diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aeca25c --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +openbox/ +openbox_1/ +include.tgz +lib.tgz +case.tgz diff --git a/case.tgz b/case.tgz deleted file mode 100644 index c89016a..0000000 Binary files a/case.tgz and /dev/null differ diff --git a/openflow/Makefile b/openflow/Makefile index e566bc1..ada5719 100644 --- a/openflow/Makefile +++ b/openflow/Makefile @@ -1,8 +1,11 @@ -CC=gcc +CC = arm-linux-gnueabihf-gcc + +CFLAGS += -I./include -L./lib + +LDLIBS = -lofp -lrule -lua -lreg -lpcap -lnet -lpthread -LDLIBS = -lofp -lrule -lua -lreg -lpcap -lnet -lpthread user_openflow:main_user_openflow.c - $(CC) -o user_openflow main_user_openflow.c $(LDLIBS) + $(CC) $(CFLAGS) -o user_openflow main_user_openflow.c $(LDLIBS) clean: rm -rf user_openflow *.o diff --git a/openflow/include.tgz b/openflow/include.tgz deleted file mode 100644 index ce2b475..0000000 Binary files a/openflow/include.tgz and /dev/null differ diff --git a/openflow/include/click/algorithm.hh b/openflow/include/click/algorithm.hh new file mode 100644 index 0000000..21f3515 --- /dev/null +++ b/openflow/include/click/algorithm.hh @@ -0,0 +1,94 @@ +#ifndef CLICK_ALGORITHM_HH +#define CLICK_ALGORITHM_HH +CLICK_DECLS + +template +inline T *find(T *begin, T *end, const T &val) +{ + while (begin < end && *begin != val) + ++begin; + return begin; +} + +template +inline const T *find(const T *begin, const T *end, const T &val) +{ + while (begin < end && *begin != val) + ++begin; + return begin; +} + +template +inline void ignore_result(T result) +{ + (void) result; +} + +/** @brief Exchange the values of @a a and @a b. + * + * The generic version constructs a temporary copy of @a a. Some + * specializations avoid this copy. */ +template +inline void click_swap(T &a, T &b) +{ + T tmp(a); + a = b; + b = tmp; +} + +/** @brief Replace @a x with a default-constructed object. + * + * Unlike @a x.clear(), this function usually frees all memory associated with + * @a x. */ +template +inline void clear_by_swap(T &x) +{ + T tmp; + click_swap(x, tmp); +} + +/** @brief Assign @a x to a copy of @a y, possibly modifying @a y. + * + * This is like @a x = @a y, except that under certain circumstances + * it can modify @a y (for example, by calling @a x.swap(@a y)). */ +template +inline void assign_consume(T &x, const V &y) +{ + x = y; +} + + +template struct do_nothing; + +/** @brief Binary function object that does nothing when called. */ +template +struct do_nothing { + typedef T first_argument_type; + typedef U second_argument_type; + typedef void result_type; + void operator()(const T &, const U &) { + } +}; + +/** @brief Unary function object that does nothing when called. */ +template +struct do_nothing { + typedef T argument_type; + typedef void result_type; + void operator()(const T &) { + } +}; + +/** @brief Function object that encapsulates operator<(). */ +template +struct less { + typedef T first_argument_type; + typedef T second_argument_type; + typedef bool result_type; + bool operator()(const T &x, const T &y) { + return x < y; + } +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/archive.hh b/openflow/include/click/archive.hh new file mode 100644 index 0000000..7093f04 --- /dev/null +++ b/openflow/include/click/archive.hh @@ -0,0 +1,76 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/archive.cc" -*- +#ifndef CLICK_ARCHIVE_HH +#define CLICK_ARCHIVE_HH +#include +#include +CLICK_DECLS +class ErrorHandler; + +/** @file + * @brief Class for handling 'ar' archives. */ + +/** @class ArchiveElement + * @brief Member of an 'ar' archive. + * + * The ArchiveElement class represents members of ar(1) archives. Click uses + * the simple ar(1) format for passing configurations with additional + * information, such as compiled packages and element maps. An archive member + * consists of a name, data, and additional metadata. Complete archives are + * represented as vectors of ArchiveElement objects. */ +struct ArchiveElement { + + String name; ///< Member name (no slashes allowed) + int date; ///< Decimal seconds since the epoch (1/1/1970) + int uid; ///< User ID of member + int gid; ///< Group ID of member + int mode; ///< File mode + String data; ///< Member contents + + /** @brief Return true iff the member should be included in an archive. */ + bool live() const { + return name; + } + + /** @brief Kill a member, preventing it from being archived. */ + void kill() { + name = String(); + } + + /** @brief Parse a string into a vector of ArchiveElement objects. + * @param str input string + * @param[out] ar archive elements + * @param errh error message receiver + * @return 0 on success, < 0 on failure */ + static int parse(const String &str, Vector &ar, + ErrorHandler *errh = 0); + + /** @brief Unparse a vector of ArchiveElement objects into a string. + * @param ar archive elements + * @param errh error message receiver + * @return archive string, suitable for parse() */ + static String unparse(const Vector &ar, + ErrorHandler *errh = 0); + + /** @brief Locate an ArchiveElement in an archive by name. + * @param ar archive elements + * @param name element name + * @return pointer to matching archive element, or 0 if none exists */ + static ArchiveElement *find(Vector &ar, const String &name) { + for (ArchiveElement *ae = ar.begin(); ae != ar.end(); ++ae) + if (ae->name == name) + return ae; + return 0; + } + + /** @overload */ + static const ArchiveElement *find(const Vector &ar, const String &name) { + for (const ArchiveElement *ae = ar.begin(); ae != ar.end(); ++ae) + if (ae->name == name) + return ae; + return 0; + } + +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/args.hh b/openflow/include/click/args.hh new file mode 100644 index 0000000..3dec217 --- /dev/null +++ b/openflow/include/click/args.hh @@ -0,0 +1,1409 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/args.cc" -*- +#ifndef CLICK_ARGS_HH +#define CLICK_ARGS_HH +#include +#include +#include +#include +#include +#if CLICK_BSDMODULE +# include +#else +# include +#endif +CLICK_DECLS +class Element; +class ErrorHandler; + +/** @class ArgContext + @brief Argument context class. + + The ArgContext class encapsulates state useful for parsing arguments: an + element context and an ErrorHandler for reporting parse errors. + + Args is derived from ArgContext. Some parser functions take an ArgContext + reference rather than an Args reference. This clarifies that the parser + function doesn't modify Args internals. Also, ArgContext objects are smaller + and quicker to construct than Args objects. +*/ +class ArgContext { public: + + /** @brief Construct an argument context. + * @param errh optional error handler */ + ArgContext(ErrorHandler *errh = 0) + : _errh(errh), _arg_keyword(0), _read_status(false) { +#if !CLICK_TOOL + _context = 0; +#endif + } + +#if !CLICK_TOOL + /** @brief Construct an argument context. + * @param context optional element context + * @param errh optional error handler */ + ArgContext(const Element *context, ErrorHandler *errh = 0) + : _context(context), _errh(errh), _arg_keyword(0), _read_status(false) { + } + + /** @brief Return the element context. */ + const Element *context() const { + return _context; + } +#endif + + /** @brief Return the associated error handler. */ + ErrorHandler *errh() const { + return _errh; + } + + /** @brief Return a prefix string associated with the current argument. + * + * If the current argument is keyword FOO, returns "FOO: ". */ + String error_prefix() const; + + /** @brief Report a parse error for the current argument. */ + void error(const char *fmt, ...) const; + + /** @brief Report a parse warning for the current argument. */ + void warning(const char *fmt, ...) const; + + /** @brief Report a message for the current argument. */ + void message(const char *fmt, ...) const; + + void xmessage(const String &anno, const String &str) const; + void xmessage(const String &anno, const char *fmt, va_list val) const; + + protected: + +#if !CLICK_TOOL + const Element *_context; +#endif + ErrorHandler *_errh; + const char *_arg_keyword; + mutable bool _read_status; + +}; + + +/** @cond never */ +template struct Args_has_enable_direct_parse { + private: + template static char test(typename X::enable_direct_parse *); + template static int test(...); + public: + enum { value = (sizeof(test(0)) == 1) }; +}; +template ::value> +struct Args_parse_helper; +template struct Args_parse_helper { + template + static inline T *slot(T &variable, A &args) { + return args.slot(variable); + } + template + static inline T *initialized_slot(T &variable, A &args) { + return args.initialized_slot(variable); + } + template + static inline bool parse(P parser, const String &str, T &s, A &args) { + return parser.parse(str, s, args); + } + template + static inline bool parse(P parser, const String &str, T1 &s1, T2 &s2, A &args) { + return parser.parse(str, s1, s2, args); + } +}; +template struct Args_parse_helper { + template + static inline T *slot(T &variable, A &) { + return &variable; + } + template + static inline T *initialized_slot(T &variable, A &) { + return &variable; + } + template + static inline bool parse(P parser, const String &str, T &s, A &args) { + return parser.direct_parse(str, s, args); + } + template + static inline bool parse(P parser, const String &str, T1 &s1, T2 &s2, A &args) { + return parser.direct_parse(str, s1, s2, args); + } +}; +/** @endcond never */ + + +/** @class Args + @brief Argument parser class. + + Args parses Click configuration strings in a type-safe manner. + + Args manages arguments and result slots. Arguments are + strings to be parsed and result slots are parsed values. + + The read() functions parse arguments into result slots. + + @code + Args args; + args.push_back("A 1"); // add argument + + int a_result; + args.read("A", a_result); // parse "A" into a result slot + @endcode + + As arguments are parsed, Args marks them off and adds new result slots. + Each result slot is paired with a variable belonging to the caller. + However, the caller's variables aren't modified until the parse + executes via complete(), consume(), or execute(). + + @code + Args args; args.push_back("A 1"); + + int a_result = 0; + args.read("A", a_result); + assert(a_result == 0); // parsed value not yet assigned + args.execute(); // this call assigns results + assert(a_result == 1); + @endcode + + If Args encounters a parse error, then execution doesn't modify + any of the caller's variables. + + @code + Args args; args.push_back("A 1, B NOT_AN_INTEGER"); + + int a_result = 0, b_result = 0; + args.read("A", a_result) // succeeds + .read("B", b_result) // fails, since B is not an integer + .execute(); + assert(a_result == 0 && b_result == 0); + @endcode + + Each read() function comes in five variants. read() reads an optional + keyword argument. read_m() reads a mandatory keyword argument: if the + argument was not supplied, Args will report a parse error. read_p() reads + an optional positional argument. If the keyword was not supplied, but a + positional argument was, that is used. read_mp() reads a mandatory + positional argument. Positional arguments are parsed in order. The fifth + variant of read() takes an integer flags argument; flags include + Args::positional, Args::mandatory, and others, such as Args::deprecated. + + The complete() execution method checks that every argument has been + successfully parsed and reports an error if not. consume() + doesn't check for completion, but removes parsed arguments from the + argument set. Execution methods return 0 on success and <0 on failure. + You can check the parse status before execution using status(). + + Args methods are designed to chain. All read() methods (and some others) + return a reference to the Args itself. It is often possible to parse a + whole set of arguments using a single temporary Args. For example: + + @code + Vector conf; + conf.push_back("A 1"); + conf.push_back("B 2"); + + int a, b; + if (Args(conf).read("A", a) + .read("B", b) + .complete() >= 0) + click_chatter("Success! a=%d, b=%d", a, b); + @endcode + + The actual work of parsing is handled by parser objects. Many + common variable types have default parsers defined by the DefaultArg + template. For example, the default parser for an integer value understands + the common textual representations of integers. You can also pass a parser + explicitly. For example: + + @code + int a, b, c; + args.read("A", a) // parse A using DefaultArg = IntArg() + .read("B", IntArg(2), b); // parse B using IntArg(2): base-2 + @endcode + + Args generally calls a parser object's parse() method with three arguments: + +
    +
  1. const String &str: The string to be parsed.
  2. +
  3. T &result: A reference to the result. The parsed value, if any, + should be stored here. (This points to storage local to Args, not to + the caller's variable.)
  4. +
  5. Args &args: A reference to the calling Args object, for error + reporting.
  6. +
+ + The parse() method should return true if the parse succeeds and false if it + fails. Type-specific error messages should be reported using methods like + args.error(). For generic errors, the parse() method can simply + return false; Args will generate a "KEYWORD: parse error" message. + + Most parsers are disciplined, meaning that they modify + result only if the parse succeeds. This doesn't matter in the + context of Args, but can matter to users who call a parse function + directly. +*/ +class Args : public ArgContext { + struct Slot; + + public: + + /** @brief Construct an argument parser. + * @param errh optional error handler */ + Args(ErrorHandler *errh = 0); + + /** @brief Construct an argument parser parsing a copy of @a conf. + * @param conf list of configuration arguments + * @param errh optional error handler */ + Args(const Vector &conf, ErrorHandler *errh = 0); + +#if !CLICK_TOOL + /** @brief Construct an argument parser. + * @param context optional element context + * @param errh optional error handler */ + Args(const Element *context, ErrorHandler *errh = 0); + + /** @brief Construct an argument parser parsing a copy of @a conf. + * @param conf list of configuration arguments + * @param context optional element context + * @param errh optional error handler */ + Args(const Vector &conf, const Element *context, + ErrorHandler *errh = 0); +#endif + + + + /** @brief Copy construct an argument parser. + * @note @a x's results are not copied. */ + Args(const Args &x); + + ~Args(); + + /** @brief Assign to a copy of @a x. + * @pre results_empty() && @a x.results_empty() */ + Args &operator=(const Args &x); + + + /** @brief Return true iff this parser has no arguments or results. */ + bool empty() const { + return (!_conf || !_conf->size()) && !_slots && _simple_slotbuf[0] == 0; + } + + /** @brief Return true iff this parser has no results. */ + bool results_empty() const { + return !_slots && _simple_slotbuf[0] == 0; + } + + + /** @brief Remove all arguments. + * @return *this */ + Args &clear() { + if (_conf) + _conf->clear(); + _kwpos.clear(); + return *this; + } + + /** @brief Bind this parser's arguments to @a conf. + * @param conf reference to new arguments + * @return *this + * @post This Args shares @a conf with the caller. + * For instance, consume() will modify @a conf. */ + Args &bind(Vector &conf); + + /** @brief Append argument @a arg to this parser. + * @return *this */ + Args &push_back(const String &arg); + + /** @brief Append arguments in the range [@a begin, @a end) to this parser. + * @return *this */ + template Args &push_back(Iter begin, Iter end) { + while (begin != end) { + push_back(*begin); + ++begin; + } + return *this; + } + + /** @brief Append the space-separated words in @a str to this parser. + * @return *this */ + Args &push_back_words(const String &str); + + /** @brief Append the comma-separated arguments in @a str to this parser. + * @return *this */ + Args &push_back_args(const String &str); + + /** @brief Reset the parse status for every argument. + * @return *this + * + * For example: + * @code + * Vector conf; conf.push_back("1"); conf.push_back("2"); + * int a, b; + * Args(conf).read_p("A", a).read_p("B", b).execute(); + * assert(a == 1 && b == 2); + * Args(conf).read_p("A", a).reset().read_p("B", b).execute(); + * assert(a == 1 && b == 1); + * @endcode + * Results are not affected. */ + Args &reset() { + reset_from(0); + return *this; + } + + + static constexpr int mandatory = 1; ///< read flag for mandatory arguments + static constexpr int positional = 2; ///< read flag for positional arguments + static constexpr int deprecated = 4; ///< read flag for deprecated arguments + static constexpr int firstmatch = 8; ///< read flag to take first matching argument + + /** @brief Read an argument using its type's default parser. + * @param keyword argument name + * @param x reference to result + * @return *this + * + * Creates a result slot for @a x and calls + * DefaultArg().parse(string, result, *this). */ + template + Args &read(const char *keyword, T &x) { + return read(keyword, 0, x); + } + template + Args &read_m(const char *keyword, T &x) { + return read(keyword, mandatory, x); + } + template + Args &read_p(const char *keyword, T &x) { + return read(keyword, positional, x); + } + template + Args &read_mp(const char *keyword, T &x) { + return read(keyword, mandatory | positional, x); + } + template + Args &read(const char *keyword, int flags, T &x) { + args_base_read(this, keyword, flags, x); + return *this; + } + + /** @brief Read an argument using the default parser, or set it to a + * default value if the argument is was not supplied. + * @param keyword argument name + * @param x reference to result + * @param default_value default value + * @return *this + * + * Creates a result slot for @a x. If @a keyword was supplied, calls + * DefaultArg().parse(string, result, this). Otherwise, assigns the + * result to @a value. */ + template + Args &read_or_set(const char *keyword, T &x, const V &default_value) { + return read_or_set(keyword, 0, x, default_value); + } + template + Args &read_or_set_p(const char *keyword, T &x, const V &default_value) { + return read_or_set(keyword, positional, x, default_value); + } + template + Args &read_or_set(const char *keyword, int flags, T &x, const V &default_value) { + args_base_read_or_set(this, keyword, flags, x, default_value); + return *this; + } + + /** @brief Read an argument using a specified parser. + * @param keyword argument name + * @param parser parser object + * @param x reference to result + * @return *this + * + * Creates a result slot for @a x and calls @a parser.parse(string, + * result, *this). */ + template + Args &read(const char *keyword, P parser, T &x) { + return read(keyword, 0, parser, x); + } + template + Args &read_m(const char *keyword, P parser, T &x) { + return read(keyword, mandatory, parser, x); + } + template + Args &read_p(const char *keyword, P parser, T &x) { + return read(keyword, positional, parser, x); + } + template + Args &read_mp(const char *keyword, P parser, T &x) { + return read(keyword, mandatory | positional, parser, x); + } + template + Args &read(const char *keyword, int flags, P parser, T &x) { + args_base_read(this, keyword, flags, parser, x); + return *this; + } + + /** @brief Read an argument using a specified parser, or set it to a + * default value if the argument is was not supplied. + * @param keyword argument name + * @param parser parser object + * @param x reference to result variable + * @param default_value default value + * @return *this + * + * Creates a result slot for @a x. If argument @a keyword was supplied, + * calls @a parser.parse(string, result, *this). Otherwise, assigns the + * result to @a default_value. */ + template + Args &read_or_set(const char *keyword, P parser, T &x, const V &default_value) { + return read_or_set(keyword, 0, parser, x, default_value); + } + template + Args &read_or_set_p(const char *keyword, P parser, T &x, const V &default_value) { + return read_or_set(keyword, positional, parser, x, default_value); + } + template + Args &read_or_set(const char *keyword, int flags, P parser, T &x, const V &default_value) { + args_base_read_or_set(this, keyword, flags, parser, x, default_value); + return *this; + } + + /** @brief Read an argument using a specified parser with two results. + * @param keyword argument name + * @param parser parser object + * @param x1 reference to first result + * @param x2 reference to second result + * @return *this + * + * Creates results for @a x1 and @a x2 and calls @a parser.parse(string, + * result1, result2, *this). */ + template + Args &read(const char *keyword, P parser, T1 &x1, T2 &x2) { + return read(keyword, 0, parser, x1, x2); + } + template + Args &read_m(const char *keyword, P parser, T1 &x1, T2 &x2) { + return read(keyword, mandatory, parser, x1, x2); + } + template + Args &read_p(const char *keyword, P parser, T1 &x1, T2 &x2) { + return read(keyword, positional, parser, x1, x2); + } + template + Args &read_mp(const char *keyword, P parser, T1 &x1, T2 &x2) { + return read(keyword, mandatory | positional, parser, x1, x2); + } + template + Args &read(const char *keyword, int flags, P parser, T1 &x1, T2 &x2) { + args_base_read(this, keyword, flags, parser, x1, x2); + return *this; + } + + /** @brief Pass an argument to a specified parser. + * @param keyword argument name + * @param parser parser object + * @return *this + * + * Calls @a parser.parse(string, *this). */ + template + Args &read_with(const char *keyword, P parser) { + return read_with(keyword, 0, parser); + } + template + Args &read_m_with(const char *keyword, P parser) { + return read_with(keyword, mandatory, parser); + } + template + Args &read_p_with(const char *keyword, P parser) { + return read_with(keyword, positional, parser); + } + template + Args &read_mp_with(const char *keyword, P parser) { + return read_with(keyword, mandatory | positional, parser); + } + template + Args &read_with(const char *keyword, int flags, P parser) { + args_base_read_with(this, keyword, flags, parser); + return *this; + } + + /** @brief Pass an argument to a specified parser. + * @param keyword argument name + * @param parser parser object + * @param x reference to result + * @return *this + * + * Creates a result slot for @a x and calls @a parser.parse(string, + * result, *this). + * + * @deprecated Use read(keyword, parser, variable) instead. */ + template + Args &read_with(const char *keyword, P parser, T &x) { + return read(keyword, parser, x); + } + template + Args &read_m_with(const char *keyword, P parser, T &x) { + return read_m(keyword, parser, x); + } + template + Args &read_p_with(const char *keyword, P parser, T &x) { + return read_p(keyword, parser, x); + } + template + Args &read_mp_with(const char *keyword, P parser, T &x) { + return read_mp(keyword, parser, x); + } + template + Args &read_with(const char *keyword, int flags, P parser, T &x) { + return read(keyword, flags, parser, x); + } + + /** @brief Pass all matching arguments to a specified parser. + * @param keyword argument name + * @param parser parser object + * @return *this + * + * Calls @a parser.parse(string, *this) zero or more times. + * + * @note The value of read_status() is true iff at least one argument + * matched and all matching arguments successfully parsed. */ + template + Args &read_all_with(const char *keyword, P parser) { + return read_all_with(keyword, 0, parser); + } + template + Args &read_all_with(const char *keyword, int flags, P parser) { + args_base_read_all_with(this, keyword, flags | firstmatch, parser); + return *this; + } + + /** @brief Pass all matching arguments to a specified parser. + * @param keyword argument name + * @param parser parser object + * @param x reference to result + * @return *this + * + * Creates a result for @a x and calls @a parser.parse(string, result, + * *this) zero or more times, once per matching argument. + * + * @note The value of read_status() is true iff at least one argument + * matched and all matching arguments successfully parsed. */ + template + Args &read_all_with(const char *keyword, P parser, T &x) { + return read_all_with(keyword, 0, parser, x); + } + template + Args &read_all_with(const char *keyword, int flags, P parser, T &x) { + args_base_read_all_with(this, keyword, flags | firstmatch, parser, x); + return *this; + } + + /** @brief Pass all matching arguments to a specified parser. + * @param keyword argument name + * @param parser parser object + * @param x reference to vector of results + * @return *this + * + * For each @a keyword argument, calls @a parser.parse(string, value, + * *this). The resulting values are collected into a vector result slot + * for @a x. + * + * @note The value of read_status() is true iff at least one argument + * matched and all matching arguments successfully parsed. */ + template + Args &read_all(const char *keyword, P parser, Vector &x) { + return read_all(keyword, 0, parser, x); + } + template + Args &read_all(const char *keyword, Vector &x) { + return read_all(keyword, 0, DefaultArg(), x); + } + template + Args &read_all(const char *keyword, int flags, P parser, Vector &x) { + args_base_read_all(this, keyword, flags | firstmatch, parser, x); + return *this; + } + template + Args &read_all(const char *keyword, int flags, Vector &x) { + return read_all(keyword, flags, DefaultArg(), x); + } + + + /** @brief Return the current parse status. */ + bool status() const { + return _status; + } + /** @brief Set @a x to the current parse status. + * @return *this */ + Args &status(bool &x) { + x = _status; + return *this; + } + /** @overload */ + const Args &status(bool &x) const { + x = _status; + return *this; + } + + /** @brief Return true iff the last read request succeeded. + * + * This function should only be called after a read. */ + bool read_status() const { + return _read_status; + } + /** @brief Set @a x to the success status of the last read request. + * + * This function should only be called after a read. */ + Args &read_status(bool &x) { + x = _read_status; + return *this; + } + /** @overload */ + const Args &read_status(bool &x) const { + x = _read_status; + return *this; + } + + + /** @brief Remove all arguments matched so far. */ + Args &strip(); + + /** @brief Assign results. + * @return 0 if the parse succeeded, <0 otherwise + * @post results_empty() + * + * Results are only assigned if status() is true (the parse is successful + * so far). Clears results as a side effect. */ + int execute(); + + /** @brief Assign results and remove matched arguments. + * @return 0 if the parse succeeded, <0 otherwise + * @post results_empty() + * + * Matched arguments are always removed. Results are only assigned if + * status() is true (the parse is successful so far). Clears results as a + * side effect. */ + int consume(); + + /** @brief Assign results if all arguments matched. + * @return 0 if the parse succeeded, <0 otherwise + * @post results_empty() + * + * Results are only assigned if status() is true (the parse is successful + * so far) and all arguments have been parsed. Clears results as a side + * effect. */ + int complete(); + + + /** @brief Create and return a result slot for @a x. + * + * If T is a trivially copyable type, such as int, then the resulting + * slot might not be initialized. */ + template + T *slot(T &x) { + if (has_trivial_copy::value) + return reinterpret_cast(simple_slot(&x, sizeof(T))); + else + return complex_slot(x); + } + + /** @brief Create and return a result slot for @a x. + * + * The resulting slot is always default-initialized. */ + template + T *initialized_slot(T &x) { + T *s = slot(x); + if (has_trivial_copy::value) + *s = T(); + return s; + } + + /** @brief Add a result that assigns @a x to @a value. + * @return *this */ + template + Args &set(T &x, const V &value) { + if (T *s = slot(x)) + *s = value; + return *this; + } + + + /** @cond never */ + template + void base_read(const char *keyword, int flags, T &variable) { + Slot *slot_status; + if (String str = find(keyword, flags, slot_status)) { + T *s = Args_parse_helper >::slot(variable, *this); + postparse(s && Args_parse_helper >::parse(DefaultArg(), str, *s, *this), slot_status); + } + } + + template + void base_read_or_set(const char *keyword, int flags, T &variable, const V &value) { + Slot *slot_status; + String str = find(keyword, flags, slot_status); + T *s = Args_parse_helper >::slot(variable, *this); + postparse(s && (str ? Args_parse_helper >::parse(DefaultArg(), str, *s, *this) : (*s = value, true)), slot_status); + } + + template + void base_read(const char *keyword, int flags, P parser, T &variable) { + Slot *slot_status; + if (String str = find(keyword, flags, slot_status)) { + T *s = Args_parse_helper

::slot(variable, *this); + postparse(s && Args_parse_helper

::parse(parser, str, *s, *this), slot_status); + } + } + + template + void base_read_or_set(const char *keyword, int flags, P parser, T &variable, const V &value) { + Slot *slot_status; + String str = find(keyword, flags, slot_status); + T *s = Args_parse_helper

::slot(variable, *this); + postparse(s && (str ? Args_parse_helper

::parse(parser, str, *s, *this) : (*s = value, true)), slot_status); + } + + template + void base_read(const char *keyword, int flags, + P parser, T1 &variable1, T2 &variable2) { + Slot *slot_status; + if (String str = find(keyword, flags, slot_status)) { + T1 *s1 = Args_parse_helper

::slot(variable1, *this); + T2 *s2 = Args_parse_helper

::slot(variable2, *this); + postparse(s1 && s2 && Args_parse_helper

::parse(parser, str, *s1, *s2, *this), slot_status); + } + } + + template + void base_read_with(const char *keyword, int flags, P parser) { + Slot *slot_status; + if (String str = find(keyword, flags, slot_status)) + postparse(parser.parse(str, *this), slot_status); + } + + template + void base_read_all_with(const char *keyword, int flags, P parser) { + Slot *slot_status; + int read_status = -1; + while (String str = find(keyword, flags, slot_status)) { + postparse(parser.parse(str, *this), slot_status); + read_status = (read_status != 0) && _read_status; + flags &= ~mandatory; + } + _read_status = (read_status == 1); + } + + template + void base_read_all_with(const char *keyword, int flags, P parser, T &variable) { + Slot *slot_status; + int read_status = -1; + T *s = Args_parse_helper

::initialized_slot(variable, *this); + while (String str = find(keyword, flags, slot_status)) { + postparse(s && Args_parse_helper

::parse(parser, str, *s, *this), slot_status); + read_status = (read_status != 0) && _read_status; + flags &= ~mandatory; + } + _read_status = (read_status == 1); + } + + template + void base_read_all(const char *keyword, int flags, P parser, Vector &variable) { + Slot *slot_status; + int read_status = -1; + Vector *s = slot(variable); + while (String str = find(keyword, flags, slot_status)) { + T sx = T(); + postparse(parser.parse(str, sx, *this), slot_status); + if (_read_status) + s->push_back(sx); + read_status = (read_status != 0) && _read_status; + flags &= ~mandatory; + } + _read_status = (read_status == 1); + } + /** @endcond never */ + + private: + + struct Slot { + Slot() { + } + virtual ~Slot() { + } + virtual void store() = 0; + Slot *_next; + }; + + struct BytesSlot : public Slot { + BytesSlot(void *ptr, size_t size) + : _ptr(ptr), _slot(new char[size]), _size(size) { + } + ~BytesSlot() { + delete[] _slot; + } + void store() { + memcpy(_ptr, _slot, _size); + } + void *_ptr; + char *_slot; + size_t _size; + }; + + template + struct SlotT : public Slot { + SlotT(T *ptr) + : _ptr(ptr) { + } + void store() { + assign_consume(*_ptr, _slot); + } + T *_ptr; + T _slot; + }; + + enum { +#if SIZEOF_VOID_P == 4 + simple_slotbuf_size = 24 +#else + simple_slotbuf_size = 48 +#endif + }; + +#if !CLICK_DEBUG_ARGS_USAGE + bool _my_conf; +#else + bool _my_conf : 1; + bool _consumed : 1; +#endif + bool _status; + uint8_t _simple_slotpos; + + Vector *_conf; + Vector _kwpos; + + Slot *_slots; + uint8_t _simple_slotbuf[simple_slotbuf_size]; + + inline void initialize(const Vector *conf); + void reset_from(int i); + + String find(const char *keyword, int flags, Slot *&slot_status); + void postparse(bool ok, Slot *slot_status); + void check_complete(); + + static inline int simple_slot_size(int size); + inline void simple_slot_info(int offset, int size, + void *&slot, void **&pointer); + void *simple_slot(void *data, size_t size); + template T *complex_slot(T &variable); + +}; + +extern const ArgContext blank_args; + + +template +struct DefaultArg { +}; + +template +T *Args::complex_slot(T &variable) +{ + if (SlotT *s = new SlotT(&variable)) { + s->_next = _slots; + _slots = s; + return &s->_slot; + } else { + error("out of memory"); + return 0; + } +} + + +/** @cond never */ +/* These functions are here because some GCC versions ignore noinline + attributes on member function templates. */ +template +void args_base_read(Args *args, const char *keyword, int flags, T &variable) + CLICK_NOINLINE; +template +void args_base_read(Args *args, const char *keyword, int flags, T &variable) +{ + args->base_read(keyword, flags, variable); +} + +template +void args_base_read_or_set(Args *args, const char *keyword, int flags, + T &variable, const V &value) CLICK_NOINLINE; +template +void args_base_read_or_set(Args *args, const char *keyword, int flags, + T &variable, const V &value) +{ + args->base_read_or_set(keyword, flags, variable, value); +} + +template +void args_base_read(Args *args, const char *keyword, int flags, + P parser, T &variable) CLICK_NOINLINE; +template +void args_base_read(Args *args, const char *keyword, int flags, + P parser, T &variable) +{ + args->base_read(keyword, flags, parser, variable); +} + +template +void args_base_read_or_set(Args *args, const char *keyword, int flags, + P parser, T &variable, const V &value) CLICK_NOINLINE; +template +void args_base_read_or_set(Args *args, const char *keyword, int flags, + P parser, T &variable, const V &value) +{ + args->base_read_or_set(keyword, flags, parser, variable, value); +} + +template +void args_base_read(Args *args, const char *keyword, int flags, + P parser, T1 &variable1, T2 &variable2) CLICK_NOINLINE; +template +void args_base_read(Args *args, const char *keyword, int flags, + P parser, T1 &variable1, T2 &variable2) +{ + args->base_read(keyword, flags, parser, variable1, variable2); +} + +template +void args_base_read_with(Args *args, const char *keyword, int flags, P parser) + CLICK_NOINLINE; +template +void args_base_read_with(Args *args, const char *keyword, int flags, P parser) +{ + args->base_read_with(keyword, flags, parser); +} + +template +void args_base_read_all_with(Args *args, const char *keyword, int flags, P parser) + CLICK_NOINLINE; +template +void args_base_read_all_with(Args *args, const char *keyword, int flags, P parser) +{ + args->base_read_all_with(keyword, flags, parser); +} + +template +void args_base_read_all_with(Args *args, const char *keyword, int flags, + P parser, T &variable) CLICK_NOINLINE; +template +void args_base_read_all_with(Args *args, const char *keyword, int flags, + P parser, T &variable) +{ + args->base_read_all_with(keyword, flags, parser, variable); +} + +template +void args_base_read_all(Args *args, const char *keyword, int flags, + P parser, Vector &variable) CLICK_NOINLINE; +template +void args_base_read_all(Args *args, const char *keyword, int flags, + P parser, Vector &variable) +{ + args->base_read_all(keyword, flags, parser, variable); +} +/** @endcond never */ + + +class NumArg { public: + enum { + status_ok = 0, + status_inval = EINVAL, + status_range = ERANGE, +#if defined(ENOTSUP) + status_notsup = ENOTSUP, +#elif defined(ENOTSUPP) + status_notsup = ENOTSUPP, +#else + status_notsup, +#endif + status_unitless + }; +}; + + +/** @class IntArg + @brief Parser class for integers. + + IntArg(@a base) reads integers in base @a base. @a base defaults to 0, + which means arguments are parsed in base 10 by default, but prefixes 0x, 0, + and 0b parse hexadecimal, octal, and binary numbers, respectively. + + Integer overflow is treated as an error. + + @sa SaturatingIntArg, BoundedIntArg */ +class IntArg : public NumArg { public: + + typedef uint32_t limb_type; + + IntArg(int b = 0) + : base(b) { + } + + const char *parse(const char *begin, const char *end, + bool is_signed, int size, + limb_type *value, int nlimb); + + template + bool parse_saturating(const String &str, V &result, const ArgContext &args = blank_args) { + constexpr bool is_signed = integer_traits::is_signed; + constexpr int nlimb = int((sizeof(V) + sizeof(limb_type) - 1) / sizeof(limb_type)); + limb_type x[nlimb]; + if (parse(str.begin(), str.end(), is_signed, int(sizeof(V)), x, nlimb) + != str.end()) + status = status_inval; + if (status && status != status_range) { + args.error("invalid number"); + return false; + } + typedef typename make_unsigned::type unsigned_v_type; + extract_integer(x, reinterpret_cast(result)); + return true; + } + + template + bool parse(const String &str, V &result, const ArgContext &args = blank_args) { + V x; + if (!parse_saturating(str, x, args) + || (status && status != status_range)) + return false; + else if (status == status_range) { + range_error(args, integer_traits::is_signed, + click_int_large_t(x)); + return false; + } else { + result = x; + return true; + } + } + + int base; + int status; + + protected: + + static const char *span(const char *begin, const char *end, + bool is_signed, int &b); + void range_error(const ArgContext &args, bool is_signed, + click_int_large_t value); + +}; + +/** @class SaturatingIntArg + @brief Parser class for integers with saturating overflow. + + SaturatingIntArg(@a base) is like IntArg(@a base), but integer overflow is + not an error; instead, the closest representable value is returned. + + @sa IntArg */ +class SaturatingIntArg : public IntArg { public: + SaturatingIntArg(int b = 0) + : IntArg(b) { + } + + template + bool parse(const String &str, V &result, const ArgContext &args = blank_args) { + return parse_saturating(str, result, args); + } +}; + +/** @class BoundedIntArg + @brief Parser class for integers with explicit bounds. + + BoundedIntArg(@a min, @a max, @a base) is like IntArg(@a base), but numbers + less than @a min or greater than @a max are treated as errors. + + @sa IntArg */ +class BoundedIntArg : public IntArg { public: + template + BoundedIntArg(T min_value, T max_value, int b = 0) + : IntArg(b), min_value(min_value), max_value(max_value) { + static_assert(integer_traits::is_integral, "BoundedIntArg argument must be integral"); + is_signed = integer_traits::is_signed; + } + + template + bool parse(const String &str, V &result, const ArgContext &args = blank_args) { + V x; + if (!IntArg::parse(str, x, args)) + return false; + else if (!check_min(typename integer_traits::max_type(x))) { + range_error(args, is_signed, min_value); + return false; + } else if (!check_max(typename integer_traits::max_type(x))) { + range_error(args, is_signed, max_value); + return false; + } else { + result = x; + return true; + } + } + + inline bool check_min(click_int_large_t x) const { + if (is_signed) + return x >= min_value; + else + return x >= 0 && click_uint_large_t(x) >= click_uint_large_t(min_value); + } + inline bool check_min(click_uint_large_t x) const { + if (is_signed) + return min_value < 0 || x >= click_uint_large_t(min_value); + else + return click_uint_large_t(x) >= click_uint_large_t(min_value); + } + inline bool check_max(click_int_large_t x) const { + if (is_signed) + return x <= max_value; + else + return x >= 0 && click_uint_large_t(x) <= click_uint_large_t(max_value); + } + inline bool check_max(click_uint_large_t x) const { + if (is_signed) + return max_value >= 0 && x <= click_uint_large_t(max_value); + else + return click_uint_large_t(x) <= click_uint_large_t(max_value); + } + + click_intmax_t min_value; + click_intmax_t max_value; + bool is_signed; +}; + +template<> struct DefaultArg : public IntArg {}; +template<> struct DefaultArg : public IntArg {}; +template<> struct DefaultArg : public IntArg {}; +template<> struct DefaultArg : public IntArg {}; +template<> struct DefaultArg : public IntArg {}; +template<> struct DefaultArg : public IntArg {}; +template<> struct DefaultArg : public IntArg {}; +template<> struct DefaultArg : public IntArg {}; +template<> struct DefaultArg : public IntArg {}; +#if HAVE_LONG_LONG +template<> struct DefaultArg : public IntArg {}; +template<> struct DefaultArg : public IntArg {}; +#endif + + +/** @class FixedPointArg + @brief Parser class for fixed-point numbers with @a b bits of fraction. */ +class FixedPointArg : public NumArg { public: + explicit FixedPointArg(int b, int exponent = 0) + : fraction_bits(b), exponent_delta(exponent) { + } + inline bool parse_saturating(const String &str, uint32_t &result, const ArgContext &args = blank_args); + bool parse(const String &str, uint32_t &result, const ArgContext &args = blank_args); + bool parse_saturating(const String &str, int32_t &result, const ArgContext &args = blank_args); + bool parse(const String &str, int32_t &result, const ArgContext &args = blank_args); + int fraction_bits; + int exponent_delta; + int status; + private: + bool underparse(const String &str, bool is_signed, uint32_t &result); +}; + +inline bool +FixedPointArg::parse_saturating(const String &str, uint32_t &result, const ArgContext &) +{ + return underparse(str, false, result); +} + +/** @class DecimalFixedPointArg + @brief Parser class for fixed-point numbers with @a d decimal digits of fraction. */ +class DecimalFixedPointArg : public NumArg { public: + DecimalFixedPointArg(int d, int exponent = 0) + : fraction_digits(d), exponent_delta(exponent) { + } + inline bool parse_saturating(const String &str, uint32_t &result, const ArgContext &args = blank_args); + bool parse(const String &str, uint32_t &result, const ArgContext &args = blank_args); + bool parse_saturating(const String &str, int32_t &result, const ArgContext &args = blank_args); + bool parse(const String &str, int32_t &result, const ArgContext &args = blank_args); + bool parse_saturating(const String &str, uint32_t &iresult, uint32_t &fresult, const ArgContext &args = blank_args); + bool parse(const String &str, uint32_t &iresult, uint32_t &fresult, const ArgContext &args = blank_args); + int fraction_digits; + int exponent_delta; + int status; + private: + bool underparse(const String &str, bool is_signed, uint32_t &result); +}; + +inline bool +DecimalFixedPointArg::parse_saturating(const String &str, uint32_t &result, const ArgContext &) +{ + return underparse(str, false, result); +} + + +#if HAVE_FLOAT_TYPES +/** @class DoubleArg + @brief Parser class for double-precision floating point numbers. */ +class DoubleArg : public NumArg { public: + DoubleArg() { + } + bool parse(const String &str, double &result, const ArgContext &args = blank_args); + int status; +}; + +template<> struct DefaultArg : public DoubleArg {}; +#endif + + +/** @class BoolArg + @brief Parser class for booleans. */ +class BoolArg { public: + static bool parse(const String &str, bool &result, const ArgContext &args = blank_args); + static String unparse(bool x) { + return String(x); + } +}; + +template<> struct DefaultArg : public BoolArg {}; + + +class UnitArg { public: + explicit UnitArg(const char *unit_def, const char *prefix_chars_def) + : units_(reinterpret_cast(unit_def)), + prefix_chars_(reinterpret_cast(prefix_chars_def)) { + } + const char *parse(const char *begin, const char *end, int &power, int &factor) const; + private: + const unsigned char *units_; + const unsigned char *prefix_chars_; + void check_units(); +}; + + +/** @class BandwidthArg + @brief Parser class for bandwidth specifications. + + Handles suffixes such as "Gbps", "k", etc. */ +class BandwidthArg : public NumArg { public: + bool parse(const String &str, uint32_t &result, const ArgContext & = blank_args); + static String unparse(uint32_t x); + int status; +}; + + +#if !CLICK_TOOL +/** @class AnnoArg + @brief Parser class for annotation specifications. */ +class AnnoArg { public: + AnnoArg(int s) + : size(s) { + } + bool parse(const String &str, int &result, const ArgContext &args = blank_args); + private: + int size; +}; +#endif + + +/** @class SecondsArg + @brief Parser class for seconds and powers thereof. + + The @a d argument is the number of digits of fraction to parse. + For example, to parse milliseconds, use SecondsArg(3). */ +class SecondsArg : public NumArg { public: + SecondsArg(int d = 0) + : fraction_digits(d) { + } + bool parse_saturating(const String &str, uint32_t &result, const ArgContext &args = blank_args); + bool parse(const String &str, uint32_t &result, const ArgContext &args = blank_args); +#if HAVE_FLOAT_TYPES + bool parse(const String &str, double &result, const ArgContext &args = blank_args); +#endif + int fraction_digits; + int status; +}; + + +/** @class AnyArg + @brief Parser class that accepts any argument. */ +class AnyArg { public: + static bool parse(const String &, const ArgContext & = blank_args) { + return true; + } + static bool parse(const String &str, String &result, const ArgContext & = blank_args) { + result = str; + return true; + } + static bool parse(const String &str, Vector &result, const ArgContext & = blank_args) { + result.push_back(str); + return true; + } +}; + + +bool cp_string(const String &str, String *result, String *rest); + +/** @class StringArg + @brief Parser class for possibly-quoted strings. */ +class StringArg { public: + static bool parse(const String &str, String &result, const ArgContext & = blank_args) { + return cp_string(str, &result, 0); + } +}; + +template<> struct DefaultArg : public StringArg {}; + + +bool cp_keyword(const String &str, String *result, String *rest); + +/** @class KeywordArg + @brief Parser class for keywords. */ +class KeywordArg { public: + static bool parse(const String &str, String &result, const ArgContext & = blank_args) { + return cp_keyword(str, &result, 0); + } +}; + + +bool cp_word(const String &str, String *result, String *rest); + +/** @class KeywordArg + @brief Parser class for words. */ +class WordArg { public: + static bool parse(const String &str, String &result, const ArgContext & = blank_args) { + return cp_word(str, &result, 0); + } +}; + + +#if CLICK_USERLEVEL || CLICK_TOOL +/** @class FilenameArg + @brief Parser class for filenames. */ +class FilenameArg { public: + static bool parse(const String &str, String &result, const ArgContext &args = blank_args); +}; +#endif + + +#if !CLICK_TOOL +/** @class ElementArg + @brief Parser class for elements. */ +class ElementArg { public: + static bool parse(const String &str, Element *&result, const ArgContext &args); +}; + +template<> struct DefaultArg : public ElementArg {}; + +/** @class ElementCastArg + @brief Parser class for elements of type @a t. */ +class ElementCastArg { public: + ElementCastArg(const char *t) + : type(t) { + } + bool parse(const String &str, Element *&result, const ArgContext &args); + template bool parse(const String &str, T *&result, const ArgContext &args) { + return parse(str, reinterpret_cast(result), args); + } + const char *type; +}; +#endif + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/array_memory.hh b/openflow/include/click/array_memory.hh new file mode 100644 index 0000000..172a72b --- /dev/null +++ b/openflow/include/click/array_memory.hh @@ -0,0 +1,121 @@ +#ifndef CLICK_ARRAY_MEMORY_HH +#define CLICK_ARRAY_MEMORY_HH 1 +#include +#include +#if HAVE_VALGRIND && HAVE_VALGRIND_MEMCHECK_H +# include +#endif +CLICK_DECLS + +template class sized_array_memory { public: + typedef char_array type; + template static type *cast(T *x) { + static_assert(sizeof(type) == s, "char_array<> size off"); + return reinterpret_cast(x); + } + template static const type *cast(const T *x) { + return reinterpret_cast(x); + } + static void fill(void *a, size_t n, const void *x) { + for (; n != 0; --n, a = (char *) a + s) + memcpy(a, x, s); + } + static void move_construct(void* a, void* x) { + memcpy(a, x, s); + } + static void copy(void *dst, const void *src, size_t n) { + if (n) + memcpy(dst, src, n * s); + } + static void move(void *dst, const void *src, size_t n) { + if (n) + memmove(dst, src, n * s); + } + static void move_onto(void *dst, const void *src, size_t n) { + if (n) + memmove(dst, src, n * s); + } + static void destroy(void *a, size_t n) { + (void) a, (void) n; + } + static void mark_noaccess(void *a, size_t n) { +#ifdef VALGRIND_MAKE_MEM_NOACCESS + VALGRIND_MAKE_MEM_NOACCESS(a, n * s); +#else + (void) a, (void) n; +#endif + } + static void mark_undefined(void *a, size_t n) { +#ifdef VALGRIND_MAKE_MEM_UNDEFINED + VALGRIND_MAKE_MEM_UNDEFINED(a, n * s); +#else + (void) a, (void) n; +#endif + } +}; + +template class typed_array_memory { public: + typedef T type; + static T *cast(T *x) { + return x; + } + static const T *cast(const T *x) { + return x; + } + static void fill(T *a, size_t n, const T *x) { + for (size_t i = 0; i != n; ++i) + new((void *) &a[i]) T(*x); + } + static void move_construct(T* a, T* x) { +#if HAVE_CXX_RVALUE_REFERENCES + new((void *) a) T(click_move(*x)); +#else + new((void *) a) T(*x); +#endif + } + static void copy(T *dst, const T *src, size_t n) { + for (size_t i = 0; i != n; ++i) + new((void *) &dst[i]) T(src[i]); + } + static void move(T *dst, const T *src, size_t n) { + if (dst > src && src + n > dst) { + for (dst += n - 1, src += n - 1; n != 0; --n, --dst, --src) { + new((void *) dst) T(*src); + src->~T(); + } + } else { + for (size_t i = 0; i != n; ++i) { + new((void *) &dst[i]) T(src[i]); + src[i].~T(); + } + } + } + static void move_onto(T *dst, const T *src, size_t n) { + if (dst > src && src + n > dst) { + for (dst += n - 1, src += n - 1; n != 0; --n, --dst, --src) { + dst->~T(); + new((void *) dst) T(*src); + } + } else { + for (size_t i = 0; i != n; ++i) { + dst[i].~T(); + new((void *) &dst[i]) T(src[i]); + } + } + } + static void destroy(T *a, size_t n) { + for (size_t i = 0; i != n; ++i) + a[i].~T(); + } + static void mark_noaccess(T *a, size_t n) { + sized_array_memory::mark_noaccess(a, n); + } + static void mark_undefined(T *a, size_t n) { + sized_array_memory::mark_undefined(a, n); + } +}; + +template class array_memory : public conditional::value, sized_array_memory, typed_array_memory > {}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/atomic.hh b/openflow/include/click/atomic.hh new file mode 100644 index 0000000..bde68ec --- /dev/null +++ b/openflow/include/click/atomic.hh @@ -0,0 +1,652 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_ATOMIC_HH +#define CLICK_ATOMIC_HH +#if CLICK_LINUXMODULE +# include +#endif +CLICK_DECLS +#if CLICK_LINUXMODULE +# if HAVE_LINUX_ASM_SYSTEM_H +# include +CLICK_CXX_PROTECT +# include +CLICK_CXX_UNPROTECT +# include +# endif +# define CLICK_ATOMIC_VAL _val.counter +#else +# define CLICK_ATOMIC_VAL _val +#endif +#if defined(__i386__) || defined(__arch_um__) || defined(__x86_64__) +# if CLICK_LINUXMODULE || HAVE_MULTITHREAD +# define CLICK_ATOMIC_X86 1 +# endif +# if (CLICK_LINUXMODULE && defined(CONFIG_SMP)) || HAVE_MULTITHREAD +# define CLICK_ATOMIC_LOCK "lock ; " +# else +# define CLICK_ATOMIC_LOCK /* nothing */ +# endif +#endif + +/** @file + * @brief An atomic 32-bit integer. + */ + +/** @class atomic_uint32_t + * @brief A 32-bit integer with support for atomic operations. + * + * The atomic_uint32_t class represents a 32-bit integer, with support for + * atomic operations. The +=, -=, &=, |=, ++, and -- operations are + * implemented using atomic instructions. There are also atomic swap(), + * fetch_and_add(), dec_and_test(), and compare_swap() operations. + * + * Because of some issues with compiler implementations, atomic_uint32_t has + * no explicit constructor; to set an atomic_uint32_t to a value, use + * operator=. + * + * The atomic_uint32_t only provides true atomic semantics when that has been + * implemented. It has been implemented in the Linux kernel, and at userlevel + * (when --enable-multithread has been defined) for x86 machines. In other + * situations, it's not truly atomic (because it doesn't need to be). + */ +class atomic_uint32_t { public: + + // No constructors because, unfortunately, GCC generates worse code. Use + // operator= instead. + + inline uint32_t value() const; + inline operator uint32_t() const; + + inline atomic_uint32_t &operator=(uint32_t x); + + inline atomic_uint32_t &operator+=(int32_t delta); + inline atomic_uint32_t &operator-=(int32_t delta); + inline atomic_uint32_t &operator|=(uint32_t mask); + inline atomic_uint32_t &operator&=(uint32_t mask); + + inline void operator++(); + inline void operator++(int); + inline void operator--(); + inline void operator--(int); + + inline uint32_t swap(uint32_t desired); + inline uint32_t fetch_and_add(uint32_t delta); + inline bool dec_and_test(); + inline uint32_t compare_swap(uint32_t expected, uint32_t desired); + inline bool compare_and_swap(uint32_t expected, uint32_t desired) CLICK_DEPRECATED; + + inline static uint32_t swap(volatile uint32_t &x, uint32_t desired); + inline static void inc(volatile uint32_t &x); + inline static bool dec_and_test(volatile uint32_t &x); + inline static uint32_t compare_swap(volatile uint32_t &x, uint32_t expected, uint32_t desired); + inline static bool compare_and_swap(volatile uint32_t &x, uint32_t expected, uint32_t desired) CLICK_DEPRECATED; + + private: + +#if CLICK_LINUXMODULE + atomic_t _val; +#elif HAVE_MULTITHREAD + volatile uint32_t _val; +#else + uint32_t _val; +#endif + +}; + +/** @brief Return the value. */ +inline uint32_t +atomic_uint32_t::value() const +{ +#if CLICK_LINUXMODULE + return atomic_read(&_val); +#else + return CLICK_ATOMIC_VAL; +#endif +} + +/** @brief Return the value. */ +inline +atomic_uint32_t::operator uint32_t() const +{ + return value(); +} + +/** @brief Set the value to @a x. */ +inline atomic_uint32_t & +atomic_uint32_t::operator=(uint32_t x) +{ +#if CLICK_LINUXMODULE + atomic_set(&_val, x); +#else + CLICK_ATOMIC_VAL = x; +#endif + return *this; +} + +/** @brief Atomically add @a delta to the value. */ +inline atomic_uint32_t & +atomic_uint32_t::operator+=(int32_t delta) +{ +#if CLICK_LINUXMODULE + atomic_add(delta, &_val); +#elif CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "addl %1,%0" + : "=m" (CLICK_ATOMIC_VAL) + : "r" (delta), "m" (CLICK_ATOMIC_VAL) + : "cc"); +#else + CLICK_ATOMIC_VAL += delta; +#endif + return *this; +} + +/** @brief Atomically subtract @a delta from the value. */ +inline atomic_uint32_t & +atomic_uint32_t::operator-=(int32_t delta) +{ +#if CLICK_LINUXMODULE + atomic_sub(delta, &_val); +#elif CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "subl %1,%0" + : "=m" (CLICK_ATOMIC_VAL) + : "r" (delta), "m" (CLICK_ATOMIC_VAL) + : "cc"); +#else + CLICK_ATOMIC_VAL -= delta; +#endif + return *this; +} + +/** @brief Atomically bitwise-or the value with @a mask. */ +inline atomic_uint32_t & +atomic_uint32_t::operator|=(uint32_t mask) +{ +#if CLICK_LINUXMODULE && HAVE_LINUX_ATOMIC_SET_MASK + atomic_set_mask(mask, &_val); +#elif CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "orl %1,%0" + : "=m" (CLICK_ATOMIC_VAL) + : "r" (mask), "m" (CLICK_ATOMIC_VAL) + : "cc"); +#elif CLICK_LINUXMODULE +# warning "using nonatomic approximation for atomic_uint32_t::operator|=" + unsigned long flags; + local_irq_save(flags); + CLICK_ATOMIC_VAL |= mask; + local_irq_restore(flags); +#else + CLICK_ATOMIC_VAL |= mask; +#endif + return *this; +} + +/** @brief Atomically bitwise-and the value with @a mask. */ +inline atomic_uint32_t & +atomic_uint32_t::operator&=(uint32_t mask) +{ +#if CLICK_LINUXMODULE && HAVE_LINUX_ATOMIC_SET_MASK + atomic_clear_mask(~mask, &_val); +#elif CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "andl %1,%0" + : "=m" (CLICK_ATOMIC_VAL) + : "r" (mask), "m" (CLICK_ATOMIC_VAL) + : "cc"); +#elif CLICK_LINUXMODULE +# warning "using nonatomic approximation for atomic_uint32_t::operator&=" + unsigned long flags; + local_irq_save(flags); + CLICK_ATOMIC_VAL &= mask; + local_irq_restore(flags); +#else + CLICK_ATOMIC_VAL &= mask; +#endif + return *this; +} + +/** @brief Atomically increment value @a x. */ +inline void +atomic_uint32_t::inc(volatile uint32_t &x) +{ +#if CLICK_LINUXMODULE + static_assert(sizeof(atomic_t) == sizeof(x), "atomic_t expected to take 32 bits."); + atomic_inc((atomic_t *) &x); +#elif CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "incl %0" + : "=m" (x) + : "m" (x) + : "cc"); +#else + x++; +#endif +} + +/** @brief Atomically increment the value. */ +inline void +atomic_uint32_t::operator++() +{ +#if CLICK_LINUXMODULE + atomic_inc(&_val); +#elif CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "incl %0" + : "=m" (CLICK_ATOMIC_VAL) + : "m" (CLICK_ATOMIC_VAL) + : "cc"); +#else + CLICK_ATOMIC_VAL++; +#endif +} + +/** @brief Atomically increment the value. */ +inline void +atomic_uint32_t::operator++(int) +{ +#if CLICK_LINUXMODULE + atomic_inc(&_val); +#elif CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "incl %0" + : "=m" (CLICK_ATOMIC_VAL) + : "m" (CLICK_ATOMIC_VAL) + : "cc"); +#else + CLICK_ATOMIC_VAL++; +#endif +} + +/** @brief Atomically decrement the value. */ +inline void +atomic_uint32_t::operator--() +{ +#if CLICK_LINUXMODULE + atomic_dec(&_val); +#elif CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "decl %0" + : "=m" (CLICK_ATOMIC_VAL) + : "m" (CLICK_ATOMIC_VAL) + : "cc"); +#else + CLICK_ATOMIC_VAL--; +#endif +} + +/** @brief Atomically decrement the value. */ +inline void +atomic_uint32_t::operator--(int) +{ +#if CLICK_LINUXMODULE + atomic_dec(&_val); +#elif CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "decl %0" + : "=m" (CLICK_ATOMIC_VAL) + : "m" (CLICK_ATOMIC_VAL) + : "cc"); +#else + CLICK_ATOMIC_VAL--; +#endif +} + +/** @brief Atomically assign the value to @a desired, returning the old value. + * + * Behaves like this, but in one atomic step: + * @code + * uint32_t actual = x; + * x = desired; + * return actual; + * @endcode + * + * Also acts as a memory barrier. */ +inline uint32_t +atomic_uint32_t::swap(volatile uint32_t &x, uint32_t desired) +{ +#if CLICK_ATOMIC_X86 + asm volatile ("xchgl %0,%1" + : "=r" (desired), "=m" (x) + : "0" (desired), "m" (x) + : "memory"); + return desired; +#elif CLICK_LINUXMODULE && defined(xchg) + return xchg(&x, desired); +#elif CLICK_LINUXMODULE +# error "need xchg for atomic_uint32_t::swap" +#else + uint32_t actual = x; + x = desired; + return actual; +#endif +} + +/** @brief Atomically assign the value to @a desired, returning the old value. + * + * Behaves like this, but in one atomic step: + * @code + * uint32_t old_value = value(); + * *this = desired; + * return old_value; + * @endcode + * + * Also acts as a memory barrier. */ +inline uint32_t +atomic_uint32_t::swap(uint32_t desired) +{ +#if CLICK_LINUXMODULE && defined(xchg) + return atomic_xchg(&_val, desired); +#elif CLICK_LINUXMODULE +# error "need xchg for atomic_uint32_t::swap" +#else + return swap(CLICK_ATOMIC_VAL, desired); +#endif +} + +/** @brief Atomically add @a delta to the value, returning the old value. + * + * Behaves like this, but in one atomic step: + * @code + * uint32_t old_value = value(); + * *this += delta; + * return old_value; + * @endcode */ +inline uint32_t +atomic_uint32_t::fetch_and_add(uint32_t delta) +{ +#if CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "xaddl %0,%1" + : "=r" (delta), "=m" (CLICK_ATOMIC_VAL) + : "0" (delta), "m" (CLICK_ATOMIC_VAL) + : "cc"); + return delta; +#elif CLICK_LINUXMODULE && HAVE_LINUX_ATOMIC_ADD_RETURN + return atomic_add_return(&_val, delta) - delta; +#elif CLICK_LINUXMODULE +# warning "using nonatomic approximation for atomic_uint32_t::fetch_and_add" + unsigned long flags; + local_irq_save(flags); + uint32_t old_value = value(); + CLICK_ATOMIC_VAL += delta; + local_irq_restore(flags); + return old_value; +#else + uint32_t old_value = value(); + CLICK_ATOMIC_VAL += delta; + return old_value; +#endif +} + +/** @brief Atomically decrement @a x, returning true if the new @a x + * is 0. + * + * Behaves like this, but in one atomic step: + * @code + * --x; + * return x == 0; + * @endcode */ +inline bool +atomic_uint32_t::dec_and_test(volatile uint32_t &x) +{ +#if CLICK_LINUXMODULE + static_assert(sizeof(atomic_t) == sizeof(x), "atomic_t expected to take 32 bits."); + return atomic_dec_and_test((atomic_t *) &x); +#elif CLICK_ATOMIC_X86 + uint8_t result; + asm volatile (CLICK_ATOMIC_LOCK "decl %0 ; sete %1" + : "=m" (x), "=qm" (result) + : "m" (x) + : "cc"); + return result; +#else + return (--x == 0); +#endif +} + +/** @brief Perform a compare-and-swap operation. + * @param x value + * @param expected test value + * @param desired new value + * @return The actual old value. If it equaled @a expected, @a x has been + * set to @a desired. + * + * Behaves like this, but in one atomic step: + * @code + * uint32_t actual = x; + * if (x == expected) + * x = desired; + * return actual; + * @endcode + * + * Also acts as a memory barrier. */ +inline uint32_t +atomic_uint32_t::compare_swap(volatile uint32_t &x, uint32_t expected, uint32_t desired) +{ +#if CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "cmpxchgl %2,%1" + : "=a" (expected), "=m" (x) + : "r" (desired), "0" (expected), "m" (x) + : "cc", "memory"); + return expected; +#elif CLICK_LINUXMODULE && defined(cmpxchg) + return cmpxchg(&x, expected, desired); +#elif CLICK_LINUXMODULE +# warning "using nonatomic approximation for atomic_uint32_t::compare_and_swap" + unsigned long flags; + local_irq_save(flags); + uint32_t actual = x; + if (actual == expected) + x = desired; + local_irq_restore(flags); + return actual; +#else + uint32_t actual = x; + if (actual == expected) + x = desired; + return actual; +#endif +} + + +/** @brief Perform a compare-and-swap operation. + * @param x value + * @param expected test value + * @param desired new value + * @return True if the old @a x equaled @a expected (in which case @a x + * was set to @a desired), false otherwise. + * @deprecated Use compare_swap instead. + * + * Behaves like this, but in one atomic step: + * @code + * uint32_t old_value = x; + * if (x == expected) + * x = desired; + * return old_value == expected; + * @endcode + * + * Also acts as a memory barrier. */ +inline bool +atomic_uint32_t::compare_and_swap(volatile uint32_t &x, uint32_t expected, uint32_t desired) +{ +#if CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "cmpxchgl %2,%0 ; sete %%al" + : "=m" (x), "=a" (expected) + : "r" (desired), "m" (x), "a" (expected) + : "cc", "memory"); + return (uint8_t) expected; +#elif CLICK_LINUXMODULE && defined(cmpxchg) + return cmpxchg(&x, expected, desired) == expected; +#elif CLICK_LINUXMODULE +# warning "using nonatomic approximation for atomic_uint32_t::compare_and_swap" + unsigned long flags; + local_irq_save(flags); + uint32_t old_value = x; + if (old_value == expected) + x = desired; + local_irq_restore(flags); + return old_value == expected; +#else + uint32_t old_value = x; + if (old_value == expected) + x = desired; + return old_value == expected; +#endif +} + +/** @brief Atomically decrement the value, returning true if the new value + * is 0. + * + * Behaves like this, but in one atomic step: + * @code + * --*this; + * return value() == 0; + * @endcode */ +inline bool +atomic_uint32_t::dec_and_test() +{ +#if CLICK_LINUXMODULE + return atomic_dec_and_test(&_val); +#elif CLICK_ATOMIC_X86 + uint8_t result; + asm volatile (CLICK_ATOMIC_LOCK "decl %0 ; sete %1" + : "=m" (CLICK_ATOMIC_VAL), "=qm" (result) + : "m" (CLICK_ATOMIC_VAL) + : "cc"); + return result; +#else + return (--CLICK_ATOMIC_VAL == 0); +#endif +} + +/** @brief Perform a compare-and-swap operation. + * @param expected test value + * @param desired new value + * @return The actual old value. If @a expected is returned, the + * value has been set to @a desired. + * + * Behaves like this, but in one atomic step: + * @code + * uint32_t actual = value(); + * if (actual == expected) + * *this = desired; + * return actual; + * @endcode + * + * Also acts as a memory barrier. */ +inline uint32_t +atomic_uint32_t::compare_swap(uint32_t expected, uint32_t desired) +{ +#if CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "cmpxchgl %2,%1" + : "=a" (expected), "=m" (CLICK_ATOMIC_VAL) + : "r" (desired), "0" (expected), "m" (CLICK_ATOMIC_VAL) + : "cc", "memory"); + return expected; +#elif CLICK_LINUXMODULE && HAVE_LINUX_ATOMIC_CMPXCHG + return atomic_cmpxchg(&_val, expected, desired); +#elif CLICK_LINUXMODULE +# warning "using nonatomic approximation for atomic_uint32_t::compare_swap" + unsigned long flags; + local_irq_save(flags); + uint32_t actual = value(); + if (actual == expected) + CLICK_ATOMIC_VAL = desired; + local_irq_restore(flags); + return actual; +#else + uint32_t actual = value(); + if (actual == expected) + CLICK_ATOMIC_VAL = desired; + return actual; +#endif +} + +/** @brief Perform a compare-and-swap operation. + * @param expected test value + * @param desired new value + * @return True if the old value equaled @a expected (in which case the + * value was set to @a desired), false otherwise. + * @deprecated Use compare_swap instead. + * + * Behaves like this, but in one atomic step: + * @code + * uint32_t old_value = value(); + * if (old_value == expected) + * *this = desired; + * return old_value == expected; + * @endcode + * + * Also acts as a memory barrier. */ +inline bool +atomic_uint32_t::compare_and_swap(uint32_t expected, uint32_t desired) +{ +#if CLICK_ATOMIC_X86 + asm volatile (CLICK_ATOMIC_LOCK "cmpxchgl %2,%0 ; sete %%al" + : "=m" (CLICK_ATOMIC_VAL), "=a" (expected) + : "r" (desired), "m" (CLICK_ATOMIC_VAL), "a" (expected) + : "cc", "memory"); + return (uint8_t) expected; +#elif CLICK_LINUXMODULE && HAVE_LINUX_ATOMIC_CMPXCHG + return atomic_cmpxchg(&_val, expected, desired) == expected; +#elif CLICK_LINUXMODULE +# warning "using nonatomic approximation for atomic_uint32_t::compare_and_swap" + unsigned long flags; + local_irq_save(flags); + uint32_t old_value = value(); + if (old_value == expected) + CLICK_ATOMIC_VAL = desired; + local_irq_restore(flags); + return old_value == expected; +#else + uint32_t old_value = value(); + if (old_value == expected) + CLICK_ATOMIC_VAL = desired; + return old_value == expected; +#endif +} + +inline uint32_t +operator+(const atomic_uint32_t &a, const atomic_uint32_t &b) +{ + return a.value() + b.value(); +} + +inline uint32_t +operator-(const atomic_uint32_t &a, const atomic_uint32_t &b) +{ + return a.value() - b.value(); +} + +inline bool +operator==(const atomic_uint32_t &a, const atomic_uint32_t &b) +{ + return a.value() == b.value(); +} + +inline bool +operator!=(const atomic_uint32_t &a, const atomic_uint32_t &b) +{ + return a.value() != b.value(); +} + +inline bool +operator>(const atomic_uint32_t &a, const atomic_uint32_t &b) +{ + return a.value() > b.value(); +} + +inline bool +operator<(const atomic_uint32_t &a, const atomic_uint32_t &b) +{ + return a.value() < b.value(); +} + +inline bool +operator>=(const atomic_uint32_t &a, const atomic_uint32_t &b) +{ + return a.value() >= b.value(); +} + +inline bool +operator<=(const atomic_uint32_t &a, const atomic_uint32_t &b) +{ + return a.value() <= b.value(); +} + +typedef atomic_uint32_t uatomic32_t; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/bighashmap.cc b/openflow/include/click/bighashmap.cc new file mode 100644 index 0000000..1d202b0 --- /dev/null +++ b/openflow/include/click/bighashmap.cc @@ -0,0 +1,19 @@ +/* + * bighashmap.{cc,hh} -- a hash table template that supports removal + * Eddie Kohler + * + * Copyright (c) 2000 Mazu Networks, Inc. + * Copyright (c) 2003 International Computer Science Institute + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, subject to the conditions + * listed in the Click LICENSE file. These conditions include: you must + * preserve this copyright notice, and you cannot mention the copyright + * holders in advertising related to the Software without their permission. + * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This + * notice is a summary of the Click LICENSE file; the license in that file is + * legally binding. + */ + +#include diff --git a/openflow/include/click/bighashmap.hh b/openflow/include/click/bighashmap.hh new file mode 100644 index 0000000..93d660f --- /dev/null +++ b/openflow/include/click/bighashmap.hh @@ -0,0 +1,7 @@ +#ifndef CLICK_BIGHASHMAP_HH +#define CLICK_BIGHASHMAP_HH + +// This file is here for compatibility only. +#include + +#endif diff --git a/openflow/include/click/bighashmap_arena.hh b/openflow/include/click/bighashmap_arena.hh new file mode 100644 index 0000000..3d4f478 --- /dev/null +++ b/openflow/include/click/bighashmap_arena.hh @@ -0,0 +1,101 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/bighashmap_arena.cc" -*- +#ifndef CLICK_BIGHASHMAP_ARENA_HH +#define CLICK_BIGHASHMAP_ARENA_HH +CLICK_DECLS + +class HashMap_Arena { public: + + HashMap_Arena(uint32_t element_size); + + void use() { _refcount++; } + void unuse(); + + bool detached() const { return _detached; } + void detach() { _detached = true; } + + void *alloc(); + void free(void *); + + private: + + struct Link { + Link *next; + }; + Link *_free; + + enum { NELEMENTS = 127 }; // not a power of 2 so we don't fall into a + // too-large bucket + char *_cur_buffer; + int _buffer_pos; + + uint32_t _element_size; + + char **_buffers; + int _nbuffers; + int _buffers_cap; + + uint32_t _refcount; + bool _detached; + + HashMap_Arena(const HashMap_Arena &); + ~HashMap_Arena(); + HashMap_Arena &operator=(const HashMap_Arena &); + + void *hard_alloc(); + + friend struct Link; // shut up, compiler + +}; + +class HashMap_ArenaFactory { public: + + HashMap_ArenaFactory(); + virtual ~HashMap_ArenaFactory(); + + static void static_initialize(); + static void static_cleanup(); + + static HashMap_Arena *get_arena(uint32_t, HashMap_ArenaFactory * =0); + virtual HashMap_Arena *get_arena_func(uint32_t); + + private: + + HashMap_Arena **_arenas[2]; + int _narenas[2]; + + static HashMap_ArenaFactory *the_factory; + +}; + +inline void +HashMap_Arena::unuse() +{ + _refcount--; + if (_refcount <= 0) + delete this; +} + +inline void * +HashMap_Arena::alloc() +{ + if (_free) { + void *ret = _free; + _free = _free->next; + return ret; + } else if (_buffer_pos > 0) { + _buffer_pos -= _element_size; + return _cur_buffer + _buffer_pos; + } else + return hard_alloc(); +} + +inline void +HashMap_Arena::free(void *v) +{ + Link *link = reinterpret_cast(v); + link->next = _free; + _free = link; +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/bigint.hh b/openflow/include/click/bigint.hh new file mode 100644 index 0000000..de00f75 --- /dev/null +++ b/openflow/include/click/bigint.hh @@ -0,0 +1,391 @@ +#ifndef CLICK_BIGINT_HH +#define CLICK_BIGINT_HH 1 +/* + * bigint.hh -- multiple-precision arithmetic + * Eddie Kohler and the authors of GMP + * + * Copyright (c) 2008 Meraki, Inc. + * Derived from the GNU Multiple Precision Arithmetic Library, which is + * Copyright (c) 2001-2008 Free Software Foundation, Inc. + * + * This source code is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * Using the interfaces provided by this file does not create a derived work. + */ +#include +#include +#include +CLICK_DECLS + +/** @file + * @brief Simple multiple-precision integer arithmetic. + */ + +/** @class Bigint + * @brief Template for multiple-precision integer arithmetic. + * + * The Bigint template provides a couple simple, but useful, functions for + * multiple-precision integer arithmetic. It is a port of a very limited + * subset of the GNU Multiple Precision Arithmetic library's mpn functionality + * (architecture-generic functions that work on unsigned integers of known + * size). + * + * A multiple-precision integer is an array of "limbs," or machine integers. + * The multiply_add() and divide() functions take arrays of limbs as + * arguments. In such arrays, the least significant limb is stored at array + * index 0. + * + * For example, here's Bigint speak for "x = 0x123_4567_89AB_CDEF * 0x45": + * @code + * // Initialize result + * uint32_t x[2] = { 0, 0 }; + * // Define multiplicand; note that least significant comes first + * uint32_t a[2] = { 0x89ABCDEF, 0x1234567 }; + * Bigint::multiply_add(x, a, 2, 0x45); + * @endcode + * + * Bigint is not optimized for speed. + * + * Bigint's template parameter is the type of a limb. Most users will use + * bigint, which is equivalent to Bigint. + */ +template +class Bigint { public: + + /** @brief Type of a limb, the unit of single arithmetic. */ + typedef L limb_type; + + /** @brief Type of an arithmetic unit no smaller than one-half limb_type. */ + typedef Lhalf half_limb_type; + + enum { + limb_bits = sizeof(limb_type) * 8, + half_limb_bits = sizeof(limb_type) * 4 + }; + enum { + limb_high_bit = limb_type(1) << (limb_bits - 1), + limb_half = limb_type(1) << half_limb_bits, + limb_low_mask = limb_half - 1, + limb_zero = limb_type(0) + }; + + /** @brief Return the less significant half of @a x. + * @invariant low(@a x) + ((limb_type) high(@a x) << half_limb_bits) == + * @a x */ + static inline half_limb_type low(limb_type x) { + return x & limb_low_mask; + } + + /** @brief Return the more significant half of @a x. */ + static inline half_limb_type high(limb_type x) { + return x >> half_limb_bits; + } + + /** @brief Add two-limb integers [@a a1,@a a0] and [@a b1,@a b0], storing + * the result in [@a x1,@a x0]. + * @param[out] x1 most significant limb of result + * @param[out] x0 least significant limb of result + * @param a1 most significant limb of addend + * @param a0 least significant limb of addend + * @param b1 most significant limb of addend + * @param b0 least significant limb of addend + * + * Handles carry in the low order limbs. */ + static void add(limb_type &x1, limb_type &x0, + limb_type a1, limb_type a0, limb_type b1, limb_type b0) { + x0 = a0 + b0; + x1 = a1 + b1 + (x0 < a0); + } + + /** @brief Multiply one-limb integers @a a and @a b, storing the result in + * [@a x1,@a x0]. + * @param[out] x1 most significant limb of result + * @param[out] x0 least significant limb of result + * @param a multiplicand + * @param b multiplicand */ + static void multiply(limb_type &x1, limb_type &x0, + limb_type a, limb_type b) { + int_multiply(a, b, x0, x1); + } + + /** @brief Multiply one-limb integer @a a by half-limb integer @a b, + * storing the result in [@a x1,@a x0]. + * @param[out] x1 most significant limb of result + * @param[out] x0 least significant limb of result + * @param a multiplicand + * @param b multiplicand */ + static void multiply_half(limb_type &x1, limb_type &x0, + limb_type a, half_limb_type b) { + if (has_fast_int_multiply::value) + multiply(x1, x0, a, b); + else { + half_limb_type al = low(a), ah = high(a); + + limb_type r0 = (limb_type) al * b; + + limb_type r1 = (limb_type) ah * b; + limb_type r2 = high(r0) + r1; + + x1 = (r2 < r1 ? limb_half : limb_zero) + high(r2); + x0 = (r2 << half_limb_bits) + low(r0); + } + } + + /** @brief Return the inverse of limb @a x. + * + * Returns the limb @a y that is the largest limb not larger than + * (2**(2*limb_bits))/@a x - (2**limb_bits). If this would yield + * overflow, @a y is the largest possible number (i.e., only ones). */ + static limb_type inverse(limb_type x) { + limb_type y1 = ~x, y0 = ~limb_zero; + + // now calculate [y1y0] / x + limb_type x1 = high(x), x0 = low(x); + limb_type q1 = y1 / x1; + limb_type r1 = y1 - q1 * x1; + limb_type m = q1 * x0; + r1 = r1 * limb_half | high(y0); + if (r1 < m) { + --q1, r1 += x; + if (r1 >= x && r1 < m) + --q1, r1 += x; + } + r1 -= m; + + limb_type q0 = r1 / x1; + limb_type r0 = r1 - q0 * x1; + m = q0 * x0; + r0 = r0 * limb_half | low(y0); + if (r0 < m) { + --q0, r0 += x; + if (r0 >= x && r0 < m) + --q0, r0 += x; + } + + return q1 * limb_half | q0; + } + + /** @brief Set @a n-limb integer @a a to the value @a b. + * @param[out] a points to @a n-limb result + * @param n number of limbs in @a a + * @param b input value + * @return carry */ + static click_uintmax_t set(limb_type *a, int n, click_uintmax_t b) { + while (n > 0) { + *a++ = b; + n--; + b >>= limb_bits; + } + return b; + } + + /** @brief Multiply @a n-limb integer @a a by 1-limb integer @a b and add + * the result to @a n-limb integer @a x. + * @param[in,out] x points to @a n-limb addend and result + * @param a points to @a n-limb multiplicand + * @param n number of limbs in @a x and @a a + * @param b 1-limb multiplicand + * @return overflow + * + * Like @a x += @a a * @a b. Both @a x and @a a must have @a n limbs. It + * is safe for @a x and @a a to point to exactly the same memory, but they + * must not otherwise overlap. */ + static limb_type multiply_add(limb_type *x, const limb_type *a, int n, + limb_type b) { + limb_type carry = 0; + do { + limb_type x0, x1; + multiply(x1, x0, *a++, b); + x0 += carry; + carry = (x0 < carry) + x1; + x0 += *x; + carry += (x0 < *x); + *x++ = x0; + } while (--n != 0); + return carry; + } + + /** @brief Multiply @a n-limb integer @a a by 1-limb integer @a b, add + * 1-limb integer @a carry, and store the result in @a n-limb integer @a x. + * @param[in,out] x points to @a n-limb result + * @param a points to @a n-limb multiplicand + * @param n number of limbs in @a x and @a a + * @param b 1-limb multiplicand + * @param carry 1-limb initial carry + * @return overflow + * + * Like @a x = (@a a * @a b) + @a carry. Both @a x and @a a must have @a + * n limbs. It is safe for @a x and @a a to point to exactly the same + * memory, but they must not otherwise overlap. */ + static limb_type multiply(limb_type *x, const limb_type *a, int n, + limb_type b, limb_type carry = 0) { + do { + limb_type x0, x1; + multiply(x1, x0, *a++, b); + x0 += carry; + carry = (x0 < carry) + x1; + *x++ = x0; + } while (--n != 0); + return carry; + } + + /** @brief Multiply @a n-limb integer @a a by 1/2-limb integer @a b, add + * 1-limb integer @a carry, and store the result in @a n-limb integer @a x. + * @param[in,out] x points to @a n-limb result + * @param a points to @a n-limb multiplicand + * @param n number of limbs in @a x and @a a + * @param b 1/2-limb multiplicand + * @param carry 1-limb initial carry + * @return overflow + * + * Like @a x = (@a a * @a b) + @a carry. Both @a x and @a a must have @a + * n limbs. It is safe for @a x and @a a to point to exactly the same + * memory, but they must not otherwise overlap. */ + static limb_type multiply_half(limb_type *x, const limb_type *a, int n, + half_limb_type b, limb_type carry = 0) { + do { + limb_type x0, x1; + multiply_half(x1, x0, *a++, b); + x0 += carry; + carry = (x0 < carry) + x1; + *x++ = x0; + } while (--n != 0); + return carry; + } + + /** @brief Divide @a n-limb integer @a a by 1-limb integer @a b and store + * the result in @a n-limb integer @a x. + * @param[out] x points to @a n-limb result + * @param a points to @a n-limb dividend + * @param n number of limbs in @a x and @a a + * @param b 1-limb divisor + * @return the remainder + * + * Like @a x = @a a / @a b. Both @a x and @a a must have @a n limbs. It + * is safe for @a x and @a a to point to exactly the same memory, but they + * must not otherwise overlap. */ + static limb_type divide(limb_type *x, const limb_type *a, int n, + limb_type b) { + x += n - 1; /* Make x point at most significant quotient limb */ + a += n - 1; /* Make a point at most significant dividend limb */ + limb_type r = 0; + + if (b & limb_high_bit) { + /* High quotient limb is 0 or 1, skip a divide step. */ + r = *a; + *x = (r >= b); + r -= (b & -*x); + --x, --a, --n; + + /* Multiply-by-inverse, divisor already normalized. */ + limb_type b_inverse = inverse(b); + while (n > 0) { + preinverted_divide(*x, r, r, *a, b, b_inverse); + --x, --a, --n; + } + + } else { + /* Most significant bit of divisor == 0. */ + /* Skip a division if high < divisor (high quotient 0). Testing + here before normalizing will still skip as often as + possible. */ + if (*a < b) { + r = *a; + *x = 0; + --x, --a, --n; + } + + if (n != 0) { + int norm = ffs_msb(b) - 1; // number of most significant 0 bits + b <<= norm; + r <<= norm; + limb_type b_inverse = inverse(b); + + limb_type a1 = *a; + r |= (a1 >> (limb_bits - norm)); + --a, --n; + while (n > 0) { + limb_type a0 = *a; + preinverted_divide(*x, r, r, ((a1 << norm) | (a0 >> (limb_bits - norm))), b, b_inverse); + --x, --a, --n; + a1 = a0; + } + preinverted_divide(*x, r, r, a1 << norm, b, b_inverse); + r >>= norm; + } + } + + return r; + } + + /** @brief Return a string representation of @a n-limb integer @a x and + * set @a x to 0. + * @param[in,out] x @a n-limb input, set to zero on output + * @param n number of limbs in @a x + * @param base base (between 2 and 36) + * @param uppercase if true, use uppercase letters for digits >= 10 */ + static String unparse_clear(limb_type *x, int n, int base = 10, bool uppercase = false) { + // need d chars, min d s.t. 10^d >= 2^(sizeof(limb_type) * 8 * n) + // == min d s.t. d >= sizeof(limb_type) * 8 * n / lg 10 + int div = (base >= 16 ? 4 : (base >= 8 ? 3 : 1)); + String s = String::make_uninitialized((n * limb_bits) / div + 1); + char *q = const_cast(s.end()); + assert(base >= 2 && base <= 36); + while (1) { + while (n > 0 && x[n - 1] == 0) + --n; + if (n == 0) + break; + int r = divide(x, x, n, base); + if (r <= 9) + *--q = '0' + r; + else if (uppercase) + *--q = 'A' + r - 10; + else + *--q = 'a' + r - 10; + } + assert(q >= s.begin()); + if (q == s.end()) + *--q = '0'; + return s.substring(q, s.end()); + } + + private: + + /* Divide the two-limb number in (a1,a0) by b, with b_inverse being the + largest limb not larger than (2**(2*limb_bits))/b - (2**limb_bits). If + this would yield overflow, b_inverse should be the largest possible + number (i.e., only ones). For correct operation, the most significant + bit of b has to be set. Put the quotient in q and the remainder in + r. */ + /* Like udiv_qrnnd_preinv, but branch-free. */ + static void preinverted_divide(limb_type &q, limb_type &r, + limb_type a1, limb_type a0, limb_type b, + limb_type b_inverse) { + limb_type a0_mask = (a0 & limb_high_bit ? ~limb_zero : limb_zero); + limb_type a0_adjusted = a0 + (b & a0_mask); + limb_type x1, x0; + multiply(x1, x0, b_inverse, a1 - a0_mask); + add(x1, x0, x1, x0, a1, a0_adjusted); + limb_type q1 = ~x1; + multiply(x1, x0, q1, b); + add(x1, x0, x1, x0, a1, a0); + x1 -= b; + r = x0 + (b & x1); + q = x1 - q1; + } + +}; + +/** @brief Typical Bigint usage with uint32_t limb_type. */ +typedef Bigint bigint; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/bitvector.hh b/openflow/include/click/bitvector.hh new file mode 100644 index 0000000..30e199c --- /dev/null +++ b/openflow/include/click/bitvector.hh @@ -0,0 +1,379 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/bitvector.cc" -*- +#ifndef CLICK_BITVECTOR_HH +#define CLICK_BITVECTOR_HH +#include +CLICK_DECLS + +/** @file + * @brief Click's bitvector class. */ + +/** @class Bitvector + @brief Vector of bits. + + The Bitvector class implements a vector of individually addressable bits. + It supports bitwise operations such as |= and &= as well as the usual + assignment and indexing operations. + + Bitvectors are stored as arrays of data words with type word_type, each + containing wbits bits. For some purposes it may be faster or easier to + manipulate data words directly. */ +class Bitvector { + public: + + class Bit; + typedef bool (Bitvector::*unspecified_bool_type)() const; + + typedef uint32_t word_type; + enum { wbits = 32, wshift = 5, wmask = 31 }; + + inline Bitvector(); + explicit inline Bitvector(int n); + explicit inline Bitvector(bool bit); + inline Bitvector(int n, bool bit); + inline Bitvector(const Bitvector &x); + inline ~Bitvector(); + + inline int size() const; + inline Bit operator[](int i); + inline bool operator[](int i) const; + inline Bit force_bit(int i); + + inline int word_size() const; + inline int max_word() const; + inline word_type *words(); + inline const word_type *words() const; + + bool zero() const; + inline operator unspecified_bool_type() const; + inline bool operator!() const; + + Bitvector &assign(int n, bool bit); + Bitvector &operator=(const Bitvector &x); + void clear(); + void resize(int n); + + friend inline bool operator==(const Bitvector &a, const Bitvector &b); + friend inline bool operator!=(const Bitvector &a, const Bitvector &b); + bool nonzero_intersection(const Bitvector &x) const; + + inline Bitvector operator~() const; + friend inline Bitvector operator&(Bitvector a, const Bitvector &b); + friend inline Bitvector operator|(Bitvector a, const Bitvector &b); + friend inline Bitvector operator^(Bitvector a, const Bitvector &b); + friend inline Bitvector operator-(Bitvector a, const Bitvector &b); + + void flip(); + inline void negate(); + Bitvector &operator&=(const Bitvector &x); + Bitvector &operator|=(const Bitvector &x); + Bitvector &operator^=(const Bitvector &x); + inline Bitvector &operator-=(const Bitvector &x); + void offset_or(const Bitvector &x, int offset); + void or_with_difference(const Bitvector &x, Bitvector &difference); + + void swap(Bitvector &x); + + /** @cond never */ + typedef word_type data_word_type CLICK_DEPRECATED; + enum { data_word_bits = wbits }; + inline word_type *data_words() CLICK_DEPRECATED; + inline const word_type *data_words() const CLICK_DEPRECATED; + /** @endcond never */ + + private: + + enum { ninline = 2, inlinebits = ninline * wbits }; + + int _max; + word_type *_data; + word_type _f[ninline]; + + void finish_copy_constructor(const Bitvector &); + inline void clear_last(); + void hard_resize(int, bool); + +}; + + +/** @class Bitvector::Bit + @brief A wrapper class that acts like a single bit. + + Bits are returned by modifiable Bitvectors' operator[]. They act like bools, + but Bit operations actually index into individual bits in some shared word. */ +class Bitvector::Bit { public: + + inline Bit(Bitvector::word_type &w, int bit_offset); + + inline operator bool() const; + + inline Bit &operator=(bool x); + inline Bit &operator=(const Bit &x); + inline void flip(); + + inline Bit &operator&=(bool x); + inline Bit &operator|=(bool x); + inline Bit &operator^=(bool x); + inline Bit &operator-=(bool x); + + private: + + Bitvector::word_type &_p; + Bitvector::word_type _mask; + +}; + + +/** @brief Construct an empty bitvector. */ +inline Bitvector::Bitvector() + : _max(-1), _data(_f) { + _f[0] = 0; +} + +/** @brief Construct an all-false bitvector with @a n elements. + @pre @a n >= 0 */ +inline Bitvector::Bitvector(int n) + : _data(_f) { + assert(n >= 0); + if (n <= inlinebits) { + _max = n - 1; + memset(_f, 0, sizeof(_f)); + } else { + _max = -1; + resize(n); + } +} + +/** @brief Construct a @a bit-valued length-1 bitvector. */ +inline Bitvector::Bitvector(bool bit) + : _max(0), _data(_f) { + _f[0] = bit; +} + +/** @brief Construct a @a bit-valued length-@a n bitvector. + @pre @a n >= 0 */ +inline Bitvector::Bitvector(int n, bool b) + : _max(-1), _data(_f) { + assign(n, b); +} + +/** @brief Construct a bitvector as a copy of @a x. */ +inline Bitvector::Bitvector(const Bitvector &x) + : _max(x._max), _data(_f) { + if (_max < inlinebits) + memcpy(_data, x._data, ninline * sizeof(word_type)); + else + finish_copy_constructor(x); +} + +/** @brief Destroy a bitvector. + + All outstanding Bit objects become invalid. */ +inline Bitvector::~Bitvector() { + if (_data != _f) + delete[] _data; +} + +/** @brief Return the number of bits in the bitvector. */ +inline int Bitvector::size() const { + return _max + 1; +} + +/** @brief Test if the bitvector contains at least one true bit. + @sa zero() */ +inline Bitvector::operator unspecified_bool_type() const { + return !zero() ? &Bitvector::zero : 0; +} + +/** @brief Test if the bitvector contains no true bits. + @sa zero() */ +inline bool Bitvector::operator!() const { + return zero(); +} + +/** @brief Return the bit at position @a i. + @pre 0 <= @a i < size() */ +inline Bitvector::Bit Bitvector::operator[](int i) { + assert(i >= 0 && i <= _max); + return Bit(_data[i>>wshift], i & wmask); +} + +/** @overload */ +inline bool Bitvector::operator[](int i) const { + assert(i >= 0 && i <= _max); + return (_data[i>>wshift] & (word_type(1) << (i & wmask))) != 0; +} + +/** @brief Return the bit at position @a i, extending if necessary. + + If @a i >= size(), then the bitvector is resize()d to length @a i+1, + which adds false bits to fill out the vector. + + @pre 0 <= @a i + @post @a i < size() */ +inline Bitvector::Bit Bitvector::force_bit(int i) { + assert(i >= 0); + if (i > _max) + resize(i + 1); + return Bit(_data[i>>wshift], i & wmask); +} + +/** @brief Return the number of valid data words. */ +inline int Bitvector::word_size() const { + return (_max + wbits) >> wshift; +} + +/** @brief Return the index of the maximum valid data word. */ +inline int Bitvector::max_word() const { + return (_max < 0 ? -1 : _max >> wshift); +} + +/** @brief Return a pointer to this bitvector's data words. */ +inline Bitvector::word_type *Bitvector::words() { + return _data; +} + +/** @overload */ +inline const Bitvector::word_type *Bitvector::words() const { + return _data; +} + +/** @cond never */ +inline Bitvector::word_type *Bitvector::data_words() { + return _data; +} +inline const Bitvector::word_type *Bitvector::data_words() const { + return _data; +} +/** @endcond never */ + +/** @brief Test bitvectors for equality. */ +inline bool operator==(const Bitvector &a, const Bitvector &b) { + return a.size() == b.size() + && memcmp(a.words(), b.words(), a.word_size() * sizeof(Bitvector::word_type)) == 0; +} + +/** @brief Test bitvectors for inequality. */ +inline bool operator!=(const Bitvector &a, const Bitvector &b) { + return !(a == b); +} + +/** @brief Modify this bitvector by bitwise subtraction with @a x. + @pre @a x.size() == size() + @return *this + + Equivalent to *this &= ~@a x. */ +inline Bitvector &Bitvector::operator-=(const Bitvector &x) { + return *this &= ~x; +} + +/** @brief Flip all bits in this bitvector. + @sa negate() */ +inline void Bitvector::negate() { + flip(); +} + +/** @brief Return the bitwise negation of this bitvector. */ +inline Bitvector Bitvector::operator~() const { + Bitvector m = *this; + m.flip(); + return m; +} + +/** @brief Return the bitwise and of two bitvectors. + @pre @a a.size() == @a b.size() */ +inline Bitvector operator&(Bitvector a, const Bitvector &b) { + return a &= b; +} + +/** @brief Return the bitwise or of two bitvectors. + @pre @a a.size() == @a b.size() */ +inline Bitvector operator|(Bitvector a, const Bitvector &b) { + return a |= b; +} + +/** @brief Return the bitwise exclusive or of two bitvectors. + @pre @a a.size() == @a b.size() */ +inline Bitvector operator^(Bitvector a, const Bitvector &b) { + return a ^= b; +} + +/** @brief Return the bitwise subtraction of two bitvectors. + @pre @a a.size() == @a b.size() + + a - b is equivalent to a & ~b. */ +inline Bitvector operator-(Bitvector a, const Bitvector &b) { + return a & ~b; +} + +inline void click_swap(Bitvector &a, Bitvector &b) { + a.swap(b); +} + +inline void assign_consume(Bitvector &a, Bitvector &b) { + a.swap(b); +} + + +/** @brief Construct a bit at offset @a bit_offset in data word @a w. */ +inline Bitvector::Bit::Bit(Bitvector::word_type &w, int bit_offset) + : _p(w), _mask(Bitvector::word_type(1) << bit_offset) { +} + +/** @brief Test if this bit is true. */ +inline Bitvector::Bit::operator bool() const { + return (_p & _mask) != 0; +} + +/** @brief Set this bit to @a x. */ +inline Bitvector::Bit &Bitvector::Bit::operator=(bool x) { + if (x) + _p |= _mask; + else + _p &= ~_mask; + return *this; +} + +/** @overload */ +inline Bitvector::Bit &Bitvector::Bit::operator=(const Bit &x) { + if (x._p & x._mask) + _p |= _mask; + else + _p &= ~_mask; + return *this; +} + +/** @brief Flip this bit. */ +inline void Bitvector::Bit::flip() { + _p ^= _mask; +} + +/** @brief Modify this bit by bitwise and with @a x. */ +inline Bitvector::Bit &Bitvector::Bit::operator&=(bool x) { + if (!x) + _p &= ~_mask; + return *this; +} + +/** @brief Modify this bit by bitwise or with @a x. */ +inline Bitvector::Bit &Bitvector::Bit::operator|=(bool x) { + if (x) + _p |= _mask; + return *this; +} + +/** @brief Modify this bit by bitwise exclusive or with @a x. */ +inline Bitvector::Bit &Bitvector::Bit::operator^=(bool x) { + if (x) + _p ^= _mask; + return *this; +} + +/** @brief Modify this bit by bitwise subtraction with @a x. */ +inline Bitvector::Bit &Bitvector::Bit::operator-=(bool x) { + if (x) + _p &= ~_mask; + return *this; +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/clp.h b/openflow/include/click/clp.h new file mode 100644 index 0000000..58c207c --- /dev/null +++ b/openflow/include/click/clp.h @@ -0,0 +1,334 @@ +/* -*- related-file-name: "../../lib/clp.c" -*- */ +#ifndef LCDF_CLP_H +#define LCDF_CLP_H +#ifdef __cplusplus +extern "C" { +#endif + +/* clp.h - Public interface to CLP. + * This file is part of CLP, the command line parser package. + * + * Copyright (c) 1997-2014 Eddie Kohler, ekohler@gmail.com + * + * CLP is free software. It is distributed under the GNU General Public + * License, Version 2, or, alternatively and at your discretion, under the + * more permissive (BSD-like) Click LICENSE file as described below. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, subject to the + * conditions listed in the Click LICENSE file, which is available in full at + * http://github.com/kohler/click/blob/master/LICENSE. The conditions + * include: you must preserve this copyright notice, and you cannot mention + * the copyright holders in advertising related to the Software without + * their permission. The Software is provided WITHOUT ANY WARRANTY, EXPRESS + * OR IMPLIED. This notice is a summary of the Click LICENSE file; the + * license in that file is binding. */ + +#include +#include + +typedef struct Clp_Option Clp_Option; +typedef struct Clp_Parser Clp_Parser; +typedef struct Clp_ParserState Clp_ParserState; + + +/** @brief Option description. + * + * CLP users declare arrays of Clp_Option structures to specify what options + * should be parsed. + * @sa Clp_NewParser, Clp_SetOptions */ +struct Clp_Option { + const char *long_name; /**< Name of long option, or NULL if the option + has no long name. */ + int short_name; /**< Character defining short option, or 0 if + the option has no short name. */ + int option_id; /**< User-specified ID defining option, + returned by Clp_Next. */ + int val_type; /**< ID of option's value type, or 0 if option + takes no value. */ + int flags; /**< Option parsing flags. */ +}; + +/** @name Value types + * These values describe the type of an option's argument and are used in + * the Clp_Option val_type field. For example, if an option took integers, its + * Clp_Option structure would have val_type set to Clp_ValInt. */ +/**@{*/ +#define Clp_NoVal 0 /**< @brief Option takes no value. */ +#define Clp_ValString 1 /**< @brief Option value is an + arbitrary string. */ +#define Clp_ValStringNotOption 2 /**< @brief Option value is a + non-option string. + + See Clp_DisallowOptions. */ +#define Clp_ValBool 3 /**< @brief Option value is a + boolean. + + Accepts "true", "false", "yes", "no", "1", and "0", or any + prefixes thereof. The match is case-insensitive. */ +#define Clp_ValInt 4 /**< @brief Option value is a + signed int. + + Accepts an optional "+" or "-" sign, followed by one or more + digits. The digits may be include a "0x" or "0X" prefix, for + a hexadecimal number, or a "0" prefix, for an octal number; + otherwise it is decimal. */ +#define Clp_ValUnsigned 5 /**< @brief Option value is an + unsigned int. + + Accepts an optional "+" sign, followed by one or more + digits. The digits may be include a "0x" or "0X" prefix, for + a hexadecimal number, or a "0" prefix, for an octal number; + otherwise it is decimal. */ +#define Clp_ValLong 6 /**< @brief Option value is a + signed long. */ +#define Clp_ValUnsignedLong 7 /**< @brief Option value is an + unsigned long. */ +#define Clp_ValDouble 8 /**< @brief Option value is a + double. + Accepts a real number as defined by strtod(). */ +#define Clp_ValFirstUser 10 /**< @brief Value types >= + Clp_ValFirstUser are available + for user types. */ +/**@}*/ + +/** @name Option flags + * These flags are used in the Clp_Option flags field. */ +/**@{*/ +#define Clp_Mandatory (1<<0) /**< @brief Option flag: value + is mandatory. + + It is an error if the option has no value. This is the + default if an option has arg_type != 0 and the Clp_Optional + flag is not provided. */ +#define Clp_Optional (1<<1) /**< @brief Option flag: value + is optional. */ +#define Clp_Negate (1<<2) /**< @brief Option flag: option + may be negated. + + --no-[long_name] will be accepted in argument lists. */ +#define Clp_OnlyNegated (1<<3) /**< @brief Option flag: option + must be negated. + + --no-[long_name] will be accepted in argument lists, but + --[long_name] will not. This is the default if long_name + begins with "no-". */ +#define Clp_PreferredMatch (1<<4) /**< @brief Option flag: prefer this + option when matching. + + Prefixes of --[long_name] should map to this option, even if + other options begin with --[long_name]. */ +/**@}*/ + +/** @name Option character types + * These flags are used in to define character types in Clp_SetOptionChar(). */ +/**@{*/ +/* Clp_NotOption 0 */ +#define Clp_Short (1<<0) /**< @brief Option character begins + a set of short options. */ +#define Clp_Long (1<<1) /**< @brief Option character begins + a long option. */ +#define Clp_ShortNegated (1<<2) /**< @brief Option character begins + a set of negated short options. */ +#define Clp_LongNegated (1<<3) /**< @brief Option character begins + a negated long option. */ +#define Clp_LongImplicit (1<<4) /**< @brief Option character can begin + a long option, and is part of that + long option. */ +/**@}*/ + +#define Clp_NotOption 0 /**< @brief Clp_Next value: argument + was not an option. */ +#define Clp_Done -1 /**< @brief Clp_Next value: there are + no more arguments. */ +#define Clp_BadOption -2 /**< @brief Clp_Next value: argument + was an erroneous option. */ +#define Clp_Error -3 /**< @brief Clp_Next value: internal + CLP error. */ + +#define Clp_ValSize 40 /**< @brief Minimum size of the + Clp_Parser val.cs field. */ +#define Clp_ValIntSize 10 /**< @brief Minimum size of the + Clp_Parser val.is field. */ + + +/** @brief A value parsing function. + * @param clp the parser + * @param vstr the value to be parsed + * @param complain if nonzero, report error messages via Clp_OptionError + * @param user_data user data passed to Clp_AddType() + * @return 1 if parsing succeeded, 0 otherwise + */ +typedef int (*Clp_ValParseFunc)(Clp_Parser *clp, const char *vstr, + int complain, void *user_data); + +/** @brief A function for reporting option errors. + * @param clp the parser + * @param message error message + */ +typedef void (*Clp_ErrorHandler)(Clp_Parser *clp, const char *message); + + +/** @brief Command line parser. + * + * A Clp_Parser object defines an instance of CLP, including allowed options, + * value types, and current arguments. + * @sa Clp_NewParser, Clp_SetOptions, Clp_SetArguments */ +struct Clp_Parser { + const Clp_Option *option; /**< The last option. */ + + int negated; /**< Whether the last option was negated. */ + + int have_val; /**< Whether the last option had a value. */ + const char *vstr; /**< The string value provided with the last + option. */ + + union { + int i; + unsigned u; + long l; + unsigned long ul; + double d; + const char *s; + void *pv; +#ifdef HAVE_INT64_TYPES + int64_t i64; + uint64_t u64; +#endif + char cs[Clp_ValSize]; + unsigned char ucs[Clp_ValSize]; + int is[Clp_ValIntSize]; + unsigned us[Clp_ValIntSize]; + } val; /**< The parsed value provided with the last + option. */ + + void *user_data; /**< Uninterpreted by CLP; users can set + arbitrarily. */ + + struct Clp_Internal *internal; +}; + +/** @cond never */ +#if __GNUC__ >= 4 +# define CLP_SENTINEL __attribute__((sentinel)) +#else +# define CLP_SENTINEL /* nothing */ +#endif +/** @endcond never */ + + +/** @brief Create a new Clp_Parser. */ +Clp_Parser *Clp_NewParser(int argc, const char * const *argv, + int nopt, const Clp_Option *opt); + +/** @brief Destroy a Clp_Parser object. */ +void Clp_DeleteParser(Clp_Parser *clp); + + +/** @brief Return @a clp's program name. */ +const char *Clp_ProgramName(Clp_Parser *clp); + +/** @brief Set @a clp's program name. */ +const char *Clp_SetProgramName(Clp_Parser *clp, const char *name); + + +/** @brief Set @a clp's error handler function. */ +Clp_ErrorHandler Clp_SetErrorHandler(Clp_Parser *clp, Clp_ErrorHandler errh); + +/** @brief Set @a clp's UTF-8 mode. */ +int Clp_SetUTF8(Clp_Parser *clp, int utf8); + +/** @brief Return @a clp's treatment of character @a c. */ +int Clp_OptionChar(Clp_Parser *clp, int c); + +/** @brief Set @a clp's treatment of character @a c. */ +int Clp_SetOptionChar(Clp_Parser *clp, int c, int type); + +/** @brief Set @a clp's option definitions. */ +int Clp_SetOptions(Clp_Parser *clp, int nopt, const Clp_Option *opt); + +/** @brief Set @a clp's arguments. */ +void Clp_SetArguments(Clp_Parser *clp, int argc, const char * const *argv); + +/** @brief Set whether @a clp is searching for options. */ +int Clp_SetOptionProcessing(Clp_Parser *clp, int on); + + +#define Clp_DisallowOptions (1<<0) /**< @brief Value type flag: value + can't be an option string. + + See Clp_AddType(). */ + +/** @brief Define a new value type for @a clp. */ +int Clp_AddType(Clp_Parser *clp, int val_type, int flags, + Clp_ValParseFunc parser, void *user_data); + + +#define Clp_AllowNumbers (1<<0) /**< @brief String list flag: allow + explicit numbers. + + See Clp_AddStringListType() and Clp_AddStringListTypeVec(). */ +#define Clp_StringListLong (1<<1) /**< @brief String list flag: values + have long type. */ + +/** @brief Define a new string list value type for @a clp. */ +int Clp_AddStringListTypeVec(Clp_Parser *clp, int val_type, int flags, + int nstrs, const char * const *strs, + const int *vals); + +/** @brief Define a new string list value type for @a clp. */ +int Clp_AddStringListType(Clp_Parser *clp, int val_type, int flags, ...) + CLP_SENTINEL; + + +/** @brief Parse and return the next argument from @a clp. */ +int Clp_Next(Clp_Parser *clp); + +/** @brief Return the next argument from @a clp without option parsing. */ +const char *Clp_Shift(Clp_Parser *clp, int allow_options); + + +/** @brief Create a new Clp_ParserState. */ +Clp_ParserState *Clp_NewParserState(void); + +/** @brief Destroy a Clp_ParserState object. */ +void Clp_DeleteParserState(Clp_ParserState *state); + +/** @brief Save @a clp's current state in @a state. */ +void Clp_SaveParser(const Clp_Parser *clp, Clp_ParserState *state); + +/** @brief Restore parser state from @a state into @a clp. */ +void Clp_RestoreParser(Clp_Parser *clp, const Clp_ParserState *state); + + +/** @brief Report a parser error. */ +int Clp_OptionError(Clp_Parser *clp, const char *format, ...); + +/** @brief Format a message. */ +int Clp_vsnprintf(Clp_Parser* clp, char* str, size_t size, + const char* format, va_list val); + +/** @brief Print a message. */ +int Clp_fprintf(Clp_Parser* clp, FILE* f, const char* format, ...); + +/** @brief Print a message. */ +int Clp_vfprintf(Clp_Parser* clp, FILE* f, const char* format, va_list val); + +/** @brief Extract the current option as a string. */ +int Clp_CurOptionNameBuf(Clp_Parser *clp, char *buf, int len); + +/** @brief Extract the current option as a string. */ +const char *Clp_CurOptionName(Clp_Parser *clp); + +/** @brief Test if the current option had long name @a name. */ +int Clp_IsLong(Clp_Parser *clp, const char *long_name); + +/** @brief Test if the current option had short name @a name. */ +int Clp_IsShort(Clp_Parser *clp, int short_name); + +#undef CLP_SENTINEL +#ifdef __cplusplus +} +#endif +#endif diff --git a/openflow/include/click/config-bsdmodule.h b/openflow/include/click/config-bsdmodule.h new file mode 100644 index 0000000..1f9ef4d --- /dev/null +++ b/openflow/include/click/config-bsdmodule.h @@ -0,0 +1,87 @@ +/* include/click/config-bsdmodule.h. Generated from config-bsdmodule.h.in by configure. */ +/* Process this file with configure to produce config-bsdmodule.h. -*- mode: c -*- */ +#ifndef CLICK_CONFIG_BSDMODULE_H +#define CLICK_CONFIG_BSDMODULE_H + +/* Define stuff under a FreeBSD module. */ +#ifndef __FreeBSD__ +# error "I must be compiled on a FreeBSD machine" +#endif + +/* Define if Click should use an adaptive scheduler to share the CPU(s) more + fairly with the kernel. */ +/* #undef HAVE_ADAPTIVE_SCHEDULER */ + +/* Define if your BSD kernel has polling extensions. */ +/* #undef HAVE_BSD_POLLING */ + +/* Define if your BSD kernel has Click extensions. */ +/* #undef HAVE_CLICK_BSD_KERNEL */ + +/* Define if 'int64_t' is typedefed to 'long' in bsdmodule. */ +/* #undef HAVE_INT64_IS_LONG_BSDMODULE */ + +/* Define if 'int64_t' is typedefed to 'long long' in bsdmodule. */ +/* #undef HAVE_INT64_IS_LONG_LONG_BSDMODULE */ + +/* Define to enable assertion checking. Failed assertions will print a message + and optionally stop the router. */ +/* #undef HAVE_KERNEL_ASSERT */ + +/* Define if NETISR scheduling should be used. */ +#define BSD_NETISRSCHED 1 + +/* The size of a `click_jiffies_t', as computed by sizeof. */ +#define SIZEOF_CLICK_JIFFIES_T SIZEOF_INT + +/* Include integer and other type definitions. */ +#include + +/* Define assert macro. */ +# ifdef __cplusplus +extern "C" { +# endif +void click_assert_failed(const char *file, int line, const char *problem_text); +# ifdef __cplusplus +} +# endif + +#ifdef HAVE_KERNEL_ASSERT +# define assert(x) ((x) ? (void)0 : click_assert_failed(__FILE__, __LINE__, #x)) +#else +# define assert(x) /* nada */ +#endif + +/* Define likely and unlikely macros. */ +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) + +/* Define HAVE_INT64_IS_LONG based on HAVE_INT64_IS_LONG_BSDMODULE. */ +#ifdef HAVE_INT64_IS_LONG_BSDMODULE +# define HAVE_INT64_IS_LONG HAVE_INT64_IS_LONG_BSDMODULE +#endif + +/* Define HAVE_INT64_IS_LONG_LONG based on HAVE_INT64_IS_LONG_LONG_BSDMODULE. */ +#if HAVE_LONG_LONG && defined(HAVE_INT64_IS_LONG_LONG_BSDMODULE) +# define HAVE_INT64_IS_LONG_LONG HAVE_INT64_IS_LONG_LONG_BSDMODULE +#endif + +#ifdef __cplusplus + +/* Declare operator new. */ +void *operator new(size_t) throw (); +void *operator new[](size_t) throw (); + +/* Provide placement new. */ +inline void *operator new(size_t, void *v) throw () { return v; } +#define HAVE_PLACEMENT_NEW 1 + +/* Define macros that surround Click declarations. */ +#define CLICK_DECLS namespace Click { +#define CLICK_ENDDECLS } +#define CLICK_USING_DECLS using namespace Click; +#define CLICK_NAME(name) ::Click::name + +#endif /* __cplusplus */ + +#endif /* CLICK_CONFIG_BSDMODULE_H */ diff --git a/openflow/include/click/config-linuxmodule.h b/openflow/include/click/config-linuxmodule.h new file mode 100644 index 0000000..522e2c4 --- /dev/null +++ b/openflow/include/click/config-linuxmodule.h @@ -0,0 +1,283 @@ +/* include/click/config-linuxmodule.h. Generated from config-linuxmodule.h.in by configure. */ +/* Process this file with configure to produce config-linuxmodule.h. -*- mode: c -*- */ +#ifndef CLICK_CONFIG_LINUXMODULE_H +#define CLICK_CONFIG_LINUXMODULE_H + +/* Define if Click should use an adaptive scheduler to share the CPU(s) more + fairly with the kernel. */ +/* #undef HAVE_ADAPTIVE_SCHEDULER */ + +/* Define if the AUTOCONF_INCLUDED symbol should be checked. */ +/* #undef HAVE_CHECK_AUTOCONF_INCLUDED */ + +/* Define if your Linux kernel has Click extensions. */ +/* #undef HAVE_CLICK_KERNEL */ + +/* Define if your Linux kernel has Click transmit notification extensions. */ +/* #undef HAVE_CLICK_KERNEL_TX_NOTIFY */ + +/* Define if your Linux kernel has Click skb_recycle. */ +/* #undef HAVE_CLICK_SKB_RECYCLE */ + +/* Define if fast checksum functions available. */ +#define HAVE_FAST_CHECKSUM 1 + +/* Define if 'int64_t' is typedefed to 'long' in linuxmodule. */ +/* #undef HAVE_INT64_IS_LONG_LINUXMODULE */ + +/* Define if 'int64_t' is typedefed to 'long long' in linuxmodule. */ +/* #undef HAVE_INT64_IS_LONG_LONG_LINUXMODULE */ + +/* Define to enable assertion checking. Failed assertions will print a message + and optionally stop the router. */ +/* #undef HAVE_KERNEL_ASSERT */ + +/* Define if you have the header file. */ +/* #undef HAVE_LINUX_ASM_ALTERNATIVE_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_LINUX_ASM_SCATTERLIST_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_LINUX_ASM_SYSTEM_H */ + +/* Define if your Linux kernel architecture defines atomic_add_return. */ +/* #undef HAVE_LINUX_ATOMIC_ADD_RETURN */ + +/* Define if your Linux kernel architecture defines atomic_set_mask. */ +/* #undef HAVE_LINUX_ATOMIC_SET_MASK */ + +/* Define if your Linux kernel architecture defines atomic_cmpxchg. */ +/* #undef HAVE_LINUX_ATOMIC_CMPXCHG */ + +/* Define if your Linux kernel has files_lock. */ +/* #undef HAVE_LINUX_FILES_LOCK */ + +/* Define if your Linux kernel has files_lglock. */ +/* #undef HAVE_LINUX_FILES_LGLOCK */ + +/* Define if you have the d_make_root function. */ +/* #undef HAVE_LINUX_D_MAKE_ROOT */ + +/* Define if 'struct dentry' has a 'd_child' member. */ +/* #undef HAVE_LINUX_DENTRY_D_CHILD */ + +/* Define if your Linux kernel has dev_ioctl. */ +/* #undef HAVE_LINUX_DEV_IOCTL */ + +/* Define if your Linux kernel has devinet_ioctl. */ +/* #undef HAVE_LINUX_DEVINET_IOCTL */ + +/* Define if your Linux kernel exports get_monotonic_coarse. */ +/* #undef HAVE_LINUX_GET_MONOTONIC_COARSE */ + +/* Define if your Linux kernel exports getboottime. */ +/* #undef HAVE_LINUX_GETBOOTTIME */ + +/* Define if your Linux kernel has inet_ctl_sock_create. */ +/* #undef HAVE_LINUX_INET_CTL_SOCK_CREATE */ + +/* Define if your Linux kernel has inet_ioctl. */ +/* #undef HAVE_LINUX_INET_IOCTL */ + +/* Define if you have the header file. */ +/* #undef HAVE_LINUX_KTIME_H */ + +/* Define if your Linux kernel exports ktime_mono_to_any. */ +/* #undef HAVE_LINUX_KTIME_MONO_TO_ANY */ + +/* Define if your Linux kernel has polling extensions. */ +/* #undef HAVE_LINUX_POLLING */ + +/* Define if your Linux kernel has read_net_skbcount. */ +/* #undef HAVE_LINUX_READ_NET_SKBCOUNT */ + +/* Define if your Linux kernel has sb_lock. */ +/* #undef HAVE_LINUX_SB_LOCK */ + +/* Define if your Linux kernel has set_cpus_allowed_ptr. */ +/* #undef HAVE_LINUX_SET_CPUS_ALLOWED_PTR */ + +/* Define if 'struct skb_shared_info' has a 'gso_size' member. */ +/* #undef HAVE_LINUX_SKB_SHINFO_GSO_SIZE */ + +/* Define if 'struct skb_shared_info' has an 'ip6_frag_id' member. */ +/* #undef HAVE_LINUX_SKB_SHINFO_IP6_FRAG_ID */ + +/* Define if 'struct skb_shared_info' has an 'tx_flags.flags' member. */ +/* #undef HAVE_LINUX_SKB_SHINFO_TX_FLAGS_UNION */ + +/* Define if 'struct skb_shared_info' has an 'tx_flags' member defining 'SKBTX_DEV_ZEROCOPY'. */ +/* #undef HAVE_LINUX_SKB_SHINFO_TX_FLAGS_SKBTX_DEV_ZEROCOPY */ + +/* Define if 'struct skb_shared_info' has a 'tso_size' member. */ +/* #undef HAVE_LINUX_SKB_SHINFO_TSO_SIZE */ + +/* Define if 'struct skb_shared_info' has a 'ufo_size' member. */ +/* #undef HAVE_LINUX_SKB_SHINFO_UFO_SIZE */ + +/* Define if 'struct sk_buff' has an 'fclone' member. */ +/* #undef HAVE_LINUX_SKBUFF_FCLONE */ + +/* Define if 'struct sk_buff' has a 'security' member. */ +/* #undef HAVE_LINUX_SKBUFF_SECURITY */ + +/* Define if your Linux kernel exposes strlen. */ +/* #undef HAVE_LINUX_STRLEN_EXPOSED */ + +/* Define if 'struct super_block' has an 's_d_op' member. */ +/* #undef HAVE_LINUX_SUPER_BLOCK_S_D_OP */ + +/* Define if your Linux kernel has tulip_interrupt_hook. */ +/* #undef HAVE_LINUX_TULIP_INTERRUPT_HOOK */ + +/* Define if the Click linuxmodule is compiled for a 2.6 or later kernel. */ +/* #undef HAVE_LINUXMODULE_2_6 */ + +/* Define if the linuxmodule driver might run multiple threads. */ +/* #undef HAVE_LINUXMODULE_MULTITHREAD */ + +/* Define if you have the net_enable_timestamp function. */ +/* #undef HAVE_NET_ENABLE_TIMESTAMP */ + +/* Define if you have the netdev_get_tx_queue function. */ +/* #undef HAVE_NETDEV_GET_TX_QUEUE */ + +/* Define if you have the netdev_uses_dsa_tags function. */ +/* #undef HAVE_NETDEV_USES_DSA_TAGS */ + +/* Define if you have the netdev_uses_trailer_tags function. */ +/* #undef HAVE_NETDEV_USES_TRAILER_TAGS */ + +/* Define if your Linux kernel has netdev_rx_handler_register. */ +/* #undef HAVE_LINUX_NETDEV_RX_HANDLER_REGISTER */ + +/* Define if netif_receive_skb takes 3 arguments. */ +/* #undef HAVE_NETIF_RECEIVE_SKB_EXTENDED */ + +/* Define if you have the netif_tx_lock function. */ +/* #undef HAVE_NETIF_TX_LOCK */ + +/* Define if you have the netif_tx_queue_frozen function. */ +/* #undef HAVE_NETIF_TX_QUEUE_FROZEN */ + +/* Define if you have the skb_dst_drop function. */ +/* #undef HAVE_SKB_DST_DROP */ + +/* Define if you have the skb_linearize function. */ +/* #undef HAVE_SKB_LINEARIZE */ + +/* Define if you have the skb_recycle function. */ +/* #undef HAVE_SKB_RECYCLE */ + +/* Define if you have the skb_recycle_check function. */ +/* #undef HAVE_SKB_RECYCLE_CHECK */ + +/* Define if you have the strnlen function. */ +#define HAVE_STRNLEN 1 + +/* Define to 1 if Linux defines the type 'uintptr_t'. */ +/* #undef HAVE_UINTPTR_T_LINUXMODULE */ + +/* The size of a `click_jiffies_t', as computed by sizeof. */ +#define SIZEOF_CLICK_JIFFIES_T SIZEOF_LONG + +/* Define HAVE_INT64_IS_LONG based on HAVE_INT64_IS_LONG_LINUXMODULE. */ +#ifdef HAVE_INT64_IS_LONG_LINUXMODULE +# define HAVE_INT64_IS_LONG HAVE_INT64_IS_LONG_LINUXMODULE +#endif + +/* Define HAVE_INT64_IS_LONG_LONG based on HAVE_INT64_IS_LONG_LONG_LINUXMODULE. */ +#if defined(HAVE_LONG_LONG) && HAVE_LONG_LONG && defined(HAVE_INT64_IS_LONG_LONG_LINUXMODULE) +# define HAVE_INT64_IS_LONG_LONG HAVE_INT64_IS_LONG_LONG_LINUXMODULE +#endif + +/* Define HAVE_MULTITHREAD based on HAVE_LINUXMODULE_MULTITHREAD. */ +#ifdef HAVE_LINUXMODULE_MULTITHREAD +# define HAVE_MULTITHREAD HAVE_LINUXMODULE_MULTITHREAD +#endif + +/* Define if fast checksum functions require correct alignment. */ +#if !defined(__i386__) && !defined(__x86_64__) +# define FAST_CHECKSUM_ALIGNED 1 +#endif + +/* Below here only for normal Click compiles. */ +#ifndef CLICK_CONFIG_LINUXMODULE_SYMBOLS_ONLY + +/* Define stuff under a Linux module. */ +#ifndef __linux__ +# error "I must be compiled on a Linux machine" +#endif +#define __KERNEL__ 1 +#define MODULE 1 + +/* Include Linux configuration and type definitions. */ +#if HAVE_CHECK_AUTOCONF_INCLUDED && !defined(AUTOCONF_INCLUDED) +# include +#endif +#include +#ifdef __cplusplus +# include +# include +# include +# include +#else +# include +# include +#endif +typedef ptrdiff_t intptr_t; +#if !HAVE_UINTPTR_T_LINUXMODULE +typedef unsigned long uintptr_t; +#endif + +/* Define KBUILD symbols. */ +#if !defined(KBUILD_STR) +# define KBUILD_STR(s) #s +# define KBUILD_BASENAME KBUILD_STR(click) +# define KBUILD_MODNAME KBUILD_STR(click) +#endif + +#ifdef __cplusplus + +/* Declare operator new. */ +void *operator new(size_t) throw (); +void *operator new[](size_t) throw (); + +/* Provide placement new. */ +inline void *operator new(size_t, void *v) { return v; } +#define HAVE_PLACEMENT_NEW 1 + +/* Define macros that surround Click declarations. */ +#define CLICK_DECLS /* */ +#define CLICK_ENDDECLS /* */ +#define CLICK_USING_DECLS /* */ +#define CLICK_NAME(name) ::name + +/* Fix incompatibilities between some Linux versions and Click/C++. */ +#include + +#endif /* __cplusplus */ + +/* Define assert macro. */ +# ifdef __cplusplus +extern "C" { +# endif +void click_assert_failed(const char *file, int line, const char *problem_text); +# ifdef __cplusplus +} +# endif + +#ifdef HAVE_KERNEL_ASSERT +# define assert(x) ((x) ? (void)0 : click_assert_failed(__FILE__, __LINE__, #x)) +#else +# define assert(x) /* nada */ +#endif + +/* Some architectures do not have builtin integer functions in kernel. */ +#if defined(__MIPSEL__) || defined(__MIPSEB__) +# define HAVE_NO_INTEGER_BUILTINS 1 +#endif + +#endif /* CLICK_CONFIG_LINUXMODULE_SYMBOLS_ONLY */ +#endif /* CLICK_CONFIG_LINUXMODULE_H */ diff --git a/openflow/include/click/config-minios.h b/openflow/include/click/config-minios.h new file mode 100644 index 0000000..dabeeb9 --- /dev/null +++ b/openflow/include/click/config-minios.h @@ -0,0 +1,215 @@ +/* include/click/config-minios.h. Generated from config-minios.h.in by configure. */ +/* Process this file with configure to produce config-minios.h. -*- mode: c -*- */ +#ifndef CLICK_CONFIG_MINIOS_H +#define CLICK_CONFIG_MINIOS_H + +/* Define if you have the header file. */ +#define HAVE_BYTESWAP_H 1 + +/* Define if you have the clock_gettime function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the declaration + of 'clock_gettime', and to 0 if you don't. */ +#define HAVE_DECL_CLOCK_GETTIME 1 + +/* Define if you have the ffs function. */ +#define HAVE_FFS 1 + +/* Define if you have the ffsl function. */ +#define HAVE_FFSL 1 + +/* Define if you have the ffsll function. */ +#define HAVE_FFSLL 1 + +/* Floating point arithmetic is allowed. */ +#define HAVE_FLOAT_TYPES 1 + +/* Define if you have the header file. */ +#define HAVE_IFADDRS_H 1 + +/* Define if 'int64_t' is typedefed to 'long' at mini-os. */ +#define HAVE_INT64_IS_LONG_MINIOS 1 + +/* Define if 'int64_t' is typedefed to 'long long' at mini-os. */ +#define HAVE_INT64_IS_LONG_LONG_MINIOS 0 + +/* Define if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if you have the mmap function. */ +#define HAVE_MMAP 1 + +/* Define if you have the header file. */ +/* #undef HAVE_NET_BPF_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_NET_IF_DL_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_NET_IF_TAP_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_NET_IF_TUN_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_NET_IF_TYPES_H */ + +/* Define if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define if you have the header file. */ +#define HAVE_NETPACKET_PACKET_H 1 + +/* Define if exists and works. */ +/* #undef HAVE_NEW_H */ + +/* Define if exists and works. */ +#define HAVE_NEW_HDR 1 + +/* Placement new is always provided below. */ +#define HAVE_PLACEMENT_NEW 1 + +/* Define if you have the random function. */ +#define HAVE_RANDOM 1 + +/* Define if you have the snprintf function. */ +#define HAVE_SNPRINTF 1 + +/* Define if you have the strerror function. */ +#define HAVE_STRERROR 1 + +/* Define if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define if you have the strnlen function. */ +#define HAVE_STRNLEN 1 + +/* Define if you have the strtof function. */ +#define HAVE_STRTOF 1 + +/* Define if you have the strtold function. */ +#define HAVE_STRTOLD 1 + +/* Define if you have the strtoul function. */ +#define HAVE_STRTOUL 1 + +/* Define if you have u_intXX_t types but not uintXX_t types. */ +/* #undef HAVE_U_INT_TYPES */ + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you have the vsnprintf function. */ +#define HAVE_VSNPRINTF 1 + +/* The size of a `click_jiffies_t', as computed by sizeof. */ +#define SIZEOF_CLICK_JIFFIES_T SIZEOF_INT + +/* The size of a `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 8 + +/* Use portable LLRPC */ +#define HAVE_PORTABLE_LLRPC 1 + +/* Set feature test macros before anything is included. */ +#if HAVE_LARGE_FILE_SUPPORT && HAVE_INT64_TYPES +# if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS != 64 +# error "bad _FILE_OFFSET_BITS, did you #include first?" +# endif +# define _LARGEFILE_SOURCE 1 +# define _FILE_OFFSET_BITS 64 +#endif +#ifdef __APPLE__ +# define _DARWIN_UNLIMITED_SELECT 1 +#endif + +/* Include integer type definitions. */ +#ifdef HAVE_INTTYPES_H +# include +#endif +#include + +/* Define uint types in terms of u_int types, if necessary. */ +#ifdef HAVE_U_INT_TYPES +typedef u_int8_t uint8_t; +typedef u_int16_t uint16_t; +typedef u_int32_t uint32_t; +# ifdef HAVE_INT64_TYPES +typedef u_int64_t uint64_t; +# endif +typedef long intptr_t; /* XXX? */ +typedef unsigned long uintptr_t; +#endif + +/* Define HAVE_INT64_IS_LONG based on HAVE_INT64_IS_LONG_MINIOS. */ +#ifdef HAVE_INT64_IS_LONG_MINIOS +# define HAVE_INT64_IS_LONG HAVE_INT64_IS_LONG_MINIOS +#endif + +/* Define HAVE_INT64_IS_LONG_LONG based on HAVE_INT64_IS_LONG_LONG_MINIOS. */ +#ifdef HAVE_INT64_IS_LONG_LONG_MINIOS +# define HAVE_INT64_IS_LONG_LONG HAVE_INT64_IS_LONG_LONG_MINIOS +#endif + +/* If 64-bit integers exist, then 64-bit divide exists. */ +#ifdef HAVE_INT64_TYPES +# define HAVE_INT64_DIVIDE 1 +#endif + +/* Define HAVE_USE_CLOCK_GETTIME if the clock_gettime function is usable. */ +#ifndef HAVE_USE_CLOCK_GETTIME +# if HAVE_DECL_CLOCK_GETTIME && HAVE_CLOCK_GETTIME +# define HAVE_USE_CLOCK_GETTIME 1 +# endif +#endif + +/* Include assert macro. */ +#include + +/* Include mini-so base header */ +#ifdef __cplusplus +extern "C"{ +#endif +#include +#ifdef __cplusplus +} +#endif + +/* Define if mmap is allowed. */ +#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MMAP) +# define ALLOW_MMAP 1 +#endif + +/* Prototype strerror if we don't have it. */ +#ifndef HAVE_STRERROR +char *strerror(int errno); +#endif + +/* Use nanosecond-granularity timestamps if they are enabled. */ +#if HAVE_NANOTIMESTAMP_ENABLED +# define TIMESTAMP_NANOSEC 1 +#endif + +#ifdef __cplusplus + +/* Provide placement new. */ +#if HAVE_NEW_HDR +# include +#elif HAVE_NEW_H +# include +#else +inline void *operator new(size_t, void *v) { return v; } +#endif + +/* Define macros that surround Click declarations. */ +#ifndef CLICK_DECLS +# define CLICK_DECLS /* */ +# define CLICK_ENDDECLS /* */ +# define CLICK_USING_DECLS /* */ +# define CLICK_NAME(name) ::name +#endif + +#endif /* __cplusplus */ + +#endif /* CLICK_CONFIG_MINIOS_H */ diff --git a/openflow/include/click/config-ns.h b/openflow/include/click/config-ns.h new file mode 100644 index 0000000..8f2d90c --- /dev/null +++ b/openflow/include/click/config-ns.h @@ -0,0 +1,23 @@ +/* include/click/config-ns.h. Generated from config-ns.h.in by configure. */ +/* Process this file with configure to produce config-ns.h. -*- mode: c -*- */ +#ifndef CLICK_CONFIG_NS_H +#define CLICK_CONFIG_NS_H + +#ifdef __cplusplus + +/* Define macros that surround Click declarations. */ +#define CLICK_DECLS namespace Click { +#define CLICK_ENDDECLS } +#define CLICK_USING_DECLS using namespace Click; +#define CLICK_NAME(name) ::Click::name + +#endif /* __cplusplus */ + +/* The ns driver probably can't use clock_gettime. */ +#define HAVE_USE_CLOCK_GETTIME 0 + +/* Include userlevel configuration. */ +#define CLICK_USERLEVEL 1 +#include + +#endif /* CLICK_CONFIG_NS_H */ diff --git a/openflow/include/click/config-userlevel.h b/openflow/include/click/config-userlevel.h new file mode 100644 index 0000000..29e480d --- /dev/null +++ b/openflow/include/click/config-userlevel.h @@ -0,0 +1,348 @@ +/* include/click/config-userlevel.h. Generated from config-userlevel.h.in by configure. */ +/* Process this file with configure to produce config-userlevel.h. -*- mode: c -*- */ +#ifndef CLICK_CONFIG_USERLEVEL_H +#define CLICK_CONFIG_USERLEVEL_H + +/* Define if you have the __thread storage class specifier. */ +#define HAVE___THREAD_STORAGE_CLASS 1 + +/* Define if accept() uses socklen_t. */ +#define HAVE_ACCEPT_SOCKLEN_T 1 + +/* Define if kqueue() may be used to wait for file descriptor events. */ +#define HAVE_ALLOW_KQUEUE 1 + +/* Define if poll() may be used to wait for file descriptor events. */ +#define HAVE_ALLOW_POLL 1 + +/* Define if select() may be used to wait for file descriptor events. */ +#define HAVE_ALLOW_SELECT 1 + +/* Define if uses bpf_timeval. */ +/* #undef HAVE_BPF_TIMEVAL */ + +/* Define if you have the header file. */ +#define HAVE_BYTESWAP_H 1 + +/* Define if you have the clock_gettime function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the declaration + of 'clock_gettime', and to 0 if you don't. */ +#define HAVE_DECL_CLOCK_GETTIME 1 + +/* Define to 1 if you have the declaration + of 'madvise', and to 0 if you don't. */ +#define HAVE_DECL_MADVISE 1 + +/* Define to 1 if you have the declaration + of 'pcap_setnonblock', and to 0 if you don't. */ +#define HAVE_DECL_PCAP_SETNONBLOCK 1 + +/* Define if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define if dynamic linking is possible. */ +#define HAVE_DYNAMIC_LINKING 1 + +/* Define if you have the header file. */ +#define HAVE_EXECINFO_H 1 + +/* Define if you have the ffs function. */ +#define HAVE_FFS 1 + +/* Define if you have the ffsl function. */ +#define HAVE_FFSL 1 + +/* Define if you have the ffsll function. */ +#define HAVE_FFSLL 1 + +/* Floating point arithmetic is allowed. */ +#define HAVE_FLOAT_TYPES 1 + +/* Define if you have the header file. */ +#define HAVE_GRP_H 1 + +/* Define if the last argument to EV_SET has pointer type. */ +/* #undef HAVE_EV_SET_UDATA_POINTER */ + +/* Define if 'struct if_data' has an 'ifi_datalen' member. */ +/* #undef HAVE_IF_DATA_IFI_DATALEN */ + +/* Define if you have the header file. */ +#define HAVE_IFADDRS_H 1 + +/* Define if 'int64_t' is typedefed to 'long' at user level. */ +/* #undef HAVE_INT64_IS_LONG_USERLEVEL */ + +/* Define if 'int64_t' is typedefed to 'long long' at user level. */ +#define HAVE_INT64_IS_LONG_LONG_USERLEVEL 1 + +/* Define if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if you have the kqueue function. */ +/* #undef HAVE_KQUEUE */ + +/* Define if your C library contains large file support. */ +#define HAVE_LARGE_FILE_SUPPORT 1 + +/* Define if you have the header file. */ +#define HAVE_LINUX_IF_TUN_H 1 + +/* Define if you have the madvise function. */ +#define HAVE_MADVISE 1 + +/* Define if you have the mmap function. */ +#define HAVE_MMAP 1 + +/* Define if you have the header file. */ +/* #undef HAVE_NET_BPF_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_NET_IF_DL_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_NET_IF_TAP_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_NET_IF_TUN_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_NET_IF_TYPES_H */ + +/* Define if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_NET_NETMAP_H */ + +/* Define if you have the header file. */ +#define HAVE_NETPACKET_PACKET_H 1 + +/* Define if exists and works. */ +/* #undef HAVE_NEW_H */ + +/* Define if exists and works. */ +#define HAVE_NEW_HDR 1 + +/* Define if you have -lpcap and pcap.h. */ +#define HAVE_PCAP 1 + +/* Define if you have the pcap_inject function. */ +#define HAVE_PCAP_INJECT 1 + +/* Define if you have the pcap_sendpacket function. */ +#define HAVE_PCAP_SENDPACKET 1 + +/* Define if you have the pcap_setdirection function. */ +#define HAVE_PCAP_SETDIRECTION 1 + +/* Define if you have the pcap_setnonblock function. */ +#define HAVE_PCAP_SETNONBLOCK 1 + +/* Define if you have the pcap_set_immediate_mode function. */ +#define HAVE_PCAP_SET_IMMEDIATE_MODE 1 + +/* Define if you have -lproper and prop.h, and proper operations should be + preferred to their non-proper counterparts. */ +/* #undef HAVE_PROPER */ + +/* Define if you have a non-emulated header file. */ +#define HAVE_POLL_H 1 + +/* Define if you have the pselect function. */ +#define HAVE_PSELECT 1 + +/* Placement new is always provided below. */ +#define HAVE_PLACEMENT_NEW 1 + +/* Define to 1 if you have the declaration + of 'pthread_setaffinity_np', and to 0 if you don't. */ +/* #undef HAVE_DECL_PTHREAD_SETAFFINITY_NP */ + +/* Define if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define if you have the random function. */ +#define HAVE_RANDOM 1 + +/* Define if you have the sigaction function. */ +#define HAVE_SIGACTION 1 + +/* Define if you have the snprintf function. */ +#define HAVE_SNPRINTF 1 + +/* Define if 'struct sockaddr_in' has a 'sin_len' member. */ +/* #undef HAVE_SOCKADDR_IN_SIN_LEN */ + +/* Define if you have the strerror function. */ +#define HAVE_STRERROR 1 + +/* Define if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define if you have the strnlen function. */ +#define HAVE_STRNLEN 1 + +/* Define if you have the strtof function. */ +#define HAVE_STRTOF 1 + +/* Define if you have the strtold function. */ +#define HAVE_STRTOLD 1 + +/* Define if you have the strtoul function. */ +#define HAVE_STRTOUL 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_EVENT_H */ + +/* Define if you have the header file. */ +#define HAVE_SYS_MMAN_H 1 + +/* Define if you have the tcgetpgrp function. */ +#define HAVE_TCGETPGRP 1 + +/* Define if you have the header file. */ +#define HAVE_TERMIO_H 1 + +/* Define if you have u_intXX_t types but not uintXX_t types. */ +/* #undef HAVE_U_INT_TYPES */ + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if a Click user-level driver might run multiple threads. */ +/* #undef HAVE_USER_MULTITHREAD */ + +/* Define if a Click user-level driver uses Intel DPDK. */ +/* #undef HAVE_DPDK */ + +/* Define if Click should use Valgrind client requests. */ +/* #undef HAVE_VALGRIND */ + +/* Define if you have the header file. */ +/* #undef HAVE_VALGRIND_MEMCHECK_H */ + +/* Define if you have the vsnprintf function. */ +#define HAVE_VSNPRINTF 1 + +/* The size of a `click_jiffies_t', as computed by sizeof. */ +#define SIZEOF_CLICK_JIFFIES_T SIZEOF_INT + +/* The size of a `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 8 + + +/* Set feature test macros before anything is included. */ +#if HAVE_LARGE_FILE_SUPPORT && HAVE_INT64_TYPES +# if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS != 64 +# error "bad _FILE_OFFSET_BITS, did you #include first?" +# endif +# define _LARGEFILE_SOURCE 1 +# define _FILE_OFFSET_BITS 64 +#endif +#ifdef __APPLE__ +# define _DARWIN_UNLIMITED_SELECT 1 +#endif + +/* Include integer type definitions. */ +#ifdef HAVE_INTTYPES_H +# include +#endif +#include + +/* Define uint types in terms of u_int types, if necessary. */ +#ifdef HAVE_U_INT_TYPES +typedef u_int8_t uint8_t; +typedef u_int16_t uint16_t; +typedef u_int32_t uint32_t; +# ifdef HAVE_INT64_TYPES +typedef u_int64_t uint64_t; +# endif +typedef long intptr_t; /* XXX? */ +typedef unsigned long uintptr_t; +#endif + +/* Define HAVE_INT64_IS_LONG based on HAVE_INT64_IS_LONG_USERLEVEL. */ +#ifdef HAVE_INT64_IS_LONG_USERLEVEL +# define HAVE_INT64_IS_LONG HAVE_INT64_IS_LONG_USERLEVEL +#endif + +/* Define HAVE_INT64_IS_LONG_LONG based on HAVE_INT64_IS_LONG_LONG_USERLEVEL. */ +#ifdef HAVE_INT64_IS_LONG_LONG_USERLEVEL +# define HAVE_INT64_IS_LONG_LONG HAVE_INT64_IS_LONG_LONG_USERLEVEL +#endif + +/* If 64-bit integers exist, then 64-bit divide exists. */ +#ifdef HAVE_INT64_TYPES +# define HAVE_INT64_DIVIDE 1 +#endif + +/* Define HAVE_MULTITHREAD based on HAVE_USER_MULTITHREAD. */ +#ifdef HAVE_USER_MULTITHREAD +# define HAVE_MULTITHREAD HAVE_USER_MULTITHREAD +#endif + +/* Define HAVE_USE_CLOCK_GETTIME if the clock_gettime function is usable. */ +#ifndef HAVE_USE_CLOCK_GETTIME +# if HAVE_DECL_CLOCK_GETTIME && HAVE_CLOCK_GETTIME +# define HAVE_USE_CLOCK_GETTIME 1 +# endif +#endif + +/* Include assert macro. */ +#include + +/* Define likely and unlikely macros. */ +#if __GNUC__ >= 3 +# define likely(x) __builtin_expect(!!(x), 1) +# define unlikely(x) __builtin_expect(!!(x), 0) +#else +# define likely(x) (x) +# define unlikely(x) (x) +#endif + +/* Define if mmap is allowed. */ +#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MMAP) +# define ALLOW_MMAP 1 +#endif + +/* Prototype strerror if we don't have it. */ +#ifndef HAVE_STRERROR +char *strerror(int errno); +#endif + +/* Use nanosecond-granularity timestamps if they are enabled. */ +#if HAVE_NANOTIMESTAMP_ENABLED +# define TIMESTAMP_NANOSEC 1 +# define HAVE_NANOTIMESTAMP 1 /* Deprecated */ +#endif + +#ifdef __cplusplus + +/* Provide placement new. */ +#if HAVE_NEW_HDR +# include +#elif HAVE_NEW_H +# include +#else +inline void *operator new(size_t, void *v) { return v; } +#endif + +/* Prototype madvise if we have it, but not the prototype. */ +#if ALLOW_MMAP && HAVE_MADVISE && !HAVE_DECL_MADVISE +extern "C" int madvise(void *addr, size_t len, int behav); +#endif + +/* Define macros that surround Click declarations. */ +#ifndef CLICK_DECLS +# define CLICK_DECLS /* */ +# define CLICK_ENDDECLS /* */ +# define CLICK_USING_DECLS /* */ +# define CLICK_NAME(name) ::name +#endif + +#endif /* __cplusplus */ + +#endif /* CLICK_CONFIG_USERLEVEL_H */ diff --git a/openflow/include/click/config.h b/openflow/include/click/config.h new file mode 100644 index 0000000..08e2fb9 --- /dev/null +++ b/openflow/include/click/config.h @@ -0,0 +1,333 @@ +/* include/click/config.h. Generated from config.h.in by configure. */ +/* Process this file with configure to produce config.h. -*- mode: c -*- */ +#ifndef CLICK_CONFIG_H +#define CLICK_CONFIG_H + +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +/* # undef __CHAR_UNSIGNED__ */ +#endif + +#define CLICK_BIG_ENDIAN 4321 +#define CLICK_LITTLE_ENDIAN 1234 +#define CLICK_NO_ENDIAN 0 + +/* Define to byte order of target machine. */ +#define CLICK_BYTE_ORDER CLICK_LITTLE_ENDIAN + +/* Define to enable debugging support for Click scheduling. */ +/* #undef CLICK_DEBUG_SCHEDULING */ + +/* Define for Click memory allocation debugging. */ +/* #undef CLICK_DMALLOC */ + +/* Define to generate smaller object files. */ +/* #undef CLICK_OPTIMIZE_SIZE */ + +/* Version number of package */ +#define CLICK_VERSION "2.1" + +/* Version number of package, in CLICK_MAKE_VERSION_CODE format */ +#define CLICK_VERSION_CODE CLICK_MAKE_VERSION_CODE(2,1,0) + +/* Define to desired statistics level. */ +#define CLICK_STATS 0 + +/* Define if PollDevice should run fast to get good benchmark numbers */ +/* #undef CLICK_WARP9 */ + +/* Define if you have the __builtin_clz function. */ +#define HAVE___BUILTIN_CLZ 1 + +/* Define if you have the __builtin_clzl function. */ +#define HAVE___BUILTIN_CLZL 1 + +/* Define if you have the __builtin_clzll function. */ +#define HAVE___BUILTIN_CLZLL 1 + +/* Define if you have the __builtin_ffs function. */ +#define HAVE___BUILTIN_FFS 1 + +/* Define if you have the __builtin_ffsl function. */ +#define HAVE___BUILTIN_FFSL 1 + +/* Define if you have the __builtin_ffsll function. */ +#define HAVE___BUILTIN_FFSLL 1 + +/* Define if you have the __has_trivial_copy compiler intrinsic. */ +#define HAVE___HAS_TRIVIAL_COPY 1 + +/* Define if you have the __sync_synchronize function. */ +#define HAVE___SYNC_SYNCHRONIZE 1 + +/* Define if the __sync_synchronize function supports arguments. */ +/* #undef HAVE___SYNC_SYNCHRONIZE_ARGUMENTS */ + +/* Define if the va_list type is addressable. */ +#define HAVE_ADDRESSABLE_VA_LIST 1 + +/* Define if right shift of signed integers acts by sign extension. */ +#define HAVE_ARITHMETIC_RIGHT_SHIFT 1 + +/* Define if Port::push/Port::pull should use bound function pointers. */ +/* #undef HAVE_BOUND_PORT_TRANSFER */ + +/* Define if the C++ compiler understands constexpr. */ +#define HAVE_CXX_CONSTEXPR 1 + +/* Define if the C++ compiler understands #pragma interface. */ +#define HAVE_CXX_PRAGMA_INTERFACE 1 + +/* Define if the C++ compiler understands rvalue references. */ +#define HAVE_CXX_RVALUE_REFERENCES 1 + +/* Define if the C++ compiler understands static_assert. */ +#define HAVE_CXX_STATIC_ASSERT 1 + +/* Define if the C++ compiler understands template alias. */ +#define HAVE_CXX_TEMPLATE_ALIAS 1 + +/* Define if the machine is indifferent to alignment. */ +#define HAVE_INDIFFERENT_ALIGNMENT 1 + +/* Define if you want to use Intel-specific instructions. */ +/* #undef HAVE_INTEL_CPU */ + +/* Define if 64-bit integer types are enabled. */ +#define HAVE_INT64_TYPES 1 + +/* Define if IPv6 support is enabled. */ +/* #undef HAVE_IP6 */ + +/* Define if IPsec support is enabled. */ +/* #undef HAVE_IPSEC */ + +/* Define to 1 if the system has the type `long long'. */ +#define HAVE_LONG_LONG 1 + +/* Define if nanosecond-granularity timestamps are enabled. */ +#define HAVE_NANOTIMESTAMP_ENABLED 1 + +/* Define if you want to use the stride scheduler. */ +#define HAVE_STRIDE_SCHED 1 + +/* Define to 1 since we have Strings. */ +#define HAVE_STRING 1 + +/* Define to 1 if the system has the type `struct timespec'. */ +#define HAVE_STRUCT_TIMESPEC 1 + +#ifdef HAVE_STRIDE_SCHED +/* Define if you want task scheduling to use a heap, not a linked list. */ +/* #undef HAVE_TASK_HEAP */ +#endif + +/* The size of a `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of a `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of a `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of a `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* The size of a `struct timespec', as computed by sizeof. */ +#define SIZEOF_STRUCT_TIMESPEC 8 + +/* The size of a `struct timeval', as computed by sizeof. */ +#define SIZEOF_STRUCT_TIMEVAL 8 + +/* The size of a `ptrdiff_t', as computed by sizeof. */ +#define SIZEOF_PTRDIFF_T 4 + +/* The size of a `void *', as computed by sizeof. */ +#define SIZEOF_VOID_P 4 + +/* Define if you want to run multithreaded Click. */ +/* #undef __MTCLICK__ */ + +/* Define inline, if necessary. C only. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define constexpr to const under C or old C++. */ +#if !defined(__cplusplus) || !HAVE_CXX_CONSTEXPR +# define constexpr const +#endif + +/* Define CLICK_DEBUG_SCHEDULING to 0 if disabled. */ +#ifndef CLICK_DEBUG_SCHEDULING +# define CLICK_DEBUG_SCHEDULING 0 +#endif + +/* Define macro for creating Click version codes (a la Linux version codes). */ +#define CLICK_MAKE_VERSION_CODE(major, minor, patch) \ + (((major) << 16) | ((minor) << 8) | (patch)) + +/* Define macro for aligning variables. */ +#if __GNUC__ +# define CLICK_ALIGNED(x) __attribute__((aligned(x))) +#else +# define CLICK_ALIGNED(x) /* nothing */ +#endif + +/* Define macro for size of a cache line. */ +#define CLICK_CACHE_LINE_SIZE 64 + +/* Define macro for the difference between 'x' and the next higher multiple + of CLICK_CACHE_LINE_SIZE (between 0 and CLICK_CACHE_LINE_SIZE - 1). */ +#define CLICK_CACHE_LINE_PAD_BYTES(x) \ + ((((x) + CLICK_CACHE_LINE_SIZE - 1) / CLICK_CACHE_LINE_SIZE) * CLICK_CACHE_LINE_SIZE - (x)) + +/* Define macro for deprecated functions. */ +#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ == 0) +# define CLICK_DEPRECATED /* nothing */ +#else +# define CLICK_DEPRECATED __attribute__((deprecated)) +#endif + +/* Define macro for deprecated functions with message. */ +#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ == 0) +# define CLICK_DEPRECATED_MSG(m) /* nothing */ +#elif __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 4) +# define CLICK_DEPRECATED_MSG(m) __attribute__((deprecated)) +#else +# define CLICK_DEPRECATED_MSG(m) __attribute__((deprecated(m))) +#endif + +/* Define macro for deprecated enumerations. */ +#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) +# define CLICK_DEPRECATED_ENUM /* nothing */ +#else +# define CLICK_DEPRECATED_ENUM __attribute__((deprecated)) +#endif + +/* Define macros for marking types as may-alias. */ +#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3) +# define CLICK_MAY_ALIAS /* nothing */ +#else +# define CLICK_MAY_ALIAS __attribute__((__may_alias__)) +#endif + +/* Define macro for marking functions noninlinable. */ +#ifdef CLICK_LINUXMODULE +# define CLICK_NOINLINE noinline +#elif __GNUC__ +# define CLICK_NOINLINE __attribute__((noinline)) +#else +# define CLICK_NOINLINE /* nothing */ +#endif + +/* Define macro for funtions that should be inline-able even if compiling without optimization. */ +#if __GNUC__ +# define CLICK_ALWAYS_INLINE __attribute__((always_inline)) +#else +# define CLICK_ALWAYS_INLINE /* nothing */ +#endif + +/* Define macros for declaring packed structures. */ +#ifdef __GNUC__ +# define CLICK_PACKED_STRUCTURE(open, close) open close __attribute__((packed)) +# define CLICK_SIZE_PACKED_STRUCTURE(open, close) open close __attribute__((packed)) /* deprecated */ +# define CLICK_SIZE_PACKED_ATTRIBUTE __attribute__((packed)) +#else +# define CLICK_PACKED_STRUCTURE(open, close) _Cannot_pack_structure__Use_GCC +# define CLICK_SIZE_PACKED_STRUCTURE(open, close) open close /* deprecated */ +# define CLICK_SIZE_PACKED_ATTRIBUTE +#endif + +/* Define macro for functions whose results should not be ignored. */ +#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) +# define CLICK_WARN_UNUSED_RESULT /* nothing */ +#else +# define CLICK_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) +#endif + +/* Define macro for cold (rarely used) functions. */ +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) +# define CLICK_COLD /* nothing */ +#else +# define CLICK_COLD __attribute__((cold)) +#endif + +/* Define ARCH_IS_BIG_ENDIAN based on CLICK_BYTE_ORDER. */ +#if CLICK_BYTE_ORDER == CLICK_BIG_ENDIAN +# define ARCH_IS_BIG_ENDIAN 1 +#elif CLICK_BYTE_ORDER == CLICK_LITTLE_ENDIAN +# define ARCH_IS_BIG_ENDIAN 0 +#endif + +/* Define macro for htons() on constants (allows htons() in switch cases). */ +#if CLICK_BYTE_ORDER == CLICK_BIG_ENDIAN +# define click_constant_htons(x) (x) +#elif CLICK_BYTE_ORDER == CLICK_LITTLE_ENDIAN +# define click_constant_htons(x) ((((x) >> 8) & 255) | (((x) & 255) << 8)) +#endif + +/* EXPORT_ELEMENT, ELEMENT_REQUIRES, ELEMENT_PROVIDES, ELEMENT_HEADER, + ELEMENT_LIBS, and ELEMENT_MT_SAFE are noops. */ +#define EXPORT_ELEMENT(x) +#define ELEMENT_REQUIRES(x) +#define ELEMENT_PROVIDES(x) +#define ELEMENT_HEADER(x) +#define ELEMENT_LIBS(x) +#define ELEMENT_MT_SAFE(x) + +/* Assume CLICK_USERLEVEL unless otherwise defined. */ +#if !defined(CLICK_USERLEVEL) && !defined(CLICK_TOOL) && !defined(CLICK_LINUXMODULE) && !defined(CLICK_BSDMODULE) && !defined(CLICK_MINIOS) +# define CLICK_USERLEVEL 1 +#endif + +/* Define stuff under a Linux module. */ +#ifdef CLICK_LINUXMODULE +# include +#endif + +/* Define stuff under a FreeBSD module. */ +#ifdef CLICK_BSDMODULE +# include +#endif + +/* Define stuff under nsclick. */ +#ifdef CLICK_NS +# include +#endif + +/* Define stuff under tools or a user-level driver. */ +#if defined(CLICK_USERLEVEL) || defined(CLICK_TOOL) +# include +#endif + +/* Define stuff under a MiniOS application. */ +#ifdef CLICK_MINIOS +# include +#endif + +/* Ensure declaration of DefaultArg template. */ +#ifdef __cplusplus +CLICK_DECLS +template struct DefaultArg; + +/** @class uninitialized_type + @brief Type tag indicating an object should not be initialized. */ +struct uninitialized_type { +}; +CLICK_ENDDECLS +#endif + +/* Define aliasing versions of integer and pointer types. */ +typedef uint16_t click_aliasable_uint16_t CLICK_MAY_ALIAS; +typedef int16_t click_aliasable_int16_t CLICK_MAY_ALIAS; +typedef uint32_t click_aliasable_uint32_t CLICK_MAY_ALIAS; +typedef int32_t click_aliasable_int32_t CLICK_MAY_ALIAS; +#if HAVE_INT64_TYPES +typedef uint64_t click_aliasable_uint64_t CLICK_MAY_ALIAS; +typedef int64_t click_aliasable_int64_t CLICK_MAY_ALIAS; +#endif +typedef void *click_aliasable_void_pointer_t CLICK_MAY_ALIAS; + +#endif /* CLICK_CONFIG_H */ diff --git a/openflow/include/click/confparse.hh b/openflow/include/click/confparse.hh new file mode 100644 index 0000000..705a08d --- /dev/null +++ b/openflow/include/click/confparse.hh @@ -0,0 +1,743 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/confparse.cc" -*- +#ifndef CLICK_CONFPARSE_HH +#define CLICK_CONFPARSE_HH +/// @cond never +#include +#include +struct in_addr; +#if HAVE_IP6 +struct in6_addr; +#endif +CLICK_DECLS +class ErrorHandler; +class StringAccum; +class Timestamp; +#ifndef CLICK_TOOL +class Element; +class Router; +class Handler; +class HandlerCall; +# define CP_VA_PARSE_ARGS_REST const Element*, ErrorHandler*, ... +# define CP_OPT_CONTEXT , const Element* context = 0 +# define CP_CONTEXT , const Element* context +# define CP_PASS_CONTEXT , context +#else +# define CP_VA_PARSE_ARGS_REST ErrorHandler*, ... +# define CP_OPT_CONTEXT +# define CP_CONTEXT +# define CP_PASS_CONTEXT +#endif +#ifndef CLICK_COMPILING_CONFPARSE_CC +# define CLICK_CONFPARSE_DEPRECATED CLICK_DEPRECATED +#else +# define CLICK_CONFPARSE_DEPRECATED /* */ +#endif +#if __GNUC__ <= 3 +# define CP_SENTINEL +#else +# define CP_SENTINEL __attribute__((sentinel)) +#endif +/// @endcond + +/// @name Argument Manipulation +//@{ +const char* cp_skip_space(const char* begin, const char* end); +const char* cp_skip_comment_space(const char* begin, const char* end); +const char* cp_skip_double_quote(const char* begin, const char* end); +bool cp_eat_space(String &str); +inline bool cp_is_space(const String &str); +bool cp_is_word(const String &str); +bool cp_is_click_id(const String &str); + +String cp_uncomment(const String &str); +String cp_unquote(const String &str); +const char* cp_process_backslash(const char* begin, const char* end, StringAccum &sa); +String cp_quote(const String &str, bool allow_newlines = false); + +void cp_argvec(const String& str, Vector& conf); +String cp_unargvec(const Vector& conf); + +void cp_spacevec(const String& str, Vector& conf); + +/// @brief Remove and return the first space-separated argument from @a str. +/// @param[in,out] str space-separated configuration string +/// +/// The first space-separated argument in the configuration string is removed +/// and returned. The returned argument is passed through cp_uncomment(). @a +/// str is set to the remaining portion of the string, with any preceding +/// spaces and comments removed. If the input string is all spaces and +/// comments, then both the returned string and @a str will be empty. +String cp_shift_spacevec(String &str); + +String cp_unspacevec(const String *begin, const String *end); +inline String cp_unspacevec(const Vector &conf); +//@} + +/// @name Direct Parsing Functions +//@{ +enum CpErrors { + CPE_OK = 0, + CPE_FORMAT, + CPE_NEGATIVE, + CPE_OVERFLOW, + CPE_INVALID, + CPE_MEMORY, + CPE_NOUNITS +}; +extern int cp_errno; + +// strings and words +bool cp_string(const String& str, String* result, String *rest = 0); +bool cp_word(const String& str, String* result, String *rest = 0); +bool cp_keyword(const String& str, String* result, String *rest = 0); + +bool cp_bool(const String& str, bool* result); + +// numbers +enum { cp_basic_integer_whole = 64 }; +const char *cp_basic_integer(const char *begin, const char *end, int flags, int size, void *result); + +inline const char *cp_integer(const char *begin, const char *end, int base, int *result); +inline const char *cp_integer(const char *begin, const char *end, int base, unsigned *result); +inline const char *cp_integer(const char *begin, const char *end, int base, long *result); +inline const char *cp_integer(const char *begin, const char *end, int base, unsigned long *result); +/// @cond never +inline const unsigned char *cp_integer(const unsigned char *begin, const unsigned char *end, int base, unsigned *result); +inline const unsigned char *cp_integer(const unsigned char *begin, const unsigned char *end, int base, unsigned long *result); +/// @endcond +#if HAVE_LONG_LONG +inline const char *cp_integer(const char *begin, const char *end, int base, long long *result); +inline const char *cp_integer(const char *begin, const char *end, int base, unsigned long long *result); +/// @cond never +inline const unsigned char *cp_integer(const unsigned char *begin, const unsigned char *end, int base, unsigned long long *result); +/// @endcond +#elif HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG +inline const char *cp_integer(const char *begin, const char *end, int base, int64_t *result); +inline const char *cp_integer(const char *begin, const char *end, int base, uint64_t *result); +/// @cond never +inline const unsigned char *cp_integer(const unsigned char *begin, const unsigned char *end, int base, uint64_t *result); +/// @endcond +#endif + +inline bool cp_integer(const String &str, int base, int *result); +inline bool cp_integer(const String &str, int base, unsigned int *result); +inline bool cp_integer(const String &str, int base, long *result); +inline bool cp_integer(const String &str, int base, unsigned long *result); +#if HAVE_LONG_LONG +inline bool cp_integer(const String &str, int base, long long *result); +inline bool cp_integer(const String &str, int base, unsigned long long *result); +#elif HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG +inline bool cp_integer(const String &str, int base, int64_t *result); +inline bool cp_integer(const String &str, int base, uint64_t *result); +#endif + +inline bool cp_integer(const String &str, int *result); +inline bool cp_integer(const String &str, unsigned int *result); +inline bool cp_integer(const String &str, long *result); +inline bool cp_integer(const String &str, unsigned long *result); +#if HAVE_LONG_LONG +inline bool cp_integer(const String &str, long long *result); +inline bool cp_integer(const String &str, unsigned long long *result); +#elif HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG +inline bool cp_integer(const String &str, int64_t *result); +inline bool cp_integer(const String &str, uint64_t *result); +#endif + +#define CP_REAL2_MAX_FRAC_BITS 28 +bool cp_real2(const String& str, int frac_bits, int32_t* result); +bool cp_real2(const String& str, int frac_bits, uint32_t* result); +bool cp_real10(const String& str, int frac_digits, int32_t* result); +bool cp_real10(const String& str, int frac_digits, uint32_t* result); +bool cp_real10(const String& str, int frac_digits, uint32_t* result_int, uint32_t* result_frac); +#if HAVE_FLOAT_TYPES +bool cp_double(const String& str, double* result); +#endif + +bool cp_seconds_as(const String& str, int frac_digits, uint32_t* result); +bool cp_seconds_as_milli(const String& str, uint32_t* result); +bool cp_seconds_as_micro(const String& str, uint32_t* result); +#if HAVE_FLOAT_TYPES +bool cp_seconds(const String& str, double* result); +#endif +bool cp_time(const String &str, Timestamp *result, bool allow_negative = false); +bool cp_time(const String& str, struct timeval* result); + +bool cp_bandwidth(const String& str, uint32_t* result); + +// network addresses +class IPAddressList; +bool cp_ip_address(const String& str, IPAddress* result CP_OPT_CONTEXT); +inline bool cp_ip_address(const String& str, struct in_addr* result CP_OPT_CONTEXT); +bool cp_ip_address(const String& str, unsigned char* result CP_OPT_CONTEXT); +bool cp_ip_prefix(const String& str, IPAddress* result_addr, IPAddress* result_mask, bool allow_bare_address CP_OPT_CONTEXT); +bool cp_ip_prefix(const String& str, unsigned char* result_addr, unsigned char* result_mask, bool allow_bare_address CP_OPT_CONTEXT); +bool cp_ip_prefix(const String& str, IPAddress* result_addr, IPAddress* result_mask CP_OPT_CONTEXT); +bool cp_ip_prefix(const String& str, unsigned char* result_addr, unsigned char* result_mask CP_OPT_CONTEXT); +bool cp_ip_address_list(const String& str, Vector* result CP_OPT_CONTEXT); + +#if HAVE_IP6 +class IP6Address; +bool cp_ip6_address(const String& str, IP6Address* result CP_OPT_CONTEXT); +inline bool cp_ip6_address(const String& str, struct in6_addr* result CP_OPT_CONTEXT); +bool cp_ip6_address(const String& str, unsigned char* result CP_OPT_CONTEXT); +bool cp_ip6_prefix(const String& str, IP6Address* result_addr, int* result_prefix, bool allow_bare_address CP_OPT_CONTEXT); +bool cp_ip6_prefix(const String& str, unsigned char* result_addr, int* result_prefix, bool allow_bare_address CP_OPT_CONTEXT); +bool cp_ip6_prefix(const String& str, unsigned char* result_addr, unsigned char* result_mask, bool allow_bare_address CP_OPT_CONTEXT); +bool cp_ip6_prefix(const String& str, IP6Address* result_addr, IP6Address* result_mask, bool allow_bare_address CP_OPT_CONTEXT); +#endif + +class EtherAddress; +bool cp_ethernet_address(const String& str, EtherAddress* result CP_OPT_CONTEXT); +bool cp_ethernet_address(const String& str, unsigned char* result CP_OPT_CONTEXT); + +bool cp_tcpudp_port(const String& str, int proto, uint16_t* result CP_OPT_CONTEXT); + +#if !CLICK_TOOL +Element *cp_element(const String &str, const Element *context, ErrorHandler *errh = 0, const char *argname = 0); +Element *cp_element(const String &str, Router *router, ErrorHandler *errh = 0, const char *argname = 0); +bool cp_handler_name(const String& str, Element** result_element, String* result_hname, const Element* context, ErrorHandler* errh=0); +bool cp_handler(const String& str, int flags, Element** result_element, const Handler** result_handler, const Element* context, ErrorHandler* errh=0); +#endif + +#if CLICK_USERLEVEL || CLICK_TOOL +bool cp_filename(const String& str, String* result); +bool cp_file_offset(const String& str, off_t* result); +#endif + +#if !CLICK_TOOL +bool cp_anno(const String &str, int size, int *result CP_OPT_CONTEXT); +#endif +//@} + +/// @name cp_va_kparse +//@{ +int cp_va_kparse(const Vector& conf, CP_VA_PARSE_ARGS_REST) CP_SENTINEL; +int cp_va_kparse(const String& str, CP_VA_PARSE_ARGS_REST) CP_SENTINEL; +int cp_va_space_kparse(const String& str, CP_VA_PARSE_ARGS_REST) CP_SENTINEL; +int cp_va_kparse_keyword(const String& str, CP_VA_PARSE_ARGS_REST) CP_SENTINEL; +int cp_va_kparse_remove_keywords(Vector& conf, CP_VA_PARSE_ARGS_REST) CP_SENTINEL; + +int cp_assign_arguments(const Vector &argv, const String *param_begin, const String *param_end, Vector* values = 0); + +void cp_va_static_initialize(); +void cp_va_static_cleanup(); + +/// @brief Type of flags for cp_va_kparse() items. +enum CpKparseFlags { + cpkN = 0, ///< Default flags + cpkM = 1, ///< Argument is mandatory + cpkP = 2, ///< Argument may be specified positionally + cpkC = 4, ///< Argument presence should be confirmed + cpkD = 8, ///< Argument is deprecated + cpkNormal = cpkN, + cpkMandatory = cpkM, + cpkPositional = cpkP, + cpkConfirm = cpkC, + cpkDeprecated = cpkD +}; + +/// @brief Type of argument type names for cp_va_kparse() items. +typedef const char *CpVaParseCmd; + +extern const CpVaParseCmd + cpEnd, ///< Use as argument name. Ends cp_va argument list. + cpIgnoreRest, ///< Use as argument name. No result storage; causes cp_va_kparse() to ignore unparsed arguments and any remaining items. + cpIgnore, ///< No result storage, ignores this argument. + cpArgument, ///< Result storage String*, accepts any argument. + cpArguments, ///< Result storage Vector*, accepts any number of arguments with the same keyword. + cpString, ///< Result storage String*, parsed by cp_string(). + cpWord, ///< Result storage String*, parsed by cp_word(). + cpKeyword, ///< Result storage String*, parsed by cp_keyword(). + cpBool, ///< Result storage bool*, parsed by cp_bool(). + cpByte, ///< Result storage unsigned char*, parsed by cp_integer(). + cpShort, ///< Result storage short*, parsed by cp_integer(). + cpUnsignedShort, ///< Result storage unsigned short*, parsed by cp_integer(). + cpInteger, ///< Result storage int32_t*, parsed by cp_integer(). + cpUnsigned, ///< Result storage uint32_t*, parsed by cp_integer(). + cpSize, ///< Result storage size_t*, parsed by cp_integer(). + cpNamedInteger, ///< Parse parameter uint32_t nameinfo_type, result storage int32_t*, parsed by NameInfo::query_int. +#if HAVE_INT64_TYPES + cpInteger64, ///< Result storage int64_t*, parsed by cp_integer(). + cpUnsigned64, ///< Result storage uint64_t*, parsed by cp_integer(). +#endif + cpUnsignedReal2, ///< Parse parameter int frac_bits, result storage uint32_t*, parsed by cp_real2(). + cpReal10, ///< Parse parameter int frac_digits, result storage int32_t*, parsed by cp_real10(). + cpUnsignedReal10, ///< Parse parameter int frac_digits, result storage uint32_t*, parsed by cp_real10(). +#if HAVE_FLOAT_TYPES + cpDouble, ///< Result storage double*, parsed by cp_double(). +#endif + cpSeconds, ///< Result storage uint32_t*, parsed by cp_seconds_as() with frac_digits 0. + cpSecondsAsMilli, ///< Result storage uint32_t*, parsed by cp_seconds_as_milli(). + cpSecondsAsMicro, ///< Result storage uint32_t*, parsed by cp_seconds_as_micro(). + cpTimestamp, ///< Result storage Timestamp*, parsed by cp_time(). + cpTimestampSigned, ///< Result storage Timestamp*, parsed by cp_time(). + cpTimeval, ///< Result storage struct timeval*, parsed by cp_time(). + cpBandwidth, ///< Result storage uint32_t*, parsed by cp_bandwidth(). + cpIPAddress, ///< Result storage IPAddress* or equivalent, parsed by cp_ip_address(). + cpIPPrefix, ///< Result storage IPAddress* addr and IPAddress *mask, parsed by cp_ip_prefix(). + cpIPAddressOrPrefix,///< Result storage IPAddress* addr and IPAddress *mask, parsed by cp_ip_prefix(). + cpIPAddressList, ///< Result storage Vector*, parsed by cp_ip_address_list(). + cpEtherAddress, ///< Result storage EtherAddress*, parsed by cp_ethernet_address(). + cpEthernetAddress, ///< Result storage EtherAddress*, parsed by cp_ethernet_address(). Synonym for cpEtherAddress. + cpTCPPort, ///< Result storage uint16_t*, parsed by cp_tcpudp_port(). + cpUDPPort, ///< Result storage uint16_t*, parsed by cp_tcpudp_port(). + cpElement, ///< Result storage Element**, parsed by cp_element(). + cpElementCast, ///< Parse parameter const char*, result storage void**, parsed by cp_element() and Element::cast(). + cpHandlerName, ///< Result storage Element** and String*, parsed by cp_handler_name(). + cpHandlerCallRead, ///< Result storage HandlerCall*, parsed by HandlerCall. + cpHandlerCallWrite, ///< Result storage HandlerCall*, parsed by HandlerCall. + cpHandlerCallPtrRead, ///< Result storage HandlerCall**, parsed by HandlerCall::reset_read. + cpHandlerCallPtrWrite, ///< Result storage HandlerCall**, parsed by HandlerCall::reset_write. + cpIP6Address, ///< Result storage IP6Address* or equivalent, parsed by cp_ip6_address(). + cpIP6Prefix, ///< Result storage IP6Address* addr and IP6Address* mask, parsed by cp_ip6_prefix(). + cpIP6PrefixLen, ///< Result storage IP6Address* addr and int* prefix_len, parsed by cp_ip6_prefix(). + cpIP6AddressOrPrefix,///< Result storage IP6Address* addr and IP6Address* mask, parsed by cp_ip6_prefix(). +#if CLICK_USERLEVEL || CLICK_TOOL + cpFilename, ///< Result storage String*, parsed by cp_filename(). + cpFileOffset, ///< Result storage off_t*, parsed by cp_integer(). +#endif +#if !CLICK_TOOL + cpAnno, ///< Parse parameter int annotation_size, result storage int*, parsed by cp_anno(). +#endif + cpOptional, ///< cp_va_parse only: Following arguments are optional. + cpKeywords, ///< cp_va_parse only: Following arguments are keywords. + cpConfirmKeywords, ///< cp_va_parse only: Following arguments are confirmed keywords. + cpMandatoryKeywords;///< cp_va_parse only: Following arguments are mandatory keywords. +// old names, here for compatibility: +extern const CpVaParseCmd + cpInterval CLICK_CONFPARSE_DEPRECATED, // struct timeval* + cpReadHandlerCall CLICK_CONFPARSE_DEPRECATED, // HandlerCall** + cpWriteHandlerCall CLICK_CONFPARSE_DEPRECATED; // HandlerCall** +//@} + +/// @name Unparsing +//@{ +String cp_unparse_bool(bool value); +String cp_unparse_real2(int32_t value, int frac_bits); +String cp_unparse_real2(uint32_t value, int frac_bits); +#if HAVE_INT64_TYPES +String cp_unparse_real2(int64_t value, int frac_bits); +String cp_unparse_real2(uint64_t value, int frac_bits); +#endif +String cp_unparse_real10(int32_t value, int frac_digits); +String cp_unparse_real10(uint32_t value, int frac_digits); +String cp_unparse_milliseconds(uint32_t value); +String cp_unparse_microseconds(uint32_t value); +String cp_unparse_interval(const Timestamp& value) CLICK_DEPRECATED; +String cp_unparse_interval(const struct timeval& value) CLICK_DEPRECATED; +String cp_unparse_bandwidth(uint32_t value); +//@} + +/// @name Legacy Functions +//@{ +int cp_va_parse(const Vector& conf, CP_VA_PARSE_ARGS_REST) CLICK_DEPRECATED; +int cp_va_parse(const String& str, CP_VA_PARSE_ARGS_REST) CLICK_DEPRECATED; +int cp_va_space_parse(const String& str, CP_VA_PARSE_ARGS_REST) CLICK_DEPRECATED; +int cp_va_parse_keyword(const String& str, CP_VA_PARSE_ARGS_REST) CLICK_DEPRECATED; +int cp_va_parse_remove_keywords(Vector& conf, int first, CP_VA_PARSE_ARGS_REST) CLICK_DEPRECATED; +// Argument syntax: +// cp_va_arg ::= cpEnd // terminates argument list (not 0!) +// | cpOptional | cpKeywords | cpIgnore... // manipulators +// | CpVaParseCmd cmd, const char *description, +// [Optional Helpers], Results +// // Helpers and Results depend on 'cmd'; +// // see table above +// | const char *keyword, CpVaParseCmd cmd, const char *description, +// [Optional Helpers], Results +// // keyword argument, within cpKeywords or +// // cpMandatoryKeywords +// | const char *keyword, CpVaParseCmd cmd, const char *description, +// bool *keyword_given, [Optional Helpers], Results +// // keyword argument, within cpConfirmKeywords +// Returns the number of result arguments set, or negative on error. +// Stores no values in the result arguments on error. +//@} + +/// @name Argument Types for cp_va_kparse() +//@{ +struct cp_value; +struct cp_argtype; + +typedef void (*cp_parsefunc)(cp_value* value, const String& arg, + ErrorHandler* errh, const char* argdesc CP_CONTEXT); +typedef void (*cp_storefunc)(cp_value* value CP_CONTEXT); + +struct cp_argtype { + const char* name; + cp_argtype* next; + cp_parsefunc parse; + cp_storefunc store; + void* user_data; + int flags; + const char* description; + int internal; + int use_count; +}; + +struct cp_value { + // set by cp_va_parse: + const cp_argtype* argtype; + const char* keyword; + const char* description CLICK_CONFPARSE_DEPRECATED; + union { + int i; + const char *c_str; + void *p; + } extra; + void* store; + void* store2; + bool* store_confirm; + // set by parsefunc, used by storefunc: + union { + bool b; + int i; + unsigned u; + int16_t s16; + uint16_t u16; + int32_t s32; + uint32_t u32; +#if HAVE_INT64_TYPES + int64_t s64; + int64_t i64 CLICK_DEPRECATED; + uint64_t u64; +#endif + size_t size; +#if HAVE_FLOAT_TYPES + double d; +#endif + unsigned char address[16]; + int is[4]; +#ifndef CLICK_TOOL + Element *element; +#endif + void *p; + } v, v2; + String v_string; + String v2_string; +}; + +enum { + cpArgNormal = 0, cpArgStore2 = 1, cpArgExtraInt = 2, + cpArgExtraCStr = 4, cpArgAllowNumbers = 8 +}; +int cp_register_argtype(const char* name, const char* description, int flags, + cp_parsefunc parsefunc, cp_storefunc storefunc, + void* user_data = 0); +void cp_unregister_argtype(const char* name); + +int cp_register_stringlist_argtype(const char* name, const char* description, + int flags); +int cp_extend_stringlist_argtype(const char* name, ...); +// Takes: const char* name, int value, ...., const char* ender = (const char*)0 +//@} + +/// @cond never +bool cp_seconds_as(int want_power, const String& str, uint32_t* result) CLICK_DEPRECATED; + +#define cp_integer64 cp_integer +#define cp_unsigned64 cp_integer +#define cp_unsigned cp_integer +#define cp_unsigned_real10 cp_real10 +#define cp_unsigned_real2 cp_real2 +/// @endcond + +/** @brief Join the strings in @a conf with spaces and return the result. + * + * This function does not quote or otherwise protect the strings in @a conf. + * The caller should do that if necessary. + * @sa cp_unspacevec(const String *, const String *) */ +inline String cp_unspacevec(const Vector& conf) +{ + return cp_unspacevec(conf.begin(), conf.end()); +} + +/** @brief Test if @a str is all spaces. + * @return True when every character in @a str is a space. */ +inline bool cp_is_space(const String& str) +{ + return cp_skip_space(str.begin(), str.end()) == str.end(); +} + +/** @brief Parse an integer from [@a begin, @a end) in base @a base. + * @param begin first character in string + * @param end one past last character in string + * @param base base of integer: 0 or 2-36 + * @param[out] result stores parsed result + * @return pointer to first unparsed character in string; equals @a begin + * if the string didn't start with a valid integer + * + * This function parses an integer from the initial characters of a string. + * The resulting integer is stored in *@a result. + * + * The integer format consists of an optional initial sign +/-, + * followed by one or more digits. A negative sign is only accepted if @a + * result has a signed type. Digits may be separated by underscores (to make + * numbers easier to read), but the first and last characters in the integer + * cannot be underscores, and two underscores can't appear in a row. Some + * examples: + * + * @code + * 0 + * 0x100 + * -1_000_023 + * @endcode + * + * Digits are numbered from 0-9, then A-Z/a-z. @a base determines which + * digits are legal. If @a base is 0, then a leading 0x or + * 0X may precede the digits, indicating base 16; a leading + * 0 indicates base 8; anything else is base 10. + * + * Returns the first character that can't be parsed as part of the integer. + * If there is no valid integer at the beginning of the string, then returns + * @a begin; *@a result is unchanged. + * + * This function checks for overflow. If an integer is too large for @a + * result, then the maximum possible value is stored in @a result and the + * cp_errno variable is set to CPE_OVERFLOW. Otherwise, cp_errno is set to + * CPE_FORMAT (for no valid integer) or CPE_OK (if all was well). + * + * Overloaded versions of this function are available for int, unsigned int, + * long, unsigned long, and (depending on configuration) long long and + * unsigned long long @a result values. + */ +inline const char *cp_integer(const char *begin, const char *end, int base, int *result) +{ + return cp_basic_integer(begin, end, base, -(int) sizeof(*result), result); +} + +/** @brief Parse an integer from @a str in base @a base. + * @param str string + * @param base base of integer: 0 or 2-36 + * @param[out] result stores parsed result + * @return True if @a str parsed correctly, false otherwise. + * + * Parses an integer from an input string. If the string correctly parses as + * an integer, then the resulting value is stored in *@a result and the + * function returns true. Otherwise, *@a result remains unchanged and the + * function returns false. + * + * Overloaded versions are available for int, unsigned int, long, unsigned + * long, and (depending on configuration) long long and unsigned long long @a + * result values. + * + * @sa cp_integer(const char *, const char *, int, int *) for the rules on + * parsing integers. + */ +inline bool cp_integer(const String &str, int base, int *result) +{ + return cp_basic_integer(str.begin(), str.end(), base + cp_basic_integer_whole, -(int) sizeof(*result), result) != str.begin(); +} + + +inline const char *cp_integer(const char *begin, const char *end, int base, unsigned *result) +{ + return cp_basic_integer(begin, end, base, (int) sizeof(*result), result); +} + +/// @cond never +inline const unsigned char *cp_integer(const unsigned char *begin, const unsigned char *end, int base, unsigned *result) +{ + return reinterpret_cast(cp_integer(reinterpret_cast(begin), reinterpret_cast(end), base, result)); +} +/// @endcond + + +inline const char *cp_integer(const char *begin, const char *end, int base, long *result) +{ + return cp_basic_integer(begin, end, base, -(int) sizeof(*result), result); +} + +inline const char *cp_integer(const char *begin, const char *end, int base, unsigned long *result) +{ + return cp_basic_integer(begin, end, base, (int) sizeof(*result), result); +} + +/// @cond never +inline const unsigned char *cp_integer(const unsigned char *begin, const unsigned char *end, int base, unsigned long *result) +{ + return reinterpret_cast(cp_integer(reinterpret_cast(begin), reinterpret_cast(end), base, result)); +} +/// @endcond + + +#if HAVE_LONG_LONG + +inline const char *cp_integer(const char *begin, const char *end, int base, long long *result) +{ + return cp_basic_integer(begin, end, base, -(int) sizeof(*result), result); +} + +inline const char *cp_integer(const char *begin, const char *end, int base, unsigned long long *result) +{ + return cp_basic_integer(begin, end, base, (int) sizeof(*result), result); +} + +/// @cond never +inline const unsigned char *cp_integer(const unsigned char *begin, const unsigned char *end, int base, unsigned long long *result) +{ + return reinterpret_cast(cp_integer(reinterpret_cast(begin), reinterpret_cast(end), base, result)); +} +/// @endcond + +#elif HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG + +inline const char *cp_integer(const char *begin, const char *end, int base, int64_t *result) +{ + return cp_basic_integer(begin, end, base, -(int) sizeof(*result), result); +} + +inline const char *cp_integer(const char *begin, const char *end, int base, uint64_t *result) +{ + return cp_basic_integer(begin, end, base, (int) sizeof(*result), result); +} + +/// @cond never +inline const unsigned char *cp_integer(const unsigned char *begin, const unsigned char *end, int base, uint64_t *result) +{ + return reinterpret_cast(cp_integer(reinterpret_cast(begin), reinterpret_cast(end), base, result)); +} +/// @endcond + +#endif + +inline bool cp_integer(const String &str, int base, int *result); + +inline bool cp_integer(const String &str, int base, unsigned int *result) +{ + return cp_basic_integer(str.begin(), str.end(), base + cp_basic_integer_whole, (int) sizeof(*result), result) != str.begin(); +} + +inline bool cp_integer(const String &str, int base, long *result) +{ + return cp_basic_integer(str.begin(), str.end(), base + cp_basic_integer_whole, -(int) sizeof(*result), result) != str.begin(); +} + +inline bool cp_integer(const String &str, int base, unsigned long *result) +{ + return cp_basic_integer(str.begin(), str.end(), base + cp_basic_integer_whole, (int) sizeof(*result), result) != str.begin(); +} + +#if HAVE_LONG_LONG + +inline bool cp_integer(const String &str, int base, long long *result) +{ + return cp_basic_integer(str.begin(), str.end(), base + cp_basic_integer_whole, -(int) sizeof(*result), result) != str.begin(); +} + +inline bool cp_integer(const String &str, int base, unsigned long long *result) +{ + return cp_basic_integer(str.begin(), str.end(), base + cp_basic_integer_whole, (int) sizeof(*result), result) != str.begin(); +} + +#elif HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG + +inline bool cp_integer(const String &str, int base, int64_t *result) +{ + return cp_basic_integer(str.begin(), str.end(), base + cp_basic_integer_whole, -(int) sizeof(*result), result) != str.begin(); +} + +inline bool cp_integer(const String &str, int base, uint64_t *result) +{ + return cp_basic_integer(str.begin(), str.end(), base + cp_basic_integer_whole, (int) sizeof(*result), result) != str.begin(); +} + +#endif + +/** @brief Parse an integer from @a str in base 0. + * + * Same as cp_integer(str, 0, result). */ +inline bool cp_integer(const String &str, int *result) +{ + return cp_basic_integer(str.begin(), str.end(), cp_basic_integer_whole, -(int) sizeof(*result), result) != str.begin(); +} + +inline bool cp_integer(const String &str, unsigned int *result) +{ + return cp_basic_integer(str.begin(), str.end(), cp_basic_integer_whole, (int) sizeof(*result), result) != str.begin(); +} + +inline bool cp_integer(const String &str, long *result) +{ + return cp_basic_integer(str.begin(), str.end(), cp_basic_integer_whole, -(int) sizeof(*result), result) != str.begin(); +} + +inline bool cp_integer(const String &str, unsigned long *result) +{ + return cp_basic_integer(str.begin(), str.end(), cp_basic_integer_whole, (int) sizeof(*result), result) != str.begin(); +} + +#if HAVE_LONG_LONG + +inline bool cp_integer(const String &str, long long *result) +{ + return cp_basic_integer(str.begin(), str.end(), cp_basic_integer_whole, -(int) sizeof(*result), result) != str.begin(); +} + +inline bool cp_integer(const String &str, unsigned long long *result) +{ + return cp_basic_integer(str.begin(), str.end(), cp_basic_integer_whole, (int) sizeof(*result), result) != str.begin(); +} + +#elif HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG + +inline bool cp_integer(const String &str, int64_t *result) +{ + return cp_basic_integer(str.begin(), str.end(), cp_basic_integer_whole, -(int) sizeof(*result), result) != str.begin(); +} + +inline bool cp_integer(const String &str, uint64_t *result) +{ + return cp_basic_integer(str.begin(), str.end(), cp_basic_integer_whole, (int) sizeof(*result), result) != str.begin(); +} + +#endif + +inline bool cp_ip_address(const String& str, struct in_addr *ina CP_CONTEXT) +{ + return cp_ip_address(str, reinterpret_cast(ina) CP_PASS_CONTEXT); +} + +#if HAVE_IP6 +inline bool cp_ip6_address(const String& str, struct in6_addr *x CP_CONTEXT) +{ + return cp_ip6_address(str, reinterpret_cast(x) CP_PASS_CONTEXT); +} +#endif + +/// @cond never +inline bool cp_seconds_as(int want_power, const String &str, uint32_t *result) +{ + return cp_seconds_as(str, want_power, result); +} + +#if !CLICK_TOOL +inline int cp_register_argtype(const char* name, const char* description, int flags, + void (*parsefunc)(cp_value *, const String &, ErrorHandler *, const char *, Element *), + void (*storefunc)(cp_value *, Element *), + void *user_data = 0) { + return cp_register_argtype(name, description, flags, + (cp_parsefunc) parsefunc, + (cp_storefunc) storefunc, + user_data); +} +#endif + +inline String cp_pop_spacevec(String &str) CLICK_DEPRECATED; + +/// @brief Remove and return the first space-separated argument from @a str. +/// @param[in,out] str space-separated configuration string +/// @deprecated This is a deprecated synonym for cp_shift_spacevec(). +inline String cp_pop_spacevec(String &str) { + return cp_shift_spacevec(str); +} + +#undef CP_VA_ARGS_REST +#undef CP_OPT_CONTEXT +#undef CP_CONTEXT +#undef CP_PASS_CONTEXT +#undef CLICK_CONFPARSE_DEPRECATED +#undef CP_SENTINEL +#define cpEnd ((CpVaParseCmd) 0) +/// @endcond +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/crc32.h b/openflow/include/click/crc32.h new file mode 100644 index 0000000..e1db84c --- /dev/null +++ b/openflow/include/click/crc32.h @@ -0,0 +1,14 @@ +/* -*- related-file-name: "../../lib/crc32.c" -*- */ +#ifndef CLICK_CRC32_H +#define CLICK_CRC32_H +#ifdef __cplusplus +extern "C" { +#endif + +uint32_t update_crc(uint32_t crc_accum, const char *data_blk_ptr, + int data_blk_size); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/openflow/include/click/cxxprotect.h b/openflow/include/click/cxxprotect.h new file mode 100644 index 0000000..65662af --- /dev/null +++ b/openflow/include/click/cxxprotect.h @@ -0,0 +1,25 @@ +#ifdef __cplusplus +# define new linux_new +# define this linux_this +# define delete linux_delete +# define class linux_class +# define virtual linux_virtual +# define typename linux_typename +# define protected linux_protected +# define public linux_public +# define namespace linux_namespace +# define false linux_false +# define true linux_true +#endif + +#ifndef CLICK_CXX_PROTECT +# ifdef __cplusplus +# define CLICK_CXX_PROTECT extern "C" { +# define CLICK_CXX_UNPROTECT } +# else +# define CLICK_CXX_PROTECT /* nothing */ +# define CLICK_CXX_UNPROTECT /* nothing */ +# endif +#endif + +#define CLICK_CXX_PROTECTED 1 diff --git a/openflow/include/click/cxxunprotect.h b/openflow/include/click/cxxunprotect.h new file mode 100644 index 0000000..5ff3d94 --- /dev/null +++ b/openflow/include/click/cxxunprotect.h @@ -0,0 +1,14 @@ +#ifdef __cplusplus +# undef new +# undef this +# undef delete +# undef class +# undef virtual +# undef typename +# undef protected +# undef public +# undef namespace +# undef false +# undef true +#endif +#undef CLICK_CXX_PROTECTED diff --git a/openflow/include/click/deque.cc b/openflow/include/click/deque.cc new file mode 100644 index 0000000..9877263 --- /dev/null +++ b/openflow/include/click/deque.cc @@ -0,0 +1,211 @@ +/* + * deque.{cc,hh} -- double-ended queue template class + * Eddie Kohler, Douglas S. J. De Couto + * Based on code from Click Vector<> class (vector.{cc,hh}). + * + * Copyright (c) 2003 Massachusetts Institute of Technology + * Copyright (c) 2011 Eddie Kohler + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, subject to the conditions + * listed in the Click LICENSE file. These conditions include: you must + * preserve this copyright notice, and you cannot mention the copyright + * holders in advertising related to the Software without their permission. + * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This + * notice is a summary of the Click LICENSE file; the license in that file is + * legally binding. + */ + +#ifndef CLICK_DEQUE_CC +#define CLICK_DEQUE_CC +#include +CLICK_DECLS +/** @cond never */ + +template +deque_memory::~deque_memory() +{ + size_type f = naccess(n_); + AM::destroy(l_ + head_, f); + AM::destroy(l_, n_ - f); + CLICK_LFREE(l_, capacity_ * sizeof(type)); +} + +template +void deque_memory::assign(const deque_memory &x) +{ + if (&x != this) { + size_type f = naccess(n_); + AM::destroy(l_ + head_, f); + AM::destroy(l_, n_ - f); + n_ = head_ = 0; + if (reserve_and_push(x.n_, false, 0)) { + n_ = x.n_; + AM::mark_undefined(l_, n_); + f = x.naccess(n_); + AM::copy(l_, x.l_ + x.head_, f); + AM::copy(l_ + f, x.l_, n_ - f); + } + } +} + +template +void deque_memory::assign(size_type n, const type *vp) +{ + if (unlikely(need_argument_copy(vp))) { + type v_copy(*vp); + return assign(n, &v_copy); + } + + resize(0, vp); + resize(n, vp); +} + +template +bool deque_memory::insert(size_type i, const type *vp) +{ + assert((unsigned) i <= (unsigned) n_); + if (unlikely(need_argument_copy(vp))) { + type v_copy(*vp); + return insert(i, &v_copy); + } + + if (n_ == capacity_ && !reserve_and_push(-1, false, 0)) + return false; + size_type srcpp, dstpp, size; + int delta; + if (i <= n_ - i) { + head_ = prevp(head_); + srcpp = head_ + 1; + dstpp = head_; + size = i; + delta = 1; + } else { + srcpp = head_ + n_ - 1; + dstpp = head_ + n_; + size = n_ - i; + delta = -1; + } + while (size) { + AM::mark_undefined(l_ + canonp(dstpp), 1); + AM::move(l_ + canonp(dstpp), l_ + canonp(srcpp), 1); + dstpp += delta, srcpp += delta, --size; + } + AM::mark_undefined(l_ + canonp(dstpp), 1); + AM::fill(l_ + canonp(dstpp), 1, vp); + ++n_; + return true; +} + +template +int deque_memory::erase(size_type ai, size_type bi) +{ + assert(ai >= bi || (ai >= 0 && (unsigned) bi <= (unsigned) n_)); + if (ai < bi) { + size_type srcpp, dstpp, size; + int delta; + if (ai < n_ - bi) { + srcpp = head_ + ai - 1; + dstpp = head_ + bi - 1; + size = ai; + delta = -1; + head_ = canonp(head_ + bi - ai); + } else { + srcpp = head_ + bi; + dstpp = head_ + ai; + size = n_ - bi; + delta = 1; + } + while (size) { + AM::destroy(l_ + canonp(dstpp), 1); + AM::copy(l_ + canonp(dstpp), l_ + canonp(srcpp), 1); + dstpp += delta, srcpp += delta, --size; + } + for (size = bi - ai; size; --size, dstpp += delta) { + AM::destroy(l_ + canonp(dstpp), 1); + AM::mark_noaccess(l_ + canonp(dstpp), 1); + } + n_ -= bi - ai; + return ai; + } else + return bi; +} + +template +bool deque_memory::reserve_and_push(size_type want, bool isfront, const type *push_vp) +{ + if (unlikely(push_vp && need_argument_copy(push_vp))) { + type push_v_copy(*push_vp); + return reserve_and_push(want, isfront, &push_v_copy); + } + + if (want < 0) + want = (capacity_ > 0 ? capacity_ * 2 : 4); + + if (want > capacity_) { + type *new_l = (type *) CLICK_LALLOC(want * sizeof(type)); + if (!new_l) + return false; + AM::mark_noaccess(new_l + n_, want - n_); + size_type f = naccess(n_); + AM::move(new_l, l_ + head_, f); + AM::move(new_l + f, l_, n_ - f); + CLICK_LFREE(l_, capacity_ * sizeof(type)); + l_ = new_l; + head_ = 0; + capacity_ = want; + } + + if (unlikely(push_vp)) + (isfront ? push_front(push_vp) : push_back(push_vp)); + return true; +} + +template +void deque_memory::resize(size_type n, const type *vp) +{ + if (unlikely(need_argument_copy(vp))) { + type v_copy(*vp); + return resize(n, &v_copy); + } + + if (n <= capacity_ || reserve_and_push(n, false, 0)) { + assert(n >= 0); + if (n < n_) + for (size_type p = i2p(n), x = i2p(n_); p != x; p = nextp(p)) { + AM::destroy(l_ + p, 1); + AM::mark_noaccess(l_ + p, 1); + } + if (n_ < n) + for (size_type p = i2p(n_), x = i2p(n); p != x; p = nextp(p)) { + AM::mark_undefined(l_ + p, 1); + AM::fill(l_ + p, 1, vp); + } + n_ = n; + } +} + +template +void deque_memory::swap(deque_memory &x) +{ + type *l = l_; + l_ = x.l_; + x.l_ = l; + + size_type head = head_; + head_ = x.head_; + x.head_ = head; + + size_type n = n_; + n_ = x.n_; + x.n_ = n; + + size_type capacity = capacity_; + capacity_ = x.capacity_; + x.capacity_ = capacity; +} + +/** @endcond never */ +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/deque.hh b/openflow/include/click/deque.hh new file mode 100644 index 0000000..5354430 --- /dev/null +++ b/openflow/include/click/deque.hh @@ -0,0 +1,687 @@ +#ifndef CLICK_DEQUE_HH +#define CLICK_DEQUE_HH 1 +#include +#include +CLICK_DECLS + +/** @cond never */ +template class deque_memory { public: + typedef int size_type; + typedef typename AM::type type; + inline bool need_argument_copy(const type *argp) const { + return fast_argument::is_reference && (uintptr_t) argp - (uintptr_t) l_ < (size_t) (capacity_ * sizeof(type)); + } + inline size_type canonp(size_type p) const { + return p < capacity_ ? p : p - capacity_; + } + inline size_type i2p(size_type i) const { + return canonp(head_ + i); + } + inline size_type prevp(size_type p) const { + return p ? p - 1 : capacity_ - 1; + } + inline size_type nextp(size_type p) const { + return p + 1 != capacity_ ? p + 1 : 0; + } + inline size_type naccess(size_type n) const { + return head_ + n <= capacity_ ? n : capacity_ - head_; + } + + deque_memory() + : l_(0), head_(0), n_(0), capacity_(0) { + } + ~deque_memory(); + void assign(const deque_memory &x); + void assign(size_type n, const type *vp); + void resize(size_type n, const type *vp); + bool insert(int i, const type *vp); + int erase(int ai, int bi); + inline void push_back(const type *vp) { + if (n_ < capacity_) { + size_type p = i2p(n_); + AM::mark_undefined(l_ + p, 1); + AM::fill(l_ + p, 1, vp); + ++n_; + } else + reserve_and_push(-1, false, vp); + } +#if HAVE_CXX_RVALUE_REFERENCES + inline void move_construct_back(type* vp) { + if (n_ < capacity_) { + size_type p = i2p(n_); + AM::mark_undefined(l_ + p, 1); + AM::move_construct(l_ + p, vp); + ++n_; + } else + reserve_and_push(-1, false, vp); + } +#endif + inline void pop_back() { + assert(n_ > 0); + --n_; + size_type p = i2p(n_); + AM::destroy(l_ + p, 1); + AM::mark_noaccess(l_ + p, 1); + } + inline void push_front(const type *vp) { + if (n_ < capacity_) { + head_ = prevp(head_); + AM::mark_undefined(l_ + head_, 1); + AM::fill(l_ + head_, 1, vp); + ++n_; + } else + reserve_and_push(-1, true, vp); + } +#if HAVE_CXX_RVALUE_REFERENCES + inline void move_construct_front(type* vp) { + if (n_ < capacity_) { + head_ = prevp(head_); + AM::mark_undefined(l_ + head_, 1); + AM::move_construct(l_ + head_, vp); + ++n_; + } else + reserve_and_push(-1, true, vp); + } +#endif + inline void pop_front() { + assert(n_ > 0); + --n_; + AM::destroy(l_ + head_, 1); + AM::mark_noaccess(l_ + head_, 1); + head_ = nextp(head_); + } + inline void clear() { + size_type f = naccess(n_); + AM::destroy(l_ + head_, f); + AM::destroy(l_, n_ - f); + AM::mark_noaccess(l_, capacity_); + head_ = n_ = 0; + } + bool reserve_and_push(size_type n, bool isfront, const type *vp); + void swap(deque_memory &x); + type *l_; + size_type head_; + size_type n_; + size_type capacity_; +}; +/** @endcond never */ + +template class Deque_iterator; +template class Deque_const_iterator; + +/** @class Deque + @brief Deque template. + + Deque implements a double-ended queue: a growable array that can efficiently + add and remove elements at both ends (see push_back(), pop_back(), + push_front(), and pop_front()). Its interface should be compatible with + C++'s std::deque, although that type has more methods. Deque elements are + accessed with operator[] like arrays. + + Deque is implemented using a circular buffer of elements. This makes its + operations slightly slower than those of Vector. If you only need to push + elements to the end of an array, prefer Vector. + + Example code: + @code + Deque d; + printf("%d\n", d.size()); // prints "0" + + d.push_back(1); + d.push_back(2); + printf("%d\n", d.size()); // prints "2" + printf("%d %d\n", d[0], d[1]); // prints "1 2" + + d.push_front(0); + d.push_front(-1); + printf("%d\n", d.size()); // prints "4" + printf("%d %d %d %d\n", d[0], d[1], d[2], d[3]); + // prints "-1 0 1 2" + + d.pop_front(); + d.pop_back(); + printf("%d\n", d.size()); // prints "2" + printf("%d %d\n", d[0], d[1]); // prints "0 1" + @endcode +*/ +template +class Deque { + + typedef typename array_memory::type array_memory_type; + mutable deque_memory vm_; + + public: + + typedef T value_type; ///< Value type. + typedef T &reference; ///< Reference to value type. + typedef const T &const_reference; ///< Const reference to value type. + typedef T *pointer; ///< Pointer to value type. + typedef const T *const_pointer; ///< Pointer to const value type. + + /** @brief Type used for value arguments (either T or const T &). */ + typedef typename fast_argument::type value_argument_type; + typedef const T &const_access_type; + + typedef int size_type; ///< Type of sizes (size()). + + typedef Deque_iterator iterator; ///< Iterator type. + typedef Deque_const_iterator const_iterator; ///< Const iterator type. + + /** @brief Constant passed to reserve() to grow the deque. */ + enum { RESERVE_GROW = (size_type) -1 }; + + + explicit inline Deque(); + explicit inline Deque(size_type n, value_argument_type v); + inline Deque(const Deque &x); +#if HAVE_CXX_RVALUE_REFERENCES + inline Deque(Deque &&x); +#endif + + inline Deque &operator=(const Deque &x); +#if HAVE_CXX_RVALUE_REFERENCES + inline Deque &operator=(Deque &&x); +#endif + inline Deque &assign(size_type n, value_argument_type v = T()); + + inline iterator begin(); + inline iterator end(); + inline const_iterator begin() const; + inline const_iterator end() const; + inline const_iterator cbegin() const; + inline const_iterator cend() const; + + inline size_type size() const; + inline size_type capacity() const; + inline bool empty() const; + inline void resize(size_type n, value_argument_type v = T()); + inline bool reserve(size_type n); + + inline T &operator[](size_type i); + inline const T &operator[](size_type i) const; + inline T &at(size_type i); + inline const T &at(size_type i) const; + inline T &front(); + inline const T &front() const; + inline T &back(); + inline const T &back() const; + + inline T &unchecked_at(size_type i); + inline const T &unchecked_at(size_type i) const; + inline T &at_u(size_type i) CLICK_DEPRECATED; + inline const T &at_u(size_type i) const CLICK_DEPRECATED; + + inline void push_back(value_argument_type v); +#if HAVE_CXX_RVALUE_REFERENCES + template > + inline typename A::enable_rvalue_reference push_back(T &&v); +#endif + inline void pop_back(); + inline void push_front(value_argument_type v); +#if HAVE_CXX_RVALUE_REFERENCES + template > + inline typename A::enable_rvalue_reference push_front(T &&v); +#endif + inline void pop_front(); + + inline iterator insert(iterator it, value_argument_type v); + inline iterator erase(iterator it); + inline iterator erase(iterator a, iterator b); + + inline void clear(); + + inline void swap(Deque &x); + +}; + +template +class Deque_const_iterator { + const Deque *q_; + typename Deque::size_type p_; + friend class Deque; + public: + typedef typename Deque::size_type size_type; + typedef Deque_const_iterator const_iterator; + typedef Deque_iterator iterator; + + Deque_const_iterator() { + } + Deque_const_iterator(const Deque *q, size_type p) + : q_(q), p_(p) { + } + const T *operator->() const { + return &(*q_)[p_]; + } + const T &operator*() const { + return (*q_)[p_]; + } + const T &operator[](size_type i) const { + return (*q_)[p_ + i]; + } + bool operator==(const const_iterator &x) const { + return p_ == x.p_ && q_ == x.q_; + } + bool operator!=(const const_iterator &x) const { + return p_ != x.p_ || q_ != x.q_; + } + bool operator<(const const_iterator &x) const { + assert(q_ == x.q_); + return p_ < x.p_; + } + bool operator<=(const const_iterator &x) const { + assert(q_ == x.q_); + return p_ <= x.p_; + } + bool operator>=(const const_iterator &x) const { + assert(q_ == x.q_); + return p_ >= x.p_; + } + bool operator>(const const_iterator &x) const { + assert(q_ == x.q_); + return p_ > x.p_; + } + size_type diff(const const_iterator &x) const { + assert(q_ == x.q_); + return p_ - x.p_; + } + void operator++(int) { + ++p_; + } + const_iterator &operator++() { + ++p_; + return *this; + } + void operator--(int) { + --p_; + } + const_iterator &operator--() { + --p_; + return *this; + } + const_iterator &operator+=(size_type n) { + p_ += n; + return *this; + } + const_iterator &operator-=(size_type n) { + p_ -= n; + return *this; + } +}; + +template +class Deque_iterator : public Deque_const_iterator { public: + typedef typename Deque::size_type size_type; + typedef Deque_const_iterator const_iterator; + typedef Deque_iterator iterator; + + Deque_iterator() { + } + Deque_iterator(Deque *q, int p) + : const_iterator(q, p) { + } + T *operator->() const { + return const_cast(const_iterator::operator->()); + } + T &operator*() const { + return const_cast(const_iterator::operator*()); + } + T &operator[](int n) const { + return const_cast(const_iterator::operator[](n)); + } + iterator &operator+=(size_type n) { + const_iterator::operator+=(n); + return *this; + } + iterator &operator-=(size_type n) { + const_iterator::operator-=(n); + return *this; + } +}; + +/** @brief Construct an empty deque. */ +template +inline Deque::Deque() { +} + +/** @brief Construct a deque containing @a n copies of @a v. */ +template +inline Deque::Deque(size_type n, value_argument_type v) { + vm_.resize(n, array_memory_type::cast(&v)); +} + +/** @brief Construct a deque as a copy of @a x. */ +template +inline Deque::Deque(const Deque &x) { + vm_.assign(x.vm_); +} + +#if HAVE_CXX_RVALUE_REFERENCES +/** @brief Construct a deque as a copy of @a x. */ +template +inline Deque::Deque(Deque &&x) { + vm_.assign(x.vm_); +} +#endif + +/** @brief Return the number of elements. */ +template +inline typename Deque::size_type Deque::size() const { + return vm_.n_; +} + +/** @brief Test if the deque is empty (size() == 0). */ +template +inline bool Deque::empty() const { + return vm_.n_ == 0; +} + +/** @brief Return the deque's capacity. + + The capacity is greater than or equal to the size(). Functions such as + resize(n) will not allocate new memory for the deque if n <= + capacity(). */ +template +inline typename Deque::size_type Deque::capacity() const { + return vm_.capacity_; +} + +/** @brief Return an iterator for the first element in the deque. */ +template +inline typename Deque::iterator Deque::begin() { + return iterator(this, 0); +} + +/** @overload */ +template +inline typename Deque::const_iterator Deque::begin() const { + return const_iterator(this, 0); +} + +/** @brief Return an iterator for the end of the deque. + @invariant end() == begin() + size() */ +template +inline typename Deque::iterator Deque::end() { + return iterator(this, vm_.n_); +} + +/** @overload */ +template +inline typename Deque::const_iterator Deque::end() const { + return const_iterator(this, vm_.n_); +} + +/** @brief Return a const_iterator for the beginning of the deque. */ +template +inline typename Deque::const_iterator Deque::cbegin() const { + return const_iterator(this, 0); +} + +/** @brief Return a const_iterator for the end of the deque. + @invariant end() == begin() + size() */ +template +inline typename Deque::const_iterator Deque::cend() const { + return const_iterator(this, vm_.n_); +} + +/** @brief Return a reference to the ith element. + @pre 0 <= @a i < size() */ +template +inline T &Deque::operator[](size_type i) { + assert((unsigned) i < (unsigned) vm_.n_); + return *(T *)&vm_.l_[vm_.i2p(i)]; +} + +/** @overload */ +template +inline const T &Deque::operator[](size_type i) const { + assert((unsigned) i < (unsigned) vm_.n_); + return *(T *)&vm_.l_[vm_.i2p(i)]; +} + +/** @brief Return a reference to the ith element. + @pre 0 <= @a i < size() + @sa operator[]() */ +template +inline T &Deque::at(size_type i) { + return operator[](i); +} + +/** @overload */ +template +inline const T &Deque::at(size_type i) const { + return operator[](i); +} + +/** @brief Return a reference to the first element. + @pre !empty() */ +template +inline T &Deque::front() { + return operator[](0); +} + +/** @overload */ +template +inline const T &Deque::front() const { + return operator[](0); +} + +/** @brief Return a reference to the last element (number size()-1). + @pre !empty() */ +template +inline T &Deque::back() { + return operator[](vm_.n_ - 1); +} + +/** @overload */ +template +inline const T &Deque::back() const { + return operator[](vm_.n_ - 1); +} + +/** @brief Return a reference to the ith element. + @pre 0 <= @a i < size() + + Unlike operator[]() and at(), this function does not check bounds, + even if assertions are enabled. Use with caution. */ +template +inline T &Deque::unchecked_at(size_type i) { + return *(T *)&vm_.l_[vm_.i2p(i)]; +} + +/** @overload */ +template +inline const T &Deque::unchecked_at(size_type i) const { + return *(T *)&vm_.l_[vm_.i2p(i)]; +} + +/** @cond never */ +template +inline T &Deque::at_u(size_type i) { + return unchecked_at(i); +} + +template +inline const T &Deque::at_u(size_type i) const { + return unchecked_at(i); +} +/** @endcond never */ + +/** @brief Resize the deque to contain @a n elements. + @param n new size + @param v value used to fill new elements */ +template +inline void Deque::resize(size_type n, value_argument_type v) { + vm_.resize(n, array_memory_type::cast(&v)); +} + +/** @brief Append @a v to the end of the deque. + + A copy of @a v is added to position size(). Takes amortized O(1) + time. */ +template +inline void Deque::push_back(value_argument_type v) { + vm_.push_back(array_memory_type::cast(&v)); +} + +#if HAVE_CXX_RVALUE_REFERENCES +/** @overload */ +template template +inline typename A::enable_rvalue_reference Deque::push_back(T&& v) { + vm_.move_construct_back(array_memory_type::cast(&v)); +} +#endif + +/** @brief Remove the last element. + + Takes O(1) time. */ +template +inline void Deque::pop_back() { + vm_.pop_back(); +} + +/** @brief Prepend element @a v. + + A copy of @a v is added to position 0. Other elements are shifted one + position forward. Takes amortized O(1) time. */ +template +inline void Deque::push_front(value_argument_type v) { + vm_.push_front(array_memory_type::cast(&v)); +} + +#if HAVE_CXX_RVALUE_REFERENCES +/** @overload */ +template template +inline typename A::enable_rvalue_reference Deque::push_front(T&& v) { + vm_.move_construct_front(array_memory_type::cast(&v)); +} +#endif + +/** @brief Remove the first element. + + Other elements are shifted one position backward. Takes O(1) time. */ +template +inline void Deque::pop_front() { + vm_.pop_front(); +} + +/** @brief Insert @a v before position @a it. + @return An iterator pointing at the new element. */ +template +inline typename Deque::iterator +Deque::insert(iterator it, value_argument_type v) { + assert(it.q_ == this); + if (likely(vm_.insert(it.p_, array_memory_type::cast(&v)))) + return it; + else + return end(); +} + +/** @brief Remove the element at position @a it. + @return An iterator pointing at the element following @a it. */ +template +inline typename Deque::iterator +Deque::erase(iterator it) { + assert(it.q_ == this); + return (it < end() ? erase(it, it + 1) : it); +} + +/** @brief Remove the elements in [@a a, @a b). + @return An iterator corresponding to @a b. */ +template +inline typename Deque::iterator +Deque::erase(iterator a, iterator b) { + assert(a.q_ == this && b.q_ == this); + return iterator(this, vm_.erase(a.p_, b.p_)); +} + +/** @brief Remove all elements. + @post size() == 0 */ +template +inline void Deque::clear() { + vm_.clear(); +} + +/** @brief Reserve space for at least @a n more elements. + @return true iff reserve succeeded. + + This function changes the deque's capacity(), not its size(). If + reserve(@a n) succeeds, then any succeeding call to resize(@a m) with @a + m < @a n will succeed without allocating deque memory. */ +template +inline bool Deque::reserve(size_type n) { + return vm_.reserve_and_push(n, false, 0); +} + +/** @brief Swap the contents of this deque and @a x. */ +template +inline void Deque::swap(Deque &x) { + vm_.swap(x.vm_); +} + +/** @brief Replace this deque's contents with a copy of @a x. */ +template +inline Deque &Deque::operator=(const Deque &x) { + vm_.assign(x.vm_); + return *this; +} + +#if HAVE_CXX_RVALUE_REFERENCES +/** @brief Replace this deque's contents with those of @a x. */ +template +inline Deque &Deque::operator=(Deque &&x) { + vm_.swap(x.vm_); + return *this; +} +#endif + +/** @brief Replace this deque's contents with @a n copies of @a v. + @post size() == @a n */ +template +inline Deque &Deque::assign(size_type n, value_argument_type v) { + vm_.assign(n, array_memory_type::cast(&v)); + return *this; +} + +template +Deque_const_iterator operator+(Deque_const_iterator it, + typename Deque::size_type n) { + return it += n; +} + +template +Deque_const_iterator operator-(Deque_const_iterator it, + typename Deque::size_type n) { + return it -= n; +} + +template +Deque_iterator operator+(Deque_iterator it, + typename Deque::size_type n) { + return it += n; +} + +template +Deque_iterator operator-(Deque_iterator it, + typename Deque::size_type n) { + return it -= n; +} + +template +typename Deque_const_iterator::size_type +operator-(const Deque_const_iterator &a, const Deque_const_iterator &b) { + return a.diff(b); +} + +template +inline void click_swap(Deque &a, Deque &b) { + a.swap(b); +} + +template +inline void assign_consume(Deque &a, Deque &b) { + a.swap(b); +} + +CLICK_ENDDECLS +#include +#endif diff --git a/openflow/include/click/dequeue.hh b/openflow/include/click/dequeue.hh new file mode 100644 index 0000000..aa57683 --- /dev/null +++ b/openflow/include/click/dequeue.hh @@ -0,0 +1,5 @@ +#ifndef DEQueue +#warning "DEQueue is deprecated, use Deque and instead" +#include +#define DEQueue Deque +#endif diff --git a/openflow/include/click/dpdkdevice.hh b/openflow/include/click/dpdkdevice.hh new file mode 100644 index 0000000..d556fe8 --- /dev/null +++ b/openflow/include/click/dpdkdevice.hh @@ -0,0 +1,210 @@ +#ifndef CLICK_DPDKDEVICE_HH +#define CLICK_DPDKDEVICE_HH + +/** + * Prevent bug under some configurations + * (like travis-ci's one) where these + * macros get undefined. + */ +#ifndef UINT8_MAX +#define UINT8_MAX 255 +#endif +#ifndef UINT16_MAX +#define UINT16_MAX 65535 +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#if RTE_VERSION < RTE_VERSION_NUM(19,8,0,0) +#define rte_ipv4_hdr ipv4_hdr +#define rte_ether_addr ether_addr +#endif + +/** + * Unified type for DPDK port IDs. + * Until DPDK v17.05 was uint8_t + * After DPDK v17.05 has been uint16_t + */ +#if RTE_VERSION >= RTE_VERSION_NUM(17,05,0,0) + typedef uint16_t portid_t; +#else + typedef uint8_t portid_t; +#endif + +CLICK_DECLS +class DPDKDeviceArg; + +extern bool dpdk_enabled; + +class DPDKDevice { +public: + + portid_t port_id; + + DPDKDevice() CLICK_COLD; + DPDKDevice(portid_t port_id) CLICK_COLD; + int add_rx_queue( + unsigned &queue_id, bool promisc, + unsigned n_desc, ErrorHandler *errh + ) CLICK_COLD; + + int add_tx_queue( + unsigned &queue_id, unsigned n_desc, + ErrorHandler *errh + ) CLICK_COLD; + + EtherAddress get_mac(); + void set_init_mac(EtherAddress mac); + void set_init_mtu(uint16_t mtu); + + unsigned int get_nb_txdesc(); + int nbRXQueues(); + int nbTXQueues(); + const char *get_device_driver(); + + static unsigned int dev_count() { +#if RTE_VERSION >= RTE_VERSION_NUM(18,05,0,0) + return rte_eth_dev_count_avail(); +#else + return rte_eth_dev_count(); +#endif + } + + static struct rte_mempool *get_mpool(unsigned int); + + static int get_port_numa_node(portid_t port_id); + + static int initialize(ErrorHandler *errh); + + inline static bool is_dpdk_packet(Packet* p) { + return p->buffer_destructor() == DPDKDevice::free_pkt || (p->data_packet() && is_dpdk_packet(p->data_packet())); + } + + inline static rte_mbuf* get_pkt(unsigned numa_node); + inline static rte_mbuf* get_pkt(); + static void free_pkt(unsigned char *, size_t, void *pktmbuf); + + static int NB_MBUF; + static int MBUF_DATA_SIZE; + static int MBUF_SIZE; + static int MBUF_CACHE_SIZE; + static int RX_PTHRESH; + static int RX_HTHRESH; + static int RX_WTHRESH; + static int TX_PTHRESH; + static int TX_HTHRESH; + static int TX_WTHRESH; + static String MEMPOOL_PREFIX; + + static unsigned DEF_DEV_RXDESC; + static unsigned DEF_DEV_TXDESC; + + static unsigned DEF_BURST_SIZE; + +private: + + enum Dir { RX, TX }; + + struct DevInfo { + inline DevInfo() : + rx_queues(0,false), tx_queues(0,false), promisc(false), n_rx_descs(0), + n_tx_descs(0), init_mac(), init_mtu(0) { + rx_queues.reserve(128); + tx_queues.reserve(128); + } + + const char* driver; + Vector rx_queues; + Vector tx_queues; + bool promisc; + unsigned n_rx_descs; + unsigned n_tx_descs; + EtherAddress init_mac; + uint16_t init_mtu; + }; + + DevInfo info; + + static bool _is_initialized; + static HashTable _devs; + static struct rte_mempool** _pktmbuf_pools; + static unsigned _nr_pktmbuf_pools; + static bool no_more_buffer_msg_printed; + + int initialize_device(ErrorHandler *errh) CLICK_COLD; + int add_queue(Dir dir, unsigned &queue_id, bool promisc, + unsigned n_desc, ErrorHandler *errh) CLICK_COLD; + + static bool alloc_pktmbufs() CLICK_COLD; + + static DPDKDevice* get_device(const portid_t &port_id) { + return &(_devs.find_insert(port_id, DPDKDevice(port_id)).value()); + } + + +#if RTE_VERSION < RTE_VERSION_NUM(18,05,0,0) + static int get_port_from_pci(uint32_t domain, uint8_t bus, uint8_t dev_id, uint8_t function) { + struct rte_eth_dev_info dev_info; + + uint16_t count = rte_eth_dev_count(); + for (portid_t port_id = 0 ; port_id < count; ++port_id) { + rte_eth_dev_info_get(port_id, &dev_info); + struct rte_pci_addr addr = dev_info.pci_dev->addr; + if (addr.domain == domain && + addr.bus == bus && + addr.devid == dev_id && + addr.function == function) + return port_id; + } + return -1; + } +#endif + + friend class DPDKDeviceArg; + friend class DPDKInfo; +}; + +inline rte_mbuf* DPDKDevice::get_pkt(unsigned numa_node) { + struct rte_mbuf* mbuf = rte_pktmbuf_alloc(get_mpool(numa_node)); + if (unlikely(!mbuf)) { + if (!DPDKDevice::no_more_buffer_msg_printed) + click_chatter("No more DPDK buffer available ! Try using " + "DPDKInfo to allocate more."); + else + DPDKDevice::no_more_buffer_msg_printed = true; + } + return mbuf; +} + +inline rte_mbuf* DPDKDevice::get_pkt() { + return get_pkt(rte_socket_id()); +} + +/** @class DPDKPortArg + @brief Parser class for DPDK Port, either an integer or a PCI address. */ +class DPDKDeviceArg { public: + static bool parse(const String &str, DPDKDevice* &result, const ArgContext &args = ArgContext()); + static String unparse(DPDKDevice* dev) { + return String(dev->port_id); + } +}; + +template<> struct DefaultArg : public DPDKDeviceArg {}; + +CLICK_ENDDECLS + +#endif diff --git a/openflow/include/click/driver.hh b/openflow/include/click/driver.hh new file mode 100644 index 0000000..e60d32b --- /dev/null +++ b/openflow/include/click/driver.hh @@ -0,0 +1,43 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/driver.cc" -*- +#ifndef CLICK_DRIVER_HH +#define CLICK_DRIVER_HH +#include + +#define CLICK_DEFAULT_PROVIDES /* nada */ + +#if defined(CLICK_USERLEVEL) || defined(CLICK_MINIOS) +CLICK_DECLS +class Router; +class Master; +class ErrorHandler; +class Lexer; +struct ArchiveElement; + +void click_static_initialize(); +void click_static_cleanup(); + +Lexer *click_lexer(); +Router *click_read_router(String filename, bool is_expr, ErrorHandler * = 0, bool initialize = true, Master * = 0); + +String click_compile_archive_file(const Vector &ar, + const ArchiveElement *ae, + String package, const String &target, int quiet, + bool &tmpdir_populated, ErrorHandler *errh); + +CLICK_ENDDECLS +#elif CLICK_TOOL +CLICK_DECLS +class ErrorHandler; +struct ArchiveElement; + +void click_static_initialize(); + +String click_compile_archive_file(const Vector &archive, + const ArchiveElement *ae, + String package, const String &target, int quiet, + bool &tmpdir_populated, ErrorHandler *errh); + +CLICK_ENDDECLS +#endif + +#endif diff --git a/openflow/include/click/element.hh b/openflow/include/click/element.hh new file mode 100644 index 0000000..66359c1 --- /dev/null +++ b/openflow/include/click/element.hh @@ -0,0 +1,729 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/element.cc" -*- +#ifndef CLICK_ELEMENT_HH +#define CLICK_ELEMENT_HH +#include +#include +#include +#include +#include +CLICK_DECLS +class Router; +class Master; +class RouterThread; +class Task; +class Timer; +class NotifierSignal; +class Element; +class ErrorHandler; +class Bitvector; +class EtherAddress; + +/** @file + * @brief Click's Element class. + */ + +#ifndef CLICK_ELEMENT_DEPRECATED +# define CLICK_ELEMENT_DEPRECATED CLICK_DEPRECATED +#endif + +class Element { public: + + Element(); + virtual ~Element(); + static int nelements_allocated; + + // RUNTIME + virtual void push(int port, Packet *p); + virtual Packet *pull(int port) CLICK_WARN_UNUSED_RESULT; + virtual Packet *simple_action(Packet *p); + + virtual bool run_task(Task *task); // return true iff did useful work + virtual void run_timer(Timer *timer); +#if CLICK_USERLEVEL + enum { SELECT_READ = 1, SELECT_WRITE = 2 }; + virtual void selected(int fd, int mask); + virtual void selected(int fd); +#endif + + inline void checked_output_push(int port, Packet *p) const; + inline Packet* checked_input_pull(int port) const; + + // ELEMENT CHARACTERISTICS + virtual const char *class_name() const = 0; + + virtual const char *port_count() const; + static const char PORTS_0_0[]; + static const char PORTS_0_1[]; + static const char PORTS_1_0[]; + static const char PORTS_1_1[]; + static const char PORTS_1_1X2[]; + + virtual const char *processing() const; + static const char AGNOSTIC[]; + static const char PUSH[]; + static const char PULL[]; + static const char PUSH_TO_PULL[]; + static const char PULL_TO_PUSH[]; + static const char PROCESSING_A_AH[]; + + virtual const char *flow_code() const; + static const char COMPLETE_FLOW[]; + + virtual const char *flags() const; + int flag_value(int flag) const; + + virtual void *cast(const char *name); + virtual void *port_cast(bool isoutput, int port, const char *name); + + // CONFIGURATION, INITIALIZATION, AND CLEANUP + enum ConfigurePhase { + CONFIGURE_PHASE_FIRST = 0, + CONFIGURE_PHASE_INFO = 20, + CONFIGURE_PHASE_PRIVILEGED = 90, + CONFIGURE_PHASE_DEFAULT = 100, + CONFIGURE_PHASE_LAST = 2000 + }; + virtual int configure_phase() const; + + virtual int configure(Vector &conf, ErrorHandler *errh); + + virtual void add_handlers(); + + virtual int initialize(ErrorHandler *errh); + + virtual void take_state(Element *old_element, ErrorHandler *errh); + virtual Element *hotswap_element() const; + + enum CleanupStage { + CLEANUP_NO_ROUTER, + CLEANUP_BEFORE_CONFIGURE = CLEANUP_NO_ROUTER, + CLEANUP_CONFIGURE_FAILED, + CLEANUP_CONFIGURED, + CLEANUP_INITIALIZE_FAILED, + CLEANUP_INITIALIZED, + CLEANUP_ROUTER_INITIALIZED, + CLEANUP_MANUAL + }; + virtual void cleanup(CleanupStage stage); + + static inline void static_initialize(); + static inline void static_cleanup(); + + // ELEMENT ROUTER CONNECTIONS + String name() const; + virtual String declaration() const; + + inline Router *router() const; + inline int eindex() const; + inline int eindex(Router *r) const; + + /** @brief Return the element's master. */ + inline Master *master() const; + + inline void attach_router(Router *r, int eindex) { + assert(!_router); + _router = r; + _eindex = eindex; + } + + // INPUTS AND OUTPUTS + inline int nports(bool isoutput) const; + inline int ninputs() const; + inline int noutputs() const; + + class Port; + inline const Port &port(bool isoutput, int port) const; + inline const Port &input(int port) const; + inline const Port &output(int port) const; + + inline bool port_active(bool isoutput, int port) const; + inline bool input_is_push(int port) const; + inline bool input_is_pull(int port) const; + inline bool output_is_push(int port) const; + inline bool output_is_pull(int port) const; + void port_flow(bool isoutput, int port, Bitvector*) const; + + // LIVE RECONFIGURATION + String configuration() const; + + virtual bool can_live_reconfigure() const; + virtual int live_reconfigure(Vector&, ErrorHandler*); + + RouterThread *home_thread() const; + +#if CLICK_USERLEVEL + // SELECT + int add_select(int fd, int mask); + int remove_select(int fd, int mask); +#endif + + // HANDLERS + void add_read_handler(const String &name, ReadHandlerCallback read_callback, const void *user_data = 0, uint32_t flags = 0); + void add_read_handler(const String &name, ReadHandlerCallback read_callback, int user_data, uint32_t flags = 0); + void add_read_handler(const char *name, ReadHandlerCallback read_callback, int user_data = 0, uint32_t flags = 0); + void add_write_handler(const String &name, WriteHandlerCallback write_callback, const void *user_data = 0, uint32_t flags = 0); + void add_write_handler(const String &name, WriteHandlerCallback write_callback, int user_data, uint32_t flags = 0); + void add_write_handler(const char *name, WriteHandlerCallback write_callback, int user_data = 0, uint32_t flags = 0); + void set_handler(const String &name, int flags, HandlerCallback callback, const void *read_user_data = 0, const void *write_user_data = 0); + void set_handler(const String &name, int flags, HandlerCallback callback, int read_user_data, int write_user_data = 0); + void set_handler(const char *name, int flags, HandlerCallback callback, int read_user_data = 0, int write_user_data = 0); + int set_handler_flags(const String &name, int set_flags, int clear_flags = 0); + enum { TASKHANDLER_WRITE_SCHEDULED = 1, + TASKHANDLER_WRITE_TICKETS = 2, + TASKHANDLER_WRITE_HOME_THREAD = 4, + TASKHANDLER_WRITE_ALL = 7, + TASKHANDLER_DEFAULT = 6 }; + void add_task_handlers(Task *task, NotifierSignal *signal, int flags, const String &prefix = String()); + inline void add_task_handlers(Task *task, NotifierSignal *signal, const String &prefix = String()) { + add_task_handlers(task, signal, TASKHANDLER_DEFAULT, prefix); + } + inline void add_task_handlers(Task *task, const String &prefix = String()) { + add_task_handlers(task, 0, TASKHANDLER_DEFAULT, prefix); + } + + void add_data_handlers(const char *name, int flags, uint8_t *data); + void add_data_handlers(const char *name, int flags, bool *data); + void add_data_handlers(const char *name, int flags, uint16_t *data); + void add_data_handlers(const char *name, int flags, int *data); + void add_data_handlers(const char *name, int flags, unsigned *data); + void add_data_handlers(const char *name, int flags, atomic_uint32_t *data); + void add_data_handlers(const char *name, int flags, long *data); + void add_data_handlers(const char *name, int flags, unsigned long *data); +#if HAVE_LONG_LONG + void add_data_handlers(const char *name, int flags, long long *data); + void add_data_handlers(const char *name, int flags, unsigned long long *data); +#endif + void add_net_order_data_handlers(const char *name, int flags, uint16_t *data); + void add_net_order_data_handlers(const char *name, int flags, uint32_t *data); +#if HAVE_FLOAT_TYPES + void add_data_handlers(const char *name, int flags, double *data); +#endif + void add_data_handlers(const char *name, int flags, String *data); + void add_data_handlers(const char *name, int flags, IPAddress *data); + void add_data_handlers(const char *name, int flags, EtherAddress *data); + void add_data_handlers(const char *name, int flags, Timestamp *data, bool is_interval = false); + + static String read_positional_handler(Element*, void*); + static String read_keyword_handler(Element*, void*); + static int reconfigure_positional_handler(const String&, Element*, void*, ErrorHandler*); + static int reconfigure_keyword_handler(const String&, Element*, void*, ErrorHandler*); + + virtual int llrpc(unsigned command, void* arg); + int local_llrpc(unsigned command, void* arg); + + class Port { public: + + inline bool active() const; + inline Element* element() const; + inline int port() const; + + inline void push(Packet* p) const; + inline Packet* pull() const; + +#if CLICK_STATS >= 1 + unsigned npackets() const { return _packets; } +#endif + + inline void assign(bool isoutput, Element *e, int port); + + private: + + Element* _e; + int _port; +#if HAVE_BOUND_PORT_TRANSFER + union { + void (*push)(Element *e, int port, Packet *p); + Packet *(*pull)(Element *e, int port); + } _bound; +#endif + +#if CLICK_STATS >= 1 + mutable unsigned _packets; // How many packets have we moved? +#endif +#if CLICK_STATS >= 2 + Element* _owner; // Whose input or output are we? +#endif + + inline Port(); + inline void assign(bool isoutput, Element *owner, Element *e, int port); + + friend class Element; + + }; + + // DEPRECATED + /** @cond never */ + String id() const CLICK_DEPRECATED; + String landmark() const CLICK_DEPRECATED; + /** @endcond never */ + + private: + + enum { INLINE_PORTS = 4 }; + + Port* _ports[2]; + Port _inline_ports[INLINE_PORTS]; + + int _nports[2]; + + Router* _router; + int _eindex; + +#if CLICK_STATS >= 2 + // STATISTICS + unsigned _xfer_calls; // Push and pull calls into this element. + click_cycles_t _xfer_own_cycles; // Cycles spent in self from push and pull. + click_cycles_t _child_cycles; // Cycles spent in children. + + unsigned _task_calls; // Calls to tasks owned by this element. + click_cycles_t _task_own_cycles; // Cycles spent in self from tasks. + + unsigned _timer_calls; // Calls to timers owned by this element. + click_cycles_t _timer_own_cycles; // Cycles spent in self from timers. + + inline void reset_cycles() { + _xfer_calls = _task_calls = _timer_calls = 0; + _xfer_own_cycles = _task_own_cycles = _timer_own_cycles = _child_cycles = 0; + } + static String read_cycles_handler(Element *, void *); + static int write_cycles_handler(const String &, Element *, void *, ErrorHandler *); +#endif + + Element(const Element &); + Element &operator=(const Element &); + + // METHODS USED BY ROUTER + int set_nports(int, int); + int notify_nports(int, int, ErrorHandler *); + enum Processing { VAGNOSTIC, VPUSH, VPULL }; + static int next_processing_code(const char*& p, ErrorHandler* errh); + void processing_vector(int* input_codes, int* output_codes, ErrorHandler*) const; + + void initialize_ports(const int* input_codes, const int* output_codes); + int connect_port(bool isoutput, int port, Element*, int); + + static String read_handlers_handler(Element *e, void *user_data); + void add_default_handlers(bool writable_config); + inline void add_data_handlers(const char *name, int flags, HandlerCallback callback, void *data); + + friend class Router; +#if CLICK_STATS >= 2 + friend class Task; + friend class Master; + friend class TimerSet; +# if CLICK_USERLEVEL + friend class SelectSet; +# endif +#endif + +}; + + +/** @brief Initialize static data for this element class. + * + * Place initialization code for an element class's shared global state in the + * static_initialize() static member function. (For example, the IPFilter + * element class uses static_initialize() to set up various parsing tables.) + * Click drivers will call this function when the element code is loaded, + * before any elements of the class are created. + * + * static_initialize functions are called in an arbitrary and unpredictable + * order (not, for example, the configure_phase() order). Element authors are + * responsible for handling static initialization dependencies. + * + * For Click to find a static_initialize declaration, it must appear inside + * the element class's class declaration on its own line and have the + * following prototype: + * + * @code + * static void static_initialize(); + * @endcode + * + * It must also have public accessibility. + * + * @note In most cases you should also define a static_cleanup() function to + * clean up state initialized by static_initialize(). + * + * @sa Element::static_cleanup + */ +inline void +Element::static_initialize() +{ +} + +/** @brief Clean up static data for this element class. + * + * Place cleanup code for an element class's shared global state in the + * static_cleanup() static member function. Click drivers will call this + * function before unloading the element code. + * + * static_cleanup functions are called in an arbitrary and unpredictable order + * (not, for example, the configure_phase() order, and not the reverse of the + * static_initialize order). Element authors are responsible for handling + * static cleanup dependencies. + * + * For Click to find a static_cleanup declaration, it must appear inside the + * element class's class declaration on its own line and have the following + * prototype: + * + * @code + * static void static_cleanup(); + * @endcode + * + * It must also have public accessibility. + * + * @sa Element::static_initialize + */ +inline void +Element::static_cleanup() +{ +} + +/** @brief Return the element's router. */ +inline Router* +Element::router() const +{ + return _router; +} + +/** @brief Return the element's index within its router. + * @invariant this == router()->element(eindex()) + */ +inline int +Element::eindex() const +{ + return _eindex; +} + +/** @brief Return the element's index within router @a r. + * + * Returns -1 if @a r != router(). */ +inline int +Element::eindex(Router* r) const +{ + return (router() == r ? _eindex : -1); +} + +/** @brief Return the number of input or output ports. + * @param isoutput false for input ports, true for output ports */ +inline int +Element::nports(bool isoutput) const +{ + return _nports[isoutput]; +} + +/** @brief Return the number of input ports. */ +inline int +Element::ninputs() const +{ + return _nports[0]; +} + +/** @brief Return the number of output ports. */ +inline int +Element::noutputs() const +{ + return _nports[1]; +} + +/** @brief Return one of the element's ports. + * @param isoutput false for input ports, true for output ports + * @param port port number + * + * An assertion fails if @a p is out of range. */ +inline const Element::Port& +Element::port(bool isoutput, int port) const +{ + assert((unsigned) port < (unsigned) _nports[isoutput]); + return _ports[isoutput][port]; +} + +/** @brief Return one of the element's input ports. + * @param port port number + * + * An assertion fails if @a port is out of range. + * + * @sa Port, port */ +inline const Element::Port& +Element::input(int port) const +{ + return Element::port(false, port); +} + +/** @brief Return one of the element's output ports. + * @param port port number + * + * An assertion fails if @a port is out of range. + * + * @sa Port, port */ +inline const Element::Port& +Element::output(int port) const +{ + return Element::port(true, port); +} + +/** @brief Check whether a port is active. + * @param isoutput false for input ports, true for output ports + * @param port port number + * + * Returns true iff @a port is in range and @a port is active. Push outputs + * and pull inputs are active; pull outputs and push inputs are not. + * + * @sa Element::Port::active */ +inline bool +Element::port_active(bool isoutput, int port) const +{ + return (unsigned) port < (unsigned) nports(isoutput) + && _ports[isoutput][port].active(); +} + +/** @brief Check whether output @a port is push. + * + * Returns true iff output @a port exists and is push. @sa port_active */ +inline bool +Element::output_is_push(int port) const +{ + return port_active(true, port); +} + +/** @brief Check whether output @a port is pull. + * + * Returns true iff output @a port exists and is pull. */ +inline bool +Element::output_is_pull(int port) const +{ + return (unsigned) port < (unsigned) nports(true) + && !_ports[1][port].active(); +} + +/** @brief Check whether input @a port is pull. + * + * Returns true iff input @a port exists and is pull. @sa port_active */ +inline bool +Element::input_is_pull(int port) const +{ + return port_active(false, port); +} + +/** @brief Check whether input @a port is push. + * + * Returns true iff input @a port exists and is push. */ +inline bool +Element::input_is_push(int port) const +{ + return (unsigned) port < (unsigned) nports(false) + && !_ports[0][port].active(); +} + +#if CLICK_STATS >= 2 +# define PORT_ASSIGN(o) _packets = 0; _owner = (o) +#elif CLICK_STATS >= 1 +# define PORT_ASSIGN(o) _packets = 0; (void) (o) +#else +# define PORT_ASSIGN(o) (void) (o) +#endif + +inline +Element::Port::Port() + : _e(0), _port(-2) +{ + PORT_ASSIGN(0); +} + +inline void +Element::Port::assign(bool isoutput, Element *e, int port) +{ + _e = e; + _port = port; + (void) isoutput; +#if HAVE_BOUND_PORT_TRANSFER + if (e) { + if (isoutput) { + void (Element::*pusher)(int, Packet *) = &Element::push; + _bound.push = (void (*)(Element *, int, Packet *)) (e->*pusher); + } else { + Packet *(Element::*puller)(int) = &Element::pull; + _bound.pull = (Packet *(*)(Element *, int)) (e->*puller); + } + } +#endif +} + +inline void +Element::Port::assign(bool isoutput, Element *owner, Element *e, int port) +{ + PORT_ASSIGN(owner); + assign(isoutput, e, port); +} + +/** @brief Returns whether this port is active (a push output or a pull input). + * + * @sa Element::port_active + */ +inline bool +Element::Port::active() const +{ + return _port >= 0; +} + +/** @brief Returns the element connected to this active port. + * + * Returns 0 if this port is not active(). */ +inline Element* +Element::Port::element() const +{ + return _e; +} + +/** @brief Returns the port number of the port connected to this active port. + * + * Returns < 0 if this port is not active(). */ +inline int +Element::Port::port() const +{ + return _port; +} + +/** @brief Push packet @a p over this port. + * + * Pushes packet @a p downstream through the router configuration by passing + * it to the next element's @link Element::push() push() @endlink function. + * Returns when the rest of the router finishes processing @a p. + * + * This port must be an active() push output port. Usually called from + * element code like @link Element::output output(i) @endlink .push(p). + * + * When element code calls Element::Port::push(@a p), it relinquishes control + * of packet @a p. When push() returns, @a p may have been altered or even + * freed by downstream elements. Thus, you must not use @a p after pushing it + * downstream. To push a copy and keep a copy, see Packet::clone(). + * + * output(i).push(p) basically behaves like the following code, although it + * maintains additional statistics depending on how CLICK_STATS is defined: + * + * @code + * output(i).element()->push(output(i).port(), p); + * @endcode + */ +inline void +Element::Port::push(Packet* p) const +{ + assert(_e && p); +#if CLICK_STATS >= 1 + ++_packets; +#endif +#if CLICK_STATS >= 2 + ++_e->input(_port)._packets; + click_cycles_t start_cycles = click_get_cycles(), + start_child_cycles = _e->_child_cycles; +# if HAVE_BOUND_PORT_TRANSFER + _bound.push(_e, _port, p); +# else + _e->push(_port, p); +# endif + click_cycles_t all_delta = click_get_cycles() - start_cycles, + own_delta = all_delta - (_e->_child_cycles - start_child_cycles); + _e->_xfer_calls += 1; + _e->_xfer_own_cycles += own_delta; + _owner->_child_cycles += all_delta; +#else +# if HAVE_BOUND_PORT_TRANSFER + _bound.push(_e, _port, p); +# else + _e->push(_port, p); +# endif +#endif +} + +/** @brief Pull a packet over this port and return it. + * + * Pulls a packet from upstream in the router configuration by calling the + * previous element's @link Element::pull() pull() @endlink function. When + * the router finishes processing, returns the result. + * + * This port must be an active() pull input port. Usually called from element + * code like @link Element::input input(i) @endlink .pull(). + * + * input(i).pull() basically behaves like the following code, although it + * maintains additional statistics depending on how CLICK_STATS is defined: + * + * @code + * input(i).element()->pull(input(i).port()) + * @endcode + */ +inline Packet* +Element::Port::pull() const +{ + assert(_e); +#if CLICK_STATS >= 2 + click_cycles_t start_cycles = click_get_cycles(), + old_child_cycles = _e->_child_cycles; +# if HAVE_BOUND_PORT_TRANSFER + Packet *p = _bound.pull(_e, _port); +# else + Packet *p = _e->pull(_port); +# endif + if (p) + _e->output(_port)._packets += 1; + click_cycles_t all_delta = click_get_cycles() - start_cycles, + own_delta = all_delta - (_e->_child_cycles - old_child_cycles); + _e->_xfer_calls += 1; + _e->_xfer_own_cycles += own_delta; + _owner->_child_cycles += all_delta; +#else +# if HAVE_BOUND_PORT_TRANSFER + Packet *p = _bound.pull(_e, _port); +# else + Packet *p = _e->pull(_port); +# endif +#endif +#if CLICK_STATS >= 1 + if (p) + ++_packets; +#endif + return p; +} + +/** @brief Push packet @a p to output @a port, or kill it if @a port is out of + * range. + * + * @param port output port number + * @param p packet to push + * + * If @a port is in range (>= 0 and < noutputs()), then push packet @a p + * forward using output(@a port).push(@a p). Otherwise, kill @a p with @a p + * ->kill(). + * + * @note It is invalid to call checked_output_push() on a pull output @a port. + */ +inline void +Element::checked_output_push(int port, Packet* p) const +{ + if ((unsigned) port < (unsigned) noutputs()) + _ports[1][port].push(p); + else + p->kill(); +} + +/** @brief Pull a packet from input @a port, or return 0 if @a port is out of + * range. + * + * @param port input port number + * + * If @a port is in range (>= 0 and < ninputs()), then return the result + * of input(@a port).pull(). Otherwise, return null. + * + * @note It is invalid to call checked_input_pull() on a push input @a port. + */ +inline Packet* +Element::checked_input_pull(int port) const +{ + if ((unsigned) port < (unsigned) ninputs()) + return _ports[0][port].pull(); + else + return 0; +} + +#undef PORT_ASSIGN +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/elemfilter.hh b/openflow/include/click/elemfilter.hh new file mode 100644 index 0000000..725ab47 --- /dev/null +++ b/openflow/include/click/elemfilter.hh @@ -0,0 +1,64 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/elemfilter.cc" -*- +#ifndef CLICK_ELEMFILTER_HH +#define CLICK_ELEMFILTER_HH +#include +CLICK_DECLS + +class ElementFilter { public: + + /** @brief Construct an ElementFilter. */ + ElementFilter() { + } + + /** @brief Destroy an ElementFilter. */ + virtual ~ElementFilter() { + } + + /** @brief Determine whether an element or port matches this filter. + * @param e element + * @param isoutput true for output ports, false for input ports + * @param port port number, or -1 to check the element as a whole + * + * This virtual function is the core of ElementFilter's functionality. + * The function should return true iff the specified element or port + * matches the filter. @a isoutput and @a port define the interesting + * port; if @a port < 0, the element should be checked as a whole. + * + * The default implementation returns false for any element. + */ + virtual bool check_match(Element *e, bool isoutput, int port); + + /** @brief Remove all non-matching elements from @a es. + * @param es array of elements + * + * Calls check_match(e, false, -1) for each element of @a es, removing + * those elements that do not match (i.e., check_match() returns false). + */ + void filter(Vector &es); + +}; + +class CastElementFilter : public ElementFilter { public: + + /** @brief Construct a CastElementFilter. + * @param name cast name of matching elements + */ + CastElementFilter(const String &name); + + /** @brief Determine whether an element matches this filter. + * @param e element + * @param isoutput ignored + * @param port ignored + * @return True iff @a e->cast(@a name) != NULL, where @a name is the + * cast name passed to the constructor. + */ + bool check_match(Element *e, bool isoutput, int port); + + private: + + String _name; + +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/error.hh b/openflow/include/click/error.hh new file mode 100644 index 0000000..c4aef70 --- /dev/null +++ b/openflow/include/click/error.hh @@ -0,0 +1,887 @@ +// -*- related-file-name: "../../lib/error.cc" -*- +#ifndef CLICK_ERROR_HH +#define CLICK_ERROR_HH +#include +#if defined(CLICK_USERLEVEL) || defined(CLICK_TOOL) || defined(CLICK_MINIOS) +# include +#endif +#if CLICK_BSDMODULE +# include +#else +# include +#endif + +#if HAVE_ADDRESSABLE_VA_LIST +# define VA_LIST_REF_T va_list * +# define VA_LIST_DEREF(val) (*(val)) +# define VA_LIST_REF(val) (&(val)) +#else +# define VA_LIST_REF_T va_list +# define VA_LIST_DEREF(val) (val) +# define VA_LIST_REF(val) (val) +#endif +#if __GNUC__ <= 3 +# define ERRH_SENTINEL +#else +# define ERRH_SENTINEL __attribute__((sentinel)) +#endif +CLICK_DECLS + +/** @class ErrorHandler + * @brief Error reporting class. + * + * Click elements report errors through ErrorHandler objects, which represent + * error collectors and printers. ErrorHandlers are passed to configure() and + * initialize() methods explicitly, as well as to write handlers; the + * click_chatter() function calls ErrorHandler implicitly. + * + *

Cooked error messages

+ * + * Most ErrorHandler interactions consist of a simple call like this: + * @code + * errh->error("not enough arguments (%d needed)", 5); + * // prints something like "not enough arguments (5 needed)\n" + * @endcode + * + * This function constructs an error message string from the format arguments, + * annotates the string with a default error level (here, el_error), and + * prints it. Alternate versions take a landmark specifying where the error + * took place: + * @code + * errh->lwarning("file.click:2", "syntax error at '%s'", word.c_str()); + * // prints something like "file.click:2: syntax error at 'foo'\n" + * @endcode + * + *

Raw error messages

+ * + * For finer control over error levels and annotations, construct an error + * message string directly. An error message is a string consisting of one or + * more lines. Each line begins with a set of optional textual @em + * annotations. The following error message has a @em level annotation + * determining how serious the error is (this one is critical, since + * el_critical == 2), and a @em landmark annotation, which specifies where the + * error took place (here, "x.click:1"): + * + * "<2>{l:x.click:1}syntax error" + * + * Click's default ErrorHandlers understand the level and landmark + * annotations. Users can add other arbitrary annotations, which can be + * useful to pass error metadata. A pair of braces ends the annotation area. + * This example has one user annotation eoc, and a message area that + * would be mistaken for an annotation were it not for the {}: + * + * "<2>{l:x.click:1}{eoc:520}{}{not:an annotation}" + * + *

Stacking handlers

+ * + * Some ErrorHandlers stack on top of others, adding useful functionality like + * automatic context description and prefixing. For example, + * ContextErrorHandler can be used to print messages like "In function + * 'xxx':". + * @code + * FileErrorHandler errh1(stderr); + * ContextErrorHandler errh2(&errh1, "While counting to 2:"); + * errh2.error("An error occurred."); + * errh2.error("Another error occurred."); + * // prints "While counting to 2:\n" + * // " An error occurred.\n" + * // " Another error occurred.\n" + * @endcode */ +class ErrorHandler { public: + + /** @brief Error level constants. + * + * Lower values represent more serious errors. Levels 0-7 correspond to + * Linux's error levels. Negative levels request immediate exit; at user + * level, the Click process's exit status is the absolute value of the + * error level. */ + enum Level { + el_abort = -999, ///< Error level that triggers abort(). + el_fatal = -1, ///< Fatal exit error level. + /// Exit status equals -(level). + el_emergency = 0, ///< Emergency error level: system is unusable. + el_alert = 1, ///< Alert error level: action must be taken. + el_critical = 2, ///< Error level for critical conditions. + el_error = 3, ///< Error level for normal error conditions. + el_warning = 4, ///< Error level for warning conditions. + el_notice = 5, ///< Error level for normal, but significant + /// conditions. + el_info = 6, ///< Error level for informational messages. + el_debug = 7 ///< Error level for debug messages. + }; + + /** @brief Error level indicators. */ + static const char e_abort[], + e_fatal[], + e_emergency[], + e_alert[], + e_critical[], + e_error[], + e_warning[], + e_warning_annotated[], + e_notice[], + e_info[], + e_debug[]; + + /** @brief Construct an ErrorHandler. */ + ErrorHandler() + : _nerrors(0) { + } + + virtual ~ErrorHandler() { + } + + + /** @brief Initialize the ErrorHandler implementation. + * @param errh default error handler + * @return @a errh + * + * Call this function to initialize the ErrorHandler implementation. The + * function installs the default conversions, creates the + * silent_handler(), and installs @a errh as the default error handler + * (see default_handler()). + * + * @note The @a errh object becomes the property of the ErrorHandler + * implementation and must not be deleted. + * (ErrorHandler::static_cleanup() will delete it.) Only the first call + * to static_initialize() has any effect. */ + static ErrorHandler *static_initialize(ErrorHandler *errh); + + /** @brief Tear down the ErrorHandler implementation. + * + * Deletes the internal ErrorHandlers and uninstalls default + * conversions. */ + static void static_cleanup(); + + + /** @brief Return the default ErrorHandler. + * @sa static_initialize() */ + static ErrorHandler *default_handler() { + return the_default_handler; + } + + /** @brief Set the default ErrorHandler to @a errh. + * @note @a errh becomes property of the ErrorHandler implementation, + * and will be freed by static_cleanup(). However, any prior default + * handler is @em not destroyed. Callers should delete the prior handler + * when necessary. */ + static void set_default_handler(ErrorHandler *errh); + + /** @brief Return the global silent ErrorHandler. */ + static ErrorHandler *silent_handler() { + return the_silent_handler; + } + + + static const int ok_result; ///< Equals 0, used for error levels + /// <5> and above + static const int error_result; ///< Equals -EINVAL, used for error + /// levels <4> and below + + + /** @brief Print a debug message (level el_debug). + * + * @a fmt and any following arguments are parsed as by format(), and the + * resulting string is passed to xmessage(). */ + void debug(const char *fmt, ...); + /** @brief Print an informational message (level el_info). */ + void message(const char *fmt, ...); + /** @brief Print a warning message (level el_warning). + * @return error_result + * + * The string "warning: " is prepended to every line of the message. */ + int warning(const char *fmt, ...); + /** @brief Print an error message (level el_error). + * @return error_result */ + int error(const char *fmt, ...); + /** @brief Print a fatal error message (level el_fatal). + * @return error_result + * + * In many ErrorHandlers, calling fatal() will cause Click to abort. */ + int fatal(const char *fmt, ...); + + /** @brief Print a debug message with a landmark annotation. */ + void ldebug(const String &landmark, const char *fmt, ...); + /** @brief Print an informational message with a landmark annotation. */ + void lmessage(const String &landmark, const char *fmt, ...); + /** @brief Print a warning message with a landmark annotation. */ + int lwarning(const String &landmark, const char *fmt, ...); + /** @brief Print an error message with a landmark annotation. */ + int lerror(const String &landmark, const char *fmt, ...); + /** @brief Print a fatal error message with a landmark annotation. */ + int lfatal(const String &landmark, const char *fmt, ...); + + + /** @brief Print an annotated error message. + * @return ok_result if the minimum error level was el_notice or higher, + * otherwise error_result + * + * This function drives the virtual functions actually responsible for + * error message decoration and printing. It passes @a str to decorate(), + * separates the result into lines, calls emit() for each line, and calls + * account() with the minimum error level of any line. + * + * Most users will call shorthand functions like error(), warning(), or + * lmessage(), which add relevant annotations to the message. */ + int xmessage(const String &str); + /** @brief Print an error message, adding annotations. + * @param anno annotations + * @param str error message + * + * Shorthand for xmessage(combine_anno(@a str, @a anno)). */ + int xmessage(const String &anno, const String &str) { + return xmessage(combine_anno(str, anno)); + } + /** @brief Format and print an error message, adding annotations. + * @param anno annotations + * @param fmt error message format + * @param val format arguments + * + * Shorthand for xmessage(@a anno, vformat(@a fmt, @a val)). */ + int xmessage(const String &anno, const char *fmt, va_list val) { + return xmessage(anno, vformat(fmt, val)); + } + /** @brief Print an error message, adding landmark and other annotations. + * @param landmark landmark annotation + * @param anno additional annotations + * @param str error message + * + * Shorthand for xmessage(combine_anno(@a anno, make_landmark_anno(@a + * landmark)), @a str). */ + int xmessage(const String &landmark, const String &anno, + const String &str) { + return xmessage(combine_anno(anno, make_landmark_anno(landmark)), str); + } + /** @brief Format and print an error message, adding landmark and other + * annotations. + * @param landmark landmark annotation + * @param anno additional annotations + * @param fmt error message format + * @param val format arguments + * + * Shorthand for xmessage(@a landmark, @a anno, vformat(@a fmt, @a + * val)). */ + int xmessage(const String &landmark, const String &anno, + const char *fmt, va_list val) { + return xmessage(landmark, anno, vformat(fmt, val)); + } + + + /** @brief Return the number of errors reported via this handler. + * + * An error is any message that contains at least one line with error + * level 3 (#el_error) or below. + * + * @note The error count will also contain errors reported via stacked + * handlers. For instance: + * @code + * SilentErrorHandler errh1; + * PrefixErrorHandler errh2(&errh1, ""); + * assert(errh1.nerrors() == 0); + * errh2.error("blah"); + * assert(errh1.nerrors() == 1); + * @endcode + * + * @sa account, clear */ + int nerrors() const { + return _nerrors; + } + + + /** @brief Format an error string. + * @param default_flags default ConversionFlags + * @param fmt printf-like format string + * @return formatted error string + * + * Formats an error string using printf-like % conversions. Conversions + * include: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
\%d, \%iFormat an int as a + * decimal string. Understands flags in #0- +, field widths + * (including *), and precisions.
\%hd, \%ld, \%lld, + * \%zdFormat a short, long, long + * long, or size_t.
\%^16d, \%^32d, \%^64dFormat a 16-, 32-, or 64-bit integer.
\%o, \%u, \%x, + * \%XFormat an unsigned integer in octal, decimal, or + * hexadecimal (with lower-case or upper-case letters).
\%sFormat a C string (const char *). + * The alternate form \%\#s calls String::printable() on the + * input string. Both \%\#s and the alternate form \%'s + * ensure that no part of the string is mistaken for an error + * annotation.
\%cFormat a character. Prints a C-like + * escape if the input character isn't printable ASCII.
\%pFormat a pointer as a hexadecimal + * value.
\%e, \%E, \%f, \%F, + * \%g, \%GFormat a double (user-level + * only).
\%p{...}Call a user-provided conversion function. + * For example, \%p{ip_ptr} reads an IPAddress * argument + * from the argument list, and formats the pointed-to address using + * IPAddress::unparse().
\%\%Format a literal \% character.
\%\<Format a left quote string. Usually + * prints a single quote.
\%\>Format a right quote string. Usually + * prints a single quote.
\%,Format an apostrophe string. Usually + * prints a single quote.
*/ + static String xformat(int default_flags, const char *fmt, ...); + /** @overload */ + static String vxformat(int default_flags, const char *fmt, va_list val); + /** @overload */ + static String xformat(const char *fmt, ...); + /** @overload */ + static String vxformat(const char *fmt, va_list val) { + return vxformat(0, fmt, val); + } + + + /** @brief Format an error string. + * @param fmt format string + * @param val argument list + * + * @warning ErrorHandler users don't need to call this function directly; + * it is called implicitly by the error()/xmessage() functions. + * + * This virtual function is called to format an error message. The + * default implementation returns the result of vxformat(@a fmt, @a val). */ + virtual String vformat(const char *fmt, va_list val); + + /** @brief Format an error string. + * @param fmt format string + * + * @warning ErrorHandler users don't usually need to call this function + * directly. + * + * This is a convenience function that calls vformat(const char *fmt, + * va_list val) for a va_list taken from the ellipsis arguments. */ + String format(const char *fmt, ...); + + /** @brief Decorate an error message. + * @param str error message, possibly with annotations + * @return decorated error message + * + * @warning ErrorHandler users don't need to call this function directly; + * it is called implicitly by the error()/xmessage() functions. + * + * This virtual function is called to decorate an error message before it + * is emitted. The input @a str is an error message string, possibly + * annotated. The default implementation returns @a str unchanged. Other + * ErrorHandlers might add context lines (ContextErrorHandler), prefixes + * (PrefixErrorHandler), or a default landmark (LandmarkErrorHandler). */ + virtual String decorate(const String &str); + + /** @brief Output an error message line. + * @param str error message line, possibly with annotations + * @param user_data callback data, 0 for first line in a message + * @param more true iff this is the last line in the current message + * @return @a user_data to be passed to emit() for the next line + * + * @warning ErrorHandler users don't need to call this function directly; + * it is called implicitly by the error()/xmessage() functions. + * + * After calling decorate(), ErrorHandler splits the message into + * individual lines and calls emit() once per line. ErrorHandler + * subclasses should output the error lines as appropriate; for example, + * FileErrorHandler outputs the error message to a file. + * + * @a str does not contain a newline, but may contain annotations, + * including a landmark annotation. Most ErrorHandlers use parse_anno() + * to extract the landmark annotation, clean it with clean_landmark(), and + * print it ahead of the error message proper. + * + * ErrorHandler can handle multi-line error messages. However, the emit() + * function takes a line at a time; this is more useful in practice for + * most error message printers. The @a user_data and @a more arguments + * can help an ErrorHandler combine the lines of a multi-line error + * message. @a user_data is null for the first line; for second and + * subsequent lines, ErrorHandler passes the result of the last line's + * emit() call. @a more is true iff this is the last line in the current + * message. + * + * The default emit() implementation does nothing. */ + virtual void *emit(const String &str, void *user_data, bool more); + + /** @brief Account for an error message at level @a level. + * @param level minimum error level in the message + * + * @warning ErrorHandler users don't need to call this function directly; + * it is called implicitly by the error()/xmessage() functions. + * + * After calling emit() for the lines of an error message, ErrorHandler + * calls account(), passing the minimum (worst) error level of any message + * line (or 1000 if no line had a level). The default implementation + * updates the nerrors() counter. Some other ErrorHandlers + * add account() behavior that, for example, exits after printing messages + * at el_fatal level or below. */ + virtual void account(int level) { + if (level <= el_error) + ++_nerrors; + } + + /** @brief Clear accumulated error state. + * + * The default implementation sets the nerrors() counter to zero. */ + virtual void clear() { + _nerrors = 0; + } + + + /** @brief Create an error annotation. + * @param name annotation name + * @param value annotation value + * @return annotation string + * + * Returns an error annotation that associates annotation @a name with @a + * value. + * + * If @a name equals "<>", then returns a level annotation of the form + * "<@a value>". @a value must be valid number; if it isn't, the function + * returns the empty string. + * + * Otherwise, @a name must be a nonempty series of letters and digits. + * make_anno() returns a string of the form "{@a name:@a value}", where + * special characters in @a value are quoted with backslashes. */ + static String make_anno(const char *name, const String &value); + + /** @brief Apply annotations from @a anno to every line in @a str. + * @param str string + * @param anno annotation string + * + * The annotations from @a anno are applied to every line in @a str. New + * annotations do not override existing annotations with the same names. + * If the @a anno string ends with non-annotation characters, this + * substring is prefixed to every line in @a str. + * + * For example: + * @code + * combine_anno("Line 1\n{l:old}{x:x}Line 2\n", "<0>{l:new} ") + * // returns "<0>{l:new} Line 1\n<0>{l:old}{x:x} Line 2\n" + * @endcode */ + static String combine_anno(const String &str, const String &anno); + + /** @brief Parse error annotations from a string. + * @param str the string + * @param begin pointer within @a str to start of annotation area + * @param end pointer to end of error region, usually @a str.end() + * @return pointer to first character after annotation area + * @pre @a str.begin() <= {@a begin, @a end} <= @a str.end() + * @post @a begin <= returned value <= @a end + * + * Use this function to skip an error line's annotation area, possibly + * extracting named annotations. + * + * The variable arguments portion consists of a series of pairs of C + * strings and value pointers, terminated by a null character pointer. + * Each C string is an annotation name. The corresponding annotation + * value, if found, is stored as a String object in the value pointer. + * You can also store the int value of an annotation by prefixing + * an annotation name with the '#' character. + * + * For example: + * @code + * String line = "{l:file:30}<4.5>error message\n"; + * String landmark_str, level_str; + * const char *s = ErrorHandler::parse_anno(line, line.begin(), line.end(), + * "l", &landmark_str, "<>", &level_str, (const char *) 0); + * // Results: s points to "error message\n", + * // landmark_str == "file:30", level_str == "4.5" + * + * int level; + * s = ErrorHandler::parse_anno(line, line.begin(), line.end(), + * "#<>", &level, (const char *) 0); + * // Results: s points to "error message\n", level_str == 4 + * @endcode */ + static const char *parse_anno(const String &str, + const char *begin, const char *end, ...) ERRH_SENTINEL; + + /** @brief Skip a string's error annotations. + * @param begin pointer to start of string + * @param end pointer one past end of string + * @return pointer to first character after annotation area + * @post @a begin <= returned value <= @a end + * + * Use this function to skip an error line's annotation area. The error + * line is defined as a pair of iterators. */ + static const char *skip_anno(const char *begin, const char *end) { + String name, value; + const char *x = begin; + do { + x = skip_anno(String(), x, end, &name, &value, false); + } while (name); + return x; + } + + + /** @brief Return a landmark annotation equal to @a x. + * @param x landmark + * + * If @a x is empty, returns the empty string. Otherwise, if @a x looks + * like a formatted annotation (it starts with an open brace), returns @a + * x unchanged. Otherwise, returns make_anno("l", @a x). */ + static String make_landmark_anno(const String &x) { + if (x && x[0] == '{') + return x; + else if (x) + return make_anno("l", x); + else + return String(); + } + + /** @brief Clean the @a landmark. + * @param landmark landmark text + * @param colon if true, append ": " to a nonempty landmark + * + * Removes trailing space and an optional trailing colon from @a landmark + * and returns the result. If @a colon is true, and the cleaned landmark + * isn't the empty string, then appends ": " to the result. */ + static String clean_landmark(const String &landmark, bool colon = false); + + + // error conversions + struct Conversion; + typedef String (*ConversionFunction)(int flags, VA_LIST_REF_T); + enum ConversionFlags { + cf_zero_pad = 1, ///< Set for conversions using the '0' flag. + cf_plus_positive = 2, ///< Set for conversions using the '+' flag. + cf_space_positive = 4, ///< Set for conversions using the ' ' flag. + cf_left_just = 8, ///< Set for conversions using the '-' flag. + cf_alternate_form = 16, ///< Set for conversions using the '#' flag. + cf_singlequote = 32, ///< Set for conversions using the '\'' flag. + cf_uppercase = 64, ///< Set for 'X' conversions (not 'x'). + cf_signed = 128, ///< Set for conversions of signed numbers. + cf_negative = 256, ///< Set for conversions of negative numbers. + cf_utf8 = 1024 ///< Set to use UTF-8 characters on output. + }; + static Conversion *add_conversion(const String &name, ConversionFunction func); + static int remove_conversion(Conversion *conversion); + + private: + + int _nerrors; + + static ErrorHandler *the_default_handler; + static ErrorHandler *the_silent_handler; + + static const char *skip_anno(const String &str, + const char *begin, const char *end, + String *name_result, String *value_result, + bool raw); + +}; + + +/** @class SilentErrorHandler + * @brief An ErrorHandler that does not report messages. + * + * Use SilentErrorHandler when an ErrorHandler object is required, but error + * messages should not be printed. */ +class SilentErrorHandler : public ErrorHandler { public: + + SilentErrorHandler() { + } + +}; + + +/** @class ErrorVeneer + * @brief Base class for ErrorHandlers that forward messages. + * + * ErrorHandlers can stack. Stacking ErrorHandlers simplify modify a message + * and then pass the result to a base ErrorHandler, which does the actual + * printing. The ErrorVeneer base class simplifies the implementation of + * stacking ErrorHandlers. It provides versions of ErrorHandler's format(), + * decorate(), emit(), and account() methods that forward to the underlying + * handler. Note that the clear() method is not automatically + * forwarded. */ +class ErrorVeneer : public ErrorHandler { public: + + /** @brief Construct an ErrorVeneer. + * @param errh base ErrorHandler + * + * If @a errh is 0, then the ErrorVeneer acts like a + * SilentErrorHandler. */ + ErrorVeneer(ErrorHandler *errh) + : _errh(errh) { + } + + String vformat(const char *fmt, va_list val); + String decorate(const String &str); + void *emit(const String &str, void *user_data, bool more); + void account(int level); + + private: + + ErrorHandler *_errh; + +}; + + +#if defined(CLICK_USERLEVEL) || defined(CLICK_TOOL) || defined(CLICK_MINIOS) +/** @class FileErrorHandler + * @brief An ErrorHandler that prints error messages to a given file. + * + * FileErrorHandler is the typical base ErrorHandler used at user level. It + * prints messages to a file passed in to the constructor, and calls exit() or + * abort() based on the error level. */ +class FileErrorHandler : public ErrorHandler { public: + + /** @brief Construct a FileErrorHandler. + * @param f file to print errors + * @param prefix string to prefix every error line */ + FileErrorHandler(FILE *f, const String &prefix = String()); + + void set_default_flags(int default_flags) { + _default_flags = default_flags; + } + + String vformat(const char *fmt, va_list val); + void *emit(const String &str, void *user_data, bool more); + void account(int level); + + private: + + FILE *_f; + String _context; + int _default_flags; + +}; +#endif + + +/** @class LocalErrorHandler + * @brief A convenience stackable ErrorHandler. + * + * It's often convenient to pass a null ErrorHandler pointer when errors + * should not be printed. The LocalErrorHandler class simplifies dealing with + * ErrorHandler pointers that may or may not be null. LocalErrorHandler is a + * transparent layer on the base handler; but if the base handler is null, it + * acts like a SilentErrorHandler. For example: + * @code + * void f(ErrorHandler *errh) { // errh might or might not be null + * LocalErrorHandler lerrh(errh); + * ... lerrh.message("message") ... + * } + * @endcode */ +class LocalErrorHandler : public ErrorVeneer { public: + + /** @brief Construct a LocalErrorHandler. */ + LocalErrorHandler(ErrorHandler *errh) + : ErrorVeneer(errh) { + } + +}; + + +/** @class ContextErrorHandler + * @brief A stackable ErrorHandler that prints context lines. + * + * The stackable ContextErrorHandler adds context to the first error + * message printed, and optionally indent error messages so that they appear + * grouped underneath the context. + * @code + * FileErrorHandler errh1(stderr); + * ContextErrorHandler errh2(&errh1, "While counting to 2:"); + * errh2.error("An error occurred."); + * errh2.error("Another error occurred."); + * // prints "While counting to 2:\n" + * // " An error occurred.\n" + * // " Another error occurred.\n" + * @endcode + * + * To prevent ContextErrorHandler from indenting or printing context for a + * message, add a "{context:no}" annotation to the message's first line. To + * turn off the indent but keep the context, add a "{context:noindent}" + * annotation. + * @code + * FileErrorHandler errh1(stderr); + * ContextErrorHandler errh2(&errh1, "While counting to 2:"); + * errh2.error("{context:no}An error occurred."); + * errh2.error("Another error occurred."); + * // prints "An error occurred.\n" + * // "While counting to 2:\n" + * // " Another error occurred.\n" + * + * FileErrorHandler errh1(stderr); + * PrefixErrorHandler noctx_errh(stderr, "{context:no}"); + * ContextErrorHandler errh2(&errh1, "While counting to 2:"); + * errh2.error("An error occurred."); + * errh2.error("Another error occurred."); + * // prints "An error occurred.\n" + * // "Another error occurred.\n" + * @endcode + * + * ContextErrorHandler adds the "{context:context}" annotation to context + * lines. */ +class ContextErrorHandler : public ErrorVeneer { public: + + /** @brief Construct a ContextErrorHandler. + * @param errh base ErrorHandler + * @param fmt format for context lines + * + * The context message is formed by @a errh->format() using @a fmt and + * any additional arguments. */ + ContextErrorHandler(ErrorHandler *errh, const char *fmt, ...); + + /** @brief Return true iff the context has already been printed. */ + bool context_printed() const { + return _context_printed; + } + + /** @brief Set whether the context has been printed. */ + void set_context_printed(bool x) { + _context_printed = x; + } + + /** @brief Set the context string to @a str. */ + void set_context(const String &str) { + _context = str; + } + + /** @brief Set the indent string to @a str. + * + * The indent string is prepended to all non-context messages. It can + * contain landmarks as well as non-landmark text. The default indent + * string is " " (two spaces). */ + void set_indent(const String &str) { + _indent = str; + } + + /** @brief Set the context landmark to @a str. + * + * The context landmark is used to decorate the context, and also applied + * to any error messages that lack landmarks of their own. The default + * context landmark is empty. + * + * @note The input @a str is passed to + * ErrorHandler::make_landmark_anno(). */ + void set_context_landmark(const String &str) { + _context_landmark = make_landmark_anno(str); + } + + String decorate(const String &str); + + private: + + String _context; + String _indent; + String _context_landmark; + bool _context_printed; + +}; + + +/** @class PrefixErrorHandler + * @brief A stackable ErrorHandler that adds a prefix to error messages. + * + * The stackable ContextErrorHandler adds a prefix to every error line + * printed. For example: + * @code + * FileErrorHandler errh1(stderr); + * PrefixErrorHandler errh2(&errh1, "Blah--"); + * errh2.error("An error occurred."); + * errh2.error("Another error occurred."); + * // prints "Blah--An error occurred.\n" + * // "Blah--Another error occurred.\n" + * @endcode */ +class PrefixErrorHandler : public ErrorVeneer { public: + + /** @brief Construct a PrefixErrorHandler. + * @param errh base ErrorHandler + * @param prefix string to prefix to error lines */ + PrefixErrorHandler(ErrorHandler *errh, const String &prefix); + + String decorate(const String &str); + + private: + + String _prefix; + +}; + + +/** @class LandmarkErrorHandler + * @brief A stackable ErrorHandler that adds a default landmark to error + * messages. + * + * The stackable ContextErrorHandler adds a default landmark to every error + * line printed. Error lines' own landmarks are preserved when they exist. + * For example: + * @code + * FileErrorHandler errh1(stderr); + * LandmarkErrorHandler errh2(&errh1, "file:1"); + * errh2.error("An error occurred."); + * errh2.lerror("file:2", "Another error occurred."); + * // prints "file:1: An error occurred.\n" + * // "file:2: Another error occurred.\n" + * @endcode */ +class LandmarkErrorHandler : public ErrorVeneer { public: + + /** @brief Construct a LandmarkErrorHandler. + * @param errh base ErrorHandler + * @param landmark default landmark */ + LandmarkErrorHandler(ErrorHandler *errh, const String &landmark); + + /** @brief Set the default landmark applied to error messages. */ + void set_landmark(const String &landmark) { + _landmark = make_landmark_anno(landmark); + } + + String decorate(const String &str); + + private: + + String _landmark; + +}; + + +#if defined(CLICK_USERLEVEL) || defined(CLICK_TOOL) || defined(CLICK_MINIOS) +/** @class BailErrorHandler + * @brief A stackable ErrorHandler that exits when errors occur. + * + * The stackable BailErrorHandler, available only at user level, causes the + * Click process to exit if an error worse than a configurable level occurs. */ +class BailErrorHandler : public ErrorVeneer { public: + + /** @brief Construct a BailErrorHandler. + * @param errh base ErrorHandler + * @param level error level that causes premature exit + * + * An error message with level less than or equal to @a el_error will + * cause the process to exit with status 1. */ + BailErrorHandler(ErrorHandler *errh, int level = el_error); + + void account(int level); + + private: + + int _level; + +}; +#endif + +#undef ERRH_SENTINEL +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/etheraddress.hh b/openflow/include/click/etheraddress.hh new file mode 100644 index 0000000..e1e92ca --- /dev/null +++ b/openflow/include/click/etheraddress.hh @@ -0,0 +1,230 @@ +// -*- related-file-name: "../../lib/etheraddress.cc" -*- +#ifndef CLICK_ETHERADDRESS_HH +#define CLICK_ETHERADDRESS_HH +#include +#include +#include +CLICK_DECLS + +class EtherAddress { public: + + typedef uninitialized_type uninitialized_t; + + /** @brief Construct an EtherAddress equal to 00-00-00-00-00-00. */ + inline EtherAddress() { + _data[0] = _data[1] = _data[2] = 0; + } + + /** @brief Construct an EtherAddress from data. + * @param data the address data, in network byte order + * + * The bytes data[0]...data[5] are used to construct the address. */ + explicit inline EtherAddress(const unsigned char *data) { + memcpy(_data, data, 6); + } + + /** @brief Construct an uninitialized EtherAddress. */ + inline EtherAddress(const uninitialized_type &unused) { + (void) unused; + } + + /** @brief Return the broadcast EtherAddress, FF-FF-FF-FF-FF-FF. */ + static EtherAddress make_broadcast() { + return EtherAddress(0xFFFF); + } + + static inline EtherAddress broadcast() CLICK_DEPRECATED; + + + typedef bool (EtherAddress::*unspecified_bool_type)() const; + /** @brief Return true iff the address is not 00-00-00-00-00-00. */ + inline operator unspecified_bool_type() const { + return _data[0] || _data[1] || _data[2] ? &EtherAddress::is_group : 0; + } + + /** @brief Return true iff this address is a group address. + * + * Group addresses have the low-order bit of the first byte set to 1, as + * in 01-00-00-00-00-00 or 03-00-00-02-04-09. */ + inline bool is_group() const { + return data()[0] & 1; + } + + /** @brief Return true iff this address is a "local" address. + * + * Local addresses have the next-to-lowest-order bit of the first byte set + * to 1. */ + inline bool is_local() const { + return data()[0] & 2; + } + + /** @brief Return true iff this address is the broadcast address. + * + * The Ethernet broadcast address is FF-FF-FF-FF-FF-FF. */ + inline bool is_broadcast() const { + return _data[0] + _data[1] + _data[2] == 0x2FFFD; + } + + /** @brief Return true if @a data points to a broadcast address. */ + static inline bool is_broadcast(const unsigned char *data) { +#if HAVE_INDIFFERENT_ALIGNMENT + return reinterpret_cast(data)->is_broadcast(); +#else + return data[0] + data[1] + data[2] + data[3] + data[4] + data[5] == 0x5FA; +#endif + } + + /** @brief Return a pointer to the address data. */ + inline unsigned char *data() { + return reinterpret_cast(_data); + } + + /** @overload */ + inline const unsigned char *data() const { + return reinterpret_cast(_data); + } + + /** @brief Return a pointer to the address data, as an array of + * uint16_ts. */ + inline const uint16_t *sdata() const { + return _data; + } + + /** @brief Hash function. */ + inline size_t hashcode() const { + return (_data[2] | ((size_t) _data[1] << 16)) + ^ ((size_t) _data[0] << 9); + } + + // bool operator==(EtherAddress, EtherAddress); + // bool operator!=(EtherAddress, EtherAddress); + + /** @brief Unparse this address into a dash-separated hex String. + * + * Examples include "00-00-00-00-00-00" and "00-05-4E-50-3C-1A". + * + * @note The IEEE standard for printing Ethernet addresses uses dashes as + * separators, not colons. Use unparse_colon() to unparse into the + * nonstandard colon-separated form. */ + inline String unparse() const { + return unparse_dash(); + } + + /** @brief Unparse this address into a colon-separated hex String. + * + * Examples include "00:00:00:00:00:00" and "00:05:4E:50:3C:1A". + * + * @note Use unparse() to create the IEEE standard dash-separated form. */ + String unparse_colon() const; + + /** @brief Unparse this address into a dash-separated hex String. + * + * Examples include "00-00-00-00-00-00" and "00-05-4E-50-3C-1A". + * + * @note This is the IEEE standard for printing Ethernet addresses. + * @sa unparse_colon */ + String unparse_dash() const; + + /** @brief Unparse this address into a dash-separated hex String. + * @deprecated The unparse() function should be preferred to s(). + * @sa unparse */ + inline String s() const CLICK_DEPRECATED; + + /** @brief Unparse this address into a dash-separated hex String. + * @deprecated The unparse() function should be preferred to this cast. + * @sa unparse */ + inline operator String() const CLICK_DEPRECATED; + + typedef const EtherAddress ¶meter_type; + + private: + + uint16_t _data[3]; + + EtherAddress(uint16_t m) { + _data[0] = _data[1] = _data[2] = m; + } + +} CLICK_SIZE_PACKED_ATTRIBUTE; + +inline EtherAddress EtherAddress::broadcast() { + return make_broadcast(); +} + +inline +EtherAddress::operator String() const +{ + return unparse(); +} + +inline String +EtherAddress::s() const +{ + return unparse(); +} + +/** @relates EtherAddress + @brief Compares two EtherAddress objects for equality. */ +inline bool +operator==(const EtherAddress &a, const EtherAddress &b) +{ + return (a.sdata()[0] == b.sdata()[0] + && a.sdata()[1] == b.sdata()[1] + && a.sdata()[2] == b.sdata()[2]); +} + +/** @relates EtherAddress + @brief Compares two EtherAddress objects for inequality. */ +inline bool +operator!=(const EtherAddress &a, const EtherAddress &b) +{ + return !(a == b); +} + +class StringAccum; +StringAccum &operator<<(StringAccum &, const EtherAddress &); + + +class ArgContext; +class Args; +extern const ArgContext blank_args; + +/** @class EtherAddressArg + @brief Parser class for Ethernet addresses. + + This is the default parser for objects of EtherAddress type. For 6-byte + arrays like "click_ether::ether_shost" and "click_ether::ether_dhost", you + must pass an EtherAddressArg() explicitly: + + @code + struct click_ether ethh; + ... Args(...) ... + .read_mp("SRC", EtherAddressArg(), ethh.ether_shost) + ... + @endcode */ +class EtherAddressArg { public: + typedef void enable_direct_parse; + EtherAddressArg(int flags = 0) : flags_(flags) {} + inline bool parse(const String& str, EtherAddress& value, const ArgContext& args = blank_args) { + return parse(str, value, args, flags_); + } + inline bool parse(const String& str, unsigned char* value, const ArgContext& args = blank_args) { + return parse(str, *reinterpret_cast(value), args); + } + inline bool direct_parse(const String& str, EtherAddress& value, Args& args) { + return direct_parse(str, value, args, flags_); + } + inline bool direct_parse(const String& str, unsigned char* value, Args& args) { + return direct_parse(str, *reinterpret_cast(value), args); + } + private: + int flags_; + static bool parse(const String& str, EtherAddress& value, const ArgContext& args, int flags); + static bool direct_parse(const String& str, EtherAddress& value, Args& args, int flags); +}; + +template<> struct DefaultArg : public EtherAddressArg {}; +template<> struct has_trivial_copy : public true_type {}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/ewma.hh b/openflow/include/click/ewma.hh new file mode 100644 index 0000000..d8ae25f --- /dev/null +++ b/openflow/include/click/ewma.hh @@ -0,0 +1,521 @@ +#ifndef CLICK_EWMA_HH +#define CLICK_EWMA_HH +#include +#include +CLICK_DECLS + +/** @file + * @brief Click's classes for supporting exponentially weighted moving + * averages. + */ + +/** @class DirectEWMAX include/click/ewma.hh + * @brief An exponentially weighted moving average. + * + * The DirectEWMAX template class represents a simple exponentially weighted + * moving average. The average starts out with value 0. The update() + * function adds a new observation to the average. + * + * The template parameter P defines three EWMA parameters: value type, + * stability shift, and scale factor. + * + * The value type is simply the unsigned integral type used to store the + * average. It is also the type of each observation. unsigned + * and uint64_t are examples. + * + * The stability shift specifies alpha, the stability parameter. Concretely, + * alpha = 1. / (2 ** stability_shift). Thus, a stability shift of 4 + * corresponds to an alpha of 1/16. + * + * The scaling factor specifies how many bits of fraction are kept per + * observation. Fraction bits are necessary to account for small differences + * between observations. For example, consider a EWMA with value 0, alpha + * 1/16, and 0 bits of fraction. Assume the EWMA begins to observe a stream + * of observations equal to 1. Despite these observations, the EWMA's value + * will never change from 0, since the 1/16 alpha factor rounds the new + * observations down to 0. At least 4 bits of fraction are required to + * account for this difference. There is a tradeoff: the more bits of + * fraction, the more precise the EWMA, but the less bits available to + * account for large values. + * + * These EWMA parameters are defined by five of P's members, two typedefs and + * three possibly static member functions. + * + *
+ *
P::value_type
+ *
The EWMA's value type. Example: unsigned.
+ * + *
P::signed_value_type
+ *
The signed version of P::value_type. Used internally. + * Example: int.
+ * + *
unsigned P::stability_shift()
+ *
This function should return this EWMA's stability shift + * (see above).
+ * + *
unsigned P::scale()
+ *
This function should return this EWMA's scaling factor + * (see above).
+ * + *
unsigned P::compensation()
+ *
This function should return this EWMA's stability compensation, + * which normally equals 1 @<@< (stability_shift - 1).
+ *
+ * + * Since DirectEWMAX inherits from an object of type P, these members are + * also directly available to callers. + * + * The FixedEWMAXParameters and StabilityEWMAXParameters types are good + * template arguments for DirectEWMAX. + * + * @sa RateEWMAX + */ +template +class DirectEWMAX : public P { public: + + typedef typename P::value_type value_type; + + /** @brief Construct a EWMA with initial average 0. */ + DirectEWMAX() + : _avg(0) { + } + + /** @brief Construct a EWMA with initial scaled average @a scaled_value. */ + DirectEWMAX(value_type scaled_value) + : _avg(scaled_value) { + } + + /** @brief Return the current scaled moving average. + * @note The returned value has scale() bits of fraction. */ + value_type scaled_average() const { + return _avg; + } + + /** @brief Return the current moving average, rounded up. + * @note The returned value is unscaled (has zero bits of fraction). */ + value_type unscaled_average() const { + return (_avg + (P::scaled_one() >> 1)) >> P::scale(); + } + + /** @brief Reset the EWMA to value 0. */ + void clear() { + _avg = 0; + } + + /** @brief Assign the EWMA to scaled average @a scaled_value. */ + inline void assign(value_type scaled_value) { + _avg = scaled_value; + } + + /** @brief Update the moving average with a new observation. + * @param x the observation (unscaled) */ + inline void update(value_type x); + + /** @brief Update the moving average with @a n identical observations. + * @param x the observation (unscaled) + * @param n number of observations + * @note This may be faster than calling update(@a x) @a n + * times. */ + void update_n(value_type x, unsigned n); + + /** @brief Unparse the current average into a String. + * @note The returned value is unscaled, but may contain a fractional + * part. */ + String unparse() const; + + /** @brief Update the moving average with a new observation (deprecated). + * @param x the observation (unscaled) + * @deprecated Use update() instead. */ + inline void update_with(value_type x) CLICK_DEPRECATED; + + private: + + value_type _avg; + +}; + +template +inline void +DirectEWMAX

::update(value_type x) +{ + value_type x_scaled = (x << P::scale()) + P::compensation(); + unsigned stability = P::stability_shift(); +#if HAVE_ARITHMETIC_RIGHT_SHIFT + _avg += static_cast(x_scaled - _avg) >> stability; +#else + if (x_scaled < _avg) + _avg -= (_avg - x_scaled) >> stability; + else + _avg += (x_scaled - _avg) >> stability; +#endif +} + +template +void +DirectEWMAX

::update_n(value_type x, unsigned n) +{ + // XXX use table lookup + value_type x_scaled = x << P::scale(); + if (n >= 100) + _avg = x_scaled; + else { + x_scaled += P::compensation(); + unsigned stability = P::stability_shift(); +#if HAVE_ARITHMETIC_RIGHT_SHIFT + for (; n > 0; n--) + _avg += static_cast(x_scaled - _avg) >> stability; +#else + if (x_scaled < _avg) + for (; n > 0; n--) + _avg -= (_avg - x_scaled) >> stability; + else + for (; n > 0; n--) + _avg += (x_scaled - _avg) >> stability; +#endif + } +} + +template +inline String +DirectEWMAX

::unparse() const +{ + return cp_unparse_real2(scaled_average(), P::scale()); +} + +template +inline void +DirectEWMAX

::update_with(value_type x) +{ + update(x); +} + +/** @class FixedEWMAXParameters include/click/ewma.hh + * @brief Parameters for a EWMA with constant scaling factor and stability + * shift. + * + * The FixedEWMAXParameters template class is used as a template argument to + * DirectEWMAX. It defines a EWMA with fixed constant scaling factor and + * stability shift. FixedEWMAXParameters's first template argument is the + * EWMA's stability shift, its second template argument is the EWMA's scaling + * factor, its third template argument is the EWMA's value type, and the + * fourth template argument is the EWMA's signed value type. + * + * Example 1: DirectEWMAX@ + * @> defines a EWMA with alpha 1/16 (stability shift 4), scaling + * factor 10, and value type unsigned. (These are the default parameters + * available in the DirectEWMA typedef.) + * + * Example 2: DirectEWMAX@ @> defines a EWMA with alpha 1/8 (stability shift 3), + * scaling factor 10, and value type uint64_t. + */ +template +class FixedEWMAXParameters { public: + + typedef T value_type; + typedef U signed_value_type; + + /** @brief Return this EWMA's stability shift. + * @return the 1st template parameter */ + static unsigned stability_shift() { + return STABILITY; + } + + /** @brief Return this EWMA's scaling factor (bits of fraction). + * @return the 2nd template parameter */ + static unsigned scale() { + static_assert(SCALE < sizeof(T) * 8, "SCALE too big for EWMA type."); + return SCALE; + } + + /** @brief Return this EWMA's scaled value for one. */ + static value_type scaled_one() { + return (value_type) 1 << SCALE; + } + + /** @brief Return this EWMA's compensation. + * @return 1 << (stability_shift() - 1) */ + static unsigned compensation() { + return 1 << (STABILITY - 1); + } + +}; + +/** @brief A DirectEWMAX with stability shift 4 (alpha 1/16), scaling factor + * 10 (10 bits of fraction), and underlying type unsigned. */ +typedef DirectEWMAX > DirectEWMA; + +/** @brief A DirectEWMAX with stability shift 3 (alpha 1/8), scaling factor + * 10 (10 bits of fraction), and underlying type unsigned. */ +typedef DirectEWMAX > FastDirectEWMA; + + +/** @class StabilityEWMAXParameters include/click/ewma.hh + * @brief Parameters for a EWMA with constant scaling factor + * and user-settable alpha. + * + * The StabilityEWMAXParameters template class is used as a template argument + * to DirectEWMAX. It defines a EWMA with fixed constant scaling factor. + * StabilityEWMAXParameters's first template argument is the EWMA's scaling + * factor, its second template argument is the EWMA's value type, and the + * third template argument is the EWMA's signed value type. + * + * Example: DirectEWMAX@ + * @> defines a EWMA with user-settable alpha (stability shift) + * initially equal to 1/16, scaling factor 10, and value type unsigned. + * + * A DirectEWMAX@ @> object has + * stability_shift() and set_stability_shift() methods. + */ +template +class StabilityEWMAXParameters { public: + + typedef T value_type; + typedef U signed_value_type; + + /** @brief Construct a StabilityEWMAXParameters with initial alpha 1/16. */ + StabilityEWMAXParameters() + : _stability(4) { + } + + /** @brief Return the current stability shift. + * + * The current alpha equals 1. / (2 ** stability_shift()). */ + unsigned stability_shift() const { + return _stability; + } + + /** @brief Set the current stability shift. + * @param stability_shift new value */ + void set_stability_shift(unsigned stability_shift) { + _stability = stability_shift; + } + + /** @brief Return this EWMA's scaling factor (bits of fraction). + * @return the 1st template parameter */ + static unsigned scale() { + return SCALE; + } + + /** @brief Return this EWMA's scaled value for one. */ + static value_type scaled_one() { + return (value_type) 1 << SCALE; + } + + /** @brief Return this EWMA's compensation. + * @return 1 << (stability_shift() - 1) */ + unsigned compensation() const { + return 1 << (stability_shift() - 1); + } + + private: + + unsigned _stability; + +}; + + + +/** @class RateEWMAX include/click/ewma.hh + * @brief An exponentially weighted moving average used to measure a rate. + * + * The RateEWMAX template class represents an exponentially weighted moving + * average that measures a rate: a count of events per unit time. + * The average starts out with value 0. + * + * RateEWMAX adds to DirectEWMAX a concept of epochs, which are periods of + * time. A RateEWMAX object collects samples over the current epoch. When + * the epoch closes, the collected sample count is used to update the moving + * average. Thus, the moving average is measured in samples per epoch. The + * rate() and unparse_rate() member functions return the rate in samples per + * second, rather than per epoch. These functions use the epoch + * frequency to translate between epochs and seconds. + * + * Note that it often makes sense to call update() before calling + * scaled_average(), rate(), or unparse_rate(), in case an epoch or two has + * passed and the average should take account of passing time. + * + * The template parameter P defines the EWMA parameters required by + * DirectEWMAX, and three others: a rate count, an epoch measurement, and an + * epoch frequency. + * + * The rate count is the number of rates measured per object. Usually it is + * 1. + * + * The epoch measurement is a function that returns the current epoch as an + * unsigned number. Epochs should increase monotonically. + * + * The epoch frequency is the number of epochs per second, and is only used + * by rate() and unparse_rate(). + * + * These are defined by: + * + *

+ *
P::rate_count
+ *
The rate count, as a static constant (for example, defined by an + * enum).
+ * + *
unsigned P::epoch()
+ *
This function returns the current epoch number.
+ * + *
unsigned P::epoch_frequency()
+ *
This function returns the number of epochs per second.
+ *
+ * + * Since RateEWMAX inherits from an object of type P, these members are + * also directly available to callers. + * + * The RateEWMAXParameters type is a good template argument for RateEWMAX. + * + * @sa DirectEWMAX + */ +template +class RateEWMAX : public P { public: + + typedef typename P::value_type value_type; + typedef typename P::signed_value_type signed_value_type; + + /** @brief Create a rate EWMA with initial value(s) 0. */ + RateEWMAX() { + _current_epoch = P::epoch(); + for (unsigned i = 0; i < P::rate_count; i++) + _current[i] = 0; + } + + /** @brief Return the current scaled moving average. + * @param ratenum rate index (0 <= ratenum < rate_count) + * @note The returned value has scale() bits of fraction. + * @note scaled_average() does not check the current epoch. + * If an epoch might have passed since the last update(), you + * should call update(0, @a ratenum) before calling this + * function. */ + signed_value_type scaled_average(unsigned ratenum = 0) const { + // note: return type must be signed! + return _avg[ratenum].scaled_average(); + } + + /** @brief Returns one of the average's scaling factors (bits of + * fraction). */ + unsigned scale(unsigned ratenum = 0) const { + return _avg[ratenum].scale(); + } + + /** @brief Return the current rate in samples per second. + * @param ratenum rate index (0 <= ratenum < rate_count) + * @note The returned value is unscaled. + * @note rate() does not check the current epoch. + * If an epoch might have passed since the last update(), you + * should call update(0, @a ratenum) before calling this + * function. */ + inline int rate(unsigned ratenum = 0) const; + + /** @brief Update the sample count for the current epoch. + * @param delta increment for current epoch sample count + * @param ratenum rate index (0 <= ratenum < rate_count) + * @note If the epoch has changed since the last update(), + * this function applies the last epoch's sample count (if any) + * to the relevant moving average, accounts for any passage of + * time (in case one or more epochs have passed with no samples), + * and clears the sample count for the new epoch. */ + inline void update(signed_value_type delta, unsigned ratenum = 0); + + /** @brief Unparse the current average into a String. + * @param ratenum rate index (0 <= ratenum < rate_count) + * @note The returned value is unscaled, but may contain a fractional + * part. + * @note unparse_rate() does not check the current epoch. + * If an epoch might have passed since the last update(), you + * should call update(0, @a ratenum) before calling this + * function. */ + String unparse_rate(unsigned ratenum = 0) const; + + private: + + unsigned _current_epoch; + value_type _current[P::rate_count]; + DirectEWMAX

_avg[P::rate_count]; + + inline void update_time(unsigned now); + +}; + +/** @class RateEWMAXParameters include/click/ewma.hh + * @brief Parameters for a RateEWMA with constant scaling factor + * and alpha, one rate count, and epochs of jiffies. + * + * The RateEWMAXParameters template class is used as a template argument + * to RateEWMAX. It defines a EWMA with fixed constant scaling factor and + * alpha and one rate count. The EWMA uses jiffies as epochs. Template + * parameters are as for DirectEWMAXParameters. + * + * Example: RateEWMAX@ + * @> defines a rate EWMA with user-settable alpha (stability shift) + * initially equal to 1/16, scaling factor 10, and value type unsigned. + */ +template +class RateEWMAXParameters : public FixedEWMAXParameters { public: + enum { + rate_count = 1 + }; + + /** @brief Return the current epoch number. + * @note RateEWMAXParameters measures epochs in jiffies. */ + static unsigned epoch() { + return click_jiffies(); + } + + /** @brief Return the number of epochs (jiffies) per second. */ + static unsigned epoch_frequency() { + return CLICK_HZ; + } +}; + +/** @brief A RateEWMAX with stability shift 4 (alpha 1/16), scaling factor 10 + * (10 bits of fraction), one rate, and underlying type unsigned + * that measures epochs in jiffies. */ +typedef RateEWMAX > RateEWMA; + + +template +inline void +RateEWMAX

::update_time(unsigned now) +{ + unsigned jj = _current_epoch; + if (now != jj) { + for (unsigned i = 0; i < P::rate_count; i++) { + // adjust the average rate using the last measured packets + _avg[i].update(_current[i]); + + // adjust for time w/ no packets + if (jj + 1 != now) + _avg[i].update_n(0, now - jj - 1); + _current[i] = 0; + } + _current_epoch = now; + } +} + +template +inline void +RateEWMAX

::update(signed_value_type delta, unsigned ratenum) +{ + update_time(P::epoch()); + _current[ratenum] += delta; +} + +template +inline int +RateEWMAX

::rate(unsigned ratenum) const +{ + return (scaled_average(ratenum) * P::epoch_frequency()) >> _avg[ratenum].scale(); +} + +template +inline String +RateEWMAX

::unparse_rate(unsigned ratenum) const +{ + return cp_unparse_real2(scaled_average(ratenum) * P::epoch_frequency(), _avg[ratenum].scale()); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/fixconfig.h b/openflow/include/click/fixconfig.h new file mode 100644 index 0000000..08228e1 --- /dev/null +++ b/openflow/include/click/fixconfig.h @@ -0,0 +1,24 @@ +#ifndef CLICK_FIXCONFIG_H +#define CLICK_FIXCONFIG_H + +#if CLICK_LINUXMODULE && __cplusplus +#include + +#define __builtin_types_compatible_p(a, b) \ + (types_compatible::value) +#endif + +#if CLICK_LINUXMODULE && HAVE_LINUX_ASM_ALTERNATIVE_H +// The .smp_locks section and C++-style weak linkage interact badly. +# if CONFIG_SMP && (defined(__i386__) || defined(__x86_64__)) +# include +CLICK_CXX_PROTECT +# include +# undef LOCK_PREFIX +# define LOCK_PREFIX "lock ; " +CLICK_CXX_UNPROTECT +# include +# endif +#endif + +#endif diff --git a/openflow/include/click/fromfile.hh b/openflow/include/click/fromfile.hh new file mode 100644 index 0000000..de0b911 --- /dev/null +++ b/openflow/include/click/fromfile.hh @@ -0,0 +1,96 @@ +// -*- related-file-name: "../../lib/fromfile.cc"; c-basic-offset: 4 -*- +#ifndef CLICK_FROMFILE_HH +#define CLICK_FROMFILE_HH +#include +#include +#include +CLICK_DECLS +class ErrorHandler; +class Element; +class Packet; +class WritablePacket; + +class FromFile { public: + + FromFile(); + ~FromFile() { cleanup(); } + + const String &filename() const { return _filename; } + String &filename() { return _filename; } + bool initialized() const { return _fd != -1; } + + void set_landmark_pattern(const String &lp) { _landmark_pattern = lp; } + String landmark(const String &landmark_pattern) const; + String landmark() const { return landmark(_landmark_pattern); } + String print_filename() const; + int lineno() const { return _lineno; } + void set_lineno(int lineno) { _lineno = lineno; } + + off_t file_pos() const { return _file_offset + _pos; } + + int configure_keywords(Vector& conf, Element* e, ErrorHandler* errh); + int set_data(const String& data, ErrorHandler* errh); + int initialize(ErrorHandler* errh, bool allow_nonexistent = false); + void add_handlers(Element* e, bool filepos_writable = false) const; + void cleanup(); + void take_state(FromFile &, ErrorHandler *); + + int seek(off_t want, ErrorHandler *); + + int read(void*, uint32_t, ErrorHandler * = 0); + const uint8_t* get_unaligned(size_t, void*, ErrorHandler* = 0); + const uint8_t* get_aligned(size_t, void*, ErrorHandler* = 0); + String get_string(size_t, ErrorHandler* = 0); + Packet* get_packet(size_t, uint32_t sec, uint32_t subsec, ErrorHandler *); + Packet* get_packet_from_data(const void *buf, size_t buf_size, size_t full_size, uint32_t sec, uint32_t subsec, ErrorHandler *); + void shift_pos(int delta) { _pos += delta; } + + int read_line(String &str, ErrorHandler *errh, bool temporary = false); + int peek_line(String &str, ErrorHandler *errh, bool temporary = false); + + int error(ErrorHandler *, const char *format, ...) const; + int warning(ErrorHandler *, const char *format, ...) const; + + private: + + enum { BUFFER_SIZE = 32768 }; + + int _fd; + const uint8_t *_buffer; + uint32_t _pos; + uint32_t _len; + + WritablePacket *_data_packet; + +#ifdef ALLOW_MMAP + bool _mmap; +#endif + +#ifdef ALLOW_MMAP + enum { WANT_MMAP_UNIT = 4194304 }; // 4 MB + size_t _mmap_unit; + off_t _mmap_off; +#endif + + String _filename; + FILE *_pipe; + off_t _file_offset; + String _landmark_pattern; + int _lineno; + +#ifdef ALLOW_MMAP + int read_buffer_mmap(ErrorHandler *); +#endif + int read_buffer(ErrorHandler *); + bool read_packet(ErrorHandler *); + int skip_ahead(ErrorHandler *); + + static String filename_handler(Element *, void *); + static String filesize_handler(Element *, void *); + static String filepos_handler(Element *, void *); + static int filepos_write_handler(const String&, Element*, void*, ErrorHandler*); + +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/gaprate.hh b/openflow/include/click/gaprate.hh new file mode 100644 index 0000000..69a2fb7 --- /dev/null +++ b/openflow/include/click/gaprate.hh @@ -0,0 +1,240 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/gaprate.cc" -*- +#ifndef CLICK_GAPRATE_HH +#define CLICK_GAPRATE_HH +#include +CLICK_DECLS +class ErrorHandler; + +/** @file + * @brief A Click helper class for implementing a uniform rate. + */ + +/** @class GapRate include/click/gaprate.hh + * @brief A helper class for implementing a uniform rate. + * + * The GapRate class helps its user implement a process with a uniform rate: + * a process in which one user event happens every T seconds. GapRate is + * designed to efficiently model high rates. (Contrast this with Timer, + * which can serve a similar function at low rates.) + * + * GapRate is not a great choice for limiting the rates of external + * processes. See TokenBucketX, a token bucket rate limiter. + * + * GapRate models an underlying "true" rated process with the correct rate. + * It also keeps a counter, maintained by its user via the update() method, + * that measures the progress of the user's rated process. The + * needs_update() method compares this counter with its expected value, which + * is determined by the true rated process. If the user's rated process is + * running behind, then needs_update() returns true; the user should trigger + * an event and call the update() method. If the user's rated process is + * just right or is running faster than the true process, then needs_update() + * returns false; the user should not trigger an event. + * + * Creating a non-bursty rate can be expensive and difficult. GapRate + * attempts to create a non-bursty rate using timestamps and some interesting + * microsecond-based arithmetic. External factors can cause scheduling + * hiccups where GapRate is not called as much as expected. GapRate + * compensates for hiccups: the user's rated process may fall up to a full + * second behind the true rated process, then catch up in a burst. More than + * one second's worth of lag is ignored. + * + * The maximum rate GapRate can implement is MAX_RATE events per second. + * + * @sa TokenBucketX, Timer + */ +class GapRate { public: + + /** @brief Construct a GapRate object with initial rate 0. */ + inline GapRate(); + + /** @brief Construct a GapRate object with initial rate @a r. + * @param r initial rate (events per second) */ + inline GapRate(unsigned r); + + /** @brief Return the current rate. */ + inline unsigned rate() const; + + /** @brief Set the current rate to @a r. + * @param r desired rate (events per second) + * + * Rates larger than MAX_RATE are reduced to MAX_RATE. Also performs the + * equivalent of a reset() to flush old state. */ + inline void set_rate(unsigned r); + + /** @brief Set the current rate to @a r. + * @param r desired rate (events per second) + * @param errh error handler + * + * Acts like set_rate(@a r), except that an warning is reported to @a errh + * if @a r is larger than MAX_RATE. */ + void set_rate(unsigned r, ErrorHandler *errh); + + + /** @brief Returns whether the user's rate is behind the true rate. + * @param ts current timestamp + * + * Returns true iff the user's rate is currently behind the true rate, + * meaning the user should cause an event and call update(). */ + inline bool need_update(const Timestamp &ts); + + /** @brief Returns a time when the user's rate will be behind the true rate. + * @pre need_update() has been called at least once. + * @return If the rate is 0, or need_update() has not been called, + * returns Timestamp(). If the user's rate is already behind the true + * rate, returns a time no greater than the argument passed to the last + * need_update(). Otherwise, returns a time in the future when + * need_update() will return true. + */ + inline Timestamp expiry() const; + + /** @brief Increment the user event counter. + * + * Call this function when causing a user event. */ + inline void update(); + + /** @brief Increment the user event counter by @a delta. + * @param delta number of user events + * + * @note This may be faster than calling update() @a delta times. + * Furthermore, @a delta can be negative. */ + inline void update_with(int delta); + + /** @brief Resets the true rate counter. + * + * This function flushes any old information about the true rate counter + * and its relationship to the user's rate counter. */ + inline void reset(); + + + enum { UGAP_SHIFT = 12 }; + enum { MAX_RATE = 1000000U << UGAP_SHIFT }; + + private: + + unsigned _ugap; // (1000000 << UGAP_SHIFT) / _rate + int _sec_count; // number of updates this second so far + Timestamp::seconds_type _tv_sec; // current second + unsigned _rate; // desired rate +#if DEBUG_GAPRATE + Timestamp _last; +#endif + + inline void initialize_rate(unsigned rate); + +}; + +/** @brief Reset the underlying rated process. */ +inline void +GapRate::reset() +{ + _tv_sec = -1; +#if DEBUG_GAPRATE + _last.set_sec(0); +#endif +} + +inline void +GapRate::initialize_rate(unsigned r) +{ + _rate = r; + _ugap = (r == 0 ? MAX_RATE + 1 : MAX_RATE / r); +#if DEBUG_GAPRATE + click_chatter("ugap: %u", _ugap); +#endif +} + +inline void +GapRate::set_rate(unsigned r) +{ + if (r > MAX_RATE) + r = MAX_RATE; + if (_rate != r) { + initialize_rate(r); + if (_tv_sec >= 0 && r != 0) { + Timestamp now = Timestamp::now(); + _sec_count = (now.usec() << UGAP_SHIFT) / _ugap; + } + } +} + +inline +GapRate::GapRate() +{ + initialize_rate(0); + reset(); +} + +inline +GapRate::GapRate(unsigned r) + : _rate(0) +{ + initialize_rate(r); + reset(); +} + +inline unsigned +GapRate::rate() const +{ + return _rate; +} + +inline bool +GapRate::need_update(const Timestamp &now) +{ + // this is an approximation of: + // unsigned need = (unsigned) ((now.usec() / 1000000.0) * _rate) + unsigned need = (now.usec() << UGAP_SHIFT) / _ugap; + + if (_tv_sec < 0) { + // 27.Feb.2005: often OK to send a packet after reset unless rate is + // 0 -- requested by Bart Braem + // check include/click/gaprate.hh (1.2) + _tv_sec = now.sec(); + _sec_count = need + ((now.usec() << UGAP_SHIFT) - (need * _ugap) > _ugap / 2); + } else if (now.sec() > _tv_sec) { + _tv_sec = now.sec(); + if (_sec_count > 0) + _sec_count -= _rate; + } + +#if DEBUG_GAPRATE + click_chatter("%p{timestamp} -> %u @ %u [%d]", &now, need, _sec_count, (int)need >= _sec_count); +#endif + return ((int)need >= _sec_count); +} + +inline void +GapRate::update() +{ + _sec_count++; +} + +inline void +GapRate::update_with(int delta) +{ + _sec_count += delta; +} + +inline Timestamp +GapRate::expiry() const +{ + if (_tv_sec < 0 || _rate == 0) + return Timestamp(); + else if (_sec_count < 0) + return Timestamp(_tv_sec, 0); + else { + Timestamp::seconds_type sec = _tv_sec; + int count = _sec_count; + if ((unsigned) count >= _rate) { + sec += count / _rate; + count = count % _rate; + } + + // uint32_t usec = (int) (count * 1000000.0 / _rate) + uint32_t usec = (count * _ugap) >> UGAP_SHIFT; + return Timestamp::make_usec(sec, usec); + } +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/glue.hh b/openflow/include/click/glue.hh new file mode 100644 index 0000000..1493f56 --- /dev/null +++ b/openflow/include/click/glue.hh @@ -0,0 +1,702 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/glue.cc" -*- +#ifndef CLICK_GLUE_HH +#define CLICK_GLUE_HH +// Removes many common #include

s and abstracts differences between +// kernel and user space, and between operating systems. + +// HEADERS + +#if CLICK_LINUXMODULE + +# define _LOOSE_KERNEL_NAMES 1 /* define ino_t, off_t, etc. */ +# undef __KERNEL_STRICT_NAMES +# ifndef __OPTIMIZE__ +# define __OPTIMIZE__ 1 /* get ntohl() macros. otherwise undefined. */ +# endif +# include +CLICK_CXX_PROTECT +# ifdef WANT_MOD_USE_COUNT +# define __NO_VERSION__ +# include +# define HAVE_MOD_USE_COUNT 1 +# endif +# include +# include +# include +# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) +# include +# include +# include +# else +# include +# endif +# include +# include +# include +CLICK_CXX_UNPROTECT +# include + +#elif CLICK_BSDMODULE + +# include +CLICK_CXX_PROTECT +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include /* XXX: for packages */ +CLICK_CXX_UNPROTECT +# include + +#elif CLICK_MINIOS + +# include +CLICK_CXX_PROTECT +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +CLICK_CXX_UNPROTECT +# include + +#else /* CLICK_USERLEVEL */ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# if CLICK_NS +extern "C" int simclick_gettimeofday(struct timeval *); +# endif +# if HAVE_MULTITHREAD +# include +# include +# endif + +#endif + + +// DEBUGGING OUTPUT +extern "C" { +void click_chatter(const char *fmt, ...); +} + + +// DEBUG MALLOC + +#if CLICK_DMALLOC && (CLICK_LINUXMODULE || CLICK_BSDMODULE || CLICK_MINIOS) +extern uint32_t click_dmalloc_where; +# define CLICK_DMALLOC_REG(s) do { const unsigned char *__str = reinterpret_cast(s); click_dmalloc_where = (__str[0]<<24) | (__str[1]<<16) | (__str[2]<<8) | __str[3]; } while (0) +#else +# define CLICK_DMALLOC_REG(s) +#endif + + +// LALLOC + +#if CLICK_LINUXMODULE +# define CLICK_LALLOC(size) (click_lalloc((size))) +# define CLICK_LFREE(p, size) (click_lfree((p), (size))) +extern "C" { +void *click_lalloc(size_t size); +void click_lfree(volatile void *p, size_t size); +} +#else +# define CLICK_LALLOC(size) ((void *)(new uint8_t[(size)])) +# define CLICK_LFREE(p, size) delete[] ((void) (size), (uint8_t *)(p)) +#endif + + +// RANDOMNESS + +CLICK_DECLS + +/** @brief Return a number between 0 and CLICK_RAND_MAX, inclusive. + * + * CLICK_RAND_MAX is guaranteed to be at least 2^31 - 1. */ +uint32_t click_random(); + +/** @brief Return a number between @a low and @a high, inclusive. + * + * Returns @a low if @a low >= @a high. */ +uint32_t click_random(uint32_t low, uint32_t high); + +/** @brief Set the click_random() seed to @a seed. */ +void click_srandom(uint32_t seed); + +/** @brief Set the click_random() seed using a source of true randomness, + * if available. */ +void click_random_srandom(); + +#if CLICK_BSDMODULE +# define CLICK_RAND_MAX 0x7FFFFFFFU +#elif !CLICK_LINUXMODULE && RAND_MAX >= 0x7FFFFFFFU +# define CLICK_RAND_MAX RAND_MAX +#else +# define CLICK_RAND_MAX 0x7FFFFFFFU +extern uint32_t click_random_seed; +#endif + +#if CLICK_NS +extern uint32_t click_random(); +#else +inline uint32_t click_random() { +# if CLICK_BSDMODULE + return random(); +# elif CLICK_LINUXMODULE + click_random_seed = click_random_seed * 69069L + 5; + return (click_random_seed ^ jiffies) & CLICK_RAND_MAX; // XXX jiffies?? +#elif CLICK_MINIOS + return rand(); +# elif HAVE_RANDOM && CLICK_RAND_MAX == RAND_MAX + // See also click_random() in ns/nsclick.cc + return random(); +# else + return rand(); +# endif +} +#endif + +inline void click_srandom(uint32_t seed) { +#if CLICK_BSDMODULE + srandom(seed); +#elif CLICK_LINUXMODULE + click_random_seed = seed; +#elif CLICK_MINIOS + srand(seed); +#elif CLICK_NS + (void) seed; /* XXX */ +#elif HAVE_RANDOM && CLICK_RAND_MAX == RAND_MAX + srandom(seed); +#else + srand(seed); +#endif +} + +CLICK_ENDDECLS + + +// SORTING + +/** @brief Sort array of elements according to @a compar. + * @param base pointer to array of elements + * @param n number of elements in @a param + * @param size size of an element + * @param compar comparison function + * @param user_data user data for comparison function + * + * Sorts an array of elements. The comparison function is called as "@a + * param(@i a, @i b, @a user_data)", where @i a and @i b are pointers into the + * array starting at @a base, and @a user_data is click_qsort's @a user_data + * parameter. The function should return an integer less than zero, equal to + * zero, or greater than zero depending on whether @i a compares less than @i + * b, equal to @i b, or greater than @i b, respectively. On return the + * elements in the @a param array have been reordered into strictly increasing + * order. The function always returns 0. + * + * Click_qsort() is not a stable sort. + * + * @warning click_qsort() shuffles elements by swapping memory, rather than by + * calling copy constructors or swap(). It is thus not safe for all types. + * In particular, objects like Bitvector that maintain pointers into their own + * representations are not safe to sort with click_qsort(). Conservatively, + * it is safe to sort fundamental data types (like int and pointers), plain + * old data types, and simple objects. It is also safe to sort String and + * StringAccum objects, and to sort Vector objects that contain objects + * that are safe to sort themselves. + * + * @note The implementation is based closely on "Engineering a Sort Function," + * Jon L. Bentley and M. Douglas McIlroy, Software---Practice & + * Experience, 23(11), 1249-1265, Nov. 1993. It has been coded + * iteratively rather than recursively, and does no dynamic memory allocation, + * so it will not exhaust stack space in the kernel. */ +int click_qsort(void *base, size_t n, size_t size, + int (*compar)(const void *a, const void *b, void *user_data), + void *user_data = 0); + +/** @brief Sort array of elements according to @a compar. + * @param base pointer to array of elements + * @param n number of elements in @a param + * @param size size of an element + * @param compar comparison function + * + * @deprecated Prefer the variant where @a compar takes an extra void + * *user_data argument. This variant depends on a nonstandard function + * pointer cast. */ +int click_qsort(void *base, size_t n, size_t size, + int (*compar)(const void *a, const void *b)) CLICK_DEPRECATED; + +/** @brief Generic comparison function useful for click_qsort. + * + * Compares @a a and @a b using operator<(). */ +template int click_compare(const void *a, const void *b, void *) +{ + const T *ta = static_cast(a); + const T *tb = static_cast(b); + return (*ta < *tb ? -1 : (*tb < *ta ? 1 : 0)); +} + +/** @brief Sort array of elements using operator<(). */ +template int click_qsort(T *base, size_t n) +{ + return click_qsort(base, n, sizeof(T), (int (*)(const void *, const void *, void *)) &click_compare); +} + + +// OTHER + +#if CLICK_LINUXMODULE + +extern "C" { + +long strtol(const char *, char **, int); + +inline unsigned long +strtoul(const char *nptr, char **endptr, int base) +{ + return simple_strtoul(nptr, endptr, base); +} + +# if __GNUC__ == 2 && __GNUC_MINOR__ == 96 +int click_strcmp(const char *, const char *); + +inline int +strcmp(const char *a, const char *b) +{ + return click_strcmp(a, b); +} +# endif + +} + +#elif CLICK_BSDMODULE + +/* Char-type glue */ + +# define _U 0x01 /* upper */ +# define _L 0x02 /* lower */ +# define _D 0x04 /* digit */ +# define _C 0x08 /* cntrl */ +# define _P 0x10 /* punct */ +# define _S 0x20 /* white space (space/lf/tab) */ +# define _X 0x40 /* hex digit */ +# define _SP 0x80 /* hard space (0x20) */ + +extern unsigned char _ctype[]; + +# define __ismask(x) (_ctype[(int)(unsigned char)(x)]) +# define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0) + +# define strchr(s, c) index(s, c) + +# if __FreeBSD_version >= 700000 && __FreeBSD_version < 730000 +/* memmove() appeared in the FreeBSD 7.3 kernel */ +extern "C" void *memmove(void *dest, const void *src, size_t len); +# endif + + +typedef struct ifnet net_device; + +#else /* not CLICK_LINUXMODULE || CLICK_BSDMODULE */ + +// provide a definition for net_device +typedef struct device net_device; + +#endif /* CLICK_LINUXMODULE */ + + +// COMPILE-TIME ASSERTION CHECKING + +#if (!defined(__cplusplus) || !HAVE_CXX_STATIC_ASSERT) && !defined(static_assert) +# define static_assert(x, ...) switch ((int) (x)) case 0: case !!((int) (x)): +#endif + + +// PROCESSOR IDENTITIES + +#if CLICK_LINUXMODULE +typedef uint32_t click_processor_t; +# define CLICK_CPU_MAX NR_CPUS +#elif CLICK_USERLEVEL && HAVE_MULTITHREAD +typedef pthread_t click_processor_t; +# define CLICK_CPU_MAX 256 +#else +typedef int8_t click_processor_t; +# if HAVE_MULTITHREAD +# define CLICK_CPU_MAX 256 +# else +# define CLICK_CPU_MAX 1 +# endif +#endif + +inline click_processor_t +click_get_processor() +{ +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) + return get_cpu(); +# else + return current->processor; +# endif +#elif CLICK_USERLEVEL && HAVE_MULTITHREAD + return pthread_self(); +#else + return 0; +#endif +} + +inline void +click_put_processor() +{ +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) +# ifdef put_cpu_no_resched + put_cpu_no_resched(); +# else + put_cpu(); +# endif +# endif +#endif +} + +#if CLICK_USERLEVEL && HAVE_MULTITHREAD && HAVE___THREAD_STORAGE_CLASS +extern __thread int click_current_thread_id; +#endif + +#if CLICK_USERLEVEL +extern int click_nthreads; +#endif + +inline click_processor_t +click_current_processor() +{ +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) + return smp_processor_id(); +# else + return current->processor; +# endif +#elif CLICK_USERLEVEL && HAVE_MULTITHREAD + return pthread_self(); +#else + return 0; +#endif +} + +inline unsigned +click_current_cpu_id() +{ +#if !HAVE_MULTITHREAD + return 0; +#elif CLICK_USERLEVEL +# if HAVE___THREAD_STORAGE_CLASS + return click_current_thread_id & 0xffff; +# else + return sched_getcpu(); +# endif +#else + return click_current_processor(); +#endif +} + +/** + * Return an upper bound to click_current_cpu_id() + */ +inline unsigned +click_max_cpu_ids() +{ +#if CLICK_LINUXMODULE + return NR_CPUS; +#elif CLICK_USERLEVEL && HAVE___THREAD_STORAGE_CLASS + return click_nthreads; +#else //XXX BSDMODULE? + return CLICK_CPU_MAX; +#endif +} + + +inline click_processor_t +click_invalid_processor() +{ +#if CLICK_LINUXMODULE + return -1; +#elif CLICK_USERLEVEL && HAVE_MULTITHREAD + return 0; +#else + return -1; +#endif +} + +// TIMEVALS AND JIFFIES +// click_jiffies_t is the type of click_jiffies() and must be unsigned. +// click_jiffies_difference_t is the signed version of click_jiffies_t. +// CLICK_JIFFIES_MONOTONIC is true if click_jiffies() never goes backwards. + +#if CLICK_LINUXMODULE +# define click_gettimeofday(tvp) (do_gettimeofday(tvp)) +typedef unsigned long click_jiffies_t; +typedef long click_jiffies_difference_t; +# define click_jiffies() (jiffies) +# define CLICK_JIFFIES_MONOTONIC 1 +# define CLICK_HZ HZ +# define click_jiffies_less(a, b) ((click_jiffies_difference_t) ((a) - (b)) < 0) +# define HAS_LONG_CLICK_JIFFIES_T 1 +#elif CLICK_BSDMODULE +# define click_gettimeofday(tvp) (getmicrotime(tvp)) +typedef unsigned click_jiffies_t; +typedef int click_jiffies_difference_t; +# define click_jiffies() (ticks) +# define CLICK_HZ hz +# define click_jiffies_less(a, b) ((click_jiffies_difference_t) ((a) - (b)) < 0) +#else +CLICK_DECLS +void click_gettimeofday(timeval *tvp) CLICK_DEPRECATED; +typedef unsigned click_jiffies_t; +typedef int click_jiffies_difference_t; +click_jiffies_t click_jiffies(); +# define click_jiffies_less(a, b) ((click_jiffies_difference_t) ((a) - (b)) < 0) +CLICK_ENDDECLS +# define CLICK_HZ 1000 +#endif + +#if SIZEOF_CLICK_JIFFIES_T != (HAS_LONG_CLICK_JIFFIES_T ? SIZEOF_LONG : SIZEOF_INT) +# error "SIZEOF_CLICK_JIFFIES_T declared incorrectly" +#endif + + +// TIMEVAL OPERATIONS + +#ifndef timercmp +// Convenience macros for operations on timevals. +// NOTE: 'timercmp' does not work for >= or <=. +# define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +# define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) +# define timercmp(a, b, CMP) \ + (((a)->tv_sec == (b)->tv_sec) ? \ + ((a)->tv_usec CMP (b)->tv_usec) : \ + ((a)->tv_sec CMP (b)->tv_sec)) +#endif +#ifndef timeradd +# define timeradd(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ + if ((result)->tv_usec >= 1000000) \ + { \ + ++(result)->tv_sec; \ + (result)->tv_usec -= 1000000; \ + } \ + } while (0) +#endif +#ifndef timersub +# define timersub(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ + if ((result)->tv_usec < 0) { \ + --(result)->tv_sec; \ + (result)->tv_usec += 1000000; \ + } \ + } while (0) +#endif + +#ifndef CLICK_TIMEVAL_OPERATORS + +inline timeval make_timeval(int sec, int usec) CLICK_DEPRECATED; +inline bool operator==(const timeval &a, const timeval &b) CLICK_DEPRECATED; +inline bool operator!=(const timeval &a, const timeval &b) CLICK_DEPRECATED; +inline bool operator<(const timeval &a, const timeval &b) CLICK_DEPRECATED; +inline bool operator<=(const timeval &a, const timeval &b) CLICK_DEPRECATED; +inline bool operator>(const timeval &a, const timeval &b) CLICK_DEPRECATED; +inline bool operator>=(const timeval &a, const timeval &b) CLICK_DEPRECATED; +inline timeval &operator+=(timeval &a, const timeval &b) CLICK_DEPRECATED; +inline timeval &operator-=(timeval &a, const timeval &b) CLICK_DEPRECATED; +inline timeval operator+(timeval a, const timeval &b) CLICK_DEPRECATED; +inline timeval operator-(timeval a, const timeval &b) CLICK_DEPRECATED; + +inline struct timeval +make_timeval(int sec, int usec) +{ + struct timeval tv; + tv.tv_sec = sec; + tv.tv_usec = usec; + return tv; +} + +inline bool +operator==(const struct timeval &a, const struct timeval &b) +{ + return a.tv_sec == b.tv_sec && a.tv_usec == b.tv_usec; +} + +inline bool +operator!=(const struct timeval &a, const struct timeval &b) +{ + return a.tv_sec != b.tv_sec || a.tv_usec != b.tv_usec; +} + +inline bool +operator<(const struct timeval &a, const struct timeval &b) +{ + return a.tv_sec < b.tv_sec || (a.tv_sec == b.tv_sec && a.tv_usec < b.tv_usec); +} + +inline bool +operator<=(const struct timeval &a, const struct timeval &b) +{ + return a.tv_sec < b.tv_sec || (a.tv_sec == b.tv_sec && a.tv_usec <= b.tv_usec); +} + +inline bool +operator>=(const struct timeval &a, const struct timeval &b) +{ + return a.tv_sec > b.tv_sec || (a.tv_sec == b.tv_sec && a.tv_usec >= b.tv_usec); +} + +inline bool +operator>(const struct timeval &a, const struct timeval &b) +{ + return a.tv_sec > b.tv_sec || (a.tv_sec == b.tv_sec && a.tv_usec > b.tv_usec); +} + +inline struct timeval & +operator+=(struct timeval &a, const struct timeval &b) +{ + timeradd(&a, &b, &a); + return a; +} + +inline struct timeval & +operator-=(struct timeval &a, const struct timeval &b) +{ + timersub(&a, &b, &a); + return a; +} + +inline struct timeval +operator+(struct timeval a, const struct timeval &b) +{ + timeradd(&a, &b, &a); + return a; +} + +inline struct timeval +operator-(struct timeval a, const struct timeval &b) +{ + timersub(&a, &b, &a); + return a; +} + +#endif + +CLICK_DECLS +class StringAccum; +StringAccum &operator<<(StringAccum &, const struct timeval &); +CLICK_ENDDECLS + + +// BYTE ORDER + +#ifndef le16_to_cpu +# if CLICK_BYTE_ORDER == CLICK_LITTLE_ENDIAN +# define le16_to_cpu(x) (x) +# define cpu_to_le16(x) (x) +# define le32_to_cpu(x) (x) +# define cpu_to_le32(x) (x) +# elif CLICK_BYTE_ORDER == CLICK_BIG_ENDIAN && defined(__APPLE__) +# include +# define le16_to_cpu(x) NXSwapShort((x)) +# define cpu_to_le16(x) NXSwapShort((x)) +# define le32_to_cpu(x) NXSwapInt((x)) +# define cpu_to_le32(x) NXSwapInt((x)) +# elif CLICK_BYTE_ORDER == CLICK_BIG_ENDIAN && HAVE_BYTESWAP_H +# include +# define le16_to_cpu(x) bswap_16((x)) +# define cpu_to_le16(x) bswap_16((x)) +# define le32_to_cpu(x) bswap_32((x)) +# define cpu_to_le32(x) bswap_32((x)) +# elif CLICK_BYTE_ORDER == CLICK_BIG_ENDIAN +# define le16_to_cpu(x) ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8)) +# define cpu_to_le16(x) le16_to_cpu((x)) +# define le32_to_cpu(x) (le16_to_cpu((x) >> 16) | (le16_to_cpu(x) << 16)) +# define cpu_to_le32(x) le32_to_cpu((x)) +# else +/* leave them undefined */ +# endif +#endif + + +// CYCLE COUNTS + +CLICK_DECLS + +#if HAVE_INT64_TYPES +typedef uint64_t click_cycles_t; +#else +typedef uint32_t click_cycles_t; +#endif + +inline click_cycles_t +click_get_cycles() +{ +#if CLICK_LINUXMODULE && HAVE_INT64_TYPES && __i386__ + uint64_t x; + __asm__ __volatile__ ("rdtsc" : "=A" (x)); + return x; +#elif CLICK_LINUXMODULE && HAVE_INT64_TYPES && __x86_64__ + uint32_t xlo, xhi; + __asm__ __volatile__ ("rdtsc" : "=a" (xlo), "=d" (xhi)); + return xlo | (((uint64_t) xhi) << 32); +#elif CLICK_LINUXMODULE && __i386__ + uint32_t xlo, xhi; + __asm__ __volatile__ ("rdtsc" : "=a" (xlo), "=d" (xhi)); + return xlo; +#elif CLICK_BSDMODULE + return rdtsc(); +#elif CLICK_USERLEVEL && HAVE_INT64_TYPES && __i386__ + uint64_t x; + __asm__ __volatile__ ("rdtsc" : "=A" (x)); + return x; +#elif CLICK_USERLEVEL && HAVE_INT64_TYPES && __x86_64__ + uint32_t xlo, xhi; + __asm__ __volatile__ ("rdtsc" : "=a" (xlo), "=d" (xhi)); + return xlo | (((uint64_t) xhi) << 32); +#elif CLICK_USERLEVEL && __i386__ + uint32_t xlo, xhi; + __asm__ __volatile__ ("rdtsc" : "=a" (xlo), "=d" (xhi)); + return xlo; +#elif CLICK_MINIOS + /* FIXME: Implement click_get_cycles for MiniOS */ + return 0; +#else + // add other architectures here + return 0; +#endif +} + +CLICK_ENDDECLS + +#endif diff --git a/openflow/include/click/handler.hh b/openflow/include/click/handler.hh new file mode 100644 index 0000000..902a836 --- /dev/null +++ b/openflow/include/click/handler.hh @@ -0,0 +1,337 @@ +#ifndef CLICK_HANDLER_HH +#define CLICK_HANDLER_HH 1 +#include +CLICK_DECLS +class Element; +class ErrorHandler; +class Handler; + +/** @file + * @brief The Handler class for router handlers. + */ + +typedef int (*HandlerCallback)(int operation, String &data, Element *element, + const Handler *handler, ErrorHandler *errh); +typedef String (*ReadHandlerCallback)(Element *handler, void *user_data); +typedef int (*WriteHandlerCallback)(const String &data, Element *element, + void *user_data, ErrorHandler *errh); + +class Handler { public: + + enum Flags { + f_read = 0x0001, ///< @brief Handler supports read operations. + f_write = 0x0002, ///< @brief Handler supports write operations. + f_read_param = 0x0004, ///< @brief Read handler takes parameters. + f_exclusive = 0, ///< @brief Handler is exclusive (the default): + /// router threads must stop while it is + /// called. + f_nonexclusive = 0x0020,///< @brief Handler is nonexclusive: router + /// threads don't need to stop while it is + /// called. + f_raw = 0x0040, ///< @brief Don't add newline to results. + f_read_private = 0x0080,///< @brief Read handler private (invisible + /// outside the router configuration). + f_write_private = 0x0100,///< @brief Write handler private (invisible + /// outside the router configuration). + f_deprecated = 0x0200, ///< @brief Handler is deprecated and available + /// only for compatibility. + f_uncommon = 0x0400, ///< @brief User interfaces should not display + /// handler by default. + f_calm = 0x0800, ///< @brief Read handler value changes rarely. + f_expensive = 0x1000, ///< @brief Read handler is expensive to call. + f_button = 0x2000, ///< @brief Write handler ignores data. + f_checkbox = 0x4000, ///< @brief Read/write handler is boolean and + /// should be rendered as a checkbox. + f_driver0 = 1U << 26, + f_driver1 = 1U << 27, ///< @brief Uninterpreted handler flags + /// available for drivers. + f_user_shift = 28, + f_user0 = 1U << f_user_shift, + ///< @brief First uninterpreted handler flag + /// available for element-specific use. + /// Equals 1 << f_user_shift. + + f_read_comprehensive = 0x0008, + f_write_comprehensive = 0x0010, + f_special = f_read | f_write | f_read_param | f_read_comprehensive | f_write_comprehensive + ///< @brief These flags may not be set by + /// Router::set_handler_flags(). + }; + + /** @brief Return this handler's name. */ + inline const String &name() const { + return _name; + } + + /** @brief Return this handler's flags. + * + * The result is a bitwise-or of flags from the Flags enumeration type. */ + inline uint32_t flags() const { + return _flags; + } + + /** @brief Return this handler's callback data. + * @param op either f_read or f_write. */ + inline void *user_data(int op) const { + return op == f_write ? _write_user_data : _read_user_data; + } + + /** @brief Return this handler's read callback data. */ + inline void *read_user_data() const { + return _read_user_data; + } + + /** @brief Return this handler's write callback data. */ + inline void *write_user_data() const { + return _write_user_data; + } + + /** @cond never */ + inline void *user_data1() const CLICK_DEPRECATED; + inline void *user_data2() const CLICK_DEPRECATED; + /** @endcond never */ + + + /** @brief Test if this is a valid read handler. */ + inline bool readable() const { + return _flags & f_read; + } + + /** @brief Test if this is a valid read handler that may accept + * parameters. */ + inline bool read_param() const { + return _flags & f_read_param; + } + + /** @brief Test if this is a public read handler. + * + * Private handlers may be not called from outside the router + * configuration. Handlers are public by default; to make a read handler + * private, add the f_read_private flag. */ + inline bool read_visible() const { + return (_flags & (f_read | f_read_private)) == f_read; + } + + /** @brief Test if this is a valid write handler. */ + inline bool writable() const { + return _flags & f_write; + } + + /** @brief Test if this is a public write handler. + * + * Private handlers may not be called from outside the router + * configuration. Handlers are public by default; to make a write handler + * private, add the f_write_private flag. */ + inline bool write_visible() const { + return (_flags & (f_write | f_write_private)) == f_write; + } + + /** @brief Test if this is a public read or write handler. */ + inline bool visible() const { + return read_visible() || write_visible(); + } + + /** @brief Test if this handler can execute concurrently with other + * handlers. */ + inline bool allow_concurrent_handlers() const { + return (_flags & f_nonexclusive); + } + + /** @brief Test if this handler can execute concurrently with + * router threads. */ + inline bool allow_concurrent_threads() const { + return (_flags & f_nonexclusive); + } + + /** @brief Test if spaces should be preserved when calling this handler. + * + * Some Click drivers perform some convenience processing on handler + * values, for example by removing a terminating newline from write + * handler values or adding a terminating newline to read handler values. + * Raw handlers do not have their values manipulated in this way. Rawness + * is set by the f_raw flag. + * + *
    + *
  • The linuxmodule driver adds a terminating newline to non-raw read + * handler values, but does not modify raw read handlers' values in any + * way.
  • + *
  • The same applies to handler values returned by the userlevel + * driver's -h option.
  • + *
  • The linuxmodule driver removes an optional terminating newline from + * a one-line non-raw write handler value, but does not modify raw write + * handlers' values in any way.
  • + *
*/ + inline bool raw() const { + return _flags & f_raw; + } + + + /** @brief Call a read handler, possibly with parameters. + * @param e element on which to call the handler + * @param param parameters, or an empty string if no parameters + * @param errh optional error handler + * + * The element must be nonnull; to call a global handler, pass the + * relevant router's Router::root_element(). @a errh may be null, in + * which case errors are reported to ErrorHandler::silent_handler(). */ + String call_read(Element *e, const String ¶m, ErrorHandler *errh) const; + + /** @brief Call a read handler without parameters. + * @param e element on which to call the handler + * @param errh error handler + * + * The element must be nonnull; to call a global handler, pass the + * relevant router's Router::root_element(). @a errh may be null, in + * which case errors are ignored. */ + inline String call_read(Element *e, ErrorHandler *errh = 0) const { + return call_read(e, String(), errh); + } + + /** @brief Call a write handler. + * @param value value to write to the handler + * @param e element on which to call the handler + * @param errh optional error handler + * + * The element must be nonnull; to call a global handler, pass the + * relevant router's Router::root_element(). @a errh may be null, in + * which case errors are reported to ErrorHandler::silent_handler(). */ + int call_write(const String &value, Element *e, ErrorHandler *errh) const; + + + /** @brief Unparse this handler's name. + * @param e relevant element + * + * If @a e is an actual element, then returns "ENAME.HNAME", where ENAME + * is @a e's @link Element::name() name@endlink and HNAME is this + * handler's name(). Otherwise, just returns name(). */ + String unparse_name(Element *e) const; + + /** @brief Unparse a handler name. + * @param e relevant element, if any + * @param hname handler name + * + * If @a e is an actual element on some router, then returns + * "ENAME.hname", where ENAME is @a e's @link Element::name() + * name@endlink. Otherwise, just returns @a hname.*/ + static String unparse_name(Element *e, const String &hname); + + + /** @brief Returns a handler incapable of doing anything. + * + * The returned handler returns false for readable() and writable() and + * has flags() of zero. */ + static inline const Handler *blank_handler() { + return the_blank_handler; + } + + + /** @cond never */ + enum { + h_read = f_read, + h_write = f_write, + h_read_param = f_read_param, + h_exclusive = f_exclusive, + h_nonexclusive = f_nonexclusive, + h_raw = f_raw, + h_read_private = f_read_private, + h_write_private = f_write_private, + h_deprecated = f_deprecated, + h_uncommon = f_uncommon, + h_calm = f_calm, + h_expensive = f_expensive, + h_button = f_button, + h_checkbox = f_checkbox, + h_driver_flag_0 = f_driver0, + h_driver_flag_1 = f_driver1, + h_user_flag_shift = f_user_shift, + h_user_flag_0 = f_user0, + h_read_comprehensive = f_read_comprehensive, + h_write_comprehensive = f_write_comprehensive, + h_special_flags = f_special + }; + enum DeprecatedFlags { + OP_READ = f_read, + OP_WRITE = f_write, + READ_PARAM = f_read_param, + RAW = f_raw, + // READ_PRIVATE = f_read_private, + // WRITE_PRIVATE = f_write_private, + // DEPRECATED = f_deprecated, + // UNCOMMON = f_uncommon, + CALM = f_calm, + EXPENSIVE = f_expensive, + BUTTON = f_button, + CHECKBOX = f_checkbox, + USER_FLAG_SHIFT = f_user_shift, + USER_FLAG_0 = f_user0 + }; + enum CLICK_DEPRECATED { + EXCLUSIVE = f_exclusive, + NONEXCLUSIVE = f_nonexclusive + }; + /** @endcond never */ + + /** @cond never */ + /** @brief Call a read handler without parameters, passing new user_data(). + * @param e element on which to call the handler + * @param new_user_data new user data + * + * This function should only be used for special purposes. It fails + * unless called on a handler created with a ReadHandlerCallback. */ + inline String __call_read(Element *e, void *new_user_data) const { + assert((_flags & (f_read | f_read_comprehensive)) == f_read); + return _read_hook.r(e, new_user_data); + } + /** @endcond never */ + + private: + + String _name; + union { + HandlerCallback h; + ReadHandlerCallback r; + } _read_hook; + union { + HandlerCallback h; + WriteHandlerCallback w; + } _write_hook; + void *_read_user_data; + void *_write_user_data; + uint32_t _flags; + int _use_count; + int _next_by_name; + + static const Handler *the_blank_handler; + + Handler(const String & = String()); + + inline void combine(const Handler &x); + inline bool compatible(const Handler &x) const; + + friend class Router; + +}; + +/* The largest size a write handler is allowed to have. */ +#define LARGEST_HANDLER_WRITE 65536 + +typedef HandlerCallback HandlerHook CLICK_DEPRECATED; +typedef ReadHandlerCallback ReadHandlerHook CLICK_DEPRECATED; +typedef WriteHandlerCallback WriteHandlerHook CLICK_DEPRECATED; + +/** @cond never */ +inline void * +Handler::user_data1() const +{ + return _read_user_data; +} + +inline void * +Handler::user_data2() const +{ + return _write_user_data; +} +/** @endcond never */ + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/handlercall.hh b/openflow/include/click/handlercall.hh new file mode 100644 index 0000000..2e116aa --- /dev/null +++ b/openflow/include/click/handlercall.hh @@ -0,0 +1,577 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/handlercall.cc" -*- +#ifndef CLICK_HANDLERCALL_HH +#define CLICK_HANDLERCALL_HH +#include +CLICK_DECLS +class VariableExpander; + +/** @brief Convenience class for calling handlers. + * + * The HandlerCall class simplifies the process of calling Click handlers. + * (The lower-level interface is the Handler class.) HandlerCall is used in + * two ways: (1) to call handlers immediately via static member functions, + * and (2) to set up future handler calls via HandlerCall objects. The + * immediate handler call functions take handler names as arguments and + * perform all necessary error checks before calling handlers, if any. A + * HandlerCall object encapsulates a handler reference (possibly including + * parameters), again automating all necessary error checks. + * + *

Immediate Handler Calls

+ * + * This example code shows how to use the HandlerCall functions for calling + * handlers immediately. + * + * @code + * class YourElement { ... + * Element *_other; + * } + * + * void YourElement::function() { + * // Call _other's "config" read handler. + * String result = HandlerCall::call_read(_other, "config"); + * + * // The same, providing an error handler to print errors. + * ErrorHandler *errh = ErrorHandler::default_handler(); + * result = HandlerCall::call_read(_other, "config", errh); + * // (Each function takes an optional last argument of "errh".) + * + * // Call the "foo.config" read handler. Search for element "foo" in + * // the current compound element context. + * result = HandlerCall::call_read("foo.config", this); + * + * // Call the global "config" read handler for the current router. + * result = HandlerCall::call_read("config", this); + * + * // Call _other's "stop" write handler with empty value. + * int success = HandlerCall::call_write(_other, "stop"); + * + * // Call _other's "config" write handler with value "blah". + * success = HandlerCall::call_write(_other, "config", "blah"); + * + * // Call the "foo.config" write handler with value "blah". + * success = HandlerCall::call_write("foo.config blah", this); + * // Or, alternately: + * success = HandlerCall::call_write("foo.config", "blah", this); + * } + * @endcode + * + *

HandlerCall Objects

+ * + * This example code shows how to use the HandlerCall objects to call + * handlers with simplified error checking. + * + * @code + * class YourElement { ... + * HandlerCall _read_call; + * HandlerCall _write_call; + * } + * + * YourElement::YourElement() + * : _read_call(), _write_call() { + * } + * + * int YourElement::configure(Vector &conf, ErrorHandler *errh) { + * return cp_va_kparse(conf, this, errh, + * "READ_CALL", cpkP, cpHandlerCallRead, &_read_call, + * "WRITE_CALL", cpkP, cpHandlerCallWrite, &_write_call, + * cpEnd); + * } + * + * int YourElement::initialize(ErrorHandler *errh) { + * if ((_read_call && _read_call.initialize_read(this, errh) < 0) + * || (_write_call && _write_call.initialize_write(this, errh) < 0)) + * return -1; + * return 0; + * } + * + * void YourElement::function() { + * // call _read_call, print result + * if (_read_call) + * click_chatter("%s", _read_call.call_read()); + * + * // call _write_call with error handler + * if (_write_call) + * _write_call.call_write(ErrorHandler::default_handler()); + * } + * @endcode + * + * If usually your element's handler calls aren't used, you can save a small + * amount of space by using pointers to HandlerCall objects, as in this + * example. The cpHandlerCallPtrRead and cpHandlerCallPtrWrite types allow + * the _read_call and _write_call members to start out as null pointers. + * + * @code + * class YourElement { ... + * HandlerCall *_read_call; + * HandlerCall *_write_call; + * } + * + * YourElement::YourElement() + * : _read_call(0), _write_call(0) { + * } + * + * int YourElement::configure(Vector &conf, ErrorHandler *errh) { + * return cp_va_kparse(conf, this, errh, + * "READ_CALL", cpkP, cpHandlerCallPtrRead, &_read_call, + * "WRITE_CALL", cpkP, cpHandlerCallPtrWrite, &_write_call, + * cpEnd); + * } + * + * int YourElement::initialize(ErrorHandler *errh) { + * if ((_read_call && _read_call->initialize_read(this, errh) < 0) + * || (_write_call && _write_call->initialize_write(this, errh) < 0)) + * return -1; + * return 0; + * } + * + * void YourElement::cleanup(CleanupStage) { + * delete _read_call; + * delete _write_call; + * } + * + * void YourElement::function() { + * // call _read_call, print result + * if (_read_call) + * click_chatter("%s", _read_call->call_read()); + * + * // call _write_call with error handler + * if (_write_call) + * _write_call->call_write(ErrorHandler::default_handler()); + * } + * @endcode + */ +class HandlerCall { public: + + /** @name Immediate Handler Calls */ + //@{ + static String call_read(Element *e, const String &hname, + ErrorHandler *errh = 0); + static String call_read(const String &hdesc, const Element *context, + ErrorHandler *errh = 0); + static int call_write(Element *e, const String &hname, + ErrorHandler *errh = 0); + static int call_write(Element *e, const String &hname, const String &value, + ErrorHandler *errh = 0); + static int call_write(const String &hdesc, + const Element *context, ErrorHandler *errh = 0); + static int call_write(const String &hdesc, const String &value, + const Element *context, ErrorHandler *errh = 0); + //@} + + + + /** @brief Construct an empty HandlerCall. + * + * Any attempt to read, write, or initialize the HandlerCall will + * fail. */ + HandlerCall() + : _e(0), _h(Handler::blank_handler()) { + } + + /** @brief Construct a HandlerCall described by @a hdesc. + * @param hdesc handler description "[ename.]hname[ value]" + * + * Although the resulting HandlerCall isn't empty, it must be initialized + * before it can be used. It returns false for initialized(). The + * handler description is not checked for syntax errors, though; + * initialize() does that. */ + HandlerCall(const String &hdesc) + : _e(reinterpret_cast(4)), _h(Handler::blank_handler()), + _value(hdesc) { + } + + + enum Flags { + readable = Handler::f_read, + f_read = Handler::f_read, + writable = Handler::f_write, + f_write = Handler::f_write, + f_preinitialize = 4, + f_unquote_param = 8 + }; + + /** @brief Initialize the HandlerCall. + * @param flags zero or more of f_read, f_write, f_preinitialize, + * f_unquote_param + * @param context optional element context + * @param errh optional error handler + * @return 0 on success, negative on failure + * + * Initializes the HandlerCall object. The handler description supplied + * to the constructor is parsed and checked for syntax errors. Any + * element reference is looked up relative to @a context, if any. (For + * example, if @a hdesc was "x.config" and @a context's name is + * "aaa/bbb/ccc", this will search for elements named aaa/bbb/x, aaa/x, + * and finally x. If @a context is null, then the description must refer + * to a global handler.) If f_read is set in @a flags, then there + * must be a read handler named appropriately; if f_write is set, + * then there must be a write handler. If f_unquote_param is set, then any + * parameters are unquoted. + * + * Initialization fails if the handler description was bogus (for + * example, an empty string, or something like "*#!$&!(#&$."), if the + * named handler does not exist, if a read handler description has + * parameters but the read handler doesn't actually take parameters, and + * so forth. If @a errh is nonnull, errors are reported there. The + * HandlerCall becomes empty on failure: empty() will return true, and + * (bool) *this will return false. Future call_read() and call_write() + * attempts will correctly fail. + * + * If the f_preinitialize flag is set, the initialize function will check + * whether the router's handlers are ready (Router::handlers_ready()). + * If handlers are not ready, then initialize() will check for syntax + * errors, but not actually look up the handler (since we don't know yet + * whether or not the handler exists). Absent a syntax error, + * initialize() will return 0 for success even though the HandlerCall + * remains uninitialized. */ + int initialize(int flags, const Element *context, ErrorHandler *errh = 0); + + /** @brief Initialize the HandlerCall for reading. + * @param context optional element context + * @param errh optional error handler + * + * Equivalent to @link initialize(int, const Element*, ErrorHandler*) + * initialize@endlink(f_read, @a context, @a errh). */ + inline int initialize_read(const Element *context, ErrorHandler *errh = 0); + + /** @brief Initialize the HandlerCall for writing. + * @param context optional element context + * @param errh optional error handler + * + * Equivalent to @link initialize(int, const Element*, ErrorHandler*) + * initialize@endlink(f_write, @a context, @a errh). */ + inline int initialize_write(const Element *context, ErrorHandler *errh = 0); + + + typedef bool (HandlerCall::*unspecified_bool_type)() const; + + /** @brief Test if HandlerCall is empty. + * @return True if HandlerCall is not empty, false otherwise. + * + * Valid HandlerCall objects have been successfully initialized. */ + operator unspecified_bool_type() const { + return _h != Handler::blank_handler() || _e ? &HandlerCall::empty : 0; + } + + /** @brief Test if HandlerCall is empty. + * @return True if HandlerCall is empty, false otherwise. */ + bool empty() const { + return _h == Handler::blank_handler() && !_e; + } + + /** @brief Test if HandlerCall is initialized. + * @return True if HandlerCall is initialized, false otherwise. */ + bool initialized() const { + return _h != Handler::blank_handler(); + } + + + /** @brief Call a read handler. + * @param errh optional error handler + * @return Read handler result. + * + * Fails and returns the empty string if this HandlerCall is invalid or + * not a read handler. If @a errh is nonnull, then any errors are + * reported there, whether from HandlerCall or the handler itself. */ + inline String call_read(ErrorHandler *errh = 0) const; + + /** @brief Call a write handler. + * @param errh optional error handler + * @return Write handler result. + * + * Fails and returns -EINVAL if this HandlerCall is invalid or not a + * write handler. If @a errh is nonnull, then any errors are reported + * there, whether from HandlerCall or the handler itself. */ + inline int call_write(ErrorHandler *errh = 0) const; + + /** @brief Call a write handler, expanding its argument. + * @param scope variable scope + * @param errh optional error handler + * @return Write handler result. + * + * The write value is expanded in @a scope before the handler is called. + * Fails and returns -EINVAL if this HandlerCall is invalid or not a + * write handler. If @a errh is nonnull, then any errors are reported + * there, whether from HandlerCall or the handler itself. */ + inline int call_write(const VariableExpander &scope, ErrorHandler *errh = 0) const; + + /** @brief Call a write handler with an additional value. + * @param value_ext write value extension + * @param errh optional error handler + * @return Write handler result. + * + * The @a value_ext is appended to the write value before the handler is + * called. (For example, consider a handler with description "a.set + * value". call_write("foo") will call "a.set value foo".) Fails and + * returns -EINVAL if this HandlerCall is invalid or not a write handler. + * If @a errh is nonnull, then any errors are reported there, whether + * from HandlerCall or the handler itself. */ + inline int call_write(const String &value_ext, ErrorHandler *errh = 0) const; + + + /** @brief Create and initialize a HandlerCall from @a hdesc. + * @param hcall stores the HandlerCall result + * @param hdesc handler description "[ename.]hname[ value]" + * @param flags initialization flags (f_read, f_write, f_preinitialize) + * @param context optional element context + * @param errh optional error handler + * @return 0 on success, -EINVAL on failure + * + * Creates a HandlerCall and initializes it. Behaves somewhat like: + * + * @code + * hcall = new HandlerCall(hdesc); + * return hcall->initialize(flags, context, errh); + * @endcode + * + * However, (1) if initialization fails, then @a hcall is untouched; and + * (2) if initialization succeeds and @a hcall is not null, then the + * existing HandlerCall is assigned so that it corresponds to the new one + * (no new memory allocations). + * + * If @a errh is nonnull, then any errors are reported there. */ + static int reset(HandlerCall *&hcall, const String &hdesc, int flags, + const Element *context, ErrorHandler *errh = 0); + + /** @brief Create and initialize a HandlerCall on element @a e. + * @param hcall stores the HandlerCall result + * @param e relevant element, if any + * @param hname handler name + * @param value handler value + * @param flags initialization flags (f_read, f_write, f_preinitialize) + * @param errh optional error handler + * @return 0 on success, -EINVAL on failure + * + * Creates a HandlerCall and initializes it. Behaves analogously to + * reset(HandlerCall*&, const String&, int, const Element*, ErrorHandler*). */ + static int reset(HandlerCall *&hcall, + Element *e, const String &hname, const String &value, + int flags, ErrorHandler *errh = 0); + + + /** @brief Create and initialize a read HandlerCall from @a hdesc. + * @param hcall stores the HandlerCall result + * @param hdesc handler description "[ename.]hdesc[ param]" + * @param context optional element context + * @param errh optional error handler + * @return 0 on success, -EINVAL on failure + * + * Equivalent to + * @link reset(HandlerCall*&, const String&, int, const Element*, ErrorHandler*) reset@endlink(@a hcall, @a hdesc, f_read, @a context, @a errh). */ + static inline int reset_read(HandlerCall *&hcall, const String &hdesc, + const Element *context, ErrorHandler *errh = 0); + + /** @brief Create and initialize a read HandlerCall from @a hdesc. + * @param hcall stores the HandlerCall result + * @param e relevant element, if any + * @param hname handler name + * @param errh optional error handler + * @return 0 on success, -EINVAL on failure + * + * Equivalent to + * @link reset(HandlerCall*&, Element*, const String&, const String&, int, ErrorHandler*) reset@endlink(@a hcall, @a e, @a hname, String(), f_read, @a context, @a errh). */ + static inline int reset_read(HandlerCall *&hcall, + Element *e, const String &hname, + ErrorHandler *errh = 0); + + /** @brief Create and initialize a write HandlerCall from @a hdesc. + * @param hcall stores the HandlerCall result + * @param hdesc handler description "[ename.]hdesc[ value]" + * @param context optional element context + * @param errh optional error handler + * @return 0 on success, -EINVAL on failure + * + * Equivalent to + * @link reset(HandlerCall*&, const String&, int, const Element*, ErrorHandler*) reset@endlink(@a hcall, @a hdesc, f_write, @a context, @a errh). */ + static inline int reset_write(HandlerCall *&hcall, const String &hdesc, + const Element *context, ErrorHandler *errh = 0); + + /** @brief Create and initialize a read HandlerCall from @a hdesc. + * @param hcall stores the HandlerCall result + * @param e relevant element, if any + * @param hname handler name + * @param value write handler value + * @param errh optional error handler + * @return 0 on success, -EINVAL on failure + * + * Equivalent to + * @link reset(HandlerCall*&, Element*, const String&, const String&, int, ErrorHandler*) reset@endlink(@a hcall, @a e, @a hname, @ value, f_write, @a context, @a errh). */ + static inline int reset_write(HandlerCall *&hcall, + Element *e, const String &hname, + const String &value = String(), + ErrorHandler *errh = 0); + + + /** @brief Return the Element corresponding to this HandlerCall. + * + * Returns null if invalid. A global handler may return some + * Router::root_element() or null. */ + Element *element() const { + return _e; + } + + /** @brief Return the Handler corresponding to this HandlerCall. + * + * Returns Handler::blank_handler() if invalid. */ + const Handler *handler() const { + return _h; + } + + /** @brief Return the write handler value and/or read handler parameters. + * + * Returns the empty string if invalid. */ + const String &value() const { + return initialized() ? _value : String::make_empty(); + } + + /** @brief Sets the write handler value and/or read handler parameters. + * @param value new value and/or parameters + * + * Does nothing if invalid. */ + void set_value(const String &value) { + if (initialized()) + _value = value; + } + + /** @brief Return a String that will parse into an equivalent HandlerCall. + * + * Will work even if the HandlerCall has not been initialized. */ + String unparse() const; + + /** @brief Make this HandlerCall empty. + * + * Subsequent attempts to read, write, or initialize the HandlerCall will + * fail. */ + void clear() { + _e = 0; + _h = Handler::blank_handler(); + _value = String(); + } + + + /** @cond never */ + enum { + CHECK_READ = f_read, OP_READ = f_read, h_read = f_read, + CHECK_WRITE = f_write, OP_WRITE = f_write, h_write = f_write, + PREINITIALIZE = f_preinitialize, h_preinitialize = f_preinitialize, + UNQUOTE_PARAM = f_unquote_param, h_unquote_param = f_unquote_param + }; + /** @endcond never */ + + private: + + Element *_e; + const Handler *_h; + String _value; + + int parse(int flags, Element*, ErrorHandler*); + int assign(Element*, const String&, const String&, int flags, ErrorHandler*); + +}; + +inline int +HandlerCall::reset_read(HandlerCall*& hcall, const String& hdesc, const Element* context, ErrorHandler* errh) +{ + return reset(hcall, hdesc, f_read, context, errh); +} + +inline int +HandlerCall::reset_write(HandlerCall*& hcall, const String& hdesc, const Element* context, ErrorHandler* errh) +{ + return reset(hcall, hdesc, f_write, context, errh); +} + +inline int +HandlerCall::reset_read(HandlerCall*& hcall, Element* e, const String& hname, ErrorHandler* errh) +{ + return reset(hcall, e, hname, String(), f_read, errh); +} + +inline int +HandlerCall::reset_write(HandlerCall*& hcall, Element* e, const String& hname, const String& value, ErrorHandler* errh) +{ + return reset(hcall, e, hname, value, f_write, errh); +} + +inline int +HandlerCall::initialize_read(const Element* context, ErrorHandler* errh) +{ + return initialize(f_read, context, errh); +} + +inline int +HandlerCall::initialize_write(const Element* context, ErrorHandler* errh) +{ + return initialize(f_write, context, errh); +} + +inline String +HandlerCall::call_read(ErrorHandler *errh) const +{ + return _h->call_read(_e, _value, errh); +} + +inline int +HandlerCall::call_write(ErrorHandler *errh) const +{ + return _h->call_write(_value, _e, errh); +} + +String cp_expand(const String &str, const VariableExpander &env, bool expand_quote, int depth); + +inline int +HandlerCall::call_write(const VariableExpander &scope, ErrorHandler *errh) const +{ + return _h->call_write(cp_expand(_value, scope, false, 0), _e, errh); +} + +inline int +HandlerCall::call_write(const String &value_ext, ErrorHandler *errh) const +{ + if (_value && value_ext) + return _h->call_write(_value + " " + value_ext, _e, errh); + else + return _h->call_write(_value ? _value : value_ext, _e, errh); +} + +/** @brief Call a write handler specified by element and handler name. + * @param e relevant element, if any + * @param hname handler name + * @param errh optional error handler + * @return handler result, or -EINVAL on error + * + * Searches for a write handler named @a hname on element @a e. If the + * handler exists, calls it (with empty write value) and returns the result. + * If @a errh is nonnull, then errors, such as a missing handler or a + * read-only handler, are reported there. If @a e is some router's @link + * Router::root_element() root element@endlink, calls the global write + * handler named @a hname on that router. */ +inline int +HandlerCall::call_write(Element *e, const String &hname, ErrorHandler *errh) +{ + return call_write(e, hname, String(), errh); +} + + +/** @class HandlerCallArg + @brief Parser class for handler call specifications. + + The constructor argument should generally be either HandlerCall::writable or + HandlerCall::readable. For example: + + @code + HandlerCall end_h; + ... Args(...) ... + .read("END_CALL", HandlerCallArg(HandlerCall::writable), end_h) + ... + @endcode */ +struct HandlerCallArg { + HandlerCallArg(int f) + : flags(f) { + } + bool parse(const String &str, HandlerCall &result, const ArgContext &args); + int flags; +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/hashallocator.hh b/openflow/include/click/hashallocator.hh new file mode 100644 index 0000000..38d55ce --- /dev/null +++ b/openflow/include/click/hashallocator.hh @@ -0,0 +1,103 @@ +// -*- related-file-name: "../../lib/hashallocator.cc" -*- +#ifndef CLICK_HASHALLOCATOR_HH +#define CLICK_HASHALLOCATOR_HH +#if HAVE_VALGRIND && HAVE_VALGRIND_MEMCHECK_H +# include +#endif +CLICK_DECLS + +class HashAllocator { public: + + HashAllocator(size_t size); + ~HashAllocator(); + + inline void increase_size(size_t new_size) { + assert(!_free && !_buffer && new_size >= _size); + _size = new_size; + } + + inline void *allocate(); + inline void deallocate(void *p); + + void swap(HashAllocator &x); + + private: + + struct link { + link *next; + }; + + struct buffer { + buffer *next; + size_t pos; + size_t maxpos; + }; + + enum { + min_buffer_size = 1024, +#if CLICK_LINUXMODULE + max_buffer_size = 16384, +#else + max_buffer_size = 1048576, +#endif + min_nelements = 8 + }; + + link *_free; + buffer *_buffer; + size_t _size; + + void *hard_allocate(); + + HashAllocator(const HashAllocator &x); + HashAllocator &operator=(const HashAllocator &x); + +}; + + +template +class SizedHashAllocator : public HashAllocator { public: + + SizedHashAllocator() + : HashAllocator(size) { + } + +}; + + +inline void *HashAllocator::allocate() +{ + if (link *l = _free) { +#ifdef VALGRIND_MEMPOOL_ALLOC + VALGRIND_MEMPOOL_ALLOC(this, l, _size); + VALGRIND_MAKE_MEM_DEFINED(&l->next, sizeof(l->next)); +#endif + _free = l->next; +#ifdef VALGRIND_MAKE_MEM_DEFINED + VALGRIND_MAKE_MEM_UNDEFINED(&l->next, sizeof(l->next)); +#endif + return l; + } else if (_buffer && _buffer->pos < _buffer->maxpos) { + void *data = reinterpret_cast(_buffer) + _buffer->pos; + _buffer->pos += _size; +#ifdef VALGRIND_MEMPOOL_ALLOC + VALGRIND_MEMPOOL_ALLOC(this, data, _size); +#endif + return data; + } else + return hard_allocate(); +} + +inline void HashAllocator::deallocate(void *p) +{ + if (p) { + reinterpret_cast(p)->next = _free; + _free = reinterpret_cast(p); +#ifdef VALGRIND_MEMPOOL_FREE + VALGRIND_MEMPOOL_FREE(this, p); +#endif + } +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/hashcode.hh b/openflow/include/click/hashcode.hh new file mode 100644 index 0000000..03d2f12 --- /dev/null +++ b/openflow/include/click/hashcode.hh @@ -0,0 +1,103 @@ +#ifndef CLICK_HASHCODE_HH +#define CLICK_HASHCODE_HH +CLICK_DECLS + +// Notes about the hashcode template: On GCC 4.3.0, "template <>" is required +// on the specializations or they aren't used. Just plain overloaded +// functions aren't used. The specializations must be e.g. "const char &", +// not "char", or GCC complains about a specialization not matching the +// general template. The main template takes a const reference for two +// reasons. First, providing both "hashcode_t hashcode(T)" and "hashcode_t +// hashcode(const T&)" leads to ambiguity errors. Second, providing only +// "hashcode_t hashcode(T)" is slower by looks like 8% when T is a String, +// because of copy constructors; for types with more expensive non-default +// copy constructors this would probably be worse. + +typedef size_t hashcode_t; ///< Typical type for a hashcode() value. + +template +inline hashcode_t hashcode(T const &x) { + return x.hashcode(); +} + +template <> +inline hashcode_t hashcode(char const &x) { + return x; +} + +template <> +inline hashcode_t hashcode(signed char const &x) { + return x; +} + +template <> +inline hashcode_t hashcode(unsigned char const &x) { + return x; +} + +template <> +inline hashcode_t hashcode(short const &x) { + return x; +} + +template <> +inline hashcode_t hashcode(unsigned short const &x) { + return x; +} + +template <> +inline hashcode_t hashcode(int const &x) { + return x; +} + +template <> +inline hashcode_t hashcode(unsigned const &x) { + return x; +} + +template <> +inline hashcode_t hashcode(long const &x) { + return x; +} + +template <> +inline hashcode_t hashcode(unsigned long const &x) { + return x; +} + +#if HAVE_LONG_LONG +template <> +inline hashcode_t hashcode(long long const &x) { + return (x >> 32) ^ x; +} + +template <> +inline hashcode_t hashcode(unsigned long long const &x) { + return (x >> 32) ^ x; +} +#endif + +#if HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG && !HAVE_INT64_IS_LONG_LONG +template <> +inline hashcode_t hashcode(int64_t const &x) { + return (x >> 32) ^ x; +} + +template <> +inline hashcode_t hashcode(uint64_t const &x) { + return (x >> 32) ^ x; +} +#endif + +template +inline hashcode_t hashcode(T * const &x) { + return reinterpret_cast(x) >> 3; +} + +template +inline typename T::key_const_reference hashkey(const T &x) { + return x.hashkey(); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/hashcontainer.hh b/openflow/include/click/hashcontainer.hh new file mode 100644 index 0000000..41e1ecf --- /dev/null +++ b/openflow/include/click/hashcontainer.hh @@ -0,0 +1,724 @@ +#ifndef CLICK_HASHCONTAINER_HH +#define CLICK_HASHCONTAINER_HH +#include +#include +#include +#if CLICK_DEBUG_HASHMAP +# define click_hash_assert(x) assert(x) +#else +# define click_hash_assert(x) +#endif +CLICK_DECLS + +template class HashContainer_adapter; +template > class HashContainer_const_iterator; +template > class HashContainer_iterator; +template > class HashContainer; + +/** @cond never */ +template +class HashContainer_rep : public A { + T **buckets; + uint32_t nbuckets; + mutable uint32_t first_bucket; + size_t size; + libdivide_u32_t bucket_divider; + friend class HashContainer; + friend class HashContainer_const_iterator; + friend class HashContainer_iterator; +}; +/** @endcond */ + +template +class HashContainer_adapter { public: + typedef typename T::key_type key_type; + typedef typename T::key_const_reference key_const_reference; + static T *&hashnext(T *e) { + return e->_hashnext; + } + static key_const_reference hashkey(const T *e) { + return e->hashkey(); + } + static bool hashkeyeq(const key_type &a, const key_type &b) { + return a == b; + } +}; + +/** @class HashContainer + @brief Intrusive hash table template. + + The HashContainer template implements a hash table or associative array + suitable for use in the kernel or at user level. + + HashContainer is intrusive. This means it does not manage its + contents' memory. While non-intrusive containers are more common in the + STL, intrusive containers make it simple to store objects in more than one + container at a time. + + Unlike many hash tables HashContainer does not automatically grow itself to + maintain good lookup performance. Its users are expected to call rehash() + when appropriate. See unbalanced(). + + With the default adapter type (A), the template type T must: + +
    +
  • Define a "key_type" type that supports equality.
  • +
  • Define a "key_const_reference" type, usually the same as "key_type."
  • +
  • Contain a member "T *_hashnext" accessible to HashContainer_adapter.
  • +
  • Define a "hashkey()" member function that returns the relevant hash key. + This function must have return type "key_const_reference."
  • +
+ + These requirements can be changed by supplying a different A, or adapter, + type. + + HashContainer can store multiple elements with the same key, although this + is not the normal use. An element stored in a HashContainer should not + modify its key. + + HashContainer is used to implement Click's HashTable template. +*/ +template +class HashContainer { public: + + /** @brief Key type. */ + typedef typename A::key_type key_type; + + /** @brief Value type. + * + * Must meet the HashContainer requirements defined by type A. */ + typedef T value_type; + + /** @brief Type of sizes. */ + typedef size_t size_type; + + /** @brief Type of bucket counts. */ + typedef uint32_t bucket_count_type; + + enum { +#if CLICK_LINUXMODULE + max_bucket_count = 4194303, +#else + max_bucket_count = (bucket_count_type) -1, +#endif + initial_bucket_count = 63 + }; + + /** @brief Construct an empty HashContainer. */ + HashContainer(); + + /** @brief Construct an empty HashContainer with at least @a n buckets. */ + explicit HashContainer(bucket_count_type n); + + /** @brief Destroy the HashContainer. */ + ~HashContainer(); + + + /** @brief Return the number of elements stored. */ + inline size_type size() const { + return _rep.size; + } + + /** @brief Return true iff size() == 0. */ + inline bool empty() const { + return _rep.size == 0; + } + + /** @brief Return the number of buckets. */ + inline bucket_count_type bucket_count() const { + return _rep.nbuckets; + } + + /** @brief Return the number of elements in bucket @a n. */ + inline size_type bucket_size(bucket_count_type n) const { + click_hash_assert(n < _rep.nbuckets); + size_type s = 0; + for (T *element = _rep.buckets[n]; element; element = _rep.hashnext(element)) + ++s; + return s; + } + + /** @brief Return the bucket number containing elements with @a key. */ + bucket_count_type bucket(const key_type &key) const; + + /** @brief Return true if this HashContainer should be rebalanced. */ + inline bool unbalanced() const { + return _rep.size > 2 * _rep.nbuckets && _rep.nbuckets < max_bucket_count; + } + + typedef HashContainer_const_iterator const_iterator; + typedef HashContainer_iterator iterator; + + /** @brief Return an iterator for the first element in the container. + * + * @note HashContainer iterators return elements in random order. */ + inline iterator begin(); + /** @overload */ + inline const_iterator begin() const; + + /** @brief Return an iterator for the end of the container. + * @invariant end().live() == false */ + inline iterator end(); + /** @overload */ + inline const_iterator end() const; + + /** @brief Return an iterator for the first element in bucket @a n. */ + inline iterator begin(bucket_count_type n); + /** @overload */ + inline const_iterator begin(bucket_count_type n) const; + + /** @brief Test if an element with key @a key exists in the table. */ + inline bool contains(const key_type& key) const; + /** @brief Return the number of elements with key @a key in the table. */ + inline size_type count(const key_type& key) const; + + /** @brief Return an iterator for an element with @a key, if any. + * + * If no element with @a key exists in the table, find() returns an + * iterator that compares equal to end(). However, this iterator is + * special, and can also be used to efficiently insert an element with key + * @a key. In particular, the return value of find() always has + * can_insert(), and can thus be passed to insert_at() or set(). (It + * will insert elements at the head of the relevant bucket.) */ + inline iterator find(const key_type &key); + /** @overload */ + inline const_iterator find(const key_type &key) const; + + /** @brief Return an iterator for an element with key @a key, if any. + * + * Like find(), but additionally moves any found element to the head of + * its bucket, possibly speeding up future lookups. */ + inline iterator find_prefer(const key_type &key); + + /** @brief Return an element for @a key, if any. + * + * Returns null if no element for @a key currently exists. Equivalent + * to find(key).get(). */ + inline T *get(const key_type &key) const; + + /** @brief Insert an element at position @a it. + * @param it iterator + * @param element element + * @pre @a it.can_insert() + * @pre @a it.bucket() == bucket(@a element->hashkey()) + * @pre @a element != NULL + * @pre @a element is not already in the HashContainer + * + * Inserts @a element at the position in the hash table indicated by @a + * it. For instance, if @a it == begin(@em n) for some bucket number @em + * n, then @a element becomes the first element in bucket @em n. Other + * elements in the bucket, if any, are chained along. + * + * On return, @a it is updated to point immediately after @a element. + * If @a it was not live before, then it will not be live after. + * + * @note HashContainer never automatically rehashes itself, so element + * insertion leaves any existing iterators valid. For best performance, + * however, users must call balance() to resize the container when it + * becomes unbalanced(). */ + inline void insert_at(iterator &it, T *element); + + /** @brief Replace the element at position @a it with @a element. + * @param it iterator + * @param element element (can be null) + * @param balance whether to balance the hash table + * @return the previous value of it.get() + * @pre @a it.can_insert() + * @pre @a it.bucket() == bucket(@a element->hashkey()) + * @pre @a element is not already in the HashContainer + * + * Replaces the element pointed to by @a it with @a element, and returns + * the former element. If @a element is null the former element is + * removed. If there is no former element then @a element is inserted. + * When inserting an element with @a balance true, set() may rebalance the + * hash table. + * + * As a side effect, @a it is advanced to point at the newly inserted @a + * element. If @a element is null, then @a it is advanced to point at the + * next element as by ++@a it. */ + T *set(iterator &it, T *element, bool balance = false); + + /** @brief Replace the element with @a element->hashkey() with @a element. + * @param element element + * @return the previous value of find(@a element->hashkey()).get() + * @pre @a element is not already in the HashContainer + * + * Finds an element with the same hashkey as @a element, removes it from + * the HashContainer, and replaces it with @a element. If there is no + * former element then @a element is inserted. */ + inline T *set(T *element); + + /** @brief Remove the element at position @a it. + * @param it iterator + * @return the previous value of it.get() + * + * As a side effect, @a it is advanced to the next element as by ++@a it. */ + inline T *erase(iterator &it); + + /** @brief Remove an element with hashkey @a key. + * @return the element removed, if any + * + * Roughly equivalent to erase(find(key)). */ + inline T *erase(const key_type &key); + + /** @brief Removes all elements from the container. + * @post size() == 0 */ + void clear(); + + /** @brief Swaps the contents of *this and @a x. */ + inline void swap(HashContainer &x); + + /** @brief Rehash the table, ensuring it contains at least @a n buckets. + * + * If @a n < bucket_count(), this function may make the hash table + * slower. + * + * @note Rehashing invalidates all existing iterators. */ + void rehash(bucket_count_type n); + + /** @brief Rehash the table if it is unbalanced. + * + * @note Rehashing invalidates all existing iterators. */ + inline void balance() { + if (unbalanced()) + rehash(bucket_count() + 1); + } + + private: + + HashContainer_rep _rep; + + HashContainer(const HashContainer &); + HashContainer &operator=(const HashContainer &); + + friend class HashContainer_iterator; + friend class HashContainer_const_iterator; + +}; + +/** @class HashContainer_const_iterator + * @brief The const_iterator type for HashContainer. */ +template +class HashContainer_const_iterator { public: + + typedef typename HashContainer::size_type size_type; + typedef typename HashContainer::bucket_count_type bucket_count_type; + + /** @brief Construct an uninitialized iterator. */ + HashContainer_const_iterator() { + } + + /** @brief Return a pointer to the element, null if *this == end(). */ + T *get() const { + return _element; + } + + /** @brief Return a pointer to the element, null if *this == end(). */ + T *operator->() const { + return _element; + } + + /** @brief Return a reference to the element. + * @pre *this != end() */ + T &operator*() const { + return *_element; + } + + /** @brief Return true iff *this != end(). */ + inline bool live() const { + return _element; + } + + typedef T *(HashContainer_const_iterator::*unspecified_bool_type)() const; + /** @brief Return true iff *this != end(). */ + inline operator unspecified_bool_type() const { + return _element ? &HashContainer_const_iterator::get : 0; + } + + /** @brief Return the corresponding HashContainer. */ + const HashContainer *hashcontainer() const { + return _hc; + } + + /** @brief Return the bucket number this iterator is in. */ + bucket_count_type bucket() const { + return _bucket; + } + + /** @brief Advance this iterator to the next element. */ + void operator++() { + if (_element && _hc->_rep.hashnext(_element)) { + _pprev = &_hc->_rep.hashnext(_element); + _element = *_pprev; + } else if (_bucket != _hc->_rep.nbuckets) { + for (++_bucket; _bucket != _hc->_rep.nbuckets; ++_bucket) + if (*(_pprev = &_hc->_rep.buckets[_bucket])) { + _element = *_pprev; + return; + } + _element = 0; + } + } + + /** @brief Advance this iterator to the next element. */ + void operator++(int) { + ++*this; + } + + private: + + T *_element; + T **_pprev; + bucket_count_type _bucket; + const HashContainer *_hc; + + inline HashContainer_const_iterator(const HashContainer *hc) + : _hc(hc) { + _bucket = hc->_rep.first_bucket; + _pprev = &hc->_rep.buckets[_bucket]; + if (unlikely(_bucket == hc->_rep.nbuckets)) + _element = 0; + else if (!(_element = *_pprev)) { + (*this)++; + hc->_rep.first_bucket = _bucket; + } + } + + inline HashContainer_const_iterator(const HashContainer *hc, bucket_count_type b, T **pprev, T *element) + : _element(element), _pprev(pprev), _bucket(b), _hc(hc) { + click_hash_assert((!_pprev && !_element) || *_pprev == _element); + } + + friend class HashContainer; + friend class HashContainer_iterator; + +}; + +/** @class HashContainer_iterator + @brief The iterator type for HashContainer. */ +template +class HashContainer_iterator : public HashContainer_const_iterator { public: + + typedef HashContainer_const_iterator inherited; + + /** @brief Construct an uninitialized iterator. */ + HashContainer_iterator() { + } + + /** @brief Return true iff elements can be inserted here. + * + * Specifically, returns true iff this iterator is valid to pass to + * HashContainer::insert_at() or HashContainer::set(). All live() + * iterators can_insert(), but some !live() iterators can_insert() as + * well. */ + bool can_insert() const { + return this->_bucket < this->_hc->bucket_count(); + } + + /** @brief Return the corresponding HashContainer. */ + HashContainer *hashcontainer() const { + return const_cast *>(this->_hc); + } + + private: + + inline HashContainer_iterator(HashContainer *hc) + : inherited(hc) { + } + + inline HashContainer_iterator(HashContainer *hc, typename inherited::bucket_count_type b, T **pprev, T *element) + : inherited(hc, b, pprev, element) { + } + + friend class HashContainer; + +}; + +template +HashContainer::HashContainer() +{ + _rep.size = 0; + _rep.nbuckets = initial_bucket_count; + _rep.buckets = (T **) CLICK_LALLOC(sizeof(T *) * _rep.nbuckets); + _rep.first_bucket = _rep.nbuckets; + _rep.bucket_divider = libdivide_u32_gen(_rep.nbuckets); + click_hash_assert(_rep.nbuckets == libdivide_u32_recover(&_rep.bucket_divider)); + for (bucket_count_type b = 0; b < _rep.nbuckets; ++b) + _rep.buckets[b] = 0; +} + +template +HashContainer::HashContainer(bucket_count_type nb) +{ + bucket_count_type b = 1; + while (b < nb && b < max_bucket_count) + b = ((b + 1) << 1) - 1; + _rep.size = 0; + _rep.nbuckets = b; + _rep.buckets = (T **) CLICK_LALLOC(sizeof(T *) * _rep.nbuckets); + _rep.first_bucket = _rep.nbuckets; + _rep.bucket_divider = libdivide_u32_gen(_rep.nbuckets); + click_hash_assert(_rep.nbuckets == libdivide_u32_recover(&_rep.bucket_divider)); + for (b = 0; b < _rep.nbuckets; ++b) + _rep.buckets[b] = 0; +} + +template +HashContainer::~HashContainer() +{ + CLICK_LFREE(_rep.buckets, sizeof(T *) * _rep.nbuckets); +} + +template +inline typename HashContainer::bucket_count_type +HashContainer::bucket(const key_type &key) const +{ + bucket_count_type h = hashcode(key); + bucket_count_type d = libdivide_u32_do(h, &_rep.bucket_divider); + bucket_count_type r = h - _rep.nbuckets * d; + click_hash_assert(_rep.nbuckets == libdivide_u32_recover(&_rep.bucket_divider)); + click_hash_assert(r == h % _rep.nbuckets); + return r; +} + +template +inline typename HashContainer::const_iterator +HashContainer::begin() const +{ + return const_iterator(this); +} + +template +inline typename HashContainer::iterator +HashContainer::begin() +{ + return iterator(this); +} + +template +inline typename HashContainer::const_iterator +HashContainer::end() const +{ + return const_iterator(this, -1, 0, 0); +} + +template +inline typename HashContainer::iterator +HashContainer::end() +{ + return iterator(this, -1, 0, 0); +} + +template +inline typename HashContainer::iterator +HashContainer::begin(bucket_count_type b) +{ + click_hash_assert(b < _rep.nbuckets); + return iterator(this, b, &_rep.buckets[b], _rep.buckets[b]); +} + +template +inline typename HashContainer::const_iterator +HashContainer::begin(bucket_count_type b) const +{ + click_hash_assert(b < _rep.nbuckets); + return const_iterator(this, b, &_rep.buckets[b], _rep.buckets[b]); +} + +template +inline bool HashContainer::contains(const key_type& key) const +{ + bucket_count_type b = bucket(key); + T **pprev; + for (pprev = &_rep.buckets[b]; *pprev; pprev = &_rep.hashnext(*pprev)) + if (_rep.hashkeyeq(_rep.hashkey(*pprev), key)) + return true; + return false; +} + +template +inline typename HashContainer::size_type +HashContainer::count(const key_type& key) const +{ + bucket_count_type b = bucket(key); + size_t c = 0; + T **pprev; + for (pprev = &_rep.buckets[b]; *pprev; pprev = &_rep.hashnext(*pprev)) + c += _rep.hashkeyeq(_rep.hashkey(*pprev), key); + return c; +} + +template +inline typename HashContainer::iterator +HashContainer::find(const key_type &key) +{ + bucket_count_type b = bucket(key); + T **pprev; + for (pprev = &_rep.buckets[b]; *pprev; pprev = &_rep.hashnext(*pprev)) + if (_rep.hashkeyeq(_rep.hashkey(*pprev), key)) + return iterator(this, b, pprev, *pprev); + return iterator(this, b, &_rep.buckets[b], 0); +} + +template +inline typename HashContainer::const_iterator +HashContainer::find(const key_type &key) const +{ + return const_cast *>(this)->find(key); +} + +template +inline typename HashContainer::iterator +HashContainer::find_prefer(const key_type &key) +{ + bucket_count_type b = bucket(key); + T **pprev; + for (pprev = &_rep.buckets[b]; *pprev; pprev = &_rep.hashnext(*pprev)) + if (_rep.hashkeyeq(_rep.hashkey(*pprev), key)) { + T *element = *pprev; + *pprev = _rep.hashnext(element); + _rep.hashnext(element) = _rep.buckets[b]; + _rep.buckets[b] = element; + return iterator(this, b, &_rep.buckets[b], element); + } + return iterator(this, b, &_rep.buckets[b], 0); +} + +template +inline T *HashContainer::get(const key_type &key) const +{ + return find(key).get(); +} + +template +T *HashContainer::set(iterator &it, T *element, bool balance) +{ + click_hash_assert(it._hc == this && it._bucket < _rep.nbuckets); + click_hash_assert(bucket(_rep.hashkey(element)) == it._bucket); + click_hash_assert(!it._element || _rep.hashkeyeq(_rep.hashkey(element), _rep.hashkey(it._element))); + T *old = it.get(); + if (unlikely(old == element)) + return old; + if (!element) { + --_rep.size; + if (!(*it._pprev = it._element = _rep.hashnext(old))) + ++it; + return old; + } + if (old) + _rep.hashnext(element) = _rep.hashnext(old); + else { + ++_rep.size; + if (unlikely(unbalanced()) && balance) { + rehash(bucket_count() + 1); + it._bucket = bucket(_rep.hashkey(element)); + it._pprev = &_rep.buckets[it._bucket]; + } + if (!(_rep.hashnext(element) = *it._pprev)) + _rep.first_bucket = 0; + } + *it._pprev = it._element = element; + return old; +} + +template +inline void HashContainer::insert_at(iterator &it, T *element) +{ + click_hash_assert(it._hc == this && it._bucket < _rep.nbuckets); + click_hash_assert(bucket(_rep.hashkey(element)) == it._bucket); + ++_rep.size; + if (!(_rep.hashnext(element) = *it._pprev)) + _rep.first_bucket = 0; + *it._pprev = element; + it._pprev = &_rep.hashnext(element); +} + +template +inline T *HashContainer::set(T *element) +{ + iterator it = find(_rep.hashkey(element)); + return set(it, element); +} + +template +inline T *HashContainer::erase(iterator &it) +{ + click_hash_assert(it._hc == this); + return set(it, 0); +} + +template +inline T *HashContainer::erase(const key_type &key) +{ + iterator it = find(key); + return set(it, 0); +} + +template +inline void HashContainer::clear() +{ + for (bucket_count_type b = 0; b < _rep.nbuckets; ++b) + _rep.buckets[b] = 0; + _rep.size = 0; +} + +template +inline void HashContainer::swap(HashContainer &o) +{ + HashContainer_rep rep(_rep); + _rep = o._rep; + o._rep = rep; +} + +template +void HashContainer::rehash(bucket_count_type n) +{ + bucket_count_type new_nbuckets = 1; + while (new_nbuckets < n && new_nbuckets < max_bucket_count) + new_nbuckets = ((new_nbuckets + 1) << 1) - 1; + click_hash_assert(new_nbuckets > 0 && new_nbuckets <= max_bucket_count); + if (_rep.nbuckets == new_nbuckets) + return; + + T **new_buckets = (T **) CLICK_LALLOC(sizeof(T *) * new_nbuckets); + for (bucket_count_type b = 0; b < new_nbuckets; ++b) + new_buckets[b] = 0; + + bucket_count_type old_nbuckets = _rep.nbuckets; + T **old_buckets = _rep.buckets; + _rep.nbuckets = new_nbuckets; + _rep.buckets = new_buckets; + _rep.first_bucket = 0; + _rep.bucket_divider = libdivide_u32_gen(_rep.nbuckets); + click_hash_assert(_rep.nbuckets == libdivide_u32_recover(&_rep.bucket_divider)); + + for (size_t b = 0; b < old_nbuckets; b++) + for (T *element = old_buckets[b]; element; ) { + T *next = _rep.hashnext(element); + bucket_count_type new_b = bucket(_rep.hashkey(element)); + _rep.hashnext(element) = new_buckets[new_b]; + new_buckets[new_b] = element; + element = next; + } + + CLICK_LFREE(old_buckets, sizeof(T *) * old_nbuckets); +} + +template +inline bool +operator==(const HashContainer_const_iterator &a, const HashContainer_const_iterator &b) +{ + click_hash_assert(a.hashcontainer() == b.hashcontainer()); + return a.get() == b.get(); +} + +template +inline bool +operator!=(const HashContainer_const_iterator &a, const HashContainer_const_iterator &b) +{ + click_hash_assert(a.hashcontainer() == b.hashcontainer()); + return a.get() != b.get(); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/hashmap.cc b/openflow/include/click/hashmap.cc new file mode 100644 index 0000000..49ef5be --- /dev/null +++ b/openflow/include/click/hashmap.cc @@ -0,0 +1,723 @@ +/* + * hashmap.{cc,hh} -- a hash table template + * Eddie Kohler + * + * Copyright (c) 2000 Mazu Networks, Inc. + * Copyright (c) 2003 International Computer Science Institute + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, subject to the conditions + * listed in the Click LICENSE file. These conditions include: you must + * preserve this copyright notice, and you cannot mention the copyright + * holders in advertising related to the Software without their permission. + * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This + * notice is a summary of the Click LICENSE file; the license in that file is + * legally binding. + */ + +#ifndef CLICK_HASHMAP_CC +#define CLICK_HASHMAP_CC +#include +#include +#include +CLICK_DECLS +/** @cond never */ + +#define BIGHASHMAP_REARRANGE_ON_FIND 0 + +template +void +HashMap::initialize(HashMap_ArenaFactory *factory, size_t initial_nbuckets) +{ + _nbuckets = initial_nbuckets; + _buckets = (Elt **) CLICK_LALLOC(_nbuckets * sizeof(Elt *)); + for (size_t i = 0; i < _nbuckets; i++) + _buckets[i] = 0; + set_dynamic_resizing(true); + + _n = 0; + + set_arena(factory); +} + +template +HashMap::HashMap() + : _default_value(), _arena(0) +{ + initialize(0, DEFAULT_INITIAL_NBUCKETS); +} + +template +HashMap::HashMap(const V &def, HashMap_ArenaFactory *factory) + : _default_value(def), _arena(0) +{ + initialize(factory, DEFAULT_INITIAL_NBUCKETS); +} + +template +void +HashMap::copy_from(const HashMap &o) + // requires that 'this' is empty and has the same number of buckets as 'o' + // and the same resize policy +{ + for (size_t i = 0; i < _nbuckets; i++) { + Elt **pprev = &_buckets[i]; + *pprev = 0; + for (const Elt *e = o._buckets[i]; e; e = e->next) { + Elt *ee = reinterpret_cast(_arena->alloc()); + new(reinterpret_cast(&ee->key)) K(e->key); + new(reinterpret_cast(&ee->value)) V(e->value); + ee->next = 0; + *pprev = ee; + pprev = &ee->next; + } + } + _n = o._n; +} + +template +HashMap::HashMap(const HashMap &o) + : _buckets((Elt **) CLICK_LALLOC(o._nbuckets * sizeof(Elt *))), + _nbuckets(o._nbuckets), _default_value(o._default_value), + _capacity(o._capacity), _arena(o._arena) +{ + _arena->use(); + copy_from(o); +} + +template +HashMap & +HashMap::operator=(const HashMap &o) +{ + if (&o != this) { + clear(); + _default_value = o._default_value; + if (_nbuckets < o._nbuckets) + resize0(o._nbuckets); + _nbuckets = o._nbuckets; + _capacity = o._capacity; + copy_from(o); + } + return *this; +} + +template +HashMap::~HashMap() +{ + for (size_t i = 0; i < _nbuckets; i++) + for (Elt *e = _buckets[i]; e; ) { + Elt *next = e->next; + e->key.~K(); + e->value.~V(); + _arena->free(e); + e = next; + } + CLICK_LFREE(_buckets, _nbuckets * sizeof(Elt *)); + _arena->unuse(); +} + +template +void +HashMap::set_dynamic_resizing(bool on) +{ + if (!on) + _capacity = 0x7FFFFFFF; + else if (_nbuckets >= MAX_NBUCKETS) + _capacity = 0x7FFFFFFE; + else + _capacity = DEFAULT_RESIZE_THRESHOLD * _nbuckets; +} + +template +void +HashMap::set_arena(HashMap_ArenaFactory *factory) +{ + assert(empty()); + if (_arena) + _arena->unuse(); + _arena = HashMap_ArenaFactory::get_arena(sizeof(Elt), factory); + _arena->use(); +} + +template +inline size_t +HashMap::bucket(const K &key) const +{ + return ((size_t) hashcode(key)) % _nbuckets; +} + +template +typename HashMap::Pair * +HashMap::find_pair(const K &key) const +{ +#if BIGHASHMAP_REARRANGE_ON_FIND + Elt *prev = 0; + size_t b = bucket(key); + for (Elt *e = _buckets[b]; e; prev = e, e = e->next) + if (e->key == key) { + if (prev) { + // move to front + prev->next = e->next; + e->next = _buckets[b]; + _buckets[b] = e; + } + return e; + } + return 0; +#else + for (Elt *e = _buckets[bucket(key)]; e; e = e->next) + if (e->key == key) + return e; + return 0; +#endif +} + + +template +void +HashMap::resize0(size_t new_nbuckets) +{ + Elt **new_buckets = (Elt **) CLICK_LALLOC(new_nbuckets * sizeof(Elt *)); + for (size_t i = 0; i < new_nbuckets; i++) + new_buckets[i] = 0; + + size_t old_nbuckets = _nbuckets; + Elt **old_buckets = _buckets; + _nbuckets = new_nbuckets; + _buckets = new_buckets; + if (dynamic_resizing()) + set_dynamic_resizing(true); // reset threshold + + for (size_t i = 0; i < old_nbuckets; i++) + for (Elt *e = old_buckets[i]; e; ) { + Elt *n = e->next; + size_t b = bucket(e->key); + e->next = new_buckets[b]; + new_buckets[b] = e; + e = n; + } + + CLICK_LFREE(old_buckets, old_nbuckets * sizeof(Elt *)); +} + +template +void +HashMap::resize(size_t want_nbuckets) +{ + size_t new_nbuckets = 1; + while (new_nbuckets < want_nbuckets && new_nbuckets < MAX_NBUCKETS) + new_nbuckets = ((new_nbuckets + 1) << 1) - 1; + assert(new_nbuckets > 0 && new_nbuckets <= MAX_NBUCKETS); + if (_nbuckets != new_nbuckets) + resize0(new_nbuckets); +} + +template +bool +HashMap::insert(const K &key, const V &value) +{ + size_t b = bucket(key); + for (Elt *e = _buckets[b]; e; e = e->next) + if (e->key == key) { + e->value = value; + return false; + } + + if (_n >= _capacity) { + resize(_nbuckets + 1); + b = bucket(key); + } + + if (Elt *e = reinterpret_cast(_arena->alloc())) { + new(reinterpret_cast(&e->key)) K(key); + new(reinterpret_cast(&e->value)) V(value); + e->next = _buckets[b]; + _buckets[b] = e; + _n++; + } + return true; +} + +template +bool +HashMap::erase(const K &key) +{ + size_t b = bucket(key); + Elt *prev = 0; + Elt *e = _buckets[b]; + while (e && !(e->key == key)) { + prev = e; + e = e->next; + } + if (e) { + if (prev) + prev->next = e->next; + else + _buckets[b] = e->next; + e->key.~K(); + e->value.~V(); + _arena->free(e); + _n--; + return true; + } else + return false; +} + +template +typename HashMap::Pair * +HashMap::find_pair_force(const K &key, const V &default_value) +{ + size_t b = bucket(key); + for (Elt *e = _buckets[b]; e; e = e->next) + if (e->key == key) + return e; + if (_n >= _capacity) { + resize(_nbuckets + 1); + b = bucket(key); + } + if (Elt *e = reinterpret_cast(_arena->alloc())) { + new(reinterpret_cast(&e->key)) K(key); + new(reinterpret_cast(&e->value)) V(default_value); + e->next = _buckets[b]; + _buckets[b] = e; + _n++; + return e; + } else + return 0; +} + +template +void +HashMap::clear() +{ + for (size_t i = 0; i < _nbuckets; i++) { + for (Elt *e = _buckets[i]; e; ) { + Elt *next = e->next; + e->key.~K(); + e->value.~V(); + _arena->free(e); + e = next; + } + _buckets[i] = 0; + } + _n = 0; +} + +template +void +HashMap::swap(HashMap &o) +{ + Elt **t_elts; + V t_v; + size_t t_size; + HashMap_Arena *t_arena; + + t_elts = _buckets; _buckets = o._buckets; o._buckets = t_elts; + t_size = _nbuckets; _nbuckets = o._nbuckets; o._nbuckets = t_size; + t_v = _default_value; _default_value = o._default_value; o._default_value = t_v; + + t_size = _n; _n = o._n; o._n = t_size; + t_size = _capacity; _capacity = o._capacity; o._capacity = t_size; + + t_arena = _arena; _arena = o._arena; o._arena = t_arena; +} + +template +_HashMap_const_iterator::_HashMap_const_iterator(const HashMap *hm, bool begin) + : _hm(hm) +{ + size_t nb = _hm->_nbuckets; + typename HashMap::Elt **b = _hm->_buckets; + for (_bucket = 0; _bucket < nb && begin; _bucket++) + if (b[_bucket]) { + _elt = b[_bucket]; + return; + } + _elt = 0; +} + +template +void +_HashMap_const_iterator::operator++(int) +{ + if (_elt->next) + _elt = _elt->next; + else { + size_t nb = _hm->_nbuckets; + typename HashMap::Elt **b = _hm->_buckets; + for (_bucket++; _bucket < nb; _bucket++) + if (b[_bucket]) { + _elt = b[_bucket]; + return; + } + _elt = 0; + } +} + +#if 0 +static size_t +HashMap_partition_elts(void **elts, size_t left, size_t right) +{ + void *pivot = elts[(left + right) / 2]; + + // loop invariant: + // elts[i] < pivot for all left_init <= i < left + // elts[i] > pivot for all right < i <= right_init + while (left < right) { + if (elts[left] < pivot) + left++; + else if (elts[right] > pivot) + right--; + else { + void *x = elts[left]; + elts[left] = elts[right]; + elts[right] = x; + } + } + + return left; +} + +void +HashMap_qsort_elts(void **elts, size_t left, size_t right) +{ + if (left < right) { + size_t split = HashMap_partition_elts(elts, left, right); + HashMap_qsort_elts(elts, left, split); + HashMap_qsort_elts(elts, split, right); + } +} +#endif + + +// void * partial specialization + +template +void +HashMap::initialize(HashMap_ArenaFactory *factory, size_t initial_nbuckets) +{ + _nbuckets = initial_nbuckets; + _buckets = (Elt **) CLICK_LALLOC(_nbuckets * sizeof(Elt *)); + for (size_t i = 0; i < _nbuckets; i++) + _buckets[i] = 0; + set_dynamic_resizing(true); + + _n = 0; + + set_arena(factory); +} + +template +HashMap::HashMap() + : _default_value(0), _arena(0) +{ + initialize(0, DEFAULT_INITIAL_NBUCKETS); +} + +template +HashMap::HashMap(void *def, HashMap_ArenaFactory *factory) + : _default_value(def), _arena(0) +{ + initialize(factory, DEFAULT_INITIAL_NBUCKETS); +} + +template +void +HashMap::copy_from(const HashMap &o) +{ + for (size_t i = 0; i < _nbuckets; i++) { + Elt **pprev = &_buckets[i]; + *pprev = 0; + for (const Elt *e = o._buckets[i]; e; e = e->next) { + Elt *ee = reinterpret_cast(_arena->alloc()); + new(reinterpret_cast(&ee->key)) K(e->key); + ee->value = e->value; + ee->next = 0; + *pprev = ee; + pprev = &ee->next; + } + } + _n = o._n; +} + +template +HashMap::HashMap(const HashMap &o) + : _buckets((Elt **) CLICK_LALLOC(o._nbuckets * sizeof(Elt *))), + _nbuckets(o._nbuckets), _default_value(o._default_value), + _capacity(o._capacity), _arena(o._arena) +{ + _arena->use(); + copy_from(o); +} + +template +HashMap & +HashMap::operator=(const HashMap &o) +{ + if (&o != this) { + clear(); + _default_value = o._default_value; + if (_nbuckets < o._nbuckets) + resize0(o._nbuckets); + _nbuckets = o._nbuckets; + _capacity = o._capacity; + copy_from(o); + } + return *this; +} + +template +HashMap::~HashMap() +{ + for (size_t i = 0; i < _nbuckets; i++) + for (Elt *e = _buckets[i]; e; ) { + Elt *next = e->next; + e->key.~K(); + _arena->free(e); + e = next; + } + CLICK_LFREE(_buckets, _nbuckets * sizeof(Elt *)); + _arena->unuse(); +} + +template +void +HashMap::set_dynamic_resizing(bool on) +{ + if (!on) + _capacity = 0x7FFFFFFF; + else if (_nbuckets >= MAX_NBUCKETS) + _capacity = 0x7FFFFFFE; + else + _capacity = DEFAULT_RESIZE_THRESHOLD * _nbuckets; +} + +template +void +HashMap::set_arena(HashMap_ArenaFactory *factory) +{ + assert(empty()); + if (_arena) + _arena->unuse(); + _arena = HashMap_ArenaFactory::get_arena(sizeof(Elt), factory); + _arena->use(); +} + +template +inline size_t +HashMap::bucket(const K &key) const +{ + return ((size_t) hashcode(key)) % _nbuckets; +} + +template +typename HashMap::Pair * +HashMap::find_pair(const K &key) const +{ +#if BIGHASHMAP_REARRANGE_ON_FIND + Elt *prev = 0; + size_t b = bucket(key); + for (Elt *e = _buckets[b]; e; prev = e, e = e->next) + if (e->key == key) { + if (prev) { + // move to front + prev->next = e->next; + e->next = _buckets[b]; + _buckets[b] = e; + } + return e; + } + return 0; +#else + for (Elt *e = _buckets[bucket(key)]; e; e = e->next) + if (e->key == key) + return e; + return 0; +#endif +} + + +template +void +HashMap::resize0(size_t new_nbuckets) +{ + Elt **new_buckets = (Elt **) CLICK_LALLOC(new_nbuckets * sizeof(Elt *)); + for (size_t i = 0; i < new_nbuckets; i++) + new_buckets[i] = 0; + + size_t old_nbuckets = _nbuckets; + Elt **old_buckets = _buckets; + _nbuckets = new_nbuckets; + _buckets = new_buckets; + if (dynamic_resizing()) + set_dynamic_resizing(true); // reset threshold + + for (size_t i = 0; i < old_nbuckets; i++) + for (Elt *e = old_buckets[i]; e; ) { + Elt *n = e->next; + size_t b = bucket(e->key); + e->next = new_buckets[b]; + new_buckets[b] = e; + e = n; + } + + CLICK_LFREE(old_buckets, old_nbuckets * sizeof(Elt *)); +} + +template +void +HashMap::resize(size_t want_nbuckets) +{ + size_t new_nbuckets = 1; + while (new_nbuckets < want_nbuckets && new_nbuckets < MAX_NBUCKETS) + new_nbuckets = ((new_nbuckets + 1) << 1) - 1; + assert(new_nbuckets > 0 && new_nbuckets <= MAX_NBUCKETS); + if (_nbuckets != new_nbuckets) + resize0(new_nbuckets); +} + +template +bool +HashMap::insert(const K &key, void *value) +{ + size_t b = bucket(key); + for (Elt *e = _buckets[b]; e; e = e->next) + if (e->key == key) { + e->value = value; + return false; + } + + if (_n >= _capacity) { + resize(_nbuckets + 1); + b = bucket(key); + } + + if (Elt *e = reinterpret_cast(_arena->alloc())) { + new(reinterpret_cast(&e->key)) K(key); + e->value = value; + e->next = _buckets[b]; + _buckets[b] = e; + _n++; + } + return true; +} + +template +bool +HashMap::erase(const K &key) +{ + size_t b = bucket(key); + Elt *prev = 0; + Elt *e = _buckets[b]; + while (e && !(e->key == key)) { + prev = e; + e = e->next; + } + if (e) { + if (prev) + prev->next = e->next; + else + _buckets[b] = e->next; + e->key.~K(); + _arena->free(e); + _n--; + return true; + } else + return false; +} + +template +typename HashMap::Pair * +HashMap::find_pair_force(const K &key, void *default_value) +{ + size_t b = bucket(key); + for (Elt *e = _buckets[b]; e; e = e->next) + if (e->key == key) + return e; + if (_n >= _capacity) { + resize(_nbuckets + 1); + b = bucket(key); + } + if (Elt *e = reinterpret_cast(_arena->alloc())) { + new(reinterpret_cast(&e->key)) K(key); + e->value = default_value; + e->next = _buckets[b]; + _buckets[b] = e; + _n++; + return e; + } else + return 0; +} + +template +void +HashMap::clear() +{ + for (size_t i = 0; i < _nbuckets; i++) { + for (Elt *e = _buckets[i]; e; ) { + Elt *next = e->next; + e->key.~K(); + _arena->free(e); + e = next; + } + _buckets[i] = 0; + } + _n = 0; +} + +template +void +HashMap::swap(HashMap &o) +{ + Elt **t_elts; + void *t_v; + size_t t_size; + HashMap_Arena *t_arena; + + t_elts = _buckets; _buckets = o._buckets; o._buckets = t_elts; + t_size = _nbuckets; _nbuckets = o._nbuckets; o._nbuckets = t_size; + t_v = _default_value; _default_value = o._default_value; o._default_value = t_v; + + t_size = _n; _n = o._n; o._n = t_size; + t_size = _capacity; _capacity = o._capacity; o._capacity = t_size; + + t_arena = _arena; _arena = o._arena; o._arena = t_arena; +} + + +template +_HashMap_const_iterator::_HashMap_const_iterator(const HashMap *hm, bool begin) + : _hm(hm) +{ + size_t nb = _hm->_nbuckets; + typename HashMap::Elt **b = _hm->_buckets; + for (_bucket = 0; _bucket < nb && begin; _bucket++) + if (b[_bucket]) { + _elt = b[_bucket]; + return; + } + _elt = 0; +} + +template +void +_HashMap_const_iterator::operator++(int) +{ + if (_elt->next) + _elt = _elt->next; + else { + size_t nb = _hm->_nbuckets; + typename HashMap::Elt **b = _hm->_buckets; + for (_bucket++; _bucket < nb; _bucket++) + if (b[_bucket]) { + _elt = b[_bucket]; + return; + } + _elt = 0; + } +} + +/** @endcond */ +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/hashmap.hh b/openflow/include/click/hashmap.hh new file mode 100644 index 0000000..3ebef5f --- /dev/null +++ b/openflow/include/click/hashmap.hh @@ -0,0 +1,585 @@ +#ifndef CLICK_HASHMAP_HH +#define CLICK_HASHMAP_HH +#include +CLICK_DECLS +/** @cond never */ +class HashMap_Arena; +class HashMap_ArenaFactory; + +// K AND V REQUIREMENTS: +// +// K::K(const K &) +// k1 == k2 +// hashcode_t hashcode(const K &) +// If hashcode(k1) != hashcode(k2), then k1 != k2. +// hashcode() can return any unsigned value. +// +// V::V() -- only used for default value +// V::V(const V &) +// V & V::operator=(const V &) + +template class _HashMap_const_iterator; +template class _HashMap_iterator; +template class HashMap; + +template +class HashMap { public: + + typedef K key_type; + typedef V mapped_type; + struct Pair; + + HashMap(); + explicit HashMap(const V &, HashMap_ArenaFactory * = 0); + HashMap(const HashMap &); + ~HashMap(); + + void set_arena(HashMap_ArenaFactory *); + + size_t size() const { return _n; } + bool empty() const { return _n == 0; } + size_t nbuckets() const { return _nbuckets; } + + Pair *find_pair(const K &) const; + inline V *findp(const K &) const; + inline const V &find(const K &, const V &) const; + inline const V &find(const K &) const; + inline const V &operator[](const K &) const; + + Pair *find_pair_force(const K &, const V &); + Pair *find_pair_force(const K &k) { return find_pair_force(k, _default_value); } + V *findp_force(const K &k, const V &v) { if (Pair *p = find_pair_force(k, v)) return &p->value; else return 0; } + V &find_force(const K &k, const V &v) { return *findp_force(k, v); } + V *findp_force(const K &k) { return findp_force(k, _default_value); } + V &find_force(const K &k) { return *findp_force(k, _default_value); } + + bool insert(const K &, const V &); + bool erase(const K &); + bool remove(const K &key) { + return erase(key); + } + void clear(); + + void swap(HashMap &); + + // iteration + typedef _HashMap_const_iterator const_iterator; + typedef _HashMap_iterator iterator; + inline const_iterator begin() const; + inline iterator begin(); + inline const_iterator end() const; + inline iterator end(); + + // dynamic resizing + void resize(size_t); + bool dynamic_resizing() const { return _capacity < 0x7FFFFFFF; } + void set_dynamic_resizing(bool); + + HashMap &operator=(const HashMap &); + + struct Pair { + K key; + V value; + }; + + enum { MAX_NBUCKETS = 4194303, + DEFAULT_INITIAL_NBUCKETS = 127, + DEFAULT_RESIZE_THRESHOLD = 2 }; + + private: + + struct Elt : public Pair { + Elt *next; +#if defined(__GNUC__) && __GNUC__ < 4 + /* Shut up compiler about Pair lacking default constructor */ + Elt(const Pair &p) : Pair(p) { } +#endif + }; + + Elt **_buckets; + size_t _nbuckets; + V _default_value; + + size_t _n; + size_t _capacity; + + HashMap_Arena *_arena; + + void initialize(HashMap_ArenaFactory *, size_t); + void copy_from(const HashMap &); + void resize0(size_t); + size_t bucket(const K &) const; + + friend class _HashMap_iterator; + friend class _HashMap_const_iterator; + +}; + +template +class _HashMap_const_iterator { public: + + bool live() const { return _elt; } + typedef bool (_HashMap_const_iterator::*unspecified_bool_type)() const; + inline operator unspecified_bool_type() const CLICK_DEPRECATED; + void operator++(int); + void operator++() { (*this)++; } + + typedef typename HashMap::Pair Pair; + const Pair *pair() const { return _elt; } + + const K &key() const { return _elt->key; } + const V &value() const { return _elt->value; } + + private: + + const HashMap *_hm; + typename HashMap::Elt *_elt; + size_t _bucket; + + _HashMap_const_iterator(const HashMap *m, bool begin); + friend class HashMap; + friend class _HashMap_iterator; + +}; + +template +class _HashMap_iterator : public _HashMap_const_iterator { public: + + typedef _HashMap_const_iterator inherited; + + typedef typename HashMap::Pair Pair; + Pair *pair() const { return const_cast(inherited::pair()); } + V &value() const { return const_cast(inherited::value()); } + + private: + + _HashMap_iterator(HashMap *m, bool begin) : inherited(m, begin) { } + friend class HashMap; + +}; + +template +inline typename HashMap::const_iterator +HashMap::begin() const +{ + return const_iterator(this, true); +} + +template +inline typename HashMap::iterator +HashMap::begin() +{ + return iterator(this, true); +} + +template +inline typename HashMap::const_iterator +HashMap::end() const +{ + return const_iterator(this, false); +} + +template +inline typename HashMap::iterator +HashMap::end() +{ + return iterator(this, false); +} + +template +inline V * +HashMap::findp(const K &key) const +{ + Pair *p = find_pair(key); + return (p ? &p->value : 0); +} + +template +inline const V & +HashMap::find(const K &key, const V &default_value) const +{ + Pair *p = find_pair(key); + const V *v = (p ? &p->value : &default_value); + return *v; +} + +template +inline const V & +HashMap::find(const K &key) const +{ + return find(key, _default_value); +} + +template +inline const V & +HashMap::operator[](const K &key) const +{ + return find(key); +} + +template +inline +_HashMap_const_iterator::operator unspecified_bool_type() const +{ + return live() ? &_HashMap_const_iterator::live : 0; +} + + +template +class HashMap { public: + + typedef K key_type; + typedef void *mapped_type; + struct Pair; + + HashMap(); + explicit HashMap(void *, HashMap_ArenaFactory * = 0); + HashMap(const HashMap &); + ~HashMap(); + + void set_arena(HashMap_ArenaFactory *); + + size_t size() const { return _n; } + bool empty() const { return _n == 0; } + size_t nbuckets() const { return _nbuckets; } + + Pair *find_pair(const K &) const; + inline void **findp(const K &) const; + inline void *find(const K &, void *) const; + inline void *find(const K &) const; + inline void *operator[](const K &) const; + + Pair *find_pair_force(const K &, void *); + Pair *find_pair_force(const K &k) { return find_pair_force(k, _default_value); } + void **findp_force(const K &k, void *v) { if (Pair *p = find_pair_force(k, v)) return &p->value; else return 0; } + void *&find_force(const K &k, void *v) { return *findp_force(k, v); } + void **findp_force(const K &k) { return findp_force(k, _default_value); } + void *&find_force(const K &k) { return *findp_force(k, _default_value); } + + bool insert(const K &, void *); + bool erase(const K &); + bool remove(const K &key) { + return erase(key); + } + void clear(); + + void swap(HashMap &); + + // iterators + typedef _HashMap_const_iterator const_iterator; + typedef _HashMap_iterator iterator; + inline const_iterator begin() const; + inline iterator begin(); + inline const_iterator end() const; + inline iterator end(); + + // dynamic resizing + void resize(size_t); + bool dynamic_resizing() const { return _capacity < 0x7FFFFFFF; } + void set_dynamic_resizing(bool); + + HashMap &operator=(const HashMap &); + + struct Pair { + K key; + void *value; + }; + + enum { MAX_NBUCKETS = 32767, + DEFAULT_INITIAL_NBUCKETS = 127, + DEFAULT_RESIZE_THRESHOLD = 2 }; + + private: + + struct Elt : public Pair { + Elt *next; +#if defined(__GNUC__) && __GNUC__ < 4 + /* Shut up compiler about Pair lacking default constructor */ + Elt(const Pair &p) : Pair(p) { } +#endif + }; + + Elt **_buckets; + size_t _nbuckets; + void *_default_value; + + size_t _n; + size_t _capacity; + + HashMap_Arena *_arena; + + void initialize(HashMap_ArenaFactory *, size_t); + void copy_from(const HashMap &); + void resize0(size_t); + size_t bucket(const K &) const; + + friend class _HashMap_iterator; + friend class _HashMap_const_iterator; + +}; + +template +class _HashMap_const_iterator { public: + + bool live() const { return _elt; } + typedef bool (_HashMap_const_iterator::*unspecified_bool_type)() const; + inline operator unspecified_bool_type() const CLICK_DEPRECATED; + void operator++(int); + void operator++() { (*this)++; } + + typedef typename HashMap::Pair Pair; + const Pair *pair() const { return _elt; } + + const K &key() const { return _elt->key; } + void *value() const { return _elt->value; } + + private: + + const HashMap *_hm; + typename HashMap::Elt *_elt; + size_t _bucket; + + _HashMap_const_iterator(const HashMap *, bool begin); + template friend class _HashMap_const_iterator; + template friend class _HashMap_iterator; + template friend class HashMap; + +}; + +template +class _HashMap_iterator : public _HashMap_const_iterator { public: + + typedef _HashMap_const_iterator inherited; + + typedef typename HashMap::Pair Pair; + Pair *pair() const { return const_cast(inherited::pair()); } + void *&value() const { return this->_elt->value; } + + private: + + _HashMap_iterator(HashMap *m, bool begin) : inherited(m, begin) { } + template friend class HashMap; + +}; + +template +inline typename HashMap::const_iterator +HashMap::begin() const +{ + return const_iterator(this, true); +} + +template +inline typename HashMap::iterator +HashMap::begin() +{ + return iterator(this, true); +} + +template +inline typename HashMap::const_iterator +HashMap::end() const +{ + return const_iterator(this, false); +} + +template +inline typename HashMap::iterator +HashMap::end() +{ + return iterator(this, false); +} + +template +inline void ** +HashMap::findp(const K &key) const +{ + Pair *p = find_pair(key); + return (p ? &p->value : 0); +} + +template +inline void * +HashMap::find(const K &key, void *default_value) const +{ + Pair *p = find_pair(key); + return (p ? p->value : default_value); +} + +template +inline void * +HashMap::find(const K &key) const +{ + return find(key, _default_value); +} + +template +inline void * +HashMap::operator[](const K &key) const +{ + return find(key); +} + +template +inline +_HashMap_const_iterator::operator unspecified_bool_type() const +{ + return live() ? &_HashMap_const_iterator::live : 0; +} + + +template +class HashMap : public HashMap { public: + + typedef K key_type; + typedef T *mapped_type; + typedef HashMap inherited; + struct Pair; + + HashMap() : inherited() { } + explicit HashMap(T *def, HashMap_ArenaFactory *factory = 0) + : inherited(def, factory) { } + HashMap(const HashMap &o) : inherited(o) { } + ~HashMap() { } + + void set_arena(HashMap_ArenaFactory *af) { inherited::set_arena(af); } + + // size_t size() const inherited + // bool empty() const inherited + // size_t nbuckets() const inherited + + Pair *find_pair(const K &k) const { return reinterpret_cast(inherited::find_pair(k)); } + T **findp(const K &k) const { return reinterpret_cast(inherited::findp(k)); } + T *find(const K &k, T *v) const { return reinterpret_cast(inherited::find(k, v)); } + T *find(const K &k) const { return reinterpret_cast(inherited::find(k)); } + T *operator[](const K &k) const { return reinterpret_cast(inherited::operator[](k)); } + + Pair *find_pair_force(const K &k, T *v) { return reinterpret_cast(inherited::find_pair_force(k, v)); } + Pair *find_pair_force(const K &k) { return reinterpret_cast(inherited::find_pair_force(k)); } + T **findp_force(const K &k, T *v) { return reinterpret_cast(inherited::findp_force(k, v)); } + T *&find_force(const K &k, T *v) { return *reinterpret_cast(inherited::findp_force(k, v)); } + T **findp_force(const K &k) { return reinterpret_cast(inherited::findp_force(k)); } + T *&find_force(const K &k) { return *reinterpret_cast(inherited::findp_force(k)); } + + bool insert(const K &k, T *v) { return inherited::insert(k, v); } + // bool erase(const K &) inherited + // bool remove(const K &) inherited + // void clear() inherited + + void swap(HashMap &o) { inherited::swap(o); } + + // iteration + typedef _HashMap_const_iterator const_iterator; + typedef _HashMap_iterator iterator; + inline const_iterator begin() const; + inline iterator begin(); + inline const_iterator end() const; + inline iterator end(); + + // dynamic resizing methods inherited + + HashMap &operator=(const HashMap &o) { return static_cast &>(inherited::operator=(o)); } + + struct Pair { + K key; + T *value; + }; + +}; + +template +class _HashMap_const_iterator { public: + + typedef _HashMap_const_iterator inherited; + + bool live() const { return _i.live(); } + typedef typename inherited::unspecified_bool_type unspecified_bool_type; + inline operator unspecified_bool_type() const CLICK_DEPRECATED; + void operator++(int) { _i.operator++(0); } + void operator++() { _i.operator++(); } + + typedef typename HashMap::Pair Pair; + const Pair *pair() const { return reinterpret_cast(_i.pair()); } + + const K &key() const { return _i.key(); } + T *value() const { return reinterpret_cast(_i.value()); } + + private: + + inherited _i; + + _HashMap_const_iterator(const HashMap *t, bool begin) : _i(t, begin) { } + friend class _HashMap_iterator; + template friend class HashMap; + +}; + +template +class _HashMap_iterator : public _HashMap_const_iterator { public: + + typedef _HashMap_const_iterator inherited; + + typedef typename HashMap::Pair Pair; + Pair *pair() const { return const_cast(inherited::pair()); } + T *&value() const { return pair()->value; } + + private: + + _HashMap_iterator(HashMap *t, bool begin) : inherited(t, begin) { } + template friend class HashMap; + +}; + +template +inline typename HashMap::const_iterator +HashMap::begin() const +{ + return const_iterator(this, true); +} + +template +inline typename HashMap::iterator +HashMap::begin() +{ + return iterator(this, true); +} + +template +inline typename HashMap::const_iterator +HashMap::end() const +{ + return const_iterator(this, false); +} + +template +inline typename HashMap::iterator +HashMap::end() +{ + return iterator(this, false); +} + +template +inline +_HashMap_const_iterator::operator unspecified_bool_type() const +{ + return inherited::live() ? &inherited::live : 0; +} + +template +inline bool +operator==(const _HashMap_const_iterator &a, const _HashMap_const_iterator &b) +{ + return a.pair() == b.pair(); +} + +template +inline bool +operator!=(const _HashMap_const_iterator &a, const _HashMap_const_iterator &b) +{ + return a.pair() != b.pair(); +} + +/** @endcond */ +CLICK_ENDDECLS +#include +#endif diff --git a/openflow/include/click/hashtable.hh b/openflow/include/click/hashtable.hh new file mode 100644 index 0000000..e482d42 --- /dev/null +++ b/openflow/include/click/hashtable.hh @@ -0,0 +1,1120 @@ +#ifndef CLICK_HASHTABLE_HH +#define CLICK_HASHTABLE_HH +/* + * hashtable.hh -- HashTable template + * Eddie Kohler + * + * Copyright (c) 2008 Meraki, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software") + * to deal in the Software without restriction, subject to the conditions + * listed in the Click LICENSE file. These conditions include: you must + * preserve this copyright notice, and you cannot mention the copyright + * holders in advertising related to the Software without their permission. + * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This + * notice is a summary of the Click LICENSE file; the license in that file is + * legally binding. + */ +#include +#include +#include +CLICK_DECLS + +/** @file + * @brief Click's hash table container template. + */ + +template class HashTable; +template class HashTable_iterator; +template class HashTable_const_iterator; + +/** @class HashTable + @brief Hash table template. + + The HashTable template implements a hash table or associative array suitable + for use in the kernel or at user level. Its interface is similar to C++'s + std::map and std::unordered_map, although those types have more methods. + + Used with two template parameters, as HashTable, the table maps keys K + to values V. Used with one template parameter, as HashTable, HashTable + is a hash set. The type T must declare types named key_type and + key_const_reference. It also must declare a hashkey() member function + returning type key_const_reference. An object's hashkey() defines its key. + + HashTable is a chained hash table. (Open coding is not + appropriate in the kernel, where large contiguous memory allocations are + essentially impossible.) When run through Google's sparse_hash_table tests + (April 2008, sparsehash-1.1), HashTable appears to perform slightly better + than g++'s hash_map, better than sparse_hash_map, and worse than + dense_hash_map; it takes less memory than hash_map and dense_hash_map. + + HashTable is faster than Click's prior HashMap class and has fewer potential + race conditions in multithreaded use. HashMap remains for backward + compatibility but should not be used in new code. + + @warning HashMap users should beware of HashTable's operator[]. HashMap's + operator[] returned a non-assignable const reference; it would never add an + element to the hash table. In contrast, the HashTable operator[] + may add an element to the table. (If added, the element will + initially have the table's default value.) For instance, consider: + @code + HashMap h(0); + h.insert("A", 1); + if (!h["B"]) // Nota bene + printf("B wasn't in table, and still isn't\n"); + for (HashMap::iterator it = h.begin(); it; ++it) + printf("%s -> %d\n", it.key().c_str(), it.value()); + // Prints B wasn't in table, and still isn't + // A -> 1 + @endcode + + @warning Here the h["B"] reference does not add an element to + the hash table, as you can see from the iteration. Similar HashTable code + has a different result: + @code + HashTable h(0); + h["A"] = 1; + if (!h["B"]) // Nota bene + printf("B wasn't in table, but it is now\n"); + for (HashMap::iterator it = h.begin(); it; ++it) + printf("%s -> %d\n", it.key().c_str(), it.value()); + // Prints B wasn't in table, but it is now + // A -> 1 + // B -> 0 + @endcode + + @warning If you don't want operator[] to add an element, either access + operator[] through a const hash table, or use get(): + @code + HashTable h(0); + if (!h.get("B")) + printf("B wasn't in table, and still isn't\n"); + const HashTable &const_h = h; + if (!const_h["B"]) + printf("B wasn't in table, and still isn't\n"); + @endcode +*/ +template +class HashTable { + + struct elt { + T v; + elt *_hashnext; + elt(const T &v_) + : v(v_) { + } + typedef typename T::key_type key_type; + typedef typename T::key_const_reference key_const_reference; + key_const_reference hashkey() const { + return v.hashkey(); + } + }; + + typedef HashContainer rep_type; + + public: + + /** @brief Key type. */ + typedef typename T::key_type key_type; + + /** @brief Const reference to key type. */ + typedef typename T::key_const_reference key_const_reference; + + /** @brief Value type. value_type::key_type must exist. */ + typedef T value_type; + + /** @brief Type of sizes (size()). */ + typedef typename rep_type::size_type size_type; + + /** @brief Type of bucket sizes (bucket_count()). */ + typedef typename rep_type::bucket_count_type bucket_count_type; + + + /** @brief Construct an empty hash table. */ + HashTable() + : _rep() { + } + + /** @brief Construct a hash table with at least @a n buckets. + * + * In kernel modules HashTable has a maximum bucket count, so + * HashTable(n).bucket_count() might be less than @a n. */ + explicit HashTable(bucket_count_type n) + : _rep(n) { + } + + /** @brief Construct a hash table as a copy of @a x. */ + HashTable(const HashTable &x) + : _rep(x._rep.bucket_count()) { + clone_elements(x); + } + +#if HAVE_CXX_RVALUE_REFERENCES + /** @overload */ + HashTable(HashTable &&x) + : _rep() { + x.swap(*this); + } +#endif + + /** @brief Destroy the hash table, freeing its memory. */ + ~HashTable(); + + + /** @brief Return the number of elements. */ + inline size_type size() const { + return _rep.size(); + } + + /** @brief Test if size() == 0. */ + inline bool empty() const { + return _rep.empty(); + } + + /** @brief Return the number of buckets. */ + inline bucket_count_type bucket_count() const { + return _rep.bucket_count(); + } + + /** @brief Return the number of elements in hash bucket @a n. + * @param n bucket number, >= 0 and < bucket_count() */ + inline size_type bucket_size(bucket_count_type n) const { + return _rep.bucket_size(n); + } + + + typedef HashTable_const_iterator const_iterator; + typedef HashTable_iterator iterator; + + /** @brief Return an iterator for the first element in the table. + * + * HashTable iterators return elements in random order. */ + inline iterator begin(); + /** @overload */ + inline const_iterator begin() const; + + /** @brief Return an iterator for the end of the table. + * @invariant end().live() == false */ + inline iterator end(); + /** @overload */ + inline const_iterator end() const; + + + /** @brief Return 1 if an element with key @a key exists, 0 otherwise. */ + inline size_type count(key_const_reference key) const; + + /** @brief Return an iterator for the element with key @a key, if any. + * + * Returns end() if no such element exists. */ + inline iterator find(key_const_reference key); + /** @overload */ + inline const_iterator find(key_const_reference key) const; + + /** @brief Return an iterator for the element with key @a key, if any. + * + * Like find(), but additionally moves the found element to the head of + * its bucket, possibly speeding up future lookups. + * + * @note find_prefer() rearranges the ordering of a bucket, and therefore + * invalidates outstanding iterators. */ + inline iterator find_prefer(key_const_reference key); + + /** @brief Ensure an element with key @a key and return its iterator. + * + * If an element with @a key already exists in the table, then, like + * find(@a key), returns an iterator pointing at at element. Otherwise, + * find_insert adds a new value T(@a key) to the table and returns its + * iterator. + * + * @note find_insert() may rebalance the hash table, and thus invalidates + * outstanding iterators. + * + * @sa operator[] */ + inline iterator find_insert(key_const_reference key); + + /** @brief Ensure an element with key @a key and return its reference. + * + * If an element with @a key already exists in the table, then returns a + * reference to that element. Otherwise, adds a new value T(@a key) to + * the table and returns a reference to the new element. + * + * @note operator[] may rebalance the hash table, and thus invalidates + * outstanding iterators. + * + * @sa find_insert(key_const_reference) */ + inline value_type &operator[](key_const_reference key); + + /** @brief Ensure an element with key @a value.hashkey() and return its iterator. + * + * If an element with @a value.hashkey() already exists in the table, + * then, like find(), returns an iterator pointing at at element. + * Otherwise, find_insert adds a copy of @a value to the table and returns + * its iterator. + * + * @note find_insert() may rebalance the hash table, and thus invalidates + * outstanding iterators. */ + inline iterator find_insert(const value_type &value); + + /** @brief Add @a value to the table, replacing any element with that key. + * + * Inserts @a value into the table. If an element with @a value.hashkey() + * already exists in the table, then it is replaced, and the function + * returns false. Otherwise, a copy of @a value is added, and the + * function returns true. + * + * @note set() may rebalance the hash table, and thus invalidates + * outstanding iterators. */ + bool set(const value_type &value); + + /** @brief Remove the element indicated by @a it. + * @return An iterator pointing at the next element remaining, or end() + * if no such element exists. */ + iterator erase(const iterator &it); + + /** @brief Remove any element with @a key. + * + * Returns the number of elements removed, which is always 0 or 1. */ + size_type erase(const key_type &key); + + /** @brief Remove all elements. + * @post size() == 0 */ + void clear(); + + + /** @brief Swap the contents of this hash table and @a x. */ + void swap(HashTable &x); + + + /** @brief Rehash the table, ensuring it contains at least @a n buckets. + * + * If @a n < bucket_count(), this function may make the hash table + * slower. */ + void rehash(bucket_count_type n) { + _rep.rehash(n); + } + + + /** @brief Replace this hash table's contents with a copy of @a x. */ + HashTable &operator=(const HashTable &x); + +#if HAVE_CXX_RVALUE_REFERENCES + /** @overload */ + inline HashTable &operator=(HashTable &&x) { + x.swap(*this); + return *this; + } +#endif + + private: + + rep_type _rep; + SizedHashAllocator _alloc; + + void clone_elements(const HashTable &); + void copy_elements(const HashTable &); + + friend class HashTable_iterator; + friend class HashTable_const_iterator; + template friend class HashTable; + +}; + +/** @class HashTable_const_iterator + * @brief The const_iterator type for HashTable. */ +template +class HashTable_const_iterator { public: + + /** @brief Construct an uninitialized iterator. */ + HashTable_const_iterator() { + } + + /** @brief Return a pointer to the element, null if *this == end(). */ + const T *get() const { + if (_rep) + return &_rep.get()->v; + else + return 0; + } + + /** @brief Return a pointer to the element. + * @pre *this != end() */ + const T *operator->() const { + return &_rep.get()->v; + } + + /** @brief Return a reference to the element. + * @pre *this != end() */ + const T &operator*() const { + return _rep.get()->v; + } + + /** @brief Return this element's key. + * @pre *this != end() */ + typename HashTable::key_const_reference key() const { + return _rep.get()->hashkey(); + } + + /** @brief Return true iff *this != end(). */ + bool live() const { + return (bool) _rep; + } + + typedef bool (HashTable_const_iterator::*unspecified_bool_type)() const; + /** @brief Return true iff *this != end(). */ + inline operator unspecified_bool_type() const { + return _rep ? &HashTable_const_iterator::live : 0; + } + + /** @brief Advance this iterator to the next element. */ + void operator++(int) { + _rep++; + } + + /** @brief Advance this iterator to the next element. */ + void operator++() { + ++_rep; + } + + private: + + typename HashTable::rep_type::const_iterator _rep; + + inline HashTable_const_iterator(const typename HashTable::rep_type::const_iterator &i) + : _rep(i) { + } + + friend class HashTable; + friend class HashTable_iterator; + +}; + +/** @class HashTable_iterator + @brief The iterator type for HashTable. + + These iterators apply to HashTable classes that store either a unified + key-value pair (HashTable), or to HashTable classes that map keys to + explicit values (HashTable). + + Iterators for HashTable objects have additional methods. Given + HashTable::iterator it: + +
    +
  • *it has type Pair.
  • +
  • it.key() returns the associated key, and is equivalent to it->first.
  • +
  • it.value() returns the associated value, and is equivalent to + it->second.
  • +
  • it.value() is a mutable reference for iterator objects and a const + reference for const_iterator objects.
  • +
+*/ +template +class HashTable_iterator : public HashTable_const_iterator { public: + + typedef HashTable_const_iterator inherited; + + /** @brief Construct an uninitialized iterator. */ + HashTable_iterator() { + } + + /** @brief Return a pointer to the element, null if *this == end(). */ + T *get() const { + return const_cast(inherited::get()); + } + + /** @brief Return a pointer to the element. + * @pre *this != end() */ + inline T *operator->() const { + return const_cast(inherited::operator->()); + } + + /** @brief Return a reference to the element. + * @pre *this != end() */ + inline T &operator*() const { + return const_cast(inherited::operator*()); + } + + private: + + inline HashTable_iterator(const typename HashTable::rep_type::const_iterator &i) + : inherited(i) { + } + + friend class HashTable; + +}; + +/** @class HashTable_const_iterator + * @brief The const_iterator type for HashTable. */ +template +class HashTable_const_iterator > { public: + + /** @brief Construct an uninitialized iterator. */ + HashTable_const_iterator() { + } + + /** @brief Return a pointer to the element, null if *this == end(). */ + const Pair *get() const { + if (_rep) + return &_rep.get()->v; + else + return 0; + } + + /** @brief Return a pointer to the element. + * @pre *this != end() */ + const Pair *operator->() const { + return &_rep.get()->v; + } + + /** @brief Return a reference to the element. + * @pre *this != end() */ + const Pair &operator*() const { + return _rep.get()->v; + } + + /** @brief Return a reference to the element's key. + * @pre *this != end() + * @return operator*().first */ + const K &key() const { + return operator*().first; + } + + /** @brief Return a reference to the element's value. + * @pre *this != end() + * @return operator*().second */ + const V &value() const { + return operator*().second; + } + + /** @brief Return true iff *this != end(). */ + bool live() const { + return (bool) _rep; + } + + typedef bool (HashTable_const_iterator::*unspecified_bool_type)() const; + /** @brief Return true iff *this != end(). */ + inline operator unspecified_bool_type() const { + return _rep ? &HashTable_const_iterator::live : 0; + } + + /** @brief Advance this iterator to the next element. */ + void operator++(int) { + _rep++; + } + + /** @brief Advance this iterator to the next element. */ + void operator++() { + ++_rep; + } + + private: + + typename HashTable >::rep_type::const_iterator _rep; + + inline HashTable_const_iterator(const typename HashTable >::rep_type::const_iterator &i) + : _rep(i) { + } + + friend class HashTable >; + friend class HashTable_iterator >; + +}; + +/** @class HashTable_iterator + * @brief The iterator type for HashTable. */ +template +class HashTable_iterator > : public HashTable_const_iterator > { public: + + typedef HashTable_const_iterator > inherited; + + /** @brief Construct an uninitialized iterator. */ + HashTable_iterator() { + } + + /** @brief Return a pointer to the element, null if *this == end(). */ + Pair *get() const { + return const_cast *>(inherited::get()); + } + + /** @brief Return a pointer to the element, null if *this == end(). */ + inline Pair *operator->() const { + return const_cast *>(inherited::operator->()); + } + + /** @brief Return a reference to the element. + * @pre *this != end() */ + inline Pair &operator*() const { + return const_cast &>(inherited::operator*()); + } + + /** @brief Return a mutable reference to the element's value. + * @pre *this != end() + * @return operator*().second */ + V &value() const { + return operator*().second; + } + + private: + + inline HashTable_iterator(const typename HashTable >::rep_type::const_iterator &i) + : inherited(i) { + } + + friend class HashTable >; + +}; + + +template +class HashTable { + + typedef HashTable > rep_type; + + public: + + /** @brief Key type. */ + typedef K key_type; + + /** @brief Const reference to key type. */ + typedef const K &key_const_reference; + + /** @brief Value type. */ + typedef V mapped_type; + + /** @brief Pair of key type and value type. */ + typedef Pair value_type; + + /** @brief Type of sizes. */ + typedef typename rep_type::size_type size_type; + + /** @brief Type of bucket sizes. */ + typedef typename rep_type::bucket_count_type bucket_count_type; + + + /** @brief Construct an empty hash table with normal default value. */ + HashTable() + : _rep(), _default_value() { + } + + /** @brief Construct an empty hash table with default value @a d. */ + explicit HashTable(const mapped_type &d) + : _rep(), _default_value(d) { + } + + /** @brief Construct an empty hash table with at least @a n buckets. + * @param d default value + * @param n minimum number of buckets */ + HashTable(const mapped_type &d, bucket_count_type n) + : _rep(n), _default_value(d) { + } + + /** @brief Construct a hash table as a copy of @a x. */ + HashTable(const HashTable &x) + : _rep(x._rep), _default_value(x._default_value) { + } + +#if HAVE_CXX_RVALUE_REFERENCES + /** @overload */ + HashTable(HashTable &&x) + : _rep(), _default_value() { + x.swap(*this); + } +#endif + + /** @brief Destroy this hash table, freeing its memory. */ + ~HashTable() { + } + + + /** @brief Return the number of elements in the hash table. */ + inline size_type size() const { + return _rep.size(); + } + + /** @brief Return true iff size() == 0. */ + inline bool empty() const { + return _rep.empty(); + } + + /** @brief Return the number of buckets in the hash table. */ + inline bucket_count_type bucket_count() const { + return _rep.bucket_count(); + } + + /** @brief Return the number of elements in bucket @a n. + * @param n bucket number, >= 0 and < bucket_count() */ + inline size_type bucket_size(bucket_count_type n) const { + return _rep.bucket_size(n); + } + + /** @brief Return the hash table's default value. + * + * The default value is returned by operator[]() when a key does not + * exist. */ + inline const mapped_type &default_value() const { + return _default_value; + } + + + typedef HashTable_const_iterator const_iterator; + typedef HashTable_iterator iterator; + + /** @brief Return an iterator for the first element in the table. + * + * @note HashTable iterators return elements in undefined order. */ + inline iterator begin() { + return _rep.begin(); + } + /** @overload */ + inline const_iterator begin() const { + return _rep.begin(); + } + + /** @brief Return an iterator for the end of the table. + * @invariant end().live() == false */ + inline iterator end() { + return _rep.end(); + } + /** @overload */ + inline const_iterator end() const { + return _rep.end(); + } + + + /** @brief Return 1 if an element with key @a key exists, 0 otherwise. */ + inline size_type count(key_const_reference key) const { + return _rep.count(key); + } + + /** @brief Return an iterator for the element with key @a key, if any. + * + * Returns end() if no such element exists. */ + inline const_iterator find(key_const_reference key) const { + return _rep.find(key); + } + /** @overload */ + inline iterator find(key_const_reference key) { + return _rep.find(key); + } + + /** @brief Return an iterator for the element with key @a key, if any. + * + * Like find(), but additionally moves the found element to the head of + * its bucket, possibly speeding up future lookups. */ + inline iterator find_prefer(key_const_reference key) { + return _rep.find_prefer(key); + } + + + /** @brief Return the value for @a key. + * + * If no element for @a key currently exists (find(@a key) == end()), + * returns default_value(). */ + const mapped_type &get(key_const_reference key) const { + if (const_iterator i = find(key)) + return i.value(); + else + return _default_value; + } + + /** @brief Return a pointer to the value for @a key. + * + * If no element for @a key currently exists (find(@a key) == end()), + * returns null. */ + mapped_type *get_pointer(key_const_reference key) { + if (iterator i = find(key)) + return &i.value(); + else + return 0; + } + /** @overload */ + const mapped_type *get_pointer(key_const_reference key) const { + if (const_iterator i = find(key)) + return &i.value(); + else + return 0; + } + + /** @brief Return the value for @a key. + * + * If no element for @a key currently exists (find(@a key) == end()), + * returns default_value(). + * + * @warning The overloaded operator[] on non-const hash tables may add an + * element to the table. If you don't want to add an element, either + * access operator[] through a const hash table, or use get(). */ + const mapped_type &operator[](key_const_reference key) const { + if (const_iterator i = find(key)) + return i.value(); + else + return _default_value; + } + + /** @brief Return a reference to the value for @a key. + * + * The caller can assign the reference to change the value. If no element + * for @a key currently exists (find(@a key) == end()), adds a new element + * with default_value() and returns a reference to that value. + * + * @note Inserting an element into a HashTable invalidates all existing + * iterators. */ +#if CLICK_HASHMAP_UPGRADE_WARNINGS + inline mapped_type &operator[](key_const_reference key) CLICK_DEPRECATED; +#else + inline mapped_type &operator[](key_const_reference key); +#endif + + + /** @brief Ensure an element with key @a key and return its iterator. + * + * If an element with @a key already exists in the table, then find(@a + * key) and find_insert(@a key) are equivalent. Otherwise, find_insert + * adds a new element with key @a key and value default_value() to the + * table and returns its iterator. + * + * @note Inserting an element into a HashTable invalidates all existing + * iterators. */ + inline iterator find_insert(key_const_reference key) { + return _rep.find_insert(value_type(key, _default_value)); + } + + /** @brief Ensure an element for key @a key and return its iterator. + * + * If an element with @a key already exists in the table, then find(@a + * key) and find_insert(@a value) are equivalent. Otherwise, + * find_insert(@a key, @a value) adds a new element with key @a key and + * value @a value to the table and returns its iterator. + * + * @note Inserting an element into a HashTable invalidates all existing + * iterators. */ + inline iterator find_insert(key_const_reference key, + const mapped_type &value) { + return _rep.find_insert(value_type(key, value)); + } + + + /** @brief Set the mapping for @a key to @a value. + * + * If an element for @a key already exists in the table, then its value is + * assigned to @a value and the function returns false. Otherwise, a new + * element mapping @a key to @a value is added and the function returns + * true. + * + * The behavior is basically the same as "(*this)[@a key] = @a value". + * (The difference is that if (*this)[@a key] is not already in the hash + * table, the new @a value is constructed rather than assigned.) + * + * @note Inserting an element into a HashTable invalidates all existing + * iterators. */ + bool set(key_const_reference key, const mapped_type &value); + + /** @brief Set the mapping for @a key to @a value. + * + * This is a deprecated synonym for set(). + * + * @deprecated Use set(). */ + bool replace(key_const_reference key, const mapped_type &value) CLICK_DEPRECATED; + + /** @brief Remove the element indicated by @a it. + * @return A valid iterator pointing at the next element remaining, or + * end() if no such element exists. */ + iterator erase(const iterator &it) { + return _rep.erase(it); + } + + /** @brief Remove any element with @a key. + * + * Returns the number of elements removed, which is always 0 or 1. */ + size_type erase(key_const_reference key) { + return _rep.erase(key); + } + + /** @brief Remove all elements. + * @post size() == 0 */ + void clear() { + _rep.clear(); + } + + + /** @brief Swap the contents of this hash table and @a x. */ + void swap(HashTable &x) { + _rep.swap(x._rep); + click_swap(x._default_value, _default_value); + } + + + /** @brief Rehash the table, ensuring it contains at least @a n buckets. + * + * All existing iterators are invalidated. If @a n < bucket_count(), this + * function may make the hash table slower. */ + void rehash(bucket_count_type nb) { + _rep.rehash(nb); + } + + + /** @brief Assign this hash table's contents to a copy of @a x. */ + HashTable &operator=(const HashTable &x) { + _rep = x._rep; + _default_value = x._default_value; + return *this; + } + +#if HAVE_CXX_RVALUE_REFERENCES + /** @overload */ + HashTable &operator=(HashTable &&x) { + x.swap(*this); + return *this; + } +#endif + + private: + + rep_type _rep; + V _default_value; + +}; + + + +template +HashTable::~HashTable() +{ + for (typename rep_type::iterator it = _rep.begin(); it; ) { + elt *e = _rep.erase(it); + e->v.~T(); + _alloc.deallocate(e); + } +} + +template +inline typename HashTable::const_iterator HashTable::begin() const +{ + return const_iterator(_rep.begin()); +} + +template +inline typename HashTable::iterator HashTable::begin() +{ + return iterator(_rep.begin()); +} + +template +inline typename HashTable::const_iterator HashTable::end() const +{ + return const_iterator(_rep.end()); +} + +template +inline typename HashTable::iterator HashTable::end() +{ + return iterator(_rep.end()); +} + +template +inline typename HashTable::size_type HashTable::count(key_const_reference key) const +{ + return _rep.contains(key); +} + +template +inline HashTable_const_iterator HashTable::find(key_const_reference key) const +{ + return HashTable_const_iterator(_rep.find(key)); +} + +template +inline HashTable_iterator HashTable::find(key_const_reference key) +{ + return HashTable_iterator(_rep.find(key)); +} + +template +inline HashTable_iterator HashTable::find_prefer(key_const_reference key) +{ + return HashTable_iterator(_rep.find_prefer(key)); +} + +template +HashTable_iterator HashTable::find_insert(key_const_reference key) +{ + typename rep_type::iterator i = _rep.find(key); + if (!i) + if (elt *e = reinterpret_cast(_alloc.allocate())) { + new(reinterpret_cast(&e->v)) T(key); + _rep.set(i, e, true); + } + return i; +} + +template +typename HashTable::value_type & +HashTable::operator[](key_const_reference key) +{ + return *find_insert(key); +} + +template +HashTable_iterator HashTable::find_insert(const value_type &v) +{ + typename rep_type::iterator i = _rep.find(hashkey(v)); + if (!i) + if (elt *e = reinterpret_cast(_alloc.allocate())) { + new(reinterpret_cast(&e->v)) T(v); + _rep.set(i, e, true); + } + return i; +} + +template +bool HashTable::set(const value_type &value) +{ + typename rep_type::iterator i = _rep.find(hashkey(value)); + if (i) + i->v = value; + else if (elt *e = reinterpret_cast(_alloc.allocate())) { + new(reinterpret_cast(&e->v)) T(value); + _rep.set(i, e, true); + return true; + } + return false; +} + +template +bool HashTable::set(const key_type &key, const mapped_type &value) +{ + typename rep_type::rep_type::iterator i = _rep._rep.find(key); + if (i) + i->v.second = value; + else if (typename rep_type::elt *e = reinterpret_cast(_rep._alloc.allocate())) { + new(reinterpret_cast(&e->v)) value_type(key, value); + _rep._rep.set(i, e, true); + return true; + } + return false; +} + +template +typename HashTable::iterator HashTable::erase(const iterator &it) +{ + iterator itx(it); + if (elt *e = _rep.erase(reinterpret_cast(itx._rep))) { + e->v.~T(); + _alloc.deallocate(e); + } + return itx; +} + +template +typename HashTable::size_type HashTable::erase(const key_type &key) +{ + if (elt *e = _rep.erase(key)) { + e->v.~T(); + _alloc.deallocate(e); + return 1; + } else + return 0; +} + +template +void HashTable::clone_elements(const HashTable &o) + // requires that 'this' is empty and has the same number of buckets as 'o' +{ + bucket_count_type b = (bucket_count_type) -1; + typename rep_type::iterator j = _rep.end(); + for (typename rep_type::const_iterator i = o._rep.begin(); i; ++i) { + if (b != i.bucket()) + j = _rep.begin((b = i.bucket())); + if (elt *e = reinterpret_cast(_alloc.allocate())) { + new(reinterpret_cast(&e->v)) T(i->v); + _rep.insert_at(j, e); + } + } +} + +template +void HashTable::copy_elements(const HashTable &o) +{ + for (typename rep_type::const_iterator i = o._rep.begin(); i; ++i) + find_insert(i->v); +} + +template +HashTable &HashTable::operator=(const HashTable &o) +{ + if (&o != this) { + clear(); + if (_rep.bucket_count() < o._rep.bucket_count()) + _rep.rehash(o._rep.bucket_count()); + copy_elements(o); + } + return *this; +} + +template +void HashTable::clear() +{ + for (typename rep_type::iterator it = _rep.begin(); it; ) { + elt *e = _rep.erase(it); + e->v.~T(); + _alloc.deallocate(e); + } +} + +template +void HashTable::swap(HashTable &o) +{ + _rep.swap(o._rep); + _alloc.swap(o._alloc); +} + +template +inline typename HashTable::mapped_type &HashTable::operator[](const key_type &key) +{ + return find_insert(key).value(); +} + +template +bool HashTable::replace(const key_type &key, const mapped_type &value) +{ + return set(key, value); +} + + +/** @brief Compare two HashTable iterators for equality. */ +template +inline bool operator==(const HashTable_const_iterator &a, const HashTable_const_iterator &b) +{ + return a.get() == b.get(); +} + +/** @brief Compare two HashTable iterators for inequality. */ +template +inline bool operator!=(const HashTable_const_iterator &a, const HashTable_const_iterator &b) +{ + return a.get() != b.get(); +} + + +template +inline void click_swap(HashTable &a, HashTable &b) +{ + a.swap(b); +} + +template +inline void assign_consume(HashTable &a, HashTable &b) +{ + a.swap(b); +} + +template +inline void clear_by_swap(HashTable &x) +{ + // specialization avoids losing x's default value + HashTable tmp(x.default_value()); + x.swap(tmp); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/heap.hh b/openflow/include/click/heap.hh new file mode 100644 index 0000000..cafc0f7 --- /dev/null +++ b/openflow/include/click/heap.hh @@ -0,0 +1,425 @@ +#ifndef CLICK_HEAP_HH +#define CLICK_HEAP_HH +#include +CLICK_DECLS + +/** @brief Add an element to a heap. + * @param begin begin random-access iterator + * @param end end random-access iterator + * @param comp compare function object, such as less<> + * @param place placement function object, defaults to do_nothing<> + * @pre @a begin \< @a end + * @pre [@a begin, @a end - 1) is a heap + * @post [@a begin, @a end) is a heap + * + * This function rearranges the elements in [@a begin, @a end) to be a heap. + * It assumes that most of the sequence is already a heap -- only the new + * element, @a end[-1], might not be in a valid place. + * + * The comparison function @a comp defines the heap order. + * + * The placement function @a place is called for each element that + * changes place within the heap order; its arguments are @a begin and + * an iterator for the element that switched place. @a place is always + * called once with an iterator pointing the new element in its final + * place. @a place is useful when elements need to keep track of + * their own positions in the heap order. @a place defaults to + * do_nothing<>(). + * + * @sa change_heap, pop_heap, remove_heap */ +template +inline void push_heap(iterator_type begin, iterator_type end, + compare_type comp, place_type place) +{ + assert(begin < end); + size_t i = end - begin - 1, npos; + + while (i > 0 && (npos = (i-1)/2, comp(begin[i], begin[npos]))) { + click_swap(begin[i], begin[npos]); + place(begin, begin + i); + i = npos; + } + + place(begin, begin + i); +} + +/** @overload */ +template +inline void push_heap(iterator_type begin, iterator_type end, + compare_type comp) +{ + push_heap(begin, end, comp, do_nothing()); +} + +/** @brief Change an element's position within a heap. + * @param begin begin random-access iterator + * @param end end random-access iterator + * @param element iterator pointing to element whose position may change + * @param comp compare function object, such as less<> + * @param place placement function object, defaults to do_nothing<> + * @pre @a begin \<= @a element < @a end + * @pre [@a begin, @a end) is a heap, perhaps excluding @a element + * @post [@a begin, @a end) is a heap + * @return iterator pointing to the new location of *@a element + * + * This function rearranges the elements in [@a begin, @a end) to be a heap. + * It assumes that most of the sequence is already a heap. Only the element + * pointed to by @a element might be out of place. + * + * The comparison function @a comp defines the heap order. + * + * The placement function @a place is called for each element that + * changes place within the heap order; its arguments are @a begin and + * an iterator for the element that switched place. @a place is + * useful when elements need to keep track of their own positions in + * the heap order. @a place defaults to do_nothing<>(). + * + * @sa push_heap, pop_heap, remove_heap */ +template +iterator_type change_heap(iterator_type begin, iterator_type end, + iterator_type element, + compare_type comp, place_type place) +{ + assert(begin <= element && element < end); + size_t i = element - begin, size = end - begin, npos; + + while (i > 0 && (npos = (i-1)/2, comp(begin[i], begin[npos]))) { + click_swap(begin[i], begin[npos]); + place(begin, begin + i); + i = npos; + } + + while (1) { + size_t smallest = i, trial = i*2 + 1; + if (trial < size && comp(begin[trial], begin[smallest])) + smallest = trial; + if (trial + 1 < size && comp(begin[trial + 1], begin[smallest])) + smallest = trial + 1; + if (smallest == i) + break; + click_swap(begin[i], begin[smallest]); + place(begin, begin + i); + i = smallest; + } + + if (begin + i != element) + place(begin, begin + i); + return begin + i; +} + +/** @overload */ +template +inline iterator_type change_heap(iterator_type begin, iterator_type end, + iterator_type element, compare_type comp) +{ + return change_heap(begin, end, element, comp, do_nothing()); +} + +/** @brief Remove an element from a heap. + * @param begin begin random-access iterator + * @param end end random-access iterator + * @param element iterator pointing to element to remove + * @param comp compare function object, such as less<> + * @param place placement function object, defaults to do_nothing<> + * @pre @a begin \<= @a element < @a end + * @pre [@a begin, @a end) is a heap, possibly excluding @a element + * @post [@a begin, @a end - 1) is a heap, and the element formerly at + * *@a element has shifted to *(@a end - 1) + * + * This function removes @a element from the heap in [@a begin, @a end) by + * shifting it to the end, preserving the heap property on the remaining + * elements. + * + * The comparison function @a comp defines the heap order. + * + * The placement function @a place is called for each actual element + * that changes place within the heap order; its arguments are @a + * begin and an iterator for the element that switched place. It is + * not called on @a element, which is no longer considered a member of + * the heap. @a place is useful when elements need to keep track of + * their own positions in the heap order. @a place defaults to + * do_nothing<>(). + * + * @sa push_heap, change_heap, pop_heap */ +template +inline void remove_heap(iterator_type begin, iterator_type end, + iterator_type element, + compare_type comp, place_type place) +{ + assert(begin <= element && element < end); + if (element + 1 != end) { + click_swap(element[0], end[-1]); + place(begin, element); + change_heap(begin, end - 1, element, comp, place); + } +} + +/** @overload */ +template +inline void remove_heap(iterator_type begin, iterator_type end, + iterator_type element, + compare_type comp) +{ + remove_heap(begin, end, element, comp, do_nothing()); +} + +/** @brief Remove the first element from a heap. + * @param begin begin random-access iterator + * @param end end random-access iterator + * @param comp compare function object, such as less<> + * @param place placement function object, defaults to do_nothing<> + * @pre @a begin \< @a end + * @pre [@a begin, @a end) is a heap + * @post [@a begin, @a end - 1) is a heap, and the element formerly at + * *@a begin has shifted to *(@a end - 1) + * + * This function removes the first element of [@a begin, @a end) from a heap + * by shifting it to the end, preserving the heap property on the remaining + * elements. + * + * The comparison function @a comp defines the heap order. + * + * The placement function @a place is called for each element that + * changes place within the heap order; its arguments are @a begin and + * an iterator for the element that switched place. It is not called + * on the first element, which is no longer considered a member of the + * heap. @a place is useful when elements need to keep track of their + * own positions in the heap order. @a place defaults to + * do_nothing<>(). + * + * @sa push_heap, change_heap, remove_heap */ +template +inline void pop_heap(iterator_type begin, iterator_type end, + compare_type comp, place_type place) +{ + remove_heap(begin, end, begin, comp, place); +} + +/** @overload */ +template +inline void pop_heap(iterator_type begin, iterator_type end, + compare_type comp) +{ + pop_heap(begin, end, comp, do_nothing()); +} + + + +/** @brief Add an element to a d-ary heap. + * @param begin begin random-access iterator + * @param end end random-access iterator + * @param comp compare function object, such as less<> + * @param place placement function object, defaults to do_nothing<> + * @pre @a begin \< @a end + * @pre [@a begin, @a end - 1) is a d-ary heap + * @post [@a begin, @a end) is a d-ary heap + * + * This function rearranges the elements in [@a begin, @a end) to be + * a d-ary heap. It assumes that most of the sequence is already a + * heap -- only the new element, @a end[-1], might not be in a valid + * place. The arity @a n is a template parameter, and must be greater + * than 2. + * + * The comparison function @a comp defines the heap order. + * + * The placement function @a place is called for each element that + * changes place within the heap order; its arguments are @a begin and + * an iterator for the element that switched place. @a place is always + * called once with an iterator pointing the new element in its final + * place. @a place is useful when elements need to keep track of + * their own positions in the heap order. @a place defaults to + * do_nothing<>(). + * + * @sa change_heap, pop_heap, remove_heap */ +template +inline void push_heap(iterator_type begin, iterator_type end, + compare_type comp, place_type place) +{ + static_assert(arity > 2, "For arity == 2, use push_heap(...), not push_heap<2>(...)."); + assert(begin < end); + size_t i = end - begin - 1, npos; + + while (i > 0 && (npos = i/arity, comp(begin[i], begin[npos]))) { + click_swap(begin[i], begin[npos]); + place(begin, begin + i); + i = npos; + } + + place(begin, begin + i); +} + +/** @overload */ +template +inline void push_heap(iterator_type begin, iterator_type end, + compare_type comp) +{ + push_heap(begin, end, comp, do_nothing()); +} + +/** @brief Change an element's position within a d-ary heap. + * @param begin begin random-access iterator + * @param end end random-access iterator + * @param element iterator pointing to element whose position may change + * @param comp compare function object, such as less<> + * @param place placement function object, defaults to do_nothing<> + * @pre @a begin \<= @a element < @a end + * @pre [@a begin, @a end) is a d-ary heap, perhaps excluding @a element + * @post [@a begin, @a end) is a d-ary heap + * @return iterator pointing to the new location of *@a element + * + * This function rearranges the elements in [@a begin, @a end) to be + * a d-ary heap. It assumes that most of the sequence is already a + * heap. Only the element pointed to by @a element might be out of + * place. The arity @a n is a template parameter, and must be greater + * than 2. + * + * The comparison function @a comp defines the heap order. + * + * The placement function @a place is called for each element that + * changes place within the heap order; its arguments are @a begin and + * an iterator for the element that switched place. @a place is + * useful when elements need to keep track of their own positions in + * the heap order. @a place defaults to do_nothing<>(). + * + * @sa push_heap, pop_heap, remove_heap */ +template +iterator_type change_heap(iterator_type begin, iterator_type end, + iterator_type element, + compare_type comp, place_type place) +{ + static_assert(arity > 2, "For arity == 2, use change_heap(...), not change_heap<2>(...)."); + assert(begin <= element && element < end); + size_t i = element - begin, size = end - begin, npos; + + while (i > 0 && (npos = i/arity, comp(begin[i], begin[npos]))) { + click_swap(begin[i], begin[npos]); + place(begin, begin + i); + i = npos; + } + + while (1) { + size_t smallest = i, + trial = i ? i * arity : 1, + end_trial = i ? trial + arity : arity; + end_trial = end_trial < size ? end_trial : size; + for (; trial < end_trial; ++trial) + if (comp(begin[trial], begin[smallest])) + smallest = trial; + if (smallest == i) + break; + click_swap(begin[i], begin[smallest]); + place(begin, begin + i); + i = smallest; + } + + if (begin + i != element) + place(begin, begin + i); + return begin + i; +} + +/** @overload */ +template +inline iterator_type change_heap(iterator_type begin, iterator_type end, + iterator_type element, compare_type comp) +{ + return change_heap(begin, end, element, comp, do_nothing()); +} + +/** @brief Remove an element from a d-ary heap. + * @param begin begin random-access iterator + * @param end end random-access iterator + * @param element iterator pointing to element to remove + * @param comp compare function object, such as less<> + * @param place placement function object, defaults to do_nothing<> + * @pre @a begin \<= @a element < @a end + * @pre [@a begin, @a end) is a d-ary heap, possibly excluding @a element + * @post [@a begin, @a end - 1) is a d-ary heap, and the element formerly + * at *@a element has shifted to *(@a end - 1) + * + * This function removes @a element from the d-ary heap in [@a begin, + * @a end) by shifting it to the end, preserving the heap property on + * the remaining elements. The arity @a n is a template parameter. + * + * The comparison function @a comp defines the heap order. + * + * The placement function @a place is called for each actual element + * that changes place within the heap order; its arguments are @a + * begin and an iterator for the element that switched place. It is + * not called on @a element, which is no longer considered a member of + * the heap. @a place is useful when elements need to keep track of + * their own positions in the heap order. @a place defaults to + * do_nothing<>(). + * + * @sa push_heap, change_heap, pop_heap */ +template +inline void remove_heap(iterator_type begin, iterator_type end, + iterator_type element, + compare_type comp, place_type place) +{ + assert(begin <= element && element < end); + if (element + 1 != end) { + click_swap(element[0], end[-1]); + place(begin, element); + change_heap(begin, end - 1, element, comp, place); + } +} + +/** @overload */ +template +inline void remove_heap(iterator_type begin, iterator_type end, + iterator_type element, + compare_type comp) +{ + remove_heap(begin, end, element, comp, do_nothing()); +} + +/** @brief Remove the first element from a d-ary heap. + * @param begin begin random-access iterator + * @param end end random-access iterator + * @param comp compare function object, such as less<> + * @param place placement function object, defaults to do_nothing<> + * @pre @a begin \< @a end + * @pre [@a begin, @a end) is a d-ary heap + * @post [@a begin, @a end - 1) is a d-ary heap, and the element formerly + * at *@a begin has shifted to *(@a end - 1) + * + * This function removes the first element of [@a begin, @a end) from + * a d-ary heap by shifting it to the end, preserving the heap + * property on the remaining elements. The arity @a n is a template + * parameter. + * + * The comparison function @a comp defines the heap order. + * + * The placement function @a place is called for each element that + * changes place within the heap order; its arguments are @a begin and + * an iterator for the element that switched place. It is not called + * on the first element, which is no longer considered a member of the + * heap. @a place is useful when elements need to keep track of their + * own positions in the heap order. @a place defaults to + * do_nothing<>(). + * + * @sa push_heap, change_heap, remove_heap */ +template +inline void pop_heap(iterator_type begin, iterator_type end, + compare_type comp, place_type place) +{ + remove_heap(begin, end, begin, comp, place); +} + +/** @overload */ +template +inline void pop_heap(iterator_type begin, iterator_type end, + compare_type comp) +{ + pop_heap(begin, end, comp, do_nothing()); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/ino.hh b/openflow/include/click/ino.hh new file mode 100644 index 0000000..c943b51 --- /dev/null +++ b/openflow/include/click/ino.hh @@ -0,0 +1,133 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/ino.cc" -*- +#ifndef CLICK_INO_HH +#define CLICK_INO_HH +#include +CLICK_DECLS + +#define INO_DEBUG 0 + +// /click: .e > .h > element names > global handlers [dt_global] +// /click/.e: element numbers [dt_u] +// /click/.e/NUM: handlers [dt_hu] +// /click/.h: global handlers [dt_hh] +// /click/ELEMENTNAME: .h > element names > element handlers [dt_hn] +// /click/ELEMENTNAME/.h: element handlers [dt_hh] + +class ClickIno { public: + + void initialize(); + void cleanup(); + + uint32_t generation() const { return _generation; } + + // NB: inode number 0 is reserved for the system. + enum { dt_u = 1U, dt_hh = 2U, dt_hu = 3U, dt_hn = 4U, dt_global = 5U }; + enum { ino_globaldir = (unsigned) (dt_global << 28), + ino_enumdir = (unsigned) (dt_u << 28) }; + static bool is_handler(unsigned ino) { return (int32_t) ino < 0; } + static unsigned dirtype(unsigned ino) { return ino >> 28; } + static bool has_element(unsigned ino) { return ino & 0xFFFFU; } + static bool has_handlers(unsigned ino) { return ino > (dt_u << 28); } + static bool has_names(unsigned ino) { return ino >= (dt_hn << 28); } + static int ino_element(unsigned ino) { return (int) (ino & 0xFFFFU) - 1; } + static int ino_handler(unsigned ino) { + return (has_element(ino) ? 0 : Router::FIRST_GLOBAL_HANDLER) + + ((ino >> 16) & 0x7FFFU); + } + + static unsigned make_handler(int e, int hi) { + return 0x80000000U | ((hi & 0x7FFFU) << 16) | ((e + 1) & 0xFFFFU); + } + static unsigned make_dir(unsigned dtype, int e) { + return (dtype << 28) | ((e + 1) & 0xFFFFU); + } + + + // These operations should be called with a configuration lock held. + inline int prepare(Router *router, uint32_t generation); + int nlink(ino_t ino); + ino_t lookup(ino_t dir, const String &component); + + // readdir handles '..' (f_pos 0) and '.' (f_pos 1). + // It returns the number of things stored. + typedef bool (*filldir_t)(const char *name, int name_len, ino_t ino, int dirtype, loff_t f_pos, void *user_data); + int readdir(ino_t dir, loff_t &f_pos, filldir_t fd, void *user_data); + +#if INO_DEBUG + String info() const; +#endif + + struct Entry { + // Name of this entry. + String name; + + // Corresponding eindex plus 1. Might be larger than the number of + // elements in the router, because of fake directories added for + // compound "elements". + uint16_t elementno_plus1; + + // '_x[i].xindex' equals the index in _x of the entry for element + // number 'i - 1'. + uint16_t xindex; + + // Number of child entries. 'name' is guaranteed to be a prefix of + // every child entry. + uint16_t skip; + + // See enum below. X_FAKE is true on fake directories added for + // compound elements. + uint16_t flags; + }; + + private: + enum { X_FAKE = 1 }; + + Entry* _x; + int _nentries; + int _cap; + Router* _router; + uint32_t _generation; + + inline int xindex(int elementno) const; + inline int next_xindex(int elementno) const; + inline int elementno(int xindex) const; + + int name_search(const String &n, int first_xi, int last_xi, int name_offset) const; + int element_name_search(const String &n, int elementno) const; + + int grow(int min_size); + int true_prepare(Router*, uint32_t); +}; + + +inline int +ClickIno::prepare(Router* router, uint32_t generation) +{ + if (generation != _generation) + return true_prepare(router, generation); + else + return 0; +} + +inline int +ClickIno::xindex(int elementno) const +{ + assert(elementno >= -1 && elementno < _nentries - 1); + return _x[elementno + 1].xindex; +} + +inline int +ClickIno::next_xindex(int elementno) const +{ + int xi = xindex(elementno); + return xi + _x[xi].skip + 1; +} + +inline int +ClickIno::elementno(int xindex) const +{ + return _x[xindex].elementno_plus1 - 1; +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/integers.hh b/openflow/include/click/integers.hh new file mode 100644 index 0000000..204f3e2 --- /dev/null +++ b/openflow/include/click/integers.hh @@ -0,0 +1,503 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/integers.cc" -*- +#ifndef CLICK_INTEGERS_HH +#define CLICK_INTEGERS_HH +#include +#include +#if !HAVE___BUILTIN_FFS && HAVE_FFS && HAVE_STRINGS_H +# include +#endif +CLICK_DECLS + +/** @file + * @brief Functions for manipulating integers. + */ + +#if HAVE_INT64_TYPES && !defined(htonq) +# if CLICK_BYTE_ORDER != CLICK_LITTLE_ENDIAN && CLICK_BYTE_ORDER != CLICK_BIG_ENDIAN +inline uint64_t htonq(uint64_t x) __attribute__((error("unknown byte order"))); +# endif + +/** @brief Return @a x translated from host to network byte order. */ +inline uint64_t htonq(uint64_t x) { +# if CLICK_BYTE_ORDER == CLICK_LITTLE_ENDIAN + uint32_t hi = x >> 32; + uint32_t lo = x & 0xffffffff; + return (((uint64_t)htonl(lo)) << 32) | htonl(hi); +# elif CLICK_BYTE_ORDER == CLICK_BIG_ENDIAN + return x; +# else + return 0; +# endif +} +#endif + +#if HAVE_INT64_TYPES && !defined(ntohq) +# if CLICK_BYTE_ORDER != CLICK_LITTLE_ENDIAN && CLICK_BYTE_ORDER != CLICK_BIG_ENDIAN +inline uint64_t htonq(uint64_t x) __attribute__((error("unknown byte order"))); +# endif + +/** @brief Return @a x translated from network to host byte order. */ +inline uint64_t ntohq(uint64_t x) { +# if CLICK_BYTE_ORDER == CLICK_LITTLE_ENDIAN + uint32_t hi = x >> 32; + uint32_t lo = x & 0xffffffff; + return (((uint64_t)ntohl(lo)) << 32) | ntohl(hi); +# elif CLICK_BYTE_ORDER == CLICK_BIG_ENDIAN + return x; +# else + return 0; +# endif +} +#endif + +/** @brief Translate @a x to network byte order. + * + * Compare htons/htonl/htonq. host_to_net_order is particularly useful in + * template functions, where the type to be translated to network byte order + * is unknown. */ +inline unsigned char host_to_net_order(unsigned char x) { + return x; +} +/** @overload */ +inline signed char host_to_net_order(signed char x) { + return x; +} +/** @overload */ +inline char host_to_net_order(char x) { + return x; +} +/** @overload */ +inline short host_to_net_order(short x) { + return htons(x); +} +/** @overload */ +inline unsigned short host_to_net_order(unsigned short x) { + return htons(x); +} +/** @overload */ +inline int host_to_net_order(int x) { + return htonl(x); +} +/** @overload */ +inline unsigned host_to_net_order(unsigned x) { + return htonl(x); +} +#if SIZEOF_LONG == 4 +/** @overload */ +inline long host_to_net_order(long x) { + return htonl(x); +} +/** @overload */ +inline unsigned long host_to_net_order(unsigned long x) { + return htonl(x); +} +#endif +#if HAVE_INT64_TYPES +# if SIZEOF_LONG == 8 +/** @overload */ +inline long host_to_net_order(long x) { + return htonq(x); +} +/** @overload */ +inline unsigned long host_to_net_order(unsigned long x) { + return htonq(x); +} +# endif +# if HAVE_LONG_LONG && SIZEOF_LONG_LONG == 8 +/** @overload */ +inline long long host_to_net_order(long long x) { + return htonq(x); +} +/** @overload */ +inline unsigned long long host_to_net_order(unsigned long long x) { + return htonq(x); +} +# endif +# if !HAVE_INT64_IS_LONG && !HAVE_INT64_IS_LONG_LONG +/** @overload */ +inline int64_t host_to_net_order(int64_t x) { + return htonq(x); +} +/** @overload */ +inline uint64_t host_to_net_order(uint64_t x) { + return htonq(x); +} +# endif +#endif + +/** @brief Translate @a x to host byte order. + * + * Compare ntohs/ntohl/ntohq. net_to_host_order is particularly useful in + * template functions, where the type to be translated to network byte order + * is unknown. */ +inline unsigned char net_to_host_order(unsigned char x) { + return x; +} +/** @overload */ +inline signed char net_to_host_order(signed char x) { + return x; +} +/** @overload */ +inline char net_to_host_order(char x) { + return x; +} +/** @overload */ +inline short net_to_host_order(short x) { + return ntohs(x); +} +/** @overload */ +inline unsigned short net_to_host_order(unsigned short x) { + return ntohs(x); +} +/** @overload */ +inline int net_to_host_order(int x) { + return ntohl(x); +} +/** @overload */ +inline unsigned net_to_host_order(unsigned x) { + return ntohl(x); +} +#if SIZEOF_LONG == 4 +/** @overload */ +inline long net_to_host_order(long x) { + return ntohl(x); +} +/** @overload */ +inline unsigned long net_to_host_order(unsigned long x) { + return ntohl(x); +} +#endif +#if HAVE_INT64_TYPES +# if SIZEOF_LONG == 8 +/** @overload */ +inline long net_to_host_order(long x) { + return ntohq(x); +} +/** @overload */ +inline unsigned long net_to_host_order(unsigned long x) { + return ntohq(x); +} +# endif +# if HAVE_LONG_LONG && SIZEOF_LONG_LONG == 8 +/** @overload */ +inline long long net_to_host_order(long long x) { + return ntohq(x); +} +/** @overload */ +inline unsigned long long net_to_host_order(unsigned long long x) { + return ntohq(x); +} +# endif +# if !HAVE_INT64_IS_LONG && !HAVE_INT64_IS_LONG_LONG +/** @overload */ +inline int64_t net_to_host_order(int64_t x) { + return ntohq(x); +} +/** @overload */ +inline uint64_t net_to_host_order(uint64_t x) { + return ntohq(x); +} +# endif +#endif + + +// MSB is bit #1 +#if HAVE___BUILTIN_CLZ && !HAVE_NO_INTEGER_BUILTINS +/** @brief Return the index of the most significant bit set in @a x. + * @return 0 if @a x = 0; otherwise the index of first bit set, where the + * most significant bit is numbered 1. + */ +inline int ffs_msb(unsigned x) { + return (x ? __builtin_clz(x) + 1 : 0); +} +#else +# define NEED_FFS_MSB_UNSIGNED 1 +/** @overload */ +int ffs_msb(unsigned x); +#endif + +#if HAVE___BUILTIN_CLZL && !HAVE_NO_INTEGER_BUILTINS +/** @overload */ +inline int ffs_msb(unsigned long x) { + return (x ? __builtin_clzl(x) + 1 : 0); +} +#elif SIZEOF_INT == SIZEOF_LONG +/** @overload */ +inline int ffs_msb(unsigned long x) { + return ffs_msb(static_cast(x)); +} +#else +# define NEED_FFS_MSB_UNSIGNED_LONG 1 +/** @overload */ +int ffs_msb(unsigned long x); +#endif + +#if HAVE_LONG_LONG && HAVE___BUILTIN_CLZLL && !HAVE_NO_INTEGER_BUILTINS +/** @overload */ +inline int ffs_msb(unsigned long long x) { + return (x ? __builtin_clzll(x) + 1 : 0); +} +#elif HAVE_LONG_LONG && SIZEOF_LONG == SIZEOF_LONG_LONG +/** @overload */ +inline int ffs_msb(unsigned long long x) { + return ffs_msb(static_cast(x)); +} +#elif HAVE_LONG_LONG +# define NEED_FFS_MSB_UNSIGNED_LONG_LONG 1 +/** @overload */ +int ffs_msb(unsigned long long x); +#endif + +#if HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG && !HAVE_INT64_IS_LONG_LONG +# if SIZEOF_LONG >= 8 +/** @overload */ +inline int ffs_msb(uint64_t x) { + return ffs_msb(static_cast(x)); +} +# elif HAVE_LONG_LONG && SIZEOF_LONG_LONG >= 8 +/** @overload */ +inline int ffs_msb(uint64_t x) { + return ffs_msb(static_cast(x)); +} +# else +# define NEED_FFS_MSB_UINT64_T 1 +/** @overload */ +int ffs_msb(uint64_t x); +# endif +#endif + + +// LSB is bit #1 +#if HAVE___BUILTIN_FFS && !HAVE_NO_INTEGER_BUILTINS +/** @brief Return the index of the least significant bit set in @a x. + * @return 0 if @a x = 0; otherwise the index of first bit set, where the + * least significant bit is numbered 1. + */ +inline int ffs_lsb(unsigned x) { + return __builtin_ffs(x); +} +#elif HAVE_FFS && !HAVE_NO_INTEGER_BUILTINS +/** overload */ +inline int ffs_lsb(unsigned x) { + return ffs(x); +} +#else +# define NEED_FFS_LSB_UNSIGNED 1 +/** @overload */ +int ffs_lsb(unsigned x); +#endif + +#if HAVE___BUILTIN_FFSL && !HAVE_NO_INTEGER_BUILTINS +/** @overload */ +inline int ffs_lsb(unsigned long x) { + return __builtin_ffsl(x); +} +#elif SIZEOF_INT == SIZEOF_LONG +/** @overload */ +inline int ffs_lsb(unsigned long x) { + return ffs_lsb(static_cast(x)); +} +#else +# define NEED_FFS_LSB_UNSIGNED_LONG 1 +/** @overload */ +int ffs_lsb(unsigned long x); +#endif + +#if HAVE_LONG_LONG && HAVE___BUILTIN_FFSLL && !HAVE_NO_INTEGER_BUILTINS +/** @overload */ +inline int ffs_lsb(unsigned long long x) { + return __builtin_ffsll(x); +} +#elif HAVE_LONG_LONG && SIZEOF_LONG == SIZEOF_LONG_LONG +/** @overload */ +inline int ffs_lsb(unsigned long long x) { + return ffs_lsb(static_cast(x)); +} +#elif HAVE_LONG_LONG +# define NEED_FFS_LSB_UNSIGNED_LONG_LONG 1 +/** @overload */ +int ffs_lsb(unsigned long long x); +#endif + +#if HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG && !HAVE_INT64_IS_LONG_LONG +# if SIZEOF_LONG >= 8 +/** @overload */ +inline int ffs_lsb(uint64_t x) { + return ffs_lsb(static_cast(x)); +} +# elif HAVE_LONG_LONG && SIZEOF_LONG_LONG >= 8 +/** @overload */ +inline int ffs_lsb(uint64_t x) { + return ffs_lsb(static_cast(x)); +} +# else +# define NEED_FFS_LSB_UINT64_T 1 +/** @overload */ +int ffs_lsb(uint64_t x); +# endif +#endif + + +/** @brief Return the integer approximation of @a x's square root. + * @return The integer @a y where @a y*@a y <= @a x, but + * (@a y+1)*(@a y+1) > @a x. + */ +uint32_t int_sqrt(uint32_t x); + +#if HAVE_INT64_TYPES && HAVE_INT64_DIVIDE +/** @overload */ +uint64_t int_sqrt(uint64_t x); +#endif + + +/** @brief Return @a a / @a b. */ +inline uint32_t int_divide(uint32_t a, uint32_t b) { + return a / b; +} + +/** @overload */ +inline int32_t int_divide(int32_t a, uint32_t b) { + return a / b; +} + +#if HAVE_INT64_TYPES +/** @overload */ +inline uint64_t int_divide(uint64_t a, uint32_t b) { +# if CLICK_LINUXMODULE && BITS_PER_LONG < 64 + do_div(a, b); + return a; +# else + return a / b; +# endif +} + +/** @overload */ +inline int64_t int_divide(int64_t a, uint32_t b) { +# if CLICK_LINUXMODULE && BITS_PER_LONG < 64 + if (unlikely(a < 0)) { + uint64_t a_abs = -(a + 1); + do_div(a_abs, b); + return (int64_t) -a_abs - 1; + } else { + uint64_t &a_unsigned = reinterpret_cast(a); + do_div(a_unsigned, b); + return a_unsigned; + } +# else + return a / b; +# endif +} + + +/** @brief Multiply @a a * @a b, placing the low-order bits of the result in @a xlow + and the high-order bits in @a xhigh. */ +template +void int_multiply(T a, T b, T &xlow, T &xhigh) +{ + typedef fast_half_integer fasthalf; + typedef typename fasthalf::half_type half_type; + + half_type al = fasthalf::low(a), ah = fasthalf::high(a), + bl = fasthalf::low(b), bh = fasthalf::high(b); + + T r0 = T(al) * bl; + T r3 = T(ah) * bh; + T r1 = T(ah) * bl; + T r2 = T(al) * bh + fasthalf::high(r0) + r1; + if (r2 < r1) + r3 += fasthalf::half_value; + + xhigh = r3 + fasthalf::high(r2); + xlow = (r2 << fasthalf::half_bits) + fasthalf::low(r0); +} + +template +struct has_fast_int_multiply : public false_type { + enum { check_t_integral = integer_traits::is_signed }; +}; + +#if defined(__i386__) || defined(__x86_64__) +inline void int_multiply(unsigned a, unsigned b, unsigned &xlow, unsigned &xhigh) +{ + __asm__("mul %2" : "=a" (xlow), "=d" (xhigh) : "r" (a), "a" (b) : "cc"); +} +template<> struct has_fast_int_multiply : public true_type {}; + +# if SIZEOF_LONG == 4 || (defined(__x86_64__) && SIZEOF_LONG == 8) +inline void int_multiply(unsigned long a, unsigned long b, unsigned long &xlow, unsigned long &xhigh) +{ + __asm__("mul %2" : "=a" (xlow), "=d" (xhigh) : "r" (a), "a" (b) : "cc"); +} +template<> struct has_fast_int_multiply : public true_type {}; +# endif + +# if defined(__x86_64__) && SIZEOF_LONG_LONG == 8 +inline void int_multiply(unsigned long long a, unsigned long long b, unsigned long long &xlow, unsigned long long &xhigh) +{ + __asm__("mul %2" : "=a" (xlow), "=d" (xhigh) : "r" (a), "a" (b) : "cc"); +} +template<> struct has_fast_int_multiply : public true_type {}; +# endif +#endif + + +/** @brief Divide @a a / @a b, placing quotient in @a quot and returning remainder. */ +inline uint32_t int_remainder(uint32_t a, uint32_t b, uint32_t ") { + quot = a / b; + return a - quot * b; +} + +/** @overload */ +inline int32_t int_remainder(int32_t a, uint32_t b, int32_t ") { + if (unlikely(a < 0)) + quot = -(-(a + 1) / b) - 1; + else + quot = a / b; + return a - quot * b; +} + +/** @overload */ +inline uint32_t int_remainder(uint64_t a, uint32_t b, uint64_t ") { +# if CLICK_LINUXMODULE && BITS_PER_LONG < 64 + uint32_t rem = do_div(a, b); + quot = a; + return rem; +# else + quot = a / b; + return a - quot * b; +# endif +} + +/** @overload */ +inline uint32_t int_remainder(int64_t a, uint32_t b, int64_t ") { +# if CLICK_LINUXMODULE && BITS_PER_LONG < 64 + if (unlikely(a < 0)) { + uint64_t a_abs = -(a + 1); + uint32_t rem = do_div(a_abs, b); + quot = (int64_t) -a_abs - 1; + return rem ? b - rem : 0; + } else { + uint64_t &a_unsigned = reinterpret_cast(a); + uint32_t rem = do_div(a_unsigned, b); + quot = a_unsigned; + return rem; + } +# else + // This arithmetic is about twice as fast on my laptop as the + // alternative "div = a / b; + // rem = a - (value_type) div * b; + // if (rem < 0) div--, rem += b;", + // and 3-4x faster than "div = a / b; + // rem = a % b; + // if (rem < 0) div--, rem += b;". + if (unlikely(a < 0)) + quot = -(-(a + 1) / b) - 1; + else + quot = a / b; + return a - quot * b; +# endif +} +#endif + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/ip6address.hh b/openflow/include/click/ip6address.hh new file mode 100644 index 0000000..b494c25 --- /dev/null +++ b/openflow/include/click/ip6address.hh @@ -0,0 +1,408 @@ +// -*- related-file-name: "../../lib/ip6address.cc" -*- +#ifndef CLICK_IP6ADDRESS_HH +#define CLICK_IP6ADDRESS_HH +#include +#include +#include +#include +#if !CLICK_TOOL +# include +# include +#endif +CLICK_DECLS + +class IP6Address { public: + + typedef uninitialized_type uninitialized_t; + + /** @brief Construct a zero-valued IP6Address (equal to ::). */ + inline IP6Address() { + memset(&_addr, 0, sizeof(_addr)); + } + + /** @brief Construct an IP6Address from a sixteen-byte buffer. */ + explicit inline IP6Address(const unsigned char *x) { + memcpy(&_addr, x, sizeof(_addr)); + } + + /** @brief Construct an IPv4-Mappped IP6Address (RFC 4291-2.5.5.2) + * + * The address has format ::FFFF:@a x. */ + explicit inline IP6Address(IPAddress x) { + *this = x; + } + + /** @brief Construct an IP6Address from a human-readable string. */ + explicit IP6Address(const String &x); // "fec0:0:0:1::1" + + /** @brief Construct an IP6Address from a C structure. */ + explicit inline IP6Address(const struct in6_addr &x) + : _addr(x) { + } + + /** @brief Construct an IPv4-Mapped IP6Address from a C structure. */ + explicit inline IP6Address(const struct in_addr &x) { + *this = x; + } + + /** @brief Construct an uninitialized IP6Address. */ + inline IP6Address(const uninitialized_type &unused) { + (void) unused; + } + + /** @brief Return an IP6Address equal to the prefix mask of length @a + * prefix_len. + * @param prefix_len prefix length; 0 <= @a prefix_len <= 128 + * + * For example, make_prefix(0) is ::, make_prefix(12) is fff0::, and + * make_prefix(128) is ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff. Causes an + * assertion failure if @a prefix_len is out of range. + * + * @sa mask_to_prefix_len, make_inverted_prefix */ + static IP6Address make_prefix(int prefix_len); + + /** @brief Return an IP6Address equal to the inversion of make_prefix(@a + * prefix_len). + * @param prefix_len prefix length; 0 <= @a prefix_len <= 128 + * @return ~make_prefix(@a prefix_len) + * @sa make_prefix */ + static IP6Address make_inverted_prefix(int prefix_len); + + typedef uint32_t (IP6Address::*unspecified_bool_type)() const; + inline operator unspecified_bool_type() const; + + operator const struct in6_addr &() const { return _addr; } + operator struct in6_addr &() { return _addr; } + const struct in6_addr &in6_addr() const { return _addr; } + struct in6_addr &in6_addr() { return _addr; } + + unsigned char *data() { return &_addr.s6_addr[0]; } + const unsigned char *data() const { return &_addr.s6_addr[0]; } + uint16_t *data16() { return (uint16_t *)&_addr.s6_addr[0]; } + const uint16_t *data16() const { return (uint16_t *)&_addr.s6_addr[0]; } + uint32_t *data32() { return (uint32_t *)&_addr.s6_addr[0]; } + const uint32_t *data32() const { return (uint32_t *)&_addr.s6_addr[0]; } + + inline uint32_t hashcode() const; + + int mask_to_prefix_len() const; + inline bool matches_prefix(const IP6Address &addr, const IP6Address &mask) const; + inline bool mask_as_specific(const IP6Address &) const; + + /** @brief Test if this address contains an embedded Ethernet address. + * + * An IPv6 address with embedded Ethernet address has format + * "nnnn:nnnn:nnnn:nnnn:uuvv:wwFF:FExx:yyzz", where the embedded Ethernet + * address is "uu-vv-ww-xx-yy-zz". */ + bool has_ether_address() const { + return _addr.s6_addr[11] == 0xFF && _addr.s6_addr[12] == 0xFE; + } + + /** @brief Extract embedded Ethernet address into @a x. + * @param[out] x Ethernet address + * @return true iff has_ether_address() */ + bool ether_address(EtherAddress &x) const; + + /** @brief Return true iff the address is a IPv4-compatible address. + * NOTE: This form has been deprecated in RFC 4291 (2.5.5.1) + * + * An IPv4-mapped address has format "::w:x:y:z", where the + * IPv4 address is "w.x.y.z". */ + inline bool is_ip4_compatible() const { + return data32()[0] == 0 && data32()[1] == 0 + && data32()[2] == 0; + } + + /** @brief Return true iff the address is a IPv4-mapped address. + * + * An IPv4-mapped address has format "::FFFF:w:x:y:z", where the + * embedded IPv4 address is "w.x.y.z". */ + inline bool is_ip4_mapped() const { + return data32()[0] == 0 && data32()[1] == 0 + && data32()[2] == htonl(0x0000FFFFU); + } + + /** @brief Return true iff the address is a multicast address + * s6_addr[0] = 0xff; + * + */ + inline bool is_multicast() const { + return _addr.s6_addr[0] == 0xff; + } + + /** @brief Return true iff the address is a link-local address. + * fe80::/64 + * + */ + inline bool is_link_local() const { + return data32()[0] == htonl(0xfe800000) && data32()[1] == 0; + } + + /** @brief Return IPv4-mapped address. + * + * @return non-empty IPv4 address iff is_ip4_mapped() is + * true. IPAddress() otherwise */ + IPAddress ip4_address() const; + + // bool operator==(const IP6Address &, const IP6Address &); + // bool operator!=(const IP6Address &, const IP6Address &); + + // IP6Address operator&(const IP6Address &, const IP6Address &); + // IP6Address operator|(const IP6Address &, const IP6Address &); + // IP6Address operator~(const IP6Address &); + + inline IP6Address &operator&=(const IP6Address &); + inline IP6Address &operator&=(const struct in6_addr &); + inline IP6Address &operator|=(const IP6Address &); + inline IP6Address &operator|=(const struct in6_addr &); + + inline IP6Address &operator=(const struct in6_addr &); + inline IP6Address &operator=(const struct in_addr &); + + void unparse(StringAccum &sa) const; + String unparse() const; + String unparse_expanded() const; + + String s() const { return unparse(); } + inline operator String() const CLICK_DEPRECATED; + + typedef const IP6Address ¶meter_type; + + private: + + struct in6_addr _addr; + +}; + +inline +IP6Address::operator unspecified_bool_type() const +{ + const uint32_t *ai = data32(); + return ai[0] || ai[1] || ai[2] || ai[3] ? &IP6Address::hashcode : 0; +} + +inline +IP6Address::operator String() const +{ + return unparse(); +} + +inline bool +operator==(const IP6Address &a, const IP6Address &b) +{ + const uint32_t *ai = a.data32(), *bi = b.data32(); + return ai[0] == bi[0] && ai[1] == bi[1] && ai[2] == bi[2] && ai[3] == bi[3]; +} + +inline bool +operator!=(const IP6Address &a, const IP6Address &b) +{ + const uint32_t *ai = a.data32(), *bi = b.data32(); + return ai[0] != bi[0] || ai[1] != bi[1] || ai[2] != bi[2] || ai[3] != bi[3]; +} + +inline StringAccum & +operator<<(StringAccum &sa, const IP6Address &a) { + a.unparse(sa); + return sa; +} + +inline bool +IP6Address::matches_prefix(const IP6Address &addr, const IP6Address &mask) const +{ + const uint32_t *xi = data32(), *ai = addr.data32(), *mi = mask.data32(); + return ((xi[0] ^ ai[0]) & mi[0]) == 0 + && ((xi[1] ^ ai[1]) & mi[1]) == 0 + && ((xi[2] ^ ai[2]) & mi[2]) == 0 + && ((xi[3] ^ ai[3]) & mi[3]) == 0; +} + +inline bool +IP6Address::mask_as_specific(const IP6Address &mask) const +{ + const uint32_t *xi = data32(), *mi = mask.data32(); + return ((xi[0] & mi[0]) == mi[0] && (xi[1] & mi[1]) == mi[1] + && (xi[2] & mi[2]) == mi[2] && (xi[3] & mi[3]) == mi[3]); +} + +inline IP6Address & +IP6Address::operator&=(const IP6Address &x) +{ + uint32_t *ai = data32(); + const uint32_t *bi = x.data32(); + ai[0] &= bi[0]; + ai[1] &= bi[1]; + ai[2] &= bi[2]; + ai[3] &= bi[3]; + return *this; +} + +inline IP6Address & +IP6Address::operator&=(const struct in6_addr &x) +{ + uint32_t *ai = data32(); + const uint32_t *bi = (uint32_t *)&x.s6_addr[0]; + ai[0] &= bi[0]; + ai[1] &= bi[1]; + ai[2] &= bi[2]; + ai[3] &= bi[3]; + return *this; +} + +inline IP6Address & +IP6Address::operator|=(const IP6Address &x) +{ + uint32_t *ai = data32(); + const uint32_t *bi = x.data32(); + ai[0] |= bi[0]; + ai[1] |= bi[1]; + ai[2] |= bi[2]; + ai[3] |= bi[3]; + return *this; +} + +inline IP6Address & +IP6Address::operator|=(const struct in6_addr &x) +{ + uint32_t *ai = data32(); + const uint32_t *bi = (uint32_t *)&x.s6_addr; + ai[0] |= bi[0]; + ai[1] |= bi[1]; + ai[2] |= bi[2]; + ai[3] |= bi[3]; + return *this; +} + +inline IP6Address +operator&(const IP6Address &a, const IP6Address &b) +{ + const uint32_t *ai = a.data32(), *bi = b.data32(); + IP6Address result = IP6Address::uninitialized_t(); + uint32_t *ri = result.data32(); + ri[0] = ai[0] & bi[0]; + ri[1] = ai[1] & bi[1]; + ri[2] = ai[2] & bi[2]; + ri[3] = ai[3] & bi[3]; + return result; +} + +inline IP6Address +operator&(const struct in6_addr &a, const IP6Address &b) +{ + const uint32_t *ai = (const uint32_t *)&a.s6_addr[0], *bi = b.data32(); + IP6Address result = IP6Address::uninitialized_t(); + uint32_t *ri = result.data32(); + ri[0] = ai[0] & bi[0]; + ri[1] = ai[1] & bi[1]; + ri[2] = ai[2] & bi[2]; + ri[3] = ai[3] & bi[3]; + return result; +} + +inline IP6Address +operator|(const IP6Address &a, const IP6Address &b) +{ + const uint32_t *ai = a.data32(), *bi = b.data32(); + IP6Address result = IP6Address::uninitialized_t(); + uint32_t *ri = result.data32(); + ri[0] = ai[0] | bi[0]; + ri[1] = ai[1] | bi[1]; + ri[2] = ai[2] | bi[2]; + ri[3] = ai[3] | bi[3]; + return result; +} + +inline IP6Address +operator~(const IP6Address &x) +{ + const uint32_t *ai = x.data32(); + IP6Address result = IP6Address::uninitialized_t(); + uint32_t *ri = result.data32(); + ri[0] = ~ai[0]; + ri[1] = ~ai[1]; + ri[2] = ~ai[2]; + ri[3] = ~ai[3]; + return result; +} + +inline IP6Address & +IP6Address::operator=(const struct in6_addr &a) +{ + _addr = a; + return *this; +} + +inline IP6Address & +IP6Address::operator=(const struct in_addr &a) +{ + memset(&_addr, 0, 10); + data16()[5] = 0xffff; + data32()[3] = a.s_addr; + return *this; +} + +inline uint32_t +IP6Address::hashcode() const +{ + return (data32()[2] << 1) + data32()[3]; +} + +#if !CLICK_TOOL +inline const IP6Address & +DST_IP6_ANNO(Packet *p) +{ + return *reinterpret_cast(p->anno_u8() + DST_IP6_ANNO_OFFSET); +} + +inline void +SET_DST_IP6_ANNO(Packet *p, const IP6Address &a) +{ + memcpy(p->anno_u8() + DST_IP6_ANNO_OFFSET, a.data(), DST_IP6_ANNO_SIZE); +} + +inline void +SET_DST_IP6_ANNO(Packet *p, const struct in6_addr &a) +{ + memcpy(p->anno_u8() + DST_IP6_ANNO_OFFSET, &a, DST_IP6_ANNO_SIZE); +} +#endif + + +/** @class IP6AddressArg + @brief Parser class for IPv6 addresses. */ +struct IP6AddressArg { + static const char *basic_parse(const String &str, IP6Address &result, + const ArgContext &args = blank_args); + static bool parse(const String &str, IP6Address &result, + const ArgContext &args = blank_args); + static bool parse(const String &str, struct in6_addr &result, + const ArgContext &args = blank_args) { + return parse(str, reinterpret_cast(result), args); + } + +}; + +/** @class IP6PrefixArg + @brief Parser class for IPv6 address prefixes. */ +class IP6PrefixArg { public: + IP6PrefixArg(bool allow_bare_address_ = false) + : allow_bare_address(allow_bare_address_) { + } + bool parse(const String &str, IP6Address &addr, int &prefix_len, + const ArgContext &args = blank_args) const; + bool parse(const String &str, IP6Address &addr, IP6Address &prefix, + const ArgContext &args = blank_args) const; + bool parse(const String &str, struct in6_addr &addr, struct in6_addr &prefix, + const ArgContext &args = blank_args) const { + return parse(str, reinterpret_cast(addr), + reinterpret_cast(prefix), args); + } + bool allow_bare_address; +}; + +template<> struct DefaultArg : public IP6AddressArg {}; +template<> struct DefaultArg : public IP6AddressArg {}; +template<> struct has_trivial_copy : public true_type {}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/ip6flowid.hh b/openflow/include/click/ip6flowid.hh new file mode 100644 index 0000000..841606a --- /dev/null +++ b/openflow/include/click/ip6flowid.hh @@ -0,0 +1,250 @@ +// -*- c-basic-offset: 2; related-file-name: "../../lib/ip6flowid.cc" -*- +#ifndef CLICK_IP6FLOWID_HH +#define CLICK_IP6FLOWID_HH +#include +#include +#include +CLICK_DECLS +class Packet; + +class IP6FlowID { public: + + typedef uninitialized_type uninitialized_t; + + /** @brief Construct an empty flow ID. + * + * The empty flow ID has zero-valued addresses and ports. */ + inline IP6FlowID(); + + /** @brief Construct a flow ID with the given parts. + * @param saddr source address + * @param sport source port, in network order + * @param daddr destination address + * @param dport destination port, in network order */ + inline IP6FlowID(const IP6Address &, uint16_t, const IP6Address &, uint16_t); + + /** @brief Construct an IPv4-Mapped flow ID with the given parts. + * @param saddr source address + * @param sport source port, in network order + * @param daddr destination address + * @param dport destination port, in network order + * + * The IPv4 addresses are converted to IPv4-mapped IPv6 addresses + * in the flow. */ + inline IP6FlowID(const IPAddress &, uint16_t, const IPAddress &, uint16_t); + + /** @brief Construct a flow ID from @a p's ip/ip6_header() and udp_header(). + * @param p input packet + * @param reverse if true, use the reverse of @a p's flow ID + * + * @pre @a p's ip/ip6_header() must point to an IPv4 or IPv6 + * header respectively, and @a p's transport header should have + * source and destination ports in the UDP-like positions; TCP, + * UDP, and DCCP fit the bill. If the packet is IPv4 the IPv4 + * addresses are converted to IPv4-mapped IPv6 addresses in the flow.*/ + explicit IP6FlowID(const Packet *, bool reverse = false); + + /** @brief Construct a flow ID from @a ip6h and the following TCP/UDP header. + * @param iph IP header + * @param reverse if true, use the reverse of @a p's flow ID + * + * This assumes a single IPv6 header with no extension headers.The + * transport header should have source and destination ports in + * the UDP-like positions; TCP, UDP, and DCCP fit the bill. */ + explicit IP6FlowID(const click_ip6 *ip6h, bool reverse = false); + + /** @brief Construct an IPv4-Mapped flow ID from @a iph and the + * following TCP/UDP header. + * @param iph IP header + * @param reverse if true, use the reverse of @a p's flow ID + * + * The IPv4 header's header length, @a iph->ip_hl, is used to find + * the following transport header. This transport header should + * have source and destination ports in the UDP-like positions; + * TCP, UDP, and DCCP fit the bill. The IPv4 addresses are + * converted ip IPv4-mapped IPv6 addresses in the flow.*/ + explicit IP6FlowID(const click_ip *iph, bool reverse = false); + + /** @brief Construct an IPv4-Mapped flow ID from the given IPv4 @a flow. + * @param flow and IPv4 IPFlowID + * + * The parameters IPv4 addresses in the IPFlowID converted to + * IPv4-mapped IPv6 addresses. */ + explicit IP6FlowID(const IPFlowID &); + + + /** @brief Construct an uninitialized flow ID. */ + inline IP6FlowID(const uninitialized_type &unused) { + (void) unused; + } + + typedef const IP6Address &(IP6FlowID::*unspecified_bool_type)() const; + inline operator unspecified_bool_type() const; + + const IP6Address &saddr() const { return _saddr; } + const IP6Address &daddr() const { return _daddr; } + IPAddress saddr4() const { return _saddr.ip4_address(); } + IPAddress daddr4() const { return _daddr.ip4_address(); } + uint16_t sport() const { return _sport; } + uint16_t dport() const { return _dport; } + + void set_saddr(const IP6Address &a) { _saddr = a; } + void set_daddr(const IP6Address &a) { _daddr = a; } + void set_saddr(const IPAddress a) { _saddr = a; } + void set_daddr(const IPAddress a) { _daddr = a; } + void set_sport(uint16_t p) { _sport = p; } + void set_dport(uint16_t p) { _dport = p; } + + /** @brief Set this flow to the given value. + * @param saddr source address + * @param sport source port, in network order + * @param daddr destination address + * @param dport destination port, in network order */ + void assign(const IP6Address &saddr, uint16_t sport, const IP6Address &daddr, uint16_t dport) { + _saddr = saddr; + _daddr = daddr; + _sport = sport; + _dport = dport; + } + + /** @brief Set this flow to the given values using IPv4-mapped addresses. + * @param saddr source address + * @param sport source port, in network order + * @param daddr destination address + * @param dport destination port, in network order */ + void assign(IPAddress saddr, uint16_t sport, IPAddress daddr, uint16_t dport) { + _saddr = saddr; + _daddr = daddr; + _sport = sport; + _dport = dport; + } + + inline IP6FlowID reverse() const; + inline IP6FlowID rev() const CLICK_DEPRECATED; + + /** @brief Indicate if this flow is IPv4. + * @return true iff the flow is IPv4 */ + inline bool is_ip4_mapped() const { return _saddr.is_ip4_mapped(); } + + /** @brief Return IPv4 version of a IPv4-mapped IP6FlowID. + * + * @return non-empty IPFlowID address iff this flow is using + * IPv4-mapped addresses. IPFlowID() otherwise */ + IPFlowID flow_id4() const; + + /** @brief Return this IP6FlowID + * + * @return this IP6FlowID */ + IP6FlowID flow_id6() const; + + inline IP6FlowID &operator=(const IPFlowID &); + + inline hashcode_t hashcode() const; + + String unparse() const; + operator String() const { return unparse(); } + String s() const { return unparse(); } + + protected: + + // note: several functions depend on this field order! + IP6Address _saddr; + IP6Address _daddr; + uint16_t _sport; // network byte order + uint16_t _dport; // network byte order + +}; + +inline +IP6FlowID::IP6FlowID() + : _saddr(), _daddr(), _sport(0), _dport(0) +{ +} + +inline +IP6FlowID::IP6FlowID(const IP6Address &saddr, uint16_t sport, + const IP6Address &daddr, uint16_t dport) + : _saddr(saddr), _daddr(daddr), _sport(sport), _dport(dport) +{ +} + +inline +IP6FlowID::IP6FlowID(const IPAddress &saddr, uint16_t sport, + const IPAddress &daddr, uint16_t dport) + : _saddr(saddr), _daddr(daddr), _sport(sport), _dport(dport) +{ +} + +inline +IP6FlowID::IP6FlowID(const IPFlowID &flow) +{ + *this = flow; +} + +inline +IP6FlowID::operator unspecified_bool_type() const +{ + return _saddr || _daddr ? &IP6FlowID::saddr : 0; +} + +inline IP6FlowID +IP6FlowID::reverse() const +{ + return IP6FlowID(_daddr, _dport, _saddr, _sport); +} + +inline IP6FlowID +IP6FlowID::rev() const +{ + return reverse(); +} + +inline IP6FlowID & +IP6FlowID::operator=(const IPFlowID &f) +{ + assign(f.saddr(), f.sport(), f.daddr(), f.dport()); + return *this; +} + +#define ROT(v, r) ((v)<<(r) | ((unsigned)(v))>>(32-(r))) + +#if 0 +inline hashcode_t +IP6FlowID::hashcode() const +{ + return (ROT(_saddr.hashcode(), 13) + ^ ROT(_daddr.hashcode(), 23) ^ (_sport | (_dport<<16))); +} +#endif + +inline hashcode_t IP6FlowID::hashcode() const +{ + // more complicated hashcode, but causes less collision + uint16_t s = ntohs(sport()); + uint16_t d = ntohs(dport()); + hashcode_t sx = CLICK_NAME(hashcode)(saddr()); + hashcode_t dx = CLICK_NAME(hashcode)(daddr()); + return (ROT(sx, s%16) + ^ ROT(dx, 31-d%16)) + ^ ((d << 16) | s); +} + +#undef ROT + +StringAccum &operator<<(StringAccum &sa, const IP6FlowID &flow_id); + +inline bool +operator==(const IP6FlowID &a, const IP6FlowID &b) +{ + return a.dport() == b.dport() && a.sport() == b.sport() + && a.daddr() == b.daddr() && a.saddr() == b.saddr(); +} + +inline bool +operator!=(const IP6FlowID &a, const IP6FlowID &b) +{ + return !(a == b); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/ip6table.hh b/openflow/include/click/ip6table.hh new file mode 100644 index 0000000..e69fe6f --- /dev/null +++ b/openflow/include/click/ip6table.hh @@ -0,0 +1,39 @@ +// -*- c-basic-offset: 2; related-file-name: "../../lib/ip6table.cc" -*- +#ifndef CLICK_IP6TABLE_HH +#define CLICK_IP6TABLE_HH +#include +#include +#include +CLICK_DECLS + +// IP6 routing table. +// Lookup by longest prefix. +// Each entry contains a gateway and an output index. + +class IP6Table { public: + + IP6Table(); + ~IP6Table(); + + bool lookup(const IP6Address &dst, IP6Address &gw, int &index) const; + + void add(const IP6Address &dst, const IP6Address &mask, const IP6Address &gw, int index); + void del(const IP6Address &dst, const IP6Address &mask); + void clear() { _v.clear(); } + String dump(); + + private: + + struct Entry { + IP6Address _dst; + IP6Address _mask; + IP6Address _gw; + int _index; + int _valid; + }; + Vector _v; + +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/ipaddress.hh b/openflow/include/click/ipaddress.hh new file mode 100644 index 0000000..589b9c2 --- /dev/null +++ b/openflow/include/click/ipaddress.hh @@ -0,0 +1,419 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/ipaddress.cc" -*- +#ifndef CLICK_IPADDRESS_HH +#define CLICK_IPADDRESS_HH +#include +#include +#include +#include +CLICK_DECLS +class StringAccum; +class ArgContext; +extern const ArgContext blank_args; +class IPAddressArg; +template class Vector; + +class IPAddress { public: + + typedef uninitialized_type uninitialized_t; + + /** @brief Construct an IPAddress equal to 0.0.0.0. */ + inline IPAddress() + : _addr(0) { + } + + /** @brief Construct an IPAddress from an integer in network byte order. */ + inline IPAddress(unsigned x) + : _addr(x) { + } + /** @overload */ + explicit inline IPAddress(int x) + : _addr(x) { + } + /** @overload */ + explicit inline IPAddress(unsigned long x) + : _addr(x) { + } + /** @overload */ + explicit inline IPAddress(long x) + : _addr(x) { + } + + /** @brief Construct an IPAddress from a struct in_addr. */ + inline IPAddress(struct in_addr x) + : _addr(x.s_addr) { + } + + /** @brief Construct an IPAddress from data. + * @param data the address data, in network byte order + * + * Bytes data[0]...data[3] are used to construct the address. */ + explicit IPAddress(const unsigned char *data) { +#if HAVE_INDIFFERENT_ALIGNMENT + _addr = *(reinterpret_cast(data)); +#else + memcpy(&_addr, data, 4); +#endif + } + + /** @brief Constructs an IPAddress from a human-readable dotted-quad + * representation. + * + * If @a x is not a valid dotted-quad address, then the IPAddress is + * initialized to 0.0.0.0. */ + explicit IPAddress(const String &x); + + /** @brief Construct an uninitialized IPAddress. */ + inline IPAddress(const uninitialized_type &unused) { + (void) unused; + } + + /** @brief Return an IPAddress equal to the prefix mask of length @a + * prefix. + * @param prefix_len prefix length; 0 <= @a prefix_len <= 32 + * + * For example, make_prefix(0) is 0.0.0.0, make_prefix(8) is 255.0.0.0, and + * make_prefix(32) is 255.255.255.255. Causes an assertion failure if @a + * prefix_len is out of range. + * @sa mask_to_prefix_len */ + static IPAddress make_prefix(int prefix_len); + + /** @brief Return the broadcast IP address, 255.255.255.255. */ + static inline IPAddress make_broadcast() { + return IPAddress(0xFFFFFFFF); + } + + /** @brief Test if the address is 0.0.0.0. */ + inline bool empty() const { + return !_addr; + } + + /** @brief Return the address as a uint32_t in network byte order. */ + inline uint32_t addr() const { + return _addr; + } + + /** @brief Return the address as a uint32_t in network byte order. + * + * Also suitable for use as an operator bool, returning true iff + * the address is not 0.0.0.0. */ + inline operator uint32_t() const { + return _addr; + } + + /** @brief Return true iff the address is a multicast address. + * + * These are the class D addresses, 224.0.0.0-239.255.255.255. */ + inline bool is_multicast() const { + return (_addr & htonl(0xF0000000U)) == htonl(0xE0000000U); + } + + inline bool is_link_local() const { + return (_addr & htonl(0xFFFF0000)) == htonl(0xA9FE0000); + } + + inline struct in_addr in_addr() const; + inline operator struct in_addr() const; + + inline unsigned char* data(); + inline const unsigned char* data() const; + + inline uint32_t hashcode() const; + + int mask_to_prefix_len() const; + inline bool matches_prefix(IPAddress addr, IPAddress mask) const; + inline bool mask_as_specific(IPAddress mask) const; + inline bool mask_more_specific(IPAddress mask) const; + + // bool operator==(IPAddress, IPAddress); + // bool operator==(IPAddress, uint32_t); + // bool operator!=(IPAddress, IPAddress); + // bool operator!=(IPAddress, uint32_t); + + // IPAddress operator&(IPAddress, IPAddress); + // IPAddress operator|(IPAddress, IPAddress); + // IPAddress operator^(IPAddress, IPAddress); + // IPAddress operator~(IPAddress); + + inline IPAddress& operator&=(IPAddress); + inline IPAddress& operator|=(IPAddress); + inline IPAddress& operator^=(IPAddress); + + String unparse() const; + String unparse_mask() const; + String unparse_with_mask(IPAddress) const; + + inline String s() const; + inline operator String() const CLICK_DEPRECATED; + + typedef IPAddress parameter_type; + + private: + + uint32_t _addr; + +}; + + +/** @relates IPAddress + @brief Compare two IPAddress objects for equality. */ +inline bool +operator==(IPAddress a, IPAddress b) +{ + return a.addr() == b.addr(); +} + +/** @relates IPAddress + @brief Compare an IPAddress with a network-byte-order address value for + equality. + @param a an address + @param b an address value in network byte order */ +inline bool +operator==(IPAddress a, uint32_t b) +{ + return a.addr() == b; +} + +/** @relates IPAddress + @brief Compare two IPAddress objects for inequality. */ +inline bool +operator!=(IPAddress a, IPAddress b) +{ + return a.addr() != b.addr(); +} + +/** @relates IPAddress + @brief Compare an IPAddress with a network-byte-order address value for + inequality. + @param a an address + @param b an address value in network byte order */ +inline bool +operator!=(IPAddress a, uint32_t b) +{ + return a.addr() != b; +} + +/** @brief Return a pointer to the address data. + + Since the address is stored in network byte order, data()[0] is the top 8 + bits of the address, data()[1] the next 8 bits, and so forth. */ +inline const unsigned char* +IPAddress::data() const +{ + return reinterpret_cast(&_addr); +} + +/** @brief Return a pointer to the address data. + + Since the address is stored in network byte order, data()[0] is the top 8 + bits of the address, data()[1] the next 8 bits, and so forth. */ +inline unsigned char* +IPAddress::data() +{ + return reinterpret_cast(&_addr); +} + +/** @brief Return a struct in_addr corresponding to the address. */ +inline struct in_addr +IPAddress::in_addr() const +{ + struct in_addr ia; + ia.s_addr = _addr; + return ia; +} + +/** @brief Return a struct in_addr corresponding to the address. */ +inline +IPAddress::operator struct in_addr() const +{ + return in_addr(); +} + +StringAccum& operator<<(StringAccum&, IPAddress); + +/** @brief Return true iff this address matches the address prefix + @a addr/@a mask. + @param addr prefix address + @param mask prefix mask + + Equivalent to (@a addr & @a mask) == (*this & @a mask). The prefix address + @a addr may be nonzero outside the @a mask. */ +inline bool +IPAddress::matches_prefix(IPAddress addr, IPAddress mask) const +{ + return ((this->addr() ^ addr.addr()) & mask.addr()) == 0; +} + +/** @brief Return true iff this address, considered as a prefix mask, is at + least as specific as @a mask. + @param mask prefix mask + + Longer prefix masks are more specific than shorter ones. For example, + make_prefix(20).mask_as_specific(make_prefix(18)) is true, but + make_prefix(10).mask_as_specific(make_prefix(14)) is false. + + Equivalent to (*this & @a mask) == @a mask. */ +inline bool +IPAddress::mask_as_specific(IPAddress mask) const +{ + return (addr() & mask.addr()) == mask.addr(); +} + +/** @brief Return true iff this prefix mask is more specific than @a mask. + @param mask prefix mask + + Both this address and @a mask must be prefix masks -- i.e., + mask_to_prefix_len() returns 0-32. Returns true iff this address contains + a longer prefix than @a mask. For example, + make_prefix(20).mask_more_specific(make_prefix(18)) is true, but + make_prefix(20).mask_more_specific(make_prefix(20)) is false. */ +inline bool +IPAddress::mask_more_specific(IPAddress mask) const +{ + return ((addr() << 1) & mask.addr()) == mask.addr(); +} + +/** @relates IPAddress + @brief Calculate the IPAddress representing the bitwise-and of @a a and + @a b. */ +inline IPAddress +operator&(IPAddress a, IPAddress b) +{ + return IPAddress(a.addr() & b.addr()); +} + +/** @brief Assign this address to its bitwise-and with @a a. */ +inline IPAddress& +IPAddress::operator&=(IPAddress a) +{ + _addr &= a._addr; + return *this; +} + +/** @relates IPAddress + @brief Calculate the IPAddress representing the bitwise-or of @a a and + @a b. */ +inline IPAddress +operator|(IPAddress a, IPAddress b) +{ + return IPAddress(a.addr() | b.addr()); +} + +/** @brief Assign this address to its bitwise-or with @a a. */ +inline IPAddress& +IPAddress::operator|=(IPAddress a) +{ + _addr |= a._addr; + return *this; +} + +/** @relates IPAddress + @brief Calculate the IPAddress representing the bitwise-xor of @a a and + @a b. */ +inline IPAddress +operator^(IPAddress a, IPAddress b) +{ + return IPAddress(a.addr() ^ b.addr()); +} + +/** @brief Assign this address to its bitwise-xor with @a a. */ +inline IPAddress& +IPAddress::operator^=(IPAddress a) +{ + _addr ^= a._addr; + return *this; +} + +/** @relates IPAddress + @brief Calculate the IPAddress representing the bitwise complement + of @a a. */ +inline IPAddress +operator~(IPAddress a) +{ + return IPAddress(~a.addr()); +} + +/** @brief Hash function. + * @return The hash value of this IPAddress. + * + * Equal IPAddress objects always have equal hashcode() values. + */ +inline uint32_t +IPAddress::hashcode() const +{ + return addr(); +} + +/** @brief Unparse this address into a dotted-quad format String. + @deprecated The unparse() function should be preferred to this cast. + @sa unparse */ +inline +IPAddress::operator String() const +{ + return unparse(); +} + +/** @brief Unparse this address into a dotted-quad format String. + @deprecated The unparse() function should be preferred to s(). + @sa unparse */ +inline String +IPAddress::s() const +{ + return unparse(); +} + + +/** @class IPAddressArg + @brief Parser class for IPv4 addresses. */ +class IPAddressArg { public: + static const char *basic_parse(const char *begin, const char *end, + unsigned char value[4], int &nbytes); + static bool parse(const String &str, IPAddress &result, + const ArgContext &args = blank_args); + static bool parse(const String &str, struct in_addr &result, + const ArgContext &args = blank_args) { + return parse(str, reinterpret_cast(result), args); + } + static bool parse(const String &str, Vector &result, + const ArgContext &args = blank_args); +}; + +/** @class IPPrefixArg + @brief Parser class for IPv4 prefixes. */ +class IPPrefixArg { public: + IPPrefixArg(bool allow_bare_address_ = false) + : allow_bare_address(allow_bare_address_) { + } + bool parse(const String &str, + IPAddress &result_addr, IPAddress &result_mask, + const ArgContext &args = blank_args) const; + bool parse(const String &str, + struct in_addr &result_addr, struct in_addr &result_mask, + const ArgContext &args = blank_args) const { + return parse(str, reinterpret_cast(result_addr), + reinterpret_cast(result_mask), args); + } + bool allow_bare_address; +}; + +template<> struct DefaultArg : public IPAddressArg {}; +template<> struct DefaultArg : public IPAddressArg {}; +template<> struct DefaultArg > : public IPAddressArg {}; +/* template<> struct has_trivial_copy : public true_type {}; -- in type_traits.hh */ + + +/** @class IPPortArg + @brief Parser class for TCP/UDP ports. + + The constructor argument is the relevant IP protocol. */ +class IPPortArg { public: + IPPortArg(int p) + : ip_p(p) { + assert(ip_p > 0 && ip_p < 256); + } + bool parse(const String &str, uint16_t &result, + const ArgContext &args = blank_args) const; + int ip_p; +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/ipaddresslist.hh b/openflow/include/click/ipaddresslist.hh new file mode 100644 index 0000000..4f2df93 --- /dev/null +++ b/openflow/include/click/ipaddresslist.hh @@ -0,0 +1 @@ +#error "The IPAddressList class is no longer available. Use Vector instead." diff --git a/openflow/include/click/ipflowid.hh b/openflow/include/click/ipflowid.hh new file mode 100644 index 0000000..5b89cfe --- /dev/null +++ b/openflow/include/click/ipflowid.hh @@ -0,0 +1,192 @@ +// -*- related-file-name: "../../lib/ipflowid.cc" -*- +#ifndef CLICK_IPFLOWID_HH +#define CLICK_IPFLOWID_HH +#include +#include +CLICK_DECLS +class Packet; + +class IPFlowID { public: + + typedef uninitialized_type uninitialized_t; + + + /** @brief Construct an empty flow ID. + * + * The empty flow ID has zero-valued addresses and ports. */ + IPFlowID() + : _saddr(), _daddr(), _sport(0), _dport(0) { + } + + /** @brief Construct a flow ID with the given parts. + * @param saddr source address + * @param sport source port, in network order + * @param daddr destination address + * @param dport destination port, in network order */ + IPFlowID(IPAddress saddr, uint16_t sport, IPAddress daddr, uint16_t dport) + : _saddr(saddr), _daddr(daddr), _sport(sport), _dport(dport) { + } + + /** @brief Construct a flow ID from @a p's ip_header() and udp_header(). + * @param p input packet + * @param reverse if true, use the reverse of @a p's flow ID + * + * @pre @a p's ip_header() must point to a first-fragment IPv4 header, and + * @a p's transport header should have source and destination ports in the + * UDP-like positions; TCP, UDP, and DCCP fit the bill. */ + explicit IPFlowID(const Packet *p, bool reverse = false); + + /** @brief Construct a flow ID from @a iph and the following TCP/UDP header. + * @param iph IP header + * @param reverse if true, use the reverse of @a p's flow ID + * + * The IP header's header length, @a iph->ip_hl, is used to find the + * following transport header. This transport header should have source + * and destination ports in the UDP-like positions; TCP, UDP, and DCCP fit + * the bill. */ + explicit IPFlowID(const click_ip *iph, bool reverse = false); + + /** @brief Construct an uninitialized flow ID. */ + inline IPFlowID(const uninitialized_type &unused) { + (void) unused; + } + + + typedef IPAddress (IPFlowID::*unspecified_bool_type)() const; + /** @brief Return true iff the addresses of this flow ID are zero. */ + operator unspecified_bool_type() const { + return _saddr || _daddr ? &IPFlowID::saddr : 0; + } + + + /** @brief Return this flow's source address. */ + IPAddress saddr() const { + return _saddr; + } + /** @brief Return this flow's source port, in network order. */ + uint16_t sport() const { + return _sport; + } + /** @brief Return this flow's destination address. */ + IPAddress daddr() const { + return _daddr; + } + /** @brief Return this flow's destination port, in network order. */ + uint16_t dport() const { + return _dport; + } + + /** @brief Set this flow's source address to @a a. */ + void set_saddr(IPAddress a) { + _saddr = a; + } + /** @brief Set this flow's source port to @a p. + * @note @a p should be in network order. */ + void set_sport(uint16_t p) { + _sport = p; + } + /** @brief Set this flow's destination address to @a a. */ + void set_daddr(IPAddress a) { + _daddr = a; + } + /** @brief Set this flow's destination port to @a p. + * @note @a p should be in network order. */ + void set_dport(uint16_t p) { + _dport = p; + } + + /** @brief Set this flow to the given value. + * @param saddr source address + * @param sport source port, in network order + * @param daddr destination address + * @param dport destination port, in network order */ + void assign(IPAddress saddr, uint16_t sport, IPAddress daddr, uint16_t dport) { + _saddr = saddr; + _daddr = daddr; + _sport = sport; + _dport = dport; + } + + + /** @brief Return this flow's reverse, which swaps sources and destinations. + * @return IPFlowID(daddr(), dport(), saddr(), sport()) */ + IPFlowID reverse() const { + return IPFlowID(_daddr, _dport, _saddr, _sport); + } + inline IPFlowID rev() const CLICK_DEPRECATED; + + /** @brief Hash function. + * @return The hash value of this IPFlowID. + * + * Equal IPFlowID objects always have equal hashcode() values. */ + inline hashcode_t hashcode() const; + + /** @brief Unparse this address into a String. + * + * Returns a string with formatted like "(SADDR, SPORT, DADDR, DPORT)". */ + String unparse() const; + + inline operator String() const CLICK_DEPRECATED; + inline String s() const CLICK_DEPRECATED; + + protected: + + // note: several functions depend on this field order! + IPAddress _saddr; + IPAddress _daddr; + uint16_t _sport; // network byte order + uint16_t _dport; // network byte order + + int unparse(char *s) const; + friend StringAccum &operator<<(StringAccum &sa, const IPFlowID &flow_id); + +}; + + +inline IPFlowID IPFlowID::rev() const +{ + return reverse(); +} + + +#define ROT(v, r) ((v)<<(r) | ((unsigned)(v))>>(32-(r))) + +inline hashcode_t IPFlowID::hashcode() const +{ + // more complicated hashcode, but causes less collision + uint16_t s = ntohs(sport()); + uint16_t d = ntohs(dport()); + hashcode_t sx = CLICK_NAME(hashcode)(saddr()); + hashcode_t dx = CLICK_NAME(hashcode)(daddr()); + return (ROT(sx, (s % 16) + 1) ^ ROT(dx, 31 - (d % 16))) + ^ ((d << 16) | s); +} + +#undef ROT + +inline bool operator==(const IPFlowID &a, const IPFlowID &b) +{ + return a.sport() == b.sport() && a.dport() == b.dport() + && a.saddr() == b.saddr() && a.daddr() == b.daddr(); +} + +inline bool operator!=(const IPFlowID &a, const IPFlowID &b) +{ + return a.sport() != b.sport() || a.dport() != b.dport() + || a.saddr() != b.saddr() || a.daddr() != b.daddr(); +} + +StringAccum &operator<<(StringAccum &, const IPFlowID &); + +inline IPFlowID::operator String() const +{ + return unparse(); +} + +inline String IPFlowID::s() const +{ + return unparse(); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/iptable.hh b/openflow/include/click/iptable.hh new file mode 100644 index 0000000..0793a97 --- /dev/null +++ b/openflow/include/click/iptable.hh @@ -0,0 +1,38 @@ +// -*- c-basic-offset: 2; related-file-name: "../../lib/iptable.cc" -*- +#ifndef CLICK_IPTABLE_HH +#define CLICK_IPTABLE_HH +#include +#include +#include +CLICK_DECLS + +// IP routing table. +// Lookup by longest prefix. +// Each entry contains a gateway and an output index. + +class IPTable { public: + + IPTable(); + ~IPTable(); + + bool lookup(IPAddress dst, IPAddress &gw, int &index) const; + + void add(IPAddress dst, IPAddress mask, IPAddress gw, int index); + void del(IPAddress dst, IPAddress mask); + void clear() { _v.clear(); } + + private: + + struct Entry { + IPAddress dst; + IPAddress mask; + IPAddress gw; + int index; + bool valid() const { return mask || !dst; } + }; + Vector _v; + +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/lexer.hh b/openflow/include/click/lexer.hh new file mode 100644 index 0000000..bbef9af --- /dev/null +++ b/openflow/include/click/lexer.hh @@ -0,0 +1,252 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/lexer.cc" -*- +#ifndef CLICK_LEXER_HH +#define CLICK_LEXER_HH +#include +#include +#include +#include +CLICK_DECLS +class LexerExtra; + +enum Lexemes { + lexEOF = 0, + lexIdent = 256, // see also Lexer::lexeme_string + lexVariable, + lexArrow, + lex2Arrow, + lex2Colon, + lex2Bar, + lex3Dot, + lexElementclass, + lexRequire, + lexProvide, + lexDefine +}; + +class Lexeme { public: + + Lexeme() + : _kind(lexEOF) { + } + Lexeme(int k, const String &s, bool compact = false) + : _kind(k), _s(compact ? s.compact() : s) { + } + + int kind() const { return _kind; } + bool is(int k) const { return _kind == k; } + + const String &string() const { return _s; } + String &string() { return _s; } + + private: + + int _kind; + String _s; + +}; + +class Lexer { public: + + enum { TUNNEL_TYPE = 0, ERROR_TYPE = 1 }; + + class TunnelEnd; + class Compound; + typedef Router::Port Port; + typedef Router::Connection Connection; + + Lexer(); + virtual ~Lexer(); + + int begin_parse(const String &data, const String &filename, LexerExtra *, ErrorHandler * = 0); + void end_parse(int); + + VariableEnvironment &global_scope() { return _global_scope; } + ErrorHandler *errh() const { return _errh; } + + String remaining_text() const; + void set_remaining_text(const String &); + + Lexeme lex() { + return _unlex_pos ? _unlex[--_unlex_pos] : next_lexeme(); + } + void unlex(const Lexeme &t) { + assert(_unlex_pos < UNLEX_SIZE); + _unlex[_unlex_pos++] = t; + } + String lex_config() { + assert(!_unlex_pos); + return _file.lex_config(this); + } + + bool expect(int, bool no_error = false); + + typedef Element *(*ElementFactory)(uintptr_t); +#ifdef CLICK_LINUXMODULE + int add_element_type(const String &, ElementFactory factory, uintptr_t thunk, struct module *module, bool scoped = false); +#else + int add_element_type(const String &, ElementFactory factory, uintptr_t thunk, bool scoped = false); +#endif + int element_type(const String &name) const { + return _element_type_map[name]; + } + int force_element_type(String name, bool report_error = true); + + void element_type_names(Vector &) const; + + int remove_element_type(int t) { return remove_element_type(t, 0); } + + String element_name(int) const; + String element_landmark(int) const; + + void add_tunnels(String name, int *eidexes); + + bool ydone() const { return !_ps; } + void ystep(); + + Router *create_router(Master *); + + private: + + enum { + max_depth = 50 + }; + + struct FileState { + String _big_string; + const char *_end; + const char *_pos; + String _filename; + String _original_filename; + unsigned _lineno; + + FileState(const String &data, const String &filename); + const char *skip_line(const char *s); + const char *skip_slash_star(const char *s); + const char *skip_backslash_angle(const char *s); + const char *skip_quote(const char *s, char end_c); + const char *process_line_directive(const char *s, Lexer *lexer); + Lexeme next_lexeme(Lexer *lexer); + String lex_config(Lexer *lexer); + String landmark() const; + }; + + struct ElementState; + struct ParseState; + + // lexer + FileState _file; + bool _compact_config; + LexerExtra *_lextra; + + Lexeme next_lexeme() { + return _file.next_lexeme(this); + } + static String lexeme_string(int); + + // parser + enum { UNLEX_SIZE = 2 }; + Lexeme _unlex[2]; + int _unlex_pos; + + // element types + struct ElementType { + ElementFactory factory; + uintptr_t thunk; +#ifdef CLICK_LINUXMODULE + struct module *module; +#endif + String name; + int next; + + inline Compound* compound() const { + if (factory == compound_element_factory) + return reinterpret_cast(thunk); + else + return 0; + } + }; + HashTable _element_type_map; + Vector _element_types; + enum { ET_SCOPED = 0x80000000, ET_TMASK = 0x7FFFFFFF, ET_NULL = 0x7FFFFFFF }; + int _last_element_type; + int _free_element_type; + VariableEnvironment _global_scope; + + // elements + Compound *_c; + ParseState *_ps; + int _group_depth; + + Vector _tunnels; + + // compound elements + int _anonymous_offset; + + // requirements + Vector _requirements; + Vector _libraries; + + // errors + ErrorHandler *_errh; + + int lerror(const char *, ...); + int lerror_syntax(const Lexeme &t); + + String anon_element_name(const String &) const; + int get_element(String name, int etype, + const String &configuration = String(), + const String &filename = String(), unsigned lineno = 0); + int lexical_scoping_in() const; + void lexical_scoping_out(int); + int remove_element_type(int, int *); + int make_compound_element(int); + void expand_compound_element(int, VariableEnvironment &); + void add_router_connections(int, const Vector &); + static Element* compound_element_factory(uintptr_t); + + void yport(bool isoutput); + void yelement_name(); + void yelement_type(int type, bool this_ident, bool this_implicit); + void yelement_config(ElementState *e, bool this_implicit); + void yelement_next(); + + void yconnection_connector(); + void yconnection_check_useless(const Vector &x, bool isoutput); + static void yconnection_analyze_ports(const Vector &x, bool isoutput, + int &min_ports, int &expandable); + void yconnection_connect_all(Vector &outputs, Vector &inputs, int connector); + + void ycompound_arguments(Compound *ct); + void ycompound(); + void ycompound_next(); + void ycompound_end(const Lexeme &t); + void ygroup(); + void ygroup_end(); + + void yelementclass(); + void yrequire(); + void yrequire_library(const String &value); + void yvar(); + + void ystatement(); + + TunnelEnd *find_tunnel(const Port &p, bool isoutput, bool insert); + void expand_connection(const Port &p, bool isoutput, Vector &); + + friend class Compound; + friend class TunnelEnd; + friend struct FileState; + +}; + +class LexerExtra { public: + + LexerExtra() { } + virtual ~LexerExtra() { } + + virtual void require(String type, String value, ErrorHandler *errh); + +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/libdivide.h b/openflow/include/click/libdivide.h new file mode 100644 index 0000000..33f2f92 --- /dev/null +++ b/openflow/include/click/libdivide.h @@ -0,0 +1,342 @@ +// libdivide.h +// Copyright 2010 - 2016 ridiculous_fish + +/* + libdivide + Copyright (C) 2010 ridiculous_fish + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + +libdivide@ridiculousfish.com +*/ +/* modified from https://github.com/ridiculousfish/libdivide for click */ + +#ifndef CLICK_LIBDIVIDE_H +#define CLICK_LIBDIVIDE_H +#include +#include +CLICK_DECLS + +#ifndef __has_builtin +#define __has_builtin(x) 0 // Compatibility with non-clang compilers. +#endif + +#if defined(__SIZEOF_INT128__) +#define HAS_INT128_T 1 +#endif + +#if defined(__x86_64__) || defined(_WIN64) || defined(_M_X64) +#define LIBDIVIDE_IS_X86_64 1 +#endif + +#if defined(__i386__) +#define LIBDIVIDE_IS_i386 1 +#endif + +#if __GNUC__ || __clang__ +#define LIBDIVIDE_GCC_STYLE_ASM 1 +#endif + +#define LIBDIVIDE_ASSERT(x) assert(x) + +// Explanation of "more" field: bit 6 is whether to use shift path. If we are +// using the shift path, bit 7 is whether the divisor is negative in the signed +// case; in the unsigned case it is 0. Bits 0-4 is shift value (for shift +// path or mult path). In 32 bit case, bit 5 is always 0. We use bit 7 as the +// "negative divisor indicator" so that we can use sign extension to +// efficiently go to a full-width -1. +// +// u32: [0-4] shift value +// [5] ignored +// [6] add indicator +// [7] shift path +// +// s32: [0-4] shift value +// [5] shift path +// [6] add indicator +// [7] indicates negative divisor +// +// u64: [0-5] shift value +// [6] add indicator +// [7] shift path +// +// s64: [0-5] shift value +// [6] add indicator +// [7] indicates negative divisor +// magic number of 0 indicates shift path (we ran out of bits!) +// +// In s32 and s64 branchfree modes, the magic number is negated according to +// whether the divisor is negated. In branchfree strategy, it is not negated. + +enum { + LIBDIVIDE_32_SHIFT_MASK = 0x1F, + LIBDIVIDE_64_SHIFT_MASK = 0x3F, + LIBDIVIDE_ADD_MARKER = 0x40, + LIBDIVIDE_U32_SHIFT_PATH = 0x80, + LIBDIVIDE_U64_SHIFT_PATH = 0x80, + LIBDIVIDE_S32_SHIFT_PATH = 0x20, + LIBDIVIDE_NEGATIVE_DIVISOR = 0x80 +}; + +struct libdivide_u32_t { + uint32_t magic; + uint8_t more; +}; + +struct libdivide_u32_branchfree_t { + uint32_t magic; + uint8_t more; +}; + +#ifndef LIBDIVIDE_API +#define LIBDIVIDE_API static inline +#endif + +LIBDIVIDE_API struct libdivide_u32_t libdivide_u32_gen(uint32_t y); + +LIBDIVIDE_API struct libdivide_u32_branchfree_t libdivide_u32_branchfree_gen(uint32_t y); + +LIBDIVIDE_API uint32_t libdivide_u32_do(uint32_t numer, const struct libdivide_u32_t *denom); + +LIBDIVIDE_API uint32_t libdivide_u32_branchfree_do(uint32_t numer, const struct libdivide_u32_branchfree_t *denom); + +LIBDIVIDE_API uint32_t libdivide_u32_recover(const struct libdivide_u32_t *denom); + +LIBDIVIDE_API uint32_t libdivide_u32_branchfree_recover(const struct libdivide_u32_branchfree_t *denom); + +LIBDIVIDE_API int libdivide_u32_get_algorithm(const struct libdivide_u32_t *denom); +LIBDIVIDE_API uint32_t libdivide_u32_do_alg0(uint32_t numer, const struct libdivide_u32_t *denom); +LIBDIVIDE_API uint32_t libdivide_u32_do_alg1(uint32_t numer, const struct libdivide_u32_t *denom); +LIBDIVIDE_API uint32_t libdivide_u32_do_alg2(uint32_t numer, const struct libdivide_u32_t *denom); + + +//////// Internal Utility Functions + +static inline uint32_t libdivide__mullhi_u32(uint32_t x, uint32_t y) { + uint64_t xl = x, yl = y; + uint64_t rl = xl * yl; + return (uint32_t)(rl >> 32); +} + +static inline int32_t libdivide__count_leading_zeros32(uint32_t val) { +#if __GNUC__ || __has_builtin(__builtin_clz) + // Fast way to count leading zeros + return __builtin_clz(val); +#else + int32_t result = 0; + uint32_t hi = 1U << 31; + + while (~val & hi) { + hi >>= 1; + result++; + } + return result; +#endif +} + +static inline int32_t libdivide__count_leading_zeros64(uint64_t val) { +#if __GNUC__ || __has_builtin(__builtin_clzll) + // Fast way to count leading zeros + return __builtin_clzll(val); +#else + uint32_t hi = val >> 32; + uint32_t lo = val & 0xFFFFFFFF; + if (hi != 0) return libdivide__count_leading_zeros32(hi); + return 32 + libdivide__count_leading_zeros32(lo); +#endif +} + +// libdivide_64_div_32_to_32: divides a 64 bit uint {u1, u0} by a 32 bit +// uint {v}. The result must fit in 32 bits. +// Returns the quotient directly and the remainder in *r +#if (LIBDIVIDE_IS_i386 || LIBDIVIDE_IS_X86_64) && LIBDIVIDE_GCC_STYLE_ASM +static uint32_t libdivide_64_div_32_to_32(uint32_t u1, uint32_t u0, uint32_t v, uint32_t *r) { + uint32_t result; + __asm__("divl %[v]" + : "=a"(result), "=d"(*r) + : [v] "r"(v), "a"(u0), "d"(u1) + ); + return result; +} +#else +static uint32_t libdivide_64_div_32_to_32(uint32_t u1, uint32_t u0, uint32_t v, uint32_t *r) { + uint64_t n = (((uint64_t)u1) << 32) | u0; + uint32_t result = (uint32_t)int_divide(n, v); + *r = (uint32_t)(n - result * (uint64_t)v); + return result; +} +#endif + +////////// UINT32 + +static inline struct libdivide_u32_t libdivide_internal_u32_gen(uint32_t d, int branchfree) { + // 1 is not supported with branchfree algorithm + LIBDIVIDE_ASSERT(!branchfree || d != 1); + + struct libdivide_u32_t result; + const uint32_t floor_log_2_d = 31 - libdivide__count_leading_zeros32(d); + if ((d & (d - 1)) == 0) { + // Power of 2 + if (! branchfree) { + result.magic = 0; + result.more = floor_log_2_d | LIBDIVIDE_U32_SHIFT_PATH; + } else { + // We want a magic number of 2**32 and a shift of floor_log_2_d + // but one of the shifts is taken up by LIBDIVIDE_ADD_MARKER, so we + // subtract 1 from the shift + result.magic = 0; + result.more = (floor_log_2_d-1) | LIBDIVIDE_ADD_MARKER; + } + } else { + uint8_t more; + uint32_t rem, proposed_m; + proposed_m = libdivide_64_div_32_to_32(1U << floor_log_2_d, 0, d, &rem); + + LIBDIVIDE_ASSERT(rem > 0 && rem < d); + const uint32_t e = d - rem; + + // This power works if e < 2**floor_log_2_d. + if (!branchfree && (e < (1U << floor_log_2_d))) { + // This power works + more = floor_log_2_d; + } else { + // We have to use the general 33-bit algorithm. We need to compute + // (2**power) / d. However, we already have (2**(power-1))/d and + // its remainder. By doubling both, and then correcting the + // remainder, we can compute the larger division. + // don't care about overflow here - in fact, we expect it + proposed_m += proposed_m; + const uint32_t twice_rem = rem + rem; + if (twice_rem >= d || twice_rem < rem) proposed_m += 1; + more = floor_log_2_d | LIBDIVIDE_ADD_MARKER; + } + result.magic = 1 + proposed_m; + result.more = more; + // result.more's shift should in general be ceil_log_2_d. But if we + // used the smaller power, we subtract one from the shift because we're + // using the smaller power. If we're using the larger power, we + // subtract one from the shift because it's taken care of by the add + // indicator. So floor_log_2_d happens to be correct in both cases. + } + return result; +} + +struct libdivide_u32_t libdivide_u32_gen(uint32_t d) { + return libdivide_internal_u32_gen(d, 0); +} + +struct libdivide_u32_branchfree_t libdivide_u32_branchfree_gen(uint32_t d) { + struct libdivide_u32_t tmp = libdivide_internal_u32_gen(d, 1); + struct libdivide_u32_branchfree_t ret = {tmp.magic, (uint8_t)(tmp.more & LIBDIVIDE_32_SHIFT_MASK)}; + return ret; +} + +uint32_t libdivide_u32_do(uint32_t numer, const struct libdivide_u32_t *denom) { + uint8_t more = denom->more; + if (more & LIBDIVIDE_U32_SHIFT_PATH) { + return numer >> (more & LIBDIVIDE_32_SHIFT_MASK); + } + else { + uint32_t q = libdivide__mullhi_u32(denom->magic, numer); + if (more & LIBDIVIDE_ADD_MARKER) { + uint32_t t = ((numer - q) >> 1) + q; + return t >> (more & LIBDIVIDE_32_SHIFT_MASK); + } + else { + return q >> more; // all upper bits are 0 - don't need to mask them off + } + } +} + +uint32_t libdivide_u32_recover(const struct libdivide_u32_t *denom) { + uint8_t more = denom->more; + uint8_t shift = more & LIBDIVIDE_32_SHIFT_MASK; + if (more & LIBDIVIDE_U32_SHIFT_PATH) { + return 1U << shift; + } else if (! (more & LIBDIVIDE_ADD_MARKER)) { + // We compute q = n/d = n*m / 2^(32 + shift) + // Therefore we have d = 2^(32 + shift) / m + // We need to ceil it. + // We know d is not a power of 2, so m is not a power of 2, + // so we can just add 1 to the floor + uint32_t hi_dividend = 1U << shift; + uint32_t rem_ignored; + return 1 + libdivide_64_div_32_to_32(hi_dividend, 0, denom->magic, &rem_ignored); + } else { + // Here we wish to compute d = 2^(32+shift+1)/(m+2^32). + // Notice (m + 2^32) is a 33 bit number. Use 64 bit division for now + // Also note that shift may be as high as 31, so shift + 1 will + // overflow. So we have to compute it as 2^(32+shift)/(m+2^32), and + // then double the quotient and remainder. + // TODO: do something better than 64 bit math + uint64_t half_n = 1ULL << (32 + shift); + uint64_t d = (1ULL << 32) | denom->magic; + // Note that the quotient is guaranteed <= 32 bits, but the remainder + // may need 33! + uint32_t half_q = (uint32_t)int_divide(half_n, d); + uint64_t rem = half_n - half_q * d; // broken + // We computed 2^(32+shift)/(m+2^32) + // Need to double it, and then add 1 to the quotient if doubling th + // remainder would increase the quotient. + // Note that rem<<1 cannot overflow, since rem < d and d is 33 bits + uint32_t full_q = half_q + half_q + ((rem<<1) >= d); + + // We rounded down in gen unless we're a power of 2 (i.e. in branchfree case) + // We can detect that by looking at m. If m zero, we're a power of 2 + return full_q + (denom->magic != 0); + } +} + +uint32_t libdivide_u32_branchfree_recover(const struct libdivide_u32_branchfree_t *denom) { + struct libdivide_u32_t denom_u32 = {denom->magic, (uint8_t)(denom->more | LIBDIVIDE_ADD_MARKER)}; + return libdivide_u32_recover(&denom_u32); +} + +int libdivide_u32_get_algorithm(const struct libdivide_u32_t *denom) { + uint8_t more = denom->more; + if (more & LIBDIVIDE_U32_SHIFT_PATH) return 0; + else if (! (more & LIBDIVIDE_ADD_MARKER)) return 1; + else return 2; +} + +uint32_t libdivide_u32_do_alg0(uint32_t numer, const struct libdivide_u32_t *denom) { + return numer >> (denom->more & LIBDIVIDE_32_SHIFT_MASK); +} + +uint32_t libdivide_u32_do_alg1(uint32_t numer, const struct libdivide_u32_t *denom) { + uint32_t q = libdivide__mullhi_u32(denom->magic, numer); + return q >> denom->more; +} + +uint32_t libdivide_u32_do_alg2(uint32_t numer, const struct libdivide_u32_t *denom) { + // denom->add != 0 + uint32_t q = libdivide__mullhi_u32(denom->magic, numer); + uint32_t t = ((numer - q) >> 1) + q; + // Note that this mask is typically free. Only the low bits are meaningful + // to a shift, so compilers can optimize out this AND. + return t >> (denom->more & LIBDIVIDE_32_SHIFT_MASK); +} + +uint32_t libdivide_u32_branchfree_do(uint32_t numer, const struct libdivide_u32_branchfree_t *denom) { + // same as alg 2 + uint32_t q = libdivide__mullhi_u32(denom->magic, numer); + uint32_t t = ((numer - q) >> 1) + q; + return t >> denom->more; +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/list.hh b/openflow/include/click/list.hh new file mode 100644 index 0000000..afc9bbb --- /dev/null +++ b/openflow/include/click/list.hh @@ -0,0 +1,564 @@ +#ifndef CLICK_LIST_HH +#define CLICK_LIST_HH 1 +/* + * list.hh -- List template + * Eddie Kohler + * + * Copyright (c) 2008 Meraki, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software") + * to deal in the Software without restriction, subject to the conditions + * listed in the Click LICENSE file. These conditions include: you must + * preserve this copyright notice, and you cannot mention the copyright + * holders in advertising related to the Software without their permission. + * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This + * notice is a summary of the Click LICENSE file; the license in that file is + * legally binding. + */ +CLICK_DECLS +#define LIST_HEAD_MARKER 0 /* ((T *) 1) */ + +/** @file + * @brief Click's doubly-linked list container template. + */ + +template class List_member; +template T::*member> class List; + +/** @class List + @brief Doubly-linked list template. + + The List template, and its helper template List_member, implement a generic + doubly-linked list. The list is intrusive in that the container + does not manage space for its contents. The user provides space for + contained elements, and must delete elements when they are no longer needed. + (This is unlike Vector or HashTable, which manage space for their contents.) + The main advantage of intrusive containers is that a single element can be + on multiple lists. + + Here's an example linked list of integers built using List and List_member. + + @code + #include + + struct intlist_node { + int value; + List_member link; + intlist_node(int v) + : value(v) { + } + }; + + typedef List intlist; + + void make_intlist(intlist &l, int begin, int end, int step) { + for (int i = begin; i < end; i += step) + l.push_back(new intlist_node(i)); + // Note that l does not manage its contents' memory! + // Whoever destroys l should first delete its contents, + // for example by calling trash_intlist(l). + } + + void print_intlist(const intlist &l) { + size_t n = 0; + for (intlist::const_iterator it = l.begin(); it != l.end(); ++it, ++n) + click_chatter("#%ld: %d\n", (long) n, it->value); + } + + void trash_intlist(intlist &l) { + while (!l.empty()) { + intlist_node *n = l.front(); + l.pop_front(); + delete n; + } + } + + template + void remove_every_other(T &list) { + typename T::iterator it = list.begin(); + while (it != l.end()) { + ++it; + if (it != l.end()) + it = list.erase(it); + } + } + @endcode +*/ + +/** @class List_member + @brief Member of classes to be placed on a List. + + Any class type that will be placed on a List must have a publicly accessible + List_member member. This member is supplied as the second template argument + to List. List_member allows users to fetch the next-element and + previous-element pointers, but all modifications must take place via List + functions like List::push_back() and List::insert(). List_member has + private copy constructor and default assignment operators. + + @sa List +*/ +template +class List_member { public: + + /** @brief Construct an isolated List_member. */ + List_member() + : _next(), _prev() { + } + + /** @brief Return the next element in the list. */ + T *next() { + return _next; + } + /** @overload */ + const T *next() const { + return _next; + } + + /** @brief Return the previous element in the list. */ + T *prev() { + return _prev != LIST_HEAD_MARKER ? _prev : 0; + } + /** @overload */ + const T *prev() const { + return _prev != LIST_HEAD_MARKER ? _prev : 0; + } + + private: + + T *_next; + T *_prev; + + List_member(const List_member &x); + List_member &operator=(const List_member &x); + template X::*member> friend class List; + +}; + +template T::*member> +class List { public: + + typedef T *pointer; + typedef const T *const_pointer; + class const_iterator; + class iterator; + typedef size_t size_type; + + /** @brief Construct an empty list. */ + List() + : _head(0), _tail(0) { + } + + + /** @brief Return an iterator for the first element in the list. */ + iterator begin() { + return iterator(_head, this); + } + /** @overload */ + const_iterator begin() const { + return const_iterator(_head, this); + } + /** @brief Return an iterator for the end of the list. + * @invariant end().live() == false */ + iterator end() { + return iterator(this); + } + /** @overload */ + const_iterator end() const { + return const_iterator(this); + } + + + /** @brief Return true iff size() == 0. + * @note Always O(1) time, whereas size() takes O(N) time. */ + bool empty() const { + return _head == 0; + } + + /** @brief Return the number of elements in the list. + * @note Takes O(N) time, where N is the number of elements. */ + size_type size() const { + size_type n = 0; + for (T *x = _head; x; x = (x->*member)._next) + ++n; + return n; + } + + + /** @brief Return the first element in the list. + * + * Returns a null pointer if the list is empty. */ + pointer front() { + return _head; + } + /** @overload */ + const_pointer front() const { + return _head; + } + /** @brief Return the last element in the list. + * + * Returns a null pointer if the list is empty. */ + pointer back() { + return _tail; + } + /** @overload */ + const_pointer back() const { + return _tail; + } + + + /** @brief Insert a new element at the beginning of the list. + * @param x new element + * @pre isolated(@a x) */ + void push_front(pointer x) { + assert(x && isolated(x)); + if (((x->*member)._next = _head)) + (_head->*member)._prev = x; + else + _tail = x; + _head = x; + (_head->*member)._prev = LIST_HEAD_MARKER; + } + + /** @brief Insert a new element at the end of the list. + * @param x new element + * @pre isolated(@a x) */ + void push_back(pointer x) { + assert(x && !(x->*member)._next && !(x->*member)._prev); + if (((x->*member)._prev = _tail)) + (_tail->*member)._next = x; + else { + _head = x; + (_head->*member)._prev = LIST_HEAD_MARKER; + } + _tail = x; + } + + /** @brief Remove the element at the beginning of the list. + * @pre !empty() */ + void pop_front() { + assert(_head); + pointer x = _head; + if ((_head = (x->*member)._next) != LIST_HEAD_MARKER) + (_head->*member)._prev = LIST_HEAD_MARKER; + else + _head = _tail = 0; + (x->*member)._next = (x->*member)._prev = 0; + } + + /** @brief Remove the element at the end of the list. + * @pre !empty() */ + void pop_back() { + assert(_head); + pointer x = _tail; + if ((_tail = (x->*member)._prev) != LIST_HEAD_MARKER) + (_tail->*member)._next = 0; + else + _head = _tail = 0; + (x->*member)._next = (x->*member)._prev = 0; + } + + + /** @brief Insert an element before @a pos. + * @param pos position to insert (if null, insert at end of list) + * @param x new element + * @pre (!@a pos || contains(@a pos)) && isolated(@a x) */ + void insert(pointer pos, pointer x) { + assert(x && isolated(x)); + T **pprev = (pos ? &(pos->*member)._prev : &_tail); + if (((x->*member)._prev = *pprev) != LIST_HEAD_MARKER) + ((x->*member)._prev->*member)._next = x; + else + _head = x; + *pprev = x; + (x->*member)._next = pos; + } + + /** @brief Insert an element before @a it. + * @param it position to insert + * @param x new element + * @return an iterator pointing to @a x + * @pre isolated(@a x) */ + iterator insert(iterator it, pointer x) { + insert(it.get(), x); + return iterator(x); + } + + /** @brief Insert the elements in [@a first, @a last) before @a it. + * @param it position to insert + * @param first iterator to beginning of insertion sequence + * @param last iterator to end of insertion sequence + * @pre isolated(@a x) for each @a x in [@a first, @a last) */ + template + void insert(iterator it, InputIterator first, InputIterator last) { + while (first != last) { + insert(it, *first); + ++first; + } + } + + + /** @brief Remove @a x from the list. + * @param x element to remove + * @pre contains(@a x) */ + void erase(pointer x) { + assert(x); + T *n = (x->*member)._next, *p = (x->*member)._prev; + if (n) + (n->*member)._prev = p; + else + _tail = (p != LIST_HEAD_MARKER ? p : 0); + if (p != LIST_HEAD_MARKER) + (p->*member)._next = n; + else + _head = n; + (x->*member)._next = (x->*member)._prev = 0; + } + + /** @brief Remove the element pointed to by @a it from the list. + * @param it element to remove + * @return iterator pointing to the element after the removed element + * @pre @a it.live() */ + iterator erase(iterator it) { + assert(it); + iterator next = iterator((it.get()->*member)._next); + erase(it.get()); + return next; + } + + /** @brief Remove the elements in [@a first, @a last) from the list. + * @param first iterator to beginning of removal subsequence + * @param last iterator to end of removal subsequence + * @return iterator pointing to the element after the removed subsequence */ + iterator erase(iterator first, iterator last) { + while (first != last) + first = erase(first); + return first; + } + + /** @brief Remove all elements from the list. + * @note Equivalent to erase(begin(), end()). */ + void clear() { + while (T *x = _head) { + _head = (x->*member)._next; + (x->*member)._next = (x->*member)._prev = 0; + } + _tail = 0; + } + + /** @brief Remove all elements from the list. + * + * Unlike clear(), this function does not erase() any of the elements of + * this list: those elements' next() and prev() members remain + * unchanged. */ + void __clear() { + _head = _tail = 0; + } + + + /** @brief Exchange list contents with list @a x. */ + void swap(List &x) { + T *h = x._head, *t = x._tail; + x._head = _head, x._tail = _tail; + _head = h, _tail = t; + } + + + /** @brief Check if @a x is isolated. + * + * An isolated element is not a member of any list. */ + bool isolated(const_pointer x) { + return !(x->*member)._next && !(x->*member)._prev && x != _head; + } + + /** @brief Check if @a x is a member of this list. */ + bool contains(const_pointer x) const { + if (!isolated(x)) + for (const_pointer *it = _head; it; it = (it->*member).next()) + if (x == it) + return true; + return false; + } + + + /** @class List::const_iterator + * @brief Const iterator type for List. */ + class const_iterator { public: + /** @brief Construct an invalid iterator. */ + const_iterator() + : _x(), _list() { + } + /** @brief Construct an iterator pointing at @a x. */ + const_iterator(const T *x) + : _x(const_cast(x)), _list() { + } + /** @brief Construct an end iterator for @a list. */ + const_iterator(const List *list) + : _x(), _list(list) { + } + /** @brief Construct an iterator pointing at @a x in @a list. */ + const_iterator(const T *x, const List *list) + : _x(const_cast(x)), _list(list) { + } + typedef bool (const_iterator::*unspecified_bool_type)() const; + /** @brief Test if this iterator points to a valid list element. */ + operator unspecified_bool_type() const { + return _x != 0 ? &const_iterator::live : 0; + } + /** @brief Test if this iterator points to a valid list element. */ + bool live() const { + return _x != 0; + } + /** @brief Return the current list element or null. */ + const T *get() const { + return _x; + } + /** @brief Return the current list element or null. */ + const T *operator->() const { + return _x; + } + /** @brief Return the current list element. */ + const T &operator*() const { + return *_x; + } + /** @brief Advance this iterator to the next element. */ + void operator++() { + assert(_x); + _x = (_x->*member).next(); + } + /** @brief Advance this iterator to the next element. */ + void operator++(int) { + ++*this; + } + /** @brief Advance this iterator to the previous element. */ + void operator--() { + assert(_x ? (bool) (_x->*member).prev() : _list && _list->back()); + if (_x) + _x = (_x->*member).prev(); + else + _x = const_cast(_list->back()); + } + /** @brief Advance this iterator to the previous element. */ + void operator--(int) { + --*this; + } + /** @brief Move this iterator forward by @a x positions. + * @return reference to this iterator + * @note This function takes O(abs(@a x)) time. */ + const_iterator &operator+=(int x) { + for (; x > 0; --x) + ++*this; + for (; x < 0; ++x) + --*this; + return *this; + } + /** @brief Move this iterator backward by @a x positions. + * @return reference to this iterator + * @note This function takes O(abs(@a x)) time. */ + const_iterator &operator-=(int x) { + for (; x > 0; --x) + --*this; + for (; x < 0; ++x) + ++*this; + return *this; + } + /** @brief Return an iterator @a x positions ahead. */ + const_iterator operator+(int x) const { + const_iterator it(*this); + return it += x; + } + /** @brief Return an iterator @a x positions behind. */ + const_iterator operator-(int x) const { + const_iterator it(*this); + return it -= x; + } + /** @brief Test if this iterator equals @a x. */ + bool operator==(const_iterator x) const { + return _x == x._x; + } + /** @brief Test if this iterator does not equal @a x. */ + bool operator!=(const_iterator x) const { + return _x != x._x; + } + private: + T *_x; + const List *_list; + friend class iterator; + }; + + /** @class List::iterator + * @brief Iterator type for List. */ + class iterator : public const_iterator { public: + /** @brief Construct an invalid iterator. */ + iterator() + : const_iterator() { + } + /** @brief Construct an iterator pointing at @a x. */ + iterator(T *x) + : const_iterator(x) { + } + /** @brief Construct an end iterator for @a list. */ + iterator(List *list) + : const_iterator(list) { + } + /** @brief Construct an iterator pointing at @a x in @a list. */ + iterator(T *x, List *list) + : const_iterator(x, list) { + } + /** @brief Return the current list element or null. */ + T *get() const { + return this->_x; + } + /** @brief Return the current list element or null. */ + T *operator->() const { + return this->_x; + } + /** @brief Return the current list element. */ + T &operator*() const { + return *this->_x; + } + /** @brief Move this iterator forward by @a x positions. + * @return reference to this iterator + * @note This function takes O(abs(@a x)) time. */ + iterator &operator+=(int x) { + for (; x > 0; --x) + ++*this; + for (; x < 0; ++x) + --*this; + return *this; + } + /** @brief Move this iterator backward by @a x positions. + * @return reference to this iterator + * @note This function takes O(abs(@a x)) time. */ + iterator &operator-=(int x) { + for (; x > 0; --x) + --*this; + for (; x < 0; ++x) + ++*this; + return *this; + } + /** @brief Return an iterator @a x positions ahead. */ + iterator operator+(int x) const { + iterator it(*this); + return it += x; + } + /** @brief Return an iterator @a x positions behind. */ + iterator operator-(int x) const { + iterator it(*this); + return it -= x; + } + }; + + private: + + T *_head; + T *_tail; + + List(const List &x); + List &operator=(const List &x); + +}; + +#undef LIST_HEAD_MARKER +CLICK_ENDDECLS +#endif /* CLICK_LIST_HH */ diff --git a/openflow/include/click/llrpc.h b/openflow/include/click/llrpc.h new file mode 100644 index 0000000..601757c --- /dev/null +++ b/openflow/include/click/llrpc.h @@ -0,0 +1,195 @@ +#ifndef CLICK_LLRPC_H +#define CLICK_LLRPC_H +#if CLICK_LINUXMODULE +# include +CLICK_CXX_PROTECT +# include +# include +# include +CLICK_CXX_UNPROTECT +# include +#elif CLICK_BSDMODULE +# include +# include +#else +# include +# include +#endif + +/* Click low-level RPC interface */ + +/* Ioctl numbers are not consistent across platforms unless you #define + HAVE_PORTABLE_LLRPC. */ +#define _CLICK_NET_IOC_VOID 0x20000000 +#define _CLICK_NET_IOC_OUT 0x40000000 +#define _CLICK_NET_IOC_IN 0x80000000 +#if HAVE_PORTABLE_LLRPC || !defined(__linux__) +# define _CLICK_IOC_VOID _CLICK_NET_IOC_VOID +# define _CLICK_IOC_OUT _CLICK_NET_IOC_OUT +# define _CLICK_IOC_IN _CLICK_NET_IOC_IN +#else +# define _CLICK_IOC_VOID (_IOC_NONE << _IOC_DIRSHIFT) +# define _CLICK_IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) +# define _CLICK_IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) +#endif +#define _CLICK_IOC_BASE_MASK 0x0FFFFFFF +#define _CLICK_IOC_SAFE 0x00008000 +#define _CLICK_IOC_FLAT 0x00004000 +#define _CLICK_IOC_SIZE(io) ((io) >> 16 & 0xFFF) + +/* _CLICK_IO[S]: data transfer direction unknown, pass pointer unchanged; + _CLICK_IOR[S]: data of specified size sent from kernel to user; + _CLICK_IOW[S]: data of specified size sent from user to kernel; + _CLICK_IOWR[S]: data of specified size transferred in both directions. */ + +/* "Non-safe" LLRPCs will not be performed in parallel with other LLRPCs or + handlers. They will also block the router threads. */ +#define _CLICK_IOX(d, n, sz) ((d) | ((sz) << 16) | (n)) +#define _CLICK_IO(n) _CLICK_IOX(_CLICK_IOC_VOID, (n), 0) +#define _CLICK_IOR(n, sz) _CLICK_IOX(_CLICK_IOC_OUT, (n), (sz)) +#define _CLICK_IOW(n, sz) _CLICK_IOX(_CLICK_IOC_IN, (n), (sz)) +#define _CLICK_IOWR(n, sz) _CLICK_IOX(_CLICK_IOC_IN|_CLICK_IOC_OUT, (n), (sz)) + +/* "Safe" LLRPCs may be performed in parallel with read handlers and other + safe LLRPCs, but not with write handlers or unsafe LLRPCs. They will not + block the router threads. */ +#define _CLICK_IOS(n) _CLICK_IOX(_CLICK_IOC_VOID|_CLICK_IOC_SAFE, (n), 0) +#define _CLICK_IORS(n, sz) _CLICK_IOX(_CLICK_IOC_OUT|_CLICK_IOC_SAFE, (n), (sz)) +#define _CLICK_IOWS(n, sz) _CLICK_IOX(_CLICK_IOC_IN|_CLICK_IOC_SAFE, (n), (sz)) +#define _CLICK_IOWRS(n, sz) _CLICK_IOX(_CLICK_IOC_IN|_CLICK_IOC_OUT|_CLICK_IOC_SAFE, (n), (sz)) + +/* "Flat" LLRPCs do not contain pointers -- all data read or written is + contained in the size. They can be safe or unsafe. */ +#define _CLICK_IORF(n, sz) _CLICK_IOX(_CLICK_IOC_OUT|_CLICK_IOC_FLAT, (n), (sz)) +#define _CLICK_IOWF(n, sz) _CLICK_IOX(_CLICK_IOC_IN|_CLICK_IOC_FLAT, (n), (sz)) +#define _CLICK_IOWRF(n, sz) _CLICK_IOX(_CLICK_IOC_IN|_CLICK_IOC_OUT|_CLICK_IOC_FLAT, (n), (sz)) +#define _CLICK_IORSF(n, sz) _CLICK_IOX(_CLICK_IOC_OUT|_CLICK_IOC_SAFE|_CLICK_IOC_FLAT, (n), (sz)) +#define _CLICK_IOWSF(n, sz) _CLICK_IOX(_CLICK_IOC_IN|_CLICK_IOC_SAFE|_CLICK_IOC_FLAT, (n), (sz)) +#define _CLICK_IOWRSF(n, sz) _CLICK_IOX(_CLICK_IOC_IN|_CLICK_IOC_OUT|_CLICK_IOC_SAFE|_CLICK_IOC_FLAT, (n), (sz)) + +#define CLICK_LLRPC_PROXY _CLICK_IO(0) +#define CLICK_LLRPC_GET_RATE _CLICK_IOWRSF(1, 4) +#define CLICK_LLRPC_GET_RATES _CLICK_IOS(2) +#define CLICK_LLRPC_GET_COUNT _CLICK_IOWRSF(3, 4) +#define CLICK_LLRPC_GET_COUNTS _CLICK_IOS(4) +#define CLICK_LLRPC_GET_SWITCH _CLICK_IORSF(5, 4) +#define CLICK_LLRPC_SET_SWITCH _CLICK_IOWF(6, 4) +#define CLICK_LLRPC_MAP_IPADDRESS _CLICK_IOWRF(7, 4) +#define CLICK_LLRPC_IPREWRITER_MAP_TCP _CLICK_IOWRF(8, 12) +#define CLICK_LLRPC_IPREWRITER_MAP_UDP _CLICK_IOWRF(9, 12) +#define CLICK_LLRPC_IPRATEMON_LEVEL_FWD_AVG _CLICK_IO(10) +#define CLICK_LLRPC_IPRATEMON_LEVEL_REV_AVG _CLICK_IO(11) +#define CLICK_LLRPC_IPRATEMON_FWD_N_REV_AVG _CLICK_IO(12) +#define CLICK_LLRPC_IPRATEMON_SET_ANNO_LEVEL _CLICK_IO(13) +#define CLICK_IOC_TOUSERDEVICE_GET_MULTI _CLICK_IOS(15) +#define CLICK_IOC_TOUSERDEVICE_SET_MULTI _CLICK_IOS(16) +#define CLICK_LLRPC_RAW_HANDLER _CLICK_IOS(17) +#define CLICK_LLRPC_ABANDON_HANDLER _CLICK_IOS(18) +#define CLICK_LLRPC_CALL_HANDLER _CLICK_IO(19) + +struct click_llrpc_proxy_st { + void* proxied_handler; /* const Router::Handler* */ + uint32_t proxied_command; + void* proxied_data; +}; + +#define CLICK_LLRPC_COUNTS_SIZE 8 +struct click_llrpc_counts_st { + uint32_t n; + uint32_t keys[CLICK_LLRPC_COUNTS_SIZE]; + uint32_t values[CLICK_LLRPC_COUNTS_SIZE]; +}; + +#define CLICK_LLRPC_CALL_HANDLER_FLAG_RAW 1 +struct click_llrpc_call_handler_st { + int flags; + size_t errorlen; + void *errorbuf; +}; + +/* data manipulation */ + +#if CLICK_USERLEVEL || CLICK_MINIOS + +# define CLICK_LLRPC_GET_DATA(local, remote, size) (memcpy(local, remote, size), 0) +# define CLICK_LLRPC_PUT_DATA(remote, local, size) (memcpy(remote, local, size), 0) +# define CLICK_LLRPC_GET(local_obj, remote_addr) (memcpy(&(local_obj), remote_addr, sizeof(local_obj)), 0) +# define CLICK_LLRPC_PUT(remote_addr, local_obj) (memcpy(remote_addr, &(local_obj), sizeof(local_obj)), 0) + +#elif CLICK_LINUXMODULE + +# ifdef __cplusplus +# define __CLICK_LLRPC_CAST(x) reinterpret_cast< x > +# else +# define __CLICK_LLRPC_CAST(x) (x) +# endif + +# define __CLICK_LLRPC_GENERIC_GET_DATA(local, remote, size) \ + (copy_from_user(local, remote, size) > 0 ? -EFAULT : 0) +# define __CLICK_LLRPC_CONSTANT_GET_DATA(local, remote, size) \ + (size == 1 ? get_user(*__CLICK_LLRPC_CAST(unsigned char *)(local), __CLICK_LLRPC_CAST(unsigned char *)(remote)) \ + : (size == 2 ? get_user(*__CLICK_LLRPC_CAST(unsigned short *)(local), __CLICK_LLRPC_CAST(unsigned short *)(remote)) \ + : (size == 4 ? get_user(*__CLICK_LLRPC_CAST(unsigned *)(local), __CLICK_LLRPC_CAST(unsigned *)(remote)) \ + : __CLICK_LLRPC_GENERIC_GET_DATA(local, remote, size)))) + +# define __CLICK_LLRPC_GENERIC_PUT_DATA(remote, local, size) \ + (copy_to_user(remote, local, size) > 0 ? -EFAULT : 0) +# define __CLICK_LLRPC_CONSTANT_PUT_DATA(remote, local, size) \ + (size == 1 ? put_user(*__CLICK_LLRPC_CAST(const unsigned char *)(local), __CLICK_LLRPC_CAST(unsigned char *)(remote)) \ + : (size == 2 ? put_user(*__CLICK_LLRPC_CAST(const unsigned short *)(local), __CLICK_LLRPC_CAST(unsigned short *)(remote)) \ + : (size == 4 ? put_user(*__CLICK_LLRPC_CAST(const unsigned *)(local), __CLICK_LLRPC_CAST(unsigned *)(remote)) \ + : __CLICK_LLRPC_GENERIC_PUT_DATA(remote, local, size)))) + +# define CLICK_LLRPC_GET_DATA(local, remote, size) \ + (__builtin_constant_p(size) && size <= 4 \ + ? __CLICK_LLRPC_CONSTANT_GET_DATA(local, remote, size) \ + : __CLICK_LLRPC_GENERIC_GET_DATA(local, remote, size)) +# define CLICK_LLRPC_PUT_DATA(remote, local, size) \ + (__builtin_constant_p(size) && size <= 4 \ + ? __CLICK_LLRPC_CONSTANT_PUT_DATA(remote, local, size) \ + : __CLICK_LLRPC_GENERIC_PUT_DATA(remote, local, size)) + +# define CLICK_LLRPC_GET(local_obj, remote_addr) \ + get_user((local_obj), (remote_addr)) +# define CLICK_LLRPC_PUT(remote_addr, local_obj) \ + put_user((local_obj), (remote_addr)) + +#elif CLICK_BSDMODULE + +/* + * XXX LLRPC isn't implemented for BSD yet. + */ + +# define CLICK_LLRPC_GET_DATA(local, remote, size) ((void)(local), (void)(remote), (void)(size), -EFAULT) +# define CLICK_LLRPC_PUT_DATA(remote, local, size) ((void)(local), (void)(remote), (void)(size), -EFAULT) +# define CLICK_LLRPC_GET(local_obj, remote_addr) ((void)(local_obj), (void)(remote_addr), -EFAULT) +# define CLICK_LLRPC_PUT(remote_addr, local_obj) ((void)(local_obj), (void)(remote_addr), -EFAULT) + +#endif + +/* CLICK_NTOH_LLRPC: portable LLRPC numbers to host LLRPC numbers */ +/* CLICK_HTON_LLRPC: host LLRPC numbers to portable LLRPC numbers */ +/* both macros are only suitable for integer constants and the like */ +#if _CLICK_IOC_VOID != _CLICK_NET_IOC_VOID || _CLICK_IOC_OUT != _CLICK_NET_IOC_OUT || _CLICK_IOC_IN != _CLICK_NET_IOC_IN +# define CLICK_LLRPC_NTOH(command) \ + (((command) & _CLICK_NET_IOC_VOID ? _CLICK_IOC_VOID : 0) \ + | ((command) & _CLICK_NET_IOC_OUT ? _CLICK_IOC_OUT : 0) \ + | ((command) & _CLICK_NET_IOC_IN ? _CLICK_IOC_IN : 0) \ + | ((command) & _CLICK_IOC_BASE_MASK)) +# define CLICK_LLRPC_HTON(command) \ + (((command) & _CLICK_IOC_VOID ? _CLICK_NET_IOC_VOID : 0) \ + | ((command) & _CLICK_IOC_OUT ? _CLICK_NET_IOC_OUT : 0) \ + | ((command) & _CLICK_IOC_IN ? _CLICK_NET_IOC_IN : 0) \ + | ((command) & _CLICK_IOC_BASE_MASK)) +#else +# define CLICK_LLRPC_NTOH(command) (command) +# define CLICK_LLRPC_HTON(command) (command) +#endif + +/* sanity checks */ +#ifdef __FreeBSD__ +# if _CLICK_IOC_VOID != IOC_VOID || _CLICK_IOC_OUT != IOC_OUT || _CLICK_IOC_IN != IOC_IN +# error "bad _CLICK_IOC constants" +# endif +#endif +#endif diff --git a/openflow/include/click/machine.hh b/openflow/include/click/machine.hh new file mode 100644 index 0000000..536d30e --- /dev/null +++ b/openflow/include/click/machine.hh @@ -0,0 +1,82 @@ +#ifndef CLICK_MACHINE_HH +#define CLICK_MACHINE_HH 1 +#if CLICK_LINUXMODULE +# include +CLICK_CXX_PROTECT +# include +# include +# if defined(CONFIG_SMP) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) +# define num_possible_cpus() smp_num_cpus +# endif +CLICK_CXX_UNPROTECT +# include +#endif + +/** @brief Compiler fence. + + Prevents reordering of loads and stores by the compiler. Not intended to + synchronize the processor's caches. */ +inline void +click_compiler_fence() +{ + asm volatile("" : : : "memory"); +} + +/** @brief Compiler fence that relaxes the processor. + + Use this in spinloops, for example. */ +inline void +click_relax_fence() +{ +#if CLICK_LINUXMODULE + cpu_relax(); +#elif HAVE_MULTITHREAD && (defined(__i386__) || defined(__arch_um__) || defined(__x86_64__)) + asm volatile("rep; nop" : : : "memory"); // equivalent to "pause" +#else + click_compiler_fence(); +#endif +} + +/** @brief Full memory fence. */ +inline void +click_fence() +{ +#if CLICK_LINUXMODULE + smp_mb(); +#elif HAVE_MULTITHREAD && (defined(__i386__) || defined(__arch_um__) || defined(__x86_64__)) + // GCC 4.2.1 on Mac has __sync_synchronize, but it doesn't work! + asm volatile("mfence" : : : "memory"); +#elif HAVE_MULTITHREAD && HAVE___SYNC_SYNCHRONIZE + __sync_synchronize(); +#else + click_compiler_fence(); +#endif +} + +/** @brief Read memory fence. + + On x86, equivalent to click_compiler_fence(). */ +inline void click_read_fence() { +#if CLICK_LINUXMODULE + smp_rmb(); +#elif HAVE_MULTITHREAD && (defined(__i386__) || defined(__arch_um__) || defined(__x86_64__)) + click_compiler_fence(); +#else + click_fence(); +#endif +} + +/** @brief Write memory fence. + + On x86, equivalent to click_compiler_fence(). */ +inline void click_write_fence() { +#if CLICK_LINUXMODULE + smp_wmb(); +#elif HAVE_MULTITHREAD && (defined(__i386__) || defined(__arch_um__) || defined(__x86_64__)) + click_compiler_fence(); +#else + click_fence(); +#endif +} + +#endif diff --git a/openflow/include/click/master.hh b/openflow/include/click/master.hh new file mode 100644 index 0000000..eda5059 --- /dev/null +++ b/openflow/include/click/master.hh @@ -0,0 +1,223 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/master.cc" -*- +#ifndef CLICK_MASTER_HH +#define CLICK_MASTER_HH +#include +#include +#if CLICK_USERLEVEL +# include +#endif +#if CLICK_NS +# include +#endif +CLICK_DECLS + +#define CLICK_DEBUG_MASTER 0 + +class Master { public: + + Master(int nthreads); + ~Master(); + + void use(); + void unuse(); + + void block_all(); + void unblock_all(); + + void pause(); + inline void unpause(); + bool paused() const { return _master_paused > 0; } + + inline int nthreads() const; + inline RouterThread *thread(int id) const; + void wake_somebody(); + +#if CLICK_USERLEVEL + int add_signal_handler(int signo, Router *router, String handler); + int remove_signal_handler(int signo, Router *router, String handler); + void process_signals(RouterThread *thread); + static void signal_handler(int signo); // not really public +#endif + + void kill_router(Router*); + +#if CLICK_NS + void initialize_ns(simclick_node_t *simnode); + simclick_node_t *simnode() const { return _simnode; } +#endif + +#if CLICK_DEBUG_MASTER || CLICK_DEBUG_SCHEDULING + String info() const; +#endif + +#if CLICK_USERLEVEL + static volatile sig_atomic_t signals_pending; +#endif + + private: + + // THREADS + RouterThread **_threads; + int _nthreads; + + // ROUTERS + Router *_routers; + int _refcount; + void register_router(Router*); + void prepare_router(Router*); + void run_router(Router*, bool foreground); + void unregister_router(Router*); + +#if CLICK_LINUXMODULE + spinlock_t _master_lock; + struct task_struct *_master_lock_task; + int _master_lock_count; +#elif HAVE_MULTITHREAD + Spinlock _master_lock; +#endif + atomic_uint32_t _master_paused; + inline void lock_master(); + inline void unlock_master(); + + void request_stop(); + bool verify_stop(RouterThread* t); + +#if CLICK_USERLEVEL + // SIGNALS + struct SignalInfo { + int signo; + Router *router; + String handler; + SignalInfo *next; + SignalInfo(int signo_, Router *router_, const String &handler_) + : signo(signo_), router(router_), handler(handler_), next() { + } + bool equals(int signo_, Router *router_, const String &handler_) const { + return signo == signo_ && router == router_ && handler == handler_; + } + }; + SignalInfo *_siginfo; + sigset_t _sig_dispatching; + Spinlock _signal_lock; +#endif + +#if CLICK_NS + simclick_node_t *_simnode; +#endif + + Master(const Master&); + Master& operator=(const Master&); + + friend class Task; + friend class RouterThread; + friend class Router; +}; + +inline int +Master::nthreads() const +{ + return _nthreads - 1; +} + +inline RouterThread* +Master::thread(int id) const +{ + // return the requested thread, or the quiescent thread if there's no such + // thread + if (unsigned(id + 1) < unsigned(_nthreads)) + return _threads[id + 1]; + else + return _threads[0]; +} + +inline void +Master::wake_somebody() +{ + _threads[1]->wake(); +} + +#if CLICK_USERLEVEL +inline void +RouterThread::run_signals() +{ + if (Master::signals_pending) + _master->process_signals(this); +} + +inline int +TimerSet::next_timer_delay(bool more_tasks, Timestamp &t) const +{ +# if CLICK_NS + // The simulator should never block. + (void) more_tasks, (void) t; + return 0; +# else + if (more_tasks || Master::signals_pending) + return 0; + t = timer_expiry_steady_adjusted(); + if (!t) + return -1; // block forever + else if (unlikely(Timestamp::warp_jumping())) { + Timestamp::warp_jump_steady(t); + return 0; + } else if ((t -= Timestamp::now_steady(), !t.is_negative())) { + t = t.warp_real_delay(); + return 1; + } else + return 0; +# endif +} +#endif + +inline void +Master::request_stop() +{ + for (RouterThread **t = _threads; t != _threads + _nthreads; ++t) + (*t)->_stop_flag = true; + // ensure that at least one thread is awake to handle the stop event + wake_somebody(); +} + +inline void +Master::lock_master() +{ +#if CLICK_LINUXMODULE + if (current != _master_lock_task) { + spin_lock(&_master_lock); + _master_lock_task = current; + } else + _master_lock_count++; +#elif HAVE_MULTITHREAD + _master_lock.acquire(); +#endif +} + +inline void +Master::unlock_master() +{ +#if CLICK_LINUXMODULE + assert(current == _master_lock_task); + if (_master_lock_count == 0) { + _master_lock_task = 0; + spin_unlock(&_master_lock); + } else + _master_lock_count--; +#elif HAVE_MULTITHREAD + _master_lock.release(); +#endif +} + +inline void +Master::unpause() +{ + _master_paused--; +} + +inline Master * +Element::master() const +{ + return _router->master(); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/md5.h b/openflow/include/click/md5.h new file mode 100644 index 0000000..6023b07 --- /dev/null +++ b/openflow/include/click/md5.h @@ -0,0 +1,203 @@ +/* -*- related-file-name: "../../lib/md5.cc" -*- + Copyright (c) 2006-2007 Regents of the University of California + Altered for Click by Eddie Kohler. */ +/* + Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + L. Peter Deutsch + ghost@aladdin.com + + */ +/* + Independent implementation of MD5 (RFC 1321). + + This code implements the MD5 Algorithm defined in RFC 1321, whose + text is available at + http://www.ietf.org/rfc/rfc1321.txt + The code is derived from the text of the RFC, including the test suite + (section A.5) but excluding the rest of Appendix A. It does not include + any code or documentation that is identified in the RFC as being + copyrighted. + + The original and principal author of md5.h is L. Peter Deutsch + . Other authors are noted in the change history + that follows (in reverse chronological order): + + 2002-04-13 lpd Removed support for non-ANSI compilers; removed + references to Ghostscript; clarified derivation from RFC 1321; + now handles byte order either statically or dynamically. + 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. + 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); + added conditionalization for C++ compilation from Martin + Purschke . + 1999-05-03 lpd Original version. + */ + +#ifndef CLICK_MD5_H +#define CLICK_MD5_H +#if CLICK_LINUXMODULE +# include +CLICK_CXX_PROTECT +# include +# include +# if HAVE_LINUX_ASM_SCATTERLIST_H +# include +# endif +# include +CLICK_CXX_UNPROTECT +# include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) +typedef struct hash_desc md5_state_t; +#else +typedef struct crypto_tfm *md5_state_t; +#endif + +static inline int md5_init(md5_state_t *pms) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) + pms->tfm = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC); + if (IS_ERR(pms->tfm)) + return PTR_ERR(pms->tfm); + pms->flags = 0; + crypto_hash_init(pms); + return 0; +#else + *pms = crypto_alloc_tfm("md5", 0); + if (IS_ERR(*pms)) + return PTR_ERR(*pms); + crypto_digest_init(*pms); + return 0; +#endif +} + +static inline void md5_reinit(md5_state_t *pms) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) + crypto_hash_init(pms); +#else + crypto_digest_init(*pms); +#endif +} + +static inline void md5_append(md5_state_t *pms, const unsigned char *data, int nbytes) { + struct scatterlist sg; + if (likely(virt_addr_valid((unsigned long)data))) { + sg_init_one(&sg, const_cast(data), nbytes); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) + crypto_hash_update(pms, &sg, nbytes); +#else + crypto_digest_update(*pms, &sg, 1); +#endif + } else { + while (nbytes > 0) { + int len = nbytes; + int off = offset_in_page(data); + if (off + len > (int)PAGE_SIZE) + len = PAGE_SIZE - off; + sg_init_table(&sg, 1); + sg_set_page(&sg, vmalloc_to_page(const_cast(data)), len, off); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) + crypto_hash_update(pms, &sg, len); +#else + crypto_digest_update(*pms, &sg, 1); +#endif + data += len; + nbytes -= len; + } + } +} + +static inline void md5_finish(md5_state_t *pms, unsigned char digest[16]) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) + crypto_hash_final(pms, digest); +#else + crypto_digest_final(*pms, digest); +#endif +} + +static inline void md5_free(md5_state_t *pms) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) + crypto_free_hash(pms->tfm); +#else + crypto_free_tfm(*pms); +#endif +} + +#else + +/* + * This package supports both compile-time and run-time determination of CPU + * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be + * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is + * defined as non-zero, the code will be compiled to run only on big-endian + * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to + * run on either big- or little-endian CPUs, but will run slightly less + * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. + */ + +typedef unsigned char md5_byte_t; /* 8-bit byte */ +typedef uint32_t md5_word_t; /* 32-bit word */ + +/* Define the state of the MD5 Algorithm. */ +typedef struct md5_state_s { + md5_word_t count[2]; /* message length in bits, lsw first */ + md5_word_t abcd[4]; /* digest buffer */ + md5_byte_t buf[64]; /* accumulate block */ +} md5_state_t; + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Initialize the algorithm. */ +int md5_init(md5_state_t *pms); + +/* Re-initialize the algorithm after a prior md5_init(). */ +static inline void md5_reinit(md5_state_t *pms) { + md5_init(pms); +} + +/* Append a string to the message. */ +void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); + +/* Finish the message and return the digest. */ +#define MD5_DIGEST_SIZE 16 +void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); + +/* Finish the message and return the digest in ASCII. DOES NOT write a + terminating NUL character. + If 'allow_at == 0', the digest uses characters [A-Za-z0-9_], and has + length between MD5_TEXT_DIGEST_SIZE and MD5_TEXT_DIGEST_MAX_SIZE. + If 'allow_at != 0', the digest uses characters [A-Za-z0-9_@], and has + length of exactly MD5_TEXT_DIGEST_SIZE. + Returns the number of characters written. Again, this will NOT include + a terminating NUL. */ +#define MD5_TEXT_DIGEST_SIZE 22 /* min len */ +#define MD5_TEXT_DIGEST_MAX_SIZE 26 /* max len if !allow_at */ +int md5_finish_text(md5_state_t *pms, char *text_digest, int allow_at); + +#define md5_free(pms) /* do nothing */ + +#ifdef __cplusplus +} +#endif + +#endif +#endif + diff --git a/openflow/include/click/nameinfo.hh b/openflow/include/click/nameinfo.hh new file mode 100644 index 0000000..efd7a59 --- /dev/null +++ b/openflow/include/click/nameinfo.hh @@ -0,0 +1,528 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/nameinfo.cc" -*- +#ifndef CLICK_NAMEINFO_HH +#define CLICK_NAMEINFO_HH +#include +#include +CLICK_DECLS +class Element; +class NameDB; +class ErrorHandler; + +class NameInfo { public: + + /** @brief Construct a NameInfo element. + * + * Users never need to call this. */ + NameInfo(); + + /** @brief Destroy a NameInfo object. + * + * Also destroys all NameDB objects installed on this NameInfo. + * + * Users never need to call this. */ + ~NameInfo(); + + /** @brief Static initialization for NameInfo. + * + * Creates the global NameInfo used for databases unconnected to any + * router. Users never need to call this. */ + static void static_initialize(); + + /** @brief Static cleanup for NameInfo. + * + * Destroys the global NameInfo used for databases unconnected to any + * router. Users never need to call this. */ + static void static_cleanup(); + + /** @brief Known name database types. */ + enum DBType { + T_NONE = 0, ///< Nonexistent names database + T_SCHEDULEINFO = 0x00000001, ///< ScheduleInfo database + T_ANNOTATION = 0x00000002, ///< Packet annotation database + T_SCRIPT_INSN = 0x00000003, ///< Script instruction names database + T_SIGNO = 0x00000004, ///< User-level signal names database + T_SPINLOCK = 0x00000005, ///< Spinlock names database + T_ETHERNET_ADDR = 0x01000001, ///< Ethernet address names database + T_IP_ADDR = 0x04000001, ///< IP address names database + T_IP_PREFIX = 0x04000002, ///< IP prefix names database + T_IP_PROTO = 0x04000003, ///< IP protocol names database + T_IPFILTER_TYPE = 0x04000004, ///< IPFilter instruction names database + T_TCP_OPT = 0x04000005, ///< TCP option names database + T_IPREWRITER_PATTERN = 0x04000006, ///< IPRewriterPattern database + T_ICMP_TYPE = 0x04010000, ///< ICMP type names database + T_ICMP_CODE = 0x04010100, ///< ICMP code names database + T_IP_PORT = 0x04020000, ///< Starting point for IP per-protocol port names databases + T_TCP_PORT = 0x04020006, ///< TCP port names database + T_UDP_PORT = 0x04020011, ///< UDP port names database + T_IP_FIELDNAME = 0x04030000, ///< Starting point for IP per-protocol field names databases + T_ICMP_FIELDNAME = 0x04030001, ///< ICMP field names database + T_TCP_FIELDNAME = 0x04030006, ///< TCP field names database + T_UDP_FIELDNAME = 0x04030011, ///< UDP field names database + T_IP6_ADDR = 0x06000001, ///< IPv6 address names database + T_IP6_PREFIX = 0x06000002 ///< IPv6 prefix names database + }; + + /** @brief Find or create a name database. + * @param type database type + * @param context compound element context + * @param value_size size of values stored in database + * @param create whether to create a DynamicNameDB if no database exists + * + * Returns an installed name database matching @a type and @a context. + * (If @a context is non-null, then the database matches the implied + * router and compound element context. Otherwise, the database is the + * unique global database for the given @a type.) If @a create is true, + * and no database exists exactly matching @a type and @a context, then a + * DynamicNameDB is created and installed with that @a type, @a context, + * and @a value_size. Otherwise, the search bubbles up through the + * prefixes of @a context until an installed database is found. + * + * Returns null if no installed database is found. @a value_size must + * match the value size in the returned database. + * + * Most users will use query() and define() directly, not call getdb(). + */ + static NameDB *getdb(uint32_t type, const Element *context, + size_t value_size, bool create); + + /** @brief Install a name database. + * @param db name database + * @param context compound element context + * + * Installs the given name database for the compound element context + * implied by @a context. (If @a context is non-null, then the database + * is installed for the implied router and compound element context. If + * it is null, the database is installed globally.) The query() and + * define() operations apply only to installed databases. + * + * It is an error to install a database that has already been installed. + * It is also an error to install a database for a compound element + * context that already has a different database installed. An installed + * NameDB is automatically destroyed when its containing NameInfo is + * destroyed (for example, when @a context's router is destroyed). + */ + static void installdb(NameDB *db, const Element *context); + + /** @brief Uninstall a name database. + * @param db name database + * + * Undoes the effects of installdb(). The given database will no longer + * be used for query() and define() operations. + */ + static void uninstalldb(NameDB *db); + + /** @brief Query installed databases for @a name. + * @param type database type + * @param context compound element context + * @param name name to look up + * @param value_store value storage + * @param value_size size of value storage + * @return true iff the query succeeded + * + * Queries all installed @a type databases that apply to the compound + * element @a context, returning the most specific value matching @a name. + * The value is stored in @a value_store. The installed databases must + * have the given @a value_size. + */ + static bool query(uint32_t type, const Element *context, + const String &name, void *value_store, size_t value_size); + + /** @brief Query installed databases for @a name, returning a 32-bit integer value. + * @param type database type + * @param context compound element context + * @param name name to look up + * @param value_store value storage + * @return true iff the query succeeded + * + * Queries all installed @a type databases that apply to the compound + * element @a context, returning the most specific value matching @a name. + * The value is stored in @a value_store. The installed databases must + * have a value size of 4. + * + * If no matching name is found, query_int checks whether @a name unparses + * into a 32-bit integer value (for example, "30"). If so, *@a + * value_store is set to the corresponding integer and true is returned. + * Otherwise, false is returned. + */ + static bool query_int(uint32_t type, const Element *context, + const String &name, int32_t *value_store); + + /** @overload */ + static bool query_int(uint32_t type, const Element *context, + const String &name, uint32_t *value_store); + + /** @brief Query installed databases for @a value. + * @param type database type + * @param context compound element context + * @param value points to value to look up + * @param value_size size of value + * @return the name, or the empty string if the query failed + * + * Queries all installed @a type databases that apply to the compound + * element @a context, returning the name in the most specific database + * whose value matches @a value, or the empty string if the relevant + * databases don't support reverse queries or no such value exists. The + * installed databases must have the given @a value_size. + */ + static String revquery(uint32_t type, const Element *context, + const void *value, size_t value_size); + + /** @brief Query installed databases for a 32-bit integer @a value. + * @param type database type + * @param context compound element context + * @param value value to look up + * @return the name, or the empty string if the query failed + * + * Queries all installed @a type databases that apply to the compound + * element @a context, returning the name in the most specific database + * whose value matches @a value, or the empty string if the relevant + * databases don't support reverse queries or no such value exists. The + * installed databases must have value size 4. + */ + static inline String revquery_int(uint32_t type, const Element *context, + int32_t value); + + /** @brief Define @a name to equal @a value in the installed databases. + * @param type database type + * @param context compound element context + * @param name name to define + * @param value points to defined value + * @param value_size size of value + * @return true iff the name was defined + * + * Defines the given @a name to @a value in the installed @a type database + * with compound element @a context. If no database exists exactly + * matching that @a type and @a context, a new DynamicNameDB is created + * and installed with those values (and the given @a value_size). A name + * might not be defined if the existing database for that @a type and @a + * context doesn't support definitions, or if no new database can be + * created. If any database exists, it must match the given @a + * value_size. + */ + static inline bool define(uint32_t type, const Element *context, + const String &name, const void *value, size_t value_size); + + /** @brief Define @a name to equal 32-bit integer @a value in the installed databases. + * @param type database type + * @param context compound element context + * @param name name to define + * @param value defined value + * @return true iff the value was defined + * + * Defines the given @a name to @a value in the installed @a type database + * with compound element @a context. If no database exists exactly + * matching that @a type and @a context, a new DynamicNameDB is created + * and installed with those values (and value size 4). A name might not + * be defined if the existing database for that @a type and @a context + * doesn't support definitions, or if no new database can be created. If + * any database exists, it must have value size 4. + */ + static inline bool define_int(uint32_t type, const Element *context, + const String &name, int32_t value); + +#if CLICK_NAMEDB_CHECK + /** @cond never */ + void check(ErrorHandler *); + static void check(const Element *, ErrorHandler *); + /** @endcond never */ +#endif + + private: + + Vector _namedb_roots; + Vector _namedbs; + + inline NameDB *install_dynamic_sentinel() { return (NameDB *) this; } + NameDB *namedb(uint32_t type, size_t size, const String &prefix, NameDB *installer); + +#if CLICK_NAMEDB_CHECK + uintptr_t _check_generation; + void checkdb(NameDB *db, NameDB *parent, ErrorHandler *errh); +#endif + +}; + +class NameDB { public: + + /** @brief Construct a database. + * @param type database type + * @param context database compound element context, as a String + * @param value_size database value size + * + * @a value_size must be greater than 0. */ + inline NameDB(uint32_t type, const String &context, size_t value_size); + + /** @brief Destroy a database. + * + * Destroying an installed database automatically uninstalls it. + * See NameInfo::uninstalldb(). */ + virtual ~NameDB() { + NameInfo::uninstalldb(this); + } + + /** @brief Return the database type. */ + uint32_t type() const { + return _type; + } + + /** @brief Return the database's compound element context as a string. */ + const String &context() const { + return _context; + } + + /** @brief Return the contextual parent database, if any. + * + * The contextual parent database is the unique database, for the same + * router, with the same type(), whose context() is a prefix of this + * database's context(), that has the longest context() of any matching + * database. If there is no such database returns null. */ + NameDB *context_parent() const { + return _context_parent; + } + + /** @brief Return the database's value size. */ + size_t value_size() const { + return _value_size; + } + + /** @brief Query this database for a given name. + * @param name name to look up + * @param value points to value storage + * @param value_size size of value storage + * @return true iff the query succeeded + * + * The @a value_size parameter must equal this database's value size. */ + virtual bool query(const String &name, void *value, size_t value_size) = 0; + + /** @brief Query this database for a given value. + * @param value points to value to look up + * @param value_size size of value storage + * @return the name for the given value, or an empty string if the value + * has not been defined + * + * The @a value_size parameter must equal this database's value size. + * The default implementation always returns the empty string. */ + virtual String revquery(const void *value, size_t value_size); + + /** @brief Define a name in this database to a given value. + * @param name name to define + * @param value points to value to define + * @param value_size size of value storage + * @return true iff the name was defined + * + * The @a value_size parameter must equal this database's value size. + * The default implementation always returns false. */ + virtual bool define(const String &name, const void *value, size_t value_size); + + /** @brief Define a name in this database to a 32-bit integer value. + * @param name name to define + * @param value value to define + * @return true iff the name was defined + * + * The database's value size must equal 4. The implementation is the same + * as define(name, &value, 4). */ + inline bool define_int(const String &name, int32_t value); + +#if CLICK_NAMEDB_CHECK + /** @cond never */ + virtual void check(ErrorHandler *); + /** @endcond never */ +#endif + + private: + + uint32_t _type; + String _context; + size_t _value_size; + NameDB *_context_parent; + NameDB *_context_sibling; + NameDB *_context_child; + NameInfo *_installed; + +#if CLICK_NAMEDB_CHECK + uintptr_t _check_generation; +#endif + + friend class NameInfo; + +}; + +class StaticNameDB : public NameDB { public: + + struct Entry { + const char *name; + uint32_t value; + }; + + /** @brief Construct a static name database. + * @param type database type + * @param context database compound element context, as a String + * @param entry pointer to static entry list + * @param nentry number of entries + * + * The entry array specifies the contents of the database. It must be + * sorted by name: entry[i].name < entry[i+1].name for all 0 <= i < + * nentry-1. The entry array must also persist as long as the database is + * in use; the database doesn't copy the entry array into its own memory, + * but continues to use the array passed in. The resulting database has + * value_size() 4. */ + inline StaticNameDB(uint32_t type, const String &context, + const Entry *entry, size_t nentry); + + /** @brief Query this database for a given name. + * @param name name to look up + * @param value points to value storage + * @param value_size size of value storage + * @return true iff the query succeeded + * + * The @a value_size parameter must equal 4. */ + bool query(const String &name, void *value, size_t value_size); + + /** @brief Query this database for a given value. + * @param value points to value to look up + * @param value_size size of value storage + * @return the name for the given value, or an empty string if the value + * has not been defined + * + * The @a value_size parameter must equal 4. */ + String revquery(const void *value, size_t value_size); + +#if CLICK_NAMEDB_CHECK + /** @cond never */ + void check(ErrorHandler *); + /** @endcond never */ +#endif + + private: + + const Entry *_entries; + size_t _nentries; + +}; + +class DynamicNameDB : public NameDB { public: + + /** @brief Construct a dynamic name database. + * @param type database type + * @param context database compound element context, as a String + * @param value_size database value size + * + * @a value_size must be greater than 0. The database is initially + * empty. */ + inline DynamicNameDB(uint32_t type, const String &context, size_t value_size); + + /** @brief Query this database for a given name. + * @param name name to look up + * @param value points to value storage + * @param value_size size of value storage + * @return true iff the query succeeded + * + * The @a value_size parameter must equal this database's value size. */ + bool query(const String &name, void *value, size_t value_size); + + /** @brief Query this database for a given value. + * @param value points to value to look up + * @param value_size size of value storage + * @return the name for the given value, or an empty string if the value + * has not been defined + * + * The @a value_size parameter must equal this database's value size. */ + String revquery(const void *value, size_t value_size); + + /** @brief Define a name in this database to a given value. + * @param name name to define + * @param value points to value to define + * @param value_size size of value storage + * @return true iff the name was defined + * + * The @a value_size parameter must equal this database's value size. */ + bool define(const String &name, const void *value, size_t value_size); + +#if CLICK_NAMEDB_CHECK + /** @cond never */ + void check(ErrorHandler *); + /** @endcond never */ +#endif + + private: + + Vector _names; + StringAccum _values; + int _sorted; + + void *find(const String &name, bool create); + void sort(); + +}; + + +inline +NameDB::NameDB(uint32_t type, const String &context, size_t vsize) + : _type(type), _context(context), _value_size(vsize), + _context_parent(0), _context_sibling(0), _context_child(0), _installed(0) +{ +#if CLICK_NAMEDB_CHECK + _check_generation = 0; +#endif + assert(_value_size > 0); +} + +inline +StaticNameDB::StaticNameDB(uint32_t type, const String &context, const Entry *entry, size_t nentry) + : NameDB(type, context, sizeof(entry->value)), _entries(entry), _nentries(nentry) +{ +} + +inline +DynamicNameDB::DynamicNameDB(uint32_t type, const String &context, size_t vsize) + : NameDB(type, context, vsize), _sorted(0) +{ +} + +inline String +NameInfo::revquery_int(uint32_t type, const Element *e, int32_t value) +{ + return revquery(type, e, &value, sizeof(value)); +} + +inline bool +NameInfo::define(uint32_t type, const Element *e, const String &name, const void *value, size_t vsize) +{ + if (NameDB *db = getdb(type, e, vsize, true)) + return db->define(name, value, vsize); + else + return false; +} + +inline bool +NameInfo::define_int(uint32_t type, const Element *e, const String &name, const int32_t value) +{ + if (NameDB *db = getdb(type, e, sizeof(value), true)) + return db->define(name, &value, sizeof(value)); + else + return false; +} + +inline bool +NameDB::define_int(const String &name, const int32_t value) +{ + return define(name, &value, sizeof(value)); +} + + +/** @class NamedIntArg + @brief Parser class for named integers. */ +struct NamedIntArg { + NamedIntArg(uint32_t type) + : _type(type) { + } + bool parse(const String &str, int &value, const ArgContext &args) { + return NameInfo::query(_type, args.context(), str, + &value, sizeof(value)) + || IntArg().parse(str, value, args); + } + int _type; +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/notifier.hh b/openflow/include/click/notifier.hh new file mode 100644 index 0000000..71fed7a --- /dev/null +++ b/openflow/include/click/notifier.hh @@ -0,0 +1,730 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/notifier.cc" -*- +#ifndef CLICK_NOTIFIER_HH +#define CLICK_NOTIFIER_HH +#include +#include +#include +#if HAVE_CXX_PRAGMA_INTERFACE +# pragma interface "click/notifier.hh" +#endif +CLICK_DECLS + +class NotifierSignal { + public: + typedef bool (NotifierSignal::*unspecified_bool_type)() const; + + inline NotifierSignal(); + inline NotifierSignal(atomic_uint32_t* value, uint32_t mask); + inline NotifierSignal(const NotifierSignal& x); + inline ~NotifierSignal(); + + static inline NotifierSignal idle_signal(); + static inline NotifierSignal busy_signal(); + static inline NotifierSignal overderived_signal(); + static inline NotifierSignal uninitialized_signal(); + + inline bool active() const; + inline operator unspecified_bool_type() const; + + inline bool set_active(bool active); + + inline bool idle() const; + inline bool busy() const; + inline bool overderived() const; + inline bool initialized() const; + + friend bool operator==(const NotifierSignal &a, const NotifierSignal &b); + friend bool operator!=(const NotifierSignal &a, const NotifierSignal &b); + + NotifierSignal& operator=(const NotifierSignal& x); + NotifierSignal& operator+=(const NotifierSignal& x); + friend NotifierSignal operator+(NotifierSignal a, const NotifierSignal &b); + + inline void swap(NotifierSignal& x); + + String unparse(Router *router) const; + + static void static_initialize(); + + private: + struct vmpair { + atomic_uint32_t *value; + uint32_t mask; + }; + union vmvalue { + atomic_uint32_t *v1; + vmpair *vm; + }; + + vmvalue _v; + uint32_t _mask; + + enum { + true_mask = 1, false_mask = 2, overderived_mask = 4, + uninitialized_mask = 8 + }; + static atomic_uint32_t static_value; + + void hard_assign_vm(const NotifierSignal &x); + void hard_derive_one(atomic_uint32_t *value, uint32_t mask); + static bool hard_equals(const vmpair *a, const vmpair *b); +}; + +class Notifier { public: + + enum SearchOp { SEARCH_STOP = 0, SEARCH_CONTINUE, SEARCH_CONTINUE_WAKE }; + typedef void (*callback_type)(void *, Notifier *); + + inline Notifier(SearchOp op = SEARCH_STOP); + inline Notifier(const NotifierSignal &signal, SearchOp op = SEARCH_STOP); + virtual ~Notifier(); + + /** @brief Return whether the Notifier is initialized. */ + inline bool initialized() const { + return _signal.initialized(); + } + + int initialize(const char *name, Router *router); + + inline const NotifierSignal &signal() const; + inline SearchOp search_op() const; + + inline bool active() const; + + inline bool set_active(bool active); + inline void wake(); + inline void sleep(); + + virtual int add_activate_callback(callback_type f, void *user_data); + virtual void remove_activate_callback(callback_type f, void *user_data); + inline int add_listener(Task *task); + inline void remove_listener(Task *task); + inline int add_dependent_signal(NotifierSignal *signal); + inline void remove_dependent_signal(NotifierSignal *signal); + + static const char EMPTY_NOTIFIER[]; + static const char FULL_NOTIFIER[]; + + static inline NotifierSignal upstream_empty_signal(Element *e, int port); + static inline NotifierSignal upstream_empty_signal(Element *e, int port, Task *task); + static inline NotifierSignal upstream_empty_signal(Element *e, int port, Notifier *dependent_notifier); + static NotifierSignal upstream_empty_signal(Element *e, int port, callback_type f, void *user_data); + + static inline NotifierSignal downstream_full_signal(Element *e, int port); + static inline NotifierSignal downstream_full_signal(Element *e, int port, Task *task); + static inline NotifierSignal downstream_full_signal(Element *e, int port, Notifier *dependent_notifier); + static NotifierSignal downstream_full_signal(Element *e, int port, callback_type f, void *user_data); + + static inline NotifierSignal upstream_empty_signal(Element *e, int port, int) CLICK_DEPRECATED; + static inline NotifierSignal upstream_empty_signal(Element *e, int port, int, Notifier *) CLICK_DEPRECATED; + static inline NotifierSignal downstream_full_signal(Element *e, int port, int) CLICK_DEPRECATED; + static inline NotifierSignal downstream_full_signal(Element *e, int port, int, Notifier *) CLICK_DEPRECATED; + + private: + + NotifierSignal _signal; + SearchOp _search_op; + + static void dependent_signal_callback(void *, Notifier *); + +}; + +class ActiveNotifier : public Notifier { public: + + ActiveNotifier(SearchOp op = SEARCH_STOP); + ~ActiveNotifier(); + + int add_activate_callback(callback_type f, void *v); + void remove_activate_callback(callback_type f, void *v); + void listeners(Vector &v) const CLICK_DEPRECATED; + + inline void set_active(bool active, bool schedule = true); + inline void wake(); + inline void sleep(); + +#if CLICK_DEBUG_SCHEDULING + String unparse(Router *router) const; +#endif + + private: + + typedef union { + Task *t; + callback_type f; + void *v; + uintptr_t p; + } task_or_signal_t; + + Task* _listener1; + task_or_signal_t* _listeners; + + int listener_add(callback_type f, void *v); + int listener_remove(callback_type f, void *v); + + ActiveNotifier(const ActiveNotifier&); // does not exist + ActiveNotifier& operator=(const ActiveNotifier&); // does not exist + +}; + + +/** @brief Construct a busy signal. + * + * The returned signal is always active. */ +inline NotifierSignal::NotifierSignal() + : _mask(true_mask) { + _v.v1 = &static_value; +} + +/** @brief Construct an activity signal. + * + * Elements should not use this constructor directly. + * @sa Router::new_notifier_signal */ +inline NotifierSignal::NotifierSignal(atomic_uint32_t* value, uint32_t mask) + : _mask(mask) { + _v.v1 = value; +} + +/** @brief Copy construct a signal. */ +inline NotifierSignal::NotifierSignal(const NotifierSignal& x) + : _mask(x._mask) { + if (likely(_mask)) + _v.v1 = x._v.v1; + else + hard_assign_vm(x); +} + +/** @brief Destroy a signal. */ +inline NotifierSignal::~NotifierSignal() { + if (unlikely(_mask == 0)) + delete[] _v.vm; +} + +/** @brief Return an idle signal. + * + * The returned signal is never active. */ +inline NotifierSignal NotifierSignal::idle_signal() { + return NotifierSignal(&static_value, false_mask); +} + +/** @brief Return a busy signal. + * + * The returned signal is always active. */ +inline NotifierSignal NotifierSignal::busy_signal() { + return NotifierSignal(&static_value, true_mask); +} + +/** @brief Return an overderived busy signal. + * + * Overderived signals replace derived signals that are too complex to + * represent. An overderived signal, like a busy signal, is always + * active. */ +inline NotifierSignal NotifierSignal::overderived_signal() { + return NotifierSignal(&static_value, overderived_mask | true_mask); +} + +/** @brief Return an uninitialized signal. + * + * Uninitialized signals may be used occasionally as placeholders for true + * signals to be added later. Uninitialized signals are never active. */ +inline NotifierSignal NotifierSignal::uninitialized_signal() { + return NotifierSignal(&static_value, uninitialized_mask); +} + +/** @brief Test if the signal is active. */ +inline bool NotifierSignal::active() const { + // 2012.May.16 This fence is necessary; consider, for example, + // InfiniteSource's checking of nonfull notifiers. + click_fence(); + if (likely(_mask)) + return (*_v.v1 & _mask) != 0; + else { + for (vmpair *vm = _v.vm; vm->mask; ++vm) + if ((*vm->value & vm->mask) != 0) + return true; + return false; + } +} + +/** @brief Test if the signal is active. */ +inline NotifierSignal::operator unspecified_bool_type() const { + return active() ? &NotifierSignal::active : 0; +} + +/** @brief Test if the signal is idle. + * @return true iff the signal is idle, i.e. it will never be active. */ +inline bool NotifierSignal::idle() const { + return (_mask == false_mask && _v.v1 == &static_value); +} + +/** @brief Test if the signal is busy. + * @return true iff the signal is busy, i.e. it will always be active. + * + * @note An overderived_signal() is busy(), but a busy_signal() is not + * overderived(). */ +inline bool NotifierSignal::busy() const { + return ((_mask & true_mask) && _v.v1 == &static_value); +} + +/** @brief Test if the signal is overderived. + * @return true iff the signal equals overderived_signal(). + * + * @note An overderived_signal() is busy(), but a busy_signal() is not + * overderived(). */ +inline bool NotifierSignal::overderived() const { + return ((_mask & overderived_mask) && _v.v1 == &static_value); +} + +/** @brief Test if the signal is initialized. + * @return true iff the signal doesn't equal uninitialized_signal(). */ +inline bool NotifierSignal::initialized() const { + return (!(_mask & uninitialized_mask) || _v.v1 != &static_value); +} + +/** @brief Set whether the basic signal is active. + * @param active true iff the basic signal is active + * @return previous active state + * + * Use this function to set whether a basic signal is active. + * + * It is illegal to call set_active() on derived, idle, busy, or + * overderived signals. Some of these actions may cause an assertion + * failure. */ +inline bool NotifierSignal::set_active(bool active) { + assert(_v.v1 != &static_value && !(_mask & (_mask - 1))); + uint32_t expected = *_v.v1; +#if !CLICK_USERLEVEL || HAVE_MULTITHREAD + while (_mask) { + uint32_t desired = (active ? expected | _mask : expected & ~_mask); + uint32_t actual = _v.v1->compare_swap(expected, desired); + if (expected == actual) + break; + expected = actual; + } +#else + *_v.v1 = (active ? expected | _mask : expected & ~_mask); +#endif + return expected & _mask; +} + +/** @brief Assign a signal. */ +inline NotifierSignal& NotifierSignal::operator=(const NotifierSignal& x) { + if (likely(this != &x)) { + if (unlikely(_mask == 0)) + delete[] _v.vm; + _mask = x._mask; + if (likely(_mask)) + _v.v1 = x._v.v1; + else + hard_assign_vm(x); + } + return *this; +} + +/** @brief Exchange the values of this signal and @a x. */ +inline void NotifierSignal::swap(NotifierSignal& x) { + click_swap(_v, x._v); + click_swap(_mask, x._mask); +} + +/** @relates NotifierSignal + * @brief Test if two NotifierSignals are equal. + * + * Returns true iff the two NotifierSignals are the same -- i.e., they + * combine information about exactly the same sets of basic signals. + * + * All idle() signals compare equal. busy_signal() and + * overderived_signal() do not compare equal, however. */ +inline bool operator==(const NotifierSignal& a, const NotifierSignal& b) { + if (a._mask == b._mask) { + if (likely(a._mask)) + return a._v.v1 == b._v.v1; + else + return NotifierSignal::hard_equals(a._v.vm, b._v.vm); + } else + return false; +} + +/** @relates NotifierSignal + * @brief Test if two NotifierSignals are unequal. + * + * Returns true iff !(@a a == @a b). */ +inline bool operator!=(const NotifierSignal& a, const NotifierSignal& b) { + return !(a == b); +} + +/** @relates NotifierSignal + * @brief Return a derived signal. + * + * Returns a derived signal that combines information from its arguments. + * The result will be active whenever @a a and/or @a b is active. If the + * combination of @a a and @a b is too complex to represent, returns an + * overderived signal; this trivially follows the invariant since it is + * always active. + * + * Signal derivation is commutative and associative. The following + * special combinations are worth remembering: + * + * - An uninitialized signal plus any other signal is uninitialized. + * - An idle signal plus any signal @a a equals @a a. + * - A busy signal plus any other initialized signal is busy. + * - overderived_signal() plus busy_signal() equals busy_signal(). + * + * @sa NotifierSignal::operator+= */ +inline NotifierSignal operator+(NotifierSignal a, const NotifierSignal& b) { + return a += b; +} + +/** @brief Constructs a Notifier. + * @param op controls notifier path search + * + * This function constructs a Notifier object. The Notifier's associated + * NotifierSignal is initially idle; it becomes associated with a signal after + * initialize() is called. + * + * The @a op argument controls path search. The rest of this entry + * describes it further. + * + * Elements interested in notification generally search for Notifier objects + * along all possible packet paths upstream (or downstream) of one of their + * ports. When a Notifier is found along a path, further searching along that + * path is cut off, so only the closest Notifiers are found. Sometimes, + * however, it makes more sense to continue searching for more Notifiers. The + * correct behavior is Notifier-specific, and is controlled by this method. + * When the search encounters a Notifier, it consults the Notifier's @a + * op variable supplied to the constructor. It should equal one of + * three SearchOp constants, which correspond to the following behavior: + * + *
+ *
SEARCH_STOP
+ *
Stop searching along this path. This is the default.
+ *
SEARCH_CONTINUE
+ *
Continue searching along this path.
+ *
SEARCH_CONTINUE_WAKE
+ *
Continue searching along this path, but any further Notifiers should + * only be used for adding and removing listeners; ignore their NotifierSignal + * objects. This operation is useful, for example, for schedulers that store + * packets temporarily. Such schedulers provide their own NotifierSignal, + * since the scheduler may still hold a packet even when all upstream sources + * are empty, but since they aren't packet sources, they don't know when + * new packets arrive and can't wake up sleeping listeners. During + * initialization, such schedulers should call Notifier::upstream_empty_signal, + * passing their own Notifier as the fourth argument. This will ensure that + * their signal is turned on appropriately whenever an upstream queue becomes + * nonempty.
+ *
+ */ +inline Notifier::Notifier(SearchOp op) + : _signal(NotifierSignal::uninitialized_signal()), _search_op(op) { +} + +/** @brief Constructs a Notifier associated with a given signal. + * @param signal the associated NotifierSignal + * @param op controls notifier path search + * + * This function constructs a Notifier object associated with a specific + * NotifierSignal, such as NotifierSignal::idle_signal(). Calling + * initialize() on this Notifier will not change the associated + * NotifierSignal. The @a op argument is as in + * Notifier::Notifier(SearchOp), above. + */ +inline Notifier::Notifier(const NotifierSignal &signal, SearchOp op) + : _signal(signal), _search_op(op) { +} + +/** @brief Return this Notifier's associated NotifierSignal. + * + * Every Notifier object corresponds to one NotifierSignal; this method + * returns it. The signal is @link NotifierSignal::idle idle() @endlink + * before initialize() is called. + */ +inline const NotifierSignal& Notifier::signal() const { + return _signal; +} + +/** @brief Return this Notifier's search operation. + * + * @sa Notifier() for a detailed explanation of search operations. + */ +inline Notifier::SearchOp Notifier::search_op() const { + return _search_op; +} + +/** @brief Returns whether the associated signal is active. + * + * Same as signal().active(). + */ +inline bool Notifier::active() const { + return _signal.active(); +} + +/** @brief Set the associated signal's activity. + * @param active true iff the signal should be active + * @return previous active state + */ +inline bool Notifier::set_active(bool active) { + return _signal.set_active(active); +} + +/** @brief Set the associated signal to active. + * @sa set_active + */ +inline void Notifier::wake() { + set_active(true); +} + +/** @brief Set the associated signal to inactive. + * @sa set_active + */ +inline void Notifier::sleep() { + set_active(false); +} + +/** @brief Register a listener with this Notifier. + * @param task Task to reschedule when this Notifier becomes active + * + * When this Notifier's associated signal is activated, the Notifier should + * schedule @a task. Not all types of Notifier provide this functionality. The + * default implementation does nothing. + * + * @sa remove_listener, add_activate_callback, add_dependent_signal + */ +inline int Notifier::add_listener(Task* task) { + return add_activate_callback(0, task); +} + +/** @brief Unregister a listener with this Notifier. + * @param task listener Task + * + * Undoes the effect of all prior add_listener(@a task) calls. Does nothing if + * @a task was never added. The default implementation does nothing. + * + * @sa add_listener + */ +inline void Notifier::remove_listener(Task* task) { + remove_activate_callback(0, task); +} + +/** @brief Register a dependent signal with this Notifier. + * @param signal dependent signal + * + * When this Notifier's associated signal is activated, the Notifier should + * also activate @a signal. Not all types of Notifier provide this + * functionality. The default implementation does nothing. + * + * @sa add_listener, add_activate_callback, remove_dependent_signal + */ +inline int Notifier::add_dependent_signal(NotifierSignal* signal) { + return add_activate_callback(dependent_signal_callback, signal); +} + +/** @brief Unregister a dependent signal with this Notifier. + * @param signal dependent signal + * + * Undoes the effect of all prior add_dependent_signal(@a signal) calls. Does + * nothing if @a signal was never added. The default implementation does + * nothing. + * + * @sa add_dependent_signal + */ +inline void Notifier::remove_dependent_signal(NotifierSignal* signal) { + remove_activate_callback(dependent_signal_callback, signal); +} + +/** @brief Calculate and return the NotifierSignal derived from all empty + * notifiers upstream of element @a e's input @a port. + * @param e an element + * @param port the input port of @a e at which to start the upstream search + * + * Searches the configuration upstream of element @a e's input @a port for @e + * empty @e notifiers. These notifiers are associated with packet storage, + * and should be true when packets are available (or likely to be available + * quite soon), and false when they are not. All notifiers found are combined + * into a single derived signal. Thus, if any of the base notifiers are + * active, indicating that at least one packet is available upstream, the + * derived signal will also be active. Element @a e's code generally uses the + * resulting signal to decide whether or not to reschedule itself. + * + * The returned signal is generally conservative, meaning that the signal + * is true whenever a packet exists upstream, but the elements that provide + * notification are responsible for ensuring this. + * + * Overloaded versions of this function can also register a task (as in + * add_listener()), a signal (as in add_dependent_notifier()), or a callback + * function (as in add_active_callback()) for each located notifier. When + * packets become available, the task will be scheduled, the signal will be + * activated, or the callback will be called. + * + *

Supporting upstream_empty_signal()

+ * + * Elements that have an empty notifier must override the Element::cast() + * method. When passed the @a name Notifier::EMPTY_NOTIFIER, this method + * should return a pointer to the corresponding Notifier object. + * + * @sa downstream_full_signal + */ +inline NotifierSignal Notifier::upstream_empty_signal(Element* e, int port) { + return upstream_empty_signal(e, port, (callback_type) 0, 0); +} + +/** @brief Calculate and return the NotifierSignal derived from all empty + * notifiers upstream of element @a e's input @a port. + * @param e an element + * @param port the input port of @a e at which to start the upstream search + * @param task task to schedule when packets become available + * @sa add_listener */ +inline NotifierSignal Notifier::upstream_empty_signal(Element* e, int port, + Task* task) { + return upstream_empty_signal(e, port, (callback_type) 0, task); +} + +/** @brief Calculate and return the NotifierSignal derived from all empty + * notifiers upstream of element @a e's input @a port. + * @param e an element + * @param port the input port of @a e at which to start the upstream search + * @param notifier notifier to activate when packets become available + * @sa add_dependent_signal */ +inline NotifierSignal Notifier::upstream_empty_signal(Element* e, int port, + Notifier* dependent_notifier) { + return upstream_empty_signal(e, port, dependent_signal_callback, &dependent_notifier->_signal); +} + +/** @brief Calculate and return the NotifierSignal derived from all full + * notifiers downstream of element @a e's output @a port. + * @param e an element + * @param port the output port of @a e at which to start the downstream search + * + * Searches the configuration downstream of element @a e's output @a port for + * @e full @e notifiers. These notifiers are associated with packet storage, + * and should be true when there is space for at least one packet, and false + * when there is not. All notifiers found are combined into a single derived + * signal. Thus, if any of the base notifiers are active, indicating that at + * least one path has available space, the derived signal will also be active. + * Element @a e's code generally uses the resulting signal to decide whether + * or not to reschedule itself. + * + * Overloaded versions of this function can also register a task (as in + * add_listener()), a signal (as in add_dependent_notifier()), or a callback + * function (as in add_active_callback()) for each located notifier. When + * space becomes available, the task will be scheduled, the signal will be + * activated, or the callback will be called. + * + * In current Click, the returned signal is conservative: if it's inactive, + * then there is no space for packets downstream. + * + *

Supporting downstream_full_signal()

+ * + * Elements that have a full notifier must override the Element::cast() + * method. When passed the @a name Notifier::FULL_NOTIFIER, this method + * should return a pointer to the corresponding Notifier object. + * + * @sa upstream_empty_signal + */ +inline NotifierSignal Notifier::downstream_full_signal(Element* e, int port) { + return downstream_full_signal(e, port, (callback_type) 0, 0); +} + +/** @brief Calculate and return the NotifierSignal derived from all full + * notifiers downstream of element @a e's output @a port. + * @param e an element + * @param port the output port of @a e at which to start the downstream search + * @param task task to schedule when packets become available + * @sa add_listener */ +inline NotifierSignal Notifier::downstream_full_signal(Element* e, int port, + Task* task) { + return downstream_full_signal(e, port, (callback_type) 0, task); +} + +/** @brief Calculate and return the NotifierSignal derived from all full + * notifiers downstream of element @a e's output @a port. + * @param e an element + * @param port the output port of @a e at which to start the downstream search + * @param notifier notifier to activate when packets become available + * @sa add_dependent_signal */ +inline NotifierSignal Notifier::downstream_full_signal(Element* e, int port, + Notifier* dependent_notifier) { + return downstream_full_signal(e, port, dependent_signal_callback, &dependent_notifier->_signal); +} + +/** @cond never */ +inline NotifierSignal Notifier::upstream_empty_signal(Element* e, int port, int x) { + (void) x; + assert(x == 0); + return upstream_empty_signal(e, port); +} + +inline NotifierSignal Notifier::upstream_empty_signal(Element* e, int port, int x, + Notifier* notifier) { + (void) x; + assert(x == 0); + return upstream_empty_signal(e, port, notifier); +} + +inline NotifierSignal Notifier::downstream_full_signal(Element* e, int port, int x) { + (void) x; + assert(x == 0); + return downstream_full_signal(e, port); +} + +inline NotifierSignal Notifier::downstream_full_signal(Element* e, int port, int x, + Notifier* notifier) { + (void) x; + assert(x == 0); + return downstream_full_signal(e, port, notifier); +} +/** @endcond never */ + +/** @brief Set the associated signal's activity, possibly scheduling any + * listener tasks. + * @param active true iff the signal should be active + * @param schedule if true, wake up listener tasks + * + * If @a active and @a schedule are both true, and the signal was previously + * inactive, then any listener Tasks are scheduled with Task::reschedule(). + * + * @sa wake, sleep, add_listener + */ +inline void ActiveNotifier::set_active(bool active, bool schedule) { + bool was_active = Notifier::set_active(active); + if (active && schedule && !was_active) { + // 2007.Sep.6: Perhaps there was a race condition here. Make sure + // that we set the notifier to active BEFORE rescheduling downstream + // tasks. This is because, in a multithreaded environment, a task we + // reschedule might run BEFORE we set the notifier; after which it + // would go to sleep forever. + if (_listener1) + _listener1->reschedule(); + else if (task_or_signal_t *tos = _listeners) { + for (; tos->p > 1; tos++) + tos->t->reschedule(); + if (tos->p == 1) + for (tos++; tos->p; tos += 2) + tos->f(tos[1].v, this); + } + } +} + +/** @brief Set the associated signal to active and schedule any listener + * tasks. + * + * If the signal was previously inactive, then any listener Tasks are + * scheduled with Task::reschedule(). + * + * @sa set_active, add_listener + */ +inline void ActiveNotifier::wake() { + set_active(true, true); +} + +/** @brief Set the associated signal to inactive. + * @sa set_active + */ +inline void ActiveNotifier::sleep() { + set_active(false, true); +} + +inline void click_swap(NotifierSignal& x, NotifierSignal& y) { + x.swap(y); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/package.hh b/openflow/include/click/package.hh new file mode 100644 index 0000000..6f3c3b5 --- /dev/null +++ b/openflow/include/click/package.hh @@ -0,0 +1,30 @@ +#ifndef CLICK_PACKAGE_HH +#define CLICK_PACKAGE_HH +#include +#include +CLICK_DECLS +#ifndef CLICK_TOOL +class Element; +#endif +CLICK_ENDDECLS + +extern "C" { + +void click_provide(const char *); +void click_unprovide(const char *); +bool click_has_provision(const char *); +void click_public_packages(CLICK_NAME(Vector) &); + +#if CLICK_LINUXMODULE +int click_add_element_type(const char *element_name, CLICK_NAME(Element) *(*factory)(uintptr_t thunk), uintptr_t thunk, struct module *); +int click_add_element_type_stable(const char *element_name, CLICK_NAME(Element) *(*factory)(uintptr_t thunk), uintptr_t thunk, struct module *); +void click_remove_element_type(int); +#elif !CLICK_TOOL +int click_add_element_type(const char *element_name, CLICK_NAME(Element) *(*factory)(uintptr_t thunk), uintptr_t thunk); +int click_add_element_type_stable(const char *element_name, CLICK_NAME(Element) *(*factory)(uintptr_t thunk), uintptr_t thunk); +void click_remove_element_type(int); +#endif + +} + +#endif diff --git a/openflow/include/click/packet.hh b/openflow/include/click/packet.hh new file mode 100644 index 0000000..9ec693f --- /dev/null +++ b/openflow/include/click/packet.hh @@ -0,0 +1,2434 @@ +// -*- related-file-name: "../../lib/packet.cc" -*- +#ifndef CLICK_PACKET_HH +#define CLICK_PACKET_HH +#include +#include +#include +#if CLICK_LINUXMODULE +# include +#else +# include +#endif +#if CLICK_BSDMODULE +# include +#endif +#if CLICK_NS +# include +#endif +#if (CLICK_USERLEVEL || CLICK_NS || CLICK_MINIOS) && (!HAVE_MULTITHREAD || HAVE___THREAD_STORAGE_CLASS) +# define HAVE_CLICK_PACKET_POOL 1 +#endif +#ifndef CLICK_PACKET_DEPRECATED_ENUM +# define CLICK_PACKET_DEPRECATED_ENUM CLICK_DEPRECATED_ENUM +#endif +struct click_ether; +struct click_ip; +struct click_icmp; +struct click_ip6; +struct click_tcp; +struct click_udp; +CLICK_DECLS + +class IP6Address; +class WritablePacket; + +class Packet { public: + + /** @name Data */ + //@{ + // PACKET CREATION + + enum { +#ifdef CLICK_MINIOS + default_headroom = 48, ///< Increase headroom for improved performance. +#else + default_headroom = 28, ///< Default packet headroom() for + /// Packet::make(). 4-byte aligned. +#endif + min_buffer_length = 64 ///< Minimum buffer_length() for + /// Packet::make() + }; + + static WritablePacket *make(uint32_t headroom, const void *data, + uint32_t length, uint32_t tailroom) CLICK_WARN_UNUSED_RESULT; + static inline WritablePacket *make(const void *data, uint32_t length) CLICK_WARN_UNUSED_RESULT; + static inline WritablePacket *make(uint32_t length) CLICK_WARN_UNUSED_RESULT; +#if CLICK_LINUXMODULE + static Packet *make(struct sk_buff *skb) CLICK_WARN_UNUSED_RESULT; +#endif +#if CLICK_BSDMODULE + // Packet::make(mbuf *) wraps a Packet around an existing mbuf. + // Packet now owns the mbuf. + static inline Packet *make(struct mbuf *mbuf) CLICK_WARN_UNUSED_RESULT; +#endif +#if CLICK_USERLEVEL || CLICK_MINIOS + typedef void (*buffer_destructor_type)(unsigned char* buf, size_t sz, void* argument); + static WritablePacket* make(unsigned char* data, uint32_t length, + buffer_destructor_type buffer_destructor, + void* argument = (void*) 0, int headroom = 0, int tailroom = 0) CLICK_WARN_UNUSED_RESULT; +#endif + + static void static_cleanup(); + + inline void kill(); + + inline bool shared() const; + Packet *clone() CLICK_WARN_UNUSED_RESULT; + inline WritablePacket *uniqueify() CLICK_WARN_UNUSED_RESULT; + + inline const unsigned char *data() const; + inline const unsigned char *end_data() const; + inline uint32_t length() const; + inline uint32_t headroom() const; + inline uint32_t tailroom() const; + inline const unsigned char *buffer() const; + inline const unsigned char *end_buffer() const; + inline uint32_t buffer_length() const; + +#if CLICK_LINUXMODULE + struct sk_buff *skb() { return (struct sk_buff *)this; } + const struct sk_buff *skb() const { return (const struct sk_buff*)this; } +#elif CLICK_BSDMODULE + struct mbuf *m() { return _m; } + const struct mbuf *m() const { return (const struct mbuf *)_m; } + struct mbuf *steal_m(); + struct mbuf *dup_jumbo_m(struct mbuf *mbuf); +#elif CLICK_USERLEVEL || CLICK_MINIOS + buffer_destructor_type buffer_destructor() const { + return _destructor; + } + + void set_buffer_destructor(buffer_destructor_type destructor) { + _destructor = destructor; + } + + void* destructor_argument() { + return _destructor_argument; + } + + void reset_buffer() { + assert(!shared()); + _head = _data = _tail = _end = 0; + _destructor = 0; + } +#endif + + + /** @brief Add space for a header before the packet. + * @param len amount of space to add + * @return packet with added header space, or null on failure + * + * Returns a packet with an additional @a len bytes of uninitialized space + * before the current packet's data(). A copy of the packet data is made + * if there isn't enough headroom() in the current packet, or if the + * current packet is shared(). If no copy is made, this operation is + * quite efficient. + * + * If a data copy would be required, but the copy fails because of lack of + * memory, then the current packet is freed. + * + * push() is usually used like this: + * @code + * WritablePacket *q = p->push(14); + * if (!q) + * return 0; + * // p must not be used here. + * @endcode + * + * @post new length() == old length() + @a len (if no failure) + * + * @sa nonunique_push, push_mac_header, pull */ + WritablePacket *push(uint32_t len) CLICK_WARN_UNUSED_RESULT; + + /** @brief Add space for a MAC header before the packet. + * @param len amount of space to add and length of MAC header + * @return packet with added header space, or null on failure + * + * Combines the action of push() and set_mac_header(). @a len bytes are + * pushed for a MAC header, and on success, the packet's returned MAC and + * network header pointers are set as by set_mac_header(data(), @a len). + * + * @sa push */ + WritablePacket *push_mac_header(uint32_t len) CLICK_WARN_UNUSED_RESULT; + + /** @brief Add space for a header before the packet. + * @param len amount of space to add + * @return packet with added header space, or null on failure + * + * This is a variant of push(). Returns a packet with an additional @a + * len bytes of uninitialized space before the current packet's data(). A + * copy of the packet data is made if there isn't enough headroom() in the + * current packet. However, no copy is made if the current packet is + * shared; and if no copy is made, this operation is quite efficient. + * + * If a data copy would be required, but the copy fails because of lack of + * memory, then the current packet is freed. + * + * @note Unlike push(), nonunique_push() returns a Packet object, which + * has non-writable data. + * + * @sa push */ + Packet *nonunique_push(uint32_t len) CLICK_WARN_UNUSED_RESULT; + + /** @brief Remove a header from the front of the packet. + * @param len amount of space to remove + * + * Removes @a len bytes from the initial part of the packet, usually + * corresponding to some network header (for example, pull(14) removes an + * Ethernet header). This operation is efficient: it just bumps a + * pointer. + * + * It is an error to attempt to pull more than length() bytes. + * + * @post new data() == old data() + @a len + * @post new length() == old length() - @a len + * + * @sa push */ + void pull(uint32_t len); + + /** @brief Add space for data after the packet. + * @param len amount of space to add + * @return packet with added trailer space, or null on failure + * + * Returns a packet with an additional @a len bytes of uninitialized space + * after the current packet's data (starting at end_data()). A copy of + * the packet data is made if there isn't enough tailroom() in the current + * packet, or if the current packet is shared(). If no copy is made, this + * operation is quite efficient. + * + * If a data copy would be required, but the copy fails because of lack of + * memory, then the current packet is freed. + * + * put() is usually used like this: + * @code + * WritablePacket *q = p->put(100); + * if (!q) + * return 0; + * // p must not be used here. + * @endcode + * + * @post new length() == old length() + @a len (if no failure) + * + * @sa nonunique_put, take */ + WritablePacket *put(uint32_t len) CLICK_WARN_UNUSED_RESULT; + + /** @brief Add space for data after the packet. + * @param len amount of space to add + * @return packet with added trailer space, or null on failure + * + * This is a variant of put(). Returns a packet with an additional @a len + * bytes of uninitialized space after the current packet's data (starting + * at end_data()). A copy of the packet data is made if there isn't + * enough tailroom() in the current packet. However, no copy is made if + * the current packet is shared; and if no copy is made, this operation is + * quite efficient. + * + * If a data copy would be required, but the copy fails because of lack of + * memory, then the current packet is freed. + * + * @sa put */ + Packet *nonunique_put(uint32_t len) CLICK_WARN_UNUSED_RESULT; + + /** @brief Remove space from the end of the packet. + * @param len amount of space to remove + * + * Removes @a len bytes from the end of the packet. This operation is + * efficient: it just bumps a pointer. + * + * It is an error to attempt to pull more than length() bytes. + * + * @post new data() == old data() + * @post new end_data() == old end_data() - @a len + * @post new length() == old length() - @a len + * + * @sa push */ + void take(uint32_t len); + + + /** @brief Shift packet data within the data buffer. + * @param offset amount to shift packet data + * @param free_on_failure if true, then delete the input packet on failure + * @return a packet with shifted data, or null on failure + * + * Useful to align packet data. For example, if the packet's embedded IP + * header is located at pointer value 0x8CCA03, then shift_data(1) or + * shift_data(-3) will both align the header on a 4-byte boundary. + * + * If the packet is shared() or there isn't enough headroom or tailroom + * for the operation, the packet is passed to uniqueify() first. This can + * fail if there isn't enough memory. If it fails, shift_data returns + * null, and if @a free_on_failure is true (the default), the input packet + * is freed. + * + * The packet's mac_header, network_header, and transport_header areas are + * preserved, even if they lie within the headroom. Any headroom outside + * these regions may be overwritten, as may any tailroom. + * + * @post new data() == old data() + @a offset (if no copy is made) + * @post new buffer() == old buffer() (if no copy is made) */ + Packet *shift_data(int offset, bool free_on_failure = true) CLICK_WARN_UNUSED_RESULT; +#if CLICK_USERLEVEL || CLICK_MINIOS + inline void shrink_data(const unsigned char *data, uint32_t length); + inline void change_headroom_and_length(uint32_t headroom, uint32_t length); +#endif + bool copy(Packet* p, int headroom=0); + //@} + + /** @name Header Pointers */ + //@{ + inline bool has_mac_header() const; + inline const unsigned char *mac_header() const; + inline int mac_header_offset() const; + inline uint32_t mac_header_length() const; + inline int mac_length() const; + inline void set_mac_header(const unsigned char *p); + inline void set_mac_header(const unsigned char *p, uint32_t len); + inline void clear_mac_header(); + + inline bool has_network_header() const; + inline const unsigned char *network_header() const; + inline int network_header_offset() const; + inline uint32_t network_header_length() const; + inline int network_length() const; + inline void set_network_header(const unsigned char *p, uint32_t len); + inline void set_network_header_length(uint32_t len); + inline void clear_network_header(); + + inline bool has_transport_header() const; + inline const unsigned char *transport_header() const; + inline int transport_header_offset() const; + inline int transport_length() const; + inline void clear_transport_header(); + + // CONVENIENCE HEADER ANNOTATIONS + inline const click_ether *ether_header() const; + inline void set_ether_header(const click_ether *ethh); + + inline const click_ip *ip_header() const; + inline int ip_header_offset() const; + inline uint32_t ip_header_length() const; + inline void set_ip_header(const click_ip *iph, uint32_t len); + + inline const click_ip6 *ip6_header() const; + inline int ip6_header_offset() const; + inline uint32_t ip6_header_length() const; + inline void set_ip6_header(const click_ip6 *ip6h); + inline void set_ip6_header(const click_ip6 *ip6h, uint32_t len); + + inline const click_icmp *icmp_header() const; + inline const click_tcp *tcp_header() const; + inline const click_udp *udp_header() const; + //@} + +#if CLICK_LINUXMODULE +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) && NET_SKBUFF_DATA_USES_OFFSET) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) + protected: + typedef typeof(((struct sk_buff*)0)->mac_header) mac_header_type; + typedef typeof(((struct sk_buff*)0)->network_header) network_header_type; + typedef typeof(((struct sk_buff*)0)->transport_header) transport_header_type; +# endif +#endif + + private: + /** @cond never */ + union Anno; +#if CLICK_LINUXMODULE + const Anno *xanno() const { return (const Anno *)skb()->cb; } + Anno *xanno() { return (Anno *)skb()->cb; } +#else + const Anno *xanno() const { return &_aa.cb; } + Anno *xanno() { return &_aa.cb; } +#endif + /** @endcond never */ + public: + + /** @name Annotations */ + //@{ + + enum { + anno_size = 48 ///< Size of annotation area. + }; + + /** @brief Return the timestamp annotation. */ + inline const Timestamp ×tamp_anno() const; + /** @overload */ + inline Timestamp ×tamp_anno(); + /** @brief Set the timestamp annotation. + * @param t new timestamp */ + inline void set_timestamp_anno(const Timestamp &t); + + /** @brief Return the device annotation. */ + inline net_device *device_anno() const; + /** @brief Set the device annotation */ + inline void set_device_anno(net_device *dev); + + /** @brief Values for packet_type_anno(). + * Must agree with Linux's PACKET_ constants in . */ + enum PacketType { + HOST = 0, /**< Packet was sent to this host. */ + BROADCAST = 1, /**< Packet was sent to a link-level multicast + address. */ + MULTICAST = 2, /**< Packet was sent to a link-level multicast + address. */ + OTHERHOST = 3, /**< Packet was sent to a different host, but + received anyway. The receiving device is + probably in promiscuous mode. */ + OUTGOING = 4, /**< Packet was generated by this host and is + being sent elsewhere. */ + LOOPBACK = 5, + FASTROUTE = 6 + }; + /** @brief Return the packet type annotation. */ + inline PacketType packet_type_anno() const; + /** @brief Set the packet type annotation. */ + inline void set_packet_type_anno(PacketType t); + +#if CLICK_NS + class SimPacketinfoWrapper { public: + simclick_simpacketinfo _pinfo; + SimPacketinfoWrapper() { + // The uninitialized value for the simulator packet data can't be + // all zeros (0 is a valid packet id) or random junk out of memory + // since the simulator will look at this info to see if the packet + // was originally generated by it. Accidental collisions with + // other packet IDs or bogus packet IDs can cause weird things to + // happen. So we set it to all -1 here to keep the simulator from + // getting confused. + memset(&_pinfo,-1,sizeof(_pinfo)); + } + }; + simclick_simpacketinfo *get_sim_packetinfo() { + return &(_sim_packetinfo._pinfo); + } + void set_sim_packetinfo(simclick_simpacketinfo* pinfo) { + _sim_packetinfo._pinfo = *pinfo; + } +#endif + + /** @brief Return the next packet annotation. */ + inline Packet *next() const; + /** @overload */ + inline Packet *&next(); + /** @brief Set the next packet annotation. */ + inline void set_next(Packet *p); + + /** @brief Return the previous packet annotation. */ + inline Packet *prev() const; + /** @overload */ + inline Packet *&prev(); + /** @brief Set the previous packet annotation. */ + inline void set_prev(Packet *p); + + enum { + dst_ip_anno_offset = 0, dst_ip_anno_size = 4, + dst_ip6_anno_offset = 0, dst_ip6_anno_size = 16 + }; + + /** @brief Return the destination IPv4 address annotation. + * + * The value is taken from the address annotation area. */ + inline IPAddress dst_ip_anno() const; + + /** @brief Set the destination IPv4 address annotation. + * + * The value is stored in the address annotation area. */ + inline void set_dst_ip_anno(IPAddress addr); + + /** @brief Return a pointer to the annotation area. + * + * The area is @link Packet::anno_size anno_size @endlink bytes long. */ + void *anno() { return xanno(); } + + /** @overload */ + const void *anno() const { return xanno(); } + + /** @brief Return a pointer to the annotation area as uint8_ts. */ + uint8_t *anno_u8() { return &xanno()->u8[0]; } + + /** @brief overload */ + const uint8_t *anno_u8() const { return &xanno()->u8[0]; } + + /** @brief Return a pointer to the annotation area as uint32_ts. */ + uint32_t *anno_u32() { return &xanno()->u32[0]; } + + /** @brief overload */ + const uint32_t *anno_u32() const { return &xanno()->u32[0]; } + + /** @brief Return annotation byte at offset @a i. + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink */ + uint8_t anno_u8(int i) const { + assert(i >= 0 && i < anno_size); + return xanno()->u8[i]; + } + + /** @brief Set annotation byte at offset @a i. + * @param i annotation offset in bytes + * @param x value + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink */ + void set_anno_u8(int i, uint8_t x) { + assert(i >= 0 && i < anno_size); + xanno()->u8[i] = x; + } + + /** @brief Return 16-bit annotation at offset @a i. + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink - 1 + * @pre On aligned targets, @a i must be evenly divisible by 2. + * + * Affects annotation bytes [@a i, @a i+1]. */ + uint16_t anno_u16(int i) const { + assert(i >= 0 && i < anno_size - 1); +#if !HAVE_INDIFFERENT_ALIGNMENT + assert(i % 2 == 0); +#endif + return *reinterpret_cast(xanno()->c + i); + } + + /** @brief Set 16-bit annotation at offset @a i. + * @param i annotation offset in bytes + * @param x value + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink - 1 + * @pre On aligned targets, @a i must be evenly divisible by 2. + * + * Affects annotation bytes [@a i, @a i+1]. */ + void set_anno_u16(int i, uint16_t x) { + assert(i >= 0 && i < anno_size - 1); +#if !HAVE_INDIFFERENT_ALIGNMENT + assert(i % 2 == 0); +#endif + *reinterpret_cast(xanno()->c + i) = x; + } + + /** @brief Return 16-bit annotation at offset @a i. + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink - 1 + * @pre On aligned targets, @a i must be evenly divisible by 2. + * + * Affects annotation bytes [@a i, @a i+1]. */ + int16_t anno_s16(int i) const { + assert(i >= 0 && i < anno_size - 1); +#if !HAVE_INDIFFERENT_ALIGNMENT + assert(i % 2 == 0); +#endif + return *reinterpret_cast(xanno()->c + i); + } + + /** @brief Set 16-bit annotation at offset @a i. + * @param i annotation offset in bytes + * @param x value + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink - 1 + * @pre On aligned targets, @a i must be evenly divisible by 2. + * + * Affects annotation bytes [@a i, @a i+1]. */ + void set_anno_s16(int i, int16_t x) { + assert(i >= 0 && i < anno_size - 1); +#if !HAVE_INDIFFERENT_ALIGNMENT + assert(i % 2 == 0); +#endif + *reinterpret_cast(xanno()->c + i) = x; + } + + /** @brief Return 32-bit annotation at offset @a i. + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink - 3 + * @pre On aligned targets, @a i must be evenly divisible by 4. + * + * Affects user annotation bytes [@a i, @a i+3]. */ + uint32_t anno_u32(int i) const { + assert(i >= 0 && i < anno_size - 3); +#if !HAVE_INDIFFERENT_ALIGNMENT + assert(i % 4 == 0); +#endif + return *reinterpret_cast(xanno()->c + i); + } + + /** @brief Set 32-bit annotation at offset @a i. + * @param i annotation offset in bytes + * @param x value + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink - 3 + * @pre On aligned targets, @a i must be evenly divisible by 4. + * + * Affects user annotation bytes [@a i, @a i+3]. */ + void set_anno_u32(int i, uint32_t x) { + assert(i >= 0 && i < anno_size - 3); +#if !HAVE_INDIFFERENT_ALIGNMENT + assert(i % 4 == 0); +#endif + *reinterpret_cast(xanno()->c + i) = x; + } + + /** @brief Return 32-bit annotation at offset @a i. + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink - 3 + * + * Affects user annotation bytes [4*@a i, 4*@a i+3]. */ + int32_t anno_s32(int i) const { + assert(i >= 0 && i < anno_size - 3); +#if !HAVE_INDIFFERENT_ALIGNMENT + assert(i % 4 == 0); +#endif + return *reinterpret_cast(xanno()->c + i); + } + + /** @brief Set 32-bit annotation at offset @a i. + * @param i annotation offset in bytes + * @param x value + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink - 3 + * @pre On aligned targets, @a i must be evenly divisible by 4. + * + * Affects user annotation bytes [@a i, @a i+3]. */ + void set_anno_s32(int i, int32_t x) { + assert(i >= 0 && i < anno_size - 3); +#if !HAVE_INDIFFERENT_ALIGNMENT + assert(i % 4 == 0); +#endif + *reinterpret_cast(xanno()->c + i) = x; + } + +#if HAVE_INT64_TYPES + /** @brief Return 64-bit annotation at offset @a i. + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink - 7 + * @pre On aligned targets, @a i must be aligned properly for uint64_t. + * + * Affects user annotation bytes [@a i, @a i+7]. */ + uint64_t anno_u64(int i) const { + assert(i >= 0 && i < anno_size - 7); +#if !HAVE_INDIFFERENT_ALIGNMENT + assert(i % __alignof__(uint64_t) == 0); +#endif + return *reinterpret_cast(xanno()->c + i); + } + + /** @brief Set 64-bit annotation at offset @a i. + * @param i annotation offset in bytes + * @param x value + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink - 7 + * @pre On aligned targets, @a i must be aligned properly for uint64_t. + * + * Affects user annotation bytes [@a i, @a i+7]. */ + void set_anno_u64(int i, uint64_t x) { + assert(i >= 0 && i < anno_size - 7); +#if !HAVE_INDIFFERENT_ALIGNMENT + assert(i % __alignof__(uint64_t) == 0); +#endif + *reinterpret_cast(xanno()->c + i) = x; + } +#endif + + /** @brief Return void * sized annotation at offset @a i. + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink - sizeof(void *) + * @pre On aligned targets, @a i must be aligned properly. + * + * Affects user annotation bytes [@a i, @a i+sizeof(void *)]. */ + void *anno_ptr(int i) const { + assert(i >= 0 && i <= anno_size - (int)sizeof(void *)); +#if !HAVE_INDIFFERENT_ALIGNMENT + assert(i % __alignof__(void *) == 0); +#endif + return *reinterpret_cast(xanno()->c + i); + } + + /** @brief Set void * sized annotation at offset @a i. + * @param i annotation offset in bytes + * @param x value + * @pre 0 <= @a i < @link Packet::anno_size anno_size @endlink - sizeof(void *) + * @pre On aligned targets, @a i must be aligned properly. + * + * Affects user annotation bytes [@a i, @a i+sizeof(void *)]. */ + void set_anno_ptr(int i, const void *x) { + assert(i >= 0 && i <= anno_size - (int)sizeof(void *)); +#if !HAVE_INDIFFERENT_ALIGNMENT + assert(i % __alignof__(void *) == 0); +#endif + *reinterpret_cast(xanno()->c + i) = const_cast(x); + } + +#if !CLICK_LINUXMODULE + inline Packet* data_packet() { + return _data_packet; + } +#endif + + inline void clear_annotations(bool all = true); + inline void copy_annotations(const Packet *); + //@} + + /** @cond never */ + enum { + DEFAULT_HEADROOM = default_headroom, + MIN_BUFFER_LENGTH = min_buffer_length, + addr_anno_offset = 0, + addr_anno_size = 16, + user_anno_offset = 16, + user_anno_size = 32, + ADDR_ANNO_SIZE = addr_anno_size, + USER_ANNO_SIZE = user_anno_size, + USER_ANNO_U16_SIZE = USER_ANNO_SIZE / 2, + USER_ANNO_U32_SIZE = USER_ANNO_SIZE / 4, + USER_ANNO_U64_SIZE = USER_ANNO_SIZE / 8 + } CLICK_PACKET_DEPRECATED_ENUM; + inline const unsigned char *buffer_data() const CLICK_DEPRECATED; + inline void *addr_anno() CLICK_DEPRECATED; + inline const void *addr_anno() const CLICK_DEPRECATED; + inline void *user_anno() CLICK_DEPRECATED; + inline const void *user_anno() const CLICK_DEPRECATED; + inline uint8_t *user_anno_u8() CLICK_DEPRECATED; + inline const uint8_t *user_anno_u8() const CLICK_DEPRECATED; + inline uint32_t *user_anno_u32() CLICK_DEPRECATED; + inline const uint32_t *user_anno_u32() const CLICK_DEPRECATED; + inline uint8_t user_anno_u8(int i) const CLICK_DEPRECATED; + inline void set_user_anno_u8(int i, uint8_t v) CLICK_DEPRECATED; + inline uint16_t user_anno_u16(int i) const CLICK_DEPRECATED; + inline void set_user_anno_u16(int i, uint16_t v) CLICK_DEPRECATED; + inline uint32_t user_anno_u32(int i) const CLICK_DEPRECATED; + inline void set_user_anno_u32(int i, uint32_t v) CLICK_DEPRECATED; + inline int32_t user_anno_s32(int i) const CLICK_DEPRECATED; + inline void set_user_anno_s32(int i, int32_t v) CLICK_DEPRECATED; +#if HAVE_INT64_TYPES + inline uint64_t user_anno_u64(int i) const CLICK_DEPRECATED; + inline void set_user_anno_u64(int i, uint64_t v) CLICK_DEPRECATED; +#endif + inline const uint8_t *all_user_anno() const CLICK_DEPRECATED; + inline uint8_t *all_user_anno() CLICK_DEPRECATED; + inline const uint32_t *all_user_anno_u() const CLICK_DEPRECATED; + inline uint32_t *all_user_anno_u() CLICK_DEPRECATED; + inline uint8_t user_anno_c(int) const CLICK_DEPRECATED; + inline void set_user_anno_c(int, uint8_t) CLICK_DEPRECATED; + inline int16_t user_anno_s(int) const CLICK_DEPRECATED; + inline void set_user_anno_s(int, int16_t) CLICK_DEPRECATED; + inline uint16_t user_anno_us(int) const CLICK_DEPRECATED; + inline void set_user_anno_us(int, uint16_t) CLICK_DEPRECATED; + inline int32_t user_anno_i(int) const CLICK_DEPRECATED; + inline void set_user_anno_i(int, int32_t) CLICK_DEPRECATED; + inline uint32_t user_anno_u(int) const CLICK_DEPRECATED; + inline void set_user_anno_u(int, uint32_t) CLICK_DEPRECATED; + /** @endcond never */ + + private: + + // Anno must fit in sk_buff's char cb[48]. + /** @cond never */ + union Anno { + char c[anno_size]; + uint8_t u8[anno_size]; + uint16_t u16[anno_size / 2]; + uint32_t u32[anno_size / 4]; +#if HAVE_INT64_TYPES + uint64_t u64[anno_size / 8]; +#endif + // allocations: see packet_anno.hh + }; + +#if !CLICK_LINUXMODULE + // All packet annotations are stored in AllAnno so that + // clear_annotations(true) can memset() the structure to zero. + struct AllAnno { + Anno cb; + unsigned char *mac; + unsigned char *nh; + unsigned char *h; + PacketType pkt_type; + char timestamp[sizeof(Timestamp)]; + Packet *next; + Packet *prev; + }; +#endif + /** @endcond never */ + +#if !CLICK_LINUXMODULE + // User-space and BSD kernel module implementations. + atomic_uint32_t _use_count; + Packet *_data_packet; + /* mimic Linux sk_buff */ + unsigned char *_head; /* start of allocated buffer */ + unsigned char *_data; /* where the packet starts */ + unsigned char *_tail; /* one beyond end of packet */ + unsigned char *_end; /* one beyond end of allocated buffer */ +# if CLICK_BSDMODULE + struct mbuf *_m; +# endif + AllAnno _aa; +# if CLICK_NS + SimPacketinfoWrapper _sim_packetinfo; +# endif +# if CLICK_USERLEVEL || CLICK_MINIOS + buffer_destructor_type _destructor; + void* _destructor_argument; +# endif +#endif + + inline Packet() { +#if CLICK_LINUXMODULE + panic("Packet constructor"); +#endif + } + Packet(const Packet &x); + ~Packet(); + Packet &operator=(const Packet &x); + +#if !CLICK_LINUXMODULE + bool alloc_data(uint32_t headroom, uint32_t length, uint32_t tailroom); +#endif +#if CLICK_BSDMODULE + static void assimilate_mbuf(Packet *p); + void assimilate_mbuf(); +#endif + + inline void shift_header_annotations(const unsigned char *old_head, int32_t extra_headroom); + WritablePacket *expensive_uniqueify(int32_t extra_headroom, int32_t extra_tailroom, bool free_on_failure); + WritablePacket *expensive_push(uint32_t nbytes); + WritablePacket *expensive_put(uint32_t nbytes); + + friend class WritablePacket; + +}; + + +class WritablePacket : public Packet { public: + + inline unsigned char *data() const; + inline unsigned char *end_data() const; + inline unsigned char *buffer() const; + inline unsigned char *end_buffer() const; + inline unsigned char *mac_header() const; + inline click_ether *ether_header() const; + inline unsigned char *network_header() const; + inline click_ip *ip_header() const; + inline click_ip6 *ip6_header() const; + inline unsigned char *transport_header() const; + inline click_icmp *icmp_header() const; + inline click_tcp *tcp_header() const; + inline click_udp *udp_header() const; + + /** @cond never */ + inline unsigned char *buffer_data() const CLICK_DEPRECATED; + /** @endcond never */ + + private: + + inline WritablePacket() { } +#if !CLICK_LINUXMODULE + inline void initialize(); +#endif + WritablePacket(const Packet &x); + ~WritablePacket() { } + +#if HAVE_CLICK_PACKET_POOL + static WritablePacket *pool_allocate(bool with_data); + static WritablePacket *pool_allocate(uint32_t headroom, uint32_t length, + uint32_t tailroom); + static void recycle(WritablePacket *p); +#endif + + friend class Packet; + +}; + + +/** @brief Clear all packet annotations. + * @param all If true, clear all annotations. If false, clear only Click's + * internal annotations. + * + * All user annotations and the address annotation are set to zero, the packet + * type annotation is set to HOST, the device annotation and all header + * pointers are set to null, the timestamp annotation is cleared, and the + * next/prev-packet annotations are set to null. + * + * If @a all is false, then the packet type, device, timestamp, header, and + * next/prev-packet annotations are left alone. + */ +inline void +Packet::clear_annotations(bool all) +{ +#if CLICK_LINUXMODULE + memset(xanno(), 0, sizeof(Anno)); + if (all) { + set_packet_type_anno(HOST); + set_device_anno(0); + set_timestamp_anno(Timestamp()); + + clear_mac_header(); + clear_network_header(); + clear_transport_header(); + + set_next(0); + set_prev(0); + } +#else + memset(&_aa, 0, all ? sizeof(AllAnno) : sizeof(Anno)); +#endif +} + +/** @brief Copy most packet annotations from @a p. + * @param p source of annotations + * + * This packet's user annotations, address annotation, packet type annotation, + * device annotation, and timestamp annotation are set to the corresponding + * annotations from @a p. + * + * @note The next/prev-packet and header annotations are not copied. */ +inline void +Packet::copy_annotations(const Packet *p) +{ + *xanno() = *p->xanno(); + set_packet_type_anno(p->packet_type_anno()); + set_device_anno(p->device_anno()); + set_timestamp_anno(p->timestamp_anno()); +} + + +#if !CLICK_LINUXMODULE +inline void +WritablePacket::initialize() +{ + _use_count = 1; + _data_packet = 0; +# if CLICK_USERLEVEL || CLICK_MINIOS + _destructor = 0; +# elif CLICK_BSDMODULE + _m = 0; +# endif + clear_annotations(); +} +#endif + +/** @brief Return the packet's data pointer. + * + * This is the pointer to the first byte of packet data. */ +inline const unsigned char * +Packet::data() const +{ +#if CLICK_LINUXMODULE + return skb()->data; +#else + return _data; +#endif +} + +/** @brief Return the packet's end data pointer. + * + * The result points at the byte following the packet data. + * @invariant end_data() == data() + length() */ +inline const unsigned char * +Packet::end_data() const +{ +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + return skb_tail_pointer(skb()); +# else + return skb()->tail; +# endif +#else + return _tail; +#endif +} + +/** @brief Return a pointer to the packet's data buffer. + * + * The result points at the packet's headroom, not its data. + * @invariant buffer() == data() - headroom() */ +inline const unsigned char * +Packet::buffer() const +{ +#if CLICK_LINUXMODULE + return skb()->head; +#else + return _head; +#endif +} + +/** @brief Return the packet's end data buffer pointer. + * + * The result points past the packet's tailroom. + * @invariant end_buffer() == end_data() + tailroom() */ +inline const unsigned char * +Packet::end_buffer() const +{ +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + return skb_end_pointer(skb()); +# else + return skb()->end; +# endif +#else + return _end; +#endif +} + +/** @brief Return the packet's length. */ +inline uint32_t +Packet::length() const +{ +#if CLICK_LINUXMODULE + return skb()->len; +#else + return _tail - _data; +#endif +} + +/** @brief Return the packet's headroom. + * + * The headroom is the amount of space available in the current packet buffer + * before data(). A push() operation is cheap if the packet's unshared and + * the length pushed is less than headroom(). */ +inline uint32_t +Packet::headroom() const +{ + return data() - buffer(); +} + +/** @brief Return the packet's tailroom. + * + * The tailroom is the amount of space available in the current packet buffer + * following end_data(). A put() operation is cheap if the packet's unshared + * and the length put is less than tailroom(). */ +inline uint32_t +Packet::tailroom() const +{ + return end_buffer() - end_data(); +} + +/** @brief Return the packet's buffer length. + * @invariant buffer_length() == headroom() + length() + tailroom() + * @invariant buffer() + buffer_length() == end_buffer() */ +inline uint32_t +Packet::buffer_length() const +{ + return end_buffer() - buffer(); +} + +inline Packet * +Packet::next() const +{ +#if CLICK_LINUXMODULE + return (Packet *)(skb()->next); +#else + return _aa.next; +#endif +} + +inline Packet *& +Packet::next() +{ +#if CLICK_LINUXMODULE + return (Packet *&)(skb()->next); +#else + return _aa.next; +#endif +} + +inline void +Packet::set_next(Packet *p) +{ +#if CLICK_LINUXMODULE + skb()->next = p->skb(); +#else + _aa.next = p; +#endif +} + +inline Packet * +Packet::prev() const +{ +#if CLICK_LINUXMODULE + return (Packet *)(skb()->prev); +#else + return _aa.prev; +#endif +} + +inline Packet *& +Packet::prev() +{ +#if CLICK_LINUXMODULE + return (Packet *&)(skb()->prev); +#else + return _aa.prev; +#endif +} + +inline void +Packet::set_prev(Packet *p) +{ +#if CLICK_LINUXMODULE + skb()->prev = p->skb(); +#else + _aa.prev = p; +#endif +} + +/** @brief Return true iff the packet's MAC header pointer is set. + * @sa set_mac_header, clear_mac_header */ +inline bool +Packet::has_mac_header() const +{ +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + return skb_mac_header_was_set(skb()); +# else + return skb()->mac.raw != 0; +# endif +#else + return _aa.mac != 0; +#endif +} + +/** @brief Return the packet's MAC header pointer. + * @warning Not useful if !has_mac_header(). + * @sa ether_header, set_mac_header, clear_mac_header, mac_header_length, + * mac_length */ +inline const unsigned char * +Packet::mac_header() const +{ +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + return skb_mac_header(skb()); +# else + return skb()->mac.raw; +# endif +#else + return _aa.mac; +#endif +} + +/** @brief Return true iff the packet's network header pointer is set. + * @sa set_network_header, clear_network_header */ +inline bool +Packet::has_network_header() const +{ +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) +# if NET_SKBUFF_DATA_USES_OFFSET + return skb()->network_header != (network_header_type) ~0U; +# else + return skb()->network_header != 0; +# endif +# else + return skb()->nh.raw != 0; +# endif +#else + return _aa.nh != 0; +#endif +} + +/** @brief Return the packet's network header pointer. + * @warning Not useful if !has_network_header(). + * @sa ip_header, ip6_header, set_network_header, clear_network_header, + * network_header_length, network_length */ +inline const unsigned char * +Packet::network_header() const +{ +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + return skb_network_header(skb()); +# else + return skb()->nh.raw; +# endif +#else + return _aa.nh; +#endif +} + +/** @brief Return true iff the packet's network header pointer is set. + * @sa set_network_header, clear_transport_header */ +inline bool +Packet::has_transport_header() const +{ +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) +# if NET_SKBUFF_DATA_USES_OFFSET + return skb()->transport_header != (transport_header_type) ~0U; +# else + return skb()->transport_header != 0; +# endif +# else + return skb()->h.raw != 0; +# endif +#else + return _aa.h != 0; +#endif +} + +/** @brief Return the packet's transport header pointer. + * @warning Not useful if !has_transport_header(). + * @sa tcp_header, udp_header, icmp_header, set_transport_header, + * clear_transport_header, transport_length */ +inline const unsigned char * +Packet::transport_header() const +{ +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + return skb_transport_header(skb()); +# else + return skb()->h.raw; +# endif +#else + return _aa.h; +#endif +} + +/** @brief Return the packet's MAC header pointer as Ethernet. + * @invariant (void *) ether_header() == (void *) mac_header() + * @warning Not useful if !has_mac_header(). + * @sa mac_header */ +inline const click_ether * +Packet::ether_header() const +{ + return reinterpret_cast(mac_header()); +} + +/** @brief Return the packet's network header pointer as IPv4. + * @invariant (void *) ip_header() == (void *) network_header() + * @warning Not useful if !has_network_header(). + * @sa network_header */ +inline const click_ip * +Packet::ip_header() const +{ + return reinterpret_cast(network_header()); +} + +/** @brief Return the packet's network header pointer as IPv6. + * @invariant (void *) ip6_header() == (void *) network_header() + * @warning Not useful if !has_network_header(). + * @sa network_header */ +inline const click_ip6 * +Packet::ip6_header() const +{ + return reinterpret_cast(network_header()); +} + +/** @brief Return the packet's transport header pointer as ICMP. + * @invariant (void *) icmp_header() == (void *) transport_header() + * @warning Not useful if !has_transport_header(). + * @sa transport_header */ +inline const click_icmp * +Packet::icmp_header() const +{ + return reinterpret_cast(transport_header()); +} + +/** @brief Return the packet's transport header pointer as TCP. + * @invariant (void *) tcp_header() == (void *) transport_header() + * @warning Not useful if !has_transport_header(). + * @sa transport_header */ +inline const click_tcp * +Packet::tcp_header() const +{ + return reinterpret_cast(transport_header()); +} + +/** @brief Return the packet's transport header pointer as UDP. + * @invariant (void *) udp_header() == (void *) transport_header() + * @warning Not useful if !has_transport_header(). + * @sa transport_header */ +inline const click_udp * +Packet::udp_header() const +{ + return reinterpret_cast(transport_header()); +} + +/** @brief Return the packet's length starting from its MAC header pointer. + * @invariant mac_length() == end_data() - mac_header() + * @warning Not useful if !has_mac_header(). */ +inline int +Packet::mac_length() const +{ + return end_data() - mac_header(); +} + +/** @brief Return the packet's length starting from its network header pointer. + * @invariant network_length() == end_data() - network_header() + * @warning Not useful if !has_network_header(). */ +inline int +Packet::network_length() const +{ + return end_data() - network_header(); +} + +/** @brief Return the packet's length starting from its transport header pointer. + * @invariant transport_length() == end_data() - transport_header() + * @warning Not useful if !has_transport_header(). */ +inline int +Packet::transport_length() const +{ + return end_data() - transport_header(); +} + +inline const Timestamp& +Packet::timestamp_anno() const +{ +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 13) + return *reinterpret_cast(&skb()->stamp); +# else + return *reinterpret_cast(&skb()->tstamp); +# endif +#else + return *reinterpret_cast(&_aa.timestamp); +#endif +} + +inline Timestamp& +Packet::timestamp_anno() +{ +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 13) + return *reinterpret_cast(&skb()->stamp); +# else + return *reinterpret_cast(&skb()->tstamp); +# endif +#else + return *reinterpret_cast(&_aa.timestamp); +#endif +} + +inline void +Packet::set_timestamp_anno(const Timestamp ×tamp) +{ + timestamp_anno() = timestamp; +} + +inline net_device * +Packet::device_anno() const +{ +#if CLICK_LINUXMODULE + return skb()->dev; +#elif CLICK_BSDMODULE + if (m()) + return m()->m_pkthdr.rcvif; + else + return 0; +#else + return 0; +#endif +} + +inline void +Packet::set_device_anno(net_device *dev) +{ +#if CLICK_LINUXMODULE + skb()->dev = dev; +#elif CLICK_BSDMODULE + if (m()) + m()->m_pkthdr.rcvif = dev; +#else + (void) dev; +#endif +} + +inline Packet::PacketType +Packet::packet_type_anno() const +{ +#if CLICK_LINUXMODULE && PACKET_TYPE_MASK + return (PacketType)(skb()->pkt_type & PACKET_TYPE_MASK); +#elif CLICK_LINUXMODULE + return (PacketType)(skb()->pkt_type); +#else + return _aa.pkt_type; +#endif +} + +inline void +Packet::set_packet_type_anno(PacketType p) +{ +#if CLICK_LINUXMODULE && PACKET_TYPE_MASK + skb()->pkt_type = (skb()->pkt_type & PACKET_CLEAN) | p; +#elif CLICK_LINUXMODULE + skb()->pkt_type = p; +#else + _aa.pkt_type = p; +#endif +} + +/** @brief Create and return a new packet. + * @param data data to be copied into the new packet + * @param length length of packet + * @return new packet, or null if no packet could be created + * + * The @a data is copied into the new packet. If @a data is null, the + * packet's data is left uninitialized. The new packet's headroom equals + * @link Packet::default_headroom default_headroom @endlink, its tailroom is 0. + * + * The returned packet's annotations are cleared and its header pointers are + * null. */ +inline WritablePacket * +Packet::make(const void *data, uint32_t length) +{ + return make(default_headroom, data, length, 0); +} + +/** @brief Create and return a new packet. + * @param length length of packet + * @return new packet, or null if no packet could be created + * + * The packet's data is left uninitialized. The new packet's headroom equals + * @link Packet::default_headroom default_headroom @endlink, its tailroom is 0. + * + * The returned packet's annotations are cleared and its header pointers are + * null. */ +inline WritablePacket * +Packet::make(uint32_t length) +{ + return make(default_headroom, (const unsigned char *) 0, length, 0); +} + +#if CLICK_LINUXMODULE +/** @brief Change an sk_buff into a Packet (linuxmodule). + * @param skb input sk_buff + * @return the packet + * + * In the Linux kernel module, Packet objects are sk_buff objects. This + * function simply changes an sk_buff into a Packet by claiming its @a skb + * argument. If skb->users is 1, then @a skb is orphaned by + * skb_orphan(skb) and returned. If it is larger than 1, then @a skb + * is cloned and the clone is returned. (sk_buffs used for Click Packet + * objects must have skb->users == 1.) Null might be returned if + * there's no memory for the clone. + * + * The returned packet's annotations and header pointers are not + * cleared: they have the same values they did in the sk_buff. If the + * packet came from Linux, then the header pointers and shared annotations + * (timestamp, packet type, next/prev packet) might have valid values, but the + * Click annotations (address, user) likely do not. Use clear_annotations() + * to clear them. */ +inline Packet * +Packet::make(struct sk_buff *skb) +{ + struct sk_buff *nskb; + if (atomic_read(&skb->users) == 1) { + skb_orphan(skb); + nskb = skb; + } else { + nskb = skb_clone(skb, GFP_ATOMIC); + atomic_dec(&skb->users); + } +# if HAVE_SKB_LINEARIZE +# if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 17) + if (nskb && skb_linearize(nskb, GFP_ATOMIC) != 0) +# else + if (nskb && skb_linearize(nskb) != 0) +# endif + { + kfree_skb(nskb); + nskb = 0; + } +# endif + return reinterpret_cast(nskb); +} +#endif + +/** @brief Delete this packet. + * + * The packet header (including annotations) is destroyed and its memory + * returned to the system. The packet's data is also freed if this is the + * last clone. */ +inline void +Packet::kill() +{ +#if CLICK_LINUXMODULE + struct sk_buff *b = skb(); + b->next = b->prev = 0; +# if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 15) + b->list = 0; +# endif + skbmgr_recycle_skbs(b); +#elif HAVE_CLICK_PACKET_POOL + if (_use_count.dec_and_test()) + WritablePacket::recycle(static_cast(this)); +#else + if (_use_count.dec_and_test()) + delete this; +#endif +} + +#if CLICK_BSDMODULE /* BSD kernel module */ +inline void +Packet::assimilate_mbuf(Packet *p) +{ + struct mbuf *m = p->m(); + + if (!m) return; + + p->_head = (unsigned char *) + (m->m_flags & M_EXT ? m->m_ext.ext_buf : + m->m_flags & M_PKTHDR ? m->m_pktdat : + m->m_dat); + p->_data = (unsigned char *)m->m_data; + p->_tail = (unsigned char *)(m->m_data + m->m_len); + p->_end = p->_head + + (m->m_flags & M_EXT ? min(m->m_pkthdr.len, m->m_ext.ext_size) : + m->m_flags & M_PKTHDR ? MHLEN : + MLEN); +} + +inline void +Packet::assimilate_mbuf() +{ + assimilate_mbuf(this); +} + +inline Packet * +Packet::make(struct mbuf *m) +{ + if (!(m->m_flags & M_PKTHDR)) + panic("trying to construct Packet from a non-packet mbuf"); + + Packet *p = new Packet; + if (!p) { + m_freem(m); + return 0; + } + p->_use_count = 1; + p->_data_packet = NULL; + + if (m->m_pkthdr.len != m->m_len) { + struct mbuf *m2; + /* click needs contiguous data */ + + if (m->m_pkthdr.len <= MCLBYTES) { + // click_chatter("m_pulldown, Click needs contiguous data"); + m2 = m_pulldown(m, 0, m->m_pkthdr.len, NULL); + if (m2 == NULL) + panic("m_pulldown failed"); + if (m2 != m) { + /* + * XXX: m_pulldown ensures that the data is contiguous, but + * it's not necessarily in the first mbuf in the chain. + * Currently that's not OK for Click, so we need to + * defragment the mbuf - which involves more copying etc. + */ + m2 = m_defrag(m, M_DONTWAIT); + if (m2 == NULL) { + m_freem(m); + delete p; + return 0; + } + m = m2; + } + } else { + m2 = p->dup_jumbo_m(m); + m_freem(m); + if (m2 == NULL) { + delete p; + return 0; + } + m = m2; + } + } + p->_m = m; + assimilate_mbuf(p); + + return p; +} +#endif + +/** @brief Test whether this packet's data is shared. + * + * Returns true iff the packet's data is shared. If shared() is false, then + * the result of uniqueify() will equal @c this. */ +inline bool +Packet::shared() const +{ +#if CLICK_LINUXMODULE + return skb_cloned(const_cast(skb())); +#else + return (_data_packet || _use_count > 1); +#endif +} + +/** @brief Return an unshared packet containing this packet's data. + * @return the unshared packet, which is writable + * + * The returned packet's data is unshared with any other packet, so it's safe + * to write the data. If shared() is false, this operation simply returns the + * input packet. If shared() is true, uniqueify() makes a copy of the data. + * The input packet is freed if the copy fails. + * + * The returned WritablePacket pointer may not equal the input Packet pointer, + * so do not use the input pointer after the uniqueify() call. + * + * The input packet's headroom and tailroom areas are copied in addition to + * its true contents. The header annotations are shifted to point into the + * new packet data if necessary. + * + * uniqueify() is usually used like this: + * @code + * WritablePacket *q = p->uniqueify(); + * if (!q) + * return 0; + * // p must not be used here. + * @endcode + */ +inline WritablePacket * +Packet::uniqueify() +{ + if (!shared()) + return static_cast(this); + else + return expensive_uniqueify(0, 0, true); +} + +inline WritablePacket * +Packet::push(uint32_t len) +{ + if (headroom() >= len && !shared()) { + WritablePacket *q = (WritablePacket *)this; +#if CLICK_LINUXMODULE /* Linux kernel module */ + __skb_push(q->skb(), len); +#else /* User-space and BSD kernel module */ + q->_data -= len; +# if CLICK_BSDMODULE + q->m()->m_data -= len; + q->m()->m_len += len; + q->m()->m_pkthdr.len += len; +# endif +#endif + return q; + } else + return expensive_push(len); +} + +inline Packet * +Packet::nonunique_push(uint32_t len) +{ + if (headroom() >= len) { +#if CLICK_LINUXMODULE /* Linux kernel module */ + __skb_push(skb(), len); +#else /* User-space and BSD kernel module */ + _data -= len; +# if CLICK_BSDMODULE + m()->m_data -= len; + m()->m_len += len; + m()->m_pkthdr.len += len; +# endif +#endif + return this; + } else + return expensive_push(len); +} + +inline void +Packet::pull(uint32_t len) +{ + if (len > length()) { + click_chatter("Packet::pull %d > length %d\n", len, length()); + len = length(); + } +#if CLICK_LINUXMODULE /* Linux kernel module */ + __skb_pull(skb(), len); +#else /* User-space and BSD kernel module */ + _data += len; +# if CLICK_BSDMODULE + m()->m_data += len; + m()->m_len -= len; + m()->m_pkthdr.len -= len; +# endif +#endif +} + +inline WritablePacket * +Packet::put(uint32_t len) +{ + if (tailroom() >= len && !shared()) { + WritablePacket *q = (WritablePacket *)this; +#if CLICK_LINUXMODULE /* Linux kernel module */ + __skb_put(q->skb(), len); +#else /* User-space and BSD kernel module */ + q->_tail += len; +# if CLICK_BSDMODULE + q->m()->m_len += len; + q->m()->m_pkthdr.len += len; +# endif +#endif + return q; + } else + return expensive_put(len); +} + +inline Packet * +Packet::nonunique_put(uint32_t len) +{ + if (tailroom() >= len) { +#if CLICK_LINUXMODULE /* Linux kernel module */ + __skb_put(skb(), len); +#else /* User-space and BSD kernel module */ + _tail += len; +# if CLICK_BSDMODULE + m()->m_len += len; + m()->m_pkthdr.len += len; +# endif +#endif + return this; + } else + return expensive_put(len); +} + +inline void +Packet::take(uint32_t len) +{ + if (len > length()) { + click_chatter("Packet::take %d > length %d\n", len, length()); + len = length(); + } +#if CLICK_LINUXMODULE /* Linux kernel module */ + skb()->tail -= len; + skb()->len -= len; +#else /* User-space and BSD kernel module */ + _tail -= len; +# if CLICK_BSDMODULE + m()->m_len -= len; + m()->m_pkthdr.len -= len; +# endif +#endif +} + +#if CLICK_USERLEVEL || CLICK_MINIOS +/** @brief Shrink the packet's data. + * @param data new data pointer + * @param length new length + * + * @warning This function is useful only in special contexts. + * @note Only available at user level + * + * User-level programs that read packet logs commonly read a large chunk of + * data (32 kB or more) into a base Packet object. The log reader then works + * over the data buffer and, for each packet contained therein, outputs a + * clone that shares memory with the base packet. This is space- and + * time-efficient, but the generated packets have gigantic headroom and + * tailroom. Uniqueifying a generated packet will wastefully copy this + * headroom and tailroom as well. The shrink_data function addresses this + * problem. + * + * shrink_data() removes all of a packet's headroom and tailroom. The + * resulting packet has data() equal to @a data, length() equal to @a length, + * and headroom() and tailroom() equal to zero. + * + * @pre The packet @em must be a clone() of another existing packet. + * @pre @a data >= data(), @a data <= end_data(), @a data + @a length >= + * data(), and @a data + @a length <= end_data() + * + * @sa change_headroom_and_length */ +inline void +Packet::shrink_data(const unsigned char *data, uint32_t length) +{ + assert(_data_packet); + if (data >= _head && data + length >= data && data + length <= _end) { + _head = _data = const_cast(data); + _tail = _end = const_cast(data + length); + } +} + +/** @brief Shift the packet's data view to a different part of its buffer. + * @param headroom new headroom + * @param length new length + * + * @warning This function is useful only in special contexts. + * @note Only available at user level + * + * Shifts the packet's data() pointer to a different part of the packet's data + * buffer. The buffer pointer itself is not changed, and the packet's + * contents are not affected (except by the new view). + * + * @pre @a headroom + @a length <= buffer_length() + * @post new buffer() == old buffer() + * @post new end_buffer() == old end_buffer() + * @post new headroom() == @a headroom + * @post new length() == @a length + * + * @sa shrink_data */ +inline void +Packet::change_headroom_and_length(uint32_t headroom, uint32_t length) +{ + if (headroom + length <= buffer_length()) { + _data = _head + headroom; + _tail = _data + length; + } +} +#endif + +inline IPAddress +Packet::dst_ip_anno() const +{ + return IPAddress(xanno()->u32[dst_ip_anno_offset / 4]); +} + +inline void +Packet::set_dst_ip_anno(IPAddress a) +{ + xanno()->u32[dst_ip_anno_offset / 4] = a.addr(); +} + +/** @brief Set the MAC header pointer. + * @param p new header pointer */ +inline void +Packet::set_mac_header(const unsigned char *p) +{ + assert(p >= buffer() && p <= end_buffer()); +#if CLICK_LINUXMODULE /* Linux kernel module */ +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + skb_set_mac_header(skb(), p - data()); +# else + skb()->mac.raw = const_cast(p); +# endif +#else /* User-space and BSD kernel module */ + _aa.mac = const_cast(p); +#endif +} + +/** @brief Set the MAC and network header pointers. + * @param p new MAC header pointer + * @param len new MAC header length + * @post mac_header() == @a p and network_header() == @a p + @a len */ +inline void +Packet::set_mac_header(const unsigned char *p, uint32_t len) +{ + assert(p >= buffer() && p + len <= end_buffer()); +#if CLICK_LINUXMODULE /* Linux kernel module */ +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + skb_set_mac_header(skb(), p - data()); + skb_set_network_header(skb(), (p + len) - data()); +# else + skb()->mac.raw = const_cast(p); + skb()->nh.raw = const_cast(p) + len; +# endif +#else /* User-space and BSD kernel module */ + _aa.mac = const_cast(p); + _aa.nh = const_cast(p) + len; +#endif +} + +/** @brief Set the MAC header pointer to an Ethernet header. + * @param ethh new Ethernet header pointer + * @post (void *) mac_header() == (void *) @a ethh + * @post mac_header_length() == 14 + * @post (void *) network_header() == (void *) (@a ethh + 1) */ +inline void +Packet::set_ether_header(const click_ether *ethh) +{ + set_mac_header(reinterpret_cast(ethh), 14); +} + +/** @brief Unset the MAC header pointer. + * @post has_mac_header() == false + * Does not affect the network or transport header pointers. */ +inline void +Packet::clear_mac_header() +{ +#if CLICK_LINUXMODULE /* Linux kernel module */ +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) && NET_SKBUFF_DATA_USES_OFFSET + skb()->mac_header = (mac_header_type) ~0U; +# elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + skb()->mac_header = 0; +# else + skb()->mac.raw = 0; +# endif +#else /* User-space and BSD kernel module */ + _aa.mac = 0; +#endif +} + +inline WritablePacket * +Packet::push_mac_header(uint32_t len) +{ + WritablePacket *q; + if (headroom() >= len && !shared()) { + q = (WritablePacket *)this; +#if CLICK_LINUXMODULE /* Linux kernel module */ + __skb_push(q->skb(), len); +#else /* User-space and BSD kernel module */ + q->_data -= len; +# if CLICK_BSDMODULE + q->m()->m_data -= len; + q->m()->m_len += len; + q->m()->m_pkthdr.len += len; +# endif +#endif + } else if ((q = expensive_push(len))) + /* nada */; + else + return 0; + q->set_mac_header(q->data(), len); + return q; +} + +/** @brief Set the network and transport header pointers. + * @param p new network header pointer + * @param len new network header length + * @post network_header() == @a p and transport_header() == @a p + @a len */ +inline void +Packet::set_network_header(const unsigned char *p, uint32_t len) +{ + assert(p >= buffer() && p + len <= end_buffer()); +#if CLICK_LINUXMODULE /* Linux kernel module */ +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + skb_set_network_header(skb(), p - data()); + skb_set_transport_header(skb(), (p + len) - data()); +# else + skb()->nh.raw = const_cast(p); + skb()->h.raw = const_cast(p) + len; +# endif +#else /* User-space and BSD kernel module */ + _aa.nh = const_cast(p); + _aa.h = const_cast(p) + len; +#endif +} + +/** @brief Set the network header length. + * @param len new network header length + * + * Setting the network header length really just sets the transport header + * pointer. + * @post transport_header() == network_header() + @a len */ +inline void +Packet::set_network_header_length(uint32_t len) +{ + assert(network_header() + len <= end_buffer()); +#if CLICK_LINUXMODULE /* Linux kernel module */ +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + skb_set_transport_header(skb(), (network_header() + len) - data()); +# else + skb()->h.raw = skb()->nh.raw + len; +# endif +#else /* User-space and BSD kernel module */ + _aa.h = _aa.nh + len; +#endif +} + +/** @brief Set the network header pointer to an IPv4 header. + * @param iph new IP header pointer + * @param len new IP header length in bytes + * @post (char *) network_header() == (char *) @a iph + * @post network_header_length() == @a len + * @post (char *) transport_header() == (char *) @a iph + @a len */ +inline void +Packet::set_ip_header(const click_ip *iph, uint32_t len) +{ + set_network_header(reinterpret_cast(iph), len); +} + +/** @brief Set the network header pointer to an IPv6 header. + * @param ip6h new IP header pointer + * @param len new IP header length in bytes + * @post (char *) network_header() == (char *) @a ip6h + * @post network_header_length() == @a len + * @post (char *) transport_header() == (char *) @a ip6h + @a len */ +inline void +Packet::set_ip6_header(const click_ip6 *ip6h, uint32_t len) +{ + set_network_header(reinterpret_cast(ip6h), len); +} + +/** @brief Set the network header pointer to an IPv6 header. + * @param ip6h new IP header pointer + * @post (char *) network_header() == (char *) @a ip6h + * @post network_header_length() == 40 + * @post (char *) transport_header() == (char *) (@a ip6h + 1) */ +inline void +Packet::set_ip6_header(const click_ip6 *ip6h) +{ + set_ip6_header(ip6h, 40); +} + +/** @brief Unset the network header pointer. + * @post has_network_header() == false + * Does not affect the MAC or transport header pointers. */ +inline void +Packet::clear_network_header() +{ +#if CLICK_LINUXMODULE /* Linux kernel module */ +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) && NET_SKBUFF_DATA_USES_OFFSET + skb()->network_header = (network_header_type) ~0U; +# elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + skb()->network_header = 0; +# else + skb()->nh.raw = 0; +# endif +#else /* User-space and BSD kernel module */ + _aa.nh = 0; +#endif +} + +/** @brief Return the offset from the packet data to the MAC header. + * @return mac_header() - data() + * @warning Not useful if !has_mac_header(). */ +inline int +Packet::mac_header_offset() const +{ + return mac_header() - data(); +} + +/** @brief Return the MAC header length. + * @return network_header() - mac_header() + * + * This equals the offset from the MAC header pointer to the network header + * pointer. + * @warning Not useful if !has_mac_header() or !has_network_header(). */ +inline uint32_t +Packet::mac_header_length() const +{ + return network_header() - mac_header(); +} + +/** @brief Return the offset from the packet data to the network header. + * @return network_header() - data() + * @warning Not useful if !has_network_header(). */ +inline int +Packet::network_header_offset() const +{ + return network_header() - data(); +} + +/** @brief Return the network header length. + * @return transport_header() - network_header() + * + * This equals the offset from the network header pointer to the transport + * header pointer. + * @warning Not useful if !has_network_header() or !has_transport_header(). */ +inline uint32_t +Packet::network_header_length() const +{ + return transport_header() - network_header(); +} + +/** @brief Return the offset from the packet data to the IP header. + * @return network_header() - mac_header() + * @warning Not useful if !has_network_header(). + * @sa network_header_offset */ +inline int +Packet::ip_header_offset() const +{ + return network_header_offset(); +} + +/** @brief Return the IP header length. + * @return transport_header() - network_header() + * + * This equals the offset from the network header pointer to the transport + * header pointer. + * @warning Not useful if !has_network_header() or !has_transport_header(). + * @sa network_header_length */ +inline uint32_t +Packet::ip_header_length() const +{ + return network_header_length(); +} + +/** @brief Return the offset from the packet data to the IPv6 header. + * @return network_header() - data() + * @warning Not useful if !has_network_header(). + * @sa network_header_offset */ +inline int +Packet::ip6_header_offset() const +{ + return network_header_offset(); +} + +/** @brief Return the IPv6 header length. + * @return transport_header() - network_header() + * + * This equals the offset from the network header pointer to the transport + * header pointer. + * @warning Not useful if !has_network_header() or !has_transport_header(). + * @sa network_header_length */ +inline uint32_t +Packet::ip6_header_length() const +{ + return network_header_length(); +} + +/** @brief Return the offset from the packet data to the transport header. + * @return transport_header() - data() + * @warning Not useful if !has_transport_header(). */ +inline int +Packet::transport_header_offset() const +{ + return transport_header() - data(); +} + +/** @brief Unset the transport header pointer. + * @post has_transport_header() == false + * Does not affect the MAC or network header pointers. */ +inline void +Packet::clear_transport_header() +{ +#if CLICK_LINUXMODULE /* Linux kernel module */ +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) && NET_SKBUFF_DATA_USES_OFFSET + skb()->transport_header = (transport_header_type) ~0U; +# elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + skb()->transport_header = 0; +# else + skb()->h.raw = 0; +# endif +#else /* User-space and BSD kernel module */ + _aa.h = 0; +#endif +} + +inline void +Packet::shift_header_annotations(const unsigned char *old_head, + int32_t extra_headroom) +{ +#if CLICK_LINUXMODULE + struct sk_buff *mskb = skb(); + /* From Linux 2.6.24 - 3.10, the header offsets are integers if + * NET_SKBUFF_DATA_USES_OFFSET is 1. From 3.11 onward, they're + * always integers. */ +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) && NET_SKBUFF_DATA_USES_OFFSET) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) + (void) old_head; + mskb->mac_header += (mskb->mac_header == (mac_header_type) ~0U ? 0 : extra_headroom); + mskb->network_header += (mskb->network_header == (network_header_type) ~0U ? 0 : extra_headroom); + mskb->transport_header += (mskb->transport_header == (transport_header_type) ~0U ? 0 : extra_headroom); +# elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + ptrdiff_t shift = (mskb->head - old_head) + extra_headroom; + mskb->mac_header += (mskb->mac_header ? shift : 0); + mskb->network_header += (mskb->network_header ? shift : 0); + mskb->transport_header += (mskb->transport_header ? shift : 0); +# else + ptrdiff_t shift = (mskb->head - old_head) + extra_headroom; + mskb->mac.raw += (mskb->mac.raw ? shift : 0); + mskb->nh.raw += (mskb->nh.raw ? shift : 0); + mskb->h.raw += (mskb->h.raw ? shift : 0); +# endif +#else + ptrdiff_t shift = (_head - old_head) + extra_headroom; + _aa.mac += (_aa.mac ? shift : 0); + _aa.nh += (_aa.nh ? shift : 0); + _aa.h += (_aa.h ? shift : 0); +#endif +} + +/** @cond never */ +/** @brief Return a pointer to the packet's data buffer. + * @deprecated Use buffer() instead. */ +inline const unsigned char * +Packet::buffer_data() const +{ +#if CLICK_LINUXMODULE + return skb()->head; +#else + return _head; +#endif +} + +/** @brief Return a pointer to the address annotation area. + * @deprecated Use anno() instead. + * + * The area is ADDR_ANNO_SIZE bytes long. */ +inline void *Packet::addr_anno() { + return anno_u8() + addr_anno_offset; +} + +/** @overload */ +inline const void *Packet::addr_anno() const { + return anno_u8() + addr_anno_offset; +} + +/** @brief Return a pointer to the user annotation area. + * @deprecated Use Packet::anno() instead. + * + * The area is USER_ANNO_SIZE bytes long. */ +inline void *Packet::user_anno() { + return anno_u8() + user_anno_offset; +} + +/** @overload */ +inline const void *Packet::user_anno() const { + return anno_u8() + user_anno_offset; +} + +/** @brief Return a pointer to the user annotation area as uint8_ts. + * @deprecated Use Packet::anno_u8() instead. */ +inline uint8_t *Packet::user_anno_u8() { + return anno_u8() + user_anno_offset; +} + +/** @brief overload */ +inline const uint8_t *Packet::user_anno_u8() const { + return anno_u8() + user_anno_offset; +} + +/** @brief Return a pointer to the user annotation area as uint32_ts. + * @deprecated Use Packet::anno_u32() instead. */ +inline uint32_t *Packet::user_anno_u32() { + return anno_u32() + user_anno_offset / 4; +} + +/** @brief overload */ +inline const uint32_t *Packet::user_anno_u32() const { + return anno_u32() + user_anno_offset / 4; +} + +/** @brief Return user annotation byte @a i. + * @param i annotation index + * @pre 0 <= @a i < USER_ANNO_SIZE + * @deprecated Use Packet::anno_u8(@a i) instead. */ +inline uint8_t Packet::user_anno_u8(int i) const { + return anno_u8(user_anno_offset + i); +} + +/** @brief Set user annotation byte @a i. + * @param i annotation index + * @param v value + * @pre 0 <= @a i < USER_ANNO_SIZE + * @deprecated Use Packet::set_anno_u8(@a i, @a v) instead. */ +inline void Packet::set_user_anno_u8(int i, uint8_t v) { + set_anno_u8(user_anno_offset + i, v); +} + +/** @brief Return 16-bit user annotation @a i. + * @param i annotation index + * @pre 0 <= @a i < USER_ANNO_U16_SIZE + * @deprecated Use Packet::anno_u16(@a i * 2) instead. + * + * Affects user annotation bytes [2*@a i, 2*@a i+1]. */ +inline uint16_t Packet::user_anno_u16(int i) const { + return anno_u16(user_anno_offset + i * 2); +} + +/** @brief Set 16-bit user annotation @a i. + * @param i annotation index + * @param v value + * @pre 0 <= @a i < USER_ANNO_U16_SIZE + * @deprecated Use Packet::set_anno_u16(@a i * 2, @a v) instead. + * + * Affects user annotation bytes [2*@a i, 2*@a i+1]. */ +inline void Packet::set_user_anno_u16(int i, uint16_t v) { + set_anno_u16(user_anno_offset + i * 2, v); +} + +/** @brief Return 32-bit user annotation @a i. + * @param i annotation index + * @pre 0 <= @a i < USER_ANNO_U32_SIZE + * @deprecated Use Packet::anno_u32(@a i * 4) instead. + * + * Affects user annotation bytes [4*@a i, 4*@a i+3]. */ +inline uint32_t Packet::user_anno_u32(int i) const { + return anno_u32(user_anno_offset + i * 4); +} + +/** @brief Set 32-bit user annotation @a i. + * @param i annotation index + * @param v value + * @pre 0 <= @a i < USER_ANNO_U32_SIZE + * @deprecated Use Packet::set_anno_u32(@a i * 4, @a v) instead. + * + * Affects user annotation bytes [4*@a i, 4*@a i+3]. */ +inline void Packet::set_user_anno_u32(int i, uint32_t v) { + set_anno_u32(user_anno_offset + i * 4, v); +} + +/** @brief Return 32-bit user annotation @a i. + * @param i annotation index + * @pre 0 <= @a i < USER_ANNO_U32_SIZE + * @deprecated Use Packet::anno_s32(@a i * 4) instead. + * + * Affects user annotation bytes [4*@a i, 4*@a i+3]. */ +inline int32_t Packet::user_anno_s32(int i) const { + return anno_s32(user_anno_offset + i * 4); +} + +/** @brief Set 32-bit user annotation @a i. + * @param i annotation index + * @param v value + * @pre 0 <= @a i < USER_ANNO_U32_SIZE + * @deprecated Use Packet::set_anno_s32(@a i * 4, @a v) instead. + * + * Affects user annotation bytes [4*@a i, 4*@a i+3]. */ +inline void Packet::set_user_anno_s32(int i, int32_t v) { + set_anno_s32(user_anno_offset + i * 4, v); +} + +#if HAVE_INT64_TYPES +/** @brief Return 64-bit user annotation @a i. + * @param i annotation index + * @pre 0 <= @a i < USER_ANNO_U64_SIZE + * @deprecated Use Packet::anno_u64(@a i * 8) instead. + * + * Affects user annotation bytes [8*@a i, 8*@a i+7]. */ +inline uint64_t Packet::user_anno_u64(int i) const { + return anno_u64(user_anno_offset + i * 8); +} + +/** @brief Set 64-bit user annotation @a i. + * @param i annotation index + * @param v value + * @pre 0 <= @a i < USER_ANNO_U64_SIZE + * @deprecated Use Packet::set_anno_u64(@a i * 8, @a v) instead. + * + * Affects user annotation bytes [8*@a i, 8*@a i+7]. */ +inline void Packet::set_user_anno_u64(int i, uint64_t v) { + set_anno_u64(user_anno_offset + i * 8, v); +} +#endif + +/** @brief Return a pointer to the user annotation area. + * @deprecated Use anno() instead. */ +inline const uint8_t *Packet::all_user_anno() const { + return anno_u8() + user_anno_offset; +} + +/** @overload + * @deprecated Use anno() instead. */ +inline uint8_t *Packet::all_user_anno() { + return anno_u8() + user_anno_offset; +} + +/** @brief Return a pointer to the user annotation area as uint32_ts. + * @deprecated Use anno_u32() instead. */ +inline const uint32_t *Packet::all_user_anno_u() const { + return anno_u32() + user_anno_offset / 4; +} + +/** @overload + * @deprecated Use anno_u32() instead. */ +inline uint32_t *Packet::all_user_anno_u() { + return anno_u32() + user_anno_offset / 4; +} + +/** @brief Return user annotation byte @a i. + * @deprecated Use anno_u8() instead. */ +inline uint8_t Packet::user_anno_c(int i) const { + return anno_u8(user_anno_offset + i); +} + +/** @brief Set user annotation byte @a i. + * @deprecated Use set_anno_u8() instead. */ +inline void Packet::set_user_anno_c(int i, uint8_t v) { + set_anno_u8(user_anno_offset + i, v); +} + +/** @brief Return 16-bit user annotation @a i. + * @deprecated Use anno_u16() instead. */ +inline uint16_t Packet::user_anno_us(int i) const { + return anno_u16(user_anno_offset + i * 2); +} + +/** @brief Set 16-bit user annotation @a i. + * @deprecated Use set_anno_u16() instead. */ +inline void Packet::set_user_anno_us(int i, uint16_t v) { + set_anno_u16(user_anno_offset + i * 2, v); +} + +/** @brief Return 16-bit user annotation @a i. + * @deprecated Use anno_u16() instead. */ +inline int16_t Packet::user_anno_s(int i) const { + return (int16_t) anno_u16(user_anno_offset + i * 2); +} + +/** @brief Set 16-bit user annotation @a i. + * @deprecated Use set_anno_u16() instead. */ +inline void Packet::set_user_anno_s(int i, int16_t v) { + set_anno_u16(user_anno_offset + i * 2, v); +} + +/** @brief Return 32-bit user annotation @a i. + * @deprecated Use anno_u32() instead. */ +inline uint32_t Packet::user_anno_u(int i) const { + return anno_u32(user_anno_offset + i * 4); +} + +/** @brief Set 32-bit user annotation @a i. + * @deprecated Use set_anno_u32() instead. */ +inline void Packet::set_user_anno_u(int i, uint32_t v) { + set_anno_u32(user_anno_offset + i * 4, v); +} + +/** @brief Return 32-bit user annotation @a i. + * @deprecated Use anno_s32() instead. */ +inline int32_t Packet::user_anno_i(int i) const { + return anno_s32(user_anno_offset + i * 4); +} + +/** @brief Set 32-bit user annotation @a i. + * @deprecated Use set_anno_s32() instead. */ +inline void Packet::set_user_anno_i(int i, int32_t v) { + set_anno_s32(user_anno_offset + i * 4, v); +} +/** @endcond never */ + +inline unsigned char * +WritablePacket::data() const +{ + return const_cast(Packet::data()); +} + +inline unsigned char * +WritablePacket::end_data() const +{ + return const_cast(Packet::end_data()); +} + +inline unsigned char * +WritablePacket::buffer() const +{ + return const_cast(Packet::buffer()); +} + +inline unsigned char * +WritablePacket::end_buffer() const +{ + return const_cast(Packet::end_buffer()); +} + +inline unsigned char * +WritablePacket::mac_header() const +{ + return const_cast(Packet::mac_header()); +} + +inline unsigned char * +WritablePacket::network_header() const +{ + return const_cast(Packet::network_header()); +} + +inline unsigned char * +WritablePacket::transport_header() const +{ + return const_cast(Packet::transport_header()); +} + +inline click_ether * +WritablePacket::ether_header() const +{ + return const_cast(Packet::ether_header()); +} + +inline click_ip * +WritablePacket::ip_header() const +{ + return const_cast(Packet::ip_header()); +} + +inline click_ip6 * +WritablePacket::ip6_header() const +{ + return const_cast(Packet::ip6_header()); +} + +inline click_icmp * +WritablePacket::icmp_header() const +{ + return const_cast(Packet::icmp_header()); +} + +inline click_tcp * +WritablePacket::tcp_header() const +{ + return const_cast(Packet::tcp_header()); +} + +inline click_udp * +WritablePacket::udp_header() const +{ + return const_cast(Packet::udp_header()); +} + +/** @cond never */ +inline unsigned char * +WritablePacket::buffer_data() const +{ + return const_cast(Packet::buffer()); +} +/** @endcond never */ + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/packet_anno.hh b/openflow/include/click/packet_anno.hh new file mode 100644 index 0000000..80b7ee6 --- /dev/null +++ b/openflow/include/click/packet_anno.hh @@ -0,0 +1,137 @@ +#ifndef CLICK_PACKET_ANNO_HH +#define CLICK_PACKET_ANNO_HH + +#define MAKE_ANNOTATIONINFO(offset, size) ((size) << 16 | (offset)) +#define ANNOTATIONINFO_SIZE(ai) ((ai) >> 16) +#define ANNOTATIONINFO_OFFSET(ai) ((uint16_t) (ai)) + +#define DST_IP_ANNO_OFFSET 0 +#define DST_IP_ANNO_SIZE 4 + +#define DST_IP6_ANNO_OFFSET 0 +#define DST_IP6_ANNO_SIZE 16 + +// bytes 16-31 +#define WIFI_EXTRA_ANNO_OFFSET 16 +#define WIFI_EXTRA_ANNO_SIZE 24 +#define WIFI_EXTRA_ANNO(p) ((click_wifi_extra *) ((p)->anno_u8() + WIFI_EXTRA_ANNO_OFFSET)) + +// byte 16 +#define PAINT_ANNO_OFFSET 16 +#define PAINT_ANNO_SIZE 1 +#define PAINT_ANNO(p) ((p)->anno_u8(PAINT_ANNO_OFFSET)) +#define SET_PAINT_ANNO(p, v) ((p)->set_anno_u8(PAINT_ANNO_OFFSET, (v))) + +// byte 17 +#define ICMP_PARAMPROB_ANNO_OFFSET 17 +#define ICMP_PARAMPROB_ANNO_SIZE 1 +#define ICMP_PARAMPROB_ANNO(p) ((p)->anno_u8(ICMP_PARAMPROB_ANNO_OFFSET)) +#define SET_ICMP_PARAMPROB_ANNO(p, v) ((p)->set_anno_u8(ICMP_PARAMPROB_ANNO_OFFSET, (v))) + +// byte 19 +#define FIX_IP_SRC_ANNO_OFFSET 19 +#define FIX_IP_SRC_ANNO_SIZE 1 +#define FIX_IP_SRC_ANNO(p) ((p)->anno_u8(FIX_IP_SRC_ANNO_OFFSET)) +#define SET_FIX_IP_SRC_ANNO(p, v) ((p)->set_anno_u8(FIX_IP_SRC_ANNO_OFFSET, (v))) + +// bytes 20-21 +#define VLAN_TCI_ANNO_OFFSET 20 +#define VLAN_TCI_ANNO_SIZE 2 +#define VLAN_TCI_ANNO(p) ((p)->anno_u16(VLAN_TCI_ANNO_OFFSET)) +#define SET_VLAN_TCI_ANNO(p, v) ((p)->set_anno_u16(VLAN_TCI_ANNO_OFFSET, (v))) + +// bytes 20-23 +#define AGGREGATE_ANNO_OFFSET 20 +#define AGGREGATE_ANNO_SIZE 4 +#define AGGREGATE_ANNO(p) ((p)->anno_u32(AGGREGATE_ANNO_OFFSET)) +#define SET_AGGREGATE_ANNO(p, v) ((p)->set_anno_u32(AGGREGATE_ANNO_OFFSET, (v))) + +#define FWD_RATE_ANNO_OFFSET 20 +#define FWD_RATE_ANNO_SIZE 4 +#define FWD_RATE_ANNO(p) ((p)->anno_s32(FWD_RATE_ANNO_OFFSET)) +#define SET_FWD_RATE_ANNO(p, v) ((p)->set_anno_s32(FWD_RATE_ANNO_OFFSET, (v))) + +#define MISC_IP_ANNO_OFFSET 20 +#define MISC_IP_ANNO_SIZE 4 +#define MISC_IP_ANNO(p) ((p)->anno_u32(MISC_IP_ANNO_OFFSET)) +#define SET_MISC_IP_ANNO(p, v) ((p)->set_anno_u32(MISC_IP_ANNO_OFFSET, (v).addr())) + +// bytes 24-27 +#define EXTRA_PACKETS_ANNO_OFFSET 24 +#define EXTRA_PACKETS_ANNO_SIZE 4 +#define EXTRA_PACKETS_ANNO(p) ((p)->anno_u32(EXTRA_PACKETS_ANNO_OFFSET)) +#define SET_EXTRA_PACKETS_ANNO(p, v) ((p)->set_anno_u32(EXTRA_PACKETS_ANNO_OFFSET, (v))) + +#define REV_RATE_ANNO_OFFSET 24 +#define REV_RATE_ANNO_SIZE 4 +#define REV_RATE_ANNO(p) ((p)->anno_s32(REV_RATE_ANNO_OFFSET)) +#define SET_REV_RATE_ANNO(p, v) ((p)->set_anno_s32(REV_RATE_ANNO_OFFSET, (v))) + +// byte 26 +#define SEND_ERR_ANNO_OFFSET 26 +#define SEND_ERR_ANNO_SIZE 1 +#define SEND_ERR_ANNO(p) ((p)->anno_u8(SEND_ERR_ANNO_OFFSET)) +#define SET_SEND_ERR_ANNO(p, v) ((p)->set_anno_u8(SEND_ERR_ANNO_OFFSET, (v))) + +// byte 27 +#define GRID_ROUTE_CB_ANNO_OFFSET 27 +#define GRID_ROUTE_CB_ANNO_SIZE 1 +#define GRID_ROUTE_CB_ANNO(p) ((p)->anno_u8(GRID_ROUTE_CB_ANNO_OFFSET)) +#define SET_GRID_ROUTE_CB_ANNO(p, v) ((p)->set_anno_u8(GRID_ROUTE_CB_ANNO_OFFSET, (v))) + +// bytes 28-31 +#define IPREASSEMBLER_ANNO_OFFSET 28 +#define IPREASSEMBLER_ANNO_SIZE 4 + +#define EXTRA_LENGTH_ANNO_OFFSET 28 +#define EXTRA_LENGTH_ANNO_SIZE 4 +#define EXTRA_LENGTH_ANNO(p) ((p)->anno_u32(EXTRA_LENGTH_ANNO_OFFSET)) +#define SET_EXTRA_LENGTH_ANNO(p, v) ((p)->set_anno_u32(EXTRA_LENGTH_ANNO_OFFSET, (v))) + +// bytes 32-39 +#define FIRST_TIMESTAMP_ANNO_OFFSET 32 +#define FIRST_TIMESTAMP_ANNO_SIZE 8 +#define CONST_FIRST_TIMESTAMP_ANNO(p) (*(reinterpret_cast((p)->anno_u8() + FIRST_TIMESTAMP_ANNO_OFFSET))) +#define FIRST_TIMESTAMP_ANNO(p) (*(reinterpret_cast((p)->anno_u8() + FIRST_TIMESTAMP_ANNO_OFFSET))) +#define SET_FIRST_TIMESTAMP_ANNO(p, v) (*(reinterpret_cast((p)->anno_u8() + FIRST_TIMESTAMP_ANNO_OFFSET)) = (v)) + +// bytes 32-35 +#define PACKET_NUMBER_ANNO_OFFSET 32 +#define PACKET_NUMBER_ANNO_SIZE 4 +#define PACKET_NUMBER_ANNO(p) ((p)->anno_u32(PACKET_NUMBER_ANNO_OFFSET)) +#define SET_PACKET_NUMBER_ANNO(p, v) ((p)->set_anno_u32(PACKET_NUMBER_ANNO_OFFSET, (v))) + +#define IPSEC_SPI_ANNO_OFFSET 32 +#define IPSEC_SPI_ANNO_SIZE 4 +#define IPSEC_SPI_ANNO(p) ((p)->anno_u32(IPSEC_SPI_ANNO_OFFSET)) +#define SET_IPSEC_SPI_ANNO(p, v) ((p)->set_anno_u32(IPSEC_SPI_ANNO_OFFSET, (v))) + +// bytes 36-39 +#define SEQUENCE_NUMBER_ANNO_OFFSET 36 +#define SEQUENCE_NUMBER_ANNO_SIZE 4 +#define SEQUENCE_NUMBER_ANNO(p) ((p)->anno_u32(SEQUENCE_NUMBER_ANNO_OFFSET)) +#define SET_SEQUENCE_NUMBER_ANNO(p, v) ((p)->set_anno_u32(SEQUENCE_NUMBER_ANNO_OFFSET, (v))) + +#if SIZEOF_VOID_P == 4 +# define IPSEC_SA_DATA_REFERENCE_ANNO_OFFSET 36 +# define IPSEC_SA_DATA_REFERENCE_ANNO_SIZE 4 +# define IPSEC_SA_DATA_REFERENCE_ANNO(p) ((p)->anno_u32(IPSEC_SA_DATA_REFERENCE_ANNO_OFFSET)) +# define SET_IPSEC_SA_DATA_REFERENCE_ANNO(p, v) ((p)->set_anno_u32(IPSEC_SA_DATA_REFERENCE_ANNO_OFFSET, (v))) +#endif + +#if HAVE_INT64_TYPES +// bytes 40-47 +# define PERFCTR_ANNO_OFFSET 40 +# define PERFCTR_ANNO_SIZE 8 +# define PERFCTR_ANNO(p) ((p)->anno_u64(PERFCTR_ANNO_OFFSET)) +# define SET_PERFCTR_ANNO(p, v) ((p)->set_anno_u64(PERFCTR_ANNO_OFFSET, (v))) + +# if SIZEOF_VOID_P == 8 +# define IPSEC_SA_DATA_REFERENCE_ANNO_OFFSET 40 +# define IPSEC_SA_DATA_REFERENCE_ANNO_SIZE 8 +# define IPSEC_SA_DATA_REFERENCE_ANNO(p) ((p)->anno_u64(IPSEC_SA_DATA_REFERENCE_ANNO_OFFSET)) +# define SET_IPSEC_SA_DATA_REFERENCE_ANNO(p, v) ((p)->set_anno_u64(IPSEC_SA_DATA_REFERENCE_ANNO_OFFSET, (v))) +# endif +#endif + +#endif diff --git a/openflow/include/click/pair.hh b/openflow/include/click/pair.hh new file mode 100644 index 0000000..76b6f8f --- /dev/null +++ b/openflow/include/click/pair.hh @@ -0,0 +1,89 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_PAIR_HH +#define CLICK_PAIR_HH +#include +#include +CLICK_DECLS + +template +struct Pair { + + typedef T first_type; + typedef U second_type; + typedef T key_type; + typedef const T &key_const_reference; + + T first; + U second; + + inline Pair() + : first(), second() { + } + + inline Pair(typename fast_argument::type t, + typename fast_argument::type u) + : first(t), second(u) { + } + + inline Pair(const Pair &p) + : first(p.first), second(p.second) { + } + + template + inline Pair(const Pair &p) + : first(p.first), second(p.second) { + } + + typedef hashcode_t (Pair::*unspecified_bool_type)() const; + inline operator unspecified_bool_type() const { + return first || second ? &Pair::hashcode : 0; + } + + inline const T &hashkey() const { + return first; + } + + inline hashcode_t hashcode() const; + + template + Pair &operator=(const Pair &p) { + first = p.first; + second = p.second; + return *this; + } + +}; + +template +inline bool operator==(const Pair &a, const Pair &b) +{ + return a.first == b.first && a.second == b.second; +} + +template +inline bool operator!=(const Pair &a, const Pair &b) +{ + return a.first != b.first || a.second != b.second; +} + +template +inline bool operator<(const Pair &a, const Pair &b) +{ + return a.first < b.first + || (!(b.first < a.first) && a.second < b.second); +} + +template +inline hashcode_t Pair::hashcode() const +{ + return (CLICK_NAME(hashcode)(first) << 7) ^ CLICK_NAME(hashcode)(second); +} + +template +inline Pair make_pair(T t, U u) +{ + return Pair(t, u); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/pathvars.h b/openflow/include/click/pathvars.h new file mode 100644 index 0000000..9a5ddc2 --- /dev/null +++ b/openflow/include/click/pathvars.h @@ -0,0 +1,42 @@ +/* include/click/pathvars.h. Generated from pathvars.h.in by configure. */ +/* Process this file with configure to produce pathvars.h. -*- mode: c -*- */ +#ifndef CLICK_PATHVARS_H +#define CLICK_PATHVARS_H + +/* Install directory for Click executables. */ +#define CLICK_BINDIR "/usr/local/bin" + +/* Install directory for Click libraries and packages. */ +#define CLICK_LIBDIR "/usr/local/lib" + +/* Install directory for Click shared data. */ +#define CLICK_DATADIR "/usr/local/share/click" + +/* FreeBSD kernel include directory. */ +#define FREEBSD_INCLUDEDIR "/usr/include" + +/* Define if the BSD kernel module driver was compiled. */ +/* #undef HAVE_BSDMODULE_DRIVER */ + +/* Define if the Click kernel module should provide clickfs. */ +#define HAVE_CLICKFS 1 + +/* Define if the expat library is available. */ +#define HAVE_EXPAT 1 + +/* Define if the Click linuxmodule is compiled for a 2.6 kernel. */ +/* #undef HAVE_LINUXMODULE_2_6 */ + +/* Define if the Linux kernel module driver was compiled. */ +/* #undef HAVE_LINUXMODULE_DRIVER */ + +/* Define if the minios driver was compiled. */ +/* #undef HAVE_MINIOS_DRIVER */ + +/* Define if the user-level driver was compiled. */ +#define HAVE_USERLEVEL_DRIVER 1 + +/* Directory containing Linux sources. */ +#define LINUX_SRCDIR "NONE" + +#endif diff --git a/openflow/include/click/perfctr-i586.hh b/openflow/include/click/perfctr-i586.hh new file mode 100644 index 0000000..713bc9d --- /dev/null +++ b/openflow/include/click/perfctr-i586.hh @@ -0,0 +1,37 @@ +#ifndef CLICK_PERFCTR_HH +#define CLICK_PERFCTR_HH +#ifdef __KERNEL__ +# include +# include +CLICK_CXX_PROTECT +# include +CLICK_CXX_UNPROTECT +# include +#endif + +#define DCU_MISS_OUTSTANDING 0x48 +#define INST_RETIRED 0xC0 +#define IFU_FETCH 0x80 +#define IFU_FETCH_MISS 0x81 +#define IFU_MEM_STALL 0x86 +#define L2_LINES_IN 0x24 +#define L2_LINES_OUT 0x26 +#define L2_IFETCH 0x28 | (0xF<<8) +#define L2_LD 0x29 | (0xF<<8) +#define L2_LINES_OUTM 0x27 +#define L2_RQSTS 0x2E | (0xF<<8) +#define BUS_LOCK_CLOCKS 0x63 +#define BUS_TRAN_RFO 0x66 +#define BUS_TRAN_INVAL 0x69 +#define BUS_TRAN_MEM 0x6F + +#define MSR_OS (1<<17) +#define MSR_OCCURRENCE (1<<18) +#define MSR_ENABLE (1<<22) +#define MSR_FLAGS0 (MSR_OS|MSR_OCCURRENCE|MSR_ENABLE) +#define MSR_FLAGS1 (MSR_OS|MSR_OCCURRENCE) + +#define MSR_EVNTSEL0 0x186 +#define MSR_EVNTSEL1 0x187 + +#endif diff --git a/openflow/include/click/router.hh b/openflow/include/click/router.hh new file mode 100644 index 0000000..e4eb40c --- /dev/null +++ b/openflow/include/click/router.hh @@ -0,0 +1,624 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/router.cc" -*- +#ifndef CLICK_ROUTER_HH +#define CLICK_ROUTER_HH +#include +#include +#include +#include +#include +#if CLICK_NS +# include +#endif +CLICK_DECLS +class Master; +class ElementFilter; +class RouterVisitor; +class RouterThread; +class HashMap_ArenaFactory; +class NotifierSignal; +class ThreadSched; +class Handler; +class NameInfo; + +class Router { public: + + /** @name Public Member Functions */ + //@{ + // MASTER + inline Master* master() const; + + // STATUS + inline bool initialized() const; + inline bool handlers_ready() const; + inline bool running() const; + inline bool dying() const; + + // RUNCOUNT AND RUNCLASS + enum { STOP_RUNCOUNT = -2147483647 - 1 }; + inline int32_t runcount() const; + void adjust_runcount(int32_t delta); + void set_runcount(int32_t rc); + inline void please_stop_driver(); + + // ELEMENTS + inline const Vector& elements() const; + inline int nelements() const; + inline Element* element(int i) const; + inline Element* root_element() const; + static Element* element(const Router *router, int i); + + const String& ename(int i) const; + String ename_context(int i) const; + String elandmark(int i) const; + const String& econfiguration(int i) const; + void set_econfiguration(int i, const String& conf); + + Element* find(const String& name, ErrorHandler* errh = 0) const; + Element* find(const String& name, String context, ErrorHandler* errh = 0) const; + Element* find(const String& name, const Element* context, ErrorHandler* errh = 0) const; + + int visit(Element *e, bool isoutput, int port, RouterVisitor *visitor) const; + int visit_downstream(Element *e, int port, RouterVisitor *visitor) const; + int visit_upstream(Element *e, int port, RouterVisitor *visitor) const; + + int downstream_elements(Element *e, int port, ElementFilter *filter, Vector &result) CLICK_DEPRECATED; + int upstream_elements(Element *e, int port, ElementFilter *filter, Vector &result) CLICK_DEPRECATED; + + inline const char *flow_code_override(int eindex) const; + void set_flow_code_override(int eindex, const String &flow_code); + + // HANDLERS + // 'const Handler *' results last until that element/handlername modified + static const Handler *handler(const Element *e, const String &hname); + static void add_read_handler(const Element *e, const String &hname, ReadHandlerCallback callback, void *user_data, uint32_t flags = 0); + static void add_write_handler(const Element *e, const String &hname, WriteHandlerCallback callback, void *user_data, uint32_t flags = 0); + static void set_handler(const Element *e, const String &hname, uint32_t flags, HandlerCallback callback, void *read_user_data = 0, void *write_user_data = 0); + static int set_handler_flags(const Element *e, const String &hname, uint32_t set_flags, uint32_t clear_flags = 0); + + enum { FIRST_GLOBAL_HANDLER = 0x40000000 }; + static int hindex(const Element *e, const String &hname); + static const Handler *handler(const Router *router, int hindex); + static void element_hindexes(const Element *e, Vector &result); + + // ATTACHMENTS AND REQUIREMENTS + void* attachment(const String& aname) const; + void*& force_attachment(const String& aname); + void* set_attachment(const String& aname, void* value); + + ErrorHandler* chatter_channel(const String& channel_name) const; + HashMap_ArenaFactory* arena_factory() const; + + inline ThreadSched* thread_sched() const; + inline void set_thread_sched(ThreadSched* scheduler); + inline int home_thread_id(const Element* e) const; + inline void set_home_thread_id(const Element* e, int home_thread); + + /** @cond never */ + // Needs to be public for NameInfo, but not useful outside + inline NameInfo* name_info() const; + NameInfo* force_name_info(); + /** @endcond never */ + + // UNPARSING + String configuration_string() const; + void unparse(StringAccum& sa, const String& indent = String()) const; + void unparse_requirements(StringAccum& sa, const String& indent = String()) const; + void unparse_declarations(StringAccum& sa, const String& indent = String()) const; + void unparse_connections(StringAccum& sa, const String& indent = String()) const; + + String element_ports_string(const Element *e) const; + //@} + + // INITIALIZATION + /** @name Internal Functions */ + //@{ + Router(const String& configuration, Master* master); + ~Router(); + + static void static_initialize(); + static void static_cleanup(); + + inline void use(); + void unuse(); + + void add_requirement(const String &type, const String &value); + int add_element(Element *e, const String &name, const String &conf, const String &filename, unsigned lineno); + int add_connection(int from_idx, int from_port, int to_idx, int to_port); +#if CLICK_LINUXMODULE + int add_module_ref(struct module* module); +#endif + + inline Router* hotswap_router() const; + void set_hotswap_router(Router* router); + + int initialize(ErrorHandler* errh); + void activate(bool foreground, ErrorHandler* errh); + inline void activate(ErrorHandler* errh); + inline void set_foreground(bool foreground); + + int new_notifier_signal(const char *name, NotifierSignal &signal); + String notifier_signal_name(const atomic_uint32_t *signal) const; + //@} + + /** @cond never */ + // Needs to be public for Lexer, etc., but not useful outside + struct Port { + int idx; + int port; + + Port() { + } + Port(int i, int p) + : idx(i), port(p) { + } + + bool operator==(const Port &x) const { + return idx == x.idx && port == x.port; + } + bool operator!=(const Port &x) const { + return idx != x.idx || port != x.port; + } + bool operator<(const Port &x) const { + return idx < x.idx || (idx == x.idx && port < x.port); + } + bool operator<=(const Port &x) const { + return idx < x.idx || (idx == x.idx && port <= x.port); + } + }; + + struct Connection { + Port p[2]; + + Connection() { + } + Connection(int from_idx, int from_port, int to_idx, int to_port) { + p[0] = Port(to_idx, to_port); + p[1] = Port(from_idx, from_port); + } + + const Port &operator[](int i) const { + assert(i >= 0 && i < 2); + return p[i]; + } + Port &operator[](int i) { + assert(i >= 0 && i < 2); + return p[i]; + } + + bool operator==(const Connection &x) const { + return p[0] == x.p[0] && p[1] == x.p[1]; + } + bool operator<(const Connection &x) const { + return p[0] < x.p[0] || (p[0] == x.p[0] && p[1] < x.p[1]); + } + }; + /** @endcond never */ + +#if CLICK_NS + simclick_node_t *simnode() const; + int sim_get_ifid(const char* ifname); + int sim_listen(int ifid, int element); + int sim_if_ready(int ifid); + int sim_write(int ifid, int ptype, const unsigned char *, int len, + simclick_simpacketinfo *pinfo); + int sim_incoming_packet(int ifid, int ptype, const unsigned char *, + int len, simclick_simpacketinfo* pinfo); + void sim_trace(const char* event); + int sim_get_node_id(); + int sim_get_next_pkt_id(); + int sim_if_promisc(int ifid); + + protected: + Vector *> _listenvecs; + Vector* sim_listenvec(int ifid); +#endif + + private: + + class RouterContextErrh; + + enum { + ROUTER_NEW, ROUTER_PRECONFIGURE, ROUTER_PREINITIALIZE, + ROUTER_LIVE, ROUTER_DEAD // order is important + }; + enum { + RUNNING_DEAD = -2, RUNNING_INACTIVE = -1, RUNNING_PREPARING = 0, + RUNNING_BACKGROUND = 1, RUNNING_ACTIVE = 2 + }; + + Master* _master; + + atomic_uint32_t _runcount; + + volatile int _state; + bool _have_connections : 1; + mutable bool _conn_sorted : 1; + bool _have_configuration : 1; + volatile int _running; + + atomic_uint32_t _refcount; + + Vector _elements; + Vector _element_names; + Vector _element_configurations; + Vector _element_landmarkids; + mutable Vector _element_home_thread_ids; + + struct element_landmark_t { + uint32_t first_landmarkid; + String filename; + }; + Vector _element_landmarks; + uint32_t _last_landmarkid; + + mutable Vector _element_name_sorter; + Vector _element_gport_offset[2]; + Vector _element_configure_order; + + mutable Vector _conn; + mutable Vector _conn_output_sorter; + + Vector _requirements; + + Vector _ehandler_first_by_element; + Vector _ehandler_to_handler; + Vector _ehandler_next; + + Vector _handler_first_by_name; + + enum { HANDLER_BUFSIZ = 256 }; + Handler** _handler_bufs; + int _nhandlers_bufs; + int _free_handler; + + Vector _attachment_names; + Vector _attachments; + + Element* _root_element; + String _configuration; + + struct notifier_signals_t { + enum { capacity = 4096 }; + String name; + int nsig; + atomic_uint32_t sig[capacity / 32]; + notifier_signals_t *next; + notifier_signals_t(const String &n, notifier_signals_t *nx) + : name(n), nsig(0), next(nx) { + memset(&sig[0], 0, sizeof(sig)); + } + }; + notifier_signals_t *_notifier_signals; + HashMap_ArenaFactory* _arena_factory; + Router* _hotswap_router; + ThreadSched* _thread_sched; + mutable NameInfo* _name_info; + Vector _flow_code_override_eindex; + Vector _flow_code_override; + + Router* _next_router; + +#if CLICK_LINUXMODULE + Vector _modules; +#endif + + Router(const Router&); + Router& operator=(const Router&); + + Connection *remove_connection(Connection *cp); + void hookup_error(const Port &p, bool isoutput, const char *message, + ErrorHandler *errh, bool active = false); + int check_hookup_elements(ErrorHandler*); + int check_hookup_range(ErrorHandler*); + int check_hookup_completeness(ErrorHandler*); + + const char *hard_flow_code_override(int e) const; + int processing_error(const Connection &conn, bool, int, ErrorHandler*); + int check_push_and_pull(ErrorHandler*); + + void set_connections(); + void sort_connections() const; + int connindex_lower_bound(bool isoutput, const Port &port) const; + + void make_gports(); + inline int ngports(bool isout) const { + return _element_gport_offset[isout].back(); + } + inline int gport(bool isoutput, const Port &port) const; + + int hard_home_thread_id(const Element *e) const; + + int element_lerror(ErrorHandler*, Element*, const char*, ...) const; + + // private handler methods + void initialize_handlers(bool, bool); + inline Handler* xhandler(int) const; + int find_ehandler(int, const String&, bool allow_star) const; + static inline Handler fetch_handler(const Element*, const String&); + void store_local_handler(int eindex, Handler &h); + static void store_global_handler(Handler &h); + static inline void store_handler(const Element *element, Handler &h); + + // global handlers + static String router_read_handler(Element *e, void *user_data); + static int router_write_handler(const String &str, Element *e, void *user_data, ErrorHandler *errh); + + /** @cond never */ + friend class Master; + friend class Task; + friend int Element::set_nports(int, int); + /** @endcond never */ + +}; + + +/** @brief Increment the router's reference count. + * + * Routers are reference counted objects. A Router is created with one + * reference, which is held by its Master object. Normally the Router and + * all its elements will be deleted when the Master drops this reference, but + * you can preserve the Router for longer by adding a reference yourself. */ +inline void +Router::use() +{ + _refcount++; +} + +/** @brief Return true iff the router is currently running. + * + * A running router has been successfully initialized (so running() implies + * initialized()), and has not stopped yet. */ +inline bool +Router::running() const +{ + return _running > 0; +} + +/** @brief Return true iff the router is in the process of being killed. */ +inline bool +Router::dying() const +{ + return _running == RUNNING_DEAD; +} + +/** @brief Return true iff the router has been successfully initialized. */ +inline bool +Router::initialized() const +{ + return _state == ROUTER_LIVE; +} + +/** @brief Return true iff the router's handlers have been initialized. + * + * handlers_ready() returns false until each element's + * Element::add_handlers() method has been called. This happens after + * Element::configure(), but before Element::initialize(). */ +inline bool +Router::handlers_ready() const +{ + return _state > ROUTER_PRECONFIGURE; +} + +/** @brief Returns a vector containing all the router's elements. + * @invariant elements()[i] == element(i) for all i in range. */ +inline const Vector& +Router::elements() const +{ + return _elements; +} + +/** @brief Returns the number of elements in the router. */ +inline int +Router::nelements() const +{ + return _elements.size(); +} + +/** @brief Returns the element with index @a i. + * @param i element index, or -1 for root_element() + * @invariant If element(i) isn't null, then element(i)->@link Element::eindex eindex@endlink() == i. + * + * This function returns the element with index @a i. If @a i == + * -1, returns root_element(). If @a i is otherwise out of range, + * returns null. */ +inline Element* +Router::element(int i) const +{ + return element(this, i); +} + +/** @brief Returns this router's root element. + * + * Every router has a root Element. This element has Element::eindex() -1 and + * name "". It is not configured or initialized, and doesn't appear in the + * configuration; it exists only for convenience, when other Click code needs + * to refer to some arbitrary element at the top level of the compound + * element hierarchy. */ +inline Element* +Router::root_element() const +{ + return _root_element; +} + +inline ThreadSched* +Router::thread_sched() const +{ + return _thread_sched; +} + +inline void +Router::set_thread_sched(ThreadSched* ts) +{ + _thread_sched = ts; +} + +inline int +Router::home_thread_id(const Element* e) const +{ + if (initialized()) + return _element_home_thread_ids[e->eindex() + 1]; + else + return hard_home_thread_id(e); +} + +inline void +Router::set_home_thread_id(const Element* e, int home_thread_id) +{ + _element_home_thread_ids[e->eindex() + 1] = home_thread_id; +} + +/** @cond never */ +/** @brief Return the NameInfo object for this router, if it exists. + * + * Users never need to call this. */ +inline NameInfo* +Router::name_info() const +{ + return _name_info; +} +/** @endcond never */ + +/** @brief Return the Master object for this router. */ +inline Master* +Router::master() const +{ + return _master; +} + +/** @brief Return the router's runcount. + * + * The runcount is an integer that determines whether the router is running. + * A running router has positive runcount. Decrementing the router's runcount + * to zero or below will cause the router to stop, although elements like + * DriverManager can intercept the stop request and continue processing. + * + * Elements request that the router stop its processing by calling + * adjust_runcount() or please_stop_driver(). */ +inline int32_t +Router::runcount() const +{ + return _runcount.value(); +} + +/** @brief Request a driver stop by adjusting the runcount by -1. + * @note Equivalent to adjust_runcount(-1). */ +inline void +Router::please_stop_driver() +{ + adjust_runcount(-1); +} + +/** @brief Returns the overriding flow code for element @a e, if any. + * @param eindex element index + * @return The flow code, or null if none has been set. */ +inline const char * +Router::flow_code_override(int eindex) const +{ + if (_flow_code_override.size()) + return hard_flow_code_override(eindex); + else + return 0; +} + +inline void +Router::activate(ErrorHandler* errh) +{ + activate(true, errh); +} + +inline void +Router::set_foreground(bool foreground) +{ + assert(_running >= RUNNING_BACKGROUND); + _running = foreground ? RUNNING_ACTIVE : RUNNING_BACKGROUND; +} + +/** @brief Finds an element named @a name. + * @param name element name + * @param errh optional error handler + * + * Returns the unique element named @a name, if any. If no element named @a + * name is found, reports an error to @a errh and returns null. The error is + * "no element named 'name'". If @a errh is null, no error is + * reported. + * + * This function is equivalent to find(const String&, String, ErrorHandler*) + * with a context argument of the empty string. */ +inline Element * +Router::find(const String& name, ErrorHandler *errh) const +{ + return find(name, "", errh); +} + +/** @brief Traverse the router configuration downstream of @a e[@a port]. + * @param e element to start search + * @param port output port (or -1 to search all output ports) + * @param visitor RouterVisitor traversal object + * @return 0 on success, -1 in early router configuration stages + * + * Calls @a visitor ->@link RouterVisitor::visit visit() @endlink on each + * reachable input port starting from the output port @a e[@a port]. Follows + * connections and traverses inside elements from port to port by + * Element::flow_code(). The visitor can stop a traversal path by returning + * false from visit(). + * + * @sa visit_upstream(), visit() + */ +inline int +Router::visit_downstream(Element *e, int port, RouterVisitor *visitor) const +{ + return visit(e, true, port, visitor); +} + +/** @brief Traverse the router configuration upstream of [@a port]@a e. + * @param e element to start search + * @param port input port (or -1 to search all input ports) + * @param visitor RouterVisitor traversal object + * @return 0 on success, -1 in early router configuration stages + * + * Calls @a visitor ->@link RouterVisitor::visit visit() @endlink on each + * reachable output port starting from the input port [@a port]@a e. Follows + * connections and traverses inside elements from port to port by + * Element::flow_code(). The visitor can stop a traversal path by returning + * false from visit(). + * + * @sa visit_downstream(), visit() + */ +inline int +Router::visit_upstream(Element *e, int port, RouterVisitor *visitor) const +{ + return visit(e, false, port, visitor); +} + +inline HashMap_ArenaFactory* +Router::arena_factory() const +{ + return _arena_factory; +} + +/** @brief Returns the currently-installed router this router will eventually + * replace. + * + * This function is only meaningful during a router's initialization. If this + * router was installed with the hotswap option, then hotswap_router() will + * return the currently-installed router that this router will eventually + * replace (assuming error-free initialization). Otherwise, hotswap_router() + * will return 0. + */ +inline Router* +Router::hotswap_router() const +{ + return _hotswap_router; +} + +inline +Handler::Handler(const String &name) + : _name(name), _read_user_data(0), _write_user_data(0), _flags(0), + _use_count(0), _next_by_name(-1) +{ + _read_hook.r = 0; + _write_hook.w = 0; +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/routerthread.hh b/openflow/include/click/routerthread.hh new file mode 100644 index 0000000..8763577 --- /dev/null +++ b/openflow/include/click/routerthread.hh @@ -0,0 +1,527 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/routerthread.cc" -*- +#ifndef CLICK_ROUTERTHREAD_HH +#define CLICK_ROUTERTHREAD_HH +#include +#include +#include +#if CLICK_LINUXMODULE +# include +CLICK_CXX_PROTECT +# include +CLICK_CXX_UNPROTECT +# include +#elif CLICK_BSDMODULE +# include +CLICK_CXX_PROTECT +# include +CLICK_CXX_UNPROTECT +# include +#elif CLICK_USERLEVEL +# include +#endif + +// NB: user must #include before . +// We cannot #include ourselves because of circular #include +// dependency. +CLICK_DECLS + +class RouterThread { public: + + enum { THREAD_QUIESCENT = -1, THREAD_UNKNOWN = -1000 }; + + inline int thread_id() const; + + inline Master *master() const; + inline TimerSet &timer_set() { return _timers; } + inline const TimerSet &timer_set() const { return _timers; } +#if CLICK_USERLEVEL + inline SelectSet &select_set() { return _selects; } + inline const SelectSet &select_set() const { return _selects; } +#endif + + // Task list functions + inline bool active() const; + inline Task *task_begin() const; + inline Task *task_next(Task *task) const; + inline Task *task_end() const; + void scheduled_tasks(Router *router, Vector &x); + + inline void lock_tasks(); + inline void unlock_tasks(); + + inline void schedule_block_tasks(); + inline void block_tasks(bool scheduled); + inline void unblock_tasks(); + + inline bool stop_flag() const; + + inline void mark_driver_entry(); + void driver(); + + void kill_router(Router *router); + +#if HAVE_ADAPTIVE_SCHEDULER + // min_cpu_share() and max_cpu_share() are expressed on a scale with + // Task::MAX_UTILIZATION == 100%. + unsigned min_cpu_share() const { return _min_click_share; } + unsigned max_cpu_share() const { return _max_click_share; } + unsigned cur_cpu_share() const { return _cur_click_share; } + void set_cpu_share(unsigned min_share, unsigned max_share); +#endif + +#if CLICK_LINUXMODULE || CLICK_BSDMODULE + bool greedy() const { return _greedy; } + void set_greedy(bool g) { _greedy = g; } +#endif + + inline void wake(); + +#if CLICK_USERLEVEL + inline void run_signals(); +#endif + + enum { S_PAUSED, S_BLOCKED, S_TIMERWAIT, + S_LOCKSELECT, S_LOCKTASKS, + S_RUNTASK, S_RUNTIMER, S_RUNSIGNAL, S_RUNPENDING, S_RUNSELECT, + NSTATES }; + inline void set_thread_state(int state); + inline void set_thread_state_for_blocking(int delay_type); +#if CLICK_DEBUG_SCHEDULING + int thread_state() const { return _thread_state; } + static String thread_state_name(int state); + uint32_t driver_epoch() const { return _driver_epoch; } + uint32_t driver_task_epoch() const { return _driver_task_epoch; } + Timestamp task_epoch_time(uint32_t epoch) const; +# if CLICK_LINUXMODULE + struct task_struct *sleeper() const { return _linux_task; } +# endif +# if CLICK_DEBUG_SCHEDULING > 1 + inline Timestamp thread_state_time(int state) const; + inline uint64_t thread_state_count(int state) const; +# endif +#endif + + private: + +#if HAVE_TASK_HEAP + struct task_heap_element { + unsigned pass; + Task *t; + task_heap_element() { + } + task_heap_element(Task *t_) + : pass(t_->_pass), t(t_) { + } + }; +#endif + + // LOCAL STATE GROUP + TaskLink _task_link; + volatile bool _stop_flag; +#if HAVE_TASK_HEAP + Vector _task_heap; +#endif + + TimerSet _timers; +#if CLICK_USERLEVEL + SelectSet _selects; +#endif + +#if HAVE_ADAPTIVE_SCHEDULER + enum { C_CLICK, C_KERNEL, NCLIENTS }; + struct Client { // top-level stride clients + unsigned pass; + unsigned stride; + int tickets; + Client() : pass(0), tickets(0) { } + }; + Client _clients[NCLIENTS]; + unsigned _global_pass; // global pass + unsigned _max_click_share; // maximum allowed Click share of CPU + unsigned _min_click_share; // minimum allowed Click share of CPU + unsigned _cur_click_share; // current Click share + Timestamp _adaptive_restride_timestamp; + int _adaptive_restride_iter; +#endif + + // EXTERNAL STATE GROUP + Spinlock _task_lock CLICK_ALIGNED(CLICK_CACHE_LINE_SIZE); + atomic_uint32_t _task_blocker; + atomic_uint32_t _task_blocker_waiting; + + Task::Pending _pending_head; + Task::Pending *_pending_tail; + SpinlockIRQ _pending_lock; + + // SHARED STATE GROUP + Master *_master CLICK_ALIGNED(CLICK_CACHE_LINE_SIZE); + int _id; + bool _driver_entered; +#if HAVE_MULTITHREAD && !(CLICK_LINUXMODULE || CLICK_MINIOS) + click_processor_t _running_processor; +#endif +#if CLICK_LINUXMODULE + bool _greedy; + struct task_struct *_linux_task; +#endif +#if CLICK_MINIOS + struct thread *_minios_thread; +#endif + public: + unsigned _tasks_per_iter; + unsigned _iters_per_os; + private: + +#if CLICK_NS + Timestamp _ns_scheduled; + Timestamp _ns_last_active; + int _ns_active_iter; + enum { ns_iters_per_time = 1000 }; +#endif + +#if CLICK_BSDMODULE + // XXX FreeBSD + u_int64_t _old_tsc; /* MARKO - temp. */ + void *_sleep_ident; + int _oticks; + bool _greedy; +#endif + +#if CLICK_DEBUG_SCHEDULING + int _thread_state; + uint32_t _driver_epoch; + uint32_t _driver_task_epoch; + enum { TASK_EPOCH_BUFSIZ = 32 }; + uint32_t _task_epoch_first; + Timestamp _task_epoch_time[TASK_EPOCH_BUFSIZ]; +# if CLICK_DEBUG_SCHEDULING > 1 + Timestamp _thread_state_time[NSTATES]; + uint64_t _thread_state_count[NSTATES]; + Timestamp _thread_state_timestamp; +# endif +#endif + + // called by Master + RouterThread(Master *master, int threadno); + ~RouterThread(); + + // task requests + inline void add_pending(); +#if HAVE_STRIDE_SCHED + inline unsigned pass() const { +# if HAVE_TASK_HEAP + return _task_heap.size() ? _task_heap.unchecked_at(0).pass : 0; +# else + return _task_link._next->_pass; +# endif + } +#endif + + // task running functions + void driver_lock_tasks(); + inline void driver_unlock_tasks() { + uint32_t val = _task_blocker.compare_swap((uint32_t) -1, 0); + (void) val; + assert(val == (uint32_t) -1); + } + + inline void run_tasks(int ntasks); + inline void process_pending(); + inline void run_os(); +#if HAVE_ADAPTIVE_SCHEDULER + void client_set_tickets(int client, int tickets); + inline void client_update_pass(int client, const Timestamp &before); +#endif +#if HAVE_TASK_HEAP + void task_reheapify_from(int pos, Task*); +#endif + static inline bool running_in_interrupt(); + inline bool current_thread_is_running() const; + inline bool current_thread_is_running_cleanup() const; + + friend class Task; + friend class Master; +#if CLICK_USERLEVEL + friend class SelectSet; +#endif + +}; + + +/** @brief Returns this thread's ID. + * + * The result is >= 0 for true threads, and < 0 for threads that never run any + * of their associated Tasks. + */ +inline int +RouterThread::thread_id() const +{ + return _id; +} + +/** @brief Returns this thread's associated Master. */ +inline Master* +RouterThread::master() const +{ + return _master; +} + +/** @brief Returns whether any tasks are scheduled. + * + * Returns false iff no tasks are scheduled and no events are pending. Since + * not all events actually matter (for example, a Task might have been + * scheduled and then subsequently unscheduled), active() may temporarily + * return true even when no real events are outstanding. + */ +inline bool +RouterThread::active() const +{ + click_compiler_fence(); +#if HAVE_TASK_HEAP + return _task_heap.size() != 0 || _pending_head.x; +#else + return _task_link._next != &_task_link || _pending_head.x; +#endif +} + +/** @brief Returns the beginning of the scheduled task list. + * + * Each RouterThread maintains a list of all currently-scheduled tasks. + * Elements may traverse this list with the task_begin(), task_next(), and + * task_end() functions, using iterator-like code such as: + * + * @code + * thread->lock_tasks(); + * for (Task *t = thread->task_begin(); + * t != thread->task_end(); + * t = thread->task_next(t)) { + * // ... do something with t... + * } + * thread->unlock_tasks(); + * @endcode + * + * The thread's task lock must be held during the traversal, as shown above. + * + * The return value may not be a real task. Test it against task_end() before + * use. + * + * @sa task_next, task_end, lock_tasks, unlock_tasks + */ +inline Task * +RouterThread::task_begin() const +{ +#if HAVE_TASK_HEAP + return (_task_heap.size() ? _task_heap.unchecked_at(0).t : 0); +#else + return static_cast(_task_link._next); +#endif +} + +/** @brief Returns the task following @a task in the scheduled task list. + * @param task the current task + * + * The return value may not be a real task. Test it against task_end() before + * use. However, the @a task argument must be a real task; do not attempt to + * call task_next(task_end()). + * + * @sa task_begin for usage, task_end + */ +inline Task * +RouterThread::task_next(Task *task) const +{ +#if HAVE_TASK_HEAP + int p = task->_schedpos + 1; + return (p < _task_heap.size() ? _task_heap.unchecked_at(p).t : 0); +#else + return static_cast(task->_next); +#endif +} + +/** @brief Returns the end of the scheduled task list. + * + * The return value is not a real task. + * + * @sa task_begin for usage, task_next + */ +inline Task * +RouterThread::task_end() const +{ +#if HAVE_TASK_HEAP + return 0; +#else + return static_cast(const_cast(&_task_link)); +#endif +} + +inline bool +RouterThread::running_in_interrupt() +{ +#if CLICK_LINUXMODULE + return in_interrupt(); +#else + return false; +#endif +} + +inline void +RouterThread::mark_driver_entry() +{ + _driver_entered = true; +} + +inline bool +RouterThread::current_thread_is_running() const +{ +#if CLICK_LINUXMODULE + return current == _linux_task && !running_in_interrupt(); +#elif CLICK_MINIOS + return get_current() == _minios_thread; +#elif CLICK_USERLEVEL && HAVE_MULTITHREAD && HAVE___THREAD_STORAGE_CLASS + return click_current_thread_id == (_id | 0x40000000); +#elif CLICK_USERLEVEL && HAVE_MULTITHREAD + return click_current_processor() == _running_processor; +#else + return true; +#endif +} + +inline bool +RouterThread::current_thread_is_running_cleanup() const +{ + return current_thread_is_running() || (!_driver_entered && _id >= 0); +} + +inline void +RouterThread::schedule_block_tasks() +{ + assert(!current_thread_is_running()); + ++_task_blocker_waiting; +} + +inline void +RouterThread::block_tasks(bool scheduled) +{ + assert(!current_thread_is_running() && !running_in_interrupt()); + if (!scheduled) + ++_task_blocker_waiting; + while (1) { + uint32_t blocker = _task_blocker.value(); + if ((int32_t) blocker >= 0 + && _task_blocker.compare_swap(blocker, blocker + 1) == blocker) + break; +#if CLICK_LINUXMODULE + // 3.Nov.2008: Must allow other threads a chance to run. Otherwise, + // soft lock is possible: the thread in block_tasks() waits for + // RouterThread::_linux_task to complete a task set, but + // RouterThread::_linux_task can't run until the thread in + // block_tasks() relinquishes the CPU. + // + // We might be able to avoid schedule() in some cases, but don't + // bother to try. + schedule(); +#endif + } + --_task_blocker_waiting; +} + +inline void +RouterThread::unblock_tasks() +{ + assert((int32_t) _task_blocker.value() > 0); + --_task_blocker; +} + +inline void +RouterThread::lock_tasks() +{ + assert(!running_in_interrupt()); + if (unlikely(!current_thread_is_running())) { + block_tasks(false); + _task_lock.acquire(); + } +} + +inline void +RouterThread::unlock_tasks() +{ + assert(!running_in_interrupt()); + if (unlikely(!current_thread_is_running())) { + _task_lock.release(); + unblock_tasks(); + } +} + +inline void +RouterThread::wake() +{ +#if CLICK_LINUXMODULE + struct task_struct *task = _linux_task; + if (task) + wake_up_process(task); +#elif CLICK_USERLEVEL + // see also Master::add_select() + if (!current_thread_is_running()) + _selects.wake_immediate(); +#elif CLICK_BSDMODULE && !BSD_NETISRSCHED + if (_sleep_ident) + wakeup_one(&_sleep_ident); +#endif +} + +inline void +RouterThread::add_pending() +{ + wake(); +} + +inline bool +RouterThread::stop_flag() const +{ + return _stop_flag; +} + +inline void +RouterThread::set_thread_state(int state) +{ + (void) state; +#if CLICK_DEBUG_SCHEDULING + assert(state >= 0 && state < NSTATES); +# if CLICK_DEBUG_SCHEDULING > 1 + Timestamp now = Timestamp::now(); + if (_thread_state_timestamp) + _thread_state_time[_thread_state] += now - _thread_state_timestamp; + if (_thread_state != state) + ++_thread_state_count[_thread_state]; + _thread_state_timestamp = now; +# endif + _thread_state = state; +#endif +} + +inline void +RouterThread::set_thread_state_for_blocking(int delay_type) +{ + if (delay_type < 0) + set_thread_state(S_BLOCKED); + else + set_thread_state(delay_type ? S_TIMERWAIT : S_PAUSED); +} + +#if CLICK_DEBUG_SCHEDULING > 1 +inline Timestamp +RouterThread::thread_state_time(int state) const +{ + assert(state >= 0 && state < NSTATES); + return _thread_state_time[state]; +} + +inline uint64_t +RouterThread::thread_state_count(int state) const +{ + assert(state >= 0 && state < NSTATES); + return _thread_state_count[state]; +} +#endif + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/routervisitor.hh b/openflow/include/click/routervisitor.hh new file mode 100644 index 0000000..6374f3e --- /dev/null +++ b/openflow/include/click/routervisitor.hh @@ -0,0 +1,193 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/routervisitor.cc" -*- +#ifndef CLICK_ROUTERVISITOR_HH +#define CLICK_ROUTERVISITOR_HH +#include +#include +CLICK_DECLS + +/** @class RouterVisitor + * @brief Base class for router configuration visitors. + * + * RouterVisitor objects are used to traverse the router configuration graph. + * They are usually passed to the Router::visit_downstream() and + * Router::visit_upstream() functions. + */ +class RouterVisitor { public: + + /** @brief Construct an RouterVisitor. */ + RouterVisitor() { + } + + /** @brief Destroy an RouterVisitor. */ + virtual ~RouterVisitor() { + } + + /** @brief Visit an element. + * @param e element being visited + * @param isoutput true for output ports, false for input ports + * @param port port number being visited + * @param from_e element by which @a e was reached + * @param from_port port by which @a e/@a port was reached + * @param distance connection distance in breadth-first search + * @return true to continue traversing, false to stop + * + * A Router configuration traversal calls this function once on each + * reached port. Configuration traversal is breadth-first; @a distance is + * the minimum connection distance from the traversal's start point to @a + * e/@a port. A traversal will call a port's visit() function at most + * once. @a from_e and @a from_port specify one port that is connected to + * @a e and @a port (there may be more than one). If @a isoutput is true, + * then @a e/@a port is an output port and @a from_e/@a from_port is an + * input port; if @a isoutput is false, the opposite holds. + * + * The return value specifies whether traversal should continue through + * the @a e element. If it is true, then the traversal will continue + * based on @a e's packet flow specifier, via ports that connect to @a + * e/@a port (see Element::flow_code() for more). + * + * The default implementation always returns true. + */ + virtual bool visit(Element *e, bool isoutput, int port, + Element *from_e, int from_port, int distance); + +}; + +/** @class ElementTracker + * @brief Base class for router configuration visitors that collect elements. + * + * ElementTracker is a type of RouterVisitor used to traverse the router + * configuration graph and collect matching elements. A subclass's @link + * RouterVisitor::visit visit() @endlink function will call insert() to store + * elements that match. ElementTracker objects are usually passed to the + * Router::visit_downstream() and Router::visit_upstream() functions. + */ +class ElementTracker : public RouterVisitor { public: + + /** @brief Construct an ElementTracker. + * @param router the router to be traversed */ + ElementTracker(Router *router); + + /** @brief Return the elements that matched. */ + const Vector &elements() const { + return _elements; + } + /** @brief Return the number of matching elements. */ + int size() const { + return _elements.size(); + } + /** @brief Return the @a i'th matching element. + * + * Elements are ordered by their time of first insertion. */ + Element *operator[](int i) const { + return _elements[i]; + } + + /** @brief Iterator type. */ + typedef Vector::const_iterator const_iterator; + /** @brief Return an iterator for the first matching element. */ + const_iterator begin() const { + return _elements.begin(); + } + /** @brief Return an iterator for the end of the container. */ + const_iterator end() const { + return _elements.end(); + } + + /** @brief Return true iff element @a e is a matching element. */ + bool contains(const Element *e) const { + return _reached[e->eindex()]; + } + + /** @brief Add element @a e to the set of matching elements. */ + void insert(Element *e) { + if (!_reached[e->eindex()]) { + _reached[e->eindex()] = true; + _elements.push_back(e); + } + } + + /** @brief Clear the set of matching elements. */ + void clear() { + _reached.clear(); + _elements.clear(); + } + + private: + + Bitvector _reached; + Vector _elements; + +}; + +/** @class ElementCastTracker + * @brief Router configuration visitor that collects elements that match a + * certain cast. + * + * When passed to Router::visit_upstream() or Router::visit_downstream(), + * ElementCastTracker collects the closest elements that successfully cast to + * @a name. For instance, this code will find the closest Storage elements + * upstream of [0]@a e: + * @code + * ElementCastTracker tracker(e->router(), "Storage"); + * e->router()->visit_upstream(e, 0, &tracker); + * tracker.elements(); // a Vector containing the Storage elements + * @endcode + * + * Graph traversal stops at each matching element, so in the above example, a + * Storage element that is "behind" another Storage element won't be returned. + */ +class ElementCastTracker : public ElementTracker { public: + + /** @brief Construct an ElementCastTracker. + * @param router the router to be traversed + * @param name the cast of interest */ + ElementCastTracker(Router *router, const String &name) + : ElementTracker(router), _name(name) { + } + + bool visit(Element *e, bool isoutput, int port, + Element *from_e, int from_port, int distance); + + private: + + String _name; + +}; + +/** @class ElementNeighborhoodTracker + * @brief Router configuration visitor that collects close-by elements. + * + * When passed to Router::visit_upstream() or Router::visit_downstream(), + * ElementNeighborhoodTracker collects the elements that are within a certain + * number of connections of the source element. For instance, this code will + * find all the elements connected to [0]@a e: + * @code + * ElementNeighborhoodTracker tracker(e->router()); + * e->router()->visit_upstream(e, 0, &tracker); + * tracker.elements(); // Vector containing neighboring elements + * @endcode + * + * Supply the constructor's @a diameter argument to find a larger neighborhood + * than just the directly-connected elements. + */ +class ElementNeighborhoodTracker : public ElementTracker { public: + + /** @brief Construct an ElementNeighborhoodTracker. + * @param router the router to be traversed + * @param diameter neighborhood diameter (maximum number of connections to + * traverse) */ + ElementNeighborhoodTracker(Router *router, int diameter = 1) + : ElementTracker(router), _diameter(diameter) { + } + + bool visit(Element *e, bool isoutput, int port, + Element *from_e, int from_port, int distance); + + private: + + int _diameter; + +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/selectset.hh b/openflow/include/click/selectset.hh new file mode 100644 index 0000000..34c619d --- /dev/null +++ b/openflow/include/click/selectset.hh @@ -0,0 +1,137 @@ +// -*- related-file-name: "../../lib/selectset.cc" -*- +#ifndef CLICK_SELECTSET_HH +#define CLICK_SELECTSET_HH 1 +#if !CLICK_USERLEVEL +# error " only meaningful at user level" +#endif +#include +#include +#include +#if !HAVE_ALLOW_SELECT && !HAVE_ALLOW_POLL && !HAVE_ALLOW_KQUEUE +# define HAVE_ALLOW_SELECT 1 +#endif +#if defined(__APPLE__) && HAVE_ALLOW_SELECT && HAVE_ALLOW_POLL +// Apple's poll() is often broken +# undef HAVE_ALLOW_POLL +#endif +#if HAVE_POLL_H && HAVE_ALLOW_POLL +# include +#else +# undef HAVE_ALLOW_POLL +# if !HAVE_ALLOW_SELECT && !HAVE_ALLOW_KQUEUE +# error "poll is not supported on this system, try --enable-select" +# endif +#endif +#if !HAVE_SYS_EVENT_H || !HAVE_KQUEUE +# undef HAVE_ALLOW_KQUEUE +# if !HAVE_ALLOW_SELECT && !HAVE_ALLOW_POLL +# error "kqueue is not supported on this system, try --enable-select" +# endif +#endif +CLICK_DECLS +class Element; +class Router; +class RouterThread; + +class SelectSet { public: + + SelectSet(); + ~SelectSet(); + + void initialize(); + + int add_select(int fd, Element *element, int mask); + int remove_select(int fd, Element *element, int mask); + + void run_selects(RouterThread *thread); + inline void wake_immediate() { + _wake_pipe_pending = true; + ignore_result(write(_wake_pipe[1], "", 1)); + } + + void kill_router(Router *router); + + inline void fence(); + + private: + + struct SelectorInfo { + Element *read; + Element *write; + int pollfd; + SelectorInfo() + : read(0), write(0), pollfd(-1) + { + } + }; + + int _wake_pipe[2]; + volatile bool _wake_pipe_pending; +#if HAVE_ALLOW_KQUEUE + int _kqueue; +#endif +#if !HAVE_ALLOW_POLL + struct pollfd { + int fd; + int events; + }; + fd_set _read_select_fd_set; + fd_set _write_select_fd_set; + int _max_select_fd; +#endif /* !HAVE_ALLOW_POLL */ + Vector _pollfds; + Vector _selinfo; +#if HAVE_MULTITHREAD + SimpleSpinlock _select_lock; + click_processor_t _select_processor; +#endif + + void register_select(int fd, bool add_read, bool add_write); + void remove_pollfd(int pi, int event); + inline void call_selected(int fd, int mask) const; + inline bool post_select(RouterThread *thread, bool acquire); +#if HAVE_ALLOW_KQUEUE + void run_selects_kqueue(RouterThread *thread); +#endif +#if HAVE_ALLOW_POLL + void run_selects_poll(RouterThread *thread); +#else + void run_selects_select(RouterThread *thread); +#endif + + inline void lock(); + inline void unlock(); + +#if CLICK_DEBUG_MASTER || CLICK_DEBUG_SCHEDULING + friend class Master; +#endif + +}; + +inline void +SelectSet::lock() +{ +#if HAVE_MULTITHREAD + if (click_get_processor() != _select_processor) + _select_lock.acquire(); +#endif +} + +inline void +SelectSet::unlock() +{ +#if HAVE_MULTITHREAD + if (click_get_processor() != _select_processor) + _select_lock.release(); +#endif +} + +inline void +SelectSet::fence() +{ + lock(); + unlock(); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/simclick.h b/openflow/include/click/simclick.h new file mode 100644 index 0000000..bc9f4d6 --- /dev/null +++ b/openflow/include/click/simclick.h @@ -0,0 +1,118 @@ +#ifndef SIMCLICK_H +#define SIMCLICK_H +/* + * simclick.h + * + * API for sending packets to Click. Mostly intended for use + * by a network simulator which wants to use Click to do routing. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Packet types used - generally going to be ethernet, but could + * possibly be something else I suppose... + */ +#define SIMCLICK_PTYPE_UNKNOWN 0 +#define SIMCLICK_PTYPE_ETHER 1 +#define SIMCLICK_PTYPE_IP 2 + +/* + * Not a whole lot to this. We have to create a click router object + * and also send packets and trigger events. + */ + +/* + * This contains per packet data we need to preserve when the packet gets + * dragged through click. Heavily biased towards ns-2 right now. + */ +typedef struct { + int id; /* Simulator ID number for the packet */ + int fid; /* Simulator flow ID number for the packet */ + int simtype; /* Original simulator packet type - useful + * for morphing between raw and simulator + * packet types */ +} simclick_simpacketinfo; + + +/* + * Opaque handles for the sim and click instances + */ +typedef struct simclick_node { + void *clickinfo; + struct timeval curtime; +} simclick_node_t; + +int simclick_click_create(simclick_node_t *sim, const char *router_file); + +int simclick_click_send(simclick_node_t *sim, + int ifid,int type,const unsigned char* data,int len, + simclick_simpacketinfo* pinfo); +int simclick_sim_send(simclick_node_t *sim, + int ifid,int type, const unsigned char* data,int len, + simclick_simpacketinfo*); + +void simclick_click_run(simclick_node_t *sim); + +void simclick_click_kill(simclick_node_t *sim); + +/* + * simclick_click_read_handler will allocate a buffer of adequate length + * to receive the handler information. This buffer must be freed + * by the caller. If a non-null value for the "memalloc" parameter + * is passed in, simclick_click_read_handler will use that function + * to allocate the memory. If there's a null value there, "malloc" will + * be used by default. The "memparam" parameter is a caller-specified + * value which will be passed back to the memory allocation function. + */ +typedef void* (*SIMCLICK_MEM_ALLOC)(size_t,void*); +char* simclick_click_read_handler(simclick_node_t *sim, + const char* elementname, + const char* handlername, + SIMCLICK_MEM_ALLOC memalloc, + void* memparam); + +int simclick_click_write_handler(simclick_node_t *sim, + const char* elemname, const char* handlername, + const char* writestring); + +/* + * We also provide a gettimeofday substitute which utilizes the + * state info passed to us by the simulator. + */ +int simclick_gettimeofday(struct timeval* tv); + +/* + * The simulated system also has to provide a few services to click, + * notably some way of injecting packets back into the system, + * mapping interface names to id numbers, and arranging for click + * to execute at a specified time in the future. + * We implement + */ +#define SIMCLICK_VERSION 0 // none +#define SIMCLICK_SUPPORTS 1 // int call +#define SIMCLICK_IFID_FROM_NAME 2 // const char *ifname +#define SIMCLICK_IPADDR_FROM_NAME 3 // const char *ifname, char *buf, int len +#define SIMCLICK_MACADDR_FROM_NAME 4 // const char *ifname, char *buf, int len +#define SIMCLICK_SCHEDULE 5 // struct timeval *when +#define SIMCLICK_GET_NODE_NAME 6 // char *buf, int len +#define SIMCLICK_IF_READY 7 // int ifid +#define SIMCLICK_TRACE 8 // const char *event +#define SIMCLICK_GET_NODE_ID 9 // none +#define SIMCLICK_GET_NEXT_PKT_ID 10 // none +#define SIMCLICK_CHANGE_CHANNEL 11 // int ifid, int channelid +#define SIMCLICK_IF_PROMISC 12 // int ifid +#define SIMCLICK_IPPREFIX_FROM_NAME 13 // const char *ifname, char *buf, int len +#define SIMCLICK_GET_RANDOM_INT 14 // uint32_t *result, uint32_t max +#define SIMCLICK_GET_DEFINES 15 // char *buf, size_t *size + +int simclick_sim_command(simclick_node_t *sim, int cmd, ...); +int simclick_click_command(simclick_node_t *sim, int cmd, ...); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/openflow/include/click/skbmgr.hh b/openflow/include/click/skbmgr.hh new file mode 100644 index 0000000..5674fe9 --- /dev/null +++ b/openflow/include/click/skbmgr.hh @@ -0,0 +1,16 @@ +// -*- c-basic-offset: 2; related-file-name: "../../linuxmodule/skbmgr.cc" -*- +#ifndef CLICK_SKBMGR_HH +#define CLICK_SKBMGR_HH +CLICK_DECLS + +void skbmgr_init(); +void skbmgr_cleanup(); + +/* allocate skbs. Number of skbs allocated is stored in the want variable */ +struct sk_buff *skbmgr_allocate_skbs(unsigned headroom, unsigned size, int *want); + +/* recycle skb back into pool */ +void skbmgr_recycle_skbs(struct sk_buff *); + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/standard/addressinfo.hh b/openflow/include/click/standard/addressinfo.hh new file mode 100644 index 0000000..147c566 --- /dev/null +++ b/openflow/include/click/standard/addressinfo.hh @@ -0,0 +1,135 @@ +// -*- related-file-name: "../../../elements/standard/addressinfo.cc" -*- +#ifndef CLICK_ADDRESSINFO_HH +#define CLICK_ADDRESSINFO_HH +#include +CLICK_DECLS + +/* +=c + +AddressInfo(NAME ADDRESS [ADDRESS...], ...) + +=s information + +specifies address information + +=io + +None + +=d + +Lets you use mnemonic names for IPv4 and IPv6 addresses, IPv4 and IPv6 +address prefixes, and Ethernet addresses. Each argument has the form `NAME +ADDRESS [ADDRESS...]', which associates the given ADDRESSes with NAME. For +example, if a configuration contains this AddressInfo element, + + AddressInfo(mauer 10.0.0.1, mazu 10.0.0.10); + +then other configuration strings can use C and C as mnemonics +for the IP addresses 10.0.0.1 and 10.0.0.10, respectively. + +The mnemonic names introduced by AddressInfo elements are local with +respect to compound elements. That is, names created inside a compound +element apply only within that compound element and its subelements. For +example: + + AddressInfo(mauer 10.0.0.1); + compound :: { + AddressInfo(mazu 10.0.0.10); + ... -> IPEncap(6, mauer, mazu) -> ... // OK + }; + ... -> IPEncap(6, mauer, mazu) -> ... // error: `mazu' undefined + +Any name can be simultaneously associated with an IP address, an IP network +address, and an Ethernet address. The kind of address that is returned is +generally determined from context. For example: + + AddressInfo(mauer 10.0.0.1 00-50-BA-85-84-A9); + ... -> IPEncap(6, mauer, ...) // as IP address + -> EtherEncap(0x0800, mauer, ...) -> ... // as Ethernet address + ... -> ARPResponder(mauer) -> ... // as IP address and Ethernet address! + +An optional suffix makes the context unambiguous. C is an ambiguous +reference to some address, but C is always an IPv4 address, +C is always an IPv4 network address (IPv4 address prefix), +C is always an IPv6 address, C is always an IPv6 +network address, and C is always an Ethernet address. + +Names with both address and prefix definitions are preferentially parsed as +addresses. For example: + + AddressInfo(boojum 10.0.0.1/24); // defines address and prefix + a1 :: ARPResponder(boojum 00-01-02-03-04-05); + // a1 will have the same configuration as: + a2 :: ARPResponder(10.0.0.1/32 00-01-02-03-04-05); + +To prefer the network prefix, use C. + +If C is a valid IPv4 network address, then C is a +valid IPv4 address equaling the broadcast address for that network. This is +obtained by setting all the host bits in the address prefix to 1. + +C usually equals the default gateway address for network +C. If C is a device, then C can sometimes be +looked up explicitly; otherwise, C is calculated from +C by setting the lowest-order bit in the network address. + +=head1 DEFAULT ADDRESSES + +If you do not define an address for a given NAME, AddressInfo will use the +default, if any. Defaults are as follows: + +=over 2 + +=item * + +For Ethernet addresses, Click checks for an Ethernet device named NAME, and +uses its address. (At userlevel, this works only on BSD and Linux.) + +=item * + +For IPv4 addresses, Click checks for a network device named NAME, and uses +its primary IPv4 address. + +=item * + +For C, Click checks for a network device named NAME, and uses its +default gateway. + +=back + +These defaults are not available on all platforms. + +=a + +PortInfo */ + +class AddressInfo : public Element { public: + + AddressInfo(); + + const char *class_name() const { return "AddressInfo"; } + + int configure_phase() const { return CONFIGURE_PHASE_FIRST; } + int configure(Vector &conf, ErrorHandler *errh); + + enum { + f_nodevice = 1 + }; + static bool query_ip(const String &s, unsigned char *store, const Element *context, int flags = 0); + static bool query_ip_prefix(String s, unsigned char *store_addr, unsigned char *store_mask, const Element *context, int flags = 0); +#if HAVE_IP6 + static bool query_ip6(String s, unsigned char *store, const Element *context, int flags = 0); + static bool query_ip6_prefix(String s, unsigned char *store_addr, int *store_prefixlen, const Element *context, int flags = 0); +#endif + static bool query_ethernet(String s, unsigned char *store, const Element *context, int flags = 0); + + private: + + static bool query_netdevice(const String &name, unsigned char *store, int type, int len, const Element *context, int flags); + +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/standard/alignmentinfo.hh b/openflow/include/click/standard/alignmentinfo.hh new file mode 100644 index 0000000..12160f8 --- /dev/null +++ b/openflow/include/click/standard/alignmentinfo.hh @@ -0,0 +1,48 @@ +// -*- related-file-name: "../../../elements/standard/alignmentinfo.cc" -*- +#ifndef CLICK_ALIGNMENTINFO_HH +#define CLICK_ALIGNMENTINFO_HH +#include +CLICK_DECLS + +/* + * =c + * AlignmentInfo(ELEMENT [MODULUS OFFSET ...], ...) + * =s information + * specifies alignment information + * =io + * None + * =d + * Provides information about the packet alignment specified elements can + * expect. Each configuration argument has the form + * `ELEMENT [MODULUS0 OFFSET0 MODULUS1 OFFSET1 ...]', + * where there are zero or more MODULUS-OFFSET pairs. + * All packets arriving at ELEMENT's + * Ith input will start `OFFSETI' bytes + * off from a `MODULUSI'-byte boundary. + * =n + * This element is inserted automatically by click-align(1). + * =a Align, click-align(1) + */ + +class AlignmentInfo : public Element { public: + + AlignmentInfo(); + + const char *class_name() const { return "AlignmentInfo"; } + int configure_phase() const { return CONFIGURE_PHASE_INFO; } + int configure(Vector &, ErrorHandler *); + + bool query1(const Element *e, int port, int &chunk, int &offset) const; + static bool query(const Element *e, int port, int &chunk, int &offset); + + private: + + Vector _elem_offset; + Vector _elem_icount; + Vector _chunks; + Vector _offsets; + +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/standard/errorelement.hh b/openflow/include/click/standard/errorelement.hh new file mode 100644 index 0000000..c6f66bb --- /dev/null +++ b/openflow/include/click/standard/errorelement.hh @@ -0,0 +1,35 @@ +// -*- c-basic-offset: 4; related-file-name: "../../../elements/standard/errorelement.cc" -*- +#ifndef CLICK_ERRORELEMENT_HH +#define CLICK_ERRORELEMENT_HH +#include +CLICK_DECLS + +/* + * =c + * Error(...) + * =s debugging + * always fails + * =d + * The Error element always fails to initialize. It has any number of inputs + * and outputs, and accepts any configuration string without complaint. It is + * useful to prevent a router from initializing while avoiding + * spurious error messages about bad configuration strings or connections. + * =a Message + */ + +class ErrorElement : public Element { public: + + ErrorElement(); + + const char *class_name() const { return "Error"; } + const char *port_count() const { return "-/-"; } + const char *processing() const { return AGNOSTIC; } + const char *flow_code() const { return "x/y"; } + + int configure(Vector &, ErrorHandler *); + int initialize(ErrorHandler *); + +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/standard/portinfo.hh b/openflow/include/click/standard/portinfo.hh new file mode 100644 index 0000000..c7ea6d4 --- /dev/null +++ b/openflow/include/click/standard/portinfo.hh @@ -0,0 +1,71 @@ +// -*- c-basic-offset: 4; related-file-name: "../../../elements/standard/portinfo.cc" -*- +#ifndef CLICK_PORTINFO_HH +#define CLICK_PORTINFO_HH +#include +CLICK_DECLS + +/* +=c + +PortInfo(NAME PORT[/PROTOCOL], ...) + +=s information + +stores named TCP/UDP port information + +=io + +None + +=d + +Lets you use mnemonic names for TCP and UDP ports. Each argument has the form +`NAME PORT[/PROTOCOL]', which associates the given PORT/PROTOCOL pair with the +NAME. If PROTOCOL is left off, the NAME applies to both TCP and UDP. For +example, in a configuration containing + + PortInfo(ssh 22, http 80), + +configuration strings can use C and C as mnemonics for the port +numbers 22 and 80, respectively. + +PortInfo names are local with respect to compound elements. That is, names +created inside a compound element apply only within that compound element and +its subelements. For example: + + PortInfo(src 10); + compound :: { + PortInfo(dst 100); + ... -> UDPIPEncap(1.0.0.1, src, 2.0.0.1, dst) -> ... // OK + }; + ... -> UDPIPEncap(1.0.0.1, src, 2.0.0.1, dst) -> ... + // error: `dst' undefined + +=n + +If you do not define a port for a given name, PortInfo will use the default, +if any. At user level, PortInfo uses the L function to look +up ports by name. In the kernel, there are no default ports. + +PortInfo will parse arguments containing more than one name, as `C', and comments starting with `C<#>' are ignored. Thus, +lines from F can be used verbatim as PortInfo configuration +arguments. + +=a + +AddressInfo */ + +class PortInfo : public Element { public: + + PortInfo(); + + const char *class_name() const { return "PortInfo"; } + + int configure_phase() const { return CONFIGURE_PHASE_FIRST; } + int configure(Vector &, ErrorHandler *); + +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/standard/scheduleinfo.hh b/openflow/include/click/standard/scheduleinfo.hh new file mode 100644 index 0000000..6bce624 --- /dev/null +++ b/openflow/include/click/standard/scheduleinfo.hh @@ -0,0 +1,104 @@ +// -*- c-basic-offset: 4; related-file-name: "../../../elements/standard/scheduleinfo.cc" -*- +#ifndef CLICK_SCHEDULEINFO_HH +#define CLICK_SCHEDULEINFO_HH +#include +CLICK_DECLS + +/* +=c + +ScheduleInfo(ELEMENT PARAM, ...) + +=s information + +specifies scheduling parameters + +=io + +None + +=d + +Provides scheduling parameters for specified elements. Each configuration +argument has the form `ELEMENT PARAM', meaning that the element +named ELEMENT has scheduling parameter PARAM. Scheduling +parameters are real numbers that set how often one element should be +scheduled in relation to another. For example, +if elements A and B have +scheduling parameters 2 and 0.5, respectively, then A will be scheduled +2/0.5 = 4 times as often as B. The default scheduling parameter is 1. + +ScheduleInfo elements inside a compound element can specify scheduling +parameters for that compound's components. +Outer ScheduleInfo elements +can specify a ``scheduling parameter'' for the compound +element as a whole. This ``scheduling parameter'' is really a scaling +factor affecting the compound's components. For example, consider this +configuration, + + elementclass Compound { + i :: InfiniteSource -> output; + ScheduleInfo(i 0.5); + } + c :: Compound -> Discard; + ScheduleInfo(c 4); + +which is the same as the following configuration, after compound elements +are expanded. + + c/i :: InfiniteSource -> Discard@3 :: Discard; + c/ScheduleInfo@2 :: ScheduleInfo(i 0.5); + ScheduleInfo@4 :: ScheduleInfo(c 4); + +The name of the first ScheduleInfo element starts with `c/', so it is +used to look up scheduling parameters for elements named `c/I'. +V<>(This includes all components of the compound element `c'.) +The second ScheduleInfo element, however, has no slash in its name, +so it is used to look up all scheduling parameters, +including scaling factors for compound elements. +The InfiniteSource's final scaling parameter will be 2: +the scaling factor 4 times the local scheduling parameter 0.5. + +An outer ScheduleInfo element can override local scheduling parameters. +For example, if the second ScheduleInfo element above was + + ScheduleInfo@4 :: ScheduleInfo(c 4, c/i 10.5) + +then the InfiniteSource's final scaling parameter would be 10.5. +*/ + +class ScheduleInfo : public Element { public: + + enum { FRAC_BITS = 10 }; + + ScheduleInfo(); + + const char* class_name() const { return "ScheduleInfo"; } + + int configure_phase() const { return CONFIGURE_PHASE_INFO; } + int configure(Vector&, ErrorHandler*); + + bool query(const String&, int&) const; + bool query_prefixes(const String&, int&, String&) const; + static int query(Element*, ErrorHandler*); + static void initialize_task(Element*, Task*, bool sched, ErrorHandler*); + static void initialize_task(Element*, Task*, ErrorHandler*); + static void join_scheduler(Element*, Task*, ErrorHandler*); + +}; + + +inline void +ScheduleInfo::initialize_task(Element* e, Task* t, ErrorHandler* errh) +{ + initialize_task(e, t, true, errh); +} + +inline void +ScheduleInfo::join_scheduler(Element* e, Task* t, ErrorHandler* errh) +{ + initialize_task(e, t, true, errh); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/standard/storage.hh b/openflow/include/click/standard/storage.hh new file mode 100644 index 0000000..263a9f7 --- /dev/null +++ b/openflow/include/click/standard/storage.hh @@ -0,0 +1,123 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_STORAGE_HH +#define CLICK_STORAGE_HH +#include +#include +CLICK_DECLS +class Packet; + +class Storage { public: + + typedef uint32_t index_type; + typedef int32_t signed_index_type; + static const index_type invalid_index = (index_type) -1; + + Storage() : _head(0), _tail(0) { } + + operator bool() const { return _head != _tail; } + bool empty() const { return _head == _tail; } + int size() const; + int size(index_type head, index_type tail) const; + int capacity() const { return _capacity; } + + index_type head() const { return _head; } + index_type tail() const { return _tail; } + + index_type next_i(index_type i) const { + return (i!=_capacity ? i+1 : 0); + } + index_type prev_i(index_type i) const { + return (i!=0 ? i-1 : _capacity); + } + + // to be used with care + void set_capacity(index_type c) { _capacity = c; } + inline void set_head(index_type h); // acquire barrier (read pkt) + inline void set_tail(index_type t); // release barrier (write pkt) + inline void set_head_release(index_type h); // release barrier (LIFO) + inline void set_tail_acquire(index_type t); // acquire barrier (LIFO) + inline index_type reserve_tail_atomic(); + + static inline void packet_memory_barrier(Packet* volatile& packet, + volatile index_type& index) + __attribute__((deprecated)); + inline void packet_memory_barrier(Packet* volatile& packet) + __attribute__((deprecated)); + + protected: + index_type _capacity; + + private: + volatile index_type _head; + volatile index_type _tail; + +}; + +inline int +Storage::size(index_type head, index_type tail) const +{ + index_type x = tail - head; + return (signed_index_type(x) >= 0 ? x : _capacity + x + 1); +} + +inline int +Storage::size() const +{ + return size(_head, _tail); +} + +inline void +Storage::set_head(index_type h) +{ + click_read_fence(); + _head = h; +} + +inline void +Storage::set_tail(index_type t) +{ + click_write_fence(); + _tail = t; +} + +inline void +Storage::set_head_release(index_type h) +{ + click_write_fence(); + _head = h; +} + +inline void +Storage::set_tail_acquire(index_type t) +{ + click_read_fence(); + _tail = t; +} + +inline Storage::index_type +Storage::reserve_tail_atomic() +{ + index_type t, nt; + do { + t = _tail; + nt = next_i(t); + if (nt == _head) + return invalid_index; + } while (atomic_uint32_t::compare_swap(_tail, t, nt) != t); + return t; +} + +inline void +Storage::packet_memory_barrier(Packet* volatile& packet, volatile index_type& index) +{ + __asm__ volatile("" : : "m" (packet), "m" (index)); +} + +inline void +Storage::packet_memory_barrier(Packet * volatile &packet) +{ + __asm__ volatile("" : : "m" (packet), "m" (_head), "m" (_tail)); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/standard/threadsched.hh b/openflow/include/click/standard/threadsched.hh new file mode 100644 index 0000000..800b6e4 --- /dev/null +++ b/openflow/include/click/standard/threadsched.hh @@ -0,0 +1,18 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_THREADSCHED_HH +#define CLICK_THREADSCHED_HH +CLICK_DECLS + +class ThreadSched { public: + + enum { THREAD_QUIESCENT = -1, THREAD_UNKNOWN = -1000 }; + + ThreadSched() { } + virtual ~ThreadSched() { } + + virtual int initial_home_thread_id(const Element *e); + +}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/straccum.hh b/openflow/include/click/straccum.hh new file mode 100644 index 0000000..d5638e3 --- /dev/null +++ b/openflow/include/click/straccum.hh @@ -0,0 +1,624 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/straccum.cc" -*- +#ifndef CLICK_STRACCUM_HH +#define CLICK_STRACCUM_HH +#include +#include +#ifdef CLICK_LINUXMODULE +# include +CLICK_CXX_PROTECT +# include +CLICK_CXX_UNPROTECT +# include +#elif defined(CLICK_BSDMODULE) +# include +#else /* User-space */ +# include +#endif +#if __GNUC__ > 4 +# define CLICK_SNPRINTF_ATTR __attribute__((__format__(__printf__, 3, 4))) +#else +# define CLICK_SNPRINTF_ATTR /* nothing */ +#endif +CLICK_DECLS + +/** @file + @brief Click's StringAccum class, used to construct Strings efficiently from pieces. +*/ + +class StringAccum { public: + + typedef const char *const_iterator; + typedef char *iterator; + + typedef int (StringAccum::*unspecified_bool_type)() const; + + inline StringAccum(); + explicit inline StringAccum(int capacity); + inline StringAccum(const String &str); + inline StringAccum(const StringAccum &x); +#if HAVE_CXX_RVALUE_REFERENCES + inline StringAccum(StringAccum &&x); +#endif + inline ~StringAccum(); + + inline StringAccum &operator=(const StringAccum &x); +#if HAVE_CXX_RVALUE_REFERENCES + inline StringAccum &operator=(StringAccum &&x); +#endif + + inline const char *data() const; + inline char *data(); + inline int length() const; + inline int capacity() const; + + const char *c_str(); + + inline operator unspecified_bool_type() const; + inline bool empty() const; + inline bool operator!() const; + + inline const_iterator begin() const; + inline iterator begin(); + inline const_iterator end() const; + inline iterator end(); + + inline char operator[](int i) const; + inline char &operator[](int i); + inline char front() const; + inline char &front(); + inline char back() const; + inline char &back(); + + inline bool out_of_memory() const; + void assign_out_of_memory(); + + inline void clear(); + inline char *reserve(int n); + inline void set_length(int len); + int resize(int len); + inline void adjust_length(int delta); + inline char *extend(int nadjust, int nreserve = 0); + + inline void pop_back(int n = 1); + + inline void append(char c); + inline void append(unsigned char c); + inline bool append_utf8(int ch); + inline void append(const char *cstr); + inline void append(const char *s, int len); + inline void append(const unsigned char *s, int len); + inline void append(const char *first, const char *last); + inline void append(const unsigned char *first, const unsigned char *last); + void append_fill(int c, int len); + void append_numeric(String::intmax_t x, int base = 10, bool uppercase = true); + void append_numeric(String::uintmax_t x, int base = 10, bool uppercase = true); + + StringAccum &snprintf(int n, const char *format, ...) CLICK_SNPRINTF_ATTR; + + String take_string(); + + void swap(StringAccum &x); + + // see also operator<< declarations below + + inline void forward(int delta) CLICK_DEPRECATED; + + private: + + enum { + MEMO_SPACE = String::MEMO_SPACE + }; + + struct rep_t { + unsigned char *s; + int len; + int cap; + rep_t() + : s(reinterpret_cast(const_cast(String::empty_data()))), + len(0), cap(0) { + } + explicit rep_t(uninitialized_type) { + } + }; + + rep_t r_; + + char *grow(int); + char *hard_extend(int nadjust, int nreserve); + void hard_append(const char *s, int len); + void hard_append_cstr(const char *cstr); + bool append_utf8_hard(int ch); + + friend StringAccum &operator<<(StringAccum &sa, const String &str); +#if HAVE_PERMSTRING + friend StringAccum &operator<<(StringAccum &sa, PermString s); +#endif + +}; + +inline StringAccum &operator<<(StringAccum &sa, char c); +inline StringAccum &operator<<(StringAccum &sa, unsigned char c); +inline StringAccum &operator<<(StringAccum &sa, const char *cstr); +inline StringAccum &operator<<(StringAccum &sa, const String &s); +inline StringAccum &operator<<(StringAccum &sa, const StringAccum &x); + +inline StringAccum &operator<<(StringAccum &sa, bool x); +inline StringAccum &operator<<(StringAccum &sa, short x); +inline StringAccum &operator<<(StringAccum &sa, unsigned short x); +inline StringAccum &operator<<(StringAccum &sa, int x); +inline StringAccum &operator<<(StringAccum &sa, unsigned x); +StringAccum &operator<<(StringAccum &sa, long x); +StringAccum &operator<<(StringAccum &sa, unsigned long x); +#if HAVE_LONG_LONG +inline StringAccum &operator<<(StringAccum &sa, long long x); +inline StringAccum &operator<<(StringAccum &sa, unsigned long long x); +#endif +#if HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG && !HAVE_INT64_IS_LONG_LONG +inline StringAccum &operator<<(StringAccum &sa, int64_t x); +inline StringAccum &operator<<(StringAccum &sa, uint64_t x); +#endif +#if defined(CLICK_USERLEVEL) || defined(CLICK_TOOL) || defined(CLICK_MINIOS) +StringAccum &operator<<(StringAccum &sa, double x); +#endif +StringAccum &operator<<(StringAccum &sa, const void *ptr); + + +/** @brief Construct an empty StringAccum (with length 0). */ +inline StringAccum::StringAccum() { +} + +/** @brief Construct a StringAccum with room for at least @a capacity + characters. + @param capacity initial capacity + + If @a capacity == 0, the StringAccum is created empty. If @a capacity is + too large (so that @a capacity bytes of memory can't be allocated), the + StringAccum falls back to a smaller capacity (possibly zero). */ +inline StringAccum::StringAccum(int capacity) { + assert(capacity >= 0); + unsigned char *s; + if (capacity + && (s = (unsigned char *) CLICK_LALLOC(capacity + MEMO_SPACE))) { + r_.s = s + MEMO_SPACE; + r_.cap = capacity; + } +} + +/** @brief Construct a StringAccum containing the characters in @a str. */ +inline StringAccum::StringAccum(const String &str) { + append(str.begin(), str.end()); +} + +/** @brief Construct a StringAccum containing a copy of @a x. */ +inline StringAccum::StringAccum(const StringAccum &x) { + append(x.data(), x.length()); +} + +#if HAVE_CXX_RVALUE_REFERENCES +/** @brief Move-construct a StringAccum from @a x. */ +inline StringAccum::StringAccum(StringAccum &&x) + : r_(x.r_) { + x.r_.cap = 0; +} +#endif + +/** @brief Destroy a StringAccum, freeing its memory. */ +inline StringAccum::~StringAccum() { + if (r_.cap > 0) + CLICK_LFREE(r_.s - MEMO_SPACE, r_.cap + MEMO_SPACE); +} + +/** @brief Return the contents of the StringAccum. + @return The StringAccum's contents. + + The returned data() value points to length() bytes of writable memory + (unless the StringAccum itself is const). */ +inline const char *StringAccum::data() const { + return reinterpret_cast(r_.s); +} + +/** @overload */ +inline char *StringAccum::data() { + return reinterpret_cast(r_.s); +} + +/** @brief Return the length of the StringAccum. */ +inline int StringAccum::length() const { + return r_.len; +} + +/** @brief Return the StringAccum's current capacity. + + The capacity is the maximum length the StringAccum can hold without + incurring a memory allocation. Returns -1 for out-of-memory + StringAccums. */ +inline int StringAccum::capacity() const { + return r_.cap; +} + +/** @brief Return an iterator for the first character in the StringAccum. + + StringAccum iterators are simply pointers into string data, so they are + quite efficient. @sa StringAccum::data */ +inline StringAccum::const_iterator StringAccum::begin() const { + return reinterpret_cast(r_.s); +} + +/** @overload */ +inline StringAccum::iterator StringAccum::begin() { + return reinterpret_cast(r_.s); +} + +/** @brief Return an iterator for the end of the StringAccum. + + The return value points one character beyond the last character in the + StringAccum. */ +inline StringAccum::const_iterator StringAccum::end() const { + return reinterpret_cast(r_.s + r_.len); +} + +/** @overload */ +inline StringAccum::iterator StringAccum::end() { + return reinterpret_cast(r_.s + r_.len); +} + +/** @brief Test if the StringAccum contains characters. */ +inline StringAccum::operator unspecified_bool_type() const { + return r_.len != 0 ? &StringAccum::capacity : 0; +} + +/** @brief Test if the StringAccum is empty. + + Returns true iff length() == 0. */ +inline bool StringAccum::operator!() const { + return r_.len == 0; +} + +/** @brief Test if the StringAccum is empty. */ +inline bool StringAccum::empty() const { + return r_.len == 0; +} + +/** @brief Test if the StringAccum is out-of-memory. */ +inline bool StringAccum::out_of_memory() const { + return unlikely(r_.cap < 0); +} + +/** @brief Return the ith character in the string. + @param i character index + @pre 0 <= @a i < length() */ +inline char StringAccum::operator[](int i) const { + assert((unsigned) i < (unsigned) r_.len); + return static_cast(r_.s[i]); +} + +/** @brief Return a reference to the ith character in the string. + @param i character index + @pre 0 <= @a i < length() */ +inline char &StringAccum::operator[](int i) { + assert((unsigned) i < (unsigned) r_.len); + return reinterpret_cast(r_.s[i]); +} + +/** @brief Return the first character in the string. + @pre length() > 0 */ +inline char StringAccum::front() const { + assert(r_.len > 0); + return static_cast(r_.s[0]); +} + +/** @brief Return a reference to the first character in the string. + @pre length() > 0 */ +inline char &StringAccum::front() { + assert(r_.len > 0); + return reinterpret_cast(r_.s[0]); +} + +/** @brief Return the last character in the string. + @pre length() > 0 */ +inline char StringAccum::back() const { + assert(r_.len > 0); + return static_cast(r_.s[r_.len - 1]); +} + +/** @brief Return a reference to the last character in the string. + @pre length() > 0 */ +inline char &StringAccum::back() { + assert(r_.len > 0); + return reinterpret_cast(r_.s[r_.len - 1]); +} + +/** @brief Clear the StringAccum's comments. + + All characters in the StringAccum are erased. Also resets the + StringAccum's out-of-memory status. */ +inline void StringAccum::clear() { + if (r_.cap < 0) + r_.cap = 0; + r_.len = 0; +} + +/** @brief Reserve space for at least @a n characters. + @return a pointer to at least @a n characters, or null if allocation + fails + @pre @a n >= 0 + + reserve() does not change the string's length(), only its capacity(). In + a frequent usage pattern, code calls reserve(), passing an upper bound + on the characters that could be written by a series of operations. After + writing into the returned buffer, adjust_length() is called to account + for the number of characters actually written. */ +inline char *StringAccum::reserve(int n) { + assert(n >= 0); + if (r_.len + n <= r_.cap) + return reinterpret_cast(r_.s + r_.len); + else + return grow(r_.len + n); +} + +/** @brief Set the StringAccum's length to @a len. + @param len new length in characters + @pre 0 <= @a len <= capacity() + @sa adjust_length */ +inline void StringAccum::set_length(int len) { + assert(len >= 0 && r_.len <= r_.cap); + r_.len = len; +} + +/** @brief Adjust the StringAccum's length. + @param delta length adjustment + @pre If @a delta > 0, then length() + @a delta <= capacity(). + If @a delta < 0, then length() + delta >= 0. + + The StringAccum's length after adjust_length(@a delta) equals its old + length plus @a delta. Generally adjust_length() is used after a call to + reserve(). @sa set_length */ +inline void StringAccum::adjust_length(int delta) { + assert(r_.len + delta >= 0 && r_.len + delta <= r_.cap); + r_.len += delta; +} + +/** @brief Reserve space and adjust length in one operation. + @param nadjust number of characters to reserve and adjust length + @param nreserve additional characters to reserve + @pre @a nadjust >= 0 and @a nreserve >= 0 + + This operation combines the effects of reserve(@a nadjust + @a nreserve) + and adjust_length(@a nadjust). Returns the result of the reserve() + call. */ +inline char *StringAccum::extend(int nadjust, int nreserve) { +#if CLICK_OPTIMIZE_SIZE || __OPTIMIZE_SIZE__ + return hard_extend(nadjust, nreserve); +#else + assert(nadjust >= 0 && nreserve >= 0); + if (r_.len + nadjust + nreserve <= r_.cap) { + char *x = reinterpret_cast(r_.s + r_.len); + r_.len += nadjust; + return x; + } else + return hard_extend(nadjust, nreserve); +#endif +} + +/** @brief Remove characters from the end of the StringAccum. + @param n number of characters to remove + @pre @a n >= 0 and @a n <= length() + + Same as adjust_length(-@a n). */ +inline void StringAccum::pop_back(int n) { + assert(n >= 0 && r_.len >= n); + r_.len -= n; +} + +/** @brief Append character @a c to the StringAccum. + @param c character to append */ +inline void StringAccum::append(char c) { + if (r_.len < r_.cap || grow(r_.len)) + r_.s[r_.len++] = c; +} + +/** @overload */ +inline void StringAccum::append(unsigned char c) { + append(static_cast(c)); +} + +/** @brief Append the first @a len characters of @a s to this StringAccum. + @param s data to append + @param len length of data + @pre @a len >= 0 */ +inline void StringAccum::append(const char *s, int len) { +#if CLICK_OPTIMIZE_SIZE || __OPTIMIZE_SIZE__ + hard_append(s, len); +#else + assert(len >= 0); + if (r_.len + len <= r_.cap) { + memcpy(r_.s + r_.len, s, len); + r_.len += len; + } else + hard_append(s, len); +#endif +} + +/** @overload */ +inline void StringAccum::append(const unsigned char *s, int len) { + append(reinterpret_cast(s), len); +} + +/** @brief Append the null-terminated C string @a s to this StringAccum. + @param s data to append */ +inline void StringAccum::append(const char *cstr) { + if (CLICK_CONSTANT_CSTR(cstr)) + append(cstr, strlen(cstr)); + else + hard_append_cstr(cstr); +} + +/** @brief Append the data from @a first to @a last to the end of this + StringAccum. + + Does nothing if @a first >= @a last. */ +inline void StringAccum::append(const char *first, const char *last) { + if (first < last) + append(first, last - first); +} + +/** @overload */ +inline void StringAccum::append(const unsigned char *first, const unsigned char *last) { + if (first < last) + append(first, last - first); +} + +/** @brief Append Unicode character @a ch encoded in UTF-8. + @return true if character was valid. + + Appends nothing if @a ch is not a valid Unicode character. */ +inline bool StringAccum::append_utf8(int ch) { + if (unlikely(ch <= 0)) + return false; + else if (likely(ch <= 0x7F)) { + append(static_cast(ch)); + return true; + } else + return append_utf8_hard(ch); +} + +/** @brief Assign this StringAccum to @a x. */ +inline StringAccum &StringAccum::operator=(const StringAccum &x) { + if (&x != this) { + if (out_of_memory()) + r_.cap = 0; + r_.len = 0; + append(x.data(), x.length()); + } + return *this; +} + +#if HAVE_CXX_RVALUE_REFERENCES +/** @brief Move-assign this StringAccum to @a x. */ +inline StringAccum &StringAccum::operator=(StringAccum &&x) { + x.swap(*this); + return *this; +} +#endif + +/** @cond never */ +/** @brief Adjust the StringAccum's length (deprecated). + @param delta length adjustment + @deprecated Use adjust_length() instead. */ +inline void StringAccum::forward(int delta) { + adjust_length(delta); +} +/** @endcond never */ + +/** @relates StringAccum + @brief Append character @a c to StringAccum @a sa. + @return @a sa + @note Same as @a sa.append(@a c). */ +inline StringAccum &operator<<(StringAccum &sa, char c) { + sa.append(c); + return sa; +} + +/** @relates StringAccum + @brief Append character @a c to StringAccum @a sa. + @return @a sa + @note Same as @a sa.append(@a c). */ +inline StringAccum &operator<<(StringAccum &sa, unsigned char c) { + sa.append(c); + return sa; +} + +/** @relates StringAccum + @brief Append null-terminated C string @a cstr to StringAccum @a sa. + @return @a sa + @note Same as @a sa.append(@a cstr). */ +inline StringAccum &operator<<(StringAccum &sa, const char *cstr) { + sa.append(cstr); + return sa; +} + +/** @relates StringAccum + @brief Append "true" or "false" to @a sa, depending on @a x. + @return @a sa */ +inline StringAccum &operator<<(StringAccum &sa, bool x) { + sa.append(String::bool_data + (-x & 6), 5 - x); + return sa; +} + +/** @relates StringAccum + @brief Append decimal representation of @a x to @a sa. + @return @a sa */ +inline StringAccum &operator<<(StringAccum &sa, short x) { + return sa << static_cast(x); +} + +/** @overload */ +inline StringAccum &operator<<(StringAccum &sa, unsigned short x) { + return sa << static_cast(x); +} + +/** @overload */ +inline StringAccum &operator<<(StringAccum &sa, int x) { + return sa << static_cast(x); +} + +/** @overload */ +inline StringAccum &operator<<(StringAccum &sa, unsigned x) { + return sa << static_cast(x); +} + +#if HAVE_LONG_LONG +/** @overload */ +inline StringAccum &operator<<(StringAccum &sa, long long x) { + sa.append_numeric(static_cast(x)); + return sa; +} + +/** @overload */ +inline StringAccum &operator<<(StringAccum &sa, unsigned long long x) { + sa.append_numeric(static_cast(x)); + return sa; +} +#endif + +#if HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG && !HAVE_INT64_IS_LONG_LONG +/** @overload */ +inline StringAccum &operator<<(StringAccum &sa, int64_t x) { + sa.append_numeric(static_cast(x)); + return sa; +} + +/** @overload */ +inline StringAccum &operator<<(StringAccum &sa, uint64_t x) { + sa.append_numeric(static_cast(x)); + return sa; +} +#endif + +/** @relates StringAccum + @brief Append the contents of @a str to @a sa. + @return @a sa */ +inline StringAccum &operator<<(StringAccum &sa, const String &str) { + sa.append(str.data(), str.length()); + return sa; +} + +/** @relates StringAccum + @brief Append the contents of @a x to @a sa. + @return @a sa */ +inline StringAccum &operator<<(StringAccum &sa, const StringAccum &x) { + sa.append(x.begin(), x.end()); + return sa; +} + +inline void click_swap(StringAccum &a, StringAccum &b) { + a.swap(b); +} + +inline void assign_consume(StringAccum &a, StringAccum &b) { + a.swap(b); +} + +#undef CLICK_SNPRINTF_ATTR +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/string.hh b/openflow/include/click/string.hh new file mode 100644 index 0000000..969a820 --- /dev/null +++ b/openflow/include/click/string.hh @@ -0,0 +1,1021 @@ +// -*- related-file-name: "../../lib/string.cc" -*- +#ifndef CLICK_STRING_HH +#define CLICK_STRING_HH +#include +#include +#if HAVE_STRING_PROFILING +# include +#endif +#if CLICK_LINUXMODULE || CLICK_BSDMODULE +# include +#else +# include +#endif +#define CLICK_CONSTANT_CSTR(cstr) ((cstr) && __builtin_constant_p(strlen((cstr)))) +CLICK_DECLS +class StringAccum; + +class String { public: + + typedef const char *const_iterator; + typedef const_iterator iterator; + + typedef int (String::*unspecified_bool_type)() const; + +#if HAVE_INT64_TYPES && (!HAVE_LONG_LONG || SIZEOF_LONG_LONG <= 8) + typedef int64_t intmax_t; + typedef uint64_t uintmax_t; +#elif HAVE_LONG_LONG + typedef long long intmax_t; + typedef unsigned long long uintmax_t; +#else + typedef long intmax_t; + typedef unsigned long uintmax_t; +#endif + typedef intmax_t int_large_t; + typedef uintmax_t uint_large_t; + + inline String(); + inline String(const String& x); +#if HAVE_CXX_RVALUE_REFERENCES + inline String(String&& x); +#endif + inline String(const char* cstr); + inline String(const char* s, int len); + inline String(const unsigned char* s, int len); + inline String(const char* first, const char* last); + inline String(const unsigned char* first, const unsigned char* last); + explicit inline String(bool x); + explicit inline String(char c); + explicit inline String(unsigned char c); + explicit String(int x); + explicit String(unsigned x); + explicit String(long x); + explicit String(unsigned long x); +#if HAVE_LONG_LONG + explicit String(long long x); + explicit String(unsigned long long x); +#endif +#if HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG && !HAVE_INT64_IS_LONG_LONG + explicit String(int64_t x); + explicit String(uint64_t x); +#endif +#if HAVE_FLOAT_TYPES + explicit String(double x); +#endif + inline ~String(); + + static inline const String& make_empty(); + static inline String make_uninitialized(int len); + static inline String make_garbage(int len) CLICK_DEPRECATED; + static inline String make_stable(const char* cstr); + static inline String make_stable(const char* s, int len); + static inline String make_stable(const char* first, const char* last); + static String make_numeric(intmax_t x, int base = 10, bool uppercase = true); + static String make_numeric(uintmax_t x, int base = 10, bool uppercase = true); + + inline const char* data() const; + inline int length() const; + + inline const char *c_str() const; + + inline operator unspecified_bool_type() const; + inline bool empty() const; + inline bool operator!() const; + + inline const_iterator begin() const; + inline const_iterator end() const; + + inline char operator[](int i) const; + inline char at(int i) const; + inline char front() const; + inline char back() const; + + static uint32_t hashcode(const char *begin, const char *end); + static inline uint32_t hashcode(const unsigned char *begin, + const unsigned char *end); + inline uint32_t hashcode() const; + + inline String substring(const char *begin, const char *end) const; + String substring(int pos, int len) const; + inline String substring(int pos) const; + String trim_space() const; + + inline bool equals(const String &x) const; + inline bool equals(const char *s, int len) const; + static inline int compare(const String &a, const String &b); + inline int compare(const String &x) const; + int compare(const char *s, int len) const; + inline bool starts_with(const String &x) const; + bool starts_with(const char *s, int len) const; + bool glob_match(const String& pattern) const; + + // bool operator==(const String &, const String &); + // bool operator==(const String &, const char *); + // bool operator==(const char *, const String &); + // bool operator!=(const String &, const String &); + // bool operator!=(const String &, const char *); + // bool operator!=(const char *, const String &); + // bool operator<(const String &, const String &); + // bool operator<=(const String &, const String &); + // bool operator>(const String &, const String &); + // bool operator>=(const String &, const String &); + + int find_left(char c, int start = 0) const; + int find_left(const String &x, int start = 0) const; + int find_right(char c, int start = 0x7FFFFFFF) const; + + String lower() const; + String upper() const; + String printable() const; + String quoted_hex() const; + String encode_json() const; + + inline String &operator=(const String &x); +#if HAVE_CXX_RVALUE_REFERENCES + inline String &operator=(String &&x); +#endif + inline String &operator=(const char *cstr); + + inline void swap(String &x); + + inline void append(const String &x); + inline void append(const char *cstr); + inline void append(const char *s, int len); + inline void append(const char *first, const char *last); + inline void append(char c); + void append_fill(int c, int len); + char *append_uninitialized(int len); + inline char *append_garbage(int len) CLICK_DEPRECATED; + + inline String &operator+=(const String &x); + inline String &operator+=(const char *cstr); + inline String &operator+=(char c); + + // String operator+(String, const String &); + // String operator+(String, const char *); + // String operator+(const char *, const String &); + + inline bool is_shared() const; + inline bool is_stable() const; + + inline String unique() const CLICK_DEPRECATED; + inline String unshared() const; + inline String compact() const; + + char *mutable_data(); + char *mutable_c_str(); + + static inline const String &make_out_of_memory(); + inline bool out_of_memory() const; + static inline const char *out_of_memory_data(); + static inline int out_of_memory_length(); + static inline const char *empty_data(); + +#if HAVE_STRING_PROFILING + static void profile_report(StringAccum &sa, int examples = 0); +#endif + + static inline const char *skip_utf8_char(const char *first, const char *last); + static const unsigned char *skip_utf8_char(const unsigned char *first, + const unsigned char *last); + + static const char bool_data[11]; + + private: + + /** @cond never */ + struct memo_t { + volatile uint32_t refcount; + uint32_t capacity; + volatile uint32_t dirty; +#if HAVE_STRING_PROFILING > 1 + memo_t **pprev; + memo_t *next; +#endif + char real_data[8]; // but it might be more or less + }; + + enum { + MEMO_SPACE = sizeof(memo_t) - 8 + }; + + struct rep_t { + const char *data; + int length; + memo_t *memo; + }; + /** @endcond never */ + + mutable rep_t _r; // mutable for c_str() + +#if HAVE_STRING_PROFILING + static uint64_t live_memo_count; + static uint64_t memo_sizes[55]; + static uint64_t live_memo_sizes[55]; + static uint64_t live_memo_bytes[55]; +# if HAVE_STRING_PROFILING > 1 + static memo_t *live_memos[55]; +# endif + + static inline int profile_memo_size_bucket(uint32_t dirty, uint32_t capacity) { + if (capacity <= 16) + return dirty; + else if (capacity <= 32) + return 17 + (capacity - 17) / 2; + else if (capacity <= 64) + return 25 + (capacity - 33) / 8; + else + return 29 + 26 - ffs_msb(capacity - 1); + } + + static void profile_update_memo_dirty(memo_t *memo, uint32_t old_dirty, uint32_t new_dirty, uint32_t capacity) { + if (capacity <= 16 && new_dirty != old_dirty) { + ++memo_sizes[new_dirty]; + ++live_memo_sizes[new_dirty]; + live_memo_bytes[new_dirty] += capacity; + --live_memo_sizes[old_dirty]; + live_memo_bytes[old_dirty] -= capacity; +# if HAVE_STRING_PROFILING > 1 + if ((*memo->pprev = memo->next)) + memo->next->pprev = memo->pprev; + memo->pprev = &live_memos[new_dirty]; + if ((memo->next = *memo->pprev)) + memo->next->pprev = &memo->next; + *memo->pprev = memo; +# else + (void) memo; +# endif + } + } + + static void one_profile_report(StringAccum &sa, int i, int examples); +#endif + + inline void assign_memo(const char *data, int length, memo_t *memo) const { + _r.data = data; + _r.length = length; + if ((_r.memo = memo)) + atomic_uint32_t::inc(memo->refcount); + } + + inline String(const char *data, int length, memo_t *memo) { + assign_memo(data, length, memo); + } + + inline void assign(const String &x) const { + assign_memo(x._r.data, x._r.length, x._r.memo); + } + + inline void deref() const { + if (_r.memo) { + assert(_r.memo->refcount); + if (atomic_uint32_t::dec_and_test(_r.memo->refcount)) + delete_memo(_r.memo); + _r.memo = 0; + } + } + + void assign(const char *s, int len, bool need_deref); + void assign_out_of_memory(); + void append(const char *s, int len, memo_t *memo); + static String hard_make_stable(const char *s, int len); + static inline memo_t *absent_memo() { + return reinterpret_cast(uintptr_t(1)); + } + static memo_t *create_memo(char *space, int dirty, int capacity); + static void delete_memo(memo_t *memo); + const char *hard_c_str() const; + bool hard_equals(const char *s, int len) const; + + static const char null_data; + static const char oom_data[15]; + static const char int_data[20]; + static const rep_t null_string_rep; + static const rep_t oom_string_rep; + enum { oom_len = 14 }; + + static String make_claim(char *, int, int); // claim memory + + friend struct rep_t; + friend class StringAccum; + +}; + +class StringRef { + public: + + inline StringRef(); + inline StringRef(const StringRef &x); + inline StringRef(const char *cstr); + inline StringRef(const char *s, int len); + inline StringRef(const String &x); + + inline const char *data() const; + inline int length() const; + + inline const char *begin() const; + inline const char *end() const; + + inline uint32_t hashcode() const; + + private: + const char *data_; + int len_; +}; + +/** @brief Construct an empty String (with length 0). */ +inline String::String() { + assign_memo(&null_data, 0, 0); +} + +/** @brief Construct a copy of the String @a x. */ +inline String::String(const String &x) { + assign(x); +} + +#if HAVE_CXX_RVALUE_REFERENCES +/** @brief Move-construct a String from @a x. */ +inline String::String(String &&x) + : _r(x._r) { + x._r.memo = 0; +} +#endif + +/** @brief Construct a String containing the C string @a cstr. + @param cstr a null-terminated C string + @return A String containing the characters of @a cstr, up to but not + including the terminating null character. */ +inline String::String(const char *cstr) { + if (CLICK_CONSTANT_CSTR(cstr)) + assign_memo(cstr, strlen(cstr), 0); + else + assign(cstr, -1, false); +} + +/** @brief Construct a String containing the first @a len characters of + string @a s. + @param s a string + @param len number of characters to take from @a s. If @a len @< 0, + then takes @c strlen(@a s) characters. + @return A String containing @a len characters of @a s. */ +inline String::String(const char *s, int len) { + assign(s, len, false); +} + +/** @overload */ +inline String::String(const unsigned char *s, int len) { + assign(reinterpret_cast(s), len, false); +} + +/** @brief Construct a String containing the characters from @a first + to @a last. + @param first first character in string (begin iterator) + @param last pointer one past last character in string (end iterator) + @return A String containing the characters from @a first to @a last. + + Constructs an empty string if @a first @>= @a last. */ +inline String::String(const char *first, const char *last) { + assign(first, (first < last ? last - first : 0), false); +} + +/** @overload */ +inline String::String(const unsigned char *first, const unsigned char *last) { + assign(reinterpret_cast(first), + (first < last ? last - first : 0), false); +} + +/** @brief Construct a String equal to "true" or "false" depending on the + value of @a x. */ +inline String::String(bool x) { + // bool_data equals "false\0true\0" + assign_memo(bool_data + (-x & 6), 5 - x, 0); +} + +/** @brief Construct a String containing the single character @a c. */ +inline String::String(char c) { + assign(&c, 1, false); +} + +/** @overload */ +inline String::String(unsigned char c) { + assign(reinterpret_cast(&c), 1, false); +} + +/** @brief Destroy a String, freeing memory if necessary. */ +inline String::~String() { + deref(); +} + +/** @brief Return a const reference to an empty String. + + May be quicker than String::String(). */ +inline const String &String::make_empty() { + return reinterpret_cast(null_string_rep); +} + +/** @brief Return a String containing @a len unknown characters. */ +inline String String::make_uninitialized(int len) { + String s; + s.append_uninitialized(len); + return s; +} + +/** @cond never */ +inline String String::make_garbage(int len) { + return make_uninitialized(len); +} +/** @endcond never */ + +/** @brief Return a String that directly references the C string @a cstr. + + The make_stable() functions are suitable for static constant strings + whose data is known to stay around forever, such as C string constants. + + @warning The String implementation may access @a cstr's terminating null + character. */ +inline String String::make_stable(const char *cstr) { + if (CLICK_CONSTANT_CSTR(cstr)) + return String(cstr, strlen(cstr), 0); + else + return hard_make_stable(cstr, -1); +} + +/** @brief Return a String that directly references the first @a len + characters of @a s. + + If @a len @< 0, treats @a s as a null-terminated C string. + + @warning The String implementation may access @a s[@a len], which + should remain constant even though it's not part of the String. */ +inline String String::make_stable(const char *s, int len) { + if (__builtin_constant_p(len) && len >= 0) + return String(s, len, 0); + else + return hard_make_stable(s, len); +} + +/** @brief Return a String that directly references the character data in + [@a first, @a last). + @param first pointer to the first character in the character data + @param last pointer one beyond the last character in the character data + (but see the warning) + + This function is suitable for static constant strings whose data is + known to stay around forever, such as C string constants. Returns an + empty string if @a first @>= @a last. + + @warning The String implementation may access *@a last, which should + remain constant even though it's not part of the String. */ +inline String String::make_stable(const char *first, const char *last) { + return String(first, (first < last ? last - first : 0), 0); +} + +/** @brief Return a pointer to the string's data. + + Only the first length() characters are valid, and the string + might not be null-terminated. */ +inline const char *String::data() const { + return _r.data; +} + +/** @brief Return the string's length. */ +inline int String::length() const { + return _r.length; +} + +/** @brief Null-terminate the string. + + The terminating null character isn't considered part of the string, so + this->length() doesn't change. Returns a corresponding C string + pointer. The returned pointer is semi-temporary; it will persist until + the string is destroyed or appended to. */ +inline const char *String::c_str() const { + // See also hard_c_str(). +#if CLICK_OPTIMIZE_SIZE || __OPTIMIZE_SIZE__ + return hard_c_str(); +#else + // We may already have a '\0' in the right place. If _memo has no + // capacity, then this is one of the special strings (null or + // stable). We are guaranteed, in these strings, that _data[_length] + // exists. Otherwise must check that _data[_length] exists. + const char *end_data = _r.data + _r.length; + if ((_r.memo && end_data >= _r.memo->real_data + _r.memo->dirty) + || *end_data != '\0') { + if (char *x = const_cast(this)->append_uninitialized(1)) { + *x = '\0'; + --_r.length; + } + } + return _r.data; +#endif +} + +/** @brief Return a substring of the current string starting at @a first + and ending before @a last. + @param first pointer to the first substring character + @param last pointer one beyond the last substring character + + Returns an empty string if @a first @>= @a last. Also returns an empty + string if @a first or @a last is out of range (i.e., either less than + this->begin() or greater than this->end()), but this should be + considered a programming error; a future version may generate a warning + for this case. */ +inline String String::substring(const char *first, const char *last) const { + if (first < last && first >= _r.data && last <= _r.data + _r.length) + return String(first, last - first, _r.memo); + else + return String(); +} + +/** @brief Return the suffix of the current string starting at index @a pos. + + If @a pos is negative, starts that far from the end of the string. + If @a pos is so negative that the suffix starts outside the string, + then the entire string is returned. If the substring is beyond the + end of the string (@a pos > length()), returns an empty string (but + this should be considered a programming error; a future version may + generate a warning for this case). + + @note String::substring() is intended to behave like Perl's + substr(). */ +inline String String::substring(int pos) const { + return substring((pos <= -_r.length ? 0 : pos), _r.length); +} + +/** @brief Return an iterator for the first character in the string. + + String iterators are simply pointers into string data, so they are + quite efficient. @sa String::data */ +inline String::const_iterator String::begin() const { + return _r.data; +} + +/** @brief Return an iterator for the end of the string. + + The return value points one character beyond the last character in the + string. */ +inline String::const_iterator String::end() const { + return _r.data + _r.length; +} + +/** @brief Test if the string is nonempty. */ +inline String::operator unspecified_bool_type() const { + return (_r.length != 0 ? &String::length : 0); +} + +/** @brief Test if the string is empty. */ +inline bool String::empty() const { + return _r.length == 0; +} + +/** @brief Test if the string is empty. */ +inline bool String::operator!() const { + return empty(); +} + +/** @brief Return the @a i th character in the string. + + Does not check bounds. @sa String::at */ +inline char String::operator[](int i) const { + return _r.data[i]; +} + +/** @brief Return the @a i th character in the string. + + Checks bounds: an assertion will fail if @a i is less than 0 or not less + than length(). @sa String::operator[] */ +inline char String::at(int i) const { + assert((unsigned) i < (unsigned) _r.length); + return _r.data[i]; +} + +/** @brief Return the first character in the string. + + Does not check bounds. Same as (*this)[0]. */ +inline char String::front() const { + return _r.data[0]; +} + +/** @brief Return the last character in the string. + + Does not check bounds. Same as (*this)[length() - 1]. */ +inline char String::back() const { + return _r.data[_r.length - 1]; +} + +/** @overload */ +inline uint32_t String::hashcode(const unsigned char *first, + const unsigned char *last) { + return hashcode(reinterpret_cast(first), + reinterpret_cast(last)); +} + +/** @brief Returns a 32-bit hash function of this string's characters. + + Equivalent to String::hashcode(begin(), end()). Uses Paul Hsieh's + "SuperFastHash." + + @invariant If s1 == s2, then s1.hashcode() == s2.hashcode(). */ +inline uint32_t String::hashcode() const { + return (length() ? hashcode(begin(), end()) : 0); +} + +/** @brief Test if this string equals @a x. */ +inline bool String::equals(const String &x) const { + return equals(x.data(), x.length()); +} + +/** @brief Test if this string is equal to the data in @a s. + @param s string data to compare to + @param len length of @a s + + Same as String::compare(*this, String(s, len)) == 0. If @a len @< 0, + then treats @a s as a null-terminated C string. + + @sa String::compare(const String &a, const String &b) */ +inline bool String::equals(const char *s, int len) const { +#if CLICK_OPTIMIZE_SIZE || __OPTIMIZE_SIZE__ + return hard_equals(s, len); +#else + if (__builtin_constant_p(len) && len >= 0) + return length() == len && memcmp(data(), s, len) == 0; + else + return hard_equals(s, len); +#endif +} + +/** @brief Compare two strings. + @param a first string to compare + @param b second string to compare + + Returns 0 if @a a == @a b, negative if @a a @< @a b in lexicographic + order, and positive if @a a @> @a b in lexicographic order. The + lexicographic order treats all characters as unsigned. */ +inline int String::compare(const String &a, const String &b) { + return a.compare(b); +} + +/** @brief Compare this string with string @a x. + + Same as String::compare(*this, @a x). + @sa String::compare(const String &a, const String &b) */ +inline int String::compare(const String &x) const { + return compare(x.data(), x.length()); +} + +/** @brief Test if this string begins with prefix @a x. + + Same as String::starts_with(@a x.data(), @a x.length()). */ +inline bool String::starts_with(const String &x) const { + return starts_with(x.data(), x.length()); +} + +/** @brief Assign this string to @a x. */ +inline String &String::operator=(const String &x) { + if (likely(&x != this)) { + deref(); + assign(x); + } + return *this; +} + +#if HAVE_CXX_RVALUE_REFERENCES +/** @brief Move-assign this string to @a x. */ +inline String &String::operator=(String &&x) { + deref(); + _r = x._r; + x._r.memo = 0; + return *this; +} +#endif + +/** @brief Assign this string to the C string @a cstr. */ +inline String &String::operator=(const char *cstr) { + if (CLICK_CONSTANT_CSTR(cstr)) { + deref(); + assign_memo(cstr, strlen(cstr), 0); + } else + assign(cstr, -1, true); + return *this; +} + +/** @brief Swap the values of this string and @a x. */ +inline void String::swap(String &x) { + rep_t r = _r; + _r = x._r; + x._r = r; +} + +/** @brief Append @a x to this string. */ +inline void String::append(const String &x) { + append(x.data(), x.length(), x._r.memo); +} + +/** @brief Append the null-terminated C string @a cstr to this string. + @param cstr data to append */ +inline void String::append(const char *cstr) { + if (CLICK_CONSTANT_CSTR(cstr)) + append(cstr, strlen(cstr), absent_memo()); + else + append(cstr, -1, absent_memo()); +} + +/** @brief Append the first @a len characters of @a s to this string. + @param s data to append + @param len length of data + @pre @a len @>= 0 */ +inline void String::append(const char *s, int len) { + append(s, len, absent_memo()); +} + +/** @brief Appends the data from @a first to @a last to this string. + + Does nothing if @a first @>= @a last. */ +inline void String::append(const char *first, const char *last) { + if (first < last) + append(first, last - first); +} + +/** @brief Append the character @a c to this string. */ +inline void String::append(char c) { + append(&c, 1, absent_memo()); +} + +/** @cond never */ +inline char *String::append_garbage(int len) { + return append_uninitialized(len); +} +/** @endcond never */ + +/** @brief Append @a x to this string. + @return *this */ +inline String &String::operator+=(const String &x) { + append(x.data(), x.length(), x._r.memo); + return *this; +} + +/** @brief Append the null-terminated C string @a cstr to this string. + @return *this */ +inline String &String::operator+=(const char *cstr) { + append(cstr); + return *this; +} + +/** @brief Append the character @a c to this string. + @return *this */ +inline String &String::operator+=(char c) { + append(&c, 1); + return *this; +} + +/** @brief Test if the String's data is shared or immutable. */ +inline bool String::is_shared() const { + return !_r.memo || _r.memo->refcount != 1; +} + +/** @brief Test if the String's data is immutable. */ +inline bool String::is_stable() const { + return !_r.memo; +} + +/** @brief Return an unshared version of this String. + + The return value shares no data with any other non-stable String. */ +inline String String::unshared() const { + if (!_r.memo || _r.memo->refcount == 1) + return *this; + else + return String(_r.data, _r.data + _r.length); +} + +/** @brief Return an unshared version of this String. + @deprecated Use String::unshared() instead. + + The return value shares no data with any other non-stable String. */ +inline String String::unique() const { + return unshared(); +} + +/** @brief Return a compact version of this String. + + The return value shares no more than 256 bytes of data with any other + non-stable String. */ +inline String String::compact() const { + if (!_r.memo || _r.memo->refcount == 1 + || (uint32_t) _r.length + 256 >= _r.memo->capacity) + return *this; + else + return String(_r.data, _r.data + _r.length); +} + +/** @brief Test if this is an out-of-memory string. */ +inline bool String::out_of_memory() const { + return unlikely(data() == oom_data); +} + +/** @brief Return a const reference to a canonical out-of-memory String. */ +inline const String &String::make_out_of_memory() { + return reinterpret_cast(oom_string_rep); +} + +/** @brief Return the data pointer used for out-of-memory strings. */ +inline const char *String::out_of_memory_data() { + return oom_data; +} + +/** @brief Return the length of canonical out-of-memory strings. */ +inline int String::out_of_memory_length() { + return oom_len; +} + +/** @brief Return the data pointer used for canonical empty strings. + + The returned value may be dereferenced; it points to a null + character. */ +inline const char *String::empty_data() { + return &null_data; +} + +/** @brief Return a pointer to the next character in UTF-8 encoding. + @pre @a first @< @a last + + If @a first doesn't point at a valid UTF-8 character, returns @a first. */ +inline const char *String::skip_utf8_char(const char *first, const char *last) { + return reinterpret_cast(skip_utf8_char(reinterpret_cast(first), reinterpret_cast(last))); +} + +inline StringRef::StringRef() + : data_(0), len_(0) { +} + +inline StringRef::StringRef(const StringRef &x) + : data_(x.data_), len_(x.len_) { +} + +inline StringRef::StringRef(const char *cstr) + : data_(cstr), len_(strlen(cstr)) { +} + +inline StringRef::StringRef(const char *s, int len) + : data_(s), len_(len) { +} + +inline StringRef::StringRef(const String &x) + : data_(x.data()), len_(x.length()) { +} + +inline const char *StringRef::data() const { + return data_; +} + +inline int StringRef::length() const { + return len_; +} + +inline const char *StringRef::begin() const { + return data(); +} + +inline const char *StringRef::end() const { + return data() + length(); +} + +/** @relates String + @brief Compares two strings for equality. + + Returns true iff the two operands have the same lengths and the same + characters in the same order. At most one of the operands can be a + null-terminated C string. + @sa String::compare */ +inline bool operator==(const String &a, const String &b) { + return a.equals(b.data(), b.length()); +} + +/** @relates String */ +inline bool operator==(const char *a, const String &b) { + if (CLICK_CONSTANT_CSTR(a)) + return b.equals(a, strlen(a)); + else + return b.equals(a, -1); +} + +/** @relates String */ +inline bool operator==(const String &a, const char *b) { + if (CLICK_CONSTANT_CSTR(b)) + return a.equals(b, strlen(b)); + else + return a.equals(b, -1); +} + +/** @relates String + @brief Compare two Strings for inequality. + + Returns true iff !(@a a == @a b). At most one of the operands can be a + null-terminated C string. */ +inline bool operator!=(const String &a, const String &b) { + return !(a == b); +} + +/** @relates String */ +inline bool operator!=(const char *a, const String &b) { + return !(a == b); +} + +/** @relates String */ +inline bool operator!=(const String &a, const char *b) { + return !(a == b); +} + +/** @relates String + @brief Compare two Strings. + + Returns true iff @a a @< @a b in lexicographic order. + @sa String::compare */ +inline bool operator<(const String &a, const String &b) { + return a.compare(b.data(), b.length()) < 0; +} + +/** @relates String + @brief Compare two Strings. + + Returns true iff @a a @<= @a b in lexicographic order. + @sa String::compare */ +inline bool operator<=(const String &a, const String &b) { + return a.compare(b.data(), b.length()) <= 0; +} + +/** @relates String + @brief Compare two Strings. + + Returns true iff @a a @> @a b in lexicographic order. + @sa String::compare */ +inline bool operator>(const String &a, const String &b) { + return a.compare(b.data(), b.length()) > 0; +} + +/** @relates String + @brief Compare two Strings. + + Returns true iff @a a @>= @a b in lexicographic order. + @sa String::compare */ +inline bool operator>=(const String &a, const String &b) { + return a.compare(b.data(), b.length()) >= 0; +} + +/** @relates String + @brief Concatenate the operands and return the result. + + At most one of the two operands can be a null-terminated C string. */ +inline String operator+(String a, const String &b) { + a += b; + return a; +} + +/** @relates String */ +inline String operator+(String a, const char *b) { + a.append(b); + return a; +} + +/** @relates String */ +inline String operator+(const char *a, const String &b) { + String s1(a); + s1 += b; + return s1; +} + +/** @relates String + @brief Concatenate the operands and return the result. + + The second operand is a single character. */ +inline String operator+(String a, char b) { + a.append(&b, 1); + return a; +} + +// find methods + +inline const char *rfind(const char *first, const char *last, char c) { + for (const char *bb = last - 1; bb >= first; bb--) + if (*bb == c) + return bb; + return last; +} + +inline const char *find(const String &s, char c) { + return find(s.begin(), s.end(), c); +} + +// sort methods + +template int click_compare(const void *, const void *); + +template <> inline int click_compare(const void *a, const void *b) { + const String *ta = reinterpret_cast(a); + const String *tb = reinterpret_cast(b); + return String::compare(*ta, *tb); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/sync.hh b/openflow/include/click/sync.hh new file mode 100644 index 0000000..bdf4cf9 --- /dev/null +++ b/openflow/include/click/sync.hh @@ -0,0 +1,568 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_SYNC_HH +#define CLICK_SYNC_HH +#include +#include +#include +#if CLICK_LINUXMODULE || (CLICK_USERLEVEL && HAVE_MULTITHREAD) +# define CLICK_MULTITHREAD_SPINLOCK 1 +#endif +#if CLICK_USERLEVEL && !NDEBUG +# define SPINLOCK_ASSERTLEVEL "<-999>" +#else +# define SPINLOCK_ASSERTLEVEL "<1>" +#endif +CLICK_DECLS + +/** @file + * @brief Classes for synchronizing among multiple CPUs, particularly in the + * Linux kernel. + */ + +/** @class Spinlock + * @brief A recursive spinlock for SMP Click threads. + * + * The Spinlock class abstracts a recursive spinlock, or polling mutex, in SMP + * Click. This is a type of mutual-exclusion lock in which acquiring the lock + * is a polling operation (basically a "while (lock.acquired()) do nothing;" + * loop). Spinlocks can be used to synchronize access to shared data among + * multiple Click SMP threads. Spinlocks should not be held for long periods + * of time: use them for quick updates and such. + * + * Spinlock operations do nothing unless Click was compiled with SMP support + * (with --enable-multithread). Therefore, Spinlock should not be used to, + * for example, synchronize handlers with main element threads. See also + * SpinlockIRQ. + * + * The main Spinlock operations are acquire(), which acquires the lock, and + * release(), which releases the lock. attempt() acquires the lock only if it + * can be acquired instantaneously. + * + * It is OK for a thread to acquire a lock it has already acquired, but you + * must release it as many times as you have acquired it. + * + * @sa SimpleSpinlock, SpinlockIRQ + */ +class Spinlock { public: + + inline Spinlock(); + inline ~Spinlock(); + + inline void acquire(); + inline void release(); + inline bool attempt(); + inline bool nested() const; + +#if CLICK_MULTITHREAD_SPINLOCK + private: + + atomic_uint32_t _lock; + int32_t _depth; + click_processor_t _owner; +#endif + +}; + +/** @brief Create a Spinlock. */ +inline +Spinlock::Spinlock() +#if CLICK_MULTITHREAD_SPINLOCK + : _depth(0), _owner(click_invalid_processor()) +#endif +{ +#if CLICK_MULTITHREAD_SPINLOCK + _lock = 0; +#endif +} + +inline +Spinlock::~Spinlock() +{ +#if CLICK_MULTITHREAD_SPINLOCK + if (_depth != 0) + click_chatter(SPINLOCK_ASSERTLEVEL "Spinlock::~Spinlock(): assertion \"_depth == 0\" failed"); +#endif +} + +/** @brief Acquires the Spinlock. + * + * On return, this thread has acquired the lock. The function will spin + * indefinitely until the lock is acquired. It is OK to acquire a lock you + * have already acquired, but you must release it as many times as you have + * acquired it. + */ +inline void +Spinlock::acquire() +{ +#if CLICK_MULTITHREAD_SPINLOCK + click_processor_t my_cpu = click_get_processor(); + if (_owner != my_cpu) { + while (_lock.swap(1) != 0) + do { + click_relax_fence(); + } while (_lock != 0); + _owner = my_cpu; + } + _depth++; +#endif +} + +/** @brief Attempts to acquire the Spinlock. + * @return True iff the Spinlock was acquired. + * + * This function will acquire the lock and return true only if the Spinlock + * can be acquired right away, without retries. + */ +inline bool +Spinlock::attempt() +{ +#if CLICK_MULTITHREAD_SPINLOCK + click_processor_t my_cpu = click_get_processor(); + if (_owner != my_cpu) { + if (_lock.swap(1) != 0) { + click_put_processor(); + return false; + } + _owner = my_cpu; + } + _depth++; + return true; +#else + return true; +#endif +} + +/** @brief Releases the Spinlock. + * + * The Spinlock must have been previously acquired by either Spinlock::acquire + * or Spinlock::attempt. + */ +inline void +Spinlock::release() +{ +#if CLICK_MULTITHREAD_SPINLOCK + if (unlikely(_owner != click_current_processor())) + click_chatter(SPINLOCK_ASSERTLEVEL "Spinlock::release(): assertion \"owner == click_current_processor()\" failed"); + if (likely(_depth > 0)) { + if (--_depth == 0) { + _owner = click_invalid_processor(); + _lock = 0; + } + } else + click_chatter(SPINLOCK_ASSERTLEVEL "Spinlock::release(): assertion \"_depth > 0\" failed"); + click_put_processor(); +#endif +} + +/** @brief Returns true iff the Spinlock has been acquired more than once by + * the current thread. + */ +inline bool +Spinlock::nested() const +{ +#if CLICK_MULTITHREAD_SPINLOCK + return _depth > 1; +#else + return false; +#endif +} + + +/** @class SimpleSpinlock + * @brief A non-recursive spinlock for SMP Click threads. + * + * The Spinlock class abstracts a non-recursive spinlock, or polling mutex, in + * SMP Click. This is a type of mutual-exclusion lock in which acquiring the + * lock is a polling operation (basically a "while (lock.acquired()) do + * nothing;" loop). Spinlocks can be used to synchronize access to shared + * data among multiple Click SMP threads. Spinlocks should not be held for + * long periods of time: use them for quick updates and such. + * + * Spinlock operations do nothing unless Click was compiled with SMP support + * (with --enable-multithread). Therefore, Spinlock should not be used to, + * for example, synchronize handlers with main element threads. See also + * SpinlockIRQ. + * + * The main Spinlock operations are acquire(), which acquires the lock, and + * release(), which releases the lock. attempt() acquires the lock only if it + * can be acquired instantaneously. + * + * It is NOT OK for a thread to acquire a lock it has already acquired. + * + * @sa Spinlock, SpinlockIRQ + */ +class SimpleSpinlock { public: + + inline SimpleSpinlock(); + inline ~SimpleSpinlock(); + + inline void acquire(); + inline void release(); + inline bool attempt(); + +#if CLICK_LINUXMODULE + private: + spinlock_t _lock; +#elif CLICK_MULTITHREAD_SPINLOCK + private: + atomic_uint32_t _lock; +#endif + +}; + +/** @brief Create a SimpleSpinlock. */ +inline +SimpleSpinlock::SimpleSpinlock() +{ +#if CLICK_LINUXMODULE + spin_lock_init(&_lock); +#elif CLICK_MULTITHREAD_SPINLOCK + _lock = 0; +#endif +} + +inline +SimpleSpinlock::~SimpleSpinlock() +{ +} + +/** @brief Acquires the SimpleSpinlock. + * + * On return, this thread has acquired the lock. The function will spin + * indefinitely until the lock is acquired. + */ +inline void +SimpleSpinlock::acquire() +{ +#if CLICK_LINUXMODULE + spin_lock(&_lock); +#elif CLICK_MULTITHREAD_SPINLOCK + while (_lock.swap(1) != 0) + do { + click_relax_fence(); + } while (_lock != 0); +#endif +} + +/** @brief Attempts to acquire the SimpleSpinlock. + * @return True iff the SimpleSpinlock was acquired. + * + * This function will acquire the lock and return true only if the + * SimpleSpinlock can be acquired right away, without retries. + */ +inline bool +SimpleSpinlock::attempt() +{ +#if CLICK_LINUXMODULE + return spin_trylock(&_lock); +#elif CLICK_MULTITHREAD_SPINLOCK + return _lock.swap(1) == 0; +#else + return true; +#endif +} + +/** @brief Releases the SimpleSpinlock. + * + * The SimpleSpinlock must have been previously acquired by either + * SimpleSpinlock::acquire or SimpleSpinlock::attempt. + */ +inline void +SimpleSpinlock::release() +{ +#if CLICK_LINUXMODULE + spin_unlock(&_lock); +#elif CLICK_MULTITHREAD_SPINLOCK + _lock = 0; +#endif +} + + +/** @class SpinlockIRQ + * @brief A spinlock that disables interrupts. + * + * The SpinlockIRQ class abstracts a spinlock, or polling mutex, that also + * turns off interrupts. Spinlocks are a type of mutual-exclusion lock in + * which acquiring the lock is a polling operation (basically a "while + * (lock.acquired()) do nothing;" loop). The SpinlockIRQ variant can be used + * to protect Click data structures from interrupts and from other threads. + * Very few objects in Click need this protection; the Click Master object, + * which protects the task list, uses it, but that's hidden from users. + * Spinlocks should not be held for long periods of time: use them for quick + * updates and such. + * + * In the Linux kernel, SpinlockIRQ is equivalent to a combination of + * local_irq_save and the spinlock_t type. + * + * The SpinlockIRQ operations are acquire(), which acquires the lock, and + * release(), which releases the lock. + * + * It is NOT OK for a SpinlockIRQ thread to acquire a lock it has already + * acquired. + */ +class SpinlockIRQ { public: + + inline SpinlockIRQ(); + +#if CLICK_LINUXMODULE + typedef unsigned long flags_t; +#else + typedef int flags_t; +#endif + + inline flags_t acquire() CLICK_ALWAYS_INLINE; + inline void release(flags_t) CLICK_ALWAYS_INLINE; + +#if CLICK_LINUXMODULE + private: + spinlock_t _lock; +#elif CLICK_USERLEVEL && HAVE_MULTITHREAD + private: + Spinlock _lock; +#endif + +}; + +/** @brief Creates a SpinlockIRQ. */ +inline +SpinlockIRQ::SpinlockIRQ() +{ +#if CLICK_LINUXMODULE + spin_lock_init(&_lock); +#endif +} + +/** @brief Acquires the SpinlockIRQ. + * @return The current state of the interrupt flags. + */ +inline SpinlockIRQ::flags_t +SpinlockIRQ::acquire() +{ +#if CLICK_LINUXMODULE + flags_t flags; + spin_lock_irqsave(&_lock, flags); + return flags; +#elif CLICK_USERLEVEL && HAVE_MULTITHREAD + _lock.acquire(); + return 0; +#else + return 0; +#endif +} + +/** @brief Releases the SpinlockIRQ. + * @param flags The value returned by SpinlockIRQ::acquire(). + */ +inline void +SpinlockIRQ::release(flags_t flags) +{ +#if CLICK_LINUXMODULE + spin_unlock_irqrestore(&_lock, flags); +#elif CLICK_USERLEVEL && HAVE_MULTITHREAD + (void) flags; + _lock.release(); +#else + (void) flags; +#endif +} + + +// read-write lock +// +// on read: acquire local read lock +// on write: acquire every read lock +// +// alternatively, we could use a read counter and a write lock. we don't do +// that because we'd like to avoid a cache miss for read acquires. this makes +// reads very fast, and writes more expensive + +/** @class ReadWriteLock + * @brief A read/write lock. + * + * The ReadWriteLock class abstracts a read/write lock in SMP Click. Multiple + * SMP Click threads can hold read locks simultaneously, but if any thread + * holds a write lock, then no other thread holds any kind of lock. The + * read/write lock is implemented with Spinlock objects, so acquiring a lock + * is a polling operation. ReadWriteLocks can be used to synchronize access + * to shared data among multiple Click SMP threads. ReadWriteLocks should not + * be held for long periods of time. + * + * ReadWriteLock operations do nothing unless Click was compiled with + * --enable-multithread. Therefore, ReadWriteLock should not be used to, for + * example, synchronize handlers with main element threads. + * + * The main ReadWriteLock operations are acquire_read() and acquire_write(), + * which acquire the lock for reading or writing, respectively, and + * release_read() and release_write(), which similarly release the lock. + * attempt_read() and attempt_write() acquire the lock only if it can be + * acquired instantaneously. + * + * It is OK for a thread to acquire a lock it has already acquired, but you + * must release it as many times as you have acquired it. + * + * ReadWriteLock objects are relatively large in terms of memory usage; don't + * create too many of them. + */ +class ReadWriteLock { public: + + inline ReadWriteLock(); +#if CLICK_LINUXMODULE && defined(CONFIG_SMP) + inline ~ReadWriteLock(); +#endif + + inline void acquire_read(); + inline bool attempt_read(); + inline void release_read(); + inline void acquire_write(); + inline bool attempt_write(); + inline void release_write(); + +#if CLICK_LINUXMODULE && defined(CONFIG_SMP) + private: + // allocate a cache line for every member + struct lock_t { + Spinlock _lock; + unsigned char reserved[L1_CACHE_BYTES - sizeof(Spinlock)]; + } *_l; +#endif + +}; + +/** @brief Creates a ReadWriteLock. */ +inline +ReadWriteLock::ReadWriteLock() +{ +#if CLICK_LINUXMODULE && defined(CONFIG_SMP) + _l = new lock_t[num_possible_cpus()]; +#endif +} + +#if CLICK_LINUXMODULE && defined(CONFIG_SMP) +inline +ReadWriteLock::~ReadWriteLock() +{ + delete[] _l; +} +#endif + +/** @brief Acquires the ReadWriteLock for reading. + * + * On return, this thread has acquired the lock for reading. The function + * will spin indefinitely until the lock is acquired. It is OK to acquire a + * lock you have already acquired, but you must release it as many times as + * you have acquired it. + * + * @sa Spinlock::acquire + */ +inline void +ReadWriteLock::acquire_read() +{ +#if CLICK_LINUXMODULE && defined(CONFIG_SMP) + click_processor_t my_cpu = click_get_processor(); + _l[my_cpu]._lock.acquire(); +#endif +} + +/** @brief Attempts to acquire the ReadWriteLock for reading. + * @return True iff the ReadWriteLock was acquired. + * + * This function will acquire the lock for reading and return true only if the + * ReadWriteLock can be acquired right away, without retries. + */ +inline bool +ReadWriteLock::attempt_read() +{ +#if CLICK_LINUXMODULE && defined(CONFIG_SMP) + click_processor_t my_cpu = click_get_processor(); + bool result = _l[my_cpu]._lock.attempt(); + if (!result) + click_put_processor(); + return result; +#else + return true; +#endif +} + +/** @brief Releases the ReadWriteLock for reading. + * + * The ReadWriteLock must have been previously acquired by either + * ReadWriteLock::acquire_read or ReadWriteLock::attempt_read. Do not call + * release_read() on a lock that was acquired for writing. + */ +inline void +ReadWriteLock::release_read() +{ +#if CLICK_LINUXMODULE && defined(CONFIG_SMP) + _l[click_current_processor()]._lock.release(); + click_put_processor(); +#endif +} + +/** @brief Acquires the ReadWriteLock for writing. + * + * On return, this thread has acquired the lock for writing. The function + * will spin indefinitely until the lock is acquired. It is OK to acquire a + * lock you have already acquired, but you must release it as many times as + * you have acquired it. + * + * @sa ReadWriteLock::acquire_read + */ +inline void +ReadWriteLock::acquire_write() +{ +#if CLICK_LINUXMODULE && defined(CONFIG_SMP) + for (unsigned i = 0; i < (unsigned) num_possible_cpus(); i++) + _l[i]._lock.acquire(); +#endif +} + +/** @brief Attempts to acquire the ReadWriteLock for writing. + * @return True iff the ReadWriteLock was acquired. + * + * This function will acquire the lock for writing and return true only if the + * ReadWriteLock can be acquired right away, without retries. Note, however, + * that acquiring a ReadWriteLock requires as many operations as there are + * CPUs. + * + * @sa ReadWriteLock::attempt_read + */ +inline bool +ReadWriteLock::attempt_write() +{ +#if CLICK_LINUXMODULE && defined(CONFIG_SMP) + bool all = true; + unsigned i; + for (i = 0; i < (unsigned) num_possible_cpus(); i++) + if (!(_l[i]._lock.attempt())) { + all = false; + break; + } + if (!all) + for (unsigned j = 0; j < i; j++) + _l[j]._lock.release(); + return all; +#else + return true; +#endif +} + +/** @brief Releases the ReadWriteLock for writing. + * + * The ReadWriteLock must have been previously acquired by either + * ReadWriteLock::acquire_write or ReadWriteLock::attempt_write. Do not call + * release_write() on a lock that was acquired for reading. + * + * @sa ReadWriteLock::release_read + */ +inline void +ReadWriteLock::release_write() +{ +#if CLICK_LINUXMODULE && defined(CONFIG_SMP) + for (unsigned i = 0; i < (unsigned) num_possible_cpus(); i++) + _l[i]._lock.release(); +#endif +} + +CLICK_ENDDECLS +#undef SPINLOCK_ASSERTLEVEL +#endif diff --git a/openflow/include/click/task.hh b/openflow/include/click/task.hh new file mode 100644 index 0000000..4bfb127 --- /dev/null +++ b/openflow/include/click/task.hh @@ -0,0 +1,648 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/task.cc" -*- +#ifndef CLICK_TASK_HH +#define CLICK_TASK_HH +#include +#include +#if HAVE_MULTITHREAD +# include +# include +#endif +CLICK_DECLS + +#if CLICK_BSDMODULE +# include +CLICK_CXX_PROTECT +# include +# include +CLICK_CXX_UNPROTECT +# include +#else +#define GIANT_REQUIRED +#endif + +#define PASS_GT(a, b) ((int)(a - b) > 0) + +typedef bool (*TaskCallback)(Task *, void *); +typedef TaskCallback TaskHook CLICK_DEPRECATED; +class RouterThread; +class TaskList; +class Master; + +struct TaskLink { +#if !HAVE_TASK_HEAP + TaskLink *_prev; + TaskLink *_next; +#endif +#if HAVE_STRIDE_SCHED + unsigned _pass; +#endif + TaskLink() { +#if !HAVE_TASK_HEAP + _prev = _next = 0; +#endif +#if HAVE_STRIDE_SCHED + _pass = 0; +#endif + } +}; + +class Task : private TaskLink { public: + +#if HAVE_STRIDE_SCHED + enum { STRIDE1 = 1U<<16, MAX_STRIDE = 1U<<31 }; + enum { MAX_TICKETS = 1<<15, DEFAULT_TICKETS = 1<<10 }; +#endif +#if HAVE_ADAPTIVE_SCHEDULER + enum { MAX_UTILIZATION = 1000 }; +#endif + + /** @brief Construct a task that calls @a f with @a user_data argument. + * + * @param f callback function + * @param user_data argument for callback function + * + * Constructs a task that, when fired, calls @a f like so: + * + * @code + * bool work_done = f(task, user_data); + * @endcode + * + * where @a task is a pointer to this task. @a f should return true if + * the task accomplished some meaningful work, and false if it did not. + * For example, a task that polls a network driver for packets should + * return true if it emits at least one packet, and false if no packets + * were available. */ + inline Task(TaskCallback f, void *user_data); + + /** @brief Construct a task that calls @a e ->@link Element::run_task(Task*) run_task()@endlink. + * + * @param e element to call + * + * Constructs a task that, when fired, calls the element @a e's @link + * Element::run_task(Task *) run_task()@endlink method, passing this Task + * as an argument. + * + * @sa Task(TaskCallback, void *) */ + inline Task(Element *e); + + /** @brief Destroy a task. + * + * Unschedules the task if necessary. */ + ~Task(); + + + /** @brief Return the task's callback function. + * + * Returns null if the task was constructed with the Task(Element *) + * constructor. */ + inline TaskCallback callback() const { + return _hook; + } + + /** @brief Return the task callback function's user data. */ + inline void *user_data() const { + return _thunk; + } + + /** @brief Return the task's owning element. */ + inline Element *element() const { + return _owner; + } + + + /** @brief Return true iff the task has been initialize()d. */ + inline bool initialized() const; + + /** @brief Return the task's home thread ID. + * + * This is the @link RouterThread::thread_id() thread_id()@endlink of the + * thread on which this Task would run if it were scheduled. This need + * not equal the ID of the current thread(), since changes in + * home_thread_id() aren't always implemented immediately (because of + * locking issues). */ + inline int home_thread_id() const; + + /** @brief Return the thread on which this task is currently scheduled, + * or would be scheduled. + * + * Usually, task->thread()->@link RouterThread::thread_id() + * thread_id()@endlink == task->home_thread_id(). They can differ, + * however, if move_thread() was called but the task hasn't yet been moved + * to the new thread. */ + inline RouterThread *thread() const; + + /** @brief Return the router to which this task belongs. */ + inline Router *router() const { + return _owner->router(); + } + + /** @brief Return the master where this task will be scheduled. */ + Master *master() const; + + + /** @brief Initialize the Task, and optionally schedule it. + * @param owner specifies the element owning the Task + * @param schedule if true, the Task will be scheduled immediately + * + * This function must be called on every Task before it is used. The + * corresponding router's ThreadSched, if any, is used to determine the + * task's initial thread assignment. The task initially has the default + * number of tickets, and is scheduled iff @a schedule is true. + * + * An assertion will fail if a Task is initialized twice. + * + * Most elements call ScheduleInfo::initialize_task() to initialize a Task + * object. The ScheduleInfo method additionally sets the task's + * scheduling parameters, such as ticket count and thread preference, + * based on a router's ScheduleInfo. ScheduleInfo::initialize_task() + * calls Task::initialize(). */ + void initialize(Element *owner, bool schedule); + + /** @brief Initialize the Task, and optionally schedule it. + * @param router specifies the router owning the Task + * @param schedule if true, the Task will be scheduled immediately + * + * This function is shorthand for @link Task::initialize(Element *, bool) + * Task::initialize@endlink(@a router ->@link Router::root_element + * root_element@endlink(), @a scheduled). However, it is better to + * explicitly associate tasks with real elements. */ + void initialize(Router *router, bool schedule); + + + /** @brief Return true iff the task is currently scheduled to run. + * + * @note A scheduled task will usually run very soon, but not + * always; due to locking issues, the effects of some reschedule() + * requests may be delayed. Although a task unscheduled with + * strong_unschedule() may appear scheduled(), it will not run + * until strong_reschedule() is called. */ + inline bool scheduled() const { + return _status.is_scheduled; + } + + + /** @brief Unschedule the task. + * + * After unschedule() returns, the task will not run until it is + * rescheduled with reschedule(). + * + * @sa reschedule, strong_unschedule */ + inline void unschedule() { + _status.is_scheduled = false; + } + + /** @brief Reschedule the task. + * + * The task is rescheduled on its home thread. It will eventually run, + * unless its home thread is quiescent or it has been + * strong_unschedule()d. + * + * @sa unschedule, strong_reschedule */ + inline void reschedule() { + _status.is_scheduled = true; + click_fence(); + if (_pending_nextptr.x < 2) + complete_schedule(0); + } + + /** @brief Reschedule a task from the task's callback function. + * + * @warning Only call @a task.fast_reschedule() while @a task is being + * fired, i.e., in its callback function. It is an error to call + * @task.fast_reschedule() at other times -- the task may not actually be + * rescheduled. + * + * Here's a typical, correct use of fast_reschedule(): + * + * @code + * class MyElement : public Element { + * ... Task _task; ... bool run_task(Task *t); ... + * }; + * bool MyElement::run_task(Task *) { + * do_some_work(); + * _task.fast_reschedule(); + * return true; + * } + * @endcode + * + * This assumes, however, that run_task() is only called directly by the + * driver. If you call run_task() from another context, _task may not + * actually be scheduled. + * + * @code + * void MyElement::run_timer(Timer *) { + * run_task(); // XXX might not reschedule _task! + * } + * @endcode + */ + inline void fast_reschedule() { + _status.is_scheduled = true; + } + + + /** @brief Unschedule the Task until strong_reschedule(). + * + * Like unschedule(), but in addition, future reschedule() calls + * will not actually schedule the task. Only after strong_reschedule() + * will the task run again. + * @sa strong_reschedule, unschedule + */ + inline void strong_unschedule() { + _status.is_scheduled = false; + _status.is_strong_unscheduled = true; + } + + /** @brief Reschedule the Task, undoing a prior strong_unschedule(). + * + * This function undoes any previous strong_unschedule() and + * reschedules the task. + * @sa reschedule, strong_unschedule + */ + inline void strong_reschedule() { + _status.is_strong_unscheduled = false; + reschedule(); + } + + + /** @brief Move the Task to a new home thread. + * + * The home thread ID is set to @a new_thread_id. The task, if it is + * currently scheduled, is rescheduled on thread @a new_thread_id + * (which generally takes some time to take effect). If @a new_thread_id + * is less than zero or greater than the number of threads on the router, + * the task is scheduled on a quiescent thread that never actually runs. + */ + void move_thread(int new_thread_id); + + +#if HAVE_STRIDE_SCHED + inline int tickets() const; + inline void set_tickets(int n); + inline void adjust_tickets(int delta); +#endif + + inline bool fire(); + +#if HAVE_ADAPTIVE_SCHEDULER + inline unsigned runs() const; + inline unsigned work_done() const; + inline unsigned utilization() const; + inline void clear_runs(); +#endif +#if HAVE_MULTITHREAD + inline int cycles() const; + inline unsigned cycle_runs() const; + inline void update_cycles(unsigned c); +#endif + + /** @cond never */ + inline TaskCallback hook() const CLICK_DEPRECATED; + inline void *thunk() const CLICK_DEPRECATED; + /** @endcond never */ + + private: + +#if HAVE_TASK_HEAP + int _schedpos; +#endif + +#if HAVE_STRIDE_SCHED + unsigned _stride; + int _tickets; +#endif + + union Status { + struct { + int16_t home_thread_id; + uint8_t is_scheduled; + uint8_t is_strong_unscheduled; + }; + uint32_t status; + } _status; + + TaskCallback _hook; + void *_thunk; + +#if HAVE_ADAPTIVE_SCHEDULER + unsigned _runs; + unsigned _work_done; +#endif +#if HAVE_MULTITHREAD + DirectEWMA _cycles; + unsigned _cycle_runs; +#endif + + RouterThread *_thread; + + Element *_owner; + + union Pending { + Task *t; + uintptr_t x; + }; + Pending _pending_nextptr; + + Task(const Task &x); + Task &operator=(const Task &x); + void cleanup(); + +#if CLICK_DEBUG_SCHEDULING + public: +#endif + inline bool on_scheduled_list() const; + inline bool on_pending_list() const { + return _pending_nextptr.x != 0; + } + inline bool needs_cleanup() const; +#if CLICK_DEBUG_SCHEDULING + private: +#endif + + void add_pending(bool always); + void process_pending(RouterThread* thread); + + void complete_schedule(RouterThread* process_pending_thread); + inline void remove_from_scheduled_list(); + + static bool error_hook(Task *task, void *user_data); + + friend class RouterThread; + friend class Master; +}; + + +// need RouterThread's definition for inline functions +CLICK_ENDDECLS +#include +CLICK_DECLS + + +inline +Task::Task(TaskCallback f, void *user_data) + : +#if HAVE_TASK_HEAP + _schedpos(-1), +#endif +#if HAVE_STRIDE_SCHED + _stride(0), _tickets(-1), +#endif + _hook(f), _thunk(user_data), +#if HAVE_ADAPTIVE_SCHEDULER + _runs(0), _work_done(0), +#endif +#if HAVE_MULTITHREAD + _cycle_runs(0), +#endif + _thread(0), _owner(0) +{ + _status.home_thread_id = -2; + _status.is_scheduled = _status.is_strong_unscheduled = false; + _pending_nextptr.x = 0; +} + +inline +Task::Task(Element* e) + : +#if HAVE_TASK_HEAP + _schedpos(-1), +#endif +#if HAVE_STRIDE_SCHED + _stride(0), _tickets(-1), +#endif + _hook(0), _thunk(e), +#if HAVE_ADAPTIVE_SCHEDULER + _runs(0), _work_done(0), +#endif +#if HAVE_MULTITHREAD + _cycle_runs(0), +#endif + _thread(0), _owner(0) +{ + _status.home_thread_id = -2; + _status.is_scheduled = _status.is_strong_unscheduled = false; + _pending_nextptr.x = 0; +} + +inline bool +Task::initialized() const +{ + return _owner != 0; +} + +inline bool +Task::on_scheduled_list() const +{ +#if HAVE_TASK_HEAP + return _schedpos >= 0; +#else + return _prev != 0; +#endif +} + +inline bool +Task::needs_cleanup() const +{ +#if HAVE_TASK_HEAP + int a; + uintptr_t b; + do { + a = _schedpos; + b = _pending_nextptr.x; + click_fence(); + } while (a != _schedpos || b != _pending_nextptr.x); + return a >= 0 || b != 0; +#else + TaskLink* a; + uintptr_t b; + do { + a = _prev; + b = _pending_nextptr.x; + click_fence(); + } while (a != _prev || b != _pending_nextptr.x); + return a != 0 || b != 0; +#endif +} + +/** @cond never */ +/** @brief Return the task's callback function. + * @deprecated Use callback() instead. */ +inline TaskCallback +Task::hook() const +{ + return _hook; +} + +/** @brief Return the task's callback data. + * @deprecated Use user_data() instead. */ +inline void * +Task::thunk() const +{ + return _thunk; +} +/** @endcond never */ + +inline int +Task::home_thread_id() const +{ + return _status.home_thread_id; +} + +inline RouterThread * +Task::thread() const +{ + return _thread; +} + +inline void +Task::remove_from_scheduled_list() +{ + if (on_scheduled_list()) { +#if HAVE_TASK_HEAP + Task *back = _thread->_task_heap.back().t; + _thread->_task_heap.pop_back(); + if (_thread->_task_heap.size() > 0) + _thread->task_reheapify_from(_schedpos, back); + click_fence(); + _schedpos = -1; +#else + _next->_prev = _prev; + _prev->_next = _next; + _next = 0; + click_fence(); + _prev = 0; +#endif + } +} + +#if HAVE_STRIDE_SCHED + +/** @brief Return the task's number of tickets. + * + * Tasks with larger numbers of tickets are scheduled more often. Tasks are + * initialized with tickets() == DEFAULT_TICKETS. + * + * @sa set_tickets, adjust_tickets + */ +inline int +Task::tickets() const +{ + return _tickets; +} + +/** @brief Set the task's ticket count. + * @param n the ticket count + * + * The ticket count @a n is pinned to the range [1, MAX_TICKETS]. + * + * @sa tickets, adjust_tickets + */ +inline void +Task::set_tickets(int n) +{ + if (n > MAX_TICKETS) + n = MAX_TICKETS; + else if (n < 1) + n = 1; + _tickets = n; + _stride = STRIDE1 / n; + assert(_stride < MAX_STRIDE); +} + +/** @brief Add @a delta to the Task's ticket count. + * @param delta adjustment to the ticket count + * + * The ticket count cannot be adjusted below 1 or above MAX_TICKETS. + * + * @sa set_tickets + */ +inline void +Task::adjust_tickets(int delta) +{ + set_tickets(_tickets + delta); +} + +#endif /* HAVE_STRIDE_SCHED */ + + +/** @brief Fire the task by calling its callback function. + * + * This function is generally called by the RouterThread implementation; there + * should be no need to call it yourself. + */ +inline bool +Task::fire() +{ +#if CLICK_STATS >= 2 + click_cycles_t start_cycles = click_get_cycles(), + start_child_cycles = _owner->_child_cycles; +#endif +#if HAVE_MULTITHREAD + _cycle_runs++; +#endif + bool work_done; + if (!_hook) + work_done = ((Element*)_thunk)->run_task(this); + else + work_done = _hook(this, _thunk); +#if HAVE_ADAPTIVE_SCHEDULER + ++_runs; + _work_done += work_done; +#endif +#if CLICK_STATS >= 2 + click_cycles_t all_delta = click_get_cycles() - start_cycles, + own_delta = all_delta - (_owner->_child_cycles - start_child_cycles); + _owner->_task_calls += 1; + _owner->_task_own_cycles += own_delta; +#endif + return work_done; +} + +#if HAVE_ADAPTIVE_SCHEDULER +inline unsigned +Task::runs() const +{ + return _runs; +} + +inline unsigned +Task::work_done() const +{ + return _work_done; +} + +inline unsigned +Task::utilization() const +{ + return (_runs ? (MAX_UTILIZATION * _work_done) / _runs : 0); +} + +inline void +Task::clear_runs() +{ + _runs = _work_done = 0; +} +#endif + +#if HAVE_MULTITHREAD +inline int +Task::cycles() const +{ + return _cycles.unscaled_average(); +} + +inline unsigned +Task::cycle_runs() const +{ + return _cycle_runs; +} + +inline void +Task::update_cycles(unsigned c) +{ + _cycles.update(c); + _cycle_runs = 0; +} +#endif + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/timer.hh b/openflow/include/click/timer.hh new file mode 100644 index 0000000..174d570 --- /dev/null +++ b/openflow/include/click/timer.hh @@ -0,0 +1,397 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/timer.cc" -*- +#ifndef CLICK_TIMER_HH +#define CLICK_TIMER_HH +#include +#include +#include +#include +CLICK_DECLS +class RouterThread; + +typedef void (*TimerCallback)(Timer *timer, void *user_data); +typedef TimerCallback TimerHook CLICK_DEPRECATED; + +class Timer { public: + + /** @brief Construct a Timer that does nothing when fired. + * + * This constructor is most useful for a Timer that will be assigned a + * true callback later, using one of the Timer::assign() methods. + * Timer::initialize() will report a warning if called on a Timer created + * by this constructor. */ + Timer(); + + struct do_nothing_t { + }; + + /** @brief Construct a Timer that does nothing when fired. + * + * Unlike with the default Timer() constructor, Timer::initialize() will + * not report a warning if called on a Timer created by this + * constructor. */ + Timer(const do_nothing_t &unused); + + /** @brief Construct a Timer that calls @a f(this, @a user_data) when + * fired. + * @param f callback function + * @param user_data argument for callback function */ + Timer(TimerCallback f, void *user_data); + + /** @brief Construct a Timer that calls @a element ->@link + * Element::run_timer() run_timer@endlink(this) when fired. + * @param element the element */ + Timer(Element *element); + + /** @brief Construct a Timer that schedules @a task when fired. + * @param task the task */ + Timer(Task *task); + + /** @brief Construct a Timer that acts like @a x when fired. + * + * The newly-constructed Timer is not initialized. */ + Timer(const Timer &x); + + /** @brief Destroy a Timer, unscheduling it first if necessary. */ + inline ~Timer() { + if (scheduled()) + unschedule(); + } + + + /** @brief Change the Timer to do nothing when fired. */ + inline void assign() { + _hook.callback = do_nothing_hook; + _thunk = (void *) 1; + } + + /** @brief Change the Timer to do nothing when fired. */ + inline void assign(const do_nothing_t &unused) { + (void) unused; + assign(); + } + + /** @brief Change the Timer to call @a f(this, @a user_data) when fired. + * @param f callback function + * @param user_data argument for callback function */ + inline void assign(TimerCallback f, void *user_data) { + _hook.callback = f; + _thunk = user_data; + } + + /** @brief Change the Timer to call @a element ->@link + * Element::run_timer() run_timer@endlink(this) when fired. + * @param element the element */ + void assign(Element *element) { + _hook.callback = element_hook; + _thunk = element; + } + + /** @brief Change the Timer to schedule @a task when fired. + * @param task the task */ + void assign(Task *task) { + _hook.callback = task_hook; + _thunk = task; + } + + + /** @brief Return true iff the Timer has been initialized. */ + inline bool initialized() const { + return _owner != 0; + } + + /** @brief Return true iff the Timer is currently scheduled. */ + inline bool scheduled() const { + return _schedpos1 != 0; + } + + + /** @brief Return the Timer's steady-clock expiration time. + * + * This is the absolute time, according to the steady clock, at which the + * timer is next scheduled to fire. If the timer is not currently + * scheduled, then expiry_steady() returns the last assigned expiration + * time. + * + * @sa expiry() */ + inline const Timestamp &expiry_steady() const { + return _expiry_s; + } + + /** @brief Return the Timer's system-clock expiration time. + * + * Timer expirations are measured using the system's steady clock, which + * increases monotonically. (See Timestamp::now_steady().) The expiry() + * function, however, returns the timer's expiration time according to the + * system clock. This is a calculated value: if the system clock changes + * -- because the user changes the current system time, for example -- + * then the timer's expiry() will also change. (The timer's + * expiry_steady() value will not change, however.) + * + * @sa expiry_steady() */ + inline Timestamp expiry() const { + if (_expiry_s) + return _expiry_s + Timestamp::recent() - Timestamp::recent_steady(); + else + return _expiry_s; + } + + /** @brief Return the Timer's associated Router. */ + inline Router *router() const { + return _owner->router(); + } + + /** @brief Return the Timer's owning element. */ + inline Element *element() const { + return _owner; + } + + /** @brief Return the Timer's associated RouterThread. */ + inline RouterThread *thread() const { + return _thread; + } + + /** @brief Return the Timer's associated home thread ID. */ + int home_thread_id() const; + + + /** @brief Initialize the timer. + * @param owner the owner element + * @param quiet do not produce default-constructor warning if true + * + * Before a timer can be used, it must be attached to a containing router. + * When that router is destroyed, the timer is automatically + * unscheduled. It is safe to initialize the timer multiple times + * on the same router. + * + * If Click is compiled with statistics support, time spent in this + * Timer will be charged to the @a owner element. + * + * Initializing a Timer constructed by the default constructor, Timer(), + * will produce a warning. */ + void initialize(Element *owner, bool quiet = false); + + /** @brief Initialize the timer. + * @param router the owner router + * + * This function is shorthand for @link + * Timer::initialize(Element*,bool) Timer::initialize@endlink(@a + * router ->@link Router::root_element root_element@endlink()). + * However, it is better to explicitly associate timers with real + * elements. */ + void initialize(Router *router); + + + /** @brief Schedule the timer to fire at @a when_steady. + * @param when_steady expiration time according to the steady clock + * + * If @a when_steady is more than 2 seconds behind the current time, then + * the expiration time is silently updated to the current time. + * + * @sa schedule_at() */ + void schedule_at_steady(const Timestamp &when_steady); + + /** @brief Schedule the timer to fire at @a when_steady. + * @param when_steady expiration time according to the steady clock + * + * This is a synonym for schedule_at_steady(). */ + void reschedule_at_steady(const Timestamp &when_steady); + + /** @brief Schedule the timer to fire at @a when. + * @param when expiration time according to the system clock + * + * If @a when is more than 2 seconds behind system time, then the + * expiration time is silently updated to the current system time. + * + * @note The schedule_at_steady() function should generally be preferred + * to schedule_at(). schedule_at() is implemented in terms of + * schedule_at_steady(). + * + * @sa schedule_at_steady() */ + inline void schedule_at(const Timestamp &when); + + /** @brief Schedule the timer to fire at @a when. + * @param when expiration time + * + * This is a synonym for schedule_at(). */ + inline void reschedule_at(const Timestamp &when); + + /** @brief Shedule the timer to fire immediately. + * + * Equivalent to schedule_at(Timestamp::recent()). */ + inline void schedule_now() { + schedule_at_steady(Timestamp::recent_steady()); + } + + /** @brief Schedule the timer to fire @a delta time in the future. + * @param delta interval until expiration time + * + * The schedule_after methods schedule the timer relative to the current + * time. When called from a timer's callback function, this will usually + * be slightly after the timer's nominal expiration time. To schedule a + * timer at a strict interval, compensating for small amounts of drift, + * use the reschedule_after methods. */ + void schedule_after(const Timestamp &delta); + + /** @brief Schedule the timer to fire after @a delta_sec seconds. + * @param delta_sec interval until expiration time, in seconds + * + * @sa schedule_after, reschedule_after_sec */ + inline void schedule_after_sec(uint32_t delta_sec) { + schedule_after(Timestamp(delta_sec, 0)); + } + + /** @brief Schedule the timer to fire after @a delta_msec milliseconds. + * @param delta_msec interval until expiration time, in milliseconds + * + * @sa schedule_after, reschedule_after_msec */ + inline void schedule_after_msec(uint32_t delta_msec) { + schedule_after(Timestamp::make_msec(delta_msec)); + } + + /** @brief Schedule the timer to fire @a delta time after its previous + * expiry. + * @param delta interval until expiration time + * + * If the expiration time is too far in the past, then the new expiration + * time will be silently updated to the current system time. + * + * @sa schedule_after */ + inline void reschedule_after(const Timestamp &delta) { + schedule_at_steady(_expiry_s + delta); + } + + /** @brief Schedule the timer to fire @a delta_sec seconds after its + * previous expiry. + * @param delta_sec interval until expiration time, in seconds + * + * @sa schedule_after_sec, reschedule_after */ + inline void reschedule_after_sec(uint32_t delta_sec) { + schedule_at_steady(Timestamp(_expiry_s.sec() + delta_sec, _expiry_s.subsec())); + } + + /** @brief Schedule the timer to fire @a delta_msec milliseconds after its + * previous expiry. + * @param delta_msec interval until expiration time, in milliseconds + * + * @sa schedule_after_msec, reschedule_after */ + inline void reschedule_after_msec(uint32_t delta_msec) { + schedule_at_steady(_expiry_s + Timestamp::make_msec(delta_msec)); + } + + + /** @brief Unschedule the timer. + * + * The timer's expiration time is not modified. */ + void unschedule(); + + /** @brief Unschedule the timer and reset its expiration time. */ + inline void clear() { + unschedule(); + _expiry_s = Timestamp(); + } + + + /** @brief Return an adjustment interval useful for precise timers. + * + * Due to scheduling granularity, other tasks running on the same machine, + * and similar effects, a Timer object can trigger some time after its + * nominal expiry(). Functions that require precise timers should combine + * a Timer and a Task object. The Timer's job is to schedule the Task; + * the Timer's expiry is set to go off a short interval before the true + * expiry, and the Task is used to busy-wait the difference. + * Timer::adjustment() is an appropriate value for this time + * difference. */ + static inline Timestamp adjustment() { +#if TIMESTAMP_WARPABLE + if (Timestamp::warp_jumping()) + return Timestamp(); +#endif + return Timestamp::make_usec(500); + } + + + /** @brief Schedule the timer to fire after @a delta_sec seconds + * (deprecated). + * + * @deprecated Use schedule_after_sec() instead. */ + inline void schedule_after_s(uint32_t delta_sec) CLICK_DEPRECATED; + + /** @brief Schedule the timer to fire after @a delta_msec milliseconds + * (deprecated). + * + * @deprecated Use schedule_after_msec() instead. */ + inline void schedule_after_ms(uint32_t delta_sec) CLICK_DEPRECATED; + + /** @brief Schedule the timer to fire @a delta_sec seconds after its + * previous expiry time (deprecated). + * + * @deprecated Use reschedule_after_sec() instead. */ + inline void reschedule_after_s(uint32_t delta_sec) CLICK_DEPRECATED; + + /** @brief Schedule the timer to fire @a delta_msec milliseconds after its + * previous expiry time (deprecated). + * + * @deprecated Use reschedule_after_msec() instead. */ + inline void reschedule_after_ms(uint32_t delta_sec) CLICK_DEPRECATED; + + enum { behind_sec = 1 }; + + private: + + int _schedpos1; + Timestamp _expiry_s; + union { + TimerCallback callback; + } _hook; + void *_thunk; + Element *_owner; + RouterThread *_thread; + + Timer &operator=(const Timer &x); + + static void do_nothing_hook(Timer *t, void *user_data); + static void element_hook(Timer *t, void *user_data); + static void task_hook(Timer *t, void *user_data); + + friend class TimerSet; + +}; + +inline void +Timer::schedule_at(const Timestamp &when) +{ + schedule_at_steady(when + Timestamp::recent_steady() - Timestamp::recent()); +} + +inline void +Timer::reschedule_at(const Timestamp &when) +{ + schedule_at(when); +} + +inline void +Timer::schedule_after_s(uint32_t delta_sec) +{ + schedule_after_sec(delta_sec); +} + +inline void +Timer::schedule_after_ms(uint32_t delta_msec) +{ + schedule_after_msec(delta_msec); +} + +inline void +Timer::reschedule_after_s(uint32_t delta_sec) +{ + reschedule_after_sec(delta_sec); +} + +inline void +Timer::reschedule_after_ms(uint32_t delta_msec) +{ + reschedule_after_msec(delta_msec); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/timerset.hh b/openflow/include/click/timerset.hh new file mode 100644 index 0000000..9f38485 --- /dev/null +++ b/openflow/include/click/timerset.hh @@ -0,0 +1,162 @@ +// -*- related-file-name: "../../lib/timerset.cc" -*- +#ifndef CLICK_TIMERSET_HH +#define CLICK_TIMERSET_HH 1 +#include +#include +#include +CLICK_DECLS +class Router; +class RouterThread; +class Timer; + +class TimerSet { public: + + TimerSet(); + + Timestamp timer_expiry_steady() const { return _timer_expiry; } + inline Timestamp timer_expiry_steady_adjusted() const; +#if CLICK_USERLEVEL + inline int next_timer_delay(bool more_tasks, Timestamp &t) const; +#endif + + Timer *next_timer(); // useful for benchmarking + + unsigned max_timer_stride() const { return _max_timer_stride; } + unsigned timer_stride() const { return _timer_stride; } + void set_max_timer_stride(unsigned timer_stride); + + void kill_router(Router *router); + + void run_timers(RouterThread *thread, Master *master); + + inline void fence(); + + private: + + struct heap_element { + Timestamp expiry_s; + Timer *t; +#if SIZEOF_VOID_P == 4 + uint32_t padding; /* the structure should have size 16 */ +#endif + heap_element(Timer *t_) + : expiry_s(t_->expiry_steady()), t(t_) { + } + }; + struct heap_less { + inline bool operator()(const heap_element &a, const heap_element &b) { + return a.expiry_s < b.expiry_s; + } + }; + struct heap_place { + inline void operator()(heap_element *begin, heap_element *t) { + t->t->_schedpos1 = (t - begin) + 1; + } + }; + + // Most likely _timer_expiry now fits in a cache line + Timestamp _timer_expiry CLICK_ALIGNED(8); + + unsigned _max_timer_stride; + unsigned _timer_stride; + unsigned _timer_count; + Vector _timer_heap; + Vector _timer_runchunk; + SimpleSpinlock _timer_lock; +#if CLICK_LINUXMODULE + struct task_struct *_timer_task; +#elif HAVE_MULTITHREAD + click_processor_t _timer_processor; +#endif + Timestamp _timer_check; + uint32_t _timer_check_reports; + + inline void run_one_timer(Timer *); + + void set_timer_expiry() { + if (_timer_heap.size()) + _timer_expiry = _timer_heap.unchecked_at(0).expiry_s; + else + _timer_expiry = Timestamp(); + } + void check_timer_expiry(Timer *t); + + inline void lock_timers(); + inline bool attempt_lock_timers(); + inline void unlock_timers(); + + friend class Timer; + +}; + +inline Timestamp +TimerSet::timer_expiry_steady_adjusted() const +{ + Timestamp e = _timer_expiry; +#if TIMESTAMP_WARPABLE + if (likely(!Timestamp::warp_jumping())) { +#endif + if (_timer_stride >= 8 || !e) + /* do nothing */; + else if (_timer_stride >= 4) + e -= Timer::adjustment(); + else + e -= Timer::adjustment() + Timer::adjustment(); +#if TIMESTAMP_WARPABLE + } +#endif + return e; +} + +inline void +TimerSet::lock_timers() +{ +#if CLICK_LINUXMODULE + if (current != _timer_task) + _timer_lock.acquire(); +#elif HAVE_MULTITHREAD + if (click_current_processor() != _timer_processor) + _timer_lock.acquire(); +#endif +} + +inline bool +TimerSet::attempt_lock_timers() +{ +#if CLICK_LINUXMODULE || HAVE_MULTITHREAD + return _timer_lock.attempt(); +#else + return true; +#endif +} + +inline void +TimerSet::unlock_timers() +{ +#if CLICK_LINUXMODULE + if (current != _timer_task) + _timer_lock.release(); +#elif HAVE_MULTITHREAD + if (click_current_processor() != _timer_processor) + _timer_lock.release(); +#endif +} + +inline void +TimerSet::fence() +{ + lock_timers(); + unlock_timers(); +} + +inline Timer * +TimerSet::next_timer() +{ + lock_timers(); + Timer *t = _timer_heap.empty() ? 0 : _timer_heap.unchecked_at(0).t; + unlock_timers(); + return t; +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/timestamp.hh b/openflow/include/click/timestamp.hh new file mode 100644 index 0000000..9b8e773 --- /dev/null +++ b/openflow/include/click/timestamp.hh @@ -0,0 +1,1540 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/timestamp.cc" -*- +#ifndef CLICK_TIMESTAMP_HH +#define CLICK_TIMESTAMP_HH +#include +#include +#include +#if !CLICK_LINUXMODULE && !CLICK_BSDMODULE +# include +#endif +CLICK_DECLS +class String; +class Timestamp; +Timestamp operator+(Timestamp, const Timestamp &); + +// Timestamp has three possible internal representations, selected by #defines. +// * TIMESTAMP_REP_FLAT64: a 64-bit integer number of nanoseconds +// * TIMESTAMP_REP_BIG_ENDIAN: 32 bits of seconds plus 32 bits of subseconds +// * TIMESTAMP_REP_LITTLE_ENDIAN: 32 bits of subseconds plus 32 bits of seconds +// +// Rationale: The linuxmodule driver must select the same representation as +// Linux's sk_buff tstamp member, which may use any of these representations. +// (Linuxmodule Packet objects are equivalent to sk_buffs, and +// Packet::timestamp_anno() maps to sk_buff::tstamp. We want to avoid +// conversion expense when accessing timestamp_anno(). More seriously, it is +// very convenient to treat timestamp_anno() as a modifiable reference.) + +#if !TIMESTAMP_REP_FLAT64 && !TIMESTAMP_REP_BIG_ENDIAN && !TIMESTAMP_REP_LITTLE_ENDIAN +# if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) +# define TIMESTAMP_REP_BIG_ENDIAN 1 +# elif BITS_PER_LONG == 64 || defined(CONFIG_KTIME_SCALAR) +# define TIMESTAMP_REP_FLAT64 1 +# elif defined(__BIG_ENDIAN) +# define TIMESTAMP_REP_BIG_ENDIAN 1 +# else +# define TIMESTAMP_REP_LITTLE_ENDIAN 1 +# endif +# elif HAVE_INT64_TYPES && SIZEOF_LONG == 8 +# define TIMESTAMP_REP_FLAT64 1 +# elif HAVE_INT64_TYPES && CLICK_BYTE_ORDER == CLICK_LITTLE_ENDIAN +# define TIMESTAMP_REP_LITTLE_ENDIAN 1 +# else +# define TIMESTAMP_REP_BIG_ENDIAN 1 +# endif +#endif + + +// Timestamp can use microsecond or nanosecond precision. Nanosecond +// precision is used if TIMESTAMP_NANOSEC == 1. In the Linux kernel, we +// choose what Linux uses for sk_buff::tstamp. Elsewhere, we default to +// microsecond precision (XXX); "./configure --enable-nanotimestamp" selects +// nanosecond precision. + +#ifndef TIMESTAMP_NANOSEC +# if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) +# define TIMESTAMP_NANOSEC 1 +# endif +# endif +#endif + + +// Define TIMESTAMP_MATH_FLAT64 if despite a seconds-and-subseconds +// representation, 64-bit arithmetic should be used for timestamp addition, +// subtraction, and comparisons. This can be faster than operating on two +// separate 32-bit integers. + +#if HAVE_INT64_TYPES && !TIMESTAMP_REP_FLAT64 +# if (TIMESTAMP_REP_BIG_ENDIAN && CLICK_BYTE_ORDER == CLICK_BIG_ENDIAN) \ + || (TIMESTAMP_REP_LITTLE_ENDIAN && CLICK_BYTE_ORDER == CLICK_LITTLE_ENDIAN) +# define TIMESTAMP_MATH_FLAT64 1 +# endif +#endif + + +// If a Timestamp's internal representation is identical to struct timespec +// or struct timeval, define TIMESTAMP_PUNS_TIMESPEC or TIMESTAMP_PUNS_TIMEVAL. + +#if TIMESTAMP_REP_BIG_ENDIAN +# if !TIMESTAMP_NANOSEC && SIZEOF_STRUCT_TIMEVAL == 8 +# define TIMESTAMP_PUNS_TIMEVAL 1 +# elif TIMESTAMP_NANOSEC && HAVE_STRUCT_TIMESPEC && SIZEOF_STRUCT_TIMESPEC == 8 +# define TIMESTAMP_PUNS_TIMESPEC 1 +# endif +#endif + + +// Timestamp::value_type is the type of arguments to, for example, +// Timestamp::make_msec(), and should be as large as possible. This is +// int64_t at userlevel. In the linuxmodule driver, int64_t can only be used +// if the relevant Linux provides 64-bit divide, which is do_div. +// TIMESTAMP_VALUE_INT64 is defined to 1 if Timestamp::value_type is int64_t. + +#if !defined(TIMESTAMP_VALUE_INT64) && HAVE_INT64_TYPES +# if CLICK_LINUXMODULE && defined(do_div) +# define TIMESTAMP_VALUE_INT64 1 +# elif !CLICK_LINUXMODULE && !CLICK_BSDMODULE +# define TIMESTAMP_VALUE_INT64 1 +# endif +#endif + + +// PRITIMESTAMP is a printf format string for Timestamps. The corresponding +// printf argument list is Timestamp::sec() and Timestamp::subsec(), in that +// order. + +#if TIMESTAMP_NANOSEC +# define PRITIMESTAMP "%d.%09d" +#else +# define PRITIMESTAMP "%d.%06d" +#endif + + +// TIMESTAMP_WARPABLE is defined if this Timestamp implementation supports +// timewarping. + +#if !CLICK_LINUXMODULE && !CLICK_BSDMODULE && !CLICK_NS +# define TIMESTAMP_WARPABLE 1 +#endif + + +class Timestamp { public: + + /** @brief Type represents a number of seconds. */ + typedef int32_t seconds_type; + /** @brief Return type for msecval(), usecval(), and nsecval(). */ +#if TIMESTAMP_VALUE_INT64 + typedef int64_t value_type; +#else + typedef int32_t value_type; +#endif + + enum { + max_seconds = (seconds_type) 2147483647U, + /**< Maximum number of seconds representable in a + Timestamp. */ + min_seconds = (seconds_type) -2147483648U + /**< Minimum number of seconds representable in a + Timestamp. */ + }; + + enum { + nsec_per_sec = 1000000000, + nsec_per_msec = 1000000, + nsec_per_usec = 1000, + usec_per_sec = 1000000, + usec_per_msec = 1000, + msec_per_sec = 1000, +#if TIMESTAMP_NANOSEC + subsec_per_sec = nsec_per_sec, + /**< Number of subseconds in a second. Can be + 1000000 or 1000000000, depending on how + Click is compiled. */ +#else + subsec_per_sec = usec_per_sec, +#endif + subsec_per_msec = subsec_per_sec / msec_per_sec, + subsec_per_usec = subsec_per_sec / usec_per_sec +#if CLICK_NS + , schedule_granularity = usec_per_sec +#endif + }; + + enum { + NSUBSEC = subsec_per_sec + }; + + typedef uninitialized_type uninitialized_t; + + union rep_t; + + + /** @brief Construct a zero-valued Timestamp. */ + inline Timestamp() { + assign(0, 0); + } + + /** @brief Construct a Timestamp of @a sec seconds plus @a subsec + * subseconds. + * @param sec number of seconds + * @param subsec number of subseconds (defaults to 0) + * + * The @a subsec parameter must be between 0 and subsec_per_sec - 1, and + * the @a sec parameter must be between @link Timestamp::min_seconds + * min_seconds @endlink and @link Timestamp::max_seconds max_seconds + * @endlink. Errors are not necessarily checked. */ + explicit inline Timestamp(long sec, uint32_t subsec = 0) { + assign(sec, subsec); + } + /** @overload */ + explicit inline Timestamp(int sec, uint32_t subsec = 0) { + assign(sec, subsec); + } + /** @overload */ + explicit inline Timestamp(unsigned long sec, uint32_t subsec = 0) { + assign(sec, subsec); + } + /** @overload */ + explicit inline Timestamp(unsigned sec, uint32_t subsec = 0) { + assign(sec, subsec); + } +#if HAVE_FLOAT_TYPES + explicit inline Timestamp(double); +#endif + + inline Timestamp(const struct timeval &tv); +#if HAVE_STRUCT_TIMESPEC + inline Timestamp(const struct timespec &ts); +#endif + + /** @brief Construct a Timestamp from its internal representation. */ + inline Timestamp(const rep_t &rep) + : _t(rep) { + } + + /** @brief Construct an uninitialized timestamp. */ + inline Timestamp(const uninitialized_t &unused) { + (void) unused; + } + + typedef seconds_type (Timestamp::*unspecified_bool_type)() const; + inline operator unspecified_bool_type() const; + + /** @brief Test if this Timestamp is negative (< Timestamp(0, 0)). */ + inline bool is_negative() const { +#if TIMESTAMP_REP_FLAT64 || TIMESTAMP_MATH_FLAT64 + return _t.x < 0; +#else + return sec() < 0; +#endif + } + + inline seconds_type sec() const; + inline uint32_t subsec() const; + inline uint32_t msec() const; + inline uint32_t usec() const; + inline uint32_t nsec() const; + + inline void set_sec(seconds_type sec); + inline void set_subsec(uint32_t subsec); + + inline seconds_type msec1() const CLICK_DEPRECATED; + inline seconds_type usec1() const CLICK_DEPRECATED; + inline seconds_type nsec1() const CLICK_DEPRECATED; + +#if TIMESTAMP_PUNS_TIMEVAL + inline const struct timeval &timeval() const; + inline const struct timeval &timeval_ceil() const; +#else + inline struct timeval timeval() const; + inline struct timeval timeval_ceil() const; +#endif +#if HAVE_STRUCT_TIMESPEC +# if TIMESTAMP_PUNS_TIMESPEC + inline const struct timespec ×pec() const; +# else + inline struct timespec timespec() const; +# endif +#endif + +#if HAVE_FLOAT_TYPES + inline double doubleval() const; +#endif + /** @brief Return this timestamp's interval length in milliseconds. */ + inline value_type msecval() const { +#if TIMESTAMP_REP_FLAT64 + return value_div(_t.x, subsec_per_sec / msec_per_sec); +#else + return (value_type) _t.sec * msec_per_sec + subsec_to_msec(_t.subsec); +#endif + } + /** @brief Return this timestamp's interval length in microseconds. */ + inline value_type usecval() const { +#if TIMESTAMP_REP_FLAT64 + return value_div(_t.x, subsec_per_sec / usec_per_sec); +#else + return (value_type) _t.sec * usec_per_sec + subsec_to_usec(_t.subsec); +#endif + } + /** @brief Return this timestamp's interval length in nanoseconds. */ + inline value_type nsecval() const { +#if TIMESTAMP_REP_FLAT64 + return _t.x * (nsec_per_sec / subsec_per_sec); +#else + return (value_type) _t.sec * nsec_per_sec + subsec_to_nsec(_t.subsec); +#endif + } + + /** @brief Return the next millisecond-valued timestamp no smaller than *this. */ + inline Timestamp msec_ceil() const { + uint32_t x = subsec() % subsec_per_msec; + return (x ? *this + Timestamp(0, subsec_per_msec - x) : *this); + } + /** @brief Return the next microsecond-valued timestamp no smaller than *this. */ + inline Timestamp usec_ceil() const { +#if TIMESTAMP_NANOSEC + uint32_t x = subsec() % subsec_per_usec; + return (x ? *this + Timestamp(0, subsec_per_usec - x) : *this); +#else + return *this; +#endif + } + /** @brief Return the next nanosecond-valued timestamp no smaller than *this. */ + inline Timestamp nsec_ceil() const { + return *this; + } + +#if !CLICK_TOOL + /** @brief Return a timestamp representing an interval of @a jiffies. */ + static inline Timestamp make_jiffies(click_jiffies_t jiffies); + /** @overload */ + static inline Timestamp make_jiffies(click_jiffies_difference_t jiffies); + /** @brief Return the number of jiffies represented by this timestamp. */ + inline click_jiffies_t jiffies() const; +#endif + + /** @brief Return a timestamp representing @a sec seconds. */ + static inline Timestamp make_sec(seconds_type sec) { + return Timestamp(sec, 0); + } + /** @brief Return a timestamp representing @a sec seconds plus @a msec + * milliseconds. + * @pre 0 <= @a msec < 1000 */ + static inline Timestamp make_msec(seconds_type sec, uint32_t msec) { + return Timestamp(sec, msec_to_subsec(msec)); + } + /** @brief Return a timestamp representing @a msec milliseconds. */ + static inline Timestamp make_msec(value_type msec) { + Timestamp t = Timestamp::uninitialized_t(); +#if TIMESTAMP_REP_FLAT64 + t._t.x = msec * (subsec_per_sec / msec_per_sec); +#else + value_div_mod(t._t.sec, t._t.subsec, msec, msec_per_sec); + t._t.subsec *= subsec_per_sec / msec_per_sec; +#endif + return t; + } + /** @brief Return a timestamp representing @a sec seconds plus @a usec + * microseconds. + * @pre 0 <= @a usec < 1000000 */ + static inline Timestamp make_usec(seconds_type sec, uint32_t usec) { + return Timestamp(sec, usec_to_subsec(usec)); + } + /** @brief Return a timestamp representing @a usec microseconds. */ + static inline Timestamp make_usec(value_type usec) { + Timestamp t = Timestamp::uninitialized_t(); +#if TIMESTAMP_REP_FLAT64 + t._t.x = usec * (subsec_per_sec / usec_per_sec); +#else + value_div_mod(t._t.sec, t._t.subsec, usec, usec_per_sec); + t._t.subsec *= subsec_per_sec / usec_per_sec; +#endif + return t; + } + /** @brief Return a timestamp representing @a sec seconds plus @a nsec + * nanoseconds. + * @pre 0 <= @a nsec < 1000000000 */ + static inline Timestamp make_nsec(seconds_type sec, uint32_t nsec) { + return Timestamp(sec, nsec_to_subsec(nsec)); + } + /** @brief Return a timestamp representing @a nsec nanoseconds. */ + static inline Timestamp make_nsec(value_type nsec) { + Timestamp t = Timestamp::uninitialized_t(); +#if TIMESTAMP_REP_FLAT64 + t._t.x = value_div(nsec, nsec_per_sec / subsec_per_sec); +#else + value_div_mod(t._t.sec, t._t.subsec, nsec, nsec_per_sec); + t._t.subsec /= nsec_per_sec / subsec_per_sec; +#endif + return t; + } + + + /** @brief Return the smallest nonzero timestamp, Timestamp(0, 1). */ + static inline Timestamp epsilon() { + return Timestamp(0, 1); + } + + /** @brief Clear this timestamp. */ + inline void clear() { + assign(0, 0); + } + + + /** Set this timestamp to a seconds-and-subseconds value. + * + * @sa Timestamp(int, int) */ + inline void assign(seconds_type sec, uint32_t subsec = 0) { +#if TIMESTAMP_REP_FLAT64 + _t.x = (int64_t) sec * subsec_per_sec + subsec; +#else + _t.sec = sec; + _t.subsec = subsec; +#endif + } + /** Assign this timestamp to a seconds-and-microseconds value. */ + inline void assign_usec(seconds_type sec, uint32_t usec) { + assign(sec, usec_to_subsec(usec)); + } + /** Assign this timestamp to a seconds-and-nanoseconds value. */ + inline void assign_nsec(seconds_type sec, uint32_t nsec) { + assign(sec, nsec_to_subsec(nsec)); + } + + /** @cond never */ + /** Assign this timestamp to a seconds-and-subseconds value. + * @deprecated Use assign() instead. */ + inline void set(seconds_type sec, uint32_t subsec = 0) CLICK_DEPRECATED; + /** Assign this timestamp to a seconds-and-microseconds value. + * @deprecated Use assign_usec() instead. */ + inline void set_usec(seconds_type sec, uint32_t usec) CLICK_DEPRECATED; + /** Assign this timestamp to a seconds-and-nanoseconds value. + * @deprecated Use assign_nsec() instead. */ + inline void set_nsec(seconds_type sec, uint32_t nsec) CLICK_DEPRECATED; + /** @brief Deprecated synonym for assign_now(). + * @deprecated Use Timestamp::assign_now() instead. */ + inline void set_now() CLICK_DEPRECATED; + /** @endcond never */ +#if !CLICK_LINUXMODULE && !CLICK_BSDMODULE && !CLICK_MINIOS + int set_timeval_ioctl(int fd, int ioctl_selector); +#endif + + + /** @brief Return the current system time. + * + * System time is measured in seconds since January 1, 1970 GMT. + * Produces the most precise timestamp available. + * + * @note System time can jump forwards or backwards as a result of user + * actions. For a clock that never moves backwards, see now_steady(). + * @sa recent(), assign_now(), now_steady() */ + static inline Timestamp now(); + + /** @brief Set this timestamp to the current system time. + * + * Like "*this = Timestamp::now()". + * @sa now(), assign_recent() */ + inline void assign_now(); + + /** @brief Return a recent system time. + * + * The Timestamp::now() function calculates the current system time, which + * is relatively expensive. Timestamp::recent() can be faster, but is + * less precise: it returns a cached copy of a recent system time. + * @sa now(), assign_recent() */ + static inline Timestamp recent(); + + /** @brief Set this timestamp to a recent system time. + * + * Like "*this = Timestamp::recent()". + * @sa recent(), assign_now() */ + inline void assign_recent(); + + + /** @brief Return the current steady-clock time. + * + * The steady clock, often called a monotonic clock, is a system clock + * that never moves backwards. Steady-clock time is measured in seconds + * since an undefined start point (often related to the most recent boot). + * Produces the most precise timestamp available. + * + * @note Steady-clock times and system times are incomparable, since they + * have different start points. + * + * @sa recent_steady(), assign_now_steady() */ + static inline Timestamp now_steady(); + + /** @brief Set this timestamp to the current steady-clock time. + * + * Like "*this = Timestamp::now_steady()". + * @sa now_steady() */ + inline void assign_now_steady(); + + /** @brief Return a recent steady-clock time. + * + * The Timestamp::now_steady() function calculates the current + * steady-clock time, which is relatively expensive. + * Timestamp::recent_steady() can be faster, but is less precise: it + * returns a cached copy of a recent steady-clock time. + * @sa now_steady(), assign_recent_steady() */ + static inline Timestamp recent_steady(); + + /** @brief Set this timestamp to a recent steady-clock time. + * + * Like "*this = Timestamp::recent_steady()". + * @sa recent_steady(), assign_now_steady() */ + inline void assign_recent_steady(); + + + /** @brief Unparse this timestamp into a String. + * + * Returns a string formatted like "10.000000", with at least six + * subsecond digits. (Nanosecond-precision timestamps where the number of + * nanoseconds is not evenly divisible by 1000 are given nine subsecond + * digits.) */ + String unparse() const; + + /** @brief Unparse this timestamp into a String as an interval. + * + * Returns a string formatted like "1us" or "1.000002s". */ + String unparse_interval() const; + + + /** @brief Convert milliseconds to subseconds. + * + * Subseconds are either microseconds or nanoseconds, depending on + * configuration options and driver choice. + * @sa usec_to_subsec(), nsec_to_subsec(), subsec_to_msec(), + * subsec_to_usec(), subsec_to_nsec() */ + inline static uint32_t msec_to_subsec(uint32_t msec) { + return msec * (subsec_per_sec / msec_per_sec); + } + /** @brief Convert microseconds to subseconds. */ + inline static uint32_t usec_to_subsec(uint32_t usec) { + return usec * (subsec_per_sec / usec_per_sec); + } + /** @brief Convert nanoseconds to subseconds. */ + inline static uint32_t nsec_to_subsec(uint32_t nsec) { + return nsec / (nsec_per_sec / subsec_per_sec); + } + /** @brief Convert subseconds to milliseconds. */ + inline static uint32_t subsec_to_msec(uint32_t subsec) { + return subsec / (subsec_per_sec / msec_per_sec); + } + /** @brief Convert subseconds to microseconds. */ + inline static uint32_t subsec_to_usec(uint32_t subsec) { + return subsec / (subsec_per_sec / usec_per_sec); + } + /** @brief Convert subseconds to nanoseconds. */ + inline static uint32_t subsec_to_nsec(uint32_t subsec) { + return subsec * (nsec_per_sec / subsec_per_sec); + } + + + /** @brief Type of a Timestamp representation. + * + * This type is rarely useful for Timestamp users; we export it to avoid + * strict-aliasing warnings in unions. */ + union rep_t { +#if TIMESTAMP_REP_FLAT64 || TIMESTAMP_MATH_FLAT64 + int64_t x; +#endif +#if TIMESTAMP_REP_BIG_ENDIAN + struct { + int32_t sec; + int32_t subsec; + }; +#elif TIMESTAMP_REP_LITTLE_ENDIAN + struct { + int32_t subsec; + int32_t sec; + }; +#endif +#if CLICK_LINUXMODULE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + ktime_t ktime; +# elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) + skb_timeval skbtime; +# endif +#endif +#if TIMESTAMP_PUNS_TIMEVAL + struct timeval tv; +#elif TIMESTAMP_PUNS_TIMESPEC + struct timespec tspec; +#endif + }; + +#if TIMESTAMP_WARPABLE + /** @name Timewarping */ + //@{ + enum warp_class_type { + warp_none = 0, ///< Run in real time (the default). + warp_linear = 1, ///< Run in speeded-up or slowed-down real time. + warp_nowait = 2, ///< Run in speeded-up or slowed-down real time, + // but don't wait for timers. + warp_simulation = 3 ///< Run in simulation time. + }; + + + /** @brief Return the active timewarp class. */ + static inline int warp_class(); + + /** @brief Return the timewarp speed. + * + * Timewarp speed measures how much faster Timestamp::now() appears to + * move compared with wall-clock time. Only meaningful if warp_class() is + * #warp_linear or #warp_nowait. */ + static inline double warp_speed(); + + + /** @brief Set the timewarp class to @a w. + * @param w warp class + * @param s speed (\> 0, meaningful when @a w == #warp_linear) + * + * The timewarp classes are as follows: + * + *
+ *
#warp_none
+ *
Click time corresponds to real time. This is the default.
+ * + *
#warp_linear
+ *
Click time is a speeded-up or slowed-down version of real time. + * The speedup factor is @a s. If @a s \> 1, then time as measured by + * Timestamp::now() will appear to move a factor of @a s faster than real + * time: for instance, a Timer set using Timer::schedule_after_s(2) from + * now will fire after just 1 second of wall-clock time.
+ * + *
#warp_nowait
+ *
Like #warp_linear, but the Click driver never waits for a timer to + * expire. Instead, time appears to "jump" ahead to the next expiration + * time.
+ * + *
#warp_simulation
+ *
Click time is completely divorced from real time. Every call to + * Timestamp::now() appears to increase the current time by + * Timestamp::epsilon() and the Click driver never waits for a timer to + * expire. This mode effectively turns Click into an event-driven + * simulator.
+ *
+ */ + static void warp_set_class(warp_class_type w, double s = 1.0); + + /** @brief Reset current time. + * @a t_system new system time + * @a t_steady new steady-clock time + * + * Only usable when warp_class() is not #warp_none. */ + static void warp_set_now(const Timestamp &t_system, const Timestamp &t_steady); + + + /** @brief Return the wall-clock time corresponding to a delay. */ + inline Timestamp warp_real_delay() const; + + /** @brief Return true iff time skips ahead around timer expirations. */ + static inline bool warp_jumping(); + + /** @brief Move Click time past a timer expiration. + * + * Does nothing if warp_jumping() is false or @a expiry is in the past. */ + static void warp_jump_steady(const Timestamp &expiry); + + + /** @brief Return the warp-free current system time. + * + * Like now(), but the time returned is unaffected by timewarping. + * @sa now(), assign_now_unwarped() */ + static inline Timestamp now_unwarped(); + + /** @brief Set this timestamp to the warp-free current system time. + * + * Like assign_now(), but the time assigned is unaffected by timewarping. + * @sa assign_now(), now_unwarped() */ + inline void assign_now_unwarped(); + + /** @brief Return the warp-free current steady-clock time. + * + * Like now_steady(), but the time returned is unaffected by timewarping. + * @sa now_steady(), assign_now_steady_unwarped() */ + static inline Timestamp now_steady_unwarped(); + + /** @brief Set this timestamp to the warp-free current steady-clock time. + * + * Like assign_now_steady(), but the time assigned is unaffected by + * timewarping. + * @sa assign_now_steady(), now_steady_unwarped() */ + inline void assign_now_steady_unwarped(); + //@} +#endif + + private: + + rep_t _t; + + inline void add_fix() { +#if TIMESTAMP_REP_FLAT64 + /* no fix necessary */ +#elif TIMESTAMP_MATH_FLAT64 + if (_t.subsec >= subsec_per_sec) + _t.x += (uint32_t) -subsec_per_sec; +#else + if (_t.subsec >= subsec_per_sec) + _t.sec++, _t.subsec -= subsec_per_sec; +#endif + } + + inline void sub_fix() { +#if TIMESTAMP_REP_FLAT64 + /* no fix necessary */ +#elif TIMESTAMP_MATH_FLAT64 + if (_t.subsec < 0) + _t.subsec += subsec_per_sec; +#else + if (_t.subsec < 0) + _t.sec--, _t.subsec += subsec_per_sec; +#endif + } + + static inline value_type value_div(value_type a, uint32_t b) { + return int_divide(a, b); + } + + static inline void value_div_mod(int32_t &div, int32_t &rem, + value_type a, uint32_t b) { + value_type quot; + rem = int_remainder(a, b, quot); + div = quot; + } + + inline void assign_now(bool recent, bool steady, bool unwarped); + +#if TIMESTAMP_WARPABLE + static inline void warp_adjust(bool steady, const Timestamp &t_raw, const Timestamp &t_warped); + inline Timestamp warped(bool steady) const; + void warp(bool steady, bool from_now); +#endif + + friend inline bool operator==(const Timestamp &a, const Timestamp &b); + friend inline bool operator<(const Timestamp &a, const Timestamp &b); + friend inline Timestamp operator-(const Timestamp &b); + friend inline Timestamp &operator+=(Timestamp &a, const Timestamp &b); + friend inline Timestamp &operator-=(Timestamp &a, const Timestamp &b); + +}; + + +#if TIMESTAMP_WARPABLE +/** @cond never */ +class TimestampWarp { + static Timestamp::warp_class_type kind; + static double speed; + static Timestamp flat_offset[2]; + static double offset[2]; + friend class Timestamp; +}; +/** @endcond never */ + +inline int Timestamp::warp_class() { + return TimestampWarp::kind; +} + +inline double Timestamp::warp_speed() { + return TimestampWarp::speed; +} + +inline bool Timestamp::warp_jumping() { + return TimestampWarp::kind >= warp_nowait; +} + +inline Timestamp Timestamp::warped(bool steady) const { + Timestamp t = *this; + if (TimestampWarp::kind) + t.warp(steady, false); + return t; +} +#endif + + +/** @brief Create a Timestamp measuring @a tv. + @param tv timeval structure */ +inline +Timestamp::Timestamp(const struct timeval& tv) +{ + assign(tv.tv_sec, usec_to_subsec(tv.tv_usec)); +} + +#if HAVE_STRUCT_TIMESPEC +/** @brief Create a Timestamp measuring @a ts. + @param ts timespec structure */ +inline +Timestamp::Timestamp(const struct timespec& ts) +{ + assign(ts.tv_sec, nsec_to_subsec(ts.tv_nsec)); +} +#endif + +/** @brief Return true iff this timestamp is not zero-valued. */ +inline +Timestamp::operator unspecified_bool_type() const +{ +#if TIMESTAMP_REP_FLAT64 || TIMESTAMP_MATH_FLAT64 + return _t.x ? &Timestamp::sec : 0; +#else + return _t.sec || _t.subsec ? &Timestamp::sec : 0; +#endif +} + +inline void +Timestamp::assign_now(bool recent, bool steady, bool unwarped) +{ + (void) recent, (void) steady, (void) unwarped; + +#if TIMESTAMP_PUNS_TIMESPEC +# define TIMESTAMP_DECLARE_TSP struct timespec &tsp = _t.tspec +# define TIMESTAMP_RESOLVE_TSP /* nothing */ +#else +# define TIMESTAMP_DECLARE_TSP struct timespec ts, &tsp = ts +# define TIMESTAMP_RESOLVE_TSP assign(tsp.tv_sec, nsec_to_subsec(tsp.tv_nsec)) +#endif +#if TIMESTAMP_PUNS_TIMEVAL +# define TIMESTAMP_DECLARE_TVP struct timeval &tvp = _t.tv +# define TIMESTAMP_RESOLVE_TVP /* nothing */ +#else +# define TIMESTAMP_DECLARE_TVP struct timeval tv, &tvp = tv +# define TIMESTAMP_RESOLVE_TVP assign(tvp.tv_sec, usec_to_subsec(tvp.tv_usec)) +#endif + +#if CLICK_LINUXMODULE +# if !TIMESTAMP_NANOSEC + if (!recent && !steady) { + TIMESTAMP_DECLARE_TVP; + do_gettimeofday(&tvp); + TIMESTAMP_RESOLVE_TVP; + return; + } +# endif + TIMESTAMP_DECLARE_TSP; + if (recent && steady) { +# if HAVE_LINUX_GET_MONOTONIC_COARSE + tsp = get_monotonic_coarse(); +# elif HAVE_LINUX_GETBOOTTIME && HAVE_LINUX_KTIME_MONO_TO_ANY + // XXX Is this even worth it????? Would it be faster to just get the + // current time? + tsp = current_kernel_time(); + struct timespec delta = + ktime_to_timespec(ktime_mono_to_any(ktime_set(0, 0), TK_OFFS_REAL)); + set_normalized_timespec(&tsp, tsp.tv_sec - delta.tv_sec, + tsp.tv_nsec - delta.tv_nsec); +# elif HAVE_LINUX_GETBOOTTIME + tsp = current_kernel_time(); + struct timespec delta; + getboottime(&delta); + monotonic_to_bootbased(&delta); + set_normalized_timespec(&tsp, tsp.tv_sec - delta.tv_sec, + tsp.tv_nsec - delta.tv_nsec); +# else + // older kernels don't export enough information to produce a recent + // steady timestamp; produce a current steady timestamp + ktime_get_ts(&tsp); +# endif + } else if (recent) + tsp = current_kernel_time(); + else if (steady) + ktime_get_ts(&tsp); + else + getnstimeofday(&tsp); + TIMESTAMP_RESOLVE_TSP; + +#elif TIMESTAMP_NANOSEC && CLICK_BSDMODULE + TIMESTAMP_DECLARE_TSP; + if (recent && steady) + getnanouptime(&tsp); + else if (recent) + getnanotime(&tsp); + else if (steady) + nanouptime(&tsp); + else + nanotime(&tsp); + TIMESTAMP_RESOLVE_TSP; + +#elif CLICK_BSDMODULE + TIMESTAMP_DECLARE_TVP; + if (recent && steady) + getmicrouptime(&tvp); + else if (recent) + getmicrotime(&tvp); + else if (steady) + microuptime(&tvp); + else + microtime(&tvp); + TIMESTAMP_RESOLVE_TVP; + +#elif CLICK_MINIOS + TIMESTAMP_DECLARE_TVP; + gettimeofday(&tvp, (struct timezone *) 0); + TIMESTAMP_RESOLVE_TVP; + +#elif CLICK_NS + if (schedule_granularity == usec_per_sec) { + TIMESTAMP_DECLARE_TVP; + simclick_gettimeofday(&tvp); + TIMESTAMP_RESOLVE_TVP; + } else { + assert(0 && "nanosecond precision not available yet"); + } + +#elif HAVE_USE_CLOCK_GETTIME + TIMESTAMP_DECLARE_TSP; + if (steady) + clock_gettime(CLOCK_MONOTONIC, &tsp); + else + clock_gettime(CLOCK_REALTIME, &tsp); + TIMESTAMP_RESOLVE_TSP; + +#else + TIMESTAMP_DECLARE_TVP; + gettimeofday(&tvp, (struct timezone *) 0); + TIMESTAMP_RESOLVE_TVP; +#endif + +#undef TIMESTAMP_DECLARE_TSP +#undef TIMESTAMP_RESOLVE_TSP +#undef TIMESTAMP_DECLARE_TVP +#undef TIMESTAMP_RESOLVE_TVP + +#if TIMESTAMP_WARPABLE + // timewarping + if (!unwarped && TimestampWarp::kind) + warp(steady, true); +#endif +} + +inline void +Timestamp::assign_now() +{ + assign_now(false, false, false); +} + +inline Timestamp +Timestamp::now() +{ + Timestamp t = Timestamp::uninitialized_t(); + t.assign_now(); + return t; +} + +inline void +Timestamp::assign_recent() +{ + assign_now(true, false, false); +} + +inline Timestamp +Timestamp::recent() +{ + Timestamp t = Timestamp::uninitialized_t(); + t.assign_recent(); + return t; +} + +inline void +Timestamp::assign_now_steady() +{ + assign_now(false, true, false); +} + +inline Timestamp +Timestamp::now_steady() +{ + Timestamp t = Timestamp::uninitialized_t(); + t.assign_now_steady(); + return t; +} + +inline void +Timestamp::assign_recent_steady() +{ + assign_now(true, true, false); +} + +inline Timestamp +Timestamp::recent_steady() +{ + Timestamp t = Timestamp::uninitialized_t(); + t.assign_recent_steady(); + return t; +} + +#if TIMESTAMP_WARPABLE +inline void +Timestamp::assign_now_unwarped() +{ + assign_now(false, false, true); +} + +inline Timestamp +Timestamp::now_unwarped() +{ + Timestamp t = Timestamp::uninitialized_t(); + t.assign_now_unwarped(); + return t; +} + +inline void +Timestamp::assign_now_steady_unwarped() +{ + assign_now(false, true, true); +} + +inline Timestamp +Timestamp::now_steady_unwarped() +{ + Timestamp t = Timestamp::uninitialized_t(); + t.assign_now_steady_unwarped(); + return t; +} +#endif + +/** @brief Set this timestamp's seconds component. + + The subseconds component is left unchanged. */ +inline void +Timestamp::set_sec(seconds_type sec) +{ +#if TIMESTAMP_REP_FLAT64 + uint32_t ss = subsec(); + _t.x = (int64_t) sec * subsec_per_sec + ss; +#else + _t.sec = sec; +#endif +} + +/** @brief Set this timestamp's subseconds component. + @param subsec number of subseconds + + The seconds component is left unchanged. */ +inline void +Timestamp::set_subsec(uint32_t subsec) +{ +#if TIMESTAMP_REP_FLAT64 + seconds_type s = sec(); + _t.x = (int64_t) s * subsec_per_sec + subsec; +#else + _t.subsec = subsec; +#endif +} + +/** @brief Return this timestamp's seconds component. */ +inline Timestamp::seconds_type +Timestamp::sec() const +{ +#if TIMESTAMP_REP_FLAT64 + if (unlikely(_t.x < 0)) + return -value_div(-(_t.x + 1), subsec_per_sec) - 1; + else + return value_div(_t.x, subsec_per_sec); +#else + return _t.sec; +#endif +} + +/** @brief Return this timestamp's subseconds component. */ +inline uint32_t +Timestamp::subsec() const +{ +#if TIMESTAMP_REP_FLAT64 + return _t.x - (uint32_t) sec() * subsec_per_sec; +#else + return _t.subsec; +#endif +} + +/** @brief Return this timestamp's subseconds component, converted to + milliseconds. */ +inline uint32_t +Timestamp::msec() const +{ + return subsec_to_msec(subsec()); +} + +/** @brief Return this timestamp's subseconds component, converted to + microseconds. */ +inline uint32_t +Timestamp::usec() const +{ + return subsec_to_usec(subsec()); +} + +/** @brief Return this timestamp's subseconds component, converted to + nanoseconds. */ +inline uint32_t +Timestamp::nsec() const +{ + return subsec_to_nsec(subsec()); +} + +/** @brief Return this timestamp's interval length, converted to + milliseconds. + + Will overflow on intervals of more than 2147483.647 seconds. */ +inline Timestamp::seconds_type +Timestamp::msec1() const +{ +#if TIMESTAMP_REP_FLAT64 + return value_div(_t.x, subsec_per_sec / msec_per_sec); +#else + return _t.sec * msec_per_sec + subsec_to_msec(_t.subsec); +#endif +} + +/** @brief Return this timestamp's interval length, converted to + microseconds. + + Will overflow on intervals of more than 2147.483647 seconds. */ +inline Timestamp::seconds_type +Timestamp::usec1() const +{ +#if TIMESTAMP_REP_FLAT64 + return value_div(_t.x, subsec_per_sec / usec_per_sec); +#else + return _t.sec * usec_per_sec + subsec_to_usec(_t.subsec); +#endif +} + +/** @brief Return this timestamp's interval length, converted to + nanoseconds. + + Will overflow on intervals of more than 2.147483647 seconds. */ +inline Timestamp::seconds_type +Timestamp::nsec1() const +{ +#if TIMESTAMP_REP_FLAT64 + return _t.x * (nsec_per_sec / subsec_per_sec); +#else + return _t.sec * nsec_per_sec + subsec_to_nsec(_t.subsec); +#endif +} + +#if !CLICK_TOOL +inline click_jiffies_t +Timestamp::jiffies() const +{ +# if TIMESTAMP_REP_FLAT64 + // This is not very precise when CLICK_HZ doesn't divide NSUBSEC evenly. + return value_div(_t.x, subsec_per_sec / CLICK_HZ); +# else + click_jiffies_t j = ((click_jiffies_t) sec()) * CLICK_HZ; +# if CLICK_HZ == 100 || CLICK_HZ == 1000 || CLICK_HZ == 10000 || CLICK_HZ == 100000 || CLICK_HZ == 1000000 + return j + ((click_jiffies_t) subsec()) / (subsec_per_sec / CLICK_HZ); +# else + // This is not very precise when CLICK_HZ doesn't divide NSUBSEC evenly. + return j + ((click_jiffies_t) subsec()) / (subsec_per_sec / CLICK_HZ); +# endif +# endif +} + +inline Timestamp +Timestamp::make_jiffies(click_jiffies_t jiffies) +{ + // Not very precise when CLICK_HZ doesn't evenly divide subsec_per_sec. + Timestamp t = Timestamp::uninitialized_t(); +# if TIMESTAMP_REP_FLAT64 + t._t.x = (int64_t) jiffies * (subsec_per_sec / CLICK_HZ); +# else + t._t.sec = jiffies / CLICK_HZ; + t._t.subsec = (jiffies - t._t.sec * CLICK_HZ) * (subsec_per_sec / CLICK_HZ); +# endif + return t; +} + +inline Timestamp +Timestamp::make_jiffies(click_jiffies_difference_t jiffies) +{ + // Not very precise when CLICK_HZ doesn't evenly divide subsec_per_sec. + Timestamp t = Timestamp::uninitialized_t(); +# if TIMESTAMP_REP_FLAT64 + t._t.x = (int64_t) jiffies * (subsec_per_sec / CLICK_HZ); +# else + if (jiffies < 0) + t._t.sec = -(-(jiffies + 1) / CLICK_HZ) - 1; + else + t._t.sec = jiffies / CLICK_HZ; + t._t.subsec = (jiffies - t._t.sec * CLICK_HZ) * (subsec_per_sec / CLICK_HZ); +# endif + return t; +} +#endif + +/** @cond never */ +inline void Timestamp::set_now() { + assign_now(false, false, false); +} + +inline void Timestamp::set(seconds_type sec, uint32_t subsec) { + assign(sec, subsec); +} + +inline void Timestamp::set_usec(seconds_type sec, uint32_t usec) { + assign_usec(sec, usec); +} + +inline void Timestamp::set_nsec(seconds_type sec, uint32_t nsec) { + assign_nsec(sec, nsec); +} +/** @endcond never */ + +/** @relates Timestamp + @brief Compare two timestamps for equality. + + Returns true iff the two operands have the same seconds and subseconds + components. */ +inline bool +operator==(const Timestamp &a, const Timestamp &b) +{ +#if TIMESTAMP_REP_FLAT64 || TIMESTAMP_MATH_FLAT64 + return a._t.x == b._t.x; +#else + return a.sec() == b.sec() && a.subsec() == b.subsec(); +#endif +} + +/** @relates Timestamp + @brief Compare two timestamps for inequality. + + Returns true iff !(@a a == @a b). */ +inline bool +operator!=(const Timestamp &a, const Timestamp &b) +{ + return !(a == b); +} + +/** @relates Timestamp + @brief Compare two timestamps. + + Returns true iff @a a represents a shorter interval than @a b, or + considered as absolute time, @a a happened before @a b. */ +inline bool +operator<(const Timestamp &a, const Timestamp &b) +{ +#if TIMESTAMP_REP_FLAT64 || TIMESTAMP_MATH_FLAT64 + return a._t.x < b._t.x; +#else + return a.sec() < b.sec() || (a.sec() == b.sec() && a.subsec() < b.subsec()); +#endif +} + +/** @overload */ +inline bool +operator<(const Timestamp &a, int b) +{ + return a < Timestamp(b); +} + +/** @relates Timestamp + @brief Compare two timestamps. + + Returns true iff @a a measures an interval no larger than @a b, or + considered as absolute time, @a a happened at or before @a b. */ +inline bool +operator<=(const Timestamp &a, const Timestamp &b) +{ + return !(b < a); +} + +/** @overload */ +inline bool +operator<=(const Timestamp &a, int b) +{ + return a <= Timestamp(b); +} + +/** @relates Timestamp + @brief Compare two timestamps. + + Returns true iff @a a measures an interval no shorter than @a b, or + considered as absolute time, @a a happened at or after @a b. */ +inline bool +operator>=(const Timestamp &a, const Timestamp &b) +{ + return !(a < b); +} + +/** @overload */ +inline bool +operator>=(const Timestamp &a, int b) +{ + return a >= Timestamp(b); +} + +/** @relates Timestamp + @brief Compare two timestamps. + + Returns true iff @a a measures a longer interval than @a b, or considered + as absolute time, @a a happened after @a b. */ +inline bool +operator>(const Timestamp &a, const Timestamp &b) +{ + return b < a; +} + +/** @overload */ +inline bool +operator>(const Timestamp &a, int b) +{ + return a > Timestamp(b); +} + +/** @brief Add @a b to @a a. + + Returns the result (the new value of @a a). */ +inline Timestamp & +operator+=(Timestamp &a, const Timestamp &b) +{ +#if TIMESTAMP_REP_FLAT64 || TIMESTAMP_MATH_FLAT64 + a._t.x += b._t.x; +#else + a._t.sec += b._t.sec; + a._t.subsec += b._t.subsec; +#endif + a.add_fix(); + return a; +} + +/** @brief Subtract @a b from @a a. + + Returns the result (the new value of @a a). */ +inline Timestamp & +operator-=(Timestamp &a, const Timestamp &b) +{ +#if TIMESTAMP_REP_FLAT64 || TIMESTAMP_MATH_FLAT64 + a._t.x -= b._t.x; +#else + a._t.sec -= b._t.sec; + a._t.subsec -= b._t.subsec; +#endif + a.sub_fix(); + return a; +} + +/** @brief Add the two operands and return the result. */ +inline Timestamp +operator+(Timestamp a, const Timestamp &b) +{ + a += b; + return a; +} + +/** @brief Subtract @a b from @a a and return the result. */ +inline Timestamp +operator-(Timestamp a, const Timestamp &b) +{ + a -= b; + return a; +} + +/** @brief Negate @a a and return the result. */ +inline Timestamp +operator-(const Timestamp &a) +{ +#if TIMESTAMP_REP_FLAT64 + Timestamp t = Timestamp::uninitialized_t(); + t._t.x = -a._t.x; + return t; +#else + if (a.subsec()) + return Timestamp(-(a.sec() + 1), Timestamp::subsec_per_sec - a.subsec()); + else + return Timestamp(-a.sec(), 0); +#endif +} + +#if HAVE_FLOAT_TYPES +/** @brief Return this timestamp's value, converted to a real number. */ +inline double +Timestamp::doubleval() const +{ +# if TIMESTAMP_REP_FLAT64 + return _t.x / (double) subsec_per_sec; +# else + return _t.sec + (_t.subsec / (double) subsec_per_sec); +# endif +} + +/** @brief Create a timestamp measuring @a d seconds. */ +inline +Timestamp::Timestamp(double d) +{ +# if TIMESTAMP_REP_FLAT64 + _t.x = (int64_t) floor(d * subsec_per_sec + 0.5); +# else + double dfloor = floor(d); + _t.sec = (seconds_type) dfloor; + _t.subsec = (uint32_t) ((d - dfloor) * subsec_per_sec + 0.5); + add_fix(); +# endif +} + +/** @brief Scale @a a by a factor of @a b and return the result. */ +inline Timestamp +operator*(const Timestamp &a, double b) +{ + return Timestamp(a.doubleval() * b); +} + +inline Timestamp +operator*(const Timestamp &a, int b) +{ + return Timestamp(a.doubleval() * b); +} + +inline Timestamp +operator*(const Timestamp &a, unsigned b) +{ + return Timestamp(a.doubleval() * b); +} + +inline Timestamp +operator*(double a, const Timestamp &b) +{ + return Timestamp(b.doubleval() * a); +} + +inline Timestamp +operator*(int a, const Timestamp &b) +{ + return Timestamp(b.doubleval() * a); +} + +inline Timestamp +operator*(unsigned a, const Timestamp &b) +{ + return Timestamp(b.doubleval() * a); +} + +/** @brief Scale @a a down by a factor of @a b and return the result. */ +inline Timestamp +operator/(const Timestamp &a, double b) +{ + return Timestamp(a.doubleval() / b); +} + +inline Timestamp +operator/(const Timestamp &a, int b) +{ + return Timestamp(a.doubleval() / b); +} + +inline Timestamp +operator/(const Timestamp &a, unsigned b) +{ + return Timestamp(a.doubleval() / b); +} + +/** @brief Divide @a a by @a b and return the result. */ +inline double +operator/(const Timestamp &a, const Timestamp &b) +{ + return a.doubleval() / b.doubleval(); +} +#endif /* HAVE_FLOAT_TYPES */ + +StringAccum& operator<<(StringAccum&, const Timestamp&); + +#if TIMESTAMP_WARPABLE +inline Timestamp +Timestamp::warp_real_delay() const +{ + if (likely(!TimestampWarp::kind) || TimestampWarp::speed == 1.0) + return *this; + else + return *this / TimestampWarp::speed; +} +#endif + +#if TIMESTAMP_PUNS_TIMEVAL +inline const struct timeval & +Timestamp::timeval() const +{ + return _t.tv; +} + +inline const struct timeval & +Timestamp::timeval_ceil() const +{ + return _t.tv; +} +#else +/** @brief Return a struct timeval that approximates this timestamp. + + If Timestamp and struct timeval have the same size and representation, + then this operation returns a "const struct timeval &" whose address is + the same as this Timestamp. If Timestamps have nanosecond precision, + the conversion rounds down, so Timestamp(t.timeval()) <= t. */ +inline struct timeval +Timestamp::timeval() const +{ + struct timeval tv; + tv.tv_sec = sec(); + tv.tv_usec = usec(); + return tv; +} + +/** @brief Return the minimum struct timeval >= this timestamp. + + If Timestamp and struct timeval have the same size and representation, + then this operation returns a "const struct timeval &" whose address is + the same as this Timestamp. */ +inline struct timeval +Timestamp::timeval_ceil() const +{ + return (*this + Timestamp(0, subsec_per_usec - 1)).timeval(); +} +#endif + +#if HAVE_STRUCT_TIMESPEC +# if TIMESTAMP_PUNS_TIMESPEC +inline const struct timespec & +Timestamp::timespec() const +{ + return _t.tspec; +} +# else +/** @brief Return a struct timespec with the same value as this timestamp. + + If Timestamp and struct timespec have the same size and representation, + then this operation returns a "const struct timespec &" whose address is + the same as this Timestamp. */ +inline struct timespec +Timestamp::timespec() const +{ + struct timespec ts; + ts.tv_sec = sec(); + ts.tv_nsec = nsec(); + return ts; +} +# endif +#endif + + +class ArgContext; +extern const ArgContext blank_args; +bool cp_time(const String &str, Timestamp *result, bool allow_negative); + +/** @class TimestampArg + @brief Parser class for timestamps. */ +class TimestampArg { public: + TimestampArg(bool is_signed = false) + : is_signed(is_signed) { + } + bool parse(const String &str, Timestamp &value, const ArgContext &args = blank_args) { + (void) args; + return cp_time(str, &value, is_signed); + } + bool is_signed; +}; + +template<> struct DefaultArg : public TimestampArg {}; +template<> struct has_trivial_copy : public true_type {}; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/tokenbucket.hh b/openflow/include/click/tokenbucket.hh new file mode 100644 index 0000000..4439c32 --- /dev/null +++ b/openflow/include/click/tokenbucket.hh @@ -0,0 +1,1021 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_TOKENBUCKET_HH +#define CLICK_TOKENBUCKET_HH +#include +#include +CLICK_DECLS + +/** @file + @brief Token bucket rate limiter templates. + + Related template classes that support token bucket rate limiters. + + The TokenRateX template class represents a token bucket rate: a refill + I in tokens per period, plus a I, the maximum number of + tokens allowed to accumulate. + + The TokenCounterX template class represents an active count of tokens. + Member functions are provided to update the count according to a particular + TokenRateX argument. The counter will fill up with tokens according to the + given rate, to a maximum of the capacity. + + A TokenRateX object's state depends only on the rate and capacity, and thus + may be shared by several distinct TokenCounterX objects. But for the common + case that a single counter is paired with a unique rate, the TokenBucketX + template class combines a TokenRateX and a TokenCounterX. + + The token bucket templates divide time into discrete units called I. + Token counters are refilled up to once per tick. A tick may be less than a + full period. For example, if periods and ticks are 1 second and 1 + millisecond, respectively, then a TokenCounterX with associated rate 1000 + tokens per second would be refilled at 1 token per millisecond. The + TokenRateX template parameter P defines the time tick unit and frequency. + The provided TokenBucketJiffyParameters class is designed to be used as + TokenRateX's parameter; it measures ticks in units of jiffies. + + @sa GapRate */ + +/** @class TokenRateX include/click/tokenbucket.hh + @brief Token bucket rate template. + + The TokenRateX class implements a token bucket rate. TokenBucketX is + initialized with a rate, in tokens per second, and a capacity in tokens. + Associated token buckets fill up with tokens at the given rate, to a maximum + of the capacity. + + Two special types of rate are supported. An unlimited TokenRateX + always refills associated counters to full capacity. Its capacity() equals + token_max. An idle TokenRateX never refills. + + Most users will be satisfied with the TokenRate type, which is equal to + TokenRateX >. + + @sa TokenCounterX, TokenBucketX */ + +template class TokenRateX; + +template +class TokenRateX : public P { public: + + /** @brief The template parameter type. */ + typedef P parameter_type; + + /** @brief Unsigned type of token counts. */ + typedef typename P::token_type token_type; + + /** @brief Type of time points. */ + typedef typename P::time_point_type time_point_type; + + /** @brief Unsigned type of tick counts (differences between time points). */ + typedef typename make_unsigned::type ticks_type; + + enum { + max_tokens = (token_type) -1 + }; + + /** @brief Construct an idle token rate. */ + TokenRateX() { + assign(); + } + + /** @brief Construct an idle or unlimited token rate. + * @param unlimited idle if false, unlimited if true */ + explicit TokenRateX(bool unlimited) { + assign(unlimited); + } + + /** @brief Construct a token rate representing @a rate. + * @param rate refill rate in tokens per period + * @param capacity maximum token accumulation + * + * The rate is idle if either @a rate or @a capacity is 0. + * + * @sa assign(@a rate, @a capacity) */ + TokenRateX(token_type rate, token_type capacity) { + assign(rate, capacity); + } + + /** @brief Set the token rate to idle or unlimited. + * @param unlimited idle if false, unlimited if true */ + inline void assign(bool unlimited = false); + + /** @brief Set the token rate and capacity. + * @param rate refill rate in tokens per period + * @param capacity maximum token accumulation + * + * Sets the token bucket's rate to @a rate and capacity to @a capacity. + * If either @a rate or @a capacity is 0, the rate becomes idle. */ + inline void assign(token_type rate, token_type capacity); + + /** @brief Return true iff the token rate is unlimited. */ + bool unlimited() const { + return _time_until_full == 0; + } + + /** @brief Return true iff the token rate is idle. */ + bool idle() const { + return _tokens_per_tick == 0; + } + + /** @brief Return the rate in tokens per period. + * + * Returns max_tokens for unlimited rates. Imprecise computer arithmetic + * may cause the result to differ from the configured rate. */ + token_type rate() const; + + /** @brief Return the capacity in tokens. + * + * Returns max_tokens for unlimited rates. Imprecise computer arithmetic + * may cause the result to differ from the configured capacity. */ + token_type capacity() const { + return max_tokens / _token_scale; + } + + /** @brief Return the number of tokens per tick. */ + token_type tokens_per_tick() const { + return _tokens_per_tick; + } + + /** @brief Return the ratio of fractional tokens to real tokens. */ + token_type token_scale() const { + return _token_scale; + } + + /** @brief Return the number of ticks required to refill a counter to + * capacity. + * + * Returns (ticks_type) -1 for idle rates. */ + ticks_type time_until_full() const { + return _time_until_full; + } + + /** @brief Return the current time point. + * + * Implemented as P::now(). */ + time_point_type now() const { + return P::now(); + } + + /** @brief Return the time point corresponding to the @a time parameter. + * + * May not be available for all U types. Implemented as P::time_point(@a + * time). */ + template + time_point_type time_point(U time) const { + return P::time_point(time); + } + + /** @brief Return @a b - @a a, assuming that @a b was measured after @a a. + * + * Some time measurements can, in rare cases, appear to jump backwards, + * as timestamps do when the user changes the current time. If this + * happens (@a b < @a a), time_monotonic_difference returns 0. + * Implemented as P::time_monotonic_difference(@a a, @a b). */ + ticks_type time_monotonic_difference(time_point_type a, time_point_type b) const { + return P::time_monotonic_difference(a, b); + } + + + /** @cond never */ + typedef time_point_type epoch_type CLICK_DEPRECATED; + inline token_type tokens_per_epoch() const CLICK_DEPRECATED; + inline ticks_type epochs_until_full() const CLICK_DEPRECATED; + /** @endcond never */ + + private: + + token_type _tokens_per_tick; // 0 iff idle() + token_type _token_scale; + ticks_type _time_until_full; // 0 iff unlimited() + +}; + +template +void TokenRateX

::assign(bool unlimited) +{ + _token_scale = 1; + if (unlimited) { + _tokens_per_tick = max_tokens; + _time_until_full = 0; + } else { + _tokens_per_tick = 0; + _time_until_full = (ticks_type) -1; + } +} + +template +void TokenRateX

::assign(token_type rate, token_type capacity) +{ + if (capacity == 0) { + rate = 0; + capacity = max_tokens; + } + + token_type frequency = P::frequency(); + if (rate != 0) { + // constrain capacity so _tokens_per_tick fits in 1 limb + unsigned min_capacity = (rate - 1) / frequency + 1; + if (capacity < min_capacity) + capacity = min_capacity; + } + _token_scale = max_tokens / capacity; + + // XXX on non-32 bit types + static_assert(sizeof(bigint::limb_type) == sizeof(token_type), + "bigint::limb_type should have the same size as token_type."); + bigint::limb_type l[2] = { 0, 0 }; + bigint::limb_type a[2] = { rate, 0 }; + bigint::multiply_add(l, a, 2, _token_scale); + (void) bigint::divide(l, l, 2, frequency); + assert(l[1] == 0); + + if (rate != 0) { + // constrain _tokens_per_tick to be at least 1 + _tokens_per_tick = (l[0] != 0 ? l[0] : 1); + _time_until_full = (max_tokens - 1) / _tokens_per_tick + 1; + } else { + _tokens_per_tick = 0; + _time_until_full = (ticks_type) -1; + } +} + +template +typename P::token_type TokenRateX

::rate() const +{ + static_assert(sizeof(bigint::limb_type) == sizeof(token_type), + "bigint::limb_type should have the same size as token_type."); + bigint::limb_type l[2] = { _tokens_per_tick / 2, 0 }; + bigint::limb_type a[2] = { _tokens_per_tick, 0 }; + bigint::multiply_add(l, a, 2, P::frequency()); + (void) bigint::divide(l, l, 2, token_scale()); + return l[1] ? (token_type) max_tokens : l[0]; +} + +/** @cond never */ +template +inline typename TokenRateX

::token_type TokenRateX

::tokens_per_epoch() const +{ + return tokens_per_tick(); +} + +template +inline typename TokenRateX

::ticks_type TokenRateX

::epochs_until_full() const +{ + return time_until_full(); +} +/** @endcond never */ + + +/** @cond never */ +/* TokenRateConverter safely scales token counts according to an input rate. + Template specializations let us make use of a fast int_multiply() when one + is available. */ +template struct TokenRateConverter { +}; +template struct TokenRateConverter { + static bool cvt(const rate_type &rate, typename rate_type::token_type &t) { + typename rate_type::token_type high; + int_multiply(t, rate.token_scale(), t, high); + if (high) + t = rate_type::max_tokens; + return !high; + } +}; +template struct TokenRateConverter { + static bool cvt(const rate_type &rate, typename rate_type::token_type &t) { + if (t <= rate.capacity()) { + t *= rate.token_scale(); + return true; + } else { + t = rate_type::max_tokens; + return false; + } + } +}; +/** @endcond never */ + + +/** @class TokenCounterX include/click/tokenbucket.hh + @brief Token bucket counter template. + + The TokenCounterX class implements a token counter associated with a token + bucket rate. The rate type, normally a TokenRateX, is specified as a + template parameter. Most of its member functions take an explicit rate + argument. The contains() method reports whether the counter has at least a + given number of tokens. The counter is emptied by the remove() and + remove_if() methods and refilled by the refill() methods. + + Often the token rate associated with a counter will not change during the + counter's lifetime. TokenCounterX will work correctly if the rate changes, + however. (See the adjust() method for details.) + + TokenCounterX internally maintains fractional tokens, so it should be + relatively precise. + + Idle and unlimited rates affect how TokenCounters are refilled. For idle + rates, refill() is a no-op. For unlimited rates, any refill() makes the + counter full(), containing max_tokens tokens. The set(), empty(), full(), + remove(), and similar functions act as normal for idle and unlimited rates. + + Most users will be satisfied with the TokenCounter type, which is equal to + TokenCounterX > >. + + @sa TokenRateX, TokenBucketX */ + +template +class TokenCounterX { public: + + /** @brief The token rate type. */ + typedef R rate_type; + + /** @brief Unsigned type of token counts. */ + typedef typename R::token_type token_type; + + /** @brief Type of time points. */ + typedef typename R::time_point_type time_point_type; + + /** @brief Unsigned type of tick counts (differences between time points). */ + typedef typename R::ticks_type ticks_type; + + enum { + max_tokens = R::max_tokens + }; + + /** @brief Construct an empty TokenCounter. + * + * The initial time point is 0. */ + TokenCounterX() + : _tokens(0), _time_point() { + } + + /** @brief Construct a TokenCounter. + * @param full whether the counter is created full + * + * The counter is initially full() if @a full is true, otherwise it is + * empty. The initial time point is 0. */ + explicit TokenCounterX(bool full) + : _tokens(full ? (token_type) max_tokens : 0), _time_point() { + } + + /** @brief Return the number of tokens in the counter. + * @param rate associated token rate + * + * The return value is a lower bound on the number of tokens, since + * TokenCounterX keeps track of fractional tokens. */ + token_type size(const rate_type &rate) const { + return _tokens / rate.token_scale(); + } + + /** @brief Return the counter's fullness fraction. + * + * The return value is a number between 0 and max_tokens, where max_tokens + * represents full capacity. */ + token_type fraction() const { + return _tokens; + } + + /** @brief Test if the token counter is completely empty. */ + bool empty() const { + return _tokens == 0; + } + + /** @brief Test if the token counter is at full capacity. */ + bool full() const { + return _tokens == (token_type) max_tokens; + } + + /** @brief Test if the token counter has at least @a t tokens. + * @param rate associated token rate + * @param t token count + * + * Returns false whenever @a t is greater than rate.@link + * TokenRateX::capacity capacity()@endlink. */ + bool contains(const rate_type &rate, token_type t) const { + return cvt_type::cvt(rate, t) && contains_fraction(t); + } + + /** @brief Test if the token counter is above a fraction of its capacity. + * @param f fullness fraction, where max_tokens is full capacity */ + bool contains_fraction(token_type f) const { + return f <= _tokens; + } + + /** @brief Clear the token counter. + * + * @sa set(), set_full() */ + void clear() { + _tokens = 0; + } + + /** @brief Fill the token counter to capacity. + * + * @sa clear(), set() */ + void set_full() { + _tokens = max_tokens; + } + + /** @brief Set the token counter to contain @a t tokens. + * @param rate associated token rate + * @param t number of tokens + * + * The result will never have more tokens than the associated capacity. */ + void set(const rate_type &rate, token_type t) { + (void) cvt_type::cvt(rate, t); + _tokens = t; + } + + /** @brief Set the token counter to a fraction of its capacity. + * @param f fullness fraction, where max_tokens is full capacity */ + void set_fraction(token_type f) { + _tokens = f; + } + + /** @brief Compensate the counter for a change of rate. + * @param old_rate old associated token rate + * @param new_rate new associated token rate + * + * TokenCounterX's internal representation stores the token count as a + * fraction of the rate's capacity. This means that if you change the + * associated rate to have a different capacity, the token count will + * appear to change. To keep the token count roughly the same, call + * adjust() with the old and new rates; TokenCounterX will as far as + * possible compensate for the rate change. */ + void adjust(const rate_type &old_rate, const rate_type &new_rate) { + if (old_rate.token_scale() != new_rate.token_scale()) { + static_assert(sizeof(bigint::limb_type) == sizeof(token_type), + "bigint::limb_type should have the same size as token_type."); + bigint::limb_type l[2] = { 0, 0 }; + bigint::limb_type a[2] = { _tokens, 0 }; + bigint::multiply_add(l, a, 2, new_rate.token_scale()); + (void) bigint::divide(l, l, 2, old_rate.token_scale()); + _tokens = l[1] ? (token_type) max_tokens : l[0]; + } + } + + /** @brief Refill the token counter to time @a rate.now(). + * @param rate associated token rate + * + * There are three refill() methods, useful for different methods of + * measuring time. This method calls @a rate.now(), which returns the + * current time. Other methods use an explicit time point and a @a + * rate.time_point(U) method. + * + * @sa set_time_point */ + void refill(const rate_type &rate); + + /** @brief Refill the token counter for @a time. + * @param rate associated token rate + * @param time new time point */ + void refill(const rate_type &rate, time_point_type time); + + /** @brief Refill the token counter for @a time. + * @param rate associated token rate + * @param time new time */ + template void refill(const rate_type &rate, U time); + + /** @brief Set the token counter's internal time point to @a time. + * @param time new time point + * + * Unlike refill(), this method does not refill the counter. + * + * @sa refill */ + void set_time_point(time_point_type time) { + _time_point = time; + } + + /** @brief Remove @a t tokens from the counter. + * @param rate associated token rate + * @param t number of tokens + * + * If the token counter contains less than @a t tokens, the new token + * count is 0. */ + void remove(const rate_type &rate, token_type t) { + (void) cvt_type::cvt(rate, t); + remove_fraction(t); + } + + /** @brief Remove @a t tokens from the counter if it contains @a t tokens. + * @param rate associated token rate + * @param t number of tokens + * @return true if @a t tokens were removed, false otherwise + * + * If the counter contains @a t or more tokens, calls remove(@a t) and + * returns true. If it contains less than @a t tokens, returns false + * without removing any tokens. */ + bool remove_if(const rate_type &rate, token_type t) { + return cvt_type::cvt(rate, t) && remove_fraction_if(t); + } + + /** @brief Remove a fullness fraction from the counter. + * @param f fullness fraction, where max_tokens is full capacity + * + * If the token counter is less than @a f full, the new token count is 0. */ + void remove_fraction(token_type f) { + _tokens = (f <= _tokens ? _tokens - f : 0); + } + + /** @brief Remove a fullness fraction from the counter if it is full enough. + * @param f fullness fraction, where max_tokens is full capacity + * @return true if @a f was removed, false otherwise + * + * If fraction() is at least @a f, calls remove_fraction(@a f) and returns + * true. Otherwise, returns false without removing any tokens. */ + bool remove_fraction_if(token_type f) { + if (f <= _tokens) { + _tokens -= f; + return true; + } else + return false; + } + + /** @brief Return the number of ticks until contains(rate, t). + * + * @param rate associated token rate + * @param t token count + * + * Returns (ticks_type) -1 if passing time will never make + * @link contains() contains(rate, t)@endlink + * true. */ + ticks_type time_until_contains(const rate_type &rate, + token_type t) const { + if (cvt_type::cvt(rate, t)) + return time_until_contains_fraction(rate, t); + else + return (ticks_type) -1; + } + + /** @brief Return the number of ticks until contains_fraction(f). + * @param rate associated token rate + * @param f fullness fraction, where max_tokens is full capacity + * + * Returns (ticks_type) -1 if passing time will never make + * @link contains_fraction() contains_fraction(f)@endlink + * true. */ + ticks_type time_until_contains_fraction(const rate_type &rate, + token_type f) const { + if (f <= _tokens || rate.time_until_full() == 0) + return 0; + else if (rate.tokens_per_tick() == 0) + return (ticks_type) -1; + else + return (f - _tokens - 1) / rate.tokens_per_tick() + 1; + } + + + /** @cond never */ + inline ticks_type epochs_until_contains(const rate_type &rate, token_type t) const CLICK_DEPRECATED; + inline ticks_type epochs_until_contains_fraction(const rate_type &rate, token_type f) const CLICK_DEPRECATED; + /** @endcond never */ + + private: + + token_type _tokens; + time_point_type _time_point; + + typedef TokenRateConverter::value> cvt_type; + +}; + +template +void TokenCounterX::refill(const rate_type &rate, time_point_type time) +{ + ticks_type diff = rate.time_monotonic_difference(_time_point, time); + if (diff >= rate.time_until_full()) { + // ignore special case of idle rates -- we assume that + // rate.time_monotonic_difference() will never return (ticks_type) -1, + // and ensure that ticks_type is unsigned + _tokens = max_tokens; + } else if (diff > 0) { + token_type new_tokens = _tokens + diff * rate.tokens_per_tick(); + _tokens = (new_tokens < _tokens ? (token_type) max_tokens : new_tokens); + } + _time_point = time; +} + +template +void TokenCounterX::refill(const rate_type &rate) +{ + refill(rate, rate.now()); +} + +template template +void TokenCounterX::refill(const rate_type &rate, U time) +{ + refill(rate, rate.time_point(time)); +} + +/** @cond never */ +template +inline typename TokenCounterX::ticks_type TokenCounterX::epochs_until_contains(const rate_type &rate, token_type t) const +{ + return time_until_contains(rate, t); +} +template +inline typename TokenCounterX::ticks_type TokenCounterX::epochs_until_contains_fraction(const rate_type &rate, token_type f) const +{ + return time_until_contains_fraction(rate, f); +} +/** @endcond never */ + + +/** @class TokenBucketJiffyParameters include/click/tokenbucket.hh + @brief Helper class for token bucket rate limiter. + + Pass this class as the parameter to TokenRateX. TokenBucketJiffyParameters + measures ticks in units of jiffies. The template parameter is the type of + tokens. */ + +template +class TokenBucketJiffyParameters { public: + + /** @brief The type of tokens. Always unsigned. */ + typedef T token_type; + + /** @brief The type of a time point. Always unsigned. */ + typedef click_jiffies_t time_point_type; + + /** @brief The type of a difference between time points. Always signed. */ + typedef click_jiffies_difference_t duration_type; + + /** @brief Return the current time point. + * @note TokenBucketJiffyParameters measures time points in jiffies. */ + static time_point_type now() { + return click_jiffies(); + } + + static time_point_type time_point(time_point_type t) { + return t; + } + + /** @brief Return @a b - @a a, assuming that @a b was measured after @a a. + * + * Some time measurements can, in rare cases, appear to jump backwards, + * as timestamps do when the user changes the current time. If this + * happens, and @a b < @a a (even though @a b happened after @a a), + * time_monotonic_difference must return 0. */ + static duration_type time_monotonic_difference(time_point_type a, time_point_type b) { +#if CLICK_JIFFIES_MONOTONIC + return b - a; +#else + return (likely(a <= b) ? b - a : 0); +#endif + } + + /** @brief Return true if @a a happened before @a b. */ + static bool time_less(time_point_type a, time_point_type b) { + return click_jiffies_less(a, b); + } + + /** @brief Return the number of time points per period. + * + * Here, this is the number of jiffies per second. */ + static unsigned frequency() { + return CLICK_HZ; + } + + /** @brief Return the Timestamp representing a given time point. */ + static Timestamp timestamp(time_point_type x) { + return Timestamp::make_jiffies(x); + } + + /** @brief Return the Timestamp representing a given tick count. */ + static Timestamp timestamp(duration_type x) { + return Timestamp::make_jiffies(x); + } + +}; + + +/** @class TokenBucketX include/click/tokenbucket.hh + @brief Token bucket rate limiter. + + The TokenBucketX class implements a token bucket rate limiter. It is + implemented as a pair of TokenRateX and TokenCounterX. + + Most users will be satisfied with the TokenBucket type, which is equal to + TokenBucketX >. + + @sa GapRate */ + +template +class TokenBucketX { public: + + /** @brief The template parameter type. */ + typedef P parameter_type; + + /** @brief The token rate type. */ + typedef TokenRateX

rate_type; + + /** @brief The token counter type. */ + typedef TokenCounterX counter_type; + + /** @brief Unsigned type of token counts. */ + typedef typename rate_type::token_type token_type; + + /** @brief Type of time ticks. */ + typedef typename rate_type::time_point_type time_point_type; + + /** @brief Unsigned type of differences between time ticks. */ + typedef typename rate_type::ticks_type ticks_type; + + enum { + max_tokens = rate_type::max_tokens + }; + + /** @brief Construct an idle token bucket. + * + * The initial time point is 0. */ + TokenBucketX() { + } + + /** @brief Construct an idle or unlimited token bucket. + * @param unlimited idle if false, unlimited if true + * + * The initial time point is 0. */ + explicit TokenBucketX(bool unlimited) + : _rate(unlimited), _bucket(unlimited) { + } + + /** @brief Construct a token bucket representing @a rate. + * @param rate refill rate in tokens per period + * @param capacity maximum token accumulation + * + * The initial time point is 0 and the token bucket is initially full (the + * initial token count equals @a capacity). The rate is idle if either @a + * rate or @a capacity is 0. + * + * @sa assign(@a rate, @a capacity) */ + TokenBucketX(token_type rate, token_type capacity) + : _rate(rate, capacity), _bucket(rate != 0 && capacity != 0) { + } + + /** @brief Set the token bucket rate to idle or unlimited. + * @param unlimited idle if false, unlimited if true */ + void assign(bool unlimited = false) { + _rate.assign(unlimited); + } + + /** @brief Set the token bucket rate and capacity. + * @param rate refill rate in tokens per period + * @param capacity maximum token accumulation + * + * Sets the token bucket's rate to @a rate and capacity to @a capacity. + * If either @a rate or @a capacity is 0, the token bucket becomes idle. + * The time point is unchanged. + * + * The ratio of tokens/burst is unchanged by the assignment, so the actual + * number of tokens could go up or down, depending on how the rate is + * changed. + * + * @sa assign_adjust */ + void assign(token_type rate, token_type capacity) { + _rate.assign(rate, capacity); + } + + /** @brief Set the token bucket rate and capacity, preserving the + * token count. + * @param rate refill rate in tokens per period + * @param capacity maximum token accumulation + * + * This performs the same function as assign(), but additionally + * keeps the number of tokens roughly stable. + * + * @sa assign */ + void assign_adjust(token_type rate, token_type capacity) { + rate_type old_rate(_rate); + _rate.assign(rate, capacity); + _bucket.adjust(old_rate, _rate); + } + + /** @brief Return true iff the token rate is unlimited. */ + bool unlimited() const { + return _rate.unlimited(); + } + + /** @brief Return true iff the token rate is idle. */ + bool idle() const { + return _rate.idle(); + } + + /** @brief Return the rate in tokens per period. + * + * Returns max_tokens for unlimited rates. Imprecise computer arithmetic + * may cause the result to differ from the configured rate. */ + token_type rate() const { + return _rate.rate(); + } + + /** @brief Return the capacity in tokens. + * + * Returns max_tokens for unlimited rates. Imprecise computer arithmetic + * may cause the result to differ from the configured capacity. */ + token_type capacity() const { + return _rate.capacity(); + } + + /** @brief Return the number of tokens in the bucket. + * + * The return value is a lower bound on the number of tokens, since + * TokenBucketX keeps track of fractional tokens. */ + token_type size() const { + return _bucket.size(_rate); + } + + /** @brief Return the bucket's fullness fraction. + * + * The return value is a number between 0 and max_tokens, where max_tokens + * represents full capacity. */ + token_type fraction() const { + return _bucket.fraction(); + } + + /** @brief Test if the token bucket is completely empty. */ + bool empty() const { + return _bucket.empty(); + } + + /** @brief Test if the token bucket is at full capacity. */ + bool full() const { + return _bucket.full(); + } + + /** @brief Test if the token bucket has at least @a t tokens. + * + * Returns true whenever @a t is zero or @a rate is unlimited. Returns + * false whenever @a t is greater than @a rate.capacity(). */ + bool contains(token_type t) const { + return _bucket.contains(_rate, t); + } + + /** @brief Test if the token bucket is above a fraction of its capacity. + * @param f fullness fraction, where max_tokens is full capacity */ + bool contains_fraction(token_type f) const { + return _bucket.contains_fraction(f); + } + + /** @brief Clear the token bucket. + * + * @sa set(), set_full() */ + void clear() { + _bucket.clear(); + } + + /** @brief Fill the token bucket to capacity. + * + * @sa clear(), set() */ + void set_full() { + _bucket.set_full(); + } + + /** @brief Set the token bucket to contain @a t tokens. + * @param t number of tokens + * + * The result will never have more tokens than the associated capacity. */ + void set(token_type t) { + _bucket.set(_rate, t); + } + + /** @brief Set the token bucket to a fraction of its capacity. + * @param f fullness fraction, where max_tokens is full capacity */ + void set_fraction(token_type f) { + _bucket.set_fraction(f); + } + + /** @brief Refill the token bucket to time P::now(). + * + * There are three refill() methods, useful for different methods of + * measuring ticks. This method call parameter_type::now(), which returns + * the current time. Other methods use an explicit time point and a + * parameter_type::time(U) method. + * + * @sa set_time_point */ + void refill() { + _bucket.refill(_rate); + } + + /** @brief Refill the token bucket for @a time. */ + void refill(time_point_type time) { + _bucket.refill(_rate, time); + } + + /** @brief Refill the token bucket for time P::time_point(@a time). */ + template void refill(U time) { + _bucket.refill(_rate, time); + } + + /** @brief Set the token bucket's internal time point to @a time. + * + * Unlike refill(), this method does not refill the counter. + * + * @sa refill */ + void set_time_point(time_point_type time) { + _bucket.set_time_point(time); + } + + /** @brief Remove @a t tokens from the bucket. + * @param t number of tokens + * + * If the token bucket contains less than @a t tokens, the new token + * count is 0. */ + void remove(token_type t) { + _bucket.remove(_rate, t); + } + + /** @brief Remove @a t tokens from the bucket if it contains @a t tokens. + * @param t number of tokens + * @return true if @a t tokens were removed, false otherwise + * + * If the token bucket contains @a t or more tokens, calls remove(@a t) + * and returns true. If it contains less than @a t tokens, returns false + * without removing any tokens. */ + bool remove_if(token_type t) { + return _bucket.remove_if(_rate, t); + } + + /** @brief Remove a fullness fraction from the bucket. + * @param f fullness fraction, where max_tokens is full capacity + * + * If the token counter is less than @a f full, the new token count is 0. */ + void remove_fraction(token_type f) { + _bucket.remove_fraction(f); + } + + /** @brief Remove a fullness fraction from the bucket if it is full enough. + * @param f fullness fraction, where max_tokens is full capacity + * @return true if @a f was removed, false otherwise + * + * If fraction() is at least @a f, calls remove_fraction(@a f) and returns + * true. Otherwise, returns false without removing any tokens. */ + bool remove_fraction_if(token_type f) { + return _bucket.remove_fraction_if(f); + } + + /** @brief Return the number of ticks until contains(@a t). + * + * Returns (ticks_type) -1 if passing time will never make contains(@a t) + * true. */ + ticks_type time_until_contains(token_type t) const { + return _bucket.time_until_contains(_rate, t); + } + + /** @brief Return the number of ticks until contains_fraction(@a f). + * + * Returns (ticks_type) -1 if passing time will never make + * contains_fraction(@a f) true. */ + ticks_type time_until_contains_fraction(ticks_type f) const { + return _bucket.time_until_contains_fraction(_rate, f); + } + + + /** @cond never */ + inline ticks_type epochs_until_contains(const rate_type &rate, token_type t) const CLICK_DEPRECATED; + inline ticks_type epochs_until_contains_fraction(const rate_type &rate, token_type f) const CLICK_DEPRECATED; + /** @endcond never */ + + private: + + rate_type _rate; + counter_type _bucket; + +}; + +/** @cond never */ +template +inline typename TokenBucketX

::ticks_type TokenBucketX

::epochs_until_contains(const rate_type &rate, token_type t) const +{ + return time_until_contains(rate, t); +} +template +inline typename TokenBucketX

::ticks_type TokenBucketX

::epochs_until_contains_fraction(const rate_type &rate, token_type f) const +{ + return time_until_contains_fraction(rate, f); +} +/** @endcond never */ + + +/** @class TokenRate include/click/tokenbucket.hh + * @brief Jiffy-based token bucket rate + * + * Equivalent to + * @link TokenRateX TokenRateX >@endlink. + * @sa TokenRateX, TokenBucketJiffyParameters */ +typedef TokenRateX > TokenRate; + +/** @class TokenCounter include/click/tokenbucket.hh + * @brief Jiffy-based token counter + * + * Equivalent to + * @link TokenCounterX TokenCounterX@endlink. + * @sa TokenCounterX, TokenRate */ +typedef TokenCounterX TokenCounter; + +/** @class TokenBucket include/click/tokenbucket.hh + * @brief Jiffy-based token bucket rate limiter + * + * Equivalent to + * @link TokenBucketX TokenBucketX >@endlink. + * @sa TokenBucketX, TokenBucketJiffyParameters */ +typedef TokenBucketX > TokenBucket; + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/type_traits.hh b/openflow/include/click/type_traits.hh new file mode 100644 index 0000000..1d989a8 --- /dev/null +++ b/openflow/include/click/type_traits.hh @@ -0,0 +1,522 @@ +#ifndef CLICK_TYPE_TRAITS_HH +#define CLICK_TYPE_TRAITS_HH +CLICK_DECLS + +/** @file + @brief Type traits structures. */ + +/** @class integral_constant + @brief Type wrapper for an integral constant V. + + Offers the following members: + +

+
type
+
The type itself.
+
value_type
+
The type argument T.
+
value
+
The value argument V.
+
*/ +template +struct integral_constant { + typedef integral_constant type; + typedef T value_type; + static constexpr T value = V; +}; +template constexpr T integral_constant::value; + +/** @class true_type + @brief Type wrapper for the constant true. */ +typedef integral_constant true_type; + +/** @class false_type + @brief Type wrapper for the constant false. */ +typedef integral_constant false_type; + + +/** @class conditional + @brief Conditional type transformation. + + If B is true, then conditional::type is equivalent to T. + Otherwise, it is equivalent to F. */ +template struct conditional {}; + +template +struct conditional { + typedef T type; +}; + +template +struct conditional { + typedef F type; +}; + + +/** @class has_trivial_copy + @brief Template determining whether T may be copied by memcpy. + + has_trivial_copy is equivalent to true_type if T has a trivial + copy constructor, false_type if it does not. */ +#if HAVE___HAS_TRIVIAL_COPY +template struct has_trivial_copy : public integral_constant {}; +#else +template struct has_trivial_copy : public false_type {}; +template <> struct has_trivial_copy : public true_type {}; +template <> struct has_trivial_copy : public true_type {}; +template <> struct has_trivial_copy : public true_type {}; +template <> struct has_trivial_copy : public true_type {}; +template <> struct has_trivial_copy : public true_type {}; +template <> struct has_trivial_copy : public true_type {}; +template <> struct has_trivial_copy : public true_type {}; +template <> struct has_trivial_copy : public true_type {}; +template <> struct has_trivial_copy : public true_type {}; +# if HAVE_LONG_LONG +template <> struct has_trivial_copy : public true_type {}; +template <> struct has_trivial_copy : public true_type {}; +# endif +template struct has_trivial_copy : public true_type {}; +#endif +class IPAddress; +template <> struct has_trivial_copy : public true_type {}; + +/** @class is_reference + @brief Template determining whether T is a reference type. + + is_reference is equivalent to true_type if T is a reference type (T& or + T&&), false_type if it is not. */ +template struct is_reference : public false_type {}; +template struct is_reference : public true_type {}; +#if HAVE_CXX_RVALUE_REFERENCES +template struct is_reference : public true_type {}; +#endif + +/** @class remove_reference + @brief Template removing any reference layer from T. + + Assuming T is a non-reference type, then all of remove_reference::type, + remove_reference::type, and remove_reference::type are equivalent + to T. */ +template struct remove_reference { + typedef T type; +}; +template struct remove_reference { + typedef T type; +}; +#if HAVE_CXX_RVALUE_REFERENCES +template struct remove_reference { + typedef T type; +}; +template +inline typename remove_reference::type&& click_move(T&& x) { + return static_cast::type&&>(x); +} +#endif + +template struct remove_cv { + typedef T type; +}; +template struct remove_cv { + typedef T type; +}; +template struct remove_cv { + typedef T type; +}; +template struct remove_cv { + typedef T type; +}; + +template struct same_type : public false_type {}; +template struct same_type : public true_type {}; + +template struct types_compatible + : public same_type::type, typename remove_cv::type> {}; + +/** @class fast_argument + @brief Template defining a fast argument type for objects of type T. + + fast_argument::type equals either "const T &" or "T". + fast_argument::is_reference is true iff fast_argument::type is + a reference. If fast_argument::is_reference is true, then + fast_argument::enable_rvalue_reference is a typedef to void; otherwise + it is not defined. */ +template ::value + && (!has_trivial_copy::value + || sizeof(T) > sizeof(void *)))> +struct fast_argument; + +template struct fast_argument { + static constexpr bool is_reference = true; + typedef const T &type; +#if HAVE_CXX_RVALUE_REFERENCES + typedef void enable_rvalue_reference; +#endif +}; +template struct fast_argument { + static constexpr bool is_reference = false; + typedef T type; +}; +template constexpr bool fast_argument::is_reference; +template constexpr bool fast_argument::is_reference; + + +/** @class char_array + @brief Template defining a fixed-size character array. */ +template struct char_array { + char x[S]; +} CLICK_SIZE_PACKED_ATTRIBUTE; +template struct has_trivial_copy > : public true_type {}; + + +#if HAVE_INT64_TYPES && (!HAVE_LONG_LONG || SIZEOF_LONG_LONG < 8) +typedef int64_t click_intmax_t; +typedef uint64_t click_uintmax_t; +# define SIZEOF_CLICK_INTMAX_T 8 +# define CLICK_ERRHdMAX "^64d" +# define CLICK_ERRHuMAX "^64u" +# define CLICK_ERRHoMAX "^64o" +# define CLICK_ERRHxMAX "^64x" +# define CLICK_ERRHXMAX "^64X" +#elif HAVE_LONG_LONG +typedef long long click_intmax_t; +typedef unsigned long long click_uintmax_t; +# define SIZEOF_CLICK_INTMAX_T SIZEOF_LONG_LONG +# define CLICK_ERRHdMAX "lld" +# define CLICK_ERRHuMAX "llu" +# define CLICK_ERRHoMAX "llo" +# define CLICK_ERRHxMAX "llx" +# define CLICK_ERRHXMAX "llX" +#else +typedef long click_intmax_t; +typedef unsigned long click_uintmax_t; +# define SIZEOF_CLICK_INTMAX_T SIZEOF_LONG +# define CLICK_ERRHdMAX "ld" +# define CLICK_ERRHuMAX "lu" +# define CLICK_ERRHoMAX "lo" +# define CLICK_ERRHxMAX "lx" +# define CLICK_ERRHXMAX "lX" +#endif + +typedef click_intmax_t click_int_large_t; +typedef click_uintmax_t click_uint_large_t; +#define SIZEOF_CLICK_INT_LARGE_T SIZEOF_CLICK_INTMAX_T +#define CLICK_ERRHdLARGE CLICK_ERRHdMAX +#define CLICK_ERRHuLARGE CLICK_ERRHuMAX +#define CLICK_ERRHoLARGE CLICK_ERRHoMAX +#define CLICK_ERRHxLARGE CLICK_ERRHxMAX +#define CLICK_ERRHXLARGE CLICK_ERRHXMAX + + +/** @class integer_traits + @brief Numeric traits template. + + The integer_traits template defines constants and type definitions related + to integers. Where T is an integer, integer_traits defines: + +
+
const T const_min
+
The minimum value defined for the type.
+
const T const_max
+
The maximum value available for the type.
+
const bool is_numeric
+
True.
+
const bool is_integral
+
True.
+
const bool is_signed
+
True iff the type is signed.
+
signed_type (typedef)
+
Signed version of the type.
+
unsigned_type (typedef)
+
Unsigned version of the type.
+
+ + If T is not an integer, integer_traits defines: + +
+
constexpr bool is_numeric
+
False.
+
constexpr bool is_integral
+
False.
+
*/ +template +struct integer_traits { + static constexpr bool is_numeric = false; + static constexpr bool is_integral = false; +}; +template constexpr bool integer_traits::is_numeric; +template constexpr bool integer_traits::is_integral; + +template <> +struct integer_traits { + static constexpr bool is_numeric = true; + static constexpr bool is_integral = true; + static constexpr unsigned char const_min = 0; + static constexpr unsigned char const_max = ~const_min; + static constexpr bool is_signed = false; + typedef signed char signed_type; + typedef unsigned char unsigned_type; + typedef unsigned char type; + typedef click_uintmax_t max_type; + static bool negative(type) { return false; } +}; + +template <> +struct integer_traits { + static constexpr bool is_numeric = true; + static constexpr bool is_integral = true; + static constexpr signed char const_min = -128; + static constexpr signed char const_max = 127; + static constexpr bool is_signed = true; + typedef signed char signed_type; + typedef unsigned char unsigned_type; + typedef signed char type; + typedef click_intmax_t max_type; + static bool negative(type x) { return x < 0; } +}; + +#if __CHAR_UNSIGNED__ +template <> +struct integer_traits : public integer_traits { + static constexpr char const_min = 0; + static constexpr char const_max = ~const_min; + typedef char type; + static bool negative(type) { return false; } +}; +#else +template <> +struct integer_traits : public integer_traits { + static constexpr char const_min = -128; + static constexpr char const_max = 127; + typedef char type; + static bool negative(type x) { return x < 0; } +}; +#endif + +template <> +struct integer_traits { + static constexpr bool is_numeric = true; + static constexpr bool is_integral = true; + static constexpr unsigned short const_min = 0; + static constexpr unsigned short const_max = ~const_min; + static constexpr bool is_signed = false; + typedef short signed_type; + typedef unsigned short unsigned_type; + typedef unsigned short type; + typedef click_uintmax_t max_type; + static bool negative(type) { return false; } +}; + +template <> +struct integer_traits { + static constexpr bool is_numeric = true; + static constexpr bool is_integral = true; + static constexpr short const_min = -32768; + static constexpr short const_max = 32767; + static constexpr bool is_signed = true; + typedef short signed_type; + typedef unsigned short unsigned_type; + typedef short type; + typedef click_intmax_t max_type; + static bool negative(type x) { return x < 0; } +}; + +template <> +struct integer_traits { + static constexpr bool is_numeric = true; + static constexpr bool is_integral = true; + static constexpr unsigned int const_min = 0; + static constexpr unsigned int const_max = ~const_min; + static constexpr bool is_signed = false; + typedef int signed_type; + typedef unsigned int unsigned_type; + typedef unsigned int type; + typedef click_uintmax_t max_type; + static bool negative(type) { return false; } +}; + +template <> +struct integer_traits { + static constexpr bool is_numeric = true; + static constexpr bool is_integral = true; + static constexpr int const_min = 1 << (8*SIZEOF_INT - 1); + static constexpr int const_max = (unsigned) const_min - 1; + static constexpr bool is_signed = true; + typedef int signed_type; + typedef unsigned int unsigned_type; + typedef int type; + typedef click_intmax_t max_type; + static bool negative(type x) { return x < 0; } +}; + +template <> +struct integer_traits { + static constexpr bool is_numeric = true; + static constexpr bool is_integral = true; + static constexpr unsigned long const_min = 0; + static constexpr unsigned long const_max = ~const_min; + static constexpr bool is_signed = false; + typedef long signed_type; + typedef unsigned long unsigned_type; + typedef unsigned long type; + typedef click_uintmax_t max_type; + static bool negative(type) { return false; } +}; + +template <> +struct integer_traits { + static constexpr bool is_numeric = true; + static constexpr bool is_integral = true; + static constexpr long const_min = (long) 1 << (8*SIZEOF_LONG - 1); + static constexpr long const_max = (unsigned long) const_min - 1; + static constexpr bool is_signed = true; + typedef long signed_type; + typedef unsigned long unsigned_type; + typedef long type; + typedef click_intmax_t max_type; + static bool negative(type x) { return x < 0; } +}; + +#if HAVE_LONG_LONG +template <> +struct integer_traits { + static constexpr bool is_numeric = true; + static constexpr bool is_integral = true; + static constexpr unsigned long long const_min = 0; + static constexpr unsigned long long const_max = ~const_min; + static constexpr bool is_signed = false; + typedef long long signed_type; + typedef unsigned long long unsigned_type; + typedef unsigned long long type; + typedef click_uintmax_t max_type; + static bool negative(type) { return false; } +}; + +template <> +struct integer_traits { + static constexpr bool is_numeric = true; + static constexpr bool is_integral = true; + static constexpr long long const_min = (long long) 1 << (8*SIZEOF_LONG_LONG - 1); + static constexpr long long const_max = (unsigned long long) const_min - 1; + static constexpr bool is_signed = true; + typedef long long signed_type; + typedef unsigned long long unsigned_type; + typedef long long type; + typedef click_intmax_t max_type; + static bool negative(type x) { return x < 0; } +}; +#endif + +#if HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG && !HAVE_INT64_IS_LONG_LONG +template <> +struct integer_traits { + static constexpr bool is_numeric = true; + static constexpr bool is_integral = true; + static constexpr uint64_t const_min = 0; + static constexpr uint64_t const_max = ~const_min; + static constexpr bool is_signed = false; + typedef int64_t signed_type; + typedef uint64_t unsigned_type; + typedef uint64_t type; + typedef click_uintmax_t max_type; + static bool negative(type) { return false; } +}; + +template <> +struct integer_traits { + static constexpr bool is_numeric = true; + static constexpr bool is_integral = true; + static constexpr int64_t const_min = (int64_t) 1 << 63; + static constexpr int64_t const_max = (uint64_t) const_min - 1; + static constexpr bool is_signed = true; + typedef int64_t signed_type; + typedef uint64_t unsigned_type; + typedef int64_t type; + typedef click_intmax_t max_type; + static bool negative(type x) { return x < 0; } +}; +#endif + + +/** @class make_signed + @brief Signed integer type transformation. + + Given an integer type T, the type make_signed::type is the signed version + of T. + + @sa integer_traits */ +template +struct make_signed { + typedef typename integer_traits::signed_type type; +}; + +/** @class make_unsigned + @brief Unsigned integer type transformation. + + Given an integer type T, the type make_unsigned::type is the unsigned + version of T. + + @sa integer_traits */ +template +struct make_unsigned { + typedef typename integer_traits::unsigned_type type; +}; + + +/** @cond never */ +template +struct make_fast_half_integer { + typedef T type; + typedef Thalf half_type; + static constexpr int half_bits = int(sizeof(type) * 4); + static constexpr type half_value = type(1) << half_bits; + static half_type low(type x) { + return x & (half_value - 1); + } + static half_type high(type x) { + return x >> (sizeof(type) * 4); + } +}; +/** @endcond never */ + +/** @class fast_half_integer + @brief Type transformation for big integers. */ +template struct fast_half_integer : public make_fast_half_integer {}; + +#if SIZEOF_LONG >= 8 && SIZEOF_LONG <= 2 * SIZEOF_INT +template <> struct fast_half_integer : public make_fast_half_integer {}; +#endif + +#if HAVE_LONG_LONG && SIZEOF_LONG_LONG <= 2 * SIZEOF_INT +template <> struct fast_half_integer : public make_fast_half_integer {}; +#endif + +#if HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG_LONG && !HAVE_INT64_IS_LONG && SIZEOF_INT >= 4 +template <> struct fast_half_integer : public make_fast_half_integer {}; +#endif + + +template +struct extract_integer_helper { + static void extract(const Limb *x, V &value) { + extract_integer_helper::extract(x + 1, value); + value = (value << (sizeof(Limb) * 8)) | *x; + } +}; + +template +struct extract_integer_helper<1, Limb, V> { + static void extract(const Limb *x, V &value) { + value = x[0]; + } +}; + +/** @brief Extract an integral type from a multi-limb integer. */ +template +inline void extract_integer(const Limb *x, V &value) { + extract_integer_helper< + int((sizeof(V) + sizeof(Limb) - 1) / sizeof(Limb)), Limb, V + >::extract(x, value); +} + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/userutils.hh b/openflow/include/click/userutils.hh new file mode 100644 index 0000000..af28375 --- /dev/null +++ b/openflow/include/click/userutils.hh @@ -0,0 +1,97 @@ +// -*- c-basic-offset: 2; related-file-name: "../../lib/userutils.cc" -*- +#ifndef CLICK_USERUTILS_HH +#define CLICK_USERUTILS_HH +#include +#include +CLICK_DECLS +class ErrorHandler; + +inline bool glob_match(const String &string, const String &pattern) { + return string.glob_match(pattern); +} + +String percent_substitute(const String &string, int format1, ...); + +/** @brief strcmp() replacement that compares numbers numerically. + * @return < 0 if @a a < @a b, > 0 if @a a > @a b, 0 if @a a == @a b + * + * Compares strings of digit characters like decimal numbers, and other + * characters using character-by-character comparison. For example: + * @code + * assert(click_strcmp("a", "b") < 0); + * assert(click_strcmp("a9", "a10") < 0); + * assert(click_strcmp("a001", "a2") < 0); // 1 < 2 + * assert(click_strcmp("a001", "a1") > 0); // longer string of initial zeros + * @endcode + * + * Letters are compared first by lowercase. If two strings are identical + * except for case, then uppercase letters compare less than lowercase + * letters. For example: + * @code + * assert(click_strcmp("a", "B") < 0); + * assert(click_strcmp("Baa", "baa") < 0); + * assert(click_strcmp("Baa", "caa") < 0); + * assert(click_strcmp("baa", "Caa") < 0); + * @endcode + * + * Two strings compare as equal only if they are character-by-character + * equal. */ +int click_strcmp(const String &a, const String &b); + +/** @brief Portable replacement for sigaction(). + * @param signum signal number + * @param handler signal action function + * @param resethand true if the handler should be reset when the signal is + * received, false otherwise + * + * Expands to either sigaction() or signal(). */ +void click_signal(int signum, void (*handler)(int), bool resethand); + +const char *filename_landmark(const char *, bool file_is_expr = false); + +String file_string(FILE *, ErrorHandler * = 0); +String file_string(String, ErrorHandler * = 0); + +String unique_tmpnam(const String &, ErrorHandler * = 0); +void remove_file_on_exit(const String &); +bool path_allows_default_path(String path); +String click_mktmpdir(ErrorHandler * = 0); + +const char *clickpath(); +void set_clickpath(const char *); + +String clickpath_find_file(const String& filename, const char *subdir, + String default_path, ErrorHandler * = 0); +void clickpath_expand_path(const char* subdir, const String& default_path, Vector&); + +void parse_tabbed_lines(const String &, Vector *, ...); + +ArchiveElement init_archive_element(const String &, int); + +String shell_quote(const String &, bool quote_tilde = false); +String shell_command_output_string(String command_line, const String &command_stdin, ErrorHandler *); + + +/** @brief Return true iff @a buf looks like it contains compressed data. + * @param buf buffer + * @param len number of characters in @a buf, should be >= 10 + * + * Checks @a buf for signatures corresponding to zip, gzip, and bzip2 + * compressed data, returning true iff a signature matches. @a len can be any + * number, but should be relatively large or compression might not be + * detected. Currently it must be at least 10 to detect bzip2 compression. */ +bool compressed_data(const unsigned char *buf, int len); + +FILE *open_uncompress_pipe(const String &filename, const unsigned char *buf, + int len, ErrorHandler *errh); + +int compressed_filename(const String &filename); +FILE *open_compress_pipe(const String &filename, ErrorHandler *); + +#if HAVE_DYNAMIC_LINKING +int clickdl_load_package(String, ErrorHandler *); +void clickdl_load_requirement(String, const Vector *archive, ErrorHandler *); +#endif + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/variableenv.hh b/openflow/include/click/variableenv.hh new file mode 100644 index 0000000..4ccb74d --- /dev/null +++ b/openflow/include/click/variableenv.hh @@ -0,0 +1,50 @@ +// -*- c-basic-offset: 4; related-file-name: "../../lib/variableenv.cc" -*- +#ifndef CLICK_VARIABLEENVIRONMENT_HH +#define CLICK_VARIABLEENVIRONMENT_HH +#include +#include +CLICK_DECLS +class StringAccum; + +class VariableExpander { public: + + VariableExpander() { } + virtual ~VariableExpander() { } + + virtual int expand(const String &var, String &expansion, int vartype, int depth) const = 0; + +}; + +class VariableEnvironment : public VariableExpander { public: + + VariableEnvironment(VariableEnvironment *parent); + + int depth() const { return _depth; } + int size() const { return _names.size(); } + + bool defines(const String &name) const; + const String &name(int i) const { return _names[i]; } + const Vector &values() const { return _values; } + const String &value(int i) const { return _values[i]; } + const String &value(const String &name, bool &found) const; + + void clear() { _names.clear(); _values.clear(); } + + VariableEnvironment *parent_of(int depth) const; + bool define(const String &name, const String &value, bool override); + int expand(const String &var, String &expansion, int vartype, int depth) const; + + private: + + Vector _names; + Vector _values; + int _depth; + VariableEnvironment *_parent; + +}; + +String cp_expand(const String &str, const VariableExpander &env, + bool expand_quote = false, int depth = 0); + +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/vector.cc b/openflow/include/click/vector.cc new file mode 100644 index 0000000..1944622 --- /dev/null +++ b/openflow/include/click/vector.cc @@ -0,0 +1,165 @@ +/* + * vector.{cc,hh} -- simple array template class + * Eddie Kohler + * + * Copyright (c) 1999-2000 Massachusetts Institute of Technology + * Copyright (c) 2006 Regents of the University of California + * Copyright (c) 2011 Eddie Kohler + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, subject to the conditions + * listed in the Click LICENSE file. These conditions include: you must + * preserve this copyright notice, and you cannot mention the copyright + * holders in advertising related to the Software without their permission. + * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This + * notice is a summary of the Click LICENSE file; the license in that file is + * legally binding. + */ + +#ifndef CLICK_VECTOR_CC +#define CLICK_VECTOR_CC +#include +#include +CLICK_DECLS +/** @cond never */ + +template +vector_memory::~vector_memory() +{ + AM::destroy(l_, n_); + CLICK_LFREE(l_, capacity_ * sizeof(type)); +} + +template +void vector_memory::assign(const vector_memory &x) +{ + if (&x != this) { + AM::destroy(l_, n_); + AM::mark_noaccess(l_, n_); + n_ = 0; + if (reserve_and_push_back(x.n_, 0)) { + n_ = x.n_; + AM::mark_undefined(l_, n_); + AM::copy(l_, x.l_, n_); + } + } +} + +template +void vector_memory::assign(size_type n, const type *vp) +{ + if (unlikely(need_argument_copy(vp))) { + type v_copy(*vp); + return assign(n, &v_copy); + } + + resize(0, vp); + resize(n, vp); +} + +template +typename vector_memory::iterator vector_memory::insert(iterator it, const type *vp) +{ + assert(it >= begin() && it <= end()); + if (unlikely(need_argument_copy(vp))) { + type v_copy(*vp); + return insert(it, &v_copy); + } + + if (n_ == capacity_) { + size_type pos = it - begin(); + if (!reserve_and_push_back(-1, 0)) + return end(); + it = begin() + pos; + } + AM::mark_undefined(l_ + n_, 1); + AM::move(it + 1, it, end() - it); + AM::mark_undefined(it, 1); + AM::fill(it, 1, vp); + ++n_; + return it; +} + +template +typename vector_memory::iterator vector_memory::erase(iterator a, iterator b) +{ + if (a < b) { + assert(a >= begin() && b <= end()); + AM::move_onto(a, b, end() - b); + n_ -= b - a; + AM::destroy(end(), b - a); + AM::mark_noaccess(end(), b - a); + return a; + } else + return b; +} + +template +bool vector_memory::reserve_and_push_back(size_type want, const type *push_vp) +{ + if (unlikely(push_vp && need_argument_copy(push_vp))) { + type push_v_copy(*push_vp); + return reserve_and_push_back(want, &push_v_copy); + } + + if (want < 0) + want = (capacity_ > 0 ? capacity_ * 2 : 4); + + if (want > capacity_) { + type *new_l = (type *) CLICK_LALLOC(want * sizeof(type)); + if (!new_l) + return false; + AM::mark_noaccess(new_l + n_, want - n_); + AM::move(new_l, l_, n_); + CLICK_LFREE(l_, capacity_ * sizeof(type)); + l_ = new_l; + capacity_ = want; + } + + if (unlikely(push_vp)) + push_back(push_vp); + return true; +} + +template +void vector_memory::resize(size_type n, const type *vp) +{ + if (unlikely(need_argument_copy(vp))) { + type v_copy(*vp); + return resize(n, &v_copy); + } + + if (n <= capacity_ || reserve_and_push_back(n, 0)) { + assert(n >= 0); + if (n < n_) { + AM::destroy(l_ + n, n_ - n); + AM::mark_noaccess(l_ + n, n_ - n); + } + if (n_ < n) { + AM::mark_undefined(l_ + n_, n - n_); + AM::fill(l_ + n_, n - n_, vp); + } + n_ = n; + } +} + +template +void vector_memory::swap(vector_memory &x) +{ + type *l = l_; + l_ = x.l_; + x.l_ = l; + + size_type n = n_; + n_ = x.n_; + x.n_ = n; + + size_type capacity = capacity_; + capacity_ = x.capacity_; + x.capacity_ = capacity; +} + +/** @endcond never */ +CLICK_ENDDECLS +#endif diff --git a/openflow/include/click/vector.hh b/openflow/include/click/vector.hh new file mode 100644 index 0000000..9cce68e --- /dev/null +++ b/openflow/include/click/vector.hh @@ -0,0 +1,518 @@ +#ifndef CLICK_VECTOR_HH +#define CLICK_VECTOR_HH +#include +#include +CLICK_DECLS + +/** @file + @brief Click's vector container template. */ + +/** @cond never */ +template class vector_memory { public: + typedef int size_type; + typedef typename AM::type type; + typedef type *iterator; + inline bool need_argument_copy(const type *argp) const { + return fast_argument::is_reference + && (uintptr_t) argp - (uintptr_t) l_ < (size_t) (n_ * sizeof(type)); + } + + vector_memory() + : l_(0), n_(0), capacity_(0) { + } + ~vector_memory(); + + void assign(const vector_memory &x); + void assign(size_type n, const type *vp); + void resize(size_type n, const type *vp); + iterator begin() { + return l_; + } + iterator end() { + return l_ + n_; + } + iterator insert(iterator it, const type *vp); + iterator erase(iterator a, iterator b); + inline void push_back(const type *vp) { + if (n_ < capacity_) { + AM::mark_undefined(l_ + n_, 1); + AM::fill(l_ + n_, 1, vp); + ++n_; + } else + reserve_and_push_back(-1, vp); + } +#if HAVE_CXX_RVALUE_REFERENCES + inline void move_construct_back(type* vp) { + if (n_ < capacity_) { + AM::mark_undefined(l_ + n_, 1); + AM::move_construct(l_ + n_, vp); + ++n_; + } else + reserve_and_push_back(-1, vp); + } +#endif + inline void pop_back() { + assert(n_ > 0); + --n_; + AM::destroy(l_ + n_, 1); + AM::mark_noaccess(l_ + n_, 1); + } + inline void clear() { + AM::destroy(l_, n_); + AM::mark_noaccess(l_, n_); + n_ = 0; + } + bool reserve_and_push_back(size_type n, const type *vp); + void swap(vector_memory &x); + + type *l_; + size_type n_; + size_type capacity_; +}; +/** @endcond never */ + + +/** @class Vector + @brief Vector template. + + Vector implements a vector, or growable array, suitable for use in the + kernel or at user level. Its interface should be compatible with C++'s + std::vector, although that type has more methods. Vector elements are + accessed with operator[] like arrays, and can be resized and expanded + through append operations (see push_back() and resize()). A common (and + efficient) usage pattern grows a Vector through repeated push_back() calls. + + Vector iterators are pointers into the underlying array. This can simplify + interactions between Vector and code that expects conventional C arrays. + + Vector's push_front() and pop_front() operations are quite expensive (O(size()) + complexity). For fast push_front() and pop_front() operations, use Deque. + + Example code: + @code + Vector v; + printf("%d\n", v.size()); // prints "0" + + v.push_back(1); + v.push_back(2); + printf("%d\n", v.size()); // prints "2" + printf("%d %d\n", v[0], v[1]); // prints "1 2" + + Vector::iterator it = v.begin(); + int *ip = it; // Vector iterators are pointers + assert(it == v.end() - 2); + + v.erase(v.begin()); + printf("%d\n", v.size()); // prints "1" + printf("%d\n", v[0]); // prints "2" + @endcode +*/ +template +class Vector { + + typedef typename array_memory::type array_memory_type; + mutable vector_memory vm_; + + public: + + typedef T value_type; ///< Value type. + typedef T &reference; ///< Reference to value type. + typedef const T &const_reference; ///< Const reference to value type. + typedef T *pointer; ///< Pointer to value type. + typedef const T *const_pointer; ///< Pointer to const value type. + + /** @brief Type used for value arguments (either T or const T &). */ + typedef typename fast_argument::type value_argument_type; + typedef const T &const_access_type; + + typedef int size_type; ///< Type of sizes (size()). + + typedef T *iterator; ///< Iterator type. + typedef const T *const_iterator; ///< Const iterator type. + + /** @brief Constant passed to reserve() to grow the Vector. */ + enum { RESERVE_GROW = (size_type) -1 }; + + + explicit inline Vector(); + explicit inline Vector(size_type n, value_argument_type v); + inline Vector(const Vector &x); +#if HAVE_CXX_RVALUE_REFERENCES + inline Vector(Vector &&x); +#endif + + inline Vector &operator=(const Vector &x); +#if HAVE_CXX_RVALUE_REFERENCES + inline Vector &operator=(Vector &&x); +#endif + inline Vector &assign(size_type n, value_argument_type v = T()); + + inline iterator begin(); + inline iterator end(); + inline const_iterator begin() const; + inline const_iterator end() const; + inline const_iterator cbegin() const; + inline const_iterator cend() const; + + inline size_type size() const; + inline size_type capacity() const; + inline bool empty() const; + inline void resize(size_type n, value_argument_type v = T()); + inline bool reserve(size_type n); + + inline T &operator[](size_type i); + inline const T &operator[](size_type i) const; + inline T &at(size_type i); + inline const T &at(size_type i) const; + inline T &front(); + inline const T &front() const; + inline T &back(); + inline const T &back() const; + + inline T &unchecked_at(size_type i); + inline const T &unchecked_at(size_type i) const; + inline T &at_u(size_type i) CLICK_DEPRECATED; + inline const T &at_u(size_type i) const CLICK_DEPRECATED; + + inline T *data(); + inline const T *data() const; + + inline void push_back(value_argument_type v); +#if HAVE_CXX_RVALUE_REFERENCES + template > + inline typename A::enable_rvalue_reference push_back(T &&v); +#endif + inline void pop_back(); + inline void push_front(value_argument_type v); + inline void pop_front(); + + inline iterator insert(iterator it, value_argument_type v); + inline iterator erase(iterator it); + inline iterator erase(iterator a, iterator b); + + inline void clear(); + + inline void swap(Vector &x); + +}; + +/** @brief Construct an empty vector. */ +template +inline Vector::Vector() { +} + +/** @brief Construct a vector containing @a n copies of @a v. */ +template +inline Vector::Vector(size_type n, value_argument_type v) { + vm_.resize(n, array_memory_type::cast(&v)); +} + +/** @brief Construct a vector as a copy of @a x. */ +template +inline Vector::Vector(const Vector &x) { + vm_.assign(x.vm_); +} + +#if HAVE_CXX_RVALUE_REFERENCES +/** @overload */ +template +inline Vector::Vector(Vector &&x) { + vm_.swap(x.vm_); +} +#endif + +/** @brief Return the number of elements. */ +template +inline typename Vector::size_type Vector::size() const { + return vm_.n_; +} + +/** @brief Test if the vector is empty (size() == 0). */ +template +inline bool Vector::empty() const { + return vm_.n_ == 0; +} + +/** @brief Return the vector's capacity. + + The capacity is greater than or equal to the size(). Functions such as + resize(n) will not allocate new memory for the vector if n <= + capacity(). */ +template +inline typename Vector::size_type Vector::capacity() const { + return vm_.capacity_; +} + +/** @brief Return an iterator for the first element in the vector. */ +template +inline typename Vector::iterator Vector::begin() { + return (iterator) vm_.l_; +} + +/** @overload */ +template +inline typename Vector::const_iterator Vector::begin() const { + return (const_iterator) vm_.l_; +} + +/** @brief Return an iterator for the end of the vector. + @invariant end() == begin() + size() */ +template +inline typename Vector::iterator Vector::end() { + return (iterator) vm_.l_ + vm_.n_; +} + +/** @overload */ +template +inline typename Vector::const_iterator Vector::end() const { + return (const_iterator) vm_.l_ + vm_.n_; +} + +/** @brief Return a const_iterator for the beginning of the vector. */ +template +inline typename Vector::const_iterator Vector::cbegin() const { + return (const_iterator) vm_.l_; +} + +/** @brief Return a const_iterator for the end of the vector. + @invariant cend() == cbegin() + size() */ +template +inline typename Vector::const_iterator Vector::cend() const { + return (iterator) vm_.l_ + vm_.n_; +} + +/** @brief Return a reference to the ith element. + @pre 0 <= @a i < size() */ +template +inline T &Vector::operator[](size_type i) { + assert((unsigned) i < (unsigned) vm_.n_); + return *(T *)&vm_.l_[i]; +} + +/** @overload */ +template +inline const T &Vector::operator[](size_type i) const { + assert((unsigned) i < (unsigned) vm_.n_); + return *(T *)&vm_.l_[i]; +} + +/** @brief Return a reference to the ith element. + @pre 0 <= @a i < size() + @sa operator[]() */ +template +inline T &Vector::at(size_type i) { + return operator[](i); +} + +/** @overload */ +template +inline const T &Vector::at(size_type i) const { + return operator[](i); +} + +/** @brief Return a reference to the first element. + @pre !empty() */ +template +inline T &Vector::front() { + return operator[](0); +} + +/** @overload */ +template +inline const T &Vector::front() const { + return operator[](0); +} + +/** @brief Return a reference to the last element (number size()-1). + @pre !empty() */ +template +inline T &Vector::back() { + return operator[](vm_.n_ - 1); +} + +/** @overload */ +template +inline const T &Vector::back() const { + return operator[](vm_.n_ - 1); +} + +/** @brief Return a reference to the ith element. + @pre 0 <= @a i < size() + + Unlike operator[]() and at(), this function does not check bounds, + even if assertions are enabled. Use with caution. */ +template +inline T &Vector::unchecked_at(size_type i) { + return *(T *)&vm_.l_[i]; +} + +/** @overload */ +template +inline const T &Vector::unchecked_at(size_type i) const { + return *(T *)&vm_.l_[i]; +} + +/** @cond never */ +template +inline T &Vector::at_u(size_type i) { + return unchecked_at(i); +} + +template +inline const T &Vector::at_u(size_type i) const { + return unchecked_at(i); +} +/** @endcond never */ + +/** @brief Return a pointer to the vector's data. + + May be null if empty(). */ +template +inline T *Vector::data() { + return (T *) vm_.l_; +} + +/** @overload */ +template +inline const T *Vector::data() const { + return (const T *) vm_.l_; +} + +/** @brief Resize the vector to contain @a n elements. + @param n new size + @param v value used to fill new elements */ +template +inline void Vector::resize(size_type n, value_argument_type v) { + vm_.resize(n, array_memory_type::cast(&v)); +} + +/** @brief Append element @a v. + + A copy of @a v is inserted at position size(). Takes amortized O(1) + time. */ +template +inline void Vector::push_back(value_argument_type v) { + vm_.push_back(array_memory_type::cast(&v)); +} + +#if HAVE_CXX_RVALUE_REFERENCES +/** @overload */ +template template +inline typename A::enable_rvalue_reference Vector::push_back(T&& v) +{ + vm_.move_construct_back(array_memory_type::cast(&v)); +} +#endif + +/** @brief Remove the last element. + + Takes O(1) time. */ +template +inline void Vector::pop_back() { + vm_.pop_back(); +} + +/** @brief Prepend element @a v. + + A copy of @a v is added to position 0. Other elements are shifted one + position forward. Takes O(size()) time. */ +template +inline void Vector::push_front(value_argument_type v) { + vm_.insert(vm_.l_, array_memory_type::cast(&v)); +} + +/** @brief Remove the first element. + + Other elements are shifted one position backward. Takes O(size()) + time. */ +template +inline void Vector::pop_front() { + vm_.erase(vm_.l_, vm_.l_ + 1); +} + +/** @brief Insert @a v before position @a it. + @return An iterator pointing at the new element. */ +template +inline typename Vector::iterator +Vector::insert(iterator it, value_argument_type v) { + return (iterator) vm_.insert(array_memory_type::cast(it), + array_memory_type::cast(&v)); +} + +/** @brief Remove the element at position @a it. + @return An iterator pointing at the element following @a it. */ +template +inline typename Vector::iterator +Vector::erase(iterator it) { + return (it < end() ? erase(it, it + 1) : it); +} + +/** @brief Remove the elements in [@a a, @a b). + @return An iterator corresponding to @a b. */ +template +inline typename Vector::iterator +Vector::erase(iterator a, iterator b) { + return (iterator) vm_.erase(array_memory_type::cast(a), + array_memory_type::cast(b)); +} + +/** @brief Remove all elements. + @post size() == 0 */ +template +inline void Vector::clear() { + vm_.clear(); +} + +/** @brief Reserve space for at least @a n more elements. + @return true iff reserve succeeded. + + This function changes the vector's capacity(), not its size(). If + reserve(@a n) succeeds, then any succeeding call to resize(@a m) with @a + m < @a n will succeed without allocating vector memory. */ +template +inline bool Vector::reserve(size_type n) { + return vm_.reserve_and_push_back(n, 0); +} + +/** @brief Swap the contents of this vector and @a x. */ +template +inline void Vector::swap(Vector &x) { + vm_.swap(x.vm_); +} + +/** @brief Replace this vector's contents with a copy of @a x. */ +template +inline Vector &Vector::operator=(const Vector &x) { + vm_.assign(x.vm_); + return *this; +} + +#if HAVE_CXX_RVALUE_REFERENCES +template +inline Vector &Vector::operator=(Vector &&x) { + vm_.swap(x.vm_); + return *this; +} +#endif + +/** @brief Replace this vector's contents with @a n copies of @a v. + @post size() == @a n */ +template +inline Vector &Vector::assign(size_type n, value_argument_type v) { + vm_.assign(n, array_memory_type::cast(&v)); + return *this; +} + +template +inline void click_swap(Vector &a, Vector &b) { + a.swap(b); +} + +template +inline void assign_consume(Vector &a, Vector &b) { + a.swap(b); +} + +CLICK_ENDDECLS +#include +#endif diff --git a/openflow/include/clicknet/dhcp.h b/openflow/include/clicknet/dhcp.h new file mode 100644 index 0000000..a996da1 --- /dev/null +++ b/openflow/include/clicknet/dhcp.h @@ -0,0 +1,129 @@ +#ifndef CLICKNET_DHCP_H +#define CLICKNET_DHCP_H + +struct click_dhcp { + uint8_t op; /* message type */ + uint8_t htype; /* hardware address type */ + uint8_t hlen; /* hardware address length */ + uint8_t hops; /* should be zero in client's message */ + uint32_t xid; /* transaction id */ + uint16_t secs; /* elapsed time in sec. from trying to boot */ + uint16_t flags; + uint32_t ciaddr; /* (previously allocated) client IP address */ + uint32_t yiaddr; /* 'your' client IP address */ + uint32_t siaddr; /* should be zero in client's messages */ + uint32_t giaddr; /* should be zero in client's messages */ + uint8_t chaddr[16]; /* client's hardware address */ + uint8_t sname[64]; /* server host name, null terminated string */ + uint8_t file[128]; /* boot file name, null terminated string */ + uint32_t magic; /* magic cookie */ + uint8_t options[312]; /* message options */ +} CLICK_SIZE_PACKED_ATTRIBUTE; + + +#define ETH_10MB 1 /* htype */ +#define ETH_10MB_LEN 6 /* hlen */ + +/* DHCP message OP code */ +#define DHCP_BOOTREQUEST 1 +#define DHCP_BOOTREPLY 2 + +/* DHCP Client State*/ +enum dhcp_client_state { + DHCP_CLIENT_INIT_STATE = 1, + DHCP_CLIENT_SELECTING_STATE, + DHCP_CLIENT_REQUESTING_STATE, + DHCP_CLIENT_INIT_REBOOT, + DHCP_CLIENT_REBOOTING, + DHCP_CLIENT_BOUND, + DHCP_CLIENT_RENEWING, + DHCP_CLIENT_REBINDING +}; + + +/* DHCP message type */ +#define DHCP_DISCOVER 1 +#define DHCP_OFFER 2 +#define DHCP_REQUEST 3 +#define DHCP_DECLINE 4 +#define DHCP_ACK 5 +#define DHCP_NACK 6 +#define DHCP_RELEASE 7 +#define DHCP_INFORM 8 + +#define DHCP_MAGIC 0x63538263 + + + +/* DHCP Option codes: */ +#define DHO_PAD 0 +#define DHO_SUBNET_MASK 1 +#define DHO_TIME_OFFSET 2 +#define DHO_ROUTERS 3 +#define DHO_TIME_SERVERS 4 +#define DHO_NAME_SERVERS 5 +#define DHO_DOMAIN_NAME_SERVERS 6 +#define DHO_LOG_SERVERS 7 +#define DHO_COOKIE_SERVERS 8 +#define DHO_LPR_SERVERS 9 +#define DHO_IMPRESS_SERVERS 10 +#define DHO_RESOURCE_LOCATION_SERVERS 11 +#define DHO_HOST_NAME 12 +#define DHO_BOOT_SIZE 13 +#define DHO_MERIT_DUMP 14 +#define DHO_DOMAIN_NAME 15 +#define DHO_SWAP_SERVER 16 +#define DHO_ROOT_PATH 17 +#define DHO_EXTENSIONS_PATH 18 +#define DHO_IP_FORWARDING 19 +#define DHO_NON_LOCAL_SOURCE_ROUTING 20 +#define DHO_POLICY_FILTER 21 +#define DHO_MAX_DGRAM_REASSEMBLY 22 +#define DHO_DEFAULT_IP_TTL 23 +#define DHO_PATH_MTU_AGING_TIMEOUT 24 +#define DHO_PATH_MTU_PLATEAU_TABLE 25 +#define DHO_INTERFACE_MTU 26 +#define DHO_ALL_SUBNETS_LOCAL 27 +#define DHO_BROADCAST_ADDRESS 28 +#define DHO_PERFORM_MASK_DISCOVERY 29 +#define DHO_MASK_SUPPLIER 30 +#define DHO_ROUTER_DISCOVERY 31 +#define DHO_ROUTER_SOLICITATION_ADDRESS 32 +#define DHO_STATIC_ROUTES 33 +#define DHO_TRAILER_ENCAPSULATION 34 +#define DHO_ARP_CACHE_TIMEOUT 35 +#define DHO_IEEE802_3_ENCAPSULATION 36 +#define DHO_DEFAULT_TCP_TTL 37 +#define DHO_TCP_KEEPALIVE_INTERVAL 38 +#define DHO_TCP_KEEPALIVE_GARBAGE 39 +#define DHO_NIS_DOMAIN 40 +#define DHO_NIS_SERVERS 41 +#define DHO_NTP_SERVERS 42 +#define DHO_VENDOR_ENCAPSULATED_OPTIONS 43 +#define DHO_NETBIOS_NAME_SERVERS 44 +#define DHO_NETBIOS_DD_SERVER 45 +#define DHO_NETBIOS_NODE_TYPE 46 +#define DHO_NETBIOS_SCOPE 47 +#define DHO_FONT_SERVERS 48 +#define DHO_X_DISPLAY_MANAGER 49 +#define DHO_DHCP_REQUESTED_ADDRESS 50 +#define DHO_DHCP_LEASE_TIME 51 +#define DHO_DHCP_OPTION_OVERLOAD 52 +#define DHO_DHCP_MESSAGE_TYPE 53 +#define DHO_DHCP_SERVER_IDENTIFIER 54 +#define DHO_DHCP_PARAMETER_REQUEST_LIST 55 +#define DHO_DHCP_MESSAGE 56 +#define DHO_DHCP_MAX_MESSAGE_SIZE 57 +#define DHO_DHCP_RENEWAL_TIME 58 +#define DHO_DHCP_REBINDING_TIME 59 +#define DHO_VENDOR_CLASS_IDENTIFIER 60 +#define DHO_DHCP_CLIENT_IDENTIFIER 61 +#define DHO_NWIP_DOMAIN_NAME 62 +#define DHO_NWIP_SUBOPTIONS 63 +#define DHO_USER_CLASS 77 +#define DHO_FQDN 81 +#define DHO_DHCP_AGENT_OPTIONS 82 +#define DHO_SUBNET_SELECTION 118 /* RFC3011! */ +#define DHO_END 255 + +#endif /* CLICKNET_DHCP_H */ diff --git a/openflow/include/clicknet/ether.h b/openflow/include/clicknet/ether.h new file mode 100644 index 0000000..ca0ea41 --- /dev/null +++ b/openflow/include/clicknet/ether.h @@ -0,0 +1,130 @@ +/* -*- mode: c; c-basic-offset: 4 -*- */ +#ifndef CLICKNET_ETHER_H +#define CLICKNET_ETHER_H + +/* + * -- Ethernet and ARP headers, based on one of the BSDs. + * + * Relevant RFCs include: + * RFC826 Ethernet Address Resolution Protocol: or, Converting Network + * Protocol Addresses to 48.bit Ethernet Address for Transmission + * on Ethernet Hardware + * RFC894 Standard for the transmission of IP datagrams over Ethernet + * networks + * Also see the relevant IEEE 802 standards. + */ + +struct click_ether { + uint8_t ether_dhost[6]; /* 0-5 Ethernet destination address */ + uint8_t ether_shost[6]; /* 6-11 Ethernet source address */ + uint16_t ether_type; /* 12-13 Ethernet protocol */ +} CLICK_SIZE_PACKED_ATTRIBUTE; + +#define ETHERTYPE_IP 0x0800 +#define ETHERTYPE_ARP 0x0806 +#define ETHERTYPE_TRAIL 0x1000 +#define ETHERTYPE_8021Q 0x8100 +#define ETHERTYPE_IP6 0x86DD +#define ETHERTYPE_MACCONTROL 0x8808 +#define ETHERTYPE_PPPOE_DISC 0x8863 +#define ETHERTYPE_PPPOE_SESSION 0x8864 +#define ETHERTYPE_GRID 0x7fff /* wvlan_cs driver won't transmit frames with high bit of protocol number set */ + +struct click_arp { /* Offsets relative to ARP (Ethernet) header */ + uint16_t ar_hrd; /* 0-1 (14-15) hardware address format */ +#define ARPHRD_ETHER 1 /* Ethernet 10Mbps */ +#define ARPHRD_IEEE802 6 /* token ring */ +#define ARPHRD_ARCNET 7 /* Arcnet */ +#define ARPHRD_FRELAY 15 /* frame relay */ +#define ARPHRD_STRIP 23 /* Ricochet Starmode Radio */ +#define ARPHRD_IEEE1394 24 /* IEEE 1394 (FireWire) */ +#define ARPHRD_80211 801 /* IEEE 802.11 (wifi) */ + uint16_t ar_pro; /* 2-3 (16-17) protocol address format */ + uint8_t ar_hln; /* 4 (18) hardware address length */ + uint8_t ar_pln; /* 5 (19) protocol address length */ + uint16_t ar_op; /* 6-7 (20-21) opcode (command) */ +#define ARPOP_REQUEST 1 /* ARP request */ +#define ARPOP_REPLY 2 /* ARP reply */ +#define ARPOP_REVREQUEST 3 /* reverse request: hw->proto */ +#define ARPOP_REVREPLY 4 /* reverse reply */ +#define ARPOP_INVREQUEST 8 /* peer identification req */ +#define ARPOP_INVREPLY 9 /* peer identification reply */ +}; + +struct click_ether_arp { + struct click_arp ea_hdr; /* 0-7 (14-21) fixed-size ARP header */ + uint8_t arp_sha[6]; /* 8-13 (22-27) sender hardware address */ + uint8_t arp_spa[4]; /* 14-17 (28-31) sender protocol address */ + uint8_t arp_tha[6]; /* 18-23 (32-37) target hardware address */ + uint8_t arp_tpa[4]; /* 24-27 (38-41) target protocol address */ +}; + + +/* Ethernet with VLAN (802.1q) */ + +struct click_ether_vlan { + uint8_t ether_dhost[6]; /* 0-5 Ethernet source address */ + uint8_t ether_shost[6]; /* 6-11 Ethernet destination address */ + uint16_t ether_vlan_proto; /* 12-13 == ETHERTYPE_8021Q */ + uint16_t ether_vlan_tci; /* 14-15 tag control information */ + uint16_t ether_vlan_encap_proto; /* 16-17 Ethernet protocol */ +} CLICK_SIZE_PACKED_ATTRIBUTE; + + +/* Ethernet MAC control (802.3) */ + +struct click_ether_macctl { + uint16_t ether_macctl_opcode; + uint16_t ether_macctl_param; + uint8_t ether_macctl_reserved[42]; +}; + +#define ETHER_MACCTL_OP_PAUSE 0x0001 + + +#define ND_SOL 0x0087 /* Neighborhood Solicitation Message Type */ +#define ND_ADV 0x0088 /* Neighborhood Advertisement Message Type */ + +/* define structure of Neighborhood Solicitation Message */ +struct click_nd_sol { + uint8_t type; + uint8_t code; + uint16_t checksum; + uint32_t reserved; + uint8_t nd_tpa[16]; + uint8_t option_type; /*option type: 1 (source link-layer add) */ + uint8_t option_length; /*option length: 1 (in units of 8 octets) */ + uint8_t nd_sha[6]; /*source link-layer address */ +}; + +/* define structure of Neighborhood Advertisement Message -reply to multicast neighborhood solitation message */ +struct click_nd_adv { + uint8_t type; + uint8_t code; + uint16_t checksum; + uint8_t flags; /* bit 1: sender_is_router + bit 2: solicited + bit 3: override + all other bits should be zero */ + uint8_t reserved[3]; + uint8_t nd_tpa[16]; + uint8_t option_type; /* option type: 2 (target link-layer add) */ + uint8_t option_length; /* option length: 1 (in units of 8 octets) */ + uint8_t nd_tha[6]; /* source link-layer address */ +}; + + +/* define structure of Neighborhood Advertisement Message - reply to unicast neighborhood solitation message */ +struct click_nd_adv2 { + uint8_t type; + uint8_t code; + uint16_t checksum; + uint8_t flags; /* bit 1: sender_is_router + bit 2: solicited + bit 3: override + all other bits should be zero */ + uint8_t reserved[3]; + uint8_t nd_tpa[16]; +}; + +#endif diff --git a/openflow/include/clicknet/fddi.h b/openflow/include/clicknet/fddi.h new file mode 100644 index 0000000..09b4e24 --- /dev/null +++ b/openflow/include/clicknet/fddi.h @@ -0,0 +1,43 @@ +/* -*- mode: c; c-basic-offset: 4 -*- */ +#ifndef CLICKNET_FDDI_H +#define CLICKNET_FDDI_H + +/* + * -- our own definitions of FDDI headers + * based on a file from Linux + */ + +struct click_fddi { + uint8_t fc; + uint8_t daddr[6]; + uint8_t saddr[6]; +} CLICK_SIZE_PACKED_ATTRIBUTE; + +struct click_fddi_8022_1 { + struct click_fddi h; + uint8_t dsap; + uint8_t ssap; + uint8_t ctrl; +} CLICK_SIZE_PACKED_ATTRIBUTE; + +struct click_fddi_8022_2 { + struct click_fddi h; + uint8_t dsap; + uint8_t ssap; + uint8_t ctrl1; + uint8_t ctrl2; +} CLICK_SIZE_PACKED_ATTRIBUTE; + +struct click_fddi_snap { + struct click_fddi h; + uint8_t dsap; + uint8_t ssap; + uint8_t ctrl; + uint8_t oui[3]; + uint16_t ether_type; +} CLICK_SIZE_PACKED_ATTRIBUTE; + +#define FDDI_FC_LLC_ASYNC 0x50 +#define FDDI_FC_LLCMASK 0xF0 /* length/class/format bits */ + +#endif diff --git a/openflow/include/clicknet/icmp.h b/openflow/include/clicknet/icmp.h new file mode 100644 index 0000000..67bc8b3 --- /dev/null +++ b/openflow/include/clicknet/icmp.h @@ -0,0 +1,133 @@ +/* -*- c-basic-offset: 4 -*- */ +#ifndef CLICKNET_ICMP_H +#define CLICKNET_ICMP_H +#include + +/* + * -- ICMP packet definitions, based on FreeBSD. + * + * Relevant RFCs include: + * RFC792 Internet Control Message Protocol + * RFC1122 Requirements for Internet Hosts - Communication Layers + * RFC1123 Requirements for Internet Hosts - Application and Support + * RFC1812 Requirements for IP Version 4 Routers + */ + +/* most icmp request types: ICMP_UNREACH, ICMP_SOURCEQUENCH, ICMP_TIMXCEED */ +struct click_icmp { + uint8_t icmp_type; /* 0 ICMP type (see below) */ + uint8_t icmp_code; /* 1 ICMP code (see below) */ + uint16_t icmp_cksum; /* 2-3 checksum */ + uint32_t padding; /* 4-7 should be zero */ + /* followed by original IP header and initial portion of data */ +}; + +/* header for types with sequence numbers: ICMP_ECHO, ICMP_ECHOREPLY, + ICMP_IREQ, ICMP_IREQREPLY */ +struct click_icmp_sequenced { + uint8_t icmp_type; /* 0 ICMP type (see below) */ + uint8_t icmp_code; /* 1 ICMP code (see below) */ + uint16_t icmp_cksum; /* 2-3 checksum */ + uint16_t icmp_identifier; /* 4-5 flow identifier */ + uint16_t icmp_sequence; /* 6-7 sequence number in flow */ +}; + +/* ICMP_PARAMPROB header */ +struct click_icmp_paramprob { + uint8_t icmp_type; /* 0 ICMP type (see below) */ + uint8_t icmp_code; /* 1 ICMP code (see below) */ + uint16_t icmp_cksum; /* 2-3 checksum */ + uint8_t icmp_pointer; /* 4 parameter pointer */ + uint8_t padding[3]; /* 5-7 should be zero */ + /* followed by original IP header and initial portion of data */ +}; + +/* Redirect header: ICMP_REDIRECT */ +struct click_icmp_redirect { + uint8_t icmp_type; /* 0 ICMP_REDIRECT (see below) */ + uint8_t icmp_code; /* 1 ICMP code (see below) */ + uint16_t icmp_cksum; /* 2-3 checksum */ + struct in_addr icmp_gateway; /* 4-7 address of gateway */ + /* followed by original IP header and initial portion of data */ +}; + +/* Timestamp and TimestampReply header: ICMP_TSTAMP and ICMP_TSTAMPREPLY */ +struct click_icmp_tstamp { + uint8_t icmp_type; /* 0 ICMP type (see below) */ + uint8_t icmp_code; /* 1 ICMP code (see below) */ + uint16_t icmp_cksum; /* 2-3 checksum */ + uint16_t icmp_identifier; /* 4-5 flow identifier */ + uint16_t icmp_sequence; /* 6-7 sequence number in flow */ + uint32_t icmp_originate; /* 8-11 originate timestamp */ + uint32_t icmp_receive; /* 12-15 receive timestamp */ + uint32_t icmp_transmit; /* 16-19 transmit timestamp */ +}; + +/* Path MTU Discovery header: ICMP_UNREACH_NEEDFRAG */ +struct click_icmp_needfrag { + uint8_t icmp_type; /* 0 ICMP_UNREACH (see below) */ + uint8_t icmp_code; /* 1 ICMP_UNREACH_NEEDFRAG */ + uint16_t icmp_cksum; /* 2-3 checksum */ + uint16_t padding; /* 4-5 should be zero */ + uint16_t icmp_nextmtu; /* 6-7 Next-Hop MTU */ + /* followed by original IP header and initial portion of data */ +}; + +#define click_icmp_unreach click_icmp +#define click_icmp_sourcequench click_icmp +#define click_icmp_timxceed click_icmp +#define click_icmp_echo click_icmp_sequenced + + +/* ICMP type definitions and (indented) code definitions */ +#define ICMP_ECHOREPLY 0 /* echo reply */ +#define ICMP_UNREACH 3 /* dest unreachable, codes: */ +#define ICMP_UNREACH_NET 0 /* bad net */ +#define ICMP_UNREACH_HOST 1 /* bad host */ +#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ +#define ICMP_UNREACH_PORT 3 /* bad port */ +#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ +#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ +#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */ +#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */ +#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */ +#define ICMP_UNREACH_NET_PROHIB 9 /* net prohibited access */ +#define ICMP_UNREACH_HOST_PROHIB 10 /* host prohibited access */ +#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */ +#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */ +#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohib */ +#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host prec violation */ +#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* prec cutoff */ +#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ +#define ICMP_REDIRECT 5 /* shorter route, codes: */ +#define ICMP_REDIRECT_NET 0 /* for network */ +#define ICMP_REDIRECT_HOST 1 /* for host */ +#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ +#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ +#define ICMP_ECHO 8 /* echo service */ +#define ICMP_ROUTERADVERT 9 /* router advertisement */ +#define ICMP_ROUTERSOLICIT 10 /* router solicitation */ +#define ICMP_TIMXCEED 11 /* time exceeded, code: */ +#define ICMP_TIMXCEED_TRANSIT 0 /* ttl==0 in transit */ +#define ICMP_TIMXCEED_REASSEMBLY 1 /* ttl==0 in reassembly */ +#define ICMP_PARAMPROB 12 /* ip header bad */ +#define ICMP_PARAMPROB_ERRATPTR 0 /* error at param ptr */ +#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */ +#define ICMP_PARAMPROB_LENGTH 2 /* bad length */ +#define ICMP_TSTAMP 13 /* timestamp request */ +#define ICMP_TSTAMPREPLY 14 /* timestamp reply */ +#define ICMP_IREQ 15 /* information request */ +#define ICMP_IREQREPLY 16 /* information reply */ +#define ICMP_MASKREQ 17 /* address mask request */ +#define ICMP_MASKREQREPLY 18 /* address mask reply */ + +static inline size_t +click_icmp_hl(uint8_t icmp_type) +{ + if (icmp_type == ICMP_TSTAMP || icmp_type == ICMP_TSTAMPREPLY) + return sizeof(click_icmp_tstamp); + else + return sizeof(click_icmp); +} + +#endif diff --git a/openflow/include/clicknet/icmp6.h b/openflow/include/clicknet/icmp6.h new file mode 100644 index 0000000..cb2b441 --- /dev/null +++ b/openflow/include/clicknet/icmp6.h @@ -0,0 +1,114 @@ +/* -*- c-basic-offset: 4 -*- */ +#ifndef CLICKNET_ICMP6_H +#define CLICKNET_ICMP6_H +#include + +/* + * -- our own definitions for ICMP6 packets + * Based on RFC 1885 + */ + +/* types for ICMP6 packets */ +#define ICMP6_UNREACH 1 +#define ICMP6_PKTTOOBIG 2 +#define ICMP6_TIMXCEED 3 +#define ICMP6_PARAMPROB 4 + +#define ICMP6_ECHO 128 +#define ICMP6_ECHOREPLY 129 +#define ICMP6_MEMBERSHIPQUERY 130 +#define ICMP6_MEMBERSHIPREPORT 131 +#define ICMP6_MEMBERSHIPREDUCTION 132 + +#define ICMP6_REDIRECT 137 + +/* codes for spefic types of ICMP6 packets */ +/* ICMP6 Error Message - Type: 1 */ +#define ICMP6_UNREACH_NOROUTE 0 +#define ICMP6_UNREACH_ADMIN 1 +#define ICMP6_UNREACH_NOTNEIGHBOR 2 +#define ICMP6_UNREACH_ADDR 3 +#define ICMP6_UNREACH_NOPORT 4 + +/* ICMP6 Time Exceeded Message - Type: 3 */ +#define ICMP6_TIMXCEED_TRANSIT 0 +#define ICMP6_TIMXCEED_REASSEMBLY 1 + +/* ICMP6 Parameter Problem Message - Type: 4 */ +#define ICMP6_PARAMPROB_HEADER 0 +#define ICMP6_PARAMPROB_NEXTHEADER 1 +#define ICMP6_PARAMPROB_OPTION 2 + +/* remove possible definitions for symbols */ +#undef icmp6_identifier +#undef icmp6_sequence +#undef icmp6_pointer +#undef icmp6_maxdelay + + +/* most ICMP6 request types */ +struct click_icmp6 { + uint8_t icmp6_type; /* one of the ICMP6_TYPE_*'s above */ + uint8_t icmp6_code; /* one of the ICMP6_CODE_*'s above */ + uint16_t icmp6_cksum; /* 16 1's comp csum */ + uint32_t padding; /* should be zero */ + /* followed by as much of invoking packet as will fit without the ICMPv6 packet exceeding 576 octets*/ +}; + +/* packet too big header */ +struct click_icmp6_pkttoobig { + uint8_t icmp6_type; /* one of the ICMP6_TYPE_*'s above */ + uint8_t icmp6_code; /* one of the ICMP6_CODE_*'s above */ + uint16_t icmp6_cksum; /* 16 1's comp csum */ + uint32_t icmp6_mtusize; /* maximum packet size */ + /* followed by as much of invoking packet as will fit without the ICMPv6 packet exceeding 576 octets*/ +}; + +/* parameter problem header */ +struct click_icmp6_paramprob { + uint8_t icmp6_type; /* one of the ICMP_TYPE_*'s above */ + uint8_t icmp6_code; /* one of the ICMP6_CODE_*'s above */ + uint16_t icmp6_cksum; /* 16 1's comp csum */ + uint32_t icmp6_pointer; /* which octect in orig. IP6 pkt was a problem */ + /* followed by as much of invoking packet as will fit without the ICMPv6 packet exceeding 576 octets*/ +}; + + +/* struct for things with sequence numbers - echo request & echo reply msgs*/ +struct click_icmp6_sequenced { + uint8_t icmp6_type; /* one of the ICMP6_TYPE_*'s above */ + uint8_t icmp6_code; /* one of the ICMP6_CODE_*'s above */ + uint16_t icmp6_cksum; /* 16 1's comp csum */ + uint16_t icmp6_identifier; + uint16_t icmp6_sequence; + /* Followed by: */ + /* Echo Request: zero or more octets of arbitary data */ + /* Echo Reply: the data fromm the invoking Echo Request msg */ +}; + +/* struct for group membership messages */ +struct click_icmp6_membership { + uint8_t icmp6_type; /* one of the ICMP6_TYPE_*'s above */ + uint8_t icmp6_code; /* one of the ICMP6_CODE_*'s above */ + uint16_t icmp6_cksum; /* 16 1's comp csum */ + uint16_t icmp6_maxdelay; /* maximum response delay, in milliseconds */ + uint16_t padding; + /* followed by multicast address */ +}; + +/* struct for redirect messages */ +struct click_icmp6_redirect { + uint8_t icmp6_type; + uint8_t icmp6_code; + uint16_t icmp6_cksum; + uint32_t padding; + struct in6_addr icmp6_target; + struct in6_addr icmp6_dst; +}; + +/* different struct names for each type of packet */ +#define click_icmp6_unreach click_icmp6 +#define click_icmp6_timxceed click_icmp6 +#define click_icmp6_echo click_icmp6_sequenced + +#endif diff --git a/openflow/include/clicknet/ip.h b/openflow/include/clicknet/ip.h new file mode 100644 index 0000000..c2be511 --- /dev/null +++ b/openflow/include/clicknet/ip.h @@ -0,0 +1,205 @@ +/* -*- mode: c; c-basic-offset: 4 -*- */ +#ifndef CLICKNET_IP_H +#define CLICKNET_IP_H +/* get struct in_addr */ +#include +CLICK_CXX_PROTECT +#if CLICK_LINUXMODULE +# include +# include +#else +# include +#undef true +# include +#define true linux_true +#endif + +/* + * -- IP header definitions, based on one of the BSDs. + * + * Relevant RFCs include: + * RFC791 Internet Protocol + * RFC3168 The Addition of Explicit Congestion Notification (ECN) to IP + */ + +struct click_ip { +#if CLICK_BYTE_ORDER == CLICK_BIG_ENDIAN + unsigned ip_v : 4; /* 0 version == 4 */ + unsigned ip_hl : 4; /* header length */ +#elif CLICK_BYTE_ORDER == CLICK_LITTLE_ENDIAN + unsigned ip_hl : 4; /* 0 header length */ + unsigned ip_v : 4; /* version == 4 */ +#else +# error "unknown byte order" +#endif + uint8_t ip_tos; /* 1 type of service */ +#define IP_DSCPMASK 0xFC /* diffserv code point */ +#define IP_ECNMASK 0x03 /* ECN code point */ +#define IP_ECN_NOT_ECT 0x00 /* not ECN capable transport */ +#define IP_ECN_ECT1 0x01 /* ECN capable transport */ +#define IP_ECN_ECT2 0x02 /* ECN capable transport */ +#define IP_ECN_CE 0x03 /* ECN congestion exp'd */ + uint16_t ip_len; /* 2-3 total length */ + uint16_t ip_id; /* 4-5 identification */ + uint16_t ip_off; /* 6-7 fragment offset field */ +#define IP_RF 0x8000 /* reserved fragment flag */ +#define IP_DF 0x4000 /* don't fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0X1FFF /* mask for fragmenting bits */ + uint8_t ip_ttl; /* 8 time to live */ + uint8_t ip_p; /* 9 protocol */ + uint16_t ip_sum; /* 10-11 checksum */ + struct in_addr ip_src; /* 12-15 source address */ + struct in_addr ip_dst; /* 16-19 destination address */ +}; + +/* ip_protocol */ +#define IP_PROTO_ICMP 1 +#define IP_PROTO_IGMP 2 +#define IP_PROTO_GGP 3 +#define IP_PROTO_IPIP 4 +#define IP_PROTO_ST 5 +#define IP_PROTO_TCP 6 +#define IP_PROTO_UCL 7 +#define IP_PROTO_EGP 8 +#define IP_PROTO_IGP 9 +#define IP_PROTO_BBN 10 +#define IP_PROTO_NVPII 11 +#define IP_PROTO_PUP 12 +#define IP_PROTO_ARGUS 13 +#define IP_PROTO_EMCON 14 +#define IP_PROTO_XNET 15 +#define IP_PROTO_CHAOS 16 +#define IP_PROTO_UDP 17 +#define IP_PROTO_MUX 18 +#define IP_PROTO_DCN 19 +#define IP_PROTO_HMP 20 +#define IP_PROTO_PRM 21 +#define IP_PROTO_XNS 22 +#define IP_PROTO_TRUNK1 23 +#define IP_PROTO_TRUNK2 24 +#define IP_PROTO_LEAF1 25 +#define IP_PROTO_LEAF2 26 +#define IP_PROTO_RDP 27 +#define IP_PROTO_IRTP 28 +#define IP_PROTO_ISOTP4 29 +#define IP_PROTO_NETBLT 30 +#define IP_PROTO_MFENSP 31 +#define IP_PROTO_MERIT 32 +#define IP_PROTO_DCCP 33 +#define IP_PROTO_RSVP 46 +#define IP_PROTO_GRE 47 +#define IP_PROTO_ICMP6 58 +#define IP_PROTO_CFTP 62 +#define IP_PROTO_SATNET 64 +#define IP_PROTO_MITSUBNET 65 +#define IP_PROTO_RVD 66 +#define IP_PROTO_IPPC 67 +#define IP_PROTO_SATMON 69 +#define IP_PROTO_IPCV 71 +#define IP_PROTO_BRSATMON 76 +#define IP_PROTO_WBMON 78 +#define IP_PROTO_WBEXPAK 79 +#define IP_PROTO_SCTP 132 +#define IP_PROTO_UDPLITE 136 + +#define IP_PROTO_NONE 257 +#define IP_PROTO_TRANSP 258 +#define IP_PROTO_TCP_OR_UDP 256 +#define IP_PROTO_PAYLOAD 259 + +#define IPOPT_EOL 0 /* end of option list */ +#define IPOPT_NOP 1 /* no operation */ +#define IPOPT_RR 7 /* record packet route */ +#define IPOPT_TS 68 /* timestamp */ +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#define IPOPT_LSRR 131 /* loose source route */ +#define IPOPT_SATID 136 /* satnet id */ +#define IPOPT_SSRR 137 /* strict source route */ +#define IPOPT_RA 148 /* router alert */ + +#define IP_ISFRAG(iph) (((iph)->ip_off & htons(IP_MF | IP_OFFMASK)) != 0) +#define IP_FIRSTFRAG(iph) (((iph)->ip_off & htons(IP_OFFMASK)) == 0) + + +/* checksum functions */ + +#if !CLICK_LINUXMODULE +/** @brief Calculate an Internet checksum over a data range. + * @param x data to checksum + * @param len number of bytes to checksum + * + * @a x must be two-byte aligned. */ +uint16_t click_in_cksum(const unsigned char *x, int len); +uint16_t click_in_cksum_pseudohdr_raw(uint32_t csum, uint32_t src, uint32_t dst, int proto, int packet_len); +#else +# define click_in_cksum(addr, len) \ + ip_compute_csum((unsigned char *)(addr), (len)) +# define click_in_cksum_pseudohdr_raw(csum, src, dst, proto, transport_len) \ + csum_tcpudp_magic((src), (dst), (transport_len), (proto), ~(csum) & 0xFFFF) +#endif +uint16_t click_in_cksum_pseudohdr_hard(uint32_t csum, const struct click_ip *iph, int packet_len); +void click_update_zero_in_cksum_hard(uint16_t *csum, const unsigned char *addr, int len); + +/** @brief Adjust an Internet checksum according to a pseudoheader. + * @param data_csum initial checksum (may be a 16-bit checksum) + * @param iph IP header from which to extract pseudoheader information + * @param transport_len length of transport header + * + * This function correctly handles Internet headers that contain source + * routing options. The final destination from the source routing option is + * used to compute the pseudoheader checksum. */ +static inline uint16_t +click_in_cksum_pseudohdr(uint32_t data_csum, const struct click_ip *iph, + int transport_len) +{ + if (iph->ip_hl == 5) + return click_in_cksum_pseudohdr_raw(data_csum, iph->ip_src.s_addr, iph->ip_dst.s_addr, iph->ip_p, transport_len); + else + return click_in_cksum_pseudohdr_hard(data_csum, iph, transport_len); +} + +/** @brief Incrementally adjust an Internet checksum. + * @param[in, out] csum points to checksum + * @param old_hw old halfword + * @param new_hw new halfword + * + * The checksum stored in *@a csum is updated to account for a change of @a + * old_hw to @a new_hw. + * + * Because of the vagaries of one's-complement arithmetic, this function will + * never produce a new checksum of ~+0 = 0xFFFF. This is usually OK, since + * IP, TCP, and UDP checksums will never have this value. (Only all-zero data + * can checksum to ~+0, but IP, TCP, and UDP checksums always cover at least + * one non-zero byte.) If you are checksumming data that is potentially all + * zero, then call click_update_zero_in_cksum() after calling + * click_update_in_cksum(). */ +static inline void +click_update_in_cksum(uint16_t *csum, uint16_t old_hw, uint16_t new_hw) +{ + /* incrementally update IP checksum according to RFC1624: + new_sum = ~(~old_sum + ~old_halfword + new_halfword) */ + uint32_t sum = (~*csum & 0xFFFF) + (~old_hw & 0xFFFF) + new_hw; + sum = (sum & 0xFFFF) + (sum >> 16); + *csum = ~(sum + (sum >> 16)); +} + +/** @brief Potentially fix a zero-valued Internet checksum. + * @param[in, out] csum points to checksum + * @param x data to checksum + * @param len number of bytes to checksum + * + * If all the data bytes in [x, x+len) are zero, then its checksum should be + * ~+0 = 0xFFFF, but click_update_in_cksum may have set the checksum to ~-0 = + * 0x0000. This function checks for such a case and sets the checksum + * correctly. */ +static inline void +click_update_zero_in_cksum(uint16_t *csum, const unsigned char *x, int len) +{ + if (*csum == 0) + click_update_zero_in_cksum_hard(csum, x, len); +} + +CLICK_CXX_UNPROTECT +#include +#endif diff --git a/openflow/include/clicknet/ip6.h b/openflow/include/clicknet/ip6.h new file mode 100644 index 0000000..f1fa1c5 --- /dev/null +++ b/openflow/include/clicknet/ip6.h @@ -0,0 +1,98 @@ +/* -*- mode: c; c-basic-offset: 4 -*- */ +#ifndef CLICKNET_IP6_H +#define CLICKNET_IP6_H +//#include +/* get struct in6_addr */ +#include +CLICK_CXX_PROTECT +#if CLICK_LINUXMODULE +# include +# include +#else +# include +# undef true +# include +# define true linux_true +#endif + +struct click_ip6 { + union { + struct { + uint32_t ip6_un1_flow; /* 0-3 bits 0-3: version == 6 */ + /* bits 4-11: traffic class */ + /* bits 4-9: DSCP */ + /* bits 10-11: ECN */ + /* bits 12-31: flow label */ + uint16_t ip6_un1_plen; /* 4-5 payload length */ + uint8_t ip6_un1_nxt; /* 6 next header */ + uint8_t ip6_un1_hlim; /* 7 hop limit */ + } ip6_un1; + uint8_t ip6_un2_vfc; /* 0 bits 0-3: version == 6 */ + /* bits 4-7: top 4 class bits */ + struct { +#if CLICK_BYTE_ORDER == CLICK_BIG_ENDIAN + unsigned ip6_un3_v : 4; /* 0 version == 6 */ + unsigned ip6_un3_fc : 4; /* header length */ +#elif CLICK_BYTE_ORDER == CLICK_LITTLE_ENDIAN + unsigned ip6_un3_fc : 4; /* 0 header length */ + unsigned ip6_un3_v : 4; /* version == 6 */ +#endif + } ip6_un3; + } ip6_ctlun; + struct in6_addr ip6_src; /* 8-23 source address */ + struct in6_addr ip6_dst; /* 24-39 dest address */ +}; + +#define ip6_v ip6_ctlun.ip6_un3.ip6_un3_v +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim + +#define IP6_FLOW_MASK 0x000FFFFFU +#define IP6_FLOW_SHIFT 0 +#define IP6_CLASS_MASK 0x0FF00000U +#define IP6_CLASS_SHIFT 20 +#define IP6_DSCP_MASK 0x0FC00000U +#define IP6_DSCP_SHIFT 22 +#define IP6_V_MASK 0xF0000000U +#define IP6_V_SHIFT 28 + +#define IP6_CHECK_V(hdr) (((hdr).ip6_vfc & htonl(IP6_V_MASK)) == htonl(6 << IP6_V_SHIFT)) + +#ifndef IP6PROTO_FRAGMENT +#define IP6PROTO_FRAGMENT 0x2c +#endif +struct click_ip6_fragment { + uint8_t ip6_frag_nxt; + uint8_t ip6_frag_reserved; + uint16_t ip6_frag_offset; +#define IP6_MF 0x0001 +#define IP6_OFFMASK 0xFFF8 + /* bits 0-12: Fragment offset */ + /* bit 13-14: reserved */ + /* bit 15: More Fragment */ + uint32_t ip6_frag_id; +}; + + +uint16_t in6_fast_cksum(const struct in6_addr *saddr, + const struct in6_addr *daddr, + uint16_t len, + uint8_t proto, + uint16_t ori_csum, + const unsigned char *addr, + uint16_t len2); + +uint16_t in6_cksum(const struct in6_addr *saddr, + const struct in6_addr *daddr, + uint16_t len, + uint8_t proto, + uint16_t ori_csum, + unsigned char *addr, + uint16_t len2); + +CLICK_CXX_UNPROTECT +#include +#endif diff --git a/openflow/include/clicknet/llc.h b/openflow/include/clicknet/llc.h new file mode 100644 index 0000000..afaa0cd --- /dev/null +++ b/openflow/include/clicknet/llc.h @@ -0,0 +1,153 @@ +/* + * - contains the definitions for llc frames. + * It was originally taken from freebsd and modified for click use. + * John Bicket + */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_llc.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_llc.h,v 1.7 1999/08/28 00:48:18 peter Exp $ + */ + +#ifndef CLICKNET_LLC_H +#define CLICKNET_LLC_H + +/* + * IEEE 802.2 Link Level Control headers, for use in conjunction with + * 802.{3,4,5} media access control methods. + * + * Headers here do not use bit fields due to shortcomings in many + * compilers. + */ + +struct click_llc { + uint8_t llc_dsap; + uint8_t llc_ssap; + union { + struct { + uint8_t control; + uint8_t format_id; + uint8_t _class; + uint8_t window_x2; + } type_u; + struct { + uint8_t num_snd_x2; + uint8_t num_rcv_x2; + } type_i; + struct { + uint8_t control; + uint8_t num_rcv_x2; + } type_s; + struct { + uint8_t control; + struct frmrinfo { + uint8_t rej_pdu_0; + uint8_t rej_pdu_1; + uint8_t frmr_control; + uint8_t frmr_control_ext; + uint8_t frmr_cause; + } frmrinfo; + } type_frmr; + struct { + uint8_t control; + uint8_t org_code[3]; + uint16_t ether_type; + } type_snap; + struct { + uint8_t control; + uint8_t control_ext; + } type_raw; + } llc_un; +} CLICK_SIZE_PACKED_ATTRIBUTE; + +#define llc_control llc_un.type_u.control +#define llc_control_ext llc_un.type_raw.control_ext +#define llc_fid llc_un.type_u.format_id +#define llc_class llc_un.type_u._class +#define llc_window llc_un.type_u.window_x2 +#define llc_frmrinfo llc_un.type_frmr.frmrinfo +#define llc_frmr_pdu0 llc_un.type_frmr.frmrinfo.rej_pdu0 +#define llc_frmr_pdu1 llc_un.type_frmr.frmrinfo.rej_pdu1 +#define llc_frmr_control llc_un.type_frmr.frmrinfo.frmr_control +#define llc_frmr_control_ext llc_un.type_frmr.frmrinfo.frmr_control_ext +#define llc_frmr_cause llc_un.type_frmr.frmrinfo.frmr_control_ext + +/* + * Don't use sizeof(struct llc_un) for LLC header sizes + */ +#define LLC_ISFRAMELEN 4 +#define LLC_UFRAMELEN 3 +#define LLC_FRMRLEN 7 + +/* + * Unnumbered LLC format commands + */ +#define LLC_UI 0x3 +#define LLC_UI_P 0x13 +#define LLC_DISC 0x43 +#define LLC_DISC_P 0x53 +#define LLC_UA 0x63 +#define LLC_UA_P 0x73 +#define LLC_TEST 0xe3 +#define LLC_TEST_P 0xf3 +#define LLC_FRMR 0x87 +#define LLC_FRMR_P 0x97 +#define LLC_DM 0x0f +#define LLC_DM_P 0x1f +#define LLC_XID 0xaf +#define LLC_XID_P 0xbf +#define LLC_SABME 0x6f +#define LLC_SABME_P 0x7f + +/* + * Supervisory LLC commands + */ +#define LLC_RR 0x01 +#define LLC_RNR 0x05 +#define LLC_REJ 0x09 + +/* + * Info format - dummy only + */ +#define LLC_INFO 0x00 + +/* + * ISO PDTR 10178 contains among others + */ +#define LLC_IP_LSAP 0x06 +#define LLC_X25_LSAP 0x7e +#define LLC_SNAP_LSAP 0xaa +#define LLC_ISO_LSAP 0xfe + +#endif diff --git a/openflow/include/clicknet/ppp.h b/openflow/include/clicknet/ppp.h new file mode 100644 index 0000000..88a36b1 --- /dev/null +++ b/openflow/include/clicknet/ppp.h @@ -0,0 +1,69 @@ +#ifndef CLICKNET_PPP_H +#define CLICKNET_PPP_H + +/* + * -- our own definition of the PPP header, borrowed from + * tcpdump + * + * Copyright 1989 by Carnegie Mellon. + * + * Permission to use, copy, modify, and distribute this program for any + * purpose and without fee is hereby granted, provided that this copyright + * and permission notice appear on all copies and supporting documentation, + * the name of Carnegie Mellon not be used in advertising or publicity + * pertaining to distribution of the program without specific prior + * permission, and notice be given in supporting documentation that copying + * and distribution is by permission of Carnegie Mellon and Stanford + * University. Carnegie Mellon makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#define PPP_ADDRESS 0xff /* The address byte value */ +#define PPP_CONTROL 0x03 /* The control byte value */ + +/* Protocol numbers */ +#define PPP_IP 0x0021 /* Raw IP */ +#define PPP_OSI 0x0023 /* OSI Network Layer */ +#define PPP_NS 0x0025 /* Xerox NS IDP */ +#define PPP_DECNET 0x0027 /* DECnet Phase IV */ +#define PPP_APPLE 0x0029 /* Appletalk */ +#define PPP_IPX 0x002b /* Novell IPX */ +#define PPP_VJC 0x002d /* Van Jacobson Compressed TCP/IP */ +#define PPP_VJNC 0x002f /* Van Jacobson Uncompressed TCP/IP */ +#define PPP_BRPDU 0x0031 /* Bridging PDU */ +#define PPP_STII 0x0033 /* Stream Protocol (ST-II) */ +#define PPP_VINES 0x0035 /* Banyan Vines */ +#define PPP_IPV6 0x0057 /* IPv6 */ +#define PPP_COMP 0x00fd /* Compressed Datagram */ + +#define PPP_HELLO 0x0201 /* 802.1d Hello Packets */ +#define PPP_LUXCOM 0x0231 /* Luxcom */ +#define PPP_SNS 0x0233 /* Sigma Network Systems */ +#define PPP_MPLS_UCAST 0x0281 /* rfc 3032 */ +#define PPP_MPLS_MCAST 0x0283 /* rfc 3022 */ + +#define PPP_IPCP 0x8021 /* IP Control Protocol */ +#define PPP_OSICP 0x8023 /* OSI Network Layer Control Protocol */ +#define PPP_NSCP 0x8025 /* Xerox NS IDP Control Protocol */ +#define PPP_DECNETCP 0x8027 /* DECnet Control Protocol */ +#define PPP_APPLECP 0x8029 /* Appletalk Control Protocol */ +#define PPP_IPXCP 0x802b /* Novell IPX Control Protocol */ +#define PPP_STIICP 0x8033 /* Strean Protocol Control Protocol */ +#define PPP_VINESCP 0x8035 /* Banyan Vines Control Protocol */ +#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ +#define PPP_CCP 0x80fd /* Compress Control Protocol */ +#define PPP_MPLSCP 0x8281 /* rfc 3022 */ + +#define PPP_LCP 0xc021 /* Link Control Protocol */ +#define PPP_PAP 0xc023 /* Password Authentication Protocol */ +#define PPP_LQM 0xc025 /* Link Quality Monitoring */ +#define PPP_SPAP 0xc027 +#define PPP_CHAP 0xc223 /* Challenge Handshake Authentication Protocol */ +#define PPP_BACP 0xc02b /* Bandwidth Allocation Control Protocol */ +#define PPP_BAP 0xc02d /* BAP */ +#define PPP_MP 0xc03d /* Multi-Link */ +#define PPP_SPAP_OLD 0xc123 +#define PPP_EAP 0xc227 + +#endif diff --git a/openflow/include/clicknet/radiotap.h b/openflow/include/clicknet/radiotap.h new file mode 100644 index 0000000..49207a1 --- /dev/null +++ b/openflow/include/clicknet/radiotap.h @@ -0,0 +1,249 @@ +/* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.5 2005/01/22 20:12:05 sam Exp $ */ +/* $NetBSD: ieee80211_radiotap.h,v 1.10 2005/01/04 00:34:58 dyoung Exp $ */ + +/*- + * Copyright (c) 2003, 2004 David Young. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of David Young may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID + * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + */ +#ifndef _NET_IF_IEEE80211RADIOTAP_H_ +#define _NET_IF_IEEE80211RADIOTAP_H_ + +/* A generic radio capture format is desirable. There is one for + * Linux, but it is neither rigidly defined (there were not even + * units given for some fields) nor easily extensible. + * + * I suggest the following extensible radio capture format. It is + * based on a bitmap indicating which fields are present. + * + * I am trying to describe precisely what the application programmer + * should expect in the following, and for that reason I tell the + * units and origin of each measurement (where it applies), or else I + * use sufficiently weaselly language ("is a monotonically nondecreasing + * function of...") that I cannot set false expectations for lawyerly + * readers. + */ +#if defined(__KERNEL__) || defined(_KERNEL) +#ifndef DLT_IEEE802_11_RADIO +#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus WLAN header */ +#endif +#endif /* defined(__KERNEL__) || defined(_KERNEL) */ + +/* XXX tcpdump/libpcap do not tolerate variable-length headers, + * yet, so we pad every radiotap header to 64 bytes. Ugh. + */ +#define IEEE80211_RADIOTAP_HDRLEN 64 + +/* The radio capture header precedes the 802.11 header. */ +struct ieee80211_radiotap_header { + u_int8_t it_version; /* Version 0. Only increases + * for drastic changes, + * introduction of compatible + * new fields does not count. + */ + u_int8_t it_pad; + u_int16_t it_len; /* length of the whole + * header in bytes, including + * it_version, it_pad, + * it_len, and data fields. + */ + u_int32_t it_present; /* A bitmap telling which + * fields are present. Set bit 31 + * (0x80000000) to extend the + * bitmap by another 32 bits. + * Additional extensions are made + * by setting bit 31. + */ +} __attribute__((__packed__)); + +/* Name Data type Units + * ---- --------- ----- + * + * IEEE80211_RADIOTAP_TSFT u_int64_t microseconds + * + * Value in microseconds of the MAC's 64-bit 802.11 Time + * Synchronization Function timer when the first bit of the + * MPDU arrived at the MAC. For received frames, only. + * + * IEEE80211_RADIOTAP_CHANNEL 2 x u_int16_t MHz, bitmap + * + * Tx/Rx frequency in MHz, followed by flags (see below). + * + * IEEE80211_RADIOTAP_FHSS u_int16_t see below + * + * For frequency-hopping radios, the hop set (first byte) + * and pattern (second byte). + * + * IEEE80211_RADIOTAP_RATE u_int8_t 500kb/s + * + * Tx/Rx data rate + * + * IEEE80211_RADIOTAP_DBM_ANTSIGNAL int8_t decibels from + * one milliwatt (dBm) + * + * RF signal power at the antenna, decibel difference from + * one milliwatt. + * + * IEEE80211_RADIOTAP_DBM_ANTNOISE int8_t decibels from + * one milliwatt (dBm) + * + * RF noise power at the antenna, decibel difference from one + * milliwatt. + * + * IEEE80211_RADIOTAP_DB_ANTSIGNAL u_int8_t decibel (dB) + * + * RF signal power at the antenna, decibel difference from an + * arbitrary, fixed reference. + * + * IEEE80211_RADIOTAP_DB_ANTNOISE u_int8_t decibel (dB) + * + * RF noise power at the antenna, decibel difference from an + * arbitrary, fixed reference point. + * + * IEEE80211_RADIOTAP_LOCK_QUALITY u_int16_t unitless + * + * Quality of Barker code lock. Unitless. Monotonically + * nondecreasing with "better" lock strength. Called "Signal + * Quality" in datasheets. (Is there a standard way to measure + * this?) + * + * IEEE80211_RADIOTAP_TX_ATTENUATION u_int16_t unitless + * + * Transmit power expressed as unitless distance from max + * power set at factory calibration. 0 is max power. + * Monotonically nondecreasing with lower power levels. + * + * IEEE80211_RADIOTAP_DB_TX_ATTENUATION u_int16_t decibels (dB) + * + * Transmit power expressed as decibel distance from max power + * set at factory calibration. 0 is max power. Monotonically + * nondecreasing with lower power levels. + * + * IEEE80211_RADIOTAP_DBM_TX_POWER int8_t decibels from + * one milliwatt (dBm) + * + * Transmit power expressed as dBm (decibels from a 1 milliwatt + * reference). This is the absolute power level measured at + * the antenna port. + * + * IEEE80211_RADIOTAP_FLAGS u_int8_t bitmap + * + * Properties of transmitted and received frames. See flags + * defined below. + * + * IEEE80211_RADIOTAP_ANTENNA u_int8_t antenna index + * + * Unitless indication of the Rx/Tx antenna for this packet. + * The first antenna is antenna 0. + * + * IEEE80211_RADIOTAP_RX_FLAGS u_int16_t bitmap + * + * Properties of received frames. See flags defined below. + * + * IEEE80211_RADIOTAP_TX_FLAGS u_int16_t bitmap + * + * Properties of transmitted frames. See flags defined below. + * + * IEEE80211_RADIOTAP_RTS_RETRIES u_int8_t data + * + * Number of rts retries a transmitted frame used. + * + * IEEE80211_RADIOTAP_DATA_RETRIES u_int8_t data + * + * Number of unicast retries a transmitted frame used. + * + */ +enum ieee80211_radiotap_type { + IEEE80211_RADIOTAP_TSFT = 0, + IEEE80211_RADIOTAP_FLAGS = 1, + IEEE80211_RADIOTAP_RATE = 2, + IEEE80211_RADIOTAP_CHANNEL = 3, + IEEE80211_RADIOTAP_FHSS = 4, + IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, + IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, + IEEE80211_RADIOTAP_LOCK_QUALITY = 7, + IEEE80211_RADIOTAP_TX_ATTENUATION = 8, + IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, + IEEE80211_RADIOTAP_DBM_TX_POWER = 10, + IEEE80211_RADIOTAP_ANTENNA = 11, + IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, + IEEE80211_RADIOTAP_DB_ANTNOISE = 13, + IEEE80211_RADIOTAP_RX_FLAGS = 14, + IEEE80211_RADIOTAP_TX_FLAGS = 15, + IEEE80211_RADIOTAP_RTS_RETRIES = 16, + IEEE80211_RADIOTAP_DATA_RETRIES = 17, + IEEE80211_RADIOTAP_XCHANNEL = 18, + IEEE80211_RADIOTAP_MCS = 19, + IEEE80211_RADIOTAP_A_MPDU_STATUS = 20, + IEEE80211_RADIOTAP_VHT = 21, + IEEE80211_RADIOTAP_EXT = 31 +}; + +#if !defined(__KERNEL__) && !defined(_KERNEL) +/* Channel flags. */ +#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ +#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ +#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ +#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ +#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ +#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ +#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ +#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ +#endif /* !defined(__KERNEL__) && !defined(_KERNEL) */ + +/* For IEEE80211_RADIOTAP_FLAGS */ +#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received + * during CFP + */ +#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received + * with short + * preamble + */ +#define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received + * with WEP encryption + */ +#define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received + * with fragmentation + */ +#define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */ +#define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between + * 802.11 header and payload + * (to 32-bit boundary) + */ +/* For IEEE80211_RADIOTAP_RX_FLAGS */ +#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */ + +/* For IEEE80211_RADIOTAP_TX_FLAGS */ +#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive + * retries */ +#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */ +#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */ + +#define IEEE80211_RADIOTAP_F_TX_NOACK 0x0008 /* Receiver will not ack */ + + + +#endif /* _NET_IF_IEEE80211RADIOTAP_H_ */ diff --git a/openflow/include/clicknet/rfc1483.h b/openflow/include/clicknet/rfc1483.h new file mode 100644 index 0000000..f3e1a33 --- /dev/null +++ b/openflow/include/clicknet/rfc1483.h @@ -0,0 +1,20 @@ +/* -*- mode: c; c-basic-offset: 4 -*- */ +#ifndef CLICKNET_RFC1483_H +#define CLICKNET_RFC1483_H + +/* + * + */ + +struct click_rfc1483 { + uint8_t dsap; + uint8_t ssap; + uint8_t ui; + uint8_t orgcode[3]; + uint16_t ether_type; +}; + +#define RFC1483_SNAP_IP_EXPECTED "\xAA\xAA\x03\x00\x00\x00" +#define RFC1483_SNAP_IP_EXPECTED_LEN 6 + +#endif diff --git a/openflow/include/clicknet/tcp.h b/openflow/include/clicknet/tcp.h new file mode 100644 index 0000000..1fc175d --- /dev/null +++ b/openflow/include/clicknet/tcp.h @@ -0,0 +1,78 @@ +/* -*- c-basic-offset: 4 -*- */ +#ifndef CLICKNET_TCP_H +#define CLICKNET_TCP_H + +/* + * -- TCP header definitions, based on one of the BSDs. + * + * Relevant RFCs include: + * RFC793 Transmission Control Protocol + * RFC1323 TCP Extensions for High Performance + * RFC2018 TCP Selective Acknowledgement Options + * RFC2581 TCP Congestion Control + * RFC2883 An Extension to the Selective Acknowledgement (SACK) Option + * for TCP + * RFC3168 The Addition of Explicit Congestion Notification (ECN) to IP + * RFC3540 Robust Explicit Congestion Notification (ECN) Signaling with + * Nonces + * among many others. See "A Roadmap for TCP Specification Documents", + * currently an Internet-Draft. + */ + +typedef uint32_t tcp_seq_t; + +struct click_tcp { + uint16_t th_sport; /* 0-1 source port */ + uint16_t th_dport; /* 2-3 destination port */ + tcp_seq_t th_seq; /* 4-7 sequence number */ + tcp_seq_t th_ack; /* 8-11 acknowledgement number */ +#if CLICK_BYTE_ORDER == CLICK_LITTLE_ENDIAN + unsigned th_flags2 : 4; /* 12 more flags */ + unsigned th_off : 4; /* data offset in words */ +#elif CLICK_BYTE_ORDER == CLICK_BIG_ENDIAN + unsigned th_off : 4; /* 12 data offset in words */ + unsigned th_flags2 : 4; /* more flags */ +#else +# error "unknown byte order" +#endif +#define TH_NS 0x01 /* in 'th_flags2' */ + uint8_t th_flags; /* 13 flags */ +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 +#define TH_ECE 0x40 +#define TH_CWR 0x80 + uint16_t th_win; /* 14-15 window */ + uint16_t th_sum; /* 16-17 checksum */ + uint16_t th_urp; /* 18-19 urgent pointer */ +}; + +/* + * TCP sequence number comparisons + */ + +#define SEQ_LT(x,y) ((int)((x)-(y)) < 0) +#define SEQ_LEQ(x,y) ((int)((x)-(y)) <= 0) +#define SEQ_GT(x,y) ((int)((x)-(y)) > 0) +#define SEQ_GEQ(x,y) ((int)((x)-(y)) >= 0) + +/* + * TCP options + */ + +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 +#define TCPOLEN_MAXSEG 4 +#define TCPOPT_WSCALE 3 +#define TCPOLEN_WSCALE 3 +#define TCPOPT_SACK_PERMITTED 4 +#define TCPOLEN_SACK_PERMITTED 2 +#define TCPOPT_SACK 5 +#define TCPOPT_TIMESTAMP 8 +#define TCPOLEN_TIMESTAMP 10 + +#endif diff --git a/openflow/include/clicknet/udp.h b/openflow/include/clicknet/udp.h new file mode 100644 index 0000000..0082be7 --- /dev/null +++ b/openflow/include/clicknet/udp.h @@ -0,0 +1,18 @@ +#ifndef CLICKNET_UDP_H +#define CLICKNET_UDP_H + +/* + * -- UDP header definitions, based on one of the BSDs. + * + * Relevant RFCs include: + * RFC768 User Datagram Protocol + */ + +struct click_udp { + uint16_t uh_sport; /* 0-1 source port */ + uint16_t uh_dport; /* 2-3 destination port */ + uint16_t uh_ulen; /* 4-5 UDP length */ + uint16_t uh_sum; /* 6-7 checksum */ +}; + +#endif diff --git a/openflow/include/clicknet/wifi.h b/openflow/include/clicknet/wifi.h new file mode 100644 index 0000000..c6ca313 --- /dev/null +++ b/openflow/include/clicknet/wifi.h @@ -0,0 +1,409 @@ +/* + * - contains the definitions for 802.11 frames. + * It was originally taken from freebsd and modified for click use. + * John Bicket + */ + +/* $NetBSD: if_ieee80211.h,v 1.5 2000/07/21 04:47:40 onoe Exp $ */ +/* $FreeBSD: src/sys/net/if_ieee80211.h,v 1.3.2.3 2001/07/04 00:12:38 brooks Exp $ */ + +#ifndef _CLICKNET_WIFI_H_ +#define _CLICKNET_WIFI_H_ + + +#define WIFI_EXTRA_MAGIC 0x7492001 + +enum { + WIFI_EXTRA_TX = (1<<0), /* packet transmission */ + WIFI_EXTRA_TX_FAIL = (1<<1), /* transmission failed */ + WIFI_EXTRA_TX_USED_ALT_RATE = (1<<2), /* used alternate bitrate */ + WIFI_EXTRA_RX_ERR = (1<<3), /* failed crc check */ + WIFI_EXTRA_RX_MORE = (1<<4), /* first part of a fragmented skb */ + WIFI_EXTRA_NO_SEQ = (1<<5), + WIFI_EXTRA_NO_TXF = (1<<6), + WIFI_EXTRA_DO_RTS_CTS = (1<<7), + WIFI_EXTRA_DO_CTS = (1<<8), + WIFI_EXTRA_TX_NOACK = (1<<9) +}; + + + +struct click_wifi_extra { + uint32_t magic; + uint32_t flags; + + uint8_t rssi; + uint8_t silence; + uint8_t power; + uint8_t pad; + + uint8_t rate; /* bitrate in Mbps*2 */ + uint8_t rate1; /* bitrate in Mbps*2 */ + uint8_t rate2; /* bitrate in Mbps*2 */ + uint8_t rate3; /* bitrate in Mbps*2 */ + + uint8_t max_tries; + uint8_t max_tries1; + uint8_t max_tries2; + uint8_t max_tries3; + + uint8_t virt_col; + uint8_t retries; + uint16_t len; +} CLICK_SIZE_PACKED_ATTRIBUTE; + + +/* + * generic definitions for IEEE 802.11 frames + */ +#define WIFI_ADDR_LEN 6 + +struct click_wifi { + uint8_t i_fc[2]; + uint16_t i_dur; + uint8_t i_addr1[WIFI_ADDR_LEN]; + uint8_t i_addr2[WIFI_ADDR_LEN]; + uint8_t i_addr3[WIFI_ADDR_LEN]; + uint16_t i_seq; +} CLICK_SIZE_PACKED_ATTRIBUTE; + +#define WIFI_FC0_VERSION_MASK 0x03 +#define WIFI_FC0_VERSION_0 0x00 +#define WIFI_FC0_TYPE_MASK 0x0c +#define WIFI_FC0_TYPE_MGT 0x00 +#define WIFI_FC0_TYPE_CTL 0x04 +#define WIFI_FC0_TYPE_DATA 0x08 + +#define WIFI_FC0_SUBTYPE_MASK 0xf0 +/* for TYPE_MGT */ +#define WIFI_FC0_SUBTYPE_ASSOC_REQ 0x00 +#define WIFI_FC0_SUBTYPE_ASSOC_RESP 0x10 +#define WIFI_FC0_SUBTYPE_REASSOC_REQ 0x20 +#define WIFI_FC0_SUBTYPE_REASSOC_RESP 0x30 +#define WIFI_FC0_SUBTYPE_PROBE_REQ 0x40 +#define WIFI_FC0_SUBTYPE_PROBE_RESP 0x50 +#define WIFI_FC0_SUBTYPE_BEACON 0x80 +#define WIFI_FC0_SUBTYPE_ATIM 0x90 +#define WIFI_FC0_SUBTYPE_DISASSOC 0xa0 +#define WIFI_FC0_SUBTYPE_AUTH 0xb0 +#define WIFI_FC0_SUBTYPE_DEAUTH 0xc0 +/* for TYPE_CTL */ +#define WIFI_FC0_SUBTYPE_PS_POLL 0xa0 +#define WIFI_FC0_SUBTYPE_RTS 0xb0 +#define WIFI_FC0_SUBTYPE_CTS 0xc0 +#define WIFI_FC0_SUBTYPE_ACK 0xd0 +#define WIFI_FC0_SUBTYPE_CF_END 0xe0 +#define WIFI_FC0_SUBTYPE_CF_END_ACK 0xf0 +/* for TYPE_DATA (bit combination) */ +#define WIFI_FC0_SUBTYPE_DATA 0x00 +#define WIFI_FC0_SUBTYPE_CF_ACK 0x10 +#define WIFI_FC0_SUBTYPE_CF_POLL 0x20 +#define WIFI_FC0_SUBTYPE_CF_ACPL 0x30 +#define WIFI_FC0_SUBTYPE_NODATA 0x40 +#define WIFI_FC0_SUBTYPE_CFACK 0x50 +#define WIFI_FC0_SUBTYPE_CFPOLL 0x60 +#define WIFI_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70 +#define WIFI_FC0_SUBTYPE_QOS 0x80 +#define WIFI_FC0_SUBTYPE_QOS_NULL 0xc0 + + +#define WIFI_FC1_DIR_MASK 0x03 +#define WIFI_FC1_DIR_NODS 0x00 /* STA->STA */ +#define WIFI_FC1_DIR_TODS 0x01 /* STA->AP */ +#define WIFI_FC1_DIR_FROMDS 0x02 /* AP ->STA */ +#define WIFI_FC1_DIR_DSTODS 0x03 /* AP ->AP */ + +#define WIFI_FC1_MORE_FRAG 0x04 +#define WIFI_FC1_RETRY 0x08 +#define WIFI_FC1_PWR_MGT 0x10 +#define WIFI_FC1_MORE_DATA 0x20 +#define WIFI_FC1_WEP 0x40 +#define WIFI_FC1_ORDER 0x80 + +#define WIFI_NWID_LEN 32 + +/* + * BEACON management packets + * + * octect timestamp[8] + * octect beacon interval[2] + * octect capability information[2] + * information element + * octect elemid + * octect length + * octect information[length] + */ +typedef uint8_t * wifi_mgt_beacon_t; + +#define WIFI_BEACON_INTERVAL(beacon) \ + (beacon[8] + (beacon[9] << 8)) +#define WIFI_BEACON_CAPABILITY(beacon) \ + (beacon[10] + (beacon[11] << 8)) + +#define WIFI_CAPINFO_ESS 0x01 +#define WIFI_CAPINFO_IBSS 0x02 +#define WIFI_CAPINFO_CF_POLLABLE 0x04 +#define WIFI_CAPINFO_CF_POLLREQ 0x08 +#define WIFI_CAPINFO_PRIVACY 0x10 + + + +#define WIFI_MAX_RETRIES 11 + +#define WIFI_QOS_HAS_SEQ(wh) \ + (((wh)->i_fc[0] & \ + (WIFI_FC0_TYPE_MASK | WIFI_FC0_SUBTYPE_QOS)) == \ + (WIFI_FC0_TYPE_DATA | WIFI_FC0_SUBTYPE_QOS)) + + +/* + * Management information elements + */ +struct wifi_information { + char ssid[WIFI_NWID_LEN+1]; + struct rates { + uint8_t *p; + } rates; + struct fh { + uint16_t dwell; + uint8_t set; + uint8_t pattern; + uint8_t index; + } fh; + struct ds { + uint8_t channel; + } ds; + struct cf { + uint8_t count; + uint8_t period; + uint8_t maxdur[2]; + uint8_t dur[2]; + } cf; + struct tim { + uint8_t count; + uint8_t period; + uint8_t bitctl; + /* uint8_t pvt[251]; The driver never needs to use this */ + } tim; + struct ibss { + uint16_t atim; + } ibss; + struct challenge { + uint8_t *p; + uint8_t len; + } challenge; +}; + +#define WIFI_RATES_MAXSIZE 15 +#define WIFI_NWID_MAXSIZE 32 + +enum { + WIFI_ELEMID_SSID = 0, + WIFI_ELEMID_RATES = 1, + WIFI_ELEMID_FHPARMS = 2, + WIFI_ELEMID_DSPARMS = 3, + WIFI_ELEMID_CFPARMS = 4, + WIFI_ELEMID_TIM = 5, + WIFI_ELEMID_IBSSPARMS = 6, + WIFI_ELEMID_CHALLENGE = 16, + WIFI_ELEMID_ERP = 42, + WIFI_ELEMID_XRATES = 50, + WIFI_ELEMID_VENDOR = 221 +}; +/* + * AUTH management packets + * + * octect algo[2] + * octect seq[2] + * octect status[2] + * octect chal.id + * octect chal.length + * octect chal.text[253] + */ +typedef uint8_t * wifi_mgt_auth_t; + +#define WIFI_AUTH_ALGORITHM(auth) \ + (auth[0] + (auth[1] << 8)) +#define WIFI_AUTH_TRANSACTION(auth) \ + (auth[2] + (auth[3] << 8)) +#define WIFI_AUTH_STATUS(auth) \ + (auth[4] + (auth[5] << 8)) + +#define WIFI_AUTH_ALG_OPEN 0x0000 +#define WIFI_AUTH_ALG_SHARED 0x0001 + +#define WIFI_AUTH_OPEN_REQUEST 1 +#define WIFI_AUTH_OPEN_RESPONSE 2 + +#define WIFI_AUTH_SHARED_REQUEST 1 +#define WIFI_AUTH_SHARED_CHALLENGE 2 +#define WIFI_AUTH_SHARED_RESPONSE 3 +#define WIFI_AUTH_SHARED_PASS 4 + +/* + * Reason codes + * + * Unlisted codes are reserved + */ +#define WIFI_REASON_UNSPECIFIED 1 +#define WIFI_REASON_AUTH_EXPIRE 2 +#define WIFI_REASON_AUTH_LEAVE 3 +#define WIFI_REASON_ASSOC_EXPIRE 4 +#define WIFI_REASON_ASSOC_TOOMANY 5 +#define WIFI_REASON_NOT_AUTHED 6 +#define WIFI_REASON_NOT_ASSOCED 7 +#define WIFI_REASON_ASSOC_LEAVE 8 +#define WIFI_REASON_ASSOC_NOT_AUTHED 9 + +/* + * Status code + * + * Unlisted codes are reserved + */ +#define WIFI_STATUS_SUCCESS 0x0000 +#define WIFI_STATUS_UNSPECIFIED 1 +#define WIFI_STATUS_CAPINFO 10 +#define WIFI_STATUS_NOT_ASSOCED 11 +#define WIFI_STATUS_OTHER 12 +#define WIFI_STATUS_ALG 13 +#define WIFI_STATUS_SEQUENCE 14 +#define WIFI_STATUS_CHALLENGE 15 +#define WIFI_STATUS_TIMEOUT 16 +#define WIFI_STATUS_BASIC_RATES 18 +#define WIFI_STATUS_TOO_MANY_STATIONS 22 +#define WIFI_STATUS_RATES 23 +#define WIFI_STATUS_SHORTSLOT_REQUIRED 25 + + +#define WIFI_WEP_KEYLEN 5 /* 40bit */ +#define WIFI_WEP_IVLEN 3 /* 24bit */ +#define WIFI_WEP_KIDLEN 1 /* 1 octet */ +#define WIFI_WEP_CRCLEN 4 /* CRC-32 */ +#define WIFI_WEP_NKID 4 /* number of key ids */ + +#define WIFI_WEP_HEADERSIZE (WIFI_WEP_IVLEN + WIFI_WEP_KIDLEN) + + +#define WIFI_WEP_NOSUP -1 +#define WIFI_WEP_OFF 0 +#define WIFI_WEP_ON 1 +#define WIFI_WEP_MIXED 2 + +#define WIFI_AUTH_NONE 0 +#define WIFI_AUTH_OPEN 1 +#define WIFI_AUTH_SHARED 2 + +#define WIFI_POWERSAVE_NOSUP -1 +#define WIFI_POWERSAVE_OFF 0 +#define WIFI_POWERSAVE_CAM 1 +#define WIFI_POWERSAVE_PSP 2 +#define WIFI_POWERSAVE_PSP_CAM 3 +#define WIFI_POWERSAVE_ON WIFI_POWERSAVE_CAM + +#define WIFI_RATE_BASIC 0x80 +#define WIFI_RATE_VAL 0x7f + +#define WIFI_RATE_SIZE 0x08 + +#define WIFI_SEQ_FRAG_MASK 0x000f +#define WIFI_SEQ_FRAG_SHIFT 0 +#define WIFI_SEQ_SEQ_MASK 0xfff0 +#define WIFI_SEQ_SEQ_SHIFT 4 + + +/* + * 802.11 protocol crypto-related definitions. + */ +#define WIFI_KEYBUF_SIZE 16 +#define WIFI_MICBUF_SIZE (8+8) /* space for both tx+rx keys */ + + +#ifndef WIFI_MAX +#define WIFI_MAX(a, b) ((a) > (b) ? (a) : (b)) +#endif +#ifndef WIFI_MIN +#define WIFI_MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif + + + +/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header + * (from linux-wlan-ng) */ + +/* + * For packet capture, define the same physical layer packet header + * structure as used in the wlan-ng driver + */ +enum { + DIDmsg_lnxind_wlansniffrm = 0x00000044, + DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044, + DIDmsg_lnxind_wlansniffrm_mactime = 0x00020044, + DIDmsg_lnxind_wlansniffrm_channel = 0x00030044, + DIDmsg_lnxind_wlansniffrm_rssi = 0x00040044, + DIDmsg_lnxind_wlansniffrm_sq = 0x00050044, + DIDmsg_lnxind_wlansniffrm_signal = 0x00060044, + DIDmsg_lnxind_wlansniffrm_noise = 0x00070044, + DIDmsg_lnxind_wlansniffrm_rate = 0x00080044, + DIDmsg_lnxind_wlansniffrm_istx = 0x00090044, + DIDmsg_lnxind_wlansniffrm_frmlen = 0x000A0044 +}; +enum { + P80211ENUM_msgitem_status_no_value = 0x00 +}; +enum { + P80211ENUM_truth_false = 0x00 +}; + + +typedef struct { + uint32_t did; + uint16_t status; + uint16_t len; + uint32_t data; +} p80211item_uint32_t; + +typedef struct { + uint32_t msgcode; + uint32_t msglen; +#define WLAN_DEVNAMELEN_MAX 16 + uint8_t devname[WLAN_DEVNAMELEN_MAX]; + p80211item_uint32_t hosttime; + p80211item_uint32_t mactime; + p80211item_uint32_t channel; + p80211item_uint32_t rssi; + p80211item_uint32_t sq; + p80211item_uint32_t signal; + p80211item_uint32_t noise; + p80211item_uint32_t rate; + p80211item_uint32_t istx; + p80211item_uint32_t frmlen; +} wlan_ng_prism2_header; + + +#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */ +#define LWNG_CAPHDR_VERSION 0x80211001 + +#define WIFI_SLOT_B 20 +#define WIFI_DIFS_B 50 +#define WIFI_SIFS_B 10 +#define WIFI_ACK_B 304 +#define WIFI_PLCP_HEADER_LONG_B 192 +#define WIFI_PLCP_HEADER_SHORT_B 192 + +#define WIFI_SLOT_A 9 +#define WIFI_DIFS_A 28 +#define WIFI_SIFS_A 9 +#define WIFI_ACK_A 30 +#define WIFI_PLCP_HEADER_A 20 + + +#define is_b_rate(b) ((b == 2) || (b == 4) || (b == 11) || (b == 22)) + +#define WIFI_CW_MIN 31 +#define WIFI_CW_MAX 1023 + +// 6-byte LLC header (last byte is terminating NUL) +#define WIFI_LLC_HEADER ((const uint8_t *) "\xAA\xAA\x03\x00\x00") +#define WIFI_LLC_HEADER_LEN 6 + +#endif /* !_CLICKNET_WIFI_H_ */ diff --git a/openflow/include/clicktool/eclasst.hh b/openflow/include/clicktool/eclasst.hh new file mode 100644 index 0000000..841526f --- /dev/null +++ b/openflow/include/clicktool/eclasst.hh @@ -0,0 +1,228 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_ECLASST_HH +#define CLICK_ECLASST_HH +#include +#include +#include +#include +#include "elementmap.hh" +class ErrorHandler; +class StringAccum; +class RouterT; +class ElementT; +class VariableEnvironment; +class ElementMap; +class SynonymElementClassT; +class LandmarkT; + +class ElementClassT { public: + + ElementClassT(const String &name); + virtual ~ElementClassT(); + + static void set_base_type_factory(ElementClassT *(*factory)(const String &)); + static ElementClassT *base_type(const String &); + static ElementClassT *tunnel_type(); + + void use() { _use_count++; } + void unuse() { if (--_use_count <= 0) delete this; } + + const String &name() const { return _name; } + String printable_name() const { return _printable_name; } + const char *printable_name_c_str() const { return _printable_name.c_str(); } + void set_printable_name(const String &s) { _printable_name = s; } + virtual String landmark() const { return String(); } + + // 'primitive' means 'not tunnel, not compound, not synonym'. + virtual bool primitive() const { return true; } + virtual bool overloaded() const { return false; } + bool tunnel() const { return this == tunnel_type(); } + + ElementTraits &force_traits() const; + ElementTraits &force_traits(ElementMap *emap) const; + inline const ElementTraits &traits() const; + inline const ElementTraits &traits(ElementMap *emap) const; + virtual const ElementTraits *find_traits(ElementMap *emap) const; + + inline const String &port_count_code() const; + inline const String &processing_code() const; + inline bool requires(const String &) const; + inline bool provides(const String &) const; + const String &package() const; + const String &documentation_name() const; + String documentation_url() const; + + // where was this type declared? + virtual RouterT *declaration_scope() const; + virtual ElementClassT *overload_type() const; + + virtual void collect_types(HashTable &) const; + virtual void collect_overloads(Vector &) const; + + static ElementT *expand_element(ElementT *element, RouterT *dest, + const String &prefix, + const VariableEnvironment &env, + ErrorHandler *errh); + + virtual bool need_resolve() const; + + /** @brief Resolve an element declaration. + * @param ninputs number of inputs used + * @param noutputs number of outputs used + * @param[in,out] args configuration arguments + * @param errh error handler + * @param landmark landmark for errors + */ + virtual ElementClassT *resolve(int ninputs, int noutputs, + Vector &args, + ErrorHandler *errh, + const LandmarkT &landmark); + + /** @brief Create a new scope with the appropriate declarations. + * @param args configuration arguments + * @param scope original scope + * @param[out] new_scope new scope + * @pre &scope != &new_scope + * + * The new scope equals the old scope, possibly restricted according to + * lexical scoping, plus declarations for the configuration arguments. */ + virtual void create_scope(const Vector &args, + const VariableEnvironment &scope, + VariableEnvironment &new_scope); + + virtual ElementT *complex_expand_element(ElementT *element, + const Vector &conf, + RouterT *dest, + const String &prefix, + const VariableEnvironment &env, + ErrorHandler *errh); + + enum UnparseKind { UNPARSE_NAMED, UNPARSE_ANONYMOUS, UNPARSE_OVERLOAD }; + virtual void unparse_declaration(StringAccum &, const String &, UnparseKind, ElementClassT *stop); + virtual String unparse_signature() const; + static String unparse_signature(const String &name, const Vector *formal_types, int nargs, int ninputs, int noutputs); + + virtual void *cast(const char *) { return 0; } + virtual SynonymElementClassT *cast_synonym() { return 0; } + virtual RouterT *cast_router() { return 0; } + + private: + + String _name; + String _printable_name; + int _use_count; + + mutable int _traits_version; + mutable const ElementTraits *_traits; + + static ElementClassT *the_tunnel_type; + + ElementClassT(const ElementClassT &); + ElementClassT &operator=(const ElementClassT &); + + ElementT *direct_expand_element(ElementT *element, RouterT *dest, + const String &prefix, + const VariableEnvironment &env, + ErrorHandler *errh); + +}; + +class SynonymElementClassT : public ElementClassT { public: + + SynonymElementClassT(const String &, ElementClassT *, RouterT *); + + ElementClassT *synonym_of() const { return _eclass; } + + bool need_resolve() const; + ElementClassT *resolve(int, int, Vector &, ErrorHandler *, const LandmarkT &); + void create_scope(const Vector &, const VariableEnvironment &, VariableEnvironment &); + ElementT *complex_expand_element(ElementT *, const Vector &, RouterT *, const String &prefix, const VariableEnvironment &, ErrorHandler *); + + void collect_types(HashTable &) const; + void collect_overloads(Vector &) const; + + void unparse_declaration(StringAccum &, const String &, UnparseKind, ElementClassT *); + + bool primitive() const { return false; } + bool overloaded() const { return _eclass->overloaded(); } + const ElementTraits *find_traits(ElementMap *emap) const; + + RouterT *declaration_scope() const; + ElementClassT *overload_type() const { return _eclass; } + + SynonymElementClassT *cast_synonym() { return this; } + RouterT *cast_router(); + + private: + + ElementClassT *_eclass; + RouterT *_declaration_scope; + +}; + + +inline ElementClassT * +ElementClassT::tunnel_type() +{ + assert(the_tunnel_type); + return the_tunnel_type; +} + +inline const ElementTraits & +ElementClassT::traits(ElementMap *emap) const +{ + if (_traits_version != emap->version()) { + _traits = find_traits(emap); + _traits_version = emap->version(); + } + return *_traits; +} + +inline const ElementTraits & +ElementClassT::traits() const +{ + return traits(ElementMap::default_map()); +} + +inline ElementTraits & +ElementClassT::force_traits() const +{ + return force_traits(ElementMap::default_map()); +} + +inline const String & +ElementClassT::documentation_name() const +{ + return traits().documentation_name; +} + +inline const String & +ElementClassT::port_count_code() const +{ + return traits().port_count_code; +} + +inline const String & +ElementClassT::processing_code() const +{ + return traits().processing_code; +} + +inline bool +ElementClassT::requires(const String &req) const +{ + return traits().requires(req); +} + +inline bool +ElementClassT::provides(const String &req) const +{ + return traits().provides(req); +} + +template <> +inline size_t hashcode(const ElementClassT * const &e) { + return CLICK_NAME(hashcode)(static_cast(e)); +} + +#endif diff --git a/openflow/include/clicktool/elementmap.hh b/openflow/include/clicktool/elementmap.hh new file mode 100644 index 0000000..da486a5 --- /dev/null +++ b/openflow/include/clicktool/elementmap.hh @@ -0,0 +1,179 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_ELEMENTMAP_HH +#define CLICK_ELEMENTMAP_HH +#include "etraits.hh" +#include +class RouterT; +class ErrorHandler; + +class ElementMap { public: + + ElementMap(); + ElementMap(const String&, ErrorHandler* = 0); + ~ElementMap(); + + static ElementMap* default_map() { return the_element_map; } + static void push_default(ElementMap *emap); + static void pop_default(ElementMap *emap); + static void pop_default(); + + void use() { _use_count++; } + void unuse() { _use_count--; } + + int size() const { return _e.size(); } + bool empty() const { return _e.size() == 1; } + int32_t version() const { return _version; } + + Traits &force_traits(const String &class_name); + inline const Traits &traits(const String &class_name) const; + const Traits &traits_at(int i) const { return _e[i]; } + inline bool has_traits(const String &class_name) const; + inline int traits_index(const String &class_name) const; + + bool provides_global(const String&) const; + + int definition_index(int i) const { return _e[i].def_index; } + const String& source_directory(const Traits&) const; + const String& package(const Traits&) const; + const String& package(const String&) const; + String documentation_url(const Traits&) const; + + class TraitsIterator; + TraitsIterator begin_elements() const; + + int add(const Traits &traits); + void remove_at(int i); + + void parse(const String& data, ErrorHandler* = 0); + void parse(const String& data, const String& package_name, ErrorHandler* = 0); + void parse_xml(const String& data, const String& package_name, ErrorHandler*); + bool parse_default_file(const String& default_path, ErrorHandler* errh, bool verbose = false); + bool parse_package_file(const String& package_name, const RouterT* router, const String& default_path, ErrorHandler* errh, bool verbose = false); + bool parse_requirement_files(RouterT*, const String& default_path, ErrorHandler* errh, bool verbose = false); + bool parse_all_files(RouterT*, const String& default_path, ErrorHandler*); + static void report_file_not_found(String default_path, bool found_default, ErrorHandler*); + String unparse(const String& package = String()) const; + String unparse_nonxml() const; + + int check_completeness(const RouterT*, ErrorHandler*) const; + bool driver_indifferent(const RouterT*, int driver_mask = Driver::ALLMASK, ErrorHandler* = 0) const; + bool driver_compatible(const RouterT*, int driver, ErrorHandler* = 0) const; + + int provided_driver_mask() const { return _provided_driver_mask; } + int driver_mask() const { return _driver_mask; } + void set_driver(int d) { set_driver_mask(1 << d); } + void set_driver_mask(int mask); + int pick_driver(int wanted_driver, const RouterT* router, ErrorHandler* = 0) const; + + private: + + struct Globals { + String srcdir; + String compile_flags; + String package; + String dochref; + int driver_mask; + }; + + Vector _e; + HashTable _name_map; + + Vector _def; + + int _use_count; + int _driver_mask; + int _provided_driver_mask; + mutable int32_t _version; + + int get_driver_mask(const String&); + int driver_elt_index(int) const; + + void collect_indexes(const RouterT*, Vector&, ErrorHandler*) const; + int compatible_driver_mask(const RouterT*, ErrorHandler* = 0) const; + + static int32_t version_counter; + static ElementMap* the_element_map; + void incr_version() const; + + bool find_and_parse_package_file(const String& package_name, const RouterT* router, const String& default_path, ErrorHandler* errh, const String& filetype, bool verbose); + +}; + + +class ElementMap::TraitsIterator { public: + + TraitsIterator(const ElementMap*, bool elements_only); + + operator bool() { return _index < _emap->size(); } + void operator++(int); + + const ElementTraits& value() const { return _emap->traits_at(_index); } + int traits_index() const { return _index; } + + private: + + const ElementMap* _emap; + int _index; + bool _elements_only; + +}; + + +inline int +ElementMap::traits_index(const String &class_name) const +{ + int i = _name_map[class_name]; + if (!(_e[i].driver_mask & _driver_mask) && i > 0) + i = driver_elt_index(i); + return i; +} + +inline const Traits & +ElementMap::traits(const String &class_name) const +{ + return _e[traits_index(class_name)]; +} + +inline bool +ElementMap::has_traits(const String &class_name) const +{ + return traits_index(class_name) > 0; +} + +inline const String& +ElementMap::source_directory(const ElementTraits& t) const +{ + return _def[t.def_index].srcdir; +} + +inline const String& +ElementMap::package(const ElementTraits& t) const +{ + return _def[t.def_index].package; +} + +inline const String& +ElementMap::package(const String& name) const +{ + return package(traits(name)); +} + +inline void +ElementMap::incr_version() const +{ + _version = version_counter = (version_counter + 1) & 0x7FFFFFFF; +} + +inline bool +ElementMap::provides_global(const String& req) const +{ + return _e[0].provides(req); +} + +inline ElementMap::TraitsIterator +ElementMap::begin_elements() const +{ + return TraitsIterator(this, true); +} + +#endif diff --git a/openflow/include/clicktool/elementt.hh b/openflow/include/clicktool/elementt.hh new file mode 100644 index 0000000..6b0d2b9 --- /dev/null +++ b/openflow/include/clicktool/elementt.hh @@ -0,0 +1,313 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_ELEMENTT_HH +#define CLICK_ELEMENTT_HH +#include "eclasst.hh" +#include "landmarkt.hh" + +class ElementT { public: + + int flags; + + ElementT(); + ElementT(const String &name, ElementClassT *type, const String &config, const LandmarkT &landmark = LandmarkT::empty_landmark()); + ~ElementT(); + + RouterT *router() const { return _owner; } + int eindex() const { return _eindex; } + + bool live() const { return _type; } + bool dead() const { return !_type; } + void kill(); + + const String &name() const { return _name; } + const char *name_c_str() const { return _name.c_str(); } + bool name_unassigned() const { return _name && _name[0] == ';'; } + bool was_anonymous() const { return _was_anonymous; } + + ElementClassT *type() const { return _type; } + ElementClassT *resolve(const VariableEnvironment &env, + VariableEnvironment *new_env, + ErrorHandler *errh = 0) const; + ElementClassT *resolved_type(const VariableEnvironment &env, ErrorHandler *errh = 0) const; + + String type_name() const { return _type->name(); } + String printable_type_name() const { return _type->printable_name(); } + const char *type_name_c_str() const { return _type->printable_name_c_str(); } + + void set_type(ElementClassT *); + inline RouterT *resolved_router(const VariableEnvironment &env, ErrorHandler *errh = 0) const; + + inline const String &flow_code(ElementMap *emap) const; + inline const String &flow_code() const; + + const String &config() const { return _configuration; } + const String &configuration() const { return _configuration; } + inline void set_configuration(const String &s); + + const LandmarkT &landmarkt() const { return _landmark; } + String landmark() const { return _landmark.str(); } + String decorated_landmark() const { return _landmark.decorated_str(); } + void set_landmark(const LandmarkT &lm) { _landmark = lm; } + + inline bool tunnel() const; + inline bool tunnel_connected() const; + ElementT *tunnel_input() const { return _tunnel_input; } + ElementT *tunnel_output() const { return _tunnel_output; } + + int nports(bool isoutput) const { return isoutput ? _noutputs : _ninputs; } + int ninputs() const { return _ninputs; } + int noutputs() const { return _noutputs; } + + inline String declaration() const; + inline String reverse_declaration() const; + + void *user_data() const { return _user_data; } + void set_user_data(void *v) { _user_data = v; } + void set_user_data(intptr_t v) { _user_data = (void *)v; } + + static bool name_ok(const String &, bool allow_anon_names = false); + static void redeclaration_error(ErrorHandler *, const char *type, String name, const String &landmark, const String &old_landmark); + + private: + + int _eindex; + String _name; + ElementClassT *_type; + mutable ElementClassT *_resolved_type; + enum { resolved_type_error = 1, resolved_type_fragile = 2 }; + mutable short _resolved_type_status; + bool _was_anonymous; + String _configuration; + LandmarkT _landmark; + int _ninputs; + int _noutputs; + ElementT *_tunnel_input; + ElementT *_tunnel_output; + RouterT *_owner; + void *_user_data; + + ElementT(const ElementT &); + ElementT &operator=(const ElementT &); + + inline void semiresolve_type() const { + if (!_resolved_type && _type && _type->primitive()) { + _resolved_type = _type; + _resolved_type->use(); + } + } + inline void unresolve_type() { + if (_resolved_type) { + _resolved_type->unuse(); + _resolved_type = 0; + } + } + inline void set_ninputs(int n) { + unresolve_type(); + _ninputs = n; + } + inline void set_noutputs(int n) { + unresolve_type(); + _noutputs = n; + } + + friend class RouterT; + +}; + +struct PortT { + + ElementT *element; + int port; + + PortT() : element(0), port(-1) { } + PortT(ElementT *e, int p) : element(e), port(p) { } + + static const PortT null_port; + + typedef bool (PortT::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const { + return element != 0 ? &PortT::live : 0; + } + + bool live() const { return element != 0; } + bool dead() const { return element == 0; } + RouterT *router() const { return (element ? element->router() : 0); } + + int eindex() const { return (element ? element->eindex() : -1); } + + int index_in(const Vector &, int start = 0) const; + int force_index_in(Vector &, int start = 0) const; + + String unparse(bool isoutput, bool with_class = false) const; + String unparse_input(bool with_class = false) const { + return unparse(false, with_class); + } + String unparse_output(bool with_class = false) const { + return unparse(true, with_class); + } + + static void sort(Vector &); + +}; + +class ConnectionT { public: + + inline ConnectionT(); + ConnectionT(const PortT &from, const PortT &to, + const LandmarkT &landmark = LandmarkT::empty_landmark()); + + typedef PortT::unspecified_bool_type unspecified_bool_type; + inline operator unspecified_bool_type() const; + + enum { end_to = 0, end_from = 1 }; + + bool live() const { return _end[end_from].live(); } + bool dead() const { return _end[end_from].dead(); } + + RouterT *router() const { return _end[end_to].router(); } + + const PortT &end(bool isoutput) const { + return _end[isoutput]; + } + ElementT *element(bool isoutput) const { + return _end[isoutput].element; + } + int eindex(bool isoutput) const { + return _end[isoutput].eindex(); + } + int port(bool isoutput) const { + return _end[isoutput].port; + } + + const PortT &from() const { return end(end_from); } + const PortT &to() const { return end(end_to); } + ElementT *from_element() const { return element(end_from); } + int from_eindex() const { return eindex(end_from); } + int from_port() const { return port(end_from); } + ElementT *to_element() const { return element(end_to); } + int to_eindex() const { return eindex(end_to); } + int to_port() const { return port(end_to); } + String landmark() const { return _landmark.str(); } + String decorated_landmark() const { return _landmark.decorated_str(); } + const LandmarkT &landmarkt() const { return _landmark; } + + String unparse(bool with_class = false) const; + String unparse_end(bool isoutput, bool with_class = false) const { + return end(isoutput).unparse(isoutput, with_class); + } + + private: + + PortT _end[2]; + LandmarkT _landmark; + + friend class RouterT; + +}; + + +inline RouterT * +ElementT::resolved_router(const VariableEnvironment &env, ErrorHandler *errh) const +{ + if (ElementClassT *t = resolved_type(env, errh)) + return t->cast_router(); + else + return 0; +} + +inline void +ElementT::set_configuration(const String &configuration) +{ + _configuration = configuration; + unresolve_type(); +} + +inline String +ElementT::declaration() const +{ + assert(_type); + return _name + " :: " + _type->printable_name(); +} + +inline String +ElementT::reverse_declaration() const +{ + assert(_type); + return _type->printable_name() + " " + _name; +} + +inline bool +ElementT::tunnel() const +{ + return _type == ElementClassT::tunnel_type(); +} + +inline bool +ElementT::tunnel_connected() const +{ + return _tunnel_input || _tunnel_output; +} + +inline const String & +ElementT::flow_code(ElementMap *emap) const +{ + semiresolve_type(); + return _resolved_type->traits(emap).flow_code; +} + +inline const String & +ElementT::flow_code() const +{ + semiresolve_type(); + return _resolved_type->traits(ElementMap::default_map()).flow_code; +} + +inline bool +operator==(const PortT &h1, const PortT &h2) +{ + return h1.element == h2.element && h1.port == h2.port; +} + +inline bool +operator!=(const PortT &h1, const PortT &h2) +{ + return h1.element != h2.element || h1.port != h2.port; +} + +inline bool +operator<(const PortT &h1, const PortT &h2) +{ + return h1.eindex() < h2.eindex() || (h1.element == h2.element && h1.port < h2.port); +} + +inline bool +operator>(const PortT &h1, const PortT &h2) +{ + return h1.eindex() > h2.eindex() || (h1.element == h2.element && h1.port > h2.port); +} + +inline bool +operator<=(const PortT &h1, const PortT &h2) +{ + return h1.eindex() < h2.eindex() || (h1.element == h2.element && h1.port <= h2.port); +} + +inline bool +operator>=(const PortT &h1, const PortT &h2) +{ + return h1.eindex() > h2.eindex() || (h1.element == h2.element && h1.port >= h2.port); +} + +inline +ConnectionT::ConnectionT() +{ +} + +inline +ConnectionT::operator unspecified_bool_type() const +{ + return (unspecified_bool_type) _end[end_from]; +} + +#endif diff --git a/openflow/include/clicktool/etraits.hh b/openflow/include/clicktool/etraits.hh new file mode 100644 index 0000000..9baa19b --- /dev/null +++ b/openflow/include/clicktool/etraits.hh @@ -0,0 +1,94 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_ETRAITS_HH +#define CLICK_ETRAITS_HH +#include + +struct Driver { + enum { + USERLEVEL = 0, LINUXMODULE = 1, BSDMODULE = 2, NSMODULE = 3, + ALLMASK = 0xF, COUNT = 4, MULTITHREAD = COUNT + }; + static const char *name(int); + static const char *multithread_name(int); + static const char *requirement(int); + static int driver(const String&); + static int driver_mask(const String&); +}; + + +struct ElementTraits { + + String name; + String cxx; + String documentation_name; + String header_file; + String source_file; + String port_count_code; + String processing_code; + String flow_code; + String flags; + String methods; + String requirements; + String provisions; + String libs; + String noexport; + int def_index; + int driver_mask; + int name_next; + + ElementTraits(); + + static const ElementTraits &null_traits() { return the_null_traits; } + + bool allows_driver(int d) const { return (driver_mask&(1< +#include +class LandmarkSetT; + +class LandmarkT { public: + + inline LandmarkT(); + inline LandmarkT(const String &filename, unsigned lineno); + //inline LandmarkT(LandmarkSetT *lset, unsigned offset); + inline LandmarkT(LandmarkSetT *lset, unsigned offset1, unsigned offset2); + inline LandmarkT(const LandmarkT &o); + inline ~LandmarkT(); + + static void static_initialize(); + + static const LandmarkT &empty_landmark(); + + typedef String (LandmarkT::*unspecified_bool_type)() const; + inline operator unspecified_bool_type() const; + + String str() const; + operator String() const; + String decorated_str() const; + + unsigned offset1() const { return _offset1; } + unsigned offset2() const { return _offset2; } + + inline LandmarkT &operator=(const LandmarkT &o); + + enum { noffset = (unsigned) -1 }; + + private: + + LandmarkSetT *_lset; + unsigned _offset1; + unsigned _offset2; + + static LandmarkT *empty; + +}; + +class LandmarkSetT { public: + + LandmarkSetT(); + LandmarkSetT(const String &filename, unsigned lineno); + + inline void ref(); + inline void unref(); + + String offset_to_string(unsigned offset) const; + String offset_to_decorated_string(unsigned offset1, unsigned offset2) const; + void new_line(unsigned offset, const String &filename, unsigned lineno); + + struct LandmarkInfo { + unsigned end_offset; + int filename; + unsigned lineno; + + LandmarkInfo(unsigned o, int f, unsigned l) + : end_offset(o), filename(f), lineno(l) { + } + }; + + private: + + int _refcount; + Vector _linfo; + Vector _fnames; + + LandmarkSetT(const LandmarkSetT &); + ~LandmarkSetT(); + LandmarkSetT &operator=(const LandmarkSetT &); + + static LandmarkSetT *the_empty_set; + friend class LandmarkT; + +}; + +inline void +LandmarkSetT::ref() +{ + assert(_refcount >= 1); + ++_refcount; +} + +inline void +LandmarkSetT::unref() +{ + assert(_refcount >= 1); + if (--_refcount == 0) + delete this; +} + +inline +LandmarkT::LandmarkT() + : _lset(empty->_lset), _offset1(noffset), _offset2(noffset) +{ + _lset->ref(); +} + +inline +LandmarkT::LandmarkT(const String &filename, unsigned lineno = 0) + : _lset(new LandmarkSetT(filename, lineno)), _offset1(noffset), _offset2(noffset) +{ +} + +#if 0 +inline +LandmarkT::LandmarkT(LandmarkSetT *lset, unsigned offset) + : _lset(lset), _offset1(offset), _offset2(offset) +{ + _lset->ref(); +} +#endif + +inline +LandmarkT::LandmarkT(LandmarkSetT *lset, unsigned offset1, unsigned offset2) + : _lset(lset), _offset1(offset1), _offset2(offset2) +{ + _lset->ref(); +} + +inline +LandmarkT::LandmarkT(const LandmarkT &lm) + : _lset(lm._lset), _offset1(lm._offset1), _offset2(lm._offset2) +{ + _lset->ref(); +} + +inline +LandmarkT::~LandmarkT() +{ + _lset->unref(); +} + +inline const LandmarkT & +LandmarkT::empty_landmark() +{ + assert(empty); + return *empty; +} + +inline LandmarkT & +LandmarkT::operator=(const LandmarkT &lm) +{ + lm._lset->ref(); + _lset->unref(); + _lset = lm._lset; + _offset1 = lm._offset1; + _offset2 = lm._offset2; + return *this; +} + +inline +LandmarkT::operator unspecified_bool_type() const +{ + return _lset != empty->_lset ? &LandmarkT::str : 0; +} + +inline String +LandmarkT::str() const +{ + return _lset->offset_to_string(_offset1); +} + +inline +LandmarkT::operator String() const +{ + return _lset->offset_to_string(_offset1); +} + +inline String +LandmarkT::decorated_str() const +{ + return _lset->offset_to_decorated_string(_offset1, _offset2); +} + +#endif diff --git a/openflow/include/clicktool/lexert.hh b/openflow/include/clicktool/lexert.hh new file mode 100644 index 0000000..1cb5755 --- /dev/null +++ b/openflow/include/clicktool/lexert.hh @@ -0,0 +1,207 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_LEXERT_HH +#define CLICK_LEXERT_HH +#include +#include +#include +#include "landmarkt.hh" +#include +class RouterT; +class ElementClassT; +class StringAccum; +class LexerTInfo; +class VariableEnvironment; +struct ArchiveElement; + +enum { + lexEOF = 0, + lexIdent = 256, // see also LexerT::lexeme_string + lexVariable, + lexConfig, + lexArrow, + lex2Arrow, + lex2Colon, + lex2Bar, + lex3Dot, + lexElementclass, + lexRequire, + lexProvide, + lexDefine +}; + +class Lexeme { public: + + Lexeme() : _kind(lexEOF), _pos(0) { } + Lexeme(int k, const String &s, const char *p) : _kind(k), _s(s), _pos(p) { } + + int kind() const { return _kind; } + bool is(int k) const { return _kind == k; } + operator bool() const { return _kind != lexEOF; } + + const String &string() const { return _s; } + String &string() { return _s; } + + const char *pos1() const { return _pos; } + const char *pos2() const { return _pos + _s.length(); } + + private: + + int _kind; + String _s; + const char *_pos; + +}; + +class LexerT { public: + + LexerT(ErrorHandler *, bool ignore_line_directives); + virtual ~LexerT(); + + void reset(const String &data, const Vector &archive, const String &filename); + void clear(); + void set_lexinfo(LexerTInfo *); + void ignore_line_directives(bool x) { _ignore_line_directives = x; } + void expand_groups(bool x) { _expand_groups = x; } + + String remaining_text() const; + void set_remaining_text(const String &); + + Lexeme lex() { + return _unlex_pos ? _unlex[--_unlex_pos] : next_lexeme(); + } + void unlex(const Lexeme &t) { + assert(_unlex_pos < UNLEX_SIZE); + _unlex[_unlex_pos++] = t; + } + Lexeme lex_config() { + assert(!_unlex_pos); + return _file.lex_config(this); + } + String landmark() const; + inline LandmarkT landmarkt(const char *pos1, const char *pos2) const; + + bool yport(Vector &ports, const char *pos[2]); + bool yelement(Vector &result, bool in_allowed, const char *epos[5]); + bool yconnection(); + void ycompound_arguments(RouterT *); + void yelementclass(const char *pos1); + ElementClassT *ycompound(String, const char *decl_pos1, const char *name_pos1); + void ygroup(String name, int group_nports[2], const char *open_pos1, const char *open_pos2); + void yrequire(); + void yvar(); + bool ystatement(int nested = 0); + + RouterT *router() const { return _router; } + RouterT *finish(const VariableEnvironment &global_scope); + + protected: + + struct FileState { + String _big_string; + const char *_end; + const char *_pos; + String _filename; + String _original_filename; + unsigned _lineno; + LandmarkSetT *_lset; + + FileState(const String &text, const String &filename); + FileState(const FileState &x) + : _big_string(x._big_string), _end(x._end), _pos(x._pos), + _filename(x._filename), _original_filename(x._original_filename), + _lineno(x._lineno), _lset(x._lset) { + _lset->ref(); + } + ~FileState() { + _lset->unref(); + } + FileState &operator=(const FileState &x); + const char *skip_line(const char *s); + const char *skip_slash_star(const char *s); + const char *skip_backslash_angle(const char *s); + const char *skip_quote(const char *s, char end_c); + const char *process_line_directive(const char *s, LexerT *lexer); + Lexeme next_lexeme(LexerT *lexer); + Lexeme lex_config(LexerT *lexer); + String landmark() const; + unsigned offset(const char *s) const { + assert(s >= _big_string.begin() && s <= _end); + return s - _big_string.begin(); + } + LandmarkT landmarkt(const char *pos1, const char *pos2) const { + return LandmarkT(_lset, offset(pos1), offset(pos2)); + } + }; + + // lexer + FileState _file; + bool _ignore_line_directives; + bool _expand_groups; + + bool get_data(); + Lexeme next_lexeme() { + return _file.next_lexeme(this); + } + static String lexeme_string(int); + + // parser + enum { UNLEX_SIZE = 2 }; + Lexeme _unlex[UNLEX_SIZE]; + int _unlex_pos; + + // router + RouterT *_router; + + int _anonymous_offset; + int _anonymous_class_count; + int _group_depth; + int _ngroups; + bool _last_connection_ends_output; + + Vector _libraries; + + // what names represent types? (builds up linearly) + HashTable _base_type_map; + + // errors + LexerTInfo *_lexinfo; + ErrorHandler *_errh; + + void xlerror(const char *pos1, const char *pos2, const String &landmark, + const char *anno, const char *format, va_list val); + int lerror(const char *pos1, const char *pos2, const char *format, ...); + int lerror(const Lexeme &t, const char *format, ...); + int lwarning(const Lexeme &t, const char *format, ...); + String anon_element_name(const String &) const; + + bool expect(int, bool no_error = false); + const char *next_pos() const { + return _unlex_pos ? _unlex[_unlex_pos - 1].pos1() : _file._pos; + } + + ElementClassT *element_type(const Lexeme &) const; + ElementClassT *force_element_type(const Lexeme &); + void ydefine(RouterT *, const String &name, const String &value, const Lexeme &, bool &scope_order_error); + void yrequire_library(const Lexeme &lexeme, const String &value); + void yconnection_check_useless(const Vector &x, bool isoutput, const char *epos[2], bool done); + static void yconnection_analyze_ports(const Vector &x, bool isoutput, + int &min_ports, int &expandable); + void yconnection_connect_all(Vector &outputs, Vector &inputs, int connector, const char *pos1, const char *pos2); + + LexerT(const LexerT &); + LexerT &operator=(const LexerT &); + int make_element(String, const Lexeme &, const char *decl_pos2, ElementClassT *, const String &); + int make_anon_element(const Lexeme &, const char *decl_pos2, ElementClassT *, const String &); + void connect(int f1, int p1, int p2, int f2, const char *pos1, const char *pos2); + + friend struct FileState; + +}; + +inline LandmarkT +LexerT::landmarkt(const char *pos1, const char *pos2) const +{ + return _file.landmarkt(pos1, pos2); +} + +#endif diff --git a/openflow/include/clicktool/lexertinfo.hh b/openflow/include/clicktool/lexertinfo.hh new file mode 100644 index 0000000..8413710 --- /dev/null +++ b/openflow/include/clicktool/lexertinfo.hh @@ -0,0 +1,29 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_LEXERTINFO_HH +#define CLICK_LEXERTINFO_HH +#include "lexert.hh" +class ElementT; +class ElementClassT; + +class LexerTInfo { public: + + LexerTInfo() { } + virtual ~LexerTInfo() { } + + virtual void notify_comment(const char *pos1, const char *pos2); + virtual void notify_error(const String &message, const char *pos1, const char *pos2); + virtual void notify_line_directive(const char *pos1, const char *pos2); + virtual void notify_keyword(const String &keyword, const char *pos1, const char *pos2); + virtual void notify_config_string(const char *pos1, const char *pos2); + virtual void notify_class_declaration(ElementClassT *, bool anonymous, + const char *pos1, const char *name_pos1, const char *pos2); + virtual void notify_class_extension(ElementClassT *, const char *pos1, const char *pos2); + virtual void notify_class_reference(ElementClassT *, const char *pos1, const char *pos2); + virtual void notify_element_declaration( + ElementT *e, const char *pos1, const char *name_pos2, const char *decl_pos2); + virtual void notify_element_reference( + ElementT *e, const char *pos1, const char *pos2); + +}; + +#endif diff --git a/openflow/include/clicktool/processingt.hh b/openflow/include/clicktool/processingt.hh new file mode 100644 index 0000000..ad33d73 --- /dev/null +++ b/openflow/include/clicktool/processingt.hh @@ -0,0 +1,260 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_PROCESSINGT_HH +#define CLICK_PROCESSINGT_HH +#include "routert.hh" +class ElementMap; +class Bitvector; + +class ProcessingT { public: + + enum { + end_to = ConnectionT::end_to, + end_from = ConnectionT::end_from + }; + + enum ProcessingCode { + ppush = 1, ppull = 2, pagnostic = 4, perror = 8 + }; + static const char processing_letters[]; + static const char decorated_processing_letters[]; + + ProcessingT(bool resolve_agnostics, RouterT *router, ElementMap *emap, + ErrorHandler *errh = 0); + ProcessingT(RouterT *router, ElementMap *emap, ErrorHandler *errh = 0); + ProcessingT(const ProcessingT &processing, ElementT *element, + ErrorHandler *errh = 0); + void check_types(ErrorHandler *errh = 0); + + RouterT *router() const { + return _router; + } + const VariableEnvironment &scope() const { + return _scope; + } + int nelements() const { + return _pidx[end_to].size() - 1; + } + int npidx(bool isoutput) const { + return _pidx[isoutput].back(); + } + ElementMap *element_map() const { + return _element_map; + } + + int pidx(int eindex, int port, bool isoutput) const { + return _pidx[isoutput][eindex] + port; + } + int pidx(const PortT &port, bool isoutput) const { + assert(port.router() == _router); + return pidx(port.eindex(), port.port, isoutput); + } + int pidx(const ConnectionT &conn, bool isoutput) const { + return pidx(conn.end(isoutput), isoutput); + } + + PortT port(int pidx, bool isoutput) const { + const ElementT *e = _elt[isoutput][pidx]; + return PortT(const_cast(e), pidx - _pidx[isoutput][e->eindex()]); + } + + int ninput_pidx() const { + return npidx(end_to); + } + int input_pidx(int eindex, int port = 0) const { + return pidx(eindex, port, end_to); + } + int input_pidx(const PortT &port) const { + return pidx(port, end_to); + } + int input_pidx(const ConnectionT &conn) const { + return pidx(conn, end_to); + } + PortT input_port(int pidx) const { + return port(pidx, end_to); + } + + int noutput_pidx() const { + return npidx(end_from); + } + int output_pidx(int eindex, int port = 0) const { + return pidx(eindex, port, end_from); + } + int output_pidx(const PortT &port) const { + return pidx(port, end_from); + } + int output_pidx(const ConnectionT &conn) const { + return pidx(conn, end_from); + } + PortT output_port(int pidx) const { + return port(pidx, end_from); + } + + const String &flow_code(ElementT *e) const { + if (_flow_overrides.size()) + if (const String &fc = _flow_overrides.get(e->name())) + return fc; + return e->flow_code(_element_map); + } + + int input_processing(const PortT &port) const; + int output_processing(const PortT &port) const; + char decorated_input_processing_letter(const PortT &port) const; + char decorated_output_processing_letter(const PortT &port) const; + int input_processing(int eindex, int port) const; + int output_processing(int eindex, int port) const; + + bool input_is_pull(int eindex, int port) const; + bool output_is_push(int eindex, int port) const; + + bool processing_error(int pidx, bool isoutput) const { + return _processing[isoutput][pidx] & perror; + } + + bool same_processing(int a_eindex, int b_eindex) const; + + String processing_code(const ElementT *element) const; + String decorated_processing_code(const ElementT *element) const; + + static const char *processing_code_next(const char *pos, const char *end_code, int &processing); + static const char *processing_code_output(const char *code, const char *end_code, const char *pos = 0); + static String processing_code_reverse(const String &pcode); + + /** @brief Set @a x to those ports reachable from @a port in @a code. + * @param code flow code + * @param port port number + * @param isoutput whether @a port is an output port + * @param[out] x output bitvector + * @param size size of @a x (number of !@a isoutput ports) + * @param errh error handler + * @return 0 on success, -1 if @a code is invalid + * + * On return, @a x.size() == @a size, and @a x[@em i] is true if and only + * if @a code indicates flow between port @a port and port @em i. If @a + * port < 0, then @a x is all false. + * + * For example, if @a code is @c "x/x", then @a x is all true. + */ + static int code_flow(const String &code, int port, bool isoutput, Bitvector *x, int size, ErrorHandler *errh = 0); + int port_flow(const PortT &port, bool isoutput, Bitvector *x, ErrorHandler *errh = 0) const { + return code_flow(flow_code(port.element), port.port, isoutput, + x, port.element->nports(!isoutput), errh); + } + + static int forward_flow(const String &code, int input_port, Bitvector *x, int noutputs, ErrorHandler *errh = 0) { + return code_flow(code, input_port, false, x, noutputs, errh); + } + int forward_flow(const PortT &port, Bitvector *x, ErrorHandler *errh = 0) { + return port_flow(port, false, x, errh); + } + static int backward_flow(const String &code, int output_port, Bitvector *x, int ninputs, ErrorHandler *errh = 0) { + return code_flow(code, output_port, true, x, ninputs, errh); + } + int backward_flow(const PortT &port, Bitvector *x, ErrorHandler *errh = 0) { + return port_flow(port, true, x, errh); + } + + /** @brief Set bits in @a sink that are connected to ports in @a source. + * @param source source ports + * @param source_isoutput whether @a source represents output ports + * @param[out] sink sink ports (input if @a source_isoutput, and vice versa) + */ + void follow_connections(const Bitvector &source, bool source_isoutput, Bitvector &sink) const; + void follow_connections(const PortT &source, bool source_isoutput, Bitvector &sink) const; + void follow_flow(const Bitvector &source, bool source_isoutput, Bitvector &sink, ErrorHandler *errh = 0) const; + void follow_reachable(Bitvector &ports, bool isoutput, bool forward, ErrorHandler *errh = 0, ErrorHandler *debug_errh = 0) const; + + String compound_port_count_code() const; + String compound_processing_code() const; + String compound_flow_code(ErrorHandler *errh = 0) const; + + private: + + RouterT *_router; + String _router_name; + ElementMap *_element_map; + VariableEnvironment _scope; + HashTable _flow_overrides; + + Vector _pidx[2]; + Vector _elt[2]; + Vector _processing[2]; + bool _pidx_created; + + enum { classwarn_unknown = 1, classwarn_pcode = 2 }; + HashTable _class_warnings; + + void parse_flow_info(ElementT *e, ErrorHandler *errh); + void create_pidx(ErrorHandler *errh); + void create(const String &compound_pcode, bool resolve_agnostics, ErrorHandler *errh); + + void initial_processing_for(int, const String &compound_pcode, ErrorHandler *); + void initial_processing(const String &compound_pcode, ErrorHandler *); + void processing_error(const ConnectionT &, int, ErrorHandler *); + void check_processing(Vector &conn, Bitvector &invalid_conn, ErrorHandler *errh); + void check_connections(Vector &conn, Bitvector &invalid_conn, ErrorHandler *errh); + void check_nports(Vector &conn, const ElementT *, const int *, const int *, ErrorHandler *); + void resolve_agnostics(); // change remaining AGNOSTICs to PUSH + void debug_print_pidxes(const Bitvector &ports, bool isoutput, const String &prefix, ErrorHandler *debug_errh) const; + +}; + + +inline int +ProcessingT::input_processing(const PortT &h) const +{ + return _processing[end_to][input_pidx(h)] & 3; +} + +inline int +ProcessingT::output_processing(const PortT &h) const +{ + return _processing[end_from][output_pidx(h)] & 3; +} + +inline char +ProcessingT::decorated_input_processing_letter(const PortT &h) const +{ + return decorated_processing_letters[_processing[end_to][input_pidx(h)] & 7]; +} + +inline char +ProcessingT::decorated_output_processing_letter(const PortT &h) const +{ + return decorated_processing_letters[_processing[end_from][output_pidx(h)] & 7]; +} + +inline int +ProcessingT::input_processing(int i, int p) const +{ + return _processing[end_to][input_pidx(i, p)] & 3; +} + +inline int +ProcessingT::output_processing(int i, int p) const +{ + return _processing[end_from][output_pidx(i, p)] & 3; +} + +inline bool +ProcessingT::input_is_pull(int i, int p) const +{ + return _processing[end_to][input_pidx(i, p)] & ppull; +} + +inline bool +ProcessingT::output_is_push(int i, int p) const +{ + return _processing[end_from][output_pidx(i, p)] & ppush; +} + +inline const char * +ProcessingT::processing_code_output(const char *code, const char *end_code, const char *pos) +{ + if (!pos) + pos = code; + while (pos < end_code && *pos != '/') + pos++; + return (pos == end_code ? code : pos + 1); +} + +#endif diff --git a/openflow/include/clicktool/routert.hh b/openflow/include/clicktool/routert.hh new file mode 100644 index 0000000..b558968 --- /dev/null +++ b/openflow/include/clicktool/routert.hh @@ -0,0 +1,672 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_ROUTERT_HH +#define CLICK_ROUTERT_HH +#include "elementt.hh" +#include "eclasst.hh" +#include +#include +#include +#include +typedef HashTable StringMap; + +class RouterT : public ElementClassT { public: + + RouterT(); + RouterT(const String &name, const LandmarkT &landmark, RouterT *declaration_scope = 0); + virtual ~RouterT(); + + // ELEMENTS + int nelements() const { return _elements.size(); } + int n_live_elements() const { return _n_live_elements; } + + inline const ElementT *element(const String &) const; + inline ElementT *element(const String &); + int eindex(const String &name) const { return _element_name_map[name]; } + + const ElementT *element(int i) const{ return _elements[i]; } + ElementT *element(int i) { return _elements[i]; } + + class iterator; + class const_iterator; + class type_iterator; + class const_type_iterator; + inline iterator begin_elements(); + inline const_iterator begin_elements() const; + inline type_iterator begin_elements(ElementClassT *); + inline const_type_iterator begin_elements(ElementClassT *) const; + inline iterator end_elements(); + inline const_iterator end_elements() const; + + bool elive(int i) const { return _elements[i]->live(); } + bool edead(int i) const { return _elements[i]->dead(); } + inline String ename(int) const; + inline ElementClassT *etype(int) const; + inline String etype_name(int) const; + + ElementT *get_element(const String &name, ElementClassT *eclass, const String &configuration, const LandmarkT &landmark); + ElementT *add_anon_element(ElementClassT *eclass, const String &configuration = String(), const LandmarkT &landmark = LandmarkT::empty_landmark()); + void change_ename(int, const String &); + int __map_element_name(const String &name, int new_eindex); + void assign_element_names(); + void free_element(ElementT *); + void free_dead_elements(); + + void set_new_eindex_collector(Vector *v) { _new_eindex_collector=v; } + + // TYPES + ElementClassT *locally_declared_type(const String &) const; + inline ElementClassT *declared_type(const String &) const; + void add_declared_type(ElementClassT *, bool anonymous); + + void collect_types(HashTable &) const; + void collect_locally_declared_types(Vector &) const; + void collect_overloads(Vector &) const; + + // CONNECTIONS + enum { end_to = ConnectionT::end_to, end_from = ConnectionT::end_from }; + + class conn_iterator; + inline conn_iterator begin_connections() const; + inline conn_iterator end_connections() const; + + conn_iterator find_connections_touching(int eindex, int port, bool isoutput) const; + inline conn_iterator find_connections_touching(const PortT &port, bool isoutput) const; + inline conn_iterator find_connections_touching(ElementT *e, bool isoutput) const; + inline conn_iterator find_connections_touching(ElementT *e, int port, bool isoutput) const; + + inline conn_iterator find_connections_from(const PortT &port) const; + inline conn_iterator find_connections_from(ElementT *e) const; + inline conn_iterator find_connections_from(ElementT *e, int port) const; + inline conn_iterator find_connections_to(const PortT &port) const; + inline conn_iterator find_connections_to(ElementT *e) const; + inline conn_iterator find_connections_to(ElementT *e, int port) const; + + bool has_connection(const PortT &from, const PortT &to) const; + + void find_connections_touching(const PortT &port, bool isoutput, Vector &v, bool clear = true) const; + inline void find_connections_from(const PortT &output, Vector &v, bool clear = true) const { + find_connections_touching(output, end_from, v, clear); + } + void find_connections_to(const PortT &input, Vector &v) const { + find_connections_touching(input, end_to, v); + } + + void find_connection_vector_touching(const ElementT *e, bool isoutput, Vector &x) const; + inline void find_connection_vector_from(const ElementT *e, Vector &x) const { + find_connection_vector_touching(e, end_from, x); + } + inline void find_connection_vector_to(const ElementT *e, Vector &x) const { + find_connection_vector_touching(e, end_to, x); + } + + void add_tunnel(const String &namein, const String &nameout, const LandmarkT &landmark, ErrorHandler *errh); + + bool add_connection(const PortT &, const PortT &, const LandmarkT &landmark = LandmarkT::empty_landmark()); + inline bool add_connection(ElementT *, int, ElementT *, int, const LandmarkT &landmark = LandmarkT::empty_landmark()); + conn_iterator erase(conn_iterator it); + void kill_bad_connections(); + + conn_iterator change_connection_to(conn_iterator it, PortT new_to); + conn_iterator change_connection_from(conn_iterator it, PortT new_from); + + bool insert_before(const PortT &, const PortT &); + bool insert_after(const PortT &, const PortT &); + inline bool insert_before(ElementT *, const PortT &); + inline bool insert_after(ElementT *, const PortT &); + + // REQUIREMENTS + void add_requirement(const String &type, const String &value); + void remove_requirement(const String &type, const String &value); + const Vector &requirements() const { return _requirements; } + + // ARCHIVE + void add_archive(const ArchiveElement &); + int narchive() const { return _archive.size(); } + int archive_index(const String &s) const { return _archive_map[s]; } + const Vector &archive() const{ return _archive; } + ArchiveElement &archive(int i) { return _archive[i]; } + const ArchiveElement &archive(int i) const { return _archive[i]; } + inline ArchiveElement &archive(const String &s); + inline const ArchiveElement &archive(const String &s) const; + + void add_components_to(RouterT *, const String &prefix = String()) const; + + // CHECKING, FLATTENING AND EXPANDING + void check() const; + + void remove_duplicate_connections(); + void remove_dead_elements(); + + void remove_compound_elements(ErrorHandler *, bool expand_vars); + void remove_tunnels(ErrorHandler *errh = 0); + void compact(); + + void expand_into(RouterT *dest, const String &prefix, VariableEnvironment &env, ErrorHandler *errh); + void flatten(ErrorHandler *errh, bool expand_vars = false); + + // UNPARSING + void unparse(StringAccum &, const String & = String()) const; + void unparse_requirements(StringAccum &, const String & = String()) const; + void unparse_defines(StringAccum &, const String & = String()) const; + void unparse_declarations(StringAccum &, const String & = String()) const; + void unparse_connections(StringAccum &, const String & = String()) const; + String configuration_string() const; + + // COMPOUND ELEMENTS + String landmark() const { return _type_landmark.str(); } + String decorated_landmark() const { return _type_landmark.decorated_str(); } + void set_landmarkt(const LandmarkT &l) { _type_landmark = l; } + const ElementTraits *find_traits(ElementMap *emap) const; + + bool primitive() const { return false; } + bool overloaded() const; + + inline bool defines(const String &name) const; + + int nformals() const { return _formals.size(); } + inline bool add_formal(const String &name, const String &type); + const String &formal_name(int i) const { return _formals[i]; } + const String &formal_type(int i) const { return _formal_types[i]; } + + const VariableEnvironment &scope() const { return _scope; } + inline bool define(const String &name, const String &value); + inline void redefine(const VariableEnvironment &); + int ninputs() const { return _ninputs; } + int noutputs() const { return _noutputs; } + + RouterT *declaration_scope() const { return _declaration_scope; } + ElementClassT *overload_type() const { return _overload_type; } + void set_overload_type(ElementClassT *); + + int check_pseudoelement(const ElementT *e, bool isoutput, const char *name, ErrorHandler *errh) const; + int finish_type(ErrorHandler *errh); + + bool need_resolve() const; + ElementClassT *resolve(int, int, Vector &, ErrorHandler *, const LandmarkT &landmark); + void create_scope(const Vector &args, const VariableEnvironment &env, VariableEnvironment &new_env); + ElementT *complex_expand_element(ElementT *, const Vector &, RouterT *, const String &prefix, const VariableEnvironment &, ErrorHandler *); + + String unparse_signature() const; + void unparse_declaration(StringAccum &, const String &, UnparseKind, ElementClassT *); + + RouterT *cast_router() { return this; } + + private: + + struct ElementType { + ElementClassT * const type; + int scope_cookie; + int prev_name; + ElementType(ElementClassT *c, int sc, int pn) : type(c), scope_cookie(sc), prev_name(pn) { assert(type); type->use(); } + ElementType(const ElementType &o) : type(o.type), scope_cookie(o.scope_cookie), prev_name(o.prev_name) { type->use(); } + ~ElementType() { type->unuse(); } + const String &name() const { return type->name(); } + private: + ElementType &operator=(const ElementType &); + }; + + enum { end_all = 2 }; + + struct ConnectionX : public ConnectionT { + ConnectionX **_pprev; + ConnectionX *_next[3]; + ConnectionX(const PortT &from, const PortT &to, + const LandmarkT &landmark) + : ConnectionT(from, to, landmark) { + } + ConnectionX *next_from() const { + return _next[end_from]; + } + ConnectionX *next_to() const { + return _next[end_to]; + } + }; + + struct ConnectionSet { + ConnectionSet *next; + ConnectionX c[1]; + }; + + struct Pair { + ConnectionX *end[2]; + Pair() { end[0] = end[1] = 0; } + Pair(ConnectionX *from, ConnectionX *to) { end[end_from] = from; end[end_to] = to; } + ConnectionX *&operator[](int i) { assert(i >= 0 && i <= 1); return end[i]; } + ConnectionX *operator[](int i) const { assert(i >= 0 && i <= 1); return end[i]; } + }; + + StringMap _element_name_map; + Vector _elements; + ElementT *_free_element; + int _n_live_elements; + Vector *_new_eindex_collector; + + ConnectionSet *_connsets; + int _nconnx; + Vector _first_conn; + ConnectionX *_conn_head; + ConnectionX **_conn_tail; + ConnectionX *_free_conn; + + StringMap _declared_type_map; + Vector _declared_types; + + Vector _requirements; + + StringMap _archive_map; + Vector _archive; + + RouterT *_declaration_scope; + int _declaration_scope_cookie; + int _scope_cookie; + + VariableEnvironment _scope; + Vector _formals; + Vector _formal_types; + int _ninputs; + int _noutputs; + bool _scope_order_error; + bool _circularity_flag; + bool _potential_duplicate_connections; + ElementClassT *_overload_type; + LandmarkT _type_landmark; + mutable ElementTraits _traits; + + RouterT(const RouterT &); + RouterT &operator=(const RouterT &); + + ElementClassT *declared_type(const String &, int scope_cookie) const; + void update_noutputs(int); + void update_ninputs(int); + ElementT *add_element(const ElementT &); + void assign_element_name(int); + void free_connection(ConnectionX *c); + void unlink_connection_from(ConnectionX *c); + void unlink_connection_to(ConnectionX *c); + void expand_tunnel(Vector *port_expansions, const Vector &ports, bool is_output, int which, ErrorHandler *) const; + int assign_arguments(const Vector &, Vector *) const; + + friend class RouterUnparserT; + friend class conn_iterator; + +}; + +class RouterT::const_iterator { public: + typedef int (const_iterator::*unspecified_bool_type)() const; + operator unspecified_bool_type() const { return _e ? &const_iterator::eindex : 0; } + int eindex() const { return _e->eindex(); } + void operator++() { if (_e) step(_e->router(), eindex()+1);} + void operator++(int) { ++(*this); } + const ElementT *operator->() const { return _e; } + const ElementT *get() const { return _e; } + const ElementT &operator*() const { return *_e; } + private: + const ElementT *_e; + const_iterator() : _e(0) { } + const_iterator(const RouterT *r, int ei) { step(r, ei); } + void step(const RouterT *, int); + friend class RouterT; + friend class RouterT::iterator; +}; + +class RouterT::iterator : public RouterT::const_iterator { public: + ElementT *operator->() const { return const_cast(_e); } + ElementT *get() const { return const_cast(_e); } + ElementT &operator*() const { return const_cast(*_e); } + private: + iterator() : const_iterator() { } + iterator(RouterT *r, int ei) : const_iterator(r, ei) { } + friend class RouterT; +}; + +class RouterT::const_type_iterator { public: + typedef int (const_type_iterator::*unspecified_bool_type)() const; + operator unspecified_bool_type() const { return _e ? &const_type_iterator::eindex : 0; } + int eindex() const { return _e->eindex(); } + inline void operator++(); + inline void operator++(int); + const ElementT *operator->() const { return _e; } + const ElementT *get() const { return _e; } + const ElementT &operator*() const { return *_e; } + private: + const ElementT *_e; + ElementClassT *_t; + const_type_iterator() : _e(0), _t(0) { } + const_type_iterator(const RouterT *r, ElementClassT *t, int i) : _t(t) { step(r, i); } + void step(const RouterT *, int); + friend class RouterT; + friend class RouterT::type_iterator; +}; + +class RouterT::type_iterator : public RouterT::const_type_iterator { public: + ElementT *operator->() const { return const_cast(_e); } + ElementT *get() const { return const_cast(_e); } + ElementT &operator*() const { return const_cast(*_e); } + private: + type_iterator() : const_type_iterator() { } + type_iterator(RouterT *r, ElementClassT *t, int ei) : const_type_iterator(r, t, ei) { } + friend class RouterT; +}; + +class RouterT::conn_iterator { public: + inline conn_iterator() : _conn(0), _by(0) { } + typedef bool (conn_iterator::*unspecified_bool_type)() const; + operator unspecified_bool_type() const { return _conn ? &conn_iterator::empty : 0; } + inline bool empty() const { return !_conn; } + inline bool is_back() const; + inline conn_iterator &operator++(); + inline void operator++(int); + const ConnectionT *operator->() const { return _conn; } + const ConnectionT *get() const { return _conn; } + const ConnectionT &operator*() const { return *_conn; } + private: + const ConnectionX *_conn; + int _by; + inline conn_iterator(const ConnectionX *conn, int by); + void assign(const ConnectionX *conn, int by) { + _conn = conn; + _by = by; + } + void complex_step(); + friend class RouterT; +}; + + +inline RouterT::iterator +RouterT::begin_elements() +{ + return iterator(this, 0); +} + +inline RouterT::const_iterator +RouterT::begin_elements() const +{ + return const_iterator(this, 0); +} + +inline RouterT::type_iterator +RouterT::begin_elements(ElementClassT *t) +{ + return type_iterator(this, t, 0); +} + +inline RouterT::const_type_iterator +RouterT::begin_elements(ElementClassT *t) const +{ + return const_type_iterator(this, t, 0); +} + +inline RouterT::const_iterator +RouterT::end_elements() const +{ + return const_iterator(); +} + +inline RouterT::iterator +RouterT::end_elements() +{ + return iterator(); +} + +inline void +RouterT::const_type_iterator::operator++() +{ + if (_e) + step(_e->router(), _e->eindex() + 1); +} + +inline void +RouterT::const_type_iterator::operator++(int) +{ + ++(*this); +} + +inline +RouterT::conn_iterator::conn_iterator(const ConnectionX *conn, int by) + : _conn(conn), _by(by) +{ +} + +inline RouterT::conn_iterator +RouterT::begin_connections() const +{ + return conn_iterator(_conn_head, end_all); +} + +inline RouterT::conn_iterator +RouterT::end_connections() const +{ + return conn_iterator(); +} + +inline RouterT::conn_iterator RouterT::find_connections_touching(const PortT &port, bool isoutput) const +{ + assert(port.router() == this); + return find_connections_touching(port.eindex(), port.port, isoutput); +} + +inline RouterT::conn_iterator RouterT::find_connections_touching(ElementT *e, bool isoutput) const +{ + assert(e->router() == this); + return find_connections_touching(e->eindex(), -1, isoutput); +} + +inline RouterT::conn_iterator RouterT::find_connections_touching(ElementT *e, int port, bool isoutput) const +{ + assert(e->router() == this); + return find_connections_touching(e->eindex(), port, isoutput); +} + +inline RouterT::conn_iterator RouterT::find_connections_from(const PortT &port) const +{ + return find_connections_touching(port, end_from); +} + +inline RouterT::conn_iterator RouterT::find_connections_from(ElementT *e) const +{ + return find_connections_touching(e, end_from); +} + +inline RouterT::conn_iterator RouterT::find_connections_from(ElementT *e, int port) const +{ + return find_connections_touching(e, port, end_from); +} + +inline RouterT::conn_iterator RouterT::find_connections_to(const PortT &port) const +{ + return find_connections_touching(port, end_to); +} + +inline RouterT::conn_iterator RouterT::find_connections_to(ElementT *e) const +{ + return find_connections_touching(e, end_to); +} + +inline RouterT::conn_iterator RouterT::find_connections_to(ElementT *e, int port) const +{ + return find_connections_touching(e, port, end_to); +} + +inline RouterT::conn_iterator & +RouterT::conn_iterator::operator++() +{ + if (_conn && unsigned(_by) <= end_all) + _conn = _conn->_next[_by]; + else + complex_step(); + return *this; +} + +inline void +RouterT::conn_iterator::operator++(int) +{ + ++(*this); +} + +inline bool +RouterT::conn_iterator::is_back() const +{ + conn_iterator x(*this); + return x && !++x; +} + +inline const ElementT * +RouterT::element(const String &s) const +{ + int i = _element_name_map[s]; + return (i >= 0 ? _elements[i] : 0); +} + +inline ElementT * +RouterT::element(const String &s) +{ + int i = _element_name_map.get(s); + return (i >= 0 ? _elements[i] : 0); +} + +inline String +RouterT::ename(int e) const +{ + return _elements[e]->name(); +} + +inline ElementClassT * +RouterT::etype(int e) const +{ + return _elements[e]->type(); +} + +inline String +RouterT::etype_name(int e) const +{ + return _elements[e]->type()->name(); +} + +inline ElementClassT * +RouterT::declared_type(const String &name) const +{ + return declared_type(name, 0x7FFFFFFF); +} + +inline bool +RouterT::add_connection(ElementT *from_elt, int from_port, ElementT *to_elt, + int to_port, const LandmarkT &landmark) +{ + return add_connection(PortT(from_elt, from_port), PortT(to_elt, to_port), landmark); +} + +inline bool +RouterT::insert_before(ElementT *e, const PortT &h) +{ + return insert_before(PortT(e, 0), h); +} + +inline bool +RouterT::insert_after(ElementT *e, const PortT &h) +{ + return insert_after(PortT(e, 0), h); +} + +inline bool +RouterT::defines(const String &name) const +{ + for (const String *f = _formals.begin(); f != _formals.end(); ++f) + if (*f == name) + return true; + return _scope.defines(name); +} + +inline bool +RouterT::add_formal(const String &name, const String &type) +{ + if (defines(name)) + return false; + _formals.push_back(name); + _formal_types.push_back(type); + return true; +} + +inline bool +RouterT::define(const String &name, const String &value) +{ + if (defines(name)) + return false; + return _scope.define(name, value, false); +} + +inline void +RouterT::redefine(const VariableEnvironment &ve) +{ + for (int i = 0; i < ve.size(); i++) + _scope.define(ve.name(i), ve.value(i), true); +} + +inline ArchiveElement & +RouterT::archive(const String &name) +{ + return _archive[_archive_map.get(name)]; +} + +inline const ArchiveElement & +RouterT::archive(const String &name) const +{ + return _archive[_archive_map[name]]; +} + +inline bool +operator==(const RouterT::const_iterator &i, const RouterT::const_iterator &j) +{ + return i.get() == j.get(); +} + +inline bool +operator!=(const RouterT::const_iterator &i, const RouterT::const_iterator &j) +{ + return i.get() != j.get(); +} + +inline bool +operator==(const RouterT::const_type_iterator &i, const RouterT::const_type_iterator &j) +{ + return i.get() == j.get(); +} + +inline bool +operator!=(const RouterT::const_type_iterator &i, const RouterT::const_type_iterator &j) +{ + return i.get() != j.get(); +} + +inline bool +operator==(const RouterT::const_type_iterator &i, const RouterT::const_iterator &j) +{ + return i.get() == j.get(); +} + +inline bool +operator!=(const RouterT::const_type_iterator &i, const RouterT::const_iterator &j) +{ + return i.get() != j.get(); +} + +inline bool +operator==(const RouterT::conn_iterator &i, const RouterT::conn_iterator &j) +{ + return i.get() == j.get(); +} + +inline bool +operator!=(const RouterT::conn_iterator &i, const RouterT::conn_iterator &j) +{ + return i.get() != j.get(); +} + +inline RouterT::conn_iterator +operator+(RouterT::conn_iterator it, int x) +{ + while (x-- > 0) + ++it; + return it; +} + +#endif diff --git a/openflow/include/clicktool/runparse.hh b/openflow/include/clicktool/runparse.hh new file mode 100644 index 0000000..537a930 --- /dev/null +++ b/openflow/include/clicktool/runparse.hh @@ -0,0 +1,31 @@ +// -*- c-basic-offset: 4 -*- +#ifndef CLICK_RUNPARSE_HH +#define CLICK_RUNPARSE_HH +#include "routert.hh" +#include + +class RouterUnparserT { public: + + RouterUnparserT(ErrorHandler *); + + struct Pair { + ElementClassT *first; + ElementClassT *second; + Pair(ElementClassT *a, ElementClassT *b) : first(a), second(b) { } + }; + + private: + + HashTable _tuid_map; + Vector _types; + + enum { X_BAD = 0, X_UNK = 1, X_LT = 2, X_LEQ = 3, X_EQ = 4, X_GEQ = 5, X_GT = 6, X_NUM = 7 }; + static int relation_negater[X_NUM]; + static uint8_t relation_combiner[X_NUM][X_NUM]; + HashTable, int> _relation; + + ErrorHandler *_errh; + +}; + +#endif diff --git a/openflow/include/clicktool/toolutils.hh b/openflow/include/clicktool/toolutils.hh new file mode 100644 index 0000000..b723d19 --- /dev/null +++ b/openflow/include/clicktool/toolutils.hh @@ -0,0 +1,21 @@ +#ifndef CLICK_TOOLUTILS_HH +#define CLICK_TOOLUTILS_HH +#include +class RouterT; +class VariableEnvironment; + +extern VariableEnvironment global_scope; +extern bool ignore_line_directives; + +int click_maybe_define(const char *arg, ErrorHandler *errh); +RouterT *read_router_string(const String &text, const String &landmark, ErrorHandler *); +RouterT *read_router_string(String text, const String &landmark, bool, RouterT *, ErrorHandler *); +RouterT *read_router_file(const char *filename, ErrorHandler *); +RouterT *read_router_file(const char *filename, bool empty_ok, ErrorHandler *); +RouterT *read_router(const String &, bool is_expr, ErrorHandler *); +void write_router_file(RouterT *, FILE *, ErrorHandler * = 0); +int write_router_file(RouterT *, const char *, ErrorHandler * = 0); + +String xml_quote(const String &); + +#endif diff --git a/openflow/fast.h b/openflow/include/fast.h similarity index 100% rename from openflow/fast.h rename to openflow/include/fast.h diff --git a/openflow/fast_err.h b/openflow/include/fast_err.h similarity index 100% rename from openflow/fast_err.h rename to openflow/include/fast_err.h diff --git a/openflow/fast_struct.h b/openflow/include/fast_struct.h similarity index 100% rename from openflow/fast_struct.h rename to openflow/include/fast_struct.h diff --git a/openflow/fast_sys_dev.h b/openflow/include/fast_sys_dev.h similarity index 100% rename from openflow/fast_sys_dev.h rename to openflow/include/fast_sys_dev.h diff --git a/openflow/fast_type.h b/openflow/include/fast_type.h similarity index 100% rename from openflow/fast_type.h rename to openflow/include/fast_type.h diff --git a/openflow/fast_vaddr.h b/openflow/include/fast_vaddr.h similarity index 100% rename from openflow/fast_vaddr.h rename to openflow/include/fast_vaddr.h diff --git a/openflow/fast_version.h b/openflow/include/fast_version.h similarity index 100% rename from openflow/fast_version.h rename to openflow/include/fast_version.h diff --git a/openflow/usr/include/libnet.h b/openflow/include/libnet.h similarity index 100% rename from openflow/usr/include/libnet.h rename to openflow/include/libnet.h diff --git a/openflow/usr/include/libnet/libnet-asn1.h b/openflow/include/libnet/libnet-asn1.h similarity index 100% rename from openflow/usr/include/libnet/libnet-asn1.h rename to openflow/include/libnet/libnet-asn1.h diff --git a/openflow/usr/include/libnet/libnet-functions.h b/openflow/include/libnet/libnet-functions.h similarity index 100% rename from openflow/usr/include/libnet/libnet-functions.h rename to openflow/include/libnet/libnet-functions.h diff --git a/openflow/usr/include/libnet/libnet-headers.h b/openflow/include/libnet/libnet-headers.h similarity index 100% rename from openflow/usr/include/libnet/libnet-headers.h rename to openflow/include/libnet/libnet-headers.h diff --git a/openflow/usr/include/libnet/libnet-macros.h b/openflow/include/libnet/libnet-macros.h similarity index 100% rename from openflow/usr/include/libnet/libnet-macros.h rename to openflow/include/libnet/libnet-macros.h diff --git a/openflow/usr/include/libnet/libnet-structures.h b/openflow/include/libnet/libnet-structures.h similarity index 100% rename from openflow/usr/include/libnet/libnet-structures.h rename to openflow/include/libnet/libnet-structures.h diff --git a/openflow/usr/include/libnet/libnet-types.h b/openflow/include/libnet/libnet-types.h similarity index 100% rename from openflow/usr/include/libnet/libnet-types.h rename to openflow/include/libnet/libnet-types.h diff --git a/openflow/include/main_libofp.h b/openflow/include/main_libofp.h new file mode 100755 index 0000000..e9e46ca --- /dev/null +++ b/openflow/include/main_libofp.h @@ -0,0 +1,222 @@ +/*************************************************************************** + * main_libofp.h + * + * 2017/02/27 09:51:58 星期一 + * Copyright 2017 XuDongLai + * + ****************************************************************************/ +/* + * main_libofp.h + * + * Copyright (C) 2017 - XuDongLai + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef __MAIN_LIBOFP_H__ +#define __MAIN_LIBOFP_H__ + +#include +#include +#include +#include +#include +#include +#include + +#include "ofp_v4.h" + +#undef NMS_METER +/***************************/ +#if 0 +#define NMS_METER +#endif + +#define MAX_IF_CNT 16 +#define MAX_RULE_CNT 256 +#define MAX_NEIGH_CNT 256 + + + +/*打印控制使用*/ +static int print_idx_nms[MAX_IF_CNT] = {0}; +static int __oft = 3; +/*打印控制使用*/ + +/*颜色控制*/ +#define NONE "\033[m" +#define RED "\033[0;32;31m" +#define LIGHT_RED "\033[1;31m" +#define GREEN "\033[0;32;32m" +#define LIGHT_GREEN "\033[1;32m" +#define BLUE "\033[0;32;34m" +#define LIGHT_BLUE "\033[1;34m" +#define DARY_GRAY "\033[1;30m" +#define CYAN "\033[0;36m" +#define LIGHT_CYAN "\033[1;36m" +#define PURPLE "\033[0;35m" +#define LIGHT_PURPLE "\033[1;35m" +#define BROWN "\033[0;33m" +#define YELLOW "\033[1;33m" +#define LIGHT_GRAY "\033[0;37m" +#define WHITE "\033[1;37m" +/*颜色控制*/ + +static int debug = 0xFFF;/*默认不输出任何打印信息*/ +enum +{ + _FUN = 1<<0, + _DBG = 1<<1, + _ERR = 1<<2, +}; + +static char P_COLOR[MAX_IF_CNT][24] = +{ + NONE,WHITE,YELLOW,LIGHT_BLUE,DARY_GRAY,CYAN,PURPLE,BROWN,LIGHT_GRAY,GREEN +}; + +#define IDX(x) (x=='n'?0:x-48) + +#define PRINT(fmt,argv...)do{ \ + char _thread_name[16] = {0}; \ + prctl(PR_GET_NAME,_thread_name); \ + printf(YELLOW"%s)"fmt,_thread_name,##argv); \ + }while(0); + +#define LOG_DBG(fmt,argv...)do{ \ + char _thread_name[16] = {0}; \ + prctl(PR_GET_NAME,_thread_name); \ + int tid = IDX(_thread_name[0]); \ + if(debug < 1 || (debug & (1<0)sprintf(_out,"%s%s",_out," "); \ + printf("%s%s)%s"fmt,P_COLOR[tid],_thread_name,_out,##argv); \ +}while(0); + +#define LOG_ERR(fmt,argv...)do{ \ + char _thread_name[16] = {0}; \ + prctl(PR_GET_NAME,_thread_name); \ + if(1){printf(RED "ERROR! %s)%s:%s[%d]\n" fmt NONE,_thread_name,__func__,__FILE__,__LINE__,##argv);} \ + exit(0); \ +}while(0); + +#define SHOW_FUN(a)do{ \ + char _thread_name[16] = {0}; \ + prctl(PR_GET_NAME,_thread_name); \ + int _cnt = 0; \ + int tid = IDX(_thread_name[0]); \ + if(debug < 1 || (debug & (1<>");}else{sprintf(_out,"%s","<<");} \ + _cnt = __print_idx_nms; \ + while(_cnt-->0)sprintf(_out,"%s%s",_out," "); \ + printf("%s%s)%s%s :%s[%d]\n",P_COLOR[tid],_thread_name,_out,__func__,__FILE__,__LINE__); \ + if(a){__print_idx_nms -= __oft;} \ + print_idx_nms[tid] = __print_idx_nms; \ +}while(0); + +#define DIV_ROUND_UP(X,Y) (((X) + ((Y) - 1)) / (Y)) +#define ROUND_UP(X,Y) (DIV_ROUND_UP(X,Y) * Y) + + + +struct eth_header +{ + u8 dmac[6]; + u8 smac[6]; + u16 frame; + u8 data[0]; +}__attribute__((packed)); + +struct meter_buffer +{ + u8 data[60]; + u32 ts; + u8 in_port; + u8 pad[3]; +}__attribute__((packed)); + +struct netdev_stats { + unsigned long long rx_packets; /* total packets received */ + unsigned long long tx_packets; /* total packets transmitted */ + unsigned long long rx_bytes; /* total bytes received */ + unsigned long long tx_bytes; /* total bytes transmitted */ + unsigned long rx_errors; /* bad packets received */ + unsigned long tx_errors; /* packet transmit problems */ + unsigned long rx_dropped; /* no space in linux buffers */ + unsigned long tx_dropped; /* no space available in linux */ + unsigned long rx_multicast; /* multicast packets received */ + unsigned long rx_compressed; + unsigned long tx_compressed; + unsigned long collisions; + + /* detailed rx_errors: */ + unsigned long rx_length_errors; + unsigned long rx_over_errors; /* receiver ring buff overflow */ + unsigned long rx_crc_errors; /* recved pkt with crc error */ + unsigned long rx_frame_errors; /* recv'd frame alignment error */ + unsigned long rx_fifo_errors; /* recv'r fifo overrun */ + unsigned long rx_missed_errors; /* receiver missed packet */ + /* detailed tx_errors */ + unsigned long tx_aborted_errors; + unsigned long tx_carrier_errors; + unsigned long tx_fifo_errors; + unsigned long tx_heartbeat_errors; + unsigned long tx_window_errors; +}; + + + +struct nms_port +{ + u8 name[16]; + struct ofp_port state; + struct ofp_port_stats stats; + union + { + u32 port_ip4; + struct in6_addr port_ip6; + u8 ip[16]; + }; + union + { + u32 gw_ip4; + struct in6_addr gw_ip6; + u8 gw[16]; + u64 gw_value[2]; + }; + u8 gwmac[6]; + u8 port_mac[6]; + pcap_t *pcap; + libnet_t *net; + u32 logport; + u32 phyport; + u32 old_state; + u16 speed; + u16 updown; + pthread_mutex_t port_send_mutex; +}; + +struct nms_ports_info +{ + int cnt; + struct nms_port ports[MAX_IF_CNT]; +}; + + + + +#endif //__MAIN_LIBOFP_H__ diff --git a/openflow/include/md5.h b/openflow/include/md5.h new file mode 100755 index 0000000..569a4a6 --- /dev/null +++ b/openflow/include/md5.h @@ -0,0 +1,46 @@ +#ifndef __MD5_H__ +#define __MD5_H__ + +typedef struct +{ + unsigned int count[2]; + unsigned int state[4]; + unsigned char buffer[64]; +}MD5_CTX; + + +#define F(x,y,z) ((x & y) | (~x & z)) +#define G(x,y,z) ((x & z) | (y & ~z)) +#define H(x,y,z) (x^y^z) +#define I(x,y,z) (y ^ (x | ~z)) +#define ROTATE_LEFT(x,n) ((x << n) | (x >> (32-n))) + +#define FF(a,b,c,d,x,s,ac){ \ + a += F(b,c,d) + x + ac; \ + a = ROTATE_LEFT(a,s); \ + a += b; \ + } +#define GG(a,b,c,d,x,s,ac){ \ + a += G(b,c,d) + x + ac; \ + a = ROTATE_LEFT(a,s); \ + a += b; \ + } +#define HH(a,b,c,d,x,s,ac){ \ + a += H(b,c,d) + x + ac; \ + a = ROTATE_LEFT(a,s); \ + a += b; \ + } +#define II(a,b,c,d,x,s,ac){ \ + a += I(b,c,d) + x + ac; \ + a = ROTATE_LEFT(a,s); \ + a += b; \ + } + +void MD5Init(MD5_CTX *context); +void MD5Update(MD5_CTX *context,unsigned char *input,unsigned int inputlen); +void MD5Final(MD5_CTX *context,unsigned char digest[16]); +void MD5Transform(unsigned int state[4],unsigned char block[64]); +void MD5Encode(unsigned char *output,unsigned int *input,unsigned int len); +void MD5Decode(unsigned int *output,unsigned char *input,unsigned int len); + +#endif //__MD5_H__ diff --git a/openflow/usr/include/netmagic08.h b/openflow/include/netmagic08.h similarity index 100% rename from openflow/usr/include/netmagic08.h rename to openflow/include/netmagic08.h diff --git a/openflow/ofp_v4.h b/openflow/include/ofp_v4.h similarity index 99% rename from openflow/ofp_v4.h rename to openflow/include/ofp_v4.h index 20c1aa8..d812f79 100755 --- a/openflow/ofp_v4.h +++ b/openflow/include/ofp_v4.h @@ -337,7 +337,9 @@ enum eth_packet_type { //ETH_IPv4 = 0x0800, //ETH_ARP = 0x0806, //ETH_IPv6 = 0x86DD, +#ifndef ETH_P_LLDP ETH_P_LLDP = 0x88CC, +#endif ETH_P_XX = 0x8942, }; diff --git a/openflow/usr/include/openboxS28.h b/openflow/include/openboxS28.h similarity index 100% rename from openflow/usr/include/openboxS28.h rename to openflow/include/openboxS28.h diff --git a/openflow/usr/include/openboxS4.h b/openflow/include/openboxS4.h similarity index 100% rename from openflow/usr/include/openboxS4.h rename to openflow/include/openboxS4.h diff --git a/openflow/include/openflow/intel-ext.h b/openflow/include/openflow/intel-ext.h new file mode 100644 index 0000000..974e63e --- /dev/null +++ b/openflow/include/openflow/intel-ext.h @@ -0,0 +1,73 @@ +/* + * Copyright(c) 2016 Intel Corporation. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENFLOW_INTEL_EXT_H +#define OPENFLOW_INTEL_EXT_H + +/* This file presents Intel vendor extension. It is not anyhow + * standardized, so all those definitions are not part of + * official openflow headers (openflow.h). Nevertheless below + * features introduces real value so it could be suitable for + * standardization */ + +/* Intel extended statistics type */ + +enum intel_port_stats_subtype { + INTEL_PORT_STATS_RFC2819 = 1, +}; + +#define INTEL_PORT_STATS_RFC2819_SIZE 184 + +/* Struct implements custom property type based on + * 'ofp_prop_experimenter'. */ +struct intel_port_stats_rfc2819 { + ovs_be16 type; /* OFPPSPT14_EXPERIMENTER. */ + ovs_be16 length; /* Length in bytes of this property excluding + * trailing padding. */ + ovs_be32 experimenter; /* INTEL_VENDOR_ID. */ + ovs_be32 exp_type; /* INTEL_PORT_STATS_*. */ + + uint8_t pad[4]; + + ovs_be64 rx_1_to_64_packets; + ovs_be64 rx_65_to_127_packets; + ovs_be64 rx_128_to_255_packets; + ovs_be64 rx_256_to_511_packets; + ovs_be64 rx_512_to_1023_packets; + ovs_be64 rx_1024_to_1522_packets; + ovs_be64 rx_1523_to_max_packets; + + ovs_be64 tx_1_to_64_packets; + ovs_be64 tx_65_to_127_packets; + ovs_be64 tx_128_to_255_packets; + ovs_be64 tx_256_to_511_packets; + ovs_be64 tx_512_to_1023_packets; + ovs_be64 tx_1024_to_1522_packets; + ovs_be64 tx_1523_to_max_packets; + + ovs_be64 tx_multicast_packets; + ovs_be64 rx_broadcast_packets; + ovs_be64 tx_broadcast_packets; + ovs_be64 rx_undersized_errors; + ovs_be64 rx_oversize_errors; + ovs_be64 rx_fragmented_errors; + ovs_be64 rx_jabber_errors; + +}; +OFP_ASSERT(sizeof (struct intel_port_stats_rfc2819) == + INTEL_PORT_STATS_RFC2819_SIZE); + +#endif /* openflow/intel-ext.h */ diff --git a/openflow/include/openflow/netronome-ext.h b/openflow/include/openflow/netronome-ext.h new file mode 100644 index 0000000..8db7b79 --- /dev/null +++ b/openflow/include/openflow/netronome-ext.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2014 Netronome. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENFLOW_NETRONOME_EXT_H +#define OPENFLOW_NETRONOME_EXT_H 1 + +#include "openflow/openflow.h" +#include "openvswitch/types.h" + +/* The following vendor extension, proposed by Netronome, is not yet + * standardized, so they are not included in openflow.h. It may + * be suitable for standardization */ + + +/* Netronome enhanced select group */ + +enum ntr_group_mod_subtype { + NTRT_SELECTION_METHOD = 1, +}; + +#define NTR_MAX_SELECTION_METHOD_LEN 16 + +struct ntr_group_prop_selection_method { + ovs_be16 type; /* OFPGPT15_EXPERIMENTER. */ + ovs_be16 length; /* Length in bytes of this property + * excluding trailing padding. */ + ovs_be32 experimenter; /* NTR_VENDOR_ID. */ + ovs_be32 exp_type; /* NTRT_SELECTION_METHOD. */ + ovs_be32 pad; + char selection_method[NTR_MAX_SELECTION_METHOD_LEN]; + /* Null-terminated */ + ovs_be64 selection_method_param; /* Non-Field parameter for + * bucket selection. */ + + /* Followed by: + * - Exactly (length - 40) (possibly 0) bytes containing OXM TLVs, then + * - Exactly ((length + 7)/8*8 - length) (between 0 and 7) bytes of + * all-zero bytes + * In summary, ntr_group_prop_selection_method is padded as needed, + * to make its overall size a multiple of 8, to preserve alignment + * in structures using it. + */ + /* uint8_t field_array[0]; */ /* Zero or more fields encoded as + * OXM TLVs where the has_mask bit must + * be zero and the value it specifies is + * a mask to apply to packet fields and + * then input them to the selection + * method of a select group. */ + /* uint8_t pad2[0]; */ +}; +OFP_ASSERT(sizeof(struct ntr_group_prop_selection_method) == 40); + +#endif /* openflow/netronome-ext.h */ diff --git a/openflow/include/openflow/nicira-ext.h b/openflow/include/openflow/nicira-ext.h new file mode 100644 index 0000000..9d53623 --- /dev/null +++ b/openflow/include/openflow/nicira-ext.h @@ -0,0 +1,1141 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENFLOW_NICIRA_EXT_H +#define OPENFLOW_NICIRA_EXT_H 1 + +#include +#include + +/* The following vendor extensions, proposed by Nicira, are not yet + * standardized, so they are not included in openflow.h. Some of them may be + * suitable for standardization; others we never expect to standardize. */ + + +/* Nicira vendor-specific error messages extension. + * + * OpenFlow 1.0 has a set of predefined error types (OFPET_*) and codes (which + * are specific to each type). It does not have any provision for + * vendor-specific error codes, and it does not even provide "generic" error + * codes that can apply to problems not anticipated by the OpenFlow + * specification authors. + * + * This extension attempts to address the problem by adding a generic "error + * vendor extension". The extension works as follows: use NXET_VENDOR as type + * and NXVC_VENDOR_ERROR as code, followed by struct nx_vendor_error with + * vendor-specific details, followed by at least 64 bytes of the failed + * request. + * + * It would be better to have a type-specific vendor extension, e.g. so that + * OFPET_BAD_ACTION could be used with vendor-specific code values. But + * OFPET_BAD_ACTION and most other standardized types already specify that + * their 'data' values are (the start of) the OpenFlow message being replied + * to, so there is no room to insert a vendor ID. + * + * Currently this extension is only implemented by Open vSwitch, but it seems + * like a reasonable candidate for future standardization. + */ + +/* This is a random number to avoid accidental collision with any other + * vendor's extension. */ +#define NXET_VENDOR 0xb0c2 + +/* ofp_error msg 'code' values for NXET_VENDOR. */ +enum nx_vendor_code { + NXVC_VENDOR_ERROR /* 'data' contains struct nx_vendor_error. */ +}; + +/* 'data' for 'type' == NXET_VENDOR, 'code' == NXVC_VENDOR_ERROR. */ +struct nx_vendor_error { + ovs_be32 vendor; /* Vendor ID as in struct ofp_vendor_header. */ + ovs_be16 type; /* Vendor-defined type. */ + ovs_be16 code; /* Vendor-defined subtype. */ + /* Followed by at least the first 64 bytes of the failed request. */ +}; + +/* Nicira vendor requests and replies. */ + +/* Fields to use when hashing flows. */ +enum nx_hash_fields { + /* Ethernet source address (NXM_OF_ETH_SRC) only. */ + NX_HASH_FIELDS_ETH_SRC, + + /* L2 through L4, symmetric across src/dst. Specifically, each of the + * following fields, if present, is hashed (slashes separate symmetric + * pairs): + * + * - NXM_OF_ETH_DST / NXM_OF_ETH_SRC + * - NXM_OF_ETH_TYPE + * - The VID bits from NXM_OF_VLAN_TCI, ignoring PCP and CFI. + * - NXM_OF_IP_PROTO + * - NXM_OF_IP_SRC / NXM_OF_IP_DST + * - NXM_OF_TCP_SRC / NXM_OF_TCP_DST + */ + NX_HASH_FIELDS_SYMMETRIC_L4, + + /* L3+L4 only, including the following fields: + * + * - NXM_OF_IP_PROTO + * - NXM_OF_IP_SRC / NXM_OF_IP_DST + * - NXM_OF_SCTP_SRC / NXM_OF_SCTP_DST + * - NXM_OF_TCP_SRC / NXM_OF_TCP_DST + */ + NX_HASH_FIELDS_SYMMETRIC_L3L4, + + /* L3+L4 only with UDP ports, including the following fields: + * + * - NXM_OF_IP_PROTO + * - NXM_OF_IP_SRC / NXM_OF_IP_DST + * - NXM_OF_SCTP_SRC / NXM_OF_SCTP_DST + * - NXM_OF_TCP_SRC / NXM_OF_TCP_DST + * - NXM_OF_UDP_SRC / NXM_OF_UDP_DST + */ + NX_HASH_FIELDS_SYMMETRIC_L3L4_UDP + + +}; + +/* This command enables or disables an Open vSwitch extension that allows a + * controller to specify the OpenFlow table to which a flow should be added, + * instead of having the switch decide which table is most appropriate as + * required by OpenFlow 1.0. Because NXM was designed as an extension to + * OpenFlow 1.0, the extension applies equally to ofp10_flow_mod and + * nx_flow_mod. By default, the extension is disabled. + * + * When this feature is enabled, Open vSwitch treats struct ofp10_flow_mod's + * and struct nx_flow_mod's 16-bit 'command' member as two separate fields. + * The upper 8 bits are used as the table ID, the lower 8 bits specify the + * command as usual. A table ID of 0xff is treated like a wildcarded table ID. + * + * The specific treatment of the table ID depends on the type of flow mod: + * + * - OFPFC_ADD: Given a specific table ID, the flow is always placed in that + * table. If an identical flow already exists in that table only, then it + * is replaced. If the flow cannot be placed in the specified table, + * either because the table is full or because the table cannot support + * flows of the given type, the switch replies with an OFPFMFC_TABLE_FULL + * error. (A controller can distinguish these cases by comparing the + * current and maximum number of entries reported in ofp_table_stats.) + * + * If the table ID is wildcarded, the switch picks an appropriate table + * itself. If an identical flow already exist in the selected flow table, + * then it is replaced. The choice of table might depend on the flows + * that are already in the switch; for example, if one table fills up then + * the switch might fall back to another one. + * + * - OFPFC_MODIFY, OFPFC_DELETE: Given a specific table ID, only flows + * within that table are matched and modified or deleted. If the table ID + * is wildcarded, flows within any table may be matched and modified or + * deleted. + * + * - OFPFC_MODIFY_STRICT, OFPFC_DELETE_STRICT: Given a specific table ID, + * only a flow within that table may be matched and modified or deleted. + * If the table ID is wildcarded and exactly one flow within any table + * matches, then it is modified or deleted; if flows in more than one + * table match, then none is modified or deleted. + */ +struct nx_flow_mod_table_id { + uint8_t set; /* Nonzero to enable, zero to disable. */ + uint8_t pad[7]; +}; +OFP_ASSERT(sizeof(struct nx_flow_mod_table_id) == 8); + +enum nx_packet_in_format { + NXPIF_STANDARD = 0, /* OFPT_PACKET_IN for this OpenFlow version. */ + NXPIF_NXT_PACKET_IN = 1, /* NXT_PACKET_IN (since OVS v1.1). */ + NXPIF_NXT_PACKET_IN2 = 2, /* NXT_PACKET_IN2 (since OVS v2.6). */ +}; + +/* NXT_SET_PACKET_IN_FORMAT request. + * + * For any given OpenFlow version, Open vSwitch supports multiple formats for + * "packet-in" messages. The default is always the standard format for the + * OpenFlow version in question, but NXT_SET_PACKET_IN_FORMAT can be used to + * set an alternative format. + * + * From OVS v1.1 to OVS v2.5, this request was only honored for OpenFlow 1.0. + * Requests to set format NXPIF_NXT_PACKET_IN were accepted for OF1.1+ but they + * had no effect. (Requests to set formats other than NXPIF_STANDARD or + * NXPIF_NXT_PACKET_IN were rejected with OFPBRC_EPERM.) + * + * From OVS v2.6 onward, this request is honored for all OpenFlow versions. + */ +struct nx_set_packet_in_format { + ovs_be32 format; /* One of NXPIF_*. */ +}; +OFP_ASSERT(sizeof(struct nx_set_packet_in_format) == 4); + +/* NXT_PACKET_IN (analogous to OFPT_PACKET_IN). + * + * NXT_PACKET_IN is similar to the OpenFlow 1.2 OFPT_PACKET_IN. The + * differences are: + * + * - NXT_PACKET_IN includes the cookie of the rule that triggered the + * message. (OpenFlow 1.3 OFPT_PACKET_IN also includes the cookie.) + * + * - The metadata fields use NXM (instead of OXM) field numbers. + * + * Open vSwitch 1.9.0 and later omits metadata fields that are zero (as allowed + * by OpenFlow 1.2). Earlier versions included all implemented metadata + * fields. + * + * Open vSwitch does not include non-metadata in the nx_match, because by + * definition that information can be found in the packet itself. The format + * and the standards allow this, however, so controllers should be prepared to + * tolerate future changes. + * + * The NXM format is convenient for reporting metadata values, but it is + * important not to interpret the format as matching against a flow, because it + * does not. Nothing is being matched; arbitrary metadata masks would not be + * meaningful. + * + * Whereas in most cases a controller can expect to only get back NXM fields + * that it set up itself (e.g. flow dumps will ordinarily report only NXM + * fields from flows that the controller added), NXT_PACKET_IN messages might + * contain fields that the controller does not understand, because the switch + * might support fields (new registers, new protocols, etc.) that the + * controller does not. The controller must prepared to tolerate these. + * + * The 'cookie' field has no meaning when 'reason' is OFPR_NO_MATCH. In this + * case it should be UINT64_MAX. */ +struct nx_packet_in { + ovs_be32 buffer_id; /* ID assigned by datapath. */ + ovs_be16 total_len; /* Full length of frame. */ + uint8_t reason; /* Reason packet is sent (one of OFPR_*). */ + uint8_t table_id; /* ID of the table that was looked up. */ + ovs_be64 cookie; /* Cookie of the rule that was looked up. */ + ovs_be16 match_len; /* Size of nx_match. */ + uint8_t pad[6]; /* Align to 64-bits. */ + /* Followed by: + * - Exactly match_len (possibly 0) bytes containing the nx_match, then + * - Exactly (match_len + 7)/8*8 - match_len (between 0 and 7) bytes of + * all-zero bytes, then + * - Exactly 2 all-zero padding bytes, then + * - An Ethernet frame whose length is inferred from nxh.header.length. + * + * The padding bytes preceding the Ethernet frame ensure that the IP + * header (if any) following the Ethernet header is 32-bit aligned. */ + + /* uint8_t nxm_fields[...]; */ /* NXM headers. */ + /* uint8_t pad[2]; */ /* Align to 64 bit + 16 bit. */ + /* uint8_t data[0]; */ /* Ethernet frame. */ +}; +OFP_ASSERT(sizeof(struct nx_packet_in) == 24); + +/* NXT_PACKET_IN2 + * ============== + * + * NXT_PACKET_IN2 is conceptually similar to OFPT_PACKET_IN but it is expressed + * as an extensible set of properties instead of using a fixed structure. + * + * Added in Open vSwitch 2.6 + * + * + * Continuations + * ------------- + * + * When a "controller" action specifies the "pause" flag, the controller action + * freezes the packet's trip through Open vSwitch flow tables and serializes + * that state into the packet-in message as a "continuation". The controller + * can later send the continuation back to the switch, which will restart the + * packet's traversal from the point where it was interrupted. This permits an + * OpenFlow controller to interpose on a packet midway through processing in + * Open vSwitch. + * + * Continuations fit into packet processing this way: + * + * 1. A packet ingresses into Open vSwitch, which runs it through the OpenFlow + * tables. + * + * 2. An OpenFlow flow executes a "controller" action that includes the "pause" + * flag. Open vSwitch serializes the packet processing state and sends it, + * as an NXT_PACKET_IN2 that includes an additional NXPINT_CONTINUATION + * property (the continuation), to the OpenFlow controller. + * + * (The controller must use NXAST_CONTROLLER2 to generate the packet-in, + * because only this form of the "controller" action has a "pause" flag. + * Similarly, the controller must use NXT_SET_PACKET_IN_FORMAT to select + * NXT_PACKET_IN2 as the packet-in format, because this is the only format + * that supports continuation passing.) + * + * 3. The controller receives the NXT_PACKET_IN2 and processes it. The + * controller can interpret and, if desired, modify some of the contents of + * the packet-in, such as the packet and the metadata being processed. + * + * 4. The controller sends the continuation back to the switch, using an + * NXT_RESUME message. Packet processing resumes where it left off. + * + * The controller might change the pipeline configuration concurrently with + * steps 2 through 4. For example, it might add or remove OpenFlow flows. If + * that happens, then the packet will experience a mix of processing from the + * two configurations, that is, the initial processing (before + * NXAST_CONTROLLER2) uses the initial flow table, and the later processing + * (after NXT_RESUME) uses the later flow table. This means that the + * controller needs to take care to avoid incompatible pipeline changes while + * processing continuations. + * + * External side effects (e.g. "output") of OpenFlow actions processed before + * NXAST_CONTROLLER2 is encountered might be executed during step 2 or step 4, + * and the details may vary among Open vSwitch features and versions. Thus, a + * controller that wants to make sure that side effects are executed must pass + * the continuation back to the switch, that is, must not skip step 4. + * + * Architecturally, continuations may be "stateful" or "stateless", that is, + * they may or may not refer to buffered state maintained in Open vSwitch. + * This means that a controller should not attempt to resume a given + * continuations more than once (because the switch might have discarded the + * buffered state after the first use). For the same reason, continuations + * might become "stale" if the controller takes too long to resume them + * (because the switch might have discarded old buffered state). Taken + * together with the previous note, this means that a controller should resume + * each continuation exactly once (and promptly). + * + * Without the information in NXPINT_CONTINUATION, the controller can (with + * careful design, and help from the flow cookie) determine where the packet is + * in the pipeline, but in the general case it can't determine what nested + * "resubmit"s that may be in progress, or what data is on the stack maintained + * by NXAST_STACK_PUSH and NXAST_STACK_POP actions, what is in the OpenFlow + * action set, etc. + * + * Continuations are expensive because they require a round trip between the + * switch and the controller. Thus, they should not be used to implement + * processing that needs to happen at "line rate". + * + * The contents of NXPINT_CONTINUATION are private to the switch, may change + * unpredictably from one version of Open vSwitch to another, and are not + * documented here. The contents are also tied to a given Open vSwitch process + * and bridge, so that restarting Open vSwitch or deleting and recreating a + * bridge will cause the corresponding NXT_RESUME to be rejected. + * + * In the current implementation, Open vSwitch forks the packet processing + * pipeline across patch ports. Suppose, for example, that the pipeline for + * br0 outputs to a patch port whose peer belongs to br1, and that the pipeline + * for br1 executes a controller action with the "pause" flag. This only + * pauses processing within br1, and processing in br0 continues and possibly + * completes with visible side effects, such as outputting to ports, before + * br1's controller receives or processes the continuation. This + * implementation maintains the independence of separate bridges and, since + * processing in br1 cannot affect the behavior of br0 anyway, should not cause + * visible behavioral changes. + * + * A stateless implementation of continuations may ignore the "controller" + * action max_len, always sending the whole packet, because the full packet is + * required to continue traversal. + */ +enum nx_packet_in2_prop_type { + /* Packet. */ + NXPINT_PACKET, /* Raw packet data. */ + NXPINT_FULL_LEN, /* ovs_be32: Full packet len, if truncated. */ + NXPINT_BUFFER_ID, /* ovs_be32: Buffer ID, if buffered. */ + + /* Information about the flow that triggered the packet-in. */ + NXPINT_TABLE_ID, /* uint8_t: Table ID. */ + NXPINT_COOKIE, /* ovs_be64: Flow cookie. */ + + /* Other. */ + NXPINT_REASON, /* uint8_t, one of OFPR_*. */ + NXPINT_METADATA, /* NXM or OXM for metadata fields. */ + NXPINT_USERDATA, /* From NXAST_CONTROLLER2 userdata. */ + NXPINT_CONTINUATION, /* Private data for continuing processing. */ +}; + +/* Configures the "role" of the sending controller. The default role is: + * + * - Other (NX_ROLE_OTHER), which allows the controller access to all + * OpenFlow features. + * + * The other possible roles are a related pair: + * + * - Master (NX_ROLE_MASTER) is equivalent to Other, except that there may + * be at most one Master controller at a time: when a controller + * configures itself as Master, any existing Master is demoted to the + * Slave role. + * + * - Slave (NX_ROLE_SLAVE) allows the controller read-only access to + * OpenFlow features. In particular attempts to modify the flow table + * will be rejected with an OFPBRC_EPERM error. + * + * Slave controllers do not receive OFPT_PACKET_IN or OFPT_FLOW_REMOVED + * messages, but they do receive OFPT_PORT_STATUS messages. + */ +struct nx_role_request { + ovs_be32 role; /* One of NX_ROLE_*. */ +}; +OFP_ASSERT(sizeof(struct nx_role_request) == 4); + +enum nx_role { + NX_ROLE_OTHER, /* Default role, full access. */ + NX_ROLE_MASTER, /* Full access, at most one. */ + NX_ROLE_SLAVE /* Read-only access. */ +}; + +/* NXT_SET_ASYNC_CONFIG. + * + * Sent by a controller, this message configures the asynchronous messages that + * the controller wants to receive. Element 0 in each array specifies messages + * of interest when the controller has an "other" or "master" role; element 1, + * when the controller has a "slave" role. + * + * Each array element is a bitmask in which a 0-bit disables receiving a + * particular message and a 1-bit enables receiving it. Each bit controls the + * message whose 'reason' corresponds to the bit index. For example, the bit + * with value 1<<2 == 4 in port_status_mask[1] determines whether the + * controller will receive OFPT_PORT_STATUS messages with reason OFPPR_MODIFY + * (value 2) when the controller has a "slave" role. + * + * As a side effect, for service controllers, this message changes the + * miss_send_len from default of zero to OFP_DEFAULT_MISS_SEND_LEN (128). + */ +struct nx_async_config { + ovs_be32 packet_in_mask[2]; /* Bitmasks of OFPR_* values. */ + ovs_be32 port_status_mask[2]; /* Bitmasks of OFPRR_* values. */ + ovs_be32 flow_removed_mask[2]; /* Bitmasks of OFPPR_* values. */ +}; +OFP_ASSERT(sizeof(struct nx_async_config) == 24); + +/* Flexible flow specifications (aka NXM = Nicira Extended Match). + * + * OpenFlow 1.0 has "struct ofp10_match" for specifying flow matches. This + * structure is fixed-length and hence difficult to extend. This section + * describes a more flexible, variable-length flow match, called "nx_match" for + * short, that is also supported by Open vSwitch. This section also defines a + * replacement for each OpenFlow message that includes struct ofp10_match. + * + * OpenFlow 1.2+ introduced OpenFlow Extensible Match (OXM), adapting + * the design of NXM. The format of NXM and OXM are compatible. + * + * + * Format + * ====== + * + * An nx_match is a sequence of zero or more "nxm_entry"s, which are + * type-length-value (TLV) entries, each 5 to 259 (inclusive) bytes long. + * "nxm_entry"s are not aligned on or padded to any multibyte boundary. The + * first 4 bytes of an nxm_entry are its "header", followed by the entry's + * "body". + * + * An nxm_entry's header is interpreted as a 32-bit word in network byte order: + * + * |<-------------------- nxm_type ------------------>| + * | | + * |31 16 15 9| 8 7 0 + * +----------------------------------+---------------+--+------------------+ + * | nxm_vendor | nxm_field |hm| nxm_length | + * +----------------------------------+---------------+--+------------------+ + * + * The most-significant 23 bits of the header are collectively "nxm_type". + * Bits 16...31 are "nxm_vendor", one of OFPXMC12_* values. In case of + * NXM, it's either OFPXMC12_NXM_0 or OFPXMC12_NXM_1. + * Bits 9...15 are "nxm_field", which is a vendor-specific value. nxm_type + * normally designates a protocol header, such as the Ethernet type, but it + * can also refer to packet metadata, such as the switch port on which a packet + * arrived. + * + * Bit 8 is "nxm_hasmask" (labeled "hm" above for space reasons). The meaning + * of this bit is explained later. + * + * The least-significant 8 bits are "nxm_length", a positive integer. The + * length of the nxm_entry, including the header, is exactly 4 + nxm_length + * bytes. + * + * For a given nxm_vendor, nxm_field, and nxm_hasmask value, nxm_length is a + * constant. It is included only to allow software to minimally parse + * "nxm_entry"s of unknown types. (Similarly, for a given nxm_vendor, + * nxm_field, and nxm_length, nxm_hasmask is a constant.) + * + * + * Semantics + * ========= + * + * A zero-length nx_match (one with no "nxm_entry"s) matches every packet. + * + * An nxm_entry places a constraint on the packets matched by the nx_match: + * + * - If nxm_hasmask is 0, the nxm_entry's body contains a value for the + * field, called "nxm_value". The nx_match matches only packets in which + * the field equals nxm_value. + * + * - If nxm_hasmask is 1, then the nxm_entry's body contains a value for the + * field (nxm_value), followed by a bitmask of the same length as the + * value, called "nxm_mask". For each 1-bit in position J in nxm_mask, the + * nx_match matches only packets for which bit J in the given field's value + * matches bit J in nxm_value. A 0-bit in nxm_mask causes the + * corresponding bit in nxm_value is ignored (it should be 0; Open vSwitch + * may enforce this someday), as is the corresponding bit in the field's + * value. (The sense of the nxm_mask bits is the opposite of that used by + * the "wildcards" member of struct ofp10_match.) + * + * When nxm_hasmask is 1, nxm_length is always even. + * + * An all-zero-bits nxm_mask is equivalent to omitting the nxm_entry + * entirely. An all-one-bits nxm_mask is equivalent to specifying 0 for + * nxm_hasmask. + * + * When there are multiple "nxm_entry"s, all of the constraints must be met. + * + * + * Mask Restrictions + * ================= + * + * Masks may be restricted: + * + * - Some nxm_types may not support masked wildcards, that is, nxm_hasmask + * must always be 0 when these fields are specified. For example, the + * field that identifies the port on which a packet was received may not be + * masked. + * + * - Some nxm_types that do support masked wildcards may only support certain + * nxm_mask patterns. For example, fields that have IPv4 address values + * may be restricted to CIDR masks. + * + * These restrictions should be noted in specifications for individual fields. + * A switch may accept an nxm_hasmask or nxm_mask value that the specification + * disallows, if the switch correctly implements support for that nxm_hasmask + * or nxm_mask value. A switch must reject an attempt to set up a flow that + * contains a nxm_hasmask or nxm_mask value that it does not support. + * + * + * Prerequisite Restrictions + * ========================= + * + * The presence of an nxm_entry with a given nxm_type may be restricted based + * on the presence of or values of other "nxm_entry"s. For example: + * + * - An nxm_entry for nxm_type=NXM_OF_IP_TOS is allowed only if it is + * preceded by another entry with nxm_type=NXM_OF_ETH_TYPE, nxm_hasmask=0, + * and nxm_value=0x0800. That is, matching on the IP source address is + * allowed only if the Ethernet type is explicitly set to IP. + * + * - An nxm_entry for nxm_type=NXM_OF_TCP_SRC is allowed only if it is + * preceded by an entry with nxm_type=NXM_OF_ETH_TYPE, nxm_hasmask=0, and + * nxm_value either 0x0800 or 0x86dd, and another with + * nxm_type=NXM_OF_IP_PROTO, nxm_hasmask=0, nxm_value=6, in that order. + * That is, matching on the TCP source port is allowed only if the Ethernet + * type is IP or IPv6 and the IP protocol is TCP. + * + * These restrictions should be noted in specifications for individual fields. + * A switch may implement relaxed versions of these restrictions. A switch + * must reject an attempt to set up a flow that violates its restrictions. + * + * + * Ordering Restrictions + * ===================== + * + * An nxm_entry that has prerequisite restrictions must appear after the + * "nxm_entry"s for its prerequisites. Ordering of "nxm_entry"s within an + * nx_match is not otherwise constrained. + * + * Any given nxm_type may appear in an nx_match at most once. + * + * + * nxm_entry Examples + * ================== + * + * These examples show the format of a single nxm_entry with particular + * nxm_hasmask and nxm_length values. The diagrams are labeled with field + * numbers and byte indexes. + * + * + * 8-bit nxm_value, nxm_hasmask=1, nxm_length=2: + * + * 0 3 4 5 + * +------------+---+---+ + * | header | v | m | + * +------------+---+---+ + * + * + * 16-bit nxm_value, nxm_hasmask=0, nxm_length=2: + * + * 0 3 4 5 + * +------------+------+ + * | header | value| + * +------------+------+ + * + * + * 32-bit nxm_value, nxm_hasmask=0, nxm_length=4: + * + * 0 3 4 7 + * +------------+-------------+ + * | header | nxm_value | + * +------------+-------------+ + * + * + * 48-bit nxm_value, nxm_hasmask=0, nxm_length=6: + * + * 0 3 4 9 + * +------------+------------------+ + * | header | nxm_value | + * +------------+------------------+ + * + * + * 48-bit nxm_value, nxm_hasmask=1, nxm_length=12: + * + * 0 3 4 9 10 15 + * +------------+------------------+------------------+ + * | header | nxm_value | nxm_mask | + * +------------+------------------+------------------+ + * + * + * Error Reporting + * =============== + * + * A switch should report an error in an nx_match using error type + * OFPET_BAD_REQUEST and one of the NXBRC_NXM_* codes. Ideally the switch + * should report a specific error code, if one is assigned for the particular + * problem, but NXBRC_NXM_INVALID is also available to report a generic + * nx_match error. + */ + +/* Number of registers allocated NXM field IDs. */ +#define NXM_NX_MAX_REGS 16 + +/* Bits in the value of NXM_NX_IP_FRAG. */ +#define NX_IP_FRAG_ANY (1 << 0) /* Is this a fragment? */ +#define NX_IP_FRAG_LATER (1 << 1) /* Is this a fragment with nonzero offset? */ + +/* Bits in the value of NXM_NX_TUN_FLAGS. */ +#define NX_TUN_FLAG_OAM (1 << 0) /* Is this an OAM packet? */ + +/* ## --------------------- ## */ +/* ## Requests and replies. ## */ +/* ## --------------------- ## */ + +enum nx_flow_format { + NXFF_OPENFLOW10 = 0, /* Standard OpenFlow 1.0 compatible. */ + NXFF_NXM = 2 /* Nicira extended match. */ +}; + +/* NXT_SET_FLOW_FORMAT request. */ +struct nx_set_flow_format { + ovs_be32 format; /* One of NXFF_*. */ +}; +OFP_ASSERT(sizeof(struct nx_set_flow_format) == 4); + +/* NXT_FLOW_MOD (analogous to OFPT_FLOW_MOD). + * + * It is possible to limit flow deletions and modifications to certain + * cookies by using the NXM_NX_COOKIE(_W) matches. The "cookie" field + * is used only to add or modify flow cookies. + */ +struct nx_flow_mod { + ovs_be64 cookie; /* Opaque controller-issued identifier. */ + ovs_be16 command; /* OFPFC_* + possibly a table ID (see comment + * on struct nx_flow_mod_table_id). */ + ovs_be16 idle_timeout; /* Idle time before discarding (seconds). */ + ovs_be16 hard_timeout; /* Max time before discarding (seconds). */ + ovs_be16 priority; /* Priority level of flow entry. */ + ovs_be32 buffer_id; /* Buffered packet to apply to (or -1). + Not meaningful for OFPFC_DELETE*. */ + ovs_be16 out_port; /* For OFPFC_DELETE* commands, require + matching entries to include this as an + output port. A value of OFPP_NONE + indicates no restriction. */ + ovs_be16 flags; /* One of OFPFF_*. */ + ovs_be16 match_len; /* Size of nx_match. */ + uint8_t pad[6]; /* Align to 64-bits. */ + /* Followed by: + * - Exactly match_len (possibly 0) bytes containing the nx_match, then + * - Exactly (match_len + 7)/8*8 - match_len (between 0 and 7) bytes of + * all-zero bytes, then + * - Actions to fill out the remainder of the message length (always a + * multiple of 8). + */ +}; +OFP_ASSERT(sizeof(struct nx_flow_mod) == 32); + +/* NXT_FLOW_REMOVED (analogous to OFPT_FLOW_REMOVED). + * + * 'table_id' is present only in Open vSwitch 1.11 and later. In earlier + * versions of Open vSwitch, this is a padding byte that is always zeroed. + * Therefore, a 'table_id' value of 0 indicates that the table ID is not known, + * and other values may be interpreted as one more than the flow's former table + * ID. */ +struct nx_flow_removed { + ovs_be64 cookie; /* Opaque controller-issued identifier. */ + ovs_be16 priority; /* Priority level of flow entry. */ + uint8_t reason; /* One of OFPRR_*. */ + uint8_t table_id; /* Flow's former table ID, plus one. */ + ovs_be32 duration_sec; /* Time flow was alive in seconds. */ + ovs_be32 duration_nsec; /* Time flow was alive in nanoseconds beyond + duration_sec. */ + ovs_be16 idle_timeout; /* Idle timeout from original flow mod. */ + ovs_be16 match_len; /* Size of nx_match. */ + ovs_be64 packet_count; + ovs_be64 byte_count; + /* Followed by: + * - Exactly match_len (possibly 0) bytes containing the nx_match, then + * - Exactly (match_len + 7)/8*8 - match_len (between 0 and 7) bytes of + * all-zero bytes. */ +}; +OFP_ASSERT(sizeof(struct nx_flow_removed) == 40); + +/* Nicira vendor stats request of type NXST_FLOW (analogous to OFPST_FLOW + * request). + * + * It is possible to limit matches to certain cookies by using the + * NXM_NX_COOKIE and NXM_NX_COOKIE_W matches. + */ +struct nx_flow_stats_request { + ovs_be16 out_port; /* Require matching entries to include this + as an output port. A value of OFPP_NONE + indicates no restriction. */ + ovs_be16 match_len; /* Length of nx_match. */ + uint8_t table_id; /* ID of table to read (from ofp_table_stats) + or 0xff for all tables. */ + uint8_t pad[3]; /* Align to 64 bits. */ + /* Followed by: + * - Exactly match_len (possibly 0) bytes containing the nx_match, then + * - Exactly (match_len + 7)/8*8 - match_len (between 0 and 7) bytes of + * all-zero bytes, which must also exactly fill out the length of the + * message. + */ +}; +OFP_ASSERT(sizeof(struct nx_flow_stats_request) == 8); + +/* Body for Nicira vendor stats reply of type NXST_FLOW (analogous to + * OFPST_FLOW reply). + * + * The values of 'idle_age' and 'hard_age' are only meaningful when talking to + * a switch that implements the NXT_FLOW_AGE extension. Zero means that the + * true value is unknown, perhaps because hardware does not track the value. + * (Zero is also the value that one should ordinarily expect to see talking to + * a switch that does not implement NXT_FLOW_AGE, since those switches zero the + * padding bytes that these fields replaced.) A nonzero value X represents X-1 + * seconds. A value of 65535 represents 65534 or more seconds. + * + * 'idle_age' is the number of seconds that the flow has been idle, that is, + * the number of seconds since a packet passed through the flow. 'hard_age' is + * the number of seconds since the flow was last modified (e.g. OFPFC_MODIFY or + * OFPFC_MODIFY_STRICT). (The 'duration_*' fields are the elapsed time since + * the flow was added, regardless of subsequent modifications.) + * + * For a flow with an idle or hard timeout, 'idle_age' or 'hard_age', + * respectively, will ordinarily be smaller than the timeout, but flow + * expiration times are only approximate and so one must be prepared to + * tolerate expirations that occur somewhat early or late. + */ +struct nx_flow_stats { + ovs_be16 length; /* Length of this entry. */ + uint8_t table_id; /* ID of table flow came from. */ + uint8_t pad; + ovs_be32 duration_sec; /* Time flow has been alive in seconds. */ + ovs_be32 duration_nsec; /* Time flow has been alive in nanoseconds + beyond duration_sec. */ + ovs_be16 priority; /* Priority of the entry. */ + ovs_be16 idle_timeout; /* Number of seconds idle before expiration. */ + ovs_be16 hard_timeout; /* Number of seconds before expiration. */ + ovs_be16 match_len; /* Length of nx_match. */ + ovs_be16 idle_age; /* Seconds since last packet, plus one. */ + ovs_be16 hard_age; /* Seconds since last modification, plus one. */ + ovs_be64 cookie; /* Opaque controller-issued identifier. */ + ovs_be64 packet_count; /* Number of packets, UINT64_MAX if unknown. */ + ovs_be64 byte_count; /* Number of bytes, UINT64_MAX if unknown. */ + /* Followed by: + * - Exactly match_len (possibly 0) bytes containing the nx_match, then + * - Exactly (match_len + 7)/8*8 - match_len (between 0 and 7) bytes of + * all-zero bytes, then + * - Actions to fill out the remainder 'length' bytes (always a multiple + * of 8). + */ +}; +OFP_ASSERT(sizeof(struct nx_flow_stats) == 48); + +/* Nicira vendor stats request of type NXST_AGGREGATE (analogous to + * OFPST_AGGREGATE request). + * + * The reply format is identical to the reply format for OFPST_AGGREGATE, + * except for the header. */ +struct nx_aggregate_stats_request { + ovs_be16 out_port; /* Require matching entries to include this + as an output port. A value of OFPP_NONE + indicates no restriction. */ + ovs_be16 match_len; /* Length of nx_match. */ + uint8_t table_id; /* ID of table to read (from ofp_table_stats) + or 0xff for all tables. */ + uint8_t pad[3]; /* Align to 64 bits. */ + /* Followed by: + * - Exactly match_len (possibly 0) bytes containing the nx_match, then + * - Exactly (match_len + 7)/8*8 - match_len (between 0 and 7) bytes of + * all-zero bytes, which must also exactly fill out the length of the + * message. + */ +}; +OFP_ASSERT(sizeof(struct nx_aggregate_stats_request) == 8); + +struct nx_ipfix_stats_reply { + ovs_be64 total_flows; + ovs_be64 current_flows; + ovs_be64 pkts; + ovs_be64 ipv4_pkts; + ovs_be64 ipv6_pkts; + ovs_be64 error_pkts; + ovs_be64 ipv4_error_pkts; + ovs_be64 ipv6_error_pkts; + ovs_be64 tx_pkts; + ovs_be64 tx_errors; + ovs_be32 collector_set_id; /* Range 0 to 4,294,967,295. */ + uint8_t pad[4]; /* Pad to a multiple of 8 bytes. */ +}; +OFP_ASSERT(sizeof(struct nx_ipfix_stats_reply) == 88); + + +/* NXT_SET_CONTROLLER_ID. + * + * Each OpenFlow controller connection has a 16-bit identifier that is + * initially 0. This message changes the connection's ID to 'id'. + * + * Controller connection IDs need not be unique. + * + * The NXAST_CONTROLLER action is the only current user of controller + * connection IDs. */ +struct nx_controller_id { + uint8_t zero[6]; /* Must be zero. */ + ovs_be16 controller_id; /* New controller connection ID. */ +}; +OFP_ASSERT(sizeof(struct nx_controller_id) == 8); + +/* Flow Table Monitoring + * ===================== + * + * NXST_FLOW_MONITOR allows a controller to keep track of changes to OpenFlow + * flow table(s) or subsets of them, with the following workflow: + * + * 1. The controller sends an NXST_FLOW_MONITOR request to begin monitoring + * flows. The 'id' in the request must be unique among all monitors that + * the controller has started and not yet canceled on this OpenFlow + * connection. + * + * 2. The switch responds with an NXST_FLOW_MONITOR reply. If the request's + * 'flags' included NXFMF_INITIAL, the reply includes all the flows that + * matched the request at the time of the request (with event NXFME_ADDED). + * If 'flags' did not include NXFMF_INITIAL, the reply is empty. + * + * The reply uses the xid of the request (as do all replies to OpenFlow + * requests). + * + * 3. Whenever a change to a flow table entry matches some outstanding monitor + * request's criteria and flags, the switch sends a notification to the + * controller as an additional NXST_FLOW_MONITOR reply with xid 0. + * + * When multiple outstanding monitors match a single change, only a single + * notification is sent. This merged notification includes the information + * requested in any of the individual monitors. That is, if any of the + * matching monitors requests actions (NXFMF_ACTIONS), the notification + * includes actions, and if any of the monitors request full changes for the + * controller's own changes (NXFMF_OWN), the controller's own changes will + * be included in full. + * + * 4. The controller may cancel a monitor with NXT_FLOW_MONITOR_CANCEL. No + * further notifications will be sent on the basis of the canceled monitor + * afterward. + * + * + * Buffer Management + * ================= + * + * OpenFlow messages for flow monitor notifications can overflow the buffer + * space available to the switch, either temporarily (e.g. due to network + * conditions slowing OpenFlow traffic) or more permanently (e.g. the sustained + * rate of flow table change exceeds the network bandwidth between switch and + * controller). + * + * When Open vSwitch's notification buffer space reaches a limiting threshold, + * OVS reacts as follows: + * + * 1. OVS sends an NXT_FLOW_MONITOR_PAUSED message to the controller, following + * all the already queued notifications. After it receives this message, + * the controller knows that its view of the flow table, as represented by + * flow monitor notifications, is incomplete. + * + * 2. As long as the notification buffer is not empty: + * + * - NXMFE_ADD and NXFME_MODIFIED notifications will not be sent. + * + * - NXFME_DELETED notifications will still be sent, but only for flows + * that existed before OVS sent NXT_FLOW_MONITOR_PAUSED. + * + * - NXFME_ABBREV notifications will not be sent. They are treated as + * the expanded version (and therefore only the NXFME_DELETED + * components, if any, are sent). + * + * 3. When the notification buffer empties, OVS sends NXFME_ADD notifications + * for flows added since the buffer reached its limit and NXFME_MODIFIED + * notifications for flows that existed before the limit was reached and + * changed after the limit was reached. + * + * 4. OVS sends an NXT_FLOW_MONITOR_RESUMED message to the controller. After + * it receives this message, the controller knows that its view of the flow + * table, as represented by flow monitor notifications, is again complete. + * + * This allows the maximum buffer space requirement for notifications to be + * bounded by the limit plus the maximum number of supported flows. + * + * + * "Flow Removed" messages + * ======================= + * + * The flow monitor mechanism is independent of OFPT_FLOW_REMOVED and + * NXT_FLOW_REMOVED. Flow monitor updates for deletion are sent if + * NXFMF_DELETE is set on a monitor, regardless of whether the + * OFPFF_SEND_FLOW_REM flag was set when the flow was added. */ + +/* NXST_FLOW_MONITOR request. + * + * The NXST_FLOW_MONITOR request's body consists of an array of zero or more + * instances of this structure. The request arranges to monitor the flows + * that match the specified criteria, which are interpreted in the same way as + * for NXST_FLOW. + * + * 'id' identifies a particular monitor for the purpose of allowing it to be + * canceled later with NXT_FLOW_MONITOR_CANCEL. 'id' must be unique among + * existing monitors that have not already been canceled. + * + * The reply includes the initial flow matches for monitors that have the + * NXFMF_INITIAL flag set. No single flow will be included in the reply more + * than once, even if more than one requested monitor matches that flow. The + * reply will be empty if none of the monitors has NXFMF_INITIAL set or if none + * of the monitors initially matches any flows. + * + * For NXFMF_ADD, an event will be reported if 'out_port' matches against the + * actions of the flow being added or, for a flow that is replacing an existing + * flow, if 'out_port' matches against the actions of the flow being replaced. + * For NXFMF_DELETE, 'out_port' matches against the actions of a flow being + * deleted. For NXFMF_MODIFY, an event will be reported if 'out_port' matches + * either the old or the new actions. */ +struct nx_flow_monitor_request { + ovs_be32 id; /* Controller-assigned ID for this monitor. */ + ovs_be16 flags; /* NXFMF_*. */ + ovs_be16 out_port; /* Required output port, if not OFPP_NONE. */ + ovs_be16 match_len; /* Length of nx_match. */ + uint8_t table_id; /* One table's ID or 0xff for all tables. */ + uint8_t zeros[5]; /* Align to 64 bits (must be zero). */ + /* Followed by: + * - Exactly match_len (possibly 0) bytes containing the nx_match, then + * - Exactly (match_len + 7)/8*8 - match_len (between 0 and 7) bytes of + * all-zero bytes. */ +}; +OFP_ASSERT(sizeof(struct nx_flow_monitor_request) == 16); + +/* 'flags' bits in struct nx_flow_monitor_request. */ +enum nx_flow_monitor_flags { + /* When to send updates. */ + NXFMF_INITIAL = 1 << 0, /* Initially matching flows. */ + NXFMF_ADD = 1 << 1, /* New matching flows as they are added. */ + NXFMF_DELETE = 1 << 2, /* Old matching flows as they are removed. */ + NXFMF_MODIFY = 1 << 3, /* Matching flows as they are changed. */ + + /* What to include in updates. */ + NXFMF_ACTIONS = 1 << 4, /* If set, actions are included. */ + NXFMF_OWN = 1 << 5, /* If set, include own changes in full. */ +}; + +/* NXST_FLOW_MONITOR reply header. + * + * The body of an NXST_FLOW_MONITOR reply is an array of variable-length + * structures, each of which begins with this header. The 'length' member may + * be used to traverse the array, and the 'event' member may be used to + * determine the particular structure. + * + * Every instance is a multiple of 8 bytes long. */ +struct nx_flow_update_header { + ovs_be16 length; /* Length of this entry. */ + ovs_be16 event; /* One of NXFME_*. */ + /* ...other data depending on 'event'... */ +}; +OFP_ASSERT(sizeof(struct nx_flow_update_header) == 4); + +/* 'event' values in struct nx_flow_update_header. */ +enum nx_flow_update_event { + /* struct nx_flow_update_full. */ + NXFME_ADDED = 0, /* Flow was added. */ + NXFME_DELETED = 1, /* Flow was deleted. */ + NXFME_MODIFIED = 2, /* Flow (generally its actions) was changed. */ + + /* struct nx_flow_update_abbrev. */ + NXFME_ABBREV = 3, /* Abbreviated reply. */ +}; + +/* NXST_FLOW_MONITOR reply for NXFME_ADDED, NXFME_DELETED, and + * NXFME_MODIFIED. */ +struct nx_flow_update_full { + ovs_be16 length; /* Length is 24. */ + ovs_be16 event; /* One of NXFME_*. */ + ovs_be16 reason; /* OFPRR_* for NXFME_DELETED, else zero. */ + ovs_be16 priority; /* Priority of the entry. */ + ovs_be16 idle_timeout; /* Number of seconds idle before expiration. */ + ovs_be16 hard_timeout; /* Number of seconds before expiration. */ + ovs_be16 match_len; /* Length of nx_match. */ + uint8_t table_id; /* ID of flow's table. */ + uint8_t pad; /* Reserved, currently zeroed. */ + ovs_be64 cookie; /* Opaque controller-issued identifier. */ + /* Followed by: + * - Exactly match_len (possibly 0) bytes containing the nx_match, then + * - Exactly (match_len + 7)/8*8 - match_len (between 0 and 7) bytes of + * all-zero bytes, then + * - Actions to fill out the remainder 'length' bytes (always a multiple + * of 8). If NXFMF_ACTIONS was not specified, or 'event' is + * NXFME_DELETED, no actions are included. + */ +}; +OFP_ASSERT(sizeof(struct nx_flow_update_full) == 24); + +/* NXST_FLOW_MONITOR reply for NXFME_ABBREV. + * + * When the controller does not specify NXFMF_OWN in a monitor request, any + * flow tables changes due to the controller's own requests (on the same + * OpenFlow channel) will be abbreviated, when possible, to this form, which + * simply specifies the 'xid' of the OpenFlow request (e.g. an OFPT_FLOW_MOD or + * NXT_FLOW_MOD) that caused the change. + * + * Some changes cannot be abbreviated and will be sent in full: + * + * - Changes that only partially succeed. This can happen if, for example, + * a flow_mod with type OFPFC_MODIFY affects multiple flows, but only some + * of those modifications succeed (e.g. due to hardware limitations). + * + * This cannot occur with the Open vSwitch software datapath. This also + * cannot occur in Open vSwitch 2.4 and later, because these versions only + * execute any flow modifications if all of them will succeed. + * + * - Changes that race with conflicting changes made by other controllers or + * other flow_mods (not separated by barriers) by the same controller. + * + * This cannot occur with the current Open vSwitch implementation + * (regardless of datapath) because Open vSwitch internally serializes + * potentially conflicting changes. + * + * - Changes that occur when flow notification is paused (see "Buffer + * Management" above). + * + * A flow_mod that does not change the flow table will not trigger any + * notification, even an abbreviated one. For example, a "modify" or "delete" + * flow_mod that does not match any flows will not trigger a notification. + * Whether an "add" or "modify" that specifies all the same parameters that a + * flow already has triggers a notification is unspecified and subject to + * change in future versions of Open vSwitch. + * + * OVS will always send the notifications for a given flow table change before + * the reply to a OFPT_BARRIER_REQUEST request that follows the flow table + * change. Thus, if the controller does not receive an abbreviated (or + * unabbreviated) notification for a flow_mod before the next + * OFPT_BARRIER_REPLY, it will never receive one. */ +struct nx_flow_update_abbrev { + ovs_be16 length; /* Length is 8. */ + ovs_be16 event; /* NXFME_ABBREV. */ + ovs_be32 xid; /* Controller-specified xid from flow_mod. */ +}; +OFP_ASSERT(sizeof(struct nx_flow_update_abbrev) == 8); + +/* NXT_FLOW_MONITOR_CANCEL. + * + * Used by a controller to cancel an outstanding monitor. */ +struct nx_flow_monitor_cancel { + ovs_be32 id; /* 'id' from nx_flow_monitor_request. */ +}; +OFP_ASSERT(sizeof(struct nx_flow_monitor_cancel) == 4); + +/* Variable-length option TLV table maintenance commands. + * + * The option in Type-Length-Value format is widely used in tunnel options, + * e.g., the base Geneve header is followed by zero or more options in TLV + * format. Each option consists of a four byte option header and a variable + * amount of option data interpreted according to the type. The generic TLV + * format in tunnel options is as following: + * + * 0 1 2 3 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Option Class | Type |R|R|R| Length | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Variable Option Data | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * + * In order to work with this variable-length options in TLV format in + * tunnel options, we need to maintain a mapping table between an option + * TLV (defined by ) and an NXM field that can be + * operated on for the purposes of matches, actions, etc. This mapping + * must be explicitly specified by the user. + * + * There are two primary groups of OpenFlow messages that are introduced + * as Nicira extensions: modification commands (add, delete, clear mappings) + * and table status request/reply to dump the current table along with switch + * information. + * + * Note that mappings should not be changed while they are in active use by + * a flow. The result of doing so is undefined. */ + +/* TLV table commands */ +enum nx_tlv_table_mod_command { + NXTTMC_ADD, /* New mappings (fails if an option is already + mapped). */ + NXTTMC_DELETE, /* Delete mappings, identified by index + * (unmapped options are ignored). */ + NXTTMC_CLEAR, /* Clear all mappings. Additional information + in this command is ignored. */ +}; + +/* Map between an option TLV and an NXM field. */ +struct nx_tlv_map { + ovs_be16 option_class; /* TLV class. */ + uint8_t option_type; /* TLV type. */ + uint8_t option_len; /* TLV length (multiple of 4). */ + ovs_be16 index; /* NXM_NX_TUN_METADATA index */ + uint8_t pad[2]; +}; +OFP_ASSERT(sizeof(struct nx_tlv_map) == 8); + +/* NXT_TLV_TABLE_MOD. + * + * Use to configure a mapping between option TLVs (class, type, length) + * and NXM fields (NXM_NX_TUN_METADATA where 'index' is ). + * + * This command is atomic: all operations on different options will + * either succeed or fail. */ +struct nx_tlv_table_mod { + ovs_be16 command; /* One of NTTTMC_* */ + uint8_t pad[6]; + /* struct nx_tlv_map[0]; Array of maps between indicies and option + TLVs. The number of elements is inferred + from the length field in the header. */ +}; +OFP_ASSERT(sizeof(struct nx_tlv_table_mod) == 8); + +/* NXT_TLV_TABLE_REPLY. + * + * Issued in reponse to an NXT_TLV_TABLE_REQUEST to give information + * about the current status of the TLV table in the switch. Provides + * both static information about the switch's capabilities as well as + * the configured TLV table. */ +struct nx_tlv_table_reply { + ovs_be32 max_option_space; /* Maximum total of option sizes supported. */ + ovs_be16 max_fields; /* Maximum number of match fields supported. */ + uint8_t reserved[10]; + /* struct nx_tlv_map[0]; Array of maps between indicies and option + TLVs. The number of elements is inferred + from the length field in the header. */ +}; +OFP_ASSERT(sizeof(struct nx_tlv_table_reply) == 16); + +/* NXT_CT_FLUSH_ZONE. + * + * Flushes the connection tracking table. */ +struct nx_zone_id { + uint8_t zero[6]; /* Must be zero. */ + ovs_be16 zone_id; /* Connection tracking zone. */ +}; +OFP_ASSERT(sizeof(struct nx_zone_id) == 8); + +#endif /* openflow/nicira-ext.h */ diff --git a/openflow/include/openflow/openflow-1.0.h b/openflow/include/openflow/openflow-1.0.h new file mode 100644 index 0000000..68c7952 --- /dev/null +++ b/openflow/include/openflow/openflow-1.0.h @@ -0,0 +1,438 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* OpenFlow: protocol between controller and datapath. */ + +#ifndef OPENFLOW_OPENFLOW10_H +#define OPENFLOW_OPENFLOW10_H 1 + +#include + +/* Port number(s) meaning + * --------------- -------------------------------------- + * 0x0000 not assigned a meaning by OpenFlow 1.0 + * 0x0001...0xfeff "physical" ports + * 0xff00...0xfff6 "reserved" but not assigned a meaning by OpenFlow 1.x + * 0xfff7...0xffff "reserved" OFPP_* ports with assigned meanings + */ + +/* Ranges. */ +#define OFPP_MAX OFP_PORT_C(0xff00) /* Max # of switch ports. */ +#define OFPP_FIRST_RESV OFP_PORT_C(0xfff7) /* First assigned reserved port. */ +#define OFPP_LAST_RESV OFP_PORT_C(0xffff) /* Last assigned reserved port. */ + +/* Reserved output "ports". */ +#define OFPP_UNSET OFP_PORT_C(0xfff7) /* For OXM_OF_ACTSET_OUTPUT only. */ +#define OFPP_IN_PORT OFP_PORT_C(0xfff8) /* Where the packet came in. */ +#define OFPP_TABLE OFP_PORT_C(0xfff9) /* Perform actions in flow table. */ +#define OFPP_NORMAL OFP_PORT_C(0xfffa) /* Process with normal L2/L3. */ +#define OFPP_FLOOD OFP_PORT_C(0xfffb) /* All ports except input port and + * ports disabled by STP. */ +#define OFPP_ALL OFP_PORT_C(0xfffc) /* All ports except input port. */ +#define OFPP_CONTROLLER OFP_PORT_C(0xfffd) /* Send to controller. */ +#define OFPP_LOCAL OFP_PORT_C(0xfffe) /* Local openflow "port". */ +#define OFPP_NONE OFP_PORT_C(0xffff) /* Not associated with any port. */ + +/* OpenFlow 1.0 specific capabilities supported by the datapath (struct + * ofp_switch_features, member capabilities). */ +enum ofp10_capabilities { + OFPC10_STP = 1 << 3, /* 802.1d spanning tree. */ + OFPC10_RESERVED = 1 << 4, /* Reserved, must not be set. */ +}; + +/* OpenFlow 1.0 specific flags to indicate behavior of the physical port. + * These flags are used in ofp10_phy_port to describe the current + * configuration. They are used in the ofp10_port_mod message to configure the + * port's behavior. + */ +enum ofp10_port_config { + OFPPC10_NO_STP = 1 << 1, /* Disable 802.1D spanning tree on port. */ + OFPPC10_NO_RECV_STP = 1 << 3, /* Drop received 802.1D STP packets. */ + OFPPC10_NO_FLOOD = 1 << 4, /* Do not include port when flooding. */ +#define OFPPC10_ALL (OFPPC_PORT_DOWN | OFPPC10_NO_STP | OFPPC_NO_RECV | \ + OFPPC10_NO_RECV_STP | OFPPC10_NO_FLOOD | OFPPC_NO_FWD | \ + OFPPC_NO_PACKET_IN) +}; + +/* OpenFlow 1.0 specific current state of the physical port. These are not + * configurable from the controller. + */ +enum ofp10_port_state { + /* The OFPPS10_STP_* bits have no effect on switch operation. The + * controller must adjust OFPPC_NO_RECV, OFPPC_NO_FWD, and + * OFPPC_NO_PACKET_IN appropriately to fully implement an 802.1D spanning + * tree. */ + OFPPS10_STP_LISTEN = 0 << 8, /* Not learning or relaying frames. */ + OFPPS10_STP_LEARN = 1 << 8, /* Learning but not relaying frames. */ + OFPPS10_STP_FORWARD = 2 << 8, /* Learning and relaying frames. */ + OFPPS10_STP_BLOCK = 3 << 8, /* Not part of spanning tree. */ + OFPPS10_STP_MASK = 3 << 8 /* Bit mask for OFPPS10_STP_* values. */ + +#define OFPPS10_ALL (OFPPS_LINK_DOWN | OFPPS10_STP_MASK) +}; + +/* OpenFlow 1.0 specific features of physical ports available in a datapath. */ +enum ofp10_port_features { + OFPPF10_COPPER = 1 << 7, /* Copper medium. */ + OFPPF10_FIBER = 1 << 8, /* Fiber medium. */ + OFPPF10_AUTONEG = 1 << 9, /* Auto-negotiation. */ + OFPPF10_PAUSE = 1 << 10, /* Pause. */ + OFPPF10_PAUSE_ASYM = 1 << 11 /* Asymmetric pause. */ +}; + +/* Description of a physical port */ +struct ofp10_phy_port { + ovs_be16 port_no; + struct eth_addr hw_addr; + char name[OFP_MAX_PORT_NAME_LEN]; /* Null-terminated */ + + ovs_be32 config; /* Bitmap of OFPPC_* and OFPPC10_* flags. */ + ovs_be32 state; /* Bitmap of OFPPS_* and OFPPS10_* flags. */ + + /* Bitmaps of OFPPF_* and OFPPF10_* that describe features. All bits + * zeroed if unsupported or unavailable. */ + ovs_be32 curr; /* Current features. */ + ovs_be32 advertised; /* Features being advertised by the port. */ + ovs_be32 supported; /* Features supported by the port. */ + ovs_be32 peer; /* Features advertised by peer. */ +}; +OFP_ASSERT(sizeof(struct ofp10_phy_port) == 48); + +/* Modify behavior of the physical port */ +struct ofp10_port_mod { + ovs_be16 port_no; + struct eth_addr hw_addr; /* The hardware address is not configurable. This + is used to sanity-check the request, so it must + be the same as returned in an ofp10_phy_port + struct. */ + + ovs_be32 config; /* Bitmap of OFPPC_* flags. */ + ovs_be32 mask; /* Bitmap of OFPPC_* flags to be changed. */ + + ovs_be32 advertise; /* Bitmap of "ofp_port_features"s. Zero all + bits to prevent any action taking place. */ + uint8_t pad[4]; /* Pad to 64-bits. */ +}; +OFP_ASSERT(sizeof(struct ofp10_port_mod) == 24); + +struct ofp10_packet_queue { + ovs_be32 queue_id; /* id for the specific queue. */ + ovs_be16 len; /* Length in bytes of this queue desc. */ + uint8_t pad[2]; /* 64-bit alignment. */ + /* Followed by any number of queue properties expressed using + * ofp_queue_prop_header, to fill out a total of 'len' bytes. */ +}; +OFP_ASSERT(sizeof(struct ofp10_packet_queue) == 8); + +/* Queue properties for OF1.0 to OF1.3. + * + * OF1.4+ use the same numbers but rename them and change the property formats + * in incompatible ways, so there's not much benefit to sharing the names. */ +enum ofp10_queue_properties { + /* Introduced in OF1.0. */ + OFPQT10_MIN_RATE = 1, /* Minimum datarate guaranteed. */ + + /* Introduced in OF1.1. */ + OFPQT11_MAX_RATE = 2, /* Maximum guaranteed rate. */ + OFPQT11_EXPERIMENTER = 0xffff, /* Experimenter defined property. */ +}; + +/* Description for a queue in OpenFlow 1.0 to 1.3. + * + * OF1.4+ also use a TLV format but an incompatible one. */ +struct ofp10_queue_prop_header { + ovs_be16 property; /* One of OFPQT*. */ + ovs_be16 len; /* Length of property, including this header. */ + uint8_t pad[4]; /* 64-bit alignemnt. */ +}; +OFP_ASSERT(sizeof(struct ofp10_queue_prop_header) == 8); + +/* Min-Rate and Max-Rate queue property description (OFPQT10_MIN and + * OFPQT11_MAX). + * + * OF1.4+ use similar TLVs but they are incompatible due to different padding. + */ +struct ofp10_queue_prop_rate { + struct ofp10_queue_prop_header prop_header; + ovs_be16 rate; /* In 1/10 of a percent; >1000 -> disabled. */ + uint8_t pad[6]; /* 64-bit alignment */ +}; +OFP_ASSERT(sizeof(struct ofp10_queue_prop_rate) == 16); + +/* Query for port queue configuration. */ +struct ofp10_queue_get_config_request { + ovs_be16 port; /* Port to be queried. Should refer + to a valid physical port (i.e. < OFPP_MAX) */ + uint8_t pad[2]; + /* 32-bit alignment. */ +}; +OFP_ASSERT(sizeof(struct ofp10_queue_get_config_request) == 4); + +/* Queue configuration for a given port. */ +struct ofp10_queue_get_config_reply { + ovs_be16 port; + uint8_t pad[6]; + /* struct ofp10_packet_queue queues[0]; List of configured queues. */ +}; +OFP_ASSERT(sizeof(struct ofp10_queue_get_config_reply) == 8); + +/* Packet received on port (datapath -> controller). */ +struct ofp10_packet_in { + ovs_be32 buffer_id; /* ID assigned by datapath. */ + ovs_be16 total_len; /* Full length of frame. */ + ovs_be16 in_port; /* Port on which frame was received. */ + uint8_t reason; /* Reason packet is being sent (one of OFPR_*) */ + uint8_t pad; + uint8_t data[0]; /* Ethernet frame, halfway through 32-bit word, + so the IP header is 32-bit aligned. The + amount of data is inferred from the length + field in the header. Because of padding, + offsetof(struct ofp_packet_in, data) == + sizeof(struct ofp_packet_in) - 2. */ +}; +OFP_ASSERT(sizeof(struct ofp10_packet_in) == 12); + +/* Send packet (controller -> datapath). */ +struct ofp10_packet_out { + ovs_be32 buffer_id; /* ID assigned by datapath or UINT32_MAX. */ + ovs_be16 in_port; /* Packet's input port (OFPP_NONE if none). */ + ovs_be16 actions_len; /* Size of action array in bytes. */ + /* Followed by: + * - Exactly 'actions_len' bytes (possibly 0 bytes, and always a multiple + * of 8) containing actions. + * - If 'buffer_id' == UINT32_MAX, packet data to fill out the remainder + * of the message length. + */ +}; +OFP_ASSERT(sizeof(struct ofp10_packet_out) == 8); + +/* Flow wildcards. */ +enum ofp10_flow_wildcards { + OFPFW10_IN_PORT = 1 << 0, /* Switch input port. */ + OFPFW10_DL_VLAN = 1 << 1, /* VLAN vid. */ + OFPFW10_DL_SRC = 1 << 2, /* Ethernet source address. */ + OFPFW10_DL_DST = 1 << 3, /* Ethernet destination address. */ + OFPFW10_DL_TYPE = 1 << 4, /* Ethernet frame type. */ + OFPFW10_NW_PROTO = 1 << 5, /* IP protocol. */ + OFPFW10_TP_SRC = 1 << 6, /* TCP/UDP source port. */ + OFPFW10_TP_DST = 1 << 7, /* TCP/UDP destination port. */ + + /* IP source address wildcard bit count. 0 is exact match, 1 ignores the + * LSB, 2 ignores the 2 least-significant bits, ..., 32 and higher wildcard + * the entire field. This is the *opposite* of the usual convention where + * e.g. /24 indicates that 8 bits (not 24 bits) are wildcarded. */ + OFPFW10_NW_SRC_SHIFT = 8, + OFPFW10_NW_SRC_BITS = 6, + OFPFW10_NW_SRC_MASK = (((1 << OFPFW10_NW_SRC_BITS) - 1) + << OFPFW10_NW_SRC_SHIFT), + OFPFW10_NW_SRC_ALL = 32 << OFPFW10_NW_SRC_SHIFT, + + /* IP destination address wildcard bit count. Same format as source. */ + OFPFW10_NW_DST_SHIFT = 14, + OFPFW10_NW_DST_BITS = 6, + OFPFW10_NW_DST_MASK = (((1 << OFPFW10_NW_DST_BITS) - 1) + << OFPFW10_NW_DST_SHIFT), + OFPFW10_NW_DST_ALL = 32 << OFPFW10_NW_DST_SHIFT, + + OFPFW10_DL_VLAN_PCP = 1 << 20, /* VLAN priority. */ + OFPFW10_NW_TOS = 1 << 21, /* IP ToS (DSCP field, 6 bits). */ + + /* Wildcard all fields. */ + OFPFW10_ALL = ((1 << 22) - 1) +}; + +/* The wildcards for ICMP type and code fields use the transport source + * and destination port fields, respectively. */ +#define OFPFW10_ICMP_TYPE OFPFW10_TP_SRC +#define OFPFW10_ICMP_CODE OFPFW10_TP_DST + +/* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate + * special conditions. All ones indicates that 802.1Q header is not present. + */ +#define OFP10_VLAN_NONE 0xffff + +/* Fields to match against flows */ +struct ofp10_match { + ovs_be32 wildcards; /* Wildcard fields. */ + ovs_be16 in_port; /* Input switch port. */ + struct eth_addr dl_src; /* Ethernet source address. */ + struct eth_addr dl_dst; /* Ethernet destination address. */ + ovs_be16 dl_vlan; /* Input VLAN. */ + uint8_t dl_vlan_pcp; /* Input VLAN priority. */ + uint8_t pad1[1]; /* Align to 64-bits. */ + ovs_be16 dl_type; /* Ethernet frame type. */ + uint8_t nw_tos; /* IP ToS (DSCP field, 6 bits). */ + uint8_t nw_proto; /* IP protocol or lower 8 bits of + ARP opcode. */ + uint8_t pad2[2]; /* Align to 64-bits. */ + ovs_be32 nw_src; /* IP source address. */ + ovs_be32 nw_dst; /* IP destination address. */ + ovs_be16 tp_src; /* TCP/UDP source port. */ + ovs_be16 tp_dst; /* TCP/UDP destination port. */ +}; +OFP_ASSERT(sizeof(struct ofp10_match) == 40); + +enum ofp10_flow_mod_flags { + OFPFF10_EMERG = 1 << 2 /* Part of "emergency flow cache". */ +}; + +/* Flow setup and teardown (controller -> datapath). */ +struct ofp10_flow_mod { + struct ofp10_match match; /* Fields to match */ + ovs_be64 cookie; /* Opaque controller-issued identifier. */ + + /* Flow actions. */ + ovs_be16 command; /* One of OFPFC_*. */ + ovs_be16 idle_timeout; /* Idle time before discarding (seconds). */ + ovs_be16 hard_timeout; /* Max time before discarding (seconds). */ + ovs_be16 priority; /* Priority level of flow entry. */ + ovs_be32 buffer_id; /* Buffered packet to apply to (or -1). + Not meaningful for OFPFC_DELETE*. */ + ovs_be16 out_port; /* For OFPFC_DELETE* commands, require + matching entries to include this as an + output port. A value of OFPP_NONE + indicates no restriction. */ + ovs_be16 flags; /* One of OFPFF_*. */ + + /* Followed by OpenFlow actions whose length is inferred from the length + * field in the OpenFlow header. */ +}; +OFP_ASSERT(sizeof(struct ofp10_flow_mod) == 64); + +/* Flow removed (datapath -> controller). */ +struct ofp10_flow_removed { + struct ofp10_match match; /* Description of fields. */ + ovs_be64 cookie; /* Opaque controller-issued identifier. */ + + ovs_be16 priority; /* Priority level of flow entry. */ + uint8_t reason; /* One of OFPRR_*. */ + uint8_t pad[1]; /* Align to 32-bits. */ + + ovs_be32 duration_sec; /* Time flow was alive in seconds. */ + ovs_be32 duration_nsec; /* Time flow was alive in nanoseconds beyond + duration_sec. */ + ovs_be16 idle_timeout; /* Idle timeout from original flow mod. */ + uint8_t pad2[2]; /* Align to 64-bits. */ + ovs_be64 packet_count; + ovs_be64 byte_count; +}; +OFP_ASSERT(sizeof(struct ofp10_flow_removed) == 80); + +/* Stats request of type OFPST_AGGREGATE or OFPST_FLOW. */ +struct ofp10_flow_stats_request { + struct ofp10_match match; /* Fields to match. */ + uint8_t table_id; /* ID of table to read (from ofp_table_stats) + or 0xff for all tables. */ + uint8_t pad; /* Align to 32 bits. */ + ovs_be16 out_port; /* Require matching entries to include this + as an output port. A value of OFPP_NONE + indicates no restriction. */ +}; +OFP_ASSERT(sizeof(struct ofp10_flow_stats_request) == 44); + +/* Body of reply to OFPST_FLOW request. */ +struct ofp10_flow_stats { + ovs_be16 length; /* Length of this entry. */ + uint8_t table_id; /* ID of table flow came from. */ + uint8_t pad; + struct ofp10_match match; /* Description of fields. */ + ovs_be32 duration_sec; /* Time flow has been alive in seconds. */ + ovs_be32 duration_nsec; /* Time flow has been alive in nanoseconds + beyond duration_sec. */ + ovs_be16 priority; /* Priority of the entry. Only meaningful + when this is not an exact-match entry. */ + ovs_be16 idle_timeout; /* Number of seconds idle before expiration. */ + ovs_be16 hard_timeout; /* Number of seconds before expiration. */ + uint8_t pad2[6]; /* Align to 64 bits. */ + ovs_32aligned_be64 cookie; /* Opaque controller-issued identifier. */ + ovs_32aligned_be64 packet_count; /* Number of packets in flow. */ + ovs_32aligned_be64 byte_count; /* Number of bytes in flow. */ + /* Followed by OpenFlow actions whose length is inferred from 'length'. */ +}; +OFP_ASSERT(sizeof(struct ofp10_flow_stats) == 88); + +/* Body of reply to OFPST_TABLE request. */ +struct ofp10_table_stats { + uint8_t table_id; /* Identifier of table. Lower numbered tables + are consulted first. */ + uint8_t pad[3]; /* Align to 32-bits. */ + char name[OFP_MAX_TABLE_NAME_LEN]; + ovs_be32 wildcards; /* Bitmap of OFPFW10_* wildcards that are + supported by the table. */ + ovs_be32 max_entries; /* Max number of entries supported. */ + ovs_be32 active_count; /* Number of active entries. */ + ovs_32aligned_be64 lookup_count; /* # of packets looked up in table. */ + ovs_32aligned_be64 matched_count; /* Number of packets that hit table. */ +}; +OFP_ASSERT(sizeof(struct ofp10_table_stats) == 64); + +/* Stats request of type OFPST_PORT. */ +struct ofp10_port_stats_request { + ovs_be16 port_no; /* OFPST_PORT message may request statistics + for a single port (specified with port_no) + or for all ports (port_no == OFPP_NONE). */ + uint8_t pad[6]; +}; +OFP_ASSERT(sizeof(struct ofp10_port_stats_request) == 8); + +/* Body of reply to OFPST_PORT request. If a counter is unsupported, set + * the field to all ones. */ +struct ofp10_port_stats { + ovs_be16 port_no; + uint8_t pad[6]; /* Align to 64-bits. */ + ovs_32aligned_be64 rx_packets; /* Number of received packets. */ + ovs_32aligned_be64 tx_packets; /* Number of transmitted packets. */ + ovs_32aligned_be64 rx_bytes; /* Number of received bytes. */ + ovs_32aligned_be64 tx_bytes; /* Number of transmitted bytes. */ + ovs_32aligned_be64 rx_dropped; /* Number of packets dropped by RX. */ + ovs_32aligned_be64 tx_dropped; /* Number of packets dropped by TX. */ + ovs_32aligned_be64 rx_errors; /* Number of receive errors. This is a + super-set of receive errors and should be + great than or equal to the sum of all + rx_*_err values. */ + ovs_32aligned_be64 tx_errors; /* Number of transmit errors. This is a + super-set of transmit errors. */ + ovs_32aligned_be64 rx_frame_err; /* Number of frame alignment errors. */ + ovs_32aligned_be64 rx_over_err; /* Number of packets with RX overrun. */ + ovs_32aligned_be64 rx_crc_err; /* Number of CRC errors. */ + ovs_32aligned_be64 collisions; /* Number of collisions. */ +}; +OFP_ASSERT(sizeof(struct ofp10_port_stats) == 104); + +/* All ones is used to indicate all queues in a port (for stats retrieval). */ +#define OFPQ_ALL 0xffffffff + +/* Body for stats request of type OFPST_QUEUE. */ +struct ofp10_queue_stats_request { + ovs_be16 port_no; /* All ports if OFPP_ALL. */ + uint8_t pad[2]; /* Align to 32-bits. */ + ovs_be32 queue_id; /* All queues if OFPQ_ALL. */ +}; +OFP_ASSERT(sizeof(struct ofp10_queue_stats_request) == 8); + +/* Body for stats reply of type OFPST_QUEUE consists of an array of this + * structure type. */ +struct ofp10_queue_stats { + ovs_be16 port_no; + uint8_t pad[2]; /* Align to 32-bits. */ + ovs_be32 queue_id; /* Queue id. */ + ovs_32aligned_be64 tx_bytes; /* Number of transmitted bytes. */ + ovs_32aligned_be64 tx_packets; /* Number of transmitted packets. */ + ovs_32aligned_be64 tx_errors; /* # of packets dropped due to overrun. */ +}; +OFP_ASSERT(sizeof(struct ofp10_queue_stats) == 32); + +#endif /* openflow/openflow-1.0.h */ diff --git a/openflow/include/openflow/openflow-1.1.h b/openflow/include/openflow/openflow-1.1.h new file mode 100644 index 0000000..de28475 --- /dev/null +++ b/openflow/include/openflow/openflow-1.1.h @@ -0,0 +1,606 @@ +/* Copyright (c) 2008, 2011, 2012, 2013, 2014, 2016 The Board of Trustees of The Leland Stanford + * Junior University + * + * We are making the OpenFlow specification and associated documentation + * (Software) available for public use and benefit with the expectation + * that others will use, modify and enhance the Software and contribute + * those enhancements back to the community. However, since we would + * like to make the Software available for broadest use, with as few + * restrictions as possible permission is hereby granted, free of + * charge, to any person obtaining a copy of this Software to deal in + * the Software under the copyrights without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * The name and trademarks of copyright holder(s) may NOT be used in + * advertising or publicity pertaining to the Software or any + * derivatives without specific, written prior permission. + */ + +/* + * Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* OpenFlow: protocol between controller and datapath. */ + +#ifndef OPENFLOW_11_H +#define OPENFLOW_11_H 1 + +#include + +/* OpenFlow 1.1 uses 32-bit port numbers. Open vSwitch, for now, uses OpenFlow + * 1.0 port numbers internally. We map them to OpenFlow 1.0 as follows: + * + * OF1.1 <=> OF1.0 + * ----------------------- --------------- + * 0x00000000...0x0000feff <=> 0x0000...0xfeff "physical" ports + * 0x0000ff00...0xfffffeff <=> not supported + * 0xffffff00...0xffffffff <=> 0xff00...0xffff "reserved" OFPP_* ports + * + * OFPP11_OFFSET is the value that must be added or subtracted to convert + * an OpenFlow 1.0 reserved port number to or from, respectively, the + * corresponding OpenFlow 1.1 reserved port number. + */ +#define OFPP11_MAX OFP11_PORT_C(0xffffff00) +#define OFPP11_OFFSET 0xffff0000 /* OFPP11_MAX - OFPP_MAX */ + +/* Reserved wildcard port used only for flow mod (delete) and flow stats + * requests. Selects all flows regardless of output port + * (including flows with no output port) + * + * Define it via OFPP_NONE (0xFFFF) so that OFPP_ANY is still an enum ofp_port + */ +#define OFPP_ANY OFPP_NONE + +/* OpenFlow 1.1 port config flags are just the common flags. */ +#define OFPPC11_ALL \ + (OFPPC_PORT_DOWN | OFPPC_NO_RECV | OFPPC_NO_FWD | OFPPC_NO_PACKET_IN) + +/* OpenFlow 1.1 specific current state of the physical port. These are not + * configurable from the controller. + */ +enum ofp11_port_state { + OFPPS11_BLOCKED = 1 << 1, /* Port is blocked */ + OFPPS11_LIVE = 1 << 2, /* Live for Fast Failover Group. */ +#define OFPPS11_ALL (OFPPS_LINK_DOWN | OFPPS11_BLOCKED | OFPPS11_LIVE) +}; + +/* OpenFlow 1.1 specific features of ports available in a datapath. */ +enum ofp11_port_features { + OFPPF11_40GB_FD = 1 << 7, /* 40 Gb full-duplex rate support. */ + OFPPF11_100GB_FD = 1 << 8, /* 100 Gb full-duplex rate support. */ + OFPPF11_1TB_FD = 1 << 9, /* 1 Tb full-duplex rate support. */ + OFPPF11_OTHER = 1 << 10, /* Other rate, not in the list. */ + + OFPPF11_COPPER = 1 << 11, /* Copper medium. */ + OFPPF11_FIBER = 1 << 12, /* Fiber medium. */ + OFPPF11_AUTONEG = 1 << 13, /* Auto-negotiation. */ + OFPPF11_PAUSE = 1 << 14, /* Pause. */ + OFPPF11_PAUSE_ASYM = 1 << 15 /* Asymmetric pause. */ +#define OFPPF11_ALL ((1 << 16) - 1) +}; + +/* Description of a port */ +struct ofp11_port { + ovs_be32 port_no; + uint8_t pad[4]; + struct eth_addr hw_addr; + uint8_t pad2[2]; /* Align to 64 bits. */ + char name[OFP_MAX_PORT_NAME_LEN]; /* Null-terminated */ + + ovs_be32 config; /* Bitmap of OFPPC_* flags. */ + ovs_be32 state; /* Bitmap of OFPPS_* and OFPPS11_* flags. */ + + /* Bitmaps of OFPPF_* and OFPPF11_* that describe features. All bits + * zeroed if unsupported or unavailable. */ + ovs_be32 curr; /* Current features. */ + ovs_be32 advertised; /* Features being advertised by the port. */ + ovs_be32 supported; /* Features supported by the port. */ + ovs_be32 peer; /* Features advertised by peer. */ + + ovs_be32 curr_speed; /* Current port bitrate in kbps. */ + ovs_be32 max_speed; /* Max port bitrate in kbps */ +}; +OFP_ASSERT(sizeof(struct ofp11_port) == 64); + +/* Modify behavior of the physical port */ +struct ofp11_port_mod { + ovs_be32 port_no; + uint8_t pad[4]; + struct eth_addr hw_addr; /* The hardware address is not configurable. This + is used to sanity-check the request, so it must + be the same as returned in an ofp11_port + struct. */ + uint8_t pad2[2]; /* Pad to 64 bits. */ + ovs_be32 config; /* Bitmap of OFPPC_* flags. */ + ovs_be32 mask; /* Bitmap of OFPPC_* flags to be changed. */ + + ovs_be32 advertise; /* Bitmap of OFPPF_* and OFPPF11_*. Zero all bits + to prevent any action taking place. */ + uint8_t pad3[4]; /* Pad to 64 bits. */ +}; +OFP_ASSERT(sizeof(struct ofp11_port_mod) == 32); + +/* Group setup and teardown (controller -> datapath). */ +struct ofp11_group_mod { + ovs_be16 command; /* One of OFPGC11_*. */ + uint8_t type; /* One of OFPGT11_*. */ + uint8_t pad; /* Pad to 64 bits. */ + ovs_be32 group_id; /* Group identifier. */ + /* struct ofp11_bucket buckets[0]; The bucket length is inferred from the + length field in the header. */ +}; +OFP_ASSERT(sizeof(struct ofp11_group_mod) == 8); + +/* Query for port queue configuration. */ +struct ofp11_queue_get_config_request { + ovs_be32 port; + /* Port to be queried. Should refer + to a valid physical port (i.e. < OFPP_MAX) */ + uint8_t pad[4]; +}; +OFP_ASSERT(sizeof(struct ofp11_queue_get_config_request) == 8); + +/* Group commands */ +enum ofp11_group_mod_command { + OFPGC11_ADD, /* New group. */ + OFPGC11_MODIFY, /* Modify all matching groups. */ + OFPGC11_DELETE, /* Delete all matching groups. */ + OFPGC11_ADD_OR_MOD = 0x8000, /* Create new or modify existing group. */ +}; + +/* OpenFlow 1.1 specific capabilities supported by the datapath (struct + * ofp_switch_features, member capabilities). */ +enum ofp11_capabilities { + OFPC11_GROUP_STATS = 1 << 3, /* Group statistics. */ +}; + +#define OFPMT11_STANDARD_LENGTH 88 + +struct ofp11_match_header { + ovs_be16 type; /* One of OFPMT_* */ + ovs_be16 length; /* Length of match */ +}; +OFP_ASSERT(sizeof(struct ofp11_match_header) == 4); + +/* Fields to match against flows */ +struct ofp11_match { + struct ofp11_match_header omh; + ovs_be32 in_port; /* Input switch port. */ + ovs_be32 wildcards; /* Wildcard fields. */ + struct eth_addr dl_src; /* Ethernet source address. */ + struct eth_addr dl_src_mask; /* Ethernet source address mask. */ + struct eth_addr dl_dst; /* Ethernet destination address. */ + struct eth_addr dl_dst_mask; /* Ethernet destination address mask. */ + ovs_be16 dl_vlan; /* Input VLAN id. */ + uint8_t dl_vlan_pcp; /* Input VLAN priority. */ + uint8_t pad1[1]; /* Align to 32-bits */ + ovs_be16 dl_type; /* Ethernet frame type. */ + uint8_t nw_tos; /* IP ToS (actually DSCP field, 6 bits). */ + uint8_t nw_proto; /* IP protocol or lower 8 bits of ARP opcode. */ + ovs_be32 nw_src; /* IP source address. */ + ovs_be32 nw_src_mask; /* IP source address mask. */ + ovs_be32 nw_dst; /* IP destination address. */ + ovs_be32 nw_dst_mask; /* IP destination address mask. */ + ovs_be16 tp_src; /* TCP/UDP/SCTP source port. */ + ovs_be16 tp_dst; /* TCP/UDP/SCTP destination port. */ + ovs_be32 mpls_label; /* MPLS label. */ + uint8_t mpls_tc; /* MPLS TC. */ + uint8_t pad2[3]; /* Align to 64-bits */ + ovs_be64 metadata; /* Metadata passed between tables. */ + ovs_be64 metadata_mask; /* Mask for metadata. */ +}; +OFP_ASSERT(sizeof(struct ofp11_match) == OFPMT11_STANDARD_LENGTH); + +/* Flow wildcards. */ +enum ofp11_flow_wildcards { + OFPFW11_IN_PORT = 1 << 0, /* Switch input port. */ + OFPFW11_DL_VLAN = 1 << 1, /* VLAN id. */ + OFPFW11_DL_VLAN_PCP = 1 << 2, /* VLAN priority. */ + OFPFW11_DL_TYPE = 1 << 3, /* Ethernet frame type. */ + OFPFW11_NW_TOS = 1 << 4, /* IP ToS (DSCP field, 6 bits). */ + OFPFW11_NW_PROTO = 1 << 5, /* IP protocol. */ + OFPFW11_TP_SRC = 1 << 6, /* TCP/UDP/SCTP source port. */ + OFPFW11_TP_DST = 1 << 7, /* TCP/UDP/SCTP destination port. */ + OFPFW11_MPLS_LABEL = 1 << 8, /* MPLS label. */ + OFPFW11_MPLS_TC = 1 << 9, /* MPLS TC. */ + + /* Wildcard all fields. */ + OFPFW11_ALL = ((1 << 10) - 1) +}; + +/* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate + * special conditions. + */ +enum ofp11_vlan_id { + OFPVID11_ANY = 0xfffe, /* Indicate that a VLAN id is set but don't care + about it's value. Note: only valid when + specifying the VLAN id in a match */ + OFPVID11_NONE = 0xffff, /* No VLAN id was set. */ +}; + +enum ofp11_instruction_type { + OFPIT11_GOTO_TABLE = 1, /* Setup the next table in the lookup + pipeline */ + OFPIT11_WRITE_METADATA = 2, /* Setup the metadata field for use later + in pipeline */ + OFPIT11_WRITE_ACTIONS = 3, /* Write the action(s) onto the datapath + action set */ + OFPIT11_APPLY_ACTIONS = 4, /* Applies the action(s) immediately */ + OFPIT11_CLEAR_ACTIONS = 5, /* Clears all actions from the datapath + action set */ + OFPIT11_EXPERIMENTER = 0xFFFF /* Experimenter instruction */ +}; + +#define OFP11_INSTRUCTION_ALIGN 8 + +/* Generic ofp_instruction structure. */ +struct ofp11_instruction { + ovs_be16 type; /* Instruction type */ + ovs_be16 len; /* Length of this struct in bytes. */ + uint8_t pad[4]; /* Align to 64-bits */ +}; +OFP_ASSERT(sizeof(struct ofp11_instruction) == 8); + +/* Instruction structure for OFPIT_GOTO_TABLE */ +struct ofp11_instruction_goto_table { + ovs_be16 type; /* OFPIT_GOTO_TABLE */ + ovs_be16 len; /* Length of this struct in bytes. */ + uint8_t table_id; /* Set next table in the lookup pipeline */ + uint8_t pad[3]; /* Pad to 64 bits. */ +}; +OFP_ASSERT(sizeof(struct ofp11_instruction_goto_table) == 8); + +/* Instruction structure for OFPIT_WRITE_METADATA */ +struct ofp11_instruction_write_metadata { + ovs_be16 type; /* OFPIT_WRITE_METADATA */ + ovs_be16 len; /* Length of this struct in bytes. */ + uint8_t pad[4]; /* Align to 64-bits */ + ovs_be64 metadata; /* Metadata value to write */ + ovs_be64 metadata_mask; /* Metadata write bitmask */ +}; +OFP_ASSERT(sizeof(struct ofp11_instruction_write_metadata) == 24); + +/* Instruction structure for OFPIT_WRITE/APPLY/CLEAR_ACTIONS */ +struct ofp11_instruction_actions { + ovs_be16 type; /* One of OFPIT_*_ACTIONS */ + ovs_be16 len; /* Length of this struct in bytes. */ + uint8_t pad[4]; /* Align to 64-bits */ + /* struct ofp_action_header actions[0]; Actions associated with + OFPIT_WRITE_ACTIONS and + OFPIT_APPLY_ACTIONS */ +}; +OFP_ASSERT(sizeof(struct ofp11_instruction_actions) == 8); + +/* Instruction structure for experimental instructions */ +struct ofp11_instruction_experimenter { + ovs_be16 type; /* OFPIT11_EXPERIMENTER */ + ovs_be16 len; /* Length of this struct in bytes */ + ovs_be32 experimenter; /* Experimenter ID which takes the same form + as in struct ofp_vendor_header. */ + /* Experimenter-defined arbitrary additional data. */ +}; +OFP_ASSERT(sizeof(struct ofp11_instruction_experimenter) == 8); + +/* Configure/Modify behavior of a flow table */ +struct ofp11_table_mod { + uint8_t table_id; /* ID of the table, 0xFF indicates all tables */ + uint8_t pad[3]; /* Pad to 32 bits */ + ovs_be32 config; /* Bitmap of OFPTC_* flags */ +}; +OFP_ASSERT(sizeof(struct ofp11_table_mod) == 8); + +/* Flow setup and teardown (controller -> datapath). */ +struct ofp11_flow_mod { + ovs_be64 cookie; /* Opaque controller-issued identifier. */ + ovs_be64 cookie_mask; /* Mask used to restrict the cookie bits + that must match when the command is + OFPFC_MODIFY* or OFPFC_DELETE*. A value + of 0 indicates no restriction. */ + /* Flow actions. */ + uint8_t table_id; /* ID of the table to put the flow in */ + uint8_t command; /* One of OFPFC_*. */ + ovs_be16 idle_timeout; /* Idle time before discarding (seconds). */ + ovs_be16 hard_timeout; /* Max time before discarding (seconds). */ + ovs_be16 priority; /* Priority level of flow entry. */ + ovs_be32 buffer_id; /* Buffered packet to apply to (or -1). + Not meaningful for OFPFC_DELETE*. */ + ovs_be32 out_port; /* For OFPFC_DELETE* commands, require + matching entries to include this as an + output port. A value of OFPP_ANY + indicates no restriction. */ + ovs_be32 out_group; /* For OFPFC_DELETE* commands, require + matching entries to include this as an + output group. A value of OFPG_ANY + indicates no restriction. */ + ovs_be16 flags; /* One of OFPFF_*. */ + ovs_be16 importance; /* Eviction precedence (OF1.4+). */ + /* Followed by an ofp11_match structure. */ + /* Followed by an instruction set. */ +}; +OFP_ASSERT(sizeof(struct ofp11_flow_mod) == 40); + +/* Group types. Values in the range [128, 255] are reserved for experimental + * use. */ +enum ofp11_group_type { + OFPGT11_ALL, /* All (multicast/broadcast) group. */ + OFPGT11_SELECT, /* Select group. */ + OFPGT11_INDIRECT, /* Indirect group. */ + OFPGT11_FF /* Fast failover group. */ +}; + +/* Bucket for use in groups. */ +struct ofp11_bucket { + ovs_be16 len; /* Length the bucket in bytes, including + this header and any padding to make it + 64-bit aligned. */ + ovs_be16 weight; /* Relative weight of bucket. Only + defined for select groups. */ + ovs_be32 watch_port; /* Port whose state affects whether this + bucket is live. Only required for fast + failover groups. */ + ovs_be32 watch_group; /* Group whose state affects whether this + bucket is live. Only required for fast + failover groups. */ + uint8_t pad[4]; + /* struct ofp_action_header actions[0]; The action length is inferred + from the length field in the + header. */ +}; +OFP_ASSERT(sizeof(struct ofp11_bucket) == 16); + +/* Queue configuration for a given port. */ +struct ofp11_queue_get_config_reply { + ovs_be32 port; + uint8_t pad[4]; + /* struct ofp_packet_queue queues[0]; List of configured queues. */ +}; +OFP_ASSERT(sizeof(struct ofp11_queue_get_config_reply) == 8); + +/* Stats request of type OFPST_FLOW. */ +struct ofp11_flow_stats_request { + uint8_t table_id; /* ID of table to read (from ofp_table_stats), + 0xff for all tables. */ + uint8_t pad[3]; /* Align to 64 bits. */ + ovs_be32 out_port; /* Require matching entries to include this + as an output port. A value of OFPP_ANY + indicates no restriction. */ + ovs_be32 out_group; /* Require matching entries to include this + as an output group. A value of OFPG_ANY + indicates no restriction. */ + uint8_t pad2[4]; /* Align to 64 bits. */ + ovs_be64 cookie; /* Require matching entries to contain this + cookie value */ + ovs_be64 cookie_mask; /* Mask used to restrict the cookie bits that + must match. A value of 0 indicates + no restriction. */ + /* Followed by an ofp11_match structure. */ +}; +OFP_ASSERT(sizeof(struct ofp11_flow_stats_request) == 32); + +/* Body of reply to OFPST_FLOW request. */ +struct ofp11_flow_stats { + ovs_be16 length; /* Length of this entry. */ + uint8_t table_id; /* ID of table flow came from. */ + uint8_t pad; + ovs_be32 duration_sec; /* Time flow has been alive in seconds. */ + ovs_be32 duration_nsec; /* Time flow has been alive in nanoseconds beyond + duration_sec. */ + ovs_be16 priority; /* Priority of the entry. Only meaningful + when this is not an exact-match entry. */ + ovs_be16 idle_timeout; /* Number of seconds idle before expiration. */ + ovs_be16 hard_timeout; /* Number of seconds before expiration. */ + ovs_be16 flags; /* OF 1.3: Set of OFPFF*. */ + ovs_be16 importance; /* Eviction precedence (OF1.4+). */ + uint8_t pad2[2]; /* Align to 64-bits. */ + ovs_be64 cookie; /* Opaque controller-issued identifier. */ + ovs_be64 packet_count; /* Number of packets in flow. */ + ovs_be64 byte_count; /* Number of bytes in flow. */ + /* OpenFlow version specific match */ + /* struct ofp11_instruction instructions[0]; Instruction set. */ +}; +OFP_ASSERT(sizeof(struct ofp11_flow_stats) == 48); + +/* Body for ofp_stats_request of type OFPST_AGGREGATE. */ +/* Identical to ofp11_flow_stats_request */ + +/* Flow match fields. */ +enum ofp11_flow_match_fields { + OFPFMF11_IN_PORT = 1 << 0, /* Switch input port. */ + OFPFMF11_DL_VLAN = 1 << 1, /* VLAN id. */ + OFPFMF11_DL_VLAN_PCP = 1 << 2, /* VLAN priority. */ + OFPFMF11_DL_TYPE = 1 << 3, /* Ethernet frame type. */ + OFPFMF11_NW_TOS = 1 << 4, /* IP ToS (DSCP field, 6 bits). */ + OFPFMF11_NW_PROTO = 1 << 5, /* IP protocol. */ + OFPFMF11_TP_SRC = 1 << 6, /* TCP/UDP/SCTP source port. */ + OFPFMF11_TP_DST = 1 << 7, /* TCP/UDP/SCTP destination port. */ + OFPFMF11_MPLS_LABEL = 1 << 8, /* MPLS label. */ + OFPFMF11_MPLS_TC = 1 << 9, /* MPLS TC. */ + OFPFMF11_TYPE = 1 << 10, /* Match type. */ + OFPFMF11_DL_SRC = 1 << 11, /* Ethernet source address. */ + OFPFMF11_DL_DST = 1 << 12, /* Ethernet destination address. */ + OFPFMF11_NW_SRC = 1 << 13, /* IP source address. */ + OFPFMF11_NW_DST = 1 << 14, /* IP destination address. */ + OFPFMF11_METADATA = 1 << 15, /* Metadata passed between tables. */ +}; + +/* Body of reply to OFPST_TABLE request. */ +struct ofp11_table_stats { + uint8_t table_id; /* Identifier of table. Lower numbered tables + are consulted first. */ + uint8_t pad[7]; /* Align to 64-bits. */ + char name[OFP_MAX_TABLE_NAME_LEN]; + ovs_be32 wildcards; /* Bitmap of OFPFMF_* wildcards that are + supported by the table. */ + ovs_be32 match; /* Bitmap of OFPFMF_* that indicate the fields + the table can match on. */ + ovs_be32 instructions; /* Bitmap of OFPIT_* values supported. */ + ovs_be32 write_actions; /* Bitmap of OFPAT_* that are supported + by the table with OFPIT_WRITE_ACTIONS. */ + ovs_be32 apply_actions; /* Bitmap of OFPAT_* that are supported + by the table with OFPIT_APPLY_ACTIONS. */ + ovs_be32 config; /* Bitmap of OFPTC_* values */ + ovs_be32 max_entries; /* Max number of entries supported. */ + ovs_be32 active_count; /* Number of active entries. */ + ovs_be64 lookup_count; /* Number of packets looked up in table. */ + ovs_be64 matched_count; /* Number of packets that hit table. */ +}; +OFP_ASSERT(sizeof(struct ofp11_table_stats) == 88); + +/* Body for ofp_stats_request of type OFPST_PORT. */ +struct ofp11_port_stats_request { + ovs_be32 port_no; /* OFPST_PORT message must request statistics + * either for a single port (specified in + * port_no) or for all ports (if port_no == + * OFPP_ANY). */ + uint8_t pad[4]; +}; +OFP_ASSERT(sizeof(struct ofp11_port_stats_request) == 8); + +/* Body of reply to OFPST_PORT request. If a counter is unsupported, set + * the field to all ones. */ +struct ofp11_port_stats { + ovs_be32 port_no; + uint8_t pad[4]; /* Align to 64-bits. */ + ovs_be64 rx_packets; /* Number of received packets. */ + ovs_be64 tx_packets; /* Number of transmitted packets. */ + ovs_be64 rx_bytes; /* Number of received bytes. */ + ovs_be64 tx_bytes; /* Number of transmitted bytes. */ + ovs_be64 rx_dropped; /* Number of packets dropped by RX. */ + ovs_be64 tx_dropped; /* Number of packets dropped by TX. */ + ovs_be64 rx_errors; /* Number of receive errors. This is a + super-set of receive errors and should be + great than or equal to the sum of all + rx_*_err values. */ + ovs_be64 tx_errors; /* Number of transmit errors. This is a + super-set of transmit errors. */ + ovs_be64 rx_frame_err; /* Number of frame alignment errors. */ + ovs_be64 rx_over_err; /* Number of packets with RX overrun. */ + ovs_be64 rx_crc_err; /* Number of CRC errors. */ + ovs_be64 collisions; /* Number of collisions. */ +}; +OFP_ASSERT(sizeof(struct ofp11_port_stats) == 104); + +struct ofp11_queue_stats_request { + ovs_be32 port_no; /* All ports if OFPP_ANY. */ + ovs_be32 queue_id; /* All queues if OFPQ_ALL. */ +}; +OFP_ASSERT(sizeof(struct ofp11_queue_stats_request) == 8); + +struct ofp11_queue_stats { + ovs_be32 port_no; + ovs_be32 queue_id; /* Queue id. */ + ovs_be64 tx_bytes; /* Number of transmitted bytes. */ + ovs_be64 tx_packets; /* Number of transmitted packets. */ + ovs_be64 tx_errors; /* # of packets dropped due to overrun. */ +}; +OFP_ASSERT(sizeof(struct ofp11_queue_stats) == 32); + +struct ofp11_group_stats_request { + ovs_be32 group_id; /* All groups if OFPG_ALL. */ + uint8_t pad[4]; /* Align to 64 bits. */ +}; +OFP_ASSERT(sizeof(struct ofp11_group_stats_request) == 8); + +/* Used in group stats replies. */ +struct ofp11_bucket_counter { + ovs_be64 packet_count; /* Number of packets processed by bucket. */ + ovs_be64 byte_count; /* Number of bytes processed by bucket. */ +}; +OFP_ASSERT(sizeof(struct ofp11_bucket_counter) == 16); + +/* Body of reply to OFPST11_GROUP request */ +struct ofp11_group_stats { + ovs_be16 length; /* Length of this entry. */ + uint8_t pad[2]; /* Align to 64 bits. */ + ovs_be32 group_id; /* Group identifier. */ + ovs_be32 ref_count; /* Number of flows or groups that + directly forward to this group. */ + uint8_t pad2[4]; /* Align to 64 bits. */ + ovs_be64 packet_count; /* Number of packets processed by group. */ + ovs_be64 byte_count; /* Number of bytes processed by group. */ + /* struct ofp11_bucket_counter bucket_stats[]; */ +}; +OFP_ASSERT(sizeof(struct ofp11_group_stats) == 32); + +/* Body of reply to OFPST11_GROUP_DESC request. */ +struct ofp11_group_desc_stats { + ovs_be16 length; /* Length of this entry. */ + uint8_t type; /* One of OFPGT11_*. */ + uint8_t pad; /* Pad to 64 bits. */ + ovs_be32 group_id; /* Group identifier. */ + /* struct ofp11_bucket buckets[0]; */ +}; +OFP_ASSERT(sizeof(struct ofp11_group_desc_stats) == 8); + +/* Send packet (controller -> datapath). */ +struct ofp11_packet_out { + ovs_be32 buffer_id; /* ID assigned by datapath (-1 if none). */ + ovs_be32 in_port; /* Packet's input port or OFPP_CONTROLLER. */ + ovs_be16 actions_len; /* Size of action array in bytes. */ + uint8_t pad[6]; + /* struct ofp_action_header actions[0]; Action list. */ + /* uint8_t data[0]; */ /* Packet data. The length is inferred + from the length field in the header. + (Only meaningful if buffer_id == -1.) */ +}; +OFP_ASSERT(sizeof(struct ofp11_packet_out) == 16); + +/* Packet received on port (datapath -> controller). */ +struct ofp11_packet_in { + ovs_be32 buffer_id; /* ID assigned by datapath. */ + ovs_be32 in_port; /* Port on which frame was received. */ + ovs_be32 in_phy_port; /* Physical Port on which frame was received. */ + ovs_be16 total_len; /* Full length of frame. */ + uint8_t reason; /* Reason packet is being sent (one of OFPR_*) */ + uint8_t table_id; /* ID of the table that was looked up */ + /* Followed by Ethernet frame. */ +}; +OFP_ASSERT(sizeof(struct ofp11_packet_in) == 16); + +/* Flow removed (datapath -> controller). */ +struct ofp11_flow_removed { + ovs_be64 cookie; /* Opaque controller-issued identifier. */ + + ovs_be16 priority; /* Priority level of flow entry. */ + uint8_t reason; /* One of OFPRR_*. */ + uint8_t table_id; /* ID of the table */ + + ovs_be32 duration_sec; /* Time flow was alive in seconds. */ + ovs_be32 duration_nsec; /* Time flow was alive in nanoseconds beyond + duration_sec. */ + ovs_be16 idle_timeout; /* Idle timeout from original flow mod. */ + uint8_t pad2[2]; /* Align to 64-bits. */ + ovs_be64 packet_count; + ovs_be64 byte_count; + /* Followed by an ofp11_match structure. */ +}; +OFP_ASSERT(sizeof(struct ofp11_flow_removed) == 40); + +#endif /* openflow/openflow-1.1.h */ diff --git a/openflow/include/openflow/openflow-1.2.h b/openflow/include/openflow/openflow-1.2.h new file mode 100644 index 0000000..30e220c --- /dev/null +++ b/openflow/include/openflow/openflow-1.2.h @@ -0,0 +1,229 @@ +/* Copyright (c) 2008, 2011, 2012, 2013, 2014 The Board of Trustees of The Leland Stanford + * Junior University + * + * We are making the OpenFlow specification and associated documentation + * (Software) available for public use and benefit with the expectation + * that others will use, modify and enhance the Software and contribute + * those enhancements back to the community. However, since we would + * like to make the Software available for broadest use, with as few + * restrictions as possible permission is hereby granted, free of + * charge, to any person obtaining a copy of this Software to deal in + * the Software under the copyrights without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * The name and trademarks of copyright holder(s) may NOT be used in + * advertising or publicity pertaining to the Software or any + * derivatives without specific, written prior permission. + */ + +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2012 Horms Solutions Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* OpenFlow: protocol between controller and datapath. */ + +#ifndef OPENFLOW_12_H +#define OPENFLOW_12_H 1 + +#include + +/* Error type for experimenter error messages. */ +#define OFPET12_EXPERIMENTER 0xffff + +/* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate + * special conditions. + */ +enum ofp12_vlan_id { + OFPVID12_PRESENT = 0x1000, /* Bit that indicate that a VLAN id is set */ + OFPVID12_NONE = 0x0000, /* No VLAN id was set. */ +}; + +/* Bit definitions for IPv6 Extension Header pseudo-field. */ +enum ofp12_ipv6exthdr_flags { + OFPIEH12_NONEXT = 1 << 0, /* "No next header" encountered. */ + OFPIEH12_ESP = 1 << 1, /* Encrypted Sec Payload header present. */ + OFPIEH12_AUTH = 1 << 2, /* Authentication header present. */ + OFPIEH12_DEST = 1 << 3, /* 1 or 2 dest headers present. */ + OFPIEH12_FRAG = 1 << 4, /* Fragment header present. */ + OFPIEH12_ROUTER = 1 << 5, /* Router header present. */ + OFPIEH12_HOP = 1 << 6, /* Hop-by-hop header present. */ + OFPIEH12_UNREP = 1 << 7, /* Unexpected repeats encountered. */ + OFPIEH12_UNSEQ = 1 << 8 /* Unexpected sequencing encountered. */ +}; + +/* Header for OXM experimenter match fields. */ +struct ofp12_oxm_experimenter_header { + ovs_be32 oxm_header; /* oxm_class = OFPXMC_EXPERIMENTER */ + ovs_be32 experimenter; /* Experimenter ID which takes the same + form as in struct ofp11_experimenter_header. */ +}; +OFP_ASSERT(sizeof(struct ofp12_oxm_experimenter_header) == 8); + +enum ofp12_controller_max_len { + OFPCML12_MAX = 0xffe5, /* maximum max_len value which can be used + * to request a specific byte length. */ + OFPCML12_NO_BUFFER = 0xffff /* indicates that no buffering should be + * applied and the whole packet is to be + * sent to the controller. */ +}; + +/* OpenFlow 1.2 specific flags + * (struct ofp12_flow_mod, member flags). */ +enum ofp12_flow_mod_flags { + OFPFF12_RESET_COUNTS = 1 << 2 /* Reset flow packet and byte counts. */ +}; + +/* OpenFlow 1.2 specific capabilities + * (struct ofp_switch_features, member capabilities). */ +enum ofp12_capabilities { + OFPC12_PORT_BLOCKED = 1 << 8 /* Switch will block looping ports. */ +}; + +/* Full description for a queue. */ +struct ofp12_packet_queue { + ovs_be32 queue_id; /* id for the specific queue. */ + ovs_be32 port; /* Port this queue is attached to. */ + ovs_be16 len; /* Length in bytes of this queue desc. */ + uint8_t pad[6]; /* 64-bit alignment. */ + /* Followed by any number of queue properties expressed using + * ofp_queue_prop_header, to fill out a total of 'len' bytes. */ +}; +OFP_ASSERT(sizeof(struct ofp12_packet_queue) == 16); + +/* Body of reply to OFPST_TABLE request. */ +struct ofp12_table_stats { + uint8_t table_id; /* Identifier of table. Lower numbered tables + are consulted first. */ + uint8_t pad[7]; /* Align to 64-bits. */ + char name[OFP_MAX_TABLE_NAME_LEN]; + ovs_be64 match; /* Bitmap of (1 << OFPXMT_*) that indicate the + fields the table can match on. */ + ovs_be64 wildcards; /* Bitmap of (1 << OFPXMT_*) wildcards that are + supported by the table. */ + ovs_be32 write_actions; /* Bitmap of OFPAT_* that are supported + by the table with OFPIT_WRITE_ACTIONS. */ + ovs_be32 apply_actions; /* Bitmap of OFPAT_* that are supported + by the table with OFPIT_APPLY_ACTIONS. */ + ovs_be64 write_setfields;/* Bitmap of (1 << OFPXMT_*) header fields that + can be set with OFPIT_WRITE_ACTIONS. */ + ovs_be64 apply_setfields;/* Bitmap of (1 << OFPXMT_*) header fields that + can be set with OFPIT_APPLY_ACTIONS. */ + ovs_be64 metadata_match; /* Bits of metadata table can match. */ + ovs_be64 metadata_write; /* Bits of metadata table can write. */ + ovs_be32 instructions; /* Bitmap of OFPIT_* values supported. */ + ovs_be32 config; /* Bitmap of OFPTC_* values */ + ovs_be32 max_entries; /* Max number of entries supported. */ + ovs_be32 active_count; /* Number of active entries. */ + ovs_be64 lookup_count; /* Number of packets looked up in table. */ + ovs_be64 matched_count; /* Number of packets that hit table. */ +}; +OFP_ASSERT(sizeof(struct ofp12_table_stats) == 128); + +/* Number of types of groups supported by ofp12_group_features_stats. */ +#define OFPGT12_N_TYPES 4 + +/* Body of reply to OFPST12_GROUP_FEATURES request. Group features. */ +struct ofp12_group_features_stats { + ovs_be32 types; /* Bitmap of OFPGT11_* values supported. */ + ovs_be32 capabilities; /* Bitmap of OFPGFC12_* capability supported. */ + + /* Each element in the following arrays corresponds to the group type with + * the same number, e.g. max_groups[0] is the maximum number of OFPGT11_ALL + * groups, actions[2] is the actions supported by OFPGT11_INDIRECT + * groups. */ + ovs_be32 max_groups[OFPGT12_N_TYPES]; /* Max number of groups. */ + ovs_be32 actions[OFPGT12_N_TYPES]; /* Bitmaps of supported OFPAT_*. */ +}; +OFP_ASSERT(sizeof(struct ofp12_group_features_stats) == 40); + +/* Group configuration flags */ +enum ofp12_group_capabilities { + OFPGFC12_SELECT_WEIGHT = 1 << 0, /* Support weight for select groups */ + OFPGFC12_SELECT_LIVENESS = 1 << 1, /* Support liveness for select groups */ + OFPGFC12_CHAINING = 1 << 2, /* Support chaining groups */ + OFPGFC12_CHAINING_CHECKS = 1 << 3, /* Check chaining for loops and delete */ +}; + +/* Role request and reply message. */ +struct ofp12_role_request { + ovs_be32 role; /* One of OFPCR12_ROLE_*. */ + uint8_t pad[4]; /* Align to 64 bits. */ + ovs_be64 generation_id; /* Master Election Generation Id */ +}; +OFP_ASSERT(sizeof(struct ofp12_role_request) == 16); + +/* Controller roles. */ +enum ofp12_controller_role { + OFPCR12_ROLE_NOCHANGE, /* Don't change current role. */ + OFPCR12_ROLE_EQUAL, /* Default role, full access. */ + OFPCR12_ROLE_MASTER, /* Full access, at most one master. */ + OFPCR12_ROLE_SLAVE, /* Read-only access. */ +}; + +/* Packet received on port (datapath -> controller). */ +struct ofp12_packet_in { + ovs_be32 buffer_id; /* ID assigned by datapath. */ + ovs_be16 total_len; /* Full length of frame. */ + uint8_t reason; /* Reason packet is being sent (one of OFPR_*) */ + uint8_t table_id; /* ID of the table that was looked up */ + /* Followed by: + * - Match + * - Exactly 2 all-zero padding bytes, then + * - An Ethernet frame whose length is inferred from header.length. + * The padding bytes preceding the Ethernet frame ensure that the IP + * header (if any) following the Ethernet header is 32-bit aligned. + */ + /* struct ofp12_match match; */ + /* uint8_t pad[2]; Align to 64 bit + 16 bit */ + /* uint8_t data[0]; Ethernet frame */ +}; +OFP_ASSERT(sizeof(struct ofp12_packet_in) == 8); + +/* Flow removed (datapath -> controller). */ +struct ofp12_flow_removed { + ovs_be64 cookie; /* Opaque controller-issued identifier. */ + + ovs_be16 priority; /* Priority level of flow entry. */ + uint8_t reason; /* One of OFPRR_*. */ + uint8_t table_id; /* ID of the table */ + + ovs_be32 duration_sec; /* Time flow was alive in seconds. */ + ovs_be32 duration_nsec; /* Time flow was alive in nanoseconds beyond + duration_sec. */ + ovs_be16 idle_timeout; /* Idle timeout from original flow mod. */ + ovs_be16 hard_timeout; /* Hard timeout from original flow mod. */ + ovs_be64 packet_count; + ovs_be64 byte_count; + /* struct ofp12_match match; Description of fields. Variable size. */ +}; +OFP_ASSERT(sizeof(struct ofp12_flow_removed) == 40); + +#endif /* openflow/openflow-1.2.h */ diff --git a/openflow/include/openflow/openflow-1.3.h b/openflow/include/openflow/openflow-1.3.h new file mode 100644 index 0000000..a521995 --- /dev/null +++ b/openflow/include/openflow/openflow-1.3.h @@ -0,0 +1,355 @@ +/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford +* Junior University +* Copyright (c) 2011, 2012 Open Networking Foundation +* +* We are making the OpenFlow specification and associated documentation +* (Software) available for public use and benefit with the expectation +* that others will use, modify and enhance the Software and contribute +* those enhancements back to the community. However, since we would +* like to make the Software available for broadest use, with as few +* restrictions as possible permission is hereby granted, free of +* charge, to any person obtaining a copy of this Software to deal in +* the Software under the copyrights without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* The name and trademarks of copyright holder(s) may NOT be used in +* advertising or publicity pertaining to the Software or any +* derivatives without specific, written prior permission. +*/ + +/* OpenFlow: protocol between controller and datapath. */ + +#ifndef OPENFLOW_13_H +#define OPENFLOW_13_H 1 + +#include + +/* + * OpenFlow 1.3 modifies the syntax of the following message types: + * + * OFPT_FEATURES_REPLY = 6 (opf13_switch_features) + * - new field: auxiliary_id + * - removed: ofp_ports at the end + * + * OFPT_PACKET_IN = 10 (appends an ovs_be64 to ofp12_packet_in) + * + * OpenFlow 1.3 adds following new message types: + * + * * Asynchronous message configuration. * + * OFPT13_GET_ASYNC_REQUEST = 26 (void) + * OFPT13_GET_ASYNC_REPLY = 27 (ofp13_async_config) + * OFPT13_SET_ASYNC = 28 (ofp13_async_config) + * + * * Meters and rate limiters configuration messages. * + * OFPT13_METER_MOD = 29 (ofp13_meter_mod) + * + * OpenFlow 1.3 modifies the syntax of the following statistics message types + * (now called multipart message types): + * + * OFPMP13_FLOW_REPLY = 1 (struct ofp13_flow_stats[]) + * OFPMP13_TABLE_REPLY = 3 (struct ofp13_table_stats[]) + * OFPMP13_PORT_REPLY = 4 (struct ofp13_port_stats[]) + * OFPMP13_QUEUE_REPLY = 5, (struct ofp13_queue_stats[]) + * OFPMP13_GROUP_REPLY = 6, (struct ofp13_group_stats[]) + * + * OpenFlow 1.3 adds the following multipart message types + * + * Meter statistics: + * OFPMP13_METER_REQUEST = 9, (struct ofp13_meter_multipart_request) + * OFPMP13_METER_REPLY = 9, (struct ofp13_meter_stats[]) + * + * Meter configuration: + * OFPMP13_METER_CONFIG_REQUEST = 10, (struct ofp13_meter_multipart_request) + * OFPMP13_METER_CONFIG_REPLY = 10, (struct ofp13_meter_config[]) + * + * Meter features: + * OFPMP13_METER_FEATURES_REQUEST = 11 (void) + * OFPMP13_METER_FEATURES_REPLY = 11 (struct ofp13_meter_features) + * + * Table features: + * OFPMP13_TABLE_FEATURES_REQUEST = 12, (struct ofp13_table_features[]) + * OFPMP13_TABLE_FEATURES_REPLY = 12, (struct ofp13_table_features[]) + * + */ + +enum ofp13_instruction_type { + OFPIT13_METER = 6 /* Apply meter (rate limiter) */ +}; + +/* Instruction structure for OFPIT_METER */ +struct ofp13_instruction_meter { + ovs_be16 type; /* OFPIT13_METER */ + ovs_be16 len; /* Length is 8. */ + ovs_be32 meter_id; /* Meter instance. */ +}; +OFP_ASSERT(sizeof(struct ofp13_instruction_meter) == 8); + +/* enum ofp_config_flags value OFPC_INVALID_TTL_TO_CONTROLLER + * is deprecated in OpenFlow 1.3 */ + +/* Flags to configure the table. Reserved for future use. */ +enum ofp13_table_config { + OFPTC13_DEPRECATED_MASK = 3 /* Deprecated bits */ +}; + +/* OpenFlow 1.3 specific flags for flow_mod messages. */ +enum ofp13_flow_mod_flags { + OFPFF13_NO_PKT_COUNTS = 1 << 3, /* Don't keep track of packet count. */ + OFPFF13_NO_BYT_COUNTS = 1 << 4 /* Don't keep track of byte count. */ +}; + +/* Common header for all meter bands */ +struct ofp13_meter_band_header { + ovs_be16 type; /* One of OFPMBT_*. */ + ovs_be16 len; /* Length in bytes of this band. */ + ovs_be32 rate; /* Rate for this band. */ + ovs_be32 burst_size; /* Size of bursts. */ +}; +OFP_ASSERT(sizeof(struct ofp13_meter_band_header) == 12); + +/* Meter configuration. OFPT_METER_MOD. */ +struct ofp13_meter_mod { + ovs_be16 command; /* One of OFPMC_*. */ + ovs_be16 flags; /* Set of OFPMF_*. */ + ovs_be32 meter_id; /* Meter instance. */ + /* struct ofp13_meter_band_header bands[0]; The bands length is inferred + from the length field in the + header. */ +}; +OFP_ASSERT(sizeof(struct ofp13_meter_mod) == 8); + +/* Meter numbering. Flow meters can use any number up to OFPM_MAX. */ +enum ofp13_meter { + /* Last usable meter. */ + OFPM13_MAX = 0xffff0000, + /* Virtual meters. */ + OFPM13_SLOWPATH = 0xfffffffd, /* Meter for slow datapath. */ + OFPM13_CONTROLLER = 0xfffffffe, /* Meter for controller connection. */ + OFPM13_ALL = 0xffffffff, /* Represents all meters for stat requests + commands. */ +}; + +/* Meter commands */ +enum ofp13_meter_mod_command { + OFPMC13_ADD, /* New meter. */ + OFPMC13_MODIFY, /* Modify specified meter. */ + OFPMC13_DELETE /* Delete specified meter. */ +}; + +/* Meter configuration flags */ +enum ofp13_meter_flags { + OFPMF13_KBPS = 1 << 0, /* Rate value in kb/s (kilo-bit per second). */ + OFPMF13_PKTPS = 1 << 1, /* Rate value in packet/sec. */ + OFPMF13_BURST = 1 << 2, /* Do burst size. */ + OFPMF13_STATS = 1 << 3 /* Collect statistics. */ +}; + +/* Meter band types */ +enum ofp13_meter_band_type { + OFPMBT13_DROP = 1, /* Drop packet. */ + OFPMBT13_DSCP_REMARK = 2, /* Remark DSCP in the IP header. */ + OFPMBT13_EXPERIMENTER = 0xFFFF /* Experimenter meter band. */ +}; + +/* OFPMBT_DROP band - drop packets */ +struct ofp13_meter_band_drop { + ovs_be16 type; /* OFPMBT_DROP. */ + ovs_be16 len; /* Length in bytes of this band. */ + ovs_be32 rate; /* Rate for dropping packets. */ + ovs_be32 burst_size; /* Size of bursts. */ + uint8_t pad[4]; +}; +OFP_ASSERT(sizeof(struct ofp13_meter_band_drop) == 16); + +/* OFPMBT_DSCP_REMARK band - Remark DSCP in the IP header */ +struct ofp13_meter_band_dscp_remark { + ovs_be16 type; /* OFPMBT_DSCP_REMARK. */ + ovs_be16 len; /* Length in bytes of this band. */ + ovs_be32 rate; /* Rate for remarking packets. */ + ovs_be32 burst_size; /* Size of bursts. */ + uint8_t prec_level; /* Number of drop precedence level to add. */ + uint8_t pad[3]; +}; +OFP_ASSERT(sizeof(struct ofp13_meter_band_dscp_remark) == 16); + +/* OFPMBT_EXPERIMENTER band - Write actions in action set */ +struct ofp13_meter_band_experimenter { + ovs_be16 type; /* OFPMBT_EXPERIMENTER. */ + ovs_be16 len; /* Length in bytes of this band. */ + ovs_be32 rate; /* Rate for dropping packets. */ + ovs_be32 burst_size; /* Size of bursts. */ + ovs_be32 experimenter; /* Experimenter ID which takes the same form as + in struct ofp_experimenter_header. */ +}; +OFP_ASSERT(sizeof(struct ofp13_meter_band_experimenter) == 16); + +/* OF 1.3 adds MORE flag also for requests */ +enum ofp13_multipart_request_flags { + OFPMPF13_REQ_MORE = 1 << 0 /* More requests to follow. */ +}; + +/* OF 1.3 splits table features off the ofp_table_stats */ +/* Body of reply to OFPMP13_TABLE request. */ +struct ofp13_table_stats { + uint8_t table_id; /* Identifier of table. Lower numbered tables are + consulted first. */ + uint8_t pad[3]; /* Align to 32-bits. */ + ovs_be32 active_count; /* Number of active entries. */ + ovs_be64 lookup_count; /* Number of packets looked up in table. */ + ovs_be64 matched_count; /* Number of packets that hit table. */ +}; +OFP_ASSERT(sizeof(struct ofp13_table_stats) == 24); + +/* Body for ofp_multipart_request of type OFPMP_TABLE_FEATURES./ + * Body of reply to OFPMP_TABLE_FEATURES request. */ +struct ofp13_table_features { + ovs_be16 length; /* Length is padded to 64 bits. */ + uint8_t table_id; /* Identifier of table. Lower numbered tables + are consulted first. */ + uint8_t pad[5]; /* Align to 64-bits. */ + char name[OFP_MAX_TABLE_NAME_LEN]; + ovs_be64 metadata_match; /* Bits of metadata table can match. */ + ovs_be64 metadata_write; /* Bits of metadata table can write. */ + + /* In OF1.3 this field was named 'config' and it was useless because OF1.3 + * did not define any OFPTC_* bits. + * + * OF1.4 renamed this field to 'capabilities' and added OFPTC14_EVICTION + * and OFPTC14_VACANCY_EVENTS. */ + ovs_be32 capabilities; /* Bitmap of OFPTC_* values */ + + ovs_be32 max_entries; /* Max number of entries supported. */ + + /* Table Feature Property list */ + /* struct ofp13_table_feature_prop_header properties[0]; */ +}; +OFP_ASSERT(sizeof(struct ofp13_table_features) == 64); + +/* Table Feature property types. + * Low order bit cleared indicates a property for a regular Flow Entry. + * Low order bit set indicates a property for the Table-Miss Flow Entry. */ +enum ofp13_table_feature_prop_type { + OFPTFPT13_INSTRUCTIONS = 0, /* Instructions property. */ + OFPTFPT13_INSTRUCTIONS_MISS = 1, /* Instructions for table-miss. */ + OFPTFPT13_NEXT_TABLES = 2, /* Next Table property. */ + OFPTFPT13_NEXT_TABLES_MISS = 3, /* Next Table for table-miss. */ + OFPTFPT13_WRITE_ACTIONS = 4, /* Write Actions property. */ + OFPTFPT13_WRITE_ACTIONS_MISS = 5, /* Write Actions for table-miss. */ + OFPTFPT13_APPLY_ACTIONS = 6, /* Apply Actions property. */ + OFPTFPT13_APPLY_ACTIONS_MISS = 7, /* Apply Actions for table-miss. */ + OFPTFPT13_MATCH = 8, /* Match property. */ + OFPTFPT13_WILDCARDS = 10, /* Wildcards property. */ + OFPTFPT13_WRITE_SETFIELD = 12, /* Write Set-Field property. */ + OFPTFPT13_WRITE_SETFIELD_MISS = 13, /* Write Set-Field for table-miss. */ + OFPTFPT13_APPLY_SETFIELD = 14, /* Apply Set-Field property. */ + OFPTFPT13_APPLY_SETFIELD_MISS = 15, /* Apply Set-Field for table-miss. */ + OFPTFPT13_EXPERIMENTER = 0xFFFE, /* Experimenter property. */ + OFPTFPT13_EXPERIMENTER_MISS = 0xFFFF, /* Experimenter for table-miss. */ +}; + +/* Body of reply to OFPMP13_PORT request. If a counter is unsupported, set + * the field to all ones. */ +struct ofp13_port_stats { + struct ofp11_port_stats ps; + ovs_be32 duration_sec; /* Time port has been alive in seconds. */ + ovs_be32 duration_nsec; /* Time port has been alive in nanoseconds + beyond duration_sec. */ +}; +OFP_ASSERT(sizeof(struct ofp13_port_stats) == 112); + +/* Body of reply to OFPMP13_QUEUE request */ +struct ofp13_queue_stats { + struct ofp11_queue_stats qs; + ovs_be32 duration_sec; /* Time queue has been alive in seconds. */ + ovs_be32 duration_nsec; /* Time queue has been alive in nanoseconds + beyond duration_sec. */ +}; +OFP_ASSERT(sizeof(struct ofp13_queue_stats) == 40); + +/* Body of reply to OFPMP13_GROUP request */ +struct ofp13_group_stats { + struct ofp11_group_stats gs; + ovs_be32 duration_sec; /* Time group has been alive in seconds. */ + ovs_be32 duration_nsec; /* Time group has been alive in nanoseconds + beyond duration_sec. */ + /* struct ofp11_bucket_counter bucket_stats[]; */ +}; +OFP_ASSERT(sizeof(struct ofp13_group_stats) == 40); + +/* Body of OFPMP13_METER and OFPMP13_METER_CONFIG requests. */ +struct ofp13_meter_multipart_request { + ovs_be32 meter_id; /* Meter instance, or OFPM_ALL. */ + uint8_t pad[4]; /* Align to 64 bits. */ +}; +OFP_ASSERT(sizeof(struct ofp13_meter_multipart_request) == 8); + +/* Statistics for each meter band */ +struct ofp13_meter_band_stats { + ovs_be64 packet_band_count; /* Number of packets in band. */ + ovs_be64 byte_band_count; /* Number of bytes in band. */ +}; +OFP_ASSERT(sizeof(struct ofp13_meter_band_stats) == 16); + +/* Body of reply to OFPMP13_METER request. Meter statistics. */ +struct ofp13_meter_stats { + ovs_be32 meter_id; /* Meter instance. */ + ovs_be16 len; /* Length in bytes of this stats. */ + uint8_t pad[6]; + ovs_be32 flow_count; /* Number of flows bound to meter. */ + ovs_be64 packet_in_count; /* Number of packets in input. */ + ovs_be64 byte_in_count; /* Number of bytes in input. */ + ovs_be32 duration_sec; /* Time meter has been alive in seconds. */ + ovs_be32 duration_nsec; /* Time meter has been alive in nanoseconds + beyond duration_sec. */ + struct ofp13_meter_band_stats band_stats[0]; /* The band_stats length is + inferred from the length field. */ +}; +OFP_ASSERT(sizeof(struct ofp13_meter_stats) == 40); + +/* Body of reply to OFPMP13_METER_CONFIG request. Meter configuration. */ +struct ofp13_meter_config { + ovs_be16 length; /* Length of this entry. */ + ovs_be16 flags; /* Set of OFPMC_* that apply. */ + ovs_be32 meter_id; /* Meter instance. */ + /* struct ofp13_meter_band_header bands[0]; The bands length is inferred + from the length field. */ +}; +OFP_ASSERT(sizeof(struct ofp13_meter_config) == 8); + +/* Body of reply to OFPMP13_METER_FEATURES request. Meter features. */ +struct ofp13_meter_features { + ovs_be32 max_meter; /* Maximum number of meters. */ + ovs_be32 band_types; /* Bitmaps of OFPMBT13_* values supported. */ + ovs_be32 capabilities; /* Bitmaps of "ofp13_meter_flags". */ + uint8_t max_bands; /* Maximum bands per meters */ + uint8_t max_color; /* Maximum color value */ + uint8_t pad[2]; +}; +OFP_ASSERT(sizeof(struct ofp13_meter_features) == 16); + +/* Asynchronous message configuration. */ +/* The body of this is the same as nx_async_config */ +/* OFPT_GET_ASYNC_REPLY or OFPT_SET_ASYNC. */ +struct ofp13_async_config { + ovs_be32 packet_in_mask[2]; /* Bitmasks of OFPR_* values. */ + ovs_be32 port_status_mask[2]; /* Bitmasks of OFPPR_* values. */ + ovs_be32 flow_removed_mask[2];/* Bitmasks of OFPRR_* values. */ +}; +OFP_ASSERT(sizeof(struct ofp13_async_config) == 24); + +#endif /* openflow/openflow-1.3.h */ diff --git a/openflow/include/openflow/openflow-1.4.h b/openflow/include/openflow/openflow-1.4.h new file mode 100644 index 0000000..fcebe4e --- /dev/null +++ b/openflow/include/openflow/openflow-1.4.h @@ -0,0 +1,384 @@ +/* Copyright (c) 2008, 2014 The Board of Trustees of The Leland Stanford +* Junior University +* Copyright (c) 2011, 2012 Open Networking Foundation +* +* We are making the OpenFlow specification and associated documentation +* (Software) available for public use and benefit with the expectation +* that others will use, modify and enhance the Software and contribute +* those enhancements back to the community. However, since we would +* like to make the Software available for broadest use, with as few +* restrictions as possible permission is hereby granted, free of +* charge, to any person obtaining a copy of this Software to deal in +* the Software under the copyrights without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* The name and trademarks of copyright holder(s) may NOT be used in +* advertising or publicity pertaining to the Software or any +* derivatives without specific, written prior permission. +*/ + +/* OpenFlow: protocol between controller and datapath. */ + +#ifndef OPENFLOW_14_H +#define OPENFLOW_14_H 1 + +#include + +/* OpenFlow 1.4.1+ specific capabilities + * (struct ofp_switch_features, member capabilities). */ +enum ofp14_capabilities { + OFPC14_BUNDLES = 1 << 9, /* Switch supports bundles. */ + OFPC14_FLOW_MONITORING = 1 << 10, /* Switch supports flow monitoring. */ +}; + +/* ## ---------- ## */ +/* ## ofp14_port ## */ +/* ## ---------- ## */ + +/* Port description property types. */ +enum ofp_port_desc_prop_type { + OFPPDPT14_ETHERNET = 0, /* Ethernet property. */ + OFPPDPT14_OPTICAL = 1, /* Optical property. */ + OFPPDPT14_EXPERIMENTER = 0xFFFF, /* Experimenter property. */ +}; + +/* Ethernet port description property. */ +struct ofp14_port_desc_prop_ethernet { + ovs_be16 type; /* OFPPDPT14_ETHERNET. */ + ovs_be16 length; /* Length in bytes of this property. */ + uint8_t pad[4]; /* Align to 64 bits. */ + /* Bitmaps of OFPPF_* that describe features. All bits zeroed if + * unsupported or unavailable. */ + ovs_be32 curr; /* Current features. */ + ovs_be32 advertised; /* Features being advertised by the port. */ + ovs_be32 supported; /* Features supported by the port. */ + ovs_be32 peer; /* Features advertised by peer. */ + + ovs_be32 curr_speed; /* Current port bitrate in kbps. */ + ovs_be32 max_speed; /* Max port bitrate in kbps */ +}; +OFP_ASSERT(sizeof(struct ofp14_port_desc_prop_ethernet) == 32); + +struct ofp14_port { + ovs_be32 port_no; + ovs_be16 length; + uint8_t pad[2]; + struct eth_addr hw_addr; + uint8_t pad2[2]; /* Align to 64 bits. */ + char name[OFP_MAX_PORT_NAME_LEN]; /* Null-terminated */ + + ovs_be32 config; /* Bitmap of OFPPC_* flags. */ + ovs_be32 state; /* Bitmap of OFPPS_* flags. */ + + /* Followed by 0 or more OFPPDPT14_* properties. */ +}; +OFP_ASSERT(sizeof(struct ofp14_port) == 40); + + +/* ## -------------- ## */ +/* ## ofp14_port_mod ## */ +/* ## -------------- ## */ + +enum ofp14_port_mod_prop_type { + OFPPMPT14_ETHERNET = 0, /* Ethernet property. */ + OFPPMPT14_OPTICAL = 1, /* Optical property. */ + OFPPMPT14_EXPERIMENTER = 0xFFFF, /* Experimenter property. */ +}; + +struct ofp14_port_mod { + ovs_be32 port_no; + uint8_t pad[4]; + struct eth_addr hw_addr; + uint8_t pad2[2]; + ovs_be32 config; /* Bitmap of OFPPC_* flags. */ + ovs_be32 mask; /* Bitmap of OFPPC_* flags to be changed. */ + /* Followed by 0 or more OFPPMPT14_* properties. */ +}; +OFP_ASSERT(sizeof(struct ofp14_port_mod) == 24); + +/* ## --------------- ## */ +/* ## ofp14_table_mod ## */ +/* ## --------------- ## */ + +enum ofp14_table_mod_prop_type { + OFPTMPT14_EVICTION = 0x2, /* Eviction property. */ + OFPTMPT14_VACANCY = 0x3, /* Vacancy property. */ + OFPTMPT14_EXPERIMENTER = 0xFFFF, /* Experimenter property. */ +}; + +enum ofp14_table_mod_prop_eviction_flag { + OFPTMPEF14_OTHER = 1 << 0, /* Using other factors. */ + OFPTMPEF14_IMPORTANCE = 1 << 1, /* Using flow entry importance. */ + OFPTMPEF14_LIFETIME = 1 << 2, /* Using flow entry lifetime. */ +}; + +/* What changed about the table */ +enum ofp14_table_reason { + OFPTR_VACANCY_DOWN = 3, /* Vacancy down threshold event. */ + OFPTR_VACANCY_UP = 4, /* Vacancy up threshold event. */ +#define OFPTR_BITS ((1u << OFPTR_VACANCY_DOWN) | (1u << OFPTR_VACANCY_UP)) +}; + +struct ofp14_table_mod_prop_vacancy { + ovs_be16 type; /* OFPTMPT14_VACANCY. */ + ovs_be16 length; /* Length in bytes of this property. */ + uint8_t vacancy_down; /* Vacancy threshold when space decreases (%). */ + uint8_t vacancy_up; /* Vacancy threshold when space increases (%). */ + uint8_t vacancy; /* Current vacancy (%) - only in ofp14_table_desc. */ + uint8_t pad[1]; /* Align to 64 bits. */ +}; +OFP_ASSERT(sizeof(struct ofp14_table_mod_prop_vacancy) == 8); + +struct ofp14_table_mod { + uint8_t table_id; /* ID of the table, OFPTT_ALL indicates all tables */ + uint8_t pad[3]; /* Pad to 32 bits */ + ovs_be32 config; /* Bitmap of OFPTC_* flags */ + /* Followed by 0 or more OFPTMPT14_* properties. */ +}; +OFP_ASSERT(sizeof(struct ofp14_table_mod) == 8); + +/* Body of reply to OFPMP_TABLE_DESC request. */ +struct ofp14_table_desc { + ovs_be16 length; /* Length is padded to 64 bits. */ + uint8_t table_id; /* Identifier of table. Lower numbered tables + are consulted first. */ + uint8_t pad[1]; /* Align to 32-bits. */ + ovs_be32 config; /* Bitmap of OFPTC_* values. */ + /* Followed by 0 or more OFPTMPT14_* properties. */ +}; +OFP_ASSERT(sizeof(struct ofp14_table_desc) == 8); + +/* A table config has changed in the datapath */ +struct ofp14_table_status { + uint8_t reason; /* One of OFPTR_*. */ + uint8_t pad[7]; /* Pad to 64 bits */ + /* Followed by struct ofp14_table_desc */ +}; +OFP_ASSERT(sizeof(struct ofp14_table_status) == 8); + +/* ## ---------------- ## */ +/* ## ofp14_port_stats ## */ +/* ## ---------------- ## */ + +enum ofp14_port_stats_prop_type { + OFPPSPT14_ETHERNET = 0, /* Ethernet property. */ + OFPPSPT14_OPTICAL = 1, /* Optical property. */ + OFPPSPT14_EXPERIMENTER = 0xFFFF, /* Experimenter property. */ +}; + +struct ofp14_port_stats_prop_ethernet { + ovs_be16 type; /* OFPPSPT14_ETHERNET. */ + ovs_be16 length; /* Length in bytes of this property. */ + uint8_t pad[4]; /* Align to 64 bits. */ + + ovs_be64 rx_frame_err; /* Number of frame alignment errors. */ + ovs_be64 rx_over_err; /* Number of packets with RX overrun. */ + ovs_be64 rx_crc_err; /* Number of CRC errors. */ + ovs_be64 collisions; /* Number of collisions. */ +}; +OFP_ASSERT(sizeof(struct ofp14_port_stats_prop_ethernet) == 40); + +struct ofp14_port_stats { + ovs_be16 length; /* Length of this entry. */ + uint8_t pad[2]; /* Align to 64 bits. */ + ovs_be32 port_no; + ovs_be32 duration_sec; /* Time port has been alive in seconds. */ + ovs_be32 duration_nsec; /* Time port has been alive in nanoseconds beyond + duration_sec. */ + ovs_be64 rx_packets; /* Number of received packets. */ + ovs_be64 tx_packets; /* Number of transmitted packets. */ + ovs_be64 rx_bytes; /* Number of received bytes. */ + ovs_be64 tx_bytes; /* Number of transmitted bytes. */ + + ovs_be64 rx_dropped; /* Number of packets dropped by RX. */ + ovs_be64 tx_dropped; /* Number of packets dropped by TX. */ + ovs_be64 rx_errors; /* Number of receive errors. This is a super-set + of more specific receive errors and should be + greater than or equal to the sum of all + rx_*_err values in properties. */ + ovs_be64 tx_errors; /* Number of transmit errors. This is a super-set + of more specific transmit errors and should be + greater than or equal to the sum of all + tx_*_err values (none currently defined.) */ + /* Followed by 0 or more OFPPSPT14_* properties. */ +}; +OFP_ASSERT(sizeof(struct ofp14_port_stats) == 80); + + +/* ## ----------------- ## */ +/* ## ofp14_queue_stats ## */ +/* ## ----------------- ## */ + +struct ofp14_queue_stats { + ovs_be16 length; /* Length of this entry. */ + uint8_t pad[6]; /* Align to 64 bits. */ + struct ofp13_queue_stats qs; + /* Followed by 0 or more properties (none yet defined). */ +}; +OFP_ASSERT(sizeof(struct ofp14_queue_stats) == 48); + + +/* ## ---------------- ## */ +/* ## ofp14_queue_desc ## */ +/* ## ---------------- ## */ + +struct ofp14_queue_desc_request { + ovs_be32 port; /* All ports if OFPP_ANY. */ + ovs_be32 queue; /* All queues if OFPQ_ALL. */ +}; +OFP_ASSERT(sizeof(struct ofp14_queue_desc_request) == 8); + +/* Body of reply to OFPMP_QUEUE_DESC request. */ +struct ofp14_queue_desc { + ovs_be32 port_no; /* Port this queue is attached to. */ + ovs_be32 queue_id; /* ID for the specific queue. */ + ovs_be16 len; /* Length in bytes of this queue desc. */ + uint8_t pad[6]; /* 64-bit alignment. */ +}; +OFP_ASSERT(sizeof(struct ofp14_queue_desc) == 16); + +enum ofp14_queue_desc_prop_type { + OFPQDPT14_MIN_RATE = 1, + OFPQDPT14_MAX_RATE = 2, + OFPQDPT14_EXPERIMENTER = 0xffff +}; + +/* ## -------------- ## */ +/* ## Miscellaneous. ## */ +/* ## -------------- ## */ + +/* Request forward reason */ +enum ofp14_requestforward_reason { + OFPRFR_GROUP_MOD = 0, /* Forward group mod requests. */ + OFPRFR_METER_MOD = 1, /* Forward meter mod requests. */ + OFPRFR_N_REASONS /* Denotes number of reasons. */ +}; + +/* Role status event message. */ +struct ofp14_role_status { + ovs_be32 role; /* One of OFPCR_ROLE_*. */ + uint8_t reason; /* One of OFPCRR_*. */ + uint8_t pad[3]; /* Align to 64 bits. */ + ovs_be64 generation_id; /* Master Election Generation Id */ + + /* Followed by a list of struct ofp14_role_prop_header */ +}; +OFP_ASSERT(sizeof(struct ofp14_role_status) == 16); + +/* What changed about the controller role */ +enum ofp14_controller_role_reason { + OFPCRR_MASTER_REQUEST = 0, /* Another controller asked to be master. */ + OFPCRR_CONFIG = 1, /* Configuration changed on the switch. */ + OFPCRR_EXPERIMENTER = 2, /* Experimenter data changed. */ + OFPCRR_N_REASONS /* Denotes number of reasons. */ +}; + +/* Role property types. +*/ +enum ofp14_role_prop_type { + OFPRPT_EXPERIMENTER = 0xFFFF, /* Experimenter property. */ +}; + +/* Group/Meter request forwarding. */ +struct ofp14_requestforward { + struct ofp_header request; /* Request being forwarded. */ +}; +OFP_ASSERT(sizeof(struct ofp14_requestforward) == 8); + +/* Bundle control message types */ +enum ofp14_bundle_ctrl_type { + OFPBCT_OPEN_REQUEST = 0, + OFPBCT_OPEN_REPLY = 1, + OFPBCT_CLOSE_REQUEST = 2, + OFPBCT_CLOSE_REPLY = 3, + OFPBCT_COMMIT_REQUEST = 4, + OFPBCT_COMMIT_REPLY = 5, + OFPBCT_DISCARD_REQUEST = 6, + OFPBCT_DISCARD_REPLY = 7, +}; + +/* Bundle configuration flags. */ +enum ofp14_bundle_flags { + OFPBF_ATOMIC = 1 << 0, /* Execute atomically. */ + OFPBF_ORDERED = 1 << 1, /* Execute in specified order. */ +}; + +/* Message structure for OFPT_BUNDLE_CONTROL and OFPT_BUNDLE_ADD_MESSAGE. */ +struct ofp14_bundle_ctrl_msg { + ovs_be32 bundle_id; /* Identify the bundle. */ + ovs_be16 type; /* OFPT_BUNDLE_CONTROL: one of OFPBCT_*. + * OFPT_BUNDLE_ADD_MESSAGE: not used. */ + ovs_be16 flags; /* Bitmap of OFPBF_* flags. */ + /* Followed by: + * - For OFPT_BUNDLE_ADD_MESSAGE only, an encapsulated OpenFlow message, + * beginning with an ofp_header whose xid is identical to this message's + * outer xid. + * - For OFPT_BUNDLE_ADD_MESSAGE only, and only if at least one property is + * present, 0 to 7 bytes of padding to align on a 64-bit boundary. + * - Zero or more properties (see struct ofp14_bundle_prop_header). */ +}; +OFP_ASSERT(sizeof(struct ofp14_bundle_ctrl_msg) == 8); + +/* Body for ofp14_multipart_request of type OFPMP_FLOW_MONITOR. + * + * The OFPMP_FLOW_MONITOR request's body consists of an array of zero or more + * instances of this structure. The request arranges to monitor the flows + * that match the specified criteria, which are interpreted in the same way as + * for OFPMP_FLOW. + * + * 'id' identifies a particular monitor for the purpose of allowing it to be + * canceled later with OFPFMC_DELETE. 'id' must be unique among + * existing monitors that have not already been canceled. + */ +struct ofp14_flow_monitor_request { + ovs_be32 monitor_id; /* Controller-assigned ID for this monitor. */ + ovs_be32 out_port; /* Required output port, if not OFPP_ANY. */ + ovs_be32 out_group; /* Required output port, if not OFPG_ANY. */ + ovs_be16 flags; /* OFPMF14_*. */ + uint8_t table_id; /* One table's ID or OFPTT_ALL (all tables). */ + uint8_t command; /* One of OFPFMC14_*. */ + /* Followed by an ofp11_match structure. */ +}; +OFP_ASSERT(sizeof(struct ofp14_flow_monitor_request) == 16); + +/* Flow monitor commands */ +enum ofp14_flow_monitor_command { + OFPFMC14_ADD = 0, /* New flow monitor. */ + OFPFMC14_MODIFY = 1, /* Modify existing flow monitor. */ + OFPFMC14_DELETE = 2, /* Delete/cancel existing flow monitor. */ +}; + +/* 'flags' bits in struct of_flow_monitor_request. */ +enum ofp14_flow_monitor_flags { + /* When to send updates. */ + /* Common to NX and OpenFlow 1.4 */ + OFPFMF14_INITIAL = 1 << 0, /* Initially matching flows. */ + OFPFMF14_ADD = 1 << 1, /* New matching flows as they are added. */ + OFPFMF14_REMOVED = 1 << 2, /* Old matching flows as they are removed. */ + OFPFMF14_MODIFY = 1 << 3, /* Matching flows as they are changed. */ + + /* What to include in updates. */ + /* Common to NX and OpenFlow 1.4 */ + OFPFMF14_INSTRUCTIONS = 1 << 4, /* If set, instructions are included. */ + OFPFMF14_NO_ABBREV = 1 << 5, /* If set, include own changes in full. */ + /* OpenFlow 1.4 */ + OFPFMF14_ONLY_OWN = 1 << 6, /* If set, don't include other controllers. + */ +}; + +#endif /* openflow/openflow-1.4.h */ diff --git a/openflow/include/openflow/openflow-1.5.h b/openflow/include/openflow/openflow-1.5.h new file mode 100644 index 0000000..3649e6c --- /dev/null +++ b/openflow/include/openflow/openflow-1.5.h @@ -0,0 +1,153 @@ +/* Copyright (c) 2008, 2014 The Board of Trustees of The Leland Stanford +* Junior University +* Copyright (c) 2011, 2014 Open Networking Foundation +* +* We are making the OpenFlow specification and associated documentation +* (Software) available for public use and benefit with the expectation +* that others will use, modify and enhance the Software and contribute +* those enhancements back to the community. However, since we would +* like to make the Software available for broadest use, with as few +* restrictions as possible permission is hereby granted, free of +* charge, to any person obtaining a copy of this Software to deal in +* the Software under the copyrights without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* The name and trademarks of copyright holder(s) may NOT be used in +* advertising or publicity pertaining to the Software or any +* derivatives without specific, written prior permission. +*/ + +/* OpenFlow: protocol between controller and datapath. */ + +#ifndef OPENFLOW_15_H +#define OPENFLOW_15_H 1 + +#include + +/* Body for ofp15_multipart_request of type OFPMP_PORT_DESC. */ +struct ofp15_port_desc_request { + ovs_be32 port_no; /* All ports if OFPP_ANY. */ + uint8_t pad[4]; /* Align to 64 bits. */ +}; +OFP_ASSERT(sizeof(struct ofp15_port_desc_request) == 8); + +/* Group commands */ +enum ofp15_group_mod_command { + /* Present since OpenFlow 1.1 - 1.4 */ + OFPGC15_ADD = 0, /* New group. */ + OFPGC15_MODIFY = 1, /* Modify all matching groups. */ + OFPGC15_DELETE = 2, /* Delete all matching groups. */ + + /* New in OpenFlow 1.5 */ + OFPGC15_INSERT_BUCKET = 3,/* Insert action buckets to the already available + list of action buckets in a matching group */ + /* OFPGCXX_YYY = 4, */ /* Reserved for future use. */ + OFPGC15_REMOVE_BUCKET = 5,/* Remove all action buckets or any specific + action bucket from matching group */ + OFPGC15_ADD_OR_MOD = 0x8000, /* Create new or modify existing group. */ +}; + +/* Group bucket property types. */ +enum ofp15_group_bucket_prop_type { + OFPGBPT15_WEIGHT = 0, /* Select groups only. */ + OFPGBPT15_WATCH_PORT = 1, /* Fast failover groups only. */ + OFPGBPT15_WATCH_GROUP = 2, /* Fast failover groups only. */ + OFPGBPT15_EXPERIMENTER = 0xFFFF, /* Experimenter defined. */ +}; + +/* Bucket for use in groups. */ +struct ofp15_bucket { + ovs_be16 len; /* Length the bucket in bytes, including + this header and any padding to make it + 64-bit aligned. */ + ovs_be16 action_array_len; /* Length of all actions in bytes. */ + ovs_be32 bucket_id; /* Bucket Id used to identify bucket*/ + /* Followed by exactly len - 8 bytes of group bucket properties. */ + /* Followed by: + * - Exactly 'action_array_len' bytes containing an array of + * struct ofp_action_*. + * - Zero or more bytes of group bucket properties to fill out the + * overall length in header.length. */ +}; +OFP_ASSERT(sizeof(struct ofp15_bucket) == 8); + +/* Bucket Id can be any value between 0 and OFPG_BUCKET_MAX */ +enum ofp15_group_bucket { + OFPG15_BUCKET_MAX = 0xffffff00, /* Last usable bucket ID */ + OFPG15_BUCKET_FIRST = 0xfffffffd, /* First bucket ID in the list of action + buckets of a group. This is applicable + for OFPGC15_INSERT_BUCKET and + OFPGC15_REMOVE_BUCKET commands */ + OFPG15_BUCKET_LAST = 0xfffffffe, /* Last bucket ID in the list of action + buckets of a group. This is applicable + for OFPGC15_INSERT_BUCKET and + OFPGC15_REMOVE_BUCKET commands */ + OFPG15_BUCKET_ALL = 0xffffffff /* All action buckets in a group, + This is applicable for + only OFPGC15_REMOVE_BUCKET command */ +}; + +/* Group property types. */ +enum ofp_group_prop_type { + OFPGPT15_EXPERIMENTER = 0xFFFF, /* Experimenter defined. */ +}; + +/* Group setup and teardown (controller -> datapath). */ +struct ofp15_group_mod { + ovs_be16 command; /* One of OFPGC15_*. */ + uint8_t type; /* One of OFPGT11_*. */ + uint8_t pad; /* Pad to 64 bits. */ + ovs_be32 group_id; /* Group identifier. */ + ovs_be16 bucket_array_len; /* Length of action buckets data. */ + uint8_t pad1[2]; /* Pad to 64 bits. */ + ovs_be32 command_bucket_id; /* Bucket Id used as part of + * OFPGC15_INSERT_BUCKET and + * OFPGC15_REMOVE_BUCKET commands + * execution.*/ + /* Followed by: + * - Exactly 'bucket_array_len' bytes containing an array of + * struct ofp15_bucket. + * - Zero or more bytes of group properties to fill out the overall + * length in header.length. */ +}; +OFP_ASSERT(sizeof(struct ofp15_group_mod) == 16); + +/* Body for ofp15_multipart_request of type OFPMP_GROUP_DESC. */ +struct ofp15_group_desc_request { + ovs_be32 group_id; /* All groups if OFPG_ALL. */ + uint8_t pad[4]; /* Align to 64 bits. */ +}; +OFP_ASSERT(sizeof(struct ofp15_group_desc_request) == 8); + +/* Body of reply to OFPMP_GROUP_DESC request. */ +struct ofp15_group_desc_stats { + ovs_be16 length; /* Length of this entry. */ + uint8_t type; /* One of OFPGT11_*. */ + uint8_t pad; /* Pad to 64 bits. */ + ovs_be32 group_id; /* Group identifier. */ + ovs_be16 bucket_list_len; /* Length of action buckets data. */ + uint8_t pad2[6]; /* Pad to 64 bits. */ + /* Followed by: + * - Exactly 'bucket_list_len' bytes containing an array of + * struct ofp_bucket. + * - Zero or more bytes of group properties to fill out the overall + * length in header.length. */ +}; +OFP_ASSERT(sizeof(struct ofp15_group_desc_stats) == 16); + +#endif /* openflow/openflow-1.5.h */ diff --git a/openflow/include/openflow/openflow-common.h b/openflow/include/openflow/openflow-common.h new file mode 100644 index 0000000..7b619a9 --- /dev/null +++ b/openflow/include/openflow/openflow-common.h @@ -0,0 +1,457 @@ +/* Copyright (c) 2008, 2011, 2012, 2013, 2014, 2016 The Board of Trustees of The Leland Stanford + * Junior University + * + * We are making the OpenFlow specification and associated documentation + * (Software) available for public use and benefit with the expectation + * that others will use, modify and enhance the Software and contribute + * those enhancements back to the community. However, since we would + * like to make the Software available for broadest use, with as few + * restrictions as possible permission is hereby granted, free of + * charge, to any person obtaining a copy of this Software to deal in + * the Software under the copyrights without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * The name and trademarks of copyright holder(s) may NOT be used in + * advertising or publicity pertaining to the Software or any + * derivatives without specific, written prior permission. + */ + +/* + * Copyright (c) 2008-2015 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENFLOW_COMMON_H +#define OPENFLOW_COMMON_H 1 + +#include + +#ifdef SWIG +#define OFP_ASSERT(EXPR) /* SWIG can't handle OFP_ASSERT. */ +#elif !defined(__cplusplus) +/* Build-time assertion for use in a declaration context. */ +#define OFP_ASSERT(EXPR) \ + extern int (*build_assert(void))[ sizeof(struct { \ + unsigned int build_assert_failed : (EXPR) ? 1 : -1; })] +#else /* __cplusplus */ +#include +#define OFP_ASSERT BOOST_STATIC_ASSERT +#endif /* __cplusplus */ + +/* Version number: + * Non-experimental versions released: 0x01 0x02 + * Experimental versions released: 0x81 -- 0x99 + */ +/* The most significant bit being set in the version field indicates an + * experimental OpenFlow version. + */ +enum ofp_version { + OFP10_VERSION = 0x01, + OFP11_VERSION = 0x02, + OFP12_VERSION = 0x03, + OFP13_VERSION = 0x04, + OFP14_VERSION = 0x05, + OFP15_VERSION = 0x06, + OFP16_VERSION = 0x07 +}; + +/* Vendor (aka experimenter) IDs. + * + * These are used in various places in OpenFlow to identify an extension + * defined by some vendor, as opposed to a standardized part of the core + * OpenFlow protocol. + * + * Vendor IDs whose top 8 bits are 0 hold an Ethernet OUI in their low 24 bits. + * The Open Networking Foundation assigns vendor IDs whose top 8 bits are + * nonzero. + * + * A few vendor IDs are special: + * + * - OF_VENDOR_ID is not a real vendor ID and does not appear in the + * OpenFlow protocol itself. It can occasionally be useful within Open + * vSwitch to identify a standardized part of OpenFlow. + * + * - ONF_VENDOR_ID is being used within the ONF "extensibility" working + * group to identify extensions being proposed for standardization. + * + * The list is sorted numerically. + */ +#define OF_VENDOR_ID 0 +#define HPL_VENDOR_ID 0x000004EA /* HP Labs. */ +#define NTR_VENDOR_ID 0x0000154d /* Netronome. */ +#define NTR_COMPAT_VENDOR_ID 0x00001540 /* Incorrect value used in v2.4. */ +#define NX_VENDOR_ID 0x00002320 /* Nicira. */ +#define ONF_VENDOR_ID 0x4f4e4600 /* Open Networking Foundation. */ +#define INTEL_VENDOR_ID 0x0000AA01 /* Intel */ + +#define OFP_MAX_TABLE_NAME_LEN 32 +#define OFP_MAX_PORT_NAME_LEN 16 + +#define OFP_OLD_PORT 6633 +#define OFP_PORT 6653 + +#define OFP_DEFAULT_MISS_SEND_LEN 128 + +/* Values below this cutoff are 802.3 packets and the two bytes + * following MAC addresses are used as a frame length. Otherwise, the + * two bytes are used as the Ethernet type. + */ +#define OFP_DL_TYPE_ETH2_CUTOFF 0x0600 + +/* Value of dl_type to indicate that the frame does not include an + * Ethernet type. + */ +#define OFP_DL_TYPE_NOT_ETH_TYPE 0x05ff + +/* Value used in "idle_timeout" and "hard_timeout" to indicate that the entry + * is permanent. */ +#define OFP_FLOW_PERMANENT 0 + +/* By default, choose a priority in the middle. */ +#define OFP_DEFAULT_PRIORITY 0x8000 + + +/* Header on all OpenFlow packets. */ +struct ofp_header { + uint8_t version; /* An OpenFlow version number, e.g. OFP10_VERSION. */ + uint8_t type; /* One of the OFPT_ constants. */ + ovs_be16 length; /* Length including this ofp_header. */ + ovs_be32 xid; /* Transaction id associated with this packet. + Replies use the same id as was in the request + to facilitate pairing. */ +}; +OFP_ASSERT(sizeof(struct ofp_header) == 8); + +/* OFPT_ERROR: Error message (datapath -> controller). */ +struct ofp_error_msg { + ovs_be16 type; + ovs_be16 code; + uint8_t data[0]; /* Variable-length data. Interpreted based + on the type and code. */ +}; +OFP_ASSERT(sizeof(struct ofp_error_msg) == 4); + +enum ofp_config_flags { + /* Handling of IP fragments. */ + OFPC_FRAG_NORMAL = 0, /* No special handling for fragments. */ + OFPC_FRAG_DROP = 1, /* Drop fragments. */ + OFPC_FRAG_REASM = 2, /* Reassemble (only if OFPC_IP_REASM set). */ + OFPC_FRAG_NX_MATCH = 3, /* Make first fragments available for matching. */ + OFPC_FRAG_MASK = 3, + + /* OFPC_INVALID_TTL_TO_CONTROLLER is deprecated in OpenFlow 1.3 */ + + /* TTL processing - applicable for IP and MPLS packets. */ + OFPC_INVALID_TTL_TO_CONTROLLER = 1 << 2, /* Send packets with invalid TTL + to the controller. */ +}; + +/* Switch configuration. */ +struct ofp_switch_config { + ovs_be16 flags; /* OFPC_* flags. */ + ovs_be16 miss_send_len; /* Max bytes of new flow that datapath should + send to the controller. */ +}; +OFP_ASSERT(sizeof(struct ofp_switch_config) == 4); + + +/* Common flags to indicate behavior of the physical port. These flags are + * used in ofp_port to describe the current configuration. They are used in + * the ofp_port_mod message to configure the port's behavior. + */ +enum ofp_port_config { + OFPPC_PORT_DOWN = 1 << 0, /* Port is administratively down. */ + + OFPPC_NO_RECV = 1 << 2, /* Drop all packets received by port. */ + OFPPC_NO_FWD = 1 << 5, /* Drop packets forwarded to port. */ + OFPPC_NO_PACKET_IN = 1 << 6 /* Do not send packet-in msgs for port. */ +}; + +/* Common current state of the physical port. These are not configurable from + * the controller. + */ +enum ofp_port_state { + OFPPS_LINK_DOWN = 1 << 0, /* No physical link present. */ +}; + +/* Common features of physical ports available in a datapath. */ +enum ofp_port_features { + OFPPF_10MB_HD = 1 << 0, /* 10 Mb half-duplex rate support. */ + OFPPF_10MB_FD = 1 << 1, /* 10 Mb full-duplex rate support. */ + OFPPF_100MB_HD = 1 << 2, /* 100 Mb half-duplex rate support. */ + OFPPF_100MB_FD = 1 << 3, /* 100 Mb full-duplex rate support. */ + OFPPF_1GB_HD = 1 << 4, /* 1 Gb half-duplex rate support. */ + OFPPF_1GB_FD = 1 << 5, /* 1 Gb full-duplex rate support. */ + OFPPF_10GB_FD = 1 << 6, /* 10 Gb full-duplex rate support. */ +}; + +/* Generic OpenFlow property header, as used by various messages in OF1.3+, and + * especially in OF1.4. + * + * The OpenFlow specs prefer to define a new structure with a specialized name + * each time this property structure comes up: struct + * ofp_port_desc_prop_header, struct ofp_controller_status_prop_header, struct + * ofp_table_mod_prop_header, and more. They're all the same, so it's easier + * to unify them. + */ +struct ofp_prop_header { + ovs_be16 type; + ovs_be16 len; + /* Followed by: + * - 'len - 4' bytes of payload. + * - PAD_SIZE(len, 8) bytes of zeros. */ +}; +OFP_ASSERT(sizeof(struct ofp_prop_header) == 4); + +/* Generic OpenFlow experimenter property header. + * + * Again the OpenFlow specs define this over and over again and it's easier to + * unify them. */ +struct ofp_prop_experimenter { + ovs_be16 type; /* Generally 0xffff (in one case 0xfffe). */ + ovs_be16 len; /* Length in bytes of this property. */ + ovs_be32 experimenter; /* Experimenter ID which takes the same form as + * in struct ofp_experimenter_header. */ + ovs_be32 exp_type; /* Experimenter defined. */ + /* Followed by: + * - 'len - 12' bytes of payload. + * - PAD_SIZE(len, 8) bytes of zeros. */ +}; +OFP_ASSERT(sizeof(struct ofp_prop_experimenter) == 12); + +/* Switch features. */ +struct ofp_switch_features { + ovs_be64 datapath_id; /* Datapath unique ID. The lower 48-bits are for + a MAC address, while the upper 16-bits are + implementer-defined. */ + + ovs_be32 n_buffers; /* Max packets buffered at once. */ + + uint8_t n_tables; /* Number of tables supported by datapath. */ + uint8_t auxiliary_id; /* OF 1.3: Identify auxiliary connections */ + uint8_t pad[2]; /* Align to 64-bits. */ + + /* Features. */ + ovs_be32 capabilities; /* OFPC_*, OFPC10_*, OFPC11_*, OFPC12_*. */ + ovs_be32 actions; /* Bitmap of supported "ofp_action_type"s. + * DEPRECATED in OpenFlow 1.1 */ + + /* Followed by an array of struct ofp10_phy_port or struct ofp11_port + * structures. The number is inferred from header.length. + * REMOVED in OpenFlow 1.3 */ +}; +OFP_ASSERT(sizeof(struct ofp_switch_features) == 24); + +/* Common capabilities supported by the datapath (struct ofp_switch_features, + * member capabilities). */ +enum ofp_capabilities { + OFPC_FLOW_STATS = 1 << 0, /* Flow statistics. */ + OFPC_TABLE_STATS = 1 << 1, /* Table statistics. */ + OFPC_PORT_STATS = 1 << 2, /* Port statistics. */ + OFPC_IP_REASM = 1 << 5, /* Can reassemble IP fragments. */ + OFPC_QUEUE_STATS = 1 << 6, /* Queue statistics. */ + OFPC_ARP_MATCH_IP = 1 << 7 /* Match IP addresses in ARP + pkts. */ +}; + +/* Why is this packet being sent to the controller? */ +enum ofp_packet_in_reason { + /* Standard reasons. */ + OFPR_NO_MATCH, /* No matching flow. */ + OFPR_ACTION, /* Action explicitly output to controller. */ + OFPR_INVALID_TTL, /* Packet has invalid TTL. */ + OFPR_ACTION_SET, /* Output to controller in action set */ + OFPR_GROUP, /* Output to controller in group bucket */ + OFPR_PACKET_OUT, /* Output to controller in packet-out */ + +#define OFPR10_BITS \ + ((1u << OFPR_NO_MATCH) | (1u << OFPR_ACTION) | (1u << OFPR_INVALID_TTL)) +#define OFPR14_BITS \ + (OFPR10_BITS | \ + (1u << OFPR_ACTION_SET) | (1u << OFPR_GROUP) | (1u << OFPR_PACKET_OUT)) + + /* Nonstandard reason--not exposed via OpenFlow. */ + OFPR_EXPLICIT_MISS, + OFPR_IMPLICIT_MISS, + + OFPR_N_REASONS +}; + +enum ofp_flow_mod_command { + OFPFC_ADD, /* New flow. */ + OFPFC_MODIFY, /* Modify all matching flows. */ + OFPFC_MODIFY_STRICT, /* Modify entry strictly matching wildcards */ + OFPFC_DELETE, /* Delete all matching flows. */ + OFPFC_DELETE_STRICT /* Strictly match wildcards and priority. */ +}; + +enum ofp_flow_mod_flags { + OFPFF_SEND_FLOW_REM = 1 << 0, /* Send flow removed message when flow + * expires or is deleted. */ + OFPFF_CHECK_OVERLAP = 1 << 1, /* Check for overlapping entries first. */ +}; + +/* Why was this flow removed? */ +enum ofp_flow_removed_reason { + OFPRR_IDLE_TIMEOUT, /* Flow idle time exceeded idle_timeout. */ + OFPRR_HARD_TIMEOUT, /* Time exceeded hard_timeout. */ + OFPRR_DELETE, /* Evicted by a DELETE flow mod. */ + OFPRR_GROUP_DELETE, /* Group was removed. */ + OFPRR_METER_DELETE, /* Meter was removed. */ + OFPRR_EVICTION, /* Switch eviction to free resources. */ + +#define OFPRR10_BITS \ + ((1u << OFPRR_IDLE_TIMEOUT) | \ + (1u << OFPRR_HARD_TIMEOUT) | \ + (1u << OFPRR_DELETE)) +#define OFPRR14_BITS \ + (OFPRR10_BITS | \ + (1u << OFPRR_GROUP_DELETE) | \ + (1u << OFPRR_METER_DELETE) | \ + (1u << OFPRR_EVICTION)) + + OVS_OFPRR_NONE /* OVS internal_use only, keep last!. */ +}; + +/* What changed about the physical port */ +enum ofp_port_reason { + OFPPR_ADD, /* The port was added. */ + OFPPR_DELETE, /* The port was removed. */ + OFPPR_MODIFY, /* Some attribute of the port has changed. */ + +#define OFPPR_BITS ((1u << OFPPR_ADD) | \ + (1u << OFPPR_DELETE) | \ + (1u << OFPPR_MODIFY)) + + OFPPR_N_REASONS /* Denotes number of reasons. */ +}; + +/* A physical port has changed in the datapath */ +struct ofp_port_status { + uint8_t reason; /* One of OFPPR_*. */ + uint8_t pad[7]; /* Align to 64-bits. */ + /* Followed by struct ofp10_phy_port, struct ofp11_port, or struct + * ofp14_port. */ +}; +OFP_ASSERT(sizeof(struct ofp_port_status) == 8); + +enum ofp_stats_reply_flags { + OFPSF_REPLY_MORE = 1 << 0 /* More replies to follow. */ +}; + +#define DESC_STR_LEN 256 +#define SERIAL_NUM_LEN 32 +/* Body of reply to OFPST_DESC request. Each entry is a NULL-terminated ASCII + * string. */ +struct ofp_desc_stats { + char mfr_desc[DESC_STR_LEN]; /* Manufacturer description. */ + char hw_desc[DESC_STR_LEN]; /* Hardware description. */ + char sw_desc[DESC_STR_LEN]; /* Software description. */ + char serial_num[SERIAL_NUM_LEN]; /* Serial number. */ + char dp_desc[DESC_STR_LEN]; /* Human readable description of + the datapath. */ +}; +OFP_ASSERT(sizeof(struct ofp_desc_stats) == 1056); + +/* Reply to OFPST_AGGREGATE request. */ +struct ofp_aggregate_stats_reply { + ovs_32aligned_be64 packet_count; /* Number of packets in flows. */ + ovs_32aligned_be64 byte_count; /* Number of bytes in flows. */ + ovs_be32 flow_count; /* Number of flows. */ + uint8_t pad[4]; /* Align to 64 bits. */ +}; +OFP_ASSERT(sizeof(struct ofp_aggregate_stats_reply) == 24); + +/* The match type indicates the match structure (set of fields that compose the + * match) in use. The match type is placed in the type field at the beginning + * of all match structures. The "OpenFlow Extensible Match" type corresponds + * to OXM TLV format described below and must be supported by all OpenFlow + * switches. Extensions that define other match types may be published on the + * ONF wiki. Support for extensions is optional. + */ +enum ofp_match_type { + OFPMT_STANDARD = 0, /* The match fields defined in the ofp11_match + structure apply */ + OFPMT_OXM = 1, /* OpenFlow Extensible Match */ +}; + +/* Group numbering. Groups can use any number up to OFPG_MAX. */ +enum ofp_group { + /* Last usable group number. */ + OFPG_MAX = 0xffffff00, + + /* Fake groups. */ + OFPG_ALL = 0xfffffffc, /* All groups, for group delete commands. */ + OFPG_ANY = 0xffffffff /* Wildcard, for flow stats requests. */ +}; + +/* Group configuration flags */ +enum ofp_group_capabilities { + OFPGFC_SELECT_WEIGHT = 1 << 0, /* Support weight for select groups */ + OFPGFC_SELECT_LIVENESS = 1 << 1, /* Support liveness for select groups */ + OFPGFC_CHAINING = 1 << 2, /* Support chaining groups */ + OFPGFC_CHAINING_CHECKS = 1 << 3, /* Check chaining for loops and delete */ +}; + +enum ofp_hello_elem_type { + OFPHET_VERSIONBITMAP = 1, /* Bitmap of version supported. */ +}; + +/* Common header for all Hello Elements */ +struct ofp_hello_elem_header { + ovs_be16 type; /* One of OFPHET_*. */ + ovs_be16 length; /* Length in bytes of this element. */ +}; +OFP_ASSERT(sizeof(struct ofp_hello_elem_header) == 4); + +/* Table numbering. Tables can use any number up to OFPT_MAX. */ +enum ofp_table { + /* Last usable table number. */ + OFPTT_MAX = 0xfe, + + /* Fake tables. */ + OFPTT_ALL = 0xff /* Wildcard table used for table config, + flow stats and flow deletes. */ +}; + +enum ofp_table_config { + /* OpenFlow 1.1 and 1.2 defined this field as shown. + * OpenFlow 1.3 and later mark this field as deprecated, but have not + * reused it for any new purpose. */ + OFPTC11_TABLE_MISS_CONTROLLER = 0 << 0, /* Send to controller. */ + OFPTC11_TABLE_MISS_CONTINUE = 1 << 0, /* Go to next table, like OF1.0. */ + OFPTC11_TABLE_MISS_DROP = 2 << 0, /* Drop the packet. */ + OFPTC11_TABLE_MISS_MASK = 3 << 0, + + /* OpenFlow 1.4. */ + OFPTC14_EVICTION = 1 << 2, /* Allow table to evict flows. */ + OFPTC14_VACANCY_EVENTS = 1 << 3, /* Enable vacancy events. */ +}; + +#endif /* openflow/openflow-common.h */ diff --git a/openflow/include/openflow/openflow.h b/openflow/include/openflow/openflow.h new file mode 100644 index 0000000..7976fbb --- /dev/null +++ b/openflow/include/openflow/openflow.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENFLOW_OPENFLOW_H +#define OPENFLOW_OPENFLOW_H 1 + +#include +#include +#include +#include +#include +#include + +#endif /* openflow/openflow.h */ diff --git a/openflow/include/openvswitch/compiler.h b/openflow/include/openvswitch/compiler.h new file mode 100644 index 0000000..6e779f3 --- /dev/null +++ b/openflow/include/openvswitch/compiler.h @@ -0,0 +1,269 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_COMPILER_H +#define OPENVSWITCH_COMPILER_H 1 + +#include +#include + +#ifndef __has_feature + #define __has_feature(x) 0 +#endif +#ifndef __has_extension + #define __has_extension(x) 0 +#endif + +/* To make OVS_NO_RETURN portable across gcc/clang and MSVC, it should be + * added at the beginning of the function declaration. */ +#if __GNUC__ && !__CHECKER__ +#define OVS_NO_RETURN __attribute__((__noreturn__)) +#elif _MSC_VER +#define OVS_NO_RETURN __declspec(noreturn) +#else +#define OVS_NO_RETURN +#endif + +#if __GNUC__ && !__CHECKER__ +#define OVS_UNUSED __attribute__((__unused__)) +#define OVS_PRINTF_FORMAT(FMT, ARG1) __attribute__((__format__(printf, FMT, ARG1))) +#define OVS_SCANF_FORMAT(FMT, ARG1) __attribute__((__format__(scanf, FMT, ARG1))) +#define OVS_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) +#define OVS_LIKELY(CONDITION) __builtin_expect(!!(CONDITION), 1) +#define OVS_UNLIKELY(CONDITION) __builtin_expect(!!(CONDITION), 0) +#else +#define OVS_UNUSED +#define OVS_PRINTF_FORMAT(FMT, ARG1) +#define OVS_SCANF_FORMAT(FMT, ARG1) +#define OVS_WARN_UNUSED_RESULT +#define OVS_LIKELY(CONDITION) (!!(CONDITION)) +#define OVS_UNLIKELY(CONDITION) (!!(CONDITION)) +#endif + +#if __has_feature(c_thread_safety_attributes) +/* "clang" annotations for thread safety check. + * + * OVS_LOCKABLE indicates that the struct contains mutex element + * which can be locked by functions like ovs_mutex_lock(). + * + * Below, the word MUTEX stands for the name of an object with an OVS_LOCKABLE + * struct type. It can also be a comma-separated list of multiple structs, + * e.g. to require a function to hold multiple locks while invoked. + * + * + * On a variable: + * + * - OVS_GUARDED indicates that the variable may only be accessed some mutex + * is held. + * + * - OVS_GUARDED_BY(MUTEX) indicates that the variable may only be accessed + * while the specific MUTEX is held. + * + * + * On a variable A of mutex type: + * + * - OVS_ACQ_BEFORE(B), where B is a mutex or a comma-separated list of + * mutexes, declare that if both A and B are acquired at the same time, + * then A must be acquired before B. That is, B nests inside A. + * + * - OVS_ACQ_AFTER(B) is the opposite of OVS_ACQ_BEFORE(B), that is, it + * declares that A nests inside B. + * + * + * On a function, the following attributes apply to mutexes: + * + * - OVS_ACQUIRES(MUTEX) indicate that the function must be called without + * holding MUTEX and that it returns holding MUTEX. + * + * - OVS_RELEASES(MUTEX) indicates that the function may only be called with + * MUTEX held and that it returns with MUTEX released. It can be used for + * all types of MUTEX. + * + * - OVS_TRY_LOCK(RETVAL, MUTEX) indicate that the function will try to + * acquire MUTEX. RETVAL is an integer or boolean value specifying the + * return value of a successful lock acquisition. + * + * - OVS_REQUIRES(MUTEX) indicate that the function may only be called with + * MUTEX held and that the function does not release MUTEX. + * + * - OVS_EXCLUDED(MUTEX) indicates that the function may only be called when + * MUTEX is not held. + * + * + * The following variants, with the same syntax, apply to reader-writer locks: + * + * mutex rwlock, for reading rwlock, for writing + * ------------------- ------------------- ------------------- + * OVS_ACQUIRES OVS_ACQ_RDLOCK OVS_ACQ_WRLOCK + * OVS_RELEASES OVS_RELEASES OVS_RELEASES + * OVS_TRY_LOCK OVS_TRY_RDLOCK OVS_TRY_WRLOCK + * OVS_REQUIRES OVS_REQ_RDLOCK OVS_REQ_WRLOCK + * OVS_EXCLUDED OVS_EXCLUDED OVS_EXCLUDED + */ +#define OVS_LOCKABLE __attribute__((lockable)) +#define OVS_REQ_RDLOCK(...) __attribute__((shared_locks_required(__VA_ARGS__))) +#define OVS_ACQ_RDLOCK(...) __attribute__((shared_lock_function(__VA_ARGS__))) +#define OVS_REQ_WRLOCK(...) \ + __attribute__((exclusive_locks_required(__VA_ARGS__))) +#define OVS_ACQ_WRLOCK(...) \ + __attribute__((exclusive_lock_function(__VA_ARGS__))) +#define OVS_REQUIRES(...) \ + __attribute__((exclusive_locks_required(__VA_ARGS__))) +#define OVS_ACQUIRES(...) \ + __attribute__((exclusive_lock_function(__VA_ARGS__))) +#define OVS_TRY_WRLOCK(RETVAL, ...) \ + __attribute__((exclusive_trylock_function(RETVAL, __VA_ARGS__))) +#define OVS_TRY_RDLOCK(RETVAL, ...) \ + __attribute__((shared_trylock_function(RETVAL, __VA_ARGS__))) +#define OVS_TRY_LOCK(RETVAL, ...) \ + __attribute__((exclusive_trylock_function(RETVAL, __VA_ARGS__))) +#define OVS_GUARDED __attribute__((guarded_var)) +#define OVS_GUARDED_BY(...) __attribute__((guarded_by(__VA_ARGS__))) +#define OVS_RELEASES(...) __attribute__((unlock_function(__VA_ARGS__))) +#define OVS_EXCLUDED(...) __attribute__((locks_excluded(__VA_ARGS__))) +#define OVS_ACQ_BEFORE(...) __attribute__((acquired_before(__VA_ARGS__))) +#define OVS_ACQ_AFTER(...) __attribute__((acquired_after(__VA_ARGS__))) +#define OVS_NO_THREAD_SAFETY_ANALYSIS \ + __attribute__((no_thread_safety_analysis)) +#else /* not Clang */ +#define OVS_LOCKABLE +#define OVS_REQ_RDLOCK(...) +#define OVS_ACQ_RDLOCK(...) +#define OVS_REQ_WRLOCK(...) +#define OVS_ACQ_WRLOCK(...) +#define OVS_REQUIRES(...) +#define OVS_ACQUIRES(...) +#define OVS_TRY_WRLOCK(...) +#define OVS_TRY_RDLOCK(...) +#define OVS_TRY_LOCK(...) +#define OVS_GUARDED +#define OVS_GUARDED_BY(...) +#define OVS_EXCLUDED(...) +#define OVS_RELEASES(...) +#define OVS_ACQ_BEFORE(...) +#define OVS_ACQ_AFTER(...) +#define OVS_NO_THREAD_SAFETY_ANALYSIS +#endif + +/* ISO C says that a C implementation may choose any integer type for an enum + * that is sufficient to hold all of its values. Common ABIs (such as the + * System V ABI used on i386 GNU/Linux) always use a full-sized "int", even + * when a smaller type would suffice. + * + * In GNU C, "enum __attribute__((packed)) name { ... }" defines 'name' as an + * enum compatible with a type that is no bigger than necessary. This is the + * intended use of OVS_PACKED_ENUM. + * + * OVS_PACKED_ENUM is intended for use only as a space optimization, since it + * only works with GCC. That means that it must not be used in wire protocols + * or otherwise exposed outside of a single process. */ +#if __GNUC__ && !__CHECKER__ +#define OVS_PACKED_ENUM __attribute__((__packed__)) +#define HAVE_PACKED_ENUM +#else +#define OVS_PACKED_ENUM +#endif + +#ifndef _MSC_VER +#define OVS_PACKED(DECL) DECL __attribute__((__packed__)) +#else +#define OVS_PACKED(DECL) __pragma(pack(push, 1)) DECL __pragma(pack(pop)) +#endif + +/* OVS_ALIGNED_STRUCT may be used to define a structure whose instances should + * aligned on an N-byte boundary. This: + * OVS_ALIGNED_STRUCT(64, mystruct) { ... }; + * is equivalent to the following except that it specifies 64-byte alignment: + * struct mystruct { ... }; + * + * OVS_ALIGNED_VAR defines a variable aligned on an N-byte boundary. For + * example, + * OVS_ALIGNED_VAR(64) int x; + * defines a "int" variable that is aligned on a 64-byte boundary. + */ +#ifndef _MSC_VER +#define OVS_ALIGNED_STRUCT(N, TAG) struct __attribute__((aligned(N))) TAG +#define OVS_ALIGNED_VAR(N) __attribute__((aligned(N))) +#else +#define OVS_ALIGNED_STRUCT(N, TAG) __declspec(align(N)) struct TAG +#define OVS_ALIGNED_VAR(N) __declspec(align(N)) +#endif + +/* Supplies code to be run at startup time before invoking main(). + * Use as: + * + * OVS_CONSTRUCTOR(my_constructor) { + * ...some code... + * } + */ +#ifdef _MSC_VER +#define CCALL __cdecl +#pragma section(".CRT$XCU",read) +#define OVS_CONSTRUCTOR(f) \ + static void __cdecl f(void); \ + __declspec(allocate(".CRT$XCU")) static void (__cdecl*f##_)(void) = f; \ + static void __cdecl f(void) +#else +#define OVS_CONSTRUCTOR(f) \ + static void f(void) __attribute__((constructor)); \ + static void f(void) +#endif + +/* OVS_PREFETCH() can be used to instruct the CPU to fetch the cache + * line containing the given address to a CPU cache. + * OVS_PREFETCH_WRITE() should be used when the memory is going to be + * written to. Depending on the target CPU, this can generate the same + * instruction as OVS_PREFETCH(), or bring the data into the cache in an + * exclusive state. */ +#if __GNUC__ +#define OVS_PREFETCH(addr) __builtin_prefetch((addr)) +#define OVS_PREFETCH_WRITE(addr) __builtin_prefetch((addr), 1) +#else +#define OVS_PREFETCH(addr) +#define OVS_PREFETCH_WRITE(addr) +#endif + +/* Build assertions. */ +#ifdef __CHECKER__ +#define BUILD_ASSERT(EXPR) ((void) 0) +#define BUILD_ASSERT_DECL(EXPR) extern int (*build_assert(void))[1] +#elif !defined(__cplusplus) +/* Build-time assertion building block. */ +#define BUILD_ASSERT__(EXPR) \ + sizeof(struct { unsigned int build_assert_failed : (EXPR) ? 1 : -1; }) + +/* Build-time assertion for use in a statement context. */ +#define BUILD_ASSERT(EXPR) (void) BUILD_ASSERT__(EXPR) + +/* Build-time assertion for use in a declaration context. */ +#define BUILD_ASSERT_DECL(EXPR) \ + extern int (*build_assert(void))[BUILD_ASSERT__(EXPR)] +#else /* __cplusplus */ +#include +#define BUILD_ASSERT BOOST_STATIC_ASSERT +#define BUILD_ASSERT_DECL BOOST_STATIC_ASSERT +#endif /* __cplusplus */ + +#ifdef __GNUC__ +#define BUILD_ASSERT_GCCONLY(EXPR) BUILD_ASSERT(EXPR) +#define BUILD_ASSERT_DECL_GCCONLY(EXPR) BUILD_ASSERT_DECL(EXPR) +#else +#define BUILD_ASSERT_GCCONLY(EXPR) ((void) 0) +#define BUILD_ASSERT_DECL_GCCONLY(EXPR) ((void) 0) +#endif + + +#endif /* compiler.h */ diff --git a/openflow/include/openvswitch/dynamic-string.h b/openflow/include/openvswitch/dynamic-string.h new file mode 100644 index 0000000..bf1f64a --- /dev/null +++ b/openflow/include/openvswitch/dynamic-string.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2015, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_DYNAMIC_STRING_H +#define OPENVSWITCH_DYNAMIC_STRING_H 1 + +#include +#include +#include +#include +#include +#include "openvswitch/compiler.h" + +/* A "dynamic string", that is, a buffer that can be used to construct a + * string across a series of operations that extend or modify it. + * + * The 'string' member does not always point to a null-terminated string. + * Initially it is NULL, and even when it is nonnull, some operations do not + * ensure that it is null-terminated. Use ds_cstr() to ensure that memory is + * allocated for the string and that it is null-terminated. */ +struct ds { + char *string; /* Null-terminated string. */ + size_t length; /* Bytes used, not including null terminator. */ + size_t allocated; /* Bytes allocated, not including null terminator. */ +}; + +#define DS_EMPTY_INITIALIZER { NULL, 0, 0 } + +void ds_init(struct ds *); +void ds_clear(struct ds *); +void ds_truncate(struct ds *, size_t new_length); +void ds_reserve(struct ds *, size_t min_length); +char *ds_put_uninit(struct ds *, size_t n); +static inline void ds_put_char(struct ds *, char); +void ds_put_utf8(struct ds *, int uc); +void ds_put_char_multiple(struct ds *, char, size_t n); +void ds_put_buffer(struct ds *, const char *, size_t n); +void ds_put_cstr(struct ds *, const char *); +void ds_put_and_free_cstr(struct ds *, char *); +void ds_put_format(struct ds *, const char *, ...) OVS_PRINTF_FORMAT(2, 3); +void ds_put_format_valist(struct ds *, const char *, va_list) + OVS_PRINTF_FORMAT(2, 0); +void ds_put_printable(struct ds *, const char *, size_t); +void ds_put_hex(struct ds *ds, const void *buf, size_t size); +void ds_put_hex_dump(struct ds *ds, const void *buf_, size_t size, + uintptr_t ofs, bool ascii); +int ds_get_line(struct ds *, FILE *); +int ds_get_preprocessed_line(struct ds *, FILE *, int *line_number); +int ds_get_test_line(struct ds *, FILE *); + +void ds_put_strftime_msec(struct ds *, const char *format, long long int when, + bool utc); +char *xastrftime_msec(const char *format, long long int when, bool utc); + +char *ds_cstr(struct ds *); +const char *ds_cstr_ro(const struct ds *); +char *ds_steal_cstr(struct ds *); +void ds_destroy(struct ds *); +void ds_swap(struct ds *, struct ds *); + +int ds_last(const struct ds *); +bool ds_chomp(struct ds *, int c); +void ds_clone(struct ds *, struct ds *); + +/* Inline functions. */ + +void ds_put_char__(struct ds *, char); + +static inline void +ds_put_char(struct ds *ds, char c) +{ + if (ds->length < ds->allocated) { + ds->string[ds->length++] = c; + ds->string[ds->length] = '\0'; + } else { + ds_put_char__(ds, c); + } +} + +#endif /* dynamic-string.h */ diff --git a/openflow/include/openvswitch/flow.h b/openflow/include/openvswitch/flow.h new file mode 100644 index 0000000..df80dfe --- /dev/null +++ b/openflow/include/openvswitch/flow.h @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef OPENVSWITCH_FLOW_H +#define OPENVSWITCH_FLOW_H 1 + +#include "openflow/nicira-ext.h" +#include "openvswitch/packets.h" +#include "openvswitch/util.h" + +/* This sequence number should be incremented whenever anything involving flows + * or the wildcarding of flows changes. This will cause build assertion + * failures in places which likely need to be updated. */ +#define FLOW_WC_SEQ 36 + +/* Number of Open vSwitch extension 32-bit registers. */ +#define FLOW_N_REGS 16 +BUILD_ASSERT_DECL(FLOW_N_REGS <= NXM_NX_MAX_REGS); +BUILD_ASSERT_DECL(FLOW_N_REGS % 4 == 0); /* Handle xxregs. */ + +/* Number of OpenFlow 1.5+ 64-bit registers. + * + * Each of these overlays a pair of Open vSwitch 32-bit registers, so there + * are half as many of them.*/ +#define FLOW_N_XREGS (FLOW_N_REGS / 2) + +/* Number of 128-bit registers. + * + * Each of these overlays four Open vSwitch 32-bit registers, so there + * are a quarter as many of them.*/ +#define FLOW_N_XXREGS (FLOW_N_REGS / 4) + +/* Used for struct flow's dl_type member for frames that have no Ethernet + * type, that is, pure 802.2 frames. */ +#define FLOW_DL_TYPE_NONE 0x5ff + +/* Fragment bits, used for IPv4 and IPv6, always zero for non-IP flows. */ +#define FLOW_NW_FRAG_ANY (1 << 0) /* Set for any IP frag. */ +#define FLOW_NW_FRAG_LATER (1 << 1) /* Set for IP frag with nonzero offset. */ +#define FLOW_NW_FRAG_MASK (FLOW_NW_FRAG_ANY | FLOW_NW_FRAG_LATER) + +BUILD_ASSERT_DECL(FLOW_NW_FRAG_ANY == NX_IP_FRAG_ANY); +BUILD_ASSERT_DECL(FLOW_NW_FRAG_LATER == NX_IP_FRAG_LATER); + +BUILD_ASSERT_DECL(FLOW_TNL_F_OAM == NX_TUN_FLAG_OAM); + +const char *flow_tun_flag_to_string(uint32_t flags); + +/* Maximum number of supported MPLS labels. */ +#define FLOW_MAX_MPLS_LABELS 3 + +/* + * A flow in the network. + * + * Must be initialized to all zeros to make any compiler-induced padding + * zeroed. Helps also in keeping unused fields (such as mutually exclusive + * IPv4 and IPv6 addresses) zeroed out. + * + * The meaning of 'in_port' is context-dependent. In most cases, it is a + * 16-bit OpenFlow 1.0 port number. In the software datapath interface (dpif) + * layer and its implementations (e.g. dpif-netlink, dpif-netdev), it is + * instead a 32-bit datapath port number. + * + * The fields are organized in four segments to facilitate staged lookup, where + * lower layer fields are first used to determine if the later fields need to + * be looked at. This enables better wildcarding for datapath flows. + * + * NOTE: Order of the fields is significant, any change in the order must be + * reflected in miniflow_extract()! + */ +struct flow { + /* Metadata */ + struct flow_tnl tunnel; /* Encapsulating tunnel parameters. */ + ovs_be64 metadata; /* OpenFlow Metadata. */ + uint32_t regs[FLOW_N_REGS]; /* Registers. */ + uint32_t skb_priority; /* Packet priority for QoS. */ + uint32_t pkt_mark; /* Packet mark. */ + uint32_t dp_hash; /* Datapath computed hash value. The exact + * computation is opaque to the user space. */ + union flow_in_port in_port; /* Input port.*/ + uint32_t recirc_id; /* Must be exact match. */ + uint16_t ct_state; /* Connection tracking state. */ + uint16_t ct_zone; /* Connection tracking zone. */ + uint32_t ct_mark; /* Connection mark.*/ + uint8_t pad1[4]; /* Pad to 64 bits. */ + ovs_u128 ct_label; /* Connection label. */ + uint32_t conj_id; /* Conjunction ID. */ + ofp_port_t actset_output; /* Output port in action set. */ + + /* L2, Order the same as in the Ethernet header! (64-bit aligned) */ + struct eth_addr dl_dst; /* Ethernet destination address. */ + struct eth_addr dl_src; /* Ethernet source address. */ + ovs_be16 dl_type; /* Ethernet frame type. */ + ovs_be16 vlan_tci; /* If 802.1Q, TCI | VLAN_CFI; otherwise 0. */ + ovs_be32 mpls_lse[ROUND_UP(FLOW_MAX_MPLS_LABELS, 2)]; /* MPLS label stack + (with padding). */ + /* L3 (64-bit aligned) */ + ovs_be32 nw_src; /* IPv4 source address or ARP SPA. */ + ovs_be32 nw_dst; /* IPv4 destination address or ARP TPA. */ + struct in6_addr ipv6_src; /* IPv6 source address. */ + struct in6_addr ipv6_dst; /* IPv6 destination address. */ + ovs_be32 ipv6_label; /* IPv6 flow label. */ + uint8_t nw_frag; /* FLOW_FRAG_* flags. */ + uint8_t nw_tos; /* IP ToS (including DSCP and ECN). */ + uint8_t nw_ttl; /* IP TTL/Hop Limit. */ + uint8_t nw_proto; /* IP protocol or low 8 bits of ARP opcode. */ + struct in6_addr nd_target; /* IPv6 neighbor discovery (ND) target. */ + struct eth_addr arp_sha; /* ARP/ND source hardware address. */ + struct eth_addr arp_tha; /* ARP/ND target hardware address. */ + ovs_be16 tcp_flags; /* TCP flags. With L3 to avoid matching L4. */ + ovs_be16 pad3; /* Pad to 64 bits. */ + + /* L4 (64-bit aligned) */ + ovs_be16 tp_src; /* TCP/UDP/SCTP source port/ICMP type. */ + ovs_be16 tp_dst; /* TCP/UDP/SCTP destination port/ICMP code. */ + ovs_be32 igmp_group_ip4; /* IGMP group IPv4 address. + * Keep last for BUILD_ASSERT_DECL below. */ +}; +BUILD_ASSERT_DECL(sizeof(struct flow) % sizeof(uint64_t) == 0); +BUILD_ASSERT_DECL(sizeof(struct flow_tnl) % sizeof(uint64_t) == 0); + +#define FLOW_U64S (sizeof(struct flow) / sizeof(uint64_t)) + +/* Remember to update FLOW_WC_SEQ when changing 'struct flow'. */ +BUILD_ASSERT_DECL(offsetof(struct flow, igmp_group_ip4) + sizeof(uint32_t) + == sizeof(struct flow_tnl) + 248 + && FLOW_WC_SEQ == 36); + +/* Incremental points at which flow classification may be performed in + * segments. + * This is located here since this is dependent on the structure of the + * struct flow defined above: + * Each offset must be on a distinct, successive U64 boundary strictly + * within the struct flow. */ +enum { + FLOW_SEGMENT_1_ENDS_AT = offsetof(struct flow, dl_dst), + FLOW_SEGMENT_2_ENDS_AT = offsetof(struct flow, nw_src), + FLOW_SEGMENT_3_ENDS_AT = offsetof(struct flow, tp_src), +}; +BUILD_ASSERT_DECL(FLOW_SEGMENT_1_ENDS_AT % sizeof(uint64_t) == 0); +BUILD_ASSERT_DECL(FLOW_SEGMENT_2_ENDS_AT % sizeof(uint64_t) == 0); +BUILD_ASSERT_DECL(FLOW_SEGMENT_3_ENDS_AT % sizeof(uint64_t) == 0); +BUILD_ASSERT_DECL( 0 < FLOW_SEGMENT_1_ENDS_AT); +BUILD_ASSERT_DECL(FLOW_SEGMENT_1_ENDS_AT < FLOW_SEGMENT_2_ENDS_AT); +BUILD_ASSERT_DECL(FLOW_SEGMENT_2_ENDS_AT < FLOW_SEGMENT_3_ENDS_AT); +BUILD_ASSERT_DECL(FLOW_SEGMENT_3_ENDS_AT < sizeof(struct flow)); + +/* Wildcards for a flow. + * + * A 1-bit in each bit in 'masks' indicates that the corresponding bit of + * the flow is significant (must match). A 0-bit indicates that the + * corresponding bit of the flow is wildcarded (need not match). */ +struct flow_wildcards { + struct flow masks; +}; + +#define WC_MASK_FIELD(WC, FIELD) \ + memset(&(WC)->masks.FIELD, 0xff, sizeof (WC)->masks.FIELD) +#define WC_MASK_FIELD_MASK(WC, FIELD, MASK) \ + ((WC)->masks.FIELD |= (MASK)) +#define WC_UNMASK_FIELD(WC, FIELD) \ + memset(&(WC)->masks.FIELD, 0, sizeof (WC)->masks.FIELD) + +void flow_wildcards_init_catchall(struct flow_wildcards *); + +void flow_wildcards_init_for_packet(struct flow_wildcards *, + const struct flow *); + +void flow_wildcards_clear_non_packet_fields(struct flow_wildcards *); + +bool flow_wildcards_is_catchall(const struct flow_wildcards *); + +void flow_wildcards_set_reg_mask(struct flow_wildcards *, + int idx, uint32_t mask); +void flow_wildcards_set_xreg_mask(struct flow_wildcards *, + int idx, uint64_t mask); +void flow_wildcards_set_xxreg_mask(struct flow_wildcards *, + int idx, ovs_u128 mask); + +void flow_wildcards_and(struct flow_wildcards *dst, + const struct flow_wildcards *src1, + const struct flow_wildcards *src2); +void flow_wildcards_or(struct flow_wildcards *dst, + const struct flow_wildcards *src1, + const struct flow_wildcards *src2); +bool flow_wildcards_has_extra(const struct flow_wildcards *, + const struct flow_wildcards *); +uint32_t flow_wildcards_hash(const struct flow_wildcards *, uint32_t basis); +bool flow_wildcards_equal(const struct flow_wildcards *, + const struct flow_wildcards *); + +#endif /* flow.h */ diff --git a/openflow/include/openvswitch/geneve.h b/openflow/include/openvswitch/geneve.h new file mode 100644 index 0000000..7311985 --- /dev/null +++ b/openflow/include/openvswitch/geneve.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2015 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_GENEVE_H +#define OPENVSWITCH_GENEVE_H 1 + +#include "openvswitch/types.h" + +#define TLV_MAX_OPT_SIZE 124 +#define TLV_TOT_OPT_SIZE 252 + +#define GENEVE_CRIT_OPT_TYPE (1 << 7) + +struct geneve_opt { + ovs_be16 opt_class; + uint8_t type; +#ifdef WORDS_BIGENDIAN + uint8_t r1:1; + uint8_t r2:1; + uint8_t r3:1; + uint8_t length:5; +#else + uint8_t length:5; + uint8_t r3:1; + uint8_t r2:1; + uint8_t r1:1; +#endif + /* Option data */ +}; + +struct genevehdr { +#ifdef WORDS_BIGENDIAN + uint8_t ver:2; + uint8_t opt_len:6; + uint8_t oam:1; + uint8_t critical:1; + uint8_t rsvd1:6; +#else + uint8_t opt_len:6; + uint8_t ver:2; + uint8_t rsvd1:6; + uint8_t critical:1; + uint8_t oam:1; +#endif + ovs_be16 proto_type; + ovs_16aligned_be32 vni; + struct geneve_opt options[]; +}; + +#endif /* geneve.h */ diff --git a/openflow/include/openvswitch/hmap.h b/openflow/include/openvswitch/hmap.h new file mode 100644 index 0000000..8aea9c2 --- /dev/null +++ b/openflow/include/openvswitch/hmap.h @@ -0,0 +1,407 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HMAP_H +#define HMAP_H 1 + +#include +#include +#include "openvswitch/util.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* A hash map node, to be embedded inside the data structure being mapped. */ +struct hmap_node { + size_t hash; /* Hash value. */ + struct hmap_node *next; /* Next in linked list. */ +}; + +/* Returns the hash value embedded in 'node'. */ +static inline size_t hmap_node_hash(const struct hmap_node *node) +{ + return node->hash; +} + +#define HMAP_NODE_NULL ((struct hmap_node *) 1) +#define HMAP_NODE_NULL_INITIALIZER { 0, HMAP_NODE_NULL } + +/* Returns true if 'node' has been set to null by hmap_node_nullify() and has + * not been un-nullified by being inserted into an hmap. */ +static inline bool +hmap_node_is_null(const struct hmap_node *node) +{ + return node->next == HMAP_NODE_NULL; +} + +/* Marks 'node' with a distinctive value that can be tested with + * hmap_node_is_null(). */ +static inline void +hmap_node_nullify(struct hmap_node *node) +{ + node->next = HMAP_NODE_NULL; +} + +/* A hash map. */ +struct hmap { + struct hmap_node **buckets; /* Must point to 'one' iff 'mask' == 0. */ + struct hmap_node *one; + size_t mask; + size_t n; +}; + +/* Initializer for an empty hash map. */ +#define HMAP_INITIALIZER(HMAP) \ + { (struct hmap_node **const) &(HMAP)->one, NULL, 0, 0 } + +/* Initializer for an immutable struct hmap 'HMAP' that contains 'N' nodes + * linked together starting at 'NODE'. The hmap only has a single chain of + * hmap_nodes, so 'N' should be small. */ +#define HMAP_CONST(HMAP, N, NODE) { \ + CONST_CAST(struct hmap_node **, &(HMAP)->one), NODE, 0, N } + +/* Initialization. */ +void hmap_init(struct hmap *); +void hmap_destroy(struct hmap *); +void hmap_clear(struct hmap *); +void hmap_swap(struct hmap *a, struct hmap *b); +void hmap_moved(struct hmap *hmap); +static inline size_t hmap_count(const struct hmap *); +static inline bool hmap_is_empty(const struct hmap *); + +/* Adjusting capacity. */ +void hmap_expand_at(struct hmap *, const char *where); +#define hmap_expand(HMAP) hmap_expand_at(HMAP, OVS_SOURCE_LOCATOR) + +void hmap_shrink_at(struct hmap *, const char *where); +#define hmap_shrink(HMAP) hmap_shrink_at(HMAP, OVS_SOURCE_LOCATOR) + +void hmap_reserve_at(struct hmap *, size_t capacity, const char *where); +#define hmap_reserve(HMAP, CAPACITY) \ + hmap_reserve_at(HMAP, CAPACITY, OVS_SOURCE_LOCATOR) + +/* Insertion and deletion. */ +static inline void hmap_insert_at(struct hmap *, struct hmap_node *, + size_t hash, const char *where); +#define hmap_insert(HMAP, NODE, HASH) \ + hmap_insert_at(HMAP, NODE, HASH, OVS_SOURCE_LOCATOR) + +static inline void hmap_insert_fast(struct hmap *, + struct hmap_node *, size_t hash); +static inline void hmap_remove(struct hmap *, struct hmap_node *); + +void hmap_node_moved(struct hmap *, struct hmap_node *, struct hmap_node *); +static inline void hmap_replace(struct hmap *, const struct hmap_node *old, + struct hmap_node *new_node); + +struct hmap_node *hmap_random_node(const struct hmap *); + +/* Search. + * + * HMAP_FOR_EACH_WITH_HASH iterates NODE over all of the nodes in HMAP that + * have hash value equal to HASH. HMAP_FOR_EACH_IN_BUCKET iterates NODE over + * all of the nodes in HMAP that would fall in the same bucket as HASH. MEMBER + * must be the name of the 'struct hmap_node' member within NODE. + * + * These macros may be used interchangeably to search for a particular value in + * an hmap, see, e.g. shash_find() for an example. Usually, using + * HMAP_FOR_EACH_WITH_HASH provides an optimization, because comparing a hash + * value is usually cheaper than comparing an entire hash map key. But for + * simple hash map keys, it makes sense to use HMAP_FOR_EACH_IN_BUCKET because + * it avoids doing two comparisons when a single simple comparison suffices. + * + * The loop should not change NODE to point to a different node or insert or + * delete nodes in HMAP (unless it "break"s out of the loop to terminate + * iteration). + * + * HASH is only evaluated once. + * + * When the loop terminates normally, meaning the iteration has completed + * without using 'break', NODE will be NULL. This is true for all of the + * HMAP_FOR_EACH_*() macros. + */ +#define HMAP_FOR_EACH_WITH_HASH(NODE, MEMBER, HASH, HMAP) \ + for (INIT_CONTAINER(NODE, hmap_first_with_hash(HMAP, HASH), MEMBER); \ + (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL); \ + ASSIGN_CONTAINER(NODE, hmap_next_with_hash(&(NODE)->MEMBER), \ + MEMBER)) +#define HMAP_FOR_EACH_IN_BUCKET(NODE, MEMBER, HASH, HMAP) \ + for (INIT_CONTAINER(NODE, hmap_first_in_bucket(HMAP, HASH), MEMBER); \ + (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL); \ + ASSIGN_CONTAINER(NODE, hmap_next_in_bucket(&(NODE)->MEMBER), MEMBER)) + +static inline struct hmap_node *hmap_first_with_hash(const struct hmap *, + size_t hash); +static inline struct hmap_node *hmap_next_with_hash(const struct hmap_node *); +static inline struct hmap_node *hmap_first_in_bucket(const struct hmap *, + size_t hash); +static inline struct hmap_node *hmap_next_in_bucket(const struct hmap_node *); + +bool hmap_contains(const struct hmap *, const struct hmap_node *); + +/* Iteration. + * + * The *_INIT variants of these macros additionally evaluate the expressions + * supplied following the HMAP argument once during the loop initialization. + * This makes it possible for data structures that wrap around hmaps to insert + * additional initialization into their iteration macros without having to + * completely rewrite them. In particular, it can be a good idea to insert + * BUILD_ASSERT_TYPE checks for map and node types that wrap hmap, since + * otherwise it is possible for clients to accidentally confuse two derived + * data structures that happen to use the same member names for struct hmap and + * struct hmap_node. */ + +/* Iterates through every node in HMAP. */ +#define HMAP_FOR_EACH(NODE, MEMBER, HMAP) \ + HMAP_FOR_EACH_INIT(NODE, MEMBER, HMAP, (void) 0) +#define HMAP_FOR_EACH_INIT(NODE, MEMBER, HMAP, ...) \ + for (INIT_CONTAINER(NODE, hmap_first(HMAP), MEMBER), __VA_ARGS__; \ + (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL); \ + ASSIGN_CONTAINER(NODE, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER)) + +/* Safe when NODE may be freed (not needed when NODE may be removed from the + * hash map but its members remain accessible and intact). */ +#define HMAP_FOR_EACH_SAFE(NODE, NEXT, MEMBER, HMAP) \ + HMAP_FOR_EACH_SAFE_INIT(NODE, NEXT, MEMBER, HMAP, (void) 0) +#define HMAP_FOR_EACH_SAFE_INIT(NODE, NEXT, MEMBER, HMAP, ...) \ + for (INIT_CONTAINER(NODE, hmap_first(HMAP), MEMBER), __VA_ARGS__; \ + ((NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL) \ + ? INIT_CONTAINER(NEXT, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER), 1 \ + : 0); \ + (NODE) = (NEXT)) + +/* Continues an iteration from just after NODE. */ +#define HMAP_FOR_EACH_CONTINUE(NODE, MEMBER, HMAP) \ + HMAP_FOR_EACH_CONTINUE_INIT(NODE, MEMBER, HMAP, (void) 0) +#define HMAP_FOR_EACH_CONTINUE_INIT(NODE, MEMBER, HMAP, ...) \ + for (ASSIGN_CONTAINER(NODE, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER), \ + __VA_ARGS__; \ + (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL); \ + ASSIGN_CONTAINER(NODE, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER)) + +static inline struct hmap_node * +hmap_pop_helper__(struct hmap *hmap, size_t *bucket) { + + for (; *bucket <= hmap->mask; (*bucket)++) { + struct hmap_node *node = hmap->buckets[*bucket]; + + if (node) { + hmap_remove(hmap, node); + return node; + } + } + + return NULL; +} + +#define HMAP_FOR_EACH_POP(NODE, MEMBER, HMAP) \ + for (size_t bucket__ = 0; \ + INIT_CONTAINER(NODE, hmap_pop_helper__(HMAP, &bucket__), MEMBER), \ + (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL);) + +static inline struct hmap_node *hmap_first(const struct hmap *); +static inline struct hmap_node *hmap_next(const struct hmap *, + const struct hmap_node *); + +struct hmap_position { + unsigned int bucket; + unsigned int offset; +}; + +struct hmap_node *hmap_at_position(const struct hmap *, + struct hmap_position *); + +/* Returns the number of nodes currently in 'hmap'. */ +static inline size_t +hmap_count(const struct hmap *hmap) +{ + return hmap->n; +} + +/* Returns the maximum number of nodes that 'hmap' may hold before it should be + * rehashed. */ +static inline size_t +hmap_capacity(const struct hmap *hmap) +{ + return hmap->mask * 2 + 1; +} + +/* Returns true if 'hmap' currently contains no nodes, + * false otherwise. + * Note: While hmap in general is not thread-safe without additional locking, + * hmap_is_empty() is. */ +static inline bool +hmap_is_empty(const struct hmap *hmap) +{ + return hmap->n == 0; +} + +/* Inserts 'node', with the given 'hash', into 'hmap'. 'hmap' is never + * expanded automatically. */ +static inline void +hmap_insert_fast(struct hmap *hmap, struct hmap_node *node, size_t hash) +{ + struct hmap_node **bucket = &hmap->buckets[hash & hmap->mask]; + node->hash = hash; + node->next = *bucket; + *bucket = node; + hmap->n++; +} + +/* Inserts 'node', with the given 'hash', into 'hmap', and expands 'hmap' if + * necessary to optimize search performance. + * + * ('where' is used in debug logging. Commonly one would use hmap_insert() to + * automatically provide the caller's source file and line number for + * 'where'.) */ +static inline void +hmap_insert_at(struct hmap *hmap, struct hmap_node *node, size_t hash, + const char *where) +{ + hmap_insert_fast(hmap, node, hash); + if (hmap->n / 2 > hmap->mask) { + hmap_expand_at(hmap, where); + } +} + +/* Removes 'node' from 'hmap'. Does not shrink the hash table; call + * hmap_shrink() directly if desired. */ +static inline void +hmap_remove(struct hmap *hmap, struct hmap_node *node) +{ + struct hmap_node **bucket = &hmap->buckets[node->hash & hmap->mask]; + while (*bucket != node) { + bucket = &(*bucket)->next; + } + *bucket = node->next; + hmap->n--; +} + +/* Puts 'new_node' in the position in 'hmap' currently occupied by 'old_node'. + * The 'new_node' must hash to the same value as 'old_node'. The client is + * responsible for ensuring that the replacement does not violate any + * client-imposed invariants (e.g. uniqueness of keys within a map). + * + * Afterward, 'old_node' is not part of 'hmap', and the client is responsible + * for freeing it (if this is desirable). */ +static inline void +hmap_replace(struct hmap *hmap, + const struct hmap_node *old_node, struct hmap_node *new_node) +{ + struct hmap_node **bucket = &hmap->buckets[old_node->hash & hmap->mask]; + while (*bucket != old_node) { + bucket = &(*bucket)->next; + } + *bucket = new_node; + new_node->hash = old_node->hash; + new_node->next = old_node->next; +} + +static inline struct hmap_node * +hmap_next_with_hash__(const struct hmap_node *node, size_t hash) +{ + while (node != NULL && node->hash != hash) { + node = node->next; + } + return CONST_CAST(struct hmap_node *, node); +} + +/* Returns the first node in 'hmap' with the given 'hash', or a null pointer if + * no nodes have that hash value. */ +static inline struct hmap_node * +hmap_first_with_hash(const struct hmap *hmap, size_t hash) +{ + return hmap_next_with_hash__(hmap->buckets[hash & hmap->mask], hash); +} + +/* Returns the first node in 'hmap' in the bucket in which the given 'hash' + * would land, or a null pointer if that bucket is empty. */ +static inline struct hmap_node * +hmap_first_in_bucket(const struct hmap *hmap, size_t hash) +{ + return hmap->buckets[hash & hmap->mask]; +} + +/* Returns the next node in the same bucket as 'node', or a null pointer if + * there are no more nodes in that bucket. + * + * If the hash map has been reallocated since 'node' was visited, some nodes + * may be skipped; if new nodes with the same hash value have been added, they + * will be skipped. (Removing 'node' from the hash map does not prevent + * calling this function, since node->next is preserved, although freeing + * 'node' of course does.) */ +static inline struct hmap_node * +hmap_next_in_bucket(const struct hmap_node *node) +{ + return node->next; +} + +/* Returns the next node in the same hash map as 'node' with the same hash + * value, or a null pointer if no more nodes have that hash value. + * + * If the hash map has been reallocated since 'node' was visited, some nodes + * may be skipped; if new nodes with the same hash value have been added, they + * will be skipped. (Removing 'node' from the hash map does not prevent + * calling this function, since node->next is preserved, although freeing + * 'node' of course does.) */ +static inline struct hmap_node * +hmap_next_with_hash(const struct hmap_node *node) +{ + return hmap_next_with_hash__(node->next, node->hash); +} + +static inline struct hmap_node * +hmap_next__(const struct hmap *hmap, size_t start) +{ + size_t i; + for (i = start; i <= hmap->mask; i++) { + struct hmap_node *node = hmap->buckets[i]; + if (node) { + return node; + } + } + return NULL; +} + +/* Returns the first node in 'hmap', in arbitrary order, or a null pointer if + * 'hmap' is empty. */ +static inline struct hmap_node * +hmap_first(const struct hmap *hmap) +{ + return hmap_next__(hmap, 0); +} + +/* Returns the next node in 'hmap' following 'node', in arbitrary order, or a + * null pointer if 'node' is the last node in 'hmap'. + * + * If the hash map has been reallocated since 'node' was visited, some nodes + * may be skipped or visited twice. (Removing 'node' from the hash map does + * not prevent calling this function, since node->next is preserved, although + * freeing 'node' of course does.) */ +static inline struct hmap_node * +hmap_next(const struct hmap *hmap, const struct hmap_node *node) +{ + return (node->next + ? node->next + : hmap_next__(hmap, (node->hash & hmap->mask) + 1)); +} + +#ifdef __cplusplus +} +#endif + +#endif /* hmap.h */ diff --git a/openflow/include/openvswitch/json.h b/openflow/include/openvswitch/json.h new file mode 100644 index 0000000..83775ed --- /dev/null +++ b/openflow/include/openvswitch/json.h @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2009, 2010, 2015 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef JSON_H +#define JSON_H 1 + +/* This is an implementation of JavaScript Object Notation (JSON) as specified + * by RFC 4627. It is intended to fully comply with RFC 4627, with the + * following known exceptions and clarifications: + * + * - Null bytes (\u0000) are not allowed in strings. + * + * - Only UTF-8 encoding is supported (RFC 4627 allows for other Unicode + * encodings). + * + * - Names within an object must be unique (RFC 4627 says that they + * "should" be unique). + */ + +#include +#include "openvswitch/shash.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct ds; + +/* Type of a JSON value. */ +enum json_type { + JSON_NULL, /* null */ + JSON_FALSE, /* false */ + JSON_TRUE, /* true */ + JSON_OBJECT, /* {"a": b, "c": d, ...} */ + JSON_ARRAY, /* [1, 2, 3, ...] */ + JSON_INTEGER, /* 123. */ + JSON_REAL, /* 123.456. */ + JSON_STRING, /* "..." */ + JSON_N_TYPES +}; + +const char *json_type_to_string(enum json_type); + +/* A JSON array. */ +struct json_array { + size_t n, n_allocated; + struct json **elems; +}; + +/* A JSON value. */ +struct json { + enum json_type type; + size_t count; + union { + struct shash *object; /* Contains "struct json *"s. */ + struct json_array array; + long long int integer; + double real; + char *string; + } u; +}; + +struct json *json_null_create(void); +struct json *json_boolean_create(bool); +struct json *json_string_create(const char *); +struct json *json_string_create_nocopy(char *); +struct json *json_integer_create(long long int); +struct json *json_real_create(double); + +struct json *json_array_create_empty(void); +void json_array_add(struct json *, struct json *element); +void json_array_trim(struct json *); +struct json *json_array_create(struct json **, size_t n); +struct json *json_array_create_1(struct json *); +struct json *json_array_create_2(struct json *, struct json *); +struct json *json_array_create_3(struct json *, struct json *, struct json *); + +struct json *json_object_create(void); +void json_object_put(struct json *, const char *name, struct json *value); +void json_object_put_string(struct json *, + const char *name, const char *value); + +const char *json_string(const struct json *); +struct json_array *json_array(const struct json *); +struct shash *json_object(const struct json *); +bool json_boolean(const struct json *); +double json_real(const struct json *); +int64_t json_integer(const struct json *); + +struct json *json_deep_clone(const struct json *); +struct json *json_clone(const struct json *); +void json_destroy(struct json *); + +size_t json_hash(const struct json *, size_t basis); +bool json_equal(const struct json *, const struct json *); + +/* Parsing JSON. */ +enum { + JSPF_TRAILER = 1 << 0 /* Check for garbage following input. */ +}; + +struct json_parser *json_parser_create(int flags); +size_t json_parser_feed(struct json_parser *, const char *, size_t); +bool json_parser_is_done(const struct json_parser *); +struct json *json_parser_finish(struct json_parser *); +void json_parser_abort(struct json_parser *); + +struct json *json_from_string(const char *string); +struct json *json_from_file(const char *file_name); +struct json *json_from_stream(FILE *stream); + +/* Serializing JSON. */ + +enum { + JSSF_PRETTY = 1 << 0, /* Multiple lines with indentation, if true. */ + JSSF_SORT = 1 << 1 /* Object members in sorted order, if true. */ +}; +char *json_to_string(const struct json *, int flags); +void json_to_ds(const struct json *, int flags, struct ds *); + +/* JSON string formatting operations. */ + +bool json_string_unescape(const char *in, size_t in_len, char **outp); +void json_string_escape(const char *in, struct ds *out); + +#ifdef __cplusplus +} +#endif + +#endif /* json.h */ diff --git a/openflow/include/openvswitch/list.h b/openflow/include/openvswitch/list.h new file mode 100644 index 0000000..2bc294c --- /dev/null +++ b/openflow/include/openvswitch/list.h @@ -0,0 +1,304 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2013, 2015, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef OPENVSWITCH_LIST_H +#define OPENVSWITCH_LIST_H 1 + +#include +#include +#include +#include +#include + +/* Doubly linked list head or element. */ +struct ovs_list { + struct ovs_list *prev; /* Previous list element. */ + struct ovs_list *next; /* Next list element. */ +}; + +#define OVS_LIST_INITIALIZER(LIST) { LIST, LIST } + +/* "struct ovs_list" with pointers that will (probably) cause segfaults if + * dereferenced and, better yet, show up clearly in a debugger. + + * MSVC2015 doesn't support designated initializers when compiling C++, + * and doesn't support ternary operators with non-designated initializers. + * So we use these static definitions rather than using initializer macros. */ +static const struct ovs_list OVS_LIST_POISON = + { (struct ovs_list *) (UINTPTR_MAX / 0xf * 0xc), + (struct ovs_list *) (UINTPTR_MAX / 0xf * 0xc) }; + +static inline void ovs_list_init(struct ovs_list *); +static inline void ovs_list_poison(struct ovs_list *); + +/* List insertion. */ +static inline void ovs_list_insert(struct ovs_list *, struct ovs_list *); +static inline void ovs_list_splice(struct ovs_list *before, struct ovs_list *first, + struct ovs_list *last); +static inline void ovs_list_push_front(struct ovs_list *, struct ovs_list *); +static inline void ovs_list_push_back(struct ovs_list *, struct ovs_list *); +static inline void ovs_list_replace(struct ovs_list *, const struct ovs_list *); +static inline void ovs_list_moved(struct ovs_list *, const struct ovs_list *orig); +static inline void ovs_list_move(struct ovs_list *dst, struct ovs_list *src); + +/* List removal. */ +static inline struct ovs_list *ovs_list_remove(struct ovs_list *); +static inline struct ovs_list *ovs_list_pop_front(struct ovs_list *); +static inline struct ovs_list *ovs_list_pop_back(struct ovs_list *); + +/* List elements. */ +static inline struct ovs_list *ovs_list_front(const struct ovs_list *); +static inline struct ovs_list *ovs_list_back(const struct ovs_list *); + +/* List properties. */ +static inline size_t ovs_list_size(const struct ovs_list *); +static inline bool ovs_list_is_empty(const struct ovs_list *); +static inline bool ovs_list_is_singleton(const struct ovs_list *); +static inline bool ovs_list_is_short(const struct ovs_list *); + +#define LIST_FOR_EACH(ITER, MEMBER, LIST) \ + for (INIT_CONTAINER(ITER, (LIST)->next, MEMBER); \ + &(ITER)->MEMBER != (LIST); \ + ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER)) +#define LIST_FOR_EACH_CONTINUE(ITER, MEMBER, LIST) \ + for (ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER); \ + &(ITER)->MEMBER != (LIST); \ + ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER)) +#define LIST_FOR_EACH_REVERSE(ITER, MEMBER, LIST) \ + for (INIT_CONTAINER(ITER, (LIST)->prev, MEMBER); \ + &(ITER)->MEMBER != (LIST); \ + ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.prev, MEMBER)) +#define LIST_FOR_EACH_REVERSE_SAFE(ITER, PREV, MEMBER, LIST) \ + for (INIT_CONTAINER(ITER, (LIST)->prev, MEMBER); \ + (&(ITER)->MEMBER != (LIST) \ + ? INIT_CONTAINER(PREV, (ITER)->MEMBER.prev, MEMBER), 1 \ + : 0); \ + (ITER) = (PREV)) +#define LIST_FOR_EACH_REVERSE_CONTINUE(ITER, MEMBER, LIST) \ + for (ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.prev, MEMBER); \ + &(ITER)->MEMBER != (LIST); \ + ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.prev, MEMBER)) +#define LIST_FOR_EACH_SAFE(ITER, NEXT, MEMBER, LIST) \ + for (INIT_CONTAINER(ITER, (LIST)->next, MEMBER); \ + (&(ITER)->MEMBER != (LIST) \ + ? INIT_CONTAINER(NEXT, (ITER)->MEMBER.next, MEMBER), 1 \ + : 0); \ + (ITER) = (NEXT)) +#define LIST_FOR_EACH_POP(ITER, MEMBER, LIST) \ + while (!ovs_list_is_empty(LIST) \ + && (INIT_CONTAINER(ITER, ovs_list_pop_front(LIST), MEMBER), 1)) + +/* Inline implementations. */ + +/* Initializes 'list' as an empty list. */ +static inline void +ovs_list_init(struct ovs_list *list) +{ + list->next = list->prev = list; +} + +/* Initializes 'list' with pointers that will (probably) cause segfaults if + * dereferenced and, better yet, show up clearly in a debugger. */ +static inline void +ovs_list_poison(struct ovs_list *list) +{ + *list = OVS_LIST_POISON; +} + +/* Inserts 'elem' just before 'before'. */ +static inline void +ovs_list_insert(struct ovs_list *before, struct ovs_list *elem) +{ + elem->prev = before->prev; + elem->next = before; + before->prev->next = elem; + before->prev = elem; +} + +/* Removes elements 'first' though 'last' (exclusive) from their current list, + then inserts them just before 'before'. */ +static inline void +ovs_list_splice(struct ovs_list *before, struct ovs_list *first, struct ovs_list *last) +{ + if (first == last) { + return; + } + last = last->prev; + + /* Cleanly remove 'first'...'last' from its current list. */ + first->prev->next = last->next; + last->next->prev = first->prev; + + /* Splice 'first'...'last' into new list. */ + first->prev = before->prev; + last->next = before; + before->prev->next = first; + before->prev = last; +} + +/* Inserts 'elem' at the beginning of 'list', so that it becomes the front in + 'list'. */ +static inline void +ovs_list_push_front(struct ovs_list *list, struct ovs_list *elem) +{ + ovs_list_insert(list->next, elem); +} + +/* Inserts 'elem' at the end of 'list', so that it becomes the back in + * 'list'. */ +static inline void +ovs_list_push_back(struct ovs_list *list, struct ovs_list *elem) +{ + ovs_list_insert(list, elem); +} + +/* Puts 'elem' in the position currently occupied by 'position'. + * Afterward, 'position' is not part of a list. */ +static inline void +ovs_list_replace(struct ovs_list *element, const struct ovs_list *position) +{ + element->next = position->next; + element->next->prev = element; + element->prev = position->prev; + element->prev->next = element; +} + +/* Adjusts pointers around 'list' to compensate for 'list' having been moved + * around in memory (e.g. as a consequence of realloc()), with original + * location 'orig'. + * + * ('orig' likely points to freed memory, but this function does not + * dereference 'orig', it only compares it to 'list'. In a very pedantic + * language lawyer sense, this still yields undefined behavior, but it works + * with actual compilers.) */ +static inline void +ovs_list_moved(struct ovs_list *list, const struct ovs_list *orig) +{ + if (list->next == orig) { + ovs_list_init(list); + } else { + list->prev->next = list->next->prev = list; + } +} + +/* Initializes 'dst' with the contents of 'src', compensating for moving it + * around in memory. The effect is that, if 'src' was the head of a list, now + * 'dst' is the head of a list containing the same elements. */ +static inline void +ovs_list_move(struct ovs_list *dst, struct ovs_list *src) +{ + *dst = *src; + ovs_list_moved(dst, src); +} + +/* Removes 'elem' from its list and returns the element that followed it. + Undefined behavior if 'elem' is not in a list. */ +static inline struct ovs_list * +ovs_list_remove(struct ovs_list *elem) +{ + elem->prev->next = elem->next; + elem->next->prev = elem->prev; + return elem->next; +} + +/* Removes the front element from 'list' and returns it. Undefined behavior if + 'list' is empty before removal. */ +static inline struct ovs_list * +ovs_list_pop_front(struct ovs_list *list) +{ + struct ovs_list *front = list->next; + + ovs_list_remove(front); + return front; +} + +/* Removes the back element from 'list' and returns it. + Undefined behavior if 'list' is empty before removal. */ +static inline struct ovs_list * +ovs_list_pop_back(struct ovs_list *list) +{ + struct ovs_list *back = list->prev; + + ovs_list_remove(back); + return back; +} + +/* Returns the front element in 'list_'. + Undefined behavior if 'list_' is empty. */ +static inline struct ovs_list * +ovs_list_front(const struct ovs_list *list_) +{ + struct ovs_list *list = CONST_CAST(struct ovs_list *, list_); + + ovs_assert(!ovs_list_is_empty(list)); + + return list->next; +} + +/* Returns the back element in 'list_'. + Undefined behavior if 'list_' is empty. */ +static inline struct ovs_list * +ovs_list_back(const struct ovs_list *list_) +{ + struct ovs_list *list = CONST_CAST(struct ovs_list *, list_); + + ovs_assert(!ovs_list_is_empty(list)); + + return list->prev; +} + +/* Returns the number of elements in 'list'. + Runs in O(n) in the number of elements. */ +static inline size_t +ovs_list_size(const struct ovs_list *list) +{ + const struct ovs_list *e; + size_t cnt = 0; + + for (e = list->next; e != list; e = e->next) { + cnt++; + } + return cnt; +} + +/* Returns true if 'list' is empty, false otherwise. */ +static inline bool +ovs_list_is_empty(const struct ovs_list *list) +{ + return list->next == list; +} + +/* Returns true if 'list' has exactly 1 element, false otherwise. */ +static inline bool +ovs_list_is_singleton(const struct ovs_list *list) +{ + return ovs_list_is_short(list) && !ovs_list_is_empty(list); +} + +/* Returns true if 'list' has 0 or 1 elements, false otherwise. */ +static inline bool +ovs_list_is_short(const struct ovs_list *list) +{ + return list->next == list->prev; +} + +/* Transplant a list into another, and resets the origin list */ +static inline void +ovs_list_push_back_all(struct ovs_list *dst, struct ovs_list *src) +{ + ovs_list_splice(dst, src->next, src); +} + +#endif /* list.h */ diff --git a/openflow/include/openvswitch/match.h b/openflow/include/openvswitch/match.h new file mode 100644 index 0000000..0b5f050 --- /dev/null +++ b/openflow/include/openvswitch/match.h @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_MATCH_H +#define OPENVSWITCH_MATCH_H 1 + +#include "openvswitch/flow.h" +#include "openvswitch/packets.h" +#include "openvswitch/tun-metadata.h" + +struct ds; + +/* A flow classification match. + * + * Use one of the match_*() functions to initialize a "struct match". + * + * The match_*() functions below maintain the following important invariant. + * If a bit or a field is wildcarded in 'wc', then the corresponding bit or + * field in 'flow' is set to all-0-bits. (The match_zero_wildcarded_fields() + * function can be used to restore this invariant after adding wildcards.) */ +struct match { + struct flow flow; + struct flow_wildcards wc; + struct tun_metadata_allocation tun_md; +}; + +/* Initializer for a "struct match" that matches every packet. */ +#define MATCH_CATCHALL_INITIALIZER { .flow = { .dl_type = 0 } } + +void match_init(struct match *, + const struct flow *, const struct flow_wildcards *); +void match_wc_init(struct match *match, const struct flow *flow); +void match_init_catchall(struct match *); + +void match_zero_wildcarded_fields(struct match *); + +void match_set_dp_hash(struct match *, uint32_t value); +void match_set_dp_hash_masked(struct match *, uint32_t value, uint32_t mask); + +void match_set_recirc_id(struct match *, uint32_t value); + +void match_set_conj_id(struct match *, uint32_t value); + +void match_set_reg(struct match *, unsigned int reg_idx, uint32_t value); +void match_set_reg_masked(struct match *, unsigned int reg_idx, + uint32_t value, uint32_t mask); +void match_set_xreg(struct match *, unsigned int xreg_idx, uint64_t value); +void match_set_xreg_masked(struct match *, unsigned int xreg_idx, + uint64_t value, uint64_t mask); +void match_set_xxreg(struct match *, unsigned int xxreg_idx, ovs_u128 value); +void match_set_xxreg_masked(struct match *, unsigned int xxreg_idx, + ovs_u128 value, ovs_u128 mask); +void match_set_actset_output(struct match *, ofp_port_t actset_output); +void match_set_metadata(struct match *, ovs_be64 metadata); +void match_set_metadata_masked(struct match *, + ovs_be64 metadata, ovs_be64 mask); +void match_set_tun_id(struct match *, ovs_be64 tun_id); +void match_set_tun_id_masked(struct match *, ovs_be64 tun_id, ovs_be64 mask); +void match_set_tun_src(struct match *match, ovs_be32 src); +void match_set_tun_src_masked(struct match *match, ovs_be32 src, ovs_be32 mask); +void match_set_tun_dst(struct match *match, ovs_be32 dst); +void match_set_tun_dst_masked(struct match *match, ovs_be32 dst, ovs_be32 mask); +void match_set_tun_ipv6_src(struct match *, const struct in6_addr *); +void match_set_tun_ipv6_src_masked(struct match *, const struct in6_addr *, + const struct in6_addr *); +void match_set_tun_ipv6_dst(struct match *, const struct in6_addr *); +void match_set_tun_ipv6_dst_masked(struct match *, const struct in6_addr *, + const struct in6_addr *); +void match_set_tun_ttl(struct match *match, uint8_t ttl); +void match_set_tun_ttl_masked(struct match *match, uint8_t ttl, uint8_t mask); +void match_set_tun_tos(struct match *match, uint8_t tos); +void match_set_tun_tos_masked(struct match *match, uint8_t tos, uint8_t mask); +void match_set_tun_flags(struct match *match, uint16_t flags); +void match_set_tun_flags_masked(struct match *match, uint16_t flags, uint16_t mask); +void match_set_tun_gbp_id_masked(struct match *match, ovs_be16 gbp_id, ovs_be16 mask); +void match_set_tun_gbp_id(struct match *match, ovs_be16 gbp_id); +void match_set_tun_gbp_flags_masked(struct match *match, uint8_t flags, uint8_t mask); +void match_set_tun_gbp_flags(struct match *match, uint8_t flags); +void match_set_in_port(struct match *, ofp_port_t ofp_port); +void match_set_pkt_mark(struct match *, uint32_t pkt_mark); +void match_set_pkt_mark_masked(struct match *, uint32_t pkt_mark, uint32_t mask); +void match_set_ct_state(struct match *, uint32_t ct_state); +void match_set_ct_state_masked(struct match *, uint32_t ct_state, uint32_t mask); +void match_set_ct_zone(struct match *, uint16_t ct_zone); +void match_set_ct_mark(struct match *, uint32_t ct_mark); +void match_set_ct_mark_masked(struct match *, uint32_t ct_mark, uint32_t mask); +void match_set_ct_label(struct match *, ovs_u128 ct_label); +void match_set_ct_label_masked(struct match *, ovs_u128 ct_label, ovs_u128 mask); +void match_set_skb_priority(struct match *, uint32_t skb_priority); +void match_set_dl_type(struct match *, ovs_be16); +void match_set_dl_src(struct match *, const struct eth_addr ); +void match_set_dl_src_masked(struct match *, const struct eth_addr dl_src, + const struct eth_addr mask); +void match_set_dl_dst(struct match *, const struct eth_addr); +void match_set_dl_dst_masked(struct match *, const struct eth_addr dl_dst, + const struct eth_addr mask); +void match_set_dl_tci(struct match *, ovs_be16 tci); +void match_set_dl_tci_masked(struct match *, ovs_be16 tci, ovs_be16 mask); +void match_set_any_vid(struct match *); +void match_set_dl_vlan(struct match *, ovs_be16); +void match_set_vlan_vid(struct match *, ovs_be16); +void match_set_vlan_vid_masked(struct match *, ovs_be16 vid, ovs_be16 mask); +void match_set_any_pcp(struct match *); +void match_set_dl_vlan_pcp(struct match *, uint8_t); +void match_set_any_mpls_lse(struct match *, int idx); +void match_set_mpls_lse(struct match *, int idx, ovs_be32); +void match_set_any_mpls_label(struct match *, int idx); +void match_set_mpls_label(struct match *, int idx, ovs_be32); +void match_set_any_mpls_tc(struct match *, int idx); +void match_set_mpls_tc(struct match *, int idx, uint8_t); +void match_set_any_mpls_bos(struct match *, int idx); +void match_set_mpls_bos(struct match *, int idx, uint8_t); +void match_set_any_mpls_ttl(struct match *, int idx); +void match_set_mpls_ttl(struct match *, int idx, uint8_t); +void match_set_tp_src(struct match *, ovs_be16); +void match_set_mpls_lse(struct match *, int idx, ovs_be32 lse); +void match_set_tp_src_masked(struct match *, ovs_be16 port, ovs_be16 mask); +void match_set_tp_dst(struct match *, ovs_be16); +void match_set_tp_dst_masked(struct match *, ovs_be16 port, ovs_be16 mask); +void match_set_tcp_flags(struct match *, ovs_be16); +void match_set_tcp_flags_masked(struct match *, ovs_be16 flags, ovs_be16 mask); +void match_set_nw_proto(struct match *, uint8_t); +void match_set_nw_src(struct match *, ovs_be32); +void match_set_nw_src_masked(struct match *, ovs_be32 ip, ovs_be32 mask); +void match_set_nw_dst(struct match *, ovs_be32); +void match_set_nw_dst_masked(struct match *, ovs_be32 ip, ovs_be32 mask); +void match_set_nw_dscp(struct match *, uint8_t); +void match_set_nw_ecn(struct match *, uint8_t); +void match_set_nw_ttl(struct match *, uint8_t); +void match_set_nw_frag(struct match *, uint8_t nw_frag); +void match_set_nw_frag_masked(struct match *, uint8_t nw_frag, uint8_t mask); +void match_set_icmp_type(struct match *, uint8_t); +void match_set_icmp_code(struct match *, uint8_t); +void match_set_arp_sha(struct match *, const struct eth_addr); +void match_set_arp_sha_masked(struct match *, + const struct eth_addr arp_sha, + const struct eth_addr mask); +void match_set_arp_tha(struct match *, const struct eth_addr); +void match_set_arp_tha_masked(struct match *, + const struct eth_addr arp_tha, + const struct eth_addr mask); +void match_set_ipv6_src(struct match *, const struct in6_addr *); +void match_set_ipv6_src_masked(struct match *, const struct in6_addr *, + const struct in6_addr *); +void match_set_ipv6_dst(struct match *, const struct in6_addr *); +void match_set_ipv6_dst_masked(struct match *, const struct in6_addr *, + const struct in6_addr *); +void match_set_ipv6_label(struct match *, ovs_be32); +void match_set_ipv6_label_masked(struct match *, ovs_be32, ovs_be32); +void match_set_nd_target(struct match *, const struct in6_addr *); +void match_set_nd_target_masked(struct match *, const struct in6_addr *, + const struct in6_addr *); + +bool match_equal(const struct match *, const struct match *); +uint32_t match_hash(const struct match *, uint32_t basis); + +void match_init_hidden_fields(struct match *); +bool match_has_default_hidden_fields(const struct match *); + +void match_format(const struct match *, struct ds *, int priority); +char *match_to_string(const struct match *, int priority); +void match_print(const struct match *); + +/* Compressed match. */ + +/* A sparse representation of a "struct match". + * + * 'flows' is used for allocating both 'flow' and 'mask' with one + * miniflow_alloc() call. + * + * There are two invariants: + * + * - The same invariant as "struct match", that is, a 1-bit in the 'flow' + * must correspond to a 1-bit in 'mask'. + * + * - 'flow' and 'mask' have the same 'map'. This implies that 'flow' and + * 'mask' have the same part of "struct flow" at the same offset into + * 'values', which makes minimatch_matches_flow() faster. + */ +struct minimatch { + union { + struct { + struct miniflow *flow; + struct minimask *mask; + }; + struct miniflow *flows[2]; + }; +}; + +void minimatch_init(struct minimatch *, const struct match *); +void minimatch_clone(struct minimatch *, const struct minimatch *); +void minimatch_move(struct minimatch *dst, struct minimatch *src); +void minimatch_destroy(struct minimatch *); + +void minimatch_expand(const struct minimatch *, struct match *); + +bool minimatch_equal(const struct minimatch *a, const struct minimatch *b); + +bool minimatch_matches_flow(const struct minimatch *, const struct flow *); + +void minimatch_format(const struct minimatch *, const struct tun_table *, + struct ds *, int priority); +char *minimatch_to_string(const struct minimatch *, int priority); + +#endif /* match.h */ diff --git a/openflow/include/openvswitch/meta-flow.h b/openflow/include/openvswitch/meta-flow.h new file mode 100644 index 0000000..83e2599 --- /dev/null +++ b/openflow/include/openvswitch/meta-flow.h @@ -0,0 +1,1977 @@ +/* + * Copyright (c) 2011-2017 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_META_FLOW_H +#define OPENVSWITCH_META_FLOW_H 1 + +#include +#include +#include +#include +#include +#include +#include "openvswitch/flow.h" +#include "openvswitch/ofp-errors.h" +#include "openvswitch/packets.h" +#include "openvswitch/util.h" + +struct ds; +struct match; +struct ofputil_tlv_table_mod; + +/* Open vSwitch fields + * =================== + * + * Refer to ovs-fields(7) for a detailed introduction to Open vSwitch fields. + * + * + * Field specifications + * ==================== + * + * Each of the enumeration values below represents a field. The comments + * preceding each enum must be in a stylized form that is parsed at compile + * time by the extract-ofp-fields program. The comment itself consists of a + * series of paragraphs separate by blank lines. The paragraphs consist of: + * + * - The first paragraph gives the user-visible name of the field as a + * quoted string. This is the name used for parsing and formatting the + * field. + * + * For historical reasons, some fields have an additional name that is + * accepted as an alternative in parsing. This name, when there is one, + * is given as a quoted string in parentheses along with "aka". For + * example: + * + * "tun_id" (aka "tunnel_id"). + * + * New fields should have only one name. + * + * - Any number of paragraphs of free text that describe the field. These + * are kept brief because the main description is in meta-flow.xml. + * + * - A final paragraph that consists of a series of key-value pairs, one + * per line, in the form "key: value." where the period at the end of the + * line is a mandatory part of the syntax. + * + * Every field must specify the following key-value pairs: + * + * Type: + * + * The format and size of the field's value. Some possible values are + * generic: + * + * u8: A one-byte field. + * be16: A two-byte field. + * be32: A four-byte field. + * be64: An eight-byte field. + * + * The remaining values imply more about the value's semantics, though OVS + * does not currently take advantage of this additional information: + * + * MAC: A six-byte field whose value is an Ethernet address. + * IPv6: A 16-byte field whose value is an IPv6 address. + * tunnelMD: A variable length field, up to 124 bytes, that carries + * tunnel metadata. + * + * Maskable: + * + * Either "bitwise", if OVS supports matching any subset of bits in the + * field, or "no", if OVS only supports matching or wildcarding the entire + * field. + * + * Formatting: + * + * Explains how a field's value is formatted and parsed for human + * consumption. Some of the options are fairly generally useful: + * + * decimal: Formats the value as a decimal number. On parsing, accepts + * decimal (with no prefix), hexadecimal with 0x prefix, or octal + * with 0 prefix. + * + * hexadecimal: Same as decimal except nonzero values are formatted in + * hex with 0x prefix. The default for parsing is *not* hexadecimal: + * only with a 0x prefix is the input in hexadecimal. + * + * Ethernet: Formats and accepts the common format xx:xx:xx:xx:xx:xx. + * 6-byte fields only. + * + * IPv4: Formats and accepts the common format w.x.y.z. 4-byte fields + * only. + * + * IPv6: Formats and accepts the common IPv6 formats. 16-byte fields + * only. + * + * OpenFlow 1.0 port: Accepts an OpenFlow well-known port name + * (e.g. "IN_PORT") in uppercase or lowercase, or a 16-bit port + * number in decimal. Formats ports using their well-known names in + * uppercase, or in decimal otherwise. 2-byte fields only. + * + * OpenFlow 1.1+ port: Same syntax as for OpenFlow 1.0 ports but for + * 4-byte OpenFlow 1.1+ port number fields. + * + * Others are very specific to particular fields: + * + * frag: One of the strings "no", "first", "later", "yes", "not_later" + * describing which IPv4/v6 fragments are matched. + * + * tunnel flags: Any number of the strings "df", "csum", "key", or + * "oam" separated by "|". + * + * TCP flags: See the description of tcp_flags in ovs-ofctl(8). + * + * Prerequisites: + * + * The field's prerequisites. The values should be straightfoward. + * + * Access: + * + * Either "read-only", for a field that cannot be changed via OpenFlow, or + * "read/write" for a modifiable field. + * + * NXM: + * + * If the field has an NXM field assignment, then this specifies the NXM + * name of the field (e.g. "NXM_OF_ETH_SRC"), followed by its nxm_type in + * parentheses, followed by "since v." specifying the version of Open + * vSwitch that first supported this field in NXM (e.g. "since v1.1" if it + * was introduced in Open vSwitch 1.1). + * + * The NXM name must begin with NXM_OF_ or NXM_NX_. This allows OVS to + * determine the correct NXM class. + * + * If the field does not have an NXM field assignment, specify "none". + * + * OXM: + * + * If the field has an OXM field assignment, then this specifies the OXM + * name of the field (e.g. "OXM_OF_ETH_SRC"), followed by its nxm_type in + * parentheses, followed by "since OF. v." specifying the + * versions of OpenFlow and Open vSwitch that first supported this field in + * OXM (e.g. "since OF1.3 and v1.10" if it was introduced in OpenFlow 1.3 + * and first supported by Open vSwitch in version 1.10). + * + * Some fields have more than one OXM field assignment. For example, + * actset_output has an experimenter OXM assignment in OpenFlow 1.3 and a + * standard OXM assignment in OpenFlow 1.5. In such a case, specify both, + * separated by commas. + * + * OVS uses the start of the OXM field name to determine the correct OXM + * class. To support a new OXM class, edit the mapping table in + * build-aux/extract-ofp-fields. + * + * If the field does not have an OXM field assignment, specify "none". + * + * The following key-value pairs are optional. Open vSwitch already supports + * all the fields to which they apply, so new fields should probably not + * include these pairs: + * + * OF1.0: + * + * Specify this as "exact match" if OpenFlow 1.0 can match or wildcard the + * entire field, or as "CIDR mask" if OpenFlow 1.0 can match any CIDR + * prefix of the field. (OpenFlow 1.0 did not support bitwise matching.) + * Omit, if OpenFlow 1.0 did not support this field. + * + * OF1.1: + * + * Specify this as "exact match" if OpenFlow 1.1 can match or wildcard the + * entire field, or as "bitwise" if OpenFlow 1.1 can match any subset of + * bits in the field. Omit, if OpenFlow 1.1 did not support this field. + * + * The following key-value pair is optional: + * + * Prefix lookup member: + * + * If this field makes sense for use with classifier_set_prefix_fields(), + * specify the name of the "struct flow" member that corresponds to the + * field. + * + * Finally, a few "register" fields have very similar names and purposes, + * e.g. MFF_REG0 through MFF_REG15. For these, the comments may be merged + * together using as a metasyntactic variable for the numeric suffix. + * Lines in the comment that are specific to one of the particular fields by + * writing, e.g. <1>, to consider that line only for e.g. MFF_REG1. + */ + +enum OVS_PACKED_ENUM mf_field_id { +/* ## -------- ## */ +/* ## Metadata ## */ +/* ## -------- ## */ + + /* "dp_hash". + * + * Flow hash computed in the datapath. Internal use only, not programmable + * from controller. + * + * The OXM code point for this is an attempt to test OXM experimenter + * support, which is otherwise difficult to test due to the dearth of use + * out in the wild. Because controllers can't add flows that match on + * dp_hash, this doesn't commit OVS to supporting this OXM experimenter + * code point in the future. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read-only. + * NXM: NXM_NX_DP_HASH(35) since v2.2. + * OXM: NXOXM_ET_DP_HASH(0) since OF1.5 and v2.4. + */ + MFF_DP_HASH, + + /* "recirc_id". + * + * ID for recirculation. The value 0 is reserved for initially received + * packets. Internal use only, not programmable from controller. + * + * Type: be32. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: none. + * Access: read-only. + * NXM: NXM_NX_RECIRC_ID(36) since v2.2. + * OXM: none. + */ + MFF_RECIRC_ID, + + /* "conj_id". + * + * ID for "conjunction" actions. Please refer to ovs-ofctl(8) + * documentation of "conjunction" for details. + * + * Type: be32. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: none. + * Access: read-only. + * NXM: NXM_NX_CONJ_ID(37) since v2.4. + * OXM: none. */ + MFF_CONJ_ID, + + /* "tun_id" (aka "tunnel_id"). + * + * The "key" or "tunnel ID" or "VNI" in a packet received via a keyed + * tunnel. For protocols in which the key is shorter than 64 bits, the key + * is stored in the low bits and the high bits are zeroed. For non-keyed + * tunnels and packets not received via a tunnel, the value is 0. + * + * Type: be64. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_TUN_ID(16) since v1.1. + * OXM: OXM_OF_TUNNEL_ID(38) since OF1.3 and v1.10. + * Prefix lookup member: tunnel.tun_id. + */ + MFF_TUN_ID, + + /* "tun_src". + * + * The IPv4 source address in the outer IP header of a tunneled packet. + * + * For non-tunneled packets, the value is 0. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: IPv4. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_TUN_IPV4_SRC(31) since v2.0. + * OXM: none. + * Prefix lookup member: tunnel.ip_src. + */ + MFF_TUN_SRC, + + /* "tun_dst". + * + * The IPv4 destination address in the outer IP header of a tunneled + * packet. + * + * For non-tunneled packets, the value is 0. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: IPv4. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_TUN_IPV4_DST(32) since v2.0. + * OXM: none. + * Prefix lookup member: tunnel.ip_dst. + */ + MFF_TUN_DST, + + /* "tun_ipv6_src". + * + * The IPv6 source address in the outer IP header of a tunneled packet. + * + * For non-tunneled packets, the value is 0. + * + * Type: be128. + * Maskable: bitwise. + * Formatting: IPv6. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_TUN_IPV6_SRC(109) since v2.5. + * OXM: none. + * Prefix lookup member: tunnel.ipv6_src. + */ + MFF_TUN_IPV6_SRC, + + /* "tun_ipv6_dst". + * + * The IPv6 destination address in the outer IP header of a tunneled + * packet. + * + * For non-tunneled packets, the value is 0. + * + * Type: be128. + * Maskable: bitwise. + * Formatting: IPv6. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_TUN_IPV6_DST(110) since v2.5. + * OXM: none. + * Prefix lookup member: tunnel.ipv6_dst. + */ + MFF_TUN_IPV6_DST, + + /* "tun_flags". + * + * Flags representing aspects of tunnel behavior. + * + * For non-tunneled packets, the value is 0. + * + * Type: be16 (low 1 bits). + * Maskable: bitwise. + * Formatting: tunnel flags. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_TUN_FLAGS(104) since v2.5. + * OXM: none. + */ + MFF_TUN_FLAGS, + + /* "tun_ttl". + * + * The TTL in the outer IP header of a tunneled packet. Internal use only, + * not programmable from controller. + * + * For non-tunneled packets, the value is 0. + * + * Type: u8. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: none. + * Access: read-only. + * NXM: none. + * OXM: none. + */ + MFF_TUN_TTL, + + /* "tun_tos". + * + * The ToS value in the outer IP header of a tunneled packet. Internal use + * only, not programmable from controller. + * + * Type: u8. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: none. + * Access: read-only. + * NXM: none. + * OXM: none. + */ + MFF_TUN_TOS, + + /* "tun_gbp_id". + * + * VXLAN Group Policy ID + * + * Type: be16. + * Maskable: bitwise. + * Formatting: decimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_TUN_GBP_ID(38) since v2.4. + * OXM: none. + */ + MFF_TUN_GBP_ID, + + /* "tun_gbp_flags". + * + * VXLAN Group Policy flags + * + * Type: u8. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_TUN_GBP_FLAGS(39) since v2.4. + * OXM: none. + */ + MFF_TUN_GBP_FLAGS, + +#if TUN_METADATA_NUM_OPTS == 64 + /* "tun_metadata". + * + * Encapsulation metadata for tunnels. + * + * Each NXM can be dynamically mapped onto a particular tunnel field using + * OpenFlow commands. The individual NXMs can each carry up to 124 bytes + * of data and a combined total of 256 across all allocated fields. + * + * Type: tunnelMD. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_TUN_METADATA0(40) since v2.5. <0> + * NXM: NXM_NX_TUN_METADATA1(41) since v2.5. <1> + * NXM: NXM_NX_TUN_METADATA2(42) since v2.5. <2> + * NXM: NXM_NX_TUN_METADATA3(43) since v2.5. <3> + * NXM: NXM_NX_TUN_METADATA4(44) since v2.5. <4> + * NXM: NXM_NX_TUN_METADATA5(45) since v2.5. <5> + * NXM: NXM_NX_TUN_METADATA6(46) since v2.5. <6> + * NXM: NXM_NX_TUN_METADATA7(47) since v2.5. <7> + * NXM: NXM_NX_TUN_METADATA8(48) since v2.5. <8> + * NXM: NXM_NX_TUN_METADATA9(49) since v2.5. <9> + * NXM: NXM_NX_TUN_METADATA10(50) since v2.5. <10> + * NXM: NXM_NX_TUN_METADATA11(51) since v2.5. <11> + * NXM: NXM_NX_TUN_METADATA12(52) since v2.5. <12> + * NXM: NXM_NX_TUN_METADATA13(53) since v2.5. <13> + * NXM: NXM_NX_TUN_METADATA14(54) since v2.5. <14> + * NXM: NXM_NX_TUN_METADATA15(55) since v2.5. <15> + * NXM: NXM_NX_TUN_METADATA16(56) since v2.5. <16> + * NXM: NXM_NX_TUN_METADATA17(57) since v2.5. <17> + * NXM: NXM_NX_TUN_METADATA18(58) since v2.5. <18> + * NXM: NXM_NX_TUN_METADATA19(59) since v2.5. <19> + * NXM: NXM_NX_TUN_METADATA20(60) since v2.5. <20> + * NXM: NXM_NX_TUN_METADATA21(61) since v2.5. <21> + * NXM: NXM_NX_TUN_METADATA22(62) since v2.5. <22> + * NXM: NXM_NX_TUN_METADATA23(63) since v2.5. <23> + * NXM: NXM_NX_TUN_METADATA24(64) since v2.5. <24> + * NXM: NXM_NX_TUN_METADATA25(65) since v2.5. <25> + * NXM: NXM_NX_TUN_METADATA26(66) since v2.5. <26> + * NXM: NXM_NX_TUN_METADATA27(67) since v2.5. <27> + * NXM: NXM_NX_TUN_METADATA28(68) since v2.5. <28> + * NXM: NXM_NX_TUN_METADATA29(69) since v2.5. <29> + * NXM: NXM_NX_TUN_METADATA30(70) since v2.5. <30> + * NXM: NXM_NX_TUN_METADATA31(71) since v2.5. <31> + * NXM: NXM_NX_TUN_METADATA32(72) since v2.5. <32> + * NXM: NXM_NX_TUN_METADATA33(73) since v2.5. <33> + * NXM: NXM_NX_TUN_METADATA34(74) since v2.5. <34> + * NXM: NXM_NX_TUN_METADATA35(75) since v2.5. <35> + * NXM: NXM_NX_TUN_METADATA36(76) since v2.5. <36> + * NXM: NXM_NX_TUN_METADATA37(77) since v2.5. <37> + * NXM: NXM_NX_TUN_METADATA38(78) since v2.5. <38> + * NXM: NXM_NX_TUN_METADATA39(79) since v2.5. <39> + * NXM: NXM_NX_TUN_METADATA40(80) since v2.5. <40> + * NXM: NXM_NX_TUN_METADATA41(81) since v2.5. <41> + * NXM: NXM_NX_TUN_METADATA42(82) since v2.5. <42> + * NXM: NXM_NX_TUN_METADATA43(83) since v2.5. <43> + * NXM: NXM_NX_TUN_METADATA44(84) since v2.5. <44> + * NXM: NXM_NX_TUN_METADATA45(85) since v2.5. <45> + * NXM: NXM_NX_TUN_METADATA46(86) since v2.5. <46> + * NXM: NXM_NX_TUN_METADATA47(87) since v2.5. <47> + * NXM: NXM_NX_TUN_METADATA48(88) since v2.5. <48> + * NXM: NXM_NX_TUN_METADATA49(89) since v2.5. <49> + * NXM: NXM_NX_TUN_METADATA50(90) since v2.5. <50> + * NXM: NXM_NX_TUN_METADATA51(91) since v2.5. <51> + * NXM: NXM_NX_TUN_METADATA52(92) since v2.5. <52> + * NXM: NXM_NX_TUN_METADATA53(93) since v2.5. <53> + * NXM: NXM_NX_TUN_METADATA54(94) since v2.5. <54> + * NXM: NXM_NX_TUN_METADATA55(95) since v2.5. <55> + * NXM: NXM_NX_TUN_METADATA56(96) since v2.5. <56> + * NXM: NXM_NX_TUN_METADATA57(97) since v2.5. <57> + * NXM: NXM_NX_TUN_METADATA58(98) since v2.5. <58> + * NXM: NXM_NX_TUN_METADATA59(99) since v2.5. <59> + * NXM: NXM_NX_TUN_METADATA60(100) since v2.5. <60> + * NXM: NXM_NX_TUN_METADATA61(101) since v2.5. <61> + * NXM: NXM_NX_TUN_METADATA62(102) since v2.5. <62> + * NXM: NXM_NX_TUN_METADATA63(103) since v2.5. <63> + * OXM: none. + */ + MFF_TUN_METADATA0, + MFF_TUN_METADATA1, + MFF_TUN_METADATA2, + MFF_TUN_METADATA3, + MFF_TUN_METADATA4, + MFF_TUN_METADATA5, + MFF_TUN_METADATA6, + MFF_TUN_METADATA7, + MFF_TUN_METADATA8, + MFF_TUN_METADATA9, + MFF_TUN_METADATA10, + MFF_TUN_METADATA11, + MFF_TUN_METADATA12, + MFF_TUN_METADATA13, + MFF_TUN_METADATA14, + MFF_TUN_METADATA15, + MFF_TUN_METADATA16, + MFF_TUN_METADATA17, + MFF_TUN_METADATA18, + MFF_TUN_METADATA19, + MFF_TUN_METADATA20, + MFF_TUN_METADATA21, + MFF_TUN_METADATA22, + MFF_TUN_METADATA23, + MFF_TUN_METADATA24, + MFF_TUN_METADATA25, + MFF_TUN_METADATA26, + MFF_TUN_METADATA27, + MFF_TUN_METADATA28, + MFF_TUN_METADATA29, + MFF_TUN_METADATA30, + MFF_TUN_METADATA31, + MFF_TUN_METADATA32, + MFF_TUN_METADATA33, + MFF_TUN_METADATA34, + MFF_TUN_METADATA35, + MFF_TUN_METADATA36, + MFF_TUN_METADATA37, + MFF_TUN_METADATA38, + MFF_TUN_METADATA39, + MFF_TUN_METADATA40, + MFF_TUN_METADATA41, + MFF_TUN_METADATA42, + MFF_TUN_METADATA43, + MFF_TUN_METADATA44, + MFF_TUN_METADATA45, + MFF_TUN_METADATA46, + MFF_TUN_METADATA47, + MFF_TUN_METADATA48, + MFF_TUN_METADATA49, + MFF_TUN_METADATA50, + MFF_TUN_METADATA51, + MFF_TUN_METADATA52, + MFF_TUN_METADATA53, + MFF_TUN_METADATA54, + MFF_TUN_METADATA55, + MFF_TUN_METADATA56, + MFF_TUN_METADATA57, + MFF_TUN_METADATA58, + MFF_TUN_METADATA59, + MFF_TUN_METADATA60, + MFF_TUN_METADATA61, + MFF_TUN_METADATA62, + MFF_TUN_METADATA63, +#else +#error "Need to update MFF_TUN_METADATA* to match TUN_METADATA_NUM_OPTS" +#endif + + /* "metadata". + * + * A scratch pad value standardized in OpenFlow 1.1+. Initially zero, at + * the beginning of the pipeline. + * + * Type: be64. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: none. + * OXM: OXM_OF_METADATA(2) since OF1.2 and v1.8. + * OF1.1: bitwise mask. + */ + MFF_METADATA, + + /* "in_port". + * + * 16-bit (OpenFlow 1.0) view of the physical or virtual port on which the + * packet was received. + * + * Type: be16. + * Maskable: no. + * Formatting: OpenFlow 1.0 port. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_OF_IN_PORT(0) since v1.1. + * OXM: none. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_IN_PORT, + + /* "in_port_oxm". + * + * 32-bit (OpenFlow 1.1+) view of the physical or virtual port on which the + * packet was received. + * + * Type: be32. + * Maskable: no. + * Formatting: OpenFlow 1.1+ port. + * Prerequisites: none. + * Access: read/write. + * NXM: none. + * OXM: OXM_OF_IN_PORT(0) since OF1.2 and v1.7. + * OF1.1: exact match. + */ + MFF_IN_PORT_OXM, + + /* "actset_output". + * + * Type: be32. + * Maskable: no. + * Formatting: OpenFlow 1.1+ port. + * Prerequisites: none. + * Access: read-only. + * NXM: none. + * OXM: ONFOXM_ET_ACTSET_OUTPUT(43) since OF1.3 and v2.4, + * OXM_OF_ACTSET_OUTPUT(43) since OF1.5 and v2.4. + */ + MFF_ACTSET_OUTPUT, + + /* "skb_priority". + * + * Designates the queue to which output will be directed. The value in + * this field is not necessarily the OpenFlow queue number; with the Linux + * kernel switch, it instead has a pair of subfields designating the + * "major" and "minor" numbers of a Linux kernel qdisc handle. + * + * This field is "semi-internal" in that it can be set with the "set_queue" + * action but not matched or read or written other ways. + * + * Type: be32. + * Maskable: no. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read-only. + * NXM: none. + * OXM: none. + */ + MFF_SKB_PRIORITY, + + /* "pkt_mark". + * + * Packet metadata mark. The mark may be passed into other system + * components in order to facilitate interaction between subsystems. On + * Linux this corresponds to struct sk_buff's "skb_mark" member but the + * exact implementation is platform-dependent. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_PKT_MARK(33) since v2.0. + * OXM: none. + */ + MFF_PKT_MARK, + + /* "ct_state". + * + * Connection tracking state. The field is populated by the NXAST_CT + * action. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: ct state. + * Prerequisites: none. + * Access: read-only. + * NXM: NXM_NX_CT_STATE(105) since v2.5. + * OXM: none. + */ + MFF_CT_STATE, + + /* "ct_zone". + * + * Connection tracking zone. The field is populated by the + * NXAST_CT action. + * + * Type: be16. + * Maskable: no. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read-only. + * NXM: NXM_NX_CT_ZONE(106) since v2.5. + * OXM: none. + */ + MFF_CT_ZONE, + + /* "ct_mark". + * + * Connection tracking mark. The mark is carried with the + * connection tracking state. On Linux this corresponds to the + * nf_conn's "mark" member but the exact implementation is + * platform-dependent. + * + * Writable only from nested actions within the NXAST_CT action. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_CT_MARK(107) since v2.5. + * OXM: none. + */ + MFF_CT_MARK, + + /* "ct_label". + * + * Connection tracking label. The label is carried with the + * connection tracking state. On Linux this is held in the + * conntrack label extension but the exact implementation is + * platform-dependent. + * + * Writable only from nested actions within the NXAST_CT action. + * + * Type: be128. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_CT_LABEL(108) since v2.5. + * OXM: none. + */ + MFF_CT_LABEL, + +#if FLOW_N_REGS == 16 + /* "reg". + * + * Nicira extension scratch pad register with initial value 0. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_REG0(0) since v1.1. <0> + * NXM: NXM_NX_REG1(1) since v1.1. <1> + * NXM: NXM_NX_REG2(2) since v1.1. <2> + * NXM: NXM_NX_REG3(3) since v1.1. <3> + * NXM: NXM_NX_REG4(4) since v1.3. <4> + * NXM: NXM_NX_REG5(5) since v1.7. <5> + * NXM: NXM_NX_REG6(6) since v1.7. <6> + * NXM: NXM_NX_REG7(7) since v1.7. <7> + * NXM: NXM_NX_REG8(8) since v2.6. <8> + * NXM: NXM_NX_REG9(9) since v2.6. <9> + * NXM: NXM_NX_REG10(10) since v2.6. <10> + * NXM: NXM_NX_REG11(11) since v2.6. <11> + * NXM: NXM_NX_REG12(12) since v2.6. <12> + * NXM: NXM_NX_REG13(13) since v2.6. <13> + * NXM: NXM_NX_REG14(14) since v2.6. <14> + * NXM: NXM_NX_REG15(15) since v2.6. <15> + * OXM: none. + */ + MFF_REG0, + MFF_REG1, + MFF_REG2, + MFF_REG3, + MFF_REG4, + MFF_REG5, + MFF_REG6, + MFF_REG7, + MFF_REG8, + MFF_REG9, + MFF_REG10, + MFF_REG11, + MFF_REG12, + MFF_REG13, + MFF_REG14, + MFF_REG15, +#else +#error "Need to update MFF_REG* to match FLOW_N_REGS" +#endif + +#if FLOW_N_XREGS == 8 + /* "xreg". + * + * OpenFlow 1.5 ``extended register". + * + * Type: be64. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: none. + * OXM: OXM_OF_PKT_REG() since OF1.3 and v2.4. + */ + MFF_XREG0, + MFF_XREG1, + MFF_XREG2, + MFF_XREG3, + MFF_XREG4, + MFF_XREG5, + MFF_XREG6, + MFF_XREG7, +#else +#error "Need to update MFF_REG* to match FLOW_N_XREGS" +#endif + +#if FLOW_N_XXREGS == 4 + /* "xxreg". + * + * ``extended-extended register". + * + * Type: be128. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_NX_XXREG0(111) since v2.6. <0> + * NXM: NXM_NX_XXREG1(112) since v2.6. <1> + * NXM: NXM_NX_XXREG2(113) since v2.6. <2> + * NXM: NXM_NX_XXREG3(114) since v2.6. <3> + * NXM: NXM_NX_XXREG4(115) since vX.Y. <4> + * NXM: NXM_NX_XXREG5(116) since vX.Y. <5> + * NXM: NXM_NX_XXREG6(117) since vX.Y. <6> + * NXM: NXM_NX_XXREG7(118) since vX.Y. <7> + * OXM: none. + */ + MFF_XXREG0, + MFF_XXREG1, + MFF_XXREG2, + MFF_XXREG3, +#else +#error "Need to update MFF_REG* to match FLOW_N_XXREGS" +#endif + +/* ## -------- ## */ +/* ## Ethernet ## */ +/* ## -------- ## */ + + /* "eth_src" (aka "dl_src"). + * + * Source address in Ethernet header. + * + * Type: MAC. + * Maskable: bitwise. + * Formatting: Ethernet. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_OF_ETH_SRC(2) since v1.1. + * OXM: OXM_OF_ETH_SRC(4) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: bitwise mask. + */ + MFF_ETH_SRC, + + /* "eth_dst" (aka "dl_dst"). + * + * Destination address in Ethernet header. + * + * Type: MAC. + * Maskable: bitwise. + * Formatting: Ethernet. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_OF_ETH_DST(1) since v1.1. + * OXM: OXM_OF_ETH_DST(3) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: bitwise mask. + */ + MFF_ETH_DST, + + /* "eth_type" (aka "dl_type"). + * + * Packet's Ethernet type. + * + * For a packet with an 802.1Q header, this is the type of the encapsulated + * frame. + * + * Type: be16. + * Maskable: no. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read-only. + * NXM: NXM_OF_ETH_TYPE(3) since v1.1. + * OXM: OXM_OF_ETH_TYPE(5) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_ETH_TYPE, + +/* ## ---- ## */ +/* ## VLAN ## */ +/* ## ---- ## */ + +/* It looks odd for vlan_tci, vlan_vid, and vlan_pcp to say that they are + * supported in OF1.0 and OF1.1, since the detailed semantics of these fields + * only apply to NXM or OXM. They are marked as supported for exact matches in + * OF1.0 and OF1.1 because exact matches on those fields can be successfully + * translated into the OF1.0 and OF1.1 flow formats. */ + + /* "vlan_tci". + * + * 802.1Q TCI. + * + * For a packet with an 802.1Q header, this is the Tag Control Information + * (TCI) field, with the CFI bit forced to 1. For a packet with no 802.1Q + * header, this has value 0. + * + * Type: be16. + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: none. + * Access: read/write. + * NXM: NXM_OF_VLAN_TCI(4) since v1.1. + * OXM: none. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_VLAN_TCI, + + /* "dl_vlan" (OpenFlow 1.0). + * + * VLAN ID field. Zero if no 802.1Q header is present. + * + * Type: be16 (low 12 bits). + * Maskable: no. + * Formatting: decimal. + * Prerequisites: none. + * Access: read/write. + * NXM: none. + * OXM: none. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_DL_VLAN, + + /* "vlan_vid" (OpenFlow 1.2+). + * + * If an 802.1Q header is present, this field's value is 0x1000 + * bitwise-or'd with the VLAN ID. If no 802.1Q is present, this field's + * value is 0. + * + * Type: be16 (low 12 bits). + * Maskable: bitwise. + * Formatting: decimal. + * Prerequisites: none. + * Access: read/write. + * NXM: none. + * OXM: OXM_OF_VLAN_VID(6) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_VLAN_VID, + + /* "dl_vlan_pcp" (OpenFlow 1.0). + * + * VLAN priority (PCP) field. Zero if no 802.1Q header is present. + * + * Type: u8 (low 3 bits). + * Maskable: no. + * Formatting: decimal. + * Prerequisites: none. + * Access: read/write. + * NXM: none. + * OXM: none. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_DL_VLAN_PCP, + + /* "vlan_pcp" (OpenFlow 1.2+). + * + * VLAN priority (PCP) field. Zero if no 802.1Q header is present. + * + * Type: u8 (low 3 bits). + * Maskable: no. + * Formatting: decimal. + * Prerequisites: VLAN VID. + * Access: read/write. + * NXM: none. + * OXM: OXM_OF_VLAN_PCP(7) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_VLAN_PCP, + +/* ## ---- ## */ +/* ## MPLS ## */ +/* ## ---- ## */ + + /* "mpls_label". + * + * The outermost MPLS label, or 0 if no MPLS labels are present. + * + * Type: be32 (low 20 bits). + * Maskable: no. + * Formatting: decimal. + * Prerequisites: MPLS. + * Access: read/write. + * NXM: none. + * OXM: OXM_OF_MPLS_LABEL(34) since OF1.2 and v1.11. + * OF1.1: exact match. + */ + MFF_MPLS_LABEL, + + /* "mpls_tc". + * + * The outermost MPLS label's traffic control (TC) field, or 0 if no MPLS + * labels are present. + * + * Type: u8 (low 3 bits). + * Maskable: no. + * Formatting: decimal. + * Prerequisites: MPLS. + * Access: read/write. + * NXM: none. + * OXM: OXM_OF_MPLS_TC(35) since OF1.2 and v1.11. + * OF1.1: exact match. + */ + MFF_MPLS_TC, + + /* "mpls_bos". + * + * The outermost MPLS label's bottom of stack (BoS) field, or 0 if no MPLS + * labels are present. + * + * Type: u8 (low 1 bits). + * Maskable: no. + * Formatting: decimal. + * Prerequisites: MPLS. + * Access: read-only. + * NXM: none. + * OXM: OXM_OF_MPLS_BOS(36) since OF1.3 and v1.11. + */ + MFF_MPLS_BOS, + + /* "mpls_ttl". + * + * The outermost MPLS label's time-to-live (TTL) field, or 0 if no MPLS + * labels are present. + * + * Type: u8. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: MPLS. + * Access: read/write. + * NXM: NXM_NX_MPLS_TTL(30) since v2.6. + * OXM: none. + */ + MFF_MPLS_TTL, + +/* ## ---- ## */ +/* ## IPv4 ## */ +/* ## ---- ## */ + +/* Update mf_is_l3_or_higher() if MFF_IPV4_SRC is no longer the first element + * for a field of layer 3 or higher */ + + /* "ip_src" (aka "nw_src"). + * + * The source address in the IPv4 header. + * + * Before Open vSwitch 1.8, only CIDR masks were supported. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: IPv4. + * Prerequisites: IPv4. + * Access: read/write. + * NXM: NXM_OF_IP_SRC(7) since v1.1. + * OXM: OXM_OF_IPV4_SRC(11) since OF1.2 and v1.7. + * OF1.0: CIDR mask. + * OF1.1: bitwise mask. + * Prefix lookup member: nw_src. + */ + MFF_IPV4_SRC, + + /* "ip_dst" (aka "nw_dst"). + * + * The destination address in the IPv4 header. + * + * Before Open vSwitch 1.8, only CIDR masks were supported. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: IPv4. + * Prerequisites: IPv4. + * Access: read/write. + * NXM: NXM_OF_IP_DST(8) since v1.1. + * OXM: OXM_OF_IPV4_DST(12) since OF1.2 and v1.7. + * OF1.0: CIDR mask. + * OF1.1: bitwise mask. + * Prefix lookup member: nw_dst. + */ + MFF_IPV4_DST, + +/* ## ---- ## */ +/* ## IPv6 ## */ +/* ## ---- ## */ + + /* "ipv6_src". + * + * The source address in the IPv6 header. + * + * Type: be128. + * Maskable: bitwise. + * Formatting: IPv6. + * Prerequisites: IPv6. + * Access: read/write. + * NXM: NXM_NX_IPV6_SRC(19) since v1.1. + * OXM: OXM_OF_IPV6_SRC(26) since OF1.2 and v1.1. + * Prefix lookup member: ipv6_src. + */ + MFF_IPV6_SRC, + + /* "ipv6_dst". + * + * The destination address in the IPv6 header. + * + * Type: be128. + * Maskable: bitwise. + * Formatting: IPv6. + * Prerequisites: IPv6. + * Access: read/write. + * NXM: NXM_NX_IPV6_DST(20) since v1.1. + * OXM: OXM_OF_IPV6_DST(27) since OF1.2 and v1.1. + * Prefix lookup member: ipv6_dst. + */ + MFF_IPV6_DST, + + /* "ipv6_label". + * + * The flow label in the IPv6 header. + * + * Type: be32 (low 20 bits). + * Maskable: bitwise. + * Formatting: hexadecimal. + * Prerequisites: IPv6. + * Access: read/write. + * NXM: NXM_NX_IPV6_LABEL(27) since v1.4. + * OXM: OXM_OF_IPV6_FLABEL(28) since OF1.2 and v1.7. + */ + MFF_IPV6_LABEL, + +/* ## ----------------------- ## */ +/* ## IPv4/IPv6 common fields ## */ +/* ## ----------------------- ## */ + + /* "nw_proto" (aka "ip_proto"). + * + * The "protocol" byte in the IPv4 or IPv6 header. + * + * Type: u8. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: IPv4/IPv6. + * Access: read-only. + * NXM: NXM_OF_IP_PROTO(6) since v1.1. + * OXM: OXM_OF_IP_PROTO(10) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_IP_PROTO, + +/* Both views of the DSCP below are marked as supported in all of the versions + * of OpenFlow because a match on either view can be successfully translated + * into every OpenFlow flow format. */ + + /* "nw_tos" (OpenFlow 1.0/1.1). + * + * The DSCP byte in the IPv4 header or the traffic class byte from the IPv6 + * header, with the ECN bits forced to 0. (That is, bits 2-7 contain the + * type of service and bits 0-1 are zero.) + * + * Type: u8. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: IPv4/IPv6. + * Access: read/write. + * NXM: NXM_OF_IP_TOS(5) since v1.1. + * OXM: none. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_IP_DSCP, + + /* "ip_dscp" (OpenFlow 1.2+). + * + * The DSCP byte in the IPv4 header or the traffic class byte from the IPv6 + * header, shifted right 2 bits. (That is, bits 0-5 contain the type of + * service and bits 6-7 are zero.) + * + * Type: u8 (low 6 bits). + * Maskable: no. + * Formatting: decimal. + * Prerequisites: IPv4/IPv6. + * Access: read/write. + * NXM: none. + * OXM: OXM_OF_IP_DSCP(8) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_IP_DSCP_SHIFTED, + + /* "nw_ecn" (aka "ip_ecn"). + * + * The ECN bits in the IPv4 or IPv6 header. + * + * Type: u8 (low 2 bits). + * Maskable: no. + * Formatting: decimal. + * Prerequisites: IPv4/IPv6. + * Access: read/write. + * NXM: NXM_NX_IP_ECN(28) since v1.4. + * OXM: OXM_OF_IP_ECN(9) since OF1.2 and v1.7. + */ + MFF_IP_ECN, + + /* "nw_ttl". + * + * The time-to-live (TTL) in the IPv4 header or hop limit in the IPv6 + * header. + * + * Type: u8. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: IPv4/IPv6. + * Access: read/write. + * NXM: NXM_NX_IP_TTL(29) since v1.4. + * OXM: none. + */ + MFF_IP_TTL, + + /* "ip_frag". + * + * IP fragment information. + * + * Type: u8 (low 2 bits). + * Maskable: bitwise. + * Formatting: frag. + * Prerequisites: IPv4/IPv6. + * Access: read-only. + * NXM: NXM_NX_IP_FRAG(26) since v1.3. + * OXM: none. + */ + MFF_IP_FRAG, + +/* ## --- ## */ +/* ## ARP ## */ +/* ## --- ## */ + + /* "arp_op". + * + * ARP opcode. + * + * For an Ethernet+IP ARP packet, the opcode in the ARP header. Always 0 + * otherwise. Only ARP opcodes between 1 and 255 should be specified for + * matching. + * + * Type: be16. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: ARP. + * Access: read/write. + * NXM: NXM_OF_ARP_OP(15) since v1.1. + * OXM: OXM_OF_ARP_OP(21) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_ARP_OP, + + /* "arp_spa". + * + * For an Ethernet+IP ARP packet, the source protocol (IPv4) address in the + * ARP header. Always 0 otherwise. + * + * Before Open vSwitch 1.8, only CIDR masks were supported. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: IPv4. + * Prerequisites: ARP. + * Access: read/write. + * NXM: NXM_OF_ARP_SPA(16) since v1.1. + * OXM: OXM_OF_ARP_SPA(22) since OF1.2 and v1.7. + * OF1.0: CIDR mask. + * OF1.1: bitwise mask. + */ + MFF_ARP_SPA, + + /* "arp_tpa". + * + * For an Ethernet+IP ARP packet, the target protocol (IPv4) address in the + * ARP header. Always 0 otherwise. + * + * Before Open vSwitch 1.8, only CIDR masks were supported. + * + * Type: be32. + * Maskable: bitwise. + * Formatting: IPv4. + * Prerequisites: ARP. + * Access: read/write. + * NXM: NXM_OF_ARP_TPA(17) since v1.1. + * OXM: OXM_OF_ARP_TPA(23) since OF1.2 and v1.7. + * OF1.0: CIDR mask. + * OF1.1: bitwise mask. + */ + MFF_ARP_TPA, + + /* "arp_sha". + * + * For an Ethernet+IP ARP packet, the source hardware (Ethernet) address in + * the ARP header. Always 0 otherwise. + * + * Type: MAC. + * Maskable: bitwise. + * Formatting: Ethernet. + * Prerequisites: ARP. + * Access: read/write. + * NXM: NXM_NX_ARP_SHA(17) since v1.1. + * OXM: OXM_OF_ARP_SHA(24) since OF1.2 and v1.7. + */ + MFF_ARP_SHA, + + /* "arp_tha". + * + * For an Ethernet+IP ARP packet, the target hardware (Ethernet) address in + * the ARP header. Always 0 otherwise. + * + * Type: MAC. + * Maskable: bitwise. + * Formatting: Ethernet. + * Prerequisites: ARP. + * Access: read/write. + * NXM: NXM_NX_ARP_THA(18) since v1.1. + * OXM: OXM_OF_ARP_THA(25) since OF1.2 and v1.7. + */ + MFF_ARP_THA, + +/* ## --- ## */ +/* ## TCP ## */ +/* ## --- ## */ + + /* "tcp_src" (aka "tp_src"). + * + * TCP source port. + * + * Type: be16. + * Maskable: bitwise. + * Formatting: decimal. + * Prerequisites: TCP. + * Access: read/write. + * NXM: NXM_OF_TCP_SRC(9) since v1.1. + * OXM: OXM_OF_TCP_SRC(13) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_TCP_SRC, + + /* "tcp_dst" (aka "tp_dst"). + * + * TCP destination port. + * + * Type: be16. + * Maskable: bitwise. + * Formatting: decimal. + * Prerequisites: TCP. + * Access: read/write. + * NXM: NXM_OF_TCP_DST(10) since v1.1. + * OXM: OXM_OF_TCP_DST(14) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_TCP_DST, + + /* "tcp_flags". + * + * Flags in the TCP header. + * + * TCP currently defines 9 flag bits, and additional 3 bits are reserved + * (must be transmitted as zero). See RFCs 793, 3168, and 3540. + * + * Type: be16 (low 12 bits). + * Maskable: bitwise. + * Formatting: TCP flags. + * Prerequisites: TCP. + * Access: read-only. + * NXM: NXM_NX_TCP_FLAGS(34) since v2.1. + * OXM: ONFOXM_ET_TCP_FLAGS(42) since OF1.3 and v2.4, + * OXM_OF_TCP_FLAGS(42) since OF1.5 and v2.3. + */ + MFF_TCP_FLAGS, + +/* ## --- ## */ +/* ## UDP ## */ +/* ## --- ## */ + + /* "udp_src". + * + * UDP source port. + * + * Type: be16. + * Maskable: bitwise. + * Formatting: decimal. + * Prerequisites: UDP. + * Access: read/write. + * NXM: NXM_OF_UDP_SRC(11) since v1.1. + * OXM: OXM_OF_UDP_SRC(15) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_UDP_SRC, + + /* "udp_dst". + * + * UDP destination port + * + * Type: be16. + * Maskable: bitwise. + * Formatting: decimal. + * Prerequisites: UDP. + * Access: read/write. + * NXM: NXM_OF_UDP_DST(12) since v1.1. + * OXM: OXM_OF_UDP_DST(16) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_UDP_DST, + +/* ## ---- ## */ +/* ## SCTP ## */ +/* ## ---- ## */ + + /* "sctp_src". + * + * SCTP source port. + * + * Type: be16. + * Maskable: bitwise. + * Formatting: decimal. + * Prerequisites: SCTP. + * Access: read/write. + * NXM: none. + * OXM: OXM_OF_SCTP_SRC(17) since OF1.2 and v2.0. + * OF1.1: exact match. + */ + MFF_SCTP_SRC, + + /* "sctp_dst". + * + * SCTP destination port. + * + * Type: be16. + * Maskable: bitwise. + * Formatting: decimal. + * Prerequisites: SCTP. + * Access: read/write. + * NXM: none. + * OXM: OXM_OF_SCTP_DST(18) since OF1.2 and v2.0. + * OF1.1: exact match. + */ + MFF_SCTP_DST, + +/* ## ---- ## */ +/* ## ICMP ## */ +/* ## ---- ## */ + + /* "icmp_type". + * + * ICMPv4 type. + * + * Type: u8. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: ICMPv4. + * Access: read/write. + * NXM: NXM_OF_ICMP_TYPE(13) since v1.1. + * OXM: OXM_OF_ICMPV4_TYPE(19) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_ICMPV4_TYPE, + + /* "icmp_code". + * + * ICMPv4 code. + * + * Type: u8. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: ICMPv4. + * Access: read/write. + * NXM: NXM_OF_ICMP_CODE(14) since v1.1. + * OXM: OXM_OF_ICMPV4_CODE(20) since OF1.2 and v1.7. + * OF1.0: exact match. + * OF1.1: exact match. + */ + MFF_ICMPV4_CODE, + + /* "icmpv6_type". + * + * ICMPv6 type. + * + * Type: u8. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: ICMPv6. + * Access: read/write. + * NXM: NXM_NX_ICMPV6_TYPE(21) since v1.1. + * OXM: OXM_OF_ICMPV6_TYPE(29) since OF1.2 and v1.7. + */ + MFF_ICMPV6_TYPE, + + /* "icmpv6_code". + * + * ICMPv6 code. + * + * Type: u8. + * Maskable: no. + * Formatting: decimal. + * Prerequisites: ICMPv6. + * Access: read/write. + * NXM: NXM_NX_ICMPV6_CODE(22) since v1.1. + * OXM: OXM_OF_ICMPV6_CODE(30) since OF1.2 and v1.7. + */ + MFF_ICMPV6_CODE, + +/* ## ------------------------- ## */ +/* ## ICMPv6 Neighbor Discovery ## */ +/* ## ------------------------- ## */ + + /* "nd_target". + * + * The target address in an IPv6 Neighbor Discovery message. + * + * Before Open vSwitch 1.8, only CIDR masks were supported. + * + * Type: be128. + * Maskable: bitwise. + * Formatting: IPv6. + * Prerequisites: ND. + * Access: read/write. + * NXM: NXM_NX_ND_TARGET(23) since v1.1. + * OXM: OXM_OF_IPV6_ND_TARGET(31) since OF1.2 and v1.7. + */ + MFF_ND_TARGET, + + /* "nd_sll". + * + * The source link layer address in an IPv6 Neighbor Discovery message. + * + * Type: MAC. + * Maskable: bitwise. + * Formatting: Ethernet. + * Prerequisites: ND solicit. + * Access: read/write. + * NXM: NXM_NX_ND_SLL(24) since v1.1. + * OXM: OXM_OF_IPV6_ND_SLL(32) since OF1.2 and v1.7. + */ + MFF_ND_SLL, + + /* "nd_tll". + * + * The target link layer address in an IPv6 Neighbor Discovery message. + * + * Type: MAC. + * Maskable: bitwise. + * Formatting: Ethernet. + * Prerequisites: ND advert. + * Access: read/write. + * NXM: NXM_NX_ND_TLL(25) since v1.1. + * OXM: OXM_OF_IPV6_ND_TLL(33) since OF1.2 and v1.7. + */ + MFF_ND_TLL, + + MFF_N_IDS +}; + +/* A set of mf_field_ids. */ +struct mf_bitmap { + unsigned long bm[BITMAP_N_LONGS(MFF_N_IDS)]; +}; +#define MF_BITMAP_INITIALIZER { { [0] = 0 } } + +/* Use this macro as CASE_MFF_REGS: in a switch statement to choose all of the + * MFF_REGn cases. */ +#if FLOW_N_REGS ==16 +#define CASE_MFF_REGS \ + case MFF_REG0: case MFF_REG1: case MFF_REG2: case MFF_REG3: \ + case MFF_REG4: case MFF_REG5: case MFF_REG6: case MFF_REG7: \ + case MFF_REG8: case MFF_REG9: case MFF_REG10: case MFF_REG11: \ + case MFF_REG12: case MFF_REG13: case MFF_REG14: case MFF_REG15 +#else +#error "Need to update CASE_MFF_REGS to match FLOW_N_REGS" +#endif + +/* Use this macro as CASE_MFF_XREGS: in a switch statement to choose all of the + * MFF_REGn cases. */ +#if FLOW_N_XREGS == 8 +#define CASE_MFF_XREGS \ + case MFF_XREG0: case MFF_XREG1: case MFF_XREG2: case MFF_XREG3: \ + case MFF_XREG4: case MFF_XREG5: case MFF_XREG6: case MFF_XREG7 +#else +#error "Need to update CASE_MFF_XREGS to match FLOW_N_XREGS" +#endif + +/* Use this macro as CASE_MFF_XXREGS: in a switch statement to choose + * all of the MFF_REGn cases. */ +#if FLOW_N_XXREGS == 4 +#define CASE_MFF_XXREGS \ + case MFF_XXREG0: case MFF_XXREG1: case MFF_XXREG2: case MFF_XXREG3 +#else +#error "Need to update CASE_MFF_XXREGS to match FLOW_N_XXREGS" +#endif + +static inline bool +mf_is_register(enum mf_field_id id) +{ + return ((id >= MFF_REG0 && id < MFF_REG0 + FLOW_N_REGS) || + (id >= MFF_XREG0 && id < MFF_XREG0 + FLOW_N_XREGS) || + (id >= MFF_XXREG0 && id < MFF_XXREG0 + FLOW_N_XXREGS)); +} + +/* Use this macro as CASE_MFF_TUN_METADATA: in a switch statement to choose + * all of the MFF_TUN_METADATAn cases. */ +#define CASE_MFF_TUN_METADATA \ + case MFF_TUN_METADATA0: case MFF_TUN_METADATA1: \ + case MFF_TUN_METADATA2: case MFF_TUN_METADATA3: \ + case MFF_TUN_METADATA4: case MFF_TUN_METADATA5: \ + case MFF_TUN_METADATA6: case MFF_TUN_METADATA7: \ + case MFF_TUN_METADATA8: case MFF_TUN_METADATA9: \ + case MFF_TUN_METADATA10: case MFF_TUN_METADATA11: \ + case MFF_TUN_METADATA12: case MFF_TUN_METADATA13: \ + case MFF_TUN_METADATA14: case MFF_TUN_METADATA15: \ + case MFF_TUN_METADATA16: case MFF_TUN_METADATA17: \ + case MFF_TUN_METADATA18: case MFF_TUN_METADATA19: \ + case MFF_TUN_METADATA20: case MFF_TUN_METADATA21: \ + case MFF_TUN_METADATA22: case MFF_TUN_METADATA23: \ + case MFF_TUN_METADATA24: case MFF_TUN_METADATA25: \ + case MFF_TUN_METADATA26: case MFF_TUN_METADATA27: \ + case MFF_TUN_METADATA28: case MFF_TUN_METADATA29: \ + case MFF_TUN_METADATA30: case MFF_TUN_METADATA31: \ + case MFF_TUN_METADATA32: case MFF_TUN_METADATA33: \ + case MFF_TUN_METADATA34: case MFF_TUN_METADATA35: \ + case MFF_TUN_METADATA36: case MFF_TUN_METADATA37: \ + case MFF_TUN_METADATA38: case MFF_TUN_METADATA39: \ + case MFF_TUN_METADATA40: case MFF_TUN_METADATA41: \ + case MFF_TUN_METADATA42: case MFF_TUN_METADATA43: \ + case MFF_TUN_METADATA44: case MFF_TUN_METADATA45: \ + case MFF_TUN_METADATA46: case MFF_TUN_METADATA47: \ + case MFF_TUN_METADATA48: case MFF_TUN_METADATA49: \ + case MFF_TUN_METADATA50: case MFF_TUN_METADATA51: \ + case MFF_TUN_METADATA52: case MFF_TUN_METADATA53: \ + case MFF_TUN_METADATA54: case MFF_TUN_METADATA55: \ + case MFF_TUN_METADATA56: case MFF_TUN_METADATA57: \ + case MFF_TUN_METADATA58: case MFF_TUN_METADATA59: \ + case MFF_TUN_METADATA60: case MFF_TUN_METADATA61: \ + case MFF_TUN_METADATA62: case MFF_TUN_METADATA63 + +/* Prerequisites for matching a field. + * + * A field may only be matched if the correct lower-level protocols are also + * matched. For example, the TCP port may be matched only if the Ethernet type + * matches ETH_TYPE_IP and the IP protocol matches IPPROTO_TCP. */ +enum OVS_PACKED_ENUM mf_prereqs { + MFP_NONE, + + /* L2 requirements. */ + MFP_ARP, + MFP_VLAN_VID, + MFP_IPV4, + MFP_IPV6, + MFP_IP_ANY, + + /* L2.5 requirements. */ + MFP_MPLS, + + /* L2+L3 requirements. */ + MFP_TCP, /* On IPv4 or IPv6. */ + MFP_UDP, /* On IPv4 or IPv6. */ + MFP_SCTP, /* On IPv4 or IPv6. */ + MFP_ICMPV4, + MFP_ICMPV6, + + /* L2+L3+L4 requirements. */ + MFP_ND, + MFP_ND_SOLICIT, + MFP_ND_ADVERT +}; + +/* Forms of partial-field masking allowed for a field. + * + * Every field may be masked as a whole. */ +enum OVS_PACKED_ENUM mf_maskable { + MFM_NONE, /* No sub-field masking. */ + MFM_FULLY, /* Every bit is individually maskable. */ +}; + +/* How to format or parse a field's value. */ +enum OVS_PACKED_ENUM mf_string { + /* Integer formats. + * + * The particular MFS_* constant sets the output format. On input, either + * decimal or hexadecimal (prefixed with 0x) is accepted. */ + MFS_DECIMAL, + MFS_HEXADECIMAL, + + /* Other formats. */ + MFS_CT_STATE, /* Connection tracking state */ + MFS_ETHERNET, + MFS_IPV4, + MFS_IPV6, + MFS_OFP_PORT, /* 16-bit OpenFlow 1.0 port number or name. */ + MFS_OFP_PORT_OXM, /* 32-bit OpenFlow 1.1+ port number or name. */ + MFS_FRAG, /* no, yes, first, later, not_later */ + MFS_TNL_FLAGS, /* FLOW_TNL_F_* flags */ + MFS_TCP_FLAGS, /* TCP_* flags */ +}; + +struct mf_field { + /* Identification. */ + enum mf_field_id id; /* MFF_*. */ + const char *name; /* Name of this field, e.g. "eth_type". */ + const char *extra_name; /* Alternate name, e.g. "dl_type", or NULL. */ + + /* Size. + * + * Most fields have n_bytes * 8 == n_bits. There are a few exceptions: + * + * - "dl_vlan" is 2 bytes but only 12 bits. + * - "dl_vlan_pcp" is 1 byte but only 3 bits. + * - "is_frag" is 1 byte but only 2 bits. + * - "ipv6_label" is 4 bytes but only 20 bits. + * - "mpls_label" is 4 bytes but only 20 bits. + * - "mpls_tc" is 1 byte but only 3 bits. + * - "mpls_bos" is 1 byte but only 1 bit. + */ + unsigned int n_bytes; /* Width of the field in bytes. */ + unsigned int n_bits; /* Number of significant bits in field. */ + bool variable_len; /* Length is variable, if so width is max. */ + + /* Properties. */ + enum mf_maskable maskable; + enum mf_string string; + enum mf_prereqs prereqs; + bool writable; /* May be written by actions? */ + bool mapped; /* Variable length mf_field is mapped. */ + + /* Usable protocols. + * + * NXM and OXM are extensible, allowing later extensions to be sent in + * earlier protocol versions, so this does not necessarily correspond to + * the OpenFlow protocol version the field was introduced in. + * Also, some field types are tranparently mapped to each other via the + * struct flow (like vlan and dscp/tos fields), so each variant supports + * all protocols. + * + * These are combinations of OFPUTIL_P_*. (They are not declared as type + * enum ofputil_protocol because that would give meta-flow.h and ofp-util.h + * a circular dependency.) */ + uint32_t usable_protocols_exact; /* Matching or setting whole field. */ + uint32_t usable_protocols_cidr; /* Matching a CIDR mask in field. */ + uint32_t usable_protocols_bitwise; /* Matching arbitrary bits in field. */ + + int flow_be32ofs; /* Field's be32 offset in "struct flow", if prefix tree + * lookup is supported for the field, or -1. */ +}; + +/* The representation of a field's value. */ +union mf_value { + uint8_t b[128]; + uint8_t tun_metadata[128]; + struct in6_addr ipv6; + struct eth_addr mac; + ovs_be128 be128; + ovs_be64 be64; + ovs_be32 be32; + ovs_be16 be16; + uint8_t u8; +}; +BUILD_ASSERT_DECL(sizeof(union mf_value) == 128); +BUILD_ASSERT_DECL(sizeof(union mf_value) >= TLV_MAX_OPT_SIZE); + +/* A const mf_value with all bits initialized to ones. */ +extern const union mf_value exact_match_mask; + +/* Part of a field. */ +struct mf_subfield { + const struct mf_field *field; + unsigned int ofs; /* Bit offset. */ + unsigned int n_bits; /* Number of bits. */ +}; + +/* Data for some part of an mf_field. + * + * The data is stored "right-justified". For example, if "union mf_subvalue + * value" contains NXM_OF_VLAN_TCI[0..11], then one could access the + * corresponding data in value.be16[7] as the bits in the mask htons(0xfff). */ +union mf_subvalue { + /* Access to full data. */ + uint8_t u8[128]; + ovs_be16 be16[64]; + ovs_be32 be32[32]; + ovs_be64 be64[16]; + ovs_be128 be128[8]; + + /* Convenient access to just least-significant bits in various forms. */ + struct { + uint8_t dummy_u8[127]; + uint8_t u8_val; + }; + struct { + ovs_be16 dummy_be16[63]; + ovs_be16 be16_int; + }; + struct { + ovs_be32 dummy_be32[31]; + ovs_be32 be32_int; + }; + struct { + ovs_be64 dummy_integer[15]; + ovs_be64 integer; + }; + struct { + ovs_be128 dummy_be128[7]; + ovs_be128 be128_int; + }; + struct { + uint8_t dummy_mac[122]; + struct eth_addr mac; + }; + struct { + ovs_be32 dummy_ipv4[31]; + ovs_be32 ipv4; + }; + struct { + struct in6_addr dummy_ipv6[7]; + struct in6_addr ipv6; + }; +}; +BUILD_ASSERT_DECL(sizeof(union mf_value) == sizeof (union mf_subvalue)); + +bool mf_subvalue_intersect(const union mf_subvalue *a_value, + const union mf_subvalue *a_mask, + const union mf_subvalue *b_value, + const union mf_subvalue *b_mask, + union mf_subvalue *dst_value, + union mf_subvalue *dst_mask); +int mf_subvalue_width(const union mf_subvalue *); +void mf_subvalue_shift(union mf_subvalue *, int n); +void mf_subvalue_format(const union mf_subvalue *, struct ds *); + +static inline void mf_subvalue_from_value(const struct mf_subfield *sf, + union mf_subvalue *sv, + const void *value) +{ + unsigned int n_bytes = DIV_ROUND_UP(sf->n_bits, 8); + memset(sv, 0, sizeof *sv - n_bytes); + memcpy(&sv->u8[sizeof sv->u8 - n_bytes], value, n_bytes); +} + + +/* Set of field values. 'values' only includes the actual data bytes for each + * field for which is used, as marked by 1-bits in 'used'. */ +struct field_array { + struct mf_bitmap used; + size_t values_size; /* Number of bytes currently in 'values'. */ + uint8_t *values; /* Dynamically allocated to the correct size. */ +}; + +/* Finding mf_fields. */ +const struct mf_field *mf_from_name(const char *name); +const struct mf_field *mf_from_name_len(const char *name, size_t len); + +static inline const struct mf_field * +mf_from_id(enum mf_field_id id) +{ + extern const struct mf_field mf_fields[MFF_N_IDS]; + ovs_assert((unsigned int) id < MFF_N_IDS); + return &mf_fields[id]; +} + +/* Inspecting wildcarded bits. */ +bool mf_is_all_wild(const struct mf_field *, const struct flow_wildcards *); + +bool mf_is_mask_valid(const struct mf_field *, const union mf_value *mask); +void mf_get_mask(const struct mf_field *, const struct flow_wildcards *, + union mf_value *mask); + +/* Prerequisites. */ +bool mf_are_prereqs_ok(const struct mf_field *mf, const struct flow *flow, + struct flow_wildcards *wc); + +static inline bool +mf_is_l3_or_higher(const struct mf_field *mf) +{ + return mf->id >= MFF_IPV4_SRC; +} + +/* Field values. */ +bool mf_is_value_valid(const struct mf_field *, const union mf_value *value); + +void mf_get_value(const struct mf_field *, const struct flow *, + union mf_value *value); +void mf_set_value(const struct mf_field *, const union mf_value *value, + struct match *, char **err_str); +void mf_set_flow_value(const struct mf_field *, const union mf_value *value, + struct flow *); +void mf_set_flow_value_masked(const struct mf_field *, + const union mf_value *value, + const union mf_value *mask, + struct flow *); +bool mf_is_tun_metadata(const struct mf_field *); +bool mf_is_set(const struct mf_field *, const struct flow *); +void mf_mask_field(const struct mf_field *, struct flow_wildcards *); +void mf_mask_field_masked(const struct mf_field *, const union mf_value *mask, + struct flow_wildcards *); +int mf_field_len(const struct mf_field *, const union mf_value *value, + const union mf_value *mask, bool *is_masked); + +void mf_get(const struct mf_field *, const struct match *, + union mf_value *value, union mf_value *mask); + +/* Returns the set of usable protocols. */ +uint32_t mf_set(const struct mf_field *, const union mf_value *value, + const union mf_value *mask, struct match *, char **err_str); + +void mf_set_wild(const struct mf_field *, struct match *, char **err_str); + +/* Subfields. */ +void mf_write_subfield_flow(const struct mf_subfield *, + const union mf_subvalue *, struct flow *); +void mf_write_subfield(const struct mf_subfield *, const union mf_subvalue *, + struct match *); +void mf_write_subfield_value(const struct mf_subfield *, const void *src, + struct match *); + +void mf_mask_subfield(const struct mf_field *, + const union mf_subvalue *value, + const union mf_subvalue *mask, + struct match *); + +void mf_read_subfield(const struct mf_subfield *, const struct flow *, + union mf_subvalue *); +uint64_t mf_get_subfield(const struct mf_subfield *, const struct flow *); + +void mf_subfield_copy(const struct mf_subfield *src, + const struct mf_subfield *dst, + struct flow *, struct flow_wildcards *); +void mf_subfield_swap(const struct mf_subfield *, + const struct mf_subfield *, + struct flow *flow, struct flow_wildcards *); + +enum ofperr mf_check_src(const struct mf_subfield *, const struct flow *); +enum ofperr mf_check_dst(const struct mf_subfield *, const struct flow *); + +/* Parsing and formatting. */ +char *mf_parse(const struct mf_field *, const char *, + union mf_value *value, union mf_value *mask); +char *mf_parse_value(const struct mf_field *, const char *, union mf_value *); +void mf_format(const struct mf_field *, + const union mf_value *value, const union mf_value *mask, + struct ds *); +void mf_format_subvalue(const union mf_subvalue *subvalue, struct ds *s); + +/* Field Arrays. */ +void field_array_set(enum mf_field_id id, const union mf_value *, + struct field_array *); +#endif /* meta-flow.h */ diff --git a/openflow/include/openvswitch/netdev.h b/openflow/include/openvswitch/netdev.h new file mode 100644 index 0000000..88a25dd --- /dev/null +++ b/openflow/include/openvswitch/netdev.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_NETDEV_H +#define OPENVSWITCH_NETDEV_H 1 + +#include +#include +#include + +struct netdev; + +/* Network device statistics. + * + * Values of unsupported statistics are set to all-1-bits (UINT64_MAX). */ +struct netdev_stats { + uint64_t rx_packets; /* Total packets received. */ + uint64_t tx_packets; /* Total packets transmitted. */ + uint64_t rx_bytes; /* Total bytes received. */ + uint64_t tx_bytes; /* Total bytes transmitted. */ + uint64_t rx_errors; /* Bad packets received. */ + uint64_t tx_errors; /* Packet transmit problems. */ + uint64_t rx_dropped; /* No buffer space. */ + uint64_t tx_dropped; /* No buffer space. */ + uint64_t multicast; /* Multicast packets received. */ + uint64_t collisions; + + /* Detailed receive errors. */ + uint64_t rx_length_errors; + uint64_t rx_over_errors; /* Receiver ring buff overflow. */ + uint64_t rx_crc_errors; /* Recved pkt with crc error. */ + uint64_t rx_frame_errors; /* Recv'd frame alignment error. */ + uint64_t rx_fifo_errors; /* Recv'r fifo overrun . */ + uint64_t rx_missed_errors; /* Receiver missed packet. */ + + /* Detailed transmit errors. */ + uint64_t tx_aborted_errors; + uint64_t tx_carrier_errors; + uint64_t tx_fifo_errors; + uint64_t tx_heartbeat_errors; + uint64_t tx_window_errors; + + /* Extended statistics based on RFC2819. */ + uint64_t rx_1_to_64_packets; + uint64_t rx_65_to_127_packets; + uint64_t rx_128_to_255_packets; + uint64_t rx_256_to_511_packets; + uint64_t rx_512_to_1023_packets; + uint64_t rx_1024_to_1522_packets; + uint64_t rx_1523_to_max_packets; + + uint64_t tx_1_to_64_packets; + uint64_t tx_65_to_127_packets; + uint64_t tx_128_to_255_packets; + uint64_t tx_256_to_511_packets; + uint64_t tx_512_to_1023_packets; + uint64_t tx_1024_to_1522_packets; + uint64_t tx_1523_to_max_packets; + + uint64_t tx_multicast_packets; + + uint64_t rx_broadcast_packets; + uint64_t tx_broadcast_packets; + + uint64_t rx_undersized_errors; + uint64_t rx_oversize_errors; + uint64_t rx_fragmented_errors; + uint64_t rx_jabber_errors; +}; + +/* Features. */ +enum netdev_features { + NETDEV_F_10MB_HD = 1 << 0, /* 10 Mb half-duplex rate support. */ + NETDEV_F_10MB_FD = 1 << 1, /* 10 Mb full-duplex rate support. */ + NETDEV_F_100MB_HD = 1 << 2, /* 100 Mb half-duplex rate support. */ + NETDEV_F_100MB_FD = 1 << 3, /* 100 Mb full-duplex rate support. */ + NETDEV_F_1GB_HD = 1 << 4, /* 1 Gb half-duplex rate support. */ + NETDEV_F_1GB_FD = 1 << 5, /* 1 Gb full-duplex rate support. */ + NETDEV_F_10GB_FD = 1 << 6, /* 10 Gb full-duplex rate support. */ + NETDEV_F_40GB_FD = 1 << 7, /* 40 Gb full-duplex rate support. */ + NETDEV_F_100GB_FD = 1 << 8, /* 100 Gb full-duplex rate support. */ + NETDEV_F_1TB_FD = 1 << 9, /* 1 Tb full-duplex rate support. */ + NETDEV_F_OTHER = 1 << 10, /* Other rate, not in the list. */ + NETDEV_F_COPPER = 1 << 11, /* Copper medium. */ + NETDEV_F_FIBER = 1 << 12, /* Fiber medium. */ + NETDEV_F_AUTONEG = 1 << 13, /* Auto-negotiation. */ + NETDEV_F_PAUSE = 1 << 14, /* Pause. */ + NETDEV_F_PAUSE_ASYM = 1 << 15, /* Asymmetric pause. */ +}; + +int netdev_get_features(const struct netdev *, + enum netdev_features *current, + enum netdev_features *advertised, + enum netdev_features *supported, + enum netdev_features *peer); +uint64_t netdev_features_to_bps(enum netdev_features features, + uint64_t default_bps); +bool netdev_features_is_full_duplex(enum netdev_features features); +int netdev_set_advertisements(struct netdev *, enum netdev_features advertise); + +#endif /* netdev.h */ diff --git a/openflow/include/openvswitch/ofp-actions.h b/openflow/include/openvswitch/ofp-actions.h new file mode 100644 index 0000000..88f573d --- /dev/null +++ b/openflow/include/openvswitch/ofp-actions.h @@ -0,0 +1,1160 @@ +/* + * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_OFP_ACTIONS_H +#define OPENVSWITCH_OFP_ACTIONS_H 1 + +#include +#include +#include "openflow/openflow.h" +#include "openflow/nicira-ext.h" +#include "openvswitch/meta-flow.h" +#include "openvswitch/ofp-util.h" +#include "openvswitch/ofp-errors.h" +#include "openvswitch/types.h" + +struct vl_mff_map; + +/* List of OVS abstracted actions. + * + * This macro is used directly only internally by this header, but the list is + * still of interest to developers. + * + * Each OFPACT invocation has the following parameters: + * + * 1. , used below in the enum definition of OFPACT_, and + * elsewhere. + * + * 2. corresponding to a structure "struct ", that must be + * defined below. This structure must be an abstract definition of the + * action. Its first member must have type "struct ofpact" and name + * "ofpact". It may be fixed length or end with a flexible array member + * (e.g. "int member[];"). + * + * 3. , which has one of two possible values: + * + * - If "struct " is fixed-length, it must be "ofpact". + * + * - If "struct " is variable-length, it must be the name of the + * flexible array member. + * + * 4. , a quoted string that gives the name of the action, for use in + * parsing actions from text. + */ +#define OFPACTS \ + /* Output. */ \ + OFPACT(OUTPUT, ofpact_output, ofpact, "output") \ + OFPACT(GROUP, ofpact_group, ofpact, "group") \ + OFPACT(CONTROLLER, ofpact_controller, userdata, "controller") \ + OFPACT(ENQUEUE, ofpact_enqueue, ofpact, "enqueue") \ + OFPACT(OUTPUT_REG, ofpact_output_reg, ofpact, "output_reg") \ + OFPACT(BUNDLE, ofpact_bundle, slaves, "bundle") \ + \ + /* Header changes. */ \ + OFPACT(SET_FIELD, ofpact_set_field, ofpact, "set_field") \ + OFPACT(SET_VLAN_VID, ofpact_vlan_vid, ofpact, "set_vlan_vid") \ + OFPACT(SET_VLAN_PCP, ofpact_vlan_pcp, ofpact, "set_vlan_pcp") \ + OFPACT(STRIP_VLAN, ofpact_null, ofpact, "strip_vlan") \ + OFPACT(PUSH_VLAN, ofpact_null, ofpact, "push_vlan") \ + OFPACT(SET_ETH_SRC, ofpact_mac, ofpact, "mod_dl_src") \ + OFPACT(SET_ETH_DST, ofpact_mac, ofpact, "mod_dl_dst") \ + OFPACT(SET_IPV4_SRC, ofpact_ipv4, ofpact, "mod_nw_src") \ + OFPACT(SET_IPV4_DST, ofpact_ipv4, ofpact, "mod_nw_dst") \ + OFPACT(SET_IP_DSCP, ofpact_dscp, ofpact, "mod_nw_tos") \ + OFPACT(SET_IP_ECN, ofpact_ecn, ofpact, "mod_nw_ecn") \ + OFPACT(SET_IP_TTL, ofpact_ip_ttl, ofpact, "mod_nw_ttl") \ + OFPACT(SET_L4_SRC_PORT, ofpact_l4_port, ofpact, "mod_tp_src") \ + OFPACT(SET_L4_DST_PORT, ofpact_l4_port, ofpact, "mod_tp_dst") \ + OFPACT(REG_MOVE, ofpact_reg_move, ofpact, "move") \ + OFPACT(STACK_PUSH, ofpact_stack, ofpact, "push") \ + OFPACT(STACK_POP, ofpact_stack, ofpact, "pop") \ + OFPACT(DEC_TTL, ofpact_cnt_ids, cnt_ids, "dec_ttl") \ + OFPACT(SET_MPLS_LABEL, ofpact_mpls_label, ofpact, "set_mpls_label") \ + OFPACT(SET_MPLS_TC, ofpact_mpls_tc, ofpact, "set_mpls_tc") \ + OFPACT(SET_MPLS_TTL, ofpact_mpls_ttl, ofpact, "set_mpls_ttl") \ + OFPACT(DEC_MPLS_TTL, ofpact_null, ofpact, "dec_mpls_ttl") \ + OFPACT(PUSH_MPLS, ofpact_push_mpls, ofpact, "push_mpls") \ + OFPACT(POP_MPLS, ofpact_pop_mpls, ofpact, "pop_mpls") \ + \ + /* Metadata. */ \ + OFPACT(SET_TUNNEL, ofpact_tunnel, ofpact, "set_tunnel") \ + OFPACT(SET_QUEUE, ofpact_queue, ofpact, "set_queue") \ + OFPACT(POP_QUEUE, ofpact_null, ofpact, "pop_queue") \ + OFPACT(FIN_TIMEOUT, ofpact_fin_timeout, ofpact, "fin_timeout") \ + \ + /* Flow table interaction. */ \ + OFPACT(RESUBMIT, ofpact_resubmit, ofpact, "resubmit") \ + OFPACT(LEARN, ofpact_learn, specs, "learn") \ + OFPACT(CONJUNCTION, ofpact_conjunction, ofpact, "conjunction") \ + \ + /* Arithmetic. */ \ + OFPACT(MULTIPATH, ofpact_multipath, ofpact, "multipath") \ + \ + /* Other. */ \ + OFPACT(NOTE, ofpact_note, data, "note") \ + OFPACT(EXIT, ofpact_null, ofpact, "exit") \ + OFPACT(SAMPLE, ofpact_sample, ofpact, "sample") \ + OFPACT(UNROLL_XLATE, ofpact_unroll_xlate, ofpact, "unroll_xlate") \ + OFPACT(CT, ofpact_conntrack, ofpact, "ct") \ + OFPACT(CT_CLEAR, ofpact_null, ofpact, "ct_clear") \ + OFPACT(NAT, ofpact_nat, ofpact, "nat") \ + OFPACT(OUTPUT_TRUNC, ofpact_output_trunc,ofpact, "output_trunc") \ + OFPACT(CLONE, ofpact_nest, actions, "clone") \ + \ + /* Debugging actions. \ + * \ + * These are intentionally undocumented, subject to change, and \ + * only accepted if ovs-vswitchd is started with --enable-dummy. */ \ + OFPACT(DEBUG_RECIRC, ofpact_null, ofpact, "debug_recirc") \ + \ + /* Instructions. */ \ + OFPACT(METER, ofpact_meter, ofpact, "meter") \ + OFPACT(CLEAR_ACTIONS, ofpact_null, ofpact, "clear_actions") \ + OFPACT(WRITE_ACTIONS, ofpact_nest, actions, "write_actions") \ + OFPACT(WRITE_METADATA, ofpact_metadata, ofpact, "write_metadata") \ + OFPACT(GOTO_TABLE, ofpact_goto_table, ofpact, "goto_table") + +/* enum ofpact_type, with a member OFPACT_ for each action. */ +enum OVS_PACKED_ENUM ofpact_type { +#define OFPACT(ENUM, STRUCT, MEMBER, NAME) OFPACT_##ENUM, + OFPACTS +#undef OFPACT +}; + +/* Define N_OFPACTS to the number of types of ofpacts. */ +enum { +#define OFPACT(ENUM, STRUCT, MEMBER, NAME) + 1 + N_OFPACTS = OFPACTS +#undef OFPACT +}; + +/* Header for an action. + * + * Each action is a structure "struct ofpact_*" that begins with "struct + * ofpact", usually followed by other data that describes the action. Actions + * are padded out to a multiple of OFPACT_ALIGNTO bytes in length. + * + * The 'raw' member is special: + * + * - Most "struct ofpact"s correspond to one particular kind of OpenFlow + * action, at least in a given OpenFlow version. For example, + * OFPACT_SET_VLAN_VID corresponds to OFPAT10_SET_VLAN_VID in OpenFlow + * 1.0. + * + * For such actions, the 'raw' member is not meaningful and generally + * should be zero. + * + * - A few "struct ofpact"s correspond to multiple OpenFlow actions. For + * example, OFPACT_SET_TUNNEL can be NXAST_SET_TUNNEL or + * NXAST_SET_TUNNEL64. In these cases, if the "struct ofpact" originated + * from OpenFlow, then we want to make sure that, if it gets translated + * back to OpenFlow later, it is translated back to the same action type. + * (Otherwise, we'd violate the promise made in the topics/design doc, in + * the "Action Reproduction" section.) + * + * For such actions, the 'raw' member should be the "enum ofp_raw_action" + * originally extracted from the OpenFlow action. (If the action didn't + * originate from OpenFlow, then setting 'raw' to zero should be fine: + * code to translate the ofpact to OpenFlow must tolerate this case.) + */ +struct ofpact { + /* We want the space advantage of an 8-bit type here on every + * implementation, without giving up the advantage of having a useful type + * on implementations that support packed enums. */ +#ifdef HAVE_PACKED_ENUM + enum ofpact_type type; /* OFPACT_*. */ +#else + uint8_t type; /* OFPACT_* */ +#endif + + uint8_t raw; /* Original type when added, if any. */ + uint16_t len; /* Length of the action, in bytes, including + * struct ofpact, excluding padding. */ +}; +BUILD_ASSERT_DECL(sizeof(struct ofpact) == 4); + +/* Alignment. */ +#define OFPACT_ALIGNTO 8 +#define OFPACT_ALIGN(SIZE) ROUND_UP(SIZE, OFPACT_ALIGNTO) +#define OFPACT_PADDED_MEMBERS(MEMBERS) PADDED_MEMBERS(OFPACT_ALIGNTO, MEMBERS) + +/* Returns the ofpact following 'ofpact'. */ +static inline struct ofpact * +ofpact_next(const struct ofpact *ofpact) +{ + return (void *) ((uint8_t *) ofpact + OFPACT_ALIGN(ofpact->len)); +} + +struct ofpact *ofpact_next_flattened(const struct ofpact *); + +static inline struct ofpact * +ofpact_end(const struct ofpact *ofpacts, size_t ofpacts_len) +{ + return (void *) ((uint8_t *) ofpacts + ofpacts_len); +} + +static inline const struct ofpact * +ofpact_find_type_flattened(const struct ofpact *a, enum ofpact_type type, + const struct ofpact * const end) +{ + while (a < end) { + if (a->type == type) { + return a; + } + a = ofpact_next_flattened(a); + } + return NULL; +} + +#define OFPACT_FIND_TYPE_FLATTENED(A, TYPE, END) \ + ofpact_get_##TYPE##_nullable( \ + ofpact_find_type_flattened(A, OFPACT_##TYPE, END)) + +/* Assigns POS to each ofpact, in turn, in the OFPACTS_LEN bytes of ofpacts + * starting at OFPACTS. */ +#define OFPACT_FOR_EACH(POS, OFPACTS, OFPACTS_LEN) \ + for ((POS) = (OFPACTS); (POS) < ofpact_end(OFPACTS, OFPACTS_LEN); \ + (POS) = ofpact_next(POS)) + +/* Assigns POS to each ofpact, in turn, in the OFPACTS_LEN bytes of ofpacts + * starting at OFPACTS. + * + * For ofpacts that contain nested ofpacts, this visits each of the inner + * ofpacts as well. */ +#define OFPACT_FOR_EACH_FLATTENED(POS, OFPACTS, OFPACTS_LEN) \ + for ((POS) = (OFPACTS); (POS) < ofpact_end(OFPACTS, OFPACTS_LEN); \ + (POS) = ofpact_next_flattened(POS)) + +#define OFPACT_FOR_EACH_TYPE_FLATTENED(POS, TYPE, OFPACTS, OFPACTS_LEN) \ + for ((POS) = OFPACT_FIND_TYPE_FLATTENED(OFPACTS, TYPE, \ + ofpact_end(OFPACTS, OFPACTS_LEN)); \ + (POS); \ + (POS) = OFPACT_FIND_TYPE_FLATTENED( \ + ofpact_next_flattened(&(POS)->ofpact), TYPE, \ + ofpact_end(OFPACTS, OFPACTS_LEN))) + +/* Action structure for each OFPACT_*. */ + +/* OFPACT_STRIP_VLAN, OFPACT_POP_QUEUE, OFPACT_EXIT, OFPACT_CLEAR_ACTIONS. + * + * Used for OFPAT10_STRIP_VLAN, NXAST_POP_QUEUE, NXAST_EXIT, + * OFPAT11_POP_VLAN, OFPIT11_CLEAR_ACTIONS. + * + * Action structure for actions that do not have any extra data beyond the + * action type. */ +struct ofpact_null { + struct ofpact ofpact; +}; + +/* OFPACT_OUTPUT. + * + * Used for OFPAT10_OUTPUT. */ +struct ofpact_output { + struct ofpact ofpact; + ofp_port_t port; /* Output port. */ + uint16_t max_len; /* Max send len, for port OFPP_CONTROLLER. */ +}; + +/* OFPACT_CONTROLLER. + * + * Used for NXAST_CONTROLLER. */ +struct ofpact_controller { + OFPACT_PADDED_MEMBERS( + struct ofpact ofpact; + uint16_t max_len; /* Max length to send to controller. */ + uint16_t controller_id; /* Controller ID to send packet-in. */ + enum ofp_packet_in_reason reason; /* Reason to put in packet-in. */ + + /* If true, this action freezes packet traversal of the OpenFlow + * tables and adds a continuation to the packet-in message, that + * a controller can use to resume that traversal. */ + bool pause; + + /* Arbitrary data to include in the packet-in message (currently, + * only in NXT_PACKET_IN2). */ + uint16_t userdata_len; + ); + uint8_t userdata[0]; +}; + +/* OFPACT_ENQUEUE. + * + * Used for OFPAT10_ENQUEUE. */ +struct ofpact_enqueue { + struct ofpact ofpact; + ofp_port_t port; + uint32_t queue; +}; + +/* OFPACT_OUTPUT_REG. + * + * Used for NXAST_OUTPUT_REG. */ +struct ofpact_output_reg { + struct ofpact ofpact; + uint16_t max_len; + struct mf_subfield src; +}; + +/* OFPACT_OUTPUT_TRUNC. + * + * Used for NXAST_OUTPUT_TRUNC. */ +struct ofpact_output_trunc { + struct ofpact ofpact; + ofp_port_t port; /* Output port. */ + uint32_t max_len; /* Max send len. */ +}; + +/* Bundle slave choice algorithm to apply. + * + * In the descriptions below, 'slaves' is the list of possible slaves in the + * order they appear in the OpenFlow action. */ +enum nx_bd_algorithm { + /* Chooses the first live slave listed in the bundle. + * + * O(n_slaves) performance. */ + NX_BD_ALG_ACTIVE_BACKUP = 0, + + /* Highest Random Weight. + * + * for i in [0,n_slaves): + * weights[i] = hash(flow, i) + * slave = { slaves[i] such that weights[i] >= weights[j] for all j != i } + * + * Redistributes 1/n_slaves of traffic when a slave's liveness changes. + * O(n_slaves) performance. + * + * Uses the 'fields' and 'basis' parameters. */ + NX_BD_ALG_HRW = 1 +}; + +/* OFPACT_BUNDLE. + * + * Used for NXAST_BUNDLE. */ +struct ofpact_bundle { + struct ofpact ofpact; + + /* Slave choice algorithm to apply to hash value. */ + enum nx_bd_algorithm algorithm; + + /* What fields to hash and how. */ + enum nx_hash_fields fields; + uint16_t basis; /* Universal hash parameter. */ + + struct mf_subfield dst; + + /* Slaves for output. */ + unsigned int n_slaves; + ofp_port_t slaves[]; +}; + +/* OFPACT_SET_VLAN_VID. + * + * We keep track if vlan was present at action validation time to avoid a + * PUSH_VLAN when translating to OpenFlow 1.1+. + * + * We also keep the originating OFPUTIL action code in ofpact.compat. + * + * Used for OFPAT10_SET_VLAN_VID and OFPAT11_SET_VLAN_VID. */ +struct ofpact_vlan_vid { + struct ofpact ofpact; + uint16_t vlan_vid; /* VLAN VID in low 12 bits, 0 in other bits. */ + bool push_vlan_if_needed; /* OF 1.0 semantics if true. */ + bool flow_has_vlan; /* VLAN present at action validation time? */ +}; + +/* OFPACT_SET_VLAN_PCP. + * + * We keep track if vlan was present at action validation time to avoid a + * PUSH_VLAN when translating to OpenFlow 1.1+. + * + * We also keep the originating OFPUTIL action code in ofpact.compat. + * + * Used for OFPAT10_SET_VLAN_PCP and OFPAT11_SET_VLAN_PCP. */ +struct ofpact_vlan_pcp { + struct ofpact ofpact; + uint8_t vlan_pcp; /* VLAN PCP in low 3 bits, 0 in other bits. */ + bool push_vlan_if_needed; /* OF 1.0 semantics if true. */ + bool flow_has_vlan; /* VLAN present at action validation time? */ +}; + +/* OFPACT_SET_ETH_SRC, OFPACT_SET_ETH_DST. + * + * Used for OFPAT10_SET_DL_SRC, OFPAT10_SET_DL_DST. */ +struct ofpact_mac { + struct ofpact ofpact; + struct eth_addr mac; +}; + +/* OFPACT_SET_IPV4_SRC, OFPACT_SET_IPV4_DST. + * + * Used for OFPAT10_SET_NW_SRC, OFPAT10_SET_NW_DST. */ +struct ofpact_ipv4 { + struct ofpact ofpact; + ovs_be32 ipv4; +}; + +/* OFPACT_SET_IP_DSCP. + * + * Used for OFPAT10_SET_NW_TOS. */ +struct ofpact_dscp { + struct ofpact ofpact; + uint8_t dscp; /* DSCP in high 6 bits, rest ignored. */ +}; + +/* OFPACT_SET_IP_ECN. + * + * Used for OFPAT11_SET_NW_ECN. */ +struct ofpact_ecn { + struct ofpact ofpact; + uint8_t ecn; /* ECN in low 2 bits, rest ignored. */ +}; + +/* OFPACT_SET_IP_TTL. + * + * Used for OFPAT11_SET_NW_TTL. */ +struct ofpact_ip_ttl { + struct ofpact ofpact; + uint8_t ttl; +}; + +/* OFPACT_SET_L4_SRC_PORT, OFPACT_SET_L4_DST_PORT. + * + * Used for OFPAT10_SET_TP_SRC, OFPAT10_SET_TP_DST. */ +struct ofpact_l4_port { + struct ofpact ofpact; + uint16_t port; /* TCP, UDP or SCTP port number. */ + uint8_t flow_ip_proto; /* IP proto from corresponding match, or 0 */ +}; + +/* OFPACT_REG_MOVE. + * + * Used for NXAST_REG_MOVE. */ +struct ofpact_reg_move { + struct ofpact ofpact; + struct mf_subfield src; + struct mf_subfield dst; +}; + +/* OFPACT_STACK_PUSH. + * + * Used for NXAST_STACK_PUSH and NXAST_STACK_POP. */ +struct ofpact_stack { + struct ofpact ofpact; + struct mf_subfield subfield; +}; + +/* OFPACT_SET_FIELD. + * + * Used for NXAST_REG_LOAD and OFPAT12_SET_FIELD. */ +struct ofpact_set_field { + OFPACT_PADDED_MEMBERS( + struct ofpact ofpact; + bool flow_has_vlan; /* VLAN present at action validation time. */ + const struct mf_field *field; + ); + union mf_value value[]; /* Significant value bytes followed by + * significant mask bytes. */ +}; +BUILD_ASSERT_DECL(offsetof(struct ofpact_set_field, value) + % OFPACT_ALIGNTO == 0); +BUILD_ASSERT_DECL(offsetof(struct ofpact_set_field, value) + == sizeof(struct ofpact_set_field)); + +/* Use macro to not have to deal with constness. */ +#define ofpact_set_field_mask(SF) \ + ALIGNED_CAST(union mf_value *, \ + (uint8_t *)(SF)->value + (SF)->field->n_bytes) + +/* OFPACT_PUSH_VLAN/MPLS/PBB + * + * Used for NXAST_PUSH_MPLS, OFPAT11_PUSH_MPLS. */ +struct ofpact_push_mpls { + struct ofpact ofpact; + ovs_be16 ethertype; +}; + +/* OFPACT_POP_MPLS + * + * Used for NXAST_POP_MPLS, OFPAT11_POP_MPLS.. */ +struct ofpact_pop_mpls { + struct ofpact ofpact; + ovs_be16 ethertype; +}; + +/* OFPACT_SET_TUNNEL. + * + * Used for NXAST_SET_TUNNEL, NXAST_SET_TUNNEL64. */ +struct ofpact_tunnel { + struct ofpact ofpact; + uint64_t tun_id; +}; + +/* OFPACT_SET_QUEUE. + * + * Used for NXAST_SET_QUEUE. */ +struct ofpact_queue { + struct ofpact ofpact; + uint32_t queue_id; +}; + +/* OFPACT_FIN_TIMEOUT. + * + * Used for NXAST_FIN_TIMEOUT. */ +struct ofpact_fin_timeout { + struct ofpact ofpact; + uint16_t fin_idle_timeout; + uint16_t fin_hard_timeout; +}; + +/* OFPACT_WRITE_METADATA. + * + * Used for NXAST_WRITE_METADATA. */ +struct ofpact_metadata { + struct ofpact ofpact; + ovs_be64 metadata; + ovs_be64 mask; +}; + +/* OFPACT_METER. + * + * Used for OFPIT13_METER. */ +struct ofpact_meter { + struct ofpact ofpact; + uint32_t meter_id; +}; + +/* OFPACT_WRITE_ACTIONS, OFPACT_CLONE. + * + * Used for OFPIT11_WRITE_ACTIONS, NXAST_CLONE. */ +struct ofpact_nest { + OFPACT_PADDED_MEMBERS(struct ofpact ofpact;); + struct ofpact actions[]; +}; +BUILD_ASSERT_DECL(offsetof(struct ofpact_nest, actions) % OFPACT_ALIGNTO == 0); +BUILD_ASSERT_DECL(offsetof(struct ofpact_nest, actions) + == sizeof(struct ofpact_nest)); + +static inline size_t +ofpact_nest_get_action_len(const struct ofpact_nest *on) +{ + return on->ofpact.len - offsetof(struct ofpact_nest, actions); +} + +/* Bits for 'flags' in struct nx_action_conntrack. + * + * If NX_CT_F_COMMIT is set, then the connection entry is moved from the + * unconfirmed to confirmed list in the tracker. */ +enum nx_conntrack_flags { + NX_CT_F_COMMIT = 1 << 0, +}; + +/* Magic value for struct nx_action_conntrack 'recirc_table' field, to specify + * that the packet should not be recirculated. */ +#define NX_CT_RECIRC_NONE OFPTT_ALL + +#if !defined(IPPORT_FTP) +#define IPPORT_FTP 21 +#endif + +#if !defined(IPPORT_TFTP) +#define IPPORT_TFTP 69 +#endif + +/* OFPACT_CT. + * + * Used for NXAST_CT. */ +struct ofpact_conntrack { + OFPACT_PADDED_MEMBERS( + struct ofpact ofpact; + uint16_t flags; + uint16_t zone_imm; + struct mf_subfield zone_src; + uint16_t alg; + uint8_t recirc_table; + ); + struct ofpact actions[0]; +}; +BUILD_ASSERT_DECL(offsetof(struct ofpact_conntrack, actions) + % OFPACT_ALIGNTO == 0); +BUILD_ASSERT_DECL(offsetof(struct ofpact_conntrack, actions) + == sizeof(struct ofpact_conntrack)); + +static inline size_t +ofpact_ct_get_action_len(const struct ofpact_conntrack *oc) +{ + return oc->ofpact.len - offsetof(struct ofpact_conntrack, actions); +} + +void ofpacts_execute_action_set(struct ofpbuf *action_list, + const struct ofpbuf *action_set); + +/* Bits for 'flags' in struct nx_action_nat. + */ +enum nx_nat_flags { + NX_NAT_F_SRC = 1 << 0, /* Mutually exclusive with NX_NAT_F_DST. */ + NX_NAT_F_DST = 1 << 1, + NX_NAT_F_PERSISTENT = 1 << 2, + NX_NAT_F_PROTO_HASH = 1 << 3, /* Mutually exclusive with PROTO_RANDOM. */ + NX_NAT_F_PROTO_RANDOM = 1 << 4, + NX_NAT_F_MASK = (NX_NAT_F_SRC | NX_NAT_F_DST | NX_NAT_F_PERSISTENT | NX_NAT_F_PROTO_HASH | NX_NAT_F_PROTO_RANDOM) +}; + +/* OFPACT_NAT. + * + * Used for NXAST_NAT. */ +struct ofpact_nat { + struct ofpact ofpact; + uint8_t range_af; /* AF_UNSPEC, AF_INET, or AF_INET6 */ + uint16_t flags; /* NX_NAT_F_* */ + struct { + struct { + uint16_t min; + uint16_t max; + } proto; + union { + struct { + ovs_be32 min; + ovs_be32 max; + } ipv4; + struct { + struct in6_addr min; + struct in6_addr max; + } ipv6; + } addr; + } range; +}; + + +/* OFPACT_RESUBMIT. + * + * Used for NXAST_RESUBMIT, NXAST_RESUBMIT_TABLE. */ +struct ofpact_resubmit { + struct ofpact ofpact; + ofp_port_t in_port; + uint8_t table_id; +}; + +/* Bits for 'flags' in struct nx_action_learn. + * + * If NX_LEARN_F_SEND_FLOW_REM is set, then the learned flows will have their + * OFPFF_SEND_FLOW_REM flag set. + * + * If NX_LEARN_F_DELETE_LEARNED is set, then removing this action will delete + * all the flows from the learn action's 'table_id' that have the learn + * action's 'cookie'. Important points: + * + * - The deleted flows include those created by this action, those created + * by other learn actions with the same 'table_id' and 'cookie', those + * created by flow_mod requests by a controller in the specified table + * with the specified cookie, and those created through any other + * means. + * + * - If multiple flows specify "learn" actions with + * NX_LEARN_F_DELETE_LEARNED with the same 'table_id' and 'cookie', then + * no deletion occurs until all of those "learn" actions are deleted. + * + * - Deleting a flow that contains a learn action is the most obvious way + * to delete a learn action. Modifying a flow's actions, or replacing it + * by a new flow, can also delete a learn action. Finally, replacing a + * learn action with NX_LEARN_F_DELETE_LEARNED with a learn action + * without that flag also effectively deletes the learn action and can + * trigger flow deletion. + * + * NX_LEARN_F_DELETE_LEARNED was added in Open vSwitch 2.4. */ +enum nx_learn_flags { + NX_LEARN_F_SEND_FLOW_REM = 1 << 0, + NX_LEARN_F_DELETE_LEARNED = 1 << 1, +}; + +#define NX_LEARN_N_BITS_MASK 0x3ff + +#define NX_LEARN_SRC_FIELD (0 << 13) /* Copy from field. */ +#define NX_LEARN_SRC_IMMEDIATE (1 << 13) /* Copy from immediate value. */ +#define NX_LEARN_SRC_MASK (1 << 13) + +#define NX_LEARN_DST_MATCH (0 << 11) /* Add match criterion. */ +#define NX_LEARN_DST_LOAD (1 << 11) /* Add NXAST_REG_LOAD action. */ +#define NX_LEARN_DST_OUTPUT (2 << 11) /* Add OFPAT_OUTPUT action. */ +#define NX_LEARN_DST_RESERVED (3 << 11) /* Not yet defined. */ +#define NX_LEARN_DST_MASK (3 << 11) + +/* Part of struct ofpact_learn, below. */ +struct ofpact_learn_spec { + OFPACT_PADDED_MEMBERS( + struct mf_subfield src; /* NX_LEARN_SRC_FIELD only. */ + struct mf_subfield dst; /* NX_LEARN_DST_MATCH, + * NX_LEARN_DST_LOAD only. */ + uint16_t src_type; /* One of NX_LEARN_SRC_*. */ + uint16_t dst_type; /* One of NX_LEARN_DST_*. */ + uint8_t n_bits; /* Number of bits in source and dest. */ + ); + /* Followed by 'DIV_ROUND_UP(n_bits, 8)' bytes of immediate data for + * match 'dst_type's NX_LEARN_DST_MATCH and NX_LEARN_DST_LOAD when + * NX_LEARN_SRC_IMMEDIATE is set in 'src_type', followed by zeroes to align + * to OFPACT_ALIGNTO. */ +}; +BUILD_ASSERT_DECL(sizeof(struct ofpact_learn_spec) % OFPACT_ALIGNTO == 0); + +static inline const void * +ofpact_learn_spec_imm(const struct ofpact_learn_spec *spec) +{ + return spec + 1; +} + +static inline const struct ofpact_learn_spec * +ofpact_learn_spec_next(const struct ofpact_learn_spec *spec) +{ + if (spec->src_type == NX_LEARN_SRC_IMMEDIATE) { + unsigned int n_bytes = OFPACT_ALIGN(DIV_ROUND_UP(spec->n_bits, 8)); + return ALIGNED_CAST(const struct ofpact_learn_spec *, + (const uint8_t *)(spec + 1) + n_bytes); + } + return spec + 1; +} + +/* OFPACT_LEARN. + * + * Used for NXAST_LEARN. */ +struct ofpact_learn { + OFPACT_PADDED_MEMBERS( + struct ofpact ofpact; + + uint16_t idle_timeout; /* Idle time before discarding (seconds). */ + uint16_t hard_timeout; /* Max time before discarding (seconds). */ + uint16_t priority; /* Priority level of flow entry. */ + uint8_t table_id; /* Table to insert flow entry. */ + enum nx_learn_flags flags; /* NX_LEARN_F_*. */ + ovs_be64 cookie; /* Cookie for new flow. */ + uint16_t fin_idle_timeout; /* Idle timeout after FIN, if nonzero. */ + uint16_t fin_hard_timeout; /* Hard timeout after FIN, if nonzero. */ + ); + + struct ofpact_learn_spec specs[]; +}; + +static inline const struct ofpact_learn_spec * +ofpact_learn_spec_end(const struct ofpact_learn *learn) +{ + return ALIGNED_CAST(const struct ofpact_learn_spec *, + ofpact_next(&learn->ofpact)); +} + +#define OFPACT_LEARN_SPEC_FOR_EACH(SPEC, LEARN) \ + for ((SPEC) = (LEARN)->specs; \ + (SPEC) < ofpact_learn_spec_end(LEARN); \ + (SPEC) = ofpact_learn_spec_next(SPEC)) + +/* Multipath link choice algorithm to apply. + * + * In the descriptions below, 'n_links' is max_link + 1. */ +enum nx_mp_algorithm { + /* link = hash(flow) % n_links. + * + * Redistributes all traffic when n_links changes. O(1) performance. See + * RFC 2992. + * + * Use UINT16_MAX for max_link to get a raw hash value. */ + NX_MP_ALG_MODULO_N = 0, + + /* link = hash(flow) / (MAX_HASH / n_links). + * + * Redistributes between one-quarter and one-half of traffic when n_links + * changes. O(1) performance. See RFC 2992. + */ + NX_MP_ALG_HASH_THRESHOLD = 1, + + /* Highest Random Weight. + * + * for i in [0,n_links): + * weights[i] = hash(flow, i) + * link = { i such that weights[i] >= weights[j] for all j != i } + * + * Redistributes 1/n_links of traffic when n_links changes. O(n_links) + * performance. If n_links is greater than a threshold (currently 64, but + * subject to change), Open vSwitch will substitute another algorithm + * automatically. See RFC 2992. */ + NX_MP_ALG_HRW = 2, + + /* Iterative Hash. + * + * i = 0 + * repeat: + * i = i + 1 + * link = hash(flow, i) % arg + * while link > max_link + * + * Redistributes 1/n_links of traffic when n_links changes. O(1) + * performance when arg/max_link is bounded by a constant. + * + * Redistributes all traffic when arg changes. + * + * arg must be greater than max_link and for best performance should be no + * more than approximately max_link * 2. If arg is outside the acceptable + * range, Open vSwitch will automatically substitute the least power of 2 + * greater than max_link. + * + * This algorithm is specific to Open vSwitch. + */ + NX_MP_ALG_ITER_HASH = 3, +}; + +/* OFPACT_CONJUNCTION. + * + * Used for NXAST_CONJUNCTION. */ +struct ofpact_conjunction { + struct ofpact ofpact; + uint8_t clause; + uint8_t n_clauses; + uint32_t id; +}; + +/* OFPACT_MULTIPATH. + * + * Used for NXAST_MULTIPATH. */ +struct ofpact_multipath { + struct ofpact ofpact; + + /* What fields to hash and how. */ + enum nx_hash_fields fields; + uint16_t basis; /* Universal hash parameter. */ + + /* Multipath link choice algorithm to apply to hash value. */ + enum nx_mp_algorithm algorithm; + uint16_t max_link; /* Number of output links, minus 1. */ + uint32_t arg; /* Algorithm-specific argument. */ + + /* Where to store the result. */ + struct mf_subfield dst; +}; + +/* OFPACT_NOTE. + * + * Used for NXAST_NOTE. */ +struct ofpact_note { + struct ofpact ofpact; + size_t length; + uint8_t data[]; +}; + +/* Direction of sampled packets. */ +enum nx_action_sample_direction { + /* OVS will attempt to infer the sample's direction based on whether + * 'sampling_port' is the packet's output port. This is generally + * effective except when sampling happens as part of an output to a patch + * port, which doesn't involve a datapath output action. */ + NX_ACTION_SAMPLE_DEFAULT, + + /* Explicit direction. This is useful for sampling packets coming in from + * or going out of a patch port, where the direction cannot be inferred. */ + NX_ACTION_SAMPLE_INGRESS, + NX_ACTION_SAMPLE_EGRESS +}; + +/* OFPACT_SAMPLE. + * + * Used for NXAST_SAMPLE, NXAST_SAMPLE2, and NXAST_SAMPLE3. */ +struct ofpact_sample { + struct ofpact ofpact; + uint16_t probability; /* Always positive. */ + uint32_t collector_set_id; + uint32_t obs_domain_id; + uint32_t obs_point_id; + ofp_port_t sampling_port; + enum nx_action_sample_direction direction; +}; + +/* OFPACT_DEC_TTL. + * + * Used for OFPAT11_DEC_NW_TTL, NXAST_DEC_TTL and NXAST_DEC_TTL_CNT_IDS. */ +struct ofpact_cnt_ids { + struct ofpact ofpact; + + /* Controller ids. */ + unsigned int n_controllers; + uint16_t cnt_ids[]; +}; + +/* OFPACT_SET_MPLS_LABEL. + * + * Used for OFPAT11_SET_MPLS_LABEL and NXAST_SET_MPLS_LABEL */ +struct ofpact_mpls_label { + struct ofpact ofpact; + + ovs_be32 label; +}; + +/* OFPACT_SET_MPLS_TC. + * + * Used for OFPAT11_SET_MPLS_TC and NXAST_SET_MPLS_TC */ +struct ofpact_mpls_tc { + struct ofpact ofpact; + + uint8_t tc; +}; + +/* OFPACT_SET_MPLS_TTL. + * + * Used for OFPAT11_SET_MPLS_TTL and NXAST_SET_MPLS_TTL */ +struct ofpact_mpls_ttl { + struct ofpact ofpact; + + uint8_t ttl; +}; + +/* OFPACT_GOTO_TABLE + * + * Used for OFPIT11_GOTO_TABLE */ +struct ofpact_goto_table { + struct ofpact ofpact; + uint8_t table_id; +}; + +/* OFPACT_GROUP. + * + * Used for OFPAT11_GROUP. */ +struct ofpact_group { + struct ofpact ofpact; + uint32_t group_id; +}; + +/* OFPACT_UNROLL_XLATE. + * + * Used only internally. */ +struct ofpact_unroll_xlate { + struct ofpact ofpact; + + /* Metadata in xlate context, visible to controller via PACKET_INs. */ + uint8_t rule_table_id; /* 0xFF if none. */ + ovs_be64 rule_cookie; /* OVS_BE64_MAX if none. */ +}; + +/* Converting OpenFlow to ofpacts. */ +enum ofperr ofpacts_pull_openflow_actions(struct ofpbuf *openflow, + unsigned int actions_len, + enum ofp_version version, + const struct vl_mff_map *, + struct ofpbuf *ofpacts); +enum ofperr +ofpacts_pull_openflow_instructions(struct ofpbuf *openflow, + unsigned int instructions_len, + enum ofp_version version, + const struct vl_mff_map *vl_mff_map, + struct ofpbuf *ofpacts); +enum ofperr ofpacts_check(struct ofpact[], size_t ofpacts_len, + struct flow *, ofp_port_t max_ports, + uint8_t table_id, uint8_t n_tables, + enum ofputil_protocol *usable_protocols); +enum ofperr ofpacts_check_consistency(struct ofpact[], size_t ofpacts_len, + struct flow *, ofp_port_t max_ports, + uint8_t table_id, uint8_t n_tables, + enum ofputil_protocol usable_protocols); +enum ofperr ofpact_check_output_port(ofp_port_t port, ofp_port_t max_ports); + +/* Converting ofpacts to OpenFlow. */ +size_t ofpacts_put_openflow_actions(const struct ofpact[], size_t ofpacts_len, + struct ofpbuf *openflow, enum ofp_version); +void ofpacts_put_openflow_instructions(const struct ofpact[], + size_t ofpacts_len, + struct ofpbuf *openflow, + enum ofp_version ofp_version); + +/* Sets of supported actions. */ +ovs_be32 ofpact_bitmap_to_openflow(uint64_t ofpacts_bitmap, enum ofp_version); +uint64_t ofpact_bitmap_from_openflow(ovs_be32 ofpat_bitmap, enum ofp_version); +void ofpact_bitmap_format(uint64_t ofpacts_bitmap, struct ds *); + +/* Working with ofpacts. */ +bool ofpacts_output_to_port(const struct ofpact[], size_t ofpacts_len, + ofp_port_t port); +bool ofpacts_output_to_group(const struct ofpact[], size_t ofpacts_len, + uint32_t group_id); +bool ofpacts_equal(const struct ofpact a[], size_t a_len, + const struct ofpact b[], size_t b_len); +const struct mf_field *ofpact_get_mf_dst(const struct ofpact *ofpact); +uint32_t ofpacts_get_meter(const struct ofpact[], size_t ofpacts_len); + +/* Formatting and parsing ofpacts. */ +void ofpacts_format(const struct ofpact[], size_t ofpacts_len, struct ds *); +char *ofpacts_parse_actions(const char *, struct ofpbuf *ofpacts, + enum ofputil_protocol *usable_protocols) + OVS_WARN_UNUSED_RESULT; +char *ofpacts_parse_instructions(const char *, struct ofpbuf *ofpacts, + enum ofputil_protocol *usable_protocols) + OVS_WARN_UNUSED_RESULT; +const char *ofpact_name(enum ofpact_type); + +/* Internal use by the helpers below. */ +void ofpact_init(struct ofpact *, enum ofpact_type, size_t len); +void *ofpact_put(struct ofpbuf *, enum ofpact_type, size_t len); +void *ofpact_finish(struct ofpbuf *, struct ofpact *); + +/* For each OFPACT_ with a corresponding struct , this defines + * the following commonly useful functions: + * + * struct *ofpact_put_(struct ofpbuf *ofpacts); + * + * Appends a new 'ofpact', of length OFPACT__SIZE, to 'ofpacts', + * initializes it with ofpact_init_(), and returns it. Also sets + * 'ofpacts->header' to the returned action. + * + * After using this function to add a variable-length action, add the + * elements of the flexible array (e.g. with ofpbuf_put()), then use + * ofpact_finish() to pad the action to a multiple of OFPACT_ALIGNTO bytes + * and update its embedded length field. (Keep in mind the need to refresh + * the structure from 'ofpacts->header' after adding data to 'ofpacts'.) + * + * struct *ofpact_get_(const struct ofpact *ofpact); + * + * Returns 'ofpact' cast to "struct *". 'ofpact->type' must be + * OFPACT_. + * + * void ofpact_finish_(struct ofpbuf *ofpacts, struct **ap); + * + * Finishes composing variable-length action '*ap' (begun using + * ofpact_put_() on 'ofpacts'), by padding the action to a multiple + * of OFPACT_ALIGNTO bytes and updating its embedded length field. + * + * May reallocate 'ofpacts', and so as a convenience automatically updates + * '*ap' to point to the new location. If the caller has other pointers + * within 'ap' or 'ofpacts', it needs to update them manually. + * + * as well as the following more rarely useful definitions: + * + * void ofpact_init_(struct *ofpact); + * + * Initializes the parts of 'ofpact' that identify it as having type + * OFPACT_ and length OFPACT__SIZE and zeros the rest. + * + * _SIZE + * + * The size of the action structure. For a fixed-length action, this is + * sizeof(struct ) rounded up to a multiple of OFPACT_ALIGNTO. For + * a variable-length action, this is the offset to the variable-length + * part. + */ +#define OFPACT(ENUM, STRUCT, MEMBER, NAME) \ + BUILD_ASSERT_DECL(offsetof(struct STRUCT, ofpact) == 0); \ + \ + enum { OFPACT_##ENUM##_SIZE \ + = (offsetof(struct STRUCT, MEMBER) \ + ? offsetof(struct STRUCT, MEMBER) \ + : OFPACT_ALIGN(sizeof(struct STRUCT))) }; \ + \ + static inline struct STRUCT * \ + ofpact_get_##ENUM(const struct ofpact *ofpact) \ + { \ + ovs_assert(ofpact->type == OFPACT_##ENUM); \ + return ALIGNED_CAST(struct STRUCT *, ofpact); \ + } \ + \ + static inline struct STRUCT * \ + ofpact_get_##ENUM##_nullable(const struct ofpact *ofpact) \ + { \ + ovs_assert(!ofpact || ofpact->type == OFPACT_##ENUM); \ + return ALIGNED_CAST(struct STRUCT *, ofpact); \ + } \ + \ + static inline struct STRUCT * \ + ofpact_put_##ENUM(struct ofpbuf *ofpacts) \ + { \ + return ofpact_put(ofpacts, OFPACT_##ENUM, \ + OFPACT_##ENUM##_SIZE); \ + } \ + \ + static inline void \ + ofpact_init_##ENUM(struct STRUCT *ofpact) \ + { \ + ofpact_init(&ofpact->ofpact, OFPACT_##ENUM, \ + OFPACT_##ENUM##_SIZE); \ + } \ + \ + static inline void \ + ofpact_finish_##ENUM(struct ofpbuf *ofpbuf, struct STRUCT **ofpactp) \ + { \ + struct ofpact *ofpact = &(*ofpactp)->ofpact; \ + ovs_assert(ofpact->type == OFPACT_##ENUM); \ + *ofpactp = ofpact_finish(ofpbuf, ofpact); \ + } +OFPACTS +#undef OFPACT + +/* Additional functions for composing ofpacts. */ +struct ofpact_set_field *ofpact_put_set_field(struct ofpbuf *ofpacts, + const struct mf_field *, + const void *value, + const void *mask); +struct ofpact_set_field *ofpact_put_reg_load(struct ofpbuf *ofpacts, + const struct mf_field *, + const void *value, + const void *mask); +struct ofpact_set_field *ofpact_put_reg_load2(struct ofpbuf *ofpacts, + const struct mf_field *, + const void *value, + const void *mask); + +/* OpenFlow 1.1 instructions. + * The order is sorted in execution order. Not in the value of OFPIT11_xxx. + * It is enforced on parser from text string. + */ +#define OVS_INSTRUCTIONS \ + DEFINE_INST(OFPIT13_METER, \ + ofp13_instruction_meter, false, \ + "meter") \ + \ + DEFINE_INST(OFPIT11_APPLY_ACTIONS, \ + ofp11_instruction_actions, true, \ + "apply_actions") \ + \ + DEFINE_INST(OFPIT11_CLEAR_ACTIONS, \ + ofp11_instruction, false, \ + "clear_actions") \ + \ + DEFINE_INST(OFPIT11_WRITE_ACTIONS, \ + ofp11_instruction_actions, true, \ + "write_actions") \ + \ + DEFINE_INST(OFPIT11_WRITE_METADATA, \ + ofp11_instruction_write_metadata, false, \ + "write_metadata") \ + \ + DEFINE_INST(OFPIT11_GOTO_TABLE, \ + ofp11_instruction_goto_table, false, \ + "goto_table") + +enum ovs_instruction_type { +#define DEFINE_INST(ENUM, STRUCT, EXTENSIBLE, NAME) OVSINST_##ENUM, + OVS_INSTRUCTIONS +#undef DEFINE_INST +}; + +enum { +#define DEFINE_INST(ENUM, STRUCT, EXTENSIBLE, NAME) + 1 + N_OVS_INSTRUCTIONS = OVS_INSTRUCTIONS +#undef DEFINE_INST +}; + +const char *ovs_instruction_name_from_type(enum ovs_instruction_type type); +int ovs_instruction_type_from_name(const char *name); +enum ovs_instruction_type ovs_instruction_type_from_ofpact_type( + enum ofpact_type); +enum ofperr ovs_instruction_type_from_inst_type( + enum ovs_instruction_type *instruction_type, const uint16_t inst_type); + +ovs_be32 ovsinst_bitmap_to_openflow(uint32_t ovsinst_bitmap, enum ofp_version); +uint32_t ovsinst_bitmap_from_openflow(ovs_be32 ofpit_bitmap, + enum ofp_version); + +#endif /* ofp-actions.h */ diff --git a/openflow/include/openvswitch/ofp-errors.h b/openflow/include/openvswitch/ofp-errors.h new file mode 100644 index 0000000..8182581 --- /dev/null +++ b/openflow/include/openvswitch/ofp-errors.h @@ -0,0 +1,819 @@ +/* + * Copyright (c) 2008-2017 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_OFP_ERRORS_H +#define OPENVSWITCH_OFP_ERRORS_H 1 + +#include +#include +#include + +#include "openflow/openflow.h" + +struct ds; +struct ofpbuf; + +/* Error codes. + * + * We embed system errno values and OpenFlow standard and vendor extension + * error codes into the positive range of "int": + * + * - Errno values are assumed to use the range 1 through 2**30 - 1. + * + * (C and POSIX say that errno values are positive. We assume that they + * are less than 2**29. They are actually less than 65536 on at least + * Linux, FreeBSD, OpenBSD, and Windows.) + * + * - OpenFlow standard and vendor extension error codes use the range + * starting at 2**30 (OFPERR_OFS). + * + * Zero and negative values are not used. + */ + +#define OFPERR_OFS (1 << 30) + +/* OpenFlow error codes + * -------------------- + * + * The comments below are parsed by the extract-ofp-errors program at build + * time and used to determine the mapping between "enum ofperr" constants and + * error type/code values used in the OpenFlow protocol: + * + * - The first part of each comment specifies the vendor, OpenFlow versions, + * type, and sometimes a code for each protocol that supports the error: + * + * # The vendor is OF for standard OpenFlow error codes. Otherwise it + * is one of the *_VENDOR_ID codes defined in openflow-common.h. + * + * # The version can specify a specific OpenFlow version, a version + * range delimited by "-", or an open-ended range with "+". + * + * # Standard OpenFlow errors have both a type and a code. Extension + * errors generally have only a type, no code. There is one + * exception: Nicira extension (NX) errors for OpenFlow 1.0 and 1.1 + * have both a type and a code. (This means that the version + * specification for NX errors may not include version 1.0 or 1.1 (or + * both) along with version 1.2 or later, because the requirements + * for those versions are different.) + * + * - Additional text is a human-readable description of the meaning of each + * error, used to explain the error to the user. Any text enclosed in + * square brackets is omitted; this can be used to explain rationale for + * choice of error codes in the case where this is desirable. + * + * + * Expected duplications + * --------------------- + * + * Occasionally, in one version of OpenFlow a single named error can indicate + * two or more distinct errors, then a later version of OpenFlow splits those + * meanings into different error codes. When that happens, both errors are + * assigned the same value in the earlier version. That is ordinarily a + * mistake, so the build system reports an error. When that happens, add the + * error message to the list of "Expected duplications" below to suppress the + * error. In such a case, the named error defined earlier is how OVS + * interprets the earlier, merged form of the error. + * + * For example, OpenFlow 1.1 defined (3,5) as OFPBIC_UNSUP_EXP_INST, then + * OpenFlow 1.2 broke this error into OFPBIC_BAD_EXPERIMENTER as (3,5) and + * OFPBIC_BAD_EXT_TYPE as (3,6). To allow the OVS code to report just a single + * error code, instead of protocol version dependent errors, this list of + * errors only lists the latter two errors, giving both of them the same code + * (3,5) for OpenFlow 1.1. Then, when OVS serializes either error into + * OpenFlow 1.1, it uses the same code (3,5). In the other direction, when OVS + * deserializes (3,5) from OpenFlow 1.1, it translates it into + * OFPBIC_BAD_EXPERIMENTER (because its definition precedes that of + * OFPBIC_BAD_EXT_TYPE below). See the "encoding OFPBIC_* experimenter errors" + * and "decoding OFPBIC_* experimenter errors" tests in tests/ofp-errors.at for + * full details. + */ +enum ofperr { +/* Expected duplications. */ + + /* Expected: 0x0,3,5 in OF1.1 means both OFPBIC_BAD_EXPERIMENTER and + * OFPBIC_BAD_EXP_TYPE. */ + + /* Expected: 0x0,1,5 in OF1.0 means both OFPBRC_EPERM and + * OFPBRC_IS_SLAVE. */ + + /* Expected: 0x0,1,5 in OF1.1 means both OFPBRC_EPERM and + * OFPBRC_IS_SLAVE. */ + +/* ## ------------------ ## */ +/* ## OFPET_HELLO_FAILED ## */ +/* ## ------------------ ## */ + + /* OF1.0+(0,0). No compatible version. */ + OFPERR_OFPHFC_INCOMPATIBLE = OFPERR_OFS, + + /* OF1.0+(0,1). Permissions error. */ + OFPERR_OFPHFC_EPERM, + +/* ## ----------------- ## */ +/* ## OFPET_BAD_REQUEST ## */ +/* ## ----------------- ## */ + + /* OF1.0+(1,0). ofp_header.version not supported. */ + OFPERR_OFPBRC_BAD_VERSION, + + /* OF1.0+(1,1). ofp_header.type not supported. */ + OFPERR_OFPBRC_BAD_TYPE, + + /* OF1.0+(1,2). ofp_stats_msg.type not supported. */ + OFPERR_OFPBRC_BAD_STAT, + + /* OF1.0+(1,3). Vendor not supported (in ofp_vendor_header or + * ofp_stats_msg). */ + OFPERR_OFPBRC_BAD_VENDOR, + + /* OF1.0+(1,4). Vendor subtype not supported. */ + OFPERR_OFPBRC_BAD_SUBTYPE, + + /* OF1.0+(1,5). Permissions error. */ + OFPERR_OFPBRC_EPERM, + + /* OF1.0+(1,6). Wrong request length for type. */ + OFPERR_OFPBRC_BAD_LEN, + + /* OF1.0+(1,7). Specified buffer has already been used. */ + OFPERR_OFPBRC_BUFFER_EMPTY, + + /* OF1.0+(1,8). Specified buffer does not exist. */ + OFPERR_OFPBRC_BUFFER_UNKNOWN, + + /* NX1.0(1,512), OF1.1+(1,9). Specified table-id invalid or does not exist. + * [ A non-standard error (1,512), formerly OFPERR_NXBRC_BAD_TABLE_ID, + * is used for OpenFlow 1.0 as there seems to be no appropriate error + * code defined the specification. ] */ + OFPERR_OFPBRC_BAD_TABLE_ID, + + /* OF1.0-1.1(1,5), OF1.2+(1,10). Denied because controller is slave. */ + OFPERR_OFPBRC_IS_SLAVE, + + /* NX1.0-1.1(1,514), OF1.2+(1,11). Invalid port. [ A non-standard error + * (1,514), formerly OFPERR_NXBRC_BAD_IN_PORT is used for OpenFlow 1.0 and + * 1.1 as there seems to be no appropriate error code defined the + * specifications. ] */ + OFPERR_OFPBRC_BAD_PORT, + + /* OF1.2+(1,12). Invalid packet in packet-out. */ + OFPERR_OFPBRC_BAD_PACKET, + + /* OF1.3+(1,13). Multipart request overflowed the assigned buffer. */ + OFPERR_OFPBRC_MULTIPART_BUFFER_OVERFLOW, + + /* NX1.0-1.1(1,256), NX1.2+(2). Invalid NXM flow match. */ + OFPERR_NXBRC_NXM_INVALID, + + /* NX1.0-1.1(1,257), NX1.2+(3). The nxm_type, or nxm_type taken in + * combination with nxm_hasmask or nxm_length or both, is invalid or not + * implemented. */ + OFPERR_NXBRC_NXM_BAD_TYPE, + + /* NX1.0-1.1(1,515), NX1.2+(4). Must-be-zero field had nonzero value. */ + OFPERR_NXBRC_MUST_BE_ZERO, + + /* NX1.0-1.1(1,516), NX1.2+(5). The reason in an ofp_port_status message + * is not valid. */ + OFPERR_NXBRC_BAD_REASON, + + /* NX1.0-1.1(1,520), NX1.2+(9). The 'event' in an NXST_FLOW_MONITOR reply + * does not specify one of the NXFME_ABBREV, NXFME_ADD, NXFME_DELETE, or + * NXFME_MODIFY. */ + OFPERR_NXBRC_FM_BAD_EVENT, + + /* NX1.0-1.1(1,521), NX1.2+(10). The error that occurred cannot be + * represented in this OpenFlow version. */ + OFPERR_NXBRC_UNENCODABLE_ERROR, + +/* ## ---------------- ## */ +/* ## OFPET_BAD_ACTION ## */ +/* ## ---------------- ## */ + + /* OF1.0+(2,0). Unknown action type. */ + OFPERR_OFPBAC_BAD_TYPE, + + /* OF1.0+(2,1). Length problem in actions. */ + OFPERR_OFPBAC_BAD_LEN, + + /* OF1.0+(2,2). Unknown experimenter id specified. */ + OFPERR_OFPBAC_BAD_VENDOR, + + /* OF1.0+(2,3). Unknown action type for experimenter id. */ + OFPERR_OFPBAC_BAD_VENDOR_TYPE, + + /* OF1.0+(2,4). Problem validating output port. */ + OFPERR_OFPBAC_BAD_OUT_PORT, + + /* OF1.0+(2,5). Bad action argument. */ + OFPERR_OFPBAC_BAD_ARGUMENT, + + /* OF1.0+(2,6). Permissions error. */ + OFPERR_OFPBAC_EPERM, + + /* OF1.0+(2,7). Can't handle this many actions. */ + OFPERR_OFPBAC_TOO_MANY, + + /* OF1.0+(2,8). Problem validating output queue. */ + OFPERR_OFPBAC_BAD_QUEUE, + + /* OF1.1+(2,9). Invalid group id in forward action. */ + OFPERR_OFPBAC_BAD_OUT_GROUP, + + /* NX1.0(1,522), OF1.1+(2,10). Action can't apply for this match or a + * prerequisite for use of this field is unmet. */ + OFPERR_OFPBAC_MATCH_INCONSISTENT, + + /* OF1.1+(2,11). Action order is unsupported for the action list in an + * Apply-Actions instruction */ + OFPERR_OFPBAC_UNSUPPORTED_ORDER, + + /* OF1.1+(2,12). Actions uses an unsupported tag/encap. */ + OFPERR_OFPBAC_BAD_TAG, + + /* NX1.0-1.1(1,523), OF1.2+(2,13). Action uses unknown or unsupported OXM + * or NXM field. */ + OFPERR_OFPBAC_BAD_SET_TYPE, + + /* NX1.0-1.1(1,524), OF1.2+(2,14). Action references past the end of an + * OXM or NXM field, or uses a length of zero. */ + OFPERR_OFPBAC_BAD_SET_LEN, + + /* NX1.0-1.1(1,525), OF1.2+(2,15). Action sets a field to an invalid or + * unsupported value, or modifies a read-only field. */ + OFPERR_OFPBAC_BAD_SET_ARGUMENT, + + /* ONF1.3-1.4(4250), OF1.5+(2,16). Field in Set-Field action has Has-Mask + * bit set to 1. */ + OFPERR_OFPBAC_BAD_SET_MASK, + + /* NX1.0-1.1(2,256), NX1.2+(11). Must-be-zero action argument had nonzero + * value. */ + OFPERR_NXBAC_MUST_BE_ZERO, + + /* NX1.0-1.1(2,526), NX1.2+(15). Conjunction action must be only action + * present. conjunction(id, k/n) must satisfy 1 <= k <= n and 2 <= n <= + * 64. */ + OFPERR_NXBAC_BAD_CONJUNCTION, + +/* ## --------------------- ## */ +/* ## OFPET_BAD_INSTRUCTION ## */ +/* ## --------------------- ## */ + + /* OF1.1+(3,0). Unknown instruction. */ + OFPERR_OFPBIC_UNKNOWN_INST, + + /* NX1.0(2,257), OF1.1+(3,1). Switch or table does not support the + * instruction. */ + OFPERR_OFPBIC_UNSUP_INST, + + /* OF1.1+(3,2). Invalid Table-ID specified. */ + OFPERR_OFPBIC_BAD_TABLE_ID, + + /* OF1.1+(3,3). Metadata value unsupported by datapath. */ + OFPERR_OFPBIC_UNSUP_METADATA, + + /* OF1.1+(3,4). Metadata mask value unsupported by datapath. */ + OFPERR_OFPBIC_UNSUP_METADATA_MASK, + + /* OF1.1+(3,5). Unknown experimenter id specified. */ + OFPERR_OFPBIC_BAD_EXPERIMENTER, + + /* OF1.1(3,5), OF1.2+(3,6). Unknown instruction for experimenter id. */ + OFPERR_OFPBIC_BAD_EXP_TYPE, + + /* OF1.2+(3,7). Length problem in instructions. */ + OFPERR_OFPBIC_BAD_LEN, + + /* OF1.2+(3,8). Permissions error. */ + OFPERR_OFPBIC_EPERM, + + /* NX1.1(3,256), ONF1.2-1.3(2600), OF1.4+(3,9). Duplicate instruction. */ + OFPERR_OFPBIC_DUP_INST, + +/* ## --------------- ## */ +/* ## OFPET_BAD_MATCH ## */ +/* ## --------------- ## */ + + /* OF1.1+(4,0). Unsupported match type specified by the match */ + OFPERR_OFPBMC_BAD_TYPE, + + /* OF1.1+(4,1). Length problem in match. */ + OFPERR_OFPBMC_BAD_LEN, + + /* OF1.1+(4,2). Match uses an unsupported tag/encap. */ + OFPERR_OFPBMC_BAD_TAG, + + /* OF1.1+(4,3). Unsupported datalink addr mask - switch does not support + * arbitrary datalink address mask. */ + OFPERR_OFPBMC_BAD_DL_ADDR_MASK, + + /* OF1.1+(4,4). Unsupported network addr mask - switch does not support + * arbitrary network address mask. */ + OFPERR_OFPBMC_BAD_NW_ADDR_MASK, + + /* NX1.0(1,262), OF1.1+(4,5). Unsupported wildcard specified in the + * match. */ + OFPERR_OFPBMC_BAD_WILDCARDS, + + /* NX1.0(0,263), OF1.1+(4,6). Unsupported field in the match. */ + OFPERR_OFPBMC_BAD_FIELD, + + /* NX1.0(1,258), OF1.1+(4,7). Unsupported value in a match + * field. */ + OFPERR_OFPBMC_BAD_VALUE, + + /* NX1.0-1.1(1,259), OF1.2+(4,8). Unsupported mask specified in the match, + * field is not dl-address or nw-address. */ + OFPERR_OFPBMC_BAD_MASK, + + /* NX1.0-1.1(1,260), OF1.2+(4,9). A prerequisite was not met. */ + OFPERR_OFPBMC_BAD_PREREQ, + + /* NX1.0-1.1(1,261), OF1.2+(4,10). A field type was duplicated. */ + OFPERR_OFPBMC_DUP_FIELD, + + /* OF1.2+(4,11). Permissions error. */ + OFPERR_OFPBMC_EPERM, + +/* ## --------------------- ## */ +/* ## OFPET_FLOW_MOD_FAILED ## */ +/* ## --------------------- ## */ + + /* OF1.1+(5,0). Unspecified error. */ + OFPERR_OFPFMFC_UNKNOWN, + + /* OF1.0(3,0), OF1.1+(5,1). Flow not added because of full table(s). */ + OFPERR_OFPFMFC_TABLE_FULL, + + /* OF1.1+(5,2). Table does not exist */ + OFPERR_OFPFMFC_BAD_TABLE_ID, + + /* OF1.0(3,1), OF1.1+(5,3). Attempted to add overlapping flow with + * CHECK_OVERLAP flag set. */ + OFPERR_OFPFMFC_OVERLAP, + + /* OF1.0(3,2), OF1.1+(5,4). Permissions error. */ + OFPERR_OFPFMFC_EPERM, + + /* OF1.1+(5,5). Flow not added because of unsupported idle/hard + * timeout. */ + OFPERR_OFPFMFC_BAD_TIMEOUT, + + /* OF1.0(3,3). Flow not added because of non-zero idle/hard timeout. */ + OFPERR_OFPFMFC_BAD_EMERG_TIMEOUT, + + /* OF1.0(3,4), OF1.1+(5,6). Unsupported or unknown command. */ + OFPERR_OFPFMFC_BAD_COMMAND, + + /* NX1.0(3,258), NX1.1(5,258), OF1.2+(5,7). Unsupported or unknown + * flags. */ + OFPERR_OFPFMFC_BAD_FLAGS, + + /* OF1.0(3,5). Unsupported action list - cannot process in the order + * specified. */ + OFPERR_OFPFMFC_UNSUPPORTED, + + /* NX1.0-1.1(5,256), NX1.2+(12). Generic hardware error. */ + OFPERR_NXFMFC_HARDWARE, + + /* NX1.0-1.1(5,257), NX1.2+(13). A nonexistent table ID was specified in + * the "command" field of struct ofp_flow_mod, when the + * nxt_flow_mod_table_id extension is enabled. */ + OFPERR_NXFMFC_BAD_TABLE_ID, + + /* NX1.0-1.1(1,536), NX1.2+(37). Attempted to add a flow with an invalid + * variable length meta-flow field. */ + OFPERR_NXFMFC_INVALID_TLV_FIELD, + +/* ## ---------------------- ## */ +/* ## OFPET_GROUP_MOD_FAILED ## */ +/* ## ---------------------- ## */ + + /* OF1.1+(6,0). Group not added because a group ADD attempted to replace + * an already-present group. */ + OFPERR_OFPGMFC_GROUP_EXISTS, + + /* OF1.1+(6,1). Group not added because Group specified is invalid. */ + OFPERR_OFPGMFC_INVALID_GROUP, + + /* OF1.1+(6,2). Switch does not support unequal load sharing with select + * groups. */ + OFPERR_OFPGMFC_WEIGHT_UNSUPPORTED, + + /* OF1.1+(6,3). The group table is full. */ + OFPERR_OFPGMFC_OUT_OF_GROUPS, + + /* OF1.1+(6,4). The maximum number of action buckets for a group has been + * exceeded. */ + OFPERR_OFPGMFC_OUT_OF_BUCKETS, + + /* OF1.1+(6,5). Switch does not support groups that forward to groups. */ + OFPERR_OFPGMFC_CHAINING_UNSUPPORTED, + + /* OF1.1+(6,6). This group cannot watch the watch_port or watch_group + * specified. */ + OFPERR_OFPGMFC_WATCH_UNSUPPORTED, + + /* OF1.1+(6,7). Group entry would cause a loop. */ + OFPERR_OFPGMFC_LOOP, + + /* OF1.1+(6,8). Group not modified because a group MODIFY attempted to + * modify a non-existent group. */ + OFPERR_OFPGMFC_UNKNOWN_GROUP, + + /* OF1.2+(6,9). Group not deleted because another + group is forwarding to it. */ + OFPERR_OFPGMFC_CHAINED_GROUP, + + /* OF1.2+(6,10). Unsupported or unknown group type. */ + OFPERR_OFPGMFC_BAD_TYPE, + + /* OF1.2+(6,11). Unsupported or unknown command. */ + OFPERR_OFPGMFC_BAD_COMMAND, + + /* OF1.2+(6,12). Error in bucket. */ + OFPERR_OFPGMFC_BAD_BUCKET, + + /* OF1.2+(6,13). Error in watch port/group. */ + OFPERR_OFPGMFC_BAD_WATCH, + + /* OF1.2+(6,14). Permissions error. */ + OFPERR_OFPGMFC_EPERM, + + /* OF1.5+(6,15). Invalid bucket identifier used in + * INSERT BUCKET or REMOVE BUCKET command. */ + OFPERR_OFPGMFC_UNKNOWN_BUCKET, + + /* OF1.5+(6,16). Can't insert bucket because a bucket + * already exist with that bucket-id. */ + OFPERR_OFPGMFC_BUCKET_EXISTS, + +/* ## --------------------- ## */ +/* ## OFPET_PORT_MOD_FAILED ## */ +/* ## --------------------- ## */ + + /* OF1.0(4,0), OF1.1+(7,0). Specified port does not exist. */ + OFPERR_OFPPMFC_BAD_PORT, + + /* OF1.0(4,1), OF1.1+(7,1). Specified hardware address does not match the + * port number. */ + OFPERR_OFPPMFC_BAD_HW_ADDR, + + /* OF1.1+(7,2). Specified config is invalid. */ + OFPERR_OFPPMFC_BAD_CONFIG, + + /* OF1.1+(7,3). Specified advertise is invalid. */ + OFPERR_OFPPMFC_BAD_ADVERTISE, + + /* OF1.2+(7,4). Permissions error. */ + OFPERR_OFPPMFC_EPERM, + +/* ## ---------------------- ## */ +/* ## OFPET_TABLE_MOD_FAILED ## */ +/* ## ---------------------- ## */ + + /* OF1.1+(8,0). Specified table does not exist. */ + OFPERR_OFPTMFC_BAD_TABLE, + + /* OF1.1+(8,1). Specified config is invalid. */ + OFPERR_OFPTMFC_BAD_CONFIG, + + /* OF1.2+(8,2). Permissions error. */ + OFPERR_OFPTMFC_EPERM, + +/* ## --------------------- ## */ +/* ## OFPET_QUEUE_OP_FAILED ## */ +/* ## --------------------- ## */ + + /* OF1.0(5,0), OF1.1+(9,0). Invalid port (or port does not exist). */ + OFPERR_OFPQOFC_BAD_PORT, + + /* OF1.0(5,1), OF1.1+(9,1). Queue does not exist. */ + OFPERR_OFPQOFC_BAD_QUEUE, + + /* OF1.0(5,2), OF1.1+(9,2). Permissions error. */ + OFPERR_OFPQOFC_EPERM, + + /* NX1.4+(23). System error retrieving queue details. */ + OFPERR_NXQOFC_QUEUE_ERROR, + +/* ## -------------------------- ## */ +/* ## OFPET_SWITCH_CONFIG_FAILED ## */ +/* ## -------------------------- ## */ + + /* OF1.1+(10,0). Specified flags is invalid. */ + OFPERR_OFPSCFC_BAD_FLAGS, + + /* OF1.1+(10,1). Specified len is invalid. */ + OFPERR_OFPSCFC_BAD_LEN, + + /* OF1.2+(10,2). Permissions error. */ + OFPERR_OFPSCFC_EPERM, + +/* ## ------------------------- ## */ +/* ## OFPET_ROLE_REQUEST_FAILED ## */ +/* ## ------------------------- ## */ + + /* OF1.2+(11,0). Stale Message: old generation_id. */ + OFPERR_OFPRRFC_STALE, + + /* OF1.2+(11,1). Controller role change unsupported. */ + OFPERR_OFPRRFC_UNSUP, + + /* NX1.0-1.1(1,513), OF1.2+(11,2). Invalid role. */ + OFPERR_OFPRRFC_BAD_ROLE, + +/* ## ---------------------- ## */ +/* ## OFPET_METER_MOD_FAILED ## */ +/* ## ---------------------- ## */ + + /* OF1.3+(12,0). Unspecified error. */ + OFPERR_OFPMMFC_UNKNOWN, + + /* OF1.3+(12,1). Meter not added because a Meter ADD attempted to + * replace an existing Meter. */ + OFPERR_OFPMMFC_METER_EXISTS, + + /* OF1.3+(12,2). Meter not added because Meter specified is invalid. */ + OFPERR_OFPMMFC_INVALID_METER, + + /* OF1.3+(12,3). Meter not modified because a Meter MODIFY attempted + * to modify a non-existent Meter. */ + OFPERR_OFPMMFC_UNKNOWN_METER, + + /* OF1.3+(12,4). Unsupported or unknown command. */ + OFPERR_OFPMMFC_BAD_COMMAND, + + /* OF1.3+(12,5). Flag configuration unsupported. */ + OFPERR_OFPMMFC_BAD_FLAGS, + + /* OF1.3+(12,6). Rate unsupported. */ + OFPERR_OFPMMFC_BAD_RATE, + + /* OF1.3+(12,7). Burst size unsupported. */ + OFPERR_OFPMMFC_BAD_BURST, + + /* OF1.3+(12,8). Band unsupported. */ + OFPERR_OFPMMFC_BAD_BAND, + + /* OF1.3+(12,9). Band value unsupported. */ + OFPERR_OFPMMFC_BAD_BAND_VALUE, + + /* OF1.3+(12,10). No more meters available. */ + OFPERR_OFPMMFC_OUT_OF_METERS, + + /* OF1.3+(12,11). The maximum number of properties for a meter has + * been exceeded. */ + OFPERR_OFPMMFC_OUT_OF_BANDS, + +/* ## --------------------------- ## */ +/* ## OFPET_TABLE_FEATURES_FAILED ## */ +/* ## --------------------------- ## */ + + /* OF1.3+(13,0). Specified table does not exist. */ + OFPERR_OFPTFFC_BAD_TABLE, + + /* OF1.3+(13,1). Invalid metadata mask. */ + OFPERR_OFPTFFC_BAD_METADATA, + + /* OF1.3+(13,5). Permissions error. */ + OFPERR_OFPTFFC_EPERM, + +/* ## ------------------ ## */ +/* ## OFPET_BAD_PROPERTY ## */ +/* ## ------------------ ## */ + + /* NX1.0-1.1(13,2), NX1.2(25), OF1.3(13,2), OF1.4+(14,0). Unknown property + * type. + * + * [Known as OFPTFFC_BAD_TYPE in OF1.3.] */ + OFPERR_OFPBPC_BAD_TYPE, + + /* NX1.0-1.1(13,3), NX1.2(26), OF1.3(13,3), OF1.4+(14,1). Length problem + * in property. + * + * [Known as OFPTFFC_BAD_LEN in OF1.3.] */ + OFPERR_OFPBPC_BAD_LEN, + + /* NX1.0-1.1(13,4), NX1.2(27), OF1.3(13,4), OF1.4+(14,2). Unsupported + * property value. + * + * [Known as OFPTFFC_BAD_ARGUMENT in OF1.3.] */ + OFPERR_OFPBPC_BAD_VALUE, + + /* NX1.0-1.1(14,3), NX1.2(28), ONF1.3(4443), OF1.4+(14,3). Can't handle + * this many properties. */ + OFPERR_OFPBPC_TOO_MANY, + + /* NX1.0-1.1(14,4), NX1.2(29), ONF1.3(4444), OF1.4+(14,4). A property type + * was duplicated. */ + OFPERR_OFPBPC_DUP_TYPE, + + /* NX1.0-1.1(14,5), NX1.2(30), ONF1.3(4445), OF1.4+(14,5). Unknown + * experimenter id specified. */ + OFPERR_OFPBPC_BAD_EXPERIMENTER, + + /* NX1.0-1.1(14,6), NX1.2(31), ONF1.3(4446), OF1.4+(14,6). Unknown + * exp_type for experimenter id. */ + OFPERR_OFPBPC_BAD_EXP_TYPE, + + /* NX1.0-1.1(14,7), NX1.2(32), ONF1.3(4447), OF1.4+(14,7). Unknown value + * for experimenter id. */ + OFPERR_OFPBPC_BAD_EXP_VALUE, + + /* NX1.0-1.1(14,8), NX1.2(33), ONF1.3(4448), OF1.4+(14,8). Permissions + * error. */ + OFPERR_OFPBPC_EPERM, + +/* ## -------------------------- ## */ +/* ## OFPET_ASYNC_CONFIG_FAILED ## */ +/* ## -------------------------- ## */ + + /* OF1.4+(15,0). One mask is invalid. */ + OFPERR_OFPACFC_INVALID, + + /* OF1.4+(15,1). Requested configuration not supported. */ + OFPERR_OFPACFC_UNSUPPORTED, + + /* OF1.4+(15,2). Permissions error. */ + OFPERR_OFPACFC_EPERM, + +/* ## -------------------- ## */ +/* ## OFPET_BUNDLE_FAILED ## */ +/* ## -------------------- ## */ + + /* ONF1.3(2300), OF1.4+(17,0). Unspecified error. */ + OFPERR_OFPBFC_UNKNOWN, + + /* ONF1.3(2301), OF1.4+(17,1). Permissions error. */ + OFPERR_OFPBFC_EPERM, + + /* ONF1.3(2302), OF1.4+(17,2). Bundle ID doesn't exist. */ + OFPERR_OFPBFC_BAD_ID, + + /* ONF1.3(2303), OF1.4+(17,3). Bundle ID already exists. */ + OFPERR_OFPBFC_BUNDLE_EXIST, + + /* ONF1.3(2304), OF1.4+(17,4). Bundle ID is closed. */ + OFPERR_OFPBFC_BUNDLE_CLOSED, + + /* ONF1.3(2305), OF1.4+(17,5). Too many bundle IDs. */ + OFPERR_OFPBFC_OUT_OF_BUNDLES, + + /* ONF1.3(2306), OF1.4+(17,6). Unsupported of unknown message control + * type. */ + OFPERR_OFPBFC_BAD_TYPE, + + /* ONF1.3(2307), OF1.4+(17,7). Unsupported, unknown, or inconsistent + * flags. */ + OFPERR_OFPBFC_BAD_FLAGS, + + /* ONF1.3(2308), OF1.4+(17,8). Length problem in included message. */ + OFPERR_OFPBFC_MSG_BAD_LEN, + + /* ONF1.3(2309), OF1.4+(17,9). Inconsistent or duplicate XID. */ + OFPERR_OFPBFC_MSG_BAD_XID, + + /* ONF1.3(2310), OF1.4+(17,10). Unsupported message in this bundle. */ + OFPERR_OFPBFC_MSG_UNSUP, + + /* ONF1.3(2311), OF1.4+(17,11). Unsupported message combination in this + * bundle. */ + OFPERR_OFPBFC_MSG_CONFLICT, + + /* ONF1.3(2312), OF1.4+(17,12). Cant handle this many messages in + * bundle. */ + OFPERR_OFPBFC_MSG_TOO_MANY, + + /* ONF1.3(2313), OF1.4+(17,13). One message in bundle failed. */ + OFPERR_OFPBFC_MSG_FAILED, + + /* ONF1.3(2314), OF1.4+(17,14). Bundle is taking too long. */ + OFPERR_OFPBFC_TIMEOUT, + + /* ONF1.3(2315), OF1.4+(17,15). Bundle is locking the resource. */ + OFPERR_OFPBFC_BUNDLE_IN_PROGRESS, + + /* NX1.4-1.5(22), OF1.6+(17,19). In an OFPT_BUNDLE_ADD_MESSAGE, the + * OpenFlow version in the inner and outer messages differ. */ + OFPERR_OFPBFC_BAD_VERSION, + +/* ## ------------------------- ## */ +/* ## OFPET_FLOW_MONITOR_FAILED ## */ +/* ## ------------------------- ## */ + + /* OF1.4+(16,0). Unspecified error. */ + OFPERR_OFPMOFC_UNKNOWN, + + /* NX1.0-1.1(1,517), NX1.2-1.3(6), OF1.4+(16,1). Monitor not added + * because a Monitor ADD attempted to replace an existing Monitor. */ + OFPERR_OFPMOFC_MONITOR_EXISTS, + + /* OF1.4+(16,2). Monitor not added because + * Monitor specified is invalid. */ + OFPERR_OFPMOFC_INVALID_MONITOR, + + /* NX1.0-1.1(1,519), NX1.2-1.3(8), OF1.4+(16,3). Monitor not modified + * because a Monitor MODIFY attempted to modify a non-existent Monitor. */ + OFPERR_OFPMOFC_UNKNOWN_MONITOR, + + /* OF1.4+(16,4). Unsupported or unknown command. */ + OFPERR_OFPMOFC_BAD_COMMAND, + + /* NX1.0-1.1(1,518), NX1.2-1.3(7), OF1.4+(16,5). Flag configuration + * unsupported. */ + OFPERR_OFPMOFC_BAD_FLAGS, + + /* OF1.4+(16,6). Specified table does not exist. */ + OFPERR_OFPMOFC_BAD_TABLE_ID, + + /* OF1.4+(16,7). Error in output port/group. */ + OFPERR_OFPMOFC_BAD_OUT, + +/* ## ----------------------------- ## */ +/* ## OFPET_TLV_TABLE_MOD_FAILED ## */ +/* ## ----------------------------- ## */ + + /* NX1.0-1.1(1,527), NX1.2+(16). The TLV table mod command is not + * recognized as a valid operation. */ + OFPERR_NXTTMFC_BAD_COMMAND, + + /* NX1.0-1.1(1,528), NX1.2+(17). The option length is not a valid + * option size for TLVs. */ + OFPERR_NXTTMFC_BAD_OPT_LEN, + + /* NX1.0-1.1(1,529), NX1.2+(18). The field index is out of range for + * the supported NX_TUN_METADATA match. */ + OFPERR_NXTTMFC_BAD_FIELD_IDX, + + /* NX1.0-1.1(1,530), NX1.2+(19). The total set of configured options + * exceeds the maximum supported by the switch. */ + OFPERR_NXTTMFC_TABLE_FULL, + + /* NX1.0-1.1(1,531), NX1.2+(20). The controller issued an NXTTMC_ADD + * command for a field index that is already mapped. */ + OFPERR_NXTTMFC_ALREADY_MAPPED, + + /* NX1.0-1.1(1,532), NX1.2+(21). The option TLV that is attempting + * to be mapped is the same as one assigned to a different field. */ + OFPERR_NXTTMFC_DUP_ENTRY, + +/* ## ---------- ## */ +/* ## NXT_RESUME ## */ +/* ## ---------- ## */ + + /* NX1.0-1.1(1,533), NX1.2+(34). This datapath doesn't support + * NXT_RESUME. */ + OFPERR_NXR_NOT_SUPPORTED, + + /* NX1.0-1.1(1,534), NX1.2+(35). Continuation is stale: Open vSwitch + * process has been restarted or bridge has been destroyed since + * continuation was generated, or continuation was not generated by this + * Open vSwitch instance. */ + OFPERR_NXR_STALE, + +/* ## ---------- ## */ +/* ## NXT_STATS ## */ +/* ## ---------- ## */ + + /* NX1.0-1.1(1,535), NX1.2+(36). Protocol is not configured on this + * Open vSwitch instance. */ + OFPERR_NXST_NOT_CONFIGURED, +}; + +const char *ofperr_domain_get_name(enum ofp_version); + +bool ofperr_is_valid(enum ofperr); + +enum ofperr ofperr_from_name(const char *); + +enum ofperr ofperr_decode_msg(const struct ofp_header *, + struct ofpbuf *payload); +struct ofpbuf *ofperr_encode_reply(enum ofperr, const struct ofp_header *); +struct ofpbuf *ofperr_encode_hello(enum ofperr, enum ofp_version ofp_version, + const char *); +int ofperr_get_vendor(enum ofperr, enum ofp_version); +int ofperr_get_type(enum ofperr, enum ofp_version); +int ofperr_get_code(enum ofperr, enum ofp_version); + +const char *ofperr_get_name(enum ofperr); +const char *ofperr_get_description(enum ofperr); + +void ofperr_format(struct ds *, enum ofperr); +const char *ofperr_to_string(enum ofperr); + +#endif /* ofp-errors.h */ diff --git a/openflow/include/openvswitch/ofp-msgs.h b/openflow/include/openvswitch/ofp-msgs.h new file mode 100644 index 0000000..07fd8aa --- /dev/null +++ b/openflow/include/openvswitch/ofp-msgs.h @@ -0,0 +1,771 @@ +/* + * Copyright (c) 2012, 2013, 2014, 2015, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_OFP_MSGS_H +#define OPENVSWITCH_OFP_MSGS_H 1 + +/* OpenFlow message headers abstraction. + * + * OpenFlow headers are unnecessarily complicated: + * + * - Some messages with the same meaning were renumbered between 1.0 and 1.1. + * + * - "Statistics" (aka multipart) messages have a different format from other + * messages. + * + * - The 1.0 header for statistics messages is an odd number of 32-bit words + * long, leaving 64-bit quantities in the body misaligned. The 1.1 header + * for statistics added a padding word to fix this misalignment, although + * many statistic message bodies did not change. + * + * - Vendor-defined messages have an additional header but no standard way to + * distinguish individual types of message within a given vendor. + * + * This file attempts to abstract out the differences between the various forms + * of headers. + */ + +#include "openvswitch/ofp-errors.h" +#include "openvswitch/types.h" + +struct ovs_list; + +/* Raw identifiers for OpenFlow messages. + * + * Some OpenFlow messages with similar meanings have multiple variants across + * OpenFlow versions or vendor extensions. Each variant has a different + * OFPRAW_* enumeration constant. More specifically, if two messages have + * different types, different numbers, or different arguments, then they must + * have different OFPRAW_* values. + * + * The comments here must follow a stylized form because the "extract-ofp-msgs" + * program parses them at build time to generate data tables. The syntax of + * each comment is: + * + * type versions (number): arguments. + * + * where the syntax of each part is: + * + * - type: One of the following: + * + * * OFPT: standard OpenFlow message. + * * OFPST: standard OpenFlow statistics or multipart message. + * * NXT: Nicira extension message. + * * NXST: Nicira extension statistics or multipart message. + * * ONFT: Open Networking Foundation extension message. + * * ONFST: Open Networking Foundation multipart message. + * + * As new vendors implement extensions it will make sense to expand the + * dictionary of possible types. + * + * - versions: The OpenFlow version or versions in which this message is + * supported, e.g. "1.0" or "1.1" or "1.0+". + * + * - number: + * For OFPT, the 'type' in struct ofp_header. + * For OFPST, the 'type' in struct ofp_stats_msg or ofp11_stats_msg. + * For NXT or ONFT, the 'subtype' in struct ofp_vendor_header. + * For NXST or ONFST, the 'subtype' in an appropriate vendor stats + * struct. + * + * - arguments: The types of data that follow the OpenFlow headers (the + * message "body"). This can be "void" if the message has no body. + * Otherwise, it should be a comma-separated sequence of C types. The + * last type in the sequence can end with [] if the body ends in a + * variable-length sequence. + * + * The arguments are used to validate the lengths of messages when a + * header is parsed. Any message whose length isn't valid as a length of + * the specified types will be rejected with OFPERR_OFPBRC_BAD_LEN. + * + * A few OpenFlow messages, such as OFPT_PACKET_IN, intentionally end with + * only part of a structure, up to some specified member. The syntax "up + * to " indicates this, e.g. "struct ofp11_packet_in up to data". + */ +enum ofpraw { +/* Immutable standard messages. + * + * The OpenFlow standard promises to preserve these messages and their numbers + * in future versions, so we mark them as , which covers every OpenFlow + * version numbered 0x01...0xff, rather than as OF1.0+, which covers only + * OpenFlow versions that we otherwise implement. + * + * Without here, then we would fail to decode "hello" messages that + * announce a version higher than we understand, even though there still could + * be a version in common with the peer that we do understand. The + * keyword is less useful for the other messages, because our OpenFlow channels + * accept only OpenFlow messages with a previously negotiated version. + */ + + /* OFPT (0): uint8_t[]. */ + OFPRAW_OFPT_HELLO, + + /* OFPT (1): struct ofp_error_msg, uint8_t[]. */ + OFPRAW_OFPT_ERROR, + + /* OFPT (2): uint8_t[]. */ + OFPRAW_OFPT_ECHO_REQUEST, + + /* OFPT (3): uint8_t[]. */ + OFPRAW_OFPT_ECHO_REPLY, + +/* Other standard messages. + * + * The meanings of these messages can (and often do) change from one version + * of OpenFlow to another. */ + + /* OFPT 1.0+ (5): void. */ + OFPRAW_OFPT_FEATURES_REQUEST, + + /* OFPT 1.0 (6): struct ofp_switch_features, struct ofp10_phy_port[]. */ + OFPRAW_OFPT10_FEATURES_REPLY, + /* OFPT 1.1-1.2 (6): struct ofp_switch_features, struct ofp11_port[]. */ + OFPRAW_OFPT11_FEATURES_REPLY, + /* OFPT 1.3+ (6): struct ofp_switch_features. */ + OFPRAW_OFPT13_FEATURES_REPLY, + + /* OFPT 1.0+ (7): void. */ + OFPRAW_OFPT_GET_CONFIG_REQUEST, + + /* OFPT 1.0+ (8): struct ofp_switch_config. */ + OFPRAW_OFPT_GET_CONFIG_REPLY, + + /* OFPT 1.0+ (9): struct ofp_switch_config. */ + OFPRAW_OFPT_SET_CONFIG, + + /* OFPT 1.0 (10): struct ofp10_packet_in up to data, uint8_t[]. */ + OFPRAW_OFPT10_PACKET_IN, + /* OFPT 1.1 (10): struct ofp11_packet_in, uint8_t[]. */ + OFPRAW_OFPT11_PACKET_IN, + /* OFPT 1.2 (10): struct ofp12_packet_in, uint8_t[]. */ + OFPRAW_OFPT12_PACKET_IN, + /* OFPT 1.3+ (10): struct ofp12_packet_in, ovs_be64, uint8_t[]. */ + OFPRAW_OFPT13_PACKET_IN, + /* NXT 1.0+ (17): struct nx_packet_in, uint8_t[]. */ + OFPRAW_NXT_PACKET_IN, + /* NXT 1.0+ (30): uint8_t[8][]. */ + OFPRAW_NXT_PACKET_IN2, + + /* OFPT 1.0 (11): struct ofp10_flow_removed. */ + OFPRAW_OFPT10_FLOW_REMOVED, + /* OFPT 1.1+ (11): struct ofp11_flow_removed, uint8_t[8][]. */ + OFPRAW_OFPT11_FLOW_REMOVED, + /* NXT 1.0+ (14): struct nx_flow_removed, uint8_t[8][]. */ + OFPRAW_NXT_FLOW_REMOVED, + + /* OFPT 1.0 (12): struct ofp_port_status, struct ofp10_phy_port. */ + OFPRAW_OFPT10_PORT_STATUS, + /* OFPT 1.1-1.3 (12): struct ofp_port_status, struct ofp11_port. */ + OFPRAW_OFPT11_PORT_STATUS, + /* OFPT 1.4+ (12): struct ofp_port_status, struct ofp14_port, uint8_t[8][]. */ + OFPRAW_OFPT14_PORT_STATUS, + + /* OFPT 1.0 (13): struct ofp10_packet_out, uint8_t[]. */ + OFPRAW_OFPT10_PACKET_OUT, + /* OFPT 1.1+ (13): struct ofp11_packet_out, uint8_t[]. */ + OFPRAW_OFPT11_PACKET_OUT, + + /* OFPT 1.0 (14): struct ofp10_flow_mod, uint8_t[8][]. */ + OFPRAW_OFPT10_FLOW_MOD, + /* OFPT 1.1+ (14): struct ofp11_flow_mod, struct ofp11_instruction[]. */ + OFPRAW_OFPT11_FLOW_MOD, + /* NXT 1.0+ (13): struct nx_flow_mod, uint8_t[8][]. */ + OFPRAW_NXT_FLOW_MOD, + + /* OFPT 1.1-1.4 (15): struct ofp11_group_mod, uint8_t[8][]. */ + OFPRAW_OFPT11_GROUP_MOD, + /* OFPT 1.5+ (15): struct ofp15_group_mod, uint8_t[8][]. */ + OFPRAW_OFPT15_GROUP_MOD, + + /* OFPT 1.0 (15): struct ofp10_port_mod. */ + OFPRAW_OFPT10_PORT_MOD, + /* OFPT 1.1-1.3 (16): struct ofp11_port_mod. */ + OFPRAW_OFPT11_PORT_MOD, + /* OFPT 1.4+ (16): struct ofp14_port_mod, uint8_t[8][]. */ + OFPRAW_OFPT14_PORT_MOD, + + /* OFPT 1.1-1.3 (17): struct ofp11_table_mod. */ + OFPRAW_OFPT11_TABLE_MOD, + /* OFPT 1.4+ (17): struct ofp14_table_mod, uint8_t[8][]. */ + OFPRAW_OFPT14_TABLE_MOD, + + /* OFPT 1.0 (18): void. */ + OFPRAW_OFPT10_BARRIER_REQUEST, + /* OFPT 1.1+ (20): void. */ + OFPRAW_OFPT11_BARRIER_REQUEST, + + /* OFPT 1.0 (19): void. */ + OFPRAW_OFPT10_BARRIER_REPLY, + /* OFPT 1.1+ (21): void. */ + OFPRAW_OFPT11_BARRIER_REPLY, + + /* OFPT 1.0 (20): struct ofp10_queue_get_config_request. */ + OFPRAW_OFPT10_QUEUE_GET_CONFIG_REQUEST, + /* OFPT 1.1-1.3 (22): struct ofp11_queue_get_config_request. */ + OFPRAW_OFPT11_QUEUE_GET_CONFIG_REQUEST, + + /* OFPT 1.0 (21): struct ofp10_queue_get_config_reply, uint8_t[8][]. */ + OFPRAW_OFPT10_QUEUE_GET_CONFIG_REPLY, + /* OFPT 1.1-1.3 (23): struct ofp11_queue_get_config_reply, uint8_t[8][]. */ + OFPRAW_OFPT11_QUEUE_GET_CONFIG_REPLY, + + /* OFPT 1.2+ (24): struct ofp12_role_request. */ + OFPRAW_OFPT12_ROLE_REQUEST, + /* NXT 1.0+ (10): struct nx_role_request. */ + OFPRAW_NXT_ROLE_REQUEST, + + /* OFPT 1.2+ (25): struct ofp12_role_request. */ + OFPRAW_OFPT12_ROLE_REPLY, + /* NXT 1.0+ (11): struct nx_role_request. */ + OFPRAW_NXT_ROLE_REPLY, + + /* OFPT 1.3 (26): void. */ + OFPRAW_OFPT13_GET_ASYNC_REQUEST, + /* OFPT 1.4+ (26): void. */ + OFPRAW_OFPT14_GET_ASYNC_REQUEST, + /* OFPT 1.3 (27): struct ofp13_async_config. */ + OFPRAW_OFPT13_GET_ASYNC_REPLY, + /* OFPT 1.4+ (27): uint8_t[8][]. */ + OFPRAW_OFPT14_GET_ASYNC_REPLY, + /* OFPT 1.3 (28): struct ofp13_async_config. */ + OFPRAW_OFPT13_SET_ASYNC, + /* NXT 1.0+ (19): struct nx_async_config. */ + OFPRAW_NXT_SET_ASYNC_CONFIG, + /* NXT 1.0-1.3 (27): uint8_t[8][]. */ + OFPRAW_NXT_SET_ASYNC_CONFIG2, + /* OFPT 1.4+ (28): uint8_t[8][]. */ + OFPRAW_OFPT14_SET_ASYNC, + + /* OFPT 1.3+ (29): struct ofp13_meter_mod, uint8_t[8][]. */ + OFPRAW_OFPT13_METER_MOD, + + /* OFPT 1.4+ (30): struct ofp14_role_status, uint8_t[8][]. */ + OFPRAW_OFPT14_ROLE_STATUS, + + /* OFPT 1.4+ (31): struct ofp14_table_status, uint8_t[8][]. */ + OFPRAW_OFPT14_TABLE_STATUS, + + /* OFPT 1.4+ (32): struct ofp14_requestforward, uint8_t[8][]. */ + OFPRAW_OFPT14_REQUESTFORWARD, + + /* OFPT 1.4+ (33): struct ofp14_bundle_ctrl_msg, uint8_t[8][]. */ + OFPRAW_OFPT14_BUNDLE_CONTROL, + /* ONFT 1.3 (2300): struct ofp14_bundle_ctrl_msg, uint8_t[8][]. */ + OFPRAW_ONFT13_BUNDLE_CONTROL, + + /* OFPT 1.4+ (34): struct ofp14_bundle_ctrl_msg, uint8_t[]. */ + OFPRAW_OFPT14_BUNDLE_ADD_MESSAGE, + /* ONFT 1.3 (2301): struct ofp14_bundle_ctrl_msg, uint8_t[]. */ + OFPRAW_ONFT13_BUNDLE_ADD_MESSAGE, + +/* Standard statistics. */ + + /* OFPST 1.0+ (0): void. */ + OFPRAW_OFPST_DESC_REQUEST, + + /* OFPST 1.0+ (0): struct ofp_desc_stats. */ + OFPRAW_OFPST_DESC_REPLY, + + /* OFPST 1.0 (1): struct ofp10_flow_stats_request. */ + OFPRAW_OFPST10_FLOW_REQUEST, + /* OFPST 1.1+ (1): struct ofp11_flow_stats_request, uint8_t[8][]. */ + OFPRAW_OFPST11_FLOW_REQUEST, + /* NXST 1.0 (0): struct nx_flow_stats_request, uint8_t[8][]. */ + OFPRAW_NXST_FLOW_REQUEST, + + /* OFPST 1.0 (1): uint8_t[]. */ + OFPRAW_OFPST10_FLOW_REPLY, + /* OFPST 1.1-1.2 (1): uint8_t[]. */ + OFPRAW_OFPST11_FLOW_REPLY, + /* OFPST 1.3+ (1): uint8_t[]. */ + OFPRAW_OFPST13_FLOW_REPLY, + /* NXST 1.0 (0): uint8_t[]. */ + OFPRAW_NXST_FLOW_REPLY, + + /* OFPST 1.0 (2): struct ofp10_flow_stats_request. */ + OFPRAW_OFPST10_AGGREGATE_REQUEST, + /* OFPST 1.1+ (2): struct ofp11_flow_stats_request, uint8_t[8][]. */ + OFPRAW_OFPST11_AGGREGATE_REQUEST, + /* NXST 1.0 (1): struct nx_flow_stats_request, uint8_t[8][]. */ + OFPRAW_NXST_AGGREGATE_REQUEST, + + /* OFPST 1.0+ (2): struct ofp_aggregate_stats_reply. */ + OFPRAW_OFPST_AGGREGATE_REPLY, + /* NXST 1.0 (1): struct ofp_aggregate_stats_reply. */ + OFPRAW_NXST_AGGREGATE_REPLY, + + /* OFPST 1.0+ (3): void. */ + OFPRAW_OFPST_TABLE_REQUEST, + + /* OFPST 1.0 (3): struct ofp10_table_stats[]. */ + OFPRAW_OFPST10_TABLE_REPLY, + /* OFPST 1.1 (3): struct ofp11_table_stats[]. */ + OFPRAW_OFPST11_TABLE_REPLY, + /* OFPST 1.2 (3): struct ofp12_table_stats[]. */ + OFPRAW_OFPST12_TABLE_REPLY, + /* OFPST 1.3+ (3): struct ofp13_table_stats[]. */ + OFPRAW_OFPST13_TABLE_REPLY, + + /* OFPST 1.0 (4): struct ofp10_port_stats_request. */ + OFPRAW_OFPST10_PORT_REQUEST, + /* OFPST 1.1+ (4): struct ofp11_port_stats_request. */ + OFPRAW_OFPST11_PORT_REQUEST, + + /* OFPST 1.0 (4): struct ofp10_port_stats[]. */ + OFPRAW_OFPST10_PORT_REPLY, + /* OFPST 1.1-1.2 (4): struct ofp11_port_stats[]. */ + OFPRAW_OFPST11_PORT_REPLY, + /* OFPST 1.3 (4): struct ofp13_port_stats[]. */ + OFPRAW_OFPST13_PORT_REPLY, + /* OFPST 1.4+ (4): uint8_t[8][]. */ + OFPRAW_OFPST14_PORT_REPLY, + + /* OFPST 1.0 (5): struct ofp10_queue_stats_request. */ + OFPRAW_OFPST10_QUEUE_REQUEST, + /* OFPST 1.1+ (5): struct ofp11_queue_stats_request. */ + OFPRAW_OFPST11_QUEUE_REQUEST, + + /* OFPST 1.0 (5): struct ofp10_queue_stats[]. */ + OFPRAW_OFPST10_QUEUE_REPLY, + /* OFPST 1.1-1.2 (5): struct ofp11_queue_stats[]. */ + OFPRAW_OFPST11_QUEUE_REPLY, + /* OFPST 1.3 (5): struct ofp13_queue_stats[]. */ + OFPRAW_OFPST13_QUEUE_REPLY, + /* OFPST 1.4+ (5): uint8_t[8][]. */ + OFPRAW_OFPST14_QUEUE_REPLY, + + /* OFPST 1.1+ (6): struct ofp11_group_stats_request. */ + OFPRAW_OFPST11_GROUP_REQUEST, + + /* OFPST 1.1-1.2 (6): uint8_t[8][]. */ + OFPRAW_OFPST11_GROUP_REPLY, + /* OFPST 1.3+ (6): uint8_t[8][]. */ + OFPRAW_OFPST13_GROUP_REPLY, + + /* OFPST 1.1-1.4 (7): void. */ + OFPRAW_OFPST11_GROUP_DESC_REQUEST, + /* OFPST 1.5+ (7): struct ofp15_group_desc_request. */ + OFPRAW_OFPST15_GROUP_DESC_REQUEST, + + /* OFPST 1.1+ (7): uint8_t[8][]. */ + OFPRAW_OFPST11_GROUP_DESC_REPLY, + + /* OFPST 1.2+ (8): void. */ + OFPRAW_OFPST12_GROUP_FEATURES_REQUEST, + + /* OFPST 1.2+ (8): struct ofp12_group_features_stats. */ + OFPRAW_OFPST12_GROUP_FEATURES_REPLY, + + /* OFPST 1.3+ (9): struct ofp13_meter_multipart_request. */ + OFPRAW_OFPST13_METER_REQUEST, + + /* OFPST 1.3+ (9): uint8_t[8][]. */ + OFPRAW_OFPST13_METER_REPLY, + + /* OFPST 1.3+ (10): struct ofp13_meter_multipart_request. */ + OFPRAW_OFPST13_METER_CONFIG_REQUEST, + + /* OFPST 1.3+ (10): uint8_t[8][]. */ + OFPRAW_OFPST13_METER_CONFIG_REPLY, + + /* OFPST 1.3+ (11): void. */ + OFPRAW_OFPST13_METER_FEATURES_REQUEST, + + /* OFPST 1.3+ (11): struct ofp13_meter_features. */ + OFPRAW_OFPST13_METER_FEATURES_REPLY, + + /* OFPST 1.3+ (12): void. */ + OFPRAW_OFPST13_TABLE_FEATURES_REQUEST, + + /* OFPST 1.3+ (12): struct ofp13_table_features, uint8_t[8][]. */ + OFPRAW_OFPST13_TABLE_FEATURES_REPLY, + + /* OFPST 1.4+ (14): void. */ + OFPRAW_OFPST14_TABLE_DESC_REQUEST, + + /* OFPST 1.4+ (14): struct ofp14_table_desc, uint8_t[8][]. */ + OFPRAW_OFPST14_TABLE_DESC_REPLY, + + /* OFPST 1.0-1.4 (13): void. */ + OFPRAW_OFPST10_PORT_DESC_REQUEST, + /* OFPST 1.5+ (13): struct ofp15_port_desc_request. */ + OFPRAW_OFPST15_PORT_DESC_REQUEST, + + /* OFPST 1.0 (13): struct ofp10_phy_port[]. */ + OFPRAW_OFPST10_PORT_DESC_REPLY, + /* OFPST 1.1-1.3 (13): struct ofp11_port[]. */ + OFPRAW_OFPST11_PORT_DESC_REPLY, + /* OFPST 1.4+ (13): uint8_t[8][]. */ + OFPRAW_OFPST14_PORT_DESC_REPLY, + + /* OFPST 1.4+ (15): struct ofp14_queue_desc_request. */ + OFPRAW_OFPST14_QUEUE_DESC_REQUEST, + /* OFPST 1.4+ (15): uint8_t[8][]. */ + OFPRAW_OFPST14_QUEUE_DESC_REPLY, + + /* OFPST 1.4+ (16): uint8_t[8][]. */ + OFPRAW_OFPST14_FLOW_MONITOR_REQUEST, + /* NXST 1.0 (2): uint8_t[8][]. */ + OFPRAW_NXST_FLOW_MONITOR_REQUEST, + + /* OFPST 1.4+ (16): uint8_t[8][]. */ + OFPRAW_OFPST14_FLOW_MONITOR_REPLY, + /* NXST 1.0 (2): uint8_t[8][]. */ + OFPRAW_NXST_FLOW_MONITOR_REPLY, + +/* Nicira extension messages. + * + * Nicira extensions that correspond to standard OpenFlow messages are listed + * alongside the standard versions above. */ + + /* NXT 1.0 (12): struct nx_set_flow_format. */ + OFPRAW_NXT_SET_FLOW_FORMAT, + + /* NXT 1.0+ (15): struct nx_flow_mod_table_id. */ + OFPRAW_NXT_FLOW_MOD_TABLE_ID, + + /* NXT 1.0+ (16): struct nx_set_packet_in_format. */ + OFPRAW_NXT_SET_PACKET_IN_FORMAT, + + /* NXT 1.0+ (18): void. */ + OFPRAW_NXT_FLOW_AGE, + + /* NXT 1.0+ (20): struct nx_controller_id. */ + OFPRAW_NXT_SET_CONTROLLER_ID, + + /* NXT 1.0+ (21): struct nx_flow_monitor_cancel. */ + OFPRAW_NXT_FLOW_MONITOR_CANCEL, + + /* NXT 1.0+ (22): void. */ + OFPRAW_NXT_FLOW_MONITOR_PAUSED, + + /* NXT 1.0+ (23): void. */ + OFPRAW_NXT_FLOW_MONITOR_RESUMED, + + /* NXT 1.0+ (24): struct nx_tlv_table_mod, struct nx_tlv_map[]. */ + OFPRAW_NXT_TLV_TABLE_MOD, + + /* NXT 1.0+ (25): void. */ + OFPRAW_NXT_TLV_TABLE_REQUEST, + + /* NXT 1.0+ (26): struct nx_tlv_table_reply, struct nx_tlv_map[]. */ + OFPRAW_NXT_TLV_TABLE_REPLY, + + /* NXT 1.0+ (28): uint8_t[8][]. */ + OFPRAW_NXT_RESUME, + + /* NXT 1.0+ (29): struct nx_zone_id. */ + OFPRAW_NXT_CT_FLUSH_ZONE, + + /* NXST 1.0+ (3): void. */ + OFPRAW_NXST_IPFIX_BRIDGE_REQUEST, + + /* NXST 1.0+ (3): struct nx_ipfix_stats_reply. */ + OFPRAW_NXST_IPFIX_BRIDGE_REPLY, + + /* NXST 1.0+ (4): void. */ + OFPRAW_NXST_IPFIX_FLOW_REQUEST, + + /* NXST 1.0+ (4): struct nx_ipfix_stats_reply[]. */ + OFPRAW_NXST_IPFIX_FLOW_REPLY, +}; + +/* Decoding messages into OFPRAW_* values. */ +enum ofperr ofpraw_decode(enum ofpraw *, const struct ofp_header *); +enum ofpraw ofpraw_decode_assert(const struct ofp_header *); +enum ofperr ofpraw_pull(enum ofpraw *, struct ofpbuf *); +enum ofpraw ofpraw_pull_assert(struct ofpbuf *); + +enum ofperr ofpraw_decode_partial(enum ofpraw *, + const struct ofp_header *, size_t length); + +/* Encoding messages using OFPRAW_* values. */ +struct ofpbuf *ofpraw_alloc(enum ofpraw, uint8_t ofp_version, + size_t extra_tailroom); +struct ofpbuf *ofpraw_alloc_xid(enum ofpraw, uint8_t ofp_version, + ovs_be32 xid, size_t extra_tailroom); +struct ofpbuf *ofpraw_alloc_reply(enum ofpraw, + const struct ofp_header *request, + size_t extra_tailroom); +struct ofpbuf *ofpraw_alloc_stats_reply(const struct ofp_header *request, + size_t extra_tailroom); + +void ofpraw_put(enum ofpraw, uint8_t ofp_version, struct ofpbuf *); +void ofpraw_put_xid(enum ofpraw, uint8_t ofp_version, ovs_be32 xid, + struct ofpbuf *); +void ofpraw_put_reply(enum ofpraw, const struct ofp_header *request, + struct ofpbuf *); +void ofpraw_put_stats_reply(const struct ofp_header *request, struct ofpbuf *); + +/* Information about OFPRAW_* values. */ +const char *ofpraw_get_name(enum ofpraw); +enum ofpraw ofpraw_stats_request_to_reply(enum ofpraw, uint8_t version); + +/* Semantic identifiers for OpenFlow messages. + * + * Each OFPTYPE_* enumeration constant represents one or more concrete format + * of OpenFlow message. When two variants of a message have essentially the + * same meaning, they are assigned a single OFPTYPE_* value. + * + * The comments here must follow a stylized form because the "extract-ofp-msgs" + * program parses them at build time to generate data tables. The format is + * simply to list each OFPRAW_* enumeration constant for a given OFPTYPE_*, + * each followed by a period. */ +enum ofptype { + /* Immutable messages. */ + OFPTYPE_HELLO, /* OFPRAW_OFPT_HELLO. */ + OFPTYPE_ERROR, /* OFPRAW_OFPT_ERROR. */ + OFPTYPE_ECHO_REQUEST, /* OFPRAW_OFPT_ECHO_REQUEST. */ + OFPTYPE_ECHO_REPLY, /* OFPRAW_OFPT_ECHO_REPLY. */ + + /* Switch configuration messages. */ + OFPTYPE_FEATURES_REQUEST, /* OFPRAW_OFPT_FEATURES_REQUEST. */ + OFPTYPE_FEATURES_REPLY, /* OFPRAW_OFPT10_FEATURES_REPLY. + * OFPRAW_OFPT11_FEATURES_REPLY. + * OFPRAW_OFPT13_FEATURES_REPLY. */ + OFPTYPE_GET_CONFIG_REQUEST, /* OFPRAW_OFPT_GET_CONFIG_REQUEST. */ + OFPTYPE_GET_CONFIG_REPLY, /* OFPRAW_OFPT_GET_CONFIG_REPLY. */ + OFPTYPE_SET_CONFIG, /* OFPRAW_OFPT_SET_CONFIG. */ + + /* Asynchronous messages. */ + OFPTYPE_PACKET_IN, /* OFPRAW_OFPT10_PACKET_IN. + * OFPRAW_OFPT11_PACKET_IN. + * OFPRAW_OFPT12_PACKET_IN. + * OFPRAW_OFPT13_PACKET_IN. + * OFPRAW_NXT_PACKET_IN2. + * OFPRAW_NXT_PACKET_IN. */ + OFPTYPE_FLOW_REMOVED, /* OFPRAW_OFPT10_FLOW_REMOVED. + * OFPRAW_OFPT11_FLOW_REMOVED. + * OFPRAW_NXT_FLOW_REMOVED. */ + OFPTYPE_PORT_STATUS, /* OFPRAW_OFPT10_PORT_STATUS. + * OFPRAW_OFPT11_PORT_STATUS. + * OFPRAW_OFPT14_PORT_STATUS. */ + + /* Controller command messages. */ + OFPTYPE_PACKET_OUT, /* OFPRAW_OFPT10_PACKET_OUT. + * OFPRAW_OFPT11_PACKET_OUT. */ + OFPTYPE_FLOW_MOD, /* OFPRAW_OFPT10_FLOW_MOD. + * OFPRAW_OFPT11_FLOW_MOD. + * OFPRAW_NXT_FLOW_MOD. */ + OFPTYPE_GROUP_MOD, /* OFPRAW_OFPT11_GROUP_MOD. + * OFPRAW_OFPT15_GROUP_MOD. */ + OFPTYPE_PORT_MOD, /* OFPRAW_OFPT10_PORT_MOD. + * OFPRAW_OFPT11_PORT_MOD. + * OFPRAW_OFPT14_PORT_MOD. */ + OFPTYPE_TABLE_MOD, /* OFPRAW_OFPT11_TABLE_MOD. + * OFPRAW_OFPT14_TABLE_MOD. */ + + /* Barrier messages. */ + OFPTYPE_BARRIER_REQUEST, /* OFPRAW_OFPT10_BARRIER_REQUEST. + * OFPRAW_OFPT11_BARRIER_REQUEST. */ + OFPTYPE_BARRIER_REPLY, /* OFPRAW_OFPT10_BARRIER_REPLY. + * OFPRAW_OFPT11_BARRIER_REPLY. */ + + /* Queue Configuration messages. */ + OFPTYPE_QUEUE_GET_CONFIG_REQUEST, /* OFPRAW_OFPT10_QUEUE_GET_CONFIG_REQUEST. + * OFPRAW_OFPT11_QUEUE_GET_CONFIG_REQUEST. + * OFPRAW_OFPST14_QUEUE_DESC_REQUEST. */ + OFPTYPE_QUEUE_GET_CONFIG_REPLY, /* OFPRAW_OFPT10_QUEUE_GET_CONFIG_REPLY. + * OFPRAW_OFPT11_QUEUE_GET_CONFIG_REPLY. + * OFPRAW_OFPST14_QUEUE_DESC_REPLY. */ + + /* Controller role change request messages. */ + OFPTYPE_ROLE_REQUEST, /* OFPRAW_OFPT12_ROLE_REQUEST. + * OFPRAW_NXT_ROLE_REQUEST. */ + OFPTYPE_ROLE_REPLY, /* OFPRAW_OFPT12_ROLE_REPLY. + * OFPRAW_NXT_ROLE_REPLY. */ + + /* Asynchronous message configuration. */ + OFPTYPE_GET_ASYNC_REQUEST, /* OFPRAW_OFPT13_GET_ASYNC_REQUEST. + * OFPRAW_OFPT14_GET_ASYNC_REQUEST. */ + OFPTYPE_GET_ASYNC_REPLY, /* OFPRAW_OFPT13_GET_ASYNC_REPLY. + * OFPRAW_OFPT14_GET_ASYNC_REPLY. */ + OFPTYPE_SET_ASYNC_CONFIG, /* OFPRAW_NXT_SET_ASYNC_CONFIG. + * OFPRAW_NXT_SET_ASYNC_CONFIG2. + * OFPRAW_OFPT13_SET_ASYNC. + * OFPRAW_OFPT14_SET_ASYNC. */ + + /* Meters and rate limiters configuration messages. */ + OFPTYPE_METER_MOD, /* OFPRAW_OFPT13_METER_MOD. */ + + /* Controller role change event messages. */ + OFPTYPE_ROLE_STATUS, /* OFPRAW_OFPT14_ROLE_STATUS. */ + + /* Request forwarding by the switch. */ + OFPTYPE_REQUESTFORWARD, /* OFPRAW_OFPT14_REQUESTFORWARD. */ + + /* Asynchronous messages. */ + OFPTYPE_TABLE_STATUS, /* OFPRAW_OFPT14_TABLE_STATUS. */ + + OFPTYPE_BUNDLE_CONTROL, /* OFPRAW_OFPT14_BUNDLE_CONTROL. + * OFPRAW_ONFT13_BUNDLE_CONTROL. */ + + OFPTYPE_BUNDLE_ADD_MESSAGE, /* OFPRAW_OFPT14_BUNDLE_ADD_MESSAGE. + * OFPRAW_ONFT13_BUNDLE_ADD_MESSAGE. */ + + /* Statistics. */ + OFPTYPE_DESC_STATS_REQUEST, /* OFPRAW_OFPST_DESC_REQUEST. */ + OFPTYPE_DESC_STATS_REPLY, /* OFPRAW_OFPST_DESC_REPLY. */ + OFPTYPE_FLOW_STATS_REQUEST, /* OFPRAW_OFPST10_FLOW_REQUEST. + * OFPRAW_OFPST11_FLOW_REQUEST. + * OFPRAW_NXST_FLOW_REQUEST. */ + OFPTYPE_FLOW_STATS_REPLY, /* OFPRAW_OFPST10_FLOW_REPLY. + * OFPRAW_OFPST11_FLOW_REPLY. + * OFPRAW_OFPST13_FLOW_REPLY. + * OFPRAW_NXST_FLOW_REPLY. */ + OFPTYPE_AGGREGATE_STATS_REQUEST, /* OFPRAW_OFPST10_AGGREGATE_REQUEST. + * OFPRAW_OFPST11_AGGREGATE_REQUEST. + * OFPRAW_NXST_AGGREGATE_REQUEST. */ + OFPTYPE_AGGREGATE_STATS_REPLY, /* OFPRAW_OFPST_AGGREGATE_REPLY. + * OFPRAW_NXST_AGGREGATE_REPLY. */ + OFPTYPE_TABLE_STATS_REQUEST, /* OFPRAW_OFPST_TABLE_REQUEST. */ + OFPTYPE_TABLE_STATS_REPLY, /* OFPRAW_OFPST10_TABLE_REPLY. + * OFPRAW_OFPST11_TABLE_REPLY. + * OFPRAW_OFPST12_TABLE_REPLY. + * OFPRAW_OFPST13_TABLE_REPLY. */ + OFPTYPE_PORT_STATS_REQUEST, /* OFPRAW_OFPST10_PORT_REQUEST. + * OFPRAW_OFPST11_PORT_REQUEST. */ + OFPTYPE_PORT_STATS_REPLY, /* OFPRAW_OFPST10_PORT_REPLY. + * OFPRAW_OFPST11_PORT_REPLY. + * OFPRAW_OFPST13_PORT_REPLY. + * OFPRAW_OFPST14_PORT_REPLY. */ + OFPTYPE_QUEUE_STATS_REQUEST, /* OFPRAW_OFPST10_QUEUE_REQUEST. + * OFPRAW_OFPST11_QUEUE_REQUEST. */ + OFPTYPE_QUEUE_STATS_REPLY, /* OFPRAW_OFPST10_QUEUE_REPLY. + * OFPRAW_OFPST11_QUEUE_REPLY. + * OFPRAW_OFPST13_QUEUE_REPLY. + * OFPRAW_OFPST14_QUEUE_REPLY. */ + + OFPTYPE_GROUP_STATS_REQUEST, /* OFPRAW_OFPST11_GROUP_REQUEST. */ + + OFPTYPE_GROUP_STATS_REPLY, /* OFPRAW_OFPST11_GROUP_REPLY. + * OFPRAW_OFPST13_GROUP_REPLY. */ + + OFPTYPE_GROUP_DESC_STATS_REQUEST, /* OFPRAW_OFPST11_GROUP_DESC_REQUEST. + * OFPRAW_OFPST15_GROUP_DESC_REQUEST. */ + + OFPTYPE_GROUP_DESC_STATS_REPLY, /* OFPRAW_OFPST11_GROUP_DESC_REPLY. */ + + OFPTYPE_GROUP_FEATURES_STATS_REQUEST, /* OFPRAW_OFPST12_GROUP_FEATURES_REQUEST. */ + + OFPTYPE_GROUP_FEATURES_STATS_REPLY, /* OFPRAW_OFPST12_GROUP_FEATURES_REPLY. */ + + OFPTYPE_METER_STATS_REQUEST, /* OFPRAW_OFPST13_METER_REQUEST. */ + + OFPTYPE_METER_STATS_REPLY, /* OFPRAW_OFPST13_METER_REPLY. */ + + OFPTYPE_METER_CONFIG_STATS_REQUEST, /* OFPRAW_OFPST13_METER_CONFIG_REQUEST. */ + + OFPTYPE_METER_CONFIG_STATS_REPLY, /* OFPRAW_OFPST13_METER_CONFIG_REPLY. */ + + OFPTYPE_METER_FEATURES_STATS_REQUEST, /* OFPRAW_OFPST13_METER_FEATURES_REQUEST. */ + + OFPTYPE_METER_FEATURES_STATS_REPLY, /* OFPRAW_OFPST13_METER_FEATURES_REPLY. */ + + OFPTYPE_TABLE_FEATURES_STATS_REQUEST, /* OFPRAW_OFPST13_TABLE_FEATURES_REQUEST. */ + + OFPTYPE_TABLE_FEATURES_STATS_REPLY, /* OFPRAW_OFPST13_TABLE_FEATURES_REPLY. */ + + OFPTYPE_TABLE_DESC_REQUEST, /* OFPRAW_OFPST14_TABLE_DESC_REQUEST. */ + + OFPTYPE_TABLE_DESC_REPLY, /* OFPRAW_OFPST14_TABLE_DESC_REPLY. */ + + OFPTYPE_PORT_DESC_STATS_REQUEST, /* OFPRAW_OFPST10_PORT_DESC_REQUEST. + * OFPRAW_OFPST15_PORT_DESC_REQUEST. */ + + OFPTYPE_PORT_DESC_STATS_REPLY, /* OFPRAW_OFPST10_PORT_DESC_REPLY. + * OFPRAW_OFPST11_PORT_DESC_REPLY. + * OFPRAW_OFPST14_PORT_DESC_REPLY. */ + + OFPTYPE_FLOW_MONITOR_STATS_REQUEST, /* OFPRAW_OFPST14_FLOW_MONITOR_REQUEST. + * OFPRAW_NXST_FLOW_MONITOR_REQUEST. */ + OFPTYPE_FLOW_MONITOR_STATS_REPLY, /* OFPRAW_OFPST14_FLOW_MONITOR_REPLY. + * OFPRAW_NXST_FLOW_MONITOR_REPLY. */ + + /* Nicira extensions. */ + OFPTYPE_SET_FLOW_FORMAT, /* OFPRAW_NXT_SET_FLOW_FORMAT. */ + OFPTYPE_FLOW_MOD_TABLE_ID, /* OFPRAW_NXT_FLOW_MOD_TABLE_ID. */ + OFPTYPE_SET_PACKET_IN_FORMAT, /* OFPRAW_NXT_SET_PACKET_IN_FORMAT. */ + OFPTYPE_FLOW_AGE, /* OFPRAW_NXT_FLOW_AGE. */ + OFPTYPE_SET_CONTROLLER_ID, /* OFPRAW_NXT_SET_CONTROLLER_ID. */ + OFPTYPE_NXT_TLV_TABLE_MOD, /* OFPRAW_NXT_TLV_TABLE_MOD. */ + OFPTYPE_NXT_TLV_TABLE_REQUEST, /* OFPRAW_NXT_TLV_TABLE_REQUEST. */ + OFPTYPE_NXT_TLV_TABLE_REPLY, /* OFPRAW_NXT_TLV_TABLE_REPLY. */ + OFPTYPE_NXT_RESUME, /* OFPRAW_NXT_RESUME. */ + OFPTYPE_IPFIX_BRIDGE_STATS_REQUEST, /* OFPRAW_NXST_IPFIX_BRIDGE_REQUEST */ + OFPTYPE_IPFIX_BRIDGE_STATS_REPLY, /* OFPRAW_NXST_IPFIX_BRIDGE_REPLY */ + OFPTYPE_IPFIX_FLOW_STATS_REQUEST, /* OFPRAW_NXST_IPFIX_FLOW_REQUEST */ + OFPTYPE_IPFIX_FLOW_STATS_REPLY, /* OFPRAW_NXST_IPFIX_FLOW_REPLY */ + OFPTYPE_CT_FLUSH_ZONE, /* OFPRAW_NXT_CT_FLUSH_ZONE. */ + + /* Flow monitor extension. */ + OFPTYPE_FLOW_MONITOR_CANCEL, /* OFPRAW_NXT_FLOW_MONITOR_CANCEL. */ + OFPTYPE_FLOW_MONITOR_PAUSED, /* OFPRAW_NXT_FLOW_MONITOR_PAUSED. */ + OFPTYPE_FLOW_MONITOR_RESUMED, /* OFPRAW_NXT_FLOW_MONITOR_RESUMED. */ +}; + +/* Decoding messages into OFPTYPE_* values. */ +enum ofperr ofptype_decode(enum ofptype *, const struct ofp_header *); +enum ofperr ofptype_pull(enum ofptype *, struct ofpbuf *); +enum ofptype ofptype_from_ofpraw(enum ofpraw); + +/* Information about OFTYPE_* values. */ +const char *ofptype_get_name(enum ofptype); + +/* OpenFlow message properties. */ +void ofpmsg_update_length(struct ofpbuf *); +const void *ofpmsg_body(const struct ofp_header *); +bool ofpmsg_is_stat_request(const struct ofp_header *); + +/* Multipart messages (aka "statistics"). + * + * Individual OpenFlow messages are limited to 64 kB in size, but some messages + * need to be longer. Therefore, multipart messages allow a longer message to + * be divided into multiple parts at some convenient boundary. For example, + * limiting the response to a "flow dump" request to 64 kB would unreasonably + * limit the maximum number of flows in an OpenFlow switch, so a "flow dump" is + * expressed as a multipart request/reply pair, with the reply broken into + * pieces between flows. + * + * Multipart messages always consist of a request/reply pair. + * + * In OpenFlow 1.0, 1.1, and 1.2, requests must always fit in a single message, + * that is, only a multipart reply may have more than one part. OpenFlow 1.3 + * adds one multipart request. This code does not yet support multipart + * requests. */ + +/* Encoding multipart replies. + * + * These functions are useful for multipart replies that might really require + * more than one message. A multipart message that is known in advance to fit + * within 64 kB doesn't need any special treatment, so you might as well use + * the ofpraw_alloc_*() functions. + * + * These functions work with a "struct ovs_list" of "struct ofpbuf"s, each of + * which represents one part of a multipart message. */ +void ofpmp_init(struct ovs_list *, const struct ofp_header *request); +struct ofpbuf *ofpmp_reserve(struct ovs_list *, size_t len); +void *ofpmp_append(struct ovs_list *, size_t len); +void ofpmp_postappend(struct ovs_list *, size_t start_ofs); + +enum ofp_version ofpmp_version(struct ovs_list *); +enum ofpraw ofpmp_decode_raw(struct ovs_list *); + +/* Decoding multipart replies. */ +uint16_t ofpmp_flags(const struct ofp_header *); +bool ofpmp_more(const struct ofp_header *); + +#endif /* ofp-msgs.h */ diff --git a/openflow/include/openvswitch/ofp-parse.h b/openflow/include/openvswitch/ofp-parse.h new file mode 100644 index 0000000..ed7a09c --- /dev/null +++ b/openflow/include/openvswitch/ofp-parse.h @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* OpenFlow protocol string to flow parser. */ + +#ifndef OPENVSWITCH_OFP_PARSE_H +#define OPENVSWITCH_OFP_PARSE_H 1 + +#include +#include +#include +#include "openvswitch/compiler.h" +#include "openvswitch/types.h" + +struct flow; +struct ofpbuf; +struct ofputil_flow_mod; +struct ofputil_packet_out; +struct ofputil_flow_monitor_request; +struct ofputil_flow_stats_request; +struct ofputil_group_mod; +struct ofputil_meter_mod; +struct ofputil_table_mod; +struct ofputil_bundle_msg; +struct ofputil_tlv_table_mod; +struct simap; +enum ofputil_protocol; + +char *parse_ofp_str(struct ofputil_flow_mod *, int command, const char *str_, + enum ofputil_protocol *usable_protocols) + OVS_WARN_UNUSED_RESULT; + +char *parse_ofp_flow_mod_str(struct ofputil_flow_mod *, const char *string, + int command, + enum ofputil_protocol *usable_protocols) + OVS_WARN_UNUSED_RESULT; + +char *parse_ofp_packet_out_str(struct ofputil_packet_out *po, const char *str_, + enum ofputil_protocol *usable_protocols) + OVS_WARN_UNUSED_RESULT; + +char *parse_ofp_table_mod(struct ofputil_table_mod *, + const char *table_id, const char *flow_miss_handling, + uint32_t *usable_versions) + OVS_WARN_UNUSED_RESULT; + +char *parse_ofp_flow_mod_file(const char *file_name, int command, + struct ofputil_flow_mod **fms, size_t *n_fms, + enum ofputil_protocol *usable_protocols) + OVS_WARN_UNUSED_RESULT; + +char *parse_ofp_flow_stats_request_str(struct ofputil_flow_stats_request *, + bool aggregate, const char *string, + enum ofputil_protocol *usable_protocols) + OVS_WARN_UNUSED_RESULT; + +char *parse_ofp_exact_flow(struct flow *flow, struct flow_wildcards *wc, + const struct tun_table *tun_table, const char *s, + const struct simap *portno_names); + +char *parse_ofp_meter_mod_str(struct ofputil_meter_mod *, const char *string, + int command, + enum ofputil_protocol *usable_protocols) + OVS_WARN_UNUSED_RESULT; + +char *parse_flow_monitor_request(struct ofputil_flow_monitor_request *, + const char *, + enum ofputil_protocol *usable_protocols) + OVS_WARN_UNUSED_RESULT; + +char *parse_ofp_group_mod_file(const char *file_name, int command, + struct ofputil_group_mod **gms, size_t *n_gms, + enum ofputil_protocol *usable_protocols) + OVS_WARN_UNUSED_RESULT; + +char *parse_ofp_group_mod_str(struct ofputil_group_mod *, int command, + const char *string, + enum ofputil_protocol *usable_protocols) + OVS_WARN_UNUSED_RESULT; + +char *parse_ofp_bundle_file(const char *file_name, + struct ofputil_bundle_msg **, size_t *n_bms, + enum ofputil_protocol *) + OVS_WARN_UNUSED_RESULT; + +char *parse_ofp_tlv_table_mod_str(struct ofputil_tlv_table_mod *, + uint16_t command, const char *string, + enum ofputil_protocol *usable_protocols) + OVS_WARN_UNUSED_RESULT; + +char *str_to_u8(const char *str, const char *name, uint8_t *valuep) + OVS_WARN_UNUSED_RESULT; +char *str_to_u16(const char *str, const char *name, uint16_t *valuep) + OVS_WARN_UNUSED_RESULT; +char *str_to_u32(const char *str, uint32_t *valuep) OVS_WARN_UNUSED_RESULT; +char *str_to_u64(const char *str, uint64_t *valuep) OVS_WARN_UNUSED_RESULT; +char *str_to_be64(const char *str, ovs_be64 *valuep) OVS_WARN_UNUSED_RESULT; +char *str_to_mac(const char *str, struct eth_addr *mac) OVS_WARN_UNUSED_RESULT; +char *str_to_ip(const char *str, ovs_be32 *ip) OVS_WARN_UNUSED_RESULT; +char *str_to_connhelper(const char *str, uint16_t *alg) OVS_WARN_UNUSED_RESULT; +char *parse_ofp_table_vacancy(struct ofputil_table_mod *, + const char *flow_miss_handling) + OVS_WARN_UNUSED_RESULT; + +#endif /* ofp-parse.h */ diff --git a/openflow/include/openvswitch/ofp-print.h b/openflow/include/openvswitch/ofp-print.h new file mode 100644 index 0000000..58fd403 --- /dev/null +++ b/openflow/include/openvswitch/ofp-print.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2008, 2009, 2011, 2012, 2015 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* OpenFlow protocol pretty-printer. */ + +#ifndef OPENVSWITCH_OFP_PRINT_H +#define OPENVSWITCH_OFP_PRINT_H 1 + +#include +#include + +struct ds; +struct ofp10_match; +struct ofp_flow_mod; +struct ofp_header; +struct ofputil_flow_stats; +struct ofputil_table_features; +struct ofputil_table_stats; + +#ifdef __cplusplus +extern "C" { +#endif + +void ofp_print(FILE *, const void *, size_t, int verbosity); +void ofp_print_packet(FILE *stream, const void *data, size_t len); + +void ofp10_match_print(struct ds *, const struct ofp10_match *, int verbosity); + +char *ofp_to_string(const void *, size_t, int verbosity); +char *ofp10_match_to_string(const struct ofp10_match *, int verbosity); +char *ofp_packet_to_string(const void *data, size_t len); + +void ofp_print_flow_stats(struct ds *, struct ofputil_flow_stats *); +void ofp_print_version(const struct ofp_header *, struct ds *); +void ofp_print_table_features( + struct ds *, const struct ofputil_table_features *features, + const struct ofputil_table_features *prev_features, + const struct ofputil_table_stats *stats, + const struct ofputil_table_stats *prev_stats); + +#ifdef __cplusplus +} +#endif + +#endif /* ofp-print.h */ diff --git a/openflow/include/openvswitch/ofp-prop.h b/openflow/include/openvswitch/ofp-prop.h new file mode 100644 index 0000000..0ba2d35 --- /dev/null +++ b/openflow/include/openvswitch/ofp-prop.h @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2014, 2015, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_OFP_PROP_H +#define OPENVSWITCH_OFP_PROP_H 1 + +/* OpenFlow 1.3+ property support + * ============================== + * + * Several OpenFlow 1.3+ messages use type-length-value (TLV) properties that + * take the common form shown by "struct ofp_prop_header". This module + * provides support for serializing and deserializing properties in this + * format. + * + * + * Property types + * -------------- + * + * This module uses uint64_t values to identify property types + * + * - OpenFlow assigns 16-bit type values to its own standardized + * properties. ofpprop uses these values directly in uint64_t. + * + * The 16-bit value 0xffff (and for some kinds of properties 0xfffe) is + * reserved as a kind of escape to introduce an "experimenter" property + * (see below). + * + * - Vendor-specific "experimenter" properties have a 32-bit "experimenter + * ID" (generally an Ethernet OUI) and a 32-bit experimenter-defined + * "exp_type". ofpprop encodes these with the experimenter ID in the + * high 32 bits and exp_type in the low 32 bits. (All existing + * experimenter IDs are nonzero, so this is unambiguous.) Use + * OFPPROP_EXP to encode these property types. + */ + +#include +#include +#include +#include "openvswitch/ofp-errors.h" +#include "openvswitch/types.h" + +struct ofpbuf; +struct uuid; +struct vlog_module; + +/* Given an OpenFlow experimenter ID (e.g. NX_VENDOR_ID) 'exp_id' and type + * 'exp_type', yields the code that ofpprop_pull() would use to identify the + * given experimenter property. */ +#define OFPPROP_EXP(EXP_ID, EXP_TYPE) \ + (((uint64_t) (EXP_ID) << 32) | (EXP_TYPE)) + +/* Returns true if 'type' represents an experimenter property type, + * false if it represents a standard property type.*/ +static inline bool +ofpprop_is_experimenter(uint64_t type) +{ + return type > UINT16_MAX; +} + +/* Deserializing properties. */ +enum ofperr ofpprop_pull__(struct ofpbuf *msg, struct ofpbuf *property, + unsigned int alignment, unsigned int min_exp, + uint64_t *typep); +enum ofperr ofpprop_pull(struct ofpbuf *msg, struct ofpbuf *property, + uint64_t *typep); + +enum ofperr ofpprop_parse_be16(const struct ofpbuf *, ovs_be16 *value); +enum ofperr ofpprop_parse_be32(const struct ofpbuf *, ovs_be32 *value); +enum ofperr ofpprop_parse_be64(const struct ofpbuf *, ovs_be64 *value); +enum ofperr ofpprop_parse_u8(const struct ofpbuf *, uint8_t *value); +enum ofperr ofpprop_parse_u16(const struct ofpbuf *, uint16_t *value); +enum ofperr ofpprop_parse_u32(const struct ofpbuf *, uint32_t *value); +enum ofperr ofpprop_parse_u64(const struct ofpbuf *, uint64_t *value); +enum ofperr ofpprop_parse_uuid(const struct ofpbuf *, struct uuid *); +enum ofperr ofpprop_parse_nested(const struct ofpbuf *, struct ofpbuf *); + +/* Serializing properties. */ +void ofpprop_put(struct ofpbuf *, uint64_t type, + const void *value, size_t len); +void *ofpprop_put_zeros(struct ofpbuf *, uint64_t type, size_t len); +void ofpprop_put_be16(struct ofpbuf *, uint64_t type, ovs_be16 value); +void ofpprop_put_be32(struct ofpbuf *, uint64_t type, ovs_be32 value); +void ofpprop_put_be64(struct ofpbuf *, uint64_t type, ovs_be64 value); +void ofpprop_put_u8(struct ofpbuf *, uint64_t type, uint8_t value); +void ofpprop_put_u16(struct ofpbuf *, uint64_t type, uint16_t value); +void ofpprop_put_u32(struct ofpbuf *, uint64_t type, uint32_t value); +void ofpprop_put_u64(struct ofpbuf *, uint64_t type, uint64_t value); +void ofpprop_put_bitmap(struct ofpbuf *, uint64_t type, uint64_t bitmap); +void ofpprop_put_flag(struct ofpbuf *, uint64_t type); +void ofpprop_put_uuid(struct ofpbuf *, uint64_t type, const struct uuid *); +void ofpprop_put_nested(struct ofpbuf *, uint64_t type, const struct ofpbuf *); + +size_t ofpprop_start(struct ofpbuf *, uint64_t type); +void ofpprop_end(struct ofpbuf *, size_t start_ofs); + +size_t ofpprop_start_nested(struct ofpbuf *, uint64_t type); + +/* Logging errors while deserializing properties. + * + * The attitude that a piece of code should take when it deserializes an + * unknown property type depends on the code in question: + * + * - In a "loose" context (with LOOSE set to true), that is, where the code + * is parsing the property to find out about the state or the capabilities + * of some piece of the system, generally an unknown property type is not + * a big deal, because it only means that there is additional information + * that the receiver does not understand. + * + * - In a "strict" context (with LOOSE set to false), that is, where the + * code is parsing the property to change the state or configuration of a + * part of the system, generally an unknown property type is an error, + * because it means that the receiver is being asked to configure the + * system in some way it doesn't understand. + * + * Given LOOSE, this macro automatically logs chooses an appropriate log + * level. */ +#define OFPPROP_LOG(RL, LOOSE, ...) \ + VLOG_RL(RL, (LOOSE) ? VLL_DBG : VLL_WARN, __VA_ARGS__) + +enum ofperr ofpprop_unknown(struct vlog_module *, bool loose, const char *msg, + uint64_t type); +#define OFPPROP_UNKNOWN(LOOSE, MSG, TYPE) \ + ofpprop_unknown(&this_module, LOOSE, MSG, TYPE) + +#endif /* ofp-prop.h */ diff --git a/openflow/include/openvswitch/ofp-util.h b/openflow/include/openvswitch/ofp-util.h new file mode 100644 index 0000000..0c3a10a --- /dev/null +++ b/openflow/include/openvswitch/ofp-util.h @@ -0,0 +1,1467 @@ +/* + * Copyright (c) 2008-2017 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_OFP_UTIL_H +#define OPENVSWITCH_OFP_UTIL_H 1 + +#include +#include +#include +#include "openvswitch/flow.h" +#include "openvswitch/list.h" +#include "openvswitch/match.h" +#include "openvswitch/meta-flow.h" +#include "openvswitch/netdev.h" +#include "openflow/netronome-ext.h" +#include "openflow/nicira-ext.h" +#include "openvswitch/ofp-msgs.h" +#include "openvswitch/ofpbuf.h" +#include "openvswitch/types.h" +#include "openvswitch/type-props.h" +#include "openvswitch/uuid.h" + +struct ofpbuf; +union ofp_action; +struct ofpact_set_field; +struct vl_mff_map; + +/* Port numbers. */ +enum ofperr ofputil_port_from_ofp11(ovs_be32 ofp11_port, + ofp_port_t *ofp10_port); +ovs_be32 ofputil_port_to_ofp11(ofp_port_t ofp10_port); + +bool ofputil_port_from_string(const char *, ofp_port_t *portp); +void ofputil_format_port(ofp_port_t port, struct ds *); +void ofputil_port_to_string(ofp_port_t, char namebuf[OFP_MAX_PORT_NAME_LEN], + size_t bufsize); + +/* Group numbers. */ +enum { MAX_GROUP_NAME_LEN = INT_STRLEN(uint32_t) }; +bool ofputil_group_from_string(const char *, uint32_t *group_id); +void ofputil_format_group(uint32_t group_id, struct ds *); +void ofputil_group_to_string(uint32_t group_id, + char namebuf[MAX_GROUP_NAME_LEN + 1], + size_t bufsize); + +/* Converting OFPFW10_NW_SRC_MASK and OFPFW10_NW_DST_MASK wildcard bit counts + * to and from IP bitmasks. */ +ovs_be32 ofputil_wcbits_to_netmask(int wcbits); +int ofputil_netmask_to_wcbits(ovs_be32 netmask); + +/* Protocols. + * + * A "protocol" is an OpenFlow version plus, for some OpenFlow versions, + * a bit extra about the flow match format in use. + * + * These are arranged from most portable to least portable, or alternatively + * from least powerful to most powerful. Protocols earlier on the list are + * more likely to be understood for the purpose of making requests, but + * protocol later on the list are more likely to accurately describe a flow + * within a switch. + * + * On any given OpenFlow connection, a single protocol is in effect at any + * given time. These values use separate bits only because that makes it easy + * to test whether a particular protocol is within a given set of protocols and + * to implement set union and intersection. + */ +enum ofputil_protocol { + /* OpenFlow 1.0 protocols. + * + * The "STD" protocols use the standard OpenFlow 1.0 flow format. + * The "NXM" protocols use the Nicira Extensible Match (NXM) flow format. + * + * The protocols with "TID" mean that the nx_flow_mod_table_id Nicira + * extension has been enabled. The other protocols have it disabled. + */ +#define OFPUTIL_P_NONE 0 + OFPUTIL_P_OF10_STD = 1 << 0, + OFPUTIL_P_OF10_STD_TID = 1 << 1, + OFPUTIL_P_OF10_NXM = 1 << 2, + OFPUTIL_P_OF10_NXM_TID = 1 << 3, +#define OFPUTIL_P_OF10_STD_ANY (OFPUTIL_P_OF10_STD | OFPUTIL_P_OF10_STD_TID) +#define OFPUTIL_P_OF10_NXM_ANY (OFPUTIL_P_OF10_NXM | OFPUTIL_P_OF10_NXM_TID) +#define OFPUTIL_P_OF10_ANY (OFPUTIL_P_OF10_STD_ANY | OFPUTIL_P_OF10_NXM_ANY) + + /* OpenFlow 1.1 protocol. + * + * We only support the standard OpenFlow 1.1 flow format. + * + * OpenFlow 1.1 always operates with an equivalent of the + * nx_flow_mod_table_id Nicira extension enabled, so there is no "TID" + * variant. */ + OFPUTIL_P_OF11_STD = 1 << 4, + + /* OpenFlow 1.2+ protocols (only one variant each). + * + * These use the standard OpenFlow Extensible Match (OXM) flow format. + * + * OpenFlow 1.2+ always operates with an equivalent of the + * nx_flow_mod_table_id Nicira extension enabled, so there is no "TID" + * variant. */ + OFPUTIL_P_OF12_OXM = 1 << 5, + OFPUTIL_P_OF13_OXM = 1 << 6, + OFPUTIL_P_OF14_OXM = 1 << 7, + OFPUTIL_P_OF15_OXM = 1 << 8, + OFPUTIL_P_OF16_OXM = 1 << 9, +#define OFPUTIL_P_ANY_OXM (OFPUTIL_P_OF12_OXM | \ + OFPUTIL_P_OF13_OXM | \ + OFPUTIL_P_OF14_OXM | \ + OFPUTIL_P_OF15_OXM | \ + OFPUTIL_P_OF16_OXM) + +#define OFPUTIL_P_NXM_OF11_UP (OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF11_STD | \ + OFPUTIL_P_ANY_OXM) + +#define OFPUTIL_P_NXM_OXM_ANY (OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_ANY_OXM) + +#define OFPUTIL_P_OF11_UP (OFPUTIL_P_OF11_STD | OFPUTIL_P_ANY_OXM) + +#define OFPUTIL_P_OF12_UP (OFPUTIL_P_OF12_OXM | OFPUTIL_P_OF13_UP) +#define OFPUTIL_P_OF13_UP (OFPUTIL_P_OF13_OXM | OFPUTIL_P_OF14_UP) +#define OFPUTIL_P_OF14_UP (OFPUTIL_P_OF14_OXM | OFPUTIL_P_OF15_UP) +#define OFPUTIL_P_OF15_UP (OFPUTIL_P_OF15_OXM | OFPUTIL_P_OF16_UP) +#define OFPUTIL_P_OF16_UP OFPUTIL_P_OF16_OXM + + /* All protocols. */ +#define OFPUTIL_P_ANY ((1 << 10) - 1) + + /* Protocols in which a specific table may be specified in flow_mods. */ +#define OFPUTIL_P_TID (OFPUTIL_P_OF10_STD_TID | \ + OFPUTIL_P_OF10_NXM_TID | \ + OFPUTIL_P_OF11_STD | \ + OFPUTIL_P_ANY_OXM) +}; + +/* Protocols to use for flow dumps, from most to least preferred. */ +extern enum ofputil_protocol ofputil_flow_dump_protocols[]; +extern size_t ofputil_n_flow_dump_protocols; + +enum ofputil_protocol ofputil_protocol_from_ofp_version(enum ofp_version); +enum ofputil_protocol ofputil_protocols_from_ofp_version(enum ofp_version); +enum ofp_version ofputil_protocol_to_ofp_version(enum ofputil_protocol); + +bool ofputil_protocol_is_valid(enum ofputil_protocol); +enum ofputil_protocol ofputil_protocol_set_tid(enum ofputil_protocol, + bool enable); +enum ofputil_protocol ofputil_protocol_to_base(enum ofputil_protocol); +enum ofputil_protocol ofputil_protocol_set_base( + enum ofputil_protocol cur, enum ofputil_protocol new_base); + +const char *ofputil_protocol_to_string(enum ofputil_protocol); +char *ofputil_protocols_to_string(enum ofputil_protocol); +enum ofputil_protocol ofputil_protocols_from_string(const char *); + +void ofputil_format_version(struct ds *, enum ofp_version); +void ofputil_format_version_name(struct ds *, enum ofp_version); + +/* A bitmap of version numbers + * + * Bit offsets correspond to ofp_version numbers which in turn correspond to + * wire-protocol numbers for OpenFlow versions, e.g. (1u << OFP11_VERSION) + * is the mask for OpenFlow 1.1. If the bit for a version is set then it is + * allowed, otherwise it is disallowed. */ + +void ofputil_format_version_bitmap(struct ds *msg, uint32_t bitmap); +void ofputil_format_version_bitmap_names(struct ds *msg, uint32_t bitmap); + +enum ofp_version ofputil_version_from_string(const char *s); + +uint32_t ofputil_protocols_to_version_bitmap(enum ofputil_protocol); +enum ofputil_protocol ofputil_protocols_from_version_bitmap(uint32_t bitmap); + +/* Bitmaps of OpenFlow versions that Open vSwitch supports, and that it enables + * by default. When Open vSwitch has experimental or incomplete support for + * newer versions of OpenFlow, those versions should not be supported by + * default and thus should be omitted from the latter bitmap. */ +#define OFPUTIL_SUPPORTED_VERSIONS ((1u << OFP10_VERSION) | \ + (1u << OFP11_VERSION) | \ + (1u << OFP12_VERSION) | \ + (1u << OFP13_VERSION)) +#define OFPUTIL_DEFAULT_VERSIONS OFPUTIL_SUPPORTED_VERSIONS + +enum ofputil_protocol ofputil_protocols_from_string(const char *s); + +const char *ofputil_version_to_string(enum ofp_version ofp_version); +uint32_t ofputil_versions_from_string(const char *s); +uint32_t ofputil_versions_from_strings(char ** const s, size_t count); + +bool ofputil_decode_hello(const struct ofp_header *, + uint32_t *allowed_versions); +struct ofpbuf *ofputil_encode_hello(uint32_t version_bitmap); + +struct ofpbuf *ofputil_encode_set_protocol(enum ofputil_protocol current, + enum ofputil_protocol want, + enum ofputil_protocol *next); + +/* nx_flow_format */ +struct ofpbuf *ofputil_encode_nx_set_flow_format(enum nx_flow_format); +enum ofputil_protocol ofputil_nx_flow_format_to_protocol(enum nx_flow_format); +bool ofputil_nx_flow_format_is_valid(enum nx_flow_format); +const char *ofputil_nx_flow_format_to_string(enum nx_flow_format); + +/* Work with ofp10_match. */ +void ofputil_wildcard_from_ofpfw10(uint32_t ofpfw, struct flow_wildcards *); +void ofputil_match_from_ofp10_match(const struct ofp10_match *, + struct match *); +void ofputil_normalize_match(struct match *); +void ofputil_normalize_match_quiet(struct match *); +void ofputil_match_to_ofp10_match(const struct match *, struct ofp10_match *); + +/* Work with ofp11_match. */ +enum ofperr ofputil_pull_ofp11_match(struct ofpbuf *, const struct tun_table *, + struct match *, + uint16_t *padded_match_len); +enum ofperr ofputil_pull_ofp11_mask(struct ofpbuf *, struct match *, + struct mf_bitmap *bm); +enum ofperr ofputil_match_from_ofp11_match(const struct ofp11_match *, + struct match *); +int ofputil_put_ofp11_match(struct ofpbuf *, const struct match *, + enum ofputil_protocol); +void ofputil_match_to_ofp11_match(const struct match *, struct ofp11_match *); +int ofputil_match_typical_len(enum ofputil_protocol); + +/* dl_type translation between OpenFlow and 'struct flow' format. */ +ovs_be16 ofputil_dl_type_to_openflow(ovs_be16 flow_dl_type); +ovs_be16 ofputil_dl_type_from_openflow(ovs_be16 ofp_dl_type); + +/* PACKET_IN. */ +bool ofputil_packet_in_format_is_valid(enum nx_packet_in_format); +int ofputil_packet_in_format_from_string(const char *); +const char *ofputil_packet_in_format_to_string(enum nx_packet_in_format); +struct ofpbuf *ofputil_make_set_packet_in_format(enum ofp_version, + enum nx_packet_in_format); + +/* NXT_FLOW_MOD_TABLE_ID extension. */ +struct ofpbuf *ofputil_make_flow_mod_table_id(bool flow_mod_table_id); + +/* Protocol-independent flow_mod flags. */ +enum ofputil_flow_mod_flags { + /* Flags that are maintained with a flow as part of its state. + * + * (OFPUTIL_FF_EMERG would be here too, if OVS supported it.) */ + OFPUTIL_FF_SEND_FLOW_REM = 1 << 0, /* All versions. */ + OFPUTIL_FF_NO_PKT_COUNTS = 1 << 1, /* OpenFlow 1.3+. */ + OFPUTIL_FF_NO_BYT_COUNTS = 1 << 2, /* OpenFlow 1.3+. */ + + /* These flags primarily affects flow_mod behavior. They are not + * particularly useful as part of flow state. We include them in flow + * state only because OpenFlow implies that they should be. */ + OFPUTIL_FF_CHECK_OVERLAP = 1 << 3, /* All versions. */ + OFPUTIL_FF_RESET_COUNTS = 1 << 4, /* OpenFlow 1.2+. */ + + /* Not supported by OVS. */ + OFPUTIL_FF_EMERG = 1 << 5, /* OpenFlow 1.0 only. */ + + /* The set of flags maintained as part of a flow table entry. */ +#define OFPUTIL_FF_STATE (OFPUTIL_FF_SEND_FLOW_REM \ + | OFPUTIL_FF_NO_PKT_COUNTS \ + | OFPUTIL_FF_NO_BYT_COUNTS \ + | OFPUTIL_FF_CHECK_OVERLAP \ + | OFPUTIL_FF_RESET_COUNTS) + + /* Flags that are only set by OVS for its internal use. Cannot be set via + * OpenFlow. */ + OFPUTIL_FF_HIDDEN_FIELDS = 1 << 6, /* Allow hidden match fields to be + set or modified. */ + OFPUTIL_FF_NO_READONLY = 1 << 7, /* Allow rules within read only tables + to be modified */ +}; + +/* Protocol-independent flow_mod. + * + * The handling of cookies across multiple versions of OpenFlow is a bit + * confusing. See the topics/design doc for the details. */ +struct ofputil_flow_mod { + struct ovs_list list_node; /* For queuing flow_mods. */ + + struct match match; + int priority; + + /* Cookie matching. The flow_mod affects only flows that have cookies that + * bitwise match 'cookie' bits in positions where 'cookie_mask has 1-bits. + * + * 'cookie_mask' should be zero for OFPFC_ADD flow_mods. */ + ovs_be64 cookie; /* Cookie bits to match. */ + ovs_be64 cookie_mask; /* 1-bit in each 'cookie' bit to match. */ + + /* Cookie changes. + * + * OFPFC_ADD uses 'new_cookie' as the new flow's cookie. 'new_cookie' + * should not be UINT64_MAX. + * + * OFPFC_MODIFY and OFPFC_MODIFY_STRICT have two cases: + * + * - If one or more matching flows exist and 'modify_cookie' is true, + * then the flow_mod changes the existing flows' cookies to + * 'new_cookie'. 'new_cookie' should not be UINT64_MAX. + * + * - If no matching flow exists, 'new_cookie' is not UINT64_MAX, and + * 'cookie_mask' is 0, then the flow_mod adds a new flow with + * 'new_cookie' as its cookie. + */ + ovs_be64 new_cookie; /* New cookie to install or UINT64_MAX. */ + bool modify_cookie; /* Set cookie of existing flow to 'new_cookie'? */ + + uint8_t table_id; + uint16_t command; + uint16_t idle_timeout; + uint16_t hard_timeout; + uint32_t buffer_id; + ofp_port_t out_port; + uint32_t out_group; + enum ofputil_flow_mod_flags flags; + uint16_t importance; /* Eviction precedence. */ + struct ofpact *ofpacts; /* Series of "struct ofpact"s. */ + size_t ofpacts_len; /* Length of ofpacts, in bytes. */ +}; + +enum ofperr ofputil_decode_flow_mod(struct ofputil_flow_mod *, + const struct ofp_header *, + enum ofputil_protocol, + const struct tun_table *, + const struct vl_mff_map *, + struct ofpbuf *ofpacts, + ofp_port_t max_port, + uint8_t max_table); +struct ofpbuf *ofputil_encode_flow_mod(const struct ofputil_flow_mod *, + enum ofputil_protocol); + +/* Flow stats or aggregate stats request, independent of protocol. */ +struct ofputil_flow_stats_request { + bool aggregate; /* Aggregate results? */ + struct match match; + ovs_be64 cookie; + ovs_be64 cookie_mask; + ofp_port_t out_port; + uint32_t out_group; + uint8_t table_id; +}; + +enum ofperr ofputil_decode_flow_stats_request( + struct ofputil_flow_stats_request *, const struct ofp_header *, + const struct tun_table *); +struct ofpbuf *ofputil_encode_flow_stats_request( + const struct ofputil_flow_stats_request *, enum ofputil_protocol); + +/* Flow stats reply, independent of protocol. */ +struct ofputil_flow_stats { + struct match match; + ovs_be64 cookie; + uint8_t table_id; + uint16_t priority; + uint16_t idle_timeout; + uint16_t hard_timeout; + uint32_t duration_sec; + uint32_t duration_nsec; + int idle_age; /* Seconds since last packet, -1 if unknown. */ + int hard_age; /* Seconds since last change, -1 if unknown. */ + uint64_t packet_count; /* Packet count, UINT64_MAX if unknown. */ + uint64_t byte_count; /* Byte count, UINT64_MAX if unknown. */ + const struct ofpact *ofpacts; + size_t ofpacts_len; + enum ofputil_flow_mod_flags flags; + uint16_t importance; /* Eviction precedence. */ +}; + +int ofputil_decode_flow_stats_reply(struct ofputil_flow_stats *, + struct ofpbuf *msg, + bool flow_age_extension, + struct ofpbuf *ofpacts); +void ofputil_append_flow_stats_reply(const struct ofputil_flow_stats *, + struct ovs_list *replies, + const struct tun_table *); + +/* Aggregate stats reply, independent of protocol. */ +struct ofputil_aggregate_stats { + uint64_t packet_count; /* Packet count, UINT64_MAX if unknown. */ + uint64_t byte_count; /* Byte count, UINT64_MAX if unknown. */ + uint32_t flow_count; +}; + +struct ofpbuf *ofputil_encode_aggregate_stats_reply( + const struct ofputil_aggregate_stats *stats, + const struct ofp_header *request); +enum ofperr ofputil_decode_aggregate_stats_reply( + struct ofputil_aggregate_stats *, + const struct ofp_header *reply); + +/* Flow removed message, independent of protocol. */ +struct ofputil_flow_removed { + struct match match; + ovs_be64 cookie; + uint16_t priority; + uint8_t reason; /* One of OFPRR_*. */ + uint8_t table_id; /* 255 if message didn't include table ID. */ + uint32_t duration_sec; + uint32_t duration_nsec; + uint16_t idle_timeout; + uint16_t hard_timeout; + uint64_t packet_count; /* Packet count, UINT64_MAX if unknown. */ + uint64_t byte_count; /* Byte count, UINT64_MAX if unknown. */ +}; + +enum ofperr ofputil_decode_flow_removed(struct ofputil_flow_removed *, + const struct ofp_header *); +struct ofpbuf *ofputil_encode_flow_removed(const struct ofputil_flow_removed *, + enum ofputil_protocol); + +/* Abstract packet-in message. + * + * This omits the 'total_len' and 'buffer_id' fields, which we handle + * differently for encoding and decoding.*/ +struct ofputil_packet_in { + /* Packet data and metadata. + * + * On encoding, the full packet should be supplied, but depending on its + * other parameters ofputil_encode_packet_in() might send only the first + * part of the packet. + * + * On decoding, the 'len' bytes in 'packet' might only be the first part of + * the original packet. ofputil_decode_packet_in() reports the full + * original length of the packet using its 'total_len' output parameter. */ + void *packet; /* The packet. */ + size_t packet_len; /* Length of 'packet' in bytes. */ + + /* Input port and other metadata for packet. */ + struct match flow_metadata; + + /* Reason that the packet-in is being sent. */ + enum ofp_packet_in_reason reason; /* One of OFPR_*. */ + + /* Information about the OpenFlow flow that triggered the packet-in. + * + * A packet-in triggered by a flow table miss has no associated flow. In + * that case, 'cookie' is UINT64_MAX. */ + uint8_t table_id; /* OpenFlow table ID. */ + ovs_be64 cookie; /* Flow's cookie. */ + + /* Arbitrary user-provided data. */ + uint8_t *userdata; + size_t userdata_len; +}; + +void ofputil_packet_in_destroy(struct ofputil_packet_in *); + +enum ofperr ofputil_decode_packet_in(const struct ofp_header *, bool loose, + const struct tun_table *, + struct ofputil_packet_in *, + size_t *total_len, uint32_t *buffer_id, + struct ofpbuf *continuation); + +struct ofpbuf *ofputil_encode_resume(const struct ofputil_packet_in *pin, + const struct ofpbuf *continuation, + enum ofputil_protocol); + +enum { OFPUTIL_PACKET_IN_REASON_BUFSIZE = INT_STRLEN(int) + 1 }; +const char *ofputil_packet_in_reason_to_string(enum ofp_packet_in_reason, + char *reasonbuf, + size_t bufsize); +bool ofputil_packet_in_reason_from_string(const char *, + enum ofp_packet_in_reason *); + +/* A packet-in message, including continuation data. The format of + * continuation data is subject to change and thus it is supposed to be opaque + * to any process other than ovs-vswitchd. Therefore, only ovs-vswitchd should + * use ofputil_packet_in_private and the functions that operate on it. */ +struct ofputil_packet_in_private { + struct ofputil_packet_in public; + + /* NXCPT_BRIDGE. */ + struct uuid bridge; + + /* NXCPT_STACK. */ + uint8_t *stack; + size_t stack_size; + + /* NXCPT_MIRRORS. */ + uint32_t mirrors; + + /* NXCPT_CONNTRACKED. */ + bool conntracked; + + /* NXCPT_ACTIONS. */ + struct ofpact *actions; + size_t actions_len; + + /* NXCPT_ACTION_SET. */ + struct ofpact *action_set; + size_t action_set_len; +}; + +struct ofpbuf *ofputil_encode_packet_in_private( + const struct ofputil_packet_in_private *, + enum ofputil_protocol protocol, + enum nx_packet_in_format); + +enum ofperr ofputil_decode_packet_in_private( + const struct ofp_header *, bool loose, + const struct tun_table *, + struct ofputil_packet_in_private *, + size_t *total_len, uint32_t *buffer_id); + +void ofputil_packet_in_private_destroy(struct ofputil_packet_in_private *); + +/* Abstract packet-out message. + * + * ofputil_decode_packet_out() will ensure that 'in_port' is a physical port + * (OFPP_MAX or less) or one of OFPP_LOCAL, OFPP_NONE, or OFPP_CONTROLLER. */ +struct ofputil_packet_out { + const void *packet; /* Packet data, if buffer_id == UINT32_MAX. */ + size_t packet_len; /* Length of packet data in bytes. */ + uint32_t buffer_id; /* Buffer id or UINT32_MAX if no buffer. */ + ofp_port_t in_port; /* Packet's input port. */ + struct ofpact *ofpacts; /* Actions. */ + size_t ofpacts_len; /* Size of ofpacts in bytes. */ +}; + +enum ofperr ofputil_decode_packet_out(struct ofputil_packet_out *, + const struct ofp_header *, + struct ofpbuf *ofpacts); +struct ofpbuf *ofputil_encode_packet_out(const struct ofputil_packet_out *, + enum ofputil_protocol protocol); + +enum ofputil_frag_handling { + OFPUTIL_FRAG_NORMAL = OFPC_FRAG_NORMAL, /* No special handling. */ + OFPUTIL_FRAG_DROP = OFPC_FRAG_DROP, /* Drop fragments. */ + OFPUTIL_FRAG_REASM = OFPC_FRAG_REASM, /* Reassemble (if supported). */ + OFPUTIL_FRAG_NX_MATCH = OFPC_FRAG_NX_MATCH /* Match on frag bits. */ +}; + +const char *ofputil_frag_handling_to_string(enum ofputil_frag_handling); +bool ofputil_frag_handling_from_string(const char *, + enum ofputil_frag_handling *); + +/* Abstract struct ofp_switch_config. */ +struct ofputil_switch_config { + /* Fragment handling. */ + enum ofputil_frag_handling frag; + + /* 0: Do not send packet to controller when decrementing invalid IP TTL. + * 1: Do send packet to controller when decrementing invalid IP TTL. + * -1: Unspecified (only OpenFlow 1.1 and 1.2 support this setting. */ + int invalid_ttl_to_controller; + + /* Maximum bytes of packet to send to controller on miss. */ + uint16_t miss_send_len; +}; + +void ofputil_decode_get_config_reply(const struct ofp_header *, + struct ofputil_switch_config *); +struct ofpbuf *ofputil_encode_get_config_reply( + const struct ofp_header *request, const struct ofputil_switch_config *); + +enum ofperr ofputil_decode_set_config(const struct ofp_header *, + struct ofputil_switch_config *); +struct ofpbuf *ofputil_encode_set_config( + const struct ofputil_switch_config *, enum ofp_version); + +enum ofputil_port_config { + /* OpenFlow 1.0 and 1.1 share these values for these port config bits. */ + OFPUTIL_PC_PORT_DOWN = 1 << 0, /* Port is administratively down. */ + OFPUTIL_PC_NO_RECV = 1 << 2, /* Drop all packets received by port. */ + OFPUTIL_PC_NO_FWD = 1 << 5, /* Drop packets forwarded to port. */ + OFPUTIL_PC_NO_PACKET_IN = 1 << 6, /* No send packet-in msgs for port. */ + /* OpenFlow 1.0 only. */ + OFPUTIL_PC_NO_STP = 1 << 1, /* No 802.1D spanning tree for port. */ + OFPUTIL_PC_NO_RECV_STP = 1 << 3, /* Drop received 802.1D STP packets. */ + OFPUTIL_PC_NO_FLOOD = 1 << 4, /* Do not include port when flooding. */ + /* There are no OpenFlow 1.1-only bits. */ +}; + +enum ofputil_port_state { + /* OpenFlow 1.0 and 1.1 share this values for these port state bits. */ + OFPUTIL_PS_LINK_DOWN = 1 << 0, /* No physical link present. */ + /* OpenFlow 1.1 only. */ + OFPUTIL_PS_BLOCKED = 1 << 1, /* Port is blocked */ + OFPUTIL_PS_LIVE = 1 << 2, /* Live for Fast Failover Group. */ + /* OpenFlow 1.0 only. */ + OFPUTIL_PS_STP_LISTEN = 0 << 8, /* Not learning or relaying frames. */ + OFPUTIL_PS_STP_LEARN = 1 << 8, /* Learning but not relaying frames. */ + OFPUTIL_PS_STP_FORWARD = 2 << 8, /* Learning and relaying frames. */ + OFPUTIL_PS_STP_BLOCK = 3 << 8, /* Not part of spanning tree. */ + OFPUTIL_PS_STP_MASK = 3 << 8 /* Bit mask for OFPPS10_STP_* values. */ +}; + +/* Abstract ofp10_phy_port or ofp11_port. */ +struct ofputil_phy_port { + ofp_port_t port_no; + struct eth_addr hw_addr; + char name[OFP_MAX_PORT_NAME_LEN]; + enum ofputil_port_config config; + enum ofputil_port_state state; + + /* NETDEV_F_* feature bitmasks. */ + enum netdev_features curr; /* Current features. */ + enum netdev_features advertised; /* Features advertised by the port. */ + enum netdev_features supported; /* Features supported by the port. */ + enum netdev_features peer; /* Features advertised by peer. */ + + /* Speed. */ + uint32_t curr_speed; /* Current speed, in kbps. */ + uint32_t max_speed; /* Maximum supported speed, in kbps. */ +}; + +enum ofputil_capabilities { + /* All OpenFlow versions share these capability values. */ + OFPUTIL_C_FLOW_STATS = 1 << 0, /* Flow statistics. */ + OFPUTIL_C_TABLE_STATS = 1 << 1, /* Table statistics. */ + OFPUTIL_C_PORT_STATS = 1 << 2, /* Port statistics. */ + OFPUTIL_C_IP_REASM = 1 << 5, /* Can reassemble IP fragments. */ + OFPUTIL_C_QUEUE_STATS = 1 << 6, /* Queue statistics. */ + + /* OpenFlow 1.0 and 1.1 share this capability. */ + OFPUTIL_C_ARP_MATCH_IP = 1 << 7, /* Match IP addresses in ARP pkts. */ + + /* OpenFlow 1.0 only. */ + OFPUTIL_C_STP = 1 << 3, /* 802.1d spanning tree. */ + + /* OpenFlow 1.1+ only. Note that this bit value does not match the one + * in the OpenFlow message. */ + OFPUTIL_C_GROUP_STATS = 1 << 4, /* Group statistics. */ + + /* OpenFlow 1.2+ only. */ + OFPUTIL_C_PORT_BLOCKED = 1 << 8, /* Switch will block looping ports */ + + /* OpenFlow 1.4+ only. */ + OFPUTIL_C_BUNDLES = 1 << 9, /* Switch supports bundles. */ + OFPUTIL_C_FLOW_MONITORING = 1 << 10, /* Switch supports flow monitoring. */ +}; + +/* Abstract ofp_switch_features. */ +struct ofputil_switch_features { + uint64_t datapath_id; /* Datapath unique ID. */ + uint32_t n_buffers; /* Max packets buffered at once. */ + uint8_t n_tables; /* Number of tables supported by datapath. */ + uint8_t auxiliary_id; /* Identify auxiliary connections */ + enum ofputil_capabilities capabilities; + uint64_t ofpacts; /* Bitmap of OFPACT_* bits. */ +}; + +enum ofperr ofputil_pull_switch_features(struct ofpbuf *, + struct ofputil_switch_features *); + +struct ofpbuf *ofputil_encode_switch_features( + const struct ofputil_switch_features *, enum ofputil_protocol, + ovs_be32 xid); +void ofputil_put_switch_features_port(const struct ofputil_phy_port *, + struct ofpbuf *); +bool ofputil_switch_features_has_ports(struct ofpbuf *b); + +/* phy_port helper functions. */ +int ofputil_pull_phy_port(enum ofp_version ofp_version, struct ofpbuf *, + struct ofputil_phy_port *); + +/* Abstract ofp_port_status. */ +struct ofputil_port_status { + enum ofp_port_reason reason; + struct ofputil_phy_port desc; +}; + +enum ofperr ofputil_decode_port_status(const struct ofp_header *, + struct ofputil_port_status *); +struct ofpbuf *ofputil_encode_port_status(const struct ofputil_port_status *, + enum ofputil_protocol); + +/* Abstract ofp_port_mod. */ +struct ofputil_port_mod { + ofp_port_t port_no; + struct eth_addr hw_addr; + enum ofputil_port_config config; + enum ofputil_port_config mask; + enum netdev_features advertise; +}; + +enum ofperr ofputil_decode_port_mod(const struct ofp_header *, + struct ofputil_port_mod *, bool loose); +struct ofpbuf *ofputil_encode_port_mod(const struct ofputil_port_mod *, + enum ofputil_protocol); + +/* Abstract version of OFPTC11_TABLE_MISS_*. + * + * OpenFlow 1.0 always sends packets that miss to the next flow table, or to + * the controller if they miss in the last flow table. + * + * OpenFlow 1.1 and 1.2 can configure table miss behavior via a "table-mod" + * that specifies "send to controller", "miss", or "drop". + * + * OpenFlow 1.3 and later never sends packets that miss to the controller. + */ +enum ofputil_table_miss { + /* Protocol-specific default behavior. On OpenFlow 1.0 through 1.2 + * connections, the packet is sent to the controller, and on OpenFlow 1.3 + * and later connections, the packet is dropped. + * + * This is also used as a result of decoding OpenFlow 1.3+ "config" values + * in table-mods, to indicate that no table-miss was specified. */ + OFPUTIL_TABLE_MISS_DEFAULT, /* Protocol default behavior. */ + + /* These constants have the same meanings as those in OpenFlow with the + * same names. */ + OFPUTIL_TABLE_MISS_CONTROLLER, /* Send to controller. */ + OFPUTIL_TABLE_MISS_CONTINUE, /* Go to next table. */ + OFPUTIL_TABLE_MISS_DROP, /* Drop the packet. */ +}; + +/* Abstract version of OFPTC14_EVICTION. + * + * OpenFlow 1.0 through 1.3 don't know anything about eviction, so decoding a + * message for one of these protocols always yields + * OFPUTIL_TABLE_EVICTION_DEFAULT. */ +enum ofputil_table_eviction { + OFPUTIL_TABLE_EVICTION_DEFAULT, /* No value. */ + OFPUTIL_TABLE_EVICTION_ON, /* Enable eviction. */ + OFPUTIL_TABLE_EVICTION_OFF /* Disable eviction. */ +}; + +/* Abstract version of OFPTC14_VACANCY_EVENTS. + * + * OpenFlow 1.0 through 1.3 don't know anything about vacancy events, so + * decoding a message for one of these protocols always yields + * OFPUTIL_TABLE_VACANCY_DEFAULT. */ +enum ofputil_table_vacancy { + OFPUTIL_TABLE_VACANCY_DEFAULT, /* No value. */ + OFPUTIL_TABLE_VACANCY_ON, /* Enable vacancy events. */ + OFPUTIL_TABLE_VACANCY_OFF /* Disable vacancy events. */ +}; + +/* Abstract version of OFPTMPT_VACANCY. + * + * Openflow 1.4+ defines vacancy events. + * The fields vacancy_down and vacancy_up are the threshold for generating + * vacancy events that should be configured on the flow table, expressed as + * a percent. + * The vacancy field is only used when this property in included in a + * OFPMP_TABLE_DESC multipart reply or a OFPT_TABLE_STATUS message and + * represent the current vacancy of the table, expressed as a percent. In + * OFP_TABLE_MOD requests, this field must be set to 0 */ +struct ofputil_table_mod_prop_vacancy { + uint8_t vacancy_down; /* Vacancy threshold when space decreases (%). */ + uint8_t vacancy_up; /* Vacancy threshold when space increases (%). */ + uint8_t vacancy; /* Current vacancy (%). */ +}; + +/* Abstract ofp_table_mod. */ +struct ofputil_table_mod { + uint8_t table_id; /* ID of the table, 0xff indicates all tables. */ + + /* OpenFlow 1.1 and 1.2 only. For other versions, ignored on encoding, + * decoded to OFPUTIL_TABLE_MISS_DEFAULT. */ + enum ofputil_table_miss miss; + + /* OpenFlow 1.4+ only. For other versions, ignored on encoding, decoded to + * OFPUTIL_TABLE_EVICTION_DEFAULT. */ + enum ofputil_table_eviction eviction; + + /* OpenFlow 1.4+ only and optional even there; UINT32_MAX indicates + * absence. For other versions, ignored on encoding, decoded to + * UINT32_MAX.*/ + uint32_t eviction_flags; /* OFPTMPEF14_*. */ + + /* OpenFlow 1.4+ only. For other versions, ignored on encoding, decoded to + * OFPUTIL_TABLE_VACANCY_DEFAULT. */ + enum ofputil_table_vacancy vacancy; + + /* Openflow 1.4+ only. Defines threshold values of vacancy expressed as + * percent, value of current vacancy is set to zero for table-mod. + * For other versions, ignored on encoding, all values decoded to + * zero. */ + struct ofputil_table_mod_prop_vacancy table_vacancy; +}; + +/* Abstract ofp14_table_desc. */ +struct ofputil_table_desc { + uint8_t table_id; /* ID of the table. */ + enum ofputil_table_eviction eviction; + uint32_t eviction_flags; /* UINT32_MAX if not present. */ + enum ofputil_table_vacancy vacancy; + struct ofputil_table_mod_prop_vacancy table_vacancy; +}; + +enum ofperr ofputil_decode_table_mod(const struct ofp_header *, + struct ofputil_table_mod *); +struct ofpbuf *ofputil_encode_table_mod(const struct ofputil_table_mod *, + enum ofputil_protocol); + +/* Abstract ofp_table_features. + * + * This is used for all versions of OpenFlow, even though ofp_table_features + * was only introduced in OpenFlow 1.3, because earlier versions of OpenFlow + * include support for a subset of ofp_table_features through OFPST_TABLE (aka + * OFPMP_TABLE). */ +struct ofputil_table_features { + uint8_t table_id; /* Identifier of table. Lower numbered tables + are consulted first. */ + char name[OFP_MAX_TABLE_NAME_LEN]; + ovs_be64 metadata_match; /* Bits of metadata table can match. */ + ovs_be64 metadata_write; /* Bits of metadata table can write. */ + uint32_t max_entries; /* Max number of entries supported. */ + + /* Flags. + * + * 'miss_config' is relevant for OpenFlow 1.1 and 1.2 only, because those + * versions include OFPTC_MISS_* flags in OFPST_TABLE. For other versions, + * it is decoded to OFPUTIL_TABLE_MISS_DEFAULT and ignored for encoding. + * + * 'supports_eviction' and 'supports_vacancy_events' are relevant only for + * OpenFlow 1.4 and later only. For OF1.4, they are boolean: 1 if + * supported, otherwise 0. For other versions, they are decoded as -1 and + * ignored for encoding. + * + * Search for "OFPTC_* Table Configuration" in the documentation for more + * details of how OpenFlow has changed in this area. + */ + enum ofputil_table_miss miss_config; /* OF1.1 and 1.2 only. */ + int supports_eviction; /* OF1.4+ only. */ + int supports_vacancy_events; /* OF1.4+ only. */ + + /* Table features related to instructions. There are two instances: + * + * - 'miss' reports features available in the table miss flow. + * + * - 'nonmiss' reports features available in other flows. */ + struct ofputil_table_instruction_features { + /* Tables that "goto-table" may jump to. */ + unsigned long int next[BITMAP_N_LONGS(255)]; + + /* Bitmap of OVSINST_* for supported instructions. */ + uint32_t instructions; + + /* Table features related to actions. There are two instances: + * + * - 'write' reports features available in a "write_actions" + * instruction. + * + * - 'apply' reports features available in an "apply_actions" + * instruction. */ + struct ofputil_table_action_features { + uint64_t ofpacts; /* Bitmap of supported OFPACT_*. */ + struct mf_bitmap set_fields; /* Fields for "set-field". */ + } write, apply; + } nonmiss, miss; + + /* MFF_* bitmaps. + * + * For any given field the following combinations are valid: + * + * - match=0, wildcard=0, mask=0: Flows in this table cannot match on + * this field. + * + * - match=1, wildcard=0, mask=0: Flows in this table must match on all + * the bits in this field. + * + * - match=1, wildcard=1, mask=0: Flows in this table must either match + * on all the bits in the field or wildcard the field entirely. + * + * - match=1, wildcard=1, mask=1: Flows in this table may arbitrarily + * mask this field (as special cases, they may match on all the bits + * or wildcard it entirely). + * + * Other combinations do not make sense. + */ + struct mf_bitmap match; /* Fields that may be matched. */ + struct mf_bitmap mask; /* Subset of 'match' that may have masks. */ + struct mf_bitmap wildcard; /* Subset of 'match' that may be wildcarded. */ +}; + +int ofputil_decode_table_features(struct ofpbuf *, + struct ofputil_table_features *, bool loose); + +int ofputil_decode_table_desc(struct ofpbuf *, + struct ofputil_table_desc *, + enum ofp_version); + +struct ofpbuf *ofputil_encode_table_features_request(enum ofp_version); + +struct ofpbuf *ofputil_encode_table_desc_request(enum ofp_version); + +void ofputil_append_table_features_reply( + const struct ofputil_table_features *tf, struct ovs_list *replies); + +void ofputil_append_table_desc_reply(const struct ofputil_table_desc *td, + struct ovs_list *replies, + enum ofp_version); + +/* Meter band configuration for all supported band types. */ +struct ofputil_meter_band { + uint16_t type; + uint8_t prec_level; /* Non-zero if type == OFPMBT_DSCP_REMARK. */ + uint32_t rate; + uint32_t burst_size; +}; + +struct ofputil_meter_band_stats { + uint64_t packet_count; + uint64_t byte_count; +}; + +struct ofputil_meter_config { + uint32_t meter_id; + uint16_t flags; + uint16_t n_bands; + struct ofputil_meter_band *bands; +}; + +/* Abstract ofp_meter_mod. */ +struct ofputil_meter_mod { + uint16_t command; + struct ofputil_meter_config meter; +}; + +struct ofputil_meter_stats { + uint32_t meter_id; + uint32_t flow_count; + uint64_t packet_in_count; + uint64_t byte_in_count; + uint32_t duration_sec; + uint32_t duration_nsec; + uint16_t n_bands; + struct ofputil_meter_band_stats *bands; +}; + +struct ofputil_meter_features { + uint32_t max_meters; /* Maximum number of meters. */ + uint32_t band_types; /* Can support max 32 band types. */ + uint32_t capabilities; /* Supported flags. */ + uint8_t max_bands; + uint8_t max_color; +}; + +enum ofperr ofputil_decode_meter_mod(const struct ofp_header *, + struct ofputil_meter_mod *, + struct ofpbuf *bands); +struct ofpbuf *ofputil_encode_meter_mod(enum ofp_version, + const struct ofputil_meter_mod *); + +void ofputil_decode_meter_features(const struct ofp_header *, + struct ofputil_meter_features *); +struct ofpbuf *ofputil_encode_meter_features_reply(const struct + ofputil_meter_features *, + const struct ofp_header * + request); +void ofputil_decode_meter_request(const struct ofp_header *, + uint32_t *meter_id); + +void ofputil_append_meter_config(struct ovs_list *replies, + const struct ofputil_meter_config *); + +void ofputil_append_meter_stats(struct ovs_list *replies, + const struct ofputil_meter_stats *); + +enum ofputil_meter_request_type { + OFPUTIL_METER_FEATURES, + OFPUTIL_METER_CONFIG, + OFPUTIL_METER_STATS +}; + +struct ofpbuf *ofputil_encode_meter_request(enum ofp_version, + enum ofputil_meter_request_type, + uint32_t meter_id); + +int ofputil_decode_meter_stats(struct ofpbuf *, + struct ofputil_meter_stats *, + struct ofpbuf *bands); + +int ofputil_decode_meter_config(struct ofpbuf *, + struct ofputil_meter_config *, + struct ofpbuf *bands); + +/* Type for meter_id in ofproto provider interface, UINT32_MAX if invalid. */ +typedef struct { uint32_t uint32; } ofproto_meter_id; + +/* Abstract ofp_role_request and reply. */ +struct ofputil_role_request { + enum ofp12_controller_role role; + bool have_generation_id; + uint64_t generation_id; +}; + +struct ofputil_role_status { + enum ofp12_controller_role role; + enum ofp14_controller_role_reason reason; + uint64_t generation_id; +}; + +enum ofperr ofputil_decode_role_message(const struct ofp_header *, + struct ofputil_role_request *); +struct ofpbuf *ofputil_encode_role_reply(const struct ofp_header *, + const struct ofputil_role_request *); + +struct ofpbuf *ofputil_encode_role_status( + const struct ofputil_role_status *status, + enum ofputil_protocol protocol); + +enum ofperr ofputil_decode_role_status(const struct ofp_header *oh, + struct ofputil_role_status *rs); + +/* Abstract table stats. + * + * This corresponds to the OpenFlow 1.3 table statistics structure, which only + * includes actual statistics. In earlier versions of OpenFlow, several + * members describe table features, so this structure has to be paired with + * struct ofputil_table_features to get all information. */ +struct ofputil_table_stats { + uint8_t table_id; /* Identifier of table. */ + uint32_t active_count; /* Number of active entries. */ + uint64_t lookup_count; /* Number of packets looked up in table. */ + uint64_t matched_count; /* Number of packets that hit table. */ +}; + +struct ofpbuf *ofputil_encode_table_stats_reply(const struct ofp_header *rq); + +struct ofpbuf *ofputil_encode_table_desc_reply(const struct ofp_header *rq); + +void ofputil_append_table_stats_reply(struct ofpbuf *reply, + const struct ofputil_table_stats *, + const struct ofputil_table_features *); + +int ofputil_decode_table_stats_reply(struct ofpbuf *reply, + struct ofputil_table_stats *, + struct ofputil_table_features *); + +/* Queue configuration request. */ +struct ofpbuf *ofputil_encode_queue_get_config_request(enum ofp_version, + ofp_port_t port, + uint32_t queue); +enum ofperr ofputil_decode_queue_get_config_request(const struct ofp_header *, + ofp_port_t *port, + uint32_t *queue); + +/* Queue configuration reply. */ +struct ofputil_queue_config { + ofp_port_t port; + uint32_t queue; + + /* Each of these optional values is expressed in tenths of a percent. + * Values greater than 1000 indicate that the feature is disabled. + * UINT16_MAX indicates that the value is omitted. */ + uint16_t min_rate; + uint16_t max_rate; +}; + +void ofputil_start_queue_get_config_reply(const struct ofp_header *request, + struct ovs_list *replies); +void ofputil_append_queue_get_config_reply( + const struct ofputil_queue_config *, struct ovs_list *replies); + +int ofputil_pull_queue_get_config_reply(struct ofpbuf *reply, + struct ofputil_queue_config *); + + +/* Abstract nx_flow_monitor_request. */ +struct ofputil_flow_monitor_request { + uint32_t id; + enum nx_flow_monitor_flags flags; + ofp_port_t out_port; + uint8_t table_id; + struct match match; +}; + +int ofputil_decode_flow_monitor_request(struct ofputil_flow_monitor_request *, + struct ofpbuf *msg); +void ofputil_append_flow_monitor_request( + const struct ofputil_flow_monitor_request *, struct ofpbuf *msg); + +/* Abstract nx_flow_update. */ +struct ofputil_flow_update { + enum nx_flow_update_event event; + + /* Used only for NXFME_ADDED, NXFME_DELETED, NXFME_MODIFIED. */ + enum ofp_flow_removed_reason reason; + uint16_t idle_timeout; + uint16_t hard_timeout; + uint8_t table_id; + uint16_t priority; + ovs_be64 cookie; + struct match match; + const struct ofpact *ofpacts; + size_t ofpacts_len; + + /* Used only for NXFME_ABBREV. */ + ovs_be32 xid; +}; + +int ofputil_decode_flow_update(struct ofputil_flow_update *, + struct ofpbuf *msg, struct ofpbuf *ofpacts); +void ofputil_start_flow_update(struct ovs_list *replies); +void ofputil_append_flow_update(const struct ofputil_flow_update *, + struct ovs_list *replies, + const struct tun_table *); + +/* Abstract nx_flow_monitor_cancel. */ +uint32_t ofputil_decode_flow_monitor_cancel(const struct ofp_header *); +struct ofpbuf *ofputil_encode_flow_monitor_cancel(uint32_t id); + +/* Port desc stats requests and replies. */ +enum ofperr ofputil_decode_port_desc_stats_request(const struct ofp_header *, + ofp_port_t *portp); +struct ofpbuf *ofputil_encode_port_desc_stats_request( + enum ofp_version ofp_version, ofp_port_t); + +void ofputil_append_port_desc_stats_reply(const struct ofputil_phy_port *pp, + struct ovs_list *replies); + +/* Encoding simple OpenFlow messages. */ +struct ofpbuf *make_echo_request(enum ofp_version); +struct ofpbuf *make_echo_reply(const struct ofp_header *rq); + +struct ofpbuf *ofputil_encode_barrier_request(enum ofp_version); + +/* Actions. */ + +bool action_outputs_to_port(const union ofp_action *, ovs_be16 port); + +enum ofperr ofputil_pull_actions(struct ofpbuf *, unsigned int actions_len, + union ofp_action **, size_t *); + +bool ofputil_actions_equal(const union ofp_action *a, size_t n_a, + const union ofp_action *b, size_t n_b); +union ofp_action *ofputil_actions_clone(const union ofp_action *, size_t n); + +/* Handy utility for parsing flows and actions. */ +bool ofputil_parse_key_value(char **stringp, char **keyp, char **valuep); + +struct ofputil_port_stats { + ofp_port_t port_no; + struct netdev_stats stats; + uint32_t duration_sec; /* UINT32_MAX if unknown. */ + uint32_t duration_nsec; +}; + +struct ofpbuf *ofputil_encode_dump_ports_request(enum ofp_version ofp_version, + ofp_port_t port); +void ofputil_append_port_stat(struct ovs_list *replies, + const struct ofputil_port_stats *ops); +size_t ofputil_count_port_stats(const struct ofp_header *); +int ofputil_decode_port_stats(struct ofputil_port_stats *, struct ofpbuf *msg); +enum ofperr ofputil_decode_port_stats_request(const struct ofp_header *request, + ofp_port_t *ofp10_port); + +struct ofputil_ipfix_stats { + uint32_t collector_set_id; /* Used only for flow-based IPFIX statistics. */ + uint64_t total_flows; /* Totabl flows of this IPFIX exporter. */ + uint64_t current_flows; /* Current flows of this IPFIX exporter. */ + uint64_t pkts; /* Successfully sampled packets. */ + uint64_t ipv4_pkts; /* Successfully sampled IPV4 packets. */ + uint64_t ipv6_pkts; /* Successfully sampled IPV6 packets. */ + uint64_t error_pkts; /* Error packets when sampling. */ + uint64_t ipv4_error_pkts; /* Error IPV4 packets when sampling. */ + uint64_t ipv6_error_pkts; /* Error IPV6 packets when sampling. */ + uint64_t tx_pkts; /* TX IPFIX packets. */ + uint64_t tx_errors; /* IPFIX packets TX errors. */ +}; + +void ofputil_append_ipfix_stat(struct ovs_list *replies, + const struct ofputil_ipfix_stats *ois); +size_t ofputil_count_ipfix_stats(const struct ofp_header *); +int ofputil_pull_ipfix_stats(struct ofputil_ipfix_stats *, struct ofpbuf *msg); + +struct ofputil_queue_stats_request { + ofp_port_t port_no; /* OFPP_ANY means "all ports". */ + uint32_t queue_id; +}; + +enum ofperr +ofputil_decode_queue_stats_request(const struct ofp_header *request, + struct ofputil_queue_stats_request *oqsr); +struct ofpbuf * +ofputil_encode_queue_stats_request(enum ofp_version ofp_version, + const struct ofputil_queue_stats_request *oqsr); + +struct ofputil_queue_stats { + ofp_port_t port_no; + uint32_t queue_id; + + /* Values of unsupported statistics are set to all-1-bits (UINT64_MAX). */ + uint64_t tx_bytes; + uint64_t tx_packets; + uint64_t tx_errors; + + /* UINT32_MAX if unknown. */ + uint32_t duration_sec; + uint32_t duration_nsec; +}; + +size_t ofputil_count_queue_stats(const struct ofp_header *); +int ofputil_decode_queue_stats(struct ofputil_queue_stats *qs, struct ofpbuf *msg); +void ofputil_append_queue_stat(struct ovs_list *replies, + const struct ofputil_queue_stats *oqs); + +struct bucket_counter { + uint64_t packet_count; /* Number of packets processed by bucket. */ + uint64_t byte_count; /* Number of bytes processed by bucket. */ +}; + +/* Bucket for use in groups. */ +struct ofputil_bucket { + struct ovs_list list_node; + uint16_t weight; /* Relative weight, for "select" groups. */ + ofp_port_t watch_port; /* Port whose state affects whether this bucket + * is live. Only required for fast failover + * groups. */ + uint32_t watch_group; /* Group whose state affects whether this + * bucket is live. Only required for fast + * failover groups. */ + uint32_t bucket_id; /* Bucket Id used to identify bucket*/ + struct ofpact *ofpacts; /* Series of "struct ofpact"s. */ + size_t ofpacts_len; /* Length of ofpacts, in bytes. */ + + struct bucket_counter stats; +}; + +/* Protocol-independent group_mod. */ +struct ofputil_group_props { + /* NTR selection method */ + char selection_method[NTR_MAX_SELECTION_METHOD_LEN]; + uint64_t selection_method_param; + struct field_array fields; +}; + +/* Protocol-independent group_mod. */ +struct ofputil_group_mod { + uint16_t command; /* One of OFPGC15_*. */ + uint8_t type; /* One of OFPGT11_*. */ + uint32_t group_id; /* Group identifier. */ + uint32_t command_bucket_id; /* Bucket Id used as part of + * OFPGC15_INSERT_BUCKET and + * OFPGC15_REMOVE_BUCKET commands + * execution.*/ + struct ovs_list buckets; /* Contains "struct ofputil_bucket"s. */ + struct ofputil_group_props props; /* Group properties. */ +}; + +/* Group stats reply, independent of protocol. */ +struct ofputil_group_stats { + uint32_t group_id; /* Group identifier. */ + uint32_t ref_count; + uint64_t packet_count; /* Packet count, UINT64_MAX if unknown. */ + uint64_t byte_count; /* Byte count, UINT64_MAX if unknown. */ + uint32_t duration_sec; /* UINT32_MAX if unknown. */ + uint32_t duration_nsec; + uint32_t n_buckets; + struct bucket_counter *bucket_stats; +}; + +/* Group features reply, independent of protocol. + * + * Only OF1.2 and later support group features replies. */ +struct ofputil_group_features { + uint32_t types; /* Bitmap of OFPGT_* values supported. */ + uint32_t capabilities; /* Bitmap of OFPGFC12_* capability supported. */ + uint32_t max_groups[4]; /* Maximum number of groups for each type. */ + uint64_t ofpacts[4]; /* Bitmaps of supported OFPACT_* */ +}; + +/* Group desc reply, independent of protocol. */ +struct ofputil_group_desc { + uint8_t type; /* One of OFPGT_*. */ + uint32_t group_id; /* Group identifier. */ + struct ovs_list buckets; /* Contains "struct ofputil_bucket"s. */ + struct ofputil_group_props props; /* Group properties. */ +}; + +void ofputil_group_properties_destroy(struct ofputil_group_props *); +void ofputil_group_properties_copy(struct ofputil_group_props *to, + const struct ofputil_group_props *from); +void ofputil_bucket_list_destroy(struct ovs_list *buckets); +void ofputil_bucket_clone_list(struct ovs_list *dest, + const struct ovs_list *src, + const struct ofputil_bucket *); +struct ofputil_bucket *ofputil_bucket_find(const struct ovs_list *, + uint32_t bucket_id); +bool ofputil_bucket_check_duplicate_id(const struct ovs_list *); +struct ofputil_bucket *ofputil_bucket_list_front(const struct ovs_list *); +struct ofputil_bucket *ofputil_bucket_list_back(const struct ovs_list *); + +static inline bool +ofputil_bucket_has_liveness(const struct ofputil_bucket *bucket) +{ + return (bucket->watch_port != OFPP_ANY || + bucket->watch_group != OFPG_ANY); +} + +struct ofpbuf *ofputil_encode_group_stats_request(enum ofp_version, + uint32_t group_id); +enum ofperr ofputil_decode_group_stats_request( + const struct ofp_header *request, uint32_t *group_id); +void ofputil_append_group_stats(struct ovs_list *replies, + const struct ofputil_group_stats *); +struct ofpbuf *ofputil_encode_group_features_request(enum ofp_version); +struct ofpbuf *ofputil_encode_group_features_reply( + const struct ofputil_group_features *, const struct ofp_header *request); +void ofputil_decode_group_features_reply(const struct ofp_header *, + struct ofputil_group_features *); +void ofputil_uninit_group_mod(struct ofputil_group_mod *gm); +struct ofpbuf *ofputil_encode_group_mod(enum ofp_version ofp_version, + const struct ofputil_group_mod *gm); + +enum ofperr ofputil_decode_group_mod(const struct ofp_header *, + struct ofputil_group_mod *); + +int ofputil_decode_group_stats_reply(struct ofpbuf *, + struct ofputil_group_stats *); + +void ofputil_uninit_group_desc(struct ofputil_group_desc *gd); +uint32_t ofputil_decode_group_desc_request(const struct ofp_header *); +struct ofpbuf *ofputil_encode_group_desc_request(enum ofp_version, + uint32_t group_id); + +int ofputil_decode_group_desc_reply(struct ofputil_group_desc *, + struct ofpbuf *, enum ofp_version); + +void ofputil_append_group_desc_reply(const struct ofputil_group_desc *, + const struct ovs_list *buckets, + struct ovs_list *replies); + +struct ofputil_bundle_ctrl_msg { + uint32_t bundle_id; + uint16_t type; + uint16_t flags; +}; + +struct ofputil_bundle_add_msg { + uint32_t bundle_id; + uint16_t flags; + const struct ofp_header *msg; +}; + +enum ofperr ofputil_decode_bundle_ctrl(const struct ofp_header *, + struct ofputil_bundle_ctrl_msg *); + +struct ofpbuf *ofputil_encode_bundle_ctrl_request(enum ofp_version, + struct ofputil_bundle_ctrl_msg *); +struct ofpbuf *ofputil_encode_bundle_ctrl_reply(const struct ofp_header *, + struct ofputil_bundle_ctrl_msg *); + +struct ofpbuf *ofputil_encode_bundle_add(enum ofp_version ofp_version, + struct ofputil_bundle_add_msg *msg); + +enum ofperr ofputil_decode_bundle_add(const struct ofp_header *, + struct ofputil_bundle_add_msg *, + enum ofptype *type); + +/* Bundle message as produced by ofp-parse. */ +struct ofputil_bundle_msg { + enum ofptype type; + union { + struct ofputil_flow_mod fm; + struct ofputil_group_mod gm; + struct ofputil_packet_out po; + }; +}; + +void ofputil_encode_bundle_msgs(const struct ofputil_bundle_msg *bms, + size_t n_bms, struct ovs_list *requests, + enum ofputil_protocol); +void ofputil_free_bundle_msgs(struct ofputil_bundle_msg *bms, size_t n_bms); + +struct ofputil_tlv_map { + struct ovs_list list_node; + + uint16_t option_class; + uint8_t option_type; + uint8_t option_len; + uint16_t index; +}; + +struct ofputil_tlv_table_mod { + uint16_t command; + struct ovs_list mappings; /* Contains "struct ofputil_tlv_map"s. */ +}; + +struct ofputil_tlv_table_reply { + uint32_t max_option_space; + uint16_t max_fields; + struct ovs_list mappings; /* Contains "struct ofputil_tlv_map"s. */ +}; + +struct ofpbuf *ofputil_encode_tlv_table_mod(enum ofp_version ofp_version, + struct ofputil_tlv_table_mod *); +enum ofperr ofputil_decode_tlv_table_mod(const struct ofp_header *, + struct ofputil_tlv_table_mod *); +struct ofpbuf *ofputil_encode_tlv_table_reply(const struct ofp_header *, + struct ofputil_tlv_table_reply *); +enum ofperr ofputil_decode_tlv_table_reply(const struct ofp_header *, + struct ofputil_tlv_table_reply *); +void ofputil_uninit_tlv_table(struct ovs_list *mappings); + +enum ofputil_async_msg_type { + /* Standard asynchronous messages. */ + OAM_PACKET_IN, /* OFPT_PACKET_IN or NXT_PACKET_IN. */ + OAM_PORT_STATUS, /* OFPT_PORT_STATUS. */ + OAM_FLOW_REMOVED, /* OFPT_FLOW_REMOVED or NXT_FLOW_REMOVED. */ + OAM_ROLE_STATUS, /* OFPT_ROLE_STATUS. */ + OAM_TABLE_STATUS, /* OFPT_TABLE_STATUS. */ + OAM_REQUESTFORWARD, /* OFPT_REQUESTFORWARD. */ + + /* Extension asynchronous messages (none yet--coming soon!). */ +#define OAM_EXTENSIONS 0 /* Bitmap of all extensions. */ + + OAM_N_TYPES +}; +const char *ofputil_async_msg_type_to_string(enum ofputil_async_msg_type); + +struct ofputil_async_cfg { + uint32_t master[OAM_N_TYPES]; + uint32_t slave[OAM_N_TYPES]; +}; +#define OFPUTIL_ASYNC_CFG_INIT (struct ofputil_async_cfg) { .master[0] = 0 } + +enum ofperr ofputil_decode_set_async_config(const struct ofp_header *, + bool loose, + const struct ofputil_async_cfg *, + struct ofputil_async_cfg *); + +struct ofpbuf *ofputil_encode_get_async_reply( + const struct ofp_header *, const struct ofputil_async_cfg *); +struct ofpbuf *ofputil_encode_set_async_config( + const struct ofputil_async_cfg *, uint32_t oams, enum ofp_version); + +struct ofputil_async_cfg ofputil_async_cfg_default(enum ofp_version); + +struct ofputil_requestforward { + ovs_be32 xid; + enum ofp14_requestforward_reason reason; + union { + /* reason == OFPRFR_METER_MOD. */ + struct { + struct ofputil_meter_mod *meter_mod; + struct ofpbuf bands; + }; + + /* reason == OFPRFR_GROUP_MOD. */ + struct ofputil_group_mod *group_mod; + }; +}; + +struct ofpbuf *ofputil_encode_requestforward( + const struct ofputil_requestforward *, enum ofputil_protocol); +enum ofperr ofputil_decode_requestforward(const struct ofp_header *, + struct ofputil_requestforward *); +void ofputil_destroy_requestforward(struct ofputil_requestforward *); + +/* Abstract ofp14_table_status. */ +struct ofputil_table_status { + enum ofp14_table_reason reason; /* One of OFPTR_*. */ + struct ofputil_table_desc desc; /* New table config. */ +}; + +enum ofperr ofputil_decode_table_status(const struct ofp_header *oh, + struct ofputil_table_status *ts); + +struct ofpbuf * +ofputil_encode_table_status(const struct ofputil_table_status *ts, + enum ofputil_protocol protocol); +#endif /* ofp-util.h */ diff --git a/openflow/include/openvswitch/ofpbuf.h b/openflow/include/openvswitch/ofpbuf.h new file mode 100644 index 0000000..bc25bb8 --- /dev/null +++ b/openflow/include/openvswitch/ofpbuf.h @@ -0,0 +1,277 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2015, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_OFPBUF_H +#define OPENVSWITCH_OFPBUF_H 1 + +#include +#include +#include +#include +#include "openvswitch/dynamic-string.h" +#include "openvswitch/list.h" +#include "openvswitch/util.h" + +#ifdef __cplusplus +extern "C" { +#endif + +enum OVS_PACKED_ENUM ofpbuf_source { + OFPBUF_MALLOC, /* Obtained via malloc(). */ + OFPBUF_STACK, /* Un-movable stack space or static buffer. */ + OFPBUF_STUB, /* Starts on stack, may expand into heap. */ +}; + +/* Buffer for holding arbitrary data. An ofpbuf is automatically reallocated + * as necessary if it grows too large for the available memory. + * + * 'header' and 'msg' conventions: + * + * OpenFlow messages: 'header' points to the start of the OpenFlow + * header, while 'msg' is the OpenFlow msg body. + * When parsing, the 'data' will move past these, as data is being + * pulled from the OpenFlow message. + * + * Caution: buffer manipulation of 'struct ofpbuf' must always update + * the 'header' and 'msg' pointers. + * + * + * Actions: When encoding OVS action lists, the 'header' is used + * as a pointer to the beginning of the current action (see ofpact_put()). + * + * rconn: Reuses 'header' as a private pointer while queuing. + */ +struct ofpbuf { + void *base; /* First byte of allocated space. */ + void *data; /* First byte actually in use. */ + uint32_t size; /* Number of bytes in use. */ + uint32_t allocated; /* Number of bytes allocated. */ + + void *header; /* OpenFlow header. */ + void *msg; /* message's body */ + struct ovs_list list_node; /* Private list element for use by owner. */ + enum ofpbuf_source source; /* Source of memory allocated as 'base'. */ +}; + +/* An initializer for a struct ofpbuf that will be initially empty and uses the + * space in STUB (which should be an array) as a stub. This is the initializer + * form of ofpbuf_use_stub(). + * + * Usage example: + * + * uint64_t stub[1024 / 8]; // 1 kB stub properly aligned for 64-bit data. + * struct ofpbuf ofpbuf = OFPBUF_STUB_INITIALIZER(stub); + */ +#define OFPBUF_STUB_INITIALIZER(STUB) { \ + .base = (STUB), \ + .data = (STUB), \ + .size = 0, \ + .allocated = sizeof (STUB), \ + .header = NULL, \ + .msg = NULL, \ + .list_node = OVS_LIST_POISON, \ + .source = OFPBUF_STUB, \ + } + +/* An initializer for a struct ofpbuf whose data starts at DATA and continues + * for SIZE bytes. This is appropriate for an ofpbuf that will be used to + * inspect existing data, without moving it around or reallocating it, and + * generally without modifying it at all. This is the initializer form of + * ofpbuf_use_const(). + */ +static inline struct ofpbuf +ofpbuf_const_initializer(const void *data, size_t size) +{ + return (struct ofpbuf) { + .base = CONST_CAST(void *, data), + .data = CONST_CAST(void *, data), + .size = size, + .allocated = size, + .header = NULL, + .msg = NULL, + .list_node = OVS_LIST_POISON, + .source = OFPBUF_STACK, + }; +} + +void ofpbuf_use_ds(struct ofpbuf *, const struct ds *); +void ofpbuf_use_stack(struct ofpbuf *, void *, size_t); +void ofpbuf_use_stub(struct ofpbuf *, void *, size_t); +void ofpbuf_use_const(struct ofpbuf *, const void *, size_t); + +void ofpbuf_init(struct ofpbuf *, size_t); +void ofpbuf_uninit(struct ofpbuf *); +void ofpbuf_reinit(struct ofpbuf *, size_t); + +struct ofpbuf *ofpbuf_new(size_t); +struct ofpbuf *ofpbuf_new_with_headroom(size_t, size_t headroom); +struct ofpbuf *ofpbuf_clone(const struct ofpbuf *); +struct ofpbuf *ofpbuf_clone_with_headroom(const struct ofpbuf *, + size_t headroom); +struct ofpbuf *ofpbuf_clone_data(const void *, size_t); +struct ofpbuf *ofpbuf_clone_data_with_headroom(const void *, size_t, + size_t headroom); +static inline void ofpbuf_delete(struct ofpbuf *); + +static inline void *ofpbuf_at(const struct ofpbuf *, size_t offset, + size_t size); +static inline void *ofpbuf_at_assert(const struct ofpbuf *, size_t offset, + size_t size); +static inline void *ofpbuf_tail(const struct ofpbuf *); +static inline void *ofpbuf_end(const struct ofpbuf *); + +void *ofpbuf_put_uninit(struct ofpbuf *, size_t); +void *ofpbuf_put_zeros(struct ofpbuf *, size_t); +void *ofpbuf_put(struct ofpbuf *, const void *, size_t); +char *ofpbuf_put_hex(struct ofpbuf *, const char *s, size_t *n); +void ofpbuf_reserve(struct ofpbuf *, size_t); +void *ofpbuf_push_uninit(struct ofpbuf *b, size_t); +void *ofpbuf_push_zeros(struct ofpbuf *, size_t); +void *ofpbuf_push(struct ofpbuf *b, const void *, size_t); + +static inline size_t ofpbuf_headroom(const struct ofpbuf *); +static inline size_t ofpbuf_tailroom(const struct ofpbuf *); +static inline size_t ofpbuf_msgsize(const struct ofpbuf *); +void ofpbuf_prealloc_headroom(struct ofpbuf *, size_t); +void ofpbuf_prealloc_tailroom(struct ofpbuf *, size_t); +void ofpbuf_trim(struct ofpbuf *); +void ofpbuf_padto(struct ofpbuf *, size_t); +void ofpbuf_shift(struct ofpbuf *, int); + +static inline void ofpbuf_clear(struct ofpbuf *); +static inline void *ofpbuf_pull(struct ofpbuf *, size_t); +static inline void *ofpbuf_try_pull(struct ofpbuf *, size_t); + +void *ofpbuf_steal_data(struct ofpbuf *); + +char *ofpbuf_to_string(const struct ofpbuf *, size_t maxbytes); +static inline struct ofpbuf *ofpbuf_from_list(const struct ovs_list *); +void ofpbuf_list_delete(struct ovs_list *); +static inline bool ofpbuf_equal(const struct ofpbuf *, const struct ofpbuf *); + + +/* Frees memory that 'b' points to, as well as 'b' itself. */ +static inline void ofpbuf_delete(struct ofpbuf *b) +{ + if (b) { + ofpbuf_uninit(b); + free(b); + } +} + +/* If 'b' contains at least 'offset + size' bytes of data, returns a pointer to + * byte 'offset'. Otherwise, returns a null pointer. */ +static inline void *ofpbuf_at(const struct ofpbuf *b, size_t offset, + size_t size) +{ + return offset + size <= b->size ? (char *) b->data + offset : NULL; +} + +/* Returns a pointer to byte 'offset' in 'b', which must contain at least + * 'offset + size' bytes of data. */ +static inline void *ofpbuf_at_assert(const struct ofpbuf *b, size_t offset, + size_t size) +{ + ovs_assert(offset + size <= b->size); + return ((char *) b->data) + offset; +} + +/* Returns a pointer to byte following the last byte of data in use in 'b'. */ +static inline void *ofpbuf_tail(const struct ofpbuf *b) +{ + return (char *) b->data + b->size; +} + +/* Returns a pointer to byte following the last byte allocated for use (but + * not necessarily in use) in 'b'. */ +static inline void *ofpbuf_end(const struct ofpbuf *b) +{ + return (char *) b->base + b->allocated; +} + +/* Returns the number of bytes of headroom in 'b', that is, the number of bytes + * of unused space in ofpbuf 'b' before the data that is in use. (Most + * commonly, the data in a ofpbuf is at its beginning, and thus the ofpbuf's + * headroom is 0.) */ +static inline size_t ofpbuf_headroom(const struct ofpbuf *b) +{ + return (char*)b->data - (char*)b->base; +} + +/* Returns the number of bytes that may be appended to the tail end of ofpbuf + * 'b' before the ofpbuf must be reallocated. */ +static inline size_t ofpbuf_tailroom(const struct ofpbuf *b) +{ + return (char*)ofpbuf_end(b) - (char*)ofpbuf_tail(b); +} + +/* Returns the number of bytes from 'b->header' to 'b->msg', that is, the + * length of 'b''s header. */ +static inline size_t +ofpbuf_headersize(const struct ofpbuf *b) +{ + return (char *)b->msg - (char *)b->header; +} + +/* Returns the number of bytes from 'b->msg' to 'b->data + b->size', that is, + * the length of the used space in 'b' starting from 'msg'. */ +static inline size_t +ofpbuf_msgsize(const struct ofpbuf *b) +{ + return (char *)ofpbuf_tail(b) - (char *)b->msg; +} + +/* Clears any data from 'b'. */ +static inline void ofpbuf_clear(struct ofpbuf *b) +{ + b->data = b->base; + b->size = 0; +} + +/* Removes 'size' bytes from the head end of 'b', which must contain at least + * 'size' bytes of data. Returns the first byte of data removed. */ +static inline void *ofpbuf_pull(struct ofpbuf *b, size_t size) +{ + void *data = b->data; + b->data = (char*)b->data + size; + b->size = b->size - size; + return data; +} + +/* If 'b' has at least 'size' bytes of data, removes that many bytes from the + * head end of 'b' and returns the first byte removed. Otherwise, returns a + * null pointer without modifying 'b'. */ +static inline void *ofpbuf_try_pull(struct ofpbuf *b, size_t size) +{ + return b->size >= size ? ofpbuf_pull(b, size) : NULL; +} + +static inline struct ofpbuf *ofpbuf_from_list(const struct ovs_list *list) +{ + return CONTAINER_OF(list, struct ofpbuf, list_node); +} + +static inline bool ofpbuf_equal(const struct ofpbuf *a, const struct ofpbuf *b) +{ + return a->size == b->size && + memcmp(a->data, b->data, a->size) == 0; +} + +#ifdef __cplusplus +} +#endif + +#endif /* ofpbuf.h */ diff --git a/openflow/include/openvswitch/packets.h b/openflow/include/openvswitch/packets.h new file mode 100644 index 0000000..5d97309 --- /dev/null +++ b/openflow/include/openvswitch/packets.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_PACKETS_H +#define OPENVSWITCH_PACKETS_H 1 + +#include +#include "openvswitch/tun-metadata.h" + +/* Tunnel information used in flow key and metadata. */ +struct flow_tnl { + ovs_be32 ip_dst; + struct in6_addr ipv6_dst; + ovs_be32 ip_src; + struct in6_addr ipv6_src; + ovs_be64 tun_id; + uint16_t flags; + uint8_t ip_tos; + uint8_t ip_ttl; + ovs_be16 tp_src; + ovs_be16 tp_dst; + ovs_be16 gbp_id; + uint8_t gbp_flags; + uint8_t pad1[5]; /* Pad to 64 bits. */ + struct tun_metadata metadata; +}; + +/* Some flags are exposed through OpenFlow while others are used only + * internally. */ + +/* Public flags */ +#define FLOW_TNL_F_OAM (1 << 0) + +#define FLOW_TNL_PUB_F_MASK ((1 << 1) - 1) + +/* Private flags */ +#define FLOW_TNL_F_DONT_FRAGMENT (1 << 1) +#define FLOW_TNL_F_CSUM (1 << 2) +#define FLOW_TNL_F_KEY (1 << 3) + +#define FLOW_TNL_F_MASK ((1 << 4) - 1) + +/* Unfortunately, a "struct flow" sometimes has to handle OpenFlow port + * numbers and other times datapath (dpif) port numbers. This union allows + * access to both. */ +union flow_in_port { + odp_port_t odp_port; + ofp_port_t ofp_port; +}; + +#endif /* packets.h */ diff --git a/openflow/include/openvswitch/shash.h b/openflow/include/openvswitch/shash.h new file mode 100644 index 0000000..afc4823 --- /dev/null +++ b/openflow/include/openvswitch/shash.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2009, 2010, 2011, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SHASH_H +#define SHASH_H 1 + +#include "openvswitch/hmap.h" +#include "openvswitch/util.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct shash_node { + struct hmap_node node; + char *name; + void *data; +}; + +struct shash { + struct hmap map; +}; + +#define SHASH_INITIALIZER(SHASH) { HMAP_INITIALIZER(&(SHASH)->map) } + +#define SHASH_FOR_EACH(SHASH_NODE, SHASH) \ + HMAP_FOR_EACH_INIT (SHASH_NODE, node, &(SHASH)->map, \ + BUILD_ASSERT_TYPE(SHASH_NODE, struct shash_node *), \ + BUILD_ASSERT_TYPE(SHASH, struct shash *)) + +#define SHASH_FOR_EACH_SAFE(SHASH_NODE, NEXT, SHASH) \ + HMAP_FOR_EACH_SAFE_INIT ( \ + SHASH_NODE, NEXT, node, &(SHASH)->map, \ + BUILD_ASSERT_TYPE(SHASH_NODE, struct shash_node *), \ + BUILD_ASSERT_TYPE(NEXT, struct shash_node *), \ + BUILD_ASSERT_TYPE(SHASH, struct shash *)) + +void shash_init(struct shash *); +void shash_destroy(struct shash *); +void shash_destroy_free_data(struct shash *); +void shash_swap(struct shash *, struct shash *); +void shash_moved(struct shash *); +void shash_clear(struct shash *); +void shash_clear_free_data(struct shash *); +bool shash_is_empty(const struct shash *); +size_t shash_count(const struct shash *); +struct shash_node *shash_add(struct shash *, const char *, const void *); +struct shash_node *shash_add_nocopy(struct shash *, char *, const void *); +bool shash_add_once(struct shash *, const char *, const void *); +void shash_add_assert(struct shash *, const char *, const void *); +void *shash_replace(struct shash *, const char *, const void *data); +void shash_delete(struct shash *, struct shash_node *); +char *shash_steal(struct shash *, struct shash_node *); +struct shash_node *shash_find(const struct shash *, const char *); +struct shash_node *shash_find_len(const struct shash *, const char *, size_t); +void *shash_find_data(const struct shash *, const char *); +void *shash_find_and_delete(struct shash *, const char *); +void *shash_find_and_delete_assert(struct shash *, const char *); +struct shash_node *shash_first(const struct shash *); +const struct shash_node **shash_sort(const struct shash *); +bool shash_equal_keys(const struct shash *, const struct shash *); +struct shash_node *shash_random_node(struct shash *); + +#ifdef __cplusplus +} +#endif + +#endif /* shash.h */ diff --git a/openflow/include/openvswitch/thread.h b/openflow/include/openvswitch/thread.h new file mode 100644 index 0000000..af6f2bb --- /dev/null +++ b/openflow/include/openvswitch/thread.h @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2013, 2014 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_THREAD_H +#define OPENVSWITCH_THREAD_H 1 + +#include +#include +#include +#include +#include "openvswitch/compiler.h" + +/* Mutex. */ +struct OVS_LOCKABLE ovs_mutex { + pthread_mutex_t lock; + const char *where; /* NULL if and only if uninitialized. */ +}; + +/* "struct ovs_mutex" initializer. */ +#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP +#define OVS_MUTEX_INITIALIZER { PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP, \ + "" } +#else +#define OVS_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, "" } +#endif + +#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP +#define OVS_ADAPTIVE_MUTEX_INITIALIZER \ + { PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP, "" } +#else +#define OVS_ADAPTIVE_MUTEX_INITIALIZER OVS_MUTEX_INITIALIZER +#endif + +/* ovs_mutex functions analogous to pthread_mutex_*() functions. + * + * Most of these functions abort the process with an error message on any + * error. ovs_mutex_trylock() is an exception: it passes through a 0 or EBUSY + * return value to the caller and aborts on any other error. */ +void ovs_mutex_init(const struct ovs_mutex *); +void ovs_mutex_init_recursive(const struct ovs_mutex *); +void ovs_mutex_init_adaptive(const struct ovs_mutex *); +void ovs_mutex_destroy(const struct ovs_mutex *); +void ovs_mutex_unlock(const struct ovs_mutex *mutex) OVS_RELEASES(mutex); +void ovs_mutex_lock_at(const struct ovs_mutex *mutex, const char *where) + OVS_ACQUIRES(mutex); +#define ovs_mutex_lock(mutex) \ + ovs_mutex_lock_at(mutex, OVS_SOURCE_LOCATOR) + +int ovs_mutex_trylock_at(const struct ovs_mutex *mutex, const char *where) + OVS_TRY_LOCK(0, mutex); +#define ovs_mutex_trylock(mutex) \ + ovs_mutex_trylock_at(mutex, OVS_SOURCE_LOCATOR) + +void ovs_mutex_cond_wait(pthread_cond_t *, const struct ovs_mutex *); + +/* Convenient once-only execution. + * + * + * Problem + * ======= + * + * POSIX provides pthread_once_t and pthread_once() as primitives for running a + * set of code only once per process execution. They are used like this: + * + * static void run_once(void) { ...initialization... } + * static pthread_once_t once = PTHREAD_ONCE_INIT; + * ... + * pthread_once(&once, run_once); + * + * pthread_once() does not allow passing any parameters to the initialization + * function, which is often inconvenient, because it means that the function + * can only access data declared at file scope. + * + * + * Solution + * ======== + * + * Use ovsthread_once, like this, instead: + * + * static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; + * + * if (ovsthread_once_start(&once)) { + * ...initialization... + * ovsthread_once_done(&once); + * } + */ + +struct ovsthread_once { + bool done; /* Non-atomic, false negatives possible. */ + struct ovs_mutex mutex; +}; + +#define OVSTHREAD_ONCE_INITIALIZER \ + { \ + false, \ + OVS_MUTEX_INITIALIZER, \ + } + +static inline bool ovsthread_once_start(struct ovsthread_once *once) + OVS_TRY_LOCK(true, once->mutex); +void ovsthread_once_done(struct ovsthread_once *once) + OVS_RELEASES(once->mutex); + +bool ovsthread_once_start__(struct ovsthread_once *once) + OVS_TRY_LOCK(true, once->mutex); + +/* Returns true if this is the first call to ovsthread_once_start() for + * 'once'. In this case, the caller should perform whatever initialization + * actions it needs to do, then call ovsthread_once_done() for 'once'. + * + * Returns false if this is not the first call to ovsthread_once_start() for + * 'once'. In this case, the call will not return until after + * ovsthread_once_done() has been called. */ +static inline bool +ovsthread_once_start(struct ovsthread_once *once) +{ + /* We may be reading 'done' at the same time as the first thread + * is writing on it, or we can be using a stale copy of it. The + * worst that can happen is that we call ovsthread_once_start__() + * once when strictly not necessary. */ + return OVS_UNLIKELY(!once->done && ovsthread_once_start__(once)); +} + +#endif /* ovs-thread.h */ diff --git a/openflow/include/openvswitch/token-bucket.h b/openflow/include/openvswitch/token-bucket.h new file mode 100644 index 0000000..6bb6040 --- /dev/null +++ b/openflow/include/openvswitch/token-bucket.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2012 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_TOKEN_BUCKET_H +#define OPENVSWITCH_TOKEN_BUCKET_H 1 + +#include +#include + +struct token_bucket { + /* Configuration settings. */ + unsigned int rate; /* Tokens added per millisecond. */ + unsigned int burst; /* Max cumulative tokens credit. */ + + /* Current status. */ + unsigned int tokens; /* Current number of tokens. */ + long long int last_fill; /* Last time tokens added. */ +}; + +#define TOKEN_BUCKET_INIT(RATE, BURST) { RATE, BURST, 0, LLONG_MIN } + +void token_bucket_init(struct token_bucket *, + unsigned int rate, unsigned int burst); +void token_bucket_set(struct token_bucket *, + unsigned int rate, unsigned int burst); +bool token_bucket_withdraw(struct token_bucket *, unsigned int n); +void token_bucket_wait_at(struct token_bucket *, unsigned int n, + const char *where); +#define token_bucket_wait(bucket, n) \ + token_bucket_wait_at(bucket, n, OVS_SOURCE_LOCATOR) + +#endif /* token-bucket.h */ diff --git a/openflow/include/openvswitch/tun-metadata.h b/openflow/include/openvswitch/tun-metadata.h new file mode 100644 index 0000000..1d6b737 --- /dev/null +++ b/openflow/include/openvswitch/tun-metadata.h @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2015 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_TUN_METADATA_H +#define OPENVSWITCH_TUN_METADATA_H 1 + +#include "openvswitch/geneve.h" + +#define TUN_METADATA_NUM_OPTS 64 +#define TUN_METADATA_TOT_OPT_SIZE 256 + +/* Tunnel option data, plus metadata to aid in their interpretation. + * + * The option data exists in two forms and is interpreted differently depending + * on whether FLOW_TNL_F_UDPIF is set in struct flow_tnl flags: + * + * When FLOW_TNL_F_UDPIF is set, the tunnel metadata is in "userspace datapath + * format". This is typically used for fast-path packet processing to avoid + * the cost of translating options and in situations where we need to maintain + * tunnel metadata exactly as it came in. In this case 'opts.gnv' is raw + * packet data from the tunnel header and 'present.len' indicates the length + * of the data stored there. In these situations, 'tab' is NULL. + * + * In all other cases, we are doing flow-based processing (such as during + * upcalls). FLOW_TNL_F_UDPIF is not set and options are reordered into + * pre-allocated locations. 'present.map' is indexed by type, that is, by the + * in TUN_METADATA, so that e.g. TUN_METADATA5 is present if + * 'present.map & (1ULL << 5)' is nonzero. The actual data for TUN_METADATA5, + * if present, might be anywhere in 'opts.u8' (not necessarily even contiguous), + * and finding it requires referring to 'tab', if set, or the global metadata + * table. */ +struct tun_metadata { + union { /* Valid members of 'opts'. When 'opts' is sorted into known types, + * 'map' is used. When 'opts' is raw packet data, 'len' is used. */ + uint64_t map; /* 1-bit for each present TLV. */ + uint8_t len; /* Length of data in 'opts'. */ + } present; + const struct tun_table *tab; /* Types & lengths for 'opts' and 'opt_map'. */ + +#if UINTPTR_MAX == UINT32_MAX + uint8_t pad[4]; /* Pad to 64-bit boundary. */ +#endif + + union { + uint8_t u8[TUN_METADATA_TOT_OPT_SIZE]; /* Values from tunnel TLVs. */ + struct geneve_opt gnv[TLV_TOT_OPT_SIZE / sizeof(struct geneve_opt)]; + } opts; +}; +BUILD_ASSERT_DECL(offsetof(struct tun_metadata, opts) % 8 == 0); +BUILD_ASSERT_DECL(sizeof(((struct tun_metadata *)0)->present.map) * 8 >= + TUN_METADATA_NUM_OPTS); + +/* The location of an option can be stored either as a single offset/len + * pair (hopefully) or if the address space is fragmented then it is a + * linked list of these blocks. */ +struct tun_metadata_loc_chain { + struct tun_metadata_loc_chain *next; + int offset; /* In bytes, from start of 'opts', multiple of 4. */ + int len; /* In bytes, multiple of 4. */ +}; + +struct tun_metadata_loc { + int len; /* Sum of 'len' over elements in chain. */ + struct tun_metadata_loc_chain c; +}; + +/* Bookkeeping information to keep track of an option that was allocated + * inside struct match. */ +struct tun_metadata_match_entry { + struct tun_metadata_loc loc; /* Allocated position. */ + bool masked; /* Source value had a mask. Otherwise we can't tell if the + * entire field was exact matched or only the portion that + * is the same size as the value. */ +}; + +/* Allocation of options inside struct match. This is important if we don't + * have access to an allocation table - either because there isn't one + * (ovs-ofctl) or if we need to keep the allocation outside of packet + * processing context (Packet-In). These structures never have dynamically + * allocated memory because the address space is never fragmented. */ +struct tun_metadata_allocation { + struct tun_metadata_match_entry entry[TUN_METADATA_NUM_OPTS]; + int alloc_offset; /* Byte offset into 'opts', multiple of 4. */ + bool valid; /* Set to true after any allocation occurs. */ +}; + + +#endif /* tun-metadata.h */ diff --git a/openflow/include/openvswitch/type-props.h b/openflow/include/openvswitch/type-props.h new file mode 100644 index 0000000..bf879cd --- /dev/null +++ b/openflow/include/openvswitch/type-props.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2008, 2011, 2015 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_TYPE_PROPS_H +#define OPENVSWITCH_TYPE_PROPS_H 1 + +#include + +/* True if TYPE is _Bool, false otherwise. */ +#define TYPE_IS_BOOL(TYPE) ((TYPE) 1 == (TYPE) 2) + +/* True if TYPE is an integer type (including _Bool), false if it is a + * floating-point type. */ +#define TYPE_IS_INTEGER(TYPE) ((TYPE) 1.5 == (TYPE) 1) + +/* True if TYPE is a signed integer or floating point type, otherwise false. */ +#define TYPE_IS_SIGNED(TYPE) ((TYPE) 1 > (TYPE) -1) + +/* The number of value bits in an signed or unsigned integer TYPE: + * + * - _Bool has 1 value bit. + * + * - An N-bit unsigned integer type has N value bits. + * + * - An N-bit signed integer type has N-1 value bits. + */ +#define TYPE_VALUE_BITS(TYPE) \ + (TYPE_IS_BOOL(TYPE) ? 1 : sizeof(TYPE) * CHAR_BIT - TYPE_IS_SIGNED(TYPE)) + +/* The minimum or maximum value of a signed or unsigned integer TYPE. */ +#define TYPE_MINIMUM(TYPE) (TYPE_IS_SIGNED(TYPE) ? -TYPE_MAXIMUM(TYPE) - 1 : 0) +#define TYPE_MAXIMUM(TYPE) \ + ((((TYPE)1 << (TYPE_VALUE_BITS(TYPE) - 1)) - 1) * 2 + 1) + +/* Number of decimal digits required to format an integer of the given TYPE. + * Includes space for a sign, if TYPE is signed, but not for a null + * terminator. + * + * The value is an overestimate. */ +#define INT_STRLEN(TYPE) (TYPE_IS_SIGNED(TYPE) + TYPE_VALUE_BITS(TYPE) / 3 + 1) + +#endif /* type-props.h */ diff --git a/openflow/include/openvswitch/types.h b/openflow/include/openvswitch/types.h new file mode 100644 index 0000000..2f5fcca --- /dev/null +++ b/openflow/include/openvswitch/types.h @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2010, 2011, 2013, 2014, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_TYPES_H +#define OPENVSWITCH_TYPES_H 1 + +#include +#include +#include "openvswitch/compiler.h" + +#ifdef __CHECKER__ +#define OVS_BITWISE __attribute__((bitwise)) +#define OVS_FORCE __attribute__((force)) +#else +#define OVS_BITWISE +#define OVS_FORCE +#endif + +/* The ovs_be types indicate that an object is in big-endian, not + * native-endian, byte order. They are otherwise equivalent to uint_t. */ +typedef uint16_t OVS_BITWISE ovs_be16; +typedef uint32_t OVS_BITWISE ovs_be32; +typedef uint64_t OVS_BITWISE ovs_be64; + +#define OVS_BE16_MAX ((OVS_FORCE ovs_be16) 0xffff) +#define OVS_BE32_MAX ((OVS_FORCE ovs_be32) 0xffffffff) +#define OVS_BE64_MAX ((OVS_FORCE ovs_be64) 0xffffffffffffffffULL) + +/* These types help with a few funny situations: + * + * - The Ethernet header is 14 bytes long, which misaligns everything after + * that. One can put 2 "shim" bytes before the Ethernet header, but this + * helps only if there is exactly one Ethernet header. If there are two, + * as with GRE and VXLAN (and if the inner header doesn't use this + * trick--GRE and VXLAN don't) then you have the choice of aligning the + * inner data or the outer data. So it seems better to treat 32-bit fields + * in protocol headers as aligned only on 16-bit boundaries. + * + * - ARP headers contain misaligned 32-bit fields. + * + * - Netlink and OpenFlow contain 64-bit values that are only guaranteed to + * be aligned on 32-bit boundaries. + * + * lib/unaligned.h has helper functions for accessing these. */ + +/* A 32-bit value, in host byte order, that is only aligned on a 16-bit + * boundary. */ +typedef struct { +#ifdef WORDS_BIGENDIAN + uint16_t hi, lo; +#else + uint16_t lo, hi; +#endif +} ovs_16aligned_u32; + +/* A 32-bit value, in network byte order, that is only aligned on a 16-bit + * boundary. */ +typedef struct { + ovs_be16 hi, lo; +} ovs_16aligned_be32; + +/* A 64-bit value, in host byte order, that is only aligned on a 32-bit + * boundary. */ +typedef struct { +#ifdef WORDS_BIGENDIAN + uint32_t hi, lo; +#else + uint32_t lo, hi; +#endif +} ovs_32aligned_u64; + +typedef union { + uint32_t u32[4]; + struct { +#ifdef WORDS_BIGENDIAN + uint64_t hi, lo; +#else + uint64_t lo, hi; +#endif + } u64; +} ovs_u128; + +typedef union { + ovs_be32 be32[4]; + struct { + ovs_be64 hi, lo; + } be64; +} ovs_be128; + +/* MSVC2015 doesn't support designated initializers when compiling C++, + * and doesn't support ternary operators with non-designated initializers. + * So we use these static definitions rather than using initializer macros. */ +static const ovs_u128 OVS_U128_ZERO = { { 0, 0, 0, 0 } }; +static const ovs_u128 OVS_U128_MAX = { { UINT32_MAX, UINT32_MAX, + UINT32_MAX, UINT32_MAX } }; +static const ovs_be128 OVS_BE128_MAX OVS_UNUSED = { { OVS_BE32_MAX, OVS_BE32_MAX, + OVS_BE32_MAX, OVS_BE32_MAX } }; +static const ovs_u128 OVS_U128_MIN OVS_UNUSED = { {0, 0, 0, 0} }; +static const ovs_u128 OVS_BE128_MIN OVS_UNUSED = { {0, 0, 0, 0} }; + +#define OVS_U128_ZERO OVS_U128_MIN + +/* A 64-bit value, in network byte order, that is only aligned on a 32-bit + * boundary. */ +typedef struct { + ovs_be32 hi, lo; +} ovs_32aligned_be64; + +/* Port numbers + * ------------ + * + * None of these types are directly interchangeable, hence the OVS_BITWISE + * annotation. + * + * ofp_port_t is an OpenFlow 1.0 port number. It uses a 16-bit range, even + * though it is a 32-bit type. This allows it to be overlaid on an odp_port_t + * for a few situations where this is useful, e.g. in union flow_in_port. + * + * ofp11_port_t is an OpenFlow-1.1 port number. + * + * odp_port_t is a port number within a datapath (e.g. see lib/dpif.h). + */ +typedef uint32_t OVS_BITWISE ofp_port_t; +typedef uint32_t OVS_BITWISE odp_port_t; +typedef uint32_t OVS_BITWISE ofp11_port_t; + +/* Macro functions that cast int types to ofp/odp/ofp11 types. */ +#define OFP_PORT_C(X) ((OVS_FORCE ofp_port_t) (X)) +#define ODP_PORT_C(X) ((OVS_FORCE odp_port_t) (X)) +#define OFP11_PORT_C(X) ((OVS_FORCE ofp11_port_t) (X)) + +/* Using this struct instead of a bare array makes an ethernet address field + * assignable. The size of the array is also part of the type, so it is easier + * to deal with. */ +struct eth_addr { + union { + uint8_t ea[6]; + ovs_be16 be16[3]; + }; +}; + +#endif /* openvswitch/types.h */ diff --git a/openflow/include/openvswitch/util.h b/openflow/include/openvswitch/util.h new file mode 100644 index 0000000..8453550 --- /dev/null +++ b/openflow/include/openvswitch/util.h @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_UTIL_H +#define OPENVSWITCH_UTIL_H 1 + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void ovs_set_program_name(const char *name, const char *version); + +const char *ovs_get_program_name(void); +const char *ovs_get_program_version(void); + +/* Expands to a string that looks like ":", e.g. "tmp.c:10". + * + * See http://c-faq.com/ansi/stringize.html for an explanation of OVS_STRINGIZE + * and OVS_STRINGIZE2. */ +#define OVS_SOURCE_LOCATOR __FILE__ ":" OVS_STRINGIZE(__LINE__) +#define OVS_STRINGIZE(ARG) OVS_STRINGIZE2(ARG) +#define OVS_STRINGIZE2(ARG) #ARG + +/* Saturating multiplication of "unsigned int"s: overflow yields UINT_MAX. */ +#define OVS_SAT_MUL(X, Y) \ + ((Y) == 0 ? 0 \ + : (X) <= UINT_MAX / (Y) ? (unsigned int) (X) * (unsigned int) (Y) \ + : UINT_MAX) + +/* Like the standard assert macro, except writes the failure message to the + * log. */ +#ifndef NDEBUG +#define ovs_assert(CONDITION) \ + if (!OVS_LIKELY(CONDITION)) { \ + ovs_assert_failure(OVS_SOURCE_LOCATOR, __func__, #CONDITION); \ + } +#else +#define ovs_assert(CONDITION) ((void) (CONDITION)) +#endif +OVS_NO_RETURN void ovs_assert_failure(const char *, const char *, const char *); + +/* This is a void expression that issues a compiler error if POINTER cannot be + * compared for equality with the given pointer TYPE. This generally means + * that POINTER is a qualified or unqualified TYPE. However, + * BUILD_ASSERT_TYPE(POINTER, void *) will accept any pointer to object type, + * because any pointer to object can be compared for equality with "void *". + * + * POINTER can be any expression. The use of "sizeof" ensures that the + * expression is not actually evaluated, so that any side effects of the + * expression do not occur. + * + * The cast to int is present only to suppress an "expression using sizeof + * bool" warning from "sparse" (see + * http://permalink.gmane.org/gmane.comp.parsers.sparse/2967). */ +#define BUILD_ASSERT_TYPE(POINTER, TYPE) \ + ((void) sizeof ((int) ((POINTER) == (TYPE) (POINTER)))) + +/* Casts 'pointer' to 'type' and issues a compiler warning if the cast changes + * anything other than an outermost "const" or "volatile" qualifier. */ +#define CONST_CAST(TYPE, POINTER) \ + (BUILD_ASSERT_TYPE(POINTER, TYPE), \ + (TYPE) (POINTER)) + +/* Given a pointer-typed lvalue OBJECT, expands to a pointer type that may be + * assigned to OBJECT. */ +#ifdef __GNUC__ +#define OVS_TYPEOF(OBJECT) typeof(OBJECT) +#else +#define OVS_TYPEOF(OBJECT) void * +#endif + +/* Given OBJECT of type pointer-to-structure, expands to the offset of MEMBER + * within an instance of the structure. + * + * The GCC-specific version avoids the technicality of undefined behavior if + * OBJECT is null, invalid, or not yet initialized. This makes some static + * checkers (like Coverity) happier. But the non-GCC version does not actually + * dereference any pointer, so it would be surprising for it to cause any + * problems in practice. + */ +#ifdef __GNUC__ +#define OBJECT_OFFSETOF(OBJECT, MEMBER) offsetof(typeof(*(OBJECT)), MEMBER) +#else +#define OBJECT_OFFSETOF(OBJECT, MEMBER) \ + ((char *) &(OBJECT)->MEMBER - (char *) (OBJECT)) +#endif + +/* Yields the size of MEMBER within STRUCT. */ +#define MEMBER_SIZEOF(STRUCT, MEMBER) (sizeof(((STRUCT *) NULL)->MEMBER)) + +/* Yields the offset of the end of MEMBER within STRUCT. */ +#define OFFSETOFEND(STRUCT, MEMBER) \ + (offsetof(STRUCT, MEMBER) + MEMBER_SIZEOF(STRUCT, MEMBER)) + +/* Given POINTER, the address of the given MEMBER in a STRUCT object, returns + the STRUCT object. */ +#define CONTAINER_OF(POINTER, STRUCT, MEMBER) \ + ((STRUCT *) (void *) ((char *) (POINTER) - offsetof (STRUCT, MEMBER))) + +/* Given POINTER, the address of the given MEMBER within an object of the type + * that that OBJECT points to, returns OBJECT as an assignment-compatible + * pointer type (either the correct pointer type or "void *"). OBJECT must be + * an lvalue. + * + * This is the same as CONTAINER_OF except that it infers the structure type + * from the type of '*OBJECT'. */ +#define OBJECT_CONTAINING(POINTER, OBJECT, MEMBER) \ + ((OVS_TYPEOF(OBJECT)) (void *) \ + ((char *) (POINTER) - OBJECT_OFFSETOF(OBJECT, MEMBER))) + +/* Given POINTER, the address of the given MEMBER within an object of the type + * that that OBJECT points to, assigns the address of the outer object to + * OBJECT, which must be an lvalue. + * + * Evaluates to (void) 0 as the result is not to be used. */ +#define ASSIGN_CONTAINER(OBJECT, POINTER, MEMBER) \ + ((OBJECT) = OBJECT_CONTAINING(POINTER, OBJECT, MEMBER), (void) 0) + +/* As explained in the comment above OBJECT_OFFSETOF(), non-GNUC compilers + * like MSVC will complain about un-initialized variables if OBJECT + * hasn't already been initialized. To prevent such warnings, INIT_CONTAINER() + * can be used as a wrapper around ASSIGN_CONTAINER. */ +#define INIT_CONTAINER(OBJECT, POINTER, MEMBER) \ + ((OBJECT) = NULL, ASSIGN_CONTAINER(OBJECT, POINTER, MEMBER)) + +/* Returns the number of elements in ARRAY. */ +#define ARRAY_SIZE(ARRAY) __ARRAY_SIZE(ARRAY) + +/* Returns X / Y, rounding up. X must be nonnegative to round correctly. */ +#define DIV_ROUND_UP(X, Y) (((X) + ((Y) - 1)) / (Y)) + +/* Returns X rounded up to the nearest multiple of Y. */ +#define ROUND_UP(X, Y) (DIV_ROUND_UP(X, Y) * (Y)) + +/* Returns the least number that, when added to X, yields a multiple of Y. */ +#define PAD_SIZE(X, Y) (ROUND_UP(X, Y) - (X)) + +/* Returns X rounded down to the nearest multiple of Y. */ +#define ROUND_DOWN(X, Y) ((X) / (Y) * (Y)) + +/* Returns true if X is a power of 2, otherwise false. */ +#define IS_POW2(X) ((X) && !((X) & ((X) - 1))) + +/* Expands to an anonymous union that contains: + * + * - MEMBERS in a nested anonymous struct. + * + * - An array as large as MEMBERS plus padding to a multiple of UNIT bytes. + * + * The effect is to pad MEMBERS to a multiple of UNIT bytes. + * + * For example, the struct below is 8 bytes long, with 6 bytes of padding: + * + * struct padded_struct { + * PADDED_MEMBERS(8, uint8_t x; uint8_t y;); + * }; + */ +#define PADDED_MEMBERS(UNIT, MEMBERS) \ + union { \ + struct { MEMBERS }; \ + uint8_t pad[ROUND_UP(sizeof(struct { MEMBERS }), UNIT)]; \ + } + +static inline bool +is_pow2(uintmax_t x) +{ + return IS_POW2(x); +} + +/* Returns X rounded up to a power of 2. X must be a constant expression. */ +#define ROUND_UP_POW2(X) RUP2__(X) +#define RUP2__(X) (RUP2_1(X) + 1) +#define RUP2_1(X) (RUP2_2(X) | (RUP2_2(X) >> 16)) +#define RUP2_2(X) (RUP2_3(X) | (RUP2_3(X) >> 8)) +#define RUP2_3(X) (RUP2_4(X) | (RUP2_4(X) >> 4)) +#define RUP2_4(X) (RUP2_5(X) | (RUP2_5(X) >> 2)) +#define RUP2_5(X) (RUP2_6(X) | (RUP2_6(X) >> 1)) +#define RUP2_6(X) ((X) - 1) + +/* Returns X rounded down to a power of 2. X must be a constant expression. */ +#define ROUND_DOWN_POW2(X) RDP2__(X) +#define RDP2__(X) (RDP2_1(X) - (RDP2_1(X) >> 1)) +#define RDP2_1(X) (RDP2_2(X) | (RDP2_2(X) >> 16)) +#define RDP2_2(X) (RDP2_3(X) | (RDP2_3(X) >> 8)) +#define RDP2_3(X) (RDP2_4(X) | (RDP2_4(X) >> 4)) +#define RDP2_4(X) (RDP2_5(X) | (RDP2_5(X) >> 2)) +#define RDP2_5(X) ( (X) | ( (X) >> 1)) + +/* Macros for sizing bitmaps */ +#define BITMAP_ULONG_BITS (sizeof(unsigned long) * CHAR_BIT) +#define BITMAP_N_LONGS(N_BITS) DIV_ROUND_UP(N_BITS, BITMAP_ULONG_BITS) + +/* Given ATTR, and TYPE, cast the ATTR to TYPE by first casting ATTR to + * (void *). This is to suppress the alignment warning issued by clang. */ +#define ALIGNED_CAST(TYPE, ATTR) ((TYPE) (void *) (ATTR)) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/openflow/include/openvswitch/uuid.h b/openflow/include/openvswitch/uuid.h new file mode 100644 index 0000000..383a408 --- /dev/null +++ b/openflow/include/openvswitch/uuid.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2008, 2009, 2010 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_UUID_H +#define OPENVSWITCH_UUID_H 1 + +#include "openvswitch/util.h" + +#define UUID_BIT 128 /* Number of bits in a UUID. */ +#define UUID_OCTET (UUID_BIT / 8) /* Number of bytes in a UUID. */ + +/* A Universally Unique IDentifier (UUID) compliant with RFC 4122. + * + * Each of the parts is stored in host byte order, but the parts themselves are + * ordered from left to right. That is, (parts[0] >> 24) is the first 8 bits + * of the UUID when output in the standard form, and (parts[3] & 0xff) is the + * final 8 bits. */ +struct uuid { + uint32_t parts[4]; +}; +BUILD_ASSERT_DECL(sizeof(struct uuid) == UUID_OCTET); + +#endif /* uuid.h */ diff --git a/openflow/include/openvswitch/vconn.h b/openflow/include/openvswitch/vconn.h new file mode 100644 index 0000000..40ca9ed --- /dev/null +++ b/openflow/include/openvswitch/vconn.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2008-2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_VCONN_H +#define OPENVSWITCH_VCONN_H 1 + +#include +#include "openvswitch/list.h" +#include "openvswitch/types.h" +#include "openvswitch/ofp-util.h" +#include "openflow/openflow.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct ofpbuf; +struct pvconn; +struct pvconn_class; +struct vconn; +struct vconn_class; + +void vconn_usage(bool active, bool passive, bool bootstrap); + +/* Active vconns: virtual connections to OpenFlow devices. */ +int vconn_verify_name(const char *name); +int vconn_open(const char *name, uint32_t allowed_versions, uint8_t dscp, + struct vconn **vconnp); +void vconn_close(struct vconn *); +const char *vconn_get_name(const struct vconn *); + +uint32_t vconn_get_allowed_versions(const struct vconn *vconn); +void vconn_set_allowed_versions(struct vconn *vconn, + uint32_t allowed_versions); +int vconn_get_version(const struct vconn *); +void vconn_set_recv_any_version(struct vconn *); + +int vconn_connect(struct vconn *); +int vconn_recv(struct vconn *, struct ofpbuf **); +int vconn_send(struct vconn *, struct ofpbuf *); +int vconn_recv_xid(struct vconn *, ovs_be32 xid, struct ofpbuf **); +int vconn_transact(struct vconn *, struct ofpbuf *, struct ofpbuf **); +int vconn_transact_noreply(struct vconn *, struct ofpbuf *, struct ofpbuf **); +int vconn_transact_multiple_noreply(struct vconn *, struct ovs_list *requests, + struct ofpbuf **replyp); + +int vconn_dump_flows(struct vconn *, const struct ofputil_flow_stats_request *, + enum ofputil_protocol, + struct ofputil_flow_stats **fsesp, size_t *n_fsesp); + +/* Bundle errors must be free()d by the caller. */ +struct vconn_bundle_error { + struct ovs_list list_node; + + /* OpenFlow header and some of the message contents for error reporting. */ + union { + struct ofp_header ofp_msg; + uint8_t ofp_msg_data[64]; + }; +}; + +/* Bundle errors must be free()d by the caller. */ +int vconn_bundle_transact(struct vconn *, struct ovs_list *requests, + uint16_t bundle_flags, + struct ovs_list *errors); + +void vconn_run(struct vconn *); +void vconn_run_wait(struct vconn *); + +int vconn_get_status(const struct vconn *); + +int vconn_open_block(const char *name, uint32_t allowed_versions, uint8_t dscp, + struct vconn **); +int vconn_connect_block(struct vconn *); +int vconn_send_block(struct vconn *, struct ofpbuf *); +int vconn_recv_block(struct vconn *, struct ofpbuf **); + +enum vconn_wait_type { + WAIT_CONNECT, + WAIT_RECV, + WAIT_SEND +}; +void vconn_wait(struct vconn *, enum vconn_wait_type); +void vconn_connect_wait(struct vconn *); +void vconn_recv_wait(struct vconn *); +void vconn_send_wait(struct vconn *); + +/* Passive vconns: virtual listeners for incoming OpenFlow connections. */ +int pvconn_verify_name(const char *name); +int pvconn_open(const char *name, uint32_t allowed_versions, uint8_t dscp, + struct pvconn **pvconnp); +const char *pvconn_get_name(const struct pvconn *); +void pvconn_close(struct pvconn *); +int pvconn_accept(struct pvconn *, struct vconn **); +void pvconn_wait(struct pvconn *); + +#ifdef __cplusplus +} +#endif + +#endif /* vconn.h */ diff --git a/openflow/include/openvswitch/version.h b/openflow/include/openvswitch/version.h new file mode 100644 index 0000000..f05409d --- /dev/null +++ b/openflow/include/openvswitch/version.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2014 Nicira, Inc. + * Copyright (c) 2014 Cisco Systems, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_VERSION_H +#define OPENVSWITCH_VERSION_H 1 + +#define OVS_PACKAGE_STRING "openvswitch 2.7.0" +#define OVS_PACKAGE_VERSION "2.7.0" + +#define OVS_LIB_VERSION 1 +#define OVS_LIB_REVISION 0 +#define OVS_LIB_AGE 0 + +#endif /* openvswitch/version.h */ diff --git a/openflow/include/openvswitch/vlog.h b/openflow/include/openvswitch/vlog.h new file mode 100644 index 0000000..3a40421 --- /dev/null +++ b/openflow/include/openvswitch/vlog.h @@ -0,0 +1,300 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_VLOG_H +#define OPENVSWITCH_VLOG_H 1 + +/* Logging. + * + * + * Thread-safety + * ============= + * + * Fully thread safe. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Logging severity levels. + * + * ovs-appctl(8) defines each of the log levels. */ +#define VLOG_LEVELS \ + VLOG_LEVEL(OFF, LOG_ALERT, 1) \ + VLOG_LEVEL(EMER, LOG_ALERT, 1) \ + VLOG_LEVEL(ERR, LOG_ERR, 3) \ + VLOG_LEVEL(WARN, LOG_WARNING, 4) \ + VLOG_LEVEL(INFO, LOG_NOTICE, 5) \ + VLOG_LEVEL(DBG, LOG_DEBUG, 7) +enum vlog_level { +#define VLOG_LEVEL(NAME, SYSLOG_LEVEL, RFC5424_LEVEL) VLL_##NAME, + VLOG_LEVELS +#undef VLOG_LEVEL + VLL_N_LEVELS +}; + +const char *vlog_get_level_name(enum vlog_level); +enum vlog_level vlog_get_level_val(const char *name); + +/* Destinations that we can log to. */ +#define VLOG_DESTINATIONS \ + VLOG_DESTINATION(SYSLOG, "ovs|%05N|%c%T|%p|%m") \ + VLOG_DESTINATION(CONSOLE, "%D{%Y-%m-%dT%H:%M:%SZ}|%05N|%c%T|%p|%m") \ + VLOG_DESTINATION(FILE, "%D{%Y-%m-%dT%H:%M:%S.###Z}|%05N|%c%T|%p|%m") +enum vlog_destination { +#define VLOG_DESTINATION(NAME, PATTERN) VLF_##NAME, + VLOG_DESTINATIONS +#undef VLOG_DESTINATION + VLF_N_DESTINATIONS, + VLF_ANY_DESTINATION = -1 +}; + +const char *vlog_get_destination_name(enum vlog_destination); +enum vlog_destination vlog_get_destination_val(const char *name); + +/* A log module. */ +struct vlog_module { + struct ovs_list list; + const char *name; /* User-visible name. */ + int levels[VLF_N_DESTINATIONS]; /* Minimum log level for each + destination. */ + int min_level; /* Minimum log level for any destination. */ + bool honor_rate_limits; /* Set false to ignore rate limits. */ +}; + +void vlog_insert_module(struct ovs_list *); + +const char *vlog_get_module_name(const struct vlog_module *); +struct vlog_module *vlog_module_from_name(const char *name); + +/* Rate-limiter for log messages. */ +struct vlog_rate_limit { + struct token_bucket token_bucket; + time_t first_dropped; /* Time first message was dropped. */ + time_t last_dropped; /* Time of most recent message drop. */ + unsigned int n_dropped; /* Number of messages dropped. */ + struct ovs_mutex mutex; /* Mutual exclusion for rate limit. */ +}; + +/* Number of tokens to emit a message. We add 'rate' tokens per millisecond, + * thus 60,000 tokens are required to emit one message per minute. */ +#define VLOG_MSG_TOKENS (60 * 1000) + +/* Initializer for a struct vlog_rate_limit, to set up a maximum rate of RATE + * messages per minute and a maximum burst size of BURST messages. */ +#define VLOG_RATE_LIMIT_INIT(RATE, BURST) \ + { \ + TOKEN_BUCKET_INIT(RATE, OVS_SAT_MUL(BURST, VLOG_MSG_TOKENS)), \ + 0, /* first_dropped */ \ + 0, /* last_dropped */ \ + 0, /* n_dropped */ \ + OVS_MUTEX_INITIALIZER /* mutex */ \ + } + +/* Configuring how each module logs messages. */ +enum vlog_level vlog_get_level(const struct vlog_module *, + enum vlog_destination); +void vlog_set_levels(struct vlog_module *, + enum vlog_destination, enum vlog_level); +char *vlog_set_levels_from_string(const char *) OVS_WARN_UNUSED_RESULT; +void vlog_set_levels_from_string_assert(const char *); +char *vlog_get_levels(void); +char *vlog_get_patterns(void); +bool vlog_is_enabled(const struct vlog_module *, enum vlog_level); +bool vlog_should_drop(const struct vlog_module *, enum vlog_level, + struct vlog_rate_limit *); +void vlog_set_verbosity(const char *arg); + +/* Configuring log destinations. */ +void vlog_set_pattern(enum vlog_destination, const char *pattern); +int vlog_set_log_file(const char *file_name); +int vlog_reopen_log_file(void); +#ifndef _WIN32 +void vlog_change_owner_unix(uid_t, gid_t); +#endif + +/* Configure method how vlog should send messages to syslog server. */ +void vlog_set_syslog_method(const char *method); + +/* Configure syslog target. */ +void vlog_set_syslog_target(const char *target); + +/* Initialization. */ +void vlog_init(void); +void vlog_enable_async(void); + +/* Functions for actual logging. */ +void vlog(const struct vlog_module *, enum vlog_level, const char *format, ...) + OVS_PRINTF_FORMAT (3, 4); +void vlog_valist(const struct vlog_module *, enum vlog_level, + const char *, va_list) + OVS_PRINTF_FORMAT (3, 0); + +OVS_NO_RETURN void vlog_fatal(const struct vlog_module *, const char *format, ...) + OVS_PRINTF_FORMAT (2, 3); +OVS_NO_RETURN void vlog_fatal_valist(const struct vlog_module *, + const char *format, va_list) + OVS_PRINTF_FORMAT (2, 0); + +OVS_NO_RETURN void vlog_abort(const struct vlog_module *, const char *format, ...) + OVS_PRINTF_FORMAT (2, 3); +OVS_NO_RETURN void vlog_abort_valist(const struct vlog_module *, + const char *format, va_list) + OVS_PRINTF_FORMAT (2, 0); + +void vlog_rate_limit(const struct vlog_module *, enum vlog_level, + struct vlog_rate_limit *, const char *, ...) + OVS_PRINTF_FORMAT (4, 5); + +/* Defines a logging module whose name is MODULE, which should generally be + * roughly the name of the source file, and makes it the module used by the + * logging convenience macros defined below. */ +#define VLOG_DEFINE_THIS_MODULE(MODULE) \ + static struct vlog_module this_module = { \ + OVS_LIST_INITIALIZER(&this_module.list), \ + #MODULE, /* name */ \ + { VLL_INFO, VLL_INFO, VLL_INFO }, /* levels */ \ + VLL_INFO, /* min_level */ \ + true /* honor_rate_limits */ \ + }; \ + OVS_CONSTRUCTOR(init_this_module_##MODULE) { \ + vlog_insert_module(&this_module.list); \ + } \ + \ + /* Prevent duplicate module names, via linker error. \ + * The extra "extern" declaration makes sparse happy. */ \ + extern struct vlog_module *VLM_##MODULE; \ + struct vlog_module *VLM_##MODULE = &this_module; + +/* Macros for the current module as set up by VLOG_DEFINE_THIS_MODULE. + * These are usually what you want to use. + * + * Guaranteed to preserve errno. + */ +#define VLOG_FATAL(...) vlog_fatal(&this_module, __VA_ARGS__) +#define VLOG_ABORT(...) vlog_abort(&this_module, __VA_ARGS__) +#define VLOG_EMER(...) VLOG(VLL_EMER, __VA_ARGS__) +#define VLOG_ERR(...) VLOG(VLL_ERR, __VA_ARGS__) +#define VLOG_WARN(...) VLOG(VLL_WARN, __VA_ARGS__) +#define VLOG_INFO(...) VLOG(VLL_INFO, __VA_ARGS__) +#define VLOG_DBG(...) VLOG(VLL_DBG, __VA_ARGS__) + +/* More convenience macros, for testing whether a given level is enabled. When + * constructing a log message is expensive, this enables it to be skipped. */ +#define VLOG_IS_ERR_ENABLED() vlog_is_enabled(&this_module, VLL_ERR) +#define VLOG_IS_WARN_ENABLED() vlog_is_enabled(&this_module, VLL_WARN) +#define VLOG_IS_INFO_ENABLED() vlog_is_enabled(&this_module, VLL_INFO) +#define VLOG_IS_DBG_ENABLED() vlog_is_enabled(&this_module, VLL_DBG) + +/* Convenience macros for rate-limiting. + * Guaranteed to preserve errno. + */ +#define VLOG_ERR_RL(RL, ...) VLOG_RL(RL, VLL_ERR, __VA_ARGS__) +#define VLOG_WARN_RL(RL, ...) VLOG_RL(RL, VLL_WARN, __VA_ARGS__) +#define VLOG_INFO_RL(RL, ...) VLOG_RL(RL, VLL_INFO, __VA_ARGS__) +#define VLOG_DBG_RL(RL, ...) VLOG_RL(RL, VLL_DBG, __VA_ARGS__) + +/* Convenience macros to additionally store log message in buffer + * Caller is responsible for freeing *ERRP afterwards */ +#define VLOG_ERR_BUF(ERRP, ...) VLOG_ERRP(ERRP, VLL_ERR, __VA_ARGS__) +#define VLOG_WARN_BUF(ERRP, ...) VLOG_ERRP(ERRP, VLL_WARN, __VA_ARGS__) + +#define VLOG_DROP_ERR(RL) vlog_should_drop(&this_module, VLL_ERR, RL) +#define VLOG_DROP_WARN(RL) vlog_should_drop(&this_module, VLL_WARN, RL) +#define VLOG_DROP_INFO(RL) vlog_should_drop(&this_module, VLL_INFO, RL) +#define VLOG_DROP_DBG(RL) vlog_should_drop(&this_module, VLL_DBG, RL) + +/* Macros for logging at most once per execution. */ +#define VLOG_ERR_ONCE(...) VLOG_ONCE(VLL_ERR, __VA_ARGS__) +#define VLOG_WARN_ONCE(...) VLOG_ONCE(VLL_WARN, __VA_ARGS__) +#define VLOG_INFO_ONCE(...) VLOG_ONCE(VLL_INFO, __VA_ARGS__) +#define VLOG_DBG_ONCE(...) VLOG_ONCE(VLL_DBG, __VA_ARGS__) + +/* Command line processing. */ +#define VLOG_OPTION_ENUMS \ + OPT_LOG_FILE, \ + OPT_SYSLOG_IMPL, \ + OPT_SYSLOG_TARGET + +#define VLOG_LONG_OPTIONS \ + {"verbose", optional_argument, NULL, 'v'}, \ + {"log-file", optional_argument, NULL, OPT_LOG_FILE}, \ + {"syslog-method", required_argument, NULL, OPT_SYSLOG_IMPL}, \ + {"syslog-target", required_argument, NULL, OPT_SYSLOG_TARGET} + +#define VLOG_OPTION_HANDLERS \ + case 'v': \ + vlog_set_verbosity(optarg); \ + break; \ + case OPT_LOG_FILE: \ + vlog_set_log_file(optarg); \ + break; \ + case OPT_SYSLOG_IMPL: \ + vlog_set_syslog_method(optarg); \ + break; \ + case OPT_SYSLOG_TARGET: \ + vlog_set_syslog_target(optarg); \ + break; + +void vlog_usage(void); + +/* Implementation details. */ +#define VLOG(LEVEL, ...) \ + do { \ + enum vlog_level level__ = LEVEL; \ + if (this_module.min_level >= level__) { \ + vlog(&this_module, level__, __VA_ARGS__); \ + } \ + } while (0) +#define VLOG_RL(RL, LEVEL, ...) \ + do { \ + enum vlog_level level__ = LEVEL; \ + if (this_module.min_level >= level__) { \ + vlog_rate_limit(&this_module, level__, RL, __VA_ARGS__); \ + } \ + } while (0) +#define VLOG_ONCE(LEVEL, ...) \ + do { \ + static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; \ + if (ovsthread_once_start(&once)) { \ + vlog(&this_module, LEVEL, __VA_ARGS__); \ + ovsthread_once_done(&once); \ + } \ + } while (0) +#define VLOG_ERRP(ERRP, LEVEL, ...) \ + do { \ + VLOG(LEVEL, __VA_ARGS__); \ + if (ERRP) { \ + *(ERRP) = xasprintf(__VA_ARGS__); \ + } \ + } while (0) + +#ifdef __cplusplus +} +#endif + +#endif /* vlog.h */ diff --git a/openflow/include/ovn/actions.h b/openflow/include/ovn/actions.h new file mode 100644 index 0000000..d2510fd --- /dev/null +++ b/openflow/include/ovn/actions.h @@ -0,0 +1,489 @@ +/* + * Copyright (c) 2015, 2016, 2017 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OVN_ACTIONS_H +#define OVN_ACTIONS_H 1 + +#include +#include +#include "compiler.h" +#include "expr.h" +#include "openvswitch/dynamic-string.h" +#include "openvswitch/hmap.h" +#include "openvswitch/uuid.h" +#include "util.h" + +struct expr; +struct lexer; +struct ofpbuf; +struct shash; +struct simap; + +/* List of OVN logical actions. + * + * This macro is used directly only internally by this header and its + * corresponding .c file, but the list is still of interest to developers. + * + * Each OVNACT invocation has the following parameters: + * + * 1. , used below in the enum definition of OVNACT_, and + * elsewhere. + * + * 2. corresponding to a structure "struct ", that must be a + * defined below. This structure must be an abstract definition of the + * action. Its first member must have type "struct ovnact" and name + * "ovnact". The structure must have a fixed length, that is, it may not + * end with a flexible array member. + */ +#define OVNACTS \ + OVNACT(OUTPUT, ovnact_null) \ + OVNACT(NEXT, ovnact_next) \ + OVNACT(LOAD, ovnact_load) \ + OVNACT(MOVE, ovnact_move) \ + OVNACT(EXCHANGE, ovnact_move) \ + OVNACT(DEC_TTL, ovnact_null) \ + OVNACT(CT_NEXT, ovnact_ct_next) \ + OVNACT(CT_COMMIT, ovnact_ct_commit) \ + OVNACT(CT_DNAT, ovnact_ct_nat) \ + OVNACT(CT_SNAT, ovnact_ct_nat) \ + OVNACT(CT_LB, ovnact_ct_lb) \ + OVNACT(CT_CLEAR, ovnact_null) \ + OVNACT(CLONE, ovnact_nest) \ + OVNACT(ARP, ovnact_nest) \ + OVNACT(ND_NA, ovnact_nest) \ + OVNACT(GET_ARP, ovnact_get_mac_bind) \ + OVNACT(PUT_ARP, ovnact_put_mac_bind) \ + OVNACT(GET_ND, ovnact_get_mac_bind) \ + OVNACT(PUT_ND, ovnact_put_mac_bind) \ + OVNACT(PUT_DHCPV4_OPTS, ovnact_put_dhcp_opts) \ + OVNACT(PUT_DHCPV6_OPTS, ovnact_put_dhcp_opts) \ + OVNACT(SET_QUEUE, ovnact_set_queue) + +/* enum ovnact_type, with a member OVNACT_ for each action. */ +enum OVS_PACKED_ENUM ovnact_type { +#define OVNACT(ENUM, STRUCT) OVNACT_##ENUM, + OVNACTS +#undef OVNACT +}; + +/* Define N_OVNACTS to the number of types of ovnacts. */ +enum { +#define OVNACT(ENUM, STRUCT) + 1 + N_OVNACTS = OVNACTS +#undef OVNACT +}; + +/* Header for an action. + * + * Each action is a structure "struct ovnact_*" that begins with "struct + * ovnact", usually followed by other data that describes the action. Actions + * are padded out to a multiple of OVNACT_ALIGNTO bytes in length. + */ +struct ovnact { + /* We want the space advantage of an 8-bit type here on every + * implementation, without giving up the advantage of having a useful type + * on implementations that support packed enums. */ +#ifdef HAVE_PACKED_ENUM + enum ovnact_type type; /* OVNACT_*. */ +#else + uint8_t type; /* OVNACT_* */ +#endif + uint8_t pad; /* Pad to multiple of 16 bits. */ + + uint16_t len; /* Length of the action, in bytes, including + * struct ovnact, excluding padding. */ +}; +BUILD_ASSERT_DECL(sizeof(struct ovnact) == 4); + +/* Alignment. */ +#define OVNACT_ALIGNTO 8 +#define OVNACT_ALIGN(SIZE) ROUND_UP(SIZE, OVNACT_ALIGNTO) + +/* Returns the ovnact following 'ovnact'. */ +static inline struct ovnact * +ovnact_next(const struct ovnact *ovnact) +{ + return (void *) ((uint8_t *) ovnact + OVNACT_ALIGN(ovnact->len)); +} + +struct ovnact *ovnact_next_flattened(const struct ovnact *); + +static inline struct ovnact * +ovnact_end(const struct ovnact *ovnacts, size_t ovnacts_len) +{ + return (void *) ((uint8_t *) ovnacts + ovnacts_len); +} + +/* Assigns POS to each ovnact, in turn, in the OVNACTS_LEN bytes of ovnacts + * starting at OVNACTS. */ +#define OVNACT_FOR_EACH(POS, OVNACTS, OVNACTS_LEN) \ + for ((POS) = (OVNACTS); (POS) < ovnact_end(OVNACTS, OVNACTS_LEN); \ + (POS) = ovnact_next(POS)) + +/* Action structure for each OVNACT_*. */ + +/* Action structure for actions that do not have any extra data beyond the + * action type. */ +struct ovnact_null { + struct ovnact ovnact; +}; + +/* Logical pipeline in which a set of actions is executed. */ +enum ovnact_pipeline { + OVNACT_P_INGRESS, + OVNACT_P_EGRESS, +}; + +/* OVNACT_NEXT. */ +struct ovnact_next { + struct ovnact ovnact; + + /* Arguments. */ + uint8_t ltable; /* Logical table ID of next table. */ + enum ovnact_pipeline pipeline; /* Pipeline of next table. */ + + /* Information about the flow that the action is in. This does not affect + * behavior, since the implementation of "next" doesn't depend on the + * source table or pipeline. It does affect how ovnacts_format() prints + * the action. */ + uint8_t src_ltable; /* Logical table ID of source table. */ + enum ovnact_pipeline src_pipeline; /* Pipeline of source table. */ +}; + +/* OVNACT_LOAD. */ +struct ovnact_load { + struct ovnact ovnact; + struct expr_field dst; + union expr_constant imm; +}; + +/* OVNACT_MOVE, OVNACT_EXCHANGE. */ +struct ovnact_move { + struct ovnact ovnact; + struct expr_field lhs; + struct expr_field rhs; +}; + +/* OVNACT_CT_NEXT. */ +struct ovnact_ct_next { + struct ovnact ovnact; + uint8_t ltable; /* Logical table ID of next table. */ +}; + +/* OVNACT_CT_COMMIT. */ +struct ovnact_ct_commit { + struct ovnact ovnact; + uint32_t ct_mark, ct_mark_mask; + ovs_be128 ct_label, ct_label_mask; +}; + +/* OVNACT_CT_DNAT, OVNACT_CT_SNAT. */ +struct ovnact_ct_nat { + struct ovnact ovnact; + ovs_be32 ip; + uint8_t ltable; /* Logical table ID of next table. */ +}; + +struct ovnact_ct_lb_dst { + ovs_be32 ip; + uint16_t port; +}; + +/* OVNACT_CT_LB. */ +struct ovnact_ct_lb { + struct ovnact ovnact; + struct ovnact_ct_lb_dst *dsts; + size_t n_dsts; + uint8_t ltable; /* Logical table ID of next table. */ +}; + +/* OVNACT_ARP, OVNACT_ND_NA, OVNACT_CLONE. */ +struct ovnact_nest { + struct ovnact ovnact; + struct ovnact *nested; + size_t nested_len; +}; + +/* OVNACT_GET_ARP, OVNACT_GET_ND. */ +struct ovnact_get_mac_bind { + struct ovnact ovnact; + struct expr_field port; /* Logical port name. */ + struct expr_field ip; /* 32-bit or 128-bit IP address. */ +}; + +/* OVNACT_PUT_ARP, ONVACT_PUT_ND. */ +struct ovnact_put_mac_bind { + struct ovnact ovnact; + struct expr_field port; /* Logical port name. */ + struct expr_field ip; /* 32-bit or 128-bit IP address. */ + struct expr_field mac; /* 48-bit Ethernet address. */ +}; + +struct ovnact_dhcp_option { + const struct dhcp_opts_map *option; + struct expr_constant_set value; +}; + +/* OVNACT_PUT_DHCPV4_OPTS, OVNACT_PUT_DHCPV6_OPTS. */ +struct ovnact_put_dhcp_opts { + struct ovnact ovnact; + struct expr_field dst; /* 1-bit destination field. */ + struct ovnact_dhcp_option *options; + size_t n_options; +}; + +/* Valid arguments to SET_QUEUE action. + * + * QDISC_MIN_QUEUE_ID is the default queue, so user-defined queues should + * start at QDISC_MIN_QUEUE_ID+1. */ +#define QDISC_MIN_QUEUE_ID 0 +#define QDISC_MAX_QUEUE_ID 0xf000 + +/* OVNACT_SET_QUEUE. */ +struct ovnact_set_queue { + struct ovnact ovnact; + uint16_t queue_id; +}; + +/* Internal use by the helpers below. */ +void ovnact_init(struct ovnact *, enum ovnact_type, size_t len); +void *ovnact_put(struct ofpbuf *, enum ovnact_type, size_t len); + +/* For each OVNACT_ with a corresponding struct , this defines + * the following commonly useful functions: + * + * struct *ovnact_put_(struct ofpbuf *ovnacts); + * + * Appends a new 'ovnact', of length OVNACT__SIZE, to 'ovnacts', + * initializes it with ovnact_init_(), and returns it. Also sets + * 'ovnacts->header' to the returned action. + * + * struct *ovnact_get_(const struct ovnact *ovnact); + * + * Returns 'ovnact' cast to "struct *". 'ovnact->type' must be + * OVNACT_. + * + * as well as the following more rarely useful definitions: + * + * void ovnact_init_(struct *ovnact); + * + * Initializes the parts of 'ovnact' that identify it as having type + * OVNACT_ and length OVNACT__SIZE and zeros the rest. + * + * _SIZE + * + * The size of the action structure, that is, sizeof(struct ) + * rounded up to a multiple of OVNACT_ALIGNTO. + */ +#define OVNACT(ENUM, STRUCT) \ + BUILD_ASSERT_DECL(offsetof(struct STRUCT, ovnact) == 0); \ + \ + enum { OVNACT_##ENUM##_SIZE = OVNACT_ALIGN(sizeof(struct STRUCT)) }; \ + \ + static inline struct STRUCT * \ + ovnact_get_##ENUM(const struct ovnact *ovnact) \ + { \ + ovs_assert(ovnact->type == OVNACT_##ENUM); \ + return ALIGNED_CAST(struct STRUCT *, ovnact); \ + } \ + \ + static inline struct STRUCT * \ + ovnact_put_##ENUM(struct ofpbuf *ovnacts) \ + { \ + return ovnact_put(ovnacts, OVNACT_##ENUM, \ + OVNACT_##ENUM##_SIZE); \ + } \ + \ + static inline void \ + ovnact_init_##ENUM(struct STRUCT *ovnact) \ + { \ + ovnact_init(&ovnact->ovnact, OVNACT_##ENUM, \ + OVNACT_##ENUM##_SIZE); \ + } +OVNACTS +#undef OVNACT + +#define MAX_OVN_GROUPS 65535 + +struct group_table { + unsigned long *group_ids; /* Used as a bitmap with value set + * for allocated group ids in either + * desired_groups or existing_groups. */ + struct hmap desired_groups; + struct hmap existing_groups; +}; + +struct group_info { + struct hmap_node hmap_node; + struct ds group; + uint32_t group_id; + bool new_group_id; /* 'True' if 'group_id' was reserved from + * group_table's 'group_ids' bitmap. */ +}; + +enum action_opcode { + /* "arp { ...actions... }". + * + * The actions, in OpenFlow 1.3 format, follow the action_header. + */ + ACTION_OPCODE_ARP, + + /* "put_arp(port, ip, mac)" + * + * Arguments are passed through the packet metadata and data, as follows: + * + * MFF_REG0 = ip + * MFF_LOG_INPORT = port + * MFF_ETH_SRC = mac + */ + ACTION_OPCODE_PUT_ARP, + + /* "result = put_dhcp_opts(offer_ip, option, ...)". + * + * Arguments follow the action_header, in this format: + * - A 32-bit or 64-bit OXM header designating the result field. + * - A 32-bit integer specifying a bit offset within the result field. + * - The 32-bit DHCP offer IP. + * - Any number of DHCP options. + */ + ACTION_OPCODE_PUT_DHCP_OPTS, + + /* "nd_na { ...actions... }". + * + * The actions, in OpenFlow 1.3 format, follow the action_header. + */ + ACTION_OPCODE_ND_NA, + + /* "put_nd(port, ip6, mac)" + * + * Arguments are passed through the packet metadata and data, as follows: + * + * MFF_XXREG0 = ip6 + * MFF_LOG_INPORT = port + * MFF_ETH_SRC = mac + */ + ACTION_OPCODE_PUT_ND, + + /* "result = put_dhcpv6_opts(option, ...)". + * + * Arguments follow the action_header, in this format: + * - A 32-bit or 64-bit OXM header designating the result field. + * - A 32-bit integer specifying a bit offset within the result field. + * - Any number of DHCPv6 options. + */ + ACTION_OPCODE_PUT_DHCPV6_OPTS, +}; + +/* Header. */ +struct action_header { + ovs_be32 opcode; /* One of ACTION_OPCODE_* */ + uint8_t pad[4]; +}; +BUILD_ASSERT_DECL(sizeof(struct action_header) == 8); + +struct ovnact_parse_params { + /* A table of "struct expr_symbol"s to support (as one would provide to + * expr_parse()). */ + const struct shash *symtab; + + /* hmap of 'struct dhcp_opts_map' to support 'put_dhcp_opts' action */ + const struct hmap *dhcp_opts; + + /* hmap of 'struct dhcp_opts_map' to support 'put_dhcpv6_opts' action */ + const struct hmap *dhcpv6_opts; + + /* Each OVN flow exists in a logical table within a logical pipeline. + * These parameters express this context for a set of OVN actions being + * parsed: + * + * - 'n_tables' is the number of tables in the logical ingress and + * egress pipelines, that is, "next" may specify a table less than + * or equal to 'n_tables'. If 'n_tables' is 0 then "next" is + * disallowed entirely. + * + * - 'cur_ltable' is the logical table of the current flow, within + * 'pipeline'. If cur_ltable + 1 < n_tables, then this defines the + * default table that "next" will jump to. + * + * - 'pipeline' is the logical pipeline. It is the default pipeline to + * which 'next' will jump. If 'pipeline' is OVNACT_P_EGRESS, then + * 'next' will also be able to jump into the ingress pipeline, but + * the reverse is not true. */ + enum ovnact_pipeline pipeline; /* Logical pipeline. */ + uint8_t n_tables; /* Number of logical flow tables. */ + uint8_t cur_ltable; /* 0 <= cur_ltable < n_tables. */ +}; + +bool ovnacts_parse(struct lexer *, const struct ovnact_parse_params *, + struct ofpbuf *ovnacts, struct expr **prereqsp); +char *ovnacts_parse_string(const char *s, const struct ovnact_parse_params *, + struct ofpbuf *ovnacts, struct expr **prereqsp) + OVS_WARN_UNUSED_RESULT; + +void ovnacts_format(const struct ovnact[], size_t ovnacts_len, struct ds *); + +struct ovnact_encode_params { + /* Looks up logical port 'port_name'. If found, stores its port number in + * '*portp' and returns true; otherwise, returns false. */ + bool (*lookup_port)(const void *aux, const char *port_name, + unsigned int *portp); + const void *aux; + + /* 'true' if the flow is for a switch. */ + bool is_switch; + + /* 'true' if the flow is for a gateway router. */ + bool is_gateway_router; + + /* A map from a port name to its connection tracking zone. */ + const struct simap *ct_zones; + + /* A struct to figure out the group_id for group actions. */ + struct group_table *group_table; + + /* OVN maps each logical flow table (ltable), one-to-one, onto a physical + * OpenFlow flow table (ptable). A number of parameters describe this + * mapping and data related to flow tables: + * + * - 'pipeline' is the logical pipeline in which the actions are + * executing. + * + * - 'ingress_ptable' is the OpenFlow table that corresponds to OVN + * ingress table 0. + * + * - 'egress_ptable' is the OpenFlow table that corresponds to OVN + * egress table 0. + * + * - 'output_ptable' should be the OpenFlow table to which the logical + * "output" action will resubmit. + * + * - 'mac_bind_ptable' should be the OpenFlow table used to track MAC + * bindings. */ + enum ovnact_pipeline pipeline; /* Logical pipeline. */ + uint8_t ingress_ptable; /* First OpenFlow ingress table. */ + uint8_t egress_ptable; /* First OpenFlow egress table. */ + uint8_t output_ptable; /* OpenFlow table for 'output' to resubmit. */ + uint8_t mac_bind_ptable; /* OpenFlow table for 'get_arp'/'get_nd' to + resubmit. */ +}; + +void ovnacts_encode(const struct ovnact[], size_t ovnacts_len, + const struct ovnact_encode_params *, + struct ofpbuf *ofpacts); + +void ovnacts_free(struct ovnact[], size_t ovnacts_len); + +#endif /* ovn/actions.h */ diff --git a/openflow/include/ovn/expr.h b/openflow/include/ovn/expr.h new file mode 100644 index 0000000..711713e --- /dev/null +++ b/openflow/include/ovn/expr.h @@ -0,0 +1,504 @@ +/* + * Copyright (c) 2015, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OVN_EXPR_H +#define OVN_EXPR_H 1 + +/* OVN matching expression tree + * ============================ + * + * The data structures here form an abstract expression tree for matching + * expressions in OVN. + * + * The abstract syntax tree representation of a matching expression is one of: + * + * - A Boolean literal ("true" or "false"). + * + * - A comparison of a field (or part of a field) against a constant + * with one of the operators == != < <= > >=. + * + * - The logical AND or OR of two or more matching expressions. + * + * Literals and comparisons are called "terminal" nodes, logical AND and OR + * nodes are "nonterminal" nodes. + * + * The syntax for expressions includes a few other concepts that are not part + * of the abstract syntax tree. In these examples, x is a field, a, b, and c + * are constants, and e1 and e2 are arbitrary expressions: + * + * - Logical NOT. The parser implements NOT by inverting the sense of the + * operand: !(x == a) becomes x != a, !(e1 && e2) becomes !e1 || !e2, and + * so on. + * + * - Set membership. The parser translates x == {a, b, c} into + * x == a || x == b || x == c. + * + * - Reversed comparisons. The parser translates a < x into x > a. + * + * - Range expressions. The parser translates a < x < b into + * x > a && x < b. + */ + +#include "classifier.h" +#include "lex.h" +#include "openvswitch/hmap.h" +#include "openvswitch/list.h" +#include "openvswitch/match.h" +#include "openvswitch/meta-flow.h" + +struct ds; +struct expr; +struct flow; +struct ofpbuf; +struct shash; +struct simap; + +/* "Measurement level" of a field. See "Level of Measurement" in the large + * comment on struct expr_symbol below for more information. */ +enum expr_level { + EXPR_L_NOMINAL, + + /* Boolean values are nominal, however because of their simple nature OVN + * can allow both equality and inequality tests on them. */ + EXPR_L_BOOLEAN, + + /* Ordinal values can at least be ordered on a scale. OVN allows equality + * and inequality and relational tests on ordinal values. These are the + * fields on which OVS allows bitwise matching. */ + EXPR_L_ORDINAL +}; + +const char *expr_level_to_string(enum expr_level); + +/* A symbol. + * + * + * Name + * ==== + * + * Every symbol must have a name. To be useful, the name must satisfy the + * lexer's syntax for an identifier. + * + * + * Width + * ===== + * + * Every symbol has a width. For integer symbols, this is the number of bits + * in the value; for string symbols, this is 0. + * + * + * Types + * ===== + * + * There are three kinds of symbols: + * + * Fields: + * + * One might, for example, define a field named "vlan.tci" to refer to + * MFF_VLAN_TCI. 'field' specifies the field. + * + * 'parent' and 'predicate' are NULL, and 'parent_ofs' is 0. + * + * Integer fields can be nominal or ordinal (see below). String fields are + * always nominal. + * + * Subfields: + * + * 'parent' specifies the field (which may itself be a subfield, + * recursively) in which the subfield is embedded, and 'parent_ofs' a + * bitwise offset from the least-significant bit of the parent. The + * subfield can contain a subset of the bits of the parent or all of them + * (in the latter case the subfield is really just a synonym for the + * parent). + * + * 'field' and 'predicate' are NULL. + * + * Only ordinal fields (see below) may have subfields, and subfields are + * always ordinal. + * + * Predicates: + * + * A predicate is an arbitrary Boolean expression that can be used in an + * expression much like a 1-bit field. 'predicate' specifies the Boolean + * expression, e.g. "ip4" might expand to "eth.type == 0x800". The + * epxression might refer to other predicates, e.g. "icmp4" might expand to + * "ip4 && ip4.proto == 1". + * + * 'field' and 'parent' are NULL, and 'parent_ofs' is 0. + * + * A predicate that refers to any nominal field or predicate (see below) is + * nominal; other predicates have Boolean level of measurement. + * + * + * Level of Measurement + * ==================== + * + * See http://en.wikipedia.org/wiki/Level_of_measurement for the statistical + * concept on which this classification is based. There are three levels: + * + * Ordinal: + * + * In statistics, ordinal values can be ordered on a scale. Here, we + * consider a field (or subfield) to be ordinal if its bits can be examined + * individually. This is true for the OpenFlow fields that OpenFlow or + * Open vSwitch makes "maskable". + * + * OVN supports all the usual arithmetic relations (== != < <= > >=) on + * ordinal fields and their subfields, because all of these can be + * implemented as collections of bitwise tests. + * + * Nominal: + * + * In statistics, nominal values cannot be usefully compared except for + * equality. This is true of OpenFlow port numbers, Ethernet types, and IP + * protocols are examples: all of these are just identifiers assigned + * arbitrarily with no deeper meaning. In OpenFlow and Open vSwitch, bits + * in these fields generally aren't individually addressable. + * + * OVN only supports arithmetic tests for equality on nominal fields, + * because OpenFlow and Open vSwitch provide no way for a flow to + * efficiently implement other comparisons on them. (A test for inequality + * can be sort of built out of two flows with different priorities, but OVN + * matching expressions always generate flows with a single priority.) + * + * String fields are always nominal. + * + * Boolean: + * + * A nominal field that has only two values, 0 and 1, is somewhat + * exceptional, since it is easy to support both equality and inequality + * tests on such a field: either one can be implemented as a test for 0 or + * 1. + * + * Only predicates (see above) have a Boolean level of measurement. + * + * This isn't a standard level of measurement. + * + * + * Prerequisites + * ============= + * + * Any symbol can have prerequisites, which are specified as a string giving an + * additional expression that must be true whenever the symbol is referenced. + * For example, the "icmp4.type" symbol might have prerequisite "icmp4", which + * would cause an expression "icmp4.type == 0" to be interpreted as "icmp4.type + * == 0 && icmp4", which would in turn expand to "icmp4.type == 0 && eth.type + * == 0x800 && ip4.proto == 1" (assuming "icmp4" is a predicate defined as + * suggested under "Types" above). + * + * + * Crossproducting + * =============== + * + * Ordinarily OVN is willing to consider using any field as a dimension in the + * Open vSwitch "conjunctive match" extension (see ovs-ofctl(8)). However, + * some fields can't actually be used that way because they are necessary as + * prerequisites. For example, from an expression like "tcp.src == {1,2,3} + * && tcp.dst == {4,5,6}", OVN might naturally generate flows like this: + * + * conj_id=1,actions=... + * ip,actions=conjunction(1,1/3) + * ip6,actions=conjunction(1,1/3) + * tp_src=1,actions=conjunction(1,2/3) + * tp_src=2,actions=conjunction(1,2/3) + * tp_src=3,actions=conjunction(1,2/3) + * tp_dst=4,actions=conjunction(1,3/3) + * tp_dst=5,actions=conjunction(1,3/3) + * tp_dst=6,actions=conjunction(1,3/3) + * + * but that's not valid because any flow that matches on tp_src or tp_dst must + * also match on either ip or ip6. Thus, one would mark eth.type as "must + * crossproduct", to force generating flows like this: + * + * conj_id=1,actions=... + * ip,tp_src=1,actions=conjunction(1,1/2) + * ip,tp_src=2,actions=conjunction(1,1/2) + * ip,tp_src=3,actions=conjunction(1,1/2) + * ip6,tp_src=1,actions=conjunction(1,1/2) + * ip6,tp_src=2,actions=conjunction(1,1/2) + * ip6,tp_src=3,actions=conjunction(1,1/2) + * ip,tp_dst=4,actions=conjunction(1,2/2) + * ip,tp_dst=5,actions=conjunction(1,2/2) + * ip,tp_dst=6,actions=conjunction(1,2/2) + * ip6,tp_dst=4,actions=conjunction(1,2/2) + * ip6,tp_dst=5,actions=conjunction(1,2/2) + * ip6,tp_dst=6,actions=conjunction(1,2/2) + * + * which are acceptable. + */ +struct expr_symbol { + char *name; + int width; + + const struct mf_field *field; /* Fields only, otherwise NULL. */ + const struct expr_symbol *parent; /* Subfields only, otherwise NULL. */ + int parent_ofs; /* Subfields only, otherwise 0. */ + char *predicate; /* Predicates only, otherwise NULL. */ + + enum expr_level level; + + char *prereqs; + bool must_crossproduct; + bool rw; +}; + +void expr_symbol_format(const struct expr_symbol *, struct ds *); + +/* A reference to a symbol or a subfield of a symbol. + * + * For string fields, ofs and n_bits are 0. */ +struct expr_field { + const struct expr_symbol *symbol; /* The symbol. */ + int ofs; /* Starting bit offset. */ + int n_bits; /* Number of bits. */ +}; + +bool expr_field_parse(struct lexer *, const struct shash *symtab, + struct expr_field *, struct expr **prereqsp); +void expr_field_format(const struct expr_field *, struct ds *); + +struct expr_symbol *expr_symtab_add_field(struct shash *symtab, + const char *name, enum mf_field_id, + const char *prereqs, + bool must_crossproduct); +struct expr_symbol *expr_symtab_add_subfield(struct shash *symtab, + const char *name, + const char *prereqs, + const char *subfield); +struct expr_symbol *expr_symtab_add_string(struct shash *symtab, + const char *name, enum mf_field_id, + const char *prereqs); +struct expr_symbol *expr_symtab_add_predicate(struct shash *symtab, + const char *name, + const char *expansion); +void expr_symtab_destroy(struct shash *symtab); + +/* Expression type. */ +enum expr_type { + EXPR_T_CMP, /* Compare symbol with constant. */ + EXPR_T_AND, /* Logical AND of 2 or more subexpressions. */ + EXPR_T_OR, /* Logical OR of 2 or more subexpressions. */ + EXPR_T_BOOLEAN, /* True or false constant. */ + EXPR_T_CONDITION, /* Conditional to be evaluated in the + * controller during expr_simplify(), + * prior to constructing OpenFlow matches. */ +}; + +/* Expression condition type. */ +enum expr_cond_type { + EXPR_COND_CHASSIS_RESIDENT, /* Check if specified logical port name is + * resident on the controller chassis. */ +}; + +/* Relational operator. */ +enum expr_relop { + EXPR_R_EQ, /* == */ + EXPR_R_NE, /* != */ + EXPR_R_LT, /* < */ + EXPR_R_LE, /* <= */ + EXPR_R_GT, /* > */ + EXPR_R_GE, /* >= */ +}; +const char *expr_relop_to_string(enum expr_relop); +bool expr_relop_from_token(enum lex_type type, enum expr_relop *relop); + +/* An abstract syntax tree for a matching expression. + * + * The expression code maintains and relies on a few important invariants: + * + * - An EXPR_T_AND or EXPR_T_OR node never has a child of the same type. + * (Any such children could be merged into their parent.) A node may + * have grandchildren of its own type. + * + * As a consequence, every nonterminal node at the same distance from the + * root has the same type. + * + * - EXPR_T_AND and EXPR_T_OR nodes must have at least two children. + * + * - An EXPR_T_CMP node always has a nonzero mask, and never has a 1-bit + * in its value in a position where the mask is a 0-bit. + * + * The expr_honors_invariants() function can check invariants. */ +struct expr { + struct ovs_list node; /* In parent EXPR_T_AND or EXPR_T_OR if any. */ + enum expr_type type; /* Expression type. */ + + union { + /* EXPR_T_CMP. + * + * The symbol is on the left, e.g. "field < constant". */ + struct { + const struct expr_symbol *symbol; + enum expr_relop relop; + + union { + char *string; + struct { + union mf_subvalue value; + union mf_subvalue mask; + }; + }; + } cmp; + + /* EXPR_T_AND, EXPR_T_OR. */ + struct ovs_list andor; + + /* EXPR_T_BOOLEAN. */ + bool boolean; + + /* EXPR_T_CONDITION. */ + struct { + enum expr_cond_type type; + bool not; + /* XXX Should arguments for conditions be generic? */ + char *string; + } cond; + }; +}; + +struct expr *expr_create_boolean(bool b); +struct expr *expr_create_andor(enum expr_type); +struct expr *expr_combine(enum expr_type, struct expr *a, struct expr *b); + +static inline struct expr * +expr_from_node(const struct ovs_list *node) +{ + return CONTAINER_OF(node, struct expr, node); +} + +void expr_format(const struct expr *, struct ds *); +void expr_print(const struct expr *); +struct expr *expr_parse(struct lexer *, const struct shash *symtab, + const struct shash *addr_sets); +struct expr *expr_parse_string(const char *, const struct shash *symtab, + const struct shash *addr_sets, + char **errorp); + +struct expr *expr_clone(struct expr *); +void expr_destroy(struct expr *); + +struct expr *expr_annotate(struct expr *, const struct shash *symtab, + char **errorp); +struct expr *expr_simplify(struct expr *, + bool (*is_chassis_resident)(const void *c_aux, + const char *port_name), + const void *c_aux); +struct expr *expr_normalize(struct expr *); + +bool expr_honors_invariants(const struct expr *); +bool expr_is_simplified(const struct expr *); +bool expr_is_normalized(const struct expr *); + +char *expr_parse_microflow(const char *, const struct shash *symtab, + const struct shash *addr_sets, + bool (*lookup_port)(const void *aux, + const char *port_name, + unsigned int *portp), + const void *aux, struct flow *uflow) + OVS_WARN_UNUSED_RESULT; + +bool expr_evaluate(const struct expr *, const struct flow *uflow, + bool (*lookup_port)(const void *aux, const char *port_name, + unsigned int *portp), + const void *aux); + +/* Converting expressions to OpenFlow flows. */ + +/* An OpenFlow match generated from a Boolean expression. See + * expr_to_matches() for more information. */ +struct expr_match { + struct hmap_node hmap_node; + struct match match; + struct cls_conjunction *conjunctions; + size_t n, allocated; +}; + +uint32_t expr_to_matches(const struct expr *, + bool (*lookup_port)(const void *aux, + const char *port_name, + unsigned int *portp), + const void *aux, + struct hmap *matches); +void expr_matches_destroy(struct hmap *matches); +void expr_matches_print(const struct hmap *matches, FILE *); + +/* Action parsing helper. */ + +char *expr_type_check(const struct expr_field *, int n_bits, bool rw) + OVS_WARN_UNUSED_RESULT; +struct mf_subfield expr_resolve_field(const struct expr_field *); + +/* Type of a "union expr_constant" or "struct expr_constant_set". */ +enum expr_constant_type { + EXPR_C_INTEGER, + EXPR_C_STRING +}; + +/* A string or integer constant (one must know which from context). */ +union expr_constant { + /* Integer constant. + * + * The width of a constant isn't always clear, e.g. if you write "1", + * there's no way to tell whether you mean for that to be a 1-bit constant + * or a 128-bit constant or somewhere in between. */ + struct { + union mf_subvalue value; + union mf_subvalue mask; /* Only initialized if 'masked'. */ + bool masked; + + enum lex_format format; /* From the constant's lex_token. */ + }; + + /* Null-terminated string constant. */ + char *string; +}; + +bool expr_constant_parse(struct lexer *, const struct expr_field *, + union expr_constant *); +void expr_constant_format(const union expr_constant *, + enum expr_constant_type, struct ds *); +void expr_constant_destroy(const union expr_constant *, + enum expr_constant_type); + +/* A collection of "union expr_constant"s of the same type. */ +struct expr_constant_set { + union expr_constant *values; /* Constants. */ + size_t n_values; /* Number of constants. */ + enum expr_constant_type type; /* Type of the constants. */ + bool in_curlies; /* Whether the constants were in {}. */ +}; + +bool expr_constant_set_parse(struct lexer *, struct expr_constant_set *); +void expr_constant_set_format(const struct expr_constant_set *, struct ds *); +void expr_constant_set_destroy(struct expr_constant_set *cs); + + +/* Address sets. + * + * Instead of referring to a set of value as: + * {addr1, addr2, ..., addrN} + * You can register a set of values and refer to them as: + * $name + * The address set entries should all have integer/masked-integer values. + * The values that don't qualify are ignored. + */ + +void expr_addr_sets_add(struct shash *addr_sets, const char *name, + const char * const *values, size_t n_values); +void expr_addr_sets_remove(struct shash *addr_sets, const char *name); +void expr_addr_sets_destroy(struct shash *addr_sets); + +#endif /* ovn/expr.h */ diff --git a/openflow/include/ovn/lex.h b/openflow/include/ovn/lex.h new file mode 100644 index 0000000..afa4a23 --- /dev/null +++ b/openflow/include/ovn/lex.h @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2015, 2016, 2017 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OVN_LEX_H +#define OVN_LEX_H 1 + +/* OVN lexical analyzer + * ==================== + * + * This is a simple lexical analyzer (or tokenizer) for OVN match expressions + * and ACLs. */ + +#include "openvswitch/meta-flow.h" + +struct ds; + +/* Token type. */ +enum lex_type { + LEX_T_END, /* end of input */ + + /* Tokens with auxiliary data. */ + LEX_T_ID, /* foo */ + LEX_T_STRING, /* "foo" */ + LEX_T_INTEGER, /* 12345 or 1.2.3.4 or ::1 or 01:02:03:04:05 */ + LEX_T_MASKED_INTEGER, /* 12345/10 or 1.2.0.0/16 or ::2/127 or... */ + LEX_T_MACRO, /* $NAME */ + LEX_T_ERROR, /* invalid input */ + + /* Bare tokens. */ + LEX_T_LPAREN, /* ( */ + LEX_T_RPAREN, /* ) */ + LEX_T_LCURLY, /* { */ + LEX_T_RCURLY, /* } */ + LEX_T_LSQUARE, /* [ */ + LEX_T_RSQUARE, /* ] */ + LEX_T_EQ, /* == */ + LEX_T_NE, /* != */ + LEX_T_LT, /* < */ + LEX_T_LE, /* <= */ + LEX_T_GT, /* > */ + LEX_T_GE, /* >= */ + LEX_T_LOG_NOT, /* ! */ + LEX_T_LOG_AND, /* && */ + LEX_T_LOG_OR, /* || */ + LEX_T_ELLIPSIS, /* .. */ + LEX_T_COMMA, /* , */ + LEX_T_SEMICOLON, /* ; */ + LEX_T_EQUALS, /* = */ + LEX_T_EXCHANGE, /* <-> */ + LEX_T_DECREMENT, /* -- */ + LEX_T_COLON, /* : */ +}; + +/* Subtype for LEX_T_INTEGER and LEX_T_MASKED_INTEGER tokens. + * + * These do not change the semantics of a token; instead, they determine the + * format used when a token is serialized back to a text form. That's + * important because 3232268289 is meaningless to a human whereas 192.168.128.1 + * has some actual significance. */ +enum lex_format { + LEX_F_DECIMAL, + LEX_F_HEXADECIMAL, + LEX_F_IPV4, + LEX_F_IPV6, + LEX_F_ETHERNET, +}; +const char *lex_format_to_string(enum lex_format); + +/* A token. */ +struct lex_token { + /* One of LEX_*. */ + enum lex_type type; + + /* Meaningful for LEX_T_ID, LEX_T_STRING, LEX_T_ERROR, LEX_T_MACRO only. + * For these token types, 's' may point to 'buffer'; otherwise, it points + * to malloc()ed memory owned by the token. + * + * Must be NULL for other token types. + * + * For LEX_T_MACRO, 's' does not include the leading $. */ + char *s; + + /* LEX_T_INTEGER, LEX_T_MASKED_INTEGER only. */ + enum lex_format format; + + union { + /* LEX_T_INTEGER, LEX_T_MASKED_INTEGER only. */ + struct { + union mf_subvalue value; /* LEX_T_INTEGER, LEX_T_MASKED_INTEGER. */ + union mf_subvalue mask; /* LEX_T_MASKED_INTEGER only. */ + }; + + /* LEX_T_ID, LEX_T_STRING, LEX_T_ERROR, LEX_T_MACRO only. */ + char buffer[256]; + }; +}; + +void lex_token_init(struct lex_token *); +void lex_token_destroy(struct lex_token *); +void lex_token_swap(struct lex_token *, struct lex_token *); +void lex_token_strcpy(struct lex_token *, const char *s, size_t length); +void lex_token_strset(struct lex_token *, char *s); +void lex_token_vsprintf(struct lex_token *, const char *format, va_list args); + +void lex_token_format(const struct lex_token *, struct ds *); +const char *lex_token_parse(struct lex_token *, const char *input, + const char **startp); + +/* A lexical analyzer. */ +struct lexer { + const char *input; /* Remaining input (not owned by lexer). */ + const char *start; /* Start of current token in 'input'. */ + struct lex_token token; /* Current token (owned by lexer). */ + char *error; /* Error message, if any (owned by lexer). */ +}; + +void lexer_init(struct lexer *, const char *input); +void lexer_destroy(struct lexer *); + +enum lex_type lexer_get(struct lexer *); +enum lex_type lexer_lookahead(const struct lexer *); +bool lexer_match(struct lexer *, enum lex_type); +bool lexer_force_match(struct lexer *, enum lex_type); +bool lexer_match_id(struct lexer *, const char *id); +bool lexer_is_int(const struct lexer *); +bool lexer_get_int(struct lexer *, int *value); +bool lexer_force_int(struct lexer *, int *value); + +bool lexer_force_end(struct lexer *); + +void lexer_error(struct lexer *, const char *message, ...) + OVS_PRINTF_FORMAT(2, 3); +void lexer_syntax_error(struct lexer *, const char *message, ...) + OVS_PRINTF_FORMAT(2, 3); + +char *lexer_steal_error(struct lexer *); + +#endif /* ovn/lex.h */ diff --git a/openflow/usr/include/pcap.h b/openflow/include/pcap.h similarity index 100% rename from openflow/usr/include/pcap.h rename to openflow/include/pcap.h diff --git a/openflow/usr/include/pcap/bluetooth.h b/openflow/include/pcap/bluetooth.h similarity index 100% rename from openflow/usr/include/pcap/bluetooth.h rename to openflow/include/pcap/bluetooth.h diff --git a/openflow/usr/include/pcap/bpf.h b/openflow/include/pcap/bpf.h similarity index 100% rename from openflow/usr/include/pcap/bpf.h rename to openflow/include/pcap/bpf.h diff --git a/openflow/usr/include/pcap/ipnet.h b/openflow/include/pcap/ipnet.h similarity index 100% rename from openflow/usr/include/pcap/ipnet.h rename to openflow/include/pcap/ipnet.h diff --git a/openflow/usr/include/pcap/namedb.h b/openflow/include/pcap/namedb.h similarity index 100% rename from openflow/usr/include/pcap/namedb.h rename to openflow/include/pcap/namedb.h diff --git a/openflow/usr/include/pcap/nflog.h b/openflow/include/pcap/nflog.h similarity index 100% rename from openflow/usr/include/pcap/nflog.h rename to openflow/include/pcap/nflog.h diff --git a/openflow/usr/include/pcap/pcap.h b/openflow/include/pcap/pcap.h similarity index 100% rename from openflow/usr/include/pcap/pcap.h rename to openflow/include/pcap/pcap.h diff --git a/openflow/usr/include/pcap/sll.h b/openflow/include/pcap/sll.h similarity index 100% rename from openflow/usr/include/pcap/sll.h rename to openflow/include/pcap/sll.h diff --git a/openflow/usr/include/pcap/usb.h b/openflow/include/pcap/usb.h similarity index 100% rename from openflow/usr/include/pcap/usb.h rename to openflow/include/pcap/usb.h diff --git a/openflow/usr/include/pcap/vlan.h b/openflow/include/pcap/vlan.h similarity index 100% rename from openflow/usr/include/pcap/vlan.h rename to openflow/include/pcap/vlan.h diff --git a/openflow/include/python3.8/Python-ast.h b/openflow/include/python3.8/Python-ast.h new file mode 100644 index 0000000..5fe4f2b --- /dev/null +++ b/openflow/include/python3.8/Python-ast.h @@ -0,0 +1,715 @@ +/* File automatically generated by Parser/asdl_c.py. */ + +#ifndef Py_PYTHON_AST_H +#define Py_PYTHON_AST_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "asdl.h" + +#undef Yield /* undefine macro conflicting with */ + +typedef struct _mod *mod_ty; + +typedef struct _stmt *stmt_ty; + +typedef struct _expr *expr_ty; + +typedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5, + Param=6 } expr_context_ty; + +typedef struct _slice *slice_ty; + +typedef enum _boolop { And=1, Or=2 } boolop_ty; + +typedef enum _operator { Add=1, Sub=2, Mult=3, MatMult=4, Div=5, Mod=6, Pow=7, + LShift=8, RShift=9, BitOr=10, BitXor=11, BitAnd=12, + FloorDiv=13 } operator_ty; + +typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty; + +typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8, + In=9, NotIn=10 } cmpop_ty; + +typedef struct _comprehension *comprehension_ty; + +typedef struct _excepthandler *excepthandler_ty; + +typedef struct _arguments *arguments_ty; + +typedef struct _arg *arg_ty; + +typedef struct _keyword *keyword_ty; + +typedef struct _alias *alias_ty; + +typedef struct _withitem *withitem_ty; + +typedef struct _type_ignore *type_ignore_ty; + + +enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3, + FunctionType_kind=4, Suite_kind=5}; +struct _mod { + enum _mod_kind kind; + union { + struct { + asdl_seq *body; + asdl_seq *type_ignores; + } Module; + + struct { + asdl_seq *body; + } Interactive; + + struct { + expr_ty body; + } Expression; + + struct { + asdl_seq *argtypes; + expr_ty returns; + } FunctionType; + + struct { + asdl_seq *body; + } Suite; + + } v; +}; + +enum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3, + Return_kind=4, Delete_kind=5, Assign_kind=6, + AugAssign_kind=7, AnnAssign_kind=8, For_kind=9, + AsyncFor_kind=10, While_kind=11, If_kind=12, With_kind=13, + AsyncWith_kind=14, Raise_kind=15, Try_kind=16, + Assert_kind=17, Import_kind=18, ImportFrom_kind=19, + Global_kind=20, Nonlocal_kind=21, Expr_kind=22, Pass_kind=23, + Break_kind=24, Continue_kind=25}; +struct _stmt { + enum _stmt_kind kind; + union { + struct { + identifier name; + arguments_ty args; + asdl_seq *body; + asdl_seq *decorator_list; + expr_ty returns; + string type_comment; + } FunctionDef; + + struct { + identifier name; + arguments_ty args; + asdl_seq *body; + asdl_seq *decorator_list; + expr_ty returns; + string type_comment; + } AsyncFunctionDef; + + struct { + identifier name; + asdl_seq *bases; + asdl_seq *keywords; + asdl_seq *body; + asdl_seq *decorator_list; + } ClassDef; + + struct { + expr_ty value; + } Return; + + struct { + asdl_seq *targets; + } Delete; + + struct { + asdl_seq *targets; + expr_ty value; + string type_comment; + } Assign; + + struct { + expr_ty target; + operator_ty op; + expr_ty value; + } AugAssign; + + struct { + expr_ty target; + expr_ty annotation; + expr_ty value; + int simple; + } AnnAssign; + + struct { + expr_ty target; + expr_ty iter; + asdl_seq *body; + asdl_seq *orelse; + string type_comment; + } For; + + struct { + expr_ty target; + expr_ty iter; + asdl_seq *body; + asdl_seq *orelse; + string type_comment; + } AsyncFor; + + struct { + expr_ty test; + asdl_seq *body; + asdl_seq *orelse; + } While; + + struct { + expr_ty test; + asdl_seq *body; + asdl_seq *orelse; + } If; + + struct { + asdl_seq *items; + asdl_seq *body; + string type_comment; + } With; + + struct { + asdl_seq *items; + asdl_seq *body; + string type_comment; + } AsyncWith; + + struct { + expr_ty exc; + expr_ty cause; + } Raise; + + struct { + asdl_seq *body; + asdl_seq *handlers; + asdl_seq *orelse; + asdl_seq *finalbody; + } Try; + + struct { + expr_ty test; + expr_ty msg; + } Assert; + + struct { + asdl_seq *names; + } Import; + + struct { + identifier module; + asdl_seq *names; + int level; + } ImportFrom; + + struct { + asdl_seq *names; + } Global; + + struct { + asdl_seq *names; + } Nonlocal; + + struct { + expr_ty value; + } Expr; + + } v; + int lineno; + int col_offset; + int end_lineno; + int end_col_offset; +}; + +enum _expr_kind {BoolOp_kind=1, NamedExpr_kind=2, BinOp_kind=3, UnaryOp_kind=4, + Lambda_kind=5, IfExp_kind=6, Dict_kind=7, Set_kind=8, + ListComp_kind=9, SetComp_kind=10, DictComp_kind=11, + GeneratorExp_kind=12, Await_kind=13, Yield_kind=14, + YieldFrom_kind=15, Compare_kind=16, Call_kind=17, + FormattedValue_kind=18, JoinedStr_kind=19, Constant_kind=20, + Attribute_kind=21, Subscript_kind=22, Starred_kind=23, + Name_kind=24, List_kind=25, Tuple_kind=26}; +struct _expr { + enum _expr_kind kind; + union { + struct { + boolop_ty op; + asdl_seq *values; + } BoolOp; + + struct { + expr_ty target; + expr_ty value; + } NamedExpr; + + struct { + expr_ty left; + operator_ty op; + expr_ty right; + } BinOp; + + struct { + unaryop_ty op; + expr_ty operand; + } UnaryOp; + + struct { + arguments_ty args; + expr_ty body; + } Lambda; + + struct { + expr_ty test; + expr_ty body; + expr_ty orelse; + } IfExp; + + struct { + asdl_seq *keys; + asdl_seq *values; + } Dict; + + struct { + asdl_seq *elts; + } Set; + + struct { + expr_ty elt; + asdl_seq *generators; + } ListComp; + + struct { + expr_ty elt; + asdl_seq *generators; + } SetComp; + + struct { + expr_ty key; + expr_ty value; + asdl_seq *generators; + } DictComp; + + struct { + expr_ty elt; + asdl_seq *generators; + } GeneratorExp; + + struct { + expr_ty value; + } Await; + + struct { + expr_ty value; + } Yield; + + struct { + expr_ty value; + } YieldFrom; + + struct { + expr_ty left; + asdl_int_seq *ops; + asdl_seq *comparators; + } Compare; + + struct { + expr_ty func; + asdl_seq *args; + asdl_seq *keywords; + } Call; + + struct { + expr_ty value; + int conversion; + expr_ty format_spec; + } FormattedValue; + + struct { + asdl_seq *values; + } JoinedStr; + + struct { + constant value; + string kind; + } Constant; + + struct { + expr_ty value; + identifier attr; + expr_context_ty ctx; + } Attribute; + + struct { + expr_ty value; + slice_ty slice; + expr_context_ty ctx; + } Subscript; + + struct { + expr_ty value; + expr_context_ty ctx; + } Starred; + + struct { + identifier id; + expr_context_ty ctx; + } Name; + + struct { + asdl_seq *elts; + expr_context_ty ctx; + } List; + + struct { + asdl_seq *elts; + expr_context_ty ctx; + } Tuple; + + } v; + int lineno; + int col_offset; + int end_lineno; + int end_col_offset; +}; + +enum _slice_kind {Slice_kind=1, ExtSlice_kind=2, Index_kind=3}; +struct _slice { + enum _slice_kind kind; + union { + struct { + expr_ty lower; + expr_ty upper; + expr_ty step; + } Slice; + + struct { + asdl_seq *dims; + } ExtSlice; + + struct { + expr_ty value; + } Index; + + } v; +}; + +struct _comprehension { + expr_ty target; + expr_ty iter; + asdl_seq *ifs; + int is_async; +}; + +enum _excepthandler_kind {ExceptHandler_kind=1}; +struct _excepthandler { + enum _excepthandler_kind kind; + union { + struct { + expr_ty type; + identifier name; + asdl_seq *body; + } ExceptHandler; + + } v; + int lineno; + int col_offset; + int end_lineno; + int end_col_offset; +}; + +struct _arguments { + asdl_seq *posonlyargs; + asdl_seq *args; + arg_ty vararg; + asdl_seq *kwonlyargs; + asdl_seq *kw_defaults; + arg_ty kwarg; + asdl_seq *defaults; +}; + +struct _arg { + identifier arg; + expr_ty annotation; + string type_comment; + int lineno; + int col_offset; + int end_lineno; + int end_col_offset; +}; + +struct _keyword { + identifier arg; + expr_ty value; +}; + +struct _alias { + identifier name; + identifier asname; +}; + +struct _withitem { + expr_ty context_expr; + expr_ty optional_vars; +}; + +enum _type_ignore_kind {TypeIgnore_kind=1}; +struct _type_ignore { + enum _type_ignore_kind kind; + union { + struct { + int lineno; + string tag; + } TypeIgnore; + + } v; +}; + + +// Note: these macros affect function definitions, not only call sites. +#define Module(a0, a1, a2) _Py_Module(a0, a1, a2) +mod_ty _Py_Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena); +#define Interactive(a0, a1) _Py_Interactive(a0, a1) +mod_ty _Py_Interactive(asdl_seq * body, PyArena *arena); +#define Expression(a0, a1) _Py_Expression(a0, a1) +mod_ty _Py_Expression(expr_ty body, PyArena *arena); +#define FunctionType(a0, a1, a2) _Py_FunctionType(a0, a1, a2) +mod_ty _Py_FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena); +#define Suite(a0, a1) _Py_Suite(a0, a1) +mod_ty _Py_Suite(asdl_seq * body, PyArena *arena); +#define FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) +stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body, + asdl_seq * decorator_list, expr_ty returns, string + type_comment, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +#define AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) _Py_AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) +stmt_ty _Py_AsyncFunctionDef(identifier name, arguments_ty args, asdl_seq * + body, asdl_seq * decorator_list, expr_ty returns, + string type_comment, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena + *arena); +#define ClassDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) +stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords, + asdl_seq * body, asdl_seq * decorator_list, int lineno, + int col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +#define Return(a0, a1, a2, a3, a4, a5) _Py_Return(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena); +#define Delete(a0, a1, a2, a3, a4, a5) _Py_Delete(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_Delete(asdl_seq * targets, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +#define Assign(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Assign(a0, a1, a2, a3, a4, a5, a6, a7) +stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, string type_comment, int + lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +#define AugAssign(a0, a1, a2, a3, a4, a5, a6, a7) _Py_AugAssign(a0, a1, a2, a3, a4, a5, a6, a7) +stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int + lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +#define AnnAssign(a0, a1, a2, a3, a4, a5, a6, a7, a8) _Py_AnnAssign(a0, a1, a2, a3, a4, a5, a6, a7, a8) +stmt_ty _Py_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int + simple, int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +#define For(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) _Py_For(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) +stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * + orelse, string type_comment, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +#define AsyncFor(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) _Py_AsyncFor(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) +stmt_ty _Py_AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * + orelse, string type_comment, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena *arena); +#define While(a0, a1, a2, a3, a4, a5, a6, a7) _Py_While(a0, a1, a2, a3, a4, a5, a6, a7) +stmt_ty _Py_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, + int col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +#define If(a0, a1, a2, a3, a4, a5, a6, a7) _Py_If(a0, a1, a2, a3, a4, a5, a6, a7) +stmt_ty _Py_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, + int col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +#define With(a0, a1, a2, a3, a4, a5, a6, a7) _Py_With(a0, a1, a2, a3, a4, a5, a6, a7) +stmt_ty _Py_With(asdl_seq * items, asdl_seq * body, string type_comment, int + lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +#define AsyncWith(a0, a1, a2, a3, a4, a5, a6, a7) _Py_AsyncWith(a0, a1, a2, a3, a4, a5, a6, a7) +stmt_ty _Py_AsyncWith(asdl_seq * items, asdl_seq * body, string type_comment, + int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +#define Raise(a0, a1, a2, a3, a4, a5, a6) _Py_Raise(a0, a1, a2, a3, a4, a5, a6) +stmt_ty _Py_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +#define Try(a0, a1, a2, a3, a4, a5, a6, a7, a8) _Py_Try(a0, a1, a2, a3, a4, a5, a6, a7, a8) +stmt_ty _Py_Try(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, + asdl_seq * finalbody, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +#define Assert(a0, a1, a2, a3, a4, a5, a6) _Py_Assert(a0, a1, a2, a3, a4, a5, a6) +stmt_ty _Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +#define Import(a0, a1, a2, a3, a4, a5) _Py_Import(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_Import(asdl_seq * names, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +#define ImportFrom(a0, a1, a2, a3, a4, a5, a6, a7) _Py_ImportFrom(a0, a1, a2, a3, a4, a5, a6, a7) +stmt_ty _Py_ImportFrom(identifier module, asdl_seq * names, int level, int + lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +#define Global(a0, a1, a2, a3, a4, a5) _Py_Global(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_Global(asdl_seq * names, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +#define Nonlocal(a0, a1, a2, a3, a4, a5) _Py_Nonlocal(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_Nonlocal(asdl_seq * names, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +#define Expr(a0, a1, a2, a3, a4, a5) _Py_Expr(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +#define Pass(a0, a1, a2, a3, a4) _Py_Pass(a0, a1, a2, a3, a4) +stmt_ty _Py_Pass(int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +#define Break(a0, a1, a2, a3, a4) _Py_Break(a0, a1, a2, a3, a4) +stmt_ty _Py_Break(int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +#define Continue(a0, a1, a2, a3, a4) _Py_Continue(a0, a1, a2, a3, a4) +stmt_ty _Py_Continue(int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +#define BoolOp(a0, a1, a2, a3, a4, a5, a6) _Py_BoolOp(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena *arena); +#define NamedExpr(a0, a1, a2, a3, a4, a5, a6) _Py_NamedExpr(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_NamedExpr(expr_ty target, expr_ty value, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +#define BinOp(a0, a1, a2, a3, a4, a5, a6, a7) _Py_BinOp(a0, a1, a2, a3, a4, a5, a6, a7) +expr_ty _Py_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +#define UnaryOp(a0, a1, a2, a3, a4, a5, a6) _Py_UnaryOp(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena *arena); +#define Lambda(a0, a1, a2, a3, a4, a5, a6) _Py_Lambda(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena *arena); +#define IfExp(a0, a1, a2, a3, a4, a5, a6, a7) _Py_IfExp(a0, a1, a2, a3, a4, a5, a6, a7) +expr_ty _Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +#define Dict(a0, a1, a2, a3, a4, a5, a6) _Py_Dict(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +#define Set(a0, a1, a2, a3, a4, a5) _Py_Set(a0, a1, a2, a3, a4, a5) +expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena); +#define ListComp(a0, a1, a2, a3, a4, a5, a6) _Py_ListComp(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +#define SetComp(a0, a1, a2, a3, a4, a5, a6) _Py_SetComp(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +#define DictComp(a0, a1, a2, a3, a4, a5, a6, a7) _Py_DictComp(a0, a1, a2, a3, a4, a5, a6, a7) +expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int + lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +#define GeneratorExp(a0, a1, a2, a3, a4, a5, a6) _Py_GeneratorExp(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int + col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +#define Await(a0, a1, a2, a3, a4, a5) _Py_Await(a0, a1, a2, a3, a4, a5) +expr_ty _Py_Await(expr_ty value, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena); +#define Yield(a0, a1, a2, a3, a4, a5) _Py_Yield(a0, a1, a2, a3, a4, a5) +expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena); +#define YieldFrom(a0, a1, a2, a3, a4, a5) _Py_YieldFrom(a0, a1, a2, a3, a4, a5) +expr_ty _Py_YieldFrom(expr_ty value, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +#define Compare(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Compare(a0, a1, a2, a3, a4, a5, a6, a7) +expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, + int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +#define Call(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Call(a0, a1, a2, a3, a4, a5, a6, a7) +expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, int + lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +#define FormattedValue(a0, a1, a2, a3, a4, a5, a6, a7) _Py_FormattedValue(a0, a1, a2, a3, a4, a5, a6, a7) +expr_ty _Py_FormattedValue(expr_ty value, int conversion, expr_ty format_spec, + int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +#define JoinedStr(a0, a1, a2, a3, a4, a5) _Py_JoinedStr(a0, a1, a2, a3, a4, a5) +expr_ty _Py_JoinedStr(asdl_seq * values, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +#define Constant(a0, a1, a2, a3, a4, a5, a6) _Py_Constant(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_Constant(constant value, string kind, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena *arena); +#define Attribute(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Attribute(a0, a1, a2, a3, a4, a5, a6, a7) +expr_ty _Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int + lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +#define Subscript(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Subscript(a0, a1, a2, a3, a4, a5, a6, a7) +expr_ty _Py_Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int + lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +#define Starred(a0, a1, a2, a3, a4, a5, a6) _Py_Starred(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_Starred(expr_ty value, expr_context_ty ctx, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +#define Name(a0, a1, a2, a3, a4, a5, a6) _Py_Name(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_Name(identifier id, expr_context_ty ctx, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +#define List(a0, a1, a2, a3, a4, a5, a6) _Py_List(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +#define Tuple(a0, a1, a2, a3, a4, a5, a6) _Py_Tuple(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +#define Slice(a0, a1, a2, a3) _Py_Slice(a0, a1, a2, a3) +slice_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena); +#define ExtSlice(a0, a1) _Py_ExtSlice(a0, a1) +slice_ty _Py_ExtSlice(asdl_seq * dims, PyArena *arena); +#define Index(a0, a1) _Py_Index(a0, a1) +slice_ty _Py_Index(expr_ty value, PyArena *arena); +#define comprehension(a0, a1, a2, a3, a4) _Py_comprehension(a0, a1, a2, a3, a4) +comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_seq * + ifs, int is_async, PyArena *arena); +#define ExceptHandler(a0, a1, a2, a3, a4, a5, a6, a7) _Py_ExceptHandler(a0, a1, a2, a3, a4, a5, a6, a7) +excepthandler_ty _Py_ExceptHandler(expr_ty type, identifier name, asdl_seq * + body, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena + *arena); +#define arguments(a0, a1, a2, a3, a4, a5, a6, a7) _Py_arguments(a0, a1, a2, a3, a4, a5, a6, a7) +arguments_ty _Py_arguments(asdl_seq * posonlyargs, asdl_seq * args, arg_ty + vararg, asdl_seq * kwonlyargs, asdl_seq * + kw_defaults, arg_ty kwarg, asdl_seq * defaults, + PyArena *arena); +#define arg(a0, a1, a2, a3, a4, a5, a6, a7) _Py_arg(a0, a1, a2, a3, a4, a5, a6, a7) +arg_ty _Py_arg(identifier arg, expr_ty annotation, string type_comment, int + lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +#define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2) +keyword_ty _Py_keyword(identifier arg, expr_ty value, PyArena *arena); +#define alias(a0, a1, a2) _Py_alias(a0, a1, a2) +alias_ty _Py_alias(identifier name, identifier asname, PyArena *arena); +#define withitem(a0, a1, a2) _Py_withitem(a0, a1, a2) +withitem_ty _Py_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena + *arena); +#define TypeIgnore(a0, a1, a2) _Py_TypeIgnore(a0, a1, a2) +type_ignore_ty _Py_TypeIgnore(int lineno, string tag, PyArena *arena); + +PyObject* PyAST_mod2obj(mod_ty t); +mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode); +int PyAST_Check(PyObject* obj); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYTHON_AST_H */ diff --git a/openflow/usr/include/python3.5m/Python.h b/openflow/include/python3.8/Python.h similarity index 77% rename from openflow/usr/include/python3.5m/Python.h rename to openflow/include/python3.8/Python.h index 858dbd1..d6e5b13 100644 --- a/openflow/usr/include/python3.5m/Python.h +++ b/openflow/include/python3.8/Python.h @@ -18,7 +18,7 @@ #error "Python's source code assumes C's unsigned char is an 8-bit type." #endif -#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) +#if defined(__sgi) && !defined(_SGI_MP_SOURCE) #define _SGI_MP_SOURCE #endif @@ -32,9 +32,22 @@ #include #endif #include -#ifdef HAVE_UNISTD_H +#ifndef MS_WINDOWS #include #endif +#ifdef HAVE_CRYPT_H +#if defined(HAVE_CRYPT_R) && !defined(_GNU_SOURCE) +/* Required for glibc to expose the crypt_r() function prototype. */ +# define _GNU_SOURCE +# define _Py_GNU_SOURCE_FOR_CRYPT +#endif +#include +#ifdef _Py_GNU_SOURCE_FOR_CRYPT +/* Don't leak the _GNU_SOURCE define to other headers. */ +# undef _GNU_SOURCE +# undef _Py_GNU_SOURCE_FOR_CRYPT +#endif +#endif /* For size_t? */ #ifdef HAVE_STDDEF_H @@ -50,7 +63,14 @@ #include "pyport.h" #include "pymacro.h" -#include "pyatomic.h" +/* A convenient way for code to know if clang's memory sanitizer is enabled. */ +#if defined(__has_feature) +# if __has_feature(memory_sanitizer) +# if !defined(_Py_MEMORY_SANITIZER) +# define _Py_MEMORY_SANITIZER +# endif +# endif +#endif /* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. * PYMALLOC_DEBUG is in error if pymalloc is not in use. @@ -104,25 +124,29 @@ #include "weakrefobject.h" #include "structseq.h" #include "namespaceobject.h" +#include "picklebufobject.h" #include "codecs.h" #include "pyerrors.h" +#include "cpython/initconfig.h" #include "pystate.h" +#include "context.h" #include "pyarena.h" #include "modsupport.h" +#include "compile.h" #include "pythonrun.h" #include "pylifecycle.h" #include "ceval.h" #include "sysmodule.h" +#include "osmodule.h" #include "intrcheck.h" #include "import.h" #include "abstract.h" #include "bltinmodule.h" -#include "compile.h" #include "eval.h" #include "pyctype.h" @@ -131,5 +155,6 @@ #include "dtoa.h" #include "fileutils.h" #include "pyfpe.h" +#include "tracemalloc.h" #endif /* !Py_PYTHON_H */ diff --git a/openflow/include/python3.8/abstract.h b/openflow/include/python3.8/abstract.h new file mode 100644 index 0000000..c226aab --- /dev/null +++ b/openflow/include/python3.8/abstract.h @@ -0,0 +1,844 @@ +/* Abstract Object Interface (many thanks to Jim Fulton) */ + +#ifndef Py_ABSTRACTOBJECT_H +#define Py_ABSTRACTOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* === Object Protocol ================================================== */ + +/* Implemented elsewhere: + + int PyObject_Print(PyObject *o, FILE *fp, int flags); + + Print an object 'o' on file 'fp'. Returns -1 on error. The flags argument + is used to enable certain printing options. The only option currently + supported is Py_Print_RAW. + + (What should be said about Py_Print_RAW?). */ + + +/* Implemented elsewhere: + + int PyObject_HasAttrString(PyObject *o, const char *attr_name); + + Returns 1 if object 'o' has the attribute attr_name, and 0 otherwise. + + This is equivalent to the Python expression: hasattr(o,attr_name). + + This function always succeeds. */ + + +/* Implemented elsewhere: + + PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name); + + Retrieve an attributed named attr_name form object o. + Returns the attribute value on success, or NULL on failure. + + This is the equivalent of the Python expression: o.attr_name. */ + + +/* Implemented elsewhere: + + int PyObject_HasAttr(PyObject *o, PyObject *attr_name); + + Returns 1 if o has the attribute attr_name, and 0 otherwise. + + This is equivalent to the Python expression: hasattr(o,attr_name). + + This function always succeeds. */ + +/* Implemented elsewhere: + + PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name); + + Retrieve an attributed named 'attr_name' form object 'o'. + Returns the attribute value on success, or NULL on failure. + + This is the equivalent of the Python expression: o.attr_name. */ + + +/* Implemented elsewhere: + + int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v); + + Set the value of the attribute named attr_name, for object 'o', + to the value 'v'. Raise an exception and return -1 on failure; return 0 on + success. + + This is the equivalent of the Python statement o.attr_name=v. */ + + +/* Implemented elsewhere: + + int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v); + + Set the value of the attribute named attr_name, for object 'o', to the value + 'v'. an exception and return -1 on failure; return 0 on success. + + This is the equivalent of the Python statement o.attr_name=v. */ + +/* Implemented as a macro: + + int PyObject_DelAttrString(PyObject *o, const char *attr_name); + + Delete attribute named attr_name, for object o. Returns + -1 on failure. + + This is the equivalent of the Python statement: del o.attr_name. */ +#define PyObject_DelAttrString(O,A) PyObject_SetAttrString((O),(A), NULL) + + +/* Implemented as a macro: + + int PyObject_DelAttr(PyObject *o, PyObject *attr_name); + + Delete attribute named attr_name, for object o. Returns -1 + on failure. This is the equivalent of the Python + statement: del o.attr_name. */ +#define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A), NULL) + + +/* Implemented elsewhere: + + PyObject *PyObject_Repr(PyObject *o); + + Compute the string representation of object 'o'. Returns the + string representation on success, NULL on failure. + + This is the equivalent of the Python expression: repr(o). + + Called by the repr() built-in function. */ + + +/* Implemented elsewhere: + + PyObject *PyObject_Str(PyObject *o); + + Compute the string representation of object, o. Returns the + string representation on success, NULL on failure. + + This is the equivalent of the Python expression: str(o). + + Called by the str() and print() built-in functions. */ + + +/* Declared elsewhere + + PyAPI_FUNC(int) PyCallable_Check(PyObject *o); + + Determine if the object, o, is callable. Return 1 if the object is callable + and 0 otherwise. + + This function always succeeds. */ + + +#ifdef PY_SSIZE_T_CLEAN +# define PyObject_CallFunction _PyObject_CallFunction_SizeT +# define PyObject_CallMethod _PyObject_CallMethod_SizeT +#endif + + +/* Call a callable Python object 'callable' with arguments given by the + tuple 'args' and keywords arguments given by the dictionary 'kwargs'. + + 'args' must not be *NULL*, use an empty tuple if no arguments are + needed. If no named arguments are needed, 'kwargs' can be NULL. + + This is the equivalent of the Python expression: + callable(*args, **kwargs). */ +PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable, + PyObject *args, PyObject *kwargs); + + +/* Call a callable Python object 'callable', with arguments given by the + tuple 'args'. If no arguments are needed, then 'args' can be *NULL*. + + Returns the result of the call on success, or *NULL* on failure. + + This is the equivalent of the Python expression: + callable(*args). */ +PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable, + PyObject *args); + +/* Call a callable Python object, callable, with a variable number of C + arguments. The C arguments are described using a mkvalue-style format + string. + + The format may be NULL, indicating that no arguments are provided. + + Returns the result of the call on success, or NULL on failure. + + This is the equivalent of the Python expression: + callable(arg1, arg2, ...). */ +PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable, + const char *format, ...); + +/* Call the method named 'name' of object 'obj' with a variable number of + C arguments. The C arguments are described by a mkvalue format string. + + The format can be NULL, indicating that no arguments are provided. + + Returns the result of the call on success, or NULL on failure. + + This is the equivalent of the Python expression: + obj.name(arg1, arg2, ...). */ +PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *obj, + const char *name, + const char *format, ...); + +PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable, + const char *format, + ...); + +PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *obj, + const char *name, + const char *format, + ...); + +/* Call a callable Python object 'callable' with a variable number of C + arguments. The C arguments are provided as PyObject* values, terminated + by a NULL. + + Returns the result of the call on success, or NULL on failure. + + This is the equivalent of the Python expression: + callable(arg1, arg2, ...). */ +PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable, + ...); + +/* Call the method named 'name' of object 'obj' with a variable number of + C arguments. The C arguments are provided as PyObject* values, terminated + by NULL. + + Returns the result of the call on success, or NULL on failure. + + This is the equivalent of the Python expression: obj.name(*args). */ + +PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs( + PyObject *obj, + PyObject *name, + ...); + + +/* Implemented elsewhere: + + Py_hash_t PyObject_Hash(PyObject *o); + + Compute and return the hash, hash_value, of an object, o. On + failure, return -1. + + This is the equivalent of the Python expression: hash(o). */ + + +/* Implemented elsewhere: + + int PyObject_IsTrue(PyObject *o); + + Returns 1 if the object, o, is considered to be true, 0 if o is + considered to be false and -1 on failure. + + This is equivalent to the Python expression: not not o. */ + + +/* Implemented elsewhere: + + int PyObject_Not(PyObject *o); + + Returns 0 if the object, o, is considered to be true, 1 if o is + considered to be false and -1 on failure. + + This is equivalent to the Python expression: not o. */ + + +/* Get the type of an object. + + On success, returns a type object corresponding to the object type of object + 'o'. On failure, returns NULL. + + This is equivalent to the Python expression: type(o) */ +PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o); + + +/* Return the size of object 'o'. If the object 'o' provides both sequence and + mapping protocols, the sequence size is returned. + + On error, -1 is returned. + + This is the equivalent to the Python expression: len(o) */ +PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject *o); + + +/* For DLL compatibility */ +#undef PyObject_Length +PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o); +#define PyObject_Length PyObject_Size + +/* Return element of 'o' corresponding to the object 'key'. Return NULL + on failure. + + This is the equivalent of the Python expression: o[key] */ +PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key); + + +/* Map the object 'key' to the value 'v' into 'o'. + + Raise an exception and return -1 on failure; return 0 on success. + + This is the equivalent of the Python statement: o[key]=v. */ +PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v); + +/* Remove the mapping for the string 'key' from the object 'o'. + Returns -1 on failure. + + This is equivalent to the Python statement: del o[key]. */ +PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, const char *key); + +/* Delete the mapping for the object 'key' from the object 'o'. + Returns -1 on failure. + + This is the equivalent of the Python statement: del o[key]. */ +PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key); + + +/* === Old Buffer API ============================================ */ + +/* FIXME: usage of these should all be replaced in Python itself + but for backwards compatibility we will implement them. + Their usage without a corresponding "unlock" mechanism + may create issues (but they would already be there). */ + +/* Takes an arbitrary object which must support the (character, single segment) + buffer interface and returns a pointer to a read-only memory location + useable as character based input for subsequent processing. + + Return 0 on success. buffer and buffer_len are only set in case no error + occurs. Otherwise, -1 is returned and an exception set. */ +Py_DEPRECATED(3.0) +PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj, + const char **buffer, + Py_ssize_t *buffer_len); + +/* Checks whether an arbitrary object supports the (character, single segment) + buffer interface. + + Returns 1 on success, 0 on failure. */ +Py_DEPRECATED(3.0) PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj); + +/* Same as PyObject_AsCharBuffer() except that this API expects (readable, + single segment) buffer interface and returns a pointer to a read-only memory + location which can contain arbitrary data. + + 0 is returned on success. buffer and buffer_len are only set in case no + error occurs. Otherwise, -1 is returned and an exception set. */ +Py_DEPRECATED(3.0) +PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj, + const void **buffer, + Py_ssize_t *buffer_len); + +/* Takes an arbitrary object which must support the (writable, single segment) + buffer interface and returns a pointer to a writable memory location in + buffer of size 'buffer_len'. + + Return 0 on success. buffer and buffer_len are only set in case no error + occurs. Otherwise, -1 is returned and an exception set. */ +Py_DEPRECATED(3.0) +PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj, + void **buffer, + Py_ssize_t *buffer_len); + + +/* === New Buffer API ============================================ */ + +/* Takes an arbitrary object and returns the result of calling + obj.__format__(format_spec). */ +PyAPI_FUNC(PyObject *) PyObject_Format(PyObject *obj, + PyObject *format_spec); + + +/* ==== Iterators ================================================ */ + +/* Takes an object and returns an iterator for it. + This is typically a new iterator but if the argument is an iterator, this + returns itself. */ +PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *); + +/* Returns 1 if the object 'obj' provides iterator protocols, and 0 otherwise. + + This function always succeeds. */ +PyAPI_FUNC(int) PyIter_Check(PyObject *); + +/* Takes an iterator object and calls its tp_iternext slot, + returning the next value. + + If the iterator is exhausted, this returns NULL without setting an + exception. + + NULL with an exception means an error occurred. */ +PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *); + + +/* === Number Protocol ================================================== */ + +/* Returns 1 if the object 'o' provides numeric protocols, and 0 otherwise. + + This function always succeeds. */ +PyAPI_FUNC(int) PyNumber_Check(PyObject *o); + +/* Returns the result of adding o1 and o2, or NULL on failure. + + This is the equivalent of the Python expression: o1 + o2. */ +PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2); + +/* Returns the result of subtracting o2 from o1, or NULL on failure. + + This is the equivalent of the Python expression: o1 - o2. */ +PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2); + +/* Returns the result of multiplying o1 and o2, or NULL on failure. + + This is the equivalent of the Python expression: o1 * o2. */ +PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 +/* This is the equivalent of the Python expression: o1 @ o2. */ +PyAPI_FUNC(PyObject *) PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2); +#endif + +/* Returns the result of dividing o1 by o2 giving an integral result, + or NULL on failure. + + This is the equivalent of the Python expression: o1 // o2. */ +PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2); + +/* Returns the result of dividing o1 by o2 giving a float result, or NULL on + failure. + + This is the equivalent of the Python expression: o1 / o2. */ +PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2); + +/* Returns the remainder of dividing o1 by o2, or NULL on failure. + + This is the equivalent of the Python expression: o1 % o2. */ +PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2); + +/* See the built-in function divmod. + + Returns NULL on failure. + + This is the equivalent of the Python expression: divmod(o1, o2). */ +PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2); + +/* See the built-in function pow. Returns NULL on failure. + + This is the equivalent of the Python expression: pow(o1, o2, o3), + where o3 is optional. */ +PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2, + PyObject *o3); + +/* Returns the negation of o on success, or NULL on failure. + + This is the equivalent of the Python expression: -o. */ +PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o); + +/* Returns the positive of o on success, or NULL on failure. + + This is the equivalent of the Python expression: +o. */ +PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o); + +/* Returns the absolute value of 'o', or NULL on failure. + + This is the equivalent of the Python expression: abs(o). */ +PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o); + +/* Returns the bitwise negation of 'o' on success, or NULL on failure. + + This is the equivalent of the Python expression: ~o. */ +PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o); + +/* Returns the result of left shifting o1 by o2 on success, or NULL on failure. + + This is the equivalent of the Python expression: o1 << o2. */ +PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2); + +/* Returns the result of right shifting o1 by o2 on success, or NULL on + failure. + + This is the equivalent of the Python expression: o1 >> o2. */ +PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2); + +/* Returns the result of bitwise and of o1 and o2 on success, or NULL on + failure. + + This is the equivalent of the Python expression: o1 & o2. */ +PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2); + +/* Returns the bitwise exclusive or of o1 by o2 on success, or NULL on failure. + + This is the equivalent of the Python expression: o1 ^ o2. */ +PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2); + +/* Returns the result of bitwise or on o1 and o2 on success, or NULL on + failure. + + This is the equivalent of the Python expression: o1 | o2. */ +PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2); + +/* Returns 1 if obj is an index integer (has the nb_index slot of the + tp_as_number structure filled in), and 0 otherwise. */ +PyAPI_FUNC(int) PyIndex_Check(PyObject *); + +/* Returns the object 'o' converted to a Python int, or NULL with an exception + raised on failure. */ +PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o); + +/* Returns the object 'o' converted to Py_ssize_t by going through + PyNumber_Index() first. + + If an overflow error occurs while converting the int to Py_ssize_t, then the + second argument 'exc' is the error-type to return. If it is NULL, then the + overflow error is cleared and the value is clipped. */ +PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc); + +/* Returns the object 'o' converted to an integer object on success, or NULL + on failure. + + This is the equivalent of the Python expression: int(o). */ +PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o); + +/* Returns the object 'o' converted to a float object on success, or NULL + on failure. + + This is the equivalent of the Python expression: float(o). */ +PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o); + + +/* --- In-place variants of (some of) the above number protocol functions -- */ + +/* Returns the result of adding o2 to o1, possibly in-place, or NULL + on failure. + + This is the equivalent of the Python expression: o1 += o2. */ +PyAPI_FUNC(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2); + +/* Returns the result of subtracting o2 from o1, possibly in-place or + NULL on failure. + + This is the equivalent of the Python expression: o1 -= o2. */ +PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2); + +/* Returns the result of multiplying o1 by o2, possibly in-place, or NULL on + failure. + + This is the equivalent of the Python expression: o1 *= o2. */ +PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 +/* This is the equivalent of the Python expression: o1 @= o2. */ +PyAPI_FUNC(PyObject *) PyNumber_InPlaceMatrixMultiply(PyObject *o1, PyObject *o2); +#endif + +/* Returns the result of dividing o1 by o2 giving an integral result, possibly + in-place, or NULL on failure. + + This is the equivalent of the Python expression: o1 /= o2. */ +PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1, + PyObject *o2); + +/* Returns the result of dividing o1 by o2 giving a float result, possibly + in-place, or null on failure. + + This is the equivalent of the Python expression: o1 /= o2. */ +PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1, + PyObject *o2); + +/* Returns the remainder of dividing o1 by o2, possibly in-place, or NULL on + failure. + + This is the equivalent of the Python expression: o1 %= o2. */ +PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2); + +/* Returns the result of raising o1 to the power of o2, possibly in-place, + or NULL on failure. + + This is the equivalent of the Python expression: o1 **= o2, + or o1 = pow(o1, o2, o3) if o3 is present. */ +PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2, + PyObject *o3); + +/* Returns the result of left shifting o1 by o2, possibly in-place, or NULL + on failure. + + This is the equivalent of the Python expression: o1 <<= o2. */ +PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2); + +/* Returns the result of right shifting o1 by o2, possibly in-place or NULL + on failure. + + This is the equivalent of the Python expression: o1 >>= o2. */ +PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2); + +/* Returns the result of bitwise and of o1 and o2, possibly in-place, or NULL + on failure. + + This is the equivalent of the Python expression: o1 &= o2. */ +PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2); + +/* Returns the bitwise exclusive or of o1 by o2, possibly in-place, or NULL + on failure. + + This is the equivalent of the Python expression: o1 ^= o2. */ +PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2); + +/* Returns the result of bitwise or of o1 and o2, possibly in-place, + or NULL on failure. + + This is the equivalent of the Python expression: o1 |= o2. */ +PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2); + +/* Returns the integer n converted to a string with a base, with a base + marker of 0b, 0o or 0x prefixed if applicable. + + If n is not an int object, it is converted with PyNumber_Index first. */ +PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base); + + +/* === Sequence protocol ================================================ */ + +/* Return 1 if the object provides sequence protocol, and zero + otherwise. + + This function always succeeds. */ +PyAPI_FUNC(int) PySequence_Check(PyObject *o); + +/* Return the size of sequence object o, or -1 on failure. */ +PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o); + +/* For DLL compatibility */ +#undef PySequence_Length +PyAPI_FUNC(Py_ssize_t) PySequence_Length(PyObject *o); +#define PySequence_Length PySequence_Size + + +/* Return the concatenation of o1 and o2 on success, and NULL on failure. + + This is the equivalent of the Python expression: o1 + o2. */ +PyAPI_FUNC(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2); + +/* Return the result of repeating sequence object 'o' 'count' times, + or NULL on failure. + + This is the equivalent of the Python expression: o * count. */ +PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count); + +/* Return the ith element of o, or NULL on failure. + + This is the equivalent of the Python expression: o[i]. */ +PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i); + +/* Return the slice of sequence object o between i1 and i2, or NULL on failure. + + This is the equivalent of the Python expression: o[i1:i2]. */ +PyAPI_FUNC(PyObject *) PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); + +/* Assign object 'v' to the ith element of the sequence 'o'. Raise an exception + and return -1 on failure; return 0 on success. + + This is the equivalent of the Python statement o[i] = v. */ +PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v); + +/* Delete the 'i'-th element of the sequence 'v'. Returns -1 on failure. + + This is the equivalent of the Python statement: del o[i]. */ +PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i); + +/* Assign the sequence object 'v' to the slice in sequence object 'o', + from 'i1' to 'i2'. Returns -1 on failure. + + This is the equivalent of the Python statement: o[i1:i2] = v. */ +PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, + PyObject *v); + +/* Delete the slice in sequence object 'o' from 'i1' to 'i2'. + Returns -1 on failure. + + This is the equivalent of the Python statement: del o[i1:i2]. */ +PyAPI_FUNC(int) PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); + +/* Returns the sequence 'o' as a tuple on success, and NULL on failure. + + This is equivalent to the Python expression: tuple(o). */ +PyAPI_FUNC(PyObject *) PySequence_Tuple(PyObject *o); + +/* Returns the sequence 'o' as a list on success, and NULL on failure. + This is equivalent to the Python expression: list(o) */ +PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o); + +/* Return the sequence 'o' as a list, unless it's already a tuple or list. + + Use PySequence_Fast_GET_ITEM to access the members of this list, and + PySequence_Fast_GET_SIZE to get its length. + + Returns NULL on failure. If the object does not support iteration, raises a + TypeError exception with 'm' as the message text. */ +PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m); + +/* Return the size of the sequence 'o', assuming that 'o' was returned by + PySequence_Fast and is not NULL. */ +#define PySequence_Fast_GET_SIZE(o) \ + (PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o)) + +/* Return the 'i'-th element of the sequence 'o', assuming that o was returned + by PySequence_Fast, and that i is within bounds. */ +#define PySequence_Fast_GET_ITEM(o, i)\ + (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) + +/* Return a pointer to the underlying item array for + an object retured by PySequence_Fast */ +#define PySequence_Fast_ITEMS(sf) \ + (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \ + : ((PyTupleObject *)(sf))->ob_item) + +/* Return the number of occurrences on value on 'o', that is, return + the number of keys for which o[key] == value. + + On failure, return -1. This is equivalent to the Python expression: + o.count(value). */ +PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value); + +/* Return 1 if 'ob' is in the sequence 'seq'; 0 if 'ob' is not in the sequence + 'seq'; -1 on error. + + Use __contains__ if possible, else _PySequence_IterSearch(). */ +PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob); + +/* For DLL-level backwards compatibility */ +#undef PySequence_In +/* Determine if the sequence 'o' contains 'value'. If an item in 'o' is equal + to 'value', return 1, otherwise return 0. On error, return -1. + + This is equivalent to the Python expression: value in o. */ +PyAPI_FUNC(int) PySequence_In(PyObject *o, PyObject *value); + +/* For source-level backwards compatibility */ +#define PySequence_In PySequence_Contains + + +/* Return the first index for which o[i] == value. + On error, return -1. + + This is equivalent to the Python expression: o.index(value). */ +PyAPI_FUNC(Py_ssize_t) PySequence_Index(PyObject *o, PyObject *value); + + +/* --- In-place versions of some of the above Sequence functions --- */ + +/* Append sequence 'o2' to sequence 'o1', in-place when possible. Return the + resulting object, which could be 'o1', or NULL on failure. + + This is the equivalent of the Python expression: o1 += o2. */ +PyAPI_FUNC(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2); + +/* Repeat sequence 'o' by 'count', in-place when possible. Return the resulting + object, which could be 'o', or NULL on failure. + + This is the equivalent of the Python expression: o1 *= count. */ +PyAPI_FUNC(PyObject *) PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count); + + +/* === Mapping protocol ================================================= */ + +/* Return 1 if the object provides mapping protocol, and 0 otherwise. + + This function always succeeds. */ +PyAPI_FUNC(int) PyMapping_Check(PyObject *o); + +/* Returns the number of keys in mapping object 'o' on success, and -1 on + failure. This is equivalent to the Python expression: len(o). */ +PyAPI_FUNC(Py_ssize_t) PyMapping_Size(PyObject *o); + +/* For DLL compatibility */ +#undef PyMapping_Length +PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o); +#define PyMapping_Length PyMapping_Size + + +/* Implemented as a macro: + + int PyMapping_DelItemString(PyObject *o, const char *key); + + Remove the mapping for the string 'key' from the mapping 'o'. Returns -1 on + failure. + + This is equivalent to the Python statement: del o[key]. */ +#define PyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K)) + +/* Implemented as a macro: + + int PyMapping_DelItem(PyObject *o, PyObject *key); + + Remove the mapping for the object 'key' from the mapping object 'o'. + Returns -1 on failure. + + This is equivalent to the Python statement: del o[key]. */ +#define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K)) + +/* On success, return 1 if the mapping object 'o' has the key 'key', + and 0 otherwise. + + This is equivalent to the Python expression: key in o. + + This function always succeeds. */ +PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, const char *key); + +/* Return 1 if the mapping object has the key 'key', and 0 otherwise. + + This is equivalent to the Python expression: key in o. + + This function always succeeds. */ +PyAPI_FUNC(int) PyMapping_HasKey(PyObject *o, PyObject *key); + +/* On success, return a list or tuple of the keys in mapping object 'o'. + On failure, return NULL. */ +PyAPI_FUNC(PyObject *) PyMapping_Keys(PyObject *o); + +/* On success, return a list or tuple of the values in mapping object 'o'. + On failure, return NULL. */ +PyAPI_FUNC(PyObject *) PyMapping_Values(PyObject *o); + +/* On success, return a list or tuple of the items in mapping object 'o', + where each item is a tuple containing a key-value pair. On failure, return + NULL. */ +PyAPI_FUNC(PyObject *) PyMapping_Items(PyObject *o); + +/* Return element of 'o' corresponding to the string 'key' or NULL on failure. + + This is the equivalent of the Python expression: o[key]. */ +PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, + const char *key); + +/* Map the string 'key' to the value 'v' in the mapping 'o'. + Returns -1 on failure. + + This is the equivalent of the Python statement: o[key]=v. */ +PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, const char *key, + PyObject *value); + +/* isinstance(object, typeorclass) */ +PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass); + +/* issubclass(object, typeorclass) */ +PyAPI_FUNC(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass); + +#ifndef Py_LIMITED_API +# define Py_CPYTHON_ABSTRACTOBJECT_H +# include "cpython/abstract.h" +# undef Py_CPYTHON_ABSTRACTOBJECT_H +#endif + +#ifdef __cplusplus +} +#endif +#endif /* Py_ABSTRACTOBJECT_H */ diff --git a/openflow/usr/include/python3.5m/asdl.h b/openflow/include/python3.8/asdl.h similarity index 93% rename from openflow/usr/include/python3.5m/asdl.h rename to openflow/include/python3.8/asdl.h index 495153c..fc6d223 100644 --- a/openflow/usr/include/python3.5m/asdl.h +++ b/openflow/include/python3.8/asdl.h @@ -6,6 +6,7 @@ typedef PyObject * string; typedef PyObject * bytes; typedef PyObject * object; typedef PyObject * singleton; +typedef PyObject * constant; /* It would be nice if the code generated by asdl_c.py was completely independent of Python, but it is a goal the requires too much work @@ -35,7 +36,7 @@ asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena); do { \ Py_ssize_t _asdl_i = (I); \ assert((S) != NULL); \ - assert(_asdl_i < (S)->size); \ + assert(0 <= _asdl_i && _asdl_i < (S)->size); \ (S)->elements[_asdl_i] = (V); \ } while (0) #else diff --git a/openflow/usr/include/python3.5m/ast.h b/openflow/include/python3.8/ast.h similarity index 50% rename from openflow/usr/include/python3.5m/ast.h rename to openflow/include/python3.8/ast.h index 6a8c816..f1d7348 100644 --- a/openflow/usr/include/python3.5m/ast.h +++ b/openflow/include/python3.8/ast.h @@ -4,6 +4,9 @@ extern "C" { #endif +#include "Python-ast.h" /* mod_ty */ +#include "node.h" /* node */ + PyAPI_FUNC(int) PyAST_Validate(mod_ty); PyAPI_FUNC(mod_ty) PyAST_FromNode( const node *n, @@ -16,6 +19,18 @@ PyAPI_FUNC(mod_ty) PyAST_FromNodeObject( PyObject *filename, PyArena *arena); +#ifndef Py_LIMITED_API + +/* _PyAST_ExprAsUnicode is defined in ast_unparse.c */ +PyAPI_FUNC(PyObject *) _PyAST_ExprAsUnicode(expr_ty); + +/* Return the borrowed reference to the first literal string in the + sequence of statemnts or NULL if it doesn't start from a literal string. + Doesn't set exception. */ +PyAPI_FUNC(PyObject *) _PyAST_GetDocString(asdl_seq *); + +#endif /* !Py_LIMITED_API */ + #ifdef __cplusplus } #endif diff --git a/openflow/include/python3.8/bitset.h b/openflow/include/python3.8/bitset.h new file mode 100644 index 0000000..6a2ac97 --- /dev/null +++ b/openflow/include/python3.8/bitset.h @@ -0,0 +1,23 @@ + +#ifndef Py_BITSET_H +#define Py_BITSET_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Bitset interface */ + +#define BYTE char +typedef BYTE *bitset; + +#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0) + +#define BITSPERBYTE (8*sizeof(BYTE)) +#define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE) +#define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE) +#define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit)) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_BITSET_H */ diff --git a/openflow/usr/include/python3.5m/bltinmodule.h b/openflow/include/python3.8/bltinmodule.h similarity index 100% rename from openflow/usr/include/python3.5m/bltinmodule.h rename to openflow/include/python3.8/bltinmodule.h diff --git a/openflow/usr/include/python3.5m/boolobject.h b/openflow/include/python3.8/boolobject.h similarity index 100% rename from openflow/usr/include/python3.5m/boolobject.h rename to openflow/include/python3.8/boolobject.h diff --git a/openflow/usr/include/python3.5m/bytearrayobject.h b/openflow/include/python3.8/bytearrayobject.h similarity index 100% rename from openflow/usr/include/python3.5m/bytearrayobject.h rename to openflow/include/python3.8/bytearrayobject.h diff --git a/openflow/usr/include/python3.5m/bytes_methods.h b/openflow/include/python3.8/bytes_methods.h similarity index 55% rename from openflow/usr/include/python3.5m/bytes_methods.h rename to openflow/include/python3.8/bytes_methods.h index 11d5f42..8434a50 100644 --- a/openflow/usr/include/python3.5m/bytes_methods.h +++ b/openflow/include/python3.8/bytes_methods.h @@ -9,6 +9,7 @@ extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isascii(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len); @@ -17,9 +18,18 @@ extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len); /* These store their len sized answer in the given preallocated *result arg. */ extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len); extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len); -extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len); -extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len); -extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len); +extern void _Py_bytes_title(char *result, const char *s, Py_ssize_t len); +extern void _Py_bytes_capitalize(char *result, const char *s, Py_ssize_t len); +extern void _Py_bytes_swapcase(char *result, const char *s, Py_ssize_t len); + +extern PyObject *_Py_bytes_find(const char *str, Py_ssize_t len, PyObject *args); +extern PyObject *_Py_bytes_index(const char *str, Py_ssize_t len, PyObject *args); +extern PyObject *_Py_bytes_rfind(const char *str, Py_ssize_t len, PyObject *args); +extern PyObject *_Py_bytes_rindex(const char *str, Py_ssize_t len, PyObject *args); +extern PyObject *_Py_bytes_count(const char *str, Py_ssize_t len, PyObject *args); +extern int _Py_bytes_contains(const char *str, Py_ssize_t len, PyObject *arg); +extern PyObject *_Py_bytes_startswith(const char *str, Py_ssize_t len, PyObject *args); +extern PyObject *_Py_bytes_endswith(const char *str, Py_ssize_t len, PyObject *args); /* The maketrans() static method. */ extern PyObject* _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to); @@ -28,6 +38,7 @@ extern PyObject* _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to); extern const char _Py_isspace__doc__[]; extern const char _Py_isalpha__doc__[]; extern const char _Py_isalnum__doc__[]; +extern const char _Py_isascii__doc__[]; extern const char _Py_isdigit__doc__[]; extern const char _Py_islower__doc__[]; extern const char _Py_isupper__doc__[]; @@ -37,7 +48,19 @@ extern const char _Py_upper__doc__[]; extern const char _Py_title__doc__[]; extern const char _Py_capitalize__doc__[]; extern const char _Py_swapcase__doc__[]; +extern const char _Py_count__doc__[]; +extern const char _Py_find__doc__[]; +extern const char _Py_index__doc__[]; +extern const char _Py_rfind__doc__[]; +extern const char _Py_rindex__doc__[]; +extern const char _Py_startswith__doc__[]; +extern const char _Py_endswith__doc__[]; extern const char _Py_maketrans__doc__[]; +extern const char _Py_expandtabs__doc__[]; +extern const char _Py_ljust__doc__[]; +extern const char _Py_rjust__doc__[]; +extern const char _Py_center__doc__[]; +extern const char _Py_zfill__doc__[]; /* this is needed because some docs are shared from the .o, not static */ #define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str) diff --git a/openflow/usr/include/python3.5m/bytesobject.h b/openflow/include/python3.8/bytesobject.h similarity index 55% rename from openflow/usr/include/python3.5m/bytesobject.h rename to openflow/include/python3.8/bytesobject.h index 6c1e0c3..3fde4a2 100644 --- a/openflow/usr/include/python3.5m/bytesobject.h +++ b/openflow/include/python3.8/bytesobject.h @@ -52,9 +52,9 @@ PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t); PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *); PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *); PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list) - Py_GCC_ATTRIBUTE((format(printf, 1, 0))); + Py_GCC_ATTRIBUTE((format(printf, 1, 0))); PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...) - Py_GCC_ATTRIBUTE((format(printf, 1, 2))); + Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *); PyAPI_FUNC(char *) PyBytes_AsString(PyObject *); PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int); @@ -62,11 +62,25 @@ PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *); PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t); -PyAPI_FUNC(PyObject *) _PyBytes_Format(PyObject *, PyObject *); +PyAPI_FUNC(PyObject*) _PyBytes_FormatEx( + const char *format, + Py_ssize_t format_len, + PyObject *args, + int use_bytearray); +PyAPI_FUNC(PyObject*) _PyBytes_FromHex( + PyObject *string, + int use_bytearray); #endif PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t, - const char *, Py_ssize_t, - const char *); + const char *, Py_ssize_t, + const char *); +#ifndef Py_LIMITED_API +/* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */ +PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t, + const char *, Py_ssize_t, + const char *, + const char **); +#endif /* Macro, trading safety for speed */ #ifndef Py_LIMITED_API @@ -118,10 +132,91 @@ PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer, /* Flags used by string formatting */ #define F_LJUST (1<<0) -#define F_SIGN (1<<1) +#define F_SIGN (1<<1) #define F_BLANK (1<<2) -#define F_ALT (1<<3) -#define F_ZERO (1<<4) +#define F_ALT (1<<3) +#define F_ZERO (1<<4) + +#ifndef Py_LIMITED_API +/* The _PyBytesWriter structure is big: it contains an embedded "stack buffer". + A _PyBytesWriter variable must be declared at the end of variables in a + function to optimize the memory allocation on the stack. */ +typedef struct { + /* bytes, bytearray or NULL (when the small buffer is used) */ + PyObject *buffer; + + /* Number of allocated size. */ + Py_ssize_t allocated; + + /* Minimum number of allocated bytes, + incremented by _PyBytesWriter_Prepare() */ + Py_ssize_t min_size; + + /* If non-zero, use a bytearray instead of a bytes object for buffer. */ + int use_bytearray; + + /* If non-zero, overallocate the buffer (default: 0). + This flag must be zero if use_bytearray is non-zero. */ + int overallocate; + + /* Stack buffer */ + int use_small_buffer; + char small_buffer[512]; +} _PyBytesWriter; + +/* Initialize a bytes writer + + By default, the overallocation is disabled. Set the overallocate attribute + to control the allocation of the buffer. */ +PyAPI_FUNC(void) _PyBytesWriter_Init(_PyBytesWriter *writer); + +/* Get the buffer content and reset the writer. + Return a bytes object, or a bytearray object if use_bytearray is non-zero. + Raise an exception and return NULL on error. */ +PyAPI_FUNC(PyObject *) _PyBytesWriter_Finish(_PyBytesWriter *writer, + void *str); + +/* Deallocate memory of a writer (clear its internal buffer). */ +PyAPI_FUNC(void) _PyBytesWriter_Dealloc(_PyBytesWriter *writer); + +/* Allocate the buffer to write size bytes. + Return the pointer to the beginning of buffer data. + Raise an exception and return NULL on error. */ +PyAPI_FUNC(void*) _PyBytesWriter_Alloc(_PyBytesWriter *writer, + Py_ssize_t size); + +/* Ensure that the buffer is large enough to write *size* bytes. + Add size to the writer minimum size (min_size attribute). + + str is the current pointer inside the buffer. + Return the updated current pointer inside the buffer. + Raise an exception and return NULL on error. */ +PyAPI_FUNC(void*) _PyBytesWriter_Prepare(_PyBytesWriter *writer, + void *str, + Py_ssize_t size); + +/* Resize the buffer to make it larger. + The new buffer may be larger than size bytes because of overallocation. + Return the updated current pointer inside the buffer. + Raise an exception and return NULL on error. + + Note: size must be greater than the number of allocated bytes in the writer. + + This function doesn't use the writer minimum size (min_size attribute). + + See also _PyBytesWriter_Prepare(). + */ +PyAPI_FUNC(void*) _PyBytesWriter_Resize(_PyBytesWriter *writer, + void *str, + Py_ssize_t size); + +/* Write bytes. + Raise an exception and return NULL on error. */ +PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer, + void *str, + const void *bytes, + Py_ssize_t size); +#endif /* Py_LIMITED_API */ #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/cellobject.h b/openflow/include/python3.8/cellobject.h similarity index 87% rename from openflow/usr/include/python3.5m/cellobject.h rename to openflow/include/python3.8/cellobject.h index a0aa4d9..2f9b5b7 100644 --- a/openflow/usr/include/python3.5m/cellobject.h +++ b/openflow/include/python3.8/cellobject.h @@ -7,8 +7,8 @@ extern "C" { #endif typedef struct { - PyObject_HEAD - PyObject *ob_ref; /* Content of the cell or NULL when empty */ + PyObject_HEAD + PyObject *ob_ref; /* Content of the cell or NULL when empty */ } PyCellObject; PyAPI_DATA(PyTypeObject) PyCell_Type; diff --git a/openflow/usr/include/python3.5m/ceval.h b/openflow/include/python3.8/ceval.h similarity index 74% rename from openflow/usr/include/python3.5m/ceval.h rename to openflow/include/python3.8/ceval.h index b5373a9..36fd014 100644 --- a/openflow/usr/include/python3.5m/ceval.h +++ b/openflow/include/python3.8/ceval.h @@ -7,24 +7,36 @@ extern "C" { /* Interface to random parts in ceval.c */ +/* PyEval_CallObjectWithKeywords(), PyEval_CallObject(), PyEval_CallFunction + * and PyEval_CallMethod are kept for backward compatibility: PyObject_Call(), + * PyObject_CallFunction() and PyObject_CallMethod() are recommended to call + * a callable object. + */ + PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( - PyObject *, PyObject *, PyObject *); + PyObject *callable, + PyObject *args, + PyObject *kwargs); /* Inline this */ -#define PyEval_CallObject(func,arg) \ - PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL) +#define PyEval_CallObject(callable, arg) \ + PyEval_CallObjectWithKeywords(callable, arg, (PyObject *)NULL) -PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj, +PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *callable, const char *format, ...); PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj, - const char *methodname, + const char *name, const char *format, ...); #ifndef Py_LIMITED_API PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *); PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *); -PyAPI_FUNC(void) _PyEval_SetCoroutineWrapper(PyObject *); -PyAPI_FUNC(PyObject *) _PyEval_GetCoroutineWrapper(void); +PyAPI_FUNC(void) _PyEval_SetCoroutineOriginTrackingDepth(int new_depth); +PyAPI_FUNC(int) _PyEval_GetCoroutineOriginTrackingDepth(void); +PyAPI_FUNC(void) _PyEval_SetAsyncGenFirstiter(PyObject *); +PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFirstiter(void); +PyAPI_FUNC(void) _PyEval_SetAsyncGenFinalizer(PyObject *); +PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFinalizer(void); #endif struct _frame; /* Avoid including frameobject.h */ @@ -34,10 +46,12 @@ PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void); PyAPI_FUNC(PyObject *) PyEval_GetLocals(void); PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void); +#ifndef Py_LIMITED_API +/* Helper to look up a builtin object */ +PyAPI_FUNC(PyObject *) _PyEval_GetBuiltinId(_Py_Identifier *); /* Look at the current frame's (if any) code's co_flags, and turn on the corresponding compiler flags in cf->cf_flags. Return 1 if any flag was set, else return 0. */ -#ifndef Py_LIMITED_API PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); #endif @@ -80,16 +94,19 @@ PyAPI_FUNC(int) Py_GetRecursionLimit(void); PyThreadState_GET()->overflowed = 0; \ } while(0) PyAPI_FUNC(int) _Py_CheckRecursiveCall(const char *where); + +/* Due to the macros in which it's used, _Py_CheckRecursionLimit is in + the stable ABI. It should be removed therefrom when possible. +*/ PyAPI_DATA(int) _Py_CheckRecursionLimit; #ifdef USE_STACKCHECK -/* With USE_STACKCHECK, we artificially decrement the recursion limit in order - to trigger regular stack checks in _Py_CheckRecursiveCall(), except if - the "overflowed" flag is set, in which case we need the true value - of _Py_CheckRecursionLimit for _Py_MakeEndRecCheck() to function properly. +/* With USE_STACKCHECK, trigger stack checks in _Py_CheckRecursiveCall() + on every 64th call to Py_EnterRecursiveCall. */ # define _Py_MakeRecCheck(x) \ - (++(x) > (_Py_CheckRecursionLimit += PyThreadState_GET()->overflowed - 1)) + (++(x) > _Py_CheckRecursionLimit || \ + ++(PyThreadState_GET()->stackcheck_counter) > 64) #else # define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit) #endif @@ -116,9 +133,11 @@ PyAPI_DATA(int) _Py_CheckRecursionLimit; PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *); PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *); -PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *); PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *); PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(struct _frame *f, int exc); +#endif /* Interface for threads. @@ -139,7 +158,7 @@ PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc); if (...premature_exit...) { Py_BLOCK_THREADS - PyErr_SetFromErrno(PyExc_IOError); + PyErr_SetFromErrno(PyExc_OSError); return NULL; } @@ -147,7 +166,7 @@ PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc); Py_BLOCK_THREADS if (...premature_exit...) { - PyErr_SetFromErrno(PyExc_IOError); + PyErr_SetFromErrno(PyExc_OSError); return NULL; } Py_UNBLOCK_THREADS @@ -168,22 +187,22 @@ PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc); PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void); PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *); -#ifdef WITH_THREAD - PyAPI_FUNC(int) PyEval_ThreadsInitialized(void); PyAPI_FUNC(void) PyEval_InitThreads(void); -PyAPI_FUNC(void) _PyEval_FiniThreads(void); -PyAPI_FUNC(void) PyEval_AcquireLock(void); -PyAPI_FUNC(void) PyEval_ReleaseLock(void); +Py_DEPRECATED(3.2) PyAPI_FUNC(void) PyEval_AcquireLock(void); +/* Py_DEPRECATED(3.2) */ PyAPI_FUNC(void) PyEval_ReleaseLock(void); PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate); PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate); -PyAPI_FUNC(void) PyEval_ReInitThreads(void); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds); PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void); #endif +#ifndef Py_LIMITED_API +PyAPI_FUNC(Py_ssize_t) _PyEval_RequestCodeExtraIndex(freefunc); +#endif + #define Py_BEGIN_ALLOW_THREADS { \ PyThreadState *_save; \ _save = PyEval_SaveThread(); @@ -192,20 +211,19 @@ PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void); #define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \ } -#else /* !WITH_THREAD */ - -#define Py_BEGIN_ALLOW_THREADS { -#define Py_BLOCK_THREADS -#define Py_UNBLOCK_THREADS -#define Py_END_ALLOW_THREADS } - -#endif /* !WITH_THREAD */ - #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *); -PyAPI_FUNC(void) _PyEval_SignalAsyncExc(void); +PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *); #endif +/* Masks and values used by FORMAT_VALUE opcode. */ +#define FVC_MASK 0x3 +#define FVC_NONE 0x0 +#define FVC_STR 0x1 +#define FVC_REPR 0x2 +#define FVC_ASCII 0x3 +#define FVS_MASK 0x4 +#define FVS_HAVE_SPEC 0x4 #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/classobject.h b/openflow/include/python3.8/classobject.h similarity index 93% rename from openflow/usr/include/python3.5m/classobject.h rename to openflow/include/python3.8/classobject.h index eeeb3e9..c83303c 100644 --- a/openflow/usr/include/python3.5m/classobject.h +++ b/openflow/include/python3.8/classobject.h @@ -14,6 +14,7 @@ typedef struct { PyObject *im_func; /* The callable object implementing the method */ PyObject *im_self; /* The instance it is bound to */ PyObject *im_weakreflist; /* List of weak references */ + vectorcallfunc vectorcall; } PyMethodObject; PyAPI_DATA(PyTypeObject) PyMethod_Type; @@ -30,13 +31,13 @@ PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); #define PyMethod_GET_FUNCTION(meth) \ (((PyMethodObject *)meth) -> im_func) #define PyMethod_GET_SELF(meth) \ - (((PyMethodObject *)meth) -> im_self) + (((PyMethodObject *)meth) -> im_self) PyAPI_FUNC(int) PyMethod_ClearFreeList(void); typedef struct { - PyObject_HEAD - PyObject *func; + PyObject_HEAD + PyObject *func; } PyInstanceMethodObject; PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type; diff --git a/openflow/usr/include/python3.5m/code.h b/openflow/include/python3.8/code.h similarity index 51% rename from openflow/usr/include/python3.5m/code.h rename to openflow/include/python3.8/code.h index 8ecf38a..3afddd2 100644 --- a/openflow/usr/include/python3.5m/code.h +++ b/openflow/include/python3.8/code.h @@ -7,41 +7,72 @@ extern "C" { #endif +typedef uint16_t _Py_CODEUNIT; + +#ifdef WORDS_BIGENDIAN +# define _Py_OPCODE(word) ((word) >> 8) +# define _Py_OPARG(word) ((word) & 255) +#else +# define _Py_OPCODE(word) ((word) & 255) +# define _Py_OPARG(word) ((word) >> 8) +#endif + +typedef struct _PyOpcache _PyOpcache; + /* Bytecode object */ typedef struct { PyObject_HEAD - int co_argcount; /* #arguments, except *args */ - int co_kwonlyargcount; /* #keyword only arguments */ - int co_nlocals; /* #local variables */ - int co_stacksize; /* #entries needed for evaluation stack */ - int co_flags; /* CO_..., see below */ - PyObject *co_code; /* instruction opcodes */ - PyObject *co_consts; /* list (constants used) */ - PyObject *co_names; /* list of strings (names used) */ - PyObject *co_varnames; /* tuple of strings (local variable names) */ - PyObject *co_freevars; /* tuple of strings (free variable names) */ + int co_argcount; /* #arguments, except *args */ + int co_posonlyargcount; /* #positional only arguments */ + int co_kwonlyargcount; /* #keyword only arguments */ + int co_nlocals; /* #local variables */ + int co_stacksize; /* #entries needed for evaluation stack */ + int co_flags; /* CO_..., see below */ + int co_firstlineno; /* first source line number */ + PyObject *co_code; /* instruction opcodes */ + PyObject *co_consts; /* list (constants used) */ + PyObject *co_names; /* list of strings (names used) */ + PyObject *co_varnames; /* tuple of strings (local variable names) */ + PyObject *co_freevars; /* tuple of strings (free variable names) */ PyObject *co_cellvars; /* tuple of strings (cell variable names) */ - /* The rest aren't used in either hash or comparisons, except for - co_name (used in both) and co_firstlineno (used only in - comparisons). This is done to preserve the name and line number + /* The rest aren't used in either hash or comparisons, except for co_name, + used in both. This is done to preserve the name and line number for tracebacks and debuggers; otherwise, constant de-duplication would collapse identical functions/lambdas defined on different lines. */ - unsigned char *co_cell2arg; /* Maps cell vars which are arguments. */ - PyObject *co_filename; /* unicode (where it was loaded from) */ - PyObject *co_name; /* unicode (name, for reference) */ - int co_firstlineno; /* first source line number */ - PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See - Objects/lnotab_notes.txt for details. */ - void *co_zombieframe; /* for optimization only (see frameobject.c) */ + Py_ssize_t *co_cell2arg; /* Maps cell vars which are arguments. */ + PyObject *co_filename; /* unicode (where it was loaded from) */ + PyObject *co_name; /* unicode (name, for reference) */ + PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See + Objects/lnotab_notes.txt for details. */ + void *co_zombieframe; /* for optimization only (see frameobject.c) */ PyObject *co_weakreflist; /* to support weakrefs to code objects */ + /* Scratch space for extra data relating to the code object. + Type is a void* to keep the format private in codeobject.c to force + people to go through the proper APIs. */ + void *co_extra; + + /* Per opcodes just-in-time cache + * + * To reduce cache size, we use indirect mapping from opcode index to + * cache object: + * cache = co_opcache[co_opcache_map[next_instr - first_instr] - 1] + */ + + // co_opcache_map is indexed by (next_instr - first_instr). + // * 0 means there is no cache for this opcode. + // * n > 0 means there is cache in co_opcache[n-1]. + unsigned char *co_opcache_map; + _PyOpcache *co_opcache; + int co_opcache_flag; // used to determine when create a cache. + unsigned char co_opcache_size; // length of co_opcache. } PyCodeObject; /* Masks for co_flags above */ -#define CO_OPTIMIZED 0x0001 -#define CO_NEWLOCALS 0x0002 -#define CO_VARARGS 0x0004 -#define CO_VARKEYWORDS 0x0008 +#define CO_OPTIMIZED 0x0001 +#define CO_NEWLOCALS 0x0002 +#define CO_VARARGS 0x0004 +#define CO_VARKEYWORDS 0x0008 #define CO_NESTED 0x0010 #define CO_GENERATOR 0x0020 /* The CO_NOFREE flag is set if there are no free or cell variables. @@ -55,12 +86,13 @@ typedef struct { ``async def`` keywords) */ #define CO_COROUTINE 0x0080 #define CO_ITERABLE_COROUTINE 0x0100 +#define CO_ASYNC_GENERATOR 0x0200 /* These are no longer used. */ #if 0 #define CO_GENERATOR_ALLOWED 0x1000 #endif -#define CO_FUTURE_DIVISION 0x2000 +#define CO_FUTURE_DIVISION 0x2000 #define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */ #define CO_FUTURE_WITH_STATEMENT 0x8000 #define CO_FUTURE_PRINT_FUNCTION 0x10000 @@ -68,11 +100,11 @@ typedef struct { #define CO_FUTURE_BARRY_AS_BDFL 0x40000 #define CO_FUTURE_GENERATOR_STOP 0x80000 +#define CO_FUTURE_ANNOTATIONS 0x100000 /* This value is found in the co_cell2arg array when the associated cell - variable does not correspond to an argument. The maximum number of - arguments is 255 (indexed up to 254), so 255 work as a special flag.*/ -#define CO_CELL_NOT_AN_ARG 255 + variable does not correspond to an argument. */ +#define CO_CELL_NOT_AN_ARG (-1) /* This should be defined if a future statement modifies the syntax. For example, when a keyword is added. @@ -88,9 +120,14 @@ PyAPI_DATA(PyTypeObject) PyCode_Type; /* Public interface */ PyAPI_FUNC(PyCodeObject *) PyCode_New( - int, int, int, int, int, PyObject *, PyObject *, - PyObject *, PyObject *, PyObject *, PyObject *, - PyObject *, PyObject *, int, PyObject *); + int, int, int, int, int, PyObject *, PyObject *, + PyObject *, PyObject *, PyObject *, PyObject *, + PyObject *, PyObject *, int, PyObject *); + +PyAPI_FUNC(PyCodeObject *) PyCode_NewWithPosOnlyArgs( + int, int, int, int, int, int, PyObject *, PyObject *, + PyObject *, PyObject *, PyObject *, PyObject *, + PyObject *, PyObject *, int, PyObject *); /* same as struct above */ /* Creates a new empty code object with the specified source location. */ @@ -126,7 +163,15 @@ PyAPI_FUNC(PyObject*) _PyCode_ConstantKey(PyObject *obj); #endif PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts, - PyObject *names, PyObject *lineno_obj); + PyObject *names, PyObject *lnotab); + + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyCode_GetExtra(PyObject *code, Py_ssize_t index, + void **extra); +PyAPI_FUNC(int) _PyCode_SetExtra(PyObject *code, Py_ssize_t index, + void *extra); +#endif #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/codecs.h b/openflow/include/python3.8/codecs.h similarity index 98% rename from openflow/usr/include/python3.5m/codecs.h rename to openflow/include/python3.8/codecs.h index f8275a1..3ad0f2b 100644 --- a/openflow/usr/include/python3.5m/codecs.h +++ b/openflow/include/python3.8/codecs.h @@ -225,10 +225,14 @@ PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc); /* replace the unicode encode error with backslash escapes (\x, \u and \U) */ PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* replace the unicode encode error with backslash escapes (\N, \x, \u and \U) */ PyAPI_FUNC(PyObject *) PyCodec_NameReplaceErrors(PyObject *exc); +#endif +#ifndef Py_LIMITED_API PyAPI_DATA(const char *) Py_hexdigits; +#endif #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/compile.h b/openflow/include/python3.8/compile.h similarity index 64% rename from openflow/usr/include/python3.5m/compile.h rename to openflow/include/python3.8/compile.h index ecd8dc1..1cda955 100644 --- a/openflow/usr/include/python3.5m/compile.h +++ b/openflow/include/python3.8/compile.h @@ -11,6 +11,29 @@ extern "C" { /* Public interface */ struct _node; /* Declare the existence of this type */ PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *); +/* XXX (ncoghlan): Unprefixed type name in a public API! */ + +#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \ + CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \ + CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \ + CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS) +#define PyCF_MASK_OBSOLETE (CO_NESTED) +#define PyCF_SOURCE_IS_UTF8 0x0100 +#define PyCF_DONT_IMPLY_DEDENT 0x0200 +#define PyCF_ONLY_AST 0x0400 +#define PyCF_IGNORE_COOKIE 0x0800 +#define PyCF_TYPE_COMMENTS 0x1000 +#define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000 + +#ifndef Py_LIMITED_API +typedef struct { + int cf_flags; /* bitmask of CO_xxx flags relevant to future */ + int cf_feature_version; /* minor Python version (PyCF_ONLY_AST) */ +} PyCompilerFlags; + +#define _PyCompilerFlags_INIT \ + (PyCompilerFlags){.cf_flags = 0, .cf_feature_version = PY_MINOR_VERSION} +#endif /* Future feature support */ @@ -28,6 +51,7 @@ typedef struct { #define FUTURE_UNICODE_LITERALS "unicode_literals" #define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL" #define FUTURE_GENERATOR_STOP "generator_stop" +#define FUTURE_ANNOTATIONS "annotations" struct _mod; /* Declare the existence of this type */ #define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar) @@ -57,6 +81,9 @@ PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); #define PY_INVALID_STACK_EFFECT INT_MAX PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg); +PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump); + +PyAPI_FUNC(int) _PyAST_Optimize(struct _mod *, PyArena *arena, int optimize); #ifdef __cplusplus } @@ -64,10 +91,10 @@ PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg); #endif /* !Py_LIMITED_API */ -/* These definitions must match corresponding definitions in graminit.h. - There's code in compile.c that checks that they are the same. */ +/* These definitions must match corresponding definitions in graminit.h. */ #define Py_single_input 256 #define Py_file_input 257 #define Py_eval_input 258 +#define Py_func_type_input 345 #endif /* !Py_COMPILE_H */ diff --git a/openflow/usr/include/python3.5m/complexobject.h b/openflow/include/python3.8/complexobject.h similarity index 100% rename from openflow/usr/include/python3.5m/complexobject.h rename to openflow/include/python3.8/complexobject.h diff --git a/openflow/include/python3.8/context.h b/openflow/include/python3.8/context.h new file mode 100644 index 0000000..9581285 --- /dev/null +++ b/openflow/include/python3.8/context.h @@ -0,0 +1,84 @@ +#ifndef Py_CONTEXT_H +#define Py_CONTEXT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API + + +PyAPI_DATA(PyTypeObject) PyContext_Type; +typedef struct _pycontextobject PyContext; + +PyAPI_DATA(PyTypeObject) PyContextVar_Type; +typedef struct _pycontextvarobject PyContextVar; + +PyAPI_DATA(PyTypeObject) PyContextToken_Type; +typedef struct _pycontexttokenobject PyContextToken; + + +#define PyContext_CheckExact(o) (Py_TYPE(o) == &PyContext_Type) +#define PyContextVar_CheckExact(o) (Py_TYPE(o) == &PyContextVar_Type) +#define PyContextToken_CheckExact(o) (Py_TYPE(o) == &PyContextToken_Type) + + +PyAPI_FUNC(PyObject *) PyContext_New(void); +PyAPI_FUNC(PyObject *) PyContext_Copy(PyObject *); +PyAPI_FUNC(PyObject *) PyContext_CopyCurrent(void); + +PyAPI_FUNC(int) PyContext_Enter(PyObject *); +PyAPI_FUNC(int) PyContext_Exit(PyObject *); + + +/* Create a new context variable. + + default_value can be NULL. +*/ +PyAPI_FUNC(PyObject *) PyContextVar_New( + const char *name, PyObject *default_value); + + +/* Get a value for the variable. + + Returns -1 if an error occurred during lookup. + + Returns 0 if value either was or was not found. + + If value was found, *value will point to it. + If not, it will point to: + + - default_value, if not NULL; + - the default value of "var", if not NULL; + - NULL. + + '*value' will be a new ref, if not NULL. +*/ +PyAPI_FUNC(int) PyContextVar_Get( + PyObject *var, PyObject *default_value, PyObject **value); + + +/* Set a new value for the variable. + Returns NULL if an error occurs. +*/ +PyAPI_FUNC(PyObject *) PyContextVar_Set(PyObject *var, PyObject *value); + + +/* Reset a variable to its previous value. + Returns 0 on success, -1 on error. +*/ +PyAPI_FUNC(int) PyContextVar_Reset(PyObject *var, PyObject *token); + + +/* This method is exposed only for CPython tests. Don not use it. */ +PyAPI_FUNC(PyObject *) _PyContext_NewHamtForTests(void); + + +PyAPI_FUNC(int) PyContext_ClearFreeList(void); + + +#endif /* !Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CONTEXT_H */ diff --git a/openflow/include/python3.8/cpython/abstract.h b/openflow/include/python3.8/cpython/abstract.h new file mode 100644 index 0000000..2ea3209 --- /dev/null +++ b/openflow/include/python3.8/cpython/abstract.h @@ -0,0 +1,319 @@ +#ifndef Py_CPYTHON_ABSTRACTOBJECT_H +# error "this header file must not be included directly" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* === Object Protocol ================================================== */ + +#ifdef PY_SSIZE_T_CLEAN +# define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT +#endif + +/* Convert keyword arguments from the FASTCALL (stack: C array, kwnames: tuple) + format to a Python dictionary ("kwargs" dict). + + The type of kwnames keys is not checked. The final function getting + arguments is responsible to check if all keys are strings, for example using + PyArg_ParseTupleAndKeywords() or PyArg_ValidateKeywordArguments(). + + Duplicate keys are merged using the last value. If duplicate keys must raise + an exception, the caller is responsible to implement an explicit keys on + kwnames. */ +PyAPI_FUNC(PyObject *) _PyStack_AsDict( + PyObject *const *values, + PyObject *kwnames); + +/* Convert (args, nargs, kwargs: dict) into a (stack, nargs, kwnames: tuple). + + Return 0 on success, raise an exception and return -1 on error. + + Write the new stack into *p_stack. If *p_stack is differen than args, it + must be released by PyMem_Free(). + + The stack uses borrowed references. + + The type of keyword keys is not checked, these checks should be done + later (ex: _PyArg_ParseStackAndKeywords). */ +PyAPI_FUNC(int) _PyStack_UnpackDict( + PyObject *const *args, + Py_ssize_t nargs, + PyObject *kwargs, + PyObject *const **p_stack, + PyObject **p_kwnames); + +/* Suggested size (number of positional arguments) for arrays of PyObject* + allocated on a C stack to avoid allocating memory on the heap memory. Such + array is used to pass positional arguments to call functions of the + _PyObject_Vectorcall() family. + + The size is chosen to not abuse the C stack and so limit the risk of stack + overflow. The size is also chosen to allow using the small stack for most + function calls of the Python standard library. On 64-bit CPU, it allocates + 40 bytes on the stack. */ +#define _PY_FASTCALL_SMALL_STACK 5 + +PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable, + PyObject *result, + const char *where); + +/* === Vectorcall protocol (PEP 590) ============================= */ + +/* Call callable using tp_call. Arguments are like _PyObject_Vectorcall() + or _PyObject_FastCallDict() (both forms are supported), + except that nargs is plainly the number of arguments without flags. */ +PyAPI_FUNC(PyObject *) _PyObject_MakeTpCall( + PyObject *callable, + PyObject *const *args, Py_ssize_t nargs, + PyObject *keywords); + +#define PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + +static inline Py_ssize_t +PyVectorcall_NARGS(size_t n) +{ + return n & ~PY_VECTORCALL_ARGUMENTS_OFFSET; +} + +static inline vectorcallfunc +_PyVectorcall_Function(PyObject *callable) +{ + PyTypeObject *tp = Py_TYPE(callable); + Py_ssize_t offset = tp->tp_vectorcall_offset; + vectorcallfunc *ptr; + if (!PyType_HasFeature(tp, _Py_TPFLAGS_HAVE_VECTORCALL)) { + return NULL; + } + assert(PyCallable_Check(callable)); + assert(offset > 0); + ptr = (vectorcallfunc*)(((char *)callable) + offset); + return *ptr; +} + +/* Call the callable object 'callable' with the "vectorcall" calling + convention. + + args is a C array for positional arguments. + + nargsf is the number of positional arguments plus optionally the flag + PY_VECTORCALL_ARGUMENTS_OFFSET which means that the caller is allowed to + modify args[-1]. + + kwnames is a tuple of keyword names. The values of the keyword arguments + are stored in "args" after the positional arguments (note that the number + of keyword arguments does not change nargsf). kwnames can also be NULL if + there are no keyword arguments. + + keywords must only contains str strings (no subclass), and all keys must + be unique. + + Return the result on success. Raise an exception and return NULL on + error. */ +static inline PyObject * +_PyObject_Vectorcall(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames) +{ + PyObject *res; + vectorcallfunc func; + assert(kwnames == NULL || PyTuple_Check(kwnames)); + assert(args != NULL || PyVectorcall_NARGS(nargsf) == 0); + func = _PyVectorcall_Function(callable); + if (func == NULL) { + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + return _PyObject_MakeTpCall(callable, args, nargs, kwnames); + } + res = func(callable, args, nargsf, kwnames); + return _Py_CheckFunctionResult(callable, res, NULL); +} + +/* Same as _PyObject_Vectorcall except that keyword arguments are passed as + dict, which may be NULL if there are no keyword arguments. */ +PyAPI_FUNC(PyObject *) _PyObject_FastCallDict( + PyObject *callable, + PyObject *const *args, + size_t nargsf, + PyObject *kwargs); + +/* Call "callable" (which must support vectorcall) with positional arguments + "tuple" and keyword arguments "dict". "dict" may also be NULL */ +PyAPI_FUNC(PyObject *) PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *dict); + +/* Same as _PyObject_Vectorcall except without keyword arguments */ +static inline PyObject * +_PyObject_FastCall(PyObject *func, PyObject *const *args, Py_ssize_t nargs) +{ + return _PyObject_Vectorcall(func, args, (size_t)nargs, NULL); +} + +/* Call a callable without any arguments */ +static inline PyObject * +_PyObject_CallNoArg(PyObject *func) { + return _PyObject_Vectorcall(func, NULL, 0, NULL); +} + +PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend( + PyObject *callable, + PyObject *obj, + PyObject *args, + PyObject *kwargs); + +PyAPI_FUNC(PyObject *) _PyObject_FastCall_Prepend( + PyObject *callable, + PyObject *obj, + PyObject *const *args, + Py_ssize_t nargs); + +/* Like PyObject_CallMethod(), but expect a _Py_Identifier* + as the method name. */ +PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj, + _Py_Identifier *name, + const char *format, ...); + +PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *obj, + _Py_Identifier *name, + const char *format, + ...); + +PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs( + PyObject *obj, + struct _Py_Identifier *name, + ...); + +PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o); + +/* Guess the size of object 'o' using len(o) or o.__length_hint__(). + If neither of those return a non-negative value, then return the default + value. If one of the calls fails, this function returns -1. */ +PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t); + +/* === New Buffer API ============================================ */ + +/* Return 1 if the getbuffer function is available, otherwise return 0. */ +#define PyObject_CheckBuffer(obj) \ + (((obj)->ob_type->tp_as_buffer != NULL) && \ + ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL)) + +/* This is a C-API version of the getbuffer function call. It checks + to make sure object has the required function pointer and issues the + call. + + Returns -1 and raises an error on failure and returns 0 on success. */ +PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view, + int flags); + +/* Get the memory area pointed to by the indices for the buffer given. + Note that view->ndim is the assumed size of indices. */ +PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices); + +/* Return the implied itemsize of the data-format area from a + struct-style description. */ +PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *); + +/* Implementation in memoryobject.c */ +PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view, + Py_ssize_t len, char order); + +PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf, + Py_ssize_t len, char order); + +/* Copy len bytes of data from the contiguous chunk of memory + pointed to by buf into the buffer exported by obj. Return + 0 on success and return -1 and raise a PyBuffer_Error on + error (i.e. the object does not have a buffer interface or + it is not working). + + If fort is 'F', then if the object is multi-dimensional, + then the data will be copied into the array in + Fortran-style (first dimension varies the fastest). If + fort is 'C', then the data will be copied into the array + in C-style (last dimension varies the fastest). If fort + is 'A', then it does not matter and the copy will be made + in whatever way is more efficient. */ +PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src); + +/* Copy the data from the src buffer to the buffer of destination. */ +PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer *view, char fort); + +/*Fill the strides array with byte-strides of a contiguous + (Fortran-style if fort is 'F' or C-style otherwise) + array of the given shape with the given number of bytes + per element. */ +PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims, + Py_ssize_t *shape, + Py_ssize_t *strides, + int itemsize, + char fort); + +/* Fills in a buffer-info structure correctly for an exporter + that can only share a contiguous chunk of memory of + "unsigned bytes" of the given length. + + Returns 0 on success and -1 (with raising an error) on error. */ +PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf, + Py_ssize_t len, int readonly, + int flags); + +/* Releases a Py_buffer obtained from getbuffer ParseTuple's "s*". */ +PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view); + +/* ==== Iterators ================================================ */ + +#define PyIter_Check(obj) \ + ((obj)->ob_type->tp_iternext != NULL && \ + (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) + +/* === Number Protocol ================================================== */ + +#define PyIndex_Check(obj) \ + ((obj)->ob_type->tp_as_number != NULL && \ + (obj)->ob_type->tp_as_number->nb_index != NULL) + +/* === Sequence protocol ================================================ */ + +/* Assume tp_as_sequence and sq_item exist and that 'i' does not + need to be corrected for a negative index. */ +#define PySequence_ITEM(o, i)\ + ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) ) + +#define PY_ITERSEARCH_COUNT 1 +#define PY_ITERSEARCH_INDEX 2 +#define PY_ITERSEARCH_CONTAINS 3 + +/* Iterate over seq. + + Result depends on the operation: + + PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if + error. + PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of + obj in seq; set ValueError and return -1 if none found; + also return -1 on error. + PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on + error. */ +PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq, + PyObject *obj, int operation); + +/* === Mapping protocol ================================================= */ + +PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls); + +PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls); + +PyAPI_FUNC(char *const *) _PySequence_BytesToCharpArray(PyObject* self); + +PyAPI_FUNC(void) _Py_FreeCharPArray(char *const array[]); + +/* For internal use by buffer API functions */ +PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index, + const Py_ssize_t *shape); +PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index, + const Py_ssize_t *shape); + +/* Convert Python int to Py_ssize_t. Do nothing if the argument is None. */ +PyAPI_FUNC(int) _Py_convert_optional_to_ssize_t(PyObject *, void *); + +#ifdef __cplusplus +} +#endif diff --git a/openflow/include/python3.8/cpython/dictobject.h b/openflow/include/python3.8/cpython/dictobject.h new file mode 100644 index 0000000..64c012a --- /dev/null +++ b/openflow/include/python3.8/cpython/dictobject.h @@ -0,0 +1,94 @@ +#ifndef Py_CPYTHON_DICTOBJECT_H +# error "this header file must not be included directly" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _dictkeysobject PyDictKeysObject; + +/* The ma_values pointer is NULL for a combined table + * or points to an array of PyObject* for a split table + */ +typedef struct { + PyObject_HEAD + + /* Number of items in the dictionary */ + Py_ssize_t ma_used; + + /* Dictionary version: globally unique, value change each time + the dictionary is modified */ + uint64_t ma_version_tag; + + PyDictKeysObject *ma_keys; + + /* If ma_values is NULL, the table is "combined": keys and values + are stored in ma_keys. + + If ma_values is not NULL, the table is splitted: + keys are stored in ma_keys and values are stored in ma_values */ + PyObject **ma_values; +} PyDictObject; + +PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key, + Py_hash_t hash); +PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp, + struct _Py_Identifier *key); +PyAPI_FUNC(PyObject *) _PyDict_GetItemStringWithError(PyObject *, const char *); +PyAPI_FUNC(PyObject *) PyDict_SetDefault( + PyObject *mp, PyObject *key, PyObject *defaultobj); +PyAPI_FUNC(int) _PyDict_SetItem_KnownHash(PyObject *mp, PyObject *key, + PyObject *item, Py_hash_t hash); +PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key, + Py_hash_t hash); +PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key, + int (*predicate)(PyObject *value)); +PyDictKeysObject *_PyDict_NewKeysForClass(void); +PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *); +PyAPI_FUNC(int) _PyDict_Next( + PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash); + +/* Get the number of items of a dictionary. */ +#define PyDict_GET_SIZE(mp) (assert(PyDict_Check(mp)),((PyDictObject *)mp)->ma_used) +PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash); +PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused); +PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp); +PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp); +Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys); +PyAPI_FUNC(Py_ssize_t) _PyDict_SizeOf(PyDictObject *); +PyAPI_FUNC(PyObject *) _PyDict_Pop(PyObject *, PyObject *, PyObject *); +PyObject *_PyDict_Pop_KnownHash(PyObject *, PyObject *, Py_hash_t, PyObject *); +PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *); +#define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL) + +PyAPI_FUNC(int) PyDict_ClearFreeList(void); + +/* Like PyDict_Merge, but override can be 0, 1 or 2. If override is 0, + the first occurrence of a key wins, if override is 1, the last occurrence + of a key wins, if override is 2, a KeyError with conflicting key as + argument is raised. +*/ +PyAPI_FUNC(int) _PyDict_MergeEx(PyObject *mp, PyObject *other, int override); +PyAPI_FUNC(PyObject *) _PyDict_GetItemId(PyObject *dp, struct _Py_Identifier *key); +PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, struct _Py_Identifier *key, PyObject *item); + +PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, struct _Py_Identifier *key); +PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out); + +int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value); +PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *); + +/* _PyDictView */ + +typedef struct { + PyObject_HEAD + PyDictObject *dv_dict; +} _PyDictViewObject; + +PyAPI_FUNC(PyObject *) _PyDictView_New(PyObject *, PyTypeObject *); +PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other); + +#ifdef __cplusplus +} +#endif diff --git a/openflow/include/python3.8/cpython/fileobject.h b/openflow/include/python3.8/cpython/fileobject.h new file mode 100644 index 0000000..57eac13 --- /dev/null +++ b/openflow/include/python3.8/cpython/fileobject.h @@ -0,0 +1,32 @@ +#ifndef Py_CPYTHON_FILEOBJECT_H +# error "this header file must not be included directly" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 +PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors; +#endif + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 +PyAPI_DATA(int) Py_UTF8Mode; +#endif + +/* The std printer acts as a preliminary sys.stderr until the new io + infrastructure is in place. */ +PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int); +PyAPI_DATA(PyTypeObject) PyStdPrinter_Type; + +typedef PyObject * (*Py_OpenCodeHookFunction)(PyObject *, void *); + +PyAPI_FUNC(PyObject *) PyFile_OpenCode(const char *utf8path); +PyAPI_FUNC(PyObject *) PyFile_OpenCodeObject(PyObject *path); +PyAPI_FUNC(int) PyFile_SetOpenCodeHook(Py_OpenCodeHookFunction hook, void *userData); + +#ifdef __cplusplus +} +#endif diff --git a/openflow/include/python3.8/cpython/initconfig.h b/openflow/include/python3.8/cpython/initconfig.h new file mode 100644 index 0000000..4b5ceaf --- /dev/null +++ b/openflow/include/python3.8/cpython/initconfig.h @@ -0,0 +1,434 @@ +#ifndef Py_PYCORECONFIG_H +#define Py_PYCORECONFIG_H +#ifndef Py_LIMITED_API +#ifdef __cplusplus +extern "C" { +#endif + +/* --- PyStatus ----------------------------------------------- */ + +typedef struct { + enum { + _PyStatus_TYPE_OK=0, + _PyStatus_TYPE_ERROR=1, + _PyStatus_TYPE_EXIT=2 + } _type; + const char *func; + const char *err_msg; + int exitcode; +} PyStatus; + +PyAPI_FUNC(PyStatus) PyStatus_Ok(void); +PyAPI_FUNC(PyStatus) PyStatus_Error(const char *err_msg); +PyAPI_FUNC(PyStatus) PyStatus_NoMemory(void); +PyAPI_FUNC(PyStatus) PyStatus_Exit(int exitcode); +PyAPI_FUNC(int) PyStatus_IsError(PyStatus err); +PyAPI_FUNC(int) PyStatus_IsExit(PyStatus err); +PyAPI_FUNC(int) PyStatus_Exception(PyStatus err); + +/* --- PyWideStringList ------------------------------------------------ */ + +typedef struct { + /* If length is greater than zero, items must be non-NULL + and all items strings must be non-NULL */ + Py_ssize_t length; + wchar_t **items; +} PyWideStringList; + +PyAPI_FUNC(PyStatus) PyWideStringList_Append(PyWideStringList *list, + const wchar_t *item); +PyAPI_FUNC(PyStatus) PyWideStringList_Insert(PyWideStringList *list, + Py_ssize_t index, + const wchar_t *item); + + +/* --- PyPreConfig ----------------------------------------------- */ + +typedef struct { + int _config_init; /* _PyConfigInitEnum value */ + + /* Parse Py_PreInitializeFromBytesArgs() arguments? + See PyConfig.parse_argv */ + int parse_argv; + + /* If greater than 0, enable isolated mode: sys.path contains + neither the script's directory nor the user's site-packages directory. + + Set to 1 by the -I command line option. If set to -1 (default), inherit + Py_IsolatedFlag value. */ + int isolated; + + /* If greater than 0: use environment variables. + Set to 0 by -E command line option. If set to -1 (default), it is + set to !Py_IgnoreEnvironmentFlag. */ + int use_environment; + + /* Set the LC_CTYPE locale to the user preferred locale? If equals to 0, + set coerce_c_locale and coerce_c_locale_warn to 0. */ + int configure_locale; + + /* Coerce the LC_CTYPE locale if it's equal to "C"? (PEP 538) + + Set to 0 by PYTHONCOERCECLOCALE=0. Set to 1 by PYTHONCOERCECLOCALE=1. + Set to 2 if the user preferred LC_CTYPE locale is "C". + + If it is equal to 1, LC_CTYPE locale is read to decide if it should be + coerced or not (ex: PYTHONCOERCECLOCALE=1). Internally, it is set to 2 + if the LC_CTYPE locale must be coerced. + + Disable by default (set to 0). Set it to -1 to let Python decide if it + should be enabled or not. */ + int coerce_c_locale; + + /* Emit a warning if the LC_CTYPE locale is coerced? + + Set to 1 by PYTHONCOERCECLOCALE=warn. + + Disable by default (set to 0). Set it to -1 to let Python decide if it + should be enabled or not. */ + int coerce_c_locale_warn; + +#ifdef MS_WINDOWS + /* If greater than 1, use the "mbcs" encoding instead of the UTF-8 + encoding for the filesystem encoding. + + Set to 1 if the PYTHONLEGACYWINDOWSFSENCODING environment variable is + set to a non-empty string. If set to -1 (default), inherit + Py_LegacyWindowsFSEncodingFlag value. + + See PEP 529 for more details. */ + int legacy_windows_fs_encoding; +#endif + + /* Enable UTF-8 mode? (PEP 540) + + Disabled by default (equals to 0). + + Set to 1 by "-X utf8" and "-X utf8=1" command line options. + Set to 1 by PYTHONUTF8=1 environment variable. + + Set to 0 by "-X utf8=0" and PYTHONUTF8=0. + + If equals to -1, it is set to 1 if the LC_CTYPE locale is "C" or + "POSIX", otherwise it is set to 0. Inherit Py_UTF8Mode value value. */ + int utf8_mode; + + int dev_mode; /* Development mode. PYTHONDEVMODE, -X dev */ + + /* Memory allocator: PYTHONMALLOC env var. + See PyMemAllocatorName for valid values. */ + int allocator; +} PyPreConfig; + +PyAPI_FUNC(void) PyPreConfig_InitPythonConfig(PyPreConfig *config); +PyAPI_FUNC(void) PyPreConfig_InitIsolatedConfig(PyPreConfig *config); + + +/* --- PyConfig ---------------------------------------------- */ + +typedef struct { + int _config_init; /* _PyConfigInitEnum value */ + + int isolated; /* Isolated mode? see PyPreConfig.isolated */ + int use_environment; /* Use environment variables? see PyPreConfig.use_environment */ + int dev_mode; /* Development mode? See PyPreConfig.dev_mode */ + + /* Install signal handlers? Yes by default. */ + int install_signal_handlers; + + int use_hash_seed; /* PYTHONHASHSEED=x */ + unsigned long hash_seed; + + /* Enable faulthandler? + Set to 1 by -X faulthandler and PYTHONFAULTHANDLER. -1 means unset. */ + int faulthandler; + + /* Enable tracemalloc? + Set by -X tracemalloc=N and PYTHONTRACEMALLOC. -1 means unset */ + int tracemalloc; + + int import_time; /* PYTHONPROFILEIMPORTTIME, -X importtime */ + int show_ref_count; /* -X showrefcount */ + int show_alloc_count; /* -X showalloccount */ + int dump_refs; /* PYTHONDUMPREFS */ + int malloc_stats; /* PYTHONMALLOCSTATS */ + + /* Python filesystem encoding and error handler: + sys.getfilesystemencoding() and sys.getfilesystemencodeerrors(). + + Default encoding and error handler: + + * if Py_SetStandardStreamEncoding() has been called: they have the + highest priority; + * PYTHONIOENCODING environment variable; + * The UTF-8 Mode uses UTF-8/surrogateescape; + * If Python forces the usage of the ASCII encoding (ex: C locale + or POSIX locale on FreeBSD or HP-UX), use ASCII/surrogateescape; + * locale encoding: ANSI code page on Windows, UTF-8 on Android and + VxWorks, LC_CTYPE locale encoding on other platforms; + * On Windows, "surrogateescape" error handler; + * "surrogateescape" error handler if the LC_CTYPE locale is "C" or "POSIX"; + * "surrogateescape" error handler if the LC_CTYPE locale has been coerced + (PEP 538); + * "strict" error handler. + + Supported error handlers: "strict", "surrogateescape" and + "surrogatepass". The surrogatepass error handler is only supported + if Py_DecodeLocale() and Py_EncodeLocale() use directly the UTF-8 codec; + it's only used on Windows. + + initfsencoding() updates the encoding to the Python codec name. + For example, "ANSI_X3.4-1968" is replaced with "ascii". + + On Windows, sys._enablelegacywindowsfsencoding() sets the + encoding/errors to mbcs/replace at runtime. + + + See Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors. + */ + wchar_t *filesystem_encoding; + wchar_t *filesystem_errors; + + wchar_t *pycache_prefix; /* PYTHONPYCACHEPREFIX, -X pycache_prefix=PATH */ + int parse_argv; /* Parse argv command line arguments? */ + + /* Command line arguments (sys.argv). + + Set parse_argv to 1 to parse argv as Python command line arguments + and then strip Python arguments from argv. + + If argv is empty, an empty string is added to ensure that sys.argv + always exists and is never empty. */ + PyWideStringList argv; + + /* Program name: + + - If Py_SetProgramName() was called, use its value. + - On macOS, use PYTHONEXECUTABLE environment variable if set. + - If WITH_NEXT_FRAMEWORK macro is defined, use __PYVENV_LAUNCHER__ + environment variable is set. + - Use argv[0] if available and non-empty. + - Use "python" on Windows, or "python3 on other platforms. */ + wchar_t *program_name; + + PyWideStringList xoptions; /* Command line -X options */ + + /* Warnings options: lowest to highest priority. warnings.filters + is built in the reverse order (highest to lowest priority). */ + PyWideStringList warnoptions; + + /* If equal to zero, disable the import of the module site and the + site-dependent manipulations of sys.path that it entails. Also disable + these manipulations if site is explicitly imported later (call + site.main() if you want them to be triggered). + + Set to 0 by the -S command line option. If set to -1 (default), it is + set to !Py_NoSiteFlag. */ + int site_import; + + /* Bytes warnings: + + * If equal to 1, issue a warning when comparing bytes or bytearray with + str or bytes with int. + * If equal or greater to 2, issue an error. + + Incremented by the -b command line option. If set to -1 (default), inherit + Py_BytesWarningFlag value. */ + int bytes_warning; + + /* If greater than 0, enable inspect: when a script is passed as first + argument or the -c option is used, enter interactive mode after + executing the script or the command, even when sys.stdin does not appear + to be a terminal. + + Incremented by the -i command line option. Set to 1 if the PYTHONINSPECT + environment variable is non-empty. If set to -1 (default), inherit + Py_InspectFlag value. */ + int inspect; + + /* If greater than 0: enable the interactive mode (REPL). + + Incremented by the -i command line option. If set to -1 (default), + inherit Py_InteractiveFlag value. */ + int interactive; + + /* Optimization level. + + Incremented by the -O command line option. Set by the PYTHONOPTIMIZE + environment variable. If set to -1 (default), inherit Py_OptimizeFlag + value. */ + int optimization_level; + + /* If greater than 0, enable the debug mode: turn on parser debugging + output (for expert only, depending on compilation options). + + Incremented by the -d command line option. Set by the PYTHONDEBUG + environment variable. If set to -1 (default), inherit Py_DebugFlag + value. */ + int parser_debug; + + /* If equal to 0, Python won't try to write ``.pyc`` files on the + import of source modules. + + Set to 0 by the -B command line option and the PYTHONDONTWRITEBYTECODE + environment variable. If set to -1 (default), it is set to + !Py_DontWriteBytecodeFlag. */ + int write_bytecode; + + /* If greater than 0, enable the verbose mode: print a message each time a + module is initialized, showing the place (filename or built-in module) + from which it is loaded. + + If greater or equal to 2, print a message for each file that is checked + for when searching for a module. Also provides information on module + cleanup at exit. + + Incremented by the -v option. Set by the PYTHONVERBOSE environment + variable. If set to -1 (default), inherit Py_VerboseFlag value. */ + int verbose; + + /* If greater than 0, enable the quiet mode: Don't display the copyright + and version messages even in interactive mode. + + Incremented by the -q option. If set to -1 (default), inherit + Py_QuietFlag value. */ + int quiet; + + /* If greater than 0, don't add the user site-packages directory to + sys.path. + + Set to 0 by the -s and -I command line options , and the PYTHONNOUSERSITE + environment variable. If set to -1 (default), it is set to + !Py_NoUserSiteDirectory. */ + int user_site_directory; + + /* If non-zero, configure C standard steams (stdio, stdout, + stderr): + + - Set O_BINARY mode on Windows. + - If buffered_stdio is equal to zero, make streams unbuffered. + Otherwise, enable streams buffering if interactive is non-zero. */ + int configure_c_stdio; + + /* If equal to 0, enable unbuffered mode: force the stdout and stderr + streams to be unbuffered. + + Set to 0 by the -u option. Set by the PYTHONUNBUFFERED environment + variable. + If set to -1 (default), it is set to !Py_UnbufferedStdioFlag. */ + int buffered_stdio; + + /* Encoding of sys.stdin, sys.stdout and sys.stderr. + Value set from PYTHONIOENCODING environment variable and + Py_SetStandardStreamEncoding() function. + See also 'stdio_errors' attribute. */ + wchar_t *stdio_encoding; + + /* Error handler of sys.stdin and sys.stdout. + Value set from PYTHONIOENCODING environment variable and + Py_SetStandardStreamEncoding() function. + See also 'stdio_encoding' attribute. */ + wchar_t *stdio_errors; + +#ifdef MS_WINDOWS + /* If greater than zero, use io.FileIO instead of WindowsConsoleIO for sys + standard streams. + + Set to 1 if the PYTHONLEGACYWINDOWSSTDIO environment variable is set to + a non-empty string. If set to -1 (default), inherit + Py_LegacyWindowsStdioFlag value. + + See PEP 528 for more details. */ + int legacy_windows_stdio; +#endif + + /* Value of the --check-hash-based-pycs command line option: + + - "default" means the 'check_source' flag in hash-based pycs + determines invalidation + - "always" causes the interpreter to hash the source file for + invalidation regardless of value of 'check_source' bit + - "never" causes the interpreter to always assume hash-based pycs are + valid + + The default value is "default". + + See PEP 552 "Deterministic pycs" for more details. */ + wchar_t *check_hash_pycs_mode; + + /* --- Path configuration inputs ------------ */ + + /* If greater than 0, suppress _PyPathConfig_Calculate() warnings on Unix. + The parameter has no effect on Windows. + + If set to -1 (default), inherit !Py_FrozenFlag value. */ + int pathconfig_warnings; + + wchar_t *pythonpath_env; /* PYTHONPATH environment variable */ + wchar_t *home; /* PYTHONHOME environment variable, + see also Py_SetPythonHome(). */ + + /* --- Path configuration outputs ----------- */ + + int module_search_paths_set; /* If non-zero, use module_search_paths */ + PyWideStringList module_search_paths; /* sys.path paths. Computed if + module_search_paths_set is equal + to zero. */ + + wchar_t *executable; /* sys.executable */ + wchar_t *base_executable; /* sys._base_executable */ + wchar_t *prefix; /* sys.prefix */ + wchar_t *base_prefix; /* sys.base_prefix */ + wchar_t *exec_prefix; /* sys.exec_prefix */ + wchar_t *base_exec_prefix; /* sys.base_exec_prefix */ + + /* --- Parameter only used by Py_Main() ---------- */ + + /* Skip the first line of the source ('run_filename' parameter), allowing use of non-Unix forms of + "#!cmd". This is intended for a DOS specific hack only. + + Set by the -x command line option. */ + int skip_source_first_line; + + wchar_t *run_command; /* -c command line argument */ + wchar_t *run_module; /* -m command line argument */ + wchar_t *run_filename; /* Trailing command line argument without -c or -m */ + + /* --- Private fields ---------------------------- */ + + /* Install importlib? If set to 0, importlib is not initialized at all. + Needed by freeze_importlib. */ + int _install_importlib; + + /* If equal to 0, stop Python initialization before the "main" phase */ + int _init_main; +} PyConfig; + +PyAPI_FUNC(void) PyConfig_InitPythonConfig(PyConfig *config); +PyAPI_FUNC(void) PyConfig_InitIsolatedConfig(PyConfig *config); +PyAPI_FUNC(void) PyConfig_Clear(PyConfig *); +PyAPI_FUNC(PyStatus) PyConfig_SetString( + PyConfig *config, + wchar_t **config_str, + const wchar_t *str); +PyAPI_FUNC(PyStatus) PyConfig_SetBytesString( + PyConfig *config, + wchar_t **config_str, + const char *str); +PyAPI_FUNC(PyStatus) PyConfig_Read(PyConfig *config); +PyAPI_FUNC(PyStatus) PyConfig_SetBytesArgv( + PyConfig *config, + Py_ssize_t argc, + char * const *argv); +PyAPI_FUNC(PyStatus) PyConfig_SetArgv(PyConfig *config, + Py_ssize_t argc, + wchar_t * const *argv); +PyAPI_FUNC(PyStatus) PyConfig_SetWideStringList(PyConfig *config, + PyWideStringList *list, + Py_ssize_t length, wchar_t **items); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_LIMITED_API */ +#endif /* !Py_PYCORECONFIG_H */ diff --git a/openflow/include/python3.8/cpython/interpreteridobject.h b/openflow/include/python3.8/cpython/interpreteridobject.h new file mode 100644 index 0000000..67ec587 --- /dev/null +++ b/openflow/include/python3.8/cpython/interpreteridobject.h @@ -0,0 +1,19 @@ +#ifndef Py_CPYTHON_INTERPRETERIDOBJECT_H +# error "this header file must not be included directly" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Interpreter ID Object */ + +PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type; + +PyAPI_FUNC(PyObject *) _PyInterpreterID_New(int64_t); +PyAPI_FUNC(PyObject *) _PyInterpreterState_GetIDObject(PyInterpreterState *); +PyAPI_FUNC(PyInterpreterState *) _PyInterpreterID_LookUp(PyObject *); + +#ifdef __cplusplus +} +#endif diff --git a/openflow/include/python3.8/cpython/object.h b/openflow/include/python3.8/cpython/object.h new file mode 100644 index 0000000..5a0ac4a --- /dev/null +++ b/openflow/include/python3.8/cpython/object.h @@ -0,0 +1,470 @@ +#ifndef Py_CPYTHON_OBJECT_H +# error "this header file must not be included directly" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* String Literals ****************************************/ +/* This structure helps managing static strings. The basic usage goes like this: + Instead of doing + + r = PyObject_CallMethod(o, "foo", "args", ...); + + do + + _Py_IDENTIFIER(foo); + ... + r = _PyObject_CallMethodId(o, &PyId_foo, "args", ...); + + PyId_foo is a static variable, either on block level or file level. On first + usage, the string "foo" is interned, and the structures are linked. On interpreter + shutdown, all strings are released (through _PyUnicode_ClearStaticStrings). + + Alternatively, _Py_static_string allows choosing the variable name. + _PyUnicode_FromId returns a borrowed reference to the interned string. + _PyObject_{Get,Set,Has}AttrId are __getattr__ versions using _Py_Identifier*. +*/ +typedef struct _Py_Identifier { + struct _Py_Identifier *next; + const char* string; + PyObject *object; +} _Py_Identifier; + +#define _Py_static_string_init(value) { .next = NULL, .string = value, .object = NULL } +#define _Py_static_string(varname, value) static _Py_Identifier varname = _Py_static_string_init(value) +#define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname) + +/* buffer interface */ +typedef struct bufferinfo { + void *buf; + PyObject *obj; /* owned reference */ + Py_ssize_t len; + Py_ssize_t itemsize; /* This is Py_ssize_t so it can be + pointed to by strides in simple case.*/ + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; +} Py_buffer; + +typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); +typedef void (*releasebufferproc)(PyObject *, Py_buffer *); + +typedef PyObject *(*vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + +/* Maximum number of dimensions */ +#define PyBUF_MAX_NDIM 64 + +/* Flags for getting buffers */ +#define PyBUF_SIMPLE 0 +#define PyBUF_WRITABLE 0x0001 +/* we used to include an E, backwards compatible alias */ +#define PyBUF_WRITEABLE PyBUF_WRITABLE +#define PyBUF_FORMAT 0x0004 +#define PyBUF_ND 0x0008 +#define PyBUF_STRIDES (0x0010 | PyBUF_ND) +#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) +#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) +#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) +#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE) +#define PyBUF_CONTIG_RO (PyBUF_ND) + +#define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE) +#define PyBUF_STRIDED_RO (PyBUF_STRIDES) + +#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT) +#define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT) + +#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT) +#define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT) + + +#define PyBUF_READ 0x100 +#define PyBUF_WRITE 0x200 +/* End buffer interface */ + + +typedef struct { + /* Number implementations must check *both* + arguments for proper type and implement the necessary conversions + in the slot functions themselves. */ + + binaryfunc nb_add; + binaryfunc nb_subtract; + binaryfunc nb_multiply; + binaryfunc nb_remainder; + binaryfunc nb_divmod; + ternaryfunc nb_power; + unaryfunc nb_negative; + unaryfunc nb_positive; + unaryfunc nb_absolute; + inquiry nb_bool; + unaryfunc nb_invert; + binaryfunc nb_lshift; + binaryfunc nb_rshift; + binaryfunc nb_and; + binaryfunc nb_xor; + binaryfunc nb_or; + unaryfunc nb_int; + void *nb_reserved; /* the slot formerly known as nb_long */ + unaryfunc nb_float; + + binaryfunc nb_inplace_add; + binaryfunc nb_inplace_subtract; + binaryfunc nb_inplace_multiply; + binaryfunc nb_inplace_remainder; + ternaryfunc nb_inplace_power; + binaryfunc nb_inplace_lshift; + binaryfunc nb_inplace_rshift; + binaryfunc nb_inplace_and; + binaryfunc nb_inplace_xor; + binaryfunc nb_inplace_or; + + binaryfunc nb_floor_divide; + binaryfunc nb_true_divide; + binaryfunc nb_inplace_floor_divide; + binaryfunc nb_inplace_true_divide; + + unaryfunc nb_index; + + binaryfunc nb_matrix_multiply; + binaryfunc nb_inplace_matrix_multiply; +} PyNumberMethods; + +typedef struct { + lenfunc sq_length; + binaryfunc sq_concat; + ssizeargfunc sq_repeat; + ssizeargfunc sq_item; + void *was_sq_slice; + ssizeobjargproc sq_ass_item; + void *was_sq_ass_slice; + objobjproc sq_contains; + + binaryfunc sq_inplace_concat; + ssizeargfunc sq_inplace_repeat; +} PySequenceMethods; + +typedef struct { + lenfunc mp_length; + binaryfunc mp_subscript; + objobjargproc mp_ass_subscript; +} PyMappingMethods; + +typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; +} PyAsyncMethods; + +typedef struct { + getbufferproc bf_getbuffer; + releasebufferproc bf_releasebuffer; +} PyBufferProcs; + +/* Allow printfunc in the tp_vectorcall_offset slot for + * backwards-compatibility */ +typedef Py_ssize_t printfunc; + +typedef struct _typeobject { + PyObject_VAR_HEAD + const char *tp_name; /* For printing, in format "." */ + Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ + + /* Methods to implement standard operations */ + + destructor tp_dealloc; + Py_ssize_t tp_vectorcall_offset; + getattrfunc tp_getattr; + setattrfunc tp_setattr; + PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2) + or tp_reserved (Python 3) */ + reprfunc tp_repr; + + /* Method suites for standard classes */ + + PyNumberMethods *tp_as_number; + PySequenceMethods *tp_as_sequence; + PyMappingMethods *tp_as_mapping; + + /* More standard operations (here for binary compatibility) */ + + hashfunc tp_hash; + ternaryfunc tp_call; + reprfunc tp_str; + getattrofunc tp_getattro; + setattrofunc tp_setattro; + + /* Functions to access object as input/output buffer */ + PyBufferProcs *tp_as_buffer; + + /* Flags to define presence of optional/expanded features */ + unsigned long tp_flags; + + const char *tp_doc; /* Documentation string */ + + /* Assigned meaning in release 2.0 */ + /* call function for all accessible objects */ + traverseproc tp_traverse; + + /* delete references to contained objects */ + inquiry tp_clear; + + /* Assigned meaning in release 2.1 */ + /* rich comparisons */ + richcmpfunc tp_richcompare; + + /* weak reference enabler */ + Py_ssize_t tp_weaklistoffset; + + /* Iterators */ + getiterfunc tp_iter; + iternextfunc tp_iternext; + + /* Attribute descriptor and subclassing stuff */ + struct PyMethodDef *tp_methods; + struct PyMemberDef *tp_members; + struct PyGetSetDef *tp_getset; + struct _typeobject *tp_base; + PyObject *tp_dict; + descrgetfunc tp_descr_get; + descrsetfunc tp_descr_set; + Py_ssize_t tp_dictoffset; + initproc tp_init; + allocfunc tp_alloc; + newfunc tp_new; + freefunc tp_free; /* Low-level free-memory routine */ + inquiry tp_is_gc; /* For PyObject_IS_GC */ + PyObject *tp_bases; + PyObject *tp_mro; /* method resolution order */ + PyObject *tp_cache; + PyObject *tp_subclasses; + PyObject *tp_weaklist; + destructor tp_del; + + /* Type attribute cache version tag. Added in version 2.6 */ + unsigned int tp_version_tag; + + destructor tp_finalize; + vectorcallfunc tp_vectorcall; + + /* bpo-37250: kept for backwards compatibility in CPython 3.8 only */ + Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int); + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + Py_ssize_t tp_allocs; + Py_ssize_t tp_frees; + Py_ssize_t tp_maxalloc; + struct _typeobject *tp_prev; + struct _typeobject *tp_next; +#endif +} PyTypeObject; + +/* The *real* layout of a type object when allocated on the heap */ +typedef struct _heaptypeobject { + /* Note: there's a dependency on the order of these members + in slotptr() in typeobject.c . */ + PyTypeObject ht_type; + PyAsyncMethods as_async; + PyNumberMethods as_number; + PyMappingMethods as_mapping; + PySequenceMethods as_sequence; /* as_sequence comes after as_mapping, + so that the mapping wins when both + the mapping and the sequence define + a given operator (e.g. __getitem__). + see add_operators() in typeobject.c . */ + PyBufferProcs as_buffer; + PyObject *ht_name, *ht_slots, *ht_qualname; + struct _dictkeysobject *ht_cached_keys; + /* here are optional user slots, followed by the members. */ +} PyHeapTypeObject; + +/* access macro to the members which are floating "behind" the object */ +#define PyHeapType_GET_MEMBERS(etype) \ + ((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize)) + +PyAPI_FUNC(const char *) _PyType_Name(PyTypeObject *); +PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyType_LookupId(PyTypeObject *, _Py_Identifier *); +PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, _Py_Identifier *); +PyAPI_FUNC(PyTypeObject *) _PyType_CalculateMetaclass(PyTypeObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyType_GetDocFromInternalDoc(const char *, const char *); +PyAPI_FUNC(PyObject *) _PyType_GetTextSignatureFromInternalDoc(const char *, const char *); + +struct _Py_Identifier; +PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int); +PyAPI_FUNC(void) _Py_BreakPoint(void); +PyAPI_FUNC(void) _PyObject_Dump(PyObject *); +PyAPI_FUNC(int) _PyObject_IsFreed(PyObject *); + +PyAPI_FUNC(int) _PyObject_IsAbstract(PyObject *); +PyAPI_FUNC(PyObject *) _PyObject_GetAttrId(PyObject *, struct _Py_Identifier *); +PyAPI_FUNC(int) _PyObject_SetAttrId(PyObject *, struct _Py_Identifier *, PyObject *); +PyAPI_FUNC(int) _PyObject_HasAttrId(PyObject *, struct _Py_Identifier *); +/* Replacements of PyObject_GetAttr() and _PyObject_GetAttrId() which + don't raise AttributeError. + + Return 1 and set *result != NULL if an attribute is found. + Return 0 and set *result == NULL if an attribute is not found; + an AttributeError is silenced. + Return -1 and set *result == NULL if an error other than AttributeError + is raised. +*/ +PyAPI_FUNC(int) _PyObject_LookupAttr(PyObject *, PyObject *, PyObject **); +PyAPI_FUNC(int) _PyObject_LookupAttrId(PyObject *, struct _Py_Identifier *, PyObject **); +PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *); +PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *); +PyAPI_FUNC(void) PyObject_CallFinalizer(PyObject *); +PyAPI_FUNC(int) PyObject_CallFinalizerFromDealloc(PyObject *); + +/* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes + dict as the last parameter. */ +PyAPI_FUNC(PyObject *) +_PyObject_GenericGetAttrWithDict(PyObject *, PyObject *, PyObject *, int); +PyAPI_FUNC(int) +_PyObject_GenericSetAttrWithDict(PyObject *, PyObject *, + PyObject *, PyObject *); + +#define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) + +static inline void _Py_Dealloc_inline(PyObject *op) +{ + destructor dealloc = Py_TYPE(op)->tp_dealloc; +#ifdef Py_TRACE_REFS + _Py_ForgetReference(op); +#else + _Py_INC_TPFREES(op); +#endif + (*dealloc)(op); +} +#define _Py_Dealloc(op) _Py_Dealloc_inline(op) + + +/* Safely decref `op` and set `op` to `op2`. + * + * As in case of Py_CLEAR "the obvious" code can be deadly: + * + * Py_DECREF(op); + * op = op2; + * + * The safe way is: + * + * Py_SETREF(op, op2); + * + * That arranges to set `op` to `op2` _before_ decref'ing, so that any code + * triggered as a side-effect of `op` getting torn down no longer believes + * `op` points to a valid object. + * + * Py_XSETREF is a variant of Py_SETREF that uses Py_XDECREF instead of + * Py_DECREF. + */ + +#define Py_SETREF(op, op2) \ + do { \ + PyObject *_py_tmp = _PyObject_CAST(op); \ + (op) = (op2); \ + Py_DECREF(_py_tmp); \ + } while (0) + +#define Py_XSETREF(op, op2) \ + do { \ + PyObject *_py_tmp = _PyObject_CAST(op); \ + (op) = (op2); \ + Py_XDECREF(_py_tmp); \ + } while (0) + + +PyAPI_DATA(PyTypeObject) _PyNone_Type; +PyAPI_DATA(PyTypeObject) _PyNotImplemented_Type; + +/* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE. + * Defined in object.c. + */ +PyAPI_DATA(int) _Py_SwappedOp[]; + +/* This is the old private API, invoked by the macros before 3.2.4. + Kept for binary compatibility of extensions using the stable ABI. */ +PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*); +PyAPI_FUNC(void) _PyTrash_destroy_chain(void); + +PyAPI_FUNC(void) +_PyDebugAllocatorStats(FILE *out, const char *block_name, int num_blocks, + size_t sizeof_block); +PyAPI_FUNC(void) +_PyObject_DebugTypeStats(FILE *out); + +/* Define a pair of assertion macros: + _PyObject_ASSERT_FROM(), _PyObject_ASSERT_WITH_MSG() and _PyObject_ASSERT(). + + These work like the regular C assert(), in that they will abort the + process with a message on stderr if the given condition fails to hold, + but compile away to nothing if NDEBUG is defined. + + However, before aborting, Python will also try to call _PyObject_Dump() on + the given object. This may be of use when investigating bugs in which a + particular object is corrupt (e.g. buggy a tp_visit method in an extension + module breaking the garbage collector), to help locate the broken objects. + + The WITH_MSG variant allows you to supply an additional message that Python + will attempt to print to stderr, after the object dump. */ +#ifdef NDEBUG + /* No debugging: compile away the assertions: */ +# define _PyObject_ASSERT_FROM(obj, expr, msg, filename, lineno, func) \ + ((void)0) +#else + /* With debugging: generate checks: */ +# define _PyObject_ASSERT_FROM(obj, expr, msg, filename, lineno, func) \ + ((expr) \ + ? (void)(0) \ + : _PyObject_AssertFailed((obj), Py_STRINGIFY(expr), \ + (msg), (filename), (lineno), (func))) +#endif + +#define _PyObject_ASSERT_WITH_MSG(obj, expr, msg) \ + _PyObject_ASSERT_FROM(obj, expr, msg, __FILE__, __LINE__, __func__) +#define _PyObject_ASSERT(obj, expr) \ + _PyObject_ASSERT_WITH_MSG(obj, expr, NULL) + +#define _PyObject_ASSERT_FAILED_MSG(obj, msg) \ + _PyObject_AssertFailed((obj), NULL, (msg), __FILE__, __LINE__, __func__) + +/* Declare and define _PyObject_AssertFailed() even when NDEBUG is defined, + to avoid causing compiler/linker errors when building extensions without + NDEBUG against a Python built with NDEBUG defined. + + msg, expr and function can be NULL. */ +PyAPI_FUNC(void) _PyObject_AssertFailed( + PyObject *obj, + const char *expr, + const char *msg, + const char *file, + int line, + const char *function); + +/* Check if an object is consistent. For example, ensure that the reference + counter is greater than or equal to 1, and ensure that ob_type is not NULL. + + Call _PyObject_AssertFailed() if the object is inconsistent. + + If check_content is zero, only check header fields: reduce the overhead. + + The function always return 1. The return value is just here to be able to + write: + + assert(_PyObject_CheckConsistency(obj, 1)); */ +PyAPI_FUNC(int) _PyObject_CheckConsistency( + PyObject *op, + int check_content); + +#ifdef __cplusplus +} +#endif diff --git a/openflow/include/python3.8/cpython/objimpl.h b/openflow/include/python3.8/cpython/objimpl.h new file mode 100644 index 0000000..f121922 --- /dev/null +++ b/openflow/include/python3.8/cpython/objimpl.h @@ -0,0 +1,113 @@ +#ifndef Py_CPYTHON_OBJIMPL_H +# error "this header file must not be included directly" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* This function returns the number of allocated memory blocks, regardless of size */ +PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void); + +/* Macros */ +#ifdef WITH_PYMALLOC +PyAPI_FUNC(int) _PyObject_DebugMallocStats(FILE *out); +#endif + + +typedef struct { + /* user context passed as the first argument to the 2 functions */ + void *ctx; + + /* allocate an arena of size bytes */ + void* (*alloc) (void *ctx, size_t size); + + /* free an arena */ + void (*free) (void *ctx, void *ptr, size_t size); +} PyObjectArenaAllocator; + +/* Get the arena allocator. */ +PyAPI_FUNC(void) PyObject_GetArenaAllocator(PyObjectArenaAllocator *allocator); + +/* Set the arena allocator. */ +PyAPI_FUNC(void) PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator); + + +PyAPI_FUNC(Py_ssize_t) _PyGC_CollectNoFail(void); +PyAPI_FUNC(Py_ssize_t) _PyGC_CollectIfEnabled(void); + + +/* Test if an object has a GC head */ +#define PyObject_IS_GC(o) \ + (PyType_IS_GC(Py_TYPE(o)) \ + && (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o))) + +/* GC information is stored BEFORE the object structure. */ +typedef struct { + // Pointer to next object in the list. + // 0 means the object is not tracked + uintptr_t _gc_next; + + // Pointer to previous object in the list. + // Lowest two bits are used for flags documented later. + uintptr_t _gc_prev; +} PyGC_Head; + +#define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) + +/* True if the object is currently tracked by the GC. */ +#define _PyObject_GC_IS_TRACKED(o) (_Py_AS_GC(o)->_gc_next != 0) + +/* True if the object may be tracked by the GC in the future, or already is. + This can be useful to implement some optimizations. */ +#define _PyObject_GC_MAY_BE_TRACKED(obj) \ + (PyObject_IS_GC(obj) && \ + (!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj))) + + +/* Bit flags for _gc_prev */ +/* Bit 0 is set when tp_finalize is called */ +#define _PyGC_PREV_MASK_FINALIZED (1) +/* Bit 1 is set when the object is in generation which is GCed currently. */ +#define _PyGC_PREV_MASK_COLLECTING (2) +/* The (N-2) most significant bits contain the real address. */ +#define _PyGC_PREV_SHIFT (2) +#define _PyGC_PREV_MASK (((uintptr_t) -1) << _PyGC_PREV_SHIFT) + +// Lowest bit of _gc_next is used for flags only in GC. +// But it is always 0 for normal code. +#define _PyGCHead_NEXT(g) ((PyGC_Head*)(g)->_gc_next) +#define _PyGCHead_SET_NEXT(g, p) ((g)->_gc_next = (uintptr_t)(p)) + +// Lowest two bits of _gc_prev is used for _PyGC_PREV_MASK_* flags. +#define _PyGCHead_PREV(g) ((PyGC_Head*)((g)->_gc_prev & _PyGC_PREV_MASK)) +#define _PyGCHead_SET_PREV(g, p) do { \ + assert(((uintptr_t)p & ~_PyGC_PREV_MASK) == 0); \ + (g)->_gc_prev = ((g)->_gc_prev & ~_PyGC_PREV_MASK) \ + | ((uintptr_t)(p)); \ + } while (0) + +#define _PyGCHead_FINALIZED(g) \ + (((g)->_gc_prev & _PyGC_PREV_MASK_FINALIZED) != 0) +#define _PyGCHead_SET_FINALIZED(g) \ + ((g)->_gc_prev |= _PyGC_PREV_MASK_FINALIZED) + +#define _PyGC_FINALIZED(o) \ + _PyGCHead_FINALIZED(_Py_AS_GC(o)) +#define _PyGC_SET_FINALIZED(o) \ + _PyGCHead_SET_FINALIZED(_Py_AS_GC(o)) + + +PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t size); +PyAPI_FUNC(PyObject *) _PyObject_GC_Calloc(size_t size); + + +/* Test if a type supports weak references */ +#define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0) + +#define PyObject_GET_WEAKREFS_LISTPTR(o) \ + ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset)) + +#ifdef __cplusplus +} +#endif diff --git a/openflow/include/python3.8/cpython/pyerrors.h b/openflow/include/python3.8/cpython/pyerrors.h new file mode 100644 index 0000000..e3098b3 --- /dev/null +++ b/openflow/include/python3.8/cpython/pyerrors.h @@ -0,0 +1,182 @@ +#ifndef Py_CPYTHON_ERRORS_H +# error "this header file must not be included directly" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Error objects */ + +/* PyException_HEAD defines the initial segment of every exception class. */ +#define PyException_HEAD PyObject_HEAD PyObject *dict;\ + PyObject *args; PyObject *traceback;\ + PyObject *context; PyObject *cause;\ + char suppress_context; + +typedef struct { + PyException_HEAD +} PyBaseExceptionObject; + +typedef struct { + PyException_HEAD + PyObject *msg; + PyObject *filename; + PyObject *lineno; + PyObject *offset; + PyObject *text; + PyObject *print_file_and_line; +} PySyntaxErrorObject; + +typedef struct { + PyException_HEAD + PyObject *msg; + PyObject *name; + PyObject *path; +} PyImportErrorObject; + +typedef struct { + PyException_HEAD + PyObject *encoding; + PyObject *object; + Py_ssize_t start; + Py_ssize_t end; + PyObject *reason; +} PyUnicodeErrorObject; + +typedef struct { + PyException_HEAD + PyObject *code; +} PySystemExitObject; + +typedef struct { + PyException_HEAD + PyObject *myerrno; + PyObject *strerror; + PyObject *filename; + PyObject *filename2; +#ifdef MS_WINDOWS + PyObject *winerror; +#endif + Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */ +} PyOSErrorObject; + +typedef struct { + PyException_HEAD + PyObject *value; +} PyStopIterationObject; + +/* Compatibility typedefs */ +typedef PyOSErrorObject PyEnvironmentErrorObject; +#ifdef MS_WINDOWS +typedef PyOSErrorObject PyWindowsErrorObject; +#endif + +/* Error handling definitions */ + +PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *); +_PyErr_StackItem *_PyErr_GetTopmostException(PyThreadState *tstate); + +/* Context manipulation (PEP 3134) */ + +PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *); + +/* */ + +#define PyExceptionClass_Name(x) (((PyTypeObject*)(x))->tp_name) + +/* Convenience functions */ + +#ifdef MS_WINDOWS +Py_DEPRECATED(3.3) +PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( + PyObject *, const Py_UNICODE *); +#endif /* MS_WINDOWS */ + +/* Like PyErr_Format(), but saves current exception as __context__ and + __cause__. + */ +PyAPI_FUNC(PyObject *) _PyErr_FormatFromCause( + PyObject *exception, + const char *format, /* ASCII-encoded string */ + ... + ); + +#ifdef MS_WINDOWS +/* XXX redeclare to use WSTRING */ +Py_DEPRECATED(3.3) +PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename( + int, const Py_UNICODE *); +Py_DEPRECATED(3.3) +PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename( + PyObject *,int, const Py_UNICODE *); +#endif + +/* In exceptions.c */ + +/* Helper that attempts to replace the current exception with one of the + * same type but with a prefix added to the exception text. The resulting + * exception description looks like: + * + * prefix (exc_type: original_exc_str) + * + * Only some exceptions can be safely replaced. If the function determines + * it isn't safe to perform the replacement, it will leave the original + * unmodified exception in place. + * + * Returns a borrowed reference to the new exception (if any), NULL if the + * existing exception was left in place. + */ +PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause( + const char *prefix_format, /* ASCII-encoded string */ + ... + ); + +/* In signalmodule.c */ + +int PySignal_SetWakeupFd(int fd); +PyAPI_FUNC(int) _PyErr_CheckSignals(void); + +/* Support for adding program text to SyntaxErrors */ + +PyAPI_FUNC(void) PyErr_SyntaxLocationObject( + PyObject *filename, + int lineno, + int col_offset); + +PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject( + PyObject *filename, + int lineno); + +/* Create a UnicodeEncodeError object */ +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create( + const char *encoding, /* UTF-8 encoded string */ + const Py_UNICODE *object, + Py_ssize_t length, + Py_ssize_t start, + Py_ssize_t end, + const char *reason /* UTF-8 encoded string */ + ); + +/* Create a UnicodeTranslateError object */ +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create( + const Py_UNICODE *object, + Py_ssize_t length, + Py_ssize_t start, + Py_ssize_t end, + const char *reason /* UTF-8 encoded string */ + ); +PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create( + PyObject *object, + Py_ssize_t start, + Py_ssize_t end, + const char *reason /* UTF-8 encoded string */ + ); + +PyAPI_FUNC(void) _PyErr_WriteUnraisableMsg( + const char *err_msg, + PyObject *obj); + +#ifdef __cplusplus +} +#endif diff --git a/openflow/include/python3.8/cpython/pylifecycle.h b/openflow/include/python3.8/cpython/pylifecycle.h new file mode 100644 index 0000000..2f3a0db --- /dev/null +++ b/openflow/include/python3.8/cpython/pylifecycle.h @@ -0,0 +1,78 @@ +#ifndef Py_CPYTHON_PYLIFECYCLE_H +# error "this header file must not be included directly" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Only used by applications that embed the interpreter and need to + * override the standard encoding determination mechanism + */ +PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding, + const char *errors); + +/* PEP 432 Multi-phase initialization API (Private while provisional!) */ + +PyAPI_FUNC(PyStatus) Py_PreInitialize( + const PyPreConfig *src_config); +PyAPI_FUNC(PyStatus) Py_PreInitializeFromBytesArgs( + const PyPreConfig *src_config, + Py_ssize_t argc, + char **argv); +PyAPI_FUNC(PyStatus) Py_PreInitializeFromArgs( + const PyPreConfig *src_config, + Py_ssize_t argc, + wchar_t **argv); + +PyAPI_FUNC(int) _Py_IsCoreInitialized(void); + + +/* Initialization and finalization */ + +PyAPI_FUNC(PyStatus) Py_InitializeFromConfig( + const PyConfig *config); +PyAPI_FUNC(PyStatus) _Py_InitializeFromArgs( + const PyConfig *config, + Py_ssize_t argc, + char * const *argv); +PyAPI_FUNC(PyStatus) _Py_InitializeFromWideArgs( + const PyConfig *config, + Py_ssize_t argc, + wchar_t * const *argv); +PyAPI_FUNC(PyStatus) _Py_InitializeMain(void); + +PyAPI_FUNC(int) Py_RunMain(void); + + +PyAPI_FUNC(void) _Py_NO_RETURN Py_ExitStatusException(PyStatus err); + +/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level + * exit functions. + */ +PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(PyObject *), PyObject *); + +/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */ +PyAPI_FUNC(void) _Py_RestoreSignals(void); + +PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *); + +PyAPI_FUNC(void) _Py_SetProgramFullPath(const wchar_t *); + +PyAPI_FUNC(const char *) _Py_gitidentifier(void); +PyAPI_FUNC(const char *) _Py_gitversion(void); + +PyAPI_FUNC(int) _Py_IsFinalizing(void); + +/* Random */ +PyAPI_FUNC(int) _PyOS_URandom(void *buffer, Py_ssize_t size); +PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size); + +/* Legacy locale support */ +PyAPI_FUNC(int) _Py_CoerceLegacyLocale(int warn); +PyAPI_FUNC(int) _Py_LegacyLocaleDetected(int warn); +PyAPI_FUNC(char *) _Py_SetLocaleFromEnv(int category); + +#ifdef __cplusplus +} +#endif diff --git a/openflow/include/python3.8/cpython/pymem.h b/openflow/include/python3.8/cpython/pymem.h new file mode 100644 index 0000000..79f063b --- /dev/null +++ b/openflow/include/python3.8/cpython/pymem.h @@ -0,0 +1,108 @@ +#ifndef Py_CPYTHON_PYMEM_H +# error "this header file must not be included directly" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(void *) PyMem_RawMalloc(size_t size); +PyAPI_FUNC(void *) PyMem_RawCalloc(size_t nelem, size_t elsize); +PyAPI_FUNC(void *) PyMem_RawRealloc(void *ptr, size_t new_size); +PyAPI_FUNC(void) PyMem_RawFree(void *ptr); + +/* Try to get the allocators name set by _PyMem_SetupAllocators(). */ +PyAPI_FUNC(const char*) _PyMem_GetCurrentAllocatorName(void); + +PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); + +/* strdup() using PyMem_RawMalloc() */ +PyAPI_FUNC(char *) _PyMem_RawStrdup(const char *str); + +/* strdup() using PyMem_Malloc() */ +PyAPI_FUNC(char *) _PyMem_Strdup(const char *str); + +/* wcsdup() using PyMem_RawMalloc() */ +PyAPI_FUNC(wchar_t*) _PyMem_RawWcsdup(const wchar_t *str); + + +typedef enum { + /* PyMem_RawMalloc(), PyMem_RawRealloc() and PyMem_RawFree() */ + PYMEM_DOMAIN_RAW, + + /* PyMem_Malloc(), PyMem_Realloc() and PyMem_Free() */ + PYMEM_DOMAIN_MEM, + + /* PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() */ + PYMEM_DOMAIN_OBJ +} PyMemAllocatorDomain; + +typedef enum { + PYMEM_ALLOCATOR_NOT_SET = 0, + PYMEM_ALLOCATOR_DEFAULT = 1, + PYMEM_ALLOCATOR_DEBUG = 2, + PYMEM_ALLOCATOR_MALLOC = 3, + PYMEM_ALLOCATOR_MALLOC_DEBUG = 4, +#ifdef WITH_PYMALLOC + PYMEM_ALLOCATOR_PYMALLOC = 5, + PYMEM_ALLOCATOR_PYMALLOC_DEBUG = 6, +#endif +} PyMemAllocatorName; + + +typedef struct { + /* user context passed as the first argument to the 4 functions */ + void *ctx; + + /* allocate a memory block */ + void* (*malloc) (void *ctx, size_t size); + + /* allocate a memory block initialized by zeros */ + void* (*calloc) (void *ctx, size_t nelem, size_t elsize); + + /* allocate or resize a memory block */ + void* (*realloc) (void *ctx, void *ptr, size_t new_size); + + /* release a memory block */ + void (*free) (void *ctx, void *ptr); +} PyMemAllocatorEx; + +/* Get the memory block allocator of the specified domain. */ +PyAPI_FUNC(void) PyMem_GetAllocator(PyMemAllocatorDomain domain, + PyMemAllocatorEx *allocator); + +/* Set the memory block allocator of the specified domain. + + The new allocator must return a distinct non-NULL pointer when requesting + zero bytes. + + For the PYMEM_DOMAIN_RAW domain, the allocator must be thread-safe: the GIL + is not held when the allocator is called. + + If the new allocator is not a hook (don't call the previous allocator), the + PyMem_SetupDebugHooks() function must be called to reinstall the debug hooks + on top on the new allocator. */ +PyAPI_FUNC(void) PyMem_SetAllocator(PyMemAllocatorDomain domain, + PyMemAllocatorEx *allocator); + +/* Setup hooks to detect bugs in the following Python memory allocator + functions: + + - PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree() + - PyMem_Malloc(), PyMem_Realloc(), PyMem_Free() + - PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() + + Newly allocated memory is filled with the byte 0xCB, freed memory is filled + with the byte 0xDB. Additional checks: + + - detect API violations, ex: PyObject_Free() called on a buffer allocated + by PyMem_Malloc() + - detect write before the start of the buffer (buffer underflow) + - detect write after the end of the buffer (buffer overflow) + + The function does nothing if Python is not compiled is debug mode. */ +PyAPI_FUNC(void) PyMem_SetupDebugHooks(void); + +#ifdef __cplusplus +} +#endif diff --git a/openflow/include/python3.8/cpython/pystate.h b/openflow/include/python3.8/cpython/pystate.h new file mode 100644 index 0000000..94b0809 --- /dev/null +++ b/openflow/include/python3.8/cpython/pystate.h @@ -0,0 +1,251 @@ +#ifndef Py_CPYTHON_PYSTATE_H +# error "this header file must not be included directly" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include "cpython/initconfig.h" + +PyAPI_FUNC(int) _PyInterpreterState_RequiresIDRef(PyInterpreterState *); +PyAPI_FUNC(void) _PyInterpreterState_RequireIDRef(PyInterpreterState *, int); + +PyAPI_FUNC(PyObject *) _PyInterpreterState_GetMainModule(PyInterpreterState *); + +/* State unique per thread */ + +/* Py_tracefunc return -1 when raising an exception, or 0 for success. */ +typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *); + +/* The following values are used for 'what' for tracefunc functions + * + * To add a new kind of trace event, also update "trace_init" in + * Python/sysmodule.c to define the Python level event name + */ +#define PyTrace_CALL 0 +#define PyTrace_EXCEPTION 1 +#define PyTrace_LINE 2 +#define PyTrace_RETURN 3 +#define PyTrace_C_CALL 4 +#define PyTrace_C_EXCEPTION 5 +#define PyTrace_C_RETURN 6 +#define PyTrace_OPCODE 7 + + +typedef struct _err_stackitem { + /* This struct represents an entry on the exception stack, which is a + * per-coroutine state. (Coroutine in the computer science sense, + * including the thread and generators). + * This ensures that the exception state is not impacted by "yields" + * from an except handler. + */ + PyObject *exc_type, *exc_value, *exc_traceback; + + struct _err_stackitem *previous_item; + +} _PyErr_StackItem; + + +// The PyThreadState typedef is in Include/pystate.h. +struct _ts { + /* See Python/ceval.c for comments explaining most fields */ + + struct _ts *prev; + struct _ts *next; + PyInterpreterState *interp; + + struct _frame *frame; + int recursion_depth; + char overflowed; /* The stack has overflowed. Allow 50 more calls + to handle the runtime error. */ + char recursion_critical; /* The current calls must not cause + a stack overflow. */ + int stackcheck_counter; + + /* 'tracing' keeps track of the execution depth when tracing/profiling. + This is to prevent the actual trace/profile code from being recorded in + the trace/profile. */ + int tracing; + int use_tracing; + + Py_tracefunc c_profilefunc; + Py_tracefunc c_tracefunc; + PyObject *c_profileobj; + PyObject *c_traceobj; + + /* The exception currently being raised */ + PyObject *curexc_type; + PyObject *curexc_value; + PyObject *curexc_traceback; + + /* The exception currently being handled, if no coroutines/generators + * are present. Always last element on the stack referred to be exc_info. + */ + _PyErr_StackItem exc_state; + + /* Pointer to the top of the stack of the exceptions currently + * being handled */ + _PyErr_StackItem *exc_info; + + PyObject *dict; /* Stores per-thread state */ + + int gilstate_counter; + + PyObject *async_exc; /* Asynchronous exception to raise */ + unsigned long thread_id; /* Thread id where this tstate was created */ + + int trash_delete_nesting; + PyObject *trash_delete_later; + + /* Called when a thread state is deleted normally, but not when it + * is destroyed after fork(). + * Pain: to prevent rare but fatal shutdown errors (issue 18808), + * Thread.join() must wait for the join'ed thread's tstate to be unlinked + * from the tstate chain. That happens at the end of a thread's life, + * in pystate.c. + * The obvious way doesn't quite work: create a lock which the tstate + * unlinking code releases, and have Thread.join() wait to acquire that + * lock. The problem is that we _are_ at the end of the thread's life: + * if the thread holds the last reference to the lock, decref'ing the + * lock will delete the lock, and that may trigger arbitrary Python code + * if there's a weakref, with a callback, to the lock. But by this time + * _PyRuntime.gilstate.tstate_current is already NULL, so only the simplest + * of C code can be allowed to run (in particular it must not be possible to + * release the GIL). + * So instead of holding the lock directly, the tstate holds a weakref to + * the lock: that's the value of on_delete_data below. Decref'ing a + * weakref is harmless. + * on_delete points to _threadmodule.c's static release_sentinel() function. + * After the tstate is unlinked, release_sentinel is called with the + * weakref-to-lock (on_delete_data) argument, and release_sentinel releases + * the indirectly held lock. + */ + void (*on_delete)(void *); + void *on_delete_data; + + int coroutine_origin_tracking_depth; + + PyObject *async_gen_firstiter; + PyObject *async_gen_finalizer; + + PyObject *context; + uint64_t context_ver; + + /* Unique thread state id. */ + uint64_t id; + + /* XXX signal handlers should also be here */ + +}; + +/* Get the current interpreter state. + + Issue a fatal error if there no current Python thread state or no current + interpreter. It cannot return NULL. + + The caller must hold the GIL.*/ +PyAPI_FUNC(PyInterpreterState *) _PyInterpreterState_Get(void); + +PyAPI_FUNC(int) _PyState_AddModule(PyObject*, struct PyModuleDef*); +PyAPI_FUNC(void) _PyState_ClearModules(void); +PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *); + +/* Similar to PyThreadState_Get(), but don't issue a fatal error + * if it is NULL. */ +PyAPI_FUNC(PyThreadState *) _PyThreadState_UncheckedGet(void); + +/* PyGILState */ + +/* Helper/diagnostic function - return 1 if the current thread + currently holds the GIL, 0 otherwise. + + The function returns 1 if _PyGILState_check_enabled is non-zero. */ +PyAPI_FUNC(int) PyGILState_Check(void); + +/* Get the single PyInterpreterState used by this process' GILState + implementation. + + This function doesn't check for error. Return NULL before _PyGILState_Init() + is called and after _PyGILState_Fini() is called. + + See also _PyInterpreterState_Get() and _PyInterpreterState_GET_UNSAFE(). */ +PyAPI_FUNC(PyInterpreterState *) _PyGILState_GetInterpreterStateUnsafe(void); + +/* The implementation of sys._current_frames() Returns a dict mapping + thread id to that thread's current frame. +*/ +PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void); + +/* Routines for advanced debuggers, requested by David Beazley. + Don't use unless you know what you are doing! */ +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Main(void); +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void); +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); +PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); +PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); + +typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_); + +/* cross-interpreter data */ + +struct _xid; + +// _PyCrossInterpreterData is similar to Py_buffer as an effectively +// opaque struct that holds data outside the object machinery. This +// is necessary to pass safely between interpreters in the same process. +typedef struct _xid { + // data is the cross-interpreter-safe derivation of a Python object + // (see _PyObject_GetCrossInterpreterData). It will be NULL if the + // new_object func (below) encodes the data. + void *data; + // obj is the Python object from which the data was derived. This + // is non-NULL only if the data remains bound to the object in some + // way, such that the object must be "released" (via a decref) when + // the data is released. In that case the code that sets the field, + // likely a registered "crossinterpdatafunc", is responsible for + // ensuring it owns the reference (i.e. incref). + PyObject *obj; + // interp is the ID of the owning interpreter of the original + // object. It corresponds to the active interpreter when + // _PyObject_GetCrossInterpreterData() was called. This should only + // be set by the cross-interpreter machinery. + // + // We use the ID rather than the PyInterpreterState to avoid issues + // with deleted interpreters. Note that IDs are never re-used, so + // each one will always correspond to a specific interpreter + // (whether still alive or not). + int64_t interp; + // new_object is a function that returns a new object in the current + // interpreter given the data. The resulting object (a new + // reference) will be equivalent to the original object. This field + // is required. + PyObject *(*new_object)(struct _xid *); + // free is called when the data is released. If it is NULL then + // nothing will be done to free the data. For some types this is + // okay (e.g. bytes) and for those types this field should be set + // to NULL. However, for most the data was allocated just for + // cross-interpreter use, so it must be freed when + // _PyCrossInterpreterData_Release is called or the memory will + // leak. In that case, at the very least this field should be set + // to PyMem_RawFree (the default if not explicitly set to NULL). + // The call will happen with the original interpreter activated. + void (*free)(void *); +} _PyCrossInterpreterData; + +PyAPI_FUNC(int) _PyObject_GetCrossInterpreterData(PyObject *, _PyCrossInterpreterData *); +PyAPI_FUNC(PyObject *) _PyCrossInterpreterData_NewObject(_PyCrossInterpreterData *); +PyAPI_FUNC(void) _PyCrossInterpreterData_Release(_PyCrossInterpreterData *); + +PyAPI_FUNC(int) _PyObject_CheckCrossInterpreterData(PyObject *); + +/* cross-interpreter data registry */ + +typedef int (*crossinterpdatafunc)(PyObject *, struct _xid *); + +PyAPI_FUNC(int) _PyCrossInterpreterData_RegisterClass(PyTypeObject *, crossinterpdatafunc); +PyAPI_FUNC(crossinterpdatafunc) _PyCrossInterpreterData_Lookup(PyObject *); + +#ifdef __cplusplus +} +#endif diff --git a/openflow/include/python3.8/cpython/sysmodule.h b/openflow/include/python3.8/cpython/sysmodule.h new file mode 100644 index 0000000..72d8ffe --- /dev/null +++ b/openflow/include/python3.8/cpython/sysmodule.h @@ -0,0 +1,21 @@ +#ifndef Py_CPYTHON_SYSMODULE_H +# error "this header file must not be included directly" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(PyObject *) _PySys_GetObjectId(_Py_Identifier *key); +PyAPI_FUNC(int) _PySys_SetObjectId(_Py_Identifier *key, PyObject *); + +PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *); + +typedef int(*Py_AuditHookFunction)(const char *, PyObject *, void *); + +PyAPI_FUNC(int) PySys_Audit(const char*, const char *, ...); +PyAPI_FUNC(int) PySys_AddAuditHook(Py_AuditHookFunction, void*); + +#ifdef __cplusplus +} +#endif diff --git a/openflow/include/python3.8/cpython/traceback.h b/openflow/include/python3.8/cpython/traceback.h new file mode 100644 index 0000000..746097d --- /dev/null +++ b/openflow/include/python3.8/cpython/traceback.h @@ -0,0 +1,22 @@ +#ifndef Py_CPYTHON_TRACEBACK_H +# error "this header file must not be included directly" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _traceback { + PyObject_HEAD + struct _traceback *tb_next; + struct _frame *tb_frame; + int tb_lasti; + int tb_lineno; +} PyTracebackObject; + +PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int); +PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int); + +#ifdef __cplusplus +} +#endif diff --git a/openflow/include/python3.8/cpython/tupleobject.h b/openflow/include/python3.8/cpython/tupleobject.h new file mode 100644 index 0000000..1565f2a --- /dev/null +++ b/openflow/include/python3.8/cpython/tupleobject.h @@ -0,0 +1,36 @@ +#ifndef Py_CPYTHON_TUPLEOBJECT_H +# error "this header file must not be included directly" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject_VAR_HEAD + /* ob_item contains space for 'ob_size' elements. + Items must normally not be NULL, except during construction when + the tuple is not yet visible outside the function that builds it. */ + PyObject *ob_item[1]; +} PyTupleObject; + +PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t); +PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); + +/* Macros trading safety for speed */ + +/* Cast argument to PyTupleObject* type. */ +#define _PyTuple_CAST(op) (assert(PyTuple_Check(op)), (PyTupleObject *)(op)) + +#define PyTuple_GET_SIZE(op) Py_SIZE(_PyTuple_CAST(op)) + +#define PyTuple_GET_ITEM(op, i) (_PyTuple_CAST(op)->ob_item[i]) + +/* Macro, *only* to be used to fill in brand new tuples */ +#define PyTuple_SET_ITEM(op, i, v) (_PyTuple_CAST(op)->ob_item[i] = v) + +PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out); + +#ifdef __cplusplus +} +#endif diff --git a/openflow/usr/include/python3.5m/unicodeobject.h b/openflow/include/python3.8/cpython/unicodeobject.h similarity index 52% rename from openflow/usr/include/python3.5m/unicodeobject.h rename to openflow/include/python3.8/cpython/unicodeobject.h index 533dd75..54a13e3 100644 --- a/openflow/usr/include/python3.5m/unicodeobject.h +++ b/openflow/include/python3.8/cpython/unicodeobject.h @@ -1,137 +1,17 @@ -#ifndef Py_UNICODEOBJECT_H -#define Py_UNICODEOBJECT_H - -#include - -/* - -Unicode implementation based on original code by Fredrik Lundh, -modified by Marc-Andre Lemburg (mal@lemburg.com) according to the -Unicode Integration Proposal. (See -http://www.egenix.com/files/python/unicode-proposal.txt). - -Copyright (c) Corporation for National Research Initiatives. - - - Original header: - -------------------------------------------------------------------- - - * Yet another Unicode string type for Python. This type supports the - * 16-bit Basic Multilingual Plane (BMP) only. - * - * Written by Fredrik Lundh, January 1999. - * - * Copyright (c) 1999 by Secret Labs AB. - * Copyright (c) 1999 by Fredrik Lundh. - * - * fredrik@pythonware.com - * http://www.pythonware.com - * - * -------------------------------------------------------------------- - * This Unicode String Type is - * - * Copyright (c) 1999 by Secret Labs AB - * Copyright (c) 1999 by Fredrik Lundh - * - * By obtaining, using, and/or copying this software and/or its - * associated documentation, you agree that you have read, understood, - * and will comply with the following terms and conditions: - * - * Permission to use, copy, modify, and distribute this software and its - * associated documentation for any purpose and without fee is hereby - * granted, provided that the above copyright notice appears in all - * copies, and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of Secret Labs - * AB or the author not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. - * - * SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * -------------------------------------------------------------------- */ - -#include - -/* === Internal API ======================================================= */ - -/* --- Internal Unicode Format -------------------------------------------- */ - -/* Python 3.x requires unicode */ -#define Py_USING_UNICODE - -#ifndef SIZEOF_WCHAR_T -#error Must define SIZEOF_WCHAR_T +#ifndef Py_CPYTHON_UNICODEOBJECT_H +# error "this header file must not be included directly" #endif -#define Py_UNICODE_SIZE SIZEOF_WCHAR_T - -/* If wchar_t can be used for UCS-4 storage, set Py_UNICODE_WIDE. - Otherwise, Unicode strings are stored as UCS-2 (with limited support - for UTF-16) */ - -#if Py_UNICODE_SIZE >= 4 -#define Py_UNICODE_WIDE +#ifdef __cplusplus +extern "C" { #endif -/* Set these flags if the platform has "wchar.h" and the - wchar_t type is a 16-bit unsigned type */ -/* #define HAVE_WCHAR_H */ -/* #define HAVE_USABLE_WCHAR_T */ - /* Py_UNICODE was the native Unicode storage format (code unit) used by Python and represents a single Unicode element in the Unicode type. With PEP 393, Py_UNICODE is deprecated and replaced with a typedef to wchar_t. */ - -#ifndef Py_LIMITED_API #define PY_UNICODE_TYPE wchar_t -typedef wchar_t Py_UNICODE; -#endif - -/* If the compiler provides a wchar_t type we try to support it - through the interface functions PyUnicode_FromWideChar(), - PyUnicode_AsWideChar() and PyUnicode_AsWideCharString(). */ - -#ifdef HAVE_USABLE_WCHAR_T -# ifndef HAVE_WCHAR_H -# define HAVE_WCHAR_H -# endif -#endif - -#if defined(MS_WINDOWS) -# define HAVE_MBCS -#endif - -#ifdef HAVE_WCHAR_H -/* Work around a cosmetic bug in BSDI 4.x wchar.h; thanks to Thomas Wouters */ -# ifdef _HAVE_BSDI -# include -# endif -# include -#endif - -/* Py_UCS4 and Py_UCS2 are typedefs for the respective - unicode representations. */ -#if SIZEOF_INT == 4 -typedef unsigned int Py_UCS4; -#elif SIZEOF_LONG == 4 -typedef unsigned long Py_UCS4; -#else -#error "Could not find a proper typedef for Py_UCS4" -#endif - -#if SIZEOF_SHORT == 2 -typedef unsigned short Py_UCS2; -#else -#error "Could not find a proper typedef for Py_UCS2" -#endif - -typedef unsigned char Py_UCS1; +/* Py_DEPRECATED(3.3) */ typedef wchar_t Py_UNICODE; /* --- Internal Unicode Operations ---------------------------------------- */ @@ -141,7 +21,6 @@ typedef unsigned char Py_UCS1; _Py_ascii_whitespace (see below) with an inlined check. */ -#ifndef Py_LIMITED_API #define Py_UNICODE_ISSPACE(ch) \ ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch)) @@ -172,11 +51,11 @@ typedef unsigned char Py_UCS1; Py_UNICODE_ISNUMERIC(ch)) #define Py_UNICODE_COPY(target, source, length) \ - Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE)) + memcpy((target), (source), (length)*sizeof(Py_UNICODE)) #define Py_UNICODE_FILL(target, value, length) \ do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\ - for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\ + for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\ } while (0) /* macros to work with surrogates */ @@ -200,16 +79,8 @@ typedef unsigned char Py_UCS1; ((*((string)->wstr + (offset) + (substring)->wstr_length-1) == *((substring)->wstr + (substring)->wstr_length-1))) && \ !memcmp((string)->wstr + (offset), (substring)->wstr, (substring)->wstr_length*sizeof(Py_UNICODE))) -#endif /* Py_LIMITED_API */ - -#ifdef __cplusplus -extern "C" { -#endif - /* --- Unicode Type ------------------------------------------------------- */ -#ifndef Py_LIMITED_API - /* ASCII-only strings created through PyUnicode_New use the PyASCIIObject structure. state.ascii and state.compact are set, and the data immediately follow the structure. utf8_length and wstr_length can be found @@ -374,18 +245,12 @@ typedef struct { Py_UCS4 *ucs4; } data; /* Canonical, smallest-form Unicode buffer */ } PyUnicodeObject; -#endif -PyAPI_DATA(PyTypeObject) PyUnicode_Type; -PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type; - -#define PyUnicode_Check(op) \ - PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) -#define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type) +PyAPI_FUNC(int) _PyUnicode_CheckConsistency( + PyObject *op, + int check_content); /* Fast access macros */ -#ifndef Py_LIMITED_API - #define PyUnicode_WSTR_LENGTH(op) \ (PyUnicode_IS_COMPACT_ASCII(op) ? \ ((PyASCIIObject*)op)->length : \ @@ -396,14 +261,16 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type; If the Py_UNICODE representation is not available, it will be computed on request. Use PyUnicode_GET_LENGTH() for the length in code points. */ +/* Py_DEPRECATED(3.3) */ #define PyUnicode_GET_SIZE(op) \ (assert(PyUnicode_Check(op)), \ (((PyASCIIObject *)(op))->wstr) ? \ PyUnicode_WSTR_LENGTH(op) : \ - ((void)PyUnicode_AsUnicode((PyObject *)(op)), \ + ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\ assert(((PyASCIIObject *)(op))->wstr), \ PyUnicode_WSTR_LENGTH(op))) +/* Py_DEPRECATED(3.3) */ #define PyUnicode_GET_DATA_SIZE(op) \ (PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE) @@ -412,11 +279,13 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type; try to port your code to use the new PyUnicode_*BYTE_DATA() macros or use PyUnicode_WRITE() and PyUnicode_READ(). */ +/* Py_DEPRECATED(3.3) */ #define PyUnicode_AS_UNICODE(op) \ (assert(PyUnicode_Check(op)), \ (((PyASCIIObject *)(op))->wstr) ? (((PyASCIIObject *)(op))->wstr) : \ - PyUnicode_AsUnicode((PyObject *)(op))) + PyUnicode_AsUnicode(_PyObject_CAST(op))) +/* Py_DEPRECATED(3.3) */ #define PyUnicode_AS_DATA(op) \ ((const char *)(PyUnicode_AS_UNICODE(op))) @@ -565,7 +434,7 @@ enum PyUnicode_Kind { #define PyUnicode_READY(op) \ (assert(PyUnicode_Check(op)), \ (PyUnicode_IS_READY(op) ? \ - 0 : _PyUnicode_Ready((PyObject *)(op)))) + 0 : _PyUnicode_Ready(_PyObject_CAST(op)))) /* Return a maximum character value which is suitable for creating another string based on op. This is always an approximation but more efficient @@ -580,17 +449,6 @@ enum PyUnicode_Kind { (0xffffU) : \ (0x10ffffU))))) -#endif - -/* --- Constants ---------------------------------------------------------- */ - -/* This Unicode character will be used as replacement character during - decoding if the errors argument is set to "replace". Note: the - Unicode character U+FFFD is the official REPLACEMENT CHARACTER in - Unicode 3.0. */ - -#define Py_UNICODE_REPLACEMENT_CHARACTER ((Py_UCS4) 0xFFFD) - /* === Public API ========================================================= */ /* --- Plain Py_UNICODE --------------------------------------------------- */ @@ -598,12 +456,10 @@ enum PyUnicode_Kind { /* With PEP 393, this is the recommended way to allocate a new unicode object. This function will allocate the object and its buffer in a single memory block. Objects created using this function are not resizable. */ -#ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_New( Py_ssize_t size, /* Number of code points in the new string */ Py_UCS4 maxchar /* maximum code point value in the string */ ); -#endif /* Initializes the canonical string representation from the deprecated wstr/Py_UNICODE representation. This function is used to convert Unicode @@ -612,18 +468,14 @@ PyAPI_FUNC(PyObject*) PyUnicode_New( Don't call this function directly, use the public PyUnicode_READY() macro instead. */ -#ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyUnicode_Ready( PyObject *unicode /* Unicode object */ ); -#endif /* Get a copy of a Unicode string. */ -#ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyUnicode_Copy( PyObject *unicode ); -#endif /* Copy character from one unicode object into another, this function performs character conversion when necessary and falls back to memcpy() if possible. @@ -643,7 +495,6 @@ PyAPI_FUNC(PyObject*) _PyUnicode_Copy( Note: The function doesn't write a terminating null character. */ -#ifndef Py_LIMITED_API PyAPI_FUNC(Py_ssize_t) PyUnicode_CopyCharacters( PyObject *to, Py_ssize_t to_start, @@ -662,9 +513,7 @@ PyAPI_FUNC(void) _PyUnicode_FastCopyCharacters( Py_ssize_t from_start, Py_ssize_t how_many ); -#endif -#ifndef Py_LIMITED_API /* Fill a string with a character: write fill_char into unicode[start:start+length]. @@ -688,7 +537,6 @@ PyAPI_FUNC(void) _PyUnicode_FastFill( Py_ssize_t length, Py_UCS4 fill_char ); -#endif /* Create a Unicode Object from the Py_UNICODE buffer u of the given size. @@ -699,27 +547,11 @@ PyAPI_FUNC(void) _PyUnicode_FastFill( only allowed if u was set to NULL. The buffer is copied into the new object. */ - -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( +/* Py_DEPRECATED(3.3) */ PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( const Py_UNICODE *u, /* Unicode buffer */ Py_ssize_t size /* size of buffer */ ); -#endif -/* Similar to PyUnicode_FromUnicode(), but u points to UTF-8 encoded bytes */ -PyAPI_FUNC(PyObject*) PyUnicode_FromStringAndSize( - const char *u, /* UTF-8 encoded string */ - Py_ssize_t size /* size of buffer */ - ); - -/* Similar to PyUnicode_FromUnicode(), but u points to null-terminated - UTF-8 encoded bytes. The size is determined with strlen(). */ -PyAPI_FUNC(PyObject*) PyUnicode_FromString( - const char *u /* UTF-8 encoded string */ - ); - -#ifndef Py_LIMITED_API /* Create a new string from a buffer of Py_UCS1, Py_UCS2 or Py_UCS4 characters. Scan the string to find the maximum character. */ PyAPI_FUNC(PyObject*) PyUnicode_FromKindAndData( @@ -732,160 +564,44 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromKindAndData( PyAPI_FUNC(PyObject*) _PyUnicode_FromASCII( const char *buffer, Py_ssize_t size); -#endif -PyAPI_FUNC(PyObject*) PyUnicode_Substring( - PyObject *str, - Py_ssize_t start, - Py_ssize_t end); - -#ifndef Py_LIMITED_API /* Compute the maximum character of the substring unicode[start:end]. Return 127 for an empty string. */ PyAPI_FUNC(Py_UCS4) _PyUnicode_FindMaxChar ( PyObject *unicode, Py_ssize_t start, Py_ssize_t end); -#endif - -/* Copy the string into a UCS4 buffer including the null character if copy_null - is set. Return NULL and raise an exception on error. Raise a ValueError if - the buffer is smaller than the string. Return buffer on success. - - buflen is the length of the buffer in (Py_UCS4) characters. */ -PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4( - PyObject *unicode, - Py_UCS4* buffer, - Py_ssize_t buflen, - int copy_null); - -/* Copy the string into a UCS4 buffer. A new buffer is allocated using - * PyMem_Malloc; if this fails, NULL is returned with a memory error - exception set. */ -PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4Copy(PyObject *unicode); /* Return a read-only pointer to the Unicode object's internal Py_UNICODE buffer. If the wchar_t/Py_UNICODE representation is not yet available, this function will calculate it. */ - -#ifndef Py_LIMITED_API -PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( +/* Py_DEPRECATED(3.3) */ PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( + PyObject *unicode /* Unicode object */ + ); + +/* Similar to PyUnicode_AsUnicode(), but raises a ValueError if the string + contains null characters. */ +PyAPI_FUNC(const Py_UNICODE *) _PyUnicode_AsUnicode( PyObject *unicode /* Unicode object */ ); -#endif /* Return a read-only pointer to the Unicode object's internal Py_UNICODE buffer and save the length at size. If the wchar_t/Py_UNICODE representation is not yet available, this function will calculate it. */ -#ifndef Py_LIMITED_API -PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicodeAndSize( +/* Py_DEPRECATED(3.3) */ PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicodeAndSize( PyObject *unicode, /* Unicode object */ Py_ssize_t *size /* location where to save the length */ ); -#endif -/* Get the length of the Unicode object. */ - -PyAPI_FUNC(Py_ssize_t) PyUnicode_GetLength( - PyObject *unicode -); - -/* Get the number of Py_UNICODE units in the - string representation. */ - -PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize( - PyObject *unicode /* Unicode object */ - ); - -/* Read a character from the string. */ - -PyAPI_FUNC(Py_UCS4) PyUnicode_ReadChar( - PyObject *unicode, - Py_ssize_t index - ); - -/* Write a character to the string. The string must have been created through - PyUnicode_New, must not be shared, and must not have been hashed yet. - - Return 0 on success, -1 on error. */ - -PyAPI_FUNC(int) PyUnicode_WriteChar( - PyObject *unicode, - Py_ssize_t index, - Py_UCS4 character - ); - -#ifndef Py_LIMITED_API /* Get the maximum ordinal for a Unicode character. */ -PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void); -#endif +Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void); -/* Resize a Unicode object. The length is the number of characters, except - if the kind of the string is PyUnicode_WCHAR_KIND: in this case, the length - is the number of Py_UNICODE characters. - *unicode is modified to point to the new (resized) object and 0 - returned on success. +/* --- _PyUnicodeWriter API ----------------------------------------------- */ - Try to resize the string in place (which is usually faster than allocating - a new string and copy characters), or create a new string. - - Error handling is implemented as follows: an exception is set, -1 - is returned and *unicode left untouched. - - WARNING: The function doesn't check string content, the result may not be a - string in canonical representation. */ - -PyAPI_FUNC(int) PyUnicode_Resize( - PyObject **unicode, /* Pointer to the Unicode object */ - Py_ssize_t length /* New length */ - ); - -/* Decode obj to a Unicode object. - - bytes, bytearray and other bytes-like objects are decoded according to the - given encoding and error handler. The encoding and error handler can be - NULL to have the interface use UTF-8 and "strict". - - All other objects (including Unicode objects) raise an exception. - - The API returns NULL in case of an error. The caller is responsible - for decref'ing the returned objects. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject( - PyObject *obj, /* Object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Copy an instance of a Unicode subtype to a new true Unicode object if - necessary. If obj is already a true Unicode object (not a subtype), return - the reference with *incremented* refcount. - - The API returns NULL in case of an error. The caller is responsible - for decref'ing the returned objects. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_FromObject( - PyObject *obj /* Object */ - ); - -PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV( - const char *format, /* ASCII-encoded string */ - va_list vargs - ); -PyAPI_FUNC(PyObject *) PyUnicode_FromFormat( - const char *format, /* ASCII-encoded string */ - ... - ); - -#ifndef Py_LIMITED_API typedef struct { PyObject *buffer; void *data; @@ -900,7 +616,7 @@ typedef struct { /* minimum character (default: 127, ASCII) */ Py_UCS4 min_char; - /* If non-zero, overallocate the buffer by 25% (default: 0). */ + /* If non-zero, overallocate the buffer (default: 0). */ unsigned char overallocate; /* If readonly is 1, buffer is a shared string (cannot be modified) @@ -934,6 +650,23 @@ PyAPI_FUNC(int) _PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer, Py_ssize_t length, Py_UCS4 maxchar); +/* Prepare the buffer to have at least the kind KIND. + For example, kind=PyUnicode_2BYTE_KIND ensures that the writer will + support characters in range U+000-U+FFFF. + + Return 0 on success, raise an exception and return -1 on error. */ +#define _PyUnicodeWriter_PrepareKind(WRITER, KIND) \ + (assert((KIND) != PyUnicode_WCHAR_KIND), \ + (KIND) <= (WRITER)->kind \ + ? 0 \ + : _PyUnicodeWriter_PrepareKindInternal((WRITER), (KIND))) + +/* Don't call this function directly, use the _PyUnicodeWriter_PrepareKind() + macro instead. */ +PyAPI_FUNC(int) +_PyUnicodeWriter_PrepareKindInternal(_PyUnicodeWriter *writer, + enum PyUnicode_Kind kind); + /* Append a Unicode character. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) @@ -982,9 +715,8 @@ _PyUnicodeWriter_Finish(_PyUnicodeWriter *writer); /* Deallocate memory of a writer (clear its internal buffer). */ PyAPI_FUNC(void) _PyUnicodeWriter_Dealloc(_PyUnicodeWriter *writer); -#endif -#ifndef Py_LIMITED_API + /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ PyAPI_FUNC(int) _PyUnicode_FormatAdvancedWriter( @@ -993,112 +725,13 @@ PyAPI_FUNC(int) _PyUnicode_FormatAdvancedWriter( PyObject *format_spec, Py_ssize_t start, Py_ssize_t end); -#endif - -PyAPI_FUNC(void) PyUnicode_InternInPlace(PyObject **); -PyAPI_FUNC(void) PyUnicode_InternImmortal(PyObject **); -PyAPI_FUNC(PyObject *) PyUnicode_InternFromString( - const char *u /* UTF-8 encoded string */ - ); -#ifndef Py_LIMITED_API -PyAPI_FUNC(void) _Py_ReleaseInternedUnicodeStrings(void); -#endif - -/* Use only if you know it's a string */ -#define PyUnicode_CHECK_INTERNED(op) \ - (((PyASCIIObject *)(op))->state.interned) /* --- wchar_t support for platforms which support it --------------------- */ #ifdef HAVE_WCHAR_H - -/* Create a Unicode Object from the wchar_t buffer w of the given - size. - - The buffer is copied into the new object. */ - -PyAPI_FUNC(PyObject*) PyUnicode_FromWideChar( - const wchar_t *w, /* wchar_t buffer */ - Py_ssize_t size /* size of buffer */ - ); - -/* Copies the Unicode Object contents into the wchar_t buffer w. At - most size wchar_t characters are copied. - - Note that the resulting wchar_t string may or may not be - 0-terminated. It is the responsibility of the caller to make sure - that the wchar_t string is 0-terminated in case this is required by - the application. - - Returns the number of wchar_t characters copied (excluding a - possibly trailing 0-termination character) or -1 in case of an - error. */ - -PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar( - PyObject *unicode, /* Unicode object */ - wchar_t *w, /* wchar_t buffer */ - Py_ssize_t size /* size of buffer */ - ); - -/* Convert the Unicode object to a wide character string. The output string - always ends with a nul character. If size is not NULL, write the number of - wide characters (excluding the null character) into *size. - - Returns a buffer allocated by PyMem_Malloc() (use PyMem_Free() to free it) - on success. On error, returns NULL, *size is undefined and raises a - MemoryError. */ - -PyAPI_FUNC(wchar_t*) PyUnicode_AsWideCharString( - PyObject *unicode, /* Unicode object */ - Py_ssize_t *size /* number of characters of the result */ - ); - -#ifndef Py_LIMITED_API PyAPI_FUNC(void*) _PyUnicode_AsKind(PyObject *s, unsigned int kind); #endif -#endif - -/* --- Unicode ordinals --------------------------------------------------- */ - -/* Create a Unicode Object from the given Unicode code point ordinal. - - The ordinal must be in range(0x110000). A ValueError is - raised in case it is not. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal); - -/* --- Free-list management ----------------------------------------------- */ - -/* Clear the free list used by the Unicode implementation. - - This can be used to release memory used for objects on the free - list back to the Python memory allocator. - -*/ - -PyAPI_FUNC(int) PyUnicode_ClearFreeList(void); - -/* === Builtin Codecs ===================================================== - - Many of these APIs take two arguments encoding and errors. These - parameters encoding and errors have the same semantics as the ones - of the builtin str() API. - - Setting encoding to NULL causes the default encoding (UTF-8) to be used. - - Error handling is set by errors which may also be set to NULL - meaning to use the default handling defined for the codec. Default - error handling for all builtin codecs is "strict" (ValueErrors are - raised). - - The codecs all use a similar interface. Only deviation from the - generic ones are documented. - -*/ - /* --- Manage the default encoding ---------------------------------------- */ /* Returns a pointer to the default encoding (UTF-8) of the @@ -1121,12 +754,11 @@ PyAPI_FUNC(int) PyUnicode_ClearFreeList(void); *** please use PyUnicode_AsUTF8String() instead. */ -#ifndef Py_LIMITED_API -PyAPI_FUNC(char *) PyUnicode_AsUTF8AndSize( +PyAPI_FUNC(const char *) PyUnicode_AsUTF8AndSize( PyObject *unicode, Py_ssize_t *size); + #define _PyUnicode_AsStringAndSize PyUnicode_AsUTF8AndSize -#endif /* Returns a pointer to the default encoding (UTF-8) of the Unicode object unicode. @@ -1148,284 +780,67 @@ PyAPI_FUNC(char *) PyUnicode_AsUTF8AndSize( */ -#ifndef Py_LIMITED_API -PyAPI_FUNC(char *) PyUnicode_AsUTF8(PyObject *unicode); +PyAPI_FUNC(const char *) PyUnicode_AsUTF8(PyObject *unicode); + #define _PyUnicode_AsString PyUnicode_AsUTF8 -#endif - -/* Returns "utf-8". */ - -PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void); /* --- Generic Codecs ----------------------------------------------------- */ -/* Create a Unicode object by decoding the encoded string s of the - given size. */ - -PyAPI_FUNC(PyObject*) PyUnicode_Decode( - const char *s, /* encoded string */ - Py_ssize_t size, /* size of buffer */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Decode a Unicode object unicode and return the result as Python - object. */ - -PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedObject( - PyObject *unicode, /* Unicode object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Decode a Unicode object unicode and return the result as Unicode - object. */ - -PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedUnicode( - PyObject *unicode, /* Unicode object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - /* Encodes a Py_UNICODE buffer of the given size and returns a Python string object. */ - -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject*) PyUnicode_Encode( +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_Encode( const Py_UNICODE *s, /* Unicode char buffer */ Py_ssize_t size, /* number of Py_UNICODE chars to encode */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); -#endif - -/* Encodes a Unicode object and returns the result as Python - object. */ - -PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject( - PyObject *unicode, /* Unicode object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a Unicode object and returns the result as Python string - object. */ - -PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString( - PyObject *unicode, /* Unicode object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a Unicode object and returns the result as Unicode - object. */ - -PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedUnicode( - PyObject *unicode, /* Unicode object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Build an encoding map. */ - -PyAPI_FUNC(PyObject*) PyUnicode_BuildEncodingMap( - PyObject* string /* 256 character map */ - ); /* --- UTF-7 Codecs ------------------------------------------------------- */ -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7( - const char *string, /* UTF-7 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful( - const char *string, /* UTF-7 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - Py_ssize_t *consumed /* bytes consumed */ - ); - -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7( +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ int base64SetO, /* Encode RFC2152 Set O characters in base64 */ int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */ const char *errors /* error handling */ ); + PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF7( PyObject *unicode, /* Unicode object */ int base64SetO, /* Encode RFC2152 Set O characters in base64 */ int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */ const char *errors /* error handling */ ); -#endif /* --- UTF-8 Codecs ------------------------------------------------------- */ -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8( - const char *string, /* UTF-8 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful( - const char *string, /* UTF-8 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - Py_ssize_t *consumed /* bytes consumed */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String( - PyObject *unicode /* Unicode object */ - ); - -#ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyUnicode_AsUTF8String( PyObject *unicode, const char *errors); -PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ const char *errors /* error handling */ ); -#endif /* --- UTF-32 Codecs ------------------------------------------------------ */ -/* Decodes length bytes from a UTF-32 encoded buffer string and returns - the corresponding Unicode object. - - errors (if non-NULL) defines the error handling. It defaults - to "strict". - - If byteorder is non-NULL, the decoder starts decoding using the - given byte order: - - *byteorder == -1: little endian - *byteorder == 0: native order - *byteorder == 1: big endian - - In native mode, the first four bytes of the stream are checked for a - BOM mark. If found, the BOM mark is analysed, the byte order - adjusted and the BOM skipped. In the other modes, no BOM mark - interpretation is done. After completion, *byteorder is set to the - current byte order at the end of input data. - - If byteorder is NULL, the codec starts in native order mode. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32( - const char *string, /* UTF-32 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - int *byteorder /* pointer to byteorder to use - 0=native;-1=LE,1=BE; updated on - exit */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful( - const char *string, /* UTF-32 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - int *byteorder, /* pointer to byteorder to use - 0=native;-1=LE,1=BE; updated on - exit */ - Py_ssize_t *consumed /* bytes consumed */ - ); - -/* Returns a Python string using the UTF-32 encoding in native byte - order. The string always starts with a BOM mark. */ - -PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String( - PyObject *unicode /* Unicode object */ - ); - -/* Returns a Python string object holding the UTF-32 encoded value of - the Unicode data. - - If byteorder is not 0, output is written according to the following - byte order: - - byteorder == -1: little endian - byteorder == 0: native byte order (writes a BOM mark) - byteorder == 1: big endian - - If byteorder is 0, the output string will always start with the - Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is - prepended. - -*/ - -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32( +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ const char *errors, /* error handling */ int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ ); + PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF32( PyObject *object, /* Unicode object */ const char *errors, /* error handling */ int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ ); -#endif /* --- UTF-16 Codecs ------------------------------------------------------ */ -/* Decodes length bytes from a UTF-16 encoded buffer string and returns - the corresponding Unicode object. - - errors (if non-NULL) defines the error handling. It defaults - to "strict". - - If byteorder is non-NULL, the decoder starts decoding using the - given byte order: - - *byteorder == -1: little endian - *byteorder == 0: native order - *byteorder == 1: big endian - - In native mode, the first two bytes of the stream are checked for a - BOM mark. If found, the BOM mark is analysed, the byte order - adjusted and the BOM skipped. In the other modes, no BOM mark - interpretation is done. After completion, *byteorder is set to the - current byte order at the end of input data. - - If byteorder is NULL, the codec starts in native order mode. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16( - const char *string, /* UTF-16 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - int *byteorder /* pointer to byteorder to use - 0=native;-1=LE,1=BE; updated on - exit */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful( - const char *string, /* UTF-16 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - int *byteorder, /* pointer to byteorder to use - 0=native;-1=LE,1=BE; updated on - exit */ - Py_ssize_t *consumed /* bytes consumed */ - ); - -/* Returns a Python string using the UTF-16 encoding in native byte - order. The string always starts with a BOM mark. */ - -PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( - PyObject *unicode /* Unicode object */ - ); - /* Returns a Python string object holding the UTF-16 encoded value of the Unicode data. @@ -1445,246 +860,112 @@ PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( at a later point without compromising the APIs. */ - -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16( +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ const char *errors, /* error handling */ int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ ); + PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF16( PyObject* unicode, /* Unicode object */ const char *errors, /* error handling */ int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ ); -#endif /* --- Unicode-Escape Codecs ---------------------------------------------- */ -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape( - const char *string, /* Unicode-Escape encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); +/* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape + chars. */ +PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscape( + const char *string, /* Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + const char **first_invalid_escape /* on return, points to first + invalid escaped char in + string. */ +); -PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( - PyObject *unicode /* Unicode object */ - ); - -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape( +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length /* Number of Py_UNICODE chars to encode */ ); -#endif /* --- Raw-Unicode-Escape Codecs ------------------------------------------ */ -PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape( - const char *string, /* Raw-Unicode-Escape encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString( - PyObject *unicode /* Unicode object */ - ); - -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape( +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length /* Number of Py_UNICODE chars to encode */ ); -#endif -/* --- Unicode Internal Codec --------------------------------------------- +/* --- Latin-1 Codecs ----------------------------------------------------- */ - Only for internal use in _codecsmodule.c */ - -#ifndef Py_LIMITED_API -PyObject *_PyUnicode_DecodeUnicodeInternal( - const char *string, - Py_ssize_t length, - const char *errors - ); -#endif - -/* --- Latin-1 Codecs ----------------------------------------------------- - - Note: Latin-1 corresponds to the first 256 Unicode ordinals. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1( - const char *string, /* Latin-1 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String( - PyObject *unicode /* Unicode object */ - ); - -#ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyUnicode_AsLatin1String( PyObject* unicode, const char* errors); -PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1( +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ const char *errors /* error handling */ ); -#endif -/* --- ASCII Codecs ------------------------------------------------------- +/* --- ASCII Codecs ------------------------------------------------------- */ - Only 7-bit ASCII data is excepted. All other codes generate errors. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII( - const char *string, /* ASCII encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString( - PyObject *unicode /* Unicode object */ - ); - -#ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyUnicode_AsASCIIString( PyObject* unicode, const char* errors); -PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ const char *errors /* error handling */ ); -#endif -/* --- Character Map Codecs ----------------------------------------------- +/* --- Character Map Codecs ----------------------------------------------- */ - This codec uses mappings to encode and decode characters. - - Decoding mappings must map single string characters to single - Unicode characters, integers (which are then interpreted as Unicode - ordinals) or None (meaning "undefined mapping" and causing an - error). - - Encoding mappings must map single Unicode characters to single - string characters, integers (which are then interpreted as Latin-1 - ordinals) or None (meaning "undefined mapping" and causing an - error). - - If a character lookup fails with a LookupError, the character is - copied as-is meaning that its ordinal value will be interpreted as - Unicode or Latin-1 ordinal resp. Because of this mappings only need - to contain those mappings which map characters to different code - points. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap( - const char *string, /* Encoded string */ - Py_ssize_t length, /* size of string */ - PyObject *mapping, /* character mapping - (char ordinal -> unicode ordinal) */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString( - PyObject *unicode, /* Unicode object */ - PyObject *mapping /* character mapping - (unicode ordinal -> char ordinal) */ - ); - -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ - PyObject *mapping, /* character mapping - (unicode ordinal -> char ordinal) */ + PyObject *mapping, /* encoding mapping */ const char *errors /* error handling */ ); + PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap( PyObject *unicode, /* Unicode object */ - PyObject *mapping, /* character mapping - (unicode ordinal -> char ordinal) */ + PyObject *mapping, /* encoding mapping */ const char *errors /* error handling */ ); -#endif /* Translate a Py_UNICODE buffer of the given length by applying a character mapping table to it and return the resulting Unicode object. - The mapping table must map Unicode ordinal integers to Unicode - ordinal integers or None (causing deletion of the character). + The mapping table must map Unicode ordinal integers to Unicode strings, + Unicode ordinal integers or None (causing deletion of the character). Mapping tables may be dictionaries or sequences. Unmapped character ordinals (ones which cause a LookupError) are left untouched and are copied as-is. */ - -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap( +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ PyObject *table, /* Translate table */ const char *errors /* error handling */ ); -#endif - -#ifdef HAVE_MBCS /* --- MBCS codecs for Windows -------------------------------------------- */ -PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCS( - const char *string, /* MBCS encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCSStateful( - const char *string, /* MBCS encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - Py_ssize_t *consumed /* bytes consumed */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeCodePageStateful( - int code_page, /* code page number */ - const char *string, /* encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - Py_ssize_t *consumed /* bytes consumed */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString( - PyObject *unicode /* Unicode object */ - ); - -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS( +#ifdef MS_WINDOWS +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ const char *errors /* error handling */ ); #endif -PyAPI_FUNC(PyObject*) PyUnicode_EncodeCodePage( - int code_page, /* code page number */ - PyObject *unicode, /* Unicode object */ - const char *errors /* error handling */ - ); - -#endif /* HAVE_MBCS */ - /* --- Decimal Encoder ---------------------------------------------------- */ /* Takes a Unicode string holding a decimal value and writes it into @@ -1709,14 +990,12 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeCodePage( */ -#ifndef Py_LIMITED_API -PyAPI_FUNC(int) PyUnicode_EncodeDecimal( +/* Py_DEPRECATED(3.3) */ PyAPI_FUNC(int) PyUnicode_EncodeDecimal( Py_UNICODE *s, /* Unicode buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ char *output, /* Output buffer; must have size >= length */ const char *errors /* error handling */ ); -#endif /* Transforms code points that have decimal digit property to the corresponding ASCII digit code points. @@ -1724,367 +1003,72 @@ PyAPI_FUNC(int) PyUnicode_EncodeDecimal( Returns a new Unicode string on success, NULL on failure. */ -#ifndef Py_LIMITED_API +/* Py_DEPRECATED(3.3) */ PyAPI_FUNC(PyObject*) PyUnicode_TransformDecimalToASCII( Py_UNICODE *s, /* Unicode buffer */ Py_ssize_t length /* Number of Py_UNICODE chars to transform */ ); -#endif -/* Similar to PyUnicode_TransformDecimalToASCII(), but takes a PyObject - as argument instead of a raw buffer and length. This function additionally - transforms spaces to ASCII because this is what the callers in longobject, - floatobject, and complexobject did anyways. */ +/* Coverts a Unicode object holding a decimal value to an ASCII string + for using in int, float and complex parsers. + Transforms code points that have decimal digit property to the + corresponding ASCII digit code points. Transforms spaces to ASCII. + Transforms code points starting from the first non-ASCII code point that + is neither a decimal digit nor a space to the end into '?'. */ -#ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyUnicode_TransformDecimalAndSpaceToASCII( PyObject *unicode /* Unicode object */ ); -#endif -/* --- Locale encoding --------------------------------------------------- */ +/* --- Methods & Slots ---------------------------------------------------- */ -/* Decode a string from the current locale encoding. The decoder is strict if - *surrogateescape* is equal to zero, otherwise it uses the 'surrogateescape' - error handler (PEP 383) to escape undecodable bytes. If a byte sequence can - be decoded as a surrogate character and *surrogateescape* is not equal to - zero, the byte sequence is escaped using the 'surrogateescape' error handler - instead of being decoded. *str* must end with a null character but cannot - contain embedded null characters. */ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeLocaleAndSize( - const char *str, - Py_ssize_t len, - const char *errors); - -/* Similar to PyUnicode_DecodeLocaleAndSize(), but compute the string - length using strlen(). */ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeLocale( - const char *str, - const char *errors); - -/* Encode a Unicode object to the current locale encoding. The encoder is - strict is *surrogateescape* is equal to zero, otherwise the - "surrogateescape" error handler is used. Return a bytes object. The string - cannot contain embedded null characters. */ - -PyAPI_FUNC(PyObject*) PyUnicode_EncodeLocale( - PyObject *unicode, - const char *errors +PyAPI_FUNC(PyObject *) _PyUnicode_JoinArray( + PyObject *separator, + PyObject *const *items, + Py_ssize_t seqlen ); -/* --- File system encoding ---------------------------------------------- */ - -/* ParseTuple converter: encode str objects to bytes using - PyUnicode_EncodeFSDefault(); bytes objects are output as-is. */ - -PyAPI_FUNC(int) PyUnicode_FSConverter(PyObject*, void*); - -/* ParseTuple converter: decode bytes objects to unicode using - PyUnicode_DecodeFSDefaultAndSize(); str objects are output as-is. */ - -PyAPI_FUNC(int) PyUnicode_FSDecoder(PyObject*, void*); - -/* Decode a null-terminated string using Py_FileSystemDefaultEncoding - and the "surrogateescape" error handler. - - If Py_FileSystemDefaultEncoding is not set, fall back to the locale - encoding. - - Use PyUnicode_DecodeFSDefaultAndSize() if the string length is known. -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefault( - const char *s /* encoded string */ - ); - -/* Decode a string using Py_FileSystemDefaultEncoding - and the "surrogateescape" error handler. - - If Py_FileSystemDefaultEncoding is not set, fall back to the locale - encoding. -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefaultAndSize( - const char *s, /* encoded string */ - Py_ssize_t size /* size */ - ); - -/* Encode a Unicode object to Py_FileSystemDefaultEncoding with the - "surrogateescape" error handler, and return bytes. - - If Py_FileSystemDefaultEncoding is not set, fall back to the locale - encoding. -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_EncodeFSDefault( - PyObject *unicode - ); - -/* --- Methods & Slots ---------------------------------------------------- - - These are capable of handling Unicode objects and strings on input - (we refer to them as strings in the descriptions) and return - Unicode objects or integers as appropriate. */ - -/* Concat two strings giving a new Unicode string. */ - -PyAPI_FUNC(PyObject*) PyUnicode_Concat( - PyObject *left, /* Left string */ - PyObject *right /* Right string */ - ); - -/* Concat two strings and put the result in *pleft - (sets *pleft to NULL on error) */ - -PyAPI_FUNC(void) PyUnicode_Append( - PyObject **pleft, /* Pointer to left string */ - PyObject *right /* Right string */ - ); - -/* Concat two strings, put the result in *pleft and drop the right object - (sets *pleft to NULL on error) */ - -PyAPI_FUNC(void) PyUnicode_AppendAndDel( - PyObject **pleft, /* Pointer to left string */ - PyObject *right /* Right string */ - ); - -/* Split a string giving a list of Unicode strings. - - If sep is NULL, splitting will be done at all whitespace - substrings. Otherwise, splits occur at the given separator. - - At most maxsplit splits will be done. If negative, no limit is set. - - Separators are not included in the resulting list. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_Split( - PyObject *s, /* String to split */ - PyObject *sep, /* String separator */ - Py_ssize_t maxsplit /* Maxsplit count */ - ); - -/* Dito, but split at line breaks. - - CRLF is considered to be one line break. Line breaks are not - included in the resulting list. */ - -PyAPI_FUNC(PyObject*) PyUnicode_Splitlines( - PyObject *s, /* String to split */ - int keepends /* If true, line end markers are included */ - ); - -/* Partition a string using a given separator. */ - -PyAPI_FUNC(PyObject*) PyUnicode_Partition( - PyObject *s, /* String to partition */ - PyObject *sep /* String separator */ - ); - -/* Partition a string using a given separator, searching from the end of the - string. */ - -PyAPI_FUNC(PyObject*) PyUnicode_RPartition( - PyObject *s, /* String to partition */ - PyObject *sep /* String separator */ - ); - -/* Split a string giving a list of Unicode strings. - - If sep is NULL, splitting will be done at all whitespace - substrings. Otherwise, splits occur at the given separator. - - At most maxsplit splits will be done. But unlike PyUnicode_Split - PyUnicode_RSplit splits from the end of the string. If negative, - no limit is set. - - Separators are not included in the resulting list. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_RSplit( - PyObject *s, /* String to split */ - PyObject *sep, /* String separator */ - Py_ssize_t maxsplit /* Maxsplit count */ - ); - -/* Translate a string by applying a character mapping table to it and - return the resulting Unicode object. - - The mapping table must map Unicode ordinal integers to Unicode - ordinal integers or None (causing deletion of the character). - - Mapping tables may be dictionaries or sequences. Unmapped character - ordinals (ones which cause a LookupError) are left untouched and - are copied as-is. - -*/ - -PyAPI_FUNC(PyObject *) PyUnicode_Translate( - PyObject *str, /* String */ - PyObject *table, /* Translate table */ - const char *errors /* error handling */ - ); - -/* Join a sequence of strings using the given separator and return - the resulting Unicode string. */ - -PyAPI_FUNC(PyObject*) PyUnicode_Join( - PyObject *separator, /* Separator string */ - PyObject *seq /* Sequence object */ - ); - -/* Return 1 if substr matches str[start:end] at the given tail end, 0 - otherwise. */ - -PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch( - PyObject *str, /* String */ - PyObject *substr, /* Prefix or Suffix string */ - Py_ssize_t start, /* Start index */ - Py_ssize_t end, /* Stop index */ - int direction /* Tail end: -1 prefix, +1 suffix */ - ); - -/* Return the first position of substr in str[start:end] using the - given search direction or -1 if not found. -2 is returned in case - an error occurred and an exception is set. */ - -PyAPI_FUNC(Py_ssize_t) PyUnicode_Find( - PyObject *str, /* String */ - PyObject *substr, /* Substring to find */ - Py_ssize_t start, /* Start index */ - Py_ssize_t end, /* Stop index */ - int direction /* Find direction: +1 forward, -1 backward */ - ); - -/* Like PyUnicode_Find, but search for single character only. */ -PyAPI_FUNC(Py_ssize_t) PyUnicode_FindChar( - PyObject *str, - Py_UCS4 ch, - Py_ssize_t start, - Py_ssize_t end, - int direction - ); - -/* Count the number of occurrences of substr in str[start:end]. */ - -PyAPI_FUNC(Py_ssize_t) PyUnicode_Count( - PyObject *str, /* String */ - PyObject *substr, /* Substring to count */ - Py_ssize_t start, /* Start index */ - Py_ssize_t end /* Stop index */ - ); - -/* Replace at most maxcount occurrences of substr in str with replstr - and return the resulting Unicode object. */ - -PyAPI_FUNC(PyObject *) PyUnicode_Replace( - PyObject *str, /* String */ - PyObject *substr, /* Substring to find */ - PyObject *replstr, /* Substring to replace */ - Py_ssize_t maxcount /* Max. number of replacements to apply; - -1 = all */ - ); - -/* Compare two strings and return -1, 0, 1 for less than, equal, - greater than resp. - Raise an exception and return -1 on error. */ - -PyAPI_FUNC(int) PyUnicode_Compare( - PyObject *left, /* Left string */ - PyObject *right /* Right string */ - ); - -#ifndef Py_LIMITED_API -PyAPI_FUNC(int) _PyUnicode_CompareWithId( +/* Test whether a unicode is equal to ASCII identifier. Return 1 if true, + 0 otherwise. The right argument must be ASCII identifier. + Any error occurs inside will be cleared before return. */ +PyAPI_FUNC(int) _PyUnicode_EqualToASCIIId( PyObject *left, /* Left string */ _Py_Identifier *right /* Right identifier */ ); -#endif -PyAPI_FUNC(int) PyUnicode_CompareWithASCIIString( +/* Test whether a unicode is equal to ASCII string. Return 1 if true, + 0 otherwise. The right argument must be ASCII-encoded string. + Any error occurs inside will be cleared before return. */ +PyAPI_FUNC(int) _PyUnicode_EqualToASCIIString( PyObject *left, const char *right /* ASCII-encoded string */ ); -/* Rich compare two strings and return one of the following: - - - NULL in case an exception was raised - - Py_True or Py_False for successfully comparisons - - Py_NotImplemented in case the type combination is unknown - - Note that Py_EQ and Py_NE comparisons can cause a UnicodeWarning in - case the conversion of the arguments to Unicode fails with a - UnicodeDecodeError. - - Possible values for op: - - Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE - -*/ - -PyAPI_FUNC(PyObject *) PyUnicode_RichCompare( - PyObject *left, /* Left string */ - PyObject *right, /* Right string */ - int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */ - ); - -/* Apply an argument tuple or dictionary to a format string and return - the resulting Unicode string. */ - -PyAPI_FUNC(PyObject *) PyUnicode_Format( - PyObject *format, /* Format string */ - PyObject *args /* Argument tuple or dictionary */ - ); - -/* Checks whether element is contained in container and return 1/0 - accordingly. - - element has to coerce to a one element Unicode string. -1 is - returned in case of an error. */ - -PyAPI_FUNC(int) PyUnicode_Contains( - PyObject *container, /* Container string */ - PyObject *element /* Element string */ - ); - -/* Checks whether argument is a valid identifier. */ - -PyAPI_FUNC(int) PyUnicode_IsIdentifier(PyObject *s); - -#ifndef Py_LIMITED_API /* Externally visible for str.strip(unicode) */ PyAPI_FUNC(PyObject *) _PyUnicode_XStrip( PyObject *self, int striptype, PyObject *sepobj ); -#endif /* Using explicit passed-in values, insert the thousands grouping into the string pointed to by buffer. For the argument descriptions, see Objects/stringlib/localeutil.h */ -#ifndef Py_LIMITED_API PyAPI_FUNC(Py_ssize_t) _PyUnicode_InsertThousandsGrouping( - PyObject *unicode, - Py_ssize_t index, + _PyUnicodeWriter *writer, Py_ssize_t n_buffer, - void *digits, + PyObject *digits, + Py_ssize_t d_pos, Py_ssize_t n_digits, Py_ssize_t min_width, const char *grouping, PyObject *thousands_sep, Py_UCS4 *maxchar); -#endif + /* === Characters Type APIs =============================================== */ /* Helper array used by Py_UNICODE_ISSPACE(). */ -#ifndef Py_LIMITED_API PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[]; /* These should not be used directly. Use the Py_UNICODE_IS* and @@ -2122,15 +1106,15 @@ PyAPI_FUNC(int) _PyUnicode_IsLinebreak( const Py_UCS4 ch /* Unicode character */ ); -PyAPI_FUNC(Py_UCS4) _PyUnicode_ToLowercase( +/* Py_DEPRECATED(3.3) */ PyAPI_FUNC(Py_UCS4) _PyUnicode_ToLowercase( Py_UCS4 ch /* Unicode character */ ); -PyAPI_FUNC(Py_UCS4) _PyUnicode_ToUppercase( +/* Py_DEPRECATED(3.3) */ PyAPI_FUNC(Py_UCS4) _PyUnicode_ToUppercase( Py_UCS4 ch /* Unicode character */ ); -PyAPI_FUNC(Py_UCS4) _PyUnicode_ToTitlecase( +Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UCS4) _PyUnicode_ToTitlecase( Py_UCS4 ch /* Unicode character */ ); @@ -2194,39 +1178,39 @@ PyAPI_FUNC(int) _PyUnicode_IsAlpha( Py_UCS4 ch /* Unicode character */ ); -PyAPI_FUNC(size_t) Py_UNICODE_strlen( +Py_DEPRECATED(3.3) PyAPI_FUNC(size_t) Py_UNICODE_strlen( const Py_UNICODE *u ); -PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcpy( +Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcpy( Py_UNICODE *s1, const Py_UNICODE *s2); -PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcat( +Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcat( Py_UNICODE *s1, const Py_UNICODE *s2); -PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strncpy( +Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strncpy( Py_UNICODE *s1, const Py_UNICODE *s2, size_t n); -PyAPI_FUNC(int) Py_UNICODE_strcmp( +Py_DEPRECATED(3.3) PyAPI_FUNC(int) Py_UNICODE_strcmp( const Py_UNICODE *s1, const Py_UNICODE *s2 ); -PyAPI_FUNC(int) Py_UNICODE_strncmp( +Py_DEPRECATED(3.3) PyAPI_FUNC(int) Py_UNICODE_strncmp( const Py_UNICODE *s1, const Py_UNICODE *s2, size_t n ); -PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strchr( +Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strchr( const Py_UNICODE *s, Py_UNICODE c ); -PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strrchr( +Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strrchr( const Py_UNICODE *s, Py_UNICODE c ); @@ -2237,23 +1221,19 @@ PyAPI_FUNC(PyObject*) _PyUnicode_FormatLong(PyObject *, int, int, int); and raise a MemoryError exception on memory allocation failure, otherwise return a new allocated buffer (use PyMem_Free() to free the buffer). */ -PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy( +Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy( PyObject *unicode ); -#endif /* Py_LIMITED_API */ - -#if defined(Py_DEBUG) && !defined(Py_LIMITED_API) -PyAPI_FUNC(int) _PyUnicode_CheckConsistency( - PyObject *op, - int check_content); -#endif /* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/ PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*); /* Clear all static strings. */ PyAPI_FUNC(void) _PyUnicode_ClearStaticStrings(void); +/* Fast equality check when the inputs are known to be exact unicode types + and where the hash values are equal (i.e. a very probable match) */ +PyAPI_FUNC(int) _PyUnicode_EQ(PyObject *, PyObject *); + #ifdef __cplusplus } #endif -#endif /* !Py_UNICODEOBJECT_H */ diff --git a/openflow/usr/include/python3.5m/datetime.h b/openflow/include/python3.8/datetime.h similarity index 83% rename from openflow/usr/include/python3.5m/datetime.h rename to openflow/include/python3.8/datetime.h index 06cbc4a..00507cb 100644 --- a/openflow/usr/include/python3.5m/datetime.h +++ b/openflow/include/python3.8/datetime.h @@ -81,6 +81,7 @@ typedef struct typedef struct { _PyDateTime_TIMEHEAD + unsigned char fold; PyObject *tzinfo; } PyDateTime_Time; /* hastzinfo true */ @@ -108,6 +109,7 @@ typedef struct typedef struct { _PyDateTime_DATETIMEHEAD + unsigned char fold; PyObject *tzinfo; } PyDateTime_DateTime; /* hastzinfo true */ @@ -125,6 +127,7 @@ typedef struct ((((PyDateTime_DateTime*)o)->data[7] << 16) | \ (((PyDateTime_DateTime*)o)->data[8] << 8) | \ ((PyDateTime_DateTime*)o)->data[9]) +#define PyDateTime_DATE_GET_FOLD(o) (((PyDateTime_DateTime*)o)->fold) /* Apply for time instances. */ #define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0]) @@ -134,6 +137,7 @@ typedef struct ((((PyDateTime_Time*)o)->data[3] << 16) | \ (((PyDateTime_Time*)o)->data[4] << 8) | \ ((PyDateTime_Time*)o)->data[5]) +#define PyDateTime_TIME_GET_FOLD(o) (((PyDateTime_Time*)o)->fold) /* Apply for time delta instances */ #define PyDateTime_DELTA_GET_DAYS(o) (((PyDateTime_Delta*)o)->days) @@ -151,48 +155,45 @@ typedef struct { PyTypeObject *DeltaType; PyTypeObject *TZInfoType; + /* singletons */ + PyObject *TimeZone_UTC; + /* constructors */ PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*); PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int, PyObject*, PyTypeObject*); PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*); PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*); + PyObject *(*TimeZone_FromTimeZone)(PyObject *offset, PyObject *name); /* constructors for the DB API */ PyObject *(*DateTime_FromTimestamp)(PyObject*, PyObject*, PyObject*); PyObject *(*Date_FromTimestamp)(PyObject*, PyObject*); + /* PEP 495 constructors */ + PyObject *(*DateTime_FromDateAndTimeAndFold)(int, int, int, int, int, int, int, + PyObject*, int, PyTypeObject*); + PyObject *(*Time_FromTimeAndFold)(int, int, int, int, PyObject*, int, PyTypeObject*); + } PyDateTime_CAPI; #define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI" -#ifdef Py_BUILD_CORE - -/* Macros for type checking when building the Python core. */ -#define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType) -#define PyDate_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateType) - -#define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType) -#define PyDateTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateTimeType) - -#define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType) -#define PyTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TimeType) - -#define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType) -#define PyDelta_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DeltaType) - -#define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType) -#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TZInfoType) - -#else - +/* This block is only used as part of the public API and should not be + * included in _datetimemodule.c, which does not use the C API capsule. + * See bpo-35081 for more details. + * */ +#ifndef _PY_DATETIME_IMPL /* Define global variable for the C API and a macro for setting it. */ static PyDateTime_CAPI *PyDateTimeAPI = NULL; #define PyDateTime_IMPORT \ PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0) +/* Macro for access to the UTC singleton */ +#define PyDateTime_TimeZone_UTC PyDateTimeAPI->TimeZone_UTC + /* Macros for type checking when not building the Python core. */ #define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType) #define PyDate_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateType) @@ -209,6 +210,7 @@ static PyDateTime_CAPI *PyDateTimeAPI = NULL; #define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType) #define PyTZInfo_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TZInfoType) + /* Macros for accessing constructors in a simplified fashion. */ #define PyDate_FromDate(year, month, day) \ PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType) @@ -217,14 +219,28 @@ static PyDateTime_CAPI *PyDateTimeAPI = NULL; PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \ min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType) +#define PyDateTime_FromDateAndTimeAndFold(year, month, day, hour, min, sec, usec, fold) \ + PyDateTimeAPI->DateTime_FromDateAndTimeAndFold(year, month, day, hour, \ + min, sec, usec, Py_None, fold, PyDateTimeAPI->DateTimeType) + #define PyTime_FromTime(hour, minute, second, usecond) \ PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \ Py_None, PyDateTimeAPI->TimeType) +#define PyTime_FromTimeAndFold(hour, minute, second, usecond, fold) \ + PyDateTimeAPI->Time_FromTimeAndFold(hour, minute, second, usecond, \ + Py_None, fold, PyDateTimeAPI->TimeType) + #define PyDelta_FromDSU(days, seconds, useconds) \ PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \ PyDateTimeAPI->DeltaType) +#define PyTimeZone_FromOffset(offset) \ + PyDateTimeAPI->TimeZone_FromTimeZone(offset, NULL) + +#define PyTimeZone_FromOffsetAndName(offset, name) \ + PyDateTimeAPI->TimeZone_FromTimeZone(offset, name) + /* Macros supporting the DB API. */ #define PyDateTime_FromTimestamp(args) \ PyDateTimeAPI->DateTime_FromTimestamp( \ @@ -234,7 +250,7 @@ static PyDateTime_CAPI *PyDateTimeAPI = NULL; PyDateTimeAPI->Date_FromTimestamp( \ (PyObject*) (PyDateTimeAPI->DateType), args) -#endif /* Py_BUILD_CORE */ +#endif /* !defined(_PY_DATETIME_IMPL) */ #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/descrobject.h b/openflow/include/python3.8/descrobject.h similarity index 94% rename from openflow/usr/include/python3.5m/descrobject.h rename to openflow/include/python3.8/descrobject.h index e2ba97f..ead269d 100644 --- a/openflow/usr/include/python3.5m/descrobject.h +++ b/openflow/include/python3.8/descrobject.h @@ -9,10 +9,10 @@ typedef PyObject *(*getter)(PyObject *, void *); typedef int (*setter)(PyObject *, PyObject *, void *); typedef struct PyGetSetDef { - char *name; + const char *name; getter get; setter set; - char *doc; + const char *doc; void *closure; } PyGetSetDef; @@ -24,11 +24,11 @@ typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, void *wrapped, PyObject *kwds); struct wrapperbase { - char *name; + const char *name; int offset; void *function; wrapperfunc wrapper; - char *doc; + const char *doc; int flags; PyObject *name_strobj; }; @@ -53,6 +53,7 @@ typedef struct { typedef struct { PyDescr_COMMON; PyMethodDef *d_method; + vectorcallfunc vectorcall; } PyMethodDescrObject; typedef struct { @@ -78,7 +79,9 @@ PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; PyAPI_DATA(PyTypeObject) PyMethodDescr_Type; PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; PyAPI_DATA(PyTypeObject) PyDictProxy_Type; +#ifndef Py_LIMITED_API PyAPI_DATA(PyTypeObject) _PyMethodWrapper_Type; +#endif /* Py_LIMITED_API */ PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *); diff --git a/openflow/usr/include/python3.5m/dictobject.h b/openflow/include/python3.8/dictobject.h similarity index 51% rename from openflow/usr/include/python3.5m/dictobject.h rename to openflow/include/python3.8/dictobject.h index ba90aaf..b37573a 100644 --- a/openflow/usr/include/python3.5m/dictobject.h +++ b/openflow/include/python3.8/dictobject.h @@ -4,7 +4,6 @@ extern "C" { #endif - /* Dictionary object type -- mapping from hashable object to object */ /* The distribution includes a separate file, Objects/dictnotes.txt, @@ -13,98 +12,26 @@ extern "C" { tuning dictionaries, and several ideas for possible optimizations. */ -#ifndef Py_LIMITED_API - -typedef struct _dictkeysobject PyDictKeysObject; - -/* The ma_values pointer is NULL for a combined table - * or points to an array of PyObject* for a split table - */ -typedef struct { - PyObject_HEAD - Py_ssize_t ma_used; - PyDictKeysObject *ma_keys; - PyObject **ma_values; -} PyDictObject; - -typedef struct { - PyObject_HEAD - PyDictObject *dv_dict; -} _PyDictViewObject; - -#endif /* Py_LIMITED_API */ - PyAPI_DATA(PyTypeObject) PyDict_Type; -PyAPI_DATA(PyTypeObject) PyDictIterKey_Type; -PyAPI_DATA(PyTypeObject) PyDictIterValue_Type; -PyAPI_DATA(PyTypeObject) PyDictIterItem_Type; -PyAPI_DATA(PyTypeObject) PyDictKeys_Type; -PyAPI_DATA(PyTypeObject) PyDictItems_Type; -PyAPI_DATA(PyTypeObject) PyDictValues_Type; #define PyDict_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) -#define PyDictKeys_Check(op) PyObject_TypeCheck(op, &PyDictKeys_Type) -#define PyDictItems_Check(op) PyObject_TypeCheck(op, &PyDictItems_Type) -#define PyDictValues_Check(op) PyObject_TypeCheck(op, &PyDictValues_Type) -/* This excludes Values, since they are not sets. */ -# define PyDictViewSet_Check(op) \ - (PyDictKeys_Check(op) || PyDictItems_Check(op)) - PyAPI_FUNC(PyObject *) PyDict_New(void); PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key, - Py_hash_t hash); -#endif PyAPI_FUNC(PyObject *) PyDict_GetItemWithError(PyObject *mp, PyObject *key); -PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp, - struct _Py_Identifier *key); -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) PyDict_SetDefault( - PyObject *mp, PyObject *key, PyObject *defaultobj); -#endif PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); -#ifndef Py_LIMITED_API -PyAPI_FUNC(int) _PyDict_SetItem_KnownHash(PyObject *mp, PyObject *key, - PyObject *item, Py_hash_t hash); -#endif PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key); -#ifndef Py_LIMITED_API -PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key, - Py_hash_t hash); -#endif PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); PyAPI_FUNC(int) PyDict_Next( PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value); -#ifndef Py_LIMITED_API -PyDictKeysObject *_PyDict_NewKeysForClass(void); -PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *); -PyAPI_FUNC(int) _PyDict_Next( - PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash); -PyObject *_PyDictView_New(PyObject *, PyTypeObject *); -#endif PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp); PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp); PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key); -#ifndef Py_LIMITED_API -PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash); -PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused); -PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp); -PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp); -Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys); -Py_ssize_t _PyDict_SizeOf(PyDictObject *); -PyObject *_PyDict_Pop(PyDictObject *, PyObject *, PyObject *); -PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *); -#define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL) - -PyAPI_FUNC(int) PyDict_ClearFreeList(void); -#endif /* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other); @@ -115,12 +42,8 @@ PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other); dict.update(other) is equivalent to PyDict_Merge(dict, other, 1). */ PyAPI_FUNC(int) PyDict_Merge(PyObject *mp, - PyObject *other, - int override); - -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other); -#endif + PyObject *other, + int override); /* PyDict_MergeFromSeq2 updates/merges from an iterable object producing iterable objects of length 2. If override is true, the last occurrence @@ -128,21 +51,41 @@ PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other); is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1). */ PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d, - PyObject *seq2, - int override); + PyObject *seq2, + int override); PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key); -PyAPI_FUNC(PyObject *) _PyDict_GetItemId(PyObject *dp, struct _Py_Identifier *key); PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item); -PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, struct _Py_Identifier *key, PyObject *item); PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key); -#ifndef Py_LIMITED_API -PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, struct _Py_Identifier *key); -PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out); +/* Dictionary (keys, values, items) views */ -int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value); -PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *); +PyAPI_DATA(PyTypeObject) PyDictKeys_Type; +PyAPI_DATA(PyTypeObject) PyDictValues_Type; +PyAPI_DATA(PyTypeObject) PyDictItems_Type; + +#define PyDictKeys_Check(op) PyObject_TypeCheck(op, &PyDictKeys_Type) +#define PyDictValues_Check(op) PyObject_TypeCheck(op, &PyDictValues_Type) +#define PyDictItems_Check(op) PyObject_TypeCheck(op, &PyDictItems_Type) +/* This excludes Values, since they are not sets. */ +# define PyDictViewSet_Check(op) \ + (PyDictKeys_Check(op) || PyDictItems_Check(op)) + +/* Dictionary (key, value, items) iterators */ + +PyAPI_DATA(PyTypeObject) PyDictIterKey_Type; +PyAPI_DATA(PyTypeObject) PyDictIterValue_Type; +PyAPI_DATA(PyTypeObject) PyDictIterItem_Type; + +PyAPI_DATA(PyTypeObject) PyDictRevIterKey_Type; +PyAPI_DATA(PyTypeObject) PyDictRevIterItem_Type; +PyAPI_DATA(PyTypeObject) PyDictRevIterValue_Type; + + +#ifndef Py_LIMITED_API +# define Py_CPYTHON_DICTOBJECT_H +# include "cpython/dictobject.h" +# undef Py_CPYTHON_DICTOBJECT_H #endif #ifdef __cplusplus diff --git a/openflow/usr/include/python3.5m/dtoa.h b/openflow/include/python3.8/dtoa.h similarity index 100% rename from openflow/usr/include/python3.5m/dtoa.h rename to openflow/include/python3.8/dtoa.h diff --git a/openflow/usr/include/python3.5m/dynamic_annotations.h b/openflow/include/python3.8/dynamic_annotations.h similarity index 100% rename from openflow/usr/include/python3.5m/dynamic_annotations.h rename to openflow/include/python3.8/dynamic_annotations.h diff --git a/openflow/usr/include/python3.5m/enumobject.h b/openflow/include/python3.8/enumobject.h similarity index 100% rename from openflow/usr/include/python3.5m/enumobject.h rename to openflow/include/python3.8/enumobject.h diff --git a/openflow/include/python3.8/errcode.h b/openflow/include/python3.8/errcode.h new file mode 100644 index 0000000..b37cd26 --- /dev/null +++ b/openflow/include/python3.8/errcode.h @@ -0,0 +1,38 @@ +#ifndef Py_ERRCODE_H +#define Py_ERRCODE_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* Error codes passed around between file input, tokenizer, parser and + interpreter. This is necessary so we can turn them into Python + exceptions at a higher level. Note that some errors have a + slightly different meaning when passed from the tokenizer to the + parser than when passed from the parser to the interpreter; e.g. + the parser only returns E_EOF when it hits EOF immediately, and it + never returns E_OK. */ + +#define E_OK 10 /* No error */ +#define E_EOF 11 /* End Of File */ +#define E_INTR 12 /* Interrupted */ +#define E_TOKEN 13 /* Bad token */ +#define E_SYNTAX 14 /* Syntax error */ +#define E_NOMEM 15 /* Ran out of memory */ +#define E_DONE 16 /* Parsing complete */ +#define E_ERROR 17 /* Execution error */ +#define E_TABSPACE 18 /* Inconsistent mixing of tabs and spaces */ +#define E_OVERFLOW 19 /* Node had too many children */ +#define E_TOODEEP 20 /* Too many indentation levels */ +#define E_DEDENT 21 /* No matching outer block for dedent */ +#define E_DECODE 22 /* Error in decoding into Unicode */ +#define E_EOFS 23 /* EOF in triple-quoted string */ +#define E_EOLS 24 /* EOL in single-quoted string */ +#define E_LINECONT 25 /* Unexpected characters after a line continuation */ +#define E_IDENTIFIER 26 /* Invalid characters in identifier */ +#define E_BADSINGLE 27 /* Ill-formed single statement input */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_ERRCODE_H */ diff --git a/openflow/include/python3.8/eval.h b/openflow/include/python3.8/eval.h new file mode 100644 index 0000000..2c1c2d0 --- /dev/null +++ b/openflow/include/python3.8/eval.h @@ -0,0 +1,37 @@ + +/* Interface to execute compiled code */ + +#ifndef Py_EVAL_H +#define Py_EVAL_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *); + +PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co, + PyObject *globals, + PyObject *locals, + PyObject *const *args, int argc, + PyObject *const *kwds, int kwdc, + PyObject *const *defs, int defc, + PyObject *kwdefs, PyObject *closure); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyEval_EvalCodeWithName( + PyObject *co, + PyObject *globals, PyObject *locals, + PyObject *const *args, Py_ssize_t argcount, + PyObject *const *kwnames, PyObject *const *kwargs, + Py_ssize_t kwcount, int kwstep, + PyObject *const *defs, Py_ssize_t defcount, + PyObject *kwdefs, PyObject *closure, + PyObject *name, PyObject *qualname); + +PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_EVAL_H */ diff --git a/openflow/usr/include/python3.5m/fileobject.h b/openflow/include/python3.8/fileobject.h similarity index 67% rename from openflow/usr/include/python3.5m/fileobject.h rename to openflow/include/python3.8/fileobject.h index 03155d3..456887e 100644 --- a/openflow/usr/include/python3.5m/fileobject.h +++ b/openflow/include/python3.8/fileobject.h @@ -15,9 +15,6 @@ PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int); PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int); PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *); PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *); -#ifndef Py_LIMITED_API -PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); -#endif /* The default encoding used by the platform file system APIs If non-NULL, this is different than the default encoding for strings @@ -25,21 +22,19 @@ PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding; -/* Internal API - - The std printer acts as a preliminary sys.stderr until the new io - infrastructure is in place. */ -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int); -PyAPI_DATA(PyTypeObject) PyStdPrinter_Type; -#endif /* Py_LIMITED_API */ - /* A routine to check if a file descriptor can be select()-ed. */ -#ifdef HAVE_SELECT - #define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE)) +#ifdef _MSC_VER + /* On Windows, any socket fd can be select()-ed, no matter how high */ + #define _PyIsSelectable_fd(FD) (1) #else - #define _PyIsSelectable_fd(FD) (1) -#endif /* HAVE_SELECT */ + #define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE) +#endif + +#ifndef Py_LIMITED_API +# define Py_CPYTHON_FILEOBJECT_H +# include "cpython/fileobject.h" +# undef Py_CPYTHON_FILEOBJECT_H +#endif #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/fileutils.h b/openflow/include/python3.8/fileutils.h similarity index 54% rename from openflow/usr/include/python3.5m/fileutils.h rename to openflow/include/python3.8/fileutils.h index b4a683c..359dd0a 100644 --- a/openflow/usr/include/python3.5m/fileutils.h +++ b/openflow/include/python3.8/fileutils.h @@ -1,12 +1,10 @@ #ifndef Py_FILEUTILS_H #define Py_FILEUTILS_H - #ifdef __cplusplus extern "C" { #endif -PyAPI_FUNC(PyObject *) _Py_device_encoding(int); - +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(wchar_t *) Py_DecodeLocale( const char *arg, size_t *size); @@ -15,12 +13,64 @@ PyAPI_FUNC(char*) Py_EncodeLocale( const wchar_t *text, size_t *error_pos); +PyAPI_FUNC(char*) _Py_EncodeLocaleRaw( + const wchar_t *text, + size_t *error_pos); +#endif + + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03080000 +typedef enum { + _Py_ERROR_UNKNOWN=0, + _Py_ERROR_STRICT, + _Py_ERROR_SURROGATEESCAPE, + _Py_ERROR_REPLACE, + _Py_ERROR_IGNORE, + _Py_ERROR_BACKSLASHREPLACE, + _Py_ERROR_SURROGATEPASS, + _Py_ERROR_XMLCHARREFREPLACE, + _Py_ERROR_OTHER +} _Py_error_handler; + +PyAPI_FUNC(_Py_error_handler) _Py_GetErrorHandler(const char *errors); + +PyAPI_FUNC(int) _Py_DecodeLocaleEx( + const char *arg, + wchar_t **wstr, + size_t *wlen, + const char **reason, + int current_locale, + _Py_error_handler errors); + +PyAPI_FUNC(int) _Py_EncodeLocaleEx( + const wchar_t *text, + char **str, + size_t *error_pos, + const char **reason, + int current_locale, + _Py_error_handler errors); +#endif + #ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _Py_device_encoding(int); + +#if defined(MS_WINDOWS) || defined(__APPLE__) + /* On Windows, the count parameter of read() is an int (bpo-9015, bpo-9611). + On macOS 10.13, read() and write() with more than INT_MAX bytes + fail with EINVAL (bpo-24658). */ +# define _PY_READ_MAX INT_MAX +# define _PY_WRITE_MAX INT_MAX +#else + /* write() should truncate the input to PY_SSIZE_T_MAX bytes, + but it's safer to do it ourself to have a portable behaviour */ +# define _PY_READ_MAX PY_SSIZE_T_MAX +# define _PY_WRITE_MAX PY_SSIZE_T_MAX +#endif #ifdef MS_WINDOWS struct _Py_stat_struct { unsigned long st_dev; - __int64 st_ino; + uint64_t st_ino; unsigned short st_mode; int st_nlink; int st_uid; @@ -34,6 +84,7 @@ struct _Py_stat_struct { time_t st_ctime; int st_ctime_nsec; unsigned long st_file_attributes; + unsigned long st_reparse_tag; }; #else # define _Py_stat_struct stat @@ -46,13 +97,11 @@ PyAPI_FUNC(int) _Py_fstat( PyAPI_FUNC(int) _Py_fstat_noraise( int fd, struct _Py_stat_struct *status); -#endif /* Py_LIMITED_API */ PyAPI_FUNC(int) _Py_stat( PyObject *path, struct stat *status); -#ifndef Py_LIMITED_API PyAPI_FUNC(int) _Py_open( const char *pathname, int flags); @@ -60,7 +109,6 @@ PyAPI_FUNC(int) _Py_open( PyAPI_FUNC(int) _Py_open_noraise( const char *pathname, int flags); -#endif PyAPI_FUNC(FILE *) _Py_wfopen( const wchar_t *path, @@ -93,26 +141,34 @@ PyAPI_FUNC(Py_ssize_t) _Py_write_noraise( PyAPI_FUNC(int) _Py_wreadlink( const wchar_t *path, wchar_t *buf, - size_t bufsiz); + /* Number of characters of 'buf' buffer + including the trailing NUL character */ + size_t buflen); #endif #ifdef HAVE_REALPATH PyAPI_FUNC(wchar_t*) _Py_wrealpath( const wchar_t *path, wchar_t *resolved_path, - size_t resolved_path_size); + /* Number of characters of 'resolved_path' buffer + including the trailing NUL character */ + size_t resolved_path_len); #endif PyAPI_FUNC(wchar_t*) _Py_wgetcwd( wchar_t *buf, - size_t size); + /* Number of characters of 'buf' buffer + including the trailing NUL character */ + size_t buflen); -#ifndef Py_LIMITED_API PyAPI_FUNC(int) _Py_get_inheritable(int fd); PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable, int *atomic_flag_works); +PyAPI_FUNC(int) _Py_set_inheritable_async_safe(int fd, int inheritable, + int *atomic_flag_works); + PyAPI_FUNC(int) _Py_dup(int fd); #ifndef MS_WINDOWS @@ -121,22 +177,9 @@ PyAPI_FUNC(int) _Py_get_blocking(int fd); PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking); #endif /* !MS_WINDOWS */ -#if defined _MSC_VER && _MSC_VER >= 1400 && _MSC_VER < 1900 -/* A routine to check if a file descriptor is valid on Windows. Returns 0 - * and sets errno to EBADF if it isn't. This is to avoid Assertions - * from various functions in the Windows CRT beginning with - * Visual Studio 2005 - */ -int _PyVerify_fd(int fd); - -#else -#define _PyVerify_fd(A) (1) /* dummy */ -#endif - #endif /* Py_LIMITED_API */ #ifdef __cplusplus } #endif - #endif /* !Py_FILEUTILS_H */ diff --git a/openflow/usr/include/python3.5m/floatobject.h b/openflow/include/python3.8/floatobject.h similarity index 90% rename from openflow/usr/include/python3.5m/floatobject.h rename to openflow/include/python3.8/floatobject.h index e240fdb..f1044d6 100644 --- a/openflow/usr/include/python3.5m/floatobject.h +++ b/openflow/include/python3.8/floatobject.h @@ -74,9 +74,9 @@ PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *); * happens in such cases is partly accidental (alas). */ -/* The pack routines write 4 or 8 bytes, starting at p. le is a bool +/* The pack routines write 2, 4 or 8 bytes, starting at p. le is a bool * argument, true if you want the string in little-endian format (exponent - * last, at p+3 or p+7), false if you want big-endian format (exponent + * last, at p+1, p+3 or p+7), false if you want big-endian format (exponent * first, at p). * Return value: 0 if all is OK, -1 if error (and an exception is * set, most likely OverflowError). @@ -84,6 +84,7 @@ PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *); * 1): What this does is undefined if x is a NaN or infinity. * 2): -0.0 and +0.0 produce the same string. */ +PyAPI_FUNC(int) _PyFloat_Pack2(double x, unsigned char *p, int le); PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le); PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le); @@ -96,14 +97,15 @@ PyAPI_FUNC(int) _PyFloat_Repr(double x, char *p, size_t len); PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum); PyAPI_FUNC(void) _PyFloat_DigitsInit(void); -/* The unpack routines read 4 or 8 bytes, starting at p. le is a bool +/* The unpack routines read 2, 4 or 8 bytes, starting at p. le is a bool * argument, true if the string is in little-endian format (exponent - * last, at p+3 or p+7), false if big-endian (exponent first, at p). + * last, at p+1, p+3 or p+7), false if big-endian (exponent first, at p). * Return value: The unpacked double. On error, this is -1.0 and * PyErr_Occurred() is true (and an exception is set, most likely * OverflowError). Note that on a non-IEEE platform this will refuse * to unpack a string that represents a NaN or infinity. */ +PyAPI_FUNC(double) _PyFloat_Unpack2(const unsigned char *p, int le); PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le); PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le); diff --git a/openflow/usr/include/python3.5m/frameobject.h b/openflow/include/python3.8/frameobject.h similarity index 83% rename from openflow/usr/include/python3.5m/frameobject.h rename to openflow/include/python3.8/frameobject.h index 00c5093..3bad86a 100644 --- a/openflow/usr/include/python3.5m/frameobject.h +++ b/openflow/include/python3.8/frameobject.h @@ -1,4 +1,3 @@ - /* Frame object interface */ #ifndef Py_LIMITED_API @@ -27,15 +26,9 @@ typedef struct _frame { to the current stack top. */ PyObject **f_stacktop; PyObject *f_trace; /* Trace function */ + char f_trace_lines; /* Emit per-line trace events? */ + char f_trace_opcodes; /* Emit per-opcode trace events? */ - /* In a generator, we need to be able to swap between the exception - state inside the generator and the exception state of the calling - frame (which shouldn't be impacted when the generator "yields" - from an except handler). - These three fields exist exactly for that, and are unused for - non-generator frames. See the save_exc_state and swap_exc_state - functions in ceval.c for details of their use. */ - PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; /* Borrowed reference to a generator, or NULL */ PyObject *f_gen; @@ -60,7 +53,11 @@ PyAPI_DATA(PyTypeObject) PyFrame_Type; #define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type) PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, - PyObject *, PyObject *); + PyObject *, PyObject *); + +/* only internal use */ +PyFrameObject* _PyFrame_New_NoTrack(PyThreadState *, PyCodeObject *, + PyObject *, PyObject *); /* The rest of the interface is specific for frame objects */ diff --git a/openflow/usr/include/python3.5m/funcobject.h b/openflow/include/python3.8/funcobject.h similarity index 65% rename from openflow/usr/include/python3.5m/funcobject.h rename to openflow/include/python3.8/funcobject.h index cc1426c..e563a74 100644 --- a/openflow/usr/include/python3.5m/funcobject.h +++ b/openflow/include/python3.8/funcobject.h @@ -20,18 +20,19 @@ extern "C" { typedef struct { PyObject_HEAD - PyObject *func_code; /* A code object, the __code__ attribute */ - PyObject *func_globals; /* A dictionary (other mappings won't do) */ - PyObject *func_defaults; /* NULL or a tuple */ - PyObject *func_kwdefaults; /* NULL or a dict */ - PyObject *func_closure; /* NULL or a tuple of cell objects */ - PyObject *func_doc; /* The __doc__ attribute, can be anything */ - PyObject *func_name; /* The __name__ attribute, a string object */ - PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */ - PyObject *func_weakreflist; /* List of weak references */ - PyObject *func_module; /* The __module__ attribute, can be anything */ - PyObject *func_annotations; /* Annotations, a dict or NULL */ + PyObject *func_code; /* A code object, the __code__ attribute */ + PyObject *func_globals; /* A dictionary (other mappings won't do) */ + PyObject *func_defaults; /* NULL or a tuple */ + PyObject *func_kwdefaults; /* NULL or a dict */ + PyObject *func_closure; /* NULL or a tuple of cell objects */ + PyObject *func_doc; /* The __doc__ attribute, can be anything */ + PyObject *func_name; /* The __name__ attribute, a string object */ + PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */ + PyObject *func_weakreflist; /* List of weak references */ + PyObject *func_module; /* The __module__ attribute, can be anything */ + PyObject *func_annotations; /* Annotations, a dict or NULL */ PyObject *func_qualname; /* The qualified name */ + vectorcallfunc vectorcall; /* Invariant: * func_closure contains the bindings for func_code->co_freevars, so @@ -58,22 +59,36 @@ PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *); PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyFunction_FastCallDict( + PyObject *func, + PyObject *const *args, + Py_ssize_t nargs, + PyObject *kwargs); + +PyAPI_FUNC(PyObject *) _PyFunction_Vectorcall( + PyObject *func, + PyObject *const *stack, + size_t nargsf, + PyObject *kwnames); +#endif + /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ #define PyFunction_GET_CODE(func) \ (((PyFunctionObject *)func) -> func_code) #define PyFunction_GET_GLOBALS(func) \ - (((PyFunctionObject *)func) -> func_globals) + (((PyFunctionObject *)func) -> func_globals) #define PyFunction_GET_MODULE(func) \ - (((PyFunctionObject *)func) -> func_module) + (((PyFunctionObject *)func) -> func_module) #define PyFunction_GET_DEFAULTS(func) \ - (((PyFunctionObject *)func) -> func_defaults) + (((PyFunctionObject *)func) -> func_defaults) #define PyFunction_GET_KW_DEFAULTS(func) \ - (((PyFunctionObject *)func) -> func_kwdefaults) + (((PyFunctionObject *)func) -> func_kwdefaults) #define PyFunction_GET_CLOSURE(func) \ - (((PyFunctionObject *)func) -> func_closure) + (((PyFunctionObject *)func) -> func_closure) #define PyFunction_GET_ANNOTATIONS(func) \ - (((PyFunctionObject *)func) -> func_annotations) + (((PyFunctionObject *)func) -> func_annotations) /* The classmethod and staticmethod types lives here, too */ PyAPI_DATA(PyTypeObject) PyClassMethod_Type; diff --git a/openflow/usr/include/python3.5m/genobject.h b/openflow/include/python3.8/genobject.h similarity index 66% rename from openflow/usr/include/python3.5m/genobject.h rename to openflow/include/python3.8/genobject.h index 1ff32a8..59ede28 100644 --- a/openflow/usr/include/python3.5m/genobject.h +++ b/openflow/include/python3.8/genobject.h @@ -8,6 +8,8 @@ extern "C" { #endif +#include "pystate.h" /* _PyErr_StackItem */ + struct _frame; /* Avoid including frameobject.h */ /* _PyGenObject_HEAD defines the initial segment of generator @@ -25,7 +27,8 @@ struct _frame; /* Avoid including frameobject.h */ /* Name of the generator. */ \ PyObject *prefix##_name; \ /* Qualified name of the generator. */ \ - PyObject *prefix##_qualname; + PyObject *prefix##_qualname; \ + _PyErr_StackItem prefix##_exc_state; typedef struct { /* The gi_ prefix is intended to remind of generator-iterator. */ @@ -41,26 +44,60 @@ PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(struct _frame *, PyObject *name, PyObject *qualname); PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); +PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *); PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **); -PyObject *_PyGen_Send(PyGenObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyGen_Send(PyGenObject *, PyObject *); PyObject *_PyGen_yf(PyGenObject *); PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self); #ifndef Py_LIMITED_API typedef struct { _PyGenObject_HEAD(cr) + PyObject *cr_origin; } PyCoroObject; PyAPI_DATA(PyTypeObject) PyCoro_Type; PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type; PyAPI_DATA(PyTypeObject) _PyAIterWrapper_Type; -PyObject *_PyAIterWrapper_New(PyObject *aiter); #define PyCoro_CheckExact(op) (Py_TYPE(op) == &PyCoro_Type) PyObject *_PyCoro_GetAwaitableIter(PyObject *o); PyAPI_FUNC(PyObject *) PyCoro_New(struct _frame *, PyObject *name, PyObject *qualname); + +/* Asynchronous Generators */ + +typedef struct { + _PyGenObject_HEAD(ag) + PyObject *ag_finalizer; + + /* Flag is set to 1 when hooks set up by sys.set_asyncgen_hooks + were called on the generator, to avoid calling them more + than once. */ + int ag_hooks_inited; + + /* Flag is set to 1 when aclose() is called for the first time, or + when a StopAsyncIteration exception is raised. */ + int ag_closed; + + int ag_running_async; +} PyAsyncGenObject; + +PyAPI_DATA(PyTypeObject) PyAsyncGen_Type; +PyAPI_DATA(PyTypeObject) _PyAsyncGenASend_Type; +PyAPI_DATA(PyTypeObject) _PyAsyncGenWrappedValue_Type; +PyAPI_DATA(PyTypeObject) _PyAsyncGenAThrow_Type; + +PyAPI_FUNC(PyObject *) PyAsyncGen_New(struct _frame *, + PyObject *name, PyObject *qualname); + +#define PyAsyncGen_CheckExact(op) (Py_TYPE(op) == &PyAsyncGen_Type) + +PyObject *_PyAsyncGenValueWrapperNew(PyObject *); + +int PyAsyncGen_ClearFreeLists(void); + #endif #undef _PyGenObject_HEAD diff --git a/openflow/include/python3.8/graminit.h b/openflow/include/python3.8/graminit.h new file mode 100644 index 0000000..d1027b7 --- /dev/null +++ b/openflow/include/python3.8/graminit.h @@ -0,0 +1,94 @@ +/* Generated by Parser/pgen */ + +#define single_input 256 +#define file_input 257 +#define eval_input 258 +#define decorator 259 +#define decorators 260 +#define decorated 261 +#define async_funcdef 262 +#define funcdef 263 +#define parameters 264 +#define typedargslist 265 +#define tfpdef 266 +#define varargslist 267 +#define vfpdef 268 +#define stmt 269 +#define simple_stmt 270 +#define small_stmt 271 +#define expr_stmt 272 +#define annassign 273 +#define testlist_star_expr 274 +#define augassign 275 +#define del_stmt 276 +#define pass_stmt 277 +#define flow_stmt 278 +#define break_stmt 279 +#define continue_stmt 280 +#define return_stmt 281 +#define yield_stmt 282 +#define raise_stmt 283 +#define import_stmt 284 +#define import_name 285 +#define import_from 286 +#define import_as_name 287 +#define dotted_as_name 288 +#define import_as_names 289 +#define dotted_as_names 290 +#define dotted_name 291 +#define global_stmt 292 +#define nonlocal_stmt 293 +#define assert_stmt 294 +#define compound_stmt 295 +#define async_stmt 296 +#define if_stmt 297 +#define while_stmt 298 +#define for_stmt 299 +#define try_stmt 300 +#define with_stmt 301 +#define with_item 302 +#define except_clause 303 +#define suite 304 +#define namedexpr_test 305 +#define test 306 +#define test_nocond 307 +#define lambdef 308 +#define lambdef_nocond 309 +#define or_test 310 +#define and_test 311 +#define not_test 312 +#define comparison 313 +#define comp_op 314 +#define star_expr 315 +#define expr 316 +#define xor_expr 317 +#define and_expr 318 +#define shift_expr 319 +#define arith_expr 320 +#define term 321 +#define factor 322 +#define power 323 +#define atom_expr 324 +#define atom 325 +#define testlist_comp 326 +#define trailer 327 +#define subscriptlist 328 +#define subscript 329 +#define sliceop 330 +#define exprlist 331 +#define testlist 332 +#define dictorsetmaker 333 +#define classdef 334 +#define arglist 335 +#define argument 336 +#define comp_iter 337 +#define sync_comp_for 338 +#define comp_for 339 +#define comp_if 340 +#define encoding_decl 341 +#define yield_expr 342 +#define yield_arg 343 +#define func_body_suite 344 +#define func_type_input 345 +#define func_type 346 +#define typelist 347 diff --git a/openflow/include/python3.8/grammar.h b/openflow/include/python3.8/grammar.h new file mode 100644 index 0000000..4b66b1e --- /dev/null +++ b/openflow/include/python3.8/grammar.h @@ -0,0 +1,77 @@ + +/* Grammar interface */ + +#ifndef Py_GRAMMAR_H +#define Py_GRAMMAR_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "bitset.h" /* Sigh... */ + +/* A label of an arc */ + +typedef struct { + int lb_type; + const char *lb_str; +} label; + +#define EMPTY 0 /* Label number 0 is by definition the empty label */ + +/* A list of labels */ + +typedef struct { + int ll_nlabels; + const label *ll_label; +} labellist; + +/* An arc from one state to another */ + +typedef struct { + short a_lbl; /* Label of this arc */ + short a_arrow; /* State where this arc goes to */ +} arc; + +/* A state in a DFA */ + +typedef struct { + int s_narcs; + const arc *s_arc; /* Array of arcs */ + + /* Optional accelerators */ + int s_lower; /* Lowest label index */ + int s_upper; /* Highest label index */ + int *s_accel; /* Accelerator */ + int s_accept; /* Nonzero for accepting state */ +} state; + +/* A DFA */ + +typedef struct { + int d_type; /* Non-terminal this represents */ + char *d_name; /* For printing */ + int d_nstates; + state *d_state; /* Array of states */ + bitset d_first; +} dfa; + +/* A grammar */ + +typedef struct { + int g_ndfas; + const dfa *g_dfa; /* Array of DFAs */ + const labellist g_ll; + int g_start; /* Start symbol of the grammar */ + int g_accel; /* Set if accelerators present */ +} grammar; + +/* FUNCTIONS */ +const dfa *PyGrammar_FindDFA(grammar *g, int type); +const char *PyGrammar_LabelRepr(label *lb); +void PyGrammar_AddAccelerators(grammar *g); +void PyGrammar_RemoveAccelerators(grammar *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_GRAMMAR_H */ diff --git a/openflow/usr/include/python3.5m/import.h b/openflow/include/python3.8/import.h similarity index 73% rename from openflow/usr/include/python3.5m/import.h rename to openflow/include/python3.8/import.h index afdfac2..13c6149 100644 --- a/openflow/usr/include/python3.5m/import.h +++ b/openflow/include/python3.8/import.h @@ -7,9 +7,9 @@ extern "C" { #endif -PyAPI_FUNC(void) _PyImportZip_Init(void); - -PyMODINIT_FUNC PyInit_imp(void); +#ifndef Py_LIMITED_API +PyMODINIT_FUNC PyInit__imp(void); +#endif /* !Py_LIMITED_API */ PyAPI_FUNC(long) PyImport_GetMagicNumber(void); PyAPI_FUNC(const char *) PyImport_GetMagicTag(void); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule( @@ -27,16 +27,31 @@ PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames( const char *pathname, /* decoded from the filesystem encoding */ const char *cpathname /* decoded from the filesystem encoding */ ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject( PyObject *name, PyObject *co, PyObject *pathname, PyObject *cpathname ); +#endif PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 +PyAPI_FUNC(PyObject *) PyImport_GetModule(PyObject *name); +#endif +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *); +PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(struct _Py_Identifier *name); +PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *name, + PyObject *modules); +PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module); +PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module); +#endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_AddModuleObject( PyObject *name ); +#endif PyAPI_FUNC(PyObject *) PyImport_AddModule( const char *name /* UTF-8 encoded string */ ); @@ -53,6 +68,7 @@ PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel( PyObject *fromlist, int level ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject( PyObject *name, PyObject *globals, @@ -60,6 +76,7 @@ PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject( PyObject *fromlist, int level ); +#endif #define PyImport_ImportModuleEx(n, g, l, f) \ PyImport_ImportModuleLevel(n, g, l, f, 0) @@ -68,33 +85,35 @@ PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path); PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name); PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m); PyAPI_FUNC(void) PyImport_Cleanup(void); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject( PyObject *name ); +#endif PyAPI_FUNC(int) PyImport_ImportFrozenModule( const char *name /* UTF-8 encoded string */ ); #ifndef Py_LIMITED_API -#ifdef WITH_THREAD PyAPI_FUNC(void) _PyImport_AcquireLock(void); PyAPI_FUNC(int) _PyImport_ReleaseLock(void); -#else -#define _PyImport_AcquireLock() -#define _PyImport_ReleaseLock() 1 -#endif PyAPI_FUNC(void) _PyImport_ReInitLock(void); PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin( - const char *name /* UTF-8 encoded string */ + const char *name, /* UTF-8 encoded string */ + PyObject *modules ); PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObjectEx(PyObject *, PyObject *, + PyObject *); PyAPI_FUNC(int) _PyImport_FixupBuiltin( PyObject *mod, - const char *name /* UTF-8 encoded string */ + const char *name, /* UTF-8 encoded string */ + PyObject *modules ); -PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *); +PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, + PyObject *, PyObject *); struct _inittab { const char *name; /* ASCII encoded string */ diff --git a/openflow/usr/include/python3.5m/accu.h b/openflow/include/python3.8/internal/pycore_accu.h similarity index 82% rename from openflow/usr/include/python3.5m/accu.h rename to openflow/include/python3.8/internal/pycore_accu.h index 3636ea6..d346222 100644 --- a/openflow/usr/include/python3.5m/accu.h +++ b/openflow/include/python3.8/internal/pycore_accu.h @@ -1,21 +1,24 @@ #ifndef Py_LIMITED_API -#ifndef Py_ACCU_H -#define Py_ACCU_H +#ifndef Py_INTERNAL_ACCU_H +#define Py_INTERNAL_ACCU_H +#ifdef __cplusplus +extern "C" { +#endif /*** This is a private API for use by the interpreter and the stdlib. *** Its definition may be changed or removed at any moment. ***/ +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + /* * A two-level accumulator of unicode objects that avoids both the overhead * of keeping a huge number of small separate objects, and the quadratic * behaviour of using a naive repeated concatenation scheme. */ -#ifdef __cplusplus -extern "C" { -#endif - #undef small /* defined by some Windows headers */ typedef struct { @@ -32,6 +35,5 @@ PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu *acc); #ifdef __cplusplus } #endif - -#endif /* Py_ACCU_H */ -#endif /* Py_LIMITED_API */ +#endif /* !Py_INTERNAL_ACCU_H */ +#endif /* !Py_LIMITED_API */ diff --git a/openflow/include/python3.8/internal/pycore_atomic.h b/openflow/include/python3.8/internal/pycore_atomic.h new file mode 100644 index 0000000..336bc3f --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_atomic.h @@ -0,0 +1,558 @@ +#ifndef Py_ATOMIC_H +#define Py_ATOMIC_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "dynamic_annotations.h" + +#include "pyconfig.h" + +#if defined(HAVE_STD_ATOMIC) +#include +#endif + + +#if defined(_MSC_VER) +#include +#if defined(_M_IX86) || defined(_M_X64) +# include +#endif +#endif + +/* This is modeled after the atomics interface from C1x, according to + * the draft at + * http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1425.pdf. + * Operations and types are named the same except with a _Py_ prefix + * and have the same semantics. + * + * Beware, the implementations here are deep magic. + */ + +#if defined(HAVE_STD_ATOMIC) + +typedef enum _Py_memory_order { + _Py_memory_order_relaxed = memory_order_relaxed, + _Py_memory_order_acquire = memory_order_acquire, + _Py_memory_order_release = memory_order_release, + _Py_memory_order_acq_rel = memory_order_acq_rel, + _Py_memory_order_seq_cst = memory_order_seq_cst +} _Py_memory_order; + +typedef struct _Py_atomic_address { + atomic_uintptr_t _value; +} _Py_atomic_address; + +typedef struct _Py_atomic_int { + atomic_int _value; +} _Py_atomic_int; + +#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \ + atomic_signal_fence(ORDER) + +#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \ + atomic_thread_fence(ORDER) + +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + atomic_store_explicit(&((ATOMIC_VAL)->_value), NEW_VAL, ORDER) + +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + atomic_load_explicit(&((ATOMIC_VAL)->_value), ORDER) + +/* Use builtin atomic operations in GCC >= 4.7 */ +#elif defined(HAVE_BUILTIN_ATOMIC) + +typedef enum _Py_memory_order { + _Py_memory_order_relaxed = __ATOMIC_RELAXED, + _Py_memory_order_acquire = __ATOMIC_ACQUIRE, + _Py_memory_order_release = __ATOMIC_RELEASE, + _Py_memory_order_acq_rel = __ATOMIC_ACQ_REL, + _Py_memory_order_seq_cst = __ATOMIC_SEQ_CST +} _Py_memory_order; + +typedef struct _Py_atomic_address { + uintptr_t _value; +} _Py_atomic_address; + +typedef struct _Py_atomic_int { + int _value; +} _Py_atomic_int; + +#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \ + __atomic_signal_fence(ORDER) + +#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \ + __atomic_thread_fence(ORDER) + +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + (assert((ORDER) == __ATOMIC_RELAXED \ + || (ORDER) == __ATOMIC_SEQ_CST \ + || (ORDER) == __ATOMIC_RELEASE), \ + __atomic_store_n(&((ATOMIC_VAL)->_value), NEW_VAL, ORDER)) + +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + (assert((ORDER) == __ATOMIC_RELAXED \ + || (ORDER) == __ATOMIC_SEQ_CST \ + || (ORDER) == __ATOMIC_ACQUIRE \ + || (ORDER) == __ATOMIC_CONSUME), \ + __atomic_load_n(&((ATOMIC_VAL)->_value), ORDER)) + +/* Only support GCC (for expression statements) and x86 (for simple + * atomic semantics) and MSVC x86/x64/ARM */ +#elif defined(__GNUC__) && (defined(__i386__) || defined(__amd64)) +typedef enum _Py_memory_order { + _Py_memory_order_relaxed, + _Py_memory_order_acquire, + _Py_memory_order_release, + _Py_memory_order_acq_rel, + _Py_memory_order_seq_cst +} _Py_memory_order; + +typedef struct _Py_atomic_address { + uintptr_t _value; +} _Py_atomic_address; + +typedef struct _Py_atomic_int { + int _value; +} _Py_atomic_int; + + +static __inline__ void +_Py_atomic_signal_fence(_Py_memory_order order) +{ + if (order != _Py_memory_order_relaxed) + __asm__ volatile("":::"memory"); +} + +static __inline__ void +_Py_atomic_thread_fence(_Py_memory_order order) +{ + if (order != _Py_memory_order_relaxed) + __asm__ volatile("mfence":::"memory"); +} + +/* Tell the race checker about this operation's effects. */ +static __inline__ void +_Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order) +{ + (void)address; /* shut up -Wunused-parameter */ + switch(order) { + case _Py_memory_order_release: + case _Py_memory_order_acq_rel: + case _Py_memory_order_seq_cst: + _Py_ANNOTATE_HAPPENS_BEFORE(address); + break; + case _Py_memory_order_relaxed: + case _Py_memory_order_acquire: + break; + } + switch(order) { + case _Py_memory_order_acquire: + case _Py_memory_order_acq_rel: + case _Py_memory_order_seq_cst: + _Py_ANNOTATE_HAPPENS_AFTER(address); + break; + case _Py_memory_order_relaxed: + case _Py_memory_order_release: + break; + } +} + +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + __extension__ ({ \ + __typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \ + __typeof__(atomic_val->_value) new_val = NEW_VAL;\ + volatile __typeof__(new_val) *volatile_data = &atomic_val->_value; \ + _Py_memory_order order = ORDER; \ + _Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \ + \ + /* Perform the operation. */ \ + _Py_ANNOTATE_IGNORE_WRITES_BEGIN(); \ + switch(order) { \ + case _Py_memory_order_release: \ + _Py_atomic_signal_fence(_Py_memory_order_release); \ + /* fallthrough */ \ + case _Py_memory_order_relaxed: \ + *volatile_data = new_val; \ + break; \ + \ + case _Py_memory_order_acquire: \ + case _Py_memory_order_acq_rel: \ + case _Py_memory_order_seq_cst: \ + __asm__ volatile("xchg %0, %1" \ + : "+r"(new_val) \ + : "m"(atomic_val->_value) \ + : "memory"); \ + break; \ + } \ + _Py_ANNOTATE_IGNORE_WRITES_END(); \ + }) + +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + __extension__ ({ \ + __typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \ + __typeof__(atomic_val->_value) result; \ + volatile __typeof__(result) *volatile_data = &atomic_val->_value; \ + _Py_memory_order order = ORDER; \ + _Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \ + \ + /* Perform the operation. */ \ + _Py_ANNOTATE_IGNORE_READS_BEGIN(); \ + switch(order) { \ + case _Py_memory_order_release: \ + case _Py_memory_order_acq_rel: \ + case _Py_memory_order_seq_cst: \ + /* Loads on x86 are not releases by default, so need a */ \ + /* thread fence. */ \ + _Py_atomic_thread_fence(_Py_memory_order_release); \ + break; \ + default: \ + /* No fence */ \ + break; \ + } \ + result = *volatile_data; \ + switch(order) { \ + case _Py_memory_order_acquire: \ + case _Py_memory_order_acq_rel: \ + case _Py_memory_order_seq_cst: \ + /* Loads on x86 are automatically acquire operations so */ \ + /* can get by with just a compiler fence. */ \ + _Py_atomic_signal_fence(_Py_memory_order_acquire); \ + break; \ + default: \ + /* No fence */ \ + break; \ + } \ + _Py_ANNOTATE_IGNORE_READS_END(); \ + result; \ + }) + +#elif defined(_MSC_VER) +/* _Interlocked* functions provide a full memory barrier and are therefore + enough for acq_rel and seq_cst. If the HLE variants aren't available + in hardware they will fall back to a full memory barrier as well. + + This might affect performance but likely only in some very specific and + hard to meassure scenario. +*/ +#if defined(_M_IX86) || defined(_M_X64) +typedef enum _Py_memory_order { + _Py_memory_order_relaxed, + _Py_memory_order_acquire, + _Py_memory_order_release, + _Py_memory_order_acq_rel, + _Py_memory_order_seq_cst +} _Py_memory_order; + +typedef struct _Py_atomic_address { + volatile uintptr_t _value; +} _Py_atomic_address; + +typedef struct _Py_atomic_int { + volatile int _value; +} _Py_atomic_int; + + +#if defined(_M_X64) +#define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) \ + switch (ORDER) { \ + case _Py_memory_order_acquire: \ + _InterlockedExchange64_HLEAcquire((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)(NEW_VAL)); \ + break; \ + case _Py_memory_order_release: \ + _InterlockedExchange64_HLERelease((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)(NEW_VAL)); \ + break; \ + default: \ + _InterlockedExchange64((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)(NEW_VAL)); \ + break; \ + } +#else +#define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) ((void)0); +#endif + +#define _Py_atomic_store_32bit(ATOMIC_VAL, NEW_VAL, ORDER) \ + switch (ORDER) { \ + case _Py_memory_order_acquire: \ + _InterlockedExchange_HLEAcquire((volatile long*)&((ATOMIC_VAL)->_value), (int)(NEW_VAL)); \ + break; \ + case _Py_memory_order_release: \ + _InterlockedExchange_HLERelease((volatile long*)&((ATOMIC_VAL)->_value), (int)(NEW_VAL)); \ + break; \ + default: \ + _InterlockedExchange((volatile long*)&((ATOMIC_VAL)->_value), (int)(NEW_VAL)); \ + break; \ + } + +#if defined(_M_X64) +/* This has to be an intptr_t for now. + gil_created() uses -1 as a sentinel value, if this returns + a uintptr_t it will do an unsigned compare and crash +*/ +inline intptr_t _Py_atomic_load_64bit_impl(volatile uintptr_t* value, int order) { + __int64 old; + switch (order) { + case _Py_memory_order_acquire: + { + do { + old = *value; + } while(_InterlockedCompareExchange64_HLEAcquire((volatile __int64*)value, old, old) != old); + break; + } + case _Py_memory_order_release: + { + do { + old = *value; + } while(_InterlockedCompareExchange64_HLERelease((volatile __int64*)value, old, old) != old); + break; + } + case _Py_memory_order_relaxed: + old = *value; + break; + default: + { + do { + old = *value; + } while(_InterlockedCompareExchange64((volatile __int64*)value, old, old) != old); + break; + } + } + return old; +} + +#define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) \ + _Py_atomic_load_64bit_impl((volatile uintptr_t*)&((ATOMIC_VAL)->_value), (ORDER)) + +#else +#define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) ((ATOMIC_VAL)->_value) +#endif + +inline int _Py_atomic_load_32bit_impl(volatile int* value, int order) { + long old; + switch (order) { + case _Py_memory_order_acquire: + { + do { + old = *value; + } while(_InterlockedCompareExchange_HLEAcquire((volatile long*)value, old, old) != old); + break; + } + case _Py_memory_order_release: + { + do { + old = *value; + } while(_InterlockedCompareExchange_HLERelease((volatile long*)value, old, old) != old); + break; + } + case _Py_memory_order_relaxed: + old = *value; + break; + default: + { + do { + old = *value; + } while(_InterlockedCompareExchange((volatile long*)value, old, old) != old); + break; + } + } + return old; +} + +#define _Py_atomic_load_32bit(ATOMIC_VAL, ORDER) \ + _Py_atomic_load_32bit_impl((volatile int*)&((ATOMIC_VAL)->_value), (ORDER)) + +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + if (sizeof((ATOMIC_VAL)->_value) == 8) { \ + _Py_atomic_store_64bit((ATOMIC_VAL), NEW_VAL, ORDER) } else { \ + _Py_atomic_store_32bit((ATOMIC_VAL), NEW_VAL, ORDER) } + +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + ( \ + sizeof((ATOMIC_VAL)->_value) == 8 ? \ + _Py_atomic_load_64bit((ATOMIC_VAL), ORDER) : \ + _Py_atomic_load_32bit((ATOMIC_VAL), ORDER) \ + ) +#elif defined(_M_ARM) || defined(_M_ARM64) +typedef enum _Py_memory_order { + _Py_memory_order_relaxed, + _Py_memory_order_acquire, + _Py_memory_order_release, + _Py_memory_order_acq_rel, + _Py_memory_order_seq_cst +} _Py_memory_order; + +typedef struct _Py_atomic_address { + volatile uintptr_t _value; +} _Py_atomic_address; + +typedef struct _Py_atomic_int { + volatile int _value; +} _Py_atomic_int; + + +#if defined(_M_ARM64) +#define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) \ + switch (ORDER) { \ + case _Py_memory_order_acquire: \ + _InterlockedExchange64_acq((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)NEW_VAL); \ + break; \ + case _Py_memory_order_release: \ + _InterlockedExchange64_rel((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)NEW_VAL); \ + break; \ + default: \ + _InterlockedExchange64((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)NEW_VAL); \ + break; \ + } +#else +#define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) ((void)0); +#endif + +#define _Py_atomic_store_32bit(ATOMIC_VAL, NEW_VAL, ORDER) \ + switch (ORDER) { \ + case _Py_memory_order_acquire: \ + _InterlockedExchange_acq((volatile long*)&((ATOMIC_VAL)->_value), (int)NEW_VAL); \ + break; \ + case _Py_memory_order_release: \ + _InterlockedExchange_rel((volatile long*)&((ATOMIC_VAL)->_value), (int)NEW_VAL); \ + break; \ + default: \ + _InterlockedExchange((volatile long*)&((ATOMIC_VAL)->_value), (int)NEW_VAL); \ + break; \ + } + +#if defined(_M_ARM64) +/* This has to be an intptr_t for now. + gil_created() uses -1 as a sentinel value, if this returns + a uintptr_t it will do an unsigned compare and crash +*/ +inline intptr_t _Py_atomic_load_64bit_impl(volatile uintptr_t* value, int order) { + uintptr_t old; + switch (order) { + case _Py_memory_order_acquire: + { + do { + old = *value; + } while(_InterlockedCompareExchange64_acq(value, old, old) != old); + break; + } + case _Py_memory_order_release: + { + do { + old = *value; + } while(_InterlockedCompareExchange64_rel(value, old, old) != old); + break; + } + case _Py_memory_order_relaxed: + old = *value; + break; + default: + { + do { + old = *value; + } while(_InterlockedCompareExchange64(value, old, old) != old); + break; + } + } + return old; +} + +#define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) \ + _Py_atomic_load_64bit_impl((volatile uintptr_t*)&((ATOMIC_VAL)->_value), (ORDER)) + +#else +#define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) ((ATOMIC_VAL)->_value) +#endif + +inline int _Py_atomic_load_32bit_impl(volatile int* value, int order) { + int old; + switch (order) { + case _Py_memory_order_acquire: + { + do { + old = *value; + } while(_InterlockedCompareExchange_acq(value, old, old) != old); + break; + } + case _Py_memory_order_release: + { + do { + old = *value; + } while(_InterlockedCompareExchange_rel(value, old, old) != old); + break; + } + case _Py_memory_order_relaxed: + old = *value; + break; + default: + { + do { + old = *value; + } while(_InterlockedCompareExchange(value, old, old) != old); + break; + } + } + return old; +} + +#define _Py_atomic_load_32bit(ATOMIC_VAL, ORDER) \ + _Py_atomic_load_32bit_impl((volatile int*)&((ATOMIC_VAL)->_value), (ORDER)) + +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + if (sizeof((ATOMIC_VAL)->_value) == 8) { \ + _Py_atomic_store_64bit((ATOMIC_VAL), (NEW_VAL), (ORDER)) } else { \ + _Py_atomic_store_32bit((ATOMIC_VAL), (NEW_VAL), (ORDER)) } + +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + ( \ + sizeof((ATOMIC_VAL)->_value) == 8 ? \ + _Py_atomic_load_64bit((ATOMIC_VAL), (ORDER)) : \ + _Py_atomic_load_32bit((ATOMIC_VAL), (ORDER)) \ + ) +#endif +#else /* !gcc x86 !_msc_ver */ +typedef enum _Py_memory_order { + _Py_memory_order_relaxed, + _Py_memory_order_acquire, + _Py_memory_order_release, + _Py_memory_order_acq_rel, + _Py_memory_order_seq_cst +} _Py_memory_order; + +typedef struct _Py_atomic_address { + uintptr_t _value; +} _Py_atomic_address; + +typedef struct _Py_atomic_int { + int _value; +} _Py_atomic_int; +/* Fall back to other compilers and processors by assuming that simple + volatile accesses are atomic. This is false, so people should port + this. */ +#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) ((void)0) +#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) ((void)0) +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + ((ATOMIC_VAL)->_value = NEW_VAL) +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + ((ATOMIC_VAL)->_value) +#endif + +/* Standardized shortcuts. */ +#define _Py_atomic_store(ATOMIC_VAL, NEW_VAL) \ + _Py_atomic_store_explicit((ATOMIC_VAL), (NEW_VAL), _Py_memory_order_seq_cst) +#define _Py_atomic_load(ATOMIC_VAL) \ + _Py_atomic_load_explicit((ATOMIC_VAL), _Py_memory_order_seq_cst) + +/* Python-local extensions */ + +#define _Py_atomic_store_relaxed(ATOMIC_VAL, NEW_VAL) \ + _Py_atomic_store_explicit((ATOMIC_VAL), (NEW_VAL), _Py_memory_order_relaxed) +#define _Py_atomic_load_relaxed(ATOMIC_VAL) \ + _Py_atomic_load_explicit((ATOMIC_VAL), _Py_memory_order_relaxed) + +#ifdef __cplusplus +} +#endif +#endif /* Py_ATOMIC_H */ diff --git a/openflow/include/python3.8/internal/pycore_ceval.h b/openflow/include/python3.8/internal/pycore_ceval.h new file mode 100644 index 0000000..4c1c0e2 --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_ceval.h @@ -0,0 +1,37 @@ +#ifndef Py_INTERNAL_CEVAL_H +#define Py_INTERNAL_CEVAL_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_atomic.h" +#include "pycore_pystate.h" +#include "pythread.h" + +PyAPI_FUNC(void) _Py_FinishPendingCalls(_PyRuntimeState *runtime); +PyAPI_FUNC(void) _PyEval_Initialize(struct _ceval_runtime_state *); +PyAPI_FUNC(void) _PyEval_FiniThreads( + struct _ceval_runtime_state *ceval); +PyAPI_FUNC(void) _PyEval_SignalReceived( + struct _ceval_runtime_state *ceval); +PyAPI_FUNC(int) _PyEval_AddPendingCall( + PyThreadState *tstate, + struct _ceval_runtime_state *ceval, + int (*func)(void *), + void *arg); +PyAPI_FUNC(void) _PyEval_SignalAsyncExc( + struct _ceval_runtime_state *ceval); +PyAPI_FUNC(void) _PyEval_ReInitThreads( + _PyRuntimeState *runtime); + +/* Private function */ +void _PyEval_Fini(void); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_CEVAL_H */ diff --git a/openflow/include/python3.8/internal/pycore_code.h b/openflow/include/python3.8/internal/pycore_code.h new file mode 100644 index 0000000..88956f1 --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_code.h @@ -0,0 +1,27 @@ +#ifndef Py_INTERNAL_CODE_H +#define Py_INTERNAL_CODE_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject *ptr; /* Cached pointer (borrowed reference) */ + uint64_t globals_ver; /* ma_version of global dict */ + uint64_t builtins_ver; /* ma_version of builtin dict */ +} _PyOpcache_LoadGlobal; + +struct _PyOpcache { + union { + _PyOpcache_LoadGlobal lg; + } u; + char optimized; +}; + +/* Private API */ +int _PyCode_InitOpcache(PyCodeObject *co); + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_CODE_H */ diff --git a/openflow/include/python3.8/internal/pycore_condvar.h b/openflow/include/python3.8/internal/pycore_condvar.h new file mode 100644 index 0000000..8b89d70 --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_condvar.h @@ -0,0 +1,95 @@ +#ifndef Py_INTERNAL_CONDVAR_H +#define Py_INTERNAL_CONDVAR_H + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#ifndef _POSIX_THREADS +/* This means pthreads are not implemented in libc headers, hence the macro + not present in unistd.h. But they still can be implemented as an external + library (e.g. gnu pth in pthread emulation) */ +# ifdef HAVE_PTHREAD_H +# include /* _POSIX_THREADS */ +# endif +#endif + +#ifdef _POSIX_THREADS +/* + * POSIX support + */ +#define Py_HAVE_CONDVAR + +#include + +#define PyMUTEX_T pthread_mutex_t +#define PyCOND_T pthread_cond_t + +#elif defined(NT_THREADS) +/* + * Windows (XP, 2003 server and later, as well as (hopefully) CE) support + * + * Emulated condition variables ones that work with XP and later, plus + * example native support on VISTA and onwards. + */ +#define Py_HAVE_CONDVAR + +/* include windows if it hasn't been done before */ +#define WIN32_LEAN_AND_MEAN +#include + +/* options */ +/* non-emulated condition variables are provided for those that want + * to target Windows Vista. Modify this macro to enable them. + */ +#ifndef _PY_EMULATED_WIN_CV +#define _PY_EMULATED_WIN_CV 1 /* use emulated condition variables */ +#endif + +/* fall back to emulation if not targeting Vista */ +#if !defined NTDDI_VISTA || NTDDI_VERSION < NTDDI_VISTA +#undef _PY_EMULATED_WIN_CV +#define _PY_EMULATED_WIN_CV 1 +#endif + +#if _PY_EMULATED_WIN_CV + +typedef CRITICAL_SECTION PyMUTEX_T; + +/* The ConditionVariable object. From XP onwards it is easily emulated + with a Semaphore. + Semaphores are available on Windows XP (2003 server) and later. + We use a Semaphore rather than an auto-reset event, because although + an auto-resent event might appear to solve the lost-wakeup bug (race + condition between releasing the outer lock and waiting) because it + maintains state even though a wait hasn't happened, there is still + a lost wakeup problem if more than one thread are interrupted in the + critical place. A semaphore solves that, because its state is + counted, not Boolean. + Because it is ok to signal a condition variable with no one + waiting, we need to keep track of the number of + waiting threads. Otherwise, the semaphore's state could rise + without bound. This also helps reduce the number of "spurious wakeups" + that would otherwise happen. + */ + +typedef struct _PyCOND_T +{ + HANDLE sem; + int waiting; /* to allow PyCOND_SIGNAL to be a no-op */ +} PyCOND_T; + +#else /* !_PY_EMULATED_WIN_CV */ + +/* Use native Win7 primitives if build target is Win7 or higher */ + +/* SRWLOCK is faster and better than CriticalSection */ +typedef SRWLOCK PyMUTEX_T; + +typedef CONDITION_VARIABLE PyCOND_T; + +#endif /* _PY_EMULATED_WIN_CV */ + +#endif /* _POSIX_THREADS, NT_THREADS */ + +#endif /* Py_INTERNAL_CONDVAR_H */ diff --git a/openflow/include/python3.8/internal/pycore_context.h b/openflow/include/python3.8/internal/pycore_context.h new file mode 100644 index 0000000..5e1ba0d --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_context.h @@ -0,0 +1,42 @@ +#ifndef Py_INTERNAL_CONTEXT_H +#define Py_INTERNAL_CONTEXT_H + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_hamt.h" + +struct _pycontextobject { + PyObject_HEAD + PyContext *ctx_prev; + PyHamtObject *ctx_vars; + PyObject *ctx_weakreflist; + int ctx_entered; +}; + + +struct _pycontextvarobject { + PyObject_HEAD + PyObject *var_name; + PyObject *var_default; + PyObject *var_cached; + uint64_t var_cached_tsid; + uint64_t var_cached_tsver; + Py_hash_t var_hash; +}; + + +struct _pycontexttokenobject { + PyObject_HEAD + PyContext *tok_ctx; + PyContextVar *tok_var; + PyObject *tok_oldval; + int tok_used; +}; + + +int _PyContext_Init(void); +void _PyContext_Fini(void); + +#endif /* !Py_INTERNAL_CONTEXT_H */ diff --git a/openflow/include/python3.8/internal/pycore_fileutils.h b/openflow/include/python3.8/internal/pycore_fileutils.h new file mode 100644 index 0000000..bbee586 --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_fileutils.h @@ -0,0 +1,54 @@ +#ifndef Py_INTERNAL_FILEUTILS_H +#define Py_INTERNAL_FILEUTILS_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "Py_BUILD_CORE must be defined to include this header" +#endif + +#include /* struct lconv */ + +PyAPI_DATA(int) _Py_HasFileSystemDefaultEncodeErrors; + +PyAPI_FUNC(int) _Py_DecodeUTF8Ex( + const char *arg, + Py_ssize_t arglen, + wchar_t **wstr, + size_t *wlen, + const char **reason, + _Py_error_handler errors); + +PyAPI_FUNC(int) _Py_EncodeUTF8Ex( + const wchar_t *text, + char **str, + size_t *error_pos, + const char **reason, + int raw_malloc, + _Py_error_handler errors); + +PyAPI_FUNC(wchar_t*) _Py_DecodeUTF8_surrogateescape( + const char *arg, + Py_ssize_t arglen, + size_t *wlen); + +PyAPI_FUNC(int) _Py_GetForceASCII(void); + +/* Reset "force ASCII" mode (if it was initialized). + + This function should be called when Python changes the LC_CTYPE locale, + so the "force ASCII" mode can be detected again on the new locale + encoding. */ +PyAPI_FUNC(void) _Py_ResetForceASCII(void); + + +PyAPI_FUNC(int) _Py_GetLocaleconvNumeric( + struct lconv *lc, + PyObject **decimal_point, + PyObject **thousands_sep); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_FILEUTILS_H */ diff --git a/openflow/include/python3.8/internal/pycore_getopt.h b/openflow/include/python3.8/internal/pycore_getopt.h new file mode 100644 index 0000000..7f0dd13 --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_getopt.h @@ -0,0 +1,22 @@ +#ifndef Py_INTERNAL_PYGETOPT_H +#define Py_INTERNAL_PYGETOPT_H + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +extern int _PyOS_opterr; +extern Py_ssize_t _PyOS_optind; +extern const wchar_t *_PyOS_optarg; + +extern void _PyOS_ResetGetOpt(void); + +typedef struct { + const wchar_t *name; + int has_arg; + int val; +} _PyOS_LongOption; + +extern int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex); + +#endif /* !Py_INTERNAL_PYGETOPT_H */ diff --git a/openflow/include/python3.8/internal/pycore_gil.h b/openflow/include/python3.8/internal/pycore_gil.h new file mode 100644 index 0000000..7de3163 --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_gil.h @@ -0,0 +1,50 @@ +#ifndef Py_INTERNAL_GIL_H +#define Py_INTERNAL_GIL_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_condvar.h" +#include "pycore_atomic.h" + +#ifndef Py_HAVE_CONDVAR +# error You need either a POSIX-compatible or a Windows system! +#endif + +/* Enable if you want to force the switching of threads at least + every `interval`. */ +#undef FORCE_SWITCHING +#define FORCE_SWITCHING + +struct _gil_runtime_state { + /* microseconds (the Python API uses seconds, though) */ + unsigned long interval; + /* Last PyThreadState holding / having held the GIL. This helps us + know whether anyone else was scheduled after we dropped the GIL. */ + _Py_atomic_address last_holder; + /* Whether the GIL is already taken (-1 if uninitialized). This is + atomic because it can be read without any lock taken in ceval.c. */ + _Py_atomic_int locked; + /* Number of GIL switches since the beginning. */ + unsigned long switch_number; + /* This condition variable allows one or several threads to wait + until the GIL is released. In addition, the mutex also protects + the above variables. */ + PyCOND_T cond; + PyMUTEX_T mutex; +#ifdef FORCE_SWITCHING + /* This condition variable helps the GIL-releasing thread wait for + a GIL-awaiting thread to be scheduled and take the GIL. */ + PyCOND_T switch_cond; + PyMUTEX_T switch_mutex; +#endif +}; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_GIL_H */ diff --git a/openflow/include/python3.8/internal/pycore_hamt.h b/openflow/include/python3.8/internal/pycore_hamt.h new file mode 100644 index 0000000..e65aef5 --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_hamt.h @@ -0,0 +1,116 @@ +#ifndef Py_INTERNAL_HAMT_H +#define Py_INTERNAL_HAMT_H + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#define _Py_HAMT_MAX_TREE_DEPTH 7 + + +#define PyHamt_Check(o) (Py_TYPE(o) == &_PyHamt_Type) + + +/* Abstract tree node. */ +typedef struct { + PyObject_HEAD +} PyHamtNode; + + +/* An HAMT immutable mapping collection. */ +typedef struct { + PyObject_HEAD + PyHamtNode *h_root; + PyObject *h_weakreflist; + Py_ssize_t h_count; +} PyHamtObject; + + +/* A struct to hold the state of depth-first traverse of the tree. + + HAMT is an immutable collection. Iterators will hold a strong reference + to it, and every node in the HAMT has strong references to its children. + + So for iterators, we can implement zero allocations and zero reference + inc/dec depth-first iteration. + + - i_nodes: an array of seven pointers to tree nodes + - i_level: the current node in i_nodes + - i_pos: an array of positions within nodes in i_nodes. +*/ +typedef struct { + PyHamtNode *i_nodes[_Py_HAMT_MAX_TREE_DEPTH]; + Py_ssize_t i_pos[_Py_HAMT_MAX_TREE_DEPTH]; + int8_t i_level; +} PyHamtIteratorState; + + +/* Base iterator object. + + Contains the iteration state, a pointer to the HAMT tree, + and a pointer to the 'yield function'. The latter is a simple + function that returns a key/value tuple for the 'Items' iterator, + just a key for the 'Keys' iterator, and a value for the 'Values' + iterator. +*/ +typedef struct { + PyObject_HEAD + PyHamtObject *hi_obj; + PyHamtIteratorState hi_iter; + binaryfunc hi_yield; +} PyHamtIterator; + + +PyAPI_DATA(PyTypeObject) _PyHamt_Type; +PyAPI_DATA(PyTypeObject) _PyHamt_ArrayNode_Type; +PyAPI_DATA(PyTypeObject) _PyHamt_BitmapNode_Type; +PyAPI_DATA(PyTypeObject) _PyHamt_CollisionNode_Type; +PyAPI_DATA(PyTypeObject) _PyHamtKeys_Type; +PyAPI_DATA(PyTypeObject) _PyHamtValues_Type; +PyAPI_DATA(PyTypeObject) _PyHamtItems_Type; + + +/* Create a new HAMT immutable mapping. */ +PyHamtObject * _PyHamt_New(void); + +/* Return a new collection based on "o", but with an additional + key/val pair. */ +PyHamtObject * _PyHamt_Assoc(PyHamtObject *o, PyObject *key, PyObject *val); + +/* Return a new collection based on "o", but without "key". */ +PyHamtObject * _PyHamt_Without(PyHamtObject *o, PyObject *key); + +/* Find "key" in the "o" collection. + + Return: + - -1: An error occurred. + - 0: "key" wasn't found in "o". + - 1: "key" is in "o"; "*val" is set to its value (a borrowed ref). +*/ +int _PyHamt_Find(PyHamtObject *o, PyObject *key, PyObject **val); + +/* Check if "v" is equal to "w". + + Return: + - 0: v != w + - 1: v == w + - -1: An error occurred. +*/ +int _PyHamt_Eq(PyHamtObject *v, PyHamtObject *w); + +/* Return the size of "o"; equivalent of "len(o)". */ +Py_ssize_t _PyHamt_Len(PyHamtObject *o); + +/* Return a Keys iterator over "o". */ +PyObject * _PyHamt_NewIterKeys(PyHamtObject *o); + +/* Return a Values iterator over "o". */ +PyObject * _PyHamt_NewIterValues(PyHamtObject *o); + +/* Return a Items iterator over "o". */ +PyObject * _PyHamt_NewIterItems(PyHamtObject *o); + +int _PyHamt_Init(void); +void _PyHamt_Fini(void); + +#endif /* !Py_INTERNAL_HAMT_H */ diff --git a/openflow/include/python3.8/internal/pycore_initconfig.h b/openflow/include/python3.8/internal/pycore_initconfig.h new file mode 100644 index 0000000..40831c4 --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_initconfig.h @@ -0,0 +1,166 @@ +#ifndef Py_INTERNAL_CORECONFIG_H +#define Py_INTERNAL_CORECONFIG_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_pystate.h" /* _PyRuntimeState */ + +/* --- PyStatus ----------------------------------------------- */ + +/* Almost all errors causing Python initialization to fail */ +#ifdef _MSC_VER + /* Visual Studio 2015 doesn't implement C99 __func__ in C */ +# define _PyStatus_GET_FUNC() __FUNCTION__ +#else +# define _PyStatus_GET_FUNC() __func__ +#endif + +#define _PyStatus_OK() \ + (PyStatus){._type = _PyStatus_TYPE_OK,} + /* other fields are set to 0 */ +#define _PyStatus_ERR(ERR_MSG) \ + (PyStatus){ \ + ._type = _PyStatus_TYPE_ERROR, \ + .func = _PyStatus_GET_FUNC(), \ + .err_msg = (ERR_MSG)} + /* other fields are set to 0 */ +#define _PyStatus_NO_MEMORY() _PyStatus_ERR("memory allocation failed") +#define _PyStatus_EXIT(EXITCODE) \ + (PyStatus){ \ + ._type = _PyStatus_TYPE_EXIT, \ + .exitcode = (EXITCODE)} +#define _PyStatus_IS_ERROR(err) \ + (err._type == _PyStatus_TYPE_ERROR) +#define _PyStatus_IS_EXIT(err) \ + (err._type == _PyStatus_TYPE_EXIT) +#define _PyStatus_EXCEPTION(err) \ + (err._type != _PyStatus_TYPE_OK) +#define _PyStatus_UPDATE_FUNC(err) \ + do { err.func = _PyStatus_GET_FUNC(); } while (0) + +/* --- PyWideStringList ------------------------------------------------ */ + +#define _PyWideStringList_INIT (PyWideStringList){.length = 0, .items = NULL} + +#ifndef NDEBUG +PyAPI_FUNC(int) _PyWideStringList_CheckConsistency(const PyWideStringList *list); +#endif +PyAPI_FUNC(void) _PyWideStringList_Clear(PyWideStringList *list); +PyAPI_FUNC(int) _PyWideStringList_Copy(PyWideStringList *list, + const PyWideStringList *list2); +PyAPI_FUNC(PyStatus) _PyWideStringList_Extend(PyWideStringList *list, + const PyWideStringList *list2); +PyAPI_FUNC(PyObject*) _PyWideStringList_AsList(const PyWideStringList *list); + + +/* --- _PyArgv ---------------------------------------------------- */ + +typedef struct { + Py_ssize_t argc; + int use_bytes_argv; + char * const *bytes_argv; + wchar_t * const *wchar_argv; +} _PyArgv; + +PyAPI_FUNC(PyStatus) _PyArgv_AsWstrList(const _PyArgv *args, + PyWideStringList *list); + + +/* --- Helper functions ------------------------------------------- */ + +PyAPI_FUNC(int) _Py_str_to_int( + const char *str, + int *result); +PyAPI_FUNC(const wchar_t*) _Py_get_xoption( + const PyWideStringList *xoptions, + const wchar_t *name); +PyAPI_FUNC(const char*) _Py_GetEnv( + int use_environment, + const char *name); +PyAPI_FUNC(void) _Py_get_env_flag( + int use_environment, + int *flag, + const char *name); + +/* Py_GetArgcArgv() helper */ +PyAPI_FUNC(void) _Py_ClearArgcArgv(void); + + +/* --- _PyPreCmdline ------------------------------------------------- */ + +typedef struct { + PyWideStringList argv; + PyWideStringList xoptions; /* "-X value" option */ + int isolated; /* -I option */ + int use_environment; /* -E option */ + int dev_mode; /* -X dev and PYTHONDEVMODE */ +} _PyPreCmdline; + +#define _PyPreCmdline_INIT \ + (_PyPreCmdline){ \ + .use_environment = -1, \ + .isolated = -1, \ + .dev_mode = -1} +/* Note: _PyPreCmdline_INIT sets other fields to 0/NULL */ + +extern void _PyPreCmdline_Clear(_PyPreCmdline *cmdline); +extern PyStatus _PyPreCmdline_SetArgv(_PyPreCmdline *cmdline, + const _PyArgv *args); +extern PyStatus _PyPreCmdline_SetConfig( + const _PyPreCmdline *cmdline, + PyConfig *config); +extern PyStatus _PyPreCmdline_Read(_PyPreCmdline *cmdline, + const PyPreConfig *preconfig); + + +/* --- PyPreConfig ----------------------------------------------- */ + +PyAPI_FUNC(void) _PyPreConfig_InitCompatConfig(PyPreConfig *preconfig); +extern void _PyPreConfig_InitFromConfig( + PyPreConfig *preconfig, + const PyConfig *config); +extern PyStatus _PyPreConfig_InitFromPreConfig( + PyPreConfig *preconfig, + const PyPreConfig *config2); +extern PyObject* _PyPreConfig_AsDict(const PyPreConfig *preconfig); +extern void _PyPreConfig_GetConfig(PyPreConfig *preconfig, + const PyConfig *config); +extern PyStatus _PyPreConfig_Read(PyPreConfig *preconfig, + const _PyArgv *args); +extern PyStatus _PyPreConfig_Write(const PyPreConfig *preconfig); + + +/* --- PyConfig ---------------------------------------------- */ + +typedef enum { + /* Py_Initialize() API: backward compatibility with Python 3.6 and 3.7 */ + _PyConfig_INIT_COMPAT = 1, + _PyConfig_INIT_PYTHON = 2, + _PyConfig_INIT_ISOLATED = 3 +} _PyConfigInitEnum; + +PyAPI_FUNC(void) _PyConfig_InitCompatConfig(PyConfig *config); +extern PyStatus _PyConfig_Copy( + PyConfig *config, + const PyConfig *config2); +extern PyStatus _PyConfig_InitPathConfig(PyConfig *config); +extern void _PyConfig_Write(const PyConfig *config, + _PyRuntimeState *runtime); +extern PyStatus _PyConfig_SetPyArgv( + PyConfig *config, + const _PyArgv *args); + + +/* --- Function used for testing ---------------------------------- */ + +PyAPI_FUNC(PyObject*) _Py_GetConfigsAsDict(void); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_CORECONFIG_H */ diff --git a/openflow/include/python3.8/internal/pycore_object.h b/openflow/include/python3.8/internal/pycore_object.h new file mode 100644 index 0000000..7418c69 --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_object.h @@ -0,0 +1,81 @@ +#ifndef Py_INTERNAL_OBJECT_H +#define Py_INTERNAL_OBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_pystate.h" /* _PyRuntime */ + +PyAPI_FUNC(int) _PyType_CheckConsistency(PyTypeObject *type); +PyAPI_FUNC(int) _PyDict_CheckConsistency(PyObject *mp, int check_content); + +/* Tell the GC to track this object. + * + * NB: While the object is tracked by the collector, it must be safe to call the + * ob_traverse method. + * + * Internal note: _PyRuntime.gc.generation0->_gc_prev doesn't have any bit flags + * because it's not object header. So we don't use _PyGCHead_PREV() and + * _PyGCHead_SET_PREV() for it to avoid unnecessary bitwise operations. + * + * The PyObject_GC_Track() function is the public version of this macro. + */ +static inline void _PyObject_GC_TRACK_impl(const char *filename, int lineno, + PyObject *op) +{ + _PyObject_ASSERT_FROM(op, !_PyObject_GC_IS_TRACKED(op), + "object already tracked by the garbage collector", + filename, lineno, "_PyObject_GC_TRACK"); + + PyGC_Head *gc = _Py_AS_GC(op); + _PyObject_ASSERT_FROM(op, + (gc->_gc_prev & _PyGC_PREV_MASK_COLLECTING) == 0, + "object is in generation which is garbage collected", + filename, lineno, "_PyObject_GC_TRACK"); + + PyGC_Head *last = (PyGC_Head*)(_PyRuntime.gc.generation0->_gc_prev); + _PyGCHead_SET_NEXT(last, gc); + _PyGCHead_SET_PREV(gc, last); + _PyGCHead_SET_NEXT(gc, _PyRuntime.gc.generation0); + _PyRuntime.gc.generation0->_gc_prev = (uintptr_t)gc; +} + +#define _PyObject_GC_TRACK(op) \ + _PyObject_GC_TRACK_impl(__FILE__, __LINE__, _PyObject_CAST(op)) + +/* Tell the GC to stop tracking this object. + * + * Internal note: This may be called while GC. So _PyGC_PREV_MASK_COLLECTING + * must be cleared. But _PyGC_PREV_MASK_FINALIZED bit is kept. + * + * The object must be tracked by the GC. + * + * The PyObject_GC_UnTrack() function is the public version of this macro. + */ +static inline void _PyObject_GC_UNTRACK_impl(const char *filename, int lineno, + PyObject *op) +{ + _PyObject_ASSERT_FROM(op, _PyObject_GC_IS_TRACKED(op), + "object not tracked by the garbage collector", + filename, lineno, "_PyObject_GC_UNTRACK"); + + PyGC_Head *gc = _Py_AS_GC(op); + PyGC_Head *prev = _PyGCHead_PREV(gc); + PyGC_Head *next = _PyGCHead_NEXT(gc); + _PyGCHead_SET_NEXT(prev, next); + _PyGCHead_SET_PREV(next, prev); + gc->_gc_next = 0; + gc->_gc_prev &= _PyGC_PREV_MASK_FINALIZED; +} + +#define _PyObject_GC_UNTRACK(op) \ + _PyObject_GC_UNTRACK_impl(__FILE__, __LINE__, _PyObject_CAST(op)) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_OBJECT_H */ diff --git a/openflow/include/python3.8/internal/pycore_pathconfig.h b/openflow/include/python3.8/internal/pycore_pathconfig.h new file mode 100644 index 0000000..ce75cce --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_pathconfig.h @@ -0,0 +1,75 @@ +#ifndef Py_INTERNAL_PATHCONFIG_H +#define Py_INTERNAL_PATHCONFIG_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +typedef struct _PyPathConfig { + /* Full path to the Python program */ + wchar_t *program_full_path; + wchar_t *prefix; + wchar_t *exec_prefix; + /* Set by Py_SetPath(), or computed by _PyConfig_InitPathConfig() */ + wchar_t *module_search_path; + /* Python program name */ + wchar_t *program_name; + /* Set by Py_SetPythonHome() or PYTHONHOME environment variable */ + wchar_t *home; +#ifdef MS_WINDOWS + /* isolated and site_import are used to set Py_IsolatedFlag and + Py_NoSiteFlag flags on Windows in read_pth_file(). These fields + are ignored when their value are equal to -1 (unset). */ + int isolated; + int site_import; + /* Set when a venv is detected */ + wchar_t *base_executable; +#endif +} _PyPathConfig; + +#ifdef MS_WINDOWS +# define _PyPathConfig_INIT \ + {.module_search_path = NULL, \ + .isolated = -1, \ + .site_import = -1} +#else +# define _PyPathConfig_INIT \ + {.module_search_path = NULL} +#endif +/* Note: _PyPathConfig_INIT sets other fields to 0/NULL */ + +PyAPI_DATA(_PyPathConfig) _Py_path_config; +#ifdef MS_WINDOWS +PyAPI_DATA(wchar_t*) _Py_dll_path; +#endif + +extern void _PyPathConfig_ClearGlobal(void); +extern PyStatus _PyPathConfig_SetGlobal( + const struct _PyPathConfig *pathconfig); + +extern PyStatus _PyPathConfig_Calculate( + _PyPathConfig *pathconfig, + const PyConfig *config); +extern int _PyPathConfig_ComputeSysPath0( + const PyWideStringList *argv, + PyObject **path0); +extern int _Py_FindEnvConfigValue( + FILE *env_file, + const wchar_t *key, + wchar_t *value, + size_t value_size); + +#ifdef MS_WINDOWS +extern wchar_t* _Py_GetDLLPath(void); +#endif + +extern PyStatus _PyConfig_WritePathConfig(const PyConfig *config); +extern void _Py_DumpPathConfig(PyThreadState *tstate); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_PATHCONFIG_H */ diff --git a/openflow/include/python3.8/internal/pycore_pyerrors.h b/openflow/include/python3.8/internal/pycore_pyerrors.h new file mode 100644 index 0000000..23327ef --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_pyerrors.h @@ -0,0 +1,62 @@ +#ifndef Py_INTERNAL_PYERRORS_H +#define Py_INTERNAL_PYERRORS_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +static inline PyObject* _PyErr_Occurred(PyThreadState *tstate) +{ + return tstate == NULL ? NULL : tstate->curexc_type; +} + + +PyAPI_FUNC(void) _PyErr_Fetch( + PyThreadState *tstate, + PyObject **type, + PyObject **value, + PyObject **traceback); + +PyAPI_FUNC(int) _PyErr_ExceptionMatches( + PyThreadState *tstate, + PyObject *exc); + +PyAPI_FUNC(void) _PyErr_Restore( + PyThreadState *tstate, + PyObject *type, + PyObject *value, + PyObject *traceback); + +PyAPI_FUNC(void) _PyErr_SetObject( + PyThreadState *tstate, + PyObject *type, + PyObject *value); + +PyAPI_FUNC(void) _PyErr_Clear(PyThreadState *tstate); + +PyAPI_FUNC(void) _PyErr_SetNone(PyThreadState *tstate, PyObject *exception); + +PyAPI_FUNC(void) _PyErr_SetString( + PyThreadState *tstate, + PyObject *exception, + const char *string); + +PyAPI_FUNC(PyObject *) _PyErr_Format( + PyThreadState *tstate, + PyObject *exception, + const char *format, + ...); + +PyAPI_FUNC(void) _PyErr_NormalizeException( + PyThreadState *tstate, + PyObject **exc, + PyObject **val, + PyObject **tb); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_PYERRORS_H */ diff --git a/openflow/include/python3.8/internal/pycore_pyhash.h b/openflow/include/python3.8/internal/pycore_pyhash.h new file mode 100644 index 0000000..a229f8d --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_pyhash.h @@ -0,0 +1,10 @@ +#ifndef Py_INTERNAL_HASH_H +#define Py_INTERNAL_HASH_H + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +uint64_t _Py_KeyedHash(uint64_t, const char *, Py_ssize_t); + +#endif diff --git a/openflow/include/python3.8/internal/pycore_pylifecycle.h b/openflow/include/python3.8/internal/pycore_pylifecycle.h new file mode 100644 index 0000000..d4f0ae2 --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_pylifecycle.h @@ -0,0 +1,116 @@ +#ifndef Py_INTERNAL_LIFECYCLE_H +#define Py_INTERNAL_LIFECYCLE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_initconfig.h" /* _PyArgv */ +#include "pycore_pystate.h" /* _PyRuntimeState */ + +/* True if the main interpreter thread exited due to an unhandled + * KeyboardInterrupt exception, suggesting the user pressed ^C. */ +PyAPI_DATA(int) _Py_UnhandledKeyboardInterrupt; + +extern int _Py_SetFileSystemEncoding( + const char *encoding, + const char *errors); +extern void _Py_ClearFileSystemEncoding(void); +extern PyStatus _PyUnicode_InitEncodings(PyThreadState *tstate); +#ifdef MS_WINDOWS +extern int _PyUnicode_EnableLegacyWindowsFSEncoding(void); +#endif + +PyAPI_FUNC(void) _Py_ClearStandardStreamEncoding(void); + +PyAPI_FUNC(int) _Py_IsLocaleCoercionTarget(const char *ctype_loc); + +/* Various one-time initializers */ + +extern PyStatus _PyUnicode_Init(void); +extern int _PyStructSequence_Init(void); +extern int _PyLong_Init(void); +extern PyStatus _PyFaulthandler_Init(int enable); +extern int _PyTraceMalloc_Init(int enable); +extern PyObject * _PyBuiltin_Init(void); +extern PyStatus _PySys_Create( + _PyRuntimeState *runtime, + PyInterpreterState *interp, + PyObject **sysmod_p); +extern PyStatus _PySys_SetPreliminaryStderr(PyObject *sysdict); +extern PyStatus _PySys_ReadPreinitWarnOptions(PyWideStringList *options); +extern PyStatus _PySys_ReadPreinitXOptions(PyConfig *config); +extern int _PySys_InitMain( + _PyRuntimeState *runtime, + PyInterpreterState *interp); +extern PyStatus _PyImport_Init(PyInterpreterState *interp); +extern PyStatus _PyExc_Init(void); +extern PyStatus _PyErr_Init(void); +extern PyStatus _PyBuiltins_AddExceptions(PyObject * bltinmod); +extern PyStatus _PyImportHooks_Init(void); +extern int _PyFloat_Init(void); +extern PyStatus _Py_HashRandomization_Init(const PyConfig *); + +extern PyStatus _PyTypes_Init(void); +extern PyStatus _PyImportZip_Init(PyInterpreterState *interp); + + +/* Various internal finalizers */ + +extern void PyMethod_Fini(void); +extern void PyFrame_Fini(void); +extern void PyCFunction_Fini(void); +extern void PyDict_Fini(void); +extern void PyTuple_Fini(void); +extern void PyList_Fini(void); +extern void PySet_Fini(void); +extern void PyBytes_Fini(void); +extern void PyFloat_Fini(void); +extern void PyOS_FiniInterrupts(void); +extern void PySlice_Fini(void); +extern void PyAsyncGen_Fini(void); + +extern void _PyExc_Fini(void); +extern void _PyImport_Fini(void); +extern void _PyImport_Fini2(void); +extern void _PyGC_Fini(_PyRuntimeState *runtime); +extern void _PyType_Fini(void); +extern void _Py_HashRandomization_Fini(void); +extern void _PyUnicode_Fini(void); +extern void PyLong_Fini(void); +extern void _PyFaulthandler_Fini(void); +extern void _PyHash_Fini(void); +extern void _PyTraceMalloc_Fini(void); +extern void _PyWarnings_Fini(PyInterpreterState *interp); + +extern void _PyGILState_Init( + _PyRuntimeState *runtime, + PyInterpreterState *interp, + PyThreadState *tstate); +extern void _PyGILState_Fini(_PyRuntimeState *runtime); + +PyAPI_FUNC(void) _PyGC_DumpShutdownStats(_PyRuntimeState *runtime); + +PyAPI_FUNC(PyStatus) _Py_PreInitializeFromPyArgv( + const PyPreConfig *src_config, + const _PyArgv *args); +PyAPI_FUNC(PyStatus) _Py_PreInitializeFromConfig( + const PyConfig *config, + const _PyArgv *args); + + +PyAPI_FUNC(int) _Py_HandleSystemExit(int *exitcode_p); + +PyAPI_FUNC(PyObject*) _PyErr_WriteUnraisableDefaultHook(PyObject *unraisable); + +PyAPI_FUNC(void) _PyErr_Print(PyThreadState *tstate); +PyAPI_FUNC(void) _PyErr_Display(PyObject *file, PyObject *exception, + PyObject *value, PyObject *tb); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_LIFECYCLE_H */ diff --git a/openflow/include/python3.8/internal/pycore_pymem.h b/openflow/include/python3.8/internal/pycore_pymem.h new file mode 100644 index 0000000..22677d3 --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_pymem.h @@ -0,0 +1,194 @@ +#ifndef Py_INTERNAL_PYMEM_H +#define Py_INTERNAL_PYMEM_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "objimpl.h" +#include "pymem.h" + + +/* GC runtime state */ + +/* If we change this, we need to change the default value in the + signature of gc.collect. */ +#define NUM_GENERATIONS 3 + +/* + NOTE: about the counting of long-lived objects. + + To limit the cost of garbage collection, there are two strategies; + - make each collection faster, e.g. by scanning fewer objects + - do less collections + This heuristic is about the latter strategy. + + In addition to the various configurable thresholds, we only trigger a + full collection if the ratio + long_lived_pending / long_lived_total + is above a given value (hardwired to 25%). + + The reason is that, while "non-full" collections (i.e., collections of + the young and middle generations) will always examine roughly the same + number of objects -- determined by the aforementioned thresholds --, + the cost of a full collection is proportional to the total number of + long-lived objects, which is virtually unbounded. + + Indeed, it has been remarked that doing a full collection every + of object creations entails a dramatic performance + degradation in workloads which consist in creating and storing lots of + long-lived objects (e.g. building a large list of GC-tracked objects would + show quadratic performance, instead of linear as expected: see issue #4074). + + Using the above ratio, instead, yields amortized linear performance in + the total number of objects (the effect of which can be summarized + thusly: "each full garbage collection is more and more costly as the + number of objects grows, but we do fewer and fewer of them"). + + This heuristic was suggested by Martin von Löwis on python-dev in + June 2008. His original analysis and proposal can be found at: + http://mail.python.org/pipermail/python-dev/2008-June/080579.html +*/ + +/* + NOTE: about untracking of mutable objects. + + Certain types of container cannot participate in a reference cycle, and + so do not need to be tracked by the garbage collector. Untracking these + objects reduces the cost of garbage collections. However, determining + which objects may be untracked is not free, and the costs must be + weighed against the benefits for garbage collection. + + There are two possible strategies for when to untrack a container: + + i) When the container is created. + ii) When the container is examined by the garbage collector. + + Tuples containing only immutable objects (integers, strings etc, and + recursively, tuples of immutable objects) do not need to be tracked. + The interpreter creates a large number of tuples, many of which will + not survive until garbage collection. It is therefore not worthwhile + to untrack eligible tuples at creation time. + + Instead, all tuples except the empty tuple are tracked when created. + During garbage collection it is determined whether any surviving tuples + can be untracked. A tuple can be untracked if all of its contents are + already not tracked. Tuples are examined for untracking in all garbage + collection cycles. It may take more than one cycle to untrack a tuple. + + Dictionaries containing only immutable objects also do not need to be + tracked. Dictionaries are untracked when created. If a tracked item is + inserted into a dictionary (either as a key or value), the dictionary + becomes tracked. During a full garbage collection (all generations), + the collector will untrack any dictionaries whose contents are not + tracked. + + The module provides the python function is_tracked(obj), which returns + the CURRENT tracking status of the object. Subsequent garbage + collections may change the tracking status of the object. + + Untracking of certain containers was introduced in issue #4688, and + the algorithm was refined in response to issue #14775. +*/ + +struct gc_generation { + PyGC_Head head; + int threshold; /* collection threshold */ + int count; /* count of allocations or collections of younger + generations */ +}; + +/* Running stats per generation */ +struct gc_generation_stats { + /* total number of collections */ + Py_ssize_t collections; + /* total number of collected objects */ + Py_ssize_t collected; + /* total number of uncollectable objects (put into gc.garbage) */ + Py_ssize_t uncollectable; +}; + +struct _gc_runtime_state { + /* List of objects that still need to be cleaned up, singly linked + * via their gc headers' gc_prev pointers. */ + PyObject *trash_delete_later; + /* Current call-stack depth of tp_dealloc calls. */ + int trash_delete_nesting; + + int enabled; + int debug; + /* linked lists of container objects */ + struct gc_generation generations[NUM_GENERATIONS]; + PyGC_Head *generation0; + /* a permanent generation which won't be collected */ + struct gc_generation permanent_generation; + struct gc_generation_stats generation_stats[NUM_GENERATIONS]; + /* true if we are currently running the collector */ + int collecting; + /* list of uncollectable objects */ + PyObject *garbage; + /* a list of callbacks to be invoked when collection is performed */ + PyObject *callbacks; + /* This is the number of objects that survived the last full + collection. It approximates the number of long lived objects + tracked by the GC. + + (by "full collection", we mean a collection of the oldest + generation). */ + Py_ssize_t long_lived_total; + /* This is the number of objects that survived all "non-full" + collections, and are awaiting to undergo a full collection for + the first time. */ + Py_ssize_t long_lived_pending; +}; + +PyAPI_FUNC(void) _PyGC_Initialize(struct _gc_runtime_state *); + + +/* Set the memory allocator of the specified domain to the default. + Save the old allocator into *old_alloc if it's non-NULL. + Return on success, or return -1 if the domain is unknown. */ +PyAPI_FUNC(int) _PyMem_SetDefaultAllocator( + PyMemAllocatorDomain domain, + PyMemAllocatorEx *old_alloc); + +/* Heuristic checking if a pointer value is newly allocated + (uninitialized) or newly freed. The pointer is not dereferenced, only the + pointer value is checked. + + The heuristic relies on the debug hooks on Python memory allocators which + fills newly allocated memory with CLEANBYTE (0xCD) and newly freed memory + with DEADBYTE (0xDD). Detect also "untouchable bytes" marked + with FORBIDDENBYTE (0xFD). */ +static inline int _PyMem_IsPtrFreed(void *ptr) +{ + uintptr_t value = (uintptr_t)ptr; +#if SIZEOF_VOID_P == 8 + return (value == (uintptr_t)0xCDCDCDCDCDCDCDCD + || value == (uintptr_t)0xDDDDDDDDDDDDDDDD + || value == (uintptr_t)0xFDFDFDFDFDFDFDFD); +#elif SIZEOF_VOID_P == 4 + return (value == (uintptr_t)0xCDCDCDCD + || value == (uintptr_t)0xDDDDDDDD + || value == (uintptr_t)0xFDFDFDFD); +#else +# error "unknown pointer size" +#endif +} + +PyAPI_FUNC(int) _PyMem_GetAllocatorName( + const char *name, + PyMemAllocatorName *allocator); + +/* Configure the Python memory allocators. + Pass PYMEM_ALLOCATOR_DEFAULT to use default allocators. + PYMEM_ALLOCATOR_NOT_SET does nothing. */ +PyAPI_FUNC(int) _PyMem_SetupAllocators(PyMemAllocatorName allocator); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_PYMEM_H */ diff --git a/openflow/include/python3.8/internal/pycore_pystate.h b/openflow/include/python3.8/internal/pycore_pystate.h new file mode 100644 index 0000000..f90e7e1 --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_pystate.h @@ -0,0 +1,323 @@ +#ifndef Py_INTERNAL_PYSTATE_H +#define Py_INTERNAL_PYSTATE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "cpython/initconfig.h" +#include "fileobject.h" +#include "pystate.h" +#include "pythread.h" +#include "sysmodule.h" + +#include "pycore_gil.h" /* _gil_runtime_state */ +#include "pycore_pathconfig.h" +#include "pycore_pymem.h" +#include "pycore_warnings.h" + + +/* ceval state */ + +struct _pending_calls { + int finishing; + PyThread_type_lock lock; + /* Request for running pending calls. */ + _Py_atomic_int calls_to_do; + /* Request for looking at the `async_exc` field of the current + thread state. + Guarded by the GIL. */ + int async_exc; +#define NPENDINGCALLS 32 + struct { + int (*func)(void *); + void *arg; + } calls[NPENDINGCALLS]; + int first; + int last; +}; + +struct _ceval_runtime_state { + int recursion_limit; + /* Records whether tracing is on for any thread. Counts the number + of threads for which tstate->c_tracefunc is non-NULL, so if the + value is 0, we know we don't have to check this thread's + c_tracefunc. This speeds up the if statement in + PyEval_EvalFrameEx() after fast_next_opcode. */ + int tracing_possible; + /* This single variable consolidates all requests to break out of + the fast path in the eval loop. */ + _Py_atomic_int eval_breaker; + /* Request for dropping the GIL */ + _Py_atomic_int gil_drop_request; + struct _pending_calls pending; + /* Request for checking signals. */ + _Py_atomic_int signals_pending; + struct _gil_runtime_state gil; +}; + +/* interpreter state */ + +typedef PyObject* (*_PyFrameEvalFunction)(struct _frame *, int); + +// The PyInterpreterState typedef is in Include/pystate.h. +struct _is { + + struct _is *next; + struct _ts *tstate_head; + + int64_t id; + int64_t id_refcount; + int requires_idref; + PyThread_type_lock id_mutex; + + int finalizing; + + PyObject *modules; + PyObject *modules_by_index; + PyObject *sysdict; + PyObject *builtins; + PyObject *importlib; + + /* Used in Python/sysmodule.c. */ + int check_interval; + + /* Used in Modules/_threadmodule.c. */ + long num_threads; + /* Support for runtime thread stack size tuning. + A value of 0 means using the platform's default stack size + or the size specified by the THREAD_STACK_SIZE macro. */ + /* Used in Python/thread.c. */ + size_t pythread_stacksize; + + PyObject *codec_search_path; + PyObject *codec_search_cache; + PyObject *codec_error_registry; + int codecs_initialized; + + /* fs_codec.encoding is initialized to NULL. + Later, it is set to a non-NULL string by _PyUnicode_InitEncodings(). */ + struct { + char *encoding; /* Filesystem encoding (encoded to UTF-8) */ + char *errors; /* Filesystem errors (encoded to UTF-8) */ + _Py_error_handler error_handler; + } fs_codec; + + PyConfig config; +#ifdef HAVE_DLOPEN + int dlopenflags; +#endif + + PyObject *dict; /* Stores per-interpreter state */ + + PyObject *builtins_copy; + PyObject *import_func; + /* Initialized to PyEval_EvalFrameDefault(). */ + _PyFrameEvalFunction eval_frame; + + Py_ssize_t co_extra_user_count; + freefunc co_extra_freefuncs[MAX_CO_EXTRA_USERS]; + +#ifdef HAVE_FORK + PyObject *before_forkers; + PyObject *after_forkers_parent; + PyObject *after_forkers_child; +#endif + /* AtExit module */ + void (*pyexitfunc)(PyObject *); + PyObject *pyexitmodule; + + uint64_t tstate_next_unique_id; + + struct _warnings_runtime_state warnings; + + PyObject *audit_hooks; +}; + +PyAPI_FUNC(struct _is*) _PyInterpreterState_LookUpID(PY_INT64_T); + +PyAPI_FUNC(int) _PyInterpreterState_IDInitref(struct _is *); +PyAPI_FUNC(void) _PyInterpreterState_IDIncref(struct _is *); +PyAPI_FUNC(void) _PyInterpreterState_IDDecref(struct _is *); + + +/* cross-interpreter data registry */ + +/* For now we use a global registry of shareable classes. An + alternative would be to add a tp_* slot for a class's + crossinterpdatafunc. It would be simpler and more efficient. */ + +struct _xidregitem; + +struct _xidregitem { + PyTypeObject *cls; + crossinterpdatafunc getdata; + struct _xidregitem *next; +}; + +/* runtime audit hook state */ + +typedef struct _Py_AuditHookEntry { + struct _Py_AuditHookEntry *next; + Py_AuditHookFunction hookCFunction; + void *userData; +} _Py_AuditHookEntry; + +/* GIL state */ + +struct _gilstate_runtime_state { + int check_enabled; + /* Assuming the current thread holds the GIL, this is the + PyThreadState for the current thread. */ + _Py_atomic_address tstate_current; + PyThreadFrameGetter getframe; + /* The single PyInterpreterState used by this process' + GILState implementation + */ + /* TODO: Given interp_main, it may be possible to kill this ref */ + PyInterpreterState *autoInterpreterState; + Py_tss_t autoTSSkey; +}; + +/* hook for PyEval_GetFrame(), requested for Psyco */ +#define _PyThreadState_GetFrame _PyRuntime.gilstate.getframe + +/* Issue #26558: Flag to disable PyGILState_Check(). + If set to non-zero, PyGILState_Check() always return 1. */ +#define _PyGILState_check_enabled _PyRuntime.gilstate.check_enabled + + +/* Full Python runtime state */ + +typedef struct pyruntimestate { + /* Is running Py_PreInitialize()? */ + int preinitializing; + + /* Is Python preinitialized? Set to 1 by Py_PreInitialize() */ + int preinitialized; + + /* Is Python core initialized? Set to 1 by _Py_InitializeCore() */ + int core_initialized; + + /* Is Python fully initialized? Set to 1 by Py_Initialize() */ + int initialized; + + /* Set by Py_FinalizeEx(). Only reset to NULL if Py_Initialize() + is called again. */ + PyThreadState *finalizing; + + struct pyinterpreters { + PyThread_type_lock mutex; + PyInterpreterState *head; + PyInterpreterState *main; + /* _next_interp_id is an auto-numbered sequence of small + integers. It gets initialized in _PyInterpreterState_Init(), + which is called in Py_Initialize(), and used in + PyInterpreterState_New(). A negative interpreter ID + indicates an error occurred. The main interpreter will + always have an ID of 0. Overflow results in a RuntimeError. + If that becomes a problem later then we can adjust, e.g. by + using a Python int. */ + int64_t next_id; + } interpreters; + // XXX Remove this field once we have a tp_* slot. + struct _xidregistry { + PyThread_type_lock mutex; + struct _xidregitem *head; + } xidregistry; + + unsigned long main_thread; + +#define NEXITFUNCS 32 + void (*exitfuncs[NEXITFUNCS])(void); + int nexitfuncs; + + struct _gc_runtime_state gc; + struct _ceval_runtime_state ceval; + struct _gilstate_runtime_state gilstate; + + PyPreConfig preconfig; + + Py_OpenCodeHookFunction open_code_hook; + void *open_code_userdata; + _Py_AuditHookEntry *audit_hook_head; + + // XXX Consolidate globals found via the check-c-globals script. +} _PyRuntimeState; + +#define _PyRuntimeState_INIT \ + {.preinitialized = 0, .core_initialized = 0, .initialized = 0} +/* Note: _PyRuntimeState_INIT sets other fields to 0/NULL */ + +PyAPI_DATA(_PyRuntimeState) _PyRuntime; +PyAPI_FUNC(PyStatus) _PyRuntimeState_Init(_PyRuntimeState *runtime); +PyAPI_FUNC(void) _PyRuntimeState_Fini(_PyRuntimeState *runtime); +PyAPI_FUNC(void) _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime); + +/* Initialize _PyRuntimeState. + Return NULL on success, or return an error message on failure. */ +PyAPI_FUNC(PyStatus) _PyRuntime_Initialize(void); + +PyAPI_FUNC(void) _PyRuntime_Finalize(void); + +#define _Py_CURRENTLY_FINALIZING(runtime, tstate) \ + (runtime->finalizing == tstate) + + +/* Variable and macro for in-line access to current thread + and interpreter state */ + +#define _PyRuntimeState_GetThreadState(runtime) \ + ((PyThreadState*)_Py_atomic_load_relaxed(&(runtime)->gilstate.tstate_current)) + +/* Get the current Python thread state. + + Efficient macro reading directly the 'gilstate.tstate_current' atomic + variable. The macro is unsafe: it does not check for error and it can + return NULL. + + The caller must hold the GIL. + + See also PyThreadState_Get() and PyThreadState_GET(). */ +#define _PyThreadState_GET() _PyRuntimeState_GetThreadState(&_PyRuntime) + +/* Redefine PyThreadState_GET() as an alias to _PyThreadState_GET() */ +#undef PyThreadState_GET +#define PyThreadState_GET() _PyThreadState_GET() + +/* Get the current interpreter state. + + The macro is unsafe: it does not check for error and it can return NULL. + + The caller must hold the GIL. + + See also _PyInterpreterState_Get() + and _PyGILState_GetInterpreterStateUnsafe(). */ +#define _PyInterpreterState_GET_UNSAFE() (_PyThreadState_GET()->interp) + + +/* Other */ + +PyAPI_FUNC(void) _PyThreadState_Init( + _PyRuntimeState *runtime, + PyThreadState *tstate); +PyAPI_FUNC(void) _PyThreadState_DeleteExcept( + _PyRuntimeState *runtime, + PyThreadState *tstate); + +PyAPI_FUNC(PyThreadState *) _PyThreadState_Swap( + struct _gilstate_runtime_state *gilstate, + PyThreadState *newts); + +PyAPI_FUNC(PyStatus) _PyInterpreterState_Enable(_PyRuntimeState *runtime); +PyAPI_FUNC(void) _PyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime); + +PyAPI_FUNC(void) _PyGILState_Reinit(_PyRuntimeState *runtime); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_PYSTATE_H */ diff --git a/openflow/include/python3.8/internal/pycore_traceback.h b/openflow/include/python3.8/internal/pycore_traceback.h new file mode 100644 index 0000000..bf4d7fe --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_traceback.h @@ -0,0 +1,96 @@ +#ifndef Py_INTERNAL_TRACEBACK_H +#define Py_INTERNAL_TRACEBACK_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pystate.h" /* PyInterpreterState */ + +/* Write the Python traceback into the file 'fd'. For example: + + Traceback (most recent call first): + File "xxx", line xxx in + File "xxx", line xxx in + ... + File "xxx", line xxx in + + This function is written for debug purpose only, to dump the traceback in + the worst case: after a segmentation fault, at fatal error, etc. That's why, + it is very limited. Strings are truncated to 100 characters and encoded to + ASCII with backslashreplace. It doesn't write the source code, only the + function name, filename and line number of each frame. Write only the first + 100 frames: if the traceback is truncated, write the line " ...". + + This function is signal safe. */ + +PyAPI_FUNC(void) _Py_DumpTraceback( + int fd, + PyThreadState *tstate); + +/* Write the traceback of all threads into the file 'fd'. current_thread can be + NULL. + + Return NULL on success, or an error message on error. + + This function is written for debug purpose only. It calls + _Py_DumpTraceback() for each thread, and so has the same limitations. It + only write the traceback of the first 100 threads: write "..." if there are + more threads. + + If current_tstate is NULL, the function tries to get the Python thread state + of the current thread. It is not an error if the function is unable to get + the current Python thread state. + + If interp is NULL, the function tries to get the interpreter state from + the current Python thread state, or from + _PyGILState_GetInterpreterStateUnsafe() in last resort. + + It is better to pass NULL to interp and current_tstate, the function tries + different options to retrieve these informations. + + This function is signal safe. */ + +PyAPI_FUNC(const char*) _Py_DumpTracebackThreads( + int fd, + PyInterpreterState *interp, + PyThreadState *current_tstate); + +/* Write a Unicode object into the file descriptor fd. Encode the string to + ASCII using the backslashreplace error handler. + + Do nothing if text is not a Unicode object. The function accepts Unicode + string which is not ready (PyUnicode_WCHAR_KIND). + + This function is signal safe. */ +PyAPI_FUNC(void) _Py_DumpASCII(int fd, PyObject *text); + +/* Format an integer as decimal into the file descriptor fd. + + This function is signal safe. */ +PyAPI_FUNC(void) _Py_DumpDecimal( + int fd, + unsigned long value); + +/* Format an integer as hexadecimal into the file descriptor fd with at least + width digits. + + The maximum width is sizeof(unsigned long)*2 digits. + + This function is signal safe. */ +PyAPI_FUNC(void) _Py_DumpHexadecimal( + int fd, + unsigned long value, + Py_ssize_t width); + +PyAPI_FUNC(PyObject*) _PyTraceBack_FromFrame( + PyObject *tb_next, + struct _frame *frame); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_TRACEBACK_H */ diff --git a/openflow/include/python3.8/internal/pycore_tupleobject.h b/openflow/include/python3.8/internal/pycore_tupleobject.h new file mode 100644 index 0000000..9fcfc5c --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_tupleobject.h @@ -0,0 +1,19 @@ +#ifndef Py_INTERNAL_TUPLEOBJECT_H +#define Py_INTERNAL_TUPLEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "tupleobject.h" + +#define _PyTuple_ITEMS(op) (_PyTuple_CAST(op)->ob_item) +PyAPI_FUNC(PyObject *) _PyTuple_FromArray(PyObject *const *, Py_ssize_t); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_TUPLEOBJECT_H */ diff --git a/openflow/include/python3.8/internal/pycore_warnings.h b/openflow/include/python3.8/internal/pycore_warnings.h new file mode 100644 index 0000000..73e5350 --- /dev/null +++ b/openflow/include/python3.8/internal/pycore_warnings.h @@ -0,0 +1,25 @@ +#ifndef Py_INTERNAL_WARNINGS_H +#define Py_INTERNAL_WARNINGS_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "object.h" + +struct _warnings_runtime_state { + /* Both 'filters' and 'onceregistry' can be set in warnings.py; + get_warnings_attr() will reset these variables accordingly. */ + PyObject *filters; /* List */ + PyObject *once_registry; /* Dict */ + PyObject *default_action; /* String */ + long filters_version; +}; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_WARNINGS_H */ diff --git a/openflow/include/python3.8/interpreteridobject.h b/openflow/include/python3.8/interpreteridobject.h new file mode 100644 index 0000000..e744fcd --- /dev/null +++ b/openflow/include/python3.8/interpreteridobject.h @@ -0,0 +1,17 @@ +#ifndef Py_INTERPRETERIDOBJECT_H +#define Py_INTERPRETERIDOBJECT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API +# define Py_CPYTHON_INTERPRETERIDOBJECT_H +# include "cpython/interpreteridobject.h" +# undef Py_CPYTHON_INTERPRETERIDOBJECT_H +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERPRETERIDOBJECT_H */ diff --git a/openflow/include/python3.8/intrcheck.h b/openflow/include/python3.8/intrcheck.h new file mode 100644 index 0000000..e5bf5a8 --- /dev/null +++ b/openflow/include/python3.8/intrcheck.h @@ -0,0 +1,33 @@ + +#ifndef Py_INTRCHECK_H +#define Py_INTRCHECK_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(int) PyOS_InterruptOccurred(void); +PyAPI_FUNC(void) PyOS_InitInterrupts(void); +#ifdef HAVE_FORK +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 +PyAPI_FUNC(void) PyOS_BeforeFork(void); +PyAPI_FUNC(void) PyOS_AfterFork_Parent(void); +PyAPI_FUNC(void) PyOS_AfterFork_Child(void); +#endif +#endif +/* Deprecated, please use PyOS_AfterFork_Child() instead */ +Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyOS_AfterFork(void); + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyOS_IsMainThread(void); +PyAPI_FUNC(void) _PySignal_AfterFork(void); + +#ifdef MS_WINDOWS +/* windows.h is not included by Python.h so use void* instead of HANDLE */ +PyAPI_FUNC(void*) _PyOS_SigintEvent(void); +#endif +#endif /* !Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTRCHECK_H */ diff --git a/openflow/usr/include/python3.5m/iterobject.h b/openflow/include/python3.8/iterobject.h similarity index 100% rename from openflow/usr/include/python3.5m/iterobject.h rename to openflow/include/python3.8/iterobject.h diff --git a/openflow/usr/include/python3.5m/listobject.h b/openflow/include/python3.8/listobject.h similarity index 97% rename from openflow/usr/include/python3.5m/listobject.h rename to openflow/include/python3.8/listobject.h index 31843b5..6057279 100644 --- a/openflow/usr/include/python3.5m/listobject.h +++ b/openflow/include/python3.8/listobject.h @@ -71,7 +71,7 @@ PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out); #ifndef Py_LIMITED_API #define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i]) #define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v)) -#define PyList_GET_SIZE(op) Py_SIZE(op) +#define PyList_GET_SIZE(op) (assert(PyList_Check(op)),Py_SIZE(op)) #define _PyList_ITEMS(op) (((PyListObject *)(op))->ob_item) #endif diff --git a/openflow/usr/include/python3.5m/longintrepr.h b/openflow/include/python3.8/longintrepr.h similarity index 75% rename from openflow/usr/include/python3.5m/longintrepr.h rename to openflow/include/python3.8/longintrepr.h index bbba4d8..ff4155f 100644 --- a/openflow/usr/include/python3.5m/longintrepr.h +++ b/openflow/include/python3.8/longintrepr.h @@ -42,30 +42,26 @@ extern "C" { */ #if PYLONG_BITS_IN_DIGIT == 30 -#if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \ - defined HAVE_INT64_T && defined HAVE_INT32_T) -#error "30-bit long digits requested, but the necessary types are not available on this platform" -#endif -typedef PY_UINT32_T digit; -typedef PY_INT32_T sdigit; /* signed variant of digit */ -typedef PY_UINT64_T twodigits; -typedef PY_INT64_T stwodigits; /* signed variant of twodigits */ -#define PyLong_SHIFT 30 -#define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */ -#define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */ +typedef uint32_t digit; +typedef int32_t sdigit; /* signed variant of digit */ +typedef uint64_t twodigits; +typedef int64_t stwodigits; /* signed variant of twodigits */ +#define PyLong_SHIFT 30 +#define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */ +#define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */ #elif PYLONG_BITS_IN_DIGIT == 15 typedef unsigned short digit; typedef short sdigit; /* signed variant of digit */ typedef unsigned long twodigits; typedef long stwodigits; /* signed variant of twodigits */ -#define PyLong_SHIFT 15 -#define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */ -#define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */ +#define PyLong_SHIFT 15 +#define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */ +#define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */ #else #error "PYLONG_BITS_IN_DIGIT should be 15 or 30" #endif -#define PyLong_BASE ((digit)1 << PyLong_SHIFT) -#define PyLong_MASK ((digit)(PyLong_BASE - 1)) +#define PyLong_BASE ((digit)1 << PyLong_SHIFT) +#define PyLong_MASK ((digit)(PyLong_BASE - 1)) #if PyLong_SHIFT % 5 != 0 #error "longobject.c requires that PyLong_SHIFT be divisible by 5" @@ -73,12 +69,12 @@ typedef long stwodigits; /* signed variant of twodigits */ /* Long integer representation. The absolute value of a number is equal to - SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i) + SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i) Negative numbers are represented with ob_size < 0; zero is represented by ob_size == 0. In a normalized number, ob_digit[abs(ob_size)-1] (the most significant digit) is never zero. Also, in all cases, for all valid i, - 0 <= ob_digit[i] <= MASK. + 0 <= ob_digit[i] <= MASK. The allocation function takes care of allocating extra memory so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. @@ -87,8 +83,8 @@ typedef long stwodigits; /* signed variant of twodigits */ */ struct _longobject { - PyObject_VAR_HEAD - digit ob_digit[1]; + PyObject_VAR_HEAD + digit ob_digit[1]; }; PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t); diff --git a/openflow/usr/include/python3.5m/longobject.h b/openflow/include/python3.8/longobject.h similarity index 80% rename from openflow/usr/include/python3.5m/longobject.h rename to openflow/include/python3.8/longobject.h index aed59ce..1e7a58d 100644 --- a/openflow/usr/include/python3.5m/longobject.h +++ b/openflow/include/python3.8/longobject.h @@ -65,7 +65,16 @@ PyAPI_FUNC(PyObject *) PyLong_GetInfo(void); # error "void* different in size from int, long and long long" #endif /* SIZEOF_VOID_P */ -/* Used by Python/mystrtoul.c. */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyLong_UnsignedShort_Converter(PyObject *, void *); +PyAPI_FUNC(int) _PyLong_UnsignedInt_Converter(PyObject *, void *); +PyAPI_FUNC(int) _PyLong_UnsignedLong_Converter(PyObject *, void *); +PyAPI_FUNC(int) _PyLong_UnsignedLongLong_Converter(PyObject *, void *); +PyAPI_FUNC(int) _PyLong_Size_t_Converter(PyObject *, void *); +#endif + +/* Used by Python/mystrtoul.c, _PyBytes_FromHex(), + _PyBytes_DecodeEscapeRecode(), etc. */ #ifndef Py_LIMITED_API PyAPI_DATA(unsigned char) _PyLong_DigitValue[256]; #endif @@ -84,17 +93,16 @@ PyAPI_FUNC(double) PyLong_AsDouble(PyObject *); PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *); PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *); -#ifdef HAVE_LONG_LONG -PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG); -PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG); -PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *); -PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); -PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); -PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *); -#endif /* HAVE_LONG_LONG */ +PyAPI_FUNC(PyObject *) PyLong_FromLongLong(long long); +PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned long long); +PyAPI_FUNC(long long) PyLong_AsLongLong(PyObject *); +PyAPI_FUNC(unsigned long long) PyLong_AsUnsignedLongLong(PyObject *); +PyAPI_FUNC(unsigned long long) PyLong_AsUnsignedLongLongMask(PyObject *); +PyAPI_FUNC(long long) PyLong_AsLongLongAndOverflow(PyObject *, int *); PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int); #ifndef Py_LIMITED_API +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int); PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base); PyAPI_FUNC(PyObject *) _PyLong_FromBytes(const char *, Py_ssize_t, int); @@ -159,7 +167,7 @@ PyAPI_FUNC(PyObject *) _PyLong_FromByteArray( example, if is_signed is 0 and there are more digits in the v than fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of being large enough to hold a sign bit. OverflowError is set in this - case, but bytes holds the least-signficant n bytes of the true value. + case, but bytes holds the least-significant n bytes of the true value. */ PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v, unsigned char* bytes, size_t n, @@ -170,7 +178,17 @@ PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v, nb_int slot is not available or the result of the call to nb_int returns something not of type int. */ -PyAPI_FUNC(PyLongObject *)_PyLong_FromNbInt(PyObject *); +PyAPI_FUNC(PyObject *) _PyLong_FromNbInt(PyObject *); + +/* Convert the given object to a PyLongObject using the nb_index or + nb_int slots, if available (the latter is deprecated). + Raise TypeError if either nb_index and nb_int slots are not + available or the result of the call to nb_index or nb_int + returns something not of type int. + Should be replaced with PyNumber_Index after the end of the + deprecation period. +*/ +PyAPI_FUNC(PyObject *) _PyLong_FromNbIndexOrNbInt(PyObject *); /* _PyLong_Format: Convert the long to a string object with given base, appending a base prefix of 0[box] if base is 2, 8 or 16. */ @@ -182,6 +200,13 @@ PyAPI_FUNC(int) _PyLong_FormatWriter( int base, int alternate); +PyAPI_FUNC(char*) _PyLong_FormatBytesWriter( + _PyBytesWriter *writer, + char *str, + PyObject *obj, + int base, + int alternate); + /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ PyAPI_FUNC(int) _PyLong_FormatAdvancedWriter( @@ -198,8 +223,18 @@ PyAPI_FUNC(int) _PyLong_FormatAdvancedWriter( PyAPI_FUNC(unsigned long) PyOS_strtoul(const char *, char **, int); PyAPI_FUNC(long) PyOS_strtol(const char *, char **, int); +#ifndef Py_LIMITED_API /* For use by the gcd function in mathmodule.c */ PyAPI_FUNC(PyObject *) _PyLong_GCD(PyObject *, PyObject *); +#endif /* !Py_LIMITED_API */ + +#ifndef Py_LIMITED_API +PyAPI_DATA(PyObject *) _PyLong_Zero; +PyAPI_DATA(PyObject *) _PyLong_One; + +PyAPI_FUNC(PyObject *) _PyLong_Rshift(PyObject *, size_t); +PyAPI_FUNC(PyObject *) _PyLong_Lshift(PyObject *, size_t); +#endif #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/marshal.h b/openflow/include/python3.8/marshal.h similarity index 100% rename from openflow/usr/include/python3.5m/marshal.h rename to openflow/include/python3.8/marshal.h diff --git a/openflow/usr/include/python3.5m/memoryobject.h b/openflow/include/python3.8/memoryobject.h similarity index 97% rename from openflow/usr/include/python3.5m/memoryobject.h rename to openflow/include/python3.8/memoryobject.h index ab5ee09..990a716 100644 --- a/openflow/usr/include/python3.5m/memoryobject.h +++ b/openflow/include/python3.8/memoryobject.h @@ -21,8 +21,10 @@ PyAPI_DATA(PyTypeObject) PyMemoryView_Type; #endif PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyMemoryView_FromMemory(char *mem, Py_ssize_t size, int flags); +#endif #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info); #endif diff --git a/openflow/usr/include/python3.5m/methodobject.h b/openflow/include/python3.8/methodobject.h similarity index 76% rename from openflow/usr/include/python3.5m/methodobject.h rename to openflow/include/python3.8/methodobject.h index e2ad804..ba3b887 100644 --- a/openflow/usr/include/python3.5m/methodobject.h +++ b/openflow/include/python3.8/methodobject.h @@ -16,8 +16,12 @@ PyAPI_DATA(PyTypeObject) PyCFunction_Type; #define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type) typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); +typedef PyObject *(*_PyCFunctionFast) (PyObject *, PyObject *const *, Py_ssize_t); typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, PyObject *); +typedef PyObject *(*_PyCFunctionFastWithKeywords) (PyObject *, + PyObject *const *, Py_ssize_t, + PyObject *); typedef PyObject *(*PyNoArgsFunction)(PyObject *); PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *); @@ -37,6 +41,13 @@ PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *); #endif PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyCFunction_FastCallDict(PyObject *func, + PyObject *const *args, + Py_ssize_t nargs, + PyObject *kwargs); +#endif + struct PyMethodDef { const char *ml_name; /* The name of the built-in function/method */ PyCFunction ml_meth; /* The C function that implements it */ @@ -71,6 +82,17 @@ PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *, #define METH_COEXIST 0x0040 +#ifndef Py_LIMITED_API +#define METH_FASTCALL 0x0080 +#endif + +/* This bit is preserved for Stackless Python */ +#ifdef STACKLESS +#define METH_STACKLESS 0x0100 +#else +#define METH_STACKLESS 0x0000 +#endif + #ifndef Py_LIMITED_API typedef struct { PyObject_HEAD @@ -78,7 +100,22 @@ typedef struct { PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */ PyObject *m_module; /* The __module__ attribute, can be anything */ PyObject *m_weakreflist; /* List of weak references */ + vectorcallfunc vectorcall; } PyCFunctionObject; + +PyAPI_FUNC(PyObject *) _PyMethodDef_RawFastCallDict( + PyMethodDef *method, + PyObject *self, + PyObject *const *args, + Py_ssize_t nargs, + PyObject *kwargs); + +PyAPI_FUNC(PyObject *) _PyMethodDef_RawFastCallKeywords( + PyMethodDef *method, + PyObject *self, + PyObject *const *args, + Py_ssize_t nargs, + PyObject *kwnames); #endif PyAPI_FUNC(int) PyCFunction_ClearFreeList(void); diff --git a/openflow/usr/include/python3.5m/modsupport.h b/openflow/include/python3.8/modsupport.h similarity index 62% rename from openflow/usr/include/python3.5m/modsupport.h rename to openflow/include/python3.8/modsupport.h index 829aaf8..f90ede4 100644 --- a/openflow/usr/include/python3.5m/modsupport.h +++ b/openflow/include/python3.8/modsupport.h @@ -19,8 +19,19 @@ extern "C" { #define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT #define Py_BuildValue _Py_BuildValue_SizeT #define Py_VaBuildValue _Py_VaBuildValue_SizeT +#ifndef Py_LIMITED_API +#define _Py_VaBuildStack _Py_VaBuildStack_SizeT +#endif #else +#ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list); +PyAPI_FUNC(PyObject **) _Py_VaBuildStack_SizeT( + PyObject **small_stack, + Py_ssize_t small_stack_len, + const char *format, + va_list va, + Py_ssize_t *p_nargs); +#endif /* !Py_LIMITED_API */ #endif /* Due to a glitch in 3.2, the _SizeT versions weren't exported from the DLL. */ @@ -29,20 +40,98 @@ PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...); PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...); PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, const char *, char **, ...); -PyAPI_FUNC(int) PyArg_ValidateKeywordArguments(PyObject *); -PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...); -PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...); -PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...); -#endif -#ifndef Py_LIMITED_API -PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kw); -PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args); - PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list); PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *, const char *, char **, va_list); #endif +PyAPI_FUNC(int) PyArg_ValidateKeywordArguments(PyObject *); +PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...); +PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...); +PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...); + + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyArg_UnpackStack( + PyObject *const *args, + Py_ssize_t nargs, + const char *name, + Py_ssize_t min, + Py_ssize_t max, + ...); + +PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kwargs); +PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args); +#define _PyArg_NoKeywords(funcname, kwargs) \ + ((kwargs) == NULL || _PyArg_NoKeywords((funcname), (kwargs))) +#define _PyArg_NoPositional(funcname, args) \ + ((args) == NULL || _PyArg_NoPositional((funcname), (args))) + +PyAPI_FUNC(void) _PyArg_BadArgument(const char *, const char *, const char *, PyObject *); +PyAPI_FUNC(int) _PyArg_CheckPositional(const char *, Py_ssize_t, + Py_ssize_t, Py_ssize_t); +#define _PyArg_CheckPositional(funcname, nargs, min, max) \ + (((min) <= (nargs) && (nargs) <= (max)) \ + || _PyArg_CheckPositional((funcname), (nargs), (min), (max))) + +#endif + PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject **) _Py_VaBuildStack( + PyObject **small_stack, + Py_ssize_t small_stack_len, + const char *format, + va_list va, + Py_ssize_t *p_nargs); +#endif + +#ifndef Py_LIMITED_API +typedef struct _PyArg_Parser { + const char *format; + const char * const *keywords; + const char *fname; + const char *custom_msg; + int pos; /* number of positional-only arguments */ + int min; /* minimal number of arguments */ + int max; /* maximal number of positional arguments */ + PyObject *kwtuple; /* tuple of keyword parameter names */ + struct _PyArg_Parser *next; +} _PyArg_Parser; +#ifdef PY_SSIZE_T_CLEAN +#define _PyArg_ParseTupleAndKeywordsFast _PyArg_ParseTupleAndKeywordsFast_SizeT +#define _PyArg_ParseStack _PyArg_ParseStack_SizeT +#define _PyArg_ParseStackAndKeywords _PyArg_ParseStackAndKeywords_SizeT +#define _PyArg_VaParseTupleAndKeywordsFast _PyArg_VaParseTupleAndKeywordsFast_SizeT +#endif +PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *, + struct _PyArg_Parser *, ...); +PyAPI_FUNC(int) _PyArg_ParseStack( + PyObject *const *args, + Py_ssize_t nargs, + const char *format, + ...); +PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords( + PyObject *const *args, + Py_ssize_t nargs, + PyObject *kwnames, + struct _PyArg_Parser *, + ...); +PyAPI_FUNC(int) _PyArg_VaParseTupleAndKeywordsFast(PyObject *, PyObject *, + struct _PyArg_Parser *, va_list); +PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywords( + PyObject *const *args, Py_ssize_t nargs, + PyObject *kwargs, PyObject *kwnames, + struct _PyArg_Parser *parser, + int minpos, int maxpos, int minkw, + PyObject **buf); +#define _PyArg_UnpackKeywords(args, nargs, kwargs, kwnames, parser, minpos, maxpos, minkw, buf) \ + (((minkw) == 0 && (kwargs) == NULL && (kwnames) == NULL && \ + (minpos) <= (nargs) && (nargs) <= (maxpos) && args != NULL) ? (args) : \ + _PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \ + (minpos), (maxpos), (minkw), (buf))) + +void _PyArg_Fini(void); +#endif /* Py_LIMITED_API */ PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *); PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long); @@ -121,6 +210,10 @@ PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module, PyModuleDef *def); PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*, int apiver); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyModule_CreateInitialized(struct PyModuleDef*, + int apiver); +#endif #ifdef Py_LIMITED_API #define PyModule_Create(module) \ @@ -146,7 +239,7 @@ PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def, #endif /* New in 3.5 */ #ifndef Py_LIMITED_API -PyAPI_DATA(char *) _Py_PackageContext; +PyAPI_DATA(const char *) _Py_PackageContext; #endif #ifdef __cplusplus diff --git a/openflow/usr/include/python3.5m/moduleobject.h b/openflow/include/python3.8/moduleobject.h similarity index 87% rename from openflow/usr/include/python3.5m/moduleobject.h rename to openflow/include/python3.8/moduleobject.h index 229d7fa..e246fd2 100644 --- a/openflow/usr/include/python3.5m/moduleobject.h +++ b/openflow/include/python3.8/moduleobject.h @@ -12,20 +12,25 @@ PyAPI_DATA(PyTypeObject) PyModule_Type; #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) #define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_NewObject( PyObject *name ); +#endif PyAPI_FUNC(PyObject *) PyModule_New( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *); +#endif PyAPI_FUNC(const char *) PyModule_GetName(PyObject *); -PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *); +Py_DEPRECATED(3.2) PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *); PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyModule_Clear(PyObject *); PyAPI_FUNC(void) _PyModule_ClearDict(PyObject *); +PyAPI_FUNC(int) _PyModuleSpec_IsInitializing(PyObject *); #endif PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*); PyAPI_FUNC(void*) PyModule_GetState(PyObject*); @@ -77,7 +82,7 @@ typedef struct PyModuleDef{ traverseproc m_traverse; inquiry m_clear; freefunc m_free; -}PyModuleDef; +} PyModuleDef; #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/namespaceobject.h b/openflow/include/python3.8/namespaceobject.h similarity index 85% rename from openflow/usr/include/python3.5m/namespaceobject.h rename to openflow/include/python3.8/namespaceobject.h index a412f05..0c8d95c 100644 --- a/openflow/usr/include/python3.5m/namespaceobject.h +++ b/openflow/include/python3.8/namespaceobject.h @@ -7,9 +7,11 @@ extern "C" { #endif +#ifndef Py_LIMITED_API PyAPI_DATA(PyTypeObject) _PyNamespace_Type; PyAPI_FUNC(PyObject *) _PyNamespace_New(PyObject *kwds); +#endif /* !Py_LIMITED_API */ #ifdef __cplusplus } diff --git a/openflow/include/python3.8/node.h b/openflow/include/python3.8/node.h new file mode 100644 index 0000000..2b39074 --- /dev/null +++ b/openflow/include/python3.8/node.h @@ -0,0 +1,48 @@ + +/* Parse tree node interface */ + +#ifndef Py_NODE_H +#define Py_NODE_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _node { + short n_type; + char *n_str; + int n_lineno; + int n_col_offset; + int n_nchildren; + struct _node *n_child; + int n_end_lineno; + int n_end_col_offset; +} node; + +PyAPI_FUNC(node *) PyNode_New(int type); +PyAPI_FUNC(int) PyNode_AddChild(node *n, int type, + char *str, int lineno, int col_offset, + int end_lineno, int end_col_offset); +PyAPI_FUNC(void) PyNode_Free(node *n); +#ifndef Py_LIMITED_API +PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n); +#endif + +/* Node access functions */ +#define NCH(n) ((n)->n_nchildren) + +#define CHILD(n, i) (&(n)->n_child[i]) +#define RCHILD(n, i) (CHILD(n, NCH(n) + i)) +#define TYPE(n) ((n)->n_type) +#define STR(n) ((n)->n_str) +#define LINENO(n) ((n)->n_lineno) + +/* Assert that the type of a node is what we expect */ +#define REQ(n, type) assert(TYPE(n) == (type)) + +PyAPI_FUNC(void) PyNode_ListTree(node *); +void _PyNode_FinalizeEndPos(node *n); // helper also used in parsetok.c + +#ifdef __cplusplus +} +#endif +#endif /* !Py_NODE_H */ diff --git a/openflow/usr/include/python3.5m/object.h b/openflow/include/python3.8/object.h similarity index 56% rename from openflow/usr/include/python3.5m/object.h rename to openflow/include/python3.8/object.h index 50d9747..cc98d8a 100644 --- a/openflow/usr/include/python3.5m/object.h +++ b/openflow/include/python3.8/object.h @@ -1,5 +1,8 @@ #ifndef Py_OBJECT_H #define Py_OBJECT_H + +#include "pymem.h" /* _Py_tracemalloc_config */ + #ifdef __cplusplus extern "C" { #endif @@ -51,13 +54,8 @@ A standard interface exists for objects that contain an array of items whose size is determined when the object is allocated. */ -/* Py_DEBUG implies Py_TRACE_REFS. */ -#if defined(Py_DEBUG) && !defined(Py_TRACE_REFS) -#define Py_TRACE_REFS -#endif - -/* Py_TRACE_REFS implies Py_REF_DEBUG. */ -#if defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) +/* Py_DEBUG implies Py_REF_DEBUG. */ +#if defined(Py_DEBUG) && !defined(Py_REF_DEBUG) #define Py_REF_DEBUG #endif @@ -109,44 +107,20 @@ typedef struct _object { struct _typeobject *ob_type; } PyObject; +/* Cast argument to PyObject* type. */ +#define _PyObject_CAST(op) ((PyObject*)(op)) + typedef struct { PyObject ob_base; Py_ssize_t ob_size; /* Number of items in variable part */ } PyVarObject; -#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) -#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) -#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) +/* Cast argument to PyVarObject* type. */ +#define _PyVarObject_CAST(op) ((PyVarObject*)(op)) -/********************* String Literals ****************************************/ -/* This structure helps managing static strings. The basic usage goes like this: - Instead of doing - - r = PyObject_CallMethod(o, "foo", "args", ...); - - do - - _Py_IDENTIFIER(foo); - ... - r = _PyObject_CallMethodId(o, &PyId_foo, "args", ...); - - PyId_foo is a static variable, either on block level or file level. On first - usage, the string "foo" is interned, and the structures are linked. On interpreter - shutdown, all strings are released (through _PyUnicode_ClearStaticStrings). - - Alternatively, _Py_static_string allows choosing the variable name. - _PyUnicode_FromId returns a borrowed reference to the interned string. - _PyObject_{Get,Set,Has}AttrId are __getattr__ versions using _Py_Identifier*. -*/ -typedef struct _Py_Identifier { - struct _Py_Identifier *next; - const char* string; - PyObject *object; -} _Py_Identifier; - -#define _Py_static_string_init(value) { 0, value, 0 } -#define _Py_static_string(varname, value) static _Py_Identifier varname = _Py_static_string_init(value) -#define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname) +#define Py_REFCNT(ob) (_PyObject_CAST(ob)->ob_refcnt) +#define Py_TYPE(ob) (_PyObject_CAST(ob)->ob_type) +#define Py_SIZE(ob) (_PyVarObject_CAST(ob)->ob_size) /* Type objects contain a string containing the type name (to help somewhat @@ -174,154 +148,13 @@ typedef int(*ssizeobjargproc)(PyObject *, Py_ssize_t, PyObject *); typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *); -#ifndef Py_LIMITED_API -/* buffer interface */ -typedef struct bufferinfo { - void *buf; - PyObject *obj; /* owned reference */ - Py_ssize_t len; - Py_ssize_t itemsize; /* This is Py_ssize_t so it can be - pointed to by strides in simple case.*/ - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; -} Py_buffer; - -typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); -typedef void (*releasebufferproc)(PyObject *, Py_buffer *); - -/* Maximum number of dimensions */ -#define PyBUF_MAX_NDIM 64 - -/* Flags for getting buffers */ -#define PyBUF_SIMPLE 0 -#define PyBUF_WRITABLE 0x0001 -/* we used to include an E, backwards compatible alias */ -#define PyBUF_WRITEABLE PyBUF_WRITABLE -#define PyBUF_FORMAT 0x0004 -#define PyBUF_ND 0x0008 -#define PyBUF_STRIDES (0x0010 | PyBUF_ND) -#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) -#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) -#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) -#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - -#define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE) -#define PyBUF_CONTIG_RO (PyBUF_ND) - -#define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE) -#define PyBUF_STRIDED_RO (PyBUF_STRIDES) - -#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT) -#define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT) - -#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT) -#define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT) - - -#define PyBUF_READ 0x100 -#define PyBUF_WRITE 0x200 - -/* End buffer interface */ -#endif /* Py_LIMITED_API */ - typedef int (*objobjproc)(PyObject *, PyObject *); typedef int (*visitproc)(PyObject *, void *); typedef int (*traverseproc)(PyObject *, visitproc, void *); -#ifndef Py_LIMITED_API -typedef struct { - /* Number implementations must check *both* - arguments for proper type and implement the necessary conversions - in the slot functions themselves. */ - - binaryfunc nb_add; - binaryfunc nb_subtract; - binaryfunc nb_multiply; - binaryfunc nb_remainder; - binaryfunc nb_divmod; - ternaryfunc nb_power; - unaryfunc nb_negative; - unaryfunc nb_positive; - unaryfunc nb_absolute; - inquiry nb_bool; - unaryfunc nb_invert; - binaryfunc nb_lshift; - binaryfunc nb_rshift; - binaryfunc nb_and; - binaryfunc nb_xor; - binaryfunc nb_or; - unaryfunc nb_int; - void *nb_reserved; /* the slot formerly known as nb_long */ - unaryfunc nb_float; - - binaryfunc nb_inplace_add; - binaryfunc nb_inplace_subtract; - binaryfunc nb_inplace_multiply; - binaryfunc nb_inplace_remainder; - ternaryfunc nb_inplace_power; - binaryfunc nb_inplace_lshift; - binaryfunc nb_inplace_rshift; - binaryfunc nb_inplace_and; - binaryfunc nb_inplace_xor; - binaryfunc nb_inplace_or; - - binaryfunc nb_floor_divide; - binaryfunc nb_true_divide; - binaryfunc nb_inplace_floor_divide; - binaryfunc nb_inplace_true_divide; - - unaryfunc nb_index; - - binaryfunc nb_matrix_multiply; - binaryfunc nb_inplace_matrix_multiply; -} PyNumberMethods; - -typedef struct { - lenfunc sq_length; - binaryfunc sq_concat; - ssizeargfunc sq_repeat; - ssizeargfunc sq_item; - void *was_sq_slice; - ssizeobjargproc sq_ass_item; - void *was_sq_ass_slice; - objobjproc sq_contains; - - binaryfunc sq_inplace_concat; - ssizeargfunc sq_inplace_repeat; -} PySequenceMethods; - -typedef struct { - lenfunc mp_length; - binaryfunc mp_subscript; - objobjargproc mp_ass_subscript; -} PyMappingMethods; - -typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; -} PyAsyncMethods; - -typedef struct { - getbufferproc bf_getbuffer; - releasebufferproc bf_releasebuffer; -} PyBufferProcs; -#endif /* Py_LIMITED_API */ typedef void (*freefunc)(void *); typedef void (*destructor)(PyObject *); -#ifndef Py_LIMITED_API -/* We can't provide a full compile-time check that limited-API - users won't implement tp_print. However, not defining printfunc - and making tp_print of a different function pointer type - should at least cause a warning in most cases. */ -typedef int (*printfunc)(PyObject *, FILE *, int); -#endif typedef PyObject *(*getattrfunc)(PyObject *, char *); typedef PyObject *(*getattrofunc)(PyObject *, PyObject *); typedef int (*setattrfunc)(PyObject *, char *, PyObject *); @@ -338,98 +171,10 @@ typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *); typedef PyObject *(*allocfunc)(struct _typeobject *, Py_ssize_t); #ifdef Py_LIMITED_API -typedef struct _typeobject PyTypeObject; /* opaque */ +/* In Py_LIMITED_API, PyTypeObject is an opaque structure. */ +typedef struct _typeobject PyTypeObject; #else -typedef struct _typeobject { - PyObject_VAR_HEAD - const char *tp_name; /* For printing, in format "." */ - Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ - - /* Methods to implement standard operations */ - - destructor tp_dealloc; - printfunc tp_print; - getattrfunc tp_getattr; - setattrfunc tp_setattr; - PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2) - or tp_reserved (Python 3) */ - reprfunc tp_repr; - - /* Method suites for standard classes */ - - PyNumberMethods *tp_as_number; - PySequenceMethods *tp_as_sequence; - PyMappingMethods *tp_as_mapping; - - /* More standard operations (here for binary compatibility) */ - - hashfunc tp_hash; - ternaryfunc tp_call; - reprfunc tp_str; - getattrofunc tp_getattro; - setattrofunc tp_setattro; - - /* Functions to access object as input/output buffer */ - PyBufferProcs *tp_as_buffer; - - /* Flags to define presence of optional/expanded features */ - unsigned long tp_flags; - - const char *tp_doc; /* Documentation string */ - - /* Assigned meaning in release 2.0 */ - /* call function for all accessible objects */ - traverseproc tp_traverse; - - /* delete references to contained objects */ - inquiry tp_clear; - - /* Assigned meaning in release 2.1 */ - /* rich comparisons */ - richcmpfunc tp_richcompare; - - /* weak reference enabler */ - Py_ssize_t tp_weaklistoffset; - - /* Iterators */ - getiterfunc tp_iter; - iternextfunc tp_iternext; - - /* Attribute descriptor and subclassing stuff */ - struct PyMethodDef *tp_methods; - struct PyMemberDef *tp_members; - struct PyGetSetDef *tp_getset; - struct _typeobject *tp_base; - PyObject *tp_dict; - descrgetfunc tp_descr_get; - descrsetfunc tp_descr_set; - Py_ssize_t tp_dictoffset; - initproc tp_init; - allocfunc tp_alloc; - newfunc tp_new; - freefunc tp_free; /* Low-level free-memory routine */ - inquiry tp_is_gc; /* For PyObject_IS_GC */ - PyObject *tp_bases; - PyObject *tp_mro; /* method resolution order */ - PyObject *tp_cache; - PyObject *tp_subclasses; - PyObject *tp_weaklist; - destructor tp_del; - - /* Type attribute cache version tag. Added in version 2.6 */ - unsigned int tp_version_tag; - - destructor tp_finalize; - -#ifdef COUNT_ALLOCS - /* these must be last and never explicitly initialized */ - Py_ssize_t tp_allocs; - Py_ssize_t tp_frees; - Py_ssize_t tp_maxalloc; - struct _typeobject *tp_prev; - struct _typeobject *tp_next; -#endif -} PyTypeObject; +/* PyTypeObject is defined in cpython/object.h */ #endif typedef struct{ @@ -450,74 +195,32 @@ PyAPI_FUNC(PyObject*) PyType_FromSpec(PyType_Spec*); PyAPI_FUNC(PyObject*) PyType_FromSpecWithBases(PyType_Spec*, PyObject*); #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 -PyAPI_FUNC(void*) PyType_GetSlot(PyTypeObject*, int); -#endif - -#ifndef Py_LIMITED_API -/* The *real* layout of a type object when allocated on the heap */ -typedef struct _heaptypeobject { - /* Note: there's a dependency on the order of these members - in slotptr() in typeobject.c . */ - PyTypeObject ht_type; - PyAsyncMethods as_async; - PyNumberMethods as_number; - PyMappingMethods as_mapping; - PySequenceMethods as_sequence; /* as_sequence comes after as_mapping, - so that the mapping wins when both - the mapping and the sequence define - a given operator (e.g. __getitem__). - see add_operators() in typeobject.c . */ - PyBufferProcs as_buffer; - PyObject *ht_name, *ht_slots, *ht_qualname; - struct _dictkeysobject *ht_cached_keys; - /* here are optional user slots, followed by the members. */ -} PyHeapTypeObject; - -/* access macro to the members which are floating "behind" the object */ -#define PyHeapType_GET_MEMBERS(etype) \ - ((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize)) +PyAPI_FUNC(void*) PyType_GetSlot(struct _typeobject*, int); #endif /* Generic type check */ -PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *); +PyAPI_FUNC(int) PyType_IsSubtype(struct _typeobject *, struct _typeobject *); #define PyObject_TypeCheck(ob, tp) \ (Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp))) -PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */ -PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */ -PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */ +PyAPI_DATA(struct _typeobject) PyType_Type; /* built-in 'type' */ +PyAPI_DATA(struct _typeobject) PyBaseObject_Type; /* built-in 'object' */ +PyAPI_DATA(struct _typeobject) PySuper_Type; /* built-in 'super' */ -PyAPI_FUNC(unsigned long) PyType_GetFlags(PyTypeObject*); +PyAPI_FUNC(unsigned long) PyType_GetFlags(struct _typeobject*); #define PyType_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS) #define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type) -PyAPI_FUNC(int) PyType_Ready(PyTypeObject *); -PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t); -PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *, +PyAPI_FUNC(int) PyType_Ready(struct _typeobject *); +PyAPI_FUNC(PyObject *) PyType_GenericAlloc(struct _typeobject *, Py_ssize_t); +PyAPI_FUNC(PyObject *) PyType_GenericNew(struct _typeobject *, PyObject *, PyObject *); -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); -PyAPI_FUNC(PyObject *) _PyType_LookupId(PyTypeObject *, _Py_Identifier *); -PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, _Py_Identifier *); -PyAPI_FUNC(PyTypeObject *) _PyType_CalculateMetaclass(PyTypeObject *, PyObject *); -#endif PyAPI_FUNC(unsigned int) PyType_ClearCache(void); -PyAPI_FUNC(void) PyType_Modified(PyTypeObject *); - -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) _PyType_GetDocFromInternalDoc(const char *, const char *); -PyAPI_FUNC(PyObject *) _PyType_GetTextSignatureFromInternalDoc(const char *, const char *); -#endif +PyAPI_FUNC(void) PyType_Modified(struct _typeobject *); /* Generic operations on objects */ -struct _Py_Identifier; -#ifndef Py_LIMITED_API -PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int); -PyAPI_FUNC(void) _Py_BreakPoint(void); -PyAPI_FUNC(void) _PyObject_Dump(PyObject *); -#endif PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *); PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *); PyAPI_FUNC(PyObject *) PyObject_ASCII(PyObject *); @@ -530,46 +233,19 @@ PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *); PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *); -PyAPI_FUNC(int) _PyObject_IsAbstract(PyObject *); -PyAPI_FUNC(PyObject *) _PyObject_GetAttrId(PyObject *, struct _Py_Identifier *); -PyAPI_FUNC(int) _PyObject_SetAttrId(PyObject *, struct _Py_Identifier *, PyObject *); -PyAPI_FUNC(int) _PyObject_HasAttrId(PyObject *, struct _Py_Identifier *); -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *); -#endif PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *); -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *); -#endif PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, PyObject *, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(int) PyObject_GenericSetDict(PyObject *, PyObject *, void *); +#endif PyAPI_FUNC(Py_hash_t) PyObject_Hash(PyObject *); PyAPI_FUNC(Py_hash_t) PyObject_HashNotImplemented(PyObject *); PyAPI_FUNC(int) PyObject_IsTrue(PyObject *); PyAPI_FUNC(int) PyObject_Not(PyObject *); PyAPI_FUNC(int) PyCallable_Check(PyObject *); - PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *); -#ifndef Py_LIMITED_API -PyAPI_FUNC(void) PyObject_CallFinalizer(PyObject *); -PyAPI_FUNC(int) PyObject_CallFinalizerFromDealloc(PyObject *); -#endif - -/* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes - dict as the last parameter. */ -PyAPI_FUNC(PyObject *) -_PyObject_GenericGetAttrWithDict(PyObject *, PyObject *, PyObject *); -PyAPI_FUNC(int) -_PyObject_GenericSetAttrWithDict(PyObject *, PyObject *, - PyObject *, PyObject *); - -/* Helper to look up a builtin object */ -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) -_PyObject_GetBuiltin(const char *name); -#endif /* PyObject_Dir(obj) acts like Python builtins.dir(obj), returning a list of strings. PyObject_Dir(NULL) is like builtins.dir(), @@ -587,17 +263,14 @@ PyAPI_FUNC(void) Py_ReprLeave(PyObject *); #define Py_PRINT_RAW 1 /* No string quotes etc. */ /* -`Type flags (tp_flags) +Type flags (tp_flags) -These flags are used to extend the type structure in a backwards-compatible -fashion. Extensions can use the flags to indicate (and test) when a given -type structure contains a new feature. The Python core will use these when -introducing new functionality between major revisions (to avoid mid-version -changes in the PYTHON_API_VERSION). +These flags are used to change expected features and behavior for a +particular type. Arbitration of the flag bit positions will need to be coordinated among -all extension writers who publically release their extensions (this will -be fewer than you might expect!).. +all extension writers who publicly release their extensions (this will +be fewer than you might expect!). Most flags were removed as of Python 3.0 to make room for new flags. (Some flags are not for backwards compatibility but to indicate the presence of an @@ -615,13 +288,18 @@ given type object has a specified feature. /* Set if the type allows subclassing */ #define Py_TPFLAGS_BASETYPE (1UL << 10) +/* Set if the type implements the vectorcall protocol (PEP 590) */ +#ifndef Py_LIMITED_API +#define _Py_TPFLAGS_HAVE_VECTORCALL (1UL << 11) +#endif + /* Set if the type is 'ready' -- fully initialized */ #define Py_TPFLAGS_READY (1UL << 12) /* Set while the type is being 'readied', to prevent recursive ready calls */ #define Py_TPFLAGS_READYING (1UL << 13) -/* Objects support garbage collection (see objimp.h) */ +/* Objects support garbage collection (see objimpl.h) */ #define Py_TPFLAGS_HAVE_GC (1UL << 14) /* These two bits are preserved for Stackless Python, next after this is 17 */ @@ -631,6 +309,9 @@ given type object has a specified feature. #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0 #endif +/* Objects behave like an unbound method */ +#define Py_TPFLAGS_METHOD_DESCRIPTOR (1UL << 17) + /* Objects support type attribute cache */ #define Py_TPFLAGS_HAVE_VERSION_TAG (1UL << 18) #define Py_TPFLAGS_VALID_VERSION_TAG (1UL << 19) @@ -656,13 +337,16 @@ given type object has a specified feature. /* NOTE: The following flags reuse lower bits (removed as part of the * Python 3.0 transition). */ +/* The following flag is kept for compatibility. Starting with 3.8, + * binary compatibility of C extensions accross feature releases of + * Python is not supported anymore, except when using the stable ABI. + */ + /* Type structure has tp_finalize member (3.4) */ #define Py_TPFLAGS_HAVE_FINALIZE (1UL << 0) #ifdef Py_LIMITED_API -#define PyType_HasFeature(t,f) ((PyType_GetFlags(t) & (f)) != 0) -#else -#define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) +# define PyType_HasFeature(t,f) ((PyType_GetFlags(t) & (f)) != 0) #endif #define PyType_FastSubclass(t,f) PyType_HasFeature(t,f) @@ -706,36 +390,26 @@ you can count such references to the type object.) */ #ifdef Py_REF_DEBUG PyAPI_DATA(Py_ssize_t) _Py_RefTotal; -PyAPI_FUNC(void) _Py_NegativeRefcount(const char *fname, - int lineno, PyObject *op); -PyAPI_FUNC(PyObject *) _PyDict_Dummy(void); +PyAPI_FUNC(void) _Py_NegativeRefcount(const char *filename, int lineno, + PyObject *op); PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); #define _Py_INC_REFTOTAL _Py_RefTotal++ #define _Py_DEC_REFTOTAL _Py_RefTotal-- -#define _Py_REF_DEBUG_COMMA , -#define _Py_CHECK_REFCNT(OP) \ -{ if (((PyObject*)OP)->ob_refcnt < 0) \ - _Py_NegativeRefcount(__FILE__, __LINE__, \ - (PyObject *)(OP)); \ -} + /* Py_REF_DEBUG also controls the display of refcounts and memory block * allocations at the interactive prompt and at interpreter shutdown */ PyAPI_FUNC(void) _PyDebug_PrintTotalRefs(void); -#define _PY_DEBUG_PRINT_TOTAL_REFS() _PyDebug_PrintTotalRefs() #else #define _Py_INC_REFTOTAL #define _Py_DEC_REFTOTAL -#define _Py_REF_DEBUG_COMMA -#define _Py_CHECK_REFCNT(OP) /* a semicolon */; -#define _PY_DEBUG_PRINT_TOTAL_REFS() #endif /* Py_REF_DEBUG */ #ifdef COUNT_ALLOCS -PyAPI_FUNC(void) inc_count(PyTypeObject *); -PyAPI_FUNC(void) dec_count(PyTypeObject *); -#define _Py_INC_TPALLOCS(OP) inc_count(Py_TYPE(OP)) -#define _Py_INC_TPFREES(OP) dec_count(Py_TYPE(OP)) +PyAPI_FUNC(void) _Py_inc_count(struct _typeobject *); +PyAPI_FUNC(void) _Py_dec_count(struct _typeobject *); +#define _Py_INC_TPALLOCS(OP) _Py_inc_count(Py_TYPE(OP)) +#define _Py_INC_TPFREES(OP) _Py_dec_count(Py_TYPE(OP)) #define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees-- #define _Py_COUNT_ALLOCS_COMMA , #else @@ -745,48 +419,68 @@ PyAPI_FUNC(void) dec_count(PyTypeObject *); #define _Py_COUNT_ALLOCS_COMMA #endif /* COUNT_ALLOCS */ +/* Update the Python traceback of an object. This function must be called + when a memory block is reused from a free list. */ +PyAPI_FUNC(int) _PyTraceMalloc_NewReference(PyObject *op); + #ifdef Py_TRACE_REFS /* Py_TRACE_REFS is such major surgery that we call external routines. */ PyAPI_FUNC(void) _Py_NewReference(PyObject *); PyAPI_FUNC(void) _Py_ForgetReference(PyObject *); -PyAPI_FUNC(void) _Py_Dealloc(PyObject *); PyAPI_FUNC(void) _Py_PrintReferences(FILE *); PyAPI_FUNC(void) _Py_PrintReferenceAddresses(FILE *); PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force); - #else /* Without Py_TRACE_REFS, there's little enough to do that we expand code - * inline. - */ -#define _Py_NewReference(op) ( \ - _Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA \ - _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ - Py_REFCNT(op) = 1) + inline. */ +static inline void _Py_NewReference(PyObject *op) +{ + if (_Py_tracemalloc_config.tracing) { + _PyTraceMalloc_NewReference(op); + } + _Py_INC_TPALLOCS(op); + _Py_INC_REFTOTAL; + Py_REFCNT(op) = 1; +} -#define _Py_ForgetReference(op) _Py_INC_TPFREES(op) - -#ifdef Py_LIMITED_API -PyAPI_FUNC(void) _Py_Dealloc(PyObject *); -#else -#define _Py_Dealloc(op) ( \ - _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA \ - (*Py_TYPE(op)->tp_dealloc)((PyObject *)(op))) -#endif +static inline void _Py_ForgetReference(PyObject *op) +{ + (void)op; /* may be unused, shut up -Wunused-parameter */ + _Py_INC_TPFREES(op); +} #endif /* !Py_TRACE_REFS */ -#define Py_INCREF(op) ( \ - _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ - ((PyObject *)(op))->ob_refcnt++) -#define Py_DECREF(op) \ - do { \ - PyObject *_py_decref_tmp = (PyObject *)(op); \ - if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \ - --(_py_decref_tmp)->ob_refcnt != 0) \ - _Py_CHECK_REFCNT(_py_decref_tmp) \ - else \ - _Py_Dealloc(_py_decref_tmp); \ - } while (0) +PyAPI_FUNC(void) _Py_Dealloc(PyObject *); + +static inline void _Py_INCREF(PyObject *op) +{ + _Py_INC_REFTOTAL; + op->ob_refcnt++; +} + +#define Py_INCREF(op) _Py_INCREF(_PyObject_CAST(op)) + +static inline void _Py_DECREF(const char *filename, int lineno, + PyObject *op) +{ + (void)filename; /* may be unused, shut up -Wunused-parameter */ + (void)lineno; /* may be unused, shut up -Wunused-parameter */ + _Py_DEC_REFTOTAL; + if (--op->ob_refcnt != 0) { +#ifdef Py_REF_DEBUG + if (op->ob_refcnt < 0) { + _Py_NegativeRefcount(filename, lineno, op); + } +#endif + } + else { + _Py_Dealloc(op); + } +} + +#define Py_DECREF(op) _Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op)) + /* Safely decref `op` and set `op` to NULL, especially useful in tp_clear * and tp_dealloc implementations. @@ -824,63 +518,31 @@ PyAPI_FUNC(void) _Py_Dealloc(PyObject *); */ #define Py_CLEAR(op) \ do { \ - PyObject *_py_tmp = (PyObject *)(op); \ + PyObject *_py_tmp = _PyObject_CAST(op); \ if (_py_tmp != NULL) { \ (op) = NULL; \ Py_DECREF(_py_tmp); \ } \ } while (0) -/* Macros to use in case the object pointer may be NULL: */ -#define Py_XINCREF(op) \ - do { \ - PyObject *_py_xincref_tmp = (PyObject *)(op); \ - if (_py_xincref_tmp != NULL) \ - Py_INCREF(_py_xincref_tmp); \ - } while (0) +/* Function to use in case the object pointer can be NULL: */ +static inline void _Py_XINCREF(PyObject *op) +{ + if (op != NULL) { + Py_INCREF(op); + } +} -#define Py_XDECREF(op) \ - do { \ - PyObject *_py_xdecref_tmp = (PyObject *)(op); \ - if (_py_xdecref_tmp != NULL) \ - Py_DECREF(_py_xdecref_tmp); \ - } while (0) +#define Py_XINCREF(op) _Py_XINCREF(_PyObject_CAST(op)) -#ifndef Py_LIMITED_API -/* Safely decref `op` and set `op` to `op2`. - * - * As in case of Py_CLEAR "the obvious" code can be deadly: - * - * Py_DECREF(op); - * op = op2; - * - * The safe way is: - * - * Py_SETREF(op, op2); - * - * That arranges to set `op` to `op2` _before_ decref'ing, so that any code - * triggered as a side-effect of `op` getting torn down no longer believes - * `op` points to a valid object. - * - * Py_XSETREF is a variant of Py_SETREF that uses Py_XDECREF instead of - * Py_DECREF. - */ +static inline void _Py_XDECREF(PyObject *op) +{ + if (op != NULL) { + Py_DECREF(op); + } +} -#define Py_SETREF(op, op2) \ - do { \ - PyObject *_py_tmp = (PyObject *)(op); \ - (op) = (op2); \ - Py_DECREF(_py_tmp); \ - } while (0) - -#define Py_XSETREF(op, op2) \ - do { \ - PyObject *_py_tmp = (PyObject *)(op); \ - (op) = (op2); \ - Py_XDECREF(_py_tmp); \ - } while (0) - -#endif /* ifndef Py_LIMITED_API */ +#define Py_XDECREF(op) _Py_XDECREF(_PyObject_CAST(op)) /* These are provided as conveniences to Python runtime embedders, so that @@ -889,9 +551,6 @@ they can have object code that is not dependent on Python compilation flags. PyAPI_FUNC(void) Py_IncRef(PyObject *); PyAPI_FUNC(void) Py_DecRef(PyObject *); -PyAPI_DATA(PyTypeObject) _PyNone_Type; -PyAPI_DATA(PyTypeObject) _PyNotImplemented_Type; - /* _Py_NoneStruct is an object of undefined type which can be used in contexts where NULL (nil) is not suitable (since NULL often means 'error'). @@ -923,10 +582,24 @@ PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */ #define Py_GT 4 #define Py_GE 5 -/* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE. - * Defined in object.c. +/* + * Macro for implementing rich comparisons + * + * Needs to be a macro because any C-comparable type can be used. */ -PyAPI_DATA(int) _Py_SwappedOp[]; +#define Py_RETURN_RICHCOMPARE(val1, val2, op) \ + do { \ + switch (op) { \ + case Py_EQ: if ((val1) == (val2)) Py_RETURN_TRUE; Py_RETURN_FALSE; \ + case Py_NE: if ((val1) != (val2)) Py_RETURN_TRUE; Py_RETURN_FALSE; \ + case Py_LT: if ((val1) < (val2)) Py_RETURN_TRUE; Py_RETURN_FALSE; \ + case Py_GT: if ((val1) > (val2)) Py_RETURN_TRUE; Py_RETURN_FALSE; \ + case Py_LE: if ((val1) <= (val2)) Py_RETURN_TRUE; Py_RETURN_FALSE; \ + case Py_GE: if ((val1) >= (val2)) Py_RETURN_TRUE; Py_RETURN_FALSE; \ + default: \ + Py_UNREACHABLE(); \ + } \ + } while (0) /* @@ -986,11 +659,11 @@ times. When deallocating a container object, it's possible to trigger an unbounded chain of deallocations, as each Py_DECREF in turn drops the refcount on "the -next" object in the chain to 0. This can easily lead to stack faults, and +next" object in the chain to 0. This can easily lead to stack overflows, especially in threads (which typically have less stack space to work with). -A container object that participates in cyclic gc can avoid this by -bracketing the body of its tp_dealloc function with a pair of macros: +A container object can avoid this by bracketing the body of its tp_dealloc +function with a pair of macros: static void mytype_dealloc(mytype *p) @@ -998,14 +671,14 @@ mytype_dealloc(mytype *p) ... declarations go here ... PyObject_GC_UnTrack(p); // must untrack first - Py_TRASHCAN_SAFE_BEGIN(p) + Py_TRASHCAN_BEGIN(p, mytype_dealloc) ... The body of the deallocator goes here, including all calls ... ... to Py_DECREF on contained objects. ... - Py_TRASHCAN_SAFE_END(p) + Py_TRASHCAN_END // there should be no code after this } CAUTION: Never return from the middle of the body! If the body needs to -"get out early", put a label immediately before the Py_TRASHCAN_SAFE_END +"get out early", put a label immediately before the Py_TRASHCAN_END call, and goto it. Else the call-depth counter (see below) will stay above 0 forever, and the trashcan will never get emptied. @@ -1019,16 +692,15 @@ without deallocating anything (and so unbounded call-stack depth is avoided). When the call stack finishes unwinding again, code generated by the END macro notices this, and calls another routine to deallocate all the objects that may have been added to the list of deferred deallocations. In effect, a -chain of N deallocations is broken into N / PyTrash_UNWIND_LEVEL pieces, +chain of N deallocations is broken into (N-1)/(PyTrash_UNWIND_LEVEL-1) pieces, with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL. -*/ -/* This is the old private API, invoked by the macros before 3.2.4. - Kept for binary compatibility of extensions using the stable ABI. */ -PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*); -PyAPI_FUNC(void) _PyTrash_destroy_chain(void); -PyAPI_DATA(int) _PyTrash_delete_nesting; -PyAPI_DATA(PyObject *) _PyTrash_delete_later; +Since the tp_dealloc of a subclass typically calls the tp_dealloc of the base +class, we need to ensure that the trashcan is only triggered on the tp_dealloc +of the actual class being deallocated. Otherwise we might end up with a +partially-deallocated object. To check this, the tp_dealloc function must be +passed as second argument to Py_TRASHCAN_BEGIN(). +*/ /* The new thread-safe private API, invoked by the macros below. */ PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyObject*); @@ -1036,28 +708,44 @@ PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void); #define PyTrash_UNWIND_LEVEL 50 -#define Py_TRASHCAN_SAFE_BEGIN(op) \ +#define Py_TRASHCAN_BEGIN_CONDITION(op, cond) \ do { \ - PyThreadState *_tstate = PyThreadState_GET(); \ - if (_tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ - ++_tstate->trash_delete_nesting; - /* The body of the deallocator is here. */ -#define Py_TRASHCAN_SAFE_END(op) \ + PyThreadState *_tstate = NULL; \ + /* If "cond" is false, then _tstate remains NULL and the deallocator \ + * is run normally without involving the trashcan */ \ + if (cond) { \ + _tstate = PyThreadState_GET(); \ + if (_tstate->trash_delete_nesting >= PyTrash_UNWIND_LEVEL) { \ + /* Store the object (to be deallocated later) and jump past \ + * Py_TRASHCAN_END, skipping the body of the deallocator */ \ + _PyTrash_thread_deposit_object(_PyObject_CAST(op)); \ + break; \ + } \ + ++_tstate->trash_delete_nesting; \ + } + /* The body of the deallocator is here. */ +#define Py_TRASHCAN_END \ + if (_tstate) { \ --_tstate->trash_delete_nesting; \ if (_tstate->trash_delete_later && _tstate->trash_delete_nesting <= 0) \ _PyTrash_thread_destroy_chain(); \ } \ - else \ - _PyTrash_thread_deposit_object((PyObject*)op); \ } while (0); +#define Py_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_BEGIN_CONDITION(op, \ + Py_TYPE(op)->tp_dealloc == (destructor)(dealloc)) + +/* For backwards compatibility, these macros enable the trashcan + * unconditionally */ +#define Py_TRASHCAN_SAFE_BEGIN(op) Py_TRASHCAN_BEGIN_CONDITION(op, 1) +#define Py_TRASHCAN_SAFE_END(op) Py_TRASHCAN_END + + #ifndef Py_LIMITED_API -PyAPI_FUNC(void) -_PyDebugAllocatorStats(FILE *out, const char *block_name, int num_blocks, - size_t sizeof_block); -PyAPI_FUNC(void) -_PyObject_DebugTypeStats(FILE *out); -#endif /* ifndef Py_LIMITED_API */ +# define Py_CPYTHON_OBJECT_H +# include "cpython/object.h" +# undef Py_CPYTHON_OBJECT_H +#endif #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/objimpl.h b/openflow/include/python3.8/objimpl.h similarity index 64% rename from openflow/usr/include/python3.5m/objimpl.h rename to openflow/include/python3.8/objimpl.h index 65b6d91..2337d8a 100644 --- a/openflow/usr/include/python3.5m/objimpl.h +++ b/openflow/include/python3.8/objimpl.h @@ -56,7 +56,7 @@ must use the platform malloc heap(s), or shared memory, or C++ local storage or operator new), you must first allocate the object with your custom allocator, then pass its pointer to PyObject_{Init, InitVar} for filling in its Python- specific fields: reference count, type pointer, possibly others. You should -be aware that Python no control over these objects because they don't +be aware that Python has no control over these objects because they don't cooperate with the Python memory manager. Such objects may not be eligible for automatic garbage collection and you have to make sure that they are released accordingly whenever their destructor gets called (cf. the specific @@ -95,19 +95,12 @@ PyObject_{New, NewVar, Del}. the raw memory. */ PyAPI_FUNC(void *) PyObject_Malloc(size_t size); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(void *) PyObject_Calloc(size_t nelem, size_t elsize); +#endif PyAPI_FUNC(void *) PyObject_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyObject_Free(void *ptr); -/* This function returns the number of allocated memory blocks, regardless of size */ -PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void); - -/* Macros */ -#ifdef WITH_PYMALLOC -#ifndef Py_LIMITED_API -PyAPI_FUNC(void) _PyObject_DebugMallocStats(FILE *out); -#endif /* #ifndef Py_LIMITED_API */ -#endif /* Macros */ #define PyObject_MALLOC PyObject_Malloc @@ -134,12 +127,38 @@ PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t); #define PyObject_NewVar(type, typeobj, n) \ ( (type *) _PyObject_NewVar((typeobj), (n)) ) -/* Macros trading binary compatibility for speed. See also pymem.h. - Note that these macros expect non-NULL object pointers.*/ +/* Inline functions trading binary compatibility for speed: + PyObject_INIT() is the fast version of PyObject_Init(), and + PyObject_INIT_VAR() is the fast version of PyObject_InitVar. + See also pymem.h. + + These inline functions expect non-NULL object pointers. */ +static inline PyObject* +_PyObject_INIT(PyObject *op, PyTypeObject *typeobj) +{ + assert(op != NULL); + Py_TYPE(op) = typeobj; + if (PyType_GetFlags(typeobj) & Py_TPFLAGS_HEAPTYPE) { + Py_INCREF(typeobj); + } + _Py_NewReference(op); + return op; +} + #define PyObject_INIT(op, typeobj) \ - ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) + _PyObject_INIT(_PyObject_CAST(op), (typeobj)) + +static inline PyVarObject* +_PyObject_INIT_VAR(PyVarObject *op, PyTypeObject *typeobj, Py_ssize_t size) +{ + assert(op != NULL); + Py_SIZE(op) = size; + PyObject_INIT((PyObject *)op, typeobj); + return op; +} + #define PyObject_INIT_VAR(op, typeobj, size) \ - ( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) ) + _PyObject_INIT_VAR(_PyVarObject_CAST(op), (typeobj), (size)) #define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize ) @@ -199,24 +218,6 @@ PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t); constructor you would start directly with PyObject_Init/InitVar */ -#ifndef Py_LIMITED_API -typedef struct { - /* user context passed as the first argument to the 2 functions */ - void *ctx; - - /* allocate an arena of size bytes */ - void* (*alloc) (void *ctx, size_t size); - - /* free an arena */ - void (*free) (void *ctx, void *ptr, size_t size); -} PyObjectArenaAllocator; - -/* Get the arena allocator. */ -PyAPI_FUNC(void) PyObject_GetArenaAllocator(PyObjectArenaAllocator *allocator); - -/* Set the arena allocator. */ -PyAPI_FUNC(void) PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator); -#endif /* @@ -224,110 +225,31 @@ PyAPI_FUNC(void) PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator); * ========================== */ -/* C equivalent of gc.collect(). */ +/* C equivalent of gc.collect() which ignores the state of gc.enabled. */ PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void); -#ifndef Py_LIMITED_API -PyAPI_FUNC(Py_ssize_t) _PyGC_CollectNoFail(void); -#endif - /* Test if a type has a GC head */ #define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC) -/* Test if an object has a GC head */ -#define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \ - (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o))) - PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t); #define PyObject_GC_Resize(type, op, n) \ - ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) ) + ( (type *) _PyObject_GC_Resize(_PyVarObject_CAST(op), (n)) ) -/* GC information is stored BEFORE the object structure. */ -#ifndef Py_LIMITED_API -typedef union _gc_head { - struct { - union _gc_head *gc_next; - union _gc_head *gc_prev; - Py_ssize_t gc_refs; - } gc; - double dummy; /* force worst-case alignment */ -} PyGC_Head; -extern PyGC_Head *_PyGC_generation0; -#define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) - -/* Bit 0 is set when tp_finalize is called */ -#define _PyGC_REFS_MASK_FINALIZED (1 << 0) -/* The (N-1) most significant bits contain the gc state / refcount */ -#define _PyGC_REFS_SHIFT (1) -#define _PyGC_REFS_MASK (((size_t) -1) << _PyGC_REFS_SHIFT) - -#define _PyGCHead_REFS(g) ((g)->gc.gc_refs >> _PyGC_REFS_SHIFT) -#define _PyGCHead_SET_REFS(g, v) do { \ - (g)->gc.gc_refs = ((g)->gc.gc_refs & ~_PyGC_REFS_MASK) \ - | (((size_t)(v)) << _PyGC_REFS_SHIFT); \ - } while (0) -#define _PyGCHead_DECREF(g) ((g)->gc.gc_refs -= 1 << _PyGC_REFS_SHIFT) - -#define _PyGCHead_FINALIZED(g) (((g)->gc.gc_refs & _PyGC_REFS_MASK_FINALIZED) != 0) -#define _PyGCHead_SET_FINALIZED(g, v) do { \ - (g)->gc.gc_refs = ((g)->gc.gc_refs & ~_PyGC_REFS_MASK_FINALIZED) \ - | (v != 0); \ - } while (0) - -#define _PyGC_FINALIZED(o) _PyGCHead_FINALIZED(_Py_AS_GC(o)) -#define _PyGC_SET_FINALIZED(o, v) _PyGCHead_SET_FINALIZED(_Py_AS_GC(o), v) - -#define _PyGC_REFS(o) _PyGCHead_REFS(_Py_AS_GC(o)) - -#define _PyGC_REFS_UNTRACKED (-2) -#define _PyGC_REFS_REACHABLE (-3) -#define _PyGC_REFS_TENTATIVELY_UNREACHABLE (-4) - -/* Tell the GC to track this object. NB: While the object is tracked the - * collector it must be safe to call the ob_traverse method. */ -#define _PyObject_GC_TRACK(o) do { \ - PyGC_Head *g = _Py_AS_GC(o); \ - if (_PyGCHead_REFS(g) != _PyGC_REFS_UNTRACKED) \ - Py_FatalError("GC object already tracked"); \ - _PyGCHead_SET_REFS(g, _PyGC_REFS_REACHABLE); \ - g->gc.gc_next = _PyGC_generation0; \ - g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \ - g->gc.gc_prev->gc.gc_next = g; \ - _PyGC_generation0->gc.gc_prev = g; \ - } while (0); - -/* Tell the GC to stop tracking this object. - * gc_next doesn't need to be set to NULL, but doing so is a good - * way to provoke memory errors if calling code is confused. - */ -#define _PyObject_GC_UNTRACK(o) do { \ - PyGC_Head *g = _Py_AS_GC(o); \ - assert(_PyGCHead_REFS(g) != _PyGC_REFS_UNTRACKED); \ - _PyGCHead_SET_REFS(g, _PyGC_REFS_UNTRACKED); \ - g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \ - g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \ - g->gc.gc_next = NULL; \ - } while (0); - -/* True if the object is currently tracked by the GC. */ -#define _PyObject_GC_IS_TRACKED(o) \ - (_PyGC_REFS(o) != _PyGC_REFS_UNTRACKED) - -/* True if the object may be tracked by the GC in the future, or already is. - This can be useful to implement some optimizations. */ -#define _PyObject_GC_MAY_BE_TRACKED(obj) \ - (PyObject_IS_GC(obj) && \ - (!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj))) -#endif /* Py_LIMITED_API */ - -PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t size); -PyAPI_FUNC(PyObject *) _PyObject_GC_Calloc(size_t size); PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *); PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t); + +/* Tell the GC to track this object. + * + * See also private _PyObject_GC_TRACK() macro. */ PyAPI_FUNC(void) PyObject_GC_Track(void *); + +/* Tell the GC to stop tracking this object. + * + * See also private _PyObject_GC_UNTRACK() macro. */ PyAPI_FUNC(void) PyObject_GC_UnTrack(void *); + PyAPI_FUNC(void) PyObject_GC_Del(void *); #define PyObject_GC_New(type, typeobj) \ @@ -344,18 +266,17 @@ PyAPI_FUNC(void) PyObject_GC_Del(void *); #define Py_VISIT(op) \ do { \ if (op) { \ - int vret = visit((PyObject *)(op), arg); \ + int vret = visit(_PyObject_CAST(op), arg); \ if (vret) \ return vret; \ } \ } while (0) - -/* Test if a type supports weak references */ -#define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0) - -#define PyObject_GET_WEAKREFS_LISTPTR(o) \ - ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset)) +#ifndef Py_LIMITED_API +# define Py_CPYTHON_OBJIMPL_H +# include "cpython/objimpl.h" +# undef Py_CPYTHON_OBJIMPL_H +#endif #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/odictobject.h b/openflow/include/python3.8/odictobject.h similarity index 66% rename from openflow/usr/include/python3.5m/odictobject.h rename to openflow/include/python3.8/odictobject.h index c1d9592..35aff8a 100644 --- a/openflow/usr/include/python3.5m/odictobject.h +++ b/openflow/include/python3.8/odictobject.h @@ -6,6 +6,7 @@ extern "C" { /* OrderedDict */ +/* This API is optional and mostly redundant. */ #ifndef Py_LIMITED_API @@ -17,25 +18,24 @@ PyAPI_DATA(PyTypeObject) PyODictKeys_Type; PyAPI_DATA(PyTypeObject) PyODictItems_Type; PyAPI_DATA(PyTypeObject) PyODictValues_Type; -#endif /* Py_LIMITED_API */ - #define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type) #define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type) -#define PyODict_SIZE(op) ((PyDictObject *)op)->ma_used -#define PyODict_HasKey(od, key) (PyMapping_HasKey(PyObject *)od, key) +#define PyODict_SIZE(op) PyDict_GET_SIZE((op)) PyAPI_FUNC(PyObject *) PyODict_New(void); PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item); PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key); /* wrappers around PyDict* functions */ -#define PyODict_GetItem(od, key) PyDict_GetItem((PyObject *)od, key) +#define PyODict_GetItem(od, key) PyDict_GetItem(_PyObject_CAST(od), key) #define PyODict_GetItemWithError(od, key) \ - PyDict_GetItemWithError((PyObject *)od, key) -#define PyODict_Contains(od, key) PyDict_Contains((PyObject *)od, key) -#define PyODict_Size(od) PyDict_Size((PyObject *)od) + PyDict_GetItemWithError(_PyObject_CAST(od), key) +#define PyODict_Contains(od, key) PyDict_Contains(_PyObject_CAST(od), key) +#define PyODict_Size(od) PyDict_Size(_PyObject_CAST(od)) #define PyODict_GetItemString(od, key) \ - PyDict_GetItemString((PyObject *)od, key) + PyDict_GetItemString(_PyObject_CAST(od), key) + +#endif #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/opcode.h b/openflow/include/python3.8/opcode.h similarity index 89% rename from openflow/usr/include/python3.5m/opcode.h rename to openflow/include/python3.8/opcode.h index 3f917fb..2a29e97 100644 --- a/openflow/usr/include/python3.5m/opcode.h +++ b/openflow/include/python3.8/opcode.h @@ -1,4 +1,4 @@ -/* Auto-generated by Tools/scripts/generate_opcode_h.py */ +/* Auto-generated by Tools/scripts/generate_opcode_h.py from Lib/opcode.py */ #ifndef Py_OPCODE_H #define Py_OPCODE_H #ifdef __cplusplus @@ -12,6 +12,7 @@ extern "C" { #define ROT_THREE 3 #define DUP_TOP 4 #define DUP_TOP_TWO 5 +#define ROT_FOUR 6 #define NOP 9 #define UNARY_POSITIVE 10 #define UNARY_NEGATIVE 11 @@ -32,6 +33,8 @@ extern "C" { #define GET_AITER 50 #define GET_ANEXT 51 #define BEFORE_ASYNC_WITH 52 +#define BEGIN_FINALLY 53 +#define END_ASYNC_FOR 54 #define INPLACE_ADD 55 #define INPLACE_SUBTRACT 56 #define INPLACE_MULTIPLY 57 @@ -55,11 +58,11 @@ extern "C" { #define INPLACE_AND 77 #define INPLACE_XOR 78 #define INPLACE_OR 79 -#define BREAK_LOOP 80 #define WITH_CLEANUP_START 81 #define WITH_CLEANUP_FINISH 82 #define RETURN_VALUE 83 #define IMPORT_STAR 84 +#define SETUP_ANNOTATIONS 85 #define YIELD_VALUE 86 #define POP_BLOCK 87 #define END_FINALLY 88 @@ -91,9 +94,6 @@ extern "C" { #define POP_JUMP_IF_FALSE 114 #define POP_JUMP_IF_TRUE 115 #define LOAD_GLOBAL 116 -#define CONTINUE_LOOP 119 -#define SETUP_LOOP 120 -#define SETUP_EXCEPT 121 #define SETUP_FINALLY 122 #define LOAD_FAST 124 #define STORE_FAST 125 @@ -102,14 +102,12 @@ extern "C" { #define CALL_FUNCTION 131 #define MAKE_FUNCTION 132 #define BUILD_SLICE 133 -#define MAKE_CLOSURE 134 #define LOAD_CLOSURE 135 #define LOAD_DEREF 136 #define STORE_DEREF 137 #define DELETE_DEREF 138 -#define CALL_FUNCTION_VAR 140 #define CALL_FUNCTION_KW 141 -#define CALL_FUNCTION_VAR_KW 142 +#define CALL_FUNCTION_EX 142 #define SETUP_WITH 143 #define EXTENDED_ARG 144 #define LIST_APPEND 145 @@ -122,6 +120,14 @@ extern "C" { #define BUILD_TUPLE_UNPACK 152 #define BUILD_SET_UNPACK 153 #define SETUP_ASYNC_WITH 154 +#define FORMAT_VALUE 155 +#define BUILD_CONST_KEY_MAP 156 +#define BUILD_STRING 157 +#define BUILD_TUPLE_UNPACK_WITH_CALL 158 +#define LOAD_METHOD 160 +#define CALL_METHOD 161 +#define CALL_FINALLY 162 +#define POP_FINALLY 163 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/openflow/usr/include/python3.5m/osdefs.h b/openflow/include/python3.8/osdefs.h similarity index 93% rename from openflow/usr/include/python3.5m/osdefs.h rename to openflow/include/python3.8/osdefs.h index bd84c1c..3243944 100644 --- a/openflow/usr/include/python3.5m/osdefs.h +++ b/openflow/include/python3.8/osdefs.h @@ -14,6 +14,10 @@ extern "C" { #define DELIM L';' #endif +#ifdef __VXWORKS__ +#define DELIM L';' +#endif + /* Filename separator */ #ifndef SEP #define SEP L'/' diff --git a/openflow/include/python3.8/osmodule.h b/openflow/include/python3.8/osmodule.h new file mode 100644 index 0000000..9095c2f --- /dev/null +++ b/openflow/include/python3.8/osmodule.h @@ -0,0 +1,17 @@ + +/* os module interface */ + +#ifndef Py_OSMODULE_H +#define Py_OSMODULE_H +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 +PyAPI_FUNC(PyObject *) PyOS_FSPath(PyObject *path); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_OSMODULE_H */ diff --git a/openflow/usr/include/python3.5m/parsetok.h b/openflow/include/python3.8/parsetok.h similarity index 90% rename from openflow/usr/include/python3.5m/parsetok.h rename to openflow/include/python3.8/parsetok.h index 2acb854..935d733 100644 --- a/openflow/usr/include/python3.5m/parsetok.h +++ b/openflow/include/python3.8/parsetok.h @@ -1,5 +1,5 @@ - /* Parser-tokenizer link interface */ + #ifndef Py_LIMITED_API #ifndef Py_PARSETOK_H #define Py_PARSETOK_H @@ -7,12 +7,12 @@ extern "C" { #endif +#include "grammar.h" /* grammar */ +#include "node.h" /* node */ + typedef struct { int error; -#ifndef PGEN - /* The filename is useless for pgen, see comment in tok_state structure */ PyObject *filename; -#endif int lineno; int offset; char *text; /* UTF-8-encoded string */ @@ -21,19 +21,21 @@ typedef struct { } perrdetail; #if 0 -#define PyPARSE_YIELD_IS_KEYWORD 0x0001 +#define PyPARSE_YIELD_IS_KEYWORD 0x0001 #endif -#define PyPARSE_DONT_IMPLY_DEDENT 0x0002 +#define PyPARSE_DONT_IMPLY_DEDENT 0x0002 #if 0 -#define PyPARSE_WITH_IS_KEYWORD 0x0003 +#define PyPARSE_WITH_IS_KEYWORD 0x0003 #define PyPARSE_PRINT_IS_FUNCTION 0x0004 #define PyPARSE_UNICODE_LITERALS 0x0008 #endif #define PyPARSE_IGNORE_COOKIE 0x0010 #define PyPARSE_BARRY_AS_BDFL 0x0020 +#define PyPARSE_TYPE_COMMENTS 0x0040 +#define PyPARSE_ASYNC_HACKS 0x0080 PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int, perrdetail *); diff --git a/openflow/include/python3.8/patchlevel.h b/openflow/include/python3.8/patchlevel.h new file mode 100644 index 0000000..d685a85 --- /dev/null +++ b/openflow/include/python3.8/patchlevel.h @@ -0,0 +1,35 @@ + +/* Python version identification scheme. + + When the major or minor version changes, the VERSION variable in + configure.ac must also be changed. + + There is also (independent) API version information in modsupport.h. +*/ + +/* Values for PY_RELEASE_LEVEL */ +#define PY_RELEASE_LEVEL_ALPHA 0xA +#define PY_RELEASE_LEVEL_BETA 0xB +#define PY_RELEASE_LEVEL_GAMMA 0xC /* For release candidates */ +#define PY_RELEASE_LEVEL_FINAL 0xF /* Serial should be 0 here */ + /* Higher for patch releases */ + +/* Version parsed out into numeric values */ +/*--start constants--*/ +#define PY_MAJOR_VERSION 3 +#define PY_MINOR_VERSION 8 +#define PY_MICRO_VERSION 0 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 + +/* Version as a string */ +#define PY_VERSION "3.8.0" +/*--end constants--*/ + +/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. + Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */ +#define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \ + (PY_MINOR_VERSION << 16) | \ + (PY_MICRO_VERSION << 8) | \ + (PY_RELEASE_LEVEL << 4) | \ + (PY_RELEASE_SERIAL << 0)) diff --git a/openflow/include/python3.8/picklebufobject.h b/openflow/include/python3.8/picklebufobject.h new file mode 100644 index 0000000..f07e900 --- /dev/null +++ b/openflow/include/python3.8/picklebufobject.h @@ -0,0 +1,31 @@ +/* PickleBuffer object. This is built-in for ease of use from third-party + * C extensions. + */ + +#ifndef Py_PICKLEBUFOBJECT_H +#define Py_PICKLEBUFOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API + +PyAPI_DATA(PyTypeObject) PyPickleBuffer_Type; + +#define PyPickleBuffer_Check(op) (Py_TYPE(op) == &PyPickleBuffer_Type) + +/* Create a PickleBuffer redirecting to the given buffer-enabled object */ +PyAPI_FUNC(PyObject *) PyPickleBuffer_FromObject(PyObject *); +/* Get the PickleBuffer's underlying view to the original object + * (NULL if released) + */ +PyAPI_FUNC(const Py_buffer *) PyPickleBuffer_GetBuffer(PyObject *); +/* Release the PickleBuffer. Returns 0 on success, -1 on error. */ +PyAPI_FUNC(int) PyPickleBuffer_Release(PyObject *); + +#endif /* !Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PICKLEBUFOBJECT_H */ diff --git a/openflow/include/python3.8/py_curses.h b/openflow/include/python3.8/py_curses.h new file mode 100644 index 0000000..2702b37 --- /dev/null +++ b/openflow/include/python3.8/py_curses.h @@ -0,0 +1,100 @@ + +#ifndef Py_CURSES_H +#define Py_CURSES_H + +#ifdef __APPLE__ +/* +** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards +** against multiple definition of wchar_t. +*/ +#ifdef _BSD_WCHAR_T_DEFINED_ +#define _WCHAR_T +#endif +#endif /* __APPLE__ */ + +/* On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards + against multiple definition of wchar_t and wint_t. */ +#if defined(__FreeBSD__) && defined(_XOPEN_SOURCE_EXTENDED) +# ifndef __wchar_t +# define __wchar_t +# endif +# ifndef __wint_t +# define __wint_t +# endif +#endif + +#if !defined(HAVE_CURSES_IS_PAD) && defined(WINDOW_HAS_FLAGS) +/* The following definition is necessary for ncurses 5.7; without it, + some of [n]curses.h set NCURSES_OPAQUE to 1, and then Python + can't get at the WINDOW flags field. */ +#define NCURSES_OPAQUE 0 +#endif + +#ifdef HAVE_NCURSES_H +#include +#else +#include +#endif + +#ifdef HAVE_NCURSES_H +/* configure was checking , but we will + use , which has some or all these features. */ +#if !defined(WINDOW_HAS_FLAGS) && !(NCURSES_OPAQUE+0) +#define WINDOW_HAS_FLAGS 1 +#endif +#if !defined(HAVE_CURSES_IS_PAD) && NCURSES_VERSION_PATCH+0 >= 20090906 +#define HAVE_CURSES_IS_PAD 1 +#endif +#ifndef MVWDELCH_IS_EXPRESSION +#define MVWDELCH_IS_EXPRESSION 1 +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define PyCurses_API_pointers 4 + +/* Type declarations */ + +typedef struct { + PyObject_HEAD + WINDOW *win; + char *encoding; +} PyCursesWindowObject; + +#define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type) + +#define PyCurses_CAPSULE_NAME "_curses._C_API" + + +#ifdef CURSES_MODULE +/* This section is used when compiling _cursesmodule.c */ + +#else +/* This section is used in modules that use the _cursesmodule API */ + +static void **PyCurses_API; + +#define PyCursesWindow_Type (*(PyTypeObject *) PyCurses_API[0]) +#define PyCursesSetupTermCalled {if (! ((int (*)(void))PyCurses_API[1]) () ) return NULL;} +#define PyCursesInitialised {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;} +#define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;} + +#define import_curses() \ + PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1); + +#endif + +/* general error messages */ +static const char catchall_ERR[] = "curses function returned ERR"; +static const char catchall_NULL[] = "curses function returned NULL"; + +#ifdef __cplusplus +} +#endif + +#endif /* !defined(Py_CURSES_H) */ + + diff --git a/openflow/usr/include/python3.5m/pyarena.h b/openflow/include/python3.8/pyarena.h similarity index 100% rename from openflow/usr/include/python3.5m/pyarena.h rename to openflow/include/python3.8/pyarena.h diff --git a/openflow/usr/include/python3.5m/pycapsule.h b/openflow/include/python3.8/pycapsule.h similarity index 100% rename from openflow/usr/include/python3.5m/pycapsule.h rename to openflow/include/python3.8/pycapsule.h diff --git a/openflow/usr/include/arm-linux-gnueabihf/python3.5m/pyconfig.h b/openflow/include/python3.8/pyconfig.h similarity index 85% rename from openflow/usr/include/arm-linux-gnueabihf/python3.5m/pyconfig.h rename to openflow/include/python3.8/pyconfig.h index a638031..3986cd6 100644 --- a/openflow/usr/include/arm-linux-gnueabihf/python3.5m/pyconfig.h +++ b/openflow/include/python3.8/pyconfig.h @@ -13,6 +13,13 @@ support for AIX C++ shared extension modules. */ /* #undef AIX_GENUINE_CPLUSPLUS */ +/* Alternative SOABI used in debug build to load C extensions built in release + mode */ +/* #undef ALT_SOABI */ + +/* The Android API level. */ +/* #undef ANDROID_API_LEVEL */ + /* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM mixed-endian order (byte order 45670123) */ /* #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 */ @@ -28,6 +35,10 @@ /* Define if --enable-ipv6 is specified */ #define ENABLE_IPV6 1 +/* Define to 1 if your system stores words within floats with the most + significant word first */ +/* #undef FLOAT_WORDS_BIGENDIAN */ + /* Define if flock needs to be linked with bsd library. */ /* #undef FLOCK_NEEDS_LIBBSD */ @@ -72,7 +83,7 @@ #define HAVE_BIND_TEXTDOMAIN_CODESET 1 /* Define to 1 if you have the header file. */ -#define HAVE_BLUETOOTH_BLUETOOTH_H 1 +/* #undef HAVE_BLUETOOTH_BLUETOOTH_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_BLUETOOTH_H */ @@ -105,9 +116,6 @@ /* Has builtin atomics */ #define HAVE_BUILTIN_ATOMIC 1 -/* Define this if you have the type _Bool. */ -#define HAVE_C99_BOOL 1 - /* Define to 1 if you have the 'chflags' function. */ /* #undef HAVE_CHFLAGS */ @@ -126,6 +134,9 @@ /* Define to 1 if you have the `clock_gettime' function. */ #define HAVE_CLOCK_GETTIME 1 +/* Define to 1 if you have the `clock_settime' function. */ +#define HAVE_CLOCK_SETTIME 1 + /* Define if the C compiler supports computed gotos. */ #define HAVE_COMPUTED_GOTOS 1 @@ -138,15 +149,36 @@ /* Define to 1 if you have the `copysign' function. */ #define HAVE_COPYSIGN 1 +/* Define to 1 if you have the `copy_file_range' function. */ +/* #undef HAVE_COPY_FILE_RANGE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_CRYPT_H 1 + +/* Define if you have the crypt_r() function. */ +#define HAVE_CRYPT_R 1 + /* Define to 1 if you have the `ctermid' function. */ #define HAVE_CTERMID 1 /* Define if you have the 'ctermid_r' function. */ /* #undef HAVE_CTERMID_R */ +/* Define if you have the 'filter' function. */ +#define HAVE_CURSES_FILTER 1 + /* Define to 1 if you have the header file. */ #define HAVE_CURSES_H 1 +/* Define if you have the 'has_key' function. */ +#define HAVE_CURSES_HAS_KEY 1 + +/* Define if you have the 'immedok' function. */ +#define HAVE_CURSES_IMMEDOK 1 + +/* Define if you have the 'is_pad' function or macro. */ +#define HAVE_CURSES_IS_PAD 1 + /* Define if you have the 'is_term_resized' function. */ #define HAVE_CURSES_IS_TERM_RESIZED 1 @@ -156,6 +188,18 @@ /* Define if you have the 'resize_term' function. */ #define HAVE_CURSES_RESIZE_TERM 1 +/* Define if you have the 'syncok' function. */ +#define HAVE_CURSES_SYNCOK 1 + +/* Define if you have the 'typeahead' function. */ +#define HAVE_CURSES_TYPEAHEAD 1 + +/* Define if you have the 'use_env' function. */ +#define HAVE_CURSES_USE_ENV 1 + +/* Define if you have the 'wchgat' function. */ +#define HAVE_CURSES_WCHGAT 1 + /* Define to 1 if you have the declaration of `isfinite', and to 0 if you don't. */ #define HAVE_DECL_ISFINITE 1 @@ -168,6 +212,38 @@ */ #define HAVE_DECL_ISNAN 1 +/* Define to 1 if you have the declaration of `RTLD_DEEPBIND', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_DEEPBIND 1 + +/* Define to 1 if you have the declaration of `RTLD_GLOBAL', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_GLOBAL 1 + +/* Define to 1 if you have the declaration of `RTLD_LAZY', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_LAZY 1 + +/* Define to 1 if you have the declaration of `RTLD_LOCAL', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_LOCAL 1 + +/* Define to 1 if you have the declaration of `RTLD_MEMBER', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_MEMBER 0 + +/* Define to 1 if you have the declaration of `RTLD_NODELETE', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_NODELETE 1 + +/* Define to 1 if you have the declaration of `RTLD_NOLOAD', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_NOLOAD 1 + +/* Define to 1 if you have the declaration of `RTLD_NOW', and to 0 if you + don't. */ +#define HAVE_DECL_RTLD_NOW 1 + /* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. */ /* #undef HAVE_DECL_TZNAME */ @@ -230,6 +306,12 @@ /* Define to 1 if you have the `execv' function. */ #define HAVE_EXECV 1 +/* Define to 1 if you have the `explicit_bzero' function. */ +/* #undef HAVE_EXPLICIT_BZERO */ + +/* Define to 1 if you have the `explicit_memset' function. */ +/* #undef HAVE_EXPLICIT_MEMSET */ + /* Define to 1 if you have the `expm1' function. */ #define HAVE_EXPM1 1 @@ -260,6 +342,9 @@ /* Define to 1 if you have the `fdopendir' function. */ #define HAVE_FDOPENDIR 1 +/* Define to 1 if you have the `fdwalk' function. */ +/* #undef HAVE_FDWALK */ + /* Define to 1 if you have the `fexecve' function. */ #define HAVE_FEXECVE 1 @@ -342,6 +427,12 @@ /* Define to 1 if you have the `getentropy' function. */ /* #undef HAVE_GETENTROPY */ +/* Define to 1 if you have the `getgrgid_r' function. */ +#define HAVE_GETGRGID_R 1 + +/* Define to 1 if you have the `getgrnam_r' function. */ +#define HAVE_GETGRNAM_R 1 + /* Define to 1 if you have the `getgrouplist' function. */ #define HAVE_GETGROUPLIST 1 @@ -396,6 +487,12 @@ /* Define to 1 if you have the `getpwent' function. */ #define HAVE_GETPWENT 1 +/* Define to 1 if you have the `getpwnam_r' function. */ +#define HAVE_GETPWNAM_R 1 + +/* Define to 1 if you have the `getpwuid_r' function. */ +#define HAVE_GETPWUID_R 1 + /* Define to 1 if the getrandom() function is available */ /* #undef HAVE_GETRANDOM */ @@ -454,12 +551,6 @@ /* Define to 1 if you have the `initgroups' function. */ #define HAVE_INITGROUPS 1 -/* Define if your compiler provides int32_t. */ -#define HAVE_INT32_T 1 - -/* Define if your compiler provides int64_t. */ -#define HAVE_INT64_T 1 - /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 @@ -482,9 +573,9 @@ #define HAVE_LANGINFO_H 1 /* Defined to enable large file support when an off_t is bigger than a long - and long long is available and at least as big as an off_t. You may need to - add some flags for configuration and compilation to enable this mode. (For - Solaris and Linux, the necessary defines are already defined.) */ + and long long is at least as big as an off_t. You may need to add some + flags for configuration and compilation to enable this mode. (For Solaris + and Linux, the necessary defines are already defined.) */ #define HAVE_LARGEFILE_SUPPORT 1 /* Define to 1 if you have the 'lchflags' function. */ @@ -541,14 +632,23 @@ /* Define to 1 if you have the header file. */ #define HAVE_LINUX_CAN_RAW_H 1 +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_MEMFD_H 1 + /* Define to 1 if you have the header file. */ #define HAVE_LINUX_NETLINK_H 1 +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_QRTR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_RANDOM_H 1 + /* Define to 1 if you have the header file. */ #define HAVE_LINUX_TIPC_H 1 -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_RANDOM_H 1 +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_VM_SOCKETS_H 1 /* Define to 1 if you have the `lockf' function. */ #define HAVE_LOCKF 1 @@ -559,26 +659,26 @@ /* Define to 1 if you have the `log2' function. */ #define HAVE_LOG2 1 -/* Define this if you have the type long double. */ +/* Define to 1 if the system has the type `long double'. */ #define HAVE_LONG_DOUBLE 1 -/* Define this if you have the type long long. */ -#define HAVE_LONG_LONG 1 - /* Define to 1 if you have the `lstat' function. */ #define HAVE_LSTAT 1 /* Define to 1 if you have the `lutimes' function. */ #define HAVE_LUTIMES 1 +/* Define to 1 if you have the `madvise' function. */ +#define HAVE_MADVISE 1 + /* Define this if you have the makedev macro. */ #define HAVE_MAKEDEV 1 /* Define to 1 if you have the `mbrtowc' function. */ #define HAVE_MBRTOWC 1 -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 +/* Define if you have the 'memfd_create' function. */ +/* #undef HAVE_MEMFD_CREATE */ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 @@ -631,9 +731,6 @@ /* Define to 1 if you have the `openpty' function. */ #define HAVE_OPENPTY 1 -/* Define if compiling using MacOS X 10.5 SDK or later. */ -/* #undef HAVE_OSX105_SDK */ - /* Define to 1 if you have the `pathconf' function. */ #define HAVE_PATHCONF 1 @@ -658,9 +755,21 @@ /* Define to 1 if you have the `posix_fallocate' function. */ #define HAVE_POSIX_FALLOCATE 1 +/* Define to 1 if you have the `posix_spawn' function. */ +#define HAVE_POSIX_SPAWN 1 + +/* Define to 1 if you have the `posix_spawnp' function. */ +#define HAVE_POSIX_SPAWNP 1 + /* Define to 1 if you have the `pread' function. */ #define HAVE_PREAD 1 +/* Define to 1 if you have the `preadv' function. */ +#define HAVE_PREADV 1 + +/* Define to 1 if you have the `preadv2' function. */ +/* #undef HAVE_PREADV2 */ + /* Define if you have the 'prlimit' functions. */ #define HAVE_PRLIMIT 1 @@ -670,12 +779,15 @@ /* Define if your compiler supports function prototype */ #define HAVE_PROTOTYPES 1 -/* Define to 1 if you have the `pthread_atfork' function. */ -#define HAVE_PTHREAD_ATFORK 1 +/* Define to 1 if you have the `pthread_condattr_setclock' function. */ +#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1 /* Defined for Solaris 2.6 bug in pthread header. */ /* #undef HAVE_PTHREAD_DESTRUCTOR */ +/* Define to 1 if you have the `pthread_getcpuclockid' function. */ +#define HAVE_PTHREAD_GETCPUCLOCKID 1 + /* Define to 1 if you have the header file. */ #define HAVE_PTHREAD_H 1 @@ -697,8 +809,11 @@ /* Define to 1 if you have the `pwrite' function. */ #define HAVE_PWRITE 1 -/* Define if the libcrypto has RAND_egd */ -#define HAVE_RAND_EGD 1 +/* Define to 1 if you have the `pwritev' function. */ +#define HAVE_PWRITEV 1 + +/* Define to 1 if you have the `pwritev2' function. */ +/* #undef HAVE_PWRITEV2 */ /* Define to 1 if you have the `readlink' function. */ #define HAVE_READLINK 1 @@ -718,9 +833,6 @@ /* Define if readline supports append_history */ #define HAVE_RL_APPEND_HISTORY 1 -/* Define if you have readline 2.1 */ -#define HAVE_RL_CALLBACK 1 - /* Define if you can turn off readline's signal handling. */ #define HAVE_RL_CATCH_SIGNAL 1 @@ -745,6 +857,9 @@ /* Define to 1 if you have the `round' function. */ #define HAVE_ROUND 1 +/* Define to 1 if you have the `rtpSpawn' function. */ +/* #undef HAVE_RTPSPAWN */ + /* Define to 1 if you have the `sched_get_priority_max' function. */ #define HAVE_SCHED_GET_PRIORITY_MAX 1 @@ -763,9 +878,6 @@ /* Define to 1 if you have the `sched_setscheduler' function. */ #define HAVE_SCHED_SETSCHEDULER 1 -/* Define to 1 if you have the `select' function. */ -#define HAVE_SELECT 1 - /* Define to 1 if you have the `sem_getvalue' function. */ #define HAVE_SEM_GETVALUE 1 @@ -835,12 +947,24 @@ /* Define to 1 if you have the header file. */ #define HAVE_SHADOW_H 1 +/* Define to 1 if you have the `shm_open' function. */ +#define HAVE_SHM_OPEN 1 + +/* Define to 1 if you have the `shm_unlink' function. */ +#define HAVE_SHM_UNLINK 1 + /* Define to 1 if you have the `sigaction' function. */ #define HAVE_SIGACTION 1 /* Define to 1 if you have the `sigaltstack' function. */ #define HAVE_SIGALTSTACK 1 +/* Define to 1 if you have the `sigfillset' function. */ +#define HAVE_SIGFILLSET 1 + +/* Define to 1 if `si_band' is a member of `siginfo_t'. */ +#define HAVE_SIGINFO_T_SI_BAND 1 + /* Define to 1 if you have the `siginterrupt' function. */ #define HAVE_SIGINTERRUPT 1 @@ -865,6 +989,9 @@ /* Define to 1 if you have the `snprintf' function. */ #define HAVE_SNPRINTF 1 +/* struct sockaddr_alg (linux/if_alg.h) */ +#define HAVE_SOCKADDR_ALG 1 + /* Define if sockaddr has sa_len member */ /* #undef HAVE_SOCKADDR_SA_LEN */ @@ -899,7 +1026,7 @@ /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 -/* Has stdatomic.h, atomic_int and _Atomic void* types work */ +/* Has stdatomic.h with atomic_int */ #define HAVE_STD_ATOMIC 1 /* Define to 1 if you have the `strdup' function. */ @@ -920,6 +1047,15 @@ /* Define to 1 if you have the header file. */ #define HAVE_STROPTS_H 1 +/* Define to 1 if you have the `strsignal' function. */ +#define HAVE_STRSIGNAL 1 + +/* Define to 1 if `pw_gecos' is a member of `struct passwd'. */ +#define HAVE_STRUCT_PASSWD_PW_GECOS 1 + +/* Define to 1 if `pw_passwd' is a member of `struct passwd'. */ +#define HAVE_STRUCT_PASSWD_PW_PASSWD 1 + /* Define to 1 if `st_birthtime' is a member of `struct stat'. */ /* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */ @@ -993,9 +1129,15 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_LOCK_H */ +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MEMFD_H */ + /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_MKDEV_H */ +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MMAN_H 1 + /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_MODEM_H */ @@ -1009,6 +1151,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_SYS_POLL_H 1 +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_RANDOM_H */ + /* Define to 1 if you have the header file. */ #define HAVE_SYS_RESOURCE_H 1 @@ -1030,6 +1175,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_SYS_SYSCALL_H 1 +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SYSMACROS_H 1 + /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_SYS_DOMAIN_H */ @@ -1107,15 +1255,6 @@ /* Define this if you have tcl and TCL_UTF_MAX==6 */ /* #undef HAVE_UCS4_TCL */ -/* Define if your compiler provides uint32_t. */ -#define HAVE_UINT32_T 1 - -/* Define if your compiler provides uint64_t. */ -#define HAVE_UINT64_T 1 - -/* Define to 1 if the system has the type `uintptr_t'. */ -#define HAVE_UINTPTR_T 1 - /* Define to 1 if you have the `uname' function. */ #define HAVE_UNAME 1 @@ -1145,6 +1284,21 @@ /* Define to 1 if you have the header file. */ #define HAVE_UTIME_H 1 +/* Define if uuid_create() exists. */ +/* #undef HAVE_UUID_CREATE */ + +/* Define if uuid_enc_be() exists. */ +/* #undef HAVE_UUID_ENC_BE */ + +/* Define if uuid_generate_time_safe() exists. */ +/* #undef HAVE_UUID_GENERATE_TIME_SAFE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UUID_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UUID_UUID_H */ + /* Define to 1 if you have the `wait3' function. */ #define HAVE_WAIT3 1 @@ -1179,15 +1333,15 @@ /* Define to 1 if you have the `writev' function. */ #define HAVE_WRITEV 1 +/* Define if libssl has X509_VERIFY_PARAM_set1_host and related function */ +#define HAVE_X509_VERIFY_PARAM_SET1_HOST 1 + /* Define if the zlib library has inflateCopy */ #define HAVE_ZLIB_COPY 1 /* Define to 1 if you have the `_getpty' function. */ /* #undef HAVE__GETPTY */ -/* Define if log1p(-0.) is 0. rather than -0. */ -/* #undef LOG1P_DROPS_ZERO_SIGN */ - /* Define to 1 if `major', `minor', and `makedev' are declared in . */ /* #undef MAJOR_IN_MKDEV */ @@ -1220,18 +1374,28 @@ /* Define if POSIX semaphores aren't enabled on your system */ /* #undef POSIX_SEMAPHORES_NOT_ENABLED */ +/* Define if pthread_key_t is compatible with int. */ +#define PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT 1 + /* Defined if PTHREAD_SCOPE_SYSTEM supported. */ #define PTHREAD_SYSTEM_SCHED_SUPPORTED 1 /* Define as the preferred size in bits of long digits */ /* #undef PYLONG_BITS_IN_DIGIT */ -/* Define to printf format modifier for long long type */ -#define PY_FORMAT_LONG_LONG "ll" +/* Define if you want to coerce the C locale to a UTF-8 based locale */ +#define PY_COERCE_C_LOCALE 1 /* Define to printf format modifier for Py_ssize_t */ #define PY_FORMAT_SIZE_T "z" +/* Default cipher suites list for ssl module. 1: Python's preferred selection, + 2: leave OpenSSL defaults untouched, 0: custom string */ +#define PY_SSL_DEFAULT_CIPHERS 1 + +/* Cipher suite string for PY_SSL_DEFAULT_CIPHERS=0 */ +/* #undef PY_SSL_DEFAULT_CIPHER_STRING */ + /* Define if you want to build an interpreter with many run-time checks. */ /* #undef Py_DEBUG */ @@ -1242,12 +1406,18 @@ externally defined: 0 */ /* #undef Py_HASH_ALGORITHM */ +/* Define if you want to enable tracing references for debugging purpose */ +/* #undef Py_TRACE_REFS */ + /* assume C89 semantics that RETSIGTYPE is always void */ #define RETSIGTYPE void /* Define if setpgrp() must be called as setpgrp(0, 0). */ /* #undef SETPGRP_HAVE_ARG */ +/* Define to 1 if you must link with -lrt for shm_open(). */ +#define SHM_NEEDS_LIBRT 1 + /* Define if i>>j for signed int i does not extend the sign bit when i < 0 */ /* #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS */ @@ -1278,6 +1448,9 @@ /* The size of `pid_t', as computed by sizeof. */ #define SIZEOF_PID_T 4 +/* The size of `pthread_key_t', as computed by sizeof. */ +#define SIZEOF_PTHREAD_KEY_T 4 + /* The size of `pthread_t', as computed by sizeof. */ #define SIZEOF_PTHREAD_T 4 @@ -1309,9 +1482,6 @@ (which you can't on SCO ODT 3.0). */ #define SYS_SELECT_WITH_SYS_TIME 1 -/* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */ -#define TANH_PRESERVES_ZERO_SIGN 1 - /* Library needed by timemodule.c: librt may be needed for clock_gettime() */ /* #undef TIMEMODULE_LIB */ @@ -1322,10 +1492,7 @@ /* #undef TM_IN_SYS_TIME */ /* Define if you want to use computed gotos in ceval.c. */ -#define USE_COMPUTED_GOTOS 1 - -/* Define to use the C99 inline keyword. */ -#define USE_INLINE 1 +/* #undef USE_COMPUTED_GOTOS */ /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE @@ -1349,18 +1516,15 @@ #endif -/* Define if a va_list is an array of some kind */ -/* #undef VA_LIST_IS_ARRAY */ - -/* Define if you want SIGFPE handled (see Include/pyfpe.h). */ -#define WANT_SIGFPE_HANDLER 1 - /* Define if WINDOW in curses.h offers a field _flags. */ #define WINDOW_HAS_FLAGS 1 /* Define if you want documentation strings in extension modules */ #define WITH_DOC_STRINGS 1 +/* Define if you want to compile in DTrace support */ +/* #undef WITH_DTRACE */ + /* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic linker (dyld) instead of the old-style (NextStep) dynamic linker (rld). Dyld is necessary to support frameworks. */ @@ -1376,12 +1540,6 @@ /* Define if you want to compile in Python-specific mallocs */ #define WITH_PYMALLOC 1 -/* Define if you want to compile in rudimentary thread support */ -#define WITH_THREAD 1 - -/* Define to profile with the Pentium timestamp counter */ -/* #undef WITH_TSC */ - /* Define if you want pymalloc to be disabled when running under valgrind */ /* #undef WITH_VALGRIND */ @@ -1403,9 +1561,6 @@ /* Define on OpenBSD to activate all library features */ /* #undef _BSD_SOURCE */ -/* Define on Irix to enable u_int */ -#define _BSD_TYPES 1 - /* Define on Darwin to activate all library features */ #define _DARWIN_C_SOURCE 1 @@ -1443,19 +1598,12 @@ /* Define if you have POSIX threads, and your system does not define that. */ /* #undef _POSIX_THREADS */ +/* framework name */ +#define _PYTHONFRAMEWORK "" + /* Define to force use of thread-safe errno, h_errno, and other functions */ /* #undef _REENTRANT */ -/* Define for Solaris 2.5.1 so the uint32_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT32_T */ - -/* Define for Solaris 2.5.1 so the uint64_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT64_T */ - /* Define to the level of X/Open that your system supports */ #define _XOPEN_SOURCE 700 @@ -1479,20 +1627,6 @@ /* Define to `int' if doesn't define. */ /* #undef gid_t */ -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to the type of a signed integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -/* #undef int32_t */ - -/* Define to the type of a signed integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -/* #undef int64_t */ - /* Define to `int' if does not define. */ /* #undef mode_t */ @@ -1514,17 +1648,6 @@ /* Define to `int' if doesn't define. */ /* #undef uid_t */ -/* Define to the type of an unsigned integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint32_t */ - -/* Define to the type of an unsigned integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint64_t */ - -/* Define to empty if the keyword does not work. */ -/* #undef volatile */ - /* Define the macros needed if on a UnixWare 7.x system. */ #if defined(__USLC__) && defined(__SCO_VERSION__) diff --git a/openflow/usr/include/python3.5m/pyctype.h b/openflow/include/python3.8/pyctype.h similarity index 100% rename from openflow/usr/include/python3.5m/pyctype.h rename to openflow/include/python3.8/pyctype.h diff --git a/openflow/usr/include/python3.5m/pydebug.h b/openflow/include/python3.8/pydebug.h similarity index 90% rename from openflow/usr/include/python3.5m/pydebug.h rename to openflow/include/python3.8/pydebug.h index 19bec2b..bd4aafe 100644 --- a/openflow/usr/include/python3.5m/pydebug.h +++ b/openflow/include/python3.8/pydebug.h @@ -15,7 +15,6 @@ PyAPI_DATA(int) Py_InspectFlag; PyAPI_DATA(int) Py_OptimizeFlag; PyAPI_DATA(int) Py_NoSiteFlag; PyAPI_DATA(int) Py_BytesWarningFlag; -PyAPI_DATA(int) Py_UseClassExceptionsFlag; PyAPI_DATA(int) Py_FrozenFlag; PyAPI_DATA(int) Py_IgnoreEnvironmentFlag; PyAPI_DATA(int) Py_DontWriteBytecodeFlag; @@ -24,6 +23,11 @@ PyAPI_DATA(int) Py_UnbufferedStdioFlag; PyAPI_DATA(int) Py_HashRandomizationFlag; PyAPI_DATA(int) Py_IsolatedFlag; +#ifdef MS_WINDOWS +PyAPI_DATA(int) Py_LegacyWindowsFSEncodingFlag; +PyAPI_DATA(int) Py_LegacyWindowsStdioFlag; +#endif + /* this is a wrapper around getenv() that pays attention to Py_IgnoreEnvironmentFlag. It should be used for getting variables like PYTHONPATH and PYTHONHOME from the environment */ diff --git a/openflow/include/python3.8/pydtrace.h b/openflow/include/python3.8/pydtrace.h new file mode 100644 index 0000000..75f8e7f --- /dev/null +++ b/openflow/include/python3.8/pydtrace.h @@ -0,0 +1,59 @@ +/* Static DTrace probes interface */ + +#ifndef Py_DTRACE_H +#define Py_DTRACE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef WITH_DTRACE + +#include "pydtrace_probes.h" + +/* pydtrace_probes.h, on systems with DTrace, is auto-generated to include + `PyDTrace_{PROBE}` and `PyDTrace_{PROBE}_ENABLED()` macros for every probe + defined in pydtrace_provider.d. + + Calling these functions must be guarded by a `PyDTrace_{PROBE}_ENABLED()` + check to minimize performance impact when probing is off. For example: + + if (PyDTrace_FUNCTION_ENTRY_ENABLED()) + PyDTrace_FUNCTION_ENTRY(f); +*/ + +#else + +/* Without DTrace, compile to nothing. */ + +static inline void PyDTrace_LINE(const char *arg0, const char *arg1, int arg2) {} +static inline void PyDTrace_FUNCTION_ENTRY(const char *arg0, const char *arg1, int arg2) {} +static inline void PyDTrace_FUNCTION_RETURN(const char *arg0, const char *arg1, int arg2) {} +static inline void PyDTrace_GC_START(int arg0) {} +static inline void PyDTrace_GC_DONE(Py_ssize_t arg0) {} +static inline void PyDTrace_INSTANCE_NEW_START(int arg0) {} +static inline void PyDTrace_INSTANCE_NEW_DONE(int arg0) {} +static inline void PyDTrace_INSTANCE_DELETE_START(int arg0) {} +static inline void PyDTrace_INSTANCE_DELETE_DONE(int arg0) {} +static inline void PyDTrace_IMPORT_FIND_LOAD_START(const char *arg0) {} +static inline void PyDTrace_IMPORT_FIND_LOAD_DONE(const char *arg0, int arg1) {} +static inline void PyDTrace_AUDIT(const char *arg0, void *arg1) {} + +static inline int PyDTrace_LINE_ENABLED(void) { return 0; } +static inline int PyDTrace_FUNCTION_ENTRY_ENABLED(void) { return 0; } +static inline int PyDTrace_FUNCTION_RETURN_ENABLED(void) { return 0; } +static inline int PyDTrace_GC_START_ENABLED(void) { return 0; } +static inline int PyDTrace_GC_DONE_ENABLED(void) { return 0; } +static inline int PyDTrace_INSTANCE_NEW_START_ENABLED(void) { return 0; } +static inline int PyDTrace_INSTANCE_NEW_DONE_ENABLED(void) { return 0; } +static inline int PyDTrace_INSTANCE_DELETE_START_ENABLED(void) { return 0; } +static inline int PyDTrace_INSTANCE_DELETE_DONE_ENABLED(void) { return 0; } +static inline int PyDTrace_IMPORT_FIND_LOAD_START_ENABLED(void) { return 0; } +static inline int PyDTrace_IMPORT_FIND_LOAD_DONE_ENABLED(void) { return 0; } +static inline int PyDTrace_AUDIT_ENABLED(void) { return 0; } + +#endif /* !WITH_DTRACE */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_DTRACE_H */ diff --git a/openflow/usr/include/python3.5m/pyerrors.h b/openflow/include/python3.8/pyerrors.h similarity index 72% rename from openflow/usr/include/python3.5m/pyerrors.h rename to openflow/include/python3.8/pyerrors.h index 35aedb7..5125a51 100644 --- a/openflow/usr/include/python3.5m/pyerrors.h +++ b/openflow/include/python3.8/pyerrors.h @@ -4,81 +4,10 @@ extern "C" { #endif -/* Error objects */ - -#ifndef Py_LIMITED_API -/* PyException_HEAD defines the initial segment of every exception class. */ -#define PyException_HEAD PyObject_HEAD PyObject *dict;\ - PyObject *args; PyObject *traceback;\ - PyObject *context; PyObject *cause;\ - char suppress_context; - -typedef struct { - PyException_HEAD -} PyBaseExceptionObject; - -typedef struct { - PyException_HEAD - PyObject *msg; - PyObject *filename; - PyObject *lineno; - PyObject *offset; - PyObject *text; - PyObject *print_file_and_line; -} PySyntaxErrorObject; - -typedef struct { - PyException_HEAD - PyObject *msg; - PyObject *name; - PyObject *path; -} PyImportErrorObject; - -typedef struct { - PyException_HEAD - PyObject *encoding; - PyObject *object; - Py_ssize_t start; - Py_ssize_t end; - PyObject *reason; -} PyUnicodeErrorObject; - -typedef struct { - PyException_HEAD - PyObject *code; -} PySystemExitObject; - -typedef struct { - PyException_HEAD - PyObject *myerrno; - PyObject *strerror; - PyObject *filename; - PyObject *filename2; -#ifdef MS_WINDOWS - PyObject *winerror; -#endif - Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */ -} PyOSErrorObject; - -typedef struct { - PyException_HEAD - PyObject *value; -} PyStopIterationObject; - -/* Compatibility typedefs */ -typedef PyOSErrorObject PyEnvironmentErrorObject; -#ifdef MS_WINDOWS -typedef PyOSErrorObject PyWindowsErrorObject; -#endif -#endif /* !Py_LIMITED_API */ - /* Error handling definitions */ PyAPI_FUNC(void) PyErr_SetNone(PyObject *); PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *); -#ifndef Py_LIMITED_API -PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *); -#endif PyAPI_FUNC(void) PyErr_SetString( PyObject *exception, const char *string /* decoded from utf-8 */ @@ -87,20 +16,13 @@ PyAPI_FUNC(PyObject *) PyErr_Occurred(void); PyAPI_FUNC(void) PyErr_Clear(void); PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *); - -#if defined(__clang__) || \ - (defined(__GNUC_MAJOR__) && \ - ((__GNUC_MAJOR__ >= 3) || \ - (__GNUC_MAJOR__ == 2) && (__GNUC_MINOR__ >= 5))) -#define _Py_NO_RETURN __attribute__((__noreturn__)) -#else -#define _Py_NO_RETURN #endif /* Defined in Python/pylifecycle.c */ -PyAPI_FUNC(void) Py_FatalError(const char *message) _Py_NO_RETURN; +PyAPI_FUNC(void) _Py_NO_RETURN Py_FatalError(const char *message); #if defined(Py_DEBUG) || defined(Py_LIMITED_API) #define _PyErr_OCCURRED() PyErr_Occurred() @@ -124,9 +46,6 @@ PyAPI_FUNC(void) PyException_SetCause(PyObject *, PyObject *); /* Context manipulation (PEP 3134) */ PyAPI_FUNC(PyObject *) PyException_GetContext(PyObject *); PyAPI_FUNC(void) PyException_SetContext(PyObject *, PyObject *); -#ifndef Py_LIMITED_API -PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *); -#endif /* */ @@ -137,8 +56,7 @@ PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *); #define PyExceptionInstance_Check(x) \ PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS) -#define PyExceptionClass_Name(x) \ - ((char *)(((PyTypeObject*)(x))->tp_name)) +PyAPI_FUNC(const char *) PyExceptionClass_Name(PyObject *); #define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type)) @@ -147,7 +65,9 @@ PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *); PyAPI_DATA(PyObject *) PyExc_BaseException; PyAPI_DATA(PyObject *) PyExc_Exception; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration; +#endif PyAPI_DATA(PyObject *) PyExc_StopIteration; PyAPI_DATA(PyObject *) PyExc_GeneratorExit; PyAPI_DATA(PyObject *) PyExc_ArithmeticError; @@ -160,6 +80,9 @@ PyAPI_DATA(PyObject *) PyExc_EOFError; PyAPI_DATA(PyObject *) PyExc_FloatingPointError; PyAPI_DATA(PyObject *) PyExc_OSError; PyAPI_DATA(PyObject *) PyExc_ImportError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 +PyAPI_DATA(PyObject *) PyExc_ModuleNotFoundError; +#endif PyAPI_DATA(PyObject *) PyExc_IndexError; PyAPI_DATA(PyObject *) PyExc_KeyError; PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt; @@ -167,7 +90,9 @@ PyAPI_DATA(PyObject *) PyExc_MemoryError; PyAPI_DATA(PyObject *) PyExc_NameError; PyAPI_DATA(PyObject *) PyExc_OverflowError; PyAPI_DATA(PyObject *) PyExc_RuntimeError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_DATA(PyObject *) PyExc_RecursionError; +#endif PyAPI_DATA(PyObject *) PyExc_NotImplementedError; PyAPI_DATA(PyObject *) PyExc_SyntaxError; PyAPI_DATA(PyObject *) PyExc_IndentationError; @@ -184,6 +109,7 @@ PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError; PyAPI_DATA(PyObject *) PyExc_ValueError; PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_DATA(PyObject *) PyExc_BlockingIOError; PyAPI_DATA(PyObject *) PyExc_BrokenPipeError; PyAPI_DATA(PyObject *) PyExc_ChildProcessError; @@ -199,6 +125,7 @@ PyAPI_DATA(PyObject *) PyExc_NotADirectoryError; PyAPI_DATA(PyObject *) PyExc_PermissionError; PyAPI_DATA(PyObject *) PyExc_ProcessLookupError; PyAPI_DATA(PyObject *) PyExc_TimeoutError; +#endif /* Compatibility aliases */ @@ -208,8 +135,6 @@ PyAPI_DATA(PyObject *) PyExc_IOError; PyAPI_DATA(PyObject *) PyExc_WindowsError; #endif -PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst; - /* Predefined warning categories */ PyAPI_DATA(PyObject *) PyExc_Warning; PyAPI_DATA(PyObject *) PyExc_UserWarning; @@ -231,16 +156,14 @@ PyAPI_FUNC(PyObject *) PyErr_NoMemory(void); PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( PyObject *, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObjects( PyObject *, PyObject *, PyObject *); +#endif PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename( PyObject *exc, const char *filename /* decoded from the filesystem encoding */ ); -#if defined(MS_WINDOWS) && !defined(Py_LIMITED_API) -PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( - PyObject *, const Py_UNICODE *); -#endif /* MS_WINDOWS */ PyAPI_FUNC(PyObject *) PyErr_Format( PyObject *exception, @@ -259,32 +182,29 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename( int ierr, const char *filename /* decoded from the filesystem encoding */ ); -#ifndef Py_LIMITED_API -/* XXX redeclare to use WSTRING */ -PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename( - int, const Py_UNICODE *); -#endif PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int); PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject( PyObject *,int, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObjects( PyObject *,int, PyObject *, PyObject *); +#endif PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( PyObject *exc, int ierr, const char *filename /* decoded from the filesystem encoding */ ); -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename( - PyObject *,int, const Py_UNICODE *); -#endif PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); #endif /* MS_WINDOWS */ -PyAPI_FUNC(PyObject *) PyErr_SetExcWithArgsKwargs(PyObject *, PyObject *, - PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 +PyAPI_FUNC(PyObject *) PyErr_SetImportErrorSubclass(PyObject *, PyObject *, + PyObject *, PyObject *); +#endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyErr_SetImportError(PyObject *, PyObject *, PyObject *); +#endif /* Export the old function so that the existing API remains available: */ PyAPI_FUNC(void) PyErr_BadInternalCall(void); @@ -300,36 +220,10 @@ PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc( const char *name, const char *doc, PyObject *base, PyObject *dict); PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *); -/* In exceptions.c */ -#ifndef Py_LIMITED_API -/* Helper that attempts to replace the current exception with one of the - * same type but with a prefix added to the exception text. The resulting - * exception description looks like: - * - * prefix (exc_type: original_exc_str) - * - * Only some exceptions can be safely replaced. If the function determines - * it isn't safe to perform the replacement, it will leave the original - * unmodified exception in place. - * - * Returns a borrowed reference to the new exception (if any), NULL if the - * existing exception was left in place. - */ -PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause( - const char *prefix_format, /* ASCII-encoded string */ - ... - ); -#endif - - -/* In sigcheck.c or signalmodule.c */ -PyAPI_FUNC(int) PyErr_CheckSignals(void); -PyAPI_FUNC(void) PyErr_SetInterrupt(void); /* In signalmodule.c */ -#ifndef Py_LIMITED_API -int PySignal_SetWakeupFd(int fd); -#endif +PyAPI_FUNC(int) PyErr_CheckSignals(void); +PyAPI_FUNC(void) PyErr_SetInterrupt(void); /* Support for adding program text to SyntaxErrors */ PyAPI_FUNC(void) PyErr_SyntaxLocation( @@ -339,20 +233,9 @@ PyAPI_FUNC(void) PyErr_SyntaxLocationEx( const char *filename, /* decoded from the filesystem encoding */ int lineno, int col_offset); -#ifndef Py_LIMITED_API -PyAPI_FUNC(void) PyErr_SyntaxLocationObject( - PyObject *filename, - int lineno, - int col_offset); -#endif PyAPI_FUNC(PyObject *) PyErr_ProgramText( const char *filename, /* decoded from the filesystem encoding */ int lineno); -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject( - PyObject *filename, - int lineno); -#endif /* The following functions are used to create and modify unicode exceptions from C */ @@ -367,35 +250,6 @@ PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create( const char *reason /* UTF-8 encoded string */ ); -/* create a UnicodeEncodeError object */ -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create( - const char *encoding, /* UTF-8 encoded string */ - const Py_UNICODE *object, - Py_ssize_t length, - Py_ssize_t start, - Py_ssize_t end, - const char *reason /* UTF-8 encoded string */ - ); -#endif - -/* create a UnicodeTranslateError object */ -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create( - const Py_UNICODE *object, - Py_ssize_t length, - Py_ssize_t start, - Py_ssize_t end, - const char *reason /* UTF-8 encoded string */ - ); -PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create( - PyObject *object, - Py_ssize_t start, - Py_ssize_t end, - const char *reason /* UTF-8 encoded string */ - ); -#endif - /* get the encoding attribute */ PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *); @@ -469,6 +323,12 @@ PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) Py_GCC_ATTRIBUTE((format(printf, 3, 0))); +#ifndef Py_LIMITED_API +# define Py_CPYTHON_ERRORS_H +# include "cpython/pyerrors.h" +# undef Py_CPYTHON_ERRORS_H +#endif + #ifdef __cplusplus } #endif diff --git a/openflow/usr/include/python3.5m/pyexpat.h b/openflow/include/python3.8/pyexpat.h similarity index 100% rename from openflow/usr/include/python3.5m/pyexpat.h rename to openflow/include/python3.8/pyexpat.h diff --git a/openflow/include/python3.8/pyfpe.h b/openflow/include/python3.8/pyfpe.h new file mode 100644 index 0000000..5a99e39 --- /dev/null +++ b/openflow/include/python3.8/pyfpe.h @@ -0,0 +1,12 @@ +#ifndef Py_PYFPE_H +#define Py_PYFPE_H + +/* These macros used to do something when Python was built with --with-fpectl, + * but support for that was dropped in 3.7. We continue to define them though, + * to avoid breaking API users. + */ + +#define PyFPE_START_PROTECT(err_string, leave_stmt) +#define PyFPE_END_PROTECT(v) + +#endif /* !Py_PYFPE_H */ diff --git a/openflow/usr/include/python3.5m/pyhash.h b/openflow/include/python3.8/pyhash.h similarity index 88% rename from openflow/usr/include/python3.5m/pyhash.h rename to openflow/include/python3.8/pyhash.h index a7ca937..dbcc974 100644 --- a/openflow/usr/include/python3.5m/pyhash.h +++ b/openflow/include/python3.8/pyhash.h @@ -16,7 +16,7 @@ PyAPI_FUNC(Py_hash_t) _Py_HashBytes(const void*, Py_ssize_t); #define _PyHASH_MULTIPLIER 1000003UL /* 0xf4243 */ /* Parameters used for the numeric hash implementation. See notes for - _Py_HashDouble in Objects/object.c. Numeric hashes are based on + _Py_HashDouble in Python/pyhash.c. Numeric hashes are based on reduction modulo the prime 2**_PyHASH_BITS - 1. */ #if SIZEOF_VOID_P >= 8 @@ -36,14 +36,14 @@ PyAPI_FUNC(Py_hash_t) _Py_HashBytes(const void*, Py_ssize_t); * memory layout on 64 bit systems * cccccccc cccccccc cccccccc uc -- unsigned char[24] * pppppppp ssssssss ........ fnv -- two Py_hash_t - * k0k0k0k0 k1k1k1k1 ........ siphash -- two PY_UINT64_T + * k0k0k0k0 k1k1k1k1 ........ siphash -- two uint64_t * ........ ........ ssssssss djbx33a -- 16 bytes padding + one Py_hash_t * ........ ........ eeeeeeee pyexpat XML hash salt * * memory layout on 32 bit systems * cccccccc cccccccc cccccccc uc * ppppssss ........ ........ fnv -- two Py_hash_t - * k0k0k0k0 k1k1k1k1 ........ siphash -- two PY_UINT64_T (*) + * k0k0k0k0 k1k1k1k1 ........ siphash -- two uint64_t (*) * ........ ........ ssss.... djbx33a -- 16 bytes padding + one Py_hash_t * ........ ........ eeee.... pyexpat XML hash salt * @@ -59,13 +59,11 @@ typedef union { Py_hash_t prefix; Py_hash_t suffix; } fnv; -#ifdef PY_UINT64_T /* two uint64 for SipHash24 */ struct { - PY_UINT64_T k0; - PY_UINT64_T k1; + uint64_t k0; + uint64_t k1; } siphash; -#endif /* a different (!) Py_hash_t for small string optimization */ struct { unsigned char padding[16]; @@ -121,8 +119,7 @@ PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void); * configure script. * * - FNV is available on all platforms and architectures. - * - SIPHASH24 only works on plaforms that provide PY_UINT64_T and doesn't - * require aligned memory for integers. + * - SIPHASH24 only works on platforms that don't require aligned memory for integers. * - With EXTERNAL embedders can provide an alternative implementation with:: * * PyHash_FuncDef PyHash_Func = {...}; @@ -134,8 +131,7 @@ PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void); #define Py_HASH_FNV 2 #ifndef Py_HASH_ALGORITHM -# if (defined(PY_UINT64_T) && defined(PY_UINT32_T) \ - && !defined(HAVE_ALIGNED_REQUIRED)) +# ifndef HAVE_ALIGNED_REQUIRED # define Py_HASH_ALGORITHM Py_HASH_SIPHASH24 # else # define Py_HASH_ALGORITHM Py_HASH_FNV diff --git a/openflow/include/python3.8/pylifecycle.h b/openflow/include/python3.8/pylifecycle.h new file mode 100644 index 0000000..c5368b3 --- /dev/null +++ b/openflow/include/python3.8/pylifecycle.h @@ -0,0 +1,75 @@ + +/* Interfaces to configure, query, create & destroy the Python runtime */ + +#ifndef Py_PYLIFECYCLE_H +#define Py_PYLIFECYCLE_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* Initialization and finalization */ +PyAPI_FUNC(void) Py_Initialize(void); +PyAPI_FUNC(void) Py_InitializeEx(int); +PyAPI_FUNC(void) Py_Finalize(void); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 +PyAPI_FUNC(int) Py_FinalizeEx(void); +#endif +PyAPI_FUNC(int) Py_IsInitialized(void); + +/* Subinterpreter support */ +PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void); +PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *); + + +/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level + * exit functions. + */ +PyAPI_FUNC(int) Py_AtExit(void (*func)(void)); + +PyAPI_FUNC(void) _Py_NO_RETURN Py_Exit(int); + +/* Bootstrap __main__ (defined in Modules/main.c) */ +PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv); + +PyAPI_FUNC(int) Py_BytesMain(int argc, char **argv); + +/* In pathconfig.c */ +PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *); +PyAPI_FUNC(wchar_t *) Py_GetProgramName(void); + +PyAPI_FUNC(void) Py_SetPythonHome(const wchar_t *); +PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void); + +PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void); + +PyAPI_FUNC(wchar_t *) Py_GetPrefix(void); +PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void); +PyAPI_FUNC(wchar_t *) Py_GetPath(void); +PyAPI_FUNC(void) Py_SetPath(const wchar_t *); +#ifdef MS_WINDOWS +int _Py_CheckPython3(void); +#endif + +/* In their own files */ +PyAPI_FUNC(const char *) Py_GetVersion(void); +PyAPI_FUNC(const char *) Py_GetPlatform(void); +PyAPI_FUNC(const char *) Py_GetCopyright(void); +PyAPI_FUNC(const char *) Py_GetCompiler(void); +PyAPI_FUNC(const char *) Py_GetBuildInfo(void); + +/* Signals */ +typedef void (*PyOS_sighandler_t)(int); +PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int); +PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); + +#ifndef Py_LIMITED_API +# define Py_CPYTHON_PYLIFECYCLE_H +# include "cpython/pylifecycle.h" +# undef Py_CPYTHON_PYLIFECYCLE_H +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYLIFECYCLE_H */ diff --git a/openflow/usr/include/python3.5m/pymacconfig.h b/openflow/include/python3.8/pymacconfig.h similarity index 95% rename from openflow/usr/include/python3.5m/pymacconfig.h rename to openflow/include/python3.8/pymacconfig.h index 0c28f5c..9dde11b 100644 --- a/openflow/usr/include/python3.5m/pymacconfig.h +++ b/openflow/include/python3.8/pymacconfig.h @@ -63,7 +63,7 @@ # if defined(__LP64__) /* MacOSX 10.4 (the first release to support 64-bit code * at all) only supports 64-bit in the UNIX layer. - * Therefore surpress the toolbox-glue in 64-bit mode. + * Therefore suppress the toolbox-glue in 64-bit mode. */ /* In 64-bit mode setpgrp always has no arguments, in 32-bit @@ -91,7 +91,7 @@ * * Specifically: OSX 10.4 has limited supported for '%zd', while * 10.5 has full support for '%zd'. A binary built on 10.5 won't - * work properly on 10.4 unless we surpress the definition + * work properly on 10.4 unless we suppress the definition * of PY_FORMAT_SIZE_T */ #undef PY_FORMAT_SIZE_T diff --git a/openflow/usr/include/python3.5m/pymacro.h b/openflow/include/python3.8/pymacro.h similarity index 73% rename from openflow/usr/include/python3.5m/pymacro.h rename to openflow/include/python3.8/pymacro.h index 3f6f5dc..495c2c2 100644 --- a/openflow/usr/include/python3.5m/pymacro.h +++ b/openflow/include/python3.8/pymacro.h @@ -18,6 +18,9 @@ by "__LINE__". */ #define Py_STRINGIFY(x) _Py_XSTRINGIFY(x) +/* Get the size of a structure member in bytes */ +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) + /* Argument must be a char or an int in [-128, 127] or [0, 255]. */ #define Py_CHARMASK(c) ((unsigned char)((c) & 0xff)) @@ -36,6 +39,10 @@ #define Py_BUILD_ASSERT_EXPR(cond) \ (sizeof(char [1 - 2*!(cond)]) - 1) +#define Py_BUILD_ASSERT(cond) do { \ + (void)Py_BUILD_ASSERT_EXPR(cond); \ + } while(0) + /* Get the number of elements in a visible array This does not work on pointers, or arrays declared as [], or function @@ -46,7 +53,7 @@ Requires at GCC 3.1+ */ #if (defined(__GNUC__) && !defined(__STRICT_ANSI__) && \ - (((__GNUC__ == 3) && (__GNU_MINOR__ >= 1)) || (__GNUC__ >= 4))) + (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ >= 4))) /* Two gcc extensions. &a[0] degrades to a pointer: a different type from an array */ #define Py_ARRAY_LENGTH(array) \ @@ -60,7 +67,7 @@ /* Define macros for inline documentation. */ -#define PyDoc_VAR(name) static char name[] +#define PyDoc_VAR(name) static const char name[] #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) #ifdef WITH_DOC_STRINGS #define PyDoc_STR(str) str @@ -75,17 +82,25 @@ #define _Py_SIZE_ROUND_UP(n, a) (((size_t)(n) + \ (size_t)((a) - 1)) & ~(size_t)((a) - 1)) /* Round pointer "p" down to the closest "a"-aligned address <= "p". */ -#define _Py_ALIGN_DOWN(p, a) ((void *)((Py_uintptr_t)(p) & ~(Py_uintptr_t)((a) - 1))) +#define _Py_ALIGN_DOWN(p, a) ((void *)((uintptr_t)(p) & ~(uintptr_t)((a) - 1))) /* Round pointer "p" up to the closest "a"-aligned address >= "p". */ -#define _Py_ALIGN_UP(p, a) ((void *)(((Py_uintptr_t)(p) + \ - (Py_uintptr_t)((a) - 1)) & ~(Py_uintptr_t)((a) - 1))) +#define _Py_ALIGN_UP(p, a) ((void *)(((uintptr_t)(p) + \ + (uintptr_t)((a) - 1)) & ~(uintptr_t)((a) - 1))) /* Check if pointer "p" is aligned to "a"-bytes boundary. */ -#define _Py_IS_ALIGNED(p, a) (!((Py_uintptr_t)(p) & (Py_uintptr_t)((a) - 1))) +#define _Py_IS_ALIGNED(p, a) (!((uintptr_t)(p) & (uintptr_t)((a) - 1))) -#ifdef __GNUC__ -#define Py_UNUSED(name) _unused_ ## name __attribute__((unused)) +/* Use this for unused arguments in a function definition to silence compiler + * warnings. Example: + * + * int func(int a, int Py_UNUSED(b)) { return a; } + */ +#if defined(__GNUC__) || defined(__clang__) +# define Py_UNUSED(name) _unused_ ## name __attribute__((unused)) #else -#define Py_UNUSED(name) _unused_ ## name +# define Py_UNUSED(name) _unused_ ## name #endif +#define Py_UNREACHABLE() \ + Py_FatalError("Unreachable C code path reached") + #endif /* Py_PYMACRO_H */ diff --git a/openflow/usr/include/python3.5m/pymath.h b/openflow/include/python3.8/pymath.h similarity index 78% rename from openflow/usr/include/python3.5m/pymath.h rename to openflow/include/python3.8/pymath.h index 1ea9ac1..6cf69f9 100644 --- a/openflow/usr/include/python3.5m/pymath.h +++ b/openflow/include/python3.8/pymath.h @@ -37,7 +37,7 @@ extern double pow(double, double); #endif /* __STDC__ */ #endif /* _MSC_VER */ -/* High precision defintion of pi and e (Euler) +/* High precision definition of pi and e (Euler) * The values are taken from libc6's math.h. */ #ifndef Py_MATH_PIl @@ -55,6 +55,12 @@ extern double pow(double, double); #define Py_MATH_E 2.7182818284590452354 #endif +/* Tau (2pi) to 40 digits, taken from tauday.com/tau-digits. */ +#ifndef Py_MATH_TAU +#define Py_MATH_TAU 6.2831853071795864769252867665590057683943L +#endif + + /* On x86, Py_FORCE_DOUBLE forces a floating-point number out of an x87 FPU register and into a 64-bit memory location, rounding from extended precision to double precision in the process. On other platforms it does @@ -169,7 +175,7 @@ PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); #pragma float_control (pop) #define Py_NAN __icc_nan() #else /* ICC_NAN_RELAXED as default for Intel Compiler */ - static union { unsigned char buf[8]; double __icc_nan; } __nan_store = {0,0,0,0,0,0,0xf8,0x7f}; + static const union { unsigned char buf[8]; double __icc_nan; } __nan_store = {0,0,0,0,0,0,0xf8,0x7f}; #define Py_NAN (__nan_store.__icc_nan) #endif /* ICC_NAN_STRICT */ #endif /* __INTEL_COMPILER */ @@ -181,14 +187,14 @@ PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); * result. * Caution: * This isn't reliable. C99 no longer requires libm to set errno under - * any exceptional condition, but does require +- HUGE_VAL return - * values on overflow. A 754 box *probably* maps HUGE_VAL to a - * double infinity, and we're cool if that's so, unless the input - * was an infinity and an infinity is the expected result. A C89 - * system sets errno to ERANGE, so we check for that too. We're - * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or - * if the returned result is a NaN, or if a C89 box returns HUGE_VAL - * in non-overflow cases. + * any exceptional condition, but does require +- HUGE_VAL return + * values on overflow. A 754 box *probably* maps HUGE_VAL to a + * double infinity, and we're cool if that's so, unless the input + * was an infinity and an infinity is the expected result. A C89 + * system sets errno to ERANGE, so we check for that too. We're + * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or + * if the returned result is a NaN, or if a C89 box returns HUGE_VAL + * in non-overflow cases. * X is evaluated more than once. * Some platforms have better way to spell this, so expect some #ifdef'ery. * @@ -205,8 +211,20 @@ PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); #define Py_OVERFLOWED(X) isinf(X) #else #define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \ - (X) == Py_HUGE_VAL || \ - (X) == -Py_HUGE_VAL)) + (X) == Py_HUGE_VAL || \ + (X) == -Py_HUGE_VAL)) #endif +/* Return whether integral type *type* is signed or not. */ +#define _Py_IntegralTypeSigned(type) ((type)(-1) < 0) +/* Return the maximum value of integral type *type*. */ +#define _Py_IntegralTypeMax(type) ((_Py_IntegralTypeSigned(type)) ? (((((type)1 << (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0) +/* Return the minimum value of integral type *type*. */ +#define _Py_IntegralTypeMin(type) ((_Py_IntegralTypeSigned(type)) ? -_Py_IntegralTypeMax(type) - 1 : 0) +/* Check whether *v* is in the range of integral type *type*. This is most + * useful if *v* is floating-point, since demoting a floating-point *v* to an + * integral type that cannot represent *v*'s integral part is undefined + * behavior. */ +#define _Py_InIntegralTypeRange(type, v) (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type)) + #endif /* Py_PYMATH_H */ diff --git a/openflow/usr/include/python3.5m/pymem.h b/openflow/include/python3.8/pymem.h similarity index 54% rename from openflow/usr/include/python3.5m/pymem.h rename to openflow/include/python3.8/pymem.h index 043db64..07b380a 100644 --- a/openflow/usr/include/python3.5m/pymem.h +++ b/openflow/include/python3.8/pymem.h @@ -11,14 +11,6 @@ extern "C" { #endif -#ifndef Py_LIMITED_API -PyAPI_FUNC(void *) PyMem_RawMalloc(size_t size); -PyAPI_FUNC(void *) PyMem_RawCalloc(size_t nelem, size_t elsize); -PyAPI_FUNC(void *) PyMem_RawRealloc(void *ptr, size_t new_size); -PyAPI_FUNC(void) PyMem_RawFree(void *ptr); -#endif - - /* BEWARE: Each interface exports both functions and macros. Extension modules should @@ -58,15 +50,9 @@ PyAPI_FUNC(void) PyMem_RawFree(void *ptr); */ PyAPI_FUNC(void *) PyMem_Malloc(size_t size); -PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); PyAPI_FUNC(void *) PyMem_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyMem_Free(void *ptr); -#ifndef Py_LIMITED_API -PyAPI_FUNC(char *) _PyMem_RawStrdup(const char *str); -PyAPI_FUNC(char *) _PyMem_Strdup(const char *str); -#endif - /* Macros. */ /* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL @@ -90,11 +76,11 @@ PyAPI_FUNC(char *) _PyMem_Strdup(const char *str); */ #define PyMem_New(type, n) \ - ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ - ( (type *) PyMem_Malloc((n) * sizeof(type)) ) ) + ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ + ( (type *) PyMem_Malloc((n) * sizeof(type)) ) ) #define PyMem_NEW(type, n) \ - ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ - ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) ) + ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ + ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) ) /* * The value of (p) is always clobbered by this macro regardless of success. @@ -103,82 +89,58 @@ PyAPI_FUNC(char *) _PyMem_Strdup(const char *str); * caller's memory error handler to not lose track of it. */ #define PyMem_Resize(p, type, n) \ - ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ - (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) + ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ + (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) #define PyMem_RESIZE(p, type, n) \ - ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ - (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) + ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ + (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) /* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used * anymore. They're just confusing aliases for PyMem_{Free,FREE} now. */ -#define PyMem_Del PyMem_Free -#define PyMem_DEL PyMem_FREE +#define PyMem_Del PyMem_Free +#define PyMem_DEL PyMem_FREE + +/* bpo-35053: expose _Py_tracemalloc_config for performance: + _Py_NewReference() needs an efficient check to test if tracemalloc is + tracing. + + It has to be defined in pymem.h, before object.h is included. */ +struct _PyTraceMalloc_Config { + /* Module initialized? + Variable protected by the GIL */ + enum { + TRACEMALLOC_NOT_INITIALIZED, + TRACEMALLOC_INITIALIZED, + TRACEMALLOC_FINALIZED + } initialized; + + /* Is tracemalloc tracing memory allocations? + Variable protected by the GIL */ + int tracing; + + /* limit of the number of frames in a traceback, 1 by default. + Variable protected by the GIL. */ + int max_nframe; + + /* use domain in trace key? + Variable protected by the GIL. */ + int use_domain; +}; + +PyAPI_DATA(struct _PyTraceMalloc_Config) _Py_tracemalloc_config; + +#define _PyTraceMalloc_Config_INIT \ + {.initialized = TRACEMALLOC_NOT_INITIALIZED, \ + .tracing = 0, \ + .max_nframe = 1, \ + .use_domain = 0} + #ifndef Py_LIMITED_API -typedef enum { - /* PyMem_RawMalloc(), PyMem_RawRealloc() and PyMem_RawFree() */ - PYMEM_DOMAIN_RAW, - - /* PyMem_Malloc(), PyMem_Realloc() and PyMem_Free() */ - PYMEM_DOMAIN_MEM, - - /* PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() */ - PYMEM_DOMAIN_OBJ -} PyMemAllocatorDomain; - -typedef struct { - /* user context passed as the first argument to the 4 functions */ - void *ctx; - - /* allocate a memory block */ - void* (*malloc) (void *ctx, size_t size); - - /* allocate a memory block initialized by zeros */ - void* (*calloc) (void *ctx, size_t nelem, size_t elsize); - - /* allocate or resize a memory block */ - void* (*realloc) (void *ctx, void *ptr, size_t new_size); - - /* release a memory block */ - void (*free) (void *ctx, void *ptr); -} PyMemAllocatorEx; - -/* Get the memory block allocator of the specified domain. */ -PyAPI_FUNC(void) PyMem_GetAllocator(PyMemAllocatorDomain domain, - PyMemAllocatorEx *allocator); - -/* Set the memory block allocator of the specified domain. - - The new allocator must return a distinct non-NULL pointer when requesting - zero bytes. - - For the PYMEM_DOMAIN_RAW domain, the allocator must be thread-safe: the GIL - is not held when the allocator is called. - - If the new allocator is not a hook (don't call the previous allocator), the - PyMem_SetupDebugHooks() function must be called to reinstall the debug hooks - on top on the new allocator. */ -PyAPI_FUNC(void) PyMem_SetAllocator(PyMemAllocatorDomain domain, - PyMemAllocatorEx *allocator); - -/* Setup hooks to detect bugs in the following Python memory allocator - functions: - - - PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree() - - PyMem_Malloc(), PyMem_Realloc(), PyMem_Free() - - PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() - - Newly allocated memory is filled with the byte 0xCB, freed memory is filled - with the byte 0xDB. Additionnal checks: - - - detect API violations, ex: PyObject_Free() called on a buffer allocated - by PyMem_Malloc() - - detect write before the start of the buffer (buffer underflow) - - detect write after the end of the buffer (buffer overflow) - - The function does nothing if Python is not compiled is debug mode. */ -PyAPI_FUNC(void) PyMem_SetupDebugHooks(void); +# define Py_CPYTHON_PYMEM_H +# include "cpython/pymem.h" +# undef Py_CPYTHON_PYMEM_H #endif #ifdef __cplusplus diff --git a/openflow/usr/include/python3.5m/pyport.h b/openflow/include/python3.8/pyport.h similarity index 78% rename from openflow/usr/include/python3.5m/pyport.h rename to openflow/include/python3.8/pyport.h index 66e00d4..71f5794 100644 --- a/openflow/usr/include/python3.5m/pyport.h +++ b/openflow/include/python3.8/pyport.h @@ -3,15 +3,28 @@ #include "pyconfig.h" /* include for defines */ -/* Some versions of HP-UX & Solaris need inttypes.h for int32_t, - INT32_MAX, etc. */ -#ifdef HAVE_INTTYPES_H #include + + +/* Defines to build Python and its standard library: + * + * - Py_BUILD_CORE: Build Python core. Give access to Python internals, but + * should not be used by third-party modules. + * - Py_BUILD_CORE_BUILTIN: Build a Python stdlib module as a built-in module. + * - Py_BUILD_CORE_MODULE: Build a Python stdlib module as a dynamic library. + * + * Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE imply Py_BUILD_CORE. + * + * On Windows, Py_BUILD_CORE_MODULE exports "PyInit_xxx" symbol, whereas + * Py_BUILD_CORE_BUILTIN does not. + */ +#if defined(Py_BUILD_CORE_BUILTIN) && !defined(Py_BUILD_CORE) +# define Py_BUILD_CORE +#endif +#if defined(Py_BUILD_CORE_MODULE) && !defined(Py_BUILD_CORE) +# define Py_BUILD_CORE #endif -#ifdef HAVE_STDINT_H -#include -#endif /************************************************************************** Symbols and macros to supply platform-independent interfaces to basic @@ -31,14 +44,6 @@ Py_DEBUG Meaning: Extra checks compiled in for debug mode. Used in: Py_SAFE_DOWNCAST -HAVE_UINTPTR_T -Meaning: The C9X type uintptr_t is supported by the compiler -Used in: Py_uintptr_t - -HAVE_LONG_LONG -Meaning: The compiler supports the C type "long long" -Used in: PY_LONG_LONG - **************************************************************************/ /* typedefs for some C9X-defined synonyms for integral types. @@ -53,91 +58,31 @@ Used in: PY_LONG_LONG * integral synonyms. Only define the ones we actually need. */ -#ifdef HAVE_LONG_LONG +/* long long is required. Ensure HAVE_LONG_LONG is defined for compatibility. */ +#ifndef HAVE_LONG_LONG +#define HAVE_LONG_LONG 1 +#endif #ifndef PY_LONG_LONG #define PY_LONG_LONG long long -#if defined(LLONG_MAX) /* If LLONG_MAX is defined in limits.h, use that. */ #define PY_LLONG_MIN LLONG_MIN #define PY_LLONG_MAX LLONG_MAX #define PY_ULLONG_MAX ULLONG_MAX -#elif defined(__LONG_LONG_MAX__) -/* Otherwise, if GCC has a builtin define, use that. (Definition of - * PY_LLONG_MIN assumes two's complement with no trap representation.) */ -#define PY_LLONG_MAX __LONG_LONG_MAX__ -#define PY_LLONG_MIN (-PY_LLONG_MAX - 1) -#define PY_ULLONG_MAX (PY_LLONG_MAX * Py_ULL(2) + 1) -#elif defined(SIZEOF_LONG_LONG) -/* Otherwise compute from SIZEOF_LONG_LONG, assuming two's complement, no - padding bits, and no trap representation. Note: PY_ULLONG_MAX was - previously #defined as (~0ULL) here; but that'll give the wrong value in a - preprocessor expression on systems where long long != intmax_t. */ -#define PY_LLONG_MAX \ - (1 + 2 * ((Py_LL(1) << (CHAR_BIT * SIZEOF_LONG_LONG - 2)) - 1)) -#define PY_LLONG_MIN (-PY_LLONG_MAX - 1) -#define PY_ULLONG_MAX (PY_LLONG_MAX * Py_ULL(2) + 1) -#endif /* LLONG_MAX */ -#endif -#endif /* HAVE_LONG_LONG */ - -/* a build with 30-bit digits for Python integers needs an exact-width - * 32-bit unsigned integer type to store those digits. (We could just use - * type 'unsigned long', but that would be wasteful on a system where longs - * are 64-bits.) On Unix systems, the autoconf macro AC_TYPE_UINT32_T defines - * uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t. - * However, it doesn't set HAVE_UINT32_T, so we do that here. - */ -#ifdef uint32_t -#define HAVE_UINT32_T 1 #endif -#ifdef HAVE_UINT32_T -#ifndef PY_UINT32_T #define PY_UINT32_T uint32_t -#endif -#endif - -/* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the - * integer implementation, when 30-bit digits are enabled. - */ -#ifdef uint64_t -#define HAVE_UINT64_T 1 -#endif - -#ifdef HAVE_UINT64_T -#ifndef PY_UINT64_T #define PY_UINT64_T uint64_t -#endif -#endif /* Signed variants of the above */ -#ifdef int32_t -#define HAVE_INT32_T 1 -#endif - -#ifdef HAVE_INT32_T -#ifndef PY_INT32_T #define PY_INT32_T int32_t -#endif -#endif - -#ifdef int64_t -#define HAVE_INT64_T 1 -#endif - -#ifdef HAVE_INT64_T -#ifndef PY_INT64_T #define PY_INT64_T int64_t -#endif -#endif /* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all the necessary integer types are available, and we're on a 64-bit platform (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */ #ifndef PYLONG_BITS_IN_DIGIT -#if (defined HAVE_UINT64_T && defined HAVE_INT64_T && \ - defined HAVE_UINT32_T && defined HAVE_INT32_T && SIZEOF_VOID_P >= 8) +#if SIZEOF_VOID_P >= 8 #define PYLONG_BITS_IN_DIGIT 30 #else #define PYLONG_BITS_IN_DIGIT 15 @@ -149,26 +94,9 @@ Used in: PY_LONG_LONG * without loss of information. Similarly for intptr_t, wrt a signed * integral type. */ -#ifdef HAVE_UINTPTR_T typedef uintptr_t Py_uintptr_t; typedef intptr_t Py_intptr_t; -#elif SIZEOF_VOID_P <= SIZEOF_INT -typedef unsigned int Py_uintptr_t; -typedef int Py_intptr_t; - -#elif SIZEOF_VOID_P <= SIZEOF_LONG -typedef unsigned long Py_uintptr_t; -typedef long Py_intptr_t; - -#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG) -typedef unsigned PY_LONG_LONG Py_uintptr_t; -typedef PY_LONG_LONG Py_intptr_t; - -#else -# error "Python needs a typedef for Py_uintptr_t in pyport.h." -#endif /* HAVE_UINTPTR_T */ - /* Py_ssize_t is a signed integral type such that sizeof(Py_ssize_t) == * sizeof(size_t). C99 doesn't define such a thing directly (size_t is an * unsigned integral type). See PEP 353 for details. @@ -195,16 +123,8 @@ typedef Py_ssize_t Py_ssize_clean_t; typedef int Py_ssize_clean_t; #endif -/* Largest possible value of size_t. - SIZE_MAX is part of C99, so it might be defined on some - platforms. If it is not defined, (size_t)-1 is a portable - definition for C89, due to the way signed->unsigned - conversion is defined. */ -#ifdef SIZE_MAX +/* Largest possible value of size_t. */ #define PY_SIZE_MAX SIZE_MAX -#else -#define PY_SIZE_MAX ((size_t)-1) -#endif /* Largest positive value of type Py_ssize_t. */ #define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) @@ -247,22 +167,6 @@ typedef int Py_ssize_clean_t; # endif #endif -/* PY_FORMAT_LONG_LONG is analogous to PY_FORMAT_SIZE_T above, but for - * the long long type instead of the size_t type. It's only available - * when HAVE_LONG_LONG is defined. The "high level" Python format - * functions listed above will interpret "lld" or "llu" correctly on - * all platforms. - */ -#ifdef HAVE_LONG_LONG -# ifndef PY_FORMAT_LONG_LONG -# ifdef MS_WINDOWS -# define PY_FORMAT_LONG_LONG "I64" -# else -# error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG" -# endif -# endif -#endif - /* Py_LOCAL can be used instead of static to get the fastest possible calling * convention for functions that are local to a given module. * @@ -281,43 +185,23 @@ typedef int Py_ssize_clean_t; */ #if defined(_MSC_VER) -#if defined(PY_LOCAL_AGGRESSIVE) -/* enable more aggressive optimization for visual studio */ -#pragma optimize("agtw", on) +# if defined(PY_LOCAL_AGGRESSIVE) + /* enable more aggressive optimization for visual studio */ +# pragma optimize("agtw", on) #endif -/* ignore warnings if the compiler decides not to inline a function */ -#pragma warning(disable: 4710) -/* fastest possible local call under MSVC */ -#define Py_LOCAL(type) static type __fastcall -#define Py_LOCAL_INLINE(type) static __inline type __fastcall -#elif defined(USE_INLINE) -#define Py_LOCAL(type) static type -#define Py_LOCAL_INLINE(type) static inline type + /* ignore warnings if the compiler decides not to inline a function */ +# pragma warning(disable: 4710) + /* fastest possible local call under MSVC */ +# define Py_LOCAL(type) static type __fastcall +# define Py_LOCAL_INLINE(type) static __inline type __fastcall #else -#define Py_LOCAL(type) static type -#define Py_LOCAL_INLINE(type) static type +# define Py_LOCAL(type) static type +# define Py_LOCAL_INLINE(type) static inline type #endif -/* Py_MEMCPY can be used instead of memcpy in cases where the copied blocks - * are often very short. While most platforms have highly optimized code for - * large transfers, the setup costs for memcpy are often quite high. MEMCPY - * solves this by doing short copies "in line". - */ - -#if defined(_MSC_VER) -#define Py_MEMCPY(target, source, length) do { \ - size_t i_, n_ = (length); \ - char *t_ = (void*) (target); \ - const char *s_ = (void*) (source); \ - if (n_ >= 16) \ - memcpy(t_, s_, n_); \ - else \ - for (i_ = 0; i_ < n_; i_++) \ - t_[i_] = s_[i_]; \ - } while (0) -#else +/* Py_MEMCPY is kept for backwards compatibility, + * see https://bugs.python.org/issue28126 */ #define Py_MEMCPY memcpy -#endif #include @@ -461,7 +345,7 @@ extern "C" { } \ } while(0) -/* Py_SET_ERANGE_ON_OVERFLOW(x) +/* Py_SET_ERANGE_IF_OVERFLOW(x) * An alias of Py_SET_ERRNO_ON_MATH_ERROR for backward-compatibility. */ #define Py_SET_ERANGE_IF_OVERFLOW(X) Py_SET_ERRNO_ON_MATH_ERROR(X) @@ -543,7 +427,7 @@ extern "C" { #endif /* get and set x87 control word for VisualStudio/x86 */ -#if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */ +#if defined(_MSC_VER) && !defined(_WIN64) && !defined(_M_ARM) /* x87 not supported in 64-bit or ARM */ #define HAVE_PY_SET_53BIT_PRECISION 1 #define _Py_SET_53BIT_PRECISION_HEADER \ unsigned int old_387controlword, new_387controlword, out_387controlword @@ -570,18 +454,18 @@ extern "C" { #define HAVE_PY_SET_53BIT_PRECISION 1 #define _Py_SET_53BIT_PRECISION_HEADER \ unsigned int old_fpcr, new_fpcr -#define _Py_SET_53BIT_PRECISION_START \ - do { \ - __asm__ ("fmove.l %%fpcr,%0" : "=g" (old_fpcr)); \ - /* Set double precision / round to nearest. */ \ - new_fpcr = (old_fpcr & ~0xf0) | 0x80; \ - if (new_fpcr != old_fpcr) \ - __asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (new_fpcr)); \ +#define _Py_SET_53BIT_PRECISION_START \ + do { \ + __asm__ ("fmove.l %%fpcr,%0" : "=g" (old_fpcr)); \ + /* Set double precision / round to nearest. */ \ + new_fpcr = (old_fpcr & ~0xf0) | 0x80; \ + if (new_fpcr != old_fpcr) \ + __asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (new_fpcr)); \ } while (0) -#define _Py_SET_53BIT_PRECISION_END \ - do { \ - if (new_fpcr != old_fpcr) \ - __asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (old_fpcr)); \ +#define _Py_SET_53BIT_PRECISION_END \ + do { \ + if (new_fpcr != old_fpcr) \ + __asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (old_fpcr)); \ } while (0) #endif @@ -620,18 +504,60 @@ extern "C" { /* Py_DEPRECATED(version) * Declare a variable, type, or function deprecated. + * The macro must be placed before the declaration. * Usage: - * extern int old_var Py_DEPRECATED(2.3); - * typedef int T1 Py_DEPRECATED(2.4); - * extern int x() Py_DEPRECATED(2.5); + * Py_DEPRECATED(3.3) extern int old_var; + * Py_DEPRECATED(3.4) typedef int T1; + * Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void); */ -#if defined(__GNUC__) && ((__GNUC__ >= 4) || \ - (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) +#if defined(__GNUC__) \ + && ((__GNUC__ >= 4) || (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) +#elif defined(_MSC_VER) +#define Py_DEPRECATED(VERSION) __declspec(deprecated( \ + "deprecated in " #VERSION)) #else #define Py_DEPRECATED(VERSION_UNUSED) #endif + +/* _Py_HOT_FUNCTION + * The hot attribute on a function is used to inform the compiler that the + * function is a hot spot of the compiled program. The function is optimized + * more aggressively and on many target it is placed into special subsection of + * the text section so all hot functions appears close together improving + * locality. + * + * Usage: + * int _Py_HOT_FUNCTION x(void) { return 3; } + * + * Issue #28618: This attribute must not be abused, otherwise it can have a + * negative effect on performance. Only the functions were Python spend most of + * its time must use it. Use a profiler when running performance benchmark + * suite to find these functions. + */ +#if defined(__GNUC__) \ + && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) +#define _Py_HOT_FUNCTION __attribute__((hot)) +#else +#define _Py_HOT_FUNCTION +#endif + +/* _Py_NO_INLINE + * Disable inlining on a function. For example, it helps to reduce the C stack + * consumption. + * + * Usage: + * int _Py_NO_INLINE x(void) { return 3; } + */ +#if defined(_MSC_VER) +# define _Py_NO_INLINE __declspec(noinline) +#elif defined(__GNUC__) || defined(__clang__) +# define _Py_NO_INLINE __attribute__ ((noinline)) +#else +# define _Py_NO_INLINE +#endif + /************************************************************************** Prototypes that are missing from the standard include files on some systems (and possibly only some versions of such systems.) @@ -657,16 +583,6 @@ extern char * _getpty(int *, int, mode_t, int); #include #endif -#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) -#if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) -/* BSDI does not supply a prototype for the 'openpty' and 'forkpty' - functions, even though they are included in libutil. */ -#include -extern int openpty(int *, int *, char *, struct termios *, struct winsize *); -extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); -#endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */ -#endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */ - /* On 4.4BSD-descendants, ctype functions serves the whole range of * wchar_t character set rather than single byte code points only. @@ -675,19 +591,17 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); * workaround was provided by Tim Robbins of FreeBSD project. */ -#ifdef __FreeBSD__ -#include -#if __FreeBSD_version > 500039 -# define _PY_PORT_CTYPE_UTF8_ISSUE -#endif -#endif - - #if defined(__APPLE__) -# define _PY_PORT_CTYPE_UTF8_ISSUE +# define _PY_PORT_CTYPE_UTF8_ISSUE #endif #ifdef _PY_PORT_CTYPE_UTF8_ISSUE +#ifndef __cplusplus + /* The workaround below is unsafe in C++ because + * the defines these symbols as real functions, + * with a slightly different signature. + * See issue #10910 + */ #include #include #undef isalnum @@ -705,6 +619,7 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); #undef toupper #define toupper(c) towupper(btowc(c)) #endif +#endif /* Declarations for symbol visibility. @@ -733,7 +648,7 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); /* only get special linkage if built as shared or platform is Cygwin */ #if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) # if defined(HAVE_DECLSPEC_DLL) -# ifdef Py_BUILD_CORE +# if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) # define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE # define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE /* module init functions inside the core need no external linkage */ @@ -760,7 +675,7 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); # define PyMODINIT_FUNC __declspec(dllexport) PyObject* # endif /* __cplusplus */ # endif /* Py_BUILD_CORE */ -# endif /* HAVE_DECLSPEC */ +# endif /* HAVE_DECLSPEC_DLL */ #endif /* Py_ENABLE_SHARED */ /* If no external linkage macros defined by now, create defaults */ @@ -841,10 +756,6 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); #pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) #endif -/* - * Older Microsoft compilers don't support the C99 long long literal suffixes, - * so these will be defined in PC/pyconfig.h for those compilers. - */ #ifndef Py_LL #define Py_LL(x) x##LL #endif @@ -853,15 +764,7 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); #define Py_ULL(x) Py_LL(x##U) #endif -#ifdef VA_LIST_IS_ARRAY -#define Py_VA_COPY(x, y) Py_MEMCPY((x), (y), sizeof(va_list)) -#else -#ifdef __va_copy -#define Py_VA_COPY __va_copy -#else -#define Py_VA_COPY(x, y) (x) = (y) -#endif -#endif +#define Py_VA_COPY va_copy /* * Convenient macros to deal with endianness of the platform. WORDS_BIGENDIAN is @@ -877,7 +780,7 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); #define PY_LITTLE_ENDIAN 1 #endif -#ifdef Py_BUILD_CORE +#ifdef Py_BUILD_CORE /* * Macros to protect CRT calls against instant termination when passed an * invalid parameter (issue23524). @@ -897,4 +800,51 @@ extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler; #endif /* _MSC_VER >= 1900 */ #endif /* Py_BUILD_CORE */ +#ifdef __ANDROID__ + /* The Android langinfo.h header is not used. */ +# undef HAVE_LANGINFO_H +# undef CODESET +#endif + +/* Maximum value of the Windows DWORD type */ +#define PY_DWORD_MAX 4294967295U + +/* This macro used to tell whether Python was built with multithreading + * enabled. Now multithreading is always enabled, but keep the macro + * for compatibility. + */ +#ifndef WITH_THREAD +# define WITH_THREAD +#endif + +/* Check that ALT_SOABI is consistent with Py_TRACE_REFS: + ./configure --with-trace-refs should must be used to define Py_TRACE_REFS */ +#if defined(ALT_SOABI) && defined(Py_TRACE_REFS) +# error "Py_TRACE_REFS ABI is not compatible with release and debug ABI" +#endif + +#if defined(__ANDROID__) || defined(__VXWORKS__) + /* Ignore the locale encoding: force UTF-8 */ +# define _Py_FORCE_UTF8_LOCALE +#endif + +#if defined(_Py_FORCE_UTF8_LOCALE) || defined(__APPLE__) + /* Use UTF-8 as filesystem encoding */ +# define _Py_FORCE_UTF8_FS_ENCODING +#endif + +/* Mark a function which cannot return. Example: + + PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void); */ +#if defined(__clang__) || \ + (defined(__GNUC__) && \ + ((__GNUC__ >= 3) || \ + (__GNUC__ == 2) && (__GNUC_MINOR__ >= 5))) +# define _Py_NO_RETURN __attribute__((__noreturn__)) +#elif defined(_MSC_VER) +# define _Py_NO_RETURN __declspec(noreturn) +#else +# define _Py_NO_RETURN +#endif + #endif /* Py_PYPORT_H */ diff --git a/openflow/include/python3.8/pystate.h b/openflow/include/python3.8/pystate.h new file mode 100644 index 0000000..4c25e3f --- /dev/null +++ b/openflow/include/python3.8/pystate.h @@ -0,0 +1,136 @@ +/* Thread and interpreter state structures and their interfaces */ + + +#ifndef Py_PYSTATE_H +#define Py_PYSTATE_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "pythread.h" + +/* This limitation is for performance and simplicity. If needed it can be +removed (with effort). */ +#define MAX_CO_EXTRA_USERS 255 + +/* Forward declarations for PyFrameObject, PyThreadState + and PyInterpreterState */ +struct _frame; +struct _ts; +struct _is; + +/* struct _ts is defined in cpython/pystate.h */ +typedef struct _ts PyThreadState; +/* struct _is is defined in internal/pycore_pystate.h */ +typedef struct _is PyInterpreterState; + +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); +PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *); +PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03080000 +/* New in 3.8 */ +PyAPI_FUNC(PyObject *) PyInterpreterState_GetDict(PyInterpreterState *); +#endif + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 +/* New in 3.7 */ +PyAPI_FUNC(int64_t) PyInterpreterState_GetID(PyInterpreterState *); +#endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 + +/* State unique per thread */ + +/* New in 3.3 */ +PyAPI_FUNC(int) PyState_AddModule(PyObject*, struct PyModuleDef*); +PyAPI_FUNC(int) PyState_RemoveModule(struct PyModuleDef*); +#endif +PyAPI_FUNC(PyObject*) PyState_FindModule(struct PyModuleDef*); + +PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *); +PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *); +PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *); +PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); + +/* Get the current thread state. + + When the current thread state is NULL, this issues a fatal error (so that + the caller needn't check for NULL). + + The caller must hold the GIL. + + See also PyThreadState_GET() and _PyThreadState_GET(). */ +PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void); + +/* Get the current Python thread state. + + Macro using PyThreadState_Get() or _PyThreadState_GET() depending if + pycore_pystate.h is included or not (this header redefines the macro). + + If PyThreadState_Get() is used, issue a fatal error if the current thread + state is NULL. + + See also PyThreadState_Get() and _PyThreadState_GET(). */ +#define PyThreadState_GET() PyThreadState_Get() + +PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *); +PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void); +PyAPI_FUNC(int) PyThreadState_SetAsyncExc(unsigned long, PyObject *); + +typedef + enum {PyGILState_LOCKED, PyGILState_UNLOCKED} + PyGILState_STATE; + + +/* Ensure that the current thread is ready to call the Python + C API, regardless of the current state of Python, or of its + thread lock. This may be called as many times as desired + by a thread so long as each call is matched with a call to + PyGILState_Release(). In general, other thread-state APIs may + be used between _Ensure() and _Release() calls, so long as the + thread-state is restored to its previous state before the Release(). + For example, normal use of the Py_BEGIN_ALLOW_THREADS/ + Py_END_ALLOW_THREADS macros are acceptable. + + The return value is an opaque "handle" to the thread state when + PyGILState_Ensure() was called, and must be passed to + PyGILState_Release() to ensure Python is left in the same state. Even + though recursive calls are allowed, these handles can *not* be shared - + each unique call to PyGILState_Ensure must save the handle for its + call to PyGILState_Release. + + When the function returns, the current thread will hold the GIL. + + Failure is a fatal error. +*/ +PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void); + +/* Release any resources previously acquired. After this call, Python's + state will be the same as it was prior to the corresponding + PyGILState_Ensure() call (but generally this state will be unknown to + the caller, hence the use of the GILState API.) + + Every call to PyGILState_Ensure must be matched by a call to + PyGILState_Release on the same thread. +*/ +PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); + +/* Helper/diagnostic function - get the current thread state for + this thread. May return NULL if no GILState API has been used + on the current thread. Note that the main thread always has such a + thread-state, even if no auto-thread-state call has been made + on the main thread. +*/ +PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void); + + +#ifndef Py_LIMITED_API +# define Py_CPYTHON_PYSTATE_H +# include "cpython/pystate.h" +# undef Py_CPYTHON_PYSTATE_H +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYSTATE_H */ diff --git a/openflow/usr/include/python3.5m/pystrcmp.h b/openflow/include/python3.8/pystrcmp.h similarity index 100% rename from openflow/usr/include/python3.5m/pystrcmp.h rename to openflow/include/python3.8/pystrcmp.h diff --git a/openflow/usr/include/python3.5m/pystrhex.h b/openflow/include/python3.8/pystrhex.h similarity index 52% rename from openflow/usr/include/python3.5m/pystrhex.h rename to openflow/include/python3.8/pystrhex.h index 1dc1255..a4f3630 100644 --- a/openflow/usr/include/python3.5m/pystrhex.h +++ b/openflow/include/python3.8/pystrhex.h @@ -5,10 +5,15 @@ extern "C" { #endif +#ifndef Py_LIMITED_API /* Returns a str() containing the hex representation of argbuf. */ PyAPI_FUNC(PyObject*) _Py_strhex(const char* argbuf, const Py_ssize_t arglen); /* Returns a bytes() containing the ASCII hex representation of argbuf. */ PyAPI_FUNC(PyObject*) _Py_strhex_bytes(const char* argbuf, const Py_ssize_t arglen); +/* These variants include support for a separator between every N bytes: */ +PyAPI_FUNC(PyObject*) _Py_strhex_with_sep(const char* argbuf, const Py_ssize_t arglen, const PyObject* sep, const int bytes_per_group); +PyAPI_FUNC(PyObject*) _Py_strhex_bytes_with_sep(const char* argbuf, const Py_ssize_t arglen, const PyObject* sep, const int bytes_per_group); +#endif /* !Py_LIMITED_API */ #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/pystrtod.h b/openflow/include/python3.8/pystrtod.h similarity index 86% rename from openflow/usr/include/python3.5m/pystrtod.h rename to openflow/include/python3.8/pystrtod.h index 23fd1c6..c1e84de 100644 --- a/openflow/usr/include/python3.5m/pystrtod.h +++ b/openflow/include/python3.8/pystrtod.h @@ -19,6 +19,10 @@ PyAPI_FUNC(char *) PyOS_double_to_string(double val, int *type); #ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _Py_string_to_number_with_underscores( + const char *str, Py_ssize_t len, const char *what, PyObject *obj, void *arg, + PyObject *(*innerfunc)(const char *, Py_ssize_t, void *)); + PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr); #endif diff --git a/openflow/usr/include/python3.5m/pythonrun.h b/openflow/include/python3.8/pythonrun.h similarity index 78% rename from openflow/usr/include/python3.5m/pythonrun.h rename to openflow/include/python3.8/pythonrun.h index 9c2e813..46091e0 100644 --- a/openflow/usr/include/python3.5m/pythonrun.h +++ b/openflow/include/python3.8/pythonrun.h @@ -7,25 +7,8 @@ extern "C" { #endif -#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \ - CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \ - CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \ - CO_FUTURE_GENERATOR_STOP) -#define PyCF_MASK_OBSOLETE (CO_NESTED) -#define PyCF_SOURCE_IS_UTF8 0x0100 -#define PyCF_DONT_IMPLY_DEDENT 0x0200 -#define PyCF_ONLY_AST 0x0400 -#define PyCF_IGNORE_COOKIE 0x0800 - -#ifndef Py_LIMITED_API -typedef struct { - int cf_flags; /* bitmask of CO_xxx flags relevant to future */ -} PyCompilerFlags; -#endif - #ifndef Py_LIMITED_API PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); -PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_AnyFileExFlags( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ @@ -66,8 +49,8 @@ PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile( const char *filename, /* decoded from the filesystem encoding */ const char* enc, int start, - char *ps1, - char *ps2, + const char *ps1, + const char *ps2, PyCompilerFlags *flags, int *errcode, PyArena *arena); @@ -76,8 +59,8 @@ PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject( PyObject *filename, const char* enc, int start, - char *ps1, - char *ps2, + const char *ps1, + const char *ps2, PyCompilerFlags *flags, int *errcode, PyArena *arena); @@ -91,9 +74,11 @@ PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject( #endif PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, int); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *, const char *, int, int); +#endif PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *, int, int); @@ -133,10 +118,23 @@ PyAPI_FUNC(struct symtable *) Py_SymtableString( const char *filename, /* decoded from the filesystem encoding */ int start); #ifndef Py_LIMITED_API +PyAPI_FUNC(const char *) _Py_SourceAsString( + PyObject *cmd, + const char *funcname, + const char *what, + PyCompilerFlags *cf, + PyObject **cmd_copy); + PyAPI_FUNC(struct symtable *) Py_SymtableStringObject( const char *str, PyObject *filename, int start); + +PyAPI_FUNC(struct symtable *) _Py_SymtableStringObjectFlags( + const char *str, + PyObject *filename, + int start, + PyCompilerFlags *flags); #endif PyAPI_FUNC(void) PyErr_Print(void); @@ -144,6 +142,23 @@ PyAPI_FUNC(void) PyErr_PrintEx(int); PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *); #ifndef Py_LIMITED_API +/* A function flavor is also exported by libpython. It is required when + libpython is accessed directly rather than using header files which defines + macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to + export functions in pythonXX.dll. */ +PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l); +PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name); +PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit); +PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); +PyAPI_FUNC(int) PyRun_SimpleString(const char *s); +PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p); +PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c); +PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p); +PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p); +PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l); +PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c); +PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags); + /* Use macros for a bunch of old variants */ #define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL) #define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) @@ -179,7 +194,7 @@ PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState; to an 8k margin. */ #define PYOS_STACK_MARGIN 2048 -#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300 +#if defined(WIN32) && !defined(MS_WIN64) && !defined(_M_ARM) && defined(_MSC_VER) && _MSC_VER >= 1300 /* Enable stack checking under Microsoft C */ #define USE_STACKCHECK #endif diff --git a/openflow/include/python3.8/pythread.h b/openflow/include/python3.8/pythread.h new file mode 100644 index 0000000..f22e8c4 --- /dev/null +++ b/openflow/include/python3.8/pythread.h @@ -0,0 +1,161 @@ + +#ifndef Py_PYTHREAD_H +#define Py_PYTHREAD_H + +typedef void *PyThread_type_lock; +typedef void *PyThread_type_sema; + +#ifdef __cplusplus +extern "C" { +#endif + +/* Return status codes for Python lock acquisition. Chosen for maximum + * backwards compatibility, ie failure -> 0, success -> 1. */ +typedef enum PyLockStatus { + PY_LOCK_FAILURE = 0, + PY_LOCK_ACQUIRED = 1, + PY_LOCK_INTR +} PyLockStatus; + +#ifndef Py_LIMITED_API +#define PYTHREAD_INVALID_THREAD_ID ((unsigned long)-1) +#endif + +PyAPI_FUNC(void) PyThread_init_thread(void); +PyAPI_FUNC(unsigned long) PyThread_start_new_thread(void (*)(void *), void *); +PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void); +PyAPI_FUNC(unsigned long) PyThread_get_thread_ident(void); + +#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(_WIN32) || defined(_AIX) +#define PY_HAVE_THREAD_NATIVE_ID +PyAPI_FUNC(unsigned long) PyThread_get_thread_native_id(void); +#endif + +PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void); +PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock); +PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); +#define WAIT_LOCK 1 +#define NOWAIT_LOCK 0 + +/* PY_TIMEOUT_T is the integral type used to specify timeouts when waiting + on a lock (see PyThread_acquire_lock_timed() below). + PY_TIMEOUT_MAX is the highest usable value (in microseconds) of that + type, and depends on the system threading API. + + NOTE: this isn't the same value as `_thread.TIMEOUT_MAX`. The _thread + module exposes a higher-level API, with timeouts expressed in seconds + and floating-point numbers allowed. +*/ +#define PY_TIMEOUT_T long long + +#if defined(_POSIX_THREADS) + /* PyThread_acquire_lock_timed() uses _PyTime_FromNanoseconds(us * 1000), + convert microseconds to nanoseconds. */ +# define PY_TIMEOUT_MAX (PY_LLONG_MAX / 1000) +#elif defined (NT_THREADS) + /* In the NT API, the timeout is a DWORD and is expressed in milliseconds */ +# if 0xFFFFFFFFLL * 1000 < PY_LLONG_MAX +# define PY_TIMEOUT_MAX (0xFFFFFFFFLL * 1000) +# else +# define PY_TIMEOUT_MAX PY_LLONG_MAX +# endif +#else +# define PY_TIMEOUT_MAX PY_LLONG_MAX +#endif + + +/* If microseconds == 0, the call is non-blocking: it returns immediately + even when the lock can't be acquired. + If microseconds > 0, the call waits up to the specified duration. + If microseconds < 0, the call waits until success (or abnormal failure) + + microseconds must be less than PY_TIMEOUT_MAX. Behaviour otherwise is + undefined. + + If intr_flag is true and the acquire is interrupted by a signal, then the + call will return PY_LOCK_INTR. The caller may reattempt to acquire the + lock. +*/ +PyAPI_FUNC(PyLockStatus) PyThread_acquire_lock_timed(PyThread_type_lock, + PY_TIMEOUT_T microseconds, + int intr_flag); + +PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock); + +PyAPI_FUNC(size_t) PyThread_get_stacksize(void); +PyAPI_FUNC(int) PyThread_set_stacksize(size_t); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 +PyAPI_FUNC(PyObject*) PyThread_GetInfo(void); +#endif + + +/* Thread Local Storage (TLS) API + TLS API is DEPRECATED. Use Thread Specific Storage (TSS) API. + + The existing TLS API has used int to represent TLS keys across all + platforms, but it is not POSIX-compliant. Therefore, the new TSS API uses + opaque data type to represent TSS keys to be compatible (see PEP 539). +*/ +Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_create_key(void); +Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_delete_key(int key); +Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_set_key_value(int key, + void *value); +Py_DEPRECATED(3.7) PyAPI_FUNC(void *) PyThread_get_key_value(int key); +Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_delete_key_value(int key); + +/* Cleanup after a fork */ +Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_ReInitTLS(void); + + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 +/* New in 3.7 */ +/* Thread Specific Storage (TSS) API */ + +typedef struct _Py_tss_t Py_tss_t; /* opaque */ + +#ifndef Py_LIMITED_API +#if defined(_POSIX_THREADS) + /* Darwin needs pthread.h to know type name the pthread_key_t. */ +# include +# define NATIVE_TSS_KEY_T pthread_key_t +#elif defined(NT_THREADS) + /* In Windows, native TSS key type is DWORD, + but hardcode the unsigned long to avoid errors for include directive. + */ +# define NATIVE_TSS_KEY_T unsigned long +#else +# error "Require native threads. See https://bugs.python.org/issue31370" +#endif + +/* When Py_LIMITED_API is not defined, the type layout of Py_tss_t is + exposed to allow static allocation in the API clients. Even in this case, + you must handle TSS keys through API functions due to compatibility. +*/ +struct _Py_tss_t { + int _is_initialized; + NATIVE_TSS_KEY_T _key; +}; + +#undef NATIVE_TSS_KEY_T + +/* When static allocation, you must initialize with Py_tss_NEEDS_INIT. */ +#define Py_tss_NEEDS_INIT {0} +#endif /* !Py_LIMITED_API */ + +PyAPI_FUNC(Py_tss_t *) PyThread_tss_alloc(void); +PyAPI_FUNC(void) PyThread_tss_free(Py_tss_t *key); + +/* The parameter key must not be NULL. */ +PyAPI_FUNC(int) PyThread_tss_is_created(Py_tss_t *key); +PyAPI_FUNC(int) PyThread_tss_create(Py_tss_t *key); +PyAPI_FUNC(void) PyThread_tss_delete(Py_tss_t *key); +PyAPI_FUNC(int) PyThread_tss_set(Py_tss_t *key, void *value); +PyAPI_FUNC(void *) PyThread_tss_get(Py_tss_t *key); +#endif /* New in 3.7 */ + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_PYTHREAD_H */ diff --git a/openflow/usr/include/python3.5m/pytime.h b/openflow/include/python3.8/pytime.h similarity index 71% rename from openflow/usr/include/python3.5m/pytime.h rename to openflow/include/python3.8/pytime.h index 494322c..bdda1da 100644 --- a/openflow/usr/include/python3.5m/pytime.h +++ b/openflow/include/python3.8/pytime.h @@ -13,16 +13,12 @@ functions and constants extern "C" { #endif -#ifdef PY_INT64_T /* _PyTime_t: Python timestamp with subsecond precision. It can be used to store a duration, and so indirectly a date (related to another date, like UNIX epoch). */ -typedef PY_INT64_T _PyTime_t; -#define _PyTime_MIN PY_LLONG_MIN -#define _PyTime_MAX PY_LLONG_MAX -#else -# error "_PyTime_t need signed 64-bit integer type" -#endif +typedef int64_t _PyTime_t; +#define _PyTime_MIN INT64_MIN +#define _PyTime_MAX INT64_MAX typedef enum { /* Round towards minus infinity (-inf). @@ -30,9 +26,23 @@ typedef enum { _PyTime_ROUND_FLOOR=0, /* Round towards infinity (+inf). For example, used for timeout to wait "at least" N seconds. */ - _PyTime_ROUND_CEILING + _PyTime_ROUND_CEILING=1, + /* Round to nearest with ties going to nearest even integer. + For example, used to round from a Python float. */ + _PyTime_ROUND_HALF_EVEN=2, + /* Round away from zero + For example, used for timeout. _PyTime_ROUND_CEILING rounds + -1e-9 to 0 milliseconds which causes bpo-31786 issue. + _PyTime_ROUND_UP rounds -1e-9 to -1 millisecond which keeps + the timeout sign as expected. select.poll(timeout) must block + for negative values." */ + _PyTime_ROUND_UP=3, + /* _PyTime_ROUND_TIMEOUT (an alias for _PyTime_ROUND_UP) should be + used for timeouts. */ + _PyTime_ROUND_TIMEOUT = _PyTime_ROUND_UP } _PyTime_round_t; + /* Convert a time_t to a PyLong. */ PyAPI_FUNC(PyObject *) _PyLong_FromTime_t( time_t sec); @@ -75,7 +85,11 @@ PyAPI_FUNC(_PyTime_t) _PyTime_FromSeconds(int seconds); ((_PyTime_t)(seconds) * (1000 * 1000 * 1000)) /* Create a timestamp from a number of nanoseconds. */ -PyAPI_FUNC(_PyTime_t) _PyTime_FromNanoseconds(PY_LONG_LONG ns); +PyAPI_FUNC(_PyTime_t) _PyTime_FromNanoseconds(_PyTime_t ns); + +/* Create a timestamp from nanoseconds (Python int). */ +PyAPI_FUNC(int) _PyTime_FromNanosecondsObject(_PyTime_t *t, + PyObject *obj); /* Convert a number of seconds (Python float or int) to a timetamp. Raise an exception and return -1 on error, return 0 on success. */ @@ -104,6 +118,10 @@ PyAPI_FUNC(_PyTime_t) _PyTime_AsMicroseconds(_PyTime_t t, object. */ PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t); +/* Create a timestamp from a timeval structure. + Raise an exception and return -1 on overflow, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_FromTimeval(_PyTime_t *tp, struct timeval *tv); + /* Convert a timestamp to a timeval structure (microsecond resolution). tv_usec is always positive. Raise an exception and return -1 if the conversion overflowed, @@ -130,12 +148,22 @@ PyAPI_FUNC(int) _PyTime_AsTimevalTime_t( _PyTime_round_t round); #if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE) +/* Create a timestamp from a timespec structure. + Raise an exception and return -1 on overflow, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_FromTimespec(_PyTime_t *tp, struct timespec *ts); + /* Convert a timestamp to a timespec structure (nanosecond resolution). tv_nsec is always positive. Raise an exception and return -1 on error, return 0 on success. */ PyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts); #endif +/* Compute ticks * mul / div. + The caller must ensure that ((div - 1) * mul) cannot overflow. */ +PyAPI_FUNC(_PyTime_t) _PyTime_MulDiv(_PyTime_t ticks, + _PyTime_t mul, + _PyTime_t div); + /* Get the current time from the system clock. The function cannot fail. _PyTime_Init() ensures that the system clock @@ -185,6 +213,31 @@ PyAPI_FUNC(int) _PyTime_GetMonotonicClockWithInfo( Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyTime_Init(void); +/* Converts a timestamp to the Gregorian time, using the local time zone. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_localtime(time_t t, struct tm *tm); + +/* Converts a timestamp to the Gregorian time, assuming UTC. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm *tm); + +/* Get the performance counter: clock with the highest available resolution to + measure a short duration. + + The function cannot fail. _PyTime_Init() ensures that the system clock + works. */ +PyAPI_FUNC(_PyTime_t) _PyTime_GetPerfCounter(void); + +/* Get the performance counter: clock with the highest available resolution to + measure a short duration. + + Fill info (if set) with information of the function used to get the time. + + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_GetPerfCounterWithInfo( + _PyTime_t *t, + _Py_clock_info_t *info); + #ifdef __cplusplus } #endif diff --git a/openflow/usr/include/python3.5m/rangeobject.h b/openflow/include/python3.8/rangeobject.h similarity index 100% rename from openflow/usr/include/python3.5m/rangeobject.h rename to openflow/include/python3.8/rangeobject.h diff --git a/openflow/usr/include/python3.5m/setobject.h b/openflow/include/python3.8/setobject.h similarity index 90% rename from openflow/usr/include/python3.5m/setobject.h rename to openflow/include/python3.8/setobject.h index f17bc1b..fc0ea83 100644 --- a/openflow/usr/include/python3.5m/setobject.h +++ b/openflow/include/python3.8/setobject.h @@ -10,12 +10,13 @@ extern "C" { /* There are three kinds of entries in the table: -1. Unused: key == NULL -2. Active: key != NULL and key != dummy -3. Dummy: key == dummy +1. Unused: key == NULL and hash == 0 +2. Dummy: key == dummy and hash == -1 +3. Active: key != NULL and key != dummy and hash != -1 -The hash field of Unused slots have no meaning. -The hash field of Dummny slots are set to -1 +The hash field of Unused slots is always zero. + +The hash field of Dummy slots are set to -1 meaning that dummy entries can be detected by either entry->key==dummy or by entry->hash==-1. */ @@ -63,7 +64,7 @@ typedef struct { PyObject *weakreflist; /* List of weak references */ } PySetObject; -#define PySet_GET_SIZE(so) (((PySetObject *)(so))->used) +#define PySet_GET_SIZE(so) (assert(PyAnySet_Check(so)),(((PySetObject *)(so))->used)) PyAPI_DATA(PyObject *) _PySet_Dummy; diff --git a/openflow/usr/include/python3.5m/sliceobject.h b/openflow/include/python3.8/sliceobject.h similarity index 57% rename from openflow/usr/include/python3.5m/sliceobject.h rename to openflow/include/python3.8/sliceobject.h index 26370e0..aae6f3c 100644 --- a/openflow/usr/include/python3.5m/sliceobject.h +++ b/openflow/include/python3.8/sliceobject.h @@ -21,7 +21,7 @@ let these be any arbitrary python type. Py_None stands for omitted values. #ifndef Py_LIMITED_API typedef struct { PyObject_HEAD - PyObject *start, *stop, *step; /* not NULL */ + PyObject *start, *stop, *step; /* not NULL */ } PySliceObject; #endif @@ -40,9 +40,24 @@ PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length, #endif PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); +Py_DEPRECATED(3.7) PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length, - Py_ssize_t *start, Py_ssize_t *stop, - Py_ssize_t *step, Py_ssize_t *slicelength); + Py_ssize_t *start, Py_ssize_t *stop, + Py_ssize_t *step, + Py_ssize_t *slicelength); + +#if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100 +#define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \ + PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? \ + ((*(slicelen) = 0), -1) : \ + ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \ + 0)) +PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice, + Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); +PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices(Py_ssize_t length, + Py_ssize_t *start, Py_ssize_t *stop, + Py_ssize_t step); +#endif #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/structmember.h b/openflow/include/python3.8/structmember.h similarity index 96% rename from openflow/usr/include/python3.5m/structmember.h rename to openflow/include/python3.8/structmember.h index 948f690..b54f708 100644 --- a/openflow/usr/include/python3.5m/structmember.h +++ b/openflow/include/python3.8/structmember.h @@ -16,11 +16,11 @@ extern "C" { pointer is NULL. */ typedef struct PyMemberDef { - char *name; + const char *name; int type; Py_ssize_t offset; int flags; - char *doc; + const char *doc; } PyMemberDef; /* Types */ @@ -49,10 +49,8 @@ typedef struct PyMemberDef { #define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError when the value is NULL, instead of converting to None. */ -#ifdef HAVE_LONG_LONG #define T_LONGLONG 17 #define T_ULONGLONG 18 -#endif /* HAVE_LONG_LONG */ #define T_PYSSIZET 19 /* Py_ssize_t */ #define T_NONE 20 /* Value is always None */ diff --git a/openflow/usr/include/python3.5m/structseq.h b/openflow/include/python3.8/structseq.h similarity index 93% rename from openflow/usr/include/python3.5m/structseq.h rename to openflow/include/python3.8/structseq.h index af22716..e5e5d5c 100644 --- a/openflow/usr/include/python3.5m/structseq.h +++ b/openflow/include/python3.8/structseq.h @@ -8,13 +8,13 @@ extern "C" { #endif typedef struct PyStructSequence_Field { - char *name; - char *doc; + const char *name; + const char *doc; } PyStructSequence_Field; typedef struct PyStructSequence_Desc { - char *name; - char *doc; + const char *name; + const char *doc; struct PyStructSequence_Field *fields; int n_in_sequence; } PyStructSequence_Desc; diff --git a/openflow/usr/include/python3.5m/symtable.h b/openflow/include/python3.8/symtable.h similarity index 89% rename from openflow/usr/include/python3.5m/symtable.h rename to openflow/include/python3.8/symtable.h index 1409cd9..5dcfa7e 100644 --- a/openflow/usr/include/python3.5m/symtable.h +++ b/openflow/include/python3.8/symtable.h @@ -1,11 +1,12 @@ #ifndef Py_LIMITED_API #ifndef Py_SYMTABLE_H #define Py_SYMTABLE_H - #ifdef __cplusplus extern "C" { #endif +#include "Python-ast.h" /* mod_ty */ + /* XXX(ncoghlan): This is a weird mix of public names and interpreter internal * names. */ @@ -48,6 +49,8 @@ typedef struct _symtable_entry { unsigned ste_child_free : 1; /* true if a child block has free vars, including free refs to globals */ unsigned ste_generator : 1; /* true if namespace is a generator */ + unsigned ste_coroutine : 1; /* true if namespace is a coroutine */ + unsigned ste_comprehension : 1; /* true if namespace is a list comprehension */ unsigned ste_varargs : 1; /* true if block has varargs */ unsigned ste_varkeywords : 1; /* true if block has varkeywords */ unsigned ste_returns_value : 1; /* true if namespace uses return with @@ -55,11 +58,12 @@ typedef struct _symtable_entry { unsigned ste_needs_class_closure : 1; /* for class scopes, true if a closure over __class__ should be created */ + unsigned ste_comp_iter_target : 1; /* true if visiting comprehension target */ + int ste_comp_iter_expr; /* non-zero if visiting a comprehension range expression */ int ste_lineno; /* first line of block */ int ste_col_offset; /* offset of first line of block */ int ste_opt_lineno; /* lineno of last exec or import * */ int ste_opt_col_offset; /* offset of last exec or import * */ - int ste_tmpname; /* counter for listcomp temp vars */ struct symtable *ste_table; } PySTEntryObject; @@ -91,6 +95,8 @@ PyAPI_FUNC(void) PySymtable_Free(struct symtable *); #define DEF_FREE 2<<4 /* name used but not defined in nested block */ #define DEF_FREE_CLASS 2<<5 /* free variable from class's method */ #define DEF_IMPORT 2<<6 /* assignment occurred via import */ +#define DEF_ANNOT 2<<7 /* this name is annotated */ +#define DEF_COMP_ITER 2<<8 /* this name is a comprehension iteration variable */ #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) @@ -114,4 +120,4 @@ PyAPI_FUNC(void) PySymtable_Free(struct symtable *); } #endif #endif /* !Py_SYMTABLE_H */ -#endif /* Py_LIMITED_API */ +#endif /* !Py_LIMITED_API */ diff --git a/openflow/usr/include/python3.5m/sysmodule.h b/openflow/include/python3.8/sysmodule.h similarity index 84% rename from openflow/usr/include/python3.5m/sysmodule.h rename to openflow/include/python3.8/sysmodule.h index cde10ac..670e5d2 100644 --- a/openflow/usr/include/python3.5m/sysmodule.h +++ b/openflow/include/python3.8/sysmodule.h @@ -8,11 +8,7 @@ extern "C" { #endif PyAPI_FUNC(PyObject *) PySys_GetObject(const char *); -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) _PySys_GetObjectId(_Py_Identifier *key); -#endif PyAPI_FUNC(int) PySys_SetObject(const char *, PyObject *); -PyAPI_FUNC(int) _PySys_SetObjectId(_Py_Identifier *key, PyObject *); PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **); PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int); @@ -34,7 +30,9 @@ PyAPI_FUNC(void) PySys_AddXOption(const wchar_t *); PyAPI_FUNC(PyObject *) PySys_GetXOptions(void); #ifndef Py_LIMITED_API -PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *); +# define Py_CPYTHON_SYSMODULE_H +# include "cpython/sysmodule.h" +# undef Py_CPYTHON_SYSMODULE_H #endif #ifdef __cplusplus diff --git a/openflow/include/python3.8/token.h b/openflow/include/python3.8/token.h new file mode 100644 index 0000000..e08708b --- /dev/null +++ b/openflow/include/python3.8/token.h @@ -0,0 +1,92 @@ +/* Auto-generated by Tools/scripts/generate_token.py */ + +/* Token types */ +#ifndef Py_LIMITED_API +#ifndef Py_TOKEN_H +#define Py_TOKEN_H +#ifdef __cplusplus +extern "C" { +#endif + +#undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */ + +#define ENDMARKER 0 +#define NAME 1 +#define NUMBER 2 +#define STRING 3 +#define NEWLINE 4 +#define INDENT 5 +#define DEDENT 6 +#define LPAR 7 +#define RPAR 8 +#define LSQB 9 +#define RSQB 10 +#define COLON 11 +#define COMMA 12 +#define SEMI 13 +#define PLUS 14 +#define MINUS 15 +#define STAR 16 +#define SLASH 17 +#define VBAR 18 +#define AMPER 19 +#define LESS 20 +#define GREATER 21 +#define EQUAL 22 +#define DOT 23 +#define PERCENT 24 +#define LBRACE 25 +#define RBRACE 26 +#define EQEQUAL 27 +#define NOTEQUAL 28 +#define LESSEQUAL 29 +#define GREATEREQUAL 30 +#define TILDE 31 +#define CIRCUMFLEX 32 +#define LEFTSHIFT 33 +#define RIGHTSHIFT 34 +#define DOUBLESTAR 35 +#define PLUSEQUAL 36 +#define MINEQUAL 37 +#define STAREQUAL 38 +#define SLASHEQUAL 39 +#define PERCENTEQUAL 40 +#define AMPEREQUAL 41 +#define VBAREQUAL 42 +#define CIRCUMFLEXEQUAL 43 +#define LEFTSHIFTEQUAL 44 +#define RIGHTSHIFTEQUAL 45 +#define DOUBLESTAREQUAL 46 +#define DOUBLESLASH 47 +#define DOUBLESLASHEQUAL 48 +#define AT 49 +#define ATEQUAL 50 +#define RARROW 51 +#define ELLIPSIS 52 +#define COLONEQUAL 53 +#define OP 54 +#define AWAIT 55 +#define ASYNC 56 +#define TYPE_IGNORE 57 +#define TYPE_COMMENT 58 +#define ERRORTOKEN 59 +#define N_TOKENS 63 +#define NT_OFFSET 256 + +/* Special definitions for cooperation with parser */ + +#define ISTERMINAL(x) ((x) < NT_OFFSET) +#define ISNONTERMINAL(x) ((x) >= NT_OFFSET) +#define ISEOF(x) ((x) == ENDMARKER) + + +PyAPI_DATA(const char * const) _PyParser_TokenNames[]; /* Token names */ +PyAPI_FUNC(int) PyToken_OneChar(int); +PyAPI_FUNC(int) PyToken_TwoChars(int, int); +PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_TOKEN_H */ +#endif /* Py_LIMITED_API */ diff --git a/openflow/include/python3.8/traceback.h b/openflow/include/python3.8/traceback.h new file mode 100644 index 0000000..b451927 --- /dev/null +++ b/openflow/include/python3.8/traceback.h @@ -0,0 +1,28 @@ +#ifndef Py_TRACEBACK_H +#define Py_TRACEBACK_H +#ifdef __cplusplus +extern "C" { +#endif + +struct _frame; + +/* Traceback interface */ + +PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); +PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); + +/* Reveal traceback type so we can typecheck traceback objects */ +PyAPI_DATA(PyTypeObject) PyTraceBack_Type; +#define PyTraceBack_Check(v) (Py_TYPE(v) == &PyTraceBack_Type) + + +#ifndef Py_LIMITED_API +# define Py_CPYTHON_TRACEBACK_H +# include "cpython/traceback.h" +# undef Py_CPYTHON_TRACEBACK_H +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_TRACEBACK_H */ diff --git a/openflow/include/python3.8/tracemalloc.h b/openflow/include/python3.8/tracemalloc.h new file mode 100644 index 0000000..bd14217 --- /dev/null +++ b/openflow/include/python3.8/tracemalloc.h @@ -0,0 +1,38 @@ +#ifndef Py_TRACEMALLOC_H +#define Py_TRACEMALLOC_H + +#ifndef Py_LIMITED_API +/* Track an allocated memory block in the tracemalloc module. + Return 0 on success, return -1 on error (failed to allocate memory to store + the trace). + + Return -2 if tracemalloc is disabled. + + If memory block is already tracked, update the existing trace. */ +PyAPI_FUNC(int) PyTraceMalloc_Track( + unsigned int domain, + uintptr_t ptr, + size_t size); + +/* Untrack an allocated memory block in the tracemalloc module. + Do nothing if the block was not tracked. + + Return -2 if tracemalloc is disabled, otherwise return 0. */ +PyAPI_FUNC(int) PyTraceMalloc_Untrack( + unsigned int domain, + uintptr_t ptr); + +/* Get the traceback where a memory block was allocated. + + Return a tuple of (filename: str, lineno: int) tuples. + + Return None if the tracemalloc module is disabled or if the memory block + is not tracked by tracemalloc. + + Raise an exception and return NULL on error. */ +PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback( + unsigned int domain, + uintptr_t ptr); +#endif + +#endif /* !Py_TRACEMALLOC_H */ diff --git a/openflow/usr/include/python3.5m/tupleobject.h b/openflow/include/python3.8/tupleobject.h similarity index 60% rename from openflow/usr/include/python3.5m/tupleobject.h rename to openflow/include/python3.8/tupleobject.h index c273ce7..590902d 100644 --- a/openflow/usr/include/python3.5m/tupleobject.h +++ b/openflow/include/python3.8/tupleobject.h @@ -1,4 +1,3 @@ - /* Tuple object interface */ #ifndef Py_TUPLEOBJECT_H @@ -10,7 +9,7 @@ extern "C" { /* Another generally useful object type is a tuple of object pointers. For Python, this is an immutable type. C code can change the tuple items -(but not their number), and even use tuples are general-purpose arrays of +(but not their number), and even use tuples as general-purpose arrays of object references, but in general only brand new tuples should be mutated, not ones that might already have been exposed to Python code. @@ -21,18 +20,6 @@ inserted in the tuple. Similarly, PyTuple_GetItem does not increment the returned item's reference count. */ -#ifndef Py_LIMITED_API -typedef struct { - PyObject_VAR_HEAD - PyObject *ob_item[1]; - - /* ob_item contains space for 'ob_size' elements. - * Items must normally not be NULL, except during construction when - * the tuple is not yet visible outside the function that builds it. - */ -} PyTupleObject; -#endif - PyAPI_DATA(PyTypeObject) PyTuple_Type; PyAPI_DATA(PyTypeObject) PyTupleIter_Type; @@ -45,27 +32,15 @@ PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *); PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *); PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); -#ifndef Py_LIMITED_API -PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t); -#endif PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...); -#ifndef Py_LIMITED_API -PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); -#endif - -/* Macro, trading safety for speed */ -#ifndef Py_LIMITED_API -#define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i]) -#define PyTuple_GET_SIZE(op) Py_SIZE(op) - -/* Macro, *only* to be used to fill in brand new tuples */ -#define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v) -#endif PyAPI_FUNC(int) PyTuple_ClearFreeList(void); + #ifndef Py_LIMITED_API -PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out); -#endif /* Py_LIMITED_API */ +# define Py_CPYTHON_TUPLEOBJECT_H +# include "cpython/tupleobject.h" +# undef Py_CPYTHON_TUPLEOBJECT_H +#endif #ifdef __cplusplus } diff --git a/openflow/usr/include/python3.5m/typeslots.h b/openflow/include/python3.8/typeslots.h similarity index 100% rename from openflow/usr/include/python3.5m/typeslots.h rename to openflow/include/python3.8/typeslots.h diff --git a/openflow/usr/include/python3.5m/ucnhash.h b/openflow/include/python3.8/ucnhash.h similarity index 100% rename from openflow/usr/include/python3.5m/ucnhash.h rename to openflow/include/python3.8/ucnhash.h diff --git a/openflow/include/python3.8/unicodeobject.h b/openflow/include/python3.8/unicodeobject.h new file mode 100644 index 0000000..97d8cd1 --- /dev/null +++ b/openflow/include/python3.8/unicodeobject.h @@ -0,0 +1,1044 @@ +#ifndef Py_UNICODEOBJECT_H +#define Py_UNICODEOBJECT_H + +#include + +/* + +Unicode implementation based on original code by Fredrik Lundh, +modified by Marc-Andre Lemburg (mal@lemburg.com) according to the +Unicode Integration Proposal. (See +http://www.egenix.com/files/python/unicode-proposal.txt). + +Copyright (c) Corporation for National Research Initiatives. + + + Original header: + -------------------------------------------------------------------- + + * Yet another Unicode string type for Python. This type supports the + * 16-bit Basic Multilingual Plane (BMP) only. + * + * Written by Fredrik Lundh, January 1999. + * + * Copyright (c) 1999 by Secret Labs AB. + * Copyright (c) 1999 by Fredrik Lundh. + * + * fredrik@pythonware.com + * http://www.pythonware.com + * + * -------------------------------------------------------------------- + * This Unicode String Type is + * + * Copyright (c) 1999 by Secret Labs AB + * Copyright (c) 1999 by Fredrik Lundh + * + * By obtaining, using, and/or copying this software and/or its + * associated documentation, you agree that you have read, understood, + * and will comply with the following terms and conditions: + * + * Permission to use, copy, modify, and distribute this software and its + * associated documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appears in all + * copies, and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of Secret Labs + * AB or the author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. + * + * SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * -------------------------------------------------------------------- */ + +#include + +/* === Internal API ======================================================= */ + +/* --- Internal Unicode Format -------------------------------------------- */ + +/* Python 3.x requires unicode */ +#define Py_USING_UNICODE + +#ifndef SIZEOF_WCHAR_T +#error Must define SIZEOF_WCHAR_T +#endif + +#define Py_UNICODE_SIZE SIZEOF_WCHAR_T + +/* If wchar_t can be used for UCS-4 storage, set Py_UNICODE_WIDE. + Otherwise, Unicode strings are stored as UCS-2 (with limited support + for UTF-16) */ + +#if Py_UNICODE_SIZE >= 4 +#define Py_UNICODE_WIDE +#endif + +/* Set these flags if the platform has "wchar.h" and the + wchar_t type is a 16-bit unsigned type */ +/* #define HAVE_WCHAR_H */ +/* #define HAVE_USABLE_WCHAR_T */ + +/* If the compiler provides a wchar_t type we try to support it + through the interface functions PyUnicode_FromWideChar(), + PyUnicode_AsWideChar() and PyUnicode_AsWideCharString(). */ + +#ifdef HAVE_USABLE_WCHAR_T +# ifndef HAVE_WCHAR_H +# define HAVE_WCHAR_H +# endif +#endif + +#ifdef HAVE_WCHAR_H +# include +#endif + +/* Py_UCS4 and Py_UCS2 are typedefs for the respective + unicode representations. */ +typedef uint32_t Py_UCS4; +typedef uint16_t Py_UCS2; +typedef uint8_t Py_UCS1; + +#ifdef __cplusplus +extern "C" { +#endif + + +PyAPI_DATA(PyTypeObject) PyUnicode_Type; +PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type; + +#define PyUnicode_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) +#define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type) + +/* --- Constants ---------------------------------------------------------- */ + +/* This Unicode character will be used as replacement character during + decoding if the errors argument is set to "replace". Note: the + Unicode character U+FFFD is the official REPLACEMENT CHARACTER in + Unicode 3.0. */ + +#define Py_UNICODE_REPLACEMENT_CHARACTER ((Py_UCS4) 0xFFFD) + +/* === Public API ========================================================= */ + +/* Similar to PyUnicode_FromUnicode(), but u points to UTF-8 encoded bytes */ +PyAPI_FUNC(PyObject*) PyUnicode_FromStringAndSize( + const char *u, /* UTF-8 encoded string */ + Py_ssize_t size /* size of buffer */ + ); + +/* Similar to PyUnicode_FromUnicode(), but u points to null-terminated + UTF-8 encoded bytes. The size is determined with strlen(). */ +PyAPI_FUNC(PyObject*) PyUnicode_FromString( + const char *u /* UTF-8 encoded string */ + ); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 +PyAPI_FUNC(PyObject*) PyUnicode_Substring( + PyObject *str, + Py_ssize_t start, + Py_ssize_t end); +#endif + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 +/* Copy the string into a UCS4 buffer including the null character if copy_null + is set. Return NULL and raise an exception on error. Raise a SystemError if + the buffer is smaller than the string. Return buffer on success. + + buflen is the length of the buffer in (Py_UCS4) characters. */ +PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4( + PyObject *unicode, + Py_UCS4* buffer, + Py_ssize_t buflen, + int copy_null); + +/* Copy the string into a UCS4 buffer. A new buffer is allocated using + * PyMem_Malloc; if this fails, NULL is returned with a memory error + exception set. */ +PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4Copy(PyObject *unicode); +#endif + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 +/* Get the length of the Unicode object. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_GetLength( + PyObject *unicode +); +#endif + +/* Get the number of Py_UNICODE units in the + string representation. */ + +Py_DEPRECATED(3.3) PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize( + PyObject *unicode /* Unicode object */ + ); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 +/* Read a character from the string. */ + +PyAPI_FUNC(Py_UCS4) PyUnicode_ReadChar( + PyObject *unicode, + Py_ssize_t index + ); + +/* Write a character to the string. The string must have been created through + PyUnicode_New, must not be shared, and must not have been hashed yet. + + Return 0 on success, -1 on error. */ + +PyAPI_FUNC(int) PyUnicode_WriteChar( + PyObject *unicode, + Py_ssize_t index, + Py_UCS4 character + ); +#endif + +/* Resize a Unicode object. The length is the number of characters, except + if the kind of the string is PyUnicode_WCHAR_KIND: in this case, the length + is the number of Py_UNICODE characters. + + *unicode is modified to point to the new (resized) object and 0 + returned on success. + + Try to resize the string in place (which is usually faster than allocating + a new string and copy characters), or create a new string. + + Error handling is implemented as follows: an exception is set, -1 + is returned and *unicode left untouched. + + WARNING: The function doesn't check string content, the result may not be a + string in canonical representation. */ + +PyAPI_FUNC(int) PyUnicode_Resize( + PyObject **unicode, /* Pointer to the Unicode object */ + Py_ssize_t length /* New length */ + ); + +/* Decode obj to a Unicode object. + + bytes, bytearray and other bytes-like objects are decoded according to the + given encoding and error handler. The encoding and error handler can be + NULL to have the interface use UTF-8 and "strict". + + All other objects (including Unicode objects) raise an exception. + + The API returns NULL in case of an error. The caller is responsible + for decref'ing the returned objects. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject( + PyObject *obj, /* Object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Copy an instance of a Unicode subtype to a new true Unicode object if + necessary. If obj is already a true Unicode object (not a subtype), return + the reference with *incremented* refcount. + + The API returns NULL in case of an error. The caller is responsible + for decref'ing the returned objects. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_FromObject( + PyObject *obj /* Object */ + ); + +PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV( + const char *format, /* ASCII-encoded string */ + va_list vargs + ); +PyAPI_FUNC(PyObject *) PyUnicode_FromFormat( + const char *format, /* ASCII-encoded string */ + ... + ); + +PyAPI_FUNC(void) PyUnicode_InternInPlace(PyObject **); +PyAPI_FUNC(void) PyUnicode_InternImmortal(PyObject **); +PyAPI_FUNC(PyObject *) PyUnicode_InternFromString( + const char *u /* UTF-8 encoded string */ + ); + +/* Use only if you know it's a string */ +#define PyUnicode_CHECK_INTERNED(op) \ + (((PyASCIIObject *)(op))->state.interned) + +/* --- wchar_t support for platforms which support it --------------------- */ + +#ifdef HAVE_WCHAR_H + +/* Create a Unicode Object from the wchar_t buffer w of the given + size. + + The buffer is copied into the new object. */ + +PyAPI_FUNC(PyObject*) PyUnicode_FromWideChar( + const wchar_t *w, /* wchar_t buffer */ + Py_ssize_t size /* size of buffer */ + ); + +/* Copies the Unicode Object contents into the wchar_t buffer w. At + most size wchar_t characters are copied. + + Note that the resulting wchar_t string may or may not be + 0-terminated. It is the responsibility of the caller to make sure + that the wchar_t string is 0-terminated in case this is required by + the application. + + Returns the number of wchar_t characters copied (excluding a + possibly trailing 0-termination character) or -1 in case of an + error. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar( + PyObject *unicode, /* Unicode object */ + wchar_t *w, /* wchar_t buffer */ + Py_ssize_t size /* size of buffer */ + ); + +/* Convert the Unicode object to a wide character string. The output string + always ends with a nul character. If size is not NULL, write the number of + wide characters (excluding the null character) into *size. + + Returns a buffer allocated by PyMem_Malloc() (use PyMem_Free() to free it) + on success. On error, returns NULL, *size is undefined and raises a + MemoryError. */ + +PyAPI_FUNC(wchar_t*) PyUnicode_AsWideCharString( + PyObject *unicode, /* Unicode object */ + Py_ssize_t *size /* number of characters of the result */ + ); + +#endif + +/* --- Unicode ordinals --------------------------------------------------- */ + +/* Create a Unicode Object from the given Unicode code point ordinal. + + The ordinal must be in range(0x110000). A ValueError is + raised in case it is not. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal); + +/* --- Free-list management ----------------------------------------------- */ + +/* Clear the free list used by the Unicode implementation. + + This can be used to release memory used for objects on the free + list back to the Python memory allocator. + +*/ + +PyAPI_FUNC(int) PyUnicode_ClearFreeList(void); + +/* === Builtin Codecs ===================================================== + + Many of these APIs take two arguments encoding and errors. These + parameters encoding and errors have the same semantics as the ones + of the builtin str() API. + + Setting encoding to NULL causes the default encoding (UTF-8) to be used. + + Error handling is set by errors which may also be set to NULL + meaning to use the default handling defined for the codec. Default + error handling for all builtin codecs is "strict" (ValueErrors are + raised). + + The codecs all use a similar interface. Only deviation from the + generic ones are documented. + +*/ + +/* --- Manage the default encoding ---------------------------------------- */ + +/* Returns "utf-8". */ +PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void); + +/* --- Generic Codecs ----------------------------------------------------- */ + +/* Create a Unicode object by decoding the encoded string s of the + given size. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Decode( + const char *s, /* encoded string */ + Py_ssize_t size, /* size of buffer */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Decode a Unicode object unicode and return the result as Python + object. + + This API is DEPRECATED. The only supported standard encoding is rot13. + Use PyCodec_Decode() to decode with rot13 and non-standard codecs + that decode from str. */ + +Py_DEPRECATED(3.6) PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedObject( + PyObject *unicode, /* Unicode object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Decode a Unicode object unicode and return the result as Unicode + object. + + This API is DEPRECATED. The only supported standard encoding is rot13. + Use PyCodec_Decode() to decode with rot13 and non-standard codecs + that decode from str to str. */ + +Py_DEPRECATED(3.6) PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedUnicode( + PyObject *unicode, /* Unicode object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a Unicode object and returns the result as Python + object. + + This API is DEPRECATED. It is superseded by PyUnicode_AsEncodedString() + since all standard encodings (except rot13) encode str to bytes. + Use PyCodec_Encode() for encoding with rot13 and non-standard codecs + that encode form str to non-bytes. */ + +Py_DEPRECATED(3.6) PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject( + PyObject *unicode, /* Unicode object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a Unicode object and returns the result as Python string + object. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString( + PyObject *unicode, /* Unicode object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a Unicode object and returns the result as Unicode + object. + + This API is DEPRECATED. The only supported standard encodings is rot13. + Use PyCodec_Encode() to encode with rot13 and non-standard codecs + that encode from str to str. */ + +Py_DEPRECATED(3.6) PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedUnicode( + PyObject *unicode, /* Unicode object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Build an encoding map. */ + +PyAPI_FUNC(PyObject*) PyUnicode_BuildEncodingMap( + PyObject* string /* 256 character map */ + ); + +/* --- UTF-7 Codecs ------------------------------------------------------- */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7( + const char *string, /* UTF-7 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful( + const char *string, /* UTF-7 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed /* bytes consumed */ + ); + +/* --- UTF-8 Codecs ------------------------------------------------------- */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8( + const char *string, /* UTF-8 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful( + const char *string, /* UTF-8 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed /* bytes consumed */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String( + PyObject *unicode /* Unicode object */ + ); + +/* --- UTF-32 Codecs ------------------------------------------------------ */ + +/* Decodes length bytes from a UTF-32 encoded buffer string and returns + the corresponding Unicode object. + + errors (if non-NULL) defines the error handling. It defaults + to "strict". + + If byteorder is non-NULL, the decoder starts decoding using the + given byte order: + + *byteorder == -1: little endian + *byteorder == 0: native order + *byteorder == 1: big endian + + In native mode, the first four bytes of the stream are checked for a + BOM mark. If found, the BOM mark is analysed, the byte order + adjusted and the BOM skipped. In the other modes, no BOM mark + interpretation is done. After completion, *byteorder is set to the + current byte order at the end of input data. + + If byteorder is NULL, the codec starts in native order mode. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32( + const char *string, /* UTF-32 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + int *byteorder /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful( + const char *string, /* UTF-32 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + int *byteorder, /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + Py_ssize_t *consumed /* bytes consumed */ + ); + +/* Returns a Python string using the UTF-32 encoding in native byte + order. The string always starts with a BOM mark. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String( + PyObject *unicode /* Unicode object */ + ); + +/* Returns a Python string object holding the UTF-32 encoded value of + the Unicode data. + + If byteorder is not 0, output is written according to the following + byte order: + + byteorder == -1: little endian + byteorder == 0: native byte order (writes a BOM mark) + byteorder == 1: big endian + + If byteorder is 0, the output string will always start with the + Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is + prepended. + +*/ + +/* --- UTF-16 Codecs ------------------------------------------------------ */ + +/* Decodes length bytes from a UTF-16 encoded buffer string and returns + the corresponding Unicode object. + + errors (if non-NULL) defines the error handling. It defaults + to "strict". + + If byteorder is non-NULL, the decoder starts decoding using the + given byte order: + + *byteorder == -1: little endian + *byteorder == 0: native order + *byteorder == 1: big endian + + In native mode, the first two bytes of the stream are checked for a + BOM mark. If found, the BOM mark is analysed, the byte order + adjusted and the BOM skipped. In the other modes, no BOM mark + interpretation is done. After completion, *byteorder is set to the + current byte order at the end of input data. + + If byteorder is NULL, the codec starts in native order mode. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16( + const char *string, /* UTF-16 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + int *byteorder /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful( + const char *string, /* UTF-16 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + int *byteorder, /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + Py_ssize_t *consumed /* bytes consumed */ + ); + +/* Returns a Python string using the UTF-16 encoding in native byte + order. The string always starts with a BOM mark. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( + PyObject *unicode /* Unicode object */ + ); + +/* --- Unicode-Escape Codecs ---------------------------------------------- */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape( + const char *string, /* Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( + PyObject *unicode /* Unicode object */ + ); + +/* --- Raw-Unicode-Escape Codecs ------------------------------------------ */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape( + const char *string, /* Raw-Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString( + PyObject *unicode /* Unicode object */ + ); + +/* --- Latin-1 Codecs ----------------------------------------------------- + + Note: Latin-1 corresponds to the first 256 Unicode ordinals. */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1( + const char *string, /* Latin-1 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String( + PyObject *unicode /* Unicode object */ + ); + +/* --- ASCII Codecs ------------------------------------------------------- + + Only 7-bit ASCII data is excepted. All other codes generate errors. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII( + const char *string, /* ASCII encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString( + PyObject *unicode /* Unicode object */ + ); + +/* --- Character Map Codecs ----------------------------------------------- + + This codec uses mappings to encode and decode characters. + + Decoding mappings must map byte ordinals (integers in the range from 0 to + 255) to Unicode strings, integers (which are then interpreted as Unicode + ordinals) or None. Unmapped data bytes (ones which cause a LookupError) + as well as mapped to None, 0xFFFE or '\ufffe' are treated as "undefined + mapping" and cause an error. + + Encoding mappings must map Unicode ordinal integers to bytes objects, + integers in the range from 0 to 255 or None. Unmapped character + ordinals (ones which cause a LookupError) as well as mapped to + None are treated as "undefined mapping" and cause an error. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap( + const char *string, /* Encoded string */ + Py_ssize_t length, /* size of string */ + PyObject *mapping, /* decoding mapping */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString( + PyObject *unicode, /* Unicode object */ + PyObject *mapping /* encoding mapping */ + ); + +/* --- MBCS codecs for Windows -------------------------------------------- */ + +#ifdef MS_WINDOWS +PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCS( + const char *string, /* MBCS encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCSStateful( + const char *string, /* MBCS encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed /* bytes consumed */ + ); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 +PyAPI_FUNC(PyObject*) PyUnicode_DecodeCodePageStateful( + int code_page, /* code page number */ + const char *string, /* encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed /* bytes consumed */ + ); +#endif + +PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString( + PyObject *unicode /* Unicode object */ + ); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 +PyAPI_FUNC(PyObject*) PyUnicode_EncodeCodePage( + int code_page, /* code page number */ + PyObject *unicode, /* Unicode object */ + const char *errors /* error handling */ + ); +#endif + +#endif /* MS_WINDOWS */ + +/* --- Locale encoding --------------------------------------------------- */ + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 +/* Decode a string from the current locale encoding. The decoder is strict if + *surrogateescape* is equal to zero, otherwise it uses the 'surrogateescape' + error handler (PEP 383) to escape undecodable bytes. If a byte sequence can + be decoded as a surrogate character and *surrogateescape* is not equal to + zero, the byte sequence is escaped using the 'surrogateescape' error handler + instead of being decoded. *str* must end with a null character but cannot + contain embedded null characters. */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeLocaleAndSize( + const char *str, + Py_ssize_t len, + const char *errors); + +/* Similar to PyUnicode_DecodeLocaleAndSize(), but compute the string + length using strlen(). */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeLocale( + const char *str, + const char *errors); + +/* Encode a Unicode object to the current locale encoding. The encoder is + strict is *surrogateescape* is equal to zero, otherwise the + "surrogateescape" error handler is used. Return a bytes object. The string + cannot contain embedded null characters. */ + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeLocale( + PyObject *unicode, + const char *errors + ); +#endif + +/* --- File system encoding ---------------------------------------------- */ + +/* ParseTuple converter: encode str objects to bytes using + PyUnicode_EncodeFSDefault(); bytes objects are output as-is. */ + +PyAPI_FUNC(int) PyUnicode_FSConverter(PyObject*, void*); + +/* ParseTuple converter: decode bytes objects to unicode using + PyUnicode_DecodeFSDefaultAndSize(); str objects are output as-is. */ + +PyAPI_FUNC(int) PyUnicode_FSDecoder(PyObject*, void*); + +/* Decode a null-terminated string using Py_FileSystemDefaultEncoding + and the "surrogateescape" error handler. + + If Py_FileSystemDefaultEncoding is not set, fall back to the locale + encoding. + + Use PyUnicode_DecodeFSDefaultAndSize() if the string length is known. +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefault( + const char *s /* encoded string */ + ); + +/* Decode a string using Py_FileSystemDefaultEncoding + and the "surrogateescape" error handler. + + If Py_FileSystemDefaultEncoding is not set, fall back to the locale + encoding. +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefaultAndSize( + const char *s, /* encoded string */ + Py_ssize_t size /* size */ + ); + +/* Encode a Unicode object to Py_FileSystemDefaultEncoding with the + "surrogateescape" error handler, and return bytes. + + If Py_FileSystemDefaultEncoding is not set, fall back to the locale + encoding. +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeFSDefault( + PyObject *unicode + ); + +/* --- Methods & Slots ---------------------------------------------------- + + These are capable of handling Unicode objects and strings on input + (we refer to them as strings in the descriptions) and return + Unicode objects or integers as appropriate. */ + +/* Concat two strings giving a new Unicode string. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Concat( + PyObject *left, /* Left string */ + PyObject *right /* Right string */ + ); + +/* Concat two strings and put the result in *pleft + (sets *pleft to NULL on error) */ + +PyAPI_FUNC(void) PyUnicode_Append( + PyObject **pleft, /* Pointer to left string */ + PyObject *right /* Right string */ + ); + +/* Concat two strings, put the result in *pleft and drop the right object + (sets *pleft to NULL on error) */ + +PyAPI_FUNC(void) PyUnicode_AppendAndDel( + PyObject **pleft, /* Pointer to left string */ + PyObject *right /* Right string */ + ); + +/* Split a string giving a list of Unicode strings. + + If sep is NULL, splitting will be done at all whitespace + substrings. Otherwise, splits occur at the given separator. + + At most maxsplit splits will be done. If negative, no limit is set. + + Separators are not included in the resulting list. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_Split( + PyObject *s, /* String to split */ + PyObject *sep, /* String separator */ + Py_ssize_t maxsplit /* Maxsplit count */ + ); + +/* Dito, but split at line breaks. + + CRLF is considered to be one line break. Line breaks are not + included in the resulting list. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Splitlines( + PyObject *s, /* String to split */ + int keepends /* If true, line end markers are included */ + ); + +/* Partition a string using a given separator. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Partition( + PyObject *s, /* String to partition */ + PyObject *sep /* String separator */ + ); + +/* Partition a string using a given separator, searching from the end of the + string. */ + +PyAPI_FUNC(PyObject*) PyUnicode_RPartition( + PyObject *s, /* String to partition */ + PyObject *sep /* String separator */ + ); + +/* Split a string giving a list of Unicode strings. + + If sep is NULL, splitting will be done at all whitespace + substrings. Otherwise, splits occur at the given separator. + + At most maxsplit splits will be done. But unlike PyUnicode_Split + PyUnicode_RSplit splits from the end of the string. If negative, + no limit is set. + + Separators are not included in the resulting list. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_RSplit( + PyObject *s, /* String to split */ + PyObject *sep, /* String separator */ + Py_ssize_t maxsplit /* Maxsplit count */ + ); + +/* Translate a string by applying a character mapping table to it and + return the resulting Unicode object. + + The mapping table must map Unicode ordinal integers to Unicode strings, + Unicode ordinal integers or None (causing deletion of the character). + + Mapping tables may be dictionaries or sequences. Unmapped character + ordinals (ones which cause a LookupError) are left untouched and + are copied as-is. + +*/ + +PyAPI_FUNC(PyObject *) PyUnicode_Translate( + PyObject *str, /* String */ + PyObject *table, /* Translate table */ + const char *errors /* error handling */ + ); + +/* Join a sequence of strings using the given separator and return + the resulting Unicode string. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Join( + PyObject *separator, /* Separator string */ + PyObject *seq /* Sequence object */ + ); + +/* Return 1 if substr matches str[start:end] at the given tail end, 0 + otherwise. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch( + PyObject *str, /* String */ + PyObject *substr, /* Prefix or Suffix string */ + Py_ssize_t start, /* Start index */ + Py_ssize_t end, /* Stop index */ + int direction /* Tail end: -1 prefix, +1 suffix */ + ); + +/* Return the first position of substr in str[start:end] using the + given search direction or -1 if not found. -2 is returned in case + an error occurred and an exception is set. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_Find( + PyObject *str, /* String */ + PyObject *substr, /* Substring to find */ + Py_ssize_t start, /* Start index */ + Py_ssize_t end, /* Stop index */ + int direction /* Find direction: +1 forward, -1 backward */ + ); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 +/* Like PyUnicode_Find, but search for single character only. */ +PyAPI_FUNC(Py_ssize_t) PyUnicode_FindChar( + PyObject *str, + Py_UCS4 ch, + Py_ssize_t start, + Py_ssize_t end, + int direction + ); +#endif + +/* Count the number of occurrences of substr in str[start:end]. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_Count( + PyObject *str, /* String */ + PyObject *substr, /* Substring to count */ + Py_ssize_t start, /* Start index */ + Py_ssize_t end /* Stop index */ + ); + +/* Replace at most maxcount occurrences of substr in str with replstr + and return the resulting Unicode object. */ + +PyAPI_FUNC(PyObject *) PyUnicode_Replace( + PyObject *str, /* String */ + PyObject *substr, /* Substring to find */ + PyObject *replstr, /* Substring to replace */ + Py_ssize_t maxcount /* Max. number of replacements to apply; + -1 = all */ + ); + +/* Compare two strings and return -1, 0, 1 for less than, equal, + greater than resp. + Raise an exception and return -1 on error. */ + +PyAPI_FUNC(int) PyUnicode_Compare( + PyObject *left, /* Left string */ + PyObject *right /* Right string */ + ); + +/* Compare a Unicode object with C string and return -1, 0, 1 for less than, + equal, and greater than, respectively. It is best to pass only + ASCII-encoded strings, but the function interprets the input string as + ISO-8859-1 if it contains non-ASCII characters. + This function does not raise exceptions. */ + +PyAPI_FUNC(int) PyUnicode_CompareWithASCIIString( + PyObject *left, + const char *right /* ASCII-encoded string */ + ); + +/* Rich compare two strings and return one of the following: + + - NULL in case an exception was raised + - Py_True or Py_False for successful comparisons + - Py_NotImplemented in case the type combination is unknown + + Possible values for op: + + Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE + +*/ + +PyAPI_FUNC(PyObject *) PyUnicode_RichCompare( + PyObject *left, /* Left string */ + PyObject *right, /* Right string */ + int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */ + ); + +/* Apply an argument tuple or dictionary to a format string and return + the resulting Unicode string. */ + +PyAPI_FUNC(PyObject *) PyUnicode_Format( + PyObject *format, /* Format string */ + PyObject *args /* Argument tuple or dictionary */ + ); + +/* Checks whether element is contained in container and return 1/0 + accordingly. + + element has to coerce to a one element Unicode string. -1 is + returned in case of an error. */ + +PyAPI_FUNC(int) PyUnicode_Contains( + PyObject *container, /* Container string */ + PyObject *element /* Element string */ + ); + +/* Checks whether argument is a valid identifier. */ + +PyAPI_FUNC(int) PyUnicode_IsIdentifier(PyObject *s); + +/* === Characters Type APIs =============================================== */ + +#ifndef Py_LIMITED_API +# define Py_CPYTHON_UNICODEOBJECT_H +# include "cpython/unicodeobject.h" +# undef Py_CPYTHON_UNICODEOBJECT_H +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_UNICODEOBJECT_H */ diff --git a/openflow/usr/include/python3.5m/warnings.h b/openflow/include/python3.8/warnings.h similarity index 80% rename from openflow/usr/include/python3.5m/warnings.h rename to openflow/include/python3.8/warnings.h index effb9fa..a675bb5 100644 --- a/openflow/usr/include/python3.5m/warnings.h +++ b/openflow/include/python3.8/warnings.h @@ -17,6 +17,15 @@ PyAPI_FUNC(int) PyErr_WarnFormat( Py_ssize_t stack_level, const char *format, /* ASCII-encoded string */ ...); + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 +/* Emit a ResourceWarning warning */ +PyAPI_FUNC(int) PyErr_ResourceWarning( + PyObject *source, + Py_ssize_t stack_level, + const char *format, /* ASCII-encoded string */ + ...); +#endif #ifndef Py_LIMITED_API PyAPI_FUNC(int) PyErr_WarnExplicitObject( PyObject *category, @@ -47,6 +56,10 @@ PyErr_WarnExplicitFormat(PyObject *category, #define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1) #endif +#ifndef Py_LIMITED_API +void _PyErr_WarnUnawaitedCoroutine(PyObject *coro); +#endif + #ifdef __cplusplus } #endif diff --git a/openflow/usr/include/python3.5m/weakrefobject.h b/openflow/include/python3.8/weakrefobject.h similarity index 100% rename from openflow/usr/include/python3.5m/weakrefobject.h rename to openflow/include/python3.8/weakrefobject.h diff --git a/openflow/usr/include/xdl_debug.h b/openflow/include/xdl_debug.h similarity index 100% rename from openflow/usr/include/xdl_debug.h rename to openflow/include/xdl_debug.h diff --git a/openflow/lib/libams.a b/openflow/lib/libams.a new file mode 100644 index 0000000..6481338 Binary files /dev/null and b/openflow/lib/libams.a differ diff --git a/openflow/lib/libclick.a b/openflow/lib/libclick.a new file mode 100755 index 0000000..fbf144b Binary files /dev/null and b/openflow/lib/libclick.a differ diff --git a/openflow/lib/libclicktool.a b/openflow/lib/libclicktool.a new file mode 100755 index 0000000..c86f171 Binary files /dev/null and b/openflow/lib/libclicktool.a differ diff --git a/openflow/lib/libnet.a b/openflow/lib/libnet.a new file mode 100644 index 0000000..fae704f Binary files /dev/null and b/openflow/lib/libnet.a differ diff --git a/openflow/lib/libnet.so b/openflow/lib/libnet.so new file mode 100644 index 0000000..7a7a62c Binary files /dev/null and b/openflow/lib/libnet.so differ diff --git a/openflow/lib/libnet.so.1 b/openflow/lib/libnet.so.1 new file mode 100644 index 0000000..7a7a62c Binary files /dev/null and b/openflow/lib/libnet.so.1 differ diff --git a/openflow/lib/libnet.so.1.7.0 b/openflow/lib/libnet.so.1.7.0 new file mode 100644 index 0000000..7a7a62c Binary files /dev/null and b/openflow/lib/libnet.so.1.7.0 differ diff --git a/openflow/lib/libnetfilter_conntrack.so.3 b/openflow/lib/libnetfilter_conntrack.so.3 new file mode 100644 index 0000000..82950ea Binary files /dev/null and b/openflow/lib/libnetfilter_conntrack.so.3 differ diff --git a/openflow/lib/libnetfilter_conntrack.so.3.5.0 b/openflow/lib/libnetfilter_conntrack.so.3.5.0 new file mode 100644 index 0000000..82950ea Binary files /dev/null and b/openflow/lib/libnetfilter_conntrack.so.3.5.0 differ diff --git a/openflow/lib/libnettle.so.6 b/openflow/lib/libnettle.so.6 new file mode 100644 index 0000000..bb73cdf Binary files /dev/null and b/openflow/lib/libnettle.so.6 differ diff --git a/openflow/lib/libnettle.so.6.2 b/openflow/lib/libnettle.so.6.2 new file mode 100644 index 0000000..bb73cdf Binary files /dev/null and b/openflow/lib/libnettle.so.6.2 differ diff --git a/openflow/lib/libofp.a b/openflow/lib/libofp.a new file mode 100644 index 0000000..c1800e7 Binary files /dev/null and b/openflow/lib/libofp.a differ diff --git a/openflow/lib/libofproto.a b/openflow/lib/libofproto.a new file mode 100644 index 0000000..fc6acd2 Binary files /dev/null and b/openflow/lib/libofproto.a differ diff --git a/openflow/lib/libofproto.la b/openflow/lib/libofproto.la new file mode 100755 index 0000000..ac43d93 --- /dev/null +++ b/openflow/lib/libofproto.la @@ -0,0 +1,41 @@ +# libofproto.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libofproto.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' /usr/local/lib/libsflow.la -latomic -lpthread -lrt -lm' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libofproto. +current=7 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/usr/local/lib' diff --git a/openflow/lib/libopenvswitch.a b/openflow/lib/libopenvswitch.a new file mode 100644 index 0000000..de37e01 Binary files /dev/null and b/openflow/lib/libopenvswitch.a differ diff --git a/openflow/lib/libopenvswitch.la b/openflow/lib/libopenvswitch.la new file mode 100755 index 0000000..b30f8b2 --- /dev/null +++ b/openflow/lib/libopenvswitch.la @@ -0,0 +1,41 @@ +# libopenvswitch.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libopenvswitch.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -lssl -lcrypto -latomic -lpthread -lrt -lm' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libopenvswitch. +current=7 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/usr/local/lib' diff --git a/openflow/lib/libovn.a b/openflow/lib/libovn.a new file mode 100644 index 0000000..f8f69c0 Binary files /dev/null and b/openflow/lib/libovn.a differ diff --git a/openflow/lib/libovn.la b/openflow/lib/libovn.la new file mode 100755 index 0000000..7117e4b --- /dev/null +++ b/openflow/lib/libovn.la @@ -0,0 +1,41 @@ +# libovn.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libovn.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -latomic -lpthread -lrt -lm' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libovn. +current=7 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/usr/local/lib' diff --git a/openflow/lib/libovsdb.a b/openflow/lib/libovsdb.a new file mode 100644 index 0000000..5a07084 Binary files /dev/null and b/openflow/lib/libovsdb.a differ diff --git a/openflow/lib/libovsdb.la b/openflow/lib/libovsdb.la new file mode 100755 index 0000000..bd159cb --- /dev/null +++ b/openflow/lib/libovsdb.la @@ -0,0 +1,41 @@ +# libovsdb.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libovsdb.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -latomic -lpthread -lrt -lm' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libovsdb. +current=7 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/usr/local/lib' diff --git a/openflow/lib/libpcap.a b/openflow/lib/libpcap.a new file mode 100644 index 0000000..3ab460b Binary files /dev/null and b/openflow/lib/libpcap.a differ diff --git a/openflow/lib/libpcap.so b/openflow/lib/libpcap.so new file mode 100644 index 0000000..d5ddb5b Binary files /dev/null and b/openflow/lib/libpcap.so differ diff --git a/openflow/lib/libpcap.so.0.8 b/openflow/lib/libpcap.so.0.8 new file mode 100644 index 0000000..d5ddb5b Binary files /dev/null and b/openflow/lib/libpcap.so.0.8 differ diff --git a/openflow/lib/libpcap.so.1.7.4 b/openflow/lib/libpcap.so.1.7.4 new file mode 100644 index 0000000..d5ddb5b Binary files /dev/null and b/openflow/lib/libpcap.so.1.7.4 differ diff --git a/openflow/lib/libreg.a b/openflow/lib/libreg.a new file mode 100644 index 0000000..ea03fab Binary files /dev/null and b/openflow/lib/libreg.a differ diff --git a/openflow/lib/librule.a b/openflow/lib/librule.a new file mode 100644 index 0000000..265ef1a Binary files /dev/null and b/openflow/lib/librule.a differ diff --git a/openflow/lib/libsflow.a b/openflow/lib/libsflow.a new file mode 100644 index 0000000..6220eb5 Binary files /dev/null and b/openflow/lib/libsflow.a differ diff --git a/openflow/lib/libsflow.la b/openflow/lib/libsflow.la new file mode 100755 index 0000000..e232910 --- /dev/null +++ b/openflow/lib/libsflow.la @@ -0,0 +1,41 @@ +# libsflow.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libsflow.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -latomic -lpthread -lrt -lm' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libsflow. +current=7 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/usr/local/lib' diff --git a/openflow/lib/libua.a b/openflow/lib/libua.a new file mode 100644 index 0000000..86ac978 Binary files /dev/null and b/openflow/lib/libua.a differ diff --git a/openflow/lib/libvtep.a b/openflow/lib/libvtep.a new file mode 100644 index 0000000..3f0ebae Binary files /dev/null and b/openflow/lib/libvtep.a differ diff --git a/openflow/lib/libvtep.la b/openflow/lib/libvtep.la new file mode 100755 index 0000000..b66c880 --- /dev/null +++ b/openflow/lib/libvtep.la @@ -0,0 +1,41 @@ +# libvtep.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libvtep.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -latomic -lpthread -lrt -lm' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libvtep. +current=7 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/usr/local/lib' diff --git a/openflow/lib/pkgconfig/libofproto.pc b/openflow/lib/pkgconfig/libofproto.pc new file mode 100644 index 0000000..5cc86ba --- /dev/null +++ b/openflow/lib/pkgconfig/libofproto.pc @@ -0,0 +1,11 @@ +prefix=/usr/local +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libofproto +Description: OpenFlow library of Open vSwitch +Version: 2.7.0 +Libs: -L${libdir} -lofproto +Libs.private: -latomic -lpthread -lrt -lm +Cflags: -I${includedir}/openvswitch diff --git a/openflow/lib/pkgconfig/libopenvswitch.pc b/openflow/lib/pkgconfig/libopenvswitch.pc new file mode 100644 index 0000000..cdaa3d1 --- /dev/null +++ b/openflow/lib/pkgconfig/libopenvswitch.pc @@ -0,0 +1,11 @@ +prefix=/usr/local +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libopenvswitch +Description: Open vSwitch library +Version: 2.7.0 +Libs: -L${libdir} -lopenvswitch +Libs.private: -latomic -lpthread -lrt -lm +Cflags: -I${includedir}/openvswitch diff --git a/openflow/lib/pkgconfig/libovsdb.pc b/openflow/lib/pkgconfig/libovsdb.pc new file mode 100644 index 0000000..9939887 --- /dev/null +++ b/openflow/lib/pkgconfig/libovsdb.pc @@ -0,0 +1,11 @@ +prefix=/usr/local +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libovsdb +Description: OVSDB library of Open vSwitch +Version: 2.7.0 +Libs: -L${libdir} -lovsdb +Libs.private: -latomic -lpthread -lrt -lm +Cflags: -I${includedir}/openvswitch diff --git a/openflow/lib/pkgconfig/libsflow.pc b/openflow/lib/pkgconfig/libsflow.pc new file mode 100644 index 0000000..090139a --- /dev/null +++ b/openflow/lib/pkgconfig/libsflow.pc @@ -0,0 +1,11 @@ +prefix=/usr/local +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libofproto +Description: sFlow library of Open vSwitch +Version: 2.7.0 +Libs: -L${libdir} -lsflow +Libs.private: -latomic -lpthread -lrt -lm +Cflags: -I${includedir}/openvswitch diff --git a/openflow/lib/pkgconfig/python-3.8-embed.pc b/openflow/lib/pkgconfig/python-3.8-embed.pc new file mode 100644 index 0000000..db3039c --- /dev/null +++ b/openflow/lib/pkgconfig/python-3.8-embed.pc @@ -0,0 +1,13 @@ +# See: man pkg-config +prefix=/usr/local +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: Python +Description: Embed Python into an application +Requires: +Version: 3.8 +Libs.private: -lcrypt -lpthread -ldl -lutil -lm +Libs: -L${libdir} -lpython3.8 +Cflags: -I${includedir}/python3.8 diff --git a/openflow/lib/pkgconfig/python-3.8.pc b/openflow/lib/pkgconfig/python-3.8.pc new file mode 100644 index 0000000..cbcf9d4 --- /dev/null +++ b/openflow/lib/pkgconfig/python-3.8.pc @@ -0,0 +1,13 @@ +# See: man pkg-config +prefix=/usr/local +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: Python +Description: Build a C extension for Python +Requires: +Version: 3.8 +Libs.private: -lcrypt -lpthread -ldl -lutil -lm +Libs: +Cflags: -I${includedir}/python3.8 diff --git a/openflow/lib/pkgconfig/python3-embed.pc b/openflow/lib/pkgconfig/python3-embed.pc new file mode 120000 index 0000000..f476584 --- /dev/null +++ b/openflow/lib/pkgconfig/python3-embed.pc @@ -0,0 +1 @@ +python-3.8-embed.pc \ No newline at end of file diff --git a/openflow/lib/pkgconfig/python3.pc b/openflow/lib/pkgconfig/python3.pc new file mode 120000 index 0000000..8d20751 --- /dev/null +++ b/openflow/lib/pkgconfig/python3.pc @@ -0,0 +1 @@ +python-3.8.pc \ No newline at end of file diff --git a/openflow/main_user_openflow.c b/openflow/main_user_openflow.c index 25654d5..2441613 100644 --- a/openflow/main_user_openflow.c +++ b/openflow/main_user_openflow.c @@ -1,518 +1,619 @@ -/*************************************************************************** - * main_opfmsg.c - * - * 2017/02/28 15:52:34 星期二 - * Copyright 2017 XuDongLai - * - ****************************************************************************/ -/* - * main_opfmsg.c - * - * Copyright (C) 2017 - XuDongLai - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include "fast.h" -#include -#include - -struct eth_header; -void nms_exec_action(u32 inport,u32 outport,struct eth_header *eth,int len,int hit_idx); -extern void pkt_print(u8 *pkt, uint16_t len); -static struct ofp_buffer *build_opfmsg_reply_ofpbuf(uint8_t type,uint32_t xid,uint16_t len); - -#ifndef htobe64 -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define htobe64(x) __builtin_bswap64((u64)(x)) -#define be64toh(x) __builtin_bswap64((u64)(x)) -#else -#define htobe64(x) (x) -#define be64toh(x) (x) -#endif -#endif - -static inline uint64_t host_to_be64(uint64_t value) -{ - return htobe64(value); -} - -static struct ofp_buffer *build_multipart_reply(struct ofp_buffer *request, - uint16_t mp_type, - size_t body_len, - struct ofp_multipart **mp_out) -{ - size_t reply_len = sizeof(struct ofp_header) + sizeof(struct ofp_multipart) + body_len; - struct ofp_buffer *reply = build_opfmsg_reply_ofpbuf( - OFPT_MULTIPART_REPLY, request->header.xid, reply_len); - if (!reply) { - return NULL; - } - struct ofp_multipart *mp = (struct ofp_multipart *)reply->data; - - memset(mp, 0, sizeof(*mp)); - mp->type = htons(mp_type); - if (mp_out) { - *mp_out = mp; - } - return reply; -} - -static enum opfmsg_hook_ret handle_opfmsg_get_config_request(struct ofp_buffer *ofpbuf); -static enum opfmsg_hook_ret handle_opfmsg_multipart_request(struct ofp_buffer *ofpbuf); -static enum opfmsg_hook_ret handle_opfmsg_packet_out(struct ofp_buffer *ofpbuf); -static enum opfmsg_hook_ret handle_opfmsg_flow_mod(struct ofp_buffer *ofpbuf); -static enum opfmsg_hook_ret handle_opfmsg_role_request(struct ofp_buffer *ofpbuf); - - -/** -* @brief -* -* 构建openflow报文头 -* -*/ - -void build_opfmsg_header(struct ofp_header *ofpbuf_header,uint16_t len,uint8_t type,uint32_t xid) -{ - - ofpbuf_header->version = OFP13_VERSION; - ofpbuf_header->length = htons(len); - ofpbuf_header->type = type; - ofpbuf_header->xid = xid; - - printf("ofpbuf_header->length=%d\n",ntohs(ofpbuf_header->length)); -} - -/** -* @brief -* -* 构建回应报文 -* -* @return -*/ -static struct ofp_buffer *build_opfmsg_reply_ofpbuf(uint8_t type,uint32_t xid,uint16_t len) -{ - - struct ofp_buffer *reply = (struct ofp_buffer *)malloc(len); - if (!reply) { - return NULL; - } - - memset(reply,0,len); - build_opfmsg_header(&reply->header,len,type,xid); - - printf("ofpbuf_reply,malloc:%p,type:%d,len:%d\n",reply,type,len); - - return reply; -} - - -static enum opfmsg_hook_ret -handle_opfmsg_hello(struct ofp_buffer *ofpbuf) -{ - - printf("header.version:%d\n",ofpbuf->header.version); - if(ofpbuf->header.version == 0x04) - { - printf("RECV HELLO!\n\n\n"); - }else //不是openflow1.3协议,则发送error消息 - { - int reply_len = sizeof(struct ofp_header); - //填充openflow协议头,协议类型为OFPT_ERROR - struct ofp_buffer *ofpbuf_reply = - build_opfmsg_reply_ofpbuf(OFPT_ERROR,ofpbuf->header.xid,reply_len); - if (!ofpbuf_reply) { - return CONTINUE; - } - //打印error消息 - pkt_print((u8 *)ofpbuf,htons(ofpbuf->header.length)); - //发送error消息 - send_openflow_message(ofpbuf_reply,reply_len); - } - - //返回已处理状态码 - return HANDLE; -} - - - -static enum opfmsg_hook_ret -handle_opfmsg_features_request(struct ofp_buffer *ofpbuf) -{ - int feature_reply_len = sizeof(struct ofp_switch_features)+sizeof(struct ofp_header); - //填充openflow协议头,协议类型为 OFPT_FEATURES_REPLY - struct ofp_buffer *ofpbuf_reply = build_opfmsg_reply_ofpbuf(OFPT_FEATURES_REPLY, - ofpbuf->header.xid,feature_reply_len); - if (!ofpbuf_reply) { - return CONTINUE; - } - //获取交换机的功能信息 指针变量 feature_reply_msg - struct ofp_switch_features *feature_reply_msg =(struct ofp_switch_features *)ofpbuf_reply->data; - - - //TODO - /* 构建feature回应报文,把交换机的功能信息发送给控制器(指针变量feature_reply_msg赋值) */ - memset(feature_reply_msg,0,sizeof(*feature_reply_msg)); - feature_reply_msg->datapath_id = host_to_be64(0x0100000000000001ULL); - feature_reply_msg->n_buffers = htonl(256); - feature_reply_msg->n_tables = 4; - feature_reply_msg->capabilities = htonl(0); - - //调用系统发送接口,发送回应报文 - send_openflow_message(ofpbuf_reply,feature_reply_len); - - //返回已处理状态码 - return HANDLE; -} - -static enum opfmsg_hook_ret handle_opfmsg_get_config_request(struct ofp_buffer *ofpbuf) -{ - size_t reply_len = sizeof(struct ofp_header) + sizeof(struct ofp_switch_config); - struct ofp_buffer *reply = build_opfmsg_reply_ofpbuf( - OFPT_GET_CONFIG_REPLY, ofpbuf->header.xid, reply_len); - if (!reply) { - return CONTINUE; - } - struct ofp_switch_config *cfg = (struct ofp_switch_config *)reply->data; - - memset(cfg, 0, sizeof(*cfg)); - cfg->flags = htons(0); - cfg->miss_send_len = htons(0xffff); - - send_openflow_message(reply, reply_len); - return HANDLE; -} - -static void handle_multipart_desc(struct ofp_buffer *ofpbuf) -{ - struct ofp_multipart *mp_reply = NULL; - struct ofp_buffer *reply = build_multipart_reply(ofpbuf, OFPMP_DESC, - sizeof(struct ofp_desc_stats), &mp_reply); - if (!reply || !mp_reply) { - return; - } - struct ofp_desc_stats *desc = mp_reply->ofpmp_desc; - - memset(desc, 0, sizeof(*desc)); - snprintf(desc->mfr_desc, sizeof(desc->mfr_desc), "FAST Reference Switch"); - snprintf(desc->hw_desc, sizeof(desc->hw_desc), "FAST Virtual datapath"); - snprintf(desc->sw_desc, sizeof(desc->sw_desc), "OF1.3 Example Stack"); - snprintf(desc->serial_num, sizeof(desc->serial_num), "FAST-0001"); - snprintf(desc->dp_desc, sizeof(desc->dp_desc), "FAST educational datapath"); - - size_t reply_len = sizeof(struct ofp_header) + sizeof(struct ofp_multipart) + sizeof(struct ofp_desc_stats); - send_openflow_message(reply, reply_len); -} - -static void handle_multipart_flow(struct ofp_buffer *ofpbuf) -{ - struct ofp_multipart *mp_reply = NULL; - struct ofp_buffer *reply = build_multipart_reply(ofpbuf, OFPMP_FLOW, 0, &mp_reply); - if (!reply) { - return; - } - size_t reply_len = sizeof(struct ofp_header) + sizeof(struct ofp_multipart); - send_openflow_message(reply, reply_len); -} - -static void handle_multipart_aggregate(struct ofp_buffer *ofpbuf) -{ - struct ofp_multipart *mp_reply = NULL; - struct ofp_buffer *reply = build_multipart_reply(ofpbuf, OFPMP_AGGREGATE, - sizeof(struct ofp_aggregate_stats_reply), &mp_reply); - if (!reply || !mp_reply) { - return; - } - struct ofp_aggregate_stats_reply *body = mp_reply->ofpmp_aggregate_reply; - - memset(body, 0, sizeof(*body)); - body->packet_count = host_to_be64(0); - body->byte_count = host_to_be64(0); - body->flow_count = htonl(0); - - size_t reply_len = sizeof(struct ofp_header) + sizeof(struct ofp_multipart) + - sizeof(struct ofp_aggregate_stats_reply); - send_openflow_message(reply, reply_len); -} - -static void handle_multipart_table(struct ofp_buffer *ofpbuf) -{ - struct ofp_multipart *mp_reply = NULL; - struct ofp_buffer *reply = build_multipart_reply(ofpbuf, OFPMP_TABLE, - sizeof(struct ofp_table_stats), &mp_reply); - if (!reply || !mp_reply) { - return; - } - struct ofp_table_stats *table = mp_reply->table_stats; - - memset(table, 0, sizeof(*table)); - table->table_id = 0; - table->active_count = htonl(0); - table->lookup_count = host_to_be64(0); - table->matched_count = host_to_be64(0); - - size_t reply_len = sizeof(struct ofp_header) + sizeof(struct ofp_multipart) + sizeof(struct ofp_table_stats); - send_openflow_message(reply, reply_len); -} - -static void handle_multipart_port_stats(struct ofp_buffer *ofpbuf) -{ - struct ofp_multipart *mp_reply = NULL; - struct ofp_buffer *reply = build_multipart_reply(ofpbuf, OFPMP_PORT_STATS, - sizeof(struct ofp_port_stats), &mp_reply); - if (!reply || !mp_reply) { - return; - } - struct ofp_port_stats *stats = mp_reply->ofpmp_port_stats; - - memset(stats, 0, sizeof(*stats)); - stats->port_no = htonl(1); - stats->rx_packets = host_to_be64(0); - stats->tx_packets = host_to_be64(0); - stats->rx_bytes = host_to_be64(0); - stats->tx_bytes = host_to_be64(0); - stats->rx_dropped = host_to_be64(0); - stats->tx_dropped = host_to_be64(0); - stats->rx_errors = host_to_be64(0); - stats->tx_errors = host_to_be64(0); - stats->rx_frame_err = host_to_be64(0); - stats->rx_over_err = host_to_be64(0); - stats->rx_crc_err = host_to_be64(0); - stats->collisions = host_to_be64(0); - stats->duration_sec = htonl(0); - stats->duration_nsec = htonl(0); - - size_t reply_len = sizeof(struct ofp_header) + sizeof(struct ofp_multipart) + sizeof(struct ofp_port_stats); - send_openflow_message(reply, reply_len); -} - -static void handle_multipart_group_features(struct ofp_buffer *ofpbuf) -{ - struct ofp_multipart *mp_reply = NULL; - struct ofp_buffer *reply = build_multipart_reply(ofpbuf, OFPMP_GROUP_FEATURES, - sizeof(struct ofp_group_features), &mp_reply); - if (!reply || !mp_reply) { - return; - } - struct ofp_group_features *features = (struct ofp_group_features *)mp_reply->body; - - memset(features, 0, sizeof(*features)); - features->types = htonl(0); - features->capabilities = htonl(0); - - size_t reply_len = sizeof(struct ofp_header) + sizeof(struct ofp_multipart) + - sizeof(struct ofp_group_features); - send_openflow_message(reply, reply_len); -} - -static void fill_port(struct ofp_port *port, uint32_t port_no, const char *name) -{ - memset(port, 0, sizeof(*port)); - port->port_no = htonl(port_no); - snprintf(port->name, sizeof(port->name), "%s", name); - port->curr_speed = htonl(1000000); - port->max_speed = htonl(1000000); -} - -static void handle_multipart_port_desc(struct ofp_buffer *ofpbuf) -{ - size_t ports_count = 2; - size_t body_len = ports_count * sizeof(struct ofp_port); - struct ofp_multipart *mp_reply = NULL; - struct ofp_buffer *reply = build_multipart_reply(ofpbuf, OFPMP_PORT_DESC, body_len, &mp_reply); - if (!reply || !mp_reply) { - return; - } - struct ofp_port *ports = mp_reply->ofpmp_port_desc; - - fill_port(&ports[0], 1, "fast-eth1"); - fill_port(&ports[1], 2, "fast-eth2"); - - size_t reply_len = sizeof(struct ofp_header) + sizeof(struct ofp_multipart) + body_len; - send_openflow_message(reply, reply_len); -} - -static enum opfmsg_hook_ret handle_opfmsg_multipart_request(struct ofp_buffer *ofpbuf) -{ - if (ntohs(ofpbuf->header.length) < sizeof(struct ofp_header) + sizeof(struct ofp_multipart)) { - printf("multipart request too short\n"); - return HANDLE; - } - - struct ofp_multipart *mp = (struct ofp_multipart *)ofpbuf->data; - uint16_t type = ntohs(mp->type); - - printf("multipart request type=%u\n", type); - switch (type) { - case OFPMP_DESC: - handle_multipart_desc(ofpbuf); - break; - case OFPMP_FLOW: - handle_multipart_flow(ofpbuf); - break; - case OFPMP_AGGREGATE: - handle_multipart_aggregate(ofpbuf); - break; - case OFPMP_TABLE: - handle_multipart_table(ofpbuf); - break; - case OFPMP_PORT_STATS: - handle_multipart_port_stats(ofpbuf); - break; - case OFPMP_GROUP_FEATURES: - handle_multipart_group_features(ofpbuf); - break; - case OFPMP_PORT_DESC: - handle_multipart_port_desc(ofpbuf); - break; - default: - printf("unsupported multipart type %u\n", type); - break; - } - - return HANDLE; -} - -static enum opfmsg_hook_ret handle_opfmsg_packet_out(struct ofp_buffer *ofpbuf) -{ - struct ofp_packet_out *pkt_out = (struct ofp_packet_out *)&ofpbuf->header; - uint16_t actions_len = ntohs(pkt_out->actions_len); - uint16_t total_len = ntohs(ofpbuf->header.length); - - if (total_len < sizeof(struct ofp_packet_out)) { - printf("packet_out length %u shorter than header\n", total_len); - return HANDLE; - } - if (actions_len > total_len - sizeof(struct ofp_packet_out)) { - printf("packet_out invalid actions_len=%u total_len=%u\n", actions_len, total_len); - return HANDLE; - } - - uint32_t in_port = ntohl(pkt_out->in_port); - uint8_t *payload = (uint8_t *)pkt_out->actions + actions_len; - int payload_len = total_len - (payload - (uint8_t *)&ofpbuf->header); - - if (payload_len <= 0) { - printf("packet_out without payload\n"); - return HANDLE; - } - - uint32_t out_port = 0; - if (actions_len >= sizeof(struct ofp_action_output)) { - struct ofp_action_output *action = (struct ofp_action_output *)pkt_out->actions; - out_port = ntohl(action->port); - } - - printf("packet_out in_port=%u out_port=%u len=%d\n", in_port, out_port, payload_len); - nms_exec_action(in_port, out_port, (struct eth_header *)payload, payload_len, -1); - return HANDLE; -} - -static enum opfmsg_hook_ret handle_opfmsg_flow_mod(struct ofp_buffer *ofpbuf) -{ - uint16_t total_len = ntohs(ofpbuf->header.length); - if (total_len < sizeof(struct ofp_header) + sizeof(struct fast_rule)) { - printf("flow_mod payload too small: %u\n", total_len); - return HANDLE; - } - - struct fast_rule *rule = (struct fast_rule *)ofpbuf->data; - print_user_rule(rule); - int idx = fast_add_rule(rule); - printf("fast_add_rule result index=%d\n", idx); - return HANDLE; -} - -static enum opfmsg_hook_ret handle_opfmsg_role_request(struct ofp_buffer *ofpbuf) -{ - size_t reply_len = sizeof(struct ofp_header) + sizeof(struct ofp_role); - struct ofp_buffer *reply = build_opfmsg_reply_ofpbuf( - OFPT_ROLE_REPLY, ofpbuf->header.xid, reply_len); - if (!reply) { - return CONTINUE; - } - struct ofp_role *req = (struct ofp_role *)ofpbuf->data; - struct ofp_role *rsp = (struct ofp_role *)reply->data; - - memcpy(rsp, req, sizeof(*rsp)); - send_openflow_message(reply, reply_len); - return HANDLE; -} - - -/** -* -* callback 的返回值必须有且只能存在两种返回值: -* -* 已处理: HANDLE = 0x1, -* 不处理:CONTINUE = 0x2 -* -*/ - -static int handle_openflow_callback(struct ofp_buffer *ofpbuf,int len) -{ - int oftype = ofpbuf->header.type; - printf("header.version:%d,type:%d,len:%d\n",ofpbuf->header.version,ofpbuf->header.type,htons(ofpbuf->header.length)); - - switch(oftype) - { - case OFPT_HELLO: - return handle_opfmsg_hello(ofpbuf); - - case OFPT_FEATURES_REQUEST: - return handle_opfmsg_features_request(ofpbuf); - case OFPT_GET_CONFIG_REQUEST: - return handle_opfmsg_get_config_request(ofpbuf); - case OFPT_MULTIPART_REQUEST: - return handle_opfmsg_multipart_request(ofpbuf); - case OFPT_PACKET_OUT: - return handle_opfmsg_packet_out(ofpbuf); - case OFPT_FLOW_MOD: - return handle_opfmsg_flow_mod(ofpbuf); - case OFPT_ROLE_REQUEST: - return handle_opfmsg_role_request(ofpbuf); - - default: - printf(" --do not handle the message!\n"); - } - //返回不处理状态码 - return CONTINUE; -} - -/** mask 为获取openflow消息的bimap掩码,openflow消息枚举见 "enum ofp_type" -* -* 如:获取 OFPT_HELLO(0) 和 OFPT_FEATURES_REQUEST(5)消息, -* mask值设为 mask = 0b'100001 = 0x21 -* -*/ -int main(int argc,char* argv[]) -{ - int mask = 0; - - ofp_init(argc,argv); - - //获取 OFPT_HELLO(0) 和 OFPT_FEATURES_REQUEST (5)消息 - mask = (1U << OFPT_HELLO) | - (1U << OFPT_FEATURES_REQUEST) | - (1U << OFPT_GET_CONFIG_REQUEST) | - (1U << OFPT_MULTIPART_REQUEST) | - (1U << OFPT_PACKET_OUT) | - (1U << OFPT_FLOW_MOD) | - (1U << OFPT_ROLE_REQUEST); - - openflow_hook_init(mask,handle_openflow_callback); - - pause(); - - return 0; -} +/*************************************************************************** + * main_opfmsg.c + * + * 2017/02/28 15:52:34 星期二 + * Copyright 2017 XuDongLai + * + ****************************************************************************/ +/* + * main_opfmsg.c + * + * Copyright (C) 2017 - XuDongLai + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include +#include +#include + +void nms_exec_action(u32 inport,u32 outport,struct eth_header *eth,int len,int hit_idx); +void pkt_print(u8 *data, u16 len); +#include + + + +extern uintptr_t *flow_stats_addr; +extern struct timeval flow_stats_time[]; +extern struct nms_ports_info nmps; +extern struct timeval start_tv; + +/** +* @brief +* +* @param n +* +* @return +*/ +/*64位主机序转网络序*/ +static inline uint64_t +htonll(uint64_t n) +{ + return htonl(1) == 1 ? n : (((uint64_t)htonl(n)) << 32) | htonl(n >> 32); +} + +/*64位网络序转主机序*/ +/** +* @brief +* +* @param n +* +* @return +*/ +static inline uint64_t +ntohll(uint64_t n) +{ + return htonl(1) == 1 ? n : (((uint64_t)ntohl(n)) << 32) | ntohl(n >> 32); +} + +/** +* @brief 构建OpenFlow报文头 +* +* 该函数用于填充OpenFlow报文头,包括版本、长度、类型和事务ID。 +* +* @param ofpbuf_header OpenFlow报文头结构体指针 +* @param len 报文长度 +* @param type 报文类型 +* @param xid 事务ID +*/ +void build_opfmsg_header(struct ofp_header *ofpbuf_header,uint16_t len,uint8_t type,uint32_t xid) +{ + + ofpbuf_header->version = OFP13_VERSION; + ofpbuf_header->length = htons(len); + ofpbuf_header->type = type; + ofpbuf_header->xid = xid; + + printf("ofpbuf_header->length=%d\n",ntohs(ofpbuf_header->length)); +} + +/** +* @brief 构建OpenFlow回应报文 +* +* 该函数用于构建并返回一个OpenFlow回应报文,报文类型和长度由参数指定。 +* +* @param type 报文类型 +* @param xid 事务ID +* @param len 报文长度 +* +* @return 返回构建的报文缓冲区指针 +*/ +u8 *build_opfmsg_reply_ofpbuf(uint8_t type,uint32_t xid,uint16_t len) +{ + + struct ofp_header *reply = (struct ofp_header *)malloc(len); + + memset((u8 *)reply,0,len); + build_opfmsg_header(reply,len,type,xid); + + printf("ofpbuf_reply,malloc:%p,type:%d,len:%d\n",reply,type,len); + + return (u8 *)reply; +} + +/** +* @brief 处理OpenFlow Hello消息 +* +* 该函数用于处理接收到的OpenFlow Hello消息。如果协议版本不是1.3,则发送错误消息。 +* +* @param ofpbuf 接收到的OpenFlow消息缓冲区 +* +* @return 返回处理状态码 +*/ +static enum ofperr +handle_opfmsg_hello(struct ofp_buffer *ofpbuf) +{ + + printf("header.version:%d\n",ofpbuf->header.version); + if(ofpbuf->header.version == 0x04) + { + printf("RECV HELLO!\n\n\n"); + }else //不是openflow1.3协议,则发送error消息 + { + int reply_len = sizeof(struct ofp_header); + //填充openflow协议头,协议类型为OFPT_ERROR + struct ofp_buffer *ofpbuf_reply = + (struct ofp_buffer *)build_opfmsg_reply_ofpbuf(OFPT_ERROR,ofpbuf->header.xid,reply_len); + //打印error消息 + pkt_print((u8 *)ofpbuf,htons(ofpbuf->header.length)); + //发送error消息 + send_openflow_message(ofpbuf_reply,reply_len); + } + + //返回已处理状态码 + return HANDLE; +} + +/** +* @brief 处理OpenFlow Features Request消息 +* +* 该函数用于处理接收到的OpenFlow Features Request消息,并返回交换机的功能信息。 +* +* @param ofpbuf 接收到的OpenFlow消息缓冲区 +* +* @return 返回处理状态码 +*/ +static enum ofperr +handle_opfmsg_features_request(struct ofp_buffer *ofpbuf) +{ + int feature_reply_len = sizeof(struct ofp_switch_features)+sizeof(struct ofp_header); + //填充openflow协议头,协议类型为 OFPT_FEATURES_REPLY + struct ofp_buffer *ofpbuf_reply = (struct ofp_buffer *)build_opfmsg_reply_ofpbuf(OFPT_FEATURES_REPLY, + ofpbuf->header.xid,feature_reply_len); + //获取交换机的功能信息 指针变量 feature_reply_msg + struct ofp_switch_features *feature_reply_msg =(struct ofp_switch_features *)ofpbuf_reply->data; + + + //TODO + /* 构建feature回应报文,把交换机的功能信息发送给控制器(指针变量feature_reply_msg赋值) */ + feature_reply_msg->datapath_id = htonll(0x1234ULL << 48); + feature_reply_msg->n_buffers = 0x100; // 256 + feature_reply_msg->n_tables = 1; + feature_reply_msg->auxiliary_id = 0; + feature_reply_msg->capabilities = htonl(0x0007); + feature_reply_msg->reserved = htonl(0x0000); + //调用系统发送接口,发送回应报文 + send_openflow_message(ofpbuf_reply,feature_reply_len); + + //返回已处理状态码 + return HANDLE; +} + +/** +* @brief 处理OpenFlow Get Config Request消息 +* +* 该函数用于处理接收到的OpenFlow Get Config Request消息,并返回交换机的配置信息。 +* +* @param ofpbuf 接收到的OpenFlow消息缓冲区 +* +* @return 返回处理状态码 +*/ +static enum ofperr +handle_ofpmsg_get_config_request(struct ofp_buffer *ofpbuf) +{ + int reply_len = sizeof(struct ofp_switch_config)+sizeof(struct ofp_header); + //填充openflow协议头,协议类型为 OFPT_GET_CONFIG_REPLY + struct ofp_buffer *ofpbuf_reply = (struct ofp_buffer *)build_opfmsg_reply_ofpbuf(OFPT_GET_CONFIG_REPLY, + ofpbuf->header.xid,reply_len); + struct ofp_switch_config *switch_config_reply =(struct ofp_switch_config *)ofpbuf_reply->data; + + switch_config_reply->flags = htons(0x0000); + switch_config_reply->miss_send_len = htons(0xffe5); //65509,基于协议 + send_openflow_message(ofpbuf_reply,reply_len); + + return HANDLE; +} + +/** +* @brief 处理OpenFlow Description Request消息 +* +* 该函数用于处理接收到的OpenFlow Description Request消息,并返回交换机的描述信息。 +* +* @param ofpbuf 接收到的OpenFlow消息缓冲区 +* +* @return 返回处理状态码 +*/ +static enum ofperr +handle_ofpmsg_desc(struct ofp_buffer *ofpbuf) +{ + int reply_len = sizeof(struct ofp_header)+sizeof(struct ofp_multipart)+sizeof(struct ofp_desc_stats); + struct ofp_buffer *ofpbuf_reply = + (struct ofp_buffer *)build_opfmsg_reply_ofpbuf(OFPT_MULTIPART_REPLY,ofpbuf->header.xid,reply_len); + struct ofp_multipart *ofpmp_reply = (struct ofp_multipart *)ofpbuf_reply->data; + + static const char *default_mfr_desc = "Wanglixuan"; + static const char *default_hw_desc = "Lixuan_OpenBox"; + static const char *default_sw_desc = "Lixuan_Driver"; + static const char *default_serial_desc = "Lixuan OpenBox Series"; + static const char *default_dp_desc = "None"; + + ofpmp_reply->type = htons(OFPMP_DESC); + ofpmp_reply->flags = htonl(OFPMP_REPLY_MORE_NO); + snprintf(ofpmp_reply->ofpmp_desc[0].mfr_desc, sizeof ofpmp_reply->ofpmp_desc[0].mfr_desc, "%s", default_mfr_desc); + snprintf(ofpmp_reply->ofpmp_desc[0].hw_desc, sizeof ofpmp_reply->ofpmp_desc[0].hw_desc, "%s", default_hw_desc); + snprintf(ofpmp_reply->ofpmp_desc[0].sw_desc, sizeof ofpmp_reply->ofpmp_desc[0].sw_desc, "%s", default_sw_desc); + snprintf(ofpmp_reply->ofpmp_desc[0].serial_num, sizeof ofpmp_reply->ofpmp_desc[0].serial_num, "%s", default_serial_desc); + snprintf(ofpmp_reply->ofpmp_desc[0].dp_desc, sizeof ofpmp_reply->ofpmp_desc[0].dp_desc, "%s", default_dp_desc); + send_openflow_message(ofpbuf_reply,reply_len); + + return HANDLE; +} + +/** +* @brief 处理OpenFlow Flow Stats Request消息 +* +* 该函数用于处理接收到的OpenFlow Flow Stats Request消息,并返回流统计信息。 +* +* @param ofpbuf 接收到的OpenFlow消息缓冲区 +* +* @return 返回处理状态码 +*/ +static enum ofperr +handle_ofpmsg_flow_stats(struct ofp_buffer *ofpbuf) +{ + int i = 0, reply_len = 0, flow_stats_offset; + struct ofp_flow_stats *current_flow_stats = NULL; + struct ofp_buffer *reply_buffer = NULL; + struct ofp_multipart *multipart_reply = NULL; + + // 计算长度 + for (; i < FAST_RULE_CNT; i++) { + if (flow_stats_addr[i] != 0) { + reply_len += ntohs(((struct ofp_flow_stats *)flow_stats_addr[i])->length); + } + } + reply_len += sizeof(struct ofp_header) + sizeof(struct ofp_multipart); + + // 构造响应包 + reply_buffer = (struct ofp_buffer *)build_opfmsg_reply_ofpbuf(OFPT_MULTIPART_REPLY, ofpbuf->header.xid, reply_len); + multipart_reply = (struct ofp_multipart *)reply_buffer->data; + multipart_reply->type = htons(OFPMP_FLOW); // 标识信息 + multipart_reply->flags = htonl(OFPMP_REPLY_MORE_NO); //这条不用回 + + // 填充包体 + flow_stats_offset = sizeof(struct ofp_multipart); + current_flow_stats = (struct ofp_flow_stats *)&reply_buffer->data[flow_stats_offset]; + + for (i = 0; i < FAST_RULE_CNT; i++) { + if (flow_stats_addr[i] != 0) { + memcpy(current_flow_stats, (void *)(uintptr_t)flow_stats_addr[i], ntohs(((struct ofp_flow_stats *)flow_stats_addr[i])->length)); + flow_stats_offset += ntohs(current_flow_stats->length); + current_flow_stats = (struct ofp_flow_stats *)&reply_buffer->data[flow_stats_offset]; + } + } + + send_openflow_message(reply_buffer, reply_len); + + return HANDLE; +} + +/** +* @brief 处理OpenFlow Aggregate Stats Request消息 +* +* 该函数用于处理接收到的OpenFlow Aggregate Stats Request消息,并返回聚合统计信息。 +* +* @param ofpbuf 接收到的OpenFlow消息缓冲区 +* +* @return 返回处理状态码 +*/ +static enum ofperr +handle_ofpmsg_aggregate(struct ofp_buffer *ofpbuf) +{ + int reply_len = sizeof(struct ofp_header)+ sizeof(struct ofp_multipart)+sizeof(struct ofp_aggregate_stats_reply); + struct ofp_buffer *ofpbuf_reply = (struct ofp_buffer *)build_opfmsg_reply_ofpbuf(OFPT_MULTIPART_REPLY, + ofpbuf->header.xid,reply_len); + struct ofp_multipart *ofpmp_reply = (struct ofp_multipart *)ofpbuf_reply->data; + int i = 0,flow_count = 0; + u64 byte_count = 0,packet_count = 0; + struct timeval tv; + + ofpmp_reply->type = htons(OFPMP_AGGREGATE); + ofpmp_reply->flags = htonl(OFPMP_REPLY_MORE_NO); + gettimeofday(&tv, NULL); + + for (; i < FAST_RULE_CNT; i++) { + if (flow_stats_addr[i] != 0) { + ((struct ofp_flow_stats *)flow_stats_addr[i])->duration_sec = htonl(tv.tv_sec - flow_stats_time[i].tv_sec); + ((struct ofp_flow_stats *)flow_stats_addr[i])->duration_nsec = htonl(tv.tv_usec - flow_stats_time[i].tv_usec); + ((struct ofp_flow_stats *)flow_stats_addr[i])->packet_count = ((uint64_t)0x100); // 涉及硬件地址,拼尽全力无法找到,姑且填充256 + ((struct ofp_flow_stats *)flow_stats_addr[i])->byte_count = ((uint64_t)0x40000); // 涉及硬件地址,拼尽全力无法找到,姑且填充262144=256*1024 + + packet_count += ((struct ofp_flow_stats *)flow_stats_addr[i])->packet_count; + byte_count += ((struct ofp_flow_stats *)flow_stats_addr[i])->byte_count; + flow_count++; + } + } + ofpmp_reply->ofpmp_aggregate_reply[0].packet_count = packet_count; + ofpmp_reply->ofpmp_aggregate_reply[0].byte_count = byte_count; + ofpmp_reply->ofpmp_aggregate_reply[0].flow_count = flow_count; + + send_openflow_message(ofpbuf_reply,reply_len); + + return HANDLE; +} + + +/** +* @brief 处理OpenFlow Table Stats Request消息 +* +* 该函数用于处理接收到的OpenFlow Table Stats Request消息,并返回表统计信息。 +* +* @param ofpbuf 接收到的OpenFlow消息缓冲区 +* +* @return 返回处理状态码 +*/ +static enum ofperr +handle_ofpmsg_table(struct ofp_buffer *ofpbuf) +{ + int i = 0; + int reply_len = sizeof(struct ofp_header)+sizeof(struct ofp_multipart)+ + sizeof(struct ofp_table_stats)*1; + struct ofp_buffer *ofpbuf_reply = (struct ofp_buffer *)build_opfmsg_reply_ofpbuf(OFPT_MULTIPART_REPLY, + ofpbuf->header.xid,reply_len); struct ofp_multipart *ofpmp_reply = (struct ofp_multipart *)ofpbuf_reply->data; + + ofpmp_reply->type = htons(OFPMP_TABLE); + ofpmp_reply->flags = htonl(OFPMP_REPLY_MORE_NO); + for(i=0;i<1;i++) // 关于为什么写成1,见line 114 + { + ofpmp_reply->table_stats[i].matched_count = htonll(0); + ofpmp_reply->table_stats[i].table_id = i; + ofpmp_reply->table_stats[i].lookup_count = htonll(0); + ofpmp_reply->table_stats[i].active_count = htonl(1); + } + send_openflow_message(ofpbuf_reply,reply_len); + + return HANDLE; +} + +/** +* @brief 处理OpenFlow Port Stats Request消息 +* +* 该函数用于处理接收到的OpenFlow Port Stats Request消息,并返回端口统计信息。 +* +* @param ofpbuf 接收到的OpenFlow消息缓冲区 +* +* @return 返回处理状态码 +*/ +static enum ofperr +handle_ofpmsg_port_stats(struct ofp_buffer *ofpbuf) +{ + int i = 0; + int reply_len = sizeof(struct ofp_header)+sizeof(struct ofp_multipart)+ + sizeof(struct ofp_port_stats)*nmps.cnt; + struct ofp_buffer *ofpbuf_reply = (struct ofp_buffer *)build_opfmsg_reply_ofpbuf(OFPT_MULTIPART_REPLY, + ofpbuf->header.xid,reply_len); + struct ofp_multipart *ofpmp_reply = (struct ofp_multipart *)ofpbuf_reply->data; + struct timeval tv; + + ofpmp_reply->type = htons(OFPMP_PORT_STATS); + ofpmp_reply->flags = htonl(OFPMP_REPLY_MORE_NO); + + for(i=0;iofpmp_port_stats[i] = nmps.ports[i].stats; + ofpmp_reply->ofpmp_port_stats[i].duration_sec = htonl(start_tv.tv_sec - tv.tv_sec); + ofpmp_reply->ofpmp_port_stats[i].duration_nsec = htonl(tv.tv_usec); + } + send_openflow_message(ofpbuf_reply,reply_len); + + return HANDLE; +} + +/** +* @brief 处理OpenFlow Group Features Request消息 +* +* 该函数用于处理接收到的OpenFlow Group Features Request消息,并返回组功能信息。 +* +* @param ofpbuf 接收到的OpenFlow消息缓冲区 +* +* @return 返回处理状态码 +*/ +static enum ofperr +handle_ofpmsg_group_features(struct ofp_buffer *ofpbuf) +{ + + int i = 0; + int reply_len = sizeof(struct ofp_header)+sizeof(struct ofp_group_features)+8; + struct ofp_buffer *ofpbuf_reply = (struct ofp_buffer *)build_opfmsg_reply_ofpbuf(OFPT_MULTIPART_REPLY, + ofpbuf->header.xid,reply_len); + struct ofp_group_features *group = (struct ofp_group_features *)ofpbuf_reply->data; + + group->types = htons(OFPMP_GROUP_FEATURES); + + send_openflow_message(ofpbuf_reply,reply_len); + + return HANDLE; +} + + +/** +* @brief 处理OpenFlow Port Description Request消息 +* +* 该函数用于处理接收到的OpenFlow Port Description Request消息,并返回端口描述信息。 +* +* @param ofpbuf 接收到的OpenFlow消息缓冲区 +* +* @return 返回处理状态码 +*/ +static enum ofperr +handle_ofpmsg_port_desc(struct ofp_buffer *ofpbuf) +{ + int i = 0; + int reply_len = sizeof(struct ofp_header)+sizeof(struct ofp_multipart)+ + sizeof(struct ofp_port)*nmps.cnt; + struct ofp_buffer *ofpbuf_reply = (struct ofp_buffer *)build_opfmsg_reply_ofpbuf(OFPT_MULTIPART_REPLY, + ofpbuf->header.xid,reply_len); + struct ofp_multipart *ofpmp_reply = (struct ofp_multipart *)ofpbuf_reply->data; + + ofpmp_reply->type = htons(OFPMP_PORT_DESC); + ofpmp_reply->flags = htonl(OFPMP_REPLY_MORE_NO); + for(i=0;iofpmp_port_desc[i] = nmps.ports[i].state; + } + send_openflow_message(ofpbuf_reply,reply_len); + + return HANDLE; +} + +/** +* @brief 处理OpenFlow Packet Out消息 +* +* 该函数用于处理接收到的OpenFlow Packet Out消息,并根据消息中的动作执行相应的操作。 +* +* @param ofpbuf 接收到的OpenFlow消息缓冲区 +* +* @return 返回处理状态码 +*/ +static enum ofperr +handle_ofpmsg_packet_out(struct ofp_buffer *ofpbuf) +{ + struct ofp_packet_out *out = (struct ofp_packet_out *)ofpbuf; + struct ofp_action_output *action = (struct ofp_action_output *)&out->actions[0]; + int action_len = ntohs(out->actions_len); + struct eth_header *eth = (struct eth_header *)&ofpbuf->data[sizeof(struct ofp_packet_out) - sizeof(struct ofp_header) + action_len]; + int i = 0,send_len = ntohs(ofpbuf->header.length) - sizeof(struct ofp_packet_out) - action_len; + + + if(action_len == 0) + { + nms_exec_action(ntohl(out->in_port),OFPP_FLOOD,eth,send_len,-1); + } + else + { + + while(action_len > 0) + { + if(action->type == OFPAT_OUTPUT) + { + nms_exec_action(ntohl(out->in_port),ntohl(action->port),eth,send_len,-1); + } + action_len -= sizeof(struct ofp_action_output); + action++; + } + } + + return HANDLE; +} + +/** +* @brief 处理OpenFlow Role Request消息 +* +* 该函数用于处理接收到的OpenFlow Role Request消息,并返回角色信息。 +* +* @param ofpbuf 接收到的OpenFlow消息缓冲区 +* +* @return 返回处理状态码 +*/ +static enum ofperr +handle__opfmsg_role_request(struct ofp_buffer *ofpbuf) +{ + int reply_len = sizeof(struct ofp_header)+sizeof(struct ofp_role); + struct ofp_buffer *ofpbuf_reply = + (struct ofp_buffer *)build_opfmsg_reply_ofpbuf(OFPT_ROLE_REPLY,ofpbuf->header.xid,reply_len); + + SHOW_FUN(0); + memcpy(ofpbuf_reply->data,ofpbuf->data,sizeof(struct ofp_role)); + ofpbuf_reply->header.type = OFPT_ROLE_REPLY; + send_openflow_message(ofpbuf_reply,reply_len); + SHOW_FUN(1); + + return HANDLE; +} + +/** +* @brief OpenFlow消息回调处理函数 +* +* 该函数根据接收到的OpenFlow消息类型调用相应的处理函数。 +* callback 的返回值必须有且只能存在两种返回值: +* 已处理: HANDLE = 0x1, +* 不处理:CONTINUE = 0x2 +* +* @param ofpbuf 接收到的OpenFlow消息缓冲区 +* @param len 消息长度 +* +* @return 返回处理状态码 +*/ +int handle_openflow_callback(struct ofp_buffer *ofpbuf, int len) +{ + int oftype = ofpbuf->header.type; + printf("header.version:%d, type:%d, len:%d\n", ofpbuf->header.version, ofpbuf->header.type, htons(ofpbuf->header.length)); + + switch (oftype) { + case OFPT_HELLO: + return handle_opfmsg_hello(ofpbuf); + case OFPT_FEATURES_REQUEST: + return handle_opfmsg_features_request(ofpbuf); + case OFPT_GET_CONFIG_REQUEST: + return handle_ofpmsg_get_config_request(ofpbuf); + case OFPT_MULTIPART_REQUEST: + // 根据 multipart 请求的具体类型进一步处理 + { + struct ofp_multipart *multipart = (struct ofp_multipart *)ofpbuf->data; + switch (ntohs(multipart->type)) { + case OFPMP_DESC: + return handle_ofpmsg_desc(ofpbuf); + case OFPMP_FLOW: + return handle_ofpmsg_flow_stats(ofpbuf); + case OFPMP_AGGREGATE: + return handle_ofpmsg_aggregate(ofpbuf); + case OFPMP_TABLE: + return handle_ofpmsg_table(ofpbuf); + case OFPMP_PORT_STATS: + return handle_ofpmsg_port_stats(ofpbuf); + case OFPMP_GROUP_FEATURES: + return handle_ofpmsg_group_features(ofpbuf); + case OFPMP_PORT_DESC: + return handle_ofpmsg_port_desc(ofpbuf); + default: + printf("Unsupported multipart request type: %d\n", ntohs(multipart->type)); + break; + } + } + break; + case OFPT_PACKET_OUT: + return handle_ofpmsg_packet_out(ofpbuf); + case OFPT_ROLE_REQUEST: + return handle__opfmsg_role_request(ofpbuf); + default: + printf(" --do not handle the message!\n"); + } + + // 返回不处理状态码 + return CONTINUE; +} + + +#define MASK_HELLO (1 << OFPT_HELLO) // 1 << 0 +#define MASK_FEATURES_REQUEST (1 << OFPT_FEATURES_REQUEST) // 1 << 5 +#define MASK_GET_CONFIG_REQUEST (1 << OFPT_GET_CONFIG_REQUEST) // 1 << 7 +#define MASK_PACKET_OUT (1 << OFPT_PACKET_OUT) // 1 << 13 +#define MASK_MULTIPART_REQUEST (1 << OFPT_MULTIPART_REQUEST) // 1 << 18 +#define MASK_ROLE_REQUEST (1 << OFPT_ROLE_REQUEST) // 1 << 24 + + +/** mask 为获取openflow消息的bimap掩码,openflow消息枚举见 "enum ofp_type" +* +* 如:获取 OFPT_HELLO(0) 和 OFPT_FEATURES_REQUEST(5)消息, +* mask值设为 mask = 0b'100001 = 0x21 +* +*/ +int main(int argc,char* argv[]) +{ + int mask = 0; + + ofp_init(argc,argv); + + // 使用宏为 mask 赋值,监听以下消息类型: + // OFPT_HELLO, OFPT_FEATURES_REQUEST, OFPT_GET_CONFIG_REQUEST, + // OFPT_PACKET_OUT, OFPT_MULTIPART_REQUEST, OFPT_ROLE_REQUEST + mask = MASK_HELLO | MASK_FEATURES_REQUEST | MASK_GET_CONFIG_REQUEST | + MASK_PACKET_OUT | MASK_MULTIPART_REQUEST | MASK_ROLE_REQUEST; + + openflow_hook_init(mask,handle_openflow_callback); + + pause(); + + return 0; +} +// sudo xofp -4 127.0.0.1 -c eth0 -i obx0,obx1,obx2,obx3 diff --git a/openflow/make.log b/openflow/make.log deleted file mode 100644 index d47122f..0000000 --- a/openflow/make.log +++ /dev/null @@ -1,25 +0,0 @@ -main_user_openflow.c: In function ‘build_multipart_reply’: -main_user_openflow.c:54:57: warning: implicit declaration of function ‘build_opfmsg_reply_ofpbuf’ [-Wimplicit-function-declaration] - struct ofp_buffer *reply = (struct ofp_buffer *)build_opfmsg_reply_ofpbuf( - ^ -main_user_openflow.c: At top level: -main_user_openflow.c:98:5: error: conflicting types for ‘build_opfmsg_reply_ofpbuf’ - u8 *build_opfmsg_reply_ofpbuf(uint8_t type,uint32_t xid,uint16_t len) - ^ -main_user_openflow.c:54:57: note: previous implicit declaration of ‘build_opfmsg_reply_ofpbuf’ was here - struct ofp_buffer *reply = (struct ofp_buffer *)build_opfmsg_reply_ofpbuf( - ^ -main_user_openflow.c: In function ‘handle_opfmsg_hello’: -main_user_openflow.c:127:13: warning: implicit declaration of function ‘pkt_print’ [-Wimplicit-function-declaration] - pkt_print((u8 *)ofpbuf,htons(ofpbuf->header.length)); - ^ -main_user_openflow.c: In function ‘main’: -main_user_openflow.c:472:26: warning: passing argument 2 of ‘openflow_hook_init’ from incompatible pointer type [-Wincompatible-pointer-types] - openflow_hook_init(mask,handle_openflow_callback); - ^ -In file included from /usr/local/include/fast.h:87:0, - from main_user_openflow.c:26: -/usr/local/include/fast_sys_dev.h:69:5: note: expected ‘openflow_msg_callback {aka int (*)(struct ofp_buffer *, int)}’ but argument is of type ‘enum ofperr (*)(struct ofp_buffer *, int)’ - int openflow_hook_init(int mask,openflow_msg_callback callback); - ^ - diff --git a/openflow/user_openflow b/openflow/user_openflow index 4e64137..3207c72 100755 Binary files a/openflow/user_openflow and b/openflow/user_openflow differ diff --git a/openflow/usr/include/X11/CallbackI.h b/openflow/usr/include/X11/CallbackI.h deleted file mode 100644 index 5d958f4..0000000 --- a/openflow/usr/include/X11/CallbackI.h +++ /dev/null @@ -1,119 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -/**************************************************************** - * - * Callbacks - * - ****************************************************************/ - -typedef XrmResource **CallbackTable; - -#define _XtCBCalling 1 -#define _XtCBFreeAfterCalling 2 - -_XFUNCPROTOBEGIN - -typedef struct internalCallbackRec { - unsigned short count; - char is_padded; /* contains NULL padding for external form */ - char call_state; /* combination of _XtCB{FreeAfter}Calling */ -#ifdef LONG64 - unsigned int align_pad; /* padding to align callback list */ -#endif - /* XtCallbackList */ -} InternalCallbackRec, *InternalCallbackList; - -typedef Boolean (*_XtConditionProc)( - XtPointer /* data */ -); - -extern void _XtAddCallback( - InternalCallbackList* /* callbacks */, - XtCallbackProc /* callback */, - XtPointer /* closure */ -); - -extern void _XtAddCallbackOnce( - InternalCallbackList* /* callbacks */, - XtCallbackProc /* callback */, - XtPointer /* closure */ -); - -extern InternalCallbackList _XtCompileCallbackList( - XtCallbackList /* xtcallbacks */ -); - -extern XtCallbackList _XtGetCallbackList( - InternalCallbackList* /* callbacks */ -); - -extern void _XtRemoveAllCallbacks( - InternalCallbackList* /* callbacks */ -); - -extern void _XtRemoveCallback( - InternalCallbackList* /* callbacks */, - XtCallbackProc /* callback */, - XtPointer /* closure */ -); - -extern void _XtPeekCallback( - Widget /* widget */, - XtCallbackList /* callbacks */, - XtCallbackProc * /* callback */, - XtPointer * /* closure */ -); - -extern void _XtCallConditionalCallbackList( - Widget /* widget */, - XtCallbackList /* callbacks */, - XtPointer /* call_data */, - _XtConditionProc /* cond_proc */ -); - -_XFUNCPROTOEND diff --git a/openflow/usr/include/X11/Composite.h b/openflow/usr/include/X11/Composite.h deleted file mode 100644 index d33234f..0000000 --- a/openflow/usr/include/X11/Composite.h +++ /dev/null @@ -1,102 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtComposite_h -#define _XtComposite_h - -typedef struct _CompositeClassRec *CompositeWidgetClass; - -typedef Cardinal (*XtOrderProc)( - Widget /* child */ -); - -_XFUNCPROTOBEGIN - -extern void XtManageChildren( - WidgetList /* children */, - Cardinal /* num_children */ -); - -extern void XtManageChild( - Widget /* child */ -); - -extern void XtUnmanageChildren( - WidgetList /* children */, - Cardinal /* num_children */ -); - -extern void XtUnmanageChild( - Widget /* child */ -); - -typedef void (*XtDoChangeProc)( - Widget /* composite_parent */, - WidgetList /* unmanage_children */, - Cardinal * /* num_unmanage_children */, - WidgetList /* manage_children */, - Cardinal * /* num_manage_children */, - XtPointer /* client_data */ -); - -extern void XtChangeManagedSet( - WidgetList /* unmanage_children */, - Cardinal /* num_unmanage_children */, - XtDoChangeProc /* do_change_proc */, - XtPointer /* client_data */, - WidgetList /* manage_children */, - Cardinal /* num_manage_children */ -); - -_XFUNCPROTOEND - -#ifndef VMS -externalref WidgetClass compositeWidgetClass; -#endif - -#endif /* _XtComposite_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/CompositeP.h b/openflow/usr/include/X11/CompositeP.h deleted file mode 100644 index b1b8559..0000000 --- a/openflow/usr/include/X11/CompositeP.h +++ /dev/null @@ -1,113 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtCompositeP_h -#define _XtCompositeP_h - -#include - -_XFUNCPROTOBEGIN - -/************************************************************************ - * - * Additional instance fields for widgets of (sub)class 'Composite' - * - ************************************************************************/ - -typedef struct _CompositePart { - WidgetList children; /* array of ALL widget children */ - Cardinal num_children; /* total number of widget children */ - Cardinal num_slots; /* number of slots in children array */ - XtOrderProc insert_position; /* compute position of new child */ -} CompositePart,*CompositePtr; - -typedef struct _CompositeRec { - CorePart core; - CompositePart composite; -} CompositeRec; - -/********************************************************************* - * - * Additional class fields for widgets of (sub)class 'Composite' - * - ********************************************************************/ - -typedef struct _CompositeClassPart { - XtGeometryHandler geometry_manager; /* geometry manager for children */ - XtWidgetProc change_managed; /* change managed state of child */ - XtWidgetProc insert_child; /* physically add child to parent */ - XtWidgetProc delete_child; /* physically remove child */ - XtPointer extension; /* pointer to extension record */ -} CompositeClassPart,*CompositePartPtr; - -typedef struct { - XtPointer next_extension; /* 1st 4 mandated for all extension records */ - XrmQuark record_type; /* NULLQUARK; on CompositeClassPart */ - long version; /* must be XtCompositeExtensionVersion */ - Cardinal record_size; /* sizeof(CompositeClassExtensionRec) */ - Boolean accepts_objects; - Boolean allows_change_managed_set; -} CompositeClassExtensionRec, *CompositeClassExtension; - - -typedef struct _CompositeClassRec { - CoreClassPart core_class; - CompositeClassPart composite_class; -} CompositeClassRec; - -externalref CompositeClassRec compositeClassRec; - -_XFUNCPROTOEND - -#define XtCompositeExtensionVersion 2L -#define XtInheritGeometryManager ((XtGeometryHandler) _XtInherit) -#define XtInheritChangeManaged ((XtWidgetProc) _XtInherit) -#define XtInheritInsertChild ((XtWidgetProc) _XtInherit) -#define XtInheritDeleteChild ((XtWidgetProc) _XtInherit) - -#endif /* _XtCompositeP_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/ConstrainP.h b/openflow/usr/include/X11/ConstrainP.h deleted file mode 100644 index 40ff9b9..0000000 --- a/openflow/usr/include/X11/ConstrainP.h +++ /dev/null @@ -1,96 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtConstraintP_h -#define _XtConstraintP_h - -#include - -_XFUNCPROTOBEGIN - -typedef struct _ConstraintPart { - XtPointer mumble; /* No new fields, keep C compiler happy */ -} ConstraintPart; - -typedef struct _ConstraintRec { - CorePart core; - CompositePart composite; - ConstraintPart constraint; -} ConstraintRec, *ConstraintWidget; - -typedef struct _ConstraintClassPart { - XtResourceList resources; /* constraint resource list */ - Cardinal num_resources; /* number of constraints in list */ - Cardinal constraint_size; /* size of constraint record */ - XtInitProc initialize; /* constraint initialization */ - XtWidgetProc destroy; /* constraint destroy proc */ - XtSetValuesFunc set_values; /* constraint set_values proc */ - XtPointer extension; /* pointer to extension record */ -} ConstraintClassPart; - -typedef struct { - XtPointer next_extension; /* 1st 4 mandated for all extension records */ - XrmQuark record_type; /* NULLQUARK; on ConstraintClassPart */ - long version; /* must be XtConstraintExtensionVersion */ - Cardinal record_size; /* sizeof(ConstraintClassExtensionRec) */ - XtArgsProc get_values_hook; -} ConstraintClassExtensionRec, *ConstraintClassExtension; - -typedef struct _ConstraintClassRec { - CoreClassPart core_class; - CompositeClassPart composite_class; - ConstraintClassPart constraint_class; -} ConstraintClassRec; - -externalref ConstraintClassRec constraintClassRec; - -_XFUNCPROTOEND - -#define XtConstraintExtensionVersion 1L - -#endif /* _XtConstraintP_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/Constraint.h b/openflow/usr/include/X11/Constraint.h deleted file mode 100644 index 20abead..0000000 --- a/openflow/usr/include/X11/Constraint.h +++ /dev/null @@ -1,62 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtConstraint_h -#define _XtConstraint_h - -_XFUNCPROTOBEGIN - -typedef struct _ConstraintClassRec *ConstraintWidgetClass; - -#ifndef VMS -externalref WidgetClass constraintWidgetClass; -#endif - -_XFUNCPROTOEND - -#endif /* _XtConstraint_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/ConvertI.h b/openflow/usr/include/X11/ConvertI.h deleted file mode 100644 index 760d477..0000000 --- a/openflow/usr/include/X11/ConvertI.h +++ /dev/null @@ -1,96 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -_XFUNCPROTOBEGIN - -/* Representation types */ - -extern XrmQuark _XtQString; - -/* - * Resource conversions - */ - -typedef struct _ConverterRec **ConverterTable; - -extern void _XtAddDefaultConverters( - ConverterTable /* table */ -); - -extern void _XtSetDefaultConverterTable( - ConverterTable* /* table */ -); - -extern void _XtFreeConverterTable( - ConverterTable /* table */ -); - -extern void _XtTableAddConverter( - ConverterTable /* table */, - XrmRepresentation /* from_type */, - XrmRepresentation /* to_type */, - XtTypeConverter /* converter */, - XtConvertArgList /* convert_args */, - Cardinal /* num_args */, - _XtBoolean /* new_style */, - XtCacheType /* cache_type */, - XtDestructor /* destructor */, - _XtBoolean /* global */ -); - -extern Boolean _XtConvert( - Widget /* widget */, - XrmRepresentation /* from_type */, - XrmValuePtr /* from */, - XrmRepresentation /* to_type */, - XrmValuePtr /* to */, - XtCacheRef* /* cache_ref_return */ -); - -void _XtConvertInitialize(void); - -_XFUNCPROTOEND diff --git a/openflow/usr/include/X11/Core.h b/openflow/usr/include/X11/Core.h deleted file mode 100644 index 08a86f6..0000000 --- a/openflow/usr/include/X11/Core.h +++ /dev/null @@ -1,65 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtCore_h -#define _XtCore_h - -_XFUNCPROTOBEGIN - -typedef struct _WidgetClassRec *CoreWidgetClass; -typedef struct _WidgetRec *CoreWidget; -externalref WidgetClass coreWidgetClass; - -#ifndef VMS -externalref WidgetClass widgetClass; - -#endif - -_XFUNCPROTOEND - -#endif /* _XtCore_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/CoreP.h b/openflow/usr/include/X11/CoreP.h deleted file mode 100644 index a4cb16e..0000000 --- a/openflow/usr/include/X11/CoreP.h +++ /dev/null @@ -1,170 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef XtCoreP_h -#define XtCoreP_h - -#include - -_XFUNCPROTOBEGIN - -externalref int _XtInheritTranslations; - -#define XtInheritTranslations ((String) &_XtInheritTranslations) -#define XtInheritRealize ((XtRealizeProc) _XtInherit) -#define XtInheritResize ((XtWidgetProc) _XtInherit) -#define XtInheritExpose ((XtExposeProc) _XtInherit) -#define XtInheritSetValuesAlmost ((XtAlmostProc) _XtInherit) -#define XtInheritAcceptFocus ((XtAcceptFocusProc) _XtInherit) -#define XtInheritQueryGeometry ((XtGeometryHandler) _XtInherit) -#define XtInheritDisplayAccelerator ((XtStringProc) _XtInherit) - -/*************************************************************** - * Widget Core Data Structures - * - * - **************************************************************/ - -typedef struct _CorePart { - Widget self; /* pointer to widget itself */ - WidgetClass widget_class; /* pointer to Widget's ClassRec */ - Widget parent; /* parent widget */ - XrmName xrm_name; /* widget resource name quarkified */ - Boolean being_destroyed; /* marked for destroy */ - XtCallbackList destroy_callbacks; /* who to call when widget destroyed */ - XtPointer constraints; /* constraint record */ - Position x, y; /* window position */ - Dimension width, height; /* window dimensions */ - Dimension border_width; /* window border width */ - Boolean managed; /* is widget geometry managed? */ - Boolean sensitive; /* is widget sensitive to user events*/ - Boolean ancestor_sensitive; /* are all ancestors sensitive? */ - XtEventTable event_table; /* private to event dispatcher */ - XtTMRec tm; /* translation management */ - XtTranslations accelerators; /* accelerator translations */ - Pixel border_pixel; /* window border pixel */ - Pixmap border_pixmap; /* window border pixmap or NULL */ - WidgetList popup_list; /* list of popups */ - Cardinal num_popups; /* how many popups */ - String name; /* widget resource name */ - Screen *screen; /* window's screen */ - Colormap colormap; /* colormap */ - Window window; /* window ID */ - Cardinal depth; /* number of planes in window */ - Pixel background_pixel; /* window background pixel */ - Pixmap background_pixmap; /* window background pixmap or NULL */ - Boolean visible; /* is window mapped and not occluded?*/ - Boolean mapped_when_managed;/* map window if it's managed? */ -} CorePart; - -typedef struct _WidgetRec { - CorePart core; - } WidgetRec, CoreRec; - - - -/****************************************************************** - * - * Core Class Structure. Widgets, regardless of their class, will have - * these fields. All widgets of a given class will have the same values - * for these fields. Widgets of a given class may also have additional - * common fields. These additional fields are included in incremental - * class structures, such as CommandClass. - * - * The fields that are specific to this subclass, as opposed to fields that - * are part of the superclass, are called "subclass fields" below. Many - * procedures are responsible only for the subclass fields, and not for - * any superclass fields. - * - ********************************************************************/ - -typedef struct _CoreClassPart { - WidgetClass superclass; /* pointer to superclass ClassRec */ - String class_name; /* widget resource class name */ - Cardinal widget_size; /* size in bytes of widget record */ - XtProc class_initialize; /* class initialization proc */ - XtWidgetClassProc class_part_initialize; /* dynamic initialization */ - XtEnum class_inited; /* has class been initialized? */ - XtInitProc initialize; /* initialize subclass fields */ - XtArgsProc initialize_hook; /* notify that initialize called */ - XtRealizeProc realize; /* XCreateWindow for widget */ - XtActionList actions; /* widget semantics name to proc map */ - Cardinal num_actions; /* number of entries in actions */ - XtResourceList resources; /* resources for subclass fields */ - Cardinal num_resources; /* number of entries in resources */ - XrmClass xrm_class; /* resource class quarkified */ - Boolean compress_motion; /* compress MotionNotify for widget */ - XtEnum compress_exposure; /* compress Expose events for widget*/ - Boolean compress_enterleave;/* compress enter and leave events */ - Boolean visible_interest; /* select for VisibilityNotify */ - XtWidgetProc destroy; /* free data for subclass pointers */ - XtWidgetProc resize; /* geom manager changed widget size */ - XtExposeProc expose; /* rediplay window */ - XtSetValuesFunc set_values; /* set subclass resource values */ - XtArgsFunc set_values_hook; /* notify that set_values called */ - XtAlmostProc set_values_almost; /* set_values got "Almost" geo reply */ - XtArgsProc get_values_hook; /* notify that get_values called */ - XtAcceptFocusProc accept_focus; /* assign input focus to widget */ - XtVersionType version; /* version of intrinsics used */ - XtPointer callback_private; /* list of callback offsets */ - String tm_table; /* state machine */ - XtGeometryHandler query_geometry; /* return preferred geometry */ - XtStringProc display_accelerator;/* display your accelerator */ - XtPointer extension; /* pointer to extension record */ - } CoreClassPart; - -typedef struct _WidgetClassRec { - CoreClassPart core_class; -} WidgetClassRec, CoreClassRec; - -externalref WidgetClassRec widgetClassRec; -#define coreClassRec widgetClassRec - -_XFUNCPROTOEND - -#endif /* _XtCoreP_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/CreateI.h b/openflow/usr/include/X11/CreateI.h deleted file mode 100644 index e00ba65..0000000 --- a/openflow/usr/include/X11/CreateI.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef _XtcreateI_h -#define _XtcreateI_h - -_XFUNCPROTOBEGIN - -extern Widget _XtCreateWidget(String name, WidgetClass widget_class, - Widget parent, ArgList args, Cardinal num_args, - XtTypedArgList typed_args, - Cardinal num_typed_args); -extern Widget _XtCreatePopupShell(String name, WidgetClass widget_class, - Widget parent, ArgList args, - Cardinal num_args, XtTypedArgList typed_args, - Cardinal num_typed_args); -extern Widget _XtAppCreateShell(String name, String class, - WidgetClass widget_class, Display *display, - ArgList args, Cardinal num_args, - XtTypedArgList typed_args, - Cardinal num_typed_args); -extern Widget _XtCreateHookObj(Screen *screen); - -_XFUNCPROTOEND - -#include - -_XFUNCPROTOBEGIN - -/* VarCreate.c */ -extern Widget _XtVaOpenApplication(XtAppContext *app_context_return, - _Xconst char* application_class, - XrmOptionDescList options, Cardinal num_options, - int *argc_in_out, String *argv_in_out, - String *fallback_resources, WidgetClass widget_class, - va_list var_args); -extern Widget _XtVaAppInitialize(XtAppContext *app_context_return, - _Xconst char* application_class, - XrmOptionDescList options, Cardinal num_options, - int *argc_in_out, String *argv_in_out, - String *fallback_resources, va_list var_args); - -_XFUNCPROTOEND - -#endif /* _XtcreateI_h */ diff --git a/openflow/usr/include/X11/DECkeysym.h b/openflow/usr/include/X11/DECkeysym.h deleted file mode 100644 index 0730716..0000000 --- a/openflow/usr/include/X11/DECkeysym.h +++ /dev/null @@ -1,65 +0,0 @@ -/*********************************************************** - -Copyright 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -/* - * DEC private keysyms - * (29th bit set) - */ - -/* two-key compose sequence initiators, chosen to map to Latin1 characters */ - -#define DXK_ring_accent 0x1000FEB0 -#define DXK_circumflex_accent 0x1000FE5E -#define DXK_cedilla_accent 0x1000FE2C -#define DXK_acute_accent 0x1000FE27 -#define DXK_grave_accent 0x1000FE60 -#define DXK_tilde 0x1000FE7E -#define DXK_diaeresis 0x1000FE22 - -/* special keysym for LK2** "Remove" key on editing keypad */ - -#define DXK_Remove 0x1000FF00 /* Remove */ diff --git a/openflow/usr/include/X11/EventI.h b/openflow/usr/include/X11/EventI.h deleted file mode 100644 index 4aae5af..0000000 --- a/openflow/usr/include/X11/EventI.h +++ /dev/null @@ -1,134 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -/* - * Event.h - exported types and functions for toolkit event handler - * - * Author: Charles Haynes - * Digital Equipment Corporation - * Western Software Laboratory - * Date: Sun Dec 6 1987 - */ - -#ifndef _Event_h_ -#define _Event_h_ - -typedef struct _XtGrabRec *XtGrabList; - -#include "PassivGraI.h" - -_XFUNCPROTOBEGIN - -extern void _XtEventInitialize( - void -); - -typedef struct _XtEventRec { - XtEventTable next; - EventMask mask; /* also select_data count for RecExt */ - XtEventHandler proc; - XtPointer closure; - unsigned int select:1; - unsigned int has_type_specifier:1; - unsigned int async:1; /* not used, here for Digital extension? */ -} XtEventRec; - -typedef struct _XtGrabRec { - XtGrabList next; - Widget widget; - unsigned int exclusive:1; - unsigned int spring_loaded:1; -}XtGrabRec; - -typedef struct _BlockHookRec { - struct _BlockHookRec* next; - XtAppContext app; - XtBlockHookProc proc; - XtPointer closure; -} BlockHookRec, *BlockHook; - -extern void _XtFreeEventTable( - XtEventTable* /* event_table */ -); - -extern Boolean _XtOnGrabList( - Widget /* widget */, - XtGrabRec* /* grabList */ -); - -extern void _XtRemoveAllInputs( - XtAppContext /* app */ -); - -extern void _XtRefreshMapping( - XEvent* /* event */, - _XtBoolean /* dispatch */ -); - -extern void _XtSendFocusEvent( - Widget /* child */, - int /* type */); - -extern EventMask _XtConvertTypeToMask( - int /* eventType */ -); - -/* EventUtil.c */ -extern Widget _XtFindRemapWidget(XEvent *event, Widget widget, - EventMask mask, XtPerDisplayInput pdi); -extern void _XtUngrabBadGrabs(XEvent *event, Widget widget, - EventMask mask, XtPerDisplayInput pdi); -extern void _XtFillAncestorList(Widget **listPtr, int *maxElemsPtr, - int *numElemsPtr, Widget start, - Widget breakWidget); - -/* NextEvent.c */ -extern Boolean XtAppPeekEvent_SkipTimer; - -_XFUNCPROTOEND - -#endif /* _Event_h_ */ diff --git a/openflow/usr/include/X11/HPkeysym.h b/openflow/usr/include/X11/HPkeysym.h deleted file mode 100644 index 4a0655a..0000000 --- a/openflow/usr/include/X11/HPkeysym.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the names of Hewlett Packard -or Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD -TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. Hewlett-Packard shall not be liable for errors -contained herein or direct, indirect, special, incidental or -consequential damages in connection with the furnishing, -performance, or use of this material. - -*/ - -#ifndef _HPKEYSYM_H - -#define _HPKEYSYM_H - -#define hpXK_ClearLine 0x1000FF6F -#define hpXK_InsertLine 0x1000FF70 -#define hpXK_DeleteLine 0x1000FF71 -#define hpXK_InsertChar 0x1000FF72 -#define hpXK_DeleteChar 0x1000FF73 -#define hpXK_BackTab 0x1000FF74 -#define hpXK_KP_BackTab 0x1000FF75 -#define hpXK_Modelock1 0x1000FF48 -#define hpXK_Modelock2 0x1000FF49 -#define hpXK_Reset 0x1000FF6C -#define hpXK_System 0x1000FF6D -#define hpXK_User 0x1000FF6E -#define hpXK_mute_acute 0x100000A8 -#define hpXK_mute_grave 0x100000A9 -#define hpXK_mute_asciicircum 0x100000AA -#define hpXK_mute_diaeresis 0x100000AB -#define hpXK_mute_asciitilde 0x100000AC -#define hpXK_lira 0x100000AF -#define hpXK_guilder 0x100000BE -#define hpXK_Ydiaeresis 0x100000EE -#define hpXK_IO 0x100000EE -#define hpXK_longminus 0x100000F6 -#define hpXK_block 0x100000FC - - -#ifndef _OSF_Keysyms -#define _OSF_Keysyms - -#define osfXK_Copy 0x1004FF02 -#define osfXK_Cut 0x1004FF03 -#define osfXK_Paste 0x1004FF04 -#define osfXK_BackTab 0x1004FF07 -#define osfXK_BackSpace 0x1004FF08 -#define osfXK_Clear 0x1004FF0B -#define osfXK_Escape 0x1004FF1B -#define osfXK_AddMode 0x1004FF31 -#define osfXK_PrimaryPaste 0x1004FF32 -#define osfXK_QuickPaste 0x1004FF33 -#define osfXK_PageLeft 0x1004FF40 -#define osfXK_PageUp 0x1004FF41 -#define osfXK_PageDown 0x1004FF42 -#define osfXK_PageRight 0x1004FF43 -#define osfXK_Activate 0x1004FF44 -#define osfXK_MenuBar 0x1004FF45 -#define osfXK_Left 0x1004FF51 -#define osfXK_Up 0x1004FF52 -#define osfXK_Right 0x1004FF53 -#define osfXK_Down 0x1004FF54 -#define osfXK_EndLine 0x1004FF57 -#define osfXK_BeginLine 0x1004FF58 -#define osfXK_EndData 0x1004FF59 -#define osfXK_BeginData 0x1004FF5A -#define osfXK_PrevMenu 0x1004FF5B -#define osfXK_NextMenu 0x1004FF5C -#define osfXK_PrevField 0x1004FF5D -#define osfXK_NextField 0x1004FF5E -#define osfXK_Select 0x1004FF60 -#define osfXK_Insert 0x1004FF63 -#define osfXK_Undo 0x1004FF65 -#define osfXK_Menu 0x1004FF67 -#define osfXK_Cancel 0x1004FF69 -#define osfXK_Help 0x1004FF6A -#define osfXK_SelectAll 0x1004FF71 -#define osfXK_DeselectAll 0x1004FF72 -#define osfXK_Reselect 0x1004FF73 -#define osfXK_Extend 0x1004FF74 -#define osfXK_Restore 0x1004FF78 -#define osfXK_Delete 0x1004FFFF - -#endif /* _OSF_Keysyms */ - - -/************************************************************** - * The use of the following macros is deprecated. - * They are listed below only for backwards compatibility. - */ -#define XK_Reset 0x1000FF6C -#define XK_System 0x1000FF6D -#define XK_User 0x1000FF6E -#define XK_ClearLine 0x1000FF6F -#define XK_InsertLine 0x1000FF70 -#define XK_DeleteLine 0x1000FF71 -#define XK_InsertChar 0x1000FF72 -#define XK_DeleteChar 0x1000FF73 -#define XK_BackTab 0x1000FF74 -#define XK_KP_BackTab 0x1000FF75 -#define XK_Ext16bit_L 0x1000FF76 -#define XK_Ext16bit_R 0x1000FF77 -#define XK_mute_acute 0x100000a8 -#define XK_mute_grave 0x100000a9 -#define XK_mute_asciicircum 0x100000aa -#define XK_mute_diaeresis 0x100000ab -#define XK_mute_asciitilde 0x100000ac -#define XK_lira 0x100000af -#define XK_guilder 0x100000be -#ifndef XK_Ydiaeresis -#define XK_Ydiaeresis 0x100000ee -#endif -#define XK_IO 0x100000ee -#define XK_longminus 0x100000f6 -#define XK_block 0x100000fc - -#endif /* _HPKEYSYM_H */ diff --git a/openflow/usr/include/X11/HookObjI.h b/openflow/usr/include/X11/HookObjI.h deleted file mode 100644 index 94c0cbb..0000000 --- a/openflow/usr/include/X11/HookObjI.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - -Copyright 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifndef _XtHookObjI_h -#define _XtHookObjI_h - -_XFUNCPROTOBEGIN - -/* This object is implementation-dependent and private to the library. */ - -typedef struct _HookObjRec *HookObject; -typedef struct _HookObjClassRec *HookObjectClass; - -externalref WidgetClass hookObjectClass; - -typedef struct _HookObjPart { - /* resources */ - XtCallbackList createhook_callbacks; - XtCallbackList changehook_callbacks; - XtCallbackList confighook_callbacks; - XtCallbackList geometryhook_callbacks; - XtCallbackList destroyhook_callbacks; - WidgetList shells; - Cardinal num_shells; - /* private data */ - Cardinal max_shells; - Screen* screen; -}HookObjPart; - -typedef struct _HookObjRec { - ObjectPart object; - HookObjPart hooks; -} HookObjRec; - -typedef struct _HookObjClassPart { - int unused; -} HookObjClassPart; - -typedef struct _HookObjClassRec { - ObjectClassPart object_class; - HookObjClassPart hook_class; -} HookObjClassRec; - -externalref HookObjClassRec hookObjClassRec; - -_XFUNCPROTOEND - -#endif /* ifndef _Xt_HookObjI_h */ - - diff --git a/openflow/usr/include/X11/ICE/ICE.h b/openflow/usr/include/X11/ICE/ICE.h deleted file mode 100644 index 7560647..0000000 --- a/openflow/usr/include/X11/ICE/ICE.h +++ /dev/null @@ -1,101 +0,0 @@ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Author: Ralph Mor, X Consortium - -******************************************************************************/ - -#ifndef _ICE_H_ -#define _ICE_H_ - -/* - * Protocol Version - */ - -#define IceProtoMajor 1 -#define IceProtoMinor 0 - - -/* - * Byte Order - */ - -#define IceLSBfirst 0 -#define IceMSBfirst 1 - - -/* - * ICE minor opcodes - */ - -#define ICE_Error 0 -#define ICE_ByteOrder 1 -#define ICE_ConnectionSetup 2 -#define ICE_AuthRequired 3 -#define ICE_AuthReply 4 -#define ICE_AuthNextPhase 5 -#define ICE_ConnectionReply 6 -#define ICE_ProtocolSetup 7 -#define ICE_ProtocolReply 8 -#define ICE_Ping 9 -#define ICE_PingReply 10 -#define ICE_WantToClose 11 -#define ICE_NoClose 12 - - -/* - * Error severity - */ - -#define IceCanContinue 0 -#define IceFatalToProtocol 1 -#define IceFatalToConnection 2 - - -/* - * ICE error classes that are common to all protocols - */ - -#define IceBadMinor 0x8000 -#define IceBadState 0x8001 -#define IceBadLength 0x8002 -#define IceBadValue 0x8003 - - -/* - * ICE error classes that are specific to the ICE protocol - */ - -#define IceBadMajor 0 -#define IceNoAuth 1 -#define IceNoVersion 2 -#define IceSetupFailed 3 -#define IceAuthRejected 4 -#define IceAuthFailed 5 -#define IceProtocolDuplicate 6 -#define IceMajorOpcodeDuplicate 7 -#define IceUnknownProtocol 8 - -#endif /* _ICE_H_ */ diff --git a/openflow/usr/include/X11/ICE/ICEconn.h b/openflow/usr/include/X11/ICE/ICEconn.h deleted file mode 100644 index e5d493a..0000000 --- a/openflow/usr/include/X11/ICE/ICEconn.h +++ /dev/null @@ -1,250 +0,0 @@ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Author: Ralph Mor, X Consortium -******************************************************************************/ - -#ifndef _ICECONN_H_ -#define _ICECONN_H_ - -#include - -/* - * Data structures for ICE connection object - */ - -typedef struct _IceSavedReplyWait { - IceReplyWaitInfo *reply_wait; - Bool reply_ready; - struct _IceSavedReplyWait *next; -} _IceSavedReplyWait; - -typedef struct _IcePingWait { - IcePingReplyProc ping_reply_proc; - IcePointer client_data; - struct _IcePingWait *next; -} _IcePingWait; - -typedef struct { - char *vendor; - char *release; - int version_count; - IcePoVersionRec *version_recs; - int auth_count; - char **auth_names; - IcePoAuthProc *auth_procs; - IceIOErrorProc io_error_proc; -} _IcePoProtocol; - -typedef struct { - char *vendor; - char *release; - int version_count; - IcePaVersionRec *version_recs; - IceProtocolSetupProc protocol_setup_proc; - IceProtocolActivateProc protocol_activate_proc; - int auth_count; - char **auth_names; - IcePaAuthProc *auth_procs; - IceHostBasedAuthProc host_based_auth_proc; - IceIOErrorProc io_error_proc; -} _IcePaProtocol; - -typedef struct { - char *protocol_name; - _IcePoProtocol *orig_client; - _IcePaProtocol *accept_client; -} _IceProtocol; - -typedef struct { - Bool in_use; - int my_opcode; - _IceProtocol *protocol; - IcePointer client_data; - Bool accept_flag; - union { - IcePaProcessMsgProc accept_client; - IcePoProcessMsgProc orig_client; - } process_msg_proc; -} _IceProcessMsgInfo; - -typedef struct { - int his_version_index; - int my_version_index; - char *his_vendor; - char *his_release; - char my_auth_index; - IcePointer my_auth_state; - Bool must_authenticate; -} _IceConnectToMeInfo; - -typedef struct { - int his_opcode; - int my_opcode; - int his_version_index; - int my_version_index; - char *his_vendor; - char *his_release; - char my_auth_index; - IcePointer my_auth_state; - Bool must_authenticate; -} _IceProtoSetupToMeInfo; - -typedef struct { - Bool auth_active; - char my_auth_index; - IcePointer my_auth_state; -} _IceConnectToYouInfo; - -typedef struct { - int my_opcode; - int my_auth_count; - int *my_auth_indices; - Bool auth_active; - char my_auth_index; - IcePointer my_auth_state; -} _IceProtoSetupToYouInfo; - - -struct _IceConn { - - unsigned int io_ok : 1; /* did an IO error occur? */ - unsigned int swap : 1; /* do we need to swap on reads? */ - unsigned int waiting_for_byteorder : 1; /* waiting for a ByteOrder msg? */ - unsigned int skip_want_to_close : 1; /* avoid shutdown negotiation? */ - unsigned int want_to_close : 1; /* did we send a WantToClose? */ - unsigned int free_asap : 1; /* free as soon as possible */ - unsigned int unused1 : 2; /* future use */ - unsigned int unused2 : 8; /* future use */ - - IceConnectStatus connection_status; /* pending, accepted, rejected */ - - unsigned char my_ice_version_index; /* which version are we using? */ - - struct _XtransConnInfo *trans_conn; /* transport connection object */ - unsigned long send_sequence; /* Sequence # of last msg sent */ - unsigned long receive_sequence; /* Sequence # of last msg received */ - - char *connection_string; /* network connection string */ - char *vendor; /* other client's vendor */ - char *release; /* other client's release */ - - char *inbuf; /* Input buffer starting address */ - char *inbufptr; /* Input buffer index pointer */ - char *inbufmax; /* Input buffer maximum+1 address */ - - char *outbuf; /* Output buffer starting address */ - char *outbufptr; /* Output buffer index pointer */ - char *outbufmax; /* Output buffer maximum+1 address */ - - char *scratch; /* scratch buffer */ - unsigned long scratch_size; /* scratch size */ - - int dispatch_level; /* IceProcessMessages dispatch level */ - - IcePointer context; /* context associated with caller - of IceOpenConnection */ - - /* - * Before we read a message, the major opcode of the message must be - * mapped to our corresponding major opcode (the two clients can use - * different opcodes for the same protocol). In order to save space, - * we keep track of the mininum and maximum major opcodes used by the - * other client. To get the information on how to process this message, - * we do the following... - * - * processMsgInfo = iceConn->process_msg_info[ - * message->majorOpcode - iceConn->his_min_opcode] - * - * Note that the number of elements in the iceConn->process_msg_info - * array is always (iceConn->his_max_opcode - iceConn->his_min_opcode + 1). - * We check process_msg_info->in_use to see if the opcode is being used. - */ - - _IceProcessMsgInfo *process_msg_info; - char his_min_opcode; /* [1..255] */ - char his_max_opcode; /* [1..255] */ - - - /* - * Number of times this iceConn was returned in IceOpenConnection - * or IceAcceptConnection. - */ - - unsigned char open_ref_count; - - - /* - * Number of active protocols. - */ - - unsigned char proto_ref_count; - - - /* - * If this ICE connection was created with IceAcceptConnection, - * the listen_obj field is set to the listen object. Otherwise, - * the listen_obj field is NULL. - */ - - IceListenObj listen_obj; - - - - - /* - * We need to keep track of all the replies we're waiting for. - * Check the comments in process.c for how this works. - */ - - _IceSavedReplyWait *saved_reply_waits; - - - /* - * We keep track of all Pings sent from the client. When the Ping reply - * arrives, we remove it from the list. - */ - - _IcePingWait *ping_waits; - - - /* - * Some state for a client doing a Connection/Protocol Setup - */ - - _IceConnectToYouInfo *connect_to_you; - _IceProtoSetupToYouInfo *protosetup_to_you; - - - /* - * Some state for a client receiving a Connection/Protocol Setup - */ - - _IceConnectToMeInfo *connect_to_me; - _IceProtoSetupToMeInfo *protosetup_to_me; - -}; - -#endif /* _ICECONN_H_ */ diff --git a/openflow/usr/include/X11/ICE/ICElib.h b/openflow/usr/include/X11/ICE/ICElib.h deleted file mode 100644 index 402cbc8..0000000 --- a/openflow/usr/include/X11/ICE/ICElib.h +++ /dev/null @@ -1,431 +0,0 @@ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Author: Ralph Mor, X Consortium -******************************************************************************/ - -#ifndef _ICELIB_H_ -#define _ICELIB_H_ - -#include -#include - -#define Bool int -#define Status int -#define True 1 -#define False 0 - -typedef void *IcePointer; - -typedef enum { - IcePoAuthHaveReply, - IcePoAuthRejected, - IcePoAuthFailed, - IcePoAuthDoneCleanup -} IcePoAuthStatus; - -typedef enum { - IcePaAuthContinue, - IcePaAuthAccepted, - IcePaAuthRejected, - IcePaAuthFailed -} IcePaAuthStatus; - -typedef enum { - IceConnectPending, - IceConnectAccepted, - IceConnectRejected, - IceConnectIOError -} IceConnectStatus; - -typedef enum { - IceProtocolSetupSuccess, - IceProtocolSetupFailure, - IceProtocolSetupIOError, - IceProtocolAlreadyActive -} IceProtocolSetupStatus; - -typedef enum { - IceAcceptSuccess, - IceAcceptFailure, - IceAcceptBadMalloc -} IceAcceptStatus; - -typedef enum { - IceClosedNow, - IceClosedASAP, - IceConnectionInUse, - IceStartedShutdownNegotiation -} IceCloseStatus; - -typedef enum { - IceProcessMessagesSuccess, - IceProcessMessagesIOError, - IceProcessMessagesConnectionClosed -} IceProcessMessagesStatus; - -typedef struct { - unsigned long sequence_of_request; - int major_opcode_of_request; - int minor_opcode_of_request; - IcePointer reply; -} IceReplyWaitInfo; - -typedef struct _IceConn *IceConn; -typedef struct _IceListenObj *IceListenObj; - -typedef void (*IceWatchProc) ( - IceConn /* iceConn */, - IcePointer /* clientData */, - Bool /* opening */, - IcePointer * /* watchData */ -); - -typedef void (*IcePoProcessMsgProc) ( - IceConn /* iceConn */, - IcePointer /* clientData */, - int /* opcode */, - unsigned long /* length */, - Bool /* swap */, - IceReplyWaitInfo * /* replyWait */, - Bool * /* replyReadyRet */ -); - -typedef void (*IcePaProcessMsgProc) ( - IceConn /* iceConn */, - IcePointer /* clientData */, - int /* opcode */, - unsigned long /* length */, - Bool /* swap */ -); - -typedef struct { - int major_version; - int minor_version; - IcePoProcessMsgProc process_msg_proc; -} IcePoVersionRec; - -typedef struct { - int major_version; - int minor_version; - IcePaProcessMsgProc process_msg_proc; -} IcePaVersionRec; - -typedef IcePoAuthStatus (*IcePoAuthProc) ( - IceConn /* iceConn */, - IcePointer * /* authStatePtr */, - Bool /* cleanUp */, - Bool /* swap */, - int /* authDataLen */, - IcePointer /* authData */, - int * /* replyDataLenRet */, - IcePointer * /* replyDataRet */, - char ** /* errorStringRet */ -); - -typedef IcePaAuthStatus (*IcePaAuthProc) ( - IceConn /* iceConn */, - IcePointer * /* authStatePtr */, - Bool /* swap */, - int /* authDataLen */, - IcePointer /* authData */, - int * /* replyDataLenRet */, - IcePointer * /* replyDataRet */, - char ** /* errorStringRet */ -); - -typedef Bool (*IceHostBasedAuthProc) ( - char * /* hostName */ -); - -typedef Status (*IceProtocolSetupProc) ( - IceConn /* iceConn */, - int /* majorVersion */, - int /* minorVersion */, - char * /* vendor */, - char * /* release */, - IcePointer * /* clientDataRet */, - char ** /* failureReasonRet */ -); - -typedef void (*IceProtocolActivateProc) ( - IceConn /* iceConn */, - IcePointer /* clientData */ -); - -typedef void (*IceIOErrorProc) ( - IceConn /* iceConn */ -); - -typedef void (*IcePingReplyProc) ( - IceConn /* iceConn */, - IcePointer /* clientData */ -); - -typedef void (*IceErrorHandler) ( - IceConn /* iceConn */, - Bool /* swap */, - int /* offendingMinorOpcode */, - unsigned long /* offendingSequence */, - int /* errorClass */, - int /* severity */, - IcePointer /* values */ -); - -typedef void (*IceIOErrorHandler) ( - IceConn /* iceConn */ -); - - -/* - * Function prototypes - */ - -_XFUNCPROTOBEGIN - -extern int IceRegisterForProtocolSetup ( - const char * /* protocolName */, - const char * /* vendor */, - const char * /* release */, - int /* versionCount */, - IcePoVersionRec * /* versionRecs */, - int /* authCount */, - const char ** /* authNames */, - IcePoAuthProc * /* authProcs */, - IceIOErrorProc /* IOErrorProc */ -); - -extern int IceRegisterForProtocolReply ( - const char * /* protocolName */, - const char * /* vendor */, - const char * /* release */, - int /* versionCount */, - IcePaVersionRec * /* versionRecs */, - int /* authCount */, - const char ** /* authNames */, - IcePaAuthProc * /* authProcs */, - IceHostBasedAuthProc /* hostBasedAuthProc */, - IceProtocolSetupProc /* protocolSetupProc */, - IceProtocolActivateProc /* protocolActivateProc */, - IceIOErrorProc /* IOErrorProc */ -); - -extern IceConn IceOpenConnection ( - char * /* networkIdsList */, - IcePointer /* context */, - Bool /* mustAuthenticate */, - int /* majorOpcodeCheck */, - int /* errorLength */, - char * /* errorStringRet */ -); - -extern IcePointer IceGetConnectionContext ( - IceConn /* iceConn */ -); - -extern Status IceListenForConnections ( - int * /* countRet */, - IceListenObj ** /* listenObjsRet */, - int /* errorLength */, - char * /* errorStringRet */ -); - -extern Status IceListenForWellKnownConnections ( - char * /* port */, - int * /* countRet */, - IceListenObj ** /* listenObjsRet */, - int /* errorLength */, - char * /* errorStringRet */ -); - -extern int IceGetListenConnectionNumber ( - IceListenObj /* listenObj */ -); - -extern char *IceGetListenConnectionString ( - IceListenObj /* listenObj */ -); - -extern char *IceComposeNetworkIdList ( - int /* count */, - IceListenObj * /* listenObjs */ -); - -extern void IceFreeListenObjs ( - int /* count */, - IceListenObj * /* listenObjs */ -); - -extern void IceSetHostBasedAuthProc ( - IceListenObj /* listenObj */, - IceHostBasedAuthProc /* hostBasedAuthProc */ -); - -extern IceConn IceAcceptConnection ( - IceListenObj /* listenObj */, - IceAcceptStatus * /* statusRet */ -); - -extern void IceSetShutdownNegotiation ( - IceConn /* iceConn */, - Bool /* negotiate */ -); - -extern Bool IceCheckShutdownNegotiation ( - IceConn /* iceConn */ -); - -extern IceCloseStatus IceCloseConnection ( - IceConn /* iceConn */ -); - -extern Status IceAddConnectionWatch ( - IceWatchProc /* watchProc */, - IcePointer /* clientData */ -); - -extern void IceRemoveConnectionWatch ( - IceWatchProc /* watchProc */, - IcePointer /* clientData */ -); - -extern IceProtocolSetupStatus IceProtocolSetup ( - IceConn /* iceConn */, - int /* myOpcode */, - IcePointer /* clientData */, - Bool /* mustAuthenticate */, - int * /* majorVersionRet */, - int * /* minorVersionRet */, - char ** /* vendorRet */, - char ** /* releaseRet */, - int /* errorLength */, - char * /* errorStringRet */ -); - -extern Status IceProtocolShutdown ( - IceConn /* iceConn */, - int /* majorOpcode */ -); - -extern IceProcessMessagesStatus IceProcessMessages ( - IceConn /* iceConn */, - IceReplyWaitInfo * /* replyWait */, - Bool * /* replyReadyRet */ -); - -extern Status IcePing ( - IceConn /* iceConn */, - IcePingReplyProc /* pingReplyProc */, - IcePointer /* clientData */ -); - -extern char *IceAllocScratch ( - IceConn /* iceConn */, - unsigned long /* size */ -); - -extern int IceFlush ( - IceConn /* iceConn */ -); - -extern int IceGetOutBufSize ( - IceConn /* iceConn */ -); - -extern int IceGetInBufSize ( - IceConn /* iceConn */ -); - -extern IceConnectStatus IceConnectionStatus ( - IceConn /* iceConn */ -); - -extern char *IceVendor ( - IceConn /* iceConn */ -); - -extern char *IceRelease ( - IceConn /* iceConn */ -); - -extern int IceProtocolVersion ( - IceConn /* iceConn */ -); - -extern int IceProtocolRevision ( - IceConn /* iceConn */ -); - -extern int IceConnectionNumber ( - IceConn /* iceConn */ -); - -extern char *IceConnectionString ( - IceConn /* iceConn */ -); - -extern unsigned long IceLastSentSequenceNumber ( - IceConn /* iceConn */ -); - -extern unsigned long IceLastReceivedSequenceNumber ( - IceConn /* iceConn */ -); - -extern Bool IceSwapping ( - IceConn /* iceConn */ -); - -extern IceErrorHandler IceSetErrorHandler ( - IceErrorHandler /* handler */ -); - -extern IceIOErrorHandler IceSetIOErrorHandler ( - IceIOErrorHandler /* handler */ -); - -extern char *IceGetPeerName ( - IceConn /* iceConn */ -); - -/* - * Multithread Routines - */ - -extern Status IceInitThreads ( - void -); - -extern void IceAppLockConn ( - IceConn /* iceConn */ -); - -extern void IceAppUnlockConn ( - IceConn /* iceConn */ -); - -_XFUNCPROTOEND - -#endif /* _ICELIB_H_ */ diff --git a/openflow/usr/include/X11/ICE/ICEmsg.h b/openflow/usr/include/X11/ICE/ICEmsg.h deleted file mode 100644 index f6e7121..0000000 --- a/openflow/usr/include/X11/ICE/ICEmsg.h +++ /dev/null @@ -1,300 +0,0 @@ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Author: Ralph Mor, X Consortium -******************************************************************************/ - -#ifndef _ICEMSG_H_ -#define _ICEMSG_H_ - -#include - -#include - -_XFUNCPROTOBEGIN - -/* - * Function prototypes for internal ICElib functions - */ - -extern Status _IceRead ( - IceConn /* iceConn */, - unsigned long /* nbytes */, - char * /* ptr */ -); - -extern void _IceReadSkip ( - IceConn /* iceConn */, - unsigned long /* nbytes */ -); - -extern void _IceWrite ( - IceConn /* iceConn */, - unsigned long /* nbytes */, - char * /* ptr */ -); - - -extern void _IceErrorBadMinor ( - IceConn /* iceConn */, - int /* majorOpcode */, - int /* offendingMinor */, - int /* severity */ -); - -extern void _IceErrorBadState ( - IceConn /* iceConn */, - int /* majorOpcode */, - int /* offendingMinor */, - int /* severity */ -); - -extern void _IceErrorBadLength ( - IceConn /* iceConn */, - int /* majorOpcode */, - int /* offendingMinor */, - int /* severity */ -); - -extern void _IceErrorBadValue ( - IceConn /* iceConn */, - int /* majorOpcode */, - int /* offendingMinor */, - int /* offset */, - int /* length */, - IcePointer /* value */ -); - -extern IcePoAuthStatus _IcePoMagicCookie1Proc ( - IceConn /* iceConn */, - IcePointer * /* authStatePtr */, - Bool /* cleanUp */, - Bool /* swap */, - int /* authDataLen */, - IcePointer /* authData */, - int * /* replyDataLenRet */, - IcePointer * /* replyDataRet */, - char ** /* errorStringRet */ -); - -extern IcePaAuthStatus _IcePaMagicCookie1Proc ( - IceConn /* iceConn */, - IcePointer * /* authStatePtr */, - Bool /* swap */, - int /* authDataLen */, - IcePointer /* authData */, - int * /* replyDataLenRet */, - IcePointer * /* replyDataRet */, - char ** /* errorStringRet */ -); - - -/* - * Macro to check if IO operations are valid on an ICE connection. - */ - -#define IceValidIO(_iceConn) _iceConn->io_ok - - -/* - * Macros for writing messages. - */ - -#define IceGetHeader(_iceConn, _major, _minor, _headerSize, _msgType, _pMsg) \ - if ((_iceConn->outbufptr + _headerSize) > _iceConn->outbufmax) \ - IceFlush (_iceConn); \ - _pMsg = (_msgType *) _iceConn->outbufptr; \ - _pMsg->majorOpcode = _major; \ - _pMsg->minorOpcode = _minor; \ - _pMsg->length = (_headerSize - SIZEOF (iceMsg)) >> 3; \ - _iceConn->outbufptr += _headerSize; \ - _iceConn->send_sequence++ - -#define IceGetHeaderExtra(_iceConn, _major, _minor, _headerSize, _extra, _msgType, _pMsg, _pData) \ - if ((_iceConn->outbufptr + \ - _headerSize + ((_extra) << 3)) > _iceConn->outbufmax) \ - IceFlush (_iceConn); \ - _pMsg = (_msgType *) _iceConn->outbufptr; \ - if ((_iceConn->outbufptr + \ - _headerSize + ((_extra) << 3)) <= _iceConn->outbufmax) \ - _pData = (char *) _pMsg + _headerSize; \ - else \ - _pData = NULL; \ - _pMsg->majorOpcode = _major; \ - _pMsg->minorOpcode = _minor; \ - _pMsg->length = ((_headerSize - SIZEOF (iceMsg)) >> 3) + (_extra); \ - _iceConn->outbufptr += (_headerSize + ((_extra) << 3)); \ - _iceConn->send_sequence++ - -#define IceSimpleMessage(_iceConn, _major, _minor) \ -{ \ - iceMsg *_pMsg; \ - IceGetHeader (_iceConn, _major, _minor, SIZEOF (iceMsg), iceMsg, _pMsg); \ -} - -#define IceErrorHeader(_iceConn, _offendingMajorOpcode, _offendingMinorOpcode, _offendingSequenceNum, _severity, _errorClass, _dataLength) \ -{ \ - iceErrorMsg *_pMsg; \ -\ - IceGetHeader (_iceConn, _offendingMajorOpcode, ICE_Error, \ - SIZEOF (iceErrorMsg), iceErrorMsg, _pMsg); \ - _pMsg->length += (_dataLength); \ - _pMsg->offendingMinorOpcode = (CARD8) _offendingMinorOpcode; \ - _pMsg->severity = (CARD8) _severity; \ - _pMsg->offendingSequenceNum = (CARD32) _offendingSequenceNum; \ - _pMsg->errorClass = (CARD16) _errorClass; \ -} - - -/* - * Write data into the ICE output buffer. - */ - -#define IceWriteData(_iceConn, _bytes, _data) \ -{ \ - if ((_iceConn->outbufptr + (_bytes)) > _iceConn->outbufmax) \ - { \ - IceFlush (_iceConn); \ - _IceWrite (_iceConn, (unsigned long) (_bytes), _data); \ - } \ - else \ - { \ - memcpy (_iceConn->outbufptr, _data, _bytes); \ - _iceConn->outbufptr += (_bytes); \ - } \ -} - -#define IceWriteData16(_iceConn, _bytes, _data) \ - IceWriteData (_iceConn, _bytes, (char *) _data) - -#define IceWriteData32(_iceConn, _bytes, _data) \ - IceWriteData (_iceConn, _bytes, (char *) _data) - - -/* - * The IceSendData macro bypasses copying the data to the - * ICE connection buffer and sends the data directly. If necessary, - * the ICE connection buffer is first flushed. - */ - -#define IceSendData(_iceConn, _bytes, _data) \ -{ \ - if (_iceConn->outbufptr > _iceConn->outbuf) \ - IceFlush (_iceConn); \ - _IceWrite (_iceConn, (unsigned long) (_bytes), _data); \ -} - - -/* - * Write pad bytes. Used to force 32 or 64 bit alignment. - * A maximum of 7 pad bytes can be specified. - */ - -#define IceWritePad(_iceConn, _bytes) \ -{ \ - if ((_iceConn->outbufptr + (_bytes)) > _iceConn->outbufmax) \ - { \ - char _dummy[7] = { 0 }; \ - IceFlush (_iceConn); \ - _IceWrite (_iceConn, (unsigned long) (_bytes), _dummy); \ - } \ - else \ - { \ - _iceConn->outbufptr += (_bytes); \ - } \ -} - - -/* - * Macros for reading messages. - */ - -#define IceReadCompleteMessage(_iceConn, _headerSize, _msgType, _pMsg, _pData)\ -{ \ - unsigned long _bytes; \ - IceReadMessageHeader (_iceConn, _headerSize, _msgType, _pMsg); \ - _bytes = (_pMsg->length << 3) - (_headerSize - SIZEOF (iceMsg)); \ - if ((_iceConn->inbufmax - _iceConn->inbufptr) >= _bytes) \ - { \ - _IceRead (_iceConn, _bytes, _iceConn->inbufptr); \ - _pData = _iceConn->inbufptr; \ - _iceConn->inbufptr += _bytes; \ - } \ - else \ - { \ - _pData = malloc (_bytes); \ - if (_pData) \ - _IceRead (_iceConn, _bytes, _pData); \ - else \ - _IceReadSkip (_iceConn, _bytes); \ - } \ -} - -#define IceDisposeCompleteMessage(_iceConn, _pData) \ - if ((char *) _pData < _iceConn->inbuf || \ - (char *) _pData >= _iceConn->inbufmax) \ - free (_pData); - - -#define IceReadSimpleMessage(_iceConn, _msgType, _pMsg) \ - _pMsg = (_msgType *) (_iceConn->inbuf); - -#define IceReadMessageHeader(_iceConn, _headerSize, _msgType, _pMsg) \ -{ \ - _IceRead (_iceConn, \ - (unsigned long) (_headerSize - SIZEOF (iceMsg)), \ - _iceConn->inbufptr); \ - _pMsg = (_msgType *) (_iceConn->inbuf); \ - _iceConn->inbufptr += (_headerSize - SIZEOF (iceMsg)); \ -} - -#define IceReadData(_iceConn, _bytes, _pData) \ - _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \ - -#define IceReadData16(_iceConn, _swap, _bytes, _pData) \ -{ \ - _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \ -} - -#define IceReadData32(_iceConn, _swap, _bytes, _pData) \ -{ \ - _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \ -} - - -/* - * Read pad bytes (for 32 or 64 bit alignment). - * A maxium of 7 pad bytes can be specified. - */ - -#define IceReadPad(_iceConn, _bytes) \ -{ \ - char _dummy[7]; \ - _IceRead (_iceConn, (unsigned long) (_bytes), _dummy); \ -} - -_XFUNCPROTOEND - -#endif /* _ICEMSG_H_ */ diff --git a/openflow/usr/include/X11/ICE/ICEproto.h b/openflow/usr/include/X11/ICE/ICEproto.h deleted file mode 100644 index 1fcbe6b..0000000 --- a/openflow/usr/include/X11/ICE/ICEproto.h +++ /dev/null @@ -1,175 +0,0 @@ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Author: Ralph Mor, X Consortium -******************************************************************************/ - -#ifndef _ICEPROTO_H_ -#define _ICEPROTO_H_ - -#include - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 data[2]; - CARD32 length B32; -} iceMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD16 errorClass B16; - CARD32 length B32; - CARD8 offendingMinorOpcode; - CARD8 severity; - CARD16 unused B16; - CARD32 offendingSequenceNum B32; - /* n varying values */ - /* p p = pad (n, 8) */ -} iceErrorMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 byteOrder; - CARD8 unused; - CARD32 length B32; -} iceByteOrderMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 versionCount; - CARD8 authCount; - CARD32 length B32; - CARD8 mustAuthenticate; - CARD8 unused[7]; - /* i STRING vendor */ - /* j STRING release */ - /* k LIST of STRING authentication-protocol-names */ - /* m LIST of VERSION version-list */ - /* p p = pad (i+j+k+m, 8) */ -} iceConnectionSetupMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 authIndex; - CARD8 unused1; - CARD32 length B32; - CARD16 authDataLength B16; - CARD8 unused2[6]; - /* n varying data */ - /* p p = pad (n, 8) */ -} iceAuthRequiredMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused1[2]; - CARD32 length B32; - CARD16 authDataLength B16; - CARD8 unused2[6]; - /* n varying data */ - /* p p = pad (n, 8) */ -} iceAuthReplyMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused1[2]; - CARD32 length B32; - CARD16 authDataLength B16; - CARD8 unused2[6]; - /* n varying data */ - /* p p = pad (n, 8) */ -} iceAuthNextPhaseMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 versionIndex; - CARD8 unused; - CARD32 length B32; - /* i STRING vendor */ - /* j STRING release */ - /* p p = pad (i+j, 8) */ -} iceConnectionReplyMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 protocolOpcode; - CARD8 mustAuthenticate; - CARD32 length B32; - CARD8 versionCount; - CARD8 authCount; - CARD8 unused[6]; - /* i STRING protocol-name */ - /* j STRING vendor */ - /* k STRING release */ - /* m LIST of STRING authentication-protocol-names */ - /* n LIST of VERSION version-list */ - /* p p = pad (i+j+k+m+n, 8) */ -} iceProtocolSetupMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 versionIndex; - CARD8 protocolOpcode; - CARD32 length B32; - /* i STRING vendor */ - /* j STRING release */ - /* p p = pad (i+j, 8) */ -} iceProtocolReplyMsg; - -typedef iceMsg icePingMsg; -typedef iceMsg icePingReplyMsg; -typedef iceMsg iceWantToCloseMsg; -typedef iceMsg iceNoCloseMsg; - - -/* - * SIZEOF values. These better be multiples of 8. - */ - -#define sz_iceMsg 8 -#define sz_iceErrorMsg 16 -#define sz_iceByteOrderMsg 8 -#define sz_iceConnectionSetupMsg 16 -#define sz_iceAuthRequiredMsg 16 -#define sz_iceAuthReplyMsg 16 -#define sz_iceAuthNextPhaseMsg 16 -#define sz_iceConnectionReplyMsg 8 -#define sz_iceProtocolSetupMsg 16 -#define sz_iceProtocolReplyMsg 8 -#define sz_icePingMsg 8 -#define sz_icePingReplyMsg 8 -#define sz_iceWantToCloseMsg 8 -#define sz_iceNoCloseMsg 8 - -#endif /* _ICEPROTO_H_ */ diff --git a/openflow/usr/include/X11/ICE/ICEutil.h b/openflow/usr/include/X11/ICE/ICEutil.h deleted file mode 100644 index dbf1490..0000000 --- a/openflow/usr/include/X11/ICE/ICEutil.h +++ /dev/null @@ -1,124 +0,0 @@ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Author: Ralph Mor, X Consortium -******************************************************************************/ - -#ifndef _ICEUTIL_H_ -#define _ICEUTIL_H_ - -#include - -#include - -_XFUNCPROTOBEGIN - -/* - * Data structure for entry in ICE authority file - */ - -typedef struct { - char *protocol_name; - unsigned short protocol_data_length; - char *protocol_data; - char *network_id; - char *auth_name; - unsigned short auth_data_length; - char *auth_data; -} IceAuthFileEntry; - - -/* - * Authentication data maintained in memory. - */ - -typedef struct { - char *protocol_name; - char *network_id; - char *auth_name; - unsigned short auth_data_length; - char *auth_data; -} IceAuthDataEntry; - - -/* - * Return values from IceLockAuthFile - */ - -#define IceAuthLockSuccess 0 /* lock succeeded */ -#define IceAuthLockError 1 /* lock unexpectely failed, check errno */ -#define IceAuthLockTimeout 2 /* lock failed, timeouts expired */ - - -/* - * Function Prototypes - */ - -extern char *IceAuthFileName ( - void -); - -extern int IceLockAuthFile ( - const char * /* file_name */, - int /* retries */, - int /* timeout */, - long /* dead */ -); - -extern void IceUnlockAuthFile ( - const char * /* file_name */ -); - -extern IceAuthFileEntry *IceReadAuthFileEntry ( - FILE * /* auth_file */ -); - -extern void IceFreeAuthFileEntry ( - IceAuthFileEntry * /* auth */ -); - -extern Status IceWriteAuthFileEntry ( - FILE * /* auth_file */, - IceAuthFileEntry * /* auth */ -); - -extern IceAuthFileEntry *IceGetAuthFileEntry ( - const char * /* protocol_name */, - const char * /* network_id */, - const char * /* auth_name */ -); - -extern char *IceGenerateMagicCookie ( - int /* len */ -); - -extern void IceSetPaAuthData ( - int /* numEntries */, - IceAuthDataEntry * /* entries */ -); - -_XFUNCPROTOEND - -#endif /* _ICEUTIL_H_ */ diff --git a/openflow/usr/include/X11/ImUtil.h b/openflow/usr/include/X11/ImUtil.h deleted file mode 100644 index ffdba1a..0000000 --- a/openflow/usr/include/X11/ImUtil.h +++ /dev/null @@ -1,30 +0,0 @@ - -#ifndef _X11_IMUTIL_H_ -#define _X11_IMUTIL_H_ - -extern int -_XGetScanlinePad( - Display *dpy, - int depth); - -extern int -_XGetBitsPerPixel( - Display *dpy, - int depth); - -extern int -_XSetImage( - XImage *srcimg, - register XImage *dstimg, - register int x, - register int y); - -extern int -_XReverse_Bytes( - register unsigned char *bpt, - register int nb); -extern void -_XInitImageFuncPtrs( - register XImage *image); - -#endif /* _X11_IMUTIL_H_ */ diff --git a/openflow/usr/include/X11/InitialI.h b/openflow/usr/include/X11/InitialI.h deleted file mode 100644 index 0827df0..0000000 --- a/openflow/usr/include/X11/InitialI.h +++ /dev/null @@ -1,430 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtinitialI_h -#define _XtinitialI_h - -/**************************************************************** - * - * Displays - * - ****************************************************************/ - -#ifndef X_NOT_POSIX -#ifdef _POSIX_SOURCE -#include -#else -#define _POSIX_SOURCE -#include -#undef _POSIX_SOURCE -#endif -#endif -#ifndef PATH_MAX -#ifdef WIN32 -#define PATH_MAX 512 -#else -#include -#endif -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif -#endif - -#include -#include - -_XFUNCPROTOBEGIN - -typedef struct _TimerEventRec { - struct timeval te_timer_value; - struct _TimerEventRec *te_next; - XtTimerCallbackProc te_proc; - XtAppContext app; - XtPointer te_closure; -} TimerEventRec; - -typedef struct _InputEvent { - XtInputCallbackProc ie_proc; - XtPointer ie_closure; - struct _InputEvent *ie_next; - struct _InputEvent *ie_oq; - XtAppContext app; - int ie_source; - XtInputMask ie_condition; -} InputEvent; - -typedef struct _SignalEventRec { - XtSignalCallbackProc se_proc; - XtPointer se_closure; - struct _SignalEventRec *se_next; - XtAppContext app; - Boolean se_notice; -} SignalEventRec; - -typedef struct _WorkProcRec { - XtWorkProc proc; - XtPointer closure; - struct _WorkProcRec *next; - XtAppContext app; -} WorkProcRec; - - -typedef struct -{ -#ifndef USE_POLL - fd_set rmask; - fd_set wmask; - fd_set emask; -#endif - int nfds; -} FdStruct; - -typedef struct _LangProcRec { - XtLanguageProc proc; - XtPointer closure; -} LangProcRec; - -typedef struct _ProcessContextRec { - XtAppContext defaultAppContext; - XtAppContext appContextList; - ConverterTable globalConverterTable; - LangProcRec globalLangProcRec; -} ProcessContextRec, *ProcessContext; - -typedef struct { - char* start; - char* current; - int bytes_remaining; -} Heap; - -typedef struct _DestroyRec DestroyRec; - - -typedef struct _XtAppStruct { - XtAppContext next; /* link to next app in process context */ - ProcessContext process; /* back pointer to our process context */ - InternalCallbackList destroy_callbacks; - Display **list; - TimerEventRec *timerQueue; - WorkProcRec *workQueue; - InputEvent **input_list; - InputEvent *outstandingQueue; - SignalEventRec *signalQueue; - XrmDatabase errorDB; - XtErrorMsgHandler errorMsgHandler, warningMsgHandler; - XtErrorHandler errorHandler, warningHandler; - struct _ActionListRec *action_table; - ConverterTable converterTable; - unsigned long selectionTimeout; - FdStruct fds; - short count; /* num of assigned entries in list */ - short max; /* allocate size of list */ - short last; - short input_count; - short input_max; /* elts input_list init'd with */ - Boolean sync, being_destroyed, error_inited; -#ifndef NO_IDENTIFY_WINDOWS - Boolean identify_windows; /* debugging hack */ -#endif - Heap heap; - String * fallback_resources; /* Set by XtAppSetFallbackResources. */ - struct _ActionHookRec* action_hook_list; - struct _BlockHookRec* block_hook_list; - int destroy_list_size; /* state data for 2-phase destroy */ - int destroy_count; - int dispatch_level; - DestroyRec* destroy_list; - Widget in_phase2_destroy; - LangProcRec langProcRec; - struct _TMBindCacheRec * free_bindings; - String display_name_tried; - Display **dpy_destroy_list; - int dpy_destroy_count; - Boolean exit_flag; - Boolean rebuild_fdlist; -#ifdef XTHREADS - LockPtr lock_info; - ThreadAppProc lock; - ThreadAppProc unlock; - ThreadAppYieldLockProc yield_lock; - ThreadAppRestoreLockProc restore_lock; - ThreadAppProc free_lock; -#endif -} XtAppStruct; - -extern void _XtHeapInit(Heap* heap); -extern void _XtHeapFree(Heap* heap); - -#ifdef XTTRACEMEMORY - - -extern char *_XtHeapMalloc( - Heap* /* heap */, - Cardinal /* size */, - char * /* file */, - int /* line */ -); - -#define _XtHeapAlloc(heap,bytes) _XtHeapMalloc(heap, bytes, __FILE__, __LINE__) - -#else /* XTTRACEMEMORY */ - -extern char* _XtHeapAlloc( - Heap* /* heap */, - Cardinal /* size */ -); - -#endif /* XTTRACEMEMORY */ - -extern void _XtSetDefaultErrorHandlers( - XtErrorMsgHandler* /* errMsg */, - XtErrorMsgHandler* /* warnMsg */, - XtErrorHandler* /* err */, - XtErrorHandler* /* warn */ -); - -extern void _XtSetDefaultSelectionTimeout( - unsigned long* /* timeout */ -); - -extern XtAppContext _XtDefaultAppContext( - void -); - -extern ProcessContext _XtGetProcessContext( - void -); - -Display * -_XtAppInit( - XtAppContext* /* app_context_return */, - String /* application_class */, - XrmOptionDescRec* /* options */, - Cardinal /* num_options */, - int* /* argc_in_out */, - String** /* argv_in_out */, - String* /* fallback_resources */ -); - -extern void _XtDestroyAppContexts( - void -); - -extern void _XtCloseDisplays( - XtAppContext /* app */ -); - -extern int _XtAppDestroyCount; - -extern int _XtWaitForSomething( - XtAppContext /* app */, - _XtBoolean /* ignoreEvents */, - _XtBoolean /* ignoreTimers */, - _XtBoolean /* ignoreInputs */, - _XtBoolean /* ignoreSignals */, - _XtBoolean /* block */, -#ifdef XTHREADS - _XtBoolean /* drop_lock */, -#endif - unsigned long* /* howlong */ -); - -typedef struct _CaseConverterRec *CaseConverterPtr; -typedef struct _CaseConverterRec { - KeySym start; /* first KeySym valid in converter */ - KeySym stop; /* last KeySym valid in converter */ - XtCaseProc proc; /* case converter function */ - CaseConverterPtr next; /* next converter record */ -} CaseConverterRec; - -typedef struct _ExtensionSelectorRec { - XtExtensionSelectProc proc; - int min, max; - XtPointer client_data; -} ExtSelectRec; - -typedef struct _XtPerDisplayStruct { - InternalCallbackList destroy_callbacks; - Region region; - CaseConverterPtr case_cvt; /* user-registered case converters */ - XtKeyProc defaultKeycodeTranslator; - XtAppContext appContext; - unsigned long keysyms_serial; /* for tracking MappingNotify events */ - KeySym *keysyms; /* keycode to keysym table */ - int keysyms_per_keycode; /* number of keysyms for each keycode*/ - int min_keycode, max_keycode; /* range of keycodes */ - KeySym *modKeysyms; /* keysym values for modToKeysysm */ - ModToKeysymTable *modsToKeysyms; /* modifiers to Keysysms index table*/ - unsigned char isModifier[32]; /* key-is-modifier-p bit table */ - KeySym lock_meaning; /* Lock modifier meaning */ - Modifiers mode_switch; /* keyboard group modifiers */ - Modifiers num_lock; /* keyboard numlock modifiers */ - Boolean being_destroyed; - Boolean rv; /* reverse_video resource */ - XrmName name; /* resolved app name */ - XrmClass class; /* application class */ - Heap heap; - struct _GCrec *GClist; /* support for XtGetGC */ - Drawable **pixmap_tab; /* ditto for XtGetGC */ - String language; /* XPG language string */ - XEvent last_event; /* last event dispatched */ - Time last_timestamp; /* from last event dispatched */ - int multi_click_time; /* for XtSetMultiClickTime */ - struct _TMKeyContextRec* tm_context; /* for XtGetActionKeysym */ - InternalCallbackList mapping_callbacks; /* special case for TM */ - XtPerDisplayInputRec pdi; /* state for modal grabs & kbd focus */ - struct _WWTable *WWtable; /* window to widget table */ - XrmDatabase *per_screen_db; /* per screen resource databases */ - XrmDatabase cmd_db; /* db from command line, if needed */ - XrmDatabase server_db; /* resource property else .Xdefaults */ - XtEventDispatchProc* dispatcher_list; - ExtSelectRec* ext_select_list; - int ext_select_count; - Widget hook_object; -#ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT - Atom rcm_init; /* ResConfig - initialize */ - Atom rcm_data; /* ResConfig - data atom */ -#endif -} XtPerDisplayStruct, *XtPerDisplay; - -typedef struct _PerDisplayTable { - Display *dpy; - XtPerDisplayStruct perDpy; - struct _PerDisplayTable *next; -} PerDisplayTable, *PerDisplayTablePtr; - -extern PerDisplayTablePtr _XtperDisplayList; - -extern XtPerDisplay _XtSortPerDisplayList( - Display* /* dpy */ -); - -extern XtPerDisplay _XtGetPerDisplay( - Display* /* dpy */ -); - -extern XtPerDisplayInputRec* _XtGetPerDisplayInput( - Display* /* dpy */ -); - -#if 0 -#ifdef DEBUG -#define _XtGetPerDisplay(display) \ - ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \ - ? &_XtperDisplayList->perDpy \ - : _XtSortPerDisplayList(display)) -#define _XtGetPerDisplayInput(display) \ - ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \ - ? &_XtperDisplayList->perDpy.pdi \ - : &_XtSortPerDisplayList(display)->pdi) -#else -#define _XtGetPerDisplay(display) \ - ((_XtperDisplayList->dpy == (display)) \ - ? &_XtperDisplayList->perDpy \ - : _XtSortPerDisplayList(display)) -#define _XtGetPerDisplayInput(display) \ - ((_XtperDisplayList->dpy == (display)) \ - ? &_XtperDisplayList->perDpy.pdi \ - : &_XtSortPerDisplayList(display)->pdi) -#endif /*DEBUG*/ -#endif - -extern void _XtDisplayInitialize( - Display* /* dpy */, - XtPerDisplay /* pd */, - _Xconst char* /* name */, - XrmOptionDescRec* /* urlist */, - Cardinal /* num_urs */, - int* /* argc */, - char** /* argv */ -); - -extern void _XtCacheFlushTag( - XtAppContext /* app */, - XtPointer /* tag */ -); - -extern void _XtFreeActions( - struct _ActionListRec* /* action_table */ -); - -extern void _XtDoPhase2Destroy( - XtAppContext /* app */, - int /* dispatch_level */ -); - -extern void _XtDoFreeBindings( - XtAppContext /* app */ -); - -extern void _XtExtensionSelect( - Widget /* widget */ -); - -#define _XtSafeToDestroy(app) ((app)->dispatch_level == 0) - -extern void _XtAllocWWTable( - XtPerDisplay pd -); - -extern void _XtFreeWWTable( - XtPerDisplay pd -); - -extern String _XtGetUserName(String dest, int len); -extern XrmDatabase _XtPreparseCommandLine(XrmOptionDescRec *urlist, - Cardinal num_urs, int argc, String *argv, - String *applName, String *displayName, - String *language); - -_XFUNCPROTOEND - -#endif /* _XtinitialI_h */ diff --git a/openflow/usr/include/X11/Intrinsic.h b/openflow/usr/include/X11/Intrinsic.h deleted file mode 100644 index 794b820..0000000 --- a/openflow/usr/include/X11/Intrinsic.h +++ /dev/null @@ -1,2585 +0,0 @@ -/*********************************************************** -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -/* - -Copyright 1987, 1988, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifndef _XtIntrinsic_h -#define _XtIntrinsic_h - -#include -#include -#include -#include -#ifdef XT_BC -#include /* for R4 compatibility */ -#else -#include -#include /* for XtNewString */ -#endif /* XT_BC else */ - -#define XtSpecificationRelease 6 - -typedef char *String; - -/* We do this in order to get "const" declarations to work right. We - * use _XtString instead of String so that C++ applications can - * #define String to something else if they choose, to avoid conflicts - * with other C++ libraries. - */ -#define _XtString char* - -/* _Xt names are private to Xt implementation, do not use in client code */ -#if NeedWidePrototypes -#define _XtBoolean int -#define _XtDimension unsigned int -#define _XtKeyCode unsigned int -#define _XtPosition int -#define _XtXtEnum unsigned int -#else -#define _XtBoolean Boolean -#define _XtDimension Dimension -#define _XtKeyCode KeyCode -#define _XtPosition Position -#define _XtXtEnum XtEnum -#endif /* NeedWidePrototypes */ - -#include - -#ifdef VMS -#define externalref globalref -#define externaldef(psect) globaldef {"psect"} noshare -#else -#define externalref extern -#define externaldef(psect) -#endif /* VMS */ - -#ifndef FALSE -#define FALSE 0 -#define TRUE 1 -#endif - -#define XtNumber(arr) ((Cardinal) (sizeof(arr) / sizeof(arr[0]))) - -typedef struct _WidgetRec *Widget; -typedef Widget *WidgetList; -typedef struct _WidgetClassRec *WidgetClass; -typedef struct _CompositeRec *CompositeWidget; -typedef struct _XtActionsRec *XtActionList; -typedef struct _XtEventRec *XtEventTable; - -typedef struct _XtAppStruct *XtAppContext; -typedef unsigned long XtValueMask; -typedef unsigned long XtIntervalId; -typedef unsigned long XtInputId; -typedef unsigned long XtWorkProcId; -typedef unsigned long XtSignalId; -typedef unsigned int XtGeometryMask; -typedef unsigned long XtGCMask; /* Mask of values that are used by widget*/ -typedef unsigned long Pixel; /* Index into colormap */ -typedef int XtCacheType; -#define XtCacheNone 0x001 -#define XtCacheAll 0x002 -#define XtCacheByDisplay 0x003 -#define XtCacheRefCount 0x100 - -/**************************************************************** - * - * System Dependent Definitions; see spec for specific range - * requirements. Do not assume every implementation uses the - * same base types! - * - * - * XtArgVal ought to be a union of XtPointer, char *, long, int *, and proc * - * but casting to union types is not really supported. - * - * So the typedef for XtArgVal should be chosen such that - * - * sizeof (XtArgVal) >= sizeof(XtPointer) - * sizeof(char *) - * sizeof(long) - * sizeof(int *) - * sizeof(proc *) - * - * ArgLists rely heavily on the above typedef. - * - ****************************************************************/ -typedef char Boolean; -typedef long XtArgVal; -typedef unsigned char XtEnum; - -typedef unsigned int Cardinal; -typedef unsigned short Dimension; /* Size in pixels */ -typedef short Position; /* Offset from 0 coordinate */ - -typedef void* XtPointer; - -/* The type Opaque is NOT part of the Xt standard, do NOT use it. */ -/* (It remains here only for backward compatibility.) */ -typedef XtPointer Opaque; - -#include -#include -#include -#include -#include - -typedef struct _TranslationData *XtTranslations; -typedef struct _TranslationData *XtAccelerators; -typedef unsigned int Modifiers; - -typedef void (*XtActionProc)( - Widget /* widget */, - XEvent* /* event */, - String* /* params */, - Cardinal* /* num_params */ -); - -typedef XtActionProc* XtBoundActions; - -typedef struct _XtActionsRec{ - String string; - XtActionProc proc; -} XtActionsRec; - -typedef enum { -/* address mode parameter representation */ -/* ------------ ------------------------ */ - XtAddress, /* address */ - XtBaseOffset, /* offset */ - XtImmediate, /* constant */ - XtResourceString, /* resource name string */ - XtResourceQuark, /* resource name quark */ - XtWidgetBaseOffset, /* offset from ancestor */ - XtProcedureArg /* procedure to invoke */ -} XtAddressMode; - -typedef struct { - XtAddressMode address_mode; - XtPointer address_id; - Cardinal size; -} XtConvertArgRec, *XtConvertArgList; - -typedef void (*XtConvertArgProc)( - Widget /* widget */, - Cardinal* /* size */, - XrmValue* /* value */ -); - -typedef struct { - XtGeometryMask request_mode; - Position x, y; - Dimension width, height, border_width; - Widget sibling; - int stack_mode; /* Above, Below, TopIf, BottomIf, Opposite, DontChange */ -} XtWidgetGeometry; - -/* Additions to Xlib geometry requests: ask what would happen, don't do it */ -#define XtCWQueryOnly (1 << 7) - -/* Additions to Xlib stack modes: don't change stack order */ -#define XtSMDontChange 5 - -typedef void (*XtConverter)( /* obsolete */ - XrmValue* /* args */, - Cardinal* /* num_args */, - XrmValue* /* from */, - XrmValue* /* to */ -); - -typedef Boolean (*XtTypeConverter)( - Display* /* dpy */, - XrmValue* /* args */, - Cardinal* /* num_args */, - XrmValue* /* from */, - XrmValue* /* to */, - XtPointer* /* converter_data */ -); - -typedef void (*XtDestructor)( - XtAppContext /* app */, - XrmValue* /* to */, - XtPointer /* converter_data */, - XrmValue* /* args */, - Cardinal* /* num_args */ -); - -typedef Opaque XtCacheRef; - -typedef Opaque XtActionHookId; - -typedef void (*XtActionHookProc)( - Widget /* w */, - XtPointer /* client_data */, - String /* action_name */, - XEvent* /* event */, - String* /* params */, - Cardinal* /* num_params */ -); - -typedef unsigned long XtBlockHookId; - -typedef void (*XtBlockHookProc)( - XtPointer /* client_data */ -); - -typedef void (*XtKeyProc)( - Display* /* dpy */, - _XtKeyCode /* keycode */, - Modifiers /* modifiers */, - Modifiers* /* modifiers_return */, - KeySym* /* keysym_return */ -); - -typedef void (*XtCaseProc)( - Display* /* display */, - KeySym /* keysym */, - KeySym* /* lower_return */, - KeySym* /* upper_return */ -); - -typedef void (*XtEventHandler)( - Widget /* widget */, - XtPointer /* closure */, - XEvent* /* event */, - Boolean* /* continue_to_dispatch */ -); -typedef unsigned long EventMask; - -typedef enum {XtListHead, XtListTail } XtListPosition; - -typedef unsigned long XtInputMask; -#define XtInputNoneMask 0L -#define XtInputReadMask (1L<<0) -#define XtInputWriteMask (1L<<1) -#define XtInputExceptMask (1L<<2) - -typedef void (*XtTimerCallbackProc)( - XtPointer /* closure */, - XtIntervalId* /* id */ -); - -typedef void (*XtInputCallbackProc)( - XtPointer /* closure */, - int* /* source */, - XtInputId* /* id */ -); - -typedef void (*XtSignalCallbackProc)( - XtPointer /* closure */, - XtSignalId* /* id */ -); - -typedef struct { - String name; - XtArgVal value; -} Arg, *ArgList; - -typedef XtPointer XtVarArgsList; - -typedef void (*XtCallbackProc)( - Widget /* widget */, - XtPointer /* closure */, /* data the application registered */ - XtPointer /* call_data */ /* callback specific data */ -); - -typedef struct _XtCallbackRec { - XtCallbackProc callback; - XtPointer closure; -} XtCallbackRec, *XtCallbackList; - -typedef enum { - XtCallbackNoList, - XtCallbackHasNone, - XtCallbackHasSome -} XtCallbackStatus; - -typedef enum { - XtGeometryYes, /* Request accepted. */ - XtGeometryNo, /* Request denied. */ - XtGeometryAlmost, /* Request denied, but willing to take replyBox. */ - XtGeometryDone /* Request accepted and done. */ -} XtGeometryResult; - -typedef enum {XtGrabNone, XtGrabNonexclusive, XtGrabExclusive} XtGrabKind; - -typedef struct { - Widget shell_widget; - Widget enable_widget; -} XtPopdownIDRec, *XtPopdownID; - -typedef struct _XtResource { - String resource_name; /* Resource name */ - String resource_class; /* Resource class */ - String resource_type; /* Representation type desired */ - Cardinal resource_size; /* Size in bytes of representation */ - Cardinal resource_offset;/* Offset from base to put resource value */ - String default_type; /* representation type of specified default */ - XtPointer default_addr; /* Address of default resource */ -} XtResource, *XtResourceList; - -typedef void (*XtResourceDefaultProc)( - Widget /* widget */, - int /* offset */, - XrmValue* /* value */ -); - -typedef String (*XtLanguageProc)( - Display* /* dpy */, - String /* xnl */, - XtPointer /* client_data */ -); - -typedef void (*XtErrorMsgHandler)( - String /* name */, - String /* type */, - String /* class */, - String /* default */, - String* /* params */, - Cardinal* /* num_params */ -); - -typedef void (*XtErrorHandler)( - String /* msg */ -); - -typedef void (*XtCreatePopupChildProc)( - Widget /* shell */ -); - -typedef Boolean (*XtWorkProc)( - XtPointer /* closure */ /* data the application registered */ -); - -typedef struct { - char match; - String substitution; -} SubstitutionRec, *Substitution; - -typedef Boolean (*XtFilePredicate)( - String /* filename */ -); - -typedef XtPointer XtRequestId; - -typedef Boolean (*XtConvertSelectionProc)( - Widget /* widget */, - Atom* /* selection */, - Atom* /* target */, - Atom* /* type_return */, - XtPointer* /* value_return */, - unsigned long* /* length_return */, - int* /* format_return */ -); - -typedef void (*XtLoseSelectionProc)( - Widget /* widget */, - Atom* /* selection */ -); - -typedef void (*XtSelectionDoneProc)( - Widget /* widget */, - Atom* /* selection */, - Atom* /* target */ -); - -typedef void (*XtSelectionCallbackProc)( - Widget /* widget */, - XtPointer /* closure */, - Atom* /* selection */, - Atom* /* type */, - XtPointer /* value */, - unsigned long* /* length */, - int* /* format */ -); - -typedef void (*XtLoseSelectionIncrProc)( - Widget /* widget */, - Atom* /* selection */, - XtPointer /* client_data */ -); - -typedef void (*XtSelectionDoneIncrProc)( - Widget /* widget */, - Atom* /* selection */, - Atom* /* target */, - XtRequestId* /* receiver_id */, - XtPointer /* client_data */ -); - -typedef Boolean (*XtConvertSelectionIncrProc)( - Widget /* widget */, - Atom* /* selection */, - Atom* /* target */, - Atom* /* type */, - XtPointer* /* value */, - unsigned long* /* length */, - int* /* format */, - unsigned long* /* max_length */, - XtPointer /* client_data */, - XtRequestId* /* receiver_id */ -); - -typedef void (*XtCancelConvertSelectionProc)( - Widget /* widget */, - Atom* /* selection */, - Atom* /* target */, - XtRequestId* /* receiver_id */, - XtPointer /* client_data */ -); - -typedef Boolean (*XtEventDispatchProc)( - XEvent* /* event */ -); - -typedef void (*XtExtensionSelectProc)( - Widget /* widget */, - int* /* event_types */, - XtPointer* /* select_data */, - int /* count */, - XtPointer /* client_data */ -); - -/*************************************************************** - * - * Exported Interfaces - * - ****************************************************************/ - -_XFUNCPROTOBEGIN - -extern Boolean XtConvertAndStore( - Widget /* widget */, - _Xconst _XtString /* from_type */, - XrmValue* /* from */, - _Xconst _XtString /* to_type */, - XrmValue* /* to_in_out */ -); - -extern Boolean XtCallConverter( - Display* /* dpy */, - XtTypeConverter /* converter */, - XrmValuePtr /* args */, - Cardinal /* num_args */, - XrmValuePtr /* from */, - XrmValue* /* to_in_out */, - XtCacheRef* /* cache_ref_return */ -); - -extern Boolean XtDispatchEvent( - XEvent* /* event */ -); - -extern Boolean XtCallAcceptFocus( - Widget /* widget */, - Time* /* time */ -); - -extern Boolean XtPeekEvent( /* obsolete */ - XEvent* /* event_return */ -); - -extern Boolean XtAppPeekEvent( - XtAppContext /* app_context */, - XEvent* /* event_return */ -); - -extern Boolean XtIsSubclass( - Widget /* widget */, - WidgetClass /* widgetClass */ -); - -extern Boolean XtIsObject( - Widget /* object */ -); - -extern Boolean _XtCheckSubclassFlag( /* implementation-private */ - Widget /* object */, - _XtXtEnum /* type_flag */ -); - -extern Boolean _XtIsSubclassOf( /* implementation-private */ - Widget /* object */, - WidgetClass /* widget_class */, - WidgetClass /* flag_class */, - _XtXtEnum /* type_flag */ -); - -extern Boolean XtIsManaged( - Widget /* rectobj */ -); - -extern Boolean XtIsRealized( - Widget /* widget */ -); - -extern Boolean XtIsSensitive( - Widget /* widget */ -); - -extern Boolean XtOwnSelection( - Widget /* widget */, - Atom /* selection */, - Time /* time */, - XtConvertSelectionProc /* convert */, - XtLoseSelectionProc /* lose */, - XtSelectionDoneProc /* done */ -); - -extern Boolean XtOwnSelectionIncremental( - Widget /* widget */, - Atom /* selection */, - Time /* time */, - XtConvertSelectionIncrProc /* convert_callback */, - XtLoseSelectionIncrProc /* lose_callback */, - XtSelectionDoneIncrProc /* done_callback */, - XtCancelConvertSelectionProc /* cancel_callback */, - XtPointer /* client_data */ -); - -extern XtGeometryResult XtMakeResizeRequest( - Widget /* widget */, - _XtDimension /* width */, - _XtDimension /* height */, - Dimension* /* width_return */, - Dimension* /* height_return */ -); - -extern void XtTranslateCoords( - Widget /* widget */, - _XtPosition /* x */, - _XtPosition /* y */, - Position* /* rootx_return */, - Position* /* rooty_return */ -); - -extern KeySym* XtGetKeysymTable( - Display* /* dpy */, - KeyCode* /* min_keycode_return */, - int* /* keysyms_per_keycode_return */ -); - -extern void XtKeysymToKeycodeList( - Display* /* dpy */, - KeySym /* keysym */, - KeyCode** /* keycodes_return */, - Cardinal* /* keycount_return */ -); - -extern void XtStringConversionWarning( /* obsolete */ - _Xconst _XtString /* from_value */, - _Xconst _XtString /* to_type */ -); - -extern void XtDisplayStringConversionWarning( - Display* /* dpy */, - _Xconst _XtString /* from_value */, - _Xconst _XtString /* to_type */ -); - -externalref XtConvertArgRec const colorConvertArgs[]; -externalref XtConvertArgRec const screenConvertArg[]; - -extern void XtAppAddConverter( /* obsolete */ - XtAppContext /* app_context */, - _Xconst _XtString /* from_type */, - _Xconst _XtString /* to_type */, - XtConverter /* converter */, - XtConvertArgList /* convert_args */, - Cardinal /* num_args */ -); - -extern void XtAddConverter( /* obsolete */ - _Xconst _XtString /* from_type */, - _Xconst _XtString /* to_type */, - XtConverter /* converter */, - XtConvertArgList /* convert_args */, - Cardinal /* num_args */ -); - -extern void XtSetTypeConverter( - _Xconst _XtString /* from_type */, - _Xconst _XtString /* to_type */, - XtTypeConverter /* converter */, - XtConvertArgList /* convert_args */, - Cardinal /* num_args */, - XtCacheType /* cache_type */, - XtDestructor /* destructor */ -); - -extern void XtAppSetTypeConverter( - XtAppContext /* app_context */, - _Xconst _XtString /* from_type */, - _Xconst _XtString /* to_type */, - XtTypeConverter /* converter */, - XtConvertArgList /* convert_args */, - Cardinal /* num_args */, - XtCacheType /* cache_type */, - XtDestructor /* destructor */ -); - -extern void XtConvert( /* obsolete */ - Widget /* widget */, - _Xconst _XtString /* from_type */, - XrmValue* /* from */, - _Xconst _XtString /* to_type */, - XrmValue* /* to_return */ -); - -extern void XtDirectConvert( /* obsolete */ - XtConverter /* converter */, - XrmValuePtr /* args */, - Cardinal /* num_args */, - XrmValuePtr /* from */, - XrmValue* /* to_return */ -); - -/**************************************************************** - * - * Translation Management - * - ****************************************************************/ - -extern XtTranslations XtParseTranslationTable( - _Xconst _XtString /* table */ -); - -extern XtAccelerators XtParseAcceleratorTable( - _Xconst _XtString /* source */ -); - -extern void XtOverrideTranslations( - Widget /* widget */, - XtTranslations /* translations */ -); - -extern void XtAugmentTranslations( - Widget /* widget */, - XtTranslations /* translations */ -); - -extern void XtInstallAccelerators( - Widget /* destination */, - Widget /* source */ -); - -extern void XtInstallAllAccelerators( - Widget /* destination */, - Widget /* source */ -); - -extern void XtUninstallTranslations( - Widget /* widget */ -); - -extern void XtAppAddActions( - XtAppContext /* app_context */, - XtActionList /* actions */, - Cardinal /* num_actions */ -); - -extern void XtAddActions( /* obsolete */ - XtActionList /* actions */, - Cardinal /* num_actions */ -); - -extern XtActionHookId XtAppAddActionHook( - XtAppContext /* app_context */, - XtActionHookProc /* proc */, - XtPointer /* client_data */ -); - -extern void XtRemoveActionHook( - XtActionHookId /* id */ -); - -extern void XtGetActionList( - WidgetClass /* widget_class */, - XtActionList* /* actions_return */, - Cardinal* /* num_actions_return */ -); - -extern void XtCallActionProc( - Widget /* widget */, - _Xconst _XtString /* action */, - XEvent* /* event */, - String* /* params */, - Cardinal /* num_params */ -); - -extern void XtRegisterGrabAction( - XtActionProc /* action_proc */, - _XtBoolean /* owner_events */, - unsigned int /* event_mask */, - int /* pointer_mode */, - int /* keyboard_mode */ -); - -extern void XtSetMultiClickTime( - Display* /* dpy */, - int /* milliseconds */ -); - -extern int XtGetMultiClickTime( - Display* /* dpy */ -); - -extern KeySym XtGetActionKeysym( - XEvent* /* event */, - Modifiers* /* modifiers_return */ -); - -/*************************************************************** - * - * Keycode and Keysym procedures for translation management - * - ****************************************************************/ - -extern void XtTranslateKeycode( - Display* /* dpy */, - _XtKeyCode /* keycode */, - Modifiers /* modifiers */, - Modifiers* /* modifiers_return */, - KeySym* /* keysym_return */ -); - -extern void XtTranslateKey( - Display* /* dpy */, - _XtKeyCode /* keycode */, - Modifiers /* modifiers */, - Modifiers* /* modifiers_return */, - KeySym* /* keysym_return */ -); - -extern void XtSetKeyTranslator( - Display* /* dpy */, - XtKeyProc /* proc */ -); - -extern void XtRegisterCaseConverter( - Display* /* dpy */, - XtCaseProc /* proc */, - KeySym /* start */, - KeySym /* stop */ -); - -extern void XtConvertCase( - Display* /* dpy */, - KeySym /* keysym */, - KeySym* /* lower_return */, - KeySym* /* upper_return */ -); - -/**************************************************************** - * - * Event Management - * - ****************************************************************/ - -/* XtAllEvents is valid only for XtRemoveEventHandler and - * XtRemoveRawEventHandler; don't use it to select events! - */ -#define XtAllEvents ((EventMask) -1L) - -extern void XtAddEventHandler( - Widget /* widget */, - EventMask /* event_mask */, - _XtBoolean /* nonmaskable */, - XtEventHandler /* proc */, - XtPointer /* closure */ -); - -extern void XtRemoveEventHandler( - Widget /* widget */, - EventMask /* event_mask */, - _XtBoolean /* nonmaskable */, - XtEventHandler /* proc */, - XtPointer /* closure */ -); - -extern void XtAddRawEventHandler( - Widget /* widget */, - EventMask /* event_mask */, - _XtBoolean /* nonmaskable */, - XtEventHandler /* proc */, - XtPointer /* closure */ -); - -extern void XtRemoveRawEventHandler( - Widget /* widget */, - EventMask /* event_mask */, - _XtBoolean /* nonmaskable */, - XtEventHandler /* proc */, - XtPointer /* closure */ -); - -extern void XtInsertEventHandler( - Widget /* widget */, - EventMask /* event_mask */, - _XtBoolean /* nonmaskable */, - XtEventHandler /* proc */, - XtPointer /* closure */, - XtListPosition /* position */ -); - -extern void XtInsertRawEventHandler( - Widget /* widget */, - EventMask /* event_mask */, - _XtBoolean /* nonmaskable */, - XtEventHandler /* proc */, - XtPointer /* closure */, - XtListPosition /* position */ -); - -extern XtEventDispatchProc XtSetEventDispatcher( - Display* /* dpy */, - int /* event_type */, - XtEventDispatchProc /* proc */ -); - -extern Boolean XtDispatchEventToWidget( - Widget /* widget */, - XEvent* /* event */ -); - -extern void XtInsertEventTypeHandler( - Widget /* widget */, - int /* type */, - XtPointer /* select_data */, - XtEventHandler /* proc */, - XtPointer /* closure */, - XtListPosition /* position */ -); - -extern void XtRemoveEventTypeHandler( - Widget /* widget */, - int /* type */, - XtPointer /* select_data */, - XtEventHandler /* proc */, - XtPointer /* closure */ -); - -extern EventMask XtBuildEventMask( - Widget /* widget */ -); - -extern void XtRegisterExtensionSelector( - Display* /* dpy */, - int /* min_event_type */, - int /* max_event_type */, - XtExtensionSelectProc /* proc */, - XtPointer /* client_data */ -); - -extern void XtAddGrab( - Widget /* widget */, - _XtBoolean /* exclusive */, - _XtBoolean /* spring_loaded */ -); - -extern void XtRemoveGrab( - Widget /* widget */ -); - -extern void XtProcessEvent( /* obsolete */ - XtInputMask /* mask */ -); - -extern void XtAppProcessEvent( - XtAppContext /* app_context */, - XtInputMask /* mask */ -); - -extern void XtMainLoop( /* obsolete */ - void -); - -extern void XtAppMainLoop( - XtAppContext /* app_context */ -); - -extern void XtAddExposureToRegion( - XEvent* /* event */, - Region /* region */ -); - -extern void XtSetKeyboardFocus( - Widget /* subtree */, - Widget /* descendent */ -); - -extern Widget XtGetKeyboardFocusWidget( - Widget /* widget */ -); - -extern XEvent* XtLastEventProcessed( - Display* /* dpy */ -); - -extern Time XtLastTimestampProcessed( - Display* /* dpy */ -); - -/**************************************************************** - * - * Event Gathering Routines - * - ****************************************************************/ - -extern XtIntervalId XtAddTimeOut( /* obsolete */ - unsigned long /* interval */, - XtTimerCallbackProc /* proc */, - XtPointer /* closure */ -); - -extern XtIntervalId XtAppAddTimeOut( - XtAppContext /* app_context */, - unsigned long /* interval */, - XtTimerCallbackProc /* proc */, - XtPointer /* closure */ -); - -extern void XtRemoveTimeOut( - XtIntervalId /* timer */ -); - -extern XtInputId XtAddInput( /* obsolete */ - int /* source */, - XtPointer /* condition */, - XtInputCallbackProc /* proc */, - XtPointer /* closure */ -); - -extern XtInputId XtAppAddInput( - XtAppContext /* app_context */, - int /* source */, - XtPointer /* condition */, - XtInputCallbackProc /* proc */, - XtPointer /* closure */ -); - -extern void XtRemoveInput( - XtInputId /* id */ -); - -extern XtSignalId XtAddSignal( - XtSignalCallbackProc /* proc */, - XtPointer /* closure */); - -extern XtSignalId XtAppAddSignal( - XtAppContext /* app_context */, - XtSignalCallbackProc /* proc */, - XtPointer /* closure */ -); - -extern void XtRemoveSignal( - XtSignalId /* id */ -); - -extern void XtNoticeSignal( - XtSignalId /* id */ -); - -extern void XtNextEvent( /* obsolete */ - XEvent* /* event */ -); - -extern void XtAppNextEvent( - XtAppContext /* app_context */, - XEvent* /* event_return */ -); - -#define XtIMXEvent 1 -#define XtIMTimer 2 -#define XtIMAlternateInput 4 -#define XtIMSignal 8 -#define XtIMAll (XtIMXEvent | XtIMTimer | XtIMAlternateInput | XtIMSignal) - -extern Boolean XtPending( /* obsolete */ - void -); - -extern XtInputMask XtAppPending( - XtAppContext /* app_context */ -); - -extern XtBlockHookId XtAppAddBlockHook( - XtAppContext /* app_context */, - XtBlockHookProc /* proc */, - XtPointer /* client_data */ -); - -extern void XtRemoveBlockHook( - XtBlockHookId /* id */ -); - -/**************************************************************** - * - * Random utility routines - * - ****************************************************************/ - -#define XtIsRectObj(object) (_XtCheckSubclassFlag(object, (XtEnum)0x02)) -#define XtIsWidget(object) (_XtCheckSubclassFlag(object, (XtEnum)0x04)) -#define XtIsComposite(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x08)) -#define XtIsConstraint(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x10)) -#define XtIsShell(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x20)) - -#undef XtIsOverrideShell -extern Boolean XtIsOverrideShell(Widget /* object */); -#define XtIsOverrideShell(widget) \ - (_XtIsSubclassOf(widget, (WidgetClass)overrideShellWidgetClass, \ - (WidgetClass)shellWidgetClass, (XtEnum)0x20)) - -#define XtIsWMShell(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x40)) - -#undef XtIsVendorShell -extern Boolean XtIsVendorShell(Widget /* object */); -#define XtIsVendorShell(widget) \ - (_XtIsSubclassOf(widget, (WidgetClass)vendorShellWidgetClass, \ - (WidgetClass)wmShellWidgetClass, (XtEnum)0x40)) - -#undef XtIsTransientShell -extern Boolean XtIsTransientShell(Widget /* object */); -#define XtIsTransientShell(widget) \ - (_XtIsSubclassOf(widget, (WidgetClass)transientShellWidgetClass, \ - (WidgetClass)wmShellWidgetClass, (XtEnum)0x40)) -#define XtIsTopLevelShell(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x80)) - -#undef XtIsApplicationShell -extern Boolean XtIsApplicationShell(Widget /* object */); -#define XtIsApplicationShell(widget) \ - (_XtIsSubclassOf(widget, (WidgetClass)applicationShellWidgetClass, \ - (WidgetClass)topLevelShellWidgetClass, (XtEnum)0x80)) - -#undef XtIsSessionShell -extern Boolean XtIsSessionShell(Widget /* object */); -#define XtIsSessionShell(widget) \ - (_XtIsSubclassOf(widget, (WidgetClass)sessionShellWidgetClass, \ - (WidgetClass)topLevelShellWidgetClass, (XtEnum)0x80)) - -extern void XtRealizeWidget( - Widget /* widget */ -); - -void XtUnrealizeWidget( - Widget /* widget */ -); - -extern void XtDestroyWidget( - Widget /* widget */ -); - -extern void XtSetSensitive( - Widget /* widget */, - _XtBoolean /* sensitive */ -); - -extern void XtSetMappedWhenManaged( - Widget /* widget */, - _XtBoolean /* mapped_when_managed */ -); - -extern Widget XtNameToWidget( - Widget /* reference */, - _Xconst _XtString /* names */ -); - -extern Widget XtWindowToWidget( - Display* /* display */, - Window /* window */ -); - -extern XtPointer XtGetClassExtension( - WidgetClass /* object_class */, - Cardinal /* byte_offset */, - XrmQuark /* type */, - long /* version */, - Cardinal /* record_size */ -); - -/*************************************************************** - * - * Arg lists - * - ****************************************************************/ - - -#define XtSetArg(arg, n, d) \ - ((void)( (arg).name = (n), (arg).value = (XtArgVal)(d) )) - -extern ArgList XtMergeArgLists( - ArgList /* args1 */, - Cardinal /* num_args1 */, - ArgList /* args2 */, - Cardinal /* num_args2 */ -); - -/*************************************************************** - * - * Vararg lists - * - ****************************************************************/ - -#define XtVaNestedList "XtVaNestedList" -#define XtVaTypedArg "XtVaTypedArg" - -extern XtVarArgsList XtVaCreateArgsList( - XtPointer /*unused*/, ... -) _X_SENTINEL(0); - -/************************************************************* - * - * Information routines - * - ************************************************************/ - -#ifndef _XtIntrinsicP_h - -/* We're not included from the private file, so define these */ - -extern Display *XtDisplay( - Widget /* widget */ -); - -extern Display *XtDisplayOfObject( - Widget /* object */ -); - -extern Screen *XtScreen( - Widget /* widget */ -); - -extern Screen *XtScreenOfObject( - Widget /* object */ -); - -extern Window XtWindow( - Widget /* widget */ -); - -extern Window XtWindowOfObject( - Widget /* object */ -); - -extern String XtName( - Widget /* object */ -); - -extern WidgetClass XtSuperclass( - Widget /* object */ -); - -extern WidgetClass XtClass( - Widget /* object */ -); - -extern Widget XtParent( - Widget /* widget */ -); - -#endif /*_XtIntrinsicP_h*/ - -#undef XtMapWidget -extern void XtMapWidget(Widget /* w */); -#define XtMapWidget(widget) XMapWindow(XtDisplay(widget), XtWindow(widget)) - -#undef XtUnmapWidget -extern void XtUnmapWidget(Widget /* w */); -#define XtUnmapWidget(widget) \ - XUnmapWindow(XtDisplay(widget), XtWindow(widget)) - -extern void XtAddCallback( - Widget /* widget */, - _Xconst _XtString /* callback_name */, - XtCallbackProc /* callback */, - XtPointer /* closure */ -); - -extern void XtRemoveCallback( - Widget /* widget */, - _Xconst _XtString /* callback_name */, - XtCallbackProc /* callback */, - XtPointer /* closure */ -); - -extern void XtAddCallbacks( - Widget /* widget */, - _Xconst _XtString /* callback_name */, - XtCallbackList /* callbacks */ -); - -extern void XtRemoveCallbacks( - Widget /* widget */, - _Xconst _XtString /* callback_name */, - XtCallbackList /* callbacks */ -); - -extern void XtRemoveAllCallbacks( - Widget /* widget */, - _Xconst _XtString /* callback_name */ -); - - -extern void XtCallCallbacks( - Widget /* widget */, - _Xconst _XtString /* callback_name */, - XtPointer /* call_data */ -); - -extern void XtCallCallbackList( - Widget /* widget */, - XtCallbackList /* callbacks */, - XtPointer /* call_data */ -); - -extern XtCallbackStatus XtHasCallbacks( - Widget /* widget */, - _Xconst _XtString /* callback_name */ -); - -/**************************************************************** - * - * Geometry Management - * - ****************************************************************/ - - -extern XtGeometryResult XtMakeGeometryRequest( - Widget /* widget */, - XtWidgetGeometry* /* request */, - XtWidgetGeometry* /* reply_return */ -); - -extern XtGeometryResult XtQueryGeometry( - Widget /* widget */, - XtWidgetGeometry* /* intended */, - XtWidgetGeometry* /* preferred_return */ -); - -extern Widget XtCreatePopupShell( - _Xconst _XtString /* name */, - WidgetClass /* widgetClass */, - Widget /* parent */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern Widget XtVaCreatePopupShell( - _Xconst _XtString /* name */, - WidgetClass /* widgetClass */, - Widget /* parent */, - ... -) _X_SENTINEL(0); - -extern void XtPopup( - Widget /* popup_shell */, - XtGrabKind /* grab_kind */ -); - -extern void XtPopupSpringLoaded( - Widget /* popup_shell */ -); - -extern void XtCallbackNone( - Widget /* widget */, - XtPointer /* closure */, - XtPointer /* call_data */ -); - -extern void XtCallbackNonexclusive( - Widget /* widget */, - XtPointer /* closure */, - XtPointer /* call_data */ -); - -extern void XtCallbackExclusive( - Widget /* widget */, - XtPointer /* closure */, - XtPointer /* call_data */ -); - -extern void XtPopdown( - Widget /* popup_shell */ -); - -extern void XtCallbackPopdown( - Widget /* widget */, - XtPointer /* closure */, - XtPointer /* call_data */ -); - -extern void XtMenuPopupAction( - Widget /* widget */, - XEvent* /* event */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern Widget XtCreateWidget( - _Xconst _XtString /* name */, - WidgetClass /* widget_class */, - Widget /* parent */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern Widget XtCreateManagedWidget( - _Xconst _XtString /* name */, - WidgetClass /* widget_class */, - Widget /* parent */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern Widget XtVaCreateWidget( - _Xconst _XtString /* name */, - WidgetClass /* widget */, - Widget /* parent */, - ... -) _X_SENTINEL(0); - -extern Widget XtVaCreateManagedWidget( - _Xconst _XtString /* name */, - WidgetClass /* widget_class */, - Widget /* parent */, - ... -) _X_SENTINEL(0); - -extern Widget XtCreateApplicationShell( /* obsolete */ - _Xconst _XtString /* name */, - WidgetClass /* widget_class */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern Widget XtAppCreateShell( - _Xconst _XtString /* application_name */, - _Xconst _XtString /* application_class */, - WidgetClass /* widget_class */, - Display* /* display */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern Widget XtVaAppCreateShell( - _Xconst _XtString /* application_name */, - _Xconst _XtString /* application_class */, - WidgetClass /* widget_class */, - Display* /* display */, - ... -) _X_SENTINEL(0); - -/**************************************************************** - * - * Toolkit initialization - * - ****************************************************************/ - -extern void XtToolkitInitialize( - void -); - -extern XtLanguageProc XtSetLanguageProc( - XtAppContext /* app_context */, - XtLanguageProc /* proc */, - XtPointer /* client_data */ -); - -extern void XtDisplayInitialize( - XtAppContext /* app_context */, - Display* /* dpy */, - _Xconst _XtString /* application_name */, - _Xconst _XtString /* application_class */, - XrmOptionDescRec* /* options */, - Cardinal /* num_options */, - int* /* argc */, - char** /* argv */ -); - -extern Widget XtOpenApplication( - XtAppContext* /* app_context_return */, - _Xconst _XtString /* application_class */, - XrmOptionDescList /* options */, - Cardinal /* num_options */, - int* /* argc_in_out */, - String* /* argv_in_out */, - String* /* fallback_resources */, - WidgetClass /* widget_class */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern Widget XtVaOpenApplication( - XtAppContext* /* app_context_return */, - _Xconst _XtString /* application_class */, - XrmOptionDescList /* options */, - Cardinal /* num_options */, - int* /* argc_in_out */, - String* /* argv_in_out */, - String* /* fallback_resources */, - WidgetClass /* widget_class */, - ... -) _X_SENTINEL(0); - -extern Widget XtAppInitialize( /* obsolete */ - XtAppContext* /* app_context_return */, - _Xconst _XtString /* application_class */, - XrmOptionDescList /* options */, - Cardinal /* num_options */, - int* /* argc_in_out */, - String* /* argv_in_out */, - String* /* fallback_resources */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern Widget XtVaAppInitialize( /* obsolete */ - XtAppContext* /* app_context_return */, - _Xconst _XtString /* application_class */, - XrmOptionDescList /* options */, - Cardinal /* num_options */, - int* /* argc_in_out */, - String* /* argv_in_out */, - String* /* fallback_resources */, - ... -) _X_SENTINEL(0); - -extern Widget XtInitialize( /* obsolete */ - _Xconst _XtString /* shell_name */, - _Xconst _XtString /* application_class */, - XrmOptionDescRec* /* options */, - Cardinal /* num_options */, - int* /* argc */, - char** /* argv */ -); - -extern Display *XtOpenDisplay( - XtAppContext /* app_context */, - _Xconst _XtString /* display_string */, - _Xconst _XtString /* application_name */, - _Xconst _XtString /* application_class */, - XrmOptionDescRec* /* options */, - Cardinal /* num_options */, - int* /* argc */, - char** /* argv */ -); - -extern XtAppContext XtCreateApplicationContext( - void -); - -extern void XtAppSetFallbackResources( - XtAppContext /* app_context */, - String* /* specification_list */ -); - -extern void XtDestroyApplicationContext( - XtAppContext /* app_context */ -); - -extern void XtInitializeWidgetClass( - WidgetClass /* widget_class */ -); - -extern XtAppContext XtWidgetToApplicationContext( - Widget /* widget */ -); - -extern XtAppContext XtDisplayToApplicationContext( - Display* /* dpy */ -); - -extern XrmDatabase XtDatabase( - Display* /* dpy */ -); - -extern XrmDatabase XtScreenDatabase( - Screen* /* screen */ -); - -extern void XtCloseDisplay( - Display* /* dpy */ -); - -extern void XtGetApplicationResources( - Widget /* widget */, - XtPointer /* base */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern void XtVaGetApplicationResources( - Widget /* widget */, - XtPointer /* base */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ... -) _X_SENTINEL(0); - -extern void XtGetSubresources( - Widget /* widget */, - XtPointer /* base */, - _Xconst _XtString /* name */, - _Xconst _XtString /* class */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern void XtVaGetSubresources( - Widget /* widget */, - XtPointer /* base */, - _Xconst _XtString /* name */, - _Xconst _XtString /* class */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ... -) _X_SENTINEL(0); - -extern void XtSetValues( - Widget /* widget */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern void XtVaSetValues( - Widget /* widget */, - ... -) _X_SENTINEL(0); - -extern void XtGetValues( - Widget /* widget */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern void XtVaGetValues( - Widget /* widget */, - ... -) _X_SENTINEL(0); - -extern void XtSetSubvalues( - XtPointer /* base */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern void XtVaSetSubvalues( - XtPointer /* base */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ... -) _X_SENTINEL(0); - -extern void XtGetSubvalues( - XtPointer /* base */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern void XtVaGetSubvalues( - XtPointer /* base */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ... -) _X_SENTINEL(0); - -extern void XtGetResourceList( - WidgetClass /* widget_class */, - XtResourceList* /* resources_return */, - Cardinal* /* num_resources_return */ -); - -extern void XtGetConstraintResourceList( - WidgetClass /* widget_class */, - XtResourceList* /* resources_return */, - Cardinal* /* num_resources_return */ -); - -#define XtUnspecifiedPixmap ((Pixmap)2) -#define XtUnspecifiedShellInt (-1) -#define XtUnspecifiedWindow ((Window)2) -#define XtUnspecifiedWindowGroup ((Window)3) -#define XtCurrentDirectory "XtCurrentDirectory" -#define XtDefaultForeground "XtDefaultForeground" -#define XtDefaultBackground "XtDefaultBackground" -#define XtDefaultFont "XtDefaultFont" -#define XtDefaultFontSet "XtDefaultFontSet" - -#define XtOffset(p_type,field) \ - ((Cardinal) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL))) - -#ifdef offsetof -#define XtOffsetOf(s_type,field) offsetof(s_type,field) -#else -#define XtOffsetOf(s_type,field) XtOffset(s_type*,field) -#endif - -/************************************************************* - * - * Session Management - * - ************************************************************/ - -typedef struct _XtCheckpointTokenRec { - int save_type; - int interact_style; - Boolean shutdown; - Boolean fast; - Boolean cancel_shutdown; - int phase; - int interact_dialog_type; /* return */ - Boolean request_cancel; /* return */ - Boolean request_next_phase; /* return */ - Boolean save_success; /* return */ - int type; /* implementation private */ - Widget widget; /* implementation private */ -} XtCheckpointTokenRec, *XtCheckpointToken; - -XtCheckpointToken XtSessionGetToken( - Widget /* widget */ -); - -void XtSessionReturnToken( - XtCheckpointToken /* token */ -); - -/************************************************************* - * - * Error Handling - * - ************************************************************/ - -extern XtErrorMsgHandler XtAppSetErrorMsgHandler( - XtAppContext /* app_context */, - XtErrorMsgHandler /* handler */ -); - -extern void XtSetErrorMsgHandler( /* obsolete */ - XtErrorMsgHandler /* handler */ -); - -extern XtErrorMsgHandler XtAppSetWarningMsgHandler( - XtAppContext /* app_context */, - XtErrorMsgHandler /* handler */ -); - -extern void XtSetWarningMsgHandler( /* obsolete */ - XtErrorMsgHandler /* handler */ -); - -extern void XtAppErrorMsg( - XtAppContext /* app_context */, - _Xconst _XtString /* name */, - _Xconst _XtString /* type */, - _Xconst _XtString /* class */, - _Xconst _XtString /* default */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern void XtErrorMsg( /* obsolete */ - _Xconst _XtString /* name */, - _Xconst _XtString /* type */, - _Xconst _XtString /* class */, - _Xconst _XtString /* default */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern void XtAppWarningMsg( - XtAppContext /* app_context */, - _Xconst _XtString /* name */, - _Xconst _XtString /* type */, - _Xconst _XtString /* class */, - _Xconst _XtString /* default */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern void XtWarningMsg( /* obsolete */ - _Xconst _XtString /* name */, - _Xconst _XtString /* type */, - _Xconst _XtString /* class */, - _Xconst _XtString /* default */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern XtErrorHandler XtAppSetErrorHandler( - XtAppContext /* app_context */, - XtErrorHandler /* handler */ -); - -extern void XtSetErrorHandler( /* obsolete */ - XtErrorHandler /* handler */ -); - -extern XtErrorHandler XtAppSetWarningHandler( - XtAppContext /* app_context */, - XtErrorHandler /* handler */ -); - -extern void XtSetWarningHandler( /* obsolete */ - XtErrorHandler /* handler */ -); - -extern void XtAppError( - XtAppContext /* app_context */, - _Xconst _XtString /* message */ -); - -extern void XtError( /* obsolete */ - _Xconst _XtString /* message */ -); - -extern void XtAppWarning( - XtAppContext /* app_context */, - _Xconst _XtString /* message */ -); - -extern void XtWarning( /* obsolete */ - _Xconst _XtString /* message */ -); - -extern XrmDatabase *XtAppGetErrorDatabase( - XtAppContext /* app_context */ -); - -extern XrmDatabase *XtGetErrorDatabase( /* obsolete */ - void -); - -extern void XtAppGetErrorDatabaseText( - XtAppContext /* app_context */, - _Xconst _XtString /* name */, - _Xconst _XtString /* type */, - _Xconst _XtString /* class */, - _Xconst _XtString /* default */, - String /* buffer_return */, - int /* nbytes */, - XrmDatabase /* database */ -); - -extern void XtGetErrorDatabaseText( /* obsolete */ - _Xconst _XtString /* name */, - _Xconst _XtString /* type */, - _Xconst _XtString /* class */, - _Xconst _XtString /* default */, - String /* buffer_return */, - int /* nbytes */ -); - -/**************************************************************** - * - * Memory Management - * - ****************************************************************/ - -extern char *XtMalloc( - Cardinal /* size */ -); - -extern char *XtCalloc( - Cardinal /* num */, - Cardinal /* size */ -); - -extern char *XtRealloc( - char* /* ptr */, - Cardinal /* num */ -); - -extern void XtFree( - char* /* ptr */ -); - -#ifndef _X_RESTRICT_KYWD -# define _X_RESTRICT_KYWD -#endif -extern Cardinal XtAsprintf( - String *new_string, - _Xconst char * _X_RESTRICT_KYWD format, - ... -) _X_ATTRIBUTE_PRINTF(2,3); - -#ifdef XTTRACEMEMORY - -extern char *_XtMalloc( /* implementation-private */ - Cardinal /* size */, - char * /* file */, - int /* line */ -); - -extern char *_XtRealloc( /* implementation-private */ - char * /* ptr */, - Cardinal /* size */, - char * /* file */, - int /* line */ -); - -extern char *_XtCalloc( /* implementation-private */ - Cardinal /* num */, - Cardinal /* size */, - char * /* file */, - int /* line */ -); - -extern void _XtFree( /* implementation-private */ - char * /* ptr */ -); - -#define XtMalloc(size) _XtMalloc(size, __FILE__, __LINE__) -#define XtRealloc(ptr,size) _XtRealloc(ptr, size, __FILE__, __LINE__) -#define XtCalloc(num,size) _XtCalloc(num, size, __FILE__, __LINE__) -#define XtFree(ptr) _XtFree(ptr) - -#endif /* ifdef XTTRACEMEMORY */ - -#define XtNew(type) ((type *) XtMalloc((unsigned) sizeof(type))) - -#undef XtNewString -extern String XtNewString(String /* str */); -#define XtNewString(str) \ - ((str) != NULL ? (strcpy(XtMalloc((unsigned)strlen(str) + 1), str)) : NULL) - -/************************************************************* - * - * Work procs - * - **************************************************************/ - -extern XtWorkProcId XtAddWorkProc( /* obsolete */ - XtWorkProc /* proc */, - XtPointer /* closure */ -); - -extern XtWorkProcId XtAppAddWorkProc( - XtAppContext /* app_context */, - XtWorkProc /* proc */, - XtPointer /* closure */ -); - -extern void XtRemoveWorkProc( - XtWorkProcId /* id */ -); - - -/**************************************************************** - * - * Graphic Context Management - *****************************************************************/ - -extern GC XtGetGC( - Widget /* widget */, - XtGCMask /* valueMask */, - XGCValues* /* values */ -); - -extern GC XtAllocateGC( - Widget /* widget */, - Cardinal /* depth */, - XtGCMask /* valueMask */, - XGCValues* /* values */, - XtGCMask /* dynamicMask */, - XtGCMask /* unusedMask */ -); - -/* This implementation of XtDestroyGC differs from the formal specification - * for historic backwards compatibility reasons. As other implementations - * may conform to the spec, use of XtReleaseGC is strongly encouraged. - */ -extern void XtDestroyGC( /* obsolete */ - GC /* gc */ -); - -extern void XtReleaseGC( - Widget /* object */, - GC /* gc */ -); - - - -extern void XtAppReleaseCacheRefs( - XtAppContext /* app_context */, - XtCacheRef* /* cache_ref */ -); - -extern void XtCallbackReleaseCacheRef( - Widget /* widget */, - XtPointer /* closure */, /* XtCacheRef */ - XtPointer /* call_data */ -); - -extern void XtCallbackReleaseCacheRefList( - Widget /* widget */, - XtPointer /* closure */, /* XtCacheRef* */ - XtPointer /* call_data */ -); - -extern void XtSetWMColormapWindows( - Widget /* widget */, - Widget* /* list */, - Cardinal /* count */ -); - -extern String XtFindFile( - _Xconst _XtString /* path */, - Substitution /* substitutions */, - Cardinal /* num_substitutions */, - XtFilePredicate /* predicate */ -); - -extern String XtResolvePathname( - Display* /* dpy */, - _Xconst _XtString /* type */, - _Xconst _XtString /* filename */, - _Xconst _XtString /* suffix */, - _Xconst _XtString /* path */, - Substitution /* substitutions */, - Cardinal /* num_substitutions */, - XtFilePredicate /* predicate */ -); - -/**************************************************************** - * - * Selections - * - *****************************************************************/ - -#define XT_CONVERT_FAIL (Atom)0x80000001 - -extern void XtDisownSelection( - Widget /* widget */, - Atom /* selection */, - Time /* time */ -); - -extern void XtGetSelectionValue( - Widget /* widget */, - Atom /* selection */, - Atom /* target */, - XtSelectionCallbackProc /* callback */, - XtPointer /* closure */, - Time /* time */ -); - -extern void XtGetSelectionValues( - Widget /* widget */, - Atom /* selection */, - Atom* /* targets */, - int /* count */, - XtSelectionCallbackProc /* callback */, - XtPointer* /* closures */, - Time /* time */ -); - -extern void XtAppSetSelectionTimeout( - XtAppContext /* app_context */, - unsigned long /* timeout */ -); - -extern void XtSetSelectionTimeout( /* obsolete */ - unsigned long /* timeout */ -); - -extern unsigned long XtAppGetSelectionTimeout( - XtAppContext /* app_context */ -); - -extern unsigned long XtGetSelectionTimeout( /* obsolete */ - void -); - -extern XSelectionRequestEvent *XtGetSelectionRequest( - Widget /* widget */, - Atom /* selection */, - XtRequestId /* request_id */ -); - -extern void XtGetSelectionValueIncremental( - Widget /* widget */, - Atom /* selection */, - Atom /* target */, - XtSelectionCallbackProc /* selection_callback */, - XtPointer /* client_data */, - Time /* time */ -); - -extern void XtGetSelectionValuesIncremental( - Widget /* widget */, - Atom /* selection */, - Atom* /* targets */, - int /* count */, - XtSelectionCallbackProc /* callback */, - XtPointer* /* client_data */, - Time /* time */ -); - -extern void XtSetSelectionParameters( - Widget /* requestor */, - Atom /* selection */, - Atom /* type */, - XtPointer /* value */, - unsigned long /* length */, - int /* format */ -); - -extern void XtGetSelectionParameters( - Widget /* owner */, - Atom /* selection */, - XtRequestId /* request_id */, - Atom* /* type_return */, - XtPointer* /* value_return */, - unsigned long* /* length_return */, - int* /* format_return */ -); - -extern void XtCreateSelectionRequest( - Widget /* requestor */, - Atom /* selection */ -); - -extern void XtSendSelectionRequest( - Widget /* requestor */, - Atom /* selection */, - Time /* time */ -); - -extern void XtCancelSelectionRequest( - Widget /* requestor */, - Atom /* selection */ -); - -extern Atom XtReservePropertyAtom( - Widget /* widget */ -); - -extern void XtReleasePropertyAtom( - Widget /* widget */, - Atom /* selection */ -); - -extern void XtGrabKey( - Widget /* widget */, - _XtKeyCode /* keycode */, - Modifiers /* modifiers */, - _XtBoolean /* owner_events */, - int /* pointer_mode */, - int /* keyboard_mode */ -); - -extern void XtUngrabKey( - Widget /* widget */, - _XtKeyCode /* keycode */, - Modifiers /* modifiers */ -); - -extern int XtGrabKeyboard( - Widget /* widget */, - _XtBoolean /* owner_events */, - int /* pointer_mode */, - int /* keyboard_mode */, - Time /* time */ -); - -extern void XtUngrabKeyboard( - Widget /* widget */, - Time /* time */ -); - -extern void XtGrabButton( - Widget /* widget */, - int /* button */, - Modifiers /* modifiers */, - _XtBoolean /* owner_events */, - unsigned int /* event_mask */, - int /* pointer_mode */, - int /* keyboard_mode */, - Window /* confine_to */, - Cursor /* cursor */ -); - -extern void XtUngrabButton( - Widget /* widget */, - unsigned int /* button */, - Modifiers /* modifiers */ -); - -extern int XtGrabPointer( - Widget /* widget */, - _XtBoolean /* owner_events */, - unsigned int /* event_mask */, - int /* pointer_mode */, - int /* keyboard_mode */, - Window /* confine_to */, - Cursor /* cursor */, - Time /* time */ -); - -extern void XtUngrabPointer( - Widget /* widget */, - Time /* time */ -); - -extern void XtGetApplicationNameAndClass( - Display* /* dpy */, - String* /* name_return */, - String* /* class_return */ -); - -extern void XtRegisterDrawable( - Display* /* dpy */, - Drawable /* drawable */, - Widget /* widget */ -); - -extern void XtUnregisterDrawable( - Display* /* dpy */, - Drawable /* drawable */ -); - -extern Widget XtHooksOfDisplay( - Display* /* dpy */ -); - -typedef struct { - String type; - Widget widget; - ArgList args; - Cardinal num_args; -} XtCreateHookDataRec, *XtCreateHookData; - -typedef struct { - String type; - Widget widget; - XtPointer event_data; - Cardinal num_event_data; -} XtChangeHookDataRec, *XtChangeHookData; - -typedef struct { - Widget old, req; - ArgList args; - Cardinal num_args; -} XtChangeHookSetValuesDataRec, *XtChangeHookSetValuesData; - -typedef struct { - String type; - Widget widget; - XtGeometryMask changeMask; - XWindowChanges changes; -} XtConfigureHookDataRec, *XtConfigureHookData; - -typedef struct { - String type; - Widget widget; - XtWidgetGeometry* request; - XtWidgetGeometry* reply; - XtGeometryResult result; -} XtGeometryHookDataRec, *XtGeometryHookData; - -typedef struct { - String type; - Widget widget; -} XtDestroyHookDataRec, *XtDestroyHookData; - -extern void XtGetDisplays( - XtAppContext /* app_context */, - Display*** /* dpy_return */, - Cardinal* /* num_dpy_return */ -); - -extern Boolean XtToolkitThreadInitialize( - void -); - -extern void XtAppSetExitFlag( - XtAppContext /* app_context */ -); - -extern Boolean XtAppGetExitFlag( - XtAppContext /* app_context */ -); - -extern void XtAppLock( - XtAppContext /* app_context */ -); - -extern void XtAppUnlock( - XtAppContext /* app_context */ -); - -/* - * Predefined Resource Converters - */ - - -/* String converters */ - -extern Boolean XtCvtStringToAcceleratorTable( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToAtom( - Display* /* dpy */, - XrmValuePtr /* args */, /* Display */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToBool( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToBoolean( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToCommandArgArray( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToCursor( - Display* /* dpy */, - XrmValuePtr /* args */, /* Display */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToDimension( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToDirectoryString( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToDisplay( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToFile( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToFloat( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToFont( - Display* /* dpy */, - XrmValuePtr /* args */, /* Display */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToFontSet( - Display* /* dpy */, - XrmValuePtr /* args */, /* Display, locale */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToFontStruct( - Display* /* dpy */, - XrmValuePtr /* args */, /* Display */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToGravity( - Display* /* dpy */, - XrmValuePtr /* args */, - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToInitialState( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToInt( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToPixel( - Display* /* dpy */, - XrmValuePtr /* args */, /* Screen, Colormap */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -#define XtCvtStringToPosition XtCvtStringToShort - -extern Boolean XtCvtStringToRestartStyle( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToShort( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToTranslationTable( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToUnsignedChar( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToVisual( - Display* /* dpy */, - XrmValuePtr /* args */, /* Screen, depth */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -/* int converters */ - -extern Boolean XtCvtIntToBool( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtIntToBoolean( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtIntToColor( - Display* /* dpy */, - XrmValuePtr /* args */, /* Screen, Colormap */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -#define XtCvtIntToDimension XtCvtIntToShort - -extern Boolean XtCvtIntToFloat( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtIntToFont( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtIntToPixel( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtIntToPixmap( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -#define XtCvtIntToPosition XtCvtIntToShort - -extern Boolean XtCvtIntToShort( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtIntToUnsignedChar( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -/* Color converter */ - -extern Boolean XtCvtColorToPixel( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -/* Pixel converter */ - -#define XtCvtPixelToColor XtCvtIntToColor - - -_XFUNCPROTOEND - -#endif /*_XtIntrinsic_h*/ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/IntrinsicI.h b/openflow/usr/include/X11/IntrinsicI.h deleted file mode 100644 index 845ab48..0000000 --- a/openflow/usr/include/X11/IntrinsicI.h +++ /dev/null @@ -1,229 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtintrinsicI_h -#define _XtintrinsicI_h - -#include "Xtos.h" -#include "IntrinsicP.h" -#ifdef WIN32 -#define _WILLWINSOCK_ -#endif -#include - -#include "Object.h" -#include "RectObj.h" -#include "ObjectP.h" -#include "RectObjP.h" - -#include "ConvertI.h" -#include "TranslateI.h" - -#define RectObjClassFlag 0x02 -#define WidgetClassFlag 0x04 -#define CompositeClassFlag 0x08 -#define ConstraintClassFlag 0x10 -#define ShellClassFlag 0x20 -#define WMShellClassFlag 0x40 -#define TopLevelClassFlag 0x80 - -/* - * The following macros, though very handy, are not suitable for - * IntrinsicP.h as they violate the rule that arguments are to - * be evaluated exactly once. - */ - -#define XtDisplayOfObject(object) \ - (XtIsWidget(object) ? (object)->core.screen->display : \ - _XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen->display : \ - _XtWindowedAncestor(object)->core.screen->display) - -#define XtScreenOfObject(object) \ - (XtIsWidget(object) ? (object)->core.screen : \ - _XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen : \ - _XtWindowedAncestor(object)->core.screen) - -#define XtWindowOfObject(object) \ - ((XtIsWidget(object) ? (object) : _XtWindowedAncestor(object)) \ - ->core.window) - -#define XtIsManaged(object) \ - (XtIsRectObj(object) ? (object)->core.managed : False) - -#define XtIsSensitive(object) \ - (XtIsRectObj(object) ? ((object)->core.sensitive && \ - (object)->core.ancestor_sensitive) : False) - - -/**************************************************************** - * - * Byte utilities - * - ****************************************************************/ - -#define _XBCOPYFUNC _XtBcopy -#include - -#define XtMemmove(dst, src, size) \ - if ((char *)(dst) != (char *)(src)) { \ - (void) memcpy((char *) (dst), (char *) (src), (int) (size)); \ - } - -#define XtBZero(dst, size) \ - bzero((char *) (dst), (int) (size)) - -#define XtMemcmp(b1, b2, size) \ - memcmp((char *) (b1), (char *) (b2), (int) (size)) - - -/**************************************************************** - * - * Stack cache allocation/free - * - ****************************************************************/ - -#define XtStackAlloc(size, stack_cache_array) \ - ((size) <= sizeof(stack_cache_array) \ - ? (XtPointer)(stack_cache_array) \ - : XtMalloc((unsigned)(size))) - -#define XtStackFree(pointer, stack_cache_array) \ - { if ((pointer) != ((XtPointer)(stack_cache_array))) XtFree(pointer); } - -/*************************************************************** - * - * Filename defines - * - **************************************************************/ - -/* used by XtResolvePathname */ -#ifndef XFILESEARCHPATHDEFAULT -#define XFILESEARCHPATHDEFAULT "/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S" -#endif - -/* the following two were both "X Toolkit " prior to R4 */ -#ifndef XTERROR_PREFIX -#define XTERROR_PREFIX "" -#endif - -#ifndef XTWARNING_PREFIX -#define XTWARNING_PREFIX "" -#endif - -#ifndef ERRORDB -#define ERRORDB "/usr/lib/X11/XtErrorDB" -#endif - -_XFUNCPROTOBEGIN - -extern String XtCXtToolkitError; - -extern void _XtAllocError( - String /* alloc_type */ -); - -extern void _XtCompileResourceList( - XtResourceList /* resources */, - Cardinal /* num_resources */ -); - -extern XtGeometryResult _XtMakeGeometryRequest( - Widget /* widget */, - XtWidgetGeometry* /* request */, - XtWidgetGeometry* /* reply_return */, - Boolean* /* clear_rect_obj */ -); - -extern Boolean _XtIsHookObject( - Widget /* widget */ -); - -extern void _XtAddShellToHookObj( - Widget /* widget */ -); - -/* GCManager.c */ -extern void _XtGClistFree(Display *dpy, XtPerDisplay pd); - -/** GeoTattler stuff */ - -#ifdef XT_GEO_TATTLER - -extern void _XtGeoTab (int); -extern void _XtGeoTrace ( - Widget widget, - ... -) _X_ATTRIBUTE_PRINTF(2,3); - -#define CALLGEOTAT(f) f - -#else /* XT_GEO_TATTLER */ - -#define CALLGEOTAT(f) - -#endif /* XT_GEO_TATTLER */ - -#ifndef XTTRACEMEMORY - -extern char* __XtMalloc ( - unsigned /* size */ -); -extern char* __XtCalloc ( - unsigned /* num */, - unsigned /* size */ -); - -#else - -#define __XtMalloc XtMalloc -#define __XtCalloc XtCalloc -#endif - -_XFUNCPROTOEND - -#endif /* _XtintrinsicI_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/IntrinsicP.h b/openflow/usr/include/X11/IntrinsicP.h deleted file mode 100644 index f2ded6f..0000000 --- a/openflow/usr/include/X11/IntrinsicP.h +++ /dev/null @@ -1,329 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtintrinsicP_h -#define _XtintrinsicP_h - -#include - -/* - * Field sizes and offsets of XrmResource must match those of XtResource. - * Type long is used instead of XrmQuark here because XrmQuark and String - * are not the same size on all systems. - */ -typedef struct { - long xrm_name; /* Resource name quark */ - long xrm_class; /* Resource class quark */ - long xrm_type; /* Resource representation type quark */ - Cardinal xrm_size; /* Size in bytes of representation */ - int xrm_offset; /* -offset-1 */ - long xrm_default_type; /* Default representation type quark */ - XtPointer xrm_default_addr; /* Default resource address */ -} XrmResource, *XrmResourceList; - -typedef unsigned long XtVersionType; - -#define XT_VERSION 11 -#ifndef XT_REVISION -#define XT_REVISION 6 -#endif -#define XtVersion (XT_VERSION * 1000 + XT_REVISION) -#define XtVersionDontCheck 0 - -typedef void (*XtProc)( - void -); - -typedef void (*XtWidgetClassProc)( - WidgetClass /* class */ -); - -typedef void (*XtWidgetProc)( - Widget /* widget */ -); - -typedef Boolean (*XtAcceptFocusProc)( - Widget /* widget */, - Time* /* time */ -); - -typedef void (*XtArgsProc)( - Widget /* widget */, - ArgList /* args */, - Cardinal* /* num_args */ -); - -typedef void (*XtInitProc)( - Widget /* request */, - Widget /* new */, - ArgList /* args */, - Cardinal* /* num_args */ -); - -typedef Boolean (*XtSetValuesFunc)( - Widget /* old */, - Widget /* request */, - Widget /* new */, - ArgList /* args */, - Cardinal* /* num_args */ -); - -typedef Boolean (*XtArgsFunc)( - Widget /* widget */, - ArgList /* args */, - Cardinal* /* num_args */ -); - -typedef void (*XtAlmostProc)( - Widget /* old */, - Widget /* new */, - XtWidgetGeometry* /* request */, - XtWidgetGeometry* /* reply */ -); - -typedef void (*XtExposeProc)( - Widget /* widget */, - XEvent* /* event */, - Region /* region */ -); - -/* compress_exposure options*/ -#define XtExposeNoCompress ((XtEnum)False) -#define XtExposeCompressSeries ((XtEnum)True) -#define XtExposeCompressMultiple 2 -#define XtExposeCompressMaximal 3 - -/* modifiers */ -#define XtExposeGraphicsExpose 0x10 -#define XtExposeGraphicsExposeMerged 0x20 -#define XtExposeNoExpose 0x40 -#define XtExposeNoRegion 0x80 - -typedef void (*XtRealizeProc)( - Widget /* widget */, - XtValueMask* /* mask */, - XSetWindowAttributes* /* attributes */ -); - -typedef XtGeometryResult (*XtGeometryHandler)( - Widget /* widget */, - XtWidgetGeometry* /* request */, - XtWidgetGeometry* /* reply */ -); - -typedef void (*XtStringProc)( - Widget /* widget */, - String /* str */ -); - -typedef struct { - String name; /* resource name */ - String type; /* representation type name */ - XtArgVal value; /* representation */ - int size; /* size of representation */ -} XtTypedArg, *XtTypedArgList; - -typedef void (*XtAllocateProc)( - WidgetClass /* widget_class */, - Cardinal * /* constraint_size */, - Cardinal * /* more_bytes */, - ArgList /* args */, - Cardinal * /* num_args */, - XtTypedArgList /* typed_args */, - Cardinal * /* num_typed_args */, - Widget * /* widget_return */, - XtPointer * /* more_bytes_return */ -); - -typedef void (*XtDeallocateProc)( - Widget /* widget */, - XtPointer /* more_bytes */ -); - -struct _XtStateRec; /* Forward declare before use for C++ */ - -typedef struct _XtTMRec { - XtTranslations translations; /* private to Translation Manager */ - XtBoundActions proc_table; /* procedure bindings for actions */ - struct _XtStateRec *current_state; /* Translation Manager state ptr */ - unsigned long lastEventTime; -} XtTMRec, *XtTM; - -#include -#include -#include -#include -#include - -#define XtDisplay(widget) DisplayOfScreen((widget)->core.screen) -#define XtScreen(widget) ((widget)->core.screen) -#define XtWindow(widget) ((widget)->core.window) - -#define XtClass(widget) ((widget)->core.widget_class) -#define XtSuperclass(widget) (XtClass(widget)->core_class.superclass) -#define XtIsRealized(object) (XtWindowOfObject(object) != None) -#define XtParent(widget) ((widget)->core.parent) - -#undef XtIsRectObj -extern Boolean XtIsRectObj(Widget); -#define XtIsRectObj(obj) \ - (((Object)(obj))->object.widget_class->core_class.class_inited & 0x02) - -#undef XtIsWidget -extern Boolean XtIsWidget(Widget); -#define XtIsWidget(obj) \ - (((Object)(obj))->object.widget_class->core_class.class_inited & 0x04) - -#undef XtIsComposite -extern Boolean XtIsComposite(Widget); -#define XtIsComposite(obj) \ - (((Object)(obj))->object.widget_class->core_class.class_inited & 0x08) - -#undef XtIsConstraint -extern Boolean XtIsConstraint(Widget); -#define XtIsConstraint(obj) \ - (((Object)(obj))->object.widget_class->core_class.class_inited & 0x10) - -#undef XtIsShell -extern Boolean XtIsShell(Widget); -#define XtIsShell(obj) \ - (((Object)(obj))->object.widget_class->core_class.class_inited & 0x20) - -#undef XtIsWMShell -extern Boolean XtIsWMShell(Widget); -#define XtIsWMShell(obj) \ - (((Object)(obj))->object.widget_class->core_class.class_inited & 0x40) - -#undef XtIsTopLevelShell -extern Boolean XtIsTopLevelShell(Widget); -#define XtIsTopLevelShell(obj) \ - (((Object)(obj))->object.widget_class->core_class.class_inited & 0x80) - -#ifdef DEBUG -#define XtCheckSubclass(w, widget_class_ptr, message) \ - if (!XtIsSubclass(((Widget)(w)), (widget_class_ptr))) { \ - String params[3]; \ - Cardinal num_params = 3; \ - params[0] = ((Widget)(w))->core.widget_class->core_class.class_name;\ - params[1] = (widget_class_ptr)->core_class.class_name; \ - params[2] = (message); \ - XtAppErrorMsg(XtWidgetToApplicationContext((Widget)(w)), \ - "subclassMismatch", "xtCheckSubclass", "XtToolkitError", \ - "Widget class %s found when subclass of %s expected: %s",\ - params, &num_params); \ - } -#else -#define XtCheckSubclass(w, widget_class, message) /* nothing */ -#endif - -_XFUNCPROTOBEGIN - -extern Widget _XtWindowedAncestor( /* internal; implementation-dependent */ - Widget /* object */ -); - -#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(LIBXT_COMPILATION) -__declspec(dllimport) -#else -extern -#endif -void _XtInherit( - void -); - -extern void _XtHandleFocus( - Widget /* widget */, - XtPointer /* client_data */, - XEvent * /* event */, - Boolean * /* cont */); - -extern void XtCreateWindow( - Widget /* widget */, - unsigned int /* window_class */, - Visual* /* visual */, - XtValueMask /* value_mask */, - XSetWindowAttributes* /* attributes */ -); - -extern void XtResizeWidget( - Widget /* widget */, - _XtDimension /* width */, - _XtDimension /* height */, - _XtDimension /* border_width */ -); - -extern void XtMoveWidget( - Widget /* widget */, - _XtPosition /* x */, - _XtPosition /* y */ -); - -extern void XtConfigureWidget( - Widget /* widget */, - _XtPosition /* x */, - _XtPosition /* y */, - _XtDimension /* width */, - _XtDimension /* height */, - _XtDimension /* border_width */ -); - -extern void XtResizeWindow( - Widget /* widget */ -); - -extern void XtProcessLock( - void -); - -extern void XtProcessUnlock( - void -); - -_XFUNCPROTOEND - -#endif /* _XtIntrinsicP_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/Object.h b/openflow/usr/include/X11/Object.h deleted file mode 100644 index 4be1f39..0000000 --- a/openflow/usr/include/X11/Object.h +++ /dev/null @@ -1,63 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtObject_h -#define _XtObject_h - -_XFUNCPROTOBEGIN - -typedef struct _ObjectRec *Object; -typedef struct _ObjectClassRec *ObjectClass; - -#ifndef VMS -externalref WidgetClass objectClass; -#endif - -_XFUNCPROTOEND - -#endif /* _XtObject_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/ObjectP.h b/openflow/usr/include/X11/ObjectP.h deleted file mode 100644 index 6e296f7..0000000 --- a/openflow/usr/include/X11/ObjectP.h +++ /dev/null @@ -1,141 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _Xt_ObjectP_h_ -#define _Xt_ObjectP_h_ - -#include - -_XFUNCPROTOBEGIN - -/********************************************************** - * Object Instance Data Structures - * - **********************************************************/ -/* these fields match CorePart and can not be changed */ - -typedef struct _ObjectPart { - Widget self; /* pointer to widget itself */ - WidgetClass widget_class; /* pointer to Widget's ClassRec */ - Widget parent; /* parent widget */ - XrmName xrm_name; /* widget resource name quarkified */ - Boolean being_destroyed; /* marked for destroy */ - XtCallbackList destroy_callbacks; /* who to call when widget destroyed */ - XtPointer constraints; /* constraint record */ -} ObjectPart; - -typedef struct _ObjectRec { - ObjectPart object; -} ObjectRec; - -/******************************************************** - * Object Class Data Structures - * - ********************************************************/ -/* these fields match CoreClassPart and can not be changed */ -/* ideally these structures would only contain the fields required; - but because the CoreClassPart cannot be changed at this late date - extraneous fields are necessary to make the field offsets match */ - -typedef struct _ObjectClassPart { - - WidgetClass superclass; /* pointer to superclass ClassRec */ - String class_name; /* widget resource class name */ - Cardinal widget_size; /* size in bytes of widget record */ - XtProc class_initialize; /* class initialization proc */ - XtWidgetClassProc class_part_initialize; /* dynamic initialization */ - XtEnum class_inited; /* has class been initialized? */ - XtInitProc initialize; /* initialize subclass fields */ - XtArgsProc initialize_hook; /* notify that initialize called */ - XtProc obj1; /* NULL */ - XtPointer obj2; /* NULL */ - Cardinal obj3; /* NULL */ - XtResourceList resources; /* resources for subclass fields */ - Cardinal num_resources; /* number of entries in resources */ - XrmClass xrm_class; /* resource class quarkified */ - Boolean obj4; /* NULL */ - XtEnum obj5; /* NULL */ - Boolean obj6; /* NULL */ - Boolean obj7; /* NULL */ - XtWidgetProc destroy; /* free data for subclass pointers */ - XtProc obj8; /* NULL */ - XtProc obj9; /* NULL */ - XtSetValuesFunc set_values; /* set subclass resource values */ - XtArgsFunc set_values_hook; /* notify that set_values called */ - XtProc obj10; /* NULL */ - XtArgsProc get_values_hook; /* notify that get_values called */ - XtProc obj11; /* NULL */ - XtVersionType version; /* version of intrinsics used */ - XtPointer callback_private; /* list of callback offsets */ - String obj12; /* NULL */ - XtProc obj13; /* NULL */ - XtProc obj14; /* NULL */ - XtPointer extension; /* pointer to extension record */ -}ObjectClassPart; - -typedef struct { - XtPointer next_extension; /* 1st 4 required for all extension records */ - XrmQuark record_type; /* NULLQUARK; when on ObjectClassPart */ - long version; /* must be XtObjectExtensionVersion */ - Cardinal record_size; /* sizeof(ObjectClassExtensionRec) */ - XtAllocateProc allocate; - XtDeallocateProc deallocate; -} ObjectClassExtensionRec, *ObjectClassExtension; - -typedef struct _ObjectClassRec { - ObjectClassPart object_class; -} ObjectClassRec; - -externalref ObjectClassRec objectClassRec; - -_XFUNCPROTOEND - -#define XtObjectExtensionVersion 1L -#define XtInheritAllocate ((XtAllocateProc) _XtInherit) -#define XtInheritDeallocate ((XtDeallocateProc) _XtInherit) - -#endif /*_Xt_ObjectP_h_*/ diff --git a/openflow/usr/include/X11/PassivGraI.h b/openflow/usr/include/X11/PassivGraI.h deleted file mode 100644 index 6b8cb52..0000000 --- a/openflow/usr/include/X11/PassivGraI.h +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************** - -Copyright 1988 by Hewlett-Packard Company -Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard - -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that copyright notice and this permission -notice appear in supporting documentation, and that the names of -Hewlett-Packard or Digital not be used in advertising or -publicity pertaining to distribution of the software without specific, -written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -********************************************************/ - -/* - -Copyright 1987, 1988, 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifndef _PDI_h_ -#define _PDI_h_ - - -#define KEYBOARD TRUE -#define POINTER FALSE - -_XFUNCPROTOBEGIN - -typedef enum { - XtNoServerGrab, - XtPassiveServerGrab, - XtActiveServerGrab, - XtPseudoPassiveServerGrab, - XtPseudoActiveServerGrab -}XtServerGrabType; - -typedef struct _XtServerGrabRec { - struct _XtServerGrabRec *next; - Widget widget; - unsigned int ownerEvents:1; - unsigned int pointerMode:1; - unsigned int keyboardMode:1; - unsigned int hasExt:1; - unsigned int confineToIsWidgetWin:1; - KeyCode keybut; - unsigned short modifiers; - unsigned short eventMask; -} XtServerGrabRec, *XtServerGrabPtr; - -typedef struct _XtGrabExtRec { - Mask *pKeyButMask; - Mask *pModifiersMask; - Window confineTo; - Cursor cursor; -} XtServerGrabExtRec, *XtServerGrabExtPtr; - -#define GRABEXT(p) ((XtServerGrabExtPtr)((p)+1)) - -typedef struct _XtDeviceRec{ - XtServerGrabRec grab; /* need copy in order to protect - during grab */ - XtServerGrabType grabType; -}XtDeviceRec, *XtDevice; - -#define XtMyAncestor 0 -#define XtMyDescendant 1 -#define XtMyCousin 2 -#define XtMySelf 3 -#define XtUnrelated 4 -typedef char XtGeneology; /* do not use an enum makes PerWidgetInput larger */ - -typedef struct { - Widget focusKid; - XtServerGrabPtr keyList, ptrList; - Widget queryEventDescendant; - unsigned int map_handler_added:1; - unsigned int realize_handler_added:1; - unsigned int active_handler_added:1; - unsigned int haveFocus:1; - XtGeneology focalPoint; -}XtPerWidgetInputRec, *XtPerWidgetInput; - -typedef struct XtPerDisplayInputRec{ - XtGrabList grabList; - XtDeviceRec keyboard, pointer; - KeyCode activatingKey; - Widget *trace; - int traceDepth, traceMax; - Widget focusWidget; -}XtPerDisplayInputRec, *XtPerDisplayInput; - -#define IsServerGrab(g) ((g == XtPassiveServerGrab) ||\ - (g == XtActiveServerGrab)) - -#define IsAnyGrab(g) ((g == XtPassiveServerGrab) ||\ - (g == XtActiveServerGrab) ||\ - (g == XtPseudoPassiveServerGrab)) - -#define IsEitherPassiveGrab(g) ((g == XtPassiveServerGrab) ||\ - (g == XtPseudoPassiveServerGrab)) - -#define IsPseudoGrab(g) ((g == XtPseudoPassiveServerGrab)) - -extern void _XtDestroyServerGrabs( - Widget /* w */, - XtPointer /* pwi */, /*XtPerWidgetInput*/ - XtPointer /* call_data */ -); - -extern XtPerWidgetInput _XtGetPerWidgetInput( - Widget /* widget */, - _XtBoolean /* create */ -); - -extern XtServerGrabPtr _XtCheckServerGrabsOnWidget( - XEvent* /* event */, - Widget /* widget */, - _XtBoolean /* isKeyboard */ -); - -/* -extern XtGrabList* _XtGetGrabList( XtPerDisplayInput ); -*/ - -#define _XtGetGrabList(pdi) (&(pdi)->grabList) - -extern void _XtFreePerWidgetInput( - Widget /* w */, - XtPerWidgetInput /* pwi */ -); - -extern Widget _XtProcessKeyboardEvent( - XKeyEvent* /* event */, - Widget /* widget */, - XtPerDisplayInput /* pdi */ -); - -extern Widget _XtProcessPointerEvent( - XButtonEvent* /* event */, - Widget /* widget */, - XtPerDisplayInput /* pdi */ -); - -extern void _XtRegisterPassiveGrabs( - Widget /* widget */ -); - -extern void _XtClearAncestorCache( - Widget /* widget */ -); - -_XFUNCPROTOEND - -#endif /* _PDI_h_ */ diff --git a/openflow/usr/include/X11/RectObj.h b/openflow/usr/include/X11/RectObj.h deleted file mode 100644 index fba883a..0000000 --- a/openflow/usr/include/X11/RectObj.h +++ /dev/null @@ -1,63 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtRect_h -#define _XtRect_h - -_XFUNCPROTOBEGIN - -typedef struct _RectObjRec *RectObj; -typedef struct _RectObjClassRec *RectObjClass; - -#ifndef VMS -externalref WidgetClass rectObjClass; -#endif - -_XFUNCPROTOEND - -#endif /* _XtRect_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/RectObjP.h b/openflow/usr/include/X11/RectObjP.h deleted file mode 100644 index bb5a7d3..0000000 --- a/openflow/usr/include/X11/RectObjP.h +++ /dev/null @@ -1,131 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _Xt_RectObjP_h_ -#define _Xt_RectObjP_h_ - -#include -#include - -_XFUNCPROTOBEGIN - -/********************************************************** - * Rectangle Object Instance Data Structures - * - **********************************************************/ -/* these fields match CorePart and can not be changed */ - -typedef struct _RectObjPart { - Position x, y; /* rectangle position */ - Dimension width, height; /* rectangle dimensions */ - Dimension border_width; /* rectangle border width */ - Boolean managed; /* is widget geometry managed? */ - Boolean sensitive; /* is widget sensitive to user events*/ - Boolean ancestor_sensitive; /* are all ancestors sensitive? */ -}RectObjPart; - -typedef struct _RectObjRec { - ObjectPart object; - RectObjPart rectangle; -} RectObjRec; - - - -/******************************************************** - * Rectangle Object Class Data Structures - * - ********************************************************/ -/* these fields match CoreClassPart and can not be changed */ -/* ideally these structures would only contain the fields required; - but because the CoreClassPart cannot be changed at this late date - extraneous fields are necessary to make the field offsets match */ - -typedef struct _RectObjClassPart { - - WidgetClass superclass; /* pointer to superclass ClassRec */ - String class_name; /* widget resource class name */ - Cardinal widget_size; /* size in bytes of widget record */ - XtProc class_initialize; /* class initialization proc */ - XtWidgetClassProc class_part_initialize; /* dynamic initialization */ - XtEnum class_inited; /* has class been initialized? */ - XtInitProc initialize; /* initialize subclass fields */ - XtArgsProc initialize_hook; /* notify that initialize called */ - XtProc rect1; /* NULL */ - XtPointer rect2; /* NULL */ - Cardinal rect3; /* NULL */ - XtResourceList resources; /* resources for subclass fields */ - Cardinal num_resources; /* number of entries in resources */ - XrmClass xrm_class; /* resource class quarkified */ - Boolean rect4; /* NULL */ - XtEnum rect5; /* NULL */ - Boolean rect6; /* NULL */ - Boolean rect7; /* NULL */ - XtWidgetProc destroy; /* free data for subclass pointers */ - XtWidgetProc resize; /* geom manager changed widget size */ - XtExposeProc expose; /* rediplay rectangle */ - XtSetValuesFunc set_values; /* set subclass resource values */ - XtArgsFunc set_values_hook; /* notify that set_values called */ - XtAlmostProc set_values_almost; /* set values almost for geometry */ - XtArgsProc get_values_hook; /* notify that get_values called */ - XtProc rect9; /* NULL */ - XtVersionType version; /* version of intrinsics used */ - XtPointer callback_private; /* list of callback offsets */ - String rect10; /* NULL */ - XtGeometryHandler query_geometry; /* return preferred geometry */ - XtProc rect11; /* NULL */ - XtPointer extension; /* pointer to extension record */ -} RectObjClassPart; - -typedef struct _RectObjClassRec { - RectObjClassPart rect_class; -} RectObjClassRec; - -externalref RectObjClassRec rectObjClassRec; - -_XFUNCPROTOEND - -#endif /*_Xt_RectObjP_h_*/ diff --git a/openflow/usr/include/X11/ResConfigP.h b/openflow/usr/include/X11/ResConfigP.h deleted file mode 100644 index 1e1d85a..0000000 --- a/openflow/usr/include/X11/ResConfigP.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ -/***************************************************************** - -(C) COPYRIGHT International Business Machines Corp. 1992,1997 - All Rights Reserved - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE IBM CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the IBM Corporation shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the IBM -Corporation. - -******************************************************************/ - -#ifndef _RESCONFIGP_H -#define _RESCONFIGP_H - -#include - -_XFUNCPROTOBEGIN - -/* - * Atom names for resource configuration management customization tool. - */ -#define RCM_DATA "Custom Data" -#define RCM_INIT "Custom Init" - -extern void _XtResourceConfigurationEH( - Widget /* w */, - XtPointer /* client_data */, - XEvent * /* event */ -); - -_XFUNCPROTOEND - -#endif diff --git a/openflow/usr/include/X11/ResourceI.h b/openflow/usr/include/X11/ResourceI.h deleted file mode 100644 index 4533f06..0000000 --- a/openflow/usr/include/X11/ResourceI.h +++ /dev/null @@ -1,100 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -/**************************************************************** - * - * Resources - * - ****************************************************************/ - -#ifndef _XtresourceI_h -#define _XtresourceI_h - -#define StringToQuark(string) XrmStringToQuark(string) -#define StringToName(string) XrmStringToName(string) -#define StringToClass(string) XrmStringToClass(string) - -_XFUNCPROTOBEGIN - -extern void _XtDependencies( - XtResourceList * /* class_resp */, - Cardinal * /* class_num_resp */, - XrmResourceList * /* super_res */, - Cardinal /* super_num_res */, - Cardinal /* super_widget_size */); - -extern void _XtResourceDependencies( - WidgetClass /* wc */ -); - -extern void _XtConstraintResDependencies( - ConstraintWidgetClass /* wc */ -); - -extern XtCacheRef* _XtGetResources( - Widget /* w */, - ArgList /* args */, - Cardinal /* num_args */, - XtTypedArgList /* typed_args */, - Cardinal* /* num_typed_args */ -); - -extern void _XtCopyFromParent( - Widget /* widget */, - int /* offset */, - XrmValue* /* value */ -); - -extern void _XtCopyToArg(char *src, XtArgVal *dst, unsigned int size); -extern void _XtCopyFromArg(XtArgVal src, char *dst, unsigned int size); -extern XrmResourceList* _XtCreateIndirectionTable(XtResourceList resources, - Cardinal num_resources); -extern void _XtResourceListInitialize(void); - -_XFUNCPROTOEND - -#endif /* _XtresourceI_h */ diff --git a/openflow/usr/include/X11/SM/SM.h b/openflow/usr/include/X11/SM/SM.h deleted file mode 100644 index 1af5ae8..0000000 --- a/openflow/usr/include/X11/SM/SM.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/* - * Author: Ralph Mor, X Consortium - */ - -#ifndef _SM_H_ -#define _SM_H_ - -/* - * Protocol Version - */ - -#define SmProtoMajor 1 -#define SmProtoMinor 0 - - -/* - * Interact Style - */ - -#define SmInteractStyleNone 0 -#define SmInteractStyleErrors 1 -#define SmInteractStyleAny 2 - - -/* - * Dialog Type - */ - -#define SmDialogError 0 -#define SmDialogNormal 1 - - -/* - * Save Type - */ - -#define SmSaveGlobal 0 -#define SmSaveLocal 1 -#define SmSaveBoth 2 - - -/* - * Restart Style Hints - */ - -#define SmRestartIfRunning 0 -#define SmRestartAnyway 1 -#define SmRestartImmediately 2 -#define SmRestartNever 3 - - -/* - * Property names - */ - -#define SmCloneCommand "CloneCommand" -#define SmCurrentDirectory "CurrentDirectory" -#define SmDiscardCommand "DiscardCommand" -#define SmEnvironment "Environment" -#define SmProcessID "ProcessID" -#define SmProgram "Program" -#define SmRestartCommand "RestartCommand" -#define SmResignCommand "ResignCommand" -#define SmRestartStyleHint "RestartStyleHint" -#define SmShutdownCommand "ShutdownCommand" -#define SmUserID "UserID" - - -/* - * Property types - */ - -#define SmCARD8 "CARD8" -#define SmARRAY8 "ARRAY8" -#define SmLISTofARRAY8 "LISTofARRAY8" - - -/* - * SM minor opcodes - */ - -#define SM_Error 0 -#define SM_RegisterClient 1 -#define SM_RegisterClientReply 2 -#define SM_SaveYourself 3 -#define SM_SaveYourselfRequest 4 -#define SM_InteractRequest 5 -#define SM_Interact 6 -#define SM_InteractDone 7 -#define SM_SaveYourselfDone 8 -#define SM_Die 9 -#define SM_ShutdownCancelled 10 -#define SM_CloseConnection 11 -#define SM_SetProperties 12 -#define SM_DeleteProperties 13 -#define SM_GetProperties 14 -#define SM_PropertiesReply 15 -#define SM_SaveYourselfPhase2Request 16 -#define SM_SaveYourselfPhase2 17 -#define SM_SaveComplete 18 - -#endif /* _SM_H_ */ diff --git a/openflow/usr/include/X11/SM/SMlib.h b/openflow/usr/include/X11/SM/SMlib.h deleted file mode 100644 index b88ddc0..0000000 --- a/openflow/usr/include/X11/SM/SMlib.h +++ /dev/null @@ -1,543 +0,0 @@ -/* - -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/* - * Author: Ralph Mor, X Consortium - */ - -#ifndef _SMLIB_H_ -#define _SMLIB_H_ - -#include -#include - - -/* - * Generic SM pointer - */ - -typedef IcePointer SmPointer; - - -/* - * Connection objects. Defined in SMlibint.h - */ - -typedef struct _SmcConn *SmcConn; -typedef struct _SmsConn *SmsConn; - - -/* - * Session Management property - */ - -typedef struct { - int length; /* length (in bytes) of the value */ - SmPointer value; /* the value */ -} SmPropValue; - -typedef struct { - char *name; /* name of property */ - char *type; /* type of property */ - int num_vals; /* number of values in property */ - SmPropValue *vals; /* the values */ -} SmProp; - - - -/* - * SmcCloseConnection status return - */ - -typedef enum { - SmcClosedNow, - SmcClosedASAP, - SmcConnectionInUse -} SmcCloseStatus; - - - -/* - * Client callbacks - */ - -typedef void (*SmcSaveYourselfProc) ( - SmcConn /* smcConn */, - SmPointer /* clientData */, - int /* saveType */, - Bool /* shutdown */, - int /* interactStyle */, - Bool /* fast */ -); - -typedef void (*SmcSaveYourselfPhase2Proc) ( - SmcConn /* smcConn */, - SmPointer /* clientData */ -); - -typedef void (*SmcInteractProc) ( - SmcConn /* smcConn */, - SmPointer /* clientData */ -); - -typedef void (*SmcDieProc) ( - SmcConn /* smcConn */, - SmPointer /* clientData */ -); - -typedef void (*SmcShutdownCancelledProc) ( - SmcConn /* smcConn */, - SmPointer /* clientData */ -); - -typedef void (*SmcSaveCompleteProc) ( - SmcConn /* smcConn */, - SmPointer /* clientData */ -); - -typedef void (*SmcPropReplyProc) ( - SmcConn /* smcConn */, - SmPointer /* clientData */, - int /* numProps */, - SmProp ** /* props */ -); - - -/* - * Callbacks set up at SmcOpenConnection time - */ - -typedef struct { - - struct { - SmcSaveYourselfProc callback; - SmPointer client_data; - } save_yourself; - - struct { - SmcDieProc callback; - SmPointer client_data; - } die; - - struct { - SmcSaveCompleteProc callback; - SmPointer client_data; - } save_complete; - - struct { - SmcShutdownCancelledProc callback; - SmPointer client_data; - } shutdown_cancelled; - -} SmcCallbacks; - -#define SmcSaveYourselfProcMask (1L << 0) -#define SmcDieProcMask (1L << 1) -#define SmcSaveCompleteProcMask (1L << 2) -#define SmcShutdownCancelledProcMask (1L << 3) - - - -/* - * Session manager callbacks - */ - -typedef Status (*SmsRegisterClientProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - char * /* previousId */ -); - -typedef void (*SmsInteractRequestProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - int /* dialogType */ -); - -typedef void (*SmsInteractDoneProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - Bool /* cancelShutdown */ -); - -typedef void (*SmsSaveYourselfRequestProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - int /* saveType */, - Bool /* shutdown */, - int /* interactStyle */, - Bool /* fast */, - Bool /* global */ -); - -typedef void (*SmsSaveYourselfPhase2RequestProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */ -); - -typedef void (*SmsSaveYourselfDoneProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - Bool /* success */ -); - -typedef void (*SmsCloseConnectionProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - int /* count */, - char ** /* reasonMsgs */ -); - -typedef void (*SmsSetPropertiesProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - int /* numProps */, - SmProp ** /* props */ -); - -typedef void (*SmsDeletePropertiesProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - int /* numProps */, - char ** /* propNames */ -); - -typedef void (*SmsGetPropertiesProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */ -); - - -/* - * Callbacks set up by a session manager when a new client connects. - */ - -typedef struct { - - struct { - SmsRegisterClientProc callback; - SmPointer manager_data; - } register_client; - - struct { - SmsInteractRequestProc callback; - SmPointer manager_data; - } interact_request; - - struct { - SmsInteractDoneProc callback; - SmPointer manager_data; - } interact_done; - - struct { - SmsSaveYourselfRequestProc callback; - SmPointer manager_data; - } save_yourself_request; - - struct { - SmsSaveYourselfPhase2RequestProc callback; - SmPointer manager_data; - } save_yourself_phase2_request; - - struct { - SmsSaveYourselfDoneProc callback; - SmPointer manager_data; - } save_yourself_done; - - struct { - SmsCloseConnectionProc callback; - SmPointer manager_data; - } close_connection; - - struct { - SmsSetPropertiesProc callback; - SmPointer manager_data; - } set_properties; - - struct { - SmsDeletePropertiesProc callback; - SmPointer manager_data; - } delete_properties; - - struct { - SmsGetPropertiesProc callback; - SmPointer manager_data; - } get_properties; - -} SmsCallbacks; - - -#define SmsRegisterClientProcMask (1L << 0) -#define SmsInteractRequestProcMask (1L << 1) -#define SmsInteractDoneProcMask (1L << 2) -#define SmsSaveYourselfRequestProcMask (1L << 3) -#define SmsSaveYourselfP2RequestProcMask (1L << 4) -#define SmsSaveYourselfDoneProcMask (1L << 5) -#define SmsCloseConnectionProcMask (1L << 6) -#define SmsSetPropertiesProcMask (1L << 7) -#define SmsDeletePropertiesProcMask (1L << 8) -#define SmsGetPropertiesProcMask (1L << 9) - - - -typedef Status (*SmsNewClientProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - unsigned long * /* maskRet */, - SmsCallbacks * /* callbacksRet */, - char ** /* failureReasonRet */ -); - - - -/* - * Error handlers - */ - -typedef void (*SmcErrorHandler) ( - SmcConn /* smcConn */, - Bool /* swap */, - int /* offendingMinorOpcode */, - unsigned long /* offendingSequence */, - int /* errorClass */, - int /* severity */, - SmPointer /* values */ -); - -typedef void (*SmsErrorHandler) ( - SmsConn /* smsConn */, - Bool /* swap */, - int /* offendingMinorOpcode */, - unsigned long /* offendingSequence */, - int /* errorClass */, - int /* severity */, - SmPointer /* values */ -); - - - -/* - * Function Prototypes - */ - -_XFUNCPROTOBEGIN - -extern SmcConn SmcOpenConnection ( - char * /* networkIdsList */, - SmPointer /* context */, - int /* xsmpMajorRev */, - int /* xsmpMinorRev */, - unsigned long /* mask */, - SmcCallbacks * /* callbacks */, - const char * /* previousId */, - char ** /* clientIdRet */, - int /* errorLength */, - char * /* errorStringRet */ -); - -extern SmcCloseStatus SmcCloseConnection ( - SmcConn /* smcConn */, - int /* count */, - char ** /* reasonMsgs */ -); - -extern void SmcModifyCallbacks ( - SmcConn /* smcConn */, - unsigned long /* mask */, - SmcCallbacks * /* callbacks */ -); - -extern void SmcSetProperties ( - SmcConn /* smcConn */, - int /* numProps */, - SmProp ** /* props */ -); - -extern void SmcDeleteProperties ( - SmcConn /* smcConn */, - int /* numProps */, - char ** /* propNames */ -); - -extern Status SmcGetProperties ( - SmcConn /* smcConn */, - SmcPropReplyProc /* propReplyProc */, - SmPointer /* clientData */ -); - -extern Status SmcInteractRequest ( - SmcConn /* smcConn */, - int /* dialogType */, - SmcInteractProc /* interactProc */, - SmPointer /* clientData */ -); - -extern void SmcInteractDone ( - SmcConn /* smcConn */, - Bool /* cancelShutdown */ -); - -extern void SmcRequestSaveYourself ( - SmcConn /* smcConn */, - int /* saveType */, - Bool /* shutdown */, - int /* interactStyle */, - Bool /* fast */, - Bool /* global */ -); - -extern Status SmcRequestSaveYourselfPhase2 ( - SmcConn /* smcConn */, - SmcSaveYourselfPhase2Proc /* saveYourselfPhase2Proc */, - SmPointer /* clientData */ -); - -extern void SmcSaveYourselfDone ( - SmcConn /* smcConn */, - Bool /* success */ -); - -extern int SmcProtocolVersion ( - SmcConn /* smcConn */ -); - -extern int SmcProtocolRevision ( - SmcConn /* smcConn */ -); - -extern char *SmcVendor ( - SmcConn /* smcConn */ -); - -extern char *SmcRelease ( - SmcConn /* smcConn */ -); - -extern char *SmcClientID ( - SmcConn /* smcConn */ -); - -extern IceConn SmcGetIceConnection ( - SmcConn /* smcConn */ -); - -extern Status SmsInitialize ( - const char * /* vendor */, - const char * /* release */, - SmsNewClientProc /* newClientProc */, - SmPointer /* managerData */, - IceHostBasedAuthProc /* hostBasedAuthProc */, - int /* errorLength */, - char * /* errorStringRet */ -); - -extern char *SmsClientHostName ( - SmsConn /* smsConn */ -); - -extern char *SmsGenerateClientID ( - SmsConn /* smsConn */ -); - -extern Status SmsRegisterClientReply ( - SmsConn /* smsConn */, - char * /* clientId */ -); - -extern void SmsSaveYourself ( - SmsConn /* smsConn */, - int /* saveType */, - Bool /* shutdown */, - int /* interactStyle */, - Bool /* fast */ -); - -extern void SmsSaveYourselfPhase2 ( - SmsConn /* smsConn */ -); - -extern void SmsInteract ( - SmsConn /* smsConn */ -); - -extern void SmsDie ( - SmsConn /* smsConn */ -); - -extern void SmsSaveComplete ( - SmsConn /* smsConn */ -); - -extern void SmsShutdownCancelled ( - SmsConn /* smsConn */ -); - -extern void SmsReturnProperties ( - SmsConn /* smsConn */, - int /* numProps */, - SmProp ** /* props */ -); - -extern void SmsCleanUp ( - SmsConn /* smsConn */ -); - -extern int SmsProtocolVersion ( - SmsConn /* smsConn */ -); - -extern int SmsProtocolRevision ( - SmsConn /* smsConn */ -); - -extern char *SmsClientID ( - SmsConn /* smsConn */ -); - -extern IceConn SmsGetIceConnection ( - SmsConn /* smsConn */ -); - -extern SmcErrorHandler SmcSetErrorHandler ( - SmcErrorHandler /* handler */ -); - -extern SmsErrorHandler SmsSetErrorHandler ( - SmsErrorHandler /* handler */ -); - -extern void SmFreeProperty ( - SmProp * /* prop */ -); - -extern void SmFreeReasons ( - int /* count */, - char ** /* reasonMsgs */ -); - -_XFUNCPROTOEND - -#endif /* _SMLIB_H_ */ diff --git a/openflow/usr/include/X11/SM/SMproto.h b/openflow/usr/include/X11/SM/SMproto.h deleted file mode 100644 index 228e0ce..0000000 --- a/openflow/usr/include/X11/SM/SMproto.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/* - * Author: Ralph Mor, X Consortium - */ - -#ifndef _SMPROTO_H_ -#define _SMPROTO_H_ - -#include - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused[2]; - CARD32 length B32; - /* n ARRAY8 previousId */ -} smRegisterClientMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused[2]; - CARD32 length B32; - /* n ARRAY8 clientId */ -} smRegisterClientReplyMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused1[2]; - CARD32 length B32; - CARD8 saveType; - CARD8 shutdown; - CARD8 interactStyle; - CARD8 fast; - CARD8 unused2[4]; -} smSaveYourselfMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused1[2]; - CARD32 length B32; - CARD8 saveType; - CARD8 shutdown; - CARD8 interactStyle; - CARD8 fast; - CARD8 global; - CARD8 unused2[3]; -} smSaveYourselfRequestMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 dialogType; - CARD8 unused; - CARD32 length B32; -} smInteractRequestMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused[2]; - CARD32 length B32; -} smInteractMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 cancelShutdown; - CARD8 unused; - CARD32 length B32; -} smInteractDoneMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 success; - CARD8 unused; - CARD32 length B32; -} smSaveYourselfDoneMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused[2]; - CARD32 length B32; -} smDieMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused[2]; - CARD32 length B32; -} smShutdownCancelledMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused[2]; - CARD32 length B32; - /* b LISTofARRAY8 reasons */ -} smCloseConnectionMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused[2]; - CARD32 length B32; - /* a LISTofPROPERTY properties */ -} smSetPropertiesMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused[2]; - CARD32 length B32; - /* a LISTofARRAY8 property names */ -} smDeletePropertiesMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused[2]; - CARD32 length B32; -} smGetPropertiesMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused[2]; - CARD32 length B32; - /* a LISTofPROPERTY properties */ -} smPropertiesReplyMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused[2]; - CARD32 length B32; -} smSaveYourselfPhase2RequestMsg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused[2]; - CARD32 length B32; -} smSaveYourselfPhase2Msg; - -typedef struct { - CARD8 majorOpcode; - CARD8 minorOpcode; - CARD8 unused[2]; - CARD32 length B32; -} smSaveCompleteMsg; - - -/* - * SIZEOF values. These better be multiples of 8. - */ - -#define sz_smRegisterClientMsg 8 -#define sz_smRegisterClientReplyMsg 8 -#define sz_smSaveYourselfMsg 16 -#define sz_smSaveYourselfRequestMsg 16 -#define sz_smInteractRequestMsg 8 -#define sz_smInteractMsg 8 -#define sz_smInteractDoneMsg 8 -#define sz_smSaveYourselfDoneMsg 8 -#define sz_smDieMsg 8 -#define sz_smShutdownCancelledMsg 8 -#define sz_smCloseConnectionMsg 8 -#define sz_smSetPropertiesMsg 8 -#define sz_smDeletePropertiesMsg 8 -#define sz_smGetPropertiesMsg 8 -#define sz_smPropertiesReplyMsg 8 -#define sz_smSaveYourselfPhase2RequestMsg 8 -#define sz_smSaveYourselfPhase2Msg 8 -#define sz_smSaveCompleteMsg 8 - -#endif /* _SMPROTO_H_ */ diff --git a/openflow/usr/include/X11/SelectionI.h b/openflow/usr/include/X11/SelectionI.h deleted file mode 100644 index 7f39b87..0000000 --- a/openflow/usr/include/X11/SelectionI.h +++ /dev/null @@ -1,168 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtselectionI_h -#define _XtselectionI_h - -#include "Intrinsic.h" - -typedef struct _RequestRec *Request; -typedef struct _SelectRec *Select; - -typedef struct _RequestRec { - Select ctx; /* logical owner */ - Widget widget; /* widget actually receiving Selection events */ - Window requestor; - Atom property; - Atom target; - Atom type; - int format; - XtPointer value; - unsigned long bytelength; - unsigned long offset; - XtIntervalId timeout; - XSelectionRequestEvent event; /* for XtGetSelectionRequest */ - Boolean allSent; -} RequestRec; - -typedef struct { - Atom prop; - Boolean avail; -} SelectionPropRec, *SelectionProp; - -typedef struct { - Display *dpy; - Atom incr_atom, indirect_atom, timestamp_atom; - int propCount; - SelectionProp list; -} PropListRec, *PropList; - -typedef struct _SelectRec { - Atom selection; /* constant */ - Display *dpy; /* constant */ - Widget widget; - Time time; - unsigned long serial; - XtConvertSelectionProc convert; - XtLoseSelectionProc loses; - XtSelectionDoneProc notify; - XtCancelConvertSelectionProc owner_cancel; - XtPointer owner_closure; - PropList prop_list; - Request req; /* state for local non-incr xfer */ - int ref_count; /* of active transfers */ - unsigned int incremental:1; - unsigned int free_when_done:1; - unsigned int was_disowned:1; -} SelectRec; - -typedef struct _ParamRec { - Atom selection; - Atom param; -} ParamRec, *Param; - -typedef struct _ParamInfoRec { - unsigned int count; - Param paramlist; -} ParamInfoRec, *ParamInfo; - -typedef struct _QueuedRequestRec { - Atom selection; - Atom target; - Atom param; - XtSelectionCallbackProc callback; - XtPointer closure; - Time time; - Boolean incremental; -} QueuedRequestRec, *QueuedRequest; - -typedef struct _QueuedRequestInfoRec { - int count; - Atom *selections; - QueuedRequest *requests; -} QueuedRequestInfoRec, *QueuedRequestInfo; - -typedef struct { - XtSelectionCallbackProc *callbacks; - XtPointer *req_closure; - Atom property; - Atom *target; - Atom type; - int format; - char *value; - int bytelength; - int offset; - XtIntervalId timeout; - XtEventHandler proc; - Widget widget; - Time time; - Select ctx; - Boolean *incremental; - int current; -} CallBackInfoRec, *CallBackInfo; - -typedef struct { - Atom target; - Atom property; -} IndirectPair; - -#define IndirectPairWordSize 2 - -typedef struct { - int active_transfer_count; -} RequestWindowRec; - -#define MAX_SELECTION_INCR(dpy) (((65536 < XMaxRequestSize(dpy)) ? \ - (65536 << 2) : (XMaxRequestSize(dpy) << 2))-100) - -#define MATCH_SELECT(event, info) ((event->time == info->time) && \ - (event->requestor == XtWindow(info->widget)) && \ - (event->selection == info->ctx->selection) && \ - (event->target == *info->target)) - -#endif /* _XtselectionI_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/Shell.h b/openflow/usr/include/X11/Shell.h deleted file mode 100644 index 97e605a..0000000 --- a/openflow/usr/include/X11/Shell.h +++ /dev/null @@ -1,562 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtShell_h -#define _XtShell_h - -#include -#include - -/*********************************************************************** - * - * Shell Widget - * - ***********************************************************************/ -/* - * Shell-specific resources names, classes, and a representation type. - */ - -#ifndef XTSTRINGDEFINES -#define _XtShell_h_Const const -#endif - -/* $Xorg: makestrs.c,v 1.6 2001/02/09 02:03:17 xorgcvs Exp $ */ -/* This file is automatically generated. */ -/* Default ABI version -- Do not edit */ -#ifdef XTSTRINGDEFINES -#define XtNiconName "iconName" -#define XtCIconName "IconName" -#define XtNiconPixmap "iconPixmap" -#define XtCIconPixmap "IconPixmap" -#define XtNiconWindow "iconWindow" -#define XtCIconWindow "IconWindow" -#define XtNiconMask "iconMask" -#define XtCIconMask "IconMask" -#define XtNwindowGroup "windowGroup" -#define XtCWindowGroup "WindowGroup" -#define XtNvisual "visual" -#define XtCVisual "Visual" -#define XtNtitleEncoding "titleEncoding" -#define XtCTitleEncoding "TitleEncoding" -#define XtNsaveUnder "saveUnder" -#define XtCSaveUnder "SaveUnder" -#define XtNtransient "transient" -#define XtCTransient "Transient" -#define XtNoverrideRedirect "overrideRedirect" -#define XtCOverrideRedirect "OverrideRedirect" -#define XtNtransientFor "transientFor" -#define XtCTransientFor "TransientFor" -#define XtNiconNameEncoding "iconNameEncoding" -#define XtCIconNameEncoding "IconNameEncoding" -#define XtNallowShellResize "allowShellResize" -#define XtCAllowShellResize "AllowShellResize" -#define XtNcreatePopupChildProc "createPopupChildProc" -#define XtCCreatePopupChildProc "CreatePopupChildProc" -#define XtNtitle "title" -#define XtCTitle "Title" -#ifndef XtRAtom -#define XtRAtom "Atom" -#endif -#define XtNargc "argc" -#define XtCArgc "Argc" -#define XtNargv "argv" -#define XtCArgv "Argv" -#define XtNiconX "iconX" -#define XtCIconX "IconX" -#define XtNiconY "iconY" -#define XtCIconY "IconY" -#define XtNinput "input" -#define XtCInput "Input" -#define XtNiconic "iconic" -#define XtCIconic "Iconic" -#define XtNinitialState "initialState" -#define XtCInitialState "InitialState" -#define XtNgeometry "geometry" -#define XtCGeometry "Geometry" -#define XtNbaseWidth "baseWidth" -#define XtCBaseWidth "BaseWidth" -#define XtNbaseHeight "baseHeight" -#define XtCBaseHeight "BaseHeight" -#define XtNwinGravity "winGravity" -#define XtCWinGravity "WinGravity" -#define XtNminWidth "minWidth" -#define XtCMinWidth "MinWidth" -#define XtNminHeight "minHeight" -#define XtCMinHeight "MinHeight" -#define XtNmaxWidth "maxWidth" -#define XtCMaxWidth "MaxWidth" -#define XtNmaxHeight "maxHeight" -#define XtCMaxHeight "MaxHeight" -#define XtNwidthInc "widthInc" -#define XtCWidthInc "WidthInc" -#define XtNheightInc "heightInc" -#define XtCHeightInc "HeightInc" -#define XtNminAspectY "minAspectY" -#define XtCMinAspectY "MinAspectY" -#define XtNmaxAspectY "maxAspectY" -#define XtCMaxAspectY "MaxAspectY" -#define XtNminAspectX "minAspectX" -#define XtCMinAspectX "MinAspectX" -#define XtNmaxAspectX "maxAspectX" -#define XtCMaxAspectX "MaxAspectX" -#define XtNwmTimeout "wmTimeout" -#define XtCWmTimeout "WmTimeout" -#define XtNwaitForWm "waitforwm" -#define XtCWaitForWm "Waitforwm" -#define XtNwaitforwm "waitforwm" -#define XtCWaitforwm "Waitforwm" -#define XtNclientLeader "clientLeader" -#define XtCClientLeader "ClientLeader" -#define XtNwindowRole "windowRole" -#define XtCWindowRole "WindowRole" -#define XtNurgency "urgency" -#define XtCUrgency "Urgency" -#define XtNcancelCallback "cancelCallback" -#define XtNcloneCommand "cloneCommand" -#define XtCCloneCommand "CloneCommand" -#define XtNconnection "connection" -#define XtCConnection "Connection" -#define XtNcurrentDirectory "currentDirectory" -#define XtCCurrentDirectory "CurrentDirectory" -#define XtNdieCallback "dieCallback" -#define XtNdiscardCommand "discardCommand" -#define XtCDiscardCommand "DiscardCommand" -#define XtNenvironment "environment" -#define XtCEnvironment "Environment" -#define XtNinteractCallback "interactCallback" -#define XtNjoinSession "joinSession" -#define XtCJoinSession "JoinSession" -#define XtNprogramPath "programPath" -#define XtCProgramPath "ProgramPath" -#define XtNresignCommand "resignCommand" -#define XtCResignCommand "ResignCommand" -#define XtNrestartCommand "restartCommand" -#define XtCRestartCommand "RestartCommand" -#define XtNrestartStyle "restartStyle" -#define XtCRestartStyle "RestartStyle" -#define XtNsaveCallback "saveCallback" -#define XtNsaveCompleteCallback "saveCompleteCallback" -#define XtNsessionID "sessionID" -#define XtCSessionID "SessionID" -#define XtNshutdownCommand "shutdownCommand" -#define XtCShutdownCommand "ShutdownCommand" -#define XtNerrorCallback "errorCallback" -#else -extern _XtShell_h_Const char XtShellStrings[]; -#ifndef XtNiconName -#define XtNiconName ((char*)&XtShellStrings[0]) -#endif -#ifndef XtCIconName -#define XtCIconName ((char*)&XtShellStrings[9]) -#endif -#ifndef XtNiconPixmap -#define XtNiconPixmap ((char*)&XtShellStrings[18]) -#endif -#ifndef XtCIconPixmap -#define XtCIconPixmap ((char*)&XtShellStrings[29]) -#endif -#ifndef XtNiconWindow -#define XtNiconWindow ((char*)&XtShellStrings[40]) -#endif -#ifndef XtCIconWindow -#define XtCIconWindow ((char*)&XtShellStrings[51]) -#endif -#ifndef XtNiconMask -#define XtNiconMask ((char*)&XtShellStrings[62]) -#endif -#ifndef XtCIconMask -#define XtCIconMask ((char*)&XtShellStrings[71]) -#endif -#ifndef XtNwindowGroup -#define XtNwindowGroup ((char*)&XtShellStrings[80]) -#endif -#ifndef XtCWindowGroup -#define XtCWindowGroup ((char*)&XtShellStrings[92]) -#endif -#ifndef XtNvisual -#define XtNvisual ((char*)&XtShellStrings[104]) -#endif -#ifndef XtCVisual -#define XtCVisual ((char*)&XtShellStrings[111]) -#endif -#ifndef XtNtitleEncoding -#define XtNtitleEncoding ((char*)&XtShellStrings[118]) -#endif -#ifndef XtCTitleEncoding -#define XtCTitleEncoding ((char*)&XtShellStrings[132]) -#endif -#ifndef XtNsaveUnder -#define XtNsaveUnder ((char*)&XtShellStrings[146]) -#endif -#ifndef XtCSaveUnder -#define XtCSaveUnder ((char*)&XtShellStrings[156]) -#endif -#ifndef XtNtransient -#define XtNtransient ((char*)&XtShellStrings[166]) -#endif -#ifndef XtCTransient -#define XtCTransient ((char*)&XtShellStrings[176]) -#endif -#ifndef XtNoverrideRedirect -#define XtNoverrideRedirect ((char*)&XtShellStrings[186]) -#endif -#ifndef XtCOverrideRedirect -#define XtCOverrideRedirect ((char*)&XtShellStrings[203]) -#endif -#ifndef XtNtransientFor -#define XtNtransientFor ((char*)&XtShellStrings[220]) -#endif -#ifndef XtCTransientFor -#define XtCTransientFor ((char*)&XtShellStrings[233]) -#endif -#ifndef XtNiconNameEncoding -#define XtNiconNameEncoding ((char*)&XtShellStrings[246]) -#endif -#ifndef XtCIconNameEncoding -#define XtCIconNameEncoding ((char*)&XtShellStrings[263]) -#endif -#ifndef XtNallowShellResize -#define XtNallowShellResize ((char*)&XtShellStrings[280]) -#endif -#ifndef XtCAllowShellResize -#define XtCAllowShellResize ((char*)&XtShellStrings[297]) -#endif -#ifndef XtNcreatePopupChildProc -#define XtNcreatePopupChildProc ((char*)&XtShellStrings[314]) -#endif -#ifndef XtCCreatePopupChildProc -#define XtCCreatePopupChildProc ((char*)&XtShellStrings[335]) -#endif -#ifndef XtNtitle -#define XtNtitle ((char*)&XtShellStrings[356]) -#endif -#ifndef XtCTitle -#define XtCTitle ((char*)&XtShellStrings[362]) -#endif -#ifndef XtRAtom -#define XtRAtom ((char*)&XtShellStrings[368]) -#endif -#ifndef XtNargc -#define XtNargc ((char*)&XtShellStrings[373]) -#endif -#ifndef XtCArgc -#define XtCArgc ((char*)&XtShellStrings[378]) -#endif -#ifndef XtNargv -#define XtNargv ((char*)&XtShellStrings[383]) -#endif -#ifndef XtCArgv -#define XtCArgv ((char*)&XtShellStrings[388]) -#endif -#ifndef XtNiconX -#define XtNiconX ((char*)&XtShellStrings[393]) -#endif -#ifndef XtCIconX -#define XtCIconX ((char*)&XtShellStrings[399]) -#endif -#ifndef XtNiconY -#define XtNiconY ((char*)&XtShellStrings[405]) -#endif -#ifndef XtCIconY -#define XtCIconY ((char*)&XtShellStrings[411]) -#endif -#ifndef XtNinput -#define XtNinput ((char*)&XtShellStrings[417]) -#endif -#ifndef XtCInput -#define XtCInput ((char*)&XtShellStrings[423]) -#endif -#ifndef XtNiconic -#define XtNiconic ((char*)&XtShellStrings[429]) -#endif -#ifndef XtCIconic -#define XtCIconic ((char*)&XtShellStrings[436]) -#endif -#ifndef XtNinitialState -#define XtNinitialState ((char*)&XtShellStrings[443]) -#endif -#ifndef XtCInitialState -#define XtCInitialState ((char*)&XtShellStrings[456]) -#endif -#ifndef XtNgeometry -#define XtNgeometry ((char*)&XtShellStrings[469]) -#endif -#ifndef XtCGeometry -#define XtCGeometry ((char*)&XtShellStrings[478]) -#endif -#ifndef XtNbaseWidth -#define XtNbaseWidth ((char*)&XtShellStrings[487]) -#endif -#ifndef XtCBaseWidth -#define XtCBaseWidth ((char*)&XtShellStrings[497]) -#endif -#ifndef XtNbaseHeight -#define XtNbaseHeight ((char*)&XtShellStrings[507]) -#endif -#ifndef XtCBaseHeight -#define XtCBaseHeight ((char*)&XtShellStrings[518]) -#endif -#ifndef XtNwinGravity -#define XtNwinGravity ((char*)&XtShellStrings[529]) -#endif -#ifndef XtCWinGravity -#define XtCWinGravity ((char*)&XtShellStrings[540]) -#endif -#ifndef XtNminWidth -#define XtNminWidth ((char*)&XtShellStrings[551]) -#endif -#ifndef XtCMinWidth -#define XtCMinWidth ((char*)&XtShellStrings[560]) -#endif -#ifndef XtNminHeight -#define XtNminHeight ((char*)&XtShellStrings[569]) -#endif -#ifndef XtCMinHeight -#define XtCMinHeight ((char*)&XtShellStrings[579]) -#endif -#ifndef XtNmaxWidth -#define XtNmaxWidth ((char*)&XtShellStrings[589]) -#endif -#ifndef XtCMaxWidth -#define XtCMaxWidth ((char*)&XtShellStrings[598]) -#endif -#ifndef XtNmaxHeight -#define XtNmaxHeight ((char*)&XtShellStrings[607]) -#endif -#ifndef XtCMaxHeight -#define XtCMaxHeight ((char*)&XtShellStrings[617]) -#endif -#ifndef XtNwidthInc -#define XtNwidthInc ((char*)&XtShellStrings[627]) -#endif -#ifndef XtCWidthInc -#define XtCWidthInc ((char*)&XtShellStrings[636]) -#endif -#ifndef XtNheightInc -#define XtNheightInc ((char*)&XtShellStrings[645]) -#endif -#ifndef XtCHeightInc -#define XtCHeightInc ((char*)&XtShellStrings[655]) -#endif -#ifndef XtNminAspectY -#define XtNminAspectY ((char*)&XtShellStrings[665]) -#endif -#ifndef XtCMinAspectY -#define XtCMinAspectY ((char*)&XtShellStrings[676]) -#endif -#ifndef XtNmaxAspectY -#define XtNmaxAspectY ((char*)&XtShellStrings[687]) -#endif -#ifndef XtCMaxAspectY -#define XtCMaxAspectY ((char*)&XtShellStrings[698]) -#endif -#ifndef XtNminAspectX -#define XtNminAspectX ((char*)&XtShellStrings[709]) -#endif -#ifndef XtCMinAspectX -#define XtCMinAspectX ((char*)&XtShellStrings[720]) -#endif -#ifndef XtNmaxAspectX -#define XtNmaxAspectX ((char*)&XtShellStrings[731]) -#endif -#ifndef XtCMaxAspectX -#define XtCMaxAspectX ((char*)&XtShellStrings[742]) -#endif -#ifndef XtNwmTimeout -#define XtNwmTimeout ((char*)&XtShellStrings[753]) -#endif -#ifndef XtCWmTimeout -#define XtCWmTimeout ((char*)&XtShellStrings[763]) -#endif -#ifndef XtNwaitForWm -#define XtNwaitForWm ((char*)&XtShellStrings[773]) -#endif -#ifndef XtCWaitForWm -#define XtCWaitForWm ((char*)&XtShellStrings[783]) -#endif -#ifndef XtNwaitforwm -#define XtNwaitforwm ((char*)&XtShellStrings[793]) -#endif -#ifndef XtCWaitforwm -#define XtCWaitforwm ((char*)&XtShellStrings[803]) -#endif -#ifndef XtNclientLeader -#define XtNclientLeader ((char*)&XtShellStrings[813]) -#endif -#ifndef XtCClientLeader -#define XtCClientLeader ((char*)&XtShellStrings[826]) -#endif -#ifndef XtNwindowRole -#define XtNwindowRole ((char*)&XtShellStrings[839]) -#endif -#ifndef XtCWindowRole -#define XtCWindowRole ((char*)&XtShellStrings[850]) -#endif -#ifndef XtNurgency -#define XtNurgency ((char*)&XtShellStrings[861]) -#endif -#ifndef XtCUrgency -#define XtCUrgency ((char*)&XtShellStrings[869]) -#endif -#ifndef XtNcancelCallback -#define XtNcancelCallback ((char*)&XtShellStrings[877]) -#endif -#ifndef XtNcloneCommand -#define XtNcloneCommand ((char*)&XtShellStrings[892]) -#endif -#ifndef XtCCloneCommand -#define XtCCloneCommand ((char*)&XtShellStrings[905]) -#endif -#ifndef XtNconnection -#define XtNconnection ((char*)&XtShellStrings[918]) -#endif -#ifndef XtCConnection -#define XtCConnection ((char*)&XtShellStrings[929]) -#endif -#ifndef XtNcurrentDirectory -#define XtNcurrentDirectory ((char*)&XtShellStrings[940]) -#endif -#ifndef XtCCurrentDirectory -#define XtCCurrentDirectory ((char*)&XtShellStrings[957]) -#endif -#ifndef XtNdieCallback -#define XtNdieCallback ((char*)&XtShellStrings[974]) -#endif -#ifndef XtNdiscardCommand -#define XtNdiscardCommand ((char*)&XtShellStrings[986]) -#endif -#ifndef XtCDiscardCommand -#define XtCDiscardCommand ((char*)&XtShellStrings[1001]) -#endif -#ifndef XtNenvironment -#define XtNenvironment ((char*)&XtShellStrings[1016]) -#endif -#ifndef XtCEnvironment -#define XtCEnvironment ((char*)&XtShellStrings[1028]) -#endif -#ifndef XtNinteractCallback -#define XtNinteractCallback ((char*)&XtShellStrings[1040]) -#endif -#ifndef XtNjoinSession -#define XtNjoinSession ((char*)&XtShellStrings[1057]) -#endif -#ifndef XtCJoinSession -#define XtCJoinSession ((char*)&XtShellStrings[1069]) -#endif -#ifndef XtNprogramPath -#define XtNprogramPath ((char*)&XtShellStrings[1081]) -#endif -#ifndef XtCProgramPath -#define XtCProgramPath ((char*)&XtShellStrings[1093]) -#endif -#ifndef XtNresignCommand -#define XtNresignCommand ((char*)&XtShellStrings[1105]) -#endif -#ifndef XtCResignCommand -#define XtCResignCommand ((char*)&XtShellStrings[1119]) -#endif -#ifndef XtNrestartCommand -#define XtNrestartCommand ((char*)&XtShellStrings[1133]) -#endif -#ifndef XtCRestartCommand -#define XtCRestartCommand ((char*)&XtShellStrings[1148]) -#endif -#ifndef XtNrestartStyle -#define XtNrestartStyle ((char*)&XtShellStrings[1163]) -#endif -#ifndef XtCRestartStyle -#define XtCRestartStyle ((char*)&XtShellStrings[1176]) -#endif -#ifndef XtNsaveCallback -#define XtNsaveCallback ((char*)&XtShellStrings[1189]) -#endif -#ifndef XtNsaveCompleteCallback -#define XtNsaveCompleteCallback ((char*)&XtShellStrings[1202]) -#endif -#ifndef XtNsessionID -#define XtNsessionID ((char*)&XtShellStrings[1223]) -#endif -#ifndef XtCSessionID -#define XtCSessionID ((char*)&XtShellStrings[1233]) -#endif -#ifndef XtNshutdownCommand -#define XtNshutdownCommand ((char*)&XtShellStrings[1243]) -#endif -#ifndef XtCShutdownCommand -#define XtCShutdownCommand ((char*)&XtShellStrings[1259]) -#endif -#ifndef XtNerrorCallback -#define XtNerrorCallback ((char*)&XtShellStrings[1275]) -#endif -#endif /* XTSTRINGDEFINES */ - -#ifndef XTSTRINGDEFINES -#undef _XtShell_h_Const -#endif - -/* Class record constants */ - -typedef struct _ShellClassRec *ShellWidgetClass; -typedef struct _OverrideShellClassRec *OverrideShellWidgetClass; -typedef struct _WMShellClassRec *WMShellWidgetClass; -typedef struct _TransientShellClassRec *TransientShellWidgetClass; -typedef struct _TopLevelShellClassRec *TopLevelShellWidgetClass; -typedef struct _ApplicationShellClassRec *ApplicationShellWidgetClass; -typedef struct _SessionShellClassRec *SessionShellWidgetClass; - -#ifndef SHELL -externalref WidgetClass shellWidgetClass; -externalref WidgetClass overrideShellWidgetClass; -externalref WidgetClass wmShellWidgetClass; -externalref WidgetClass transientShellWidgetClass; -externalref WidgetClass topLevelShellWidgetClass; -externalref WidgetClass applicationShellWidgetClass; -externalref WidgetClass sessionShellWidgetClass; -#endif - -#endif /* _XtShell_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/ShellI.h b/openflow/usr/include/X11/ShellI.h deleted file mode 100644 index c1ee0b1..0000000 --- a/openflow/usr/include/X11/ShellI.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _XtShellInternal_h -#define _XtShellInternal_h - -#include - -_XFUNCPROTOBEGIN - -extern void _XtShellGetCoordinates(Widget widget, Position *x, Position *y); - -#endif /* _XtShellInternal_h */ diff --git a/openflow/usr/include/X11/ShellP.h b/openflow/usr/include/X11/ShellP.h deleted file mode 100644 index 51ac3a0..0000000 --- a/openflow/usr/include/X11/ShellP.h +++ /dev/null @@ -1,434 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -/* - * ShellP.h - Private definitions for Shell widget - * - * Author: Paul Asente - * Digital Equipment Corporation - * Western Software Laboratory - * Date: Thu Dec 3, 1987 - */ - -#ifndef _XtShellPrivate_h -#define _XtShellPrivate_h - -#include - -/* ***** - * ***** VendorP.h is included later on; it needs fields defined in the first - * ***** part of this header file - * ***** - */ - -_XFUNCPROTOBEGIN - -/*********************************************************************** - * - * Shell Widget Private Data - * - ***********************************************************************/ - -/* New fields for the Shell widget class record */ - -typedef struct { - XtPointer extension; /* pointer to extension record */ -} ShellClassPart; - -typedef struct { - XtPointer next_extension; /* 1st 4 mandated for all extension records */ - XrmQuark record_type; /* NULLQUARK; on ShellClassPart */ - long version; /* must be XtShellExtensionVersion */ - Cardinal record_size; /* sizeof(ShellClassExtensionRec) */ - XtGeometryHandler root_geometry_manager; -} ShellClassExtensionRec, *ShellClassExtension; - -#define XtShellExtensionVersion 1L -#define XtInheritRootGeometryManager ((XtGeometryHandler)_XtInherit) - -typedef struct _ShellClassRec { - CoreClassPart core_class; - CompositeClassPart composite_class; - ShellClassPart shell_class; -} ShellClassRec; - -externalref ShellClassRec shellClassRec; - -/* New fields for the shell widget */ - -typedef struct { - char *geometry; - XtCreatePopupChildProc create_popup_child_proc; - XtGrabKind grab_kind; - Boolean spring_loaded; - Boolean popped_up; - Boolean allow_shell_resize; - Boolean client_specified; /* re-using old name */ -#define _XtShellPositionValid ((Boolean)(1<<0)) -#define _XtShellNotReparented ((Boolean)(1<<1)) -#define _XtShellPPositionOK ((Boolean)(1<<2)) -#define _XtShellGeometryParsed ((Boolean)(1<<3)) - Boolean save_under; - Boolean override_redirect; - - XtCallbackList popup_callback; - XtCallbackList popdown_callback; - Visual* visual; -} ShellPart; - -typedef struct { - CorePart core; - CompositePart composite; - ShellPart shell; -} ShellRec, *ShellWidget; - -/*********************************************************************** - * - * OverrideShell Widget Private Data - * - ***********************************************************************/ - -/* New fields for the OverrideShell widget class record */ - -typedef struct { - XtPointer extension; /* pointer to extension record */ -} OverrideShellClassPart; - -typedef struct _OverrideShellClassRec { - CoreClassPart core_class; - CompositeClassPart composite_class; - ShellClassPart shell_class; - OverrideShellClassPart override_shell_class; -} OverrideShellClassRec; - -externalref OverrideShellClassRec overrideShellClassRec; - -/* No new fields for the override shell widget */ - -typedef struct {int frabjous;} OverrideShellPart; - -typedef struct { - CorePart core; - CompositePart composite; - ShellPart shell; - OverrideShellPart override; -} OverrideShellRec, *OverrideShellWidget; - -/*********************************************************************** - * - * WMShell Widget Private Data - * - ***********************************************************************/ - -/* New fields for the WMShell widget class record */ - -typedef struct { - XtPointer extension; /* pointer to extension record */ -} WMShellClassPart; - -typedef struct _WMShellClassRec { - CoreClassPart core_class; - CompositeClassPart composite_class; - ShellClassPart shell_class; - WMShellClassPart wm_shell_class; -} WMShellClassRec; - -externalref WMShellClassRec wmShellClassRec; - -/* New fields for the WM shell widget */ - -typedef struct { - char *title; - int wm_timeout; - Boolean wait_for_wm; - Boolean transient; - Boolean urgency; - Widget client_leader; - String window_role; - struct _OldXSizeHints { /* pre-R4 Xlib structure */ - long flags; - int x, y; - int width, height; - int min_width, min_height; - int max_width, max_height; - int width_inc, height_inc; - struct { - int x; - int y; - } min_aspect, max_aspect; - } size_hints; - XWMHints wm_hints; - int base_width, base_height; - int win_gravity; - Atom title_encoding; -} WMShellPart; - -typedef struct { - CorePart core; - CompositePart composite; - ShellPart shell; - WMShellPart wm; -} WMShellRec, *WMShellWidget; - -_XFUNCPROTOEND - -#include - -_XFUNCPROTOBEGIN - -/*********************************************************************** - * - * TransientShell Widget Private Data - * - ***********************************************************************/ - -/* New fields for the TransientShell widget class record */ - -typedef struct { - XtPointer extension; /* pointer to extension record */ -} TransientShellClassPart; - -typedef struct _TransientShellClassRec { - CoreClassPart core_class; - CompositeClassPart composite_class; - ShellClassPart shell_class; - WMShellClassPart wm_shell_class; - VendorShellClassPart vendor_shell_class; - TransientShellClassPart transient_shell_class; -} TransientShellClassRec; - -externalref TransientShellClassRec transientShellClassRec; - -/* New fields for the transient shell widget */ - -typedef struct { - Widget transient_for; -} TransientShellPart; - -typedef struct { - CorePart core; - CompositePart composite; - ShellPart shell; - WMShellPart wm; - VendorShellPart vendor; - TransientShellPart transient; -} TransientShellRec, *TransientShellWidget; - -/*********************************************************************** - * - * TopLevelShell Widget Private Data - * - ***********************************************************************/ - -/* New fields for the TopLevelShell widget class record */ - -typedef struct { - XtPointer extension; /* pointer to extension record */ -} TopLevelShellClassPart; - -typedef struct _TopLevelShellClassRec { - CoreClassPart core_class; - CompositeClassPart composite_class; - ShellClassPart shell_class; - WMShellClassPart wm_shell_class; - VendorShellClassPart vendor_shell_class; - TopLevelShellClassPart top_level_shell_class; -} TopLevelShellClassRec; - -externalref TopLevelShellClassRec topLevelShellClassRec; - -/* New fields for the top level shell widget */ - -typedef struct { - char *icon_name; - Boolean iconic; - Atom icon_name_encoding; -} TopLevelShellPart; - -typedef struct { - CorePart core; - CompositePart composite; - ShellPart shell; - WMShellPart wm; - VendorShellPart vendor; - TopLevelShellPart topLevel; -} TopLevelShellRec, *TopLevelShellWidget; - -/*********************************************************************** - * - * ApplicationShell Widget Private Data - * - ***********************************************************************/ - -/* New fields for the ApplicationShell widget class record */ - -typedef struct { - XtPointer extension; /* pointer to extension record */ -} ApplicationShellClassPart; - -typedef struct _ApplicationShellClassRec { - CoreClassPart core_class; - CompositeClassPart composite_class; - ShellClassPart shell_class; - WMShellClassPart wm_shell_class; - VendorShellClassPart vendor_shell_class; - TopLevelShellClassPart top_level_shell_class; - ApplicationShellClassPart application_shell_class; -} ApplicationShellClassRec; - -externalref ApplicationShellClassRec applicationShellClassRec; - -/* New fields for the application shell widget */ - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - char *c_class; -#else - char *class; -#endif - XrmClass xrm_class; - int argc; - char **argv; -} ApplicationShellPart; - -typedef struct { - CorePart core; - CompositePart composite; - ShellPart shell; - WMShellPart wm; - VendorShellPart vendor; - TopLevelShellPart topLevel; - ApplicationShellPart application; -} ApplicationShellRec, *ApplicationShellWidget; - -/*********************************************************************** - * - * SessionShell Widget Private Data - * - ***********************************************************************/ - -/* New fields for the SessionShell widget class record */ - -typedef struct { - XtPointer extension; /* pointer to extension record */ -} SessionShellClassPart; - -typedef struct _SessionShellClassRec { - CoreClassPart core_class; - CompositeClassPart composite_class; - ShellClassPart shell_class; - WMShellClassPart wm_shell_class; - VendorShellClassPart vendor_shell_class; - TopLevelShellClassPart top_level_shell_class; - ApplicationShellClassPart application_shell_class; - SessionShellClassPart session_shell_class; -} SessionShellClassRec; - -externalref SessionShellClassRec sessionShellClassRec; - -typedef struct _XtSaveYourselfRec *XtSaveYourself; /* implementation-private */ - -/* New fields for the session shell widget */ - -typedef struct { - SmcConn connection; - String session_id; - String* restart_command; - String* clone_command; - String* discard_command; - String* resign_command; - String* shutdown_command; - String* environment; - String current_dir; - String program_path; - unsigned char restart_style; - unsigned char checkpoint_state; - Boolean join_session; - XtCallbackList save_callbacks; - XtCallbackList interact_callbacks; - XtCallbackList cancel_callbacks; - XtCallbackList save_complete_callbacks; - XtCallbackList die_callbacks; - XtCallbackList error_callbacks; - XtSaveYourself save; - XtInputId input_id; - XtPointer ses20; - XtPointer ses19; - XtPointer ses18; - XtPointer ses17; - XtPointer ses16; - XtPointer ses15; - XtPointer ses14; - XtPointer ses13; - XtPointer ses12; - XtPointer ses11; - XtPointer ses10; - XtPointer ses9; - XtPointer ses8; - XtPointer ses7; - XtPointer ses6; - XtPointer ses5; - XtPointer ses4; - XtPointer ses3; - XtPointer ses2; - XtPointer ses1; -} SessionShellPart; - -typedef struct { - CorePart core; - CompositePart composite; - ShellPart shell; - WMShellPart wm; - VendorShellPart vendor; - TopLevelShellPart topLevel; - ApplicationShellPart application; - SessionShellPart session; -} SessionShellRec, *SessionShellWidget; - -_XFUNCPROTOEND - -#endif /* _XtShellPrivate_h */ diff --git a/openflow/usr/include/X11/StringDefs.h b/openflow/usr/include/X11/StringDefs.h deleted file mode 100644 index 569506b..0000000 --- a/openflow/usr/include/X11/StringDefs.h +++ /dev/null @@ -1,1085 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtStringDefs_h_ -#define _XtStringDefs_h_ - -#ifndef XTSTRINGDEFINES -#define _XtStringDefs_h_Const const -#endif - -/* $Xorg: makestrs.c,v 1.6 2001/02/09 02:03:17 xorgcvs Exp $ */ -/* This file is automatically generated. */ -/* Default ABI version -- Do not edit */ -#ifdef XTSTRINGDEFINES -#define XtNaccelerators "accelerators" -#define XtNallowHoriz "allowHoriz" -#define XtNallowVert "allowVert" -#define XtNancestorSensitive "ancestorSensitive" -#define XtNbackground "background" -#define XtNbackgroundPixmap "backgroundPixmap" -#define XtNbitmap "bitmap" -#define XtNborderColor "borderColor" -#define XtNborder "borderColor" -#define XtNborderPixmap "borderPixmap" -#define XtNborderWidth "borderWidth" -#define XtNcallback "callback" -#define XtNchildren "children" -#define XtNcolormap "colormap" -#define XtNdepth "depth" -#define XtNdestroyCallback "destroyCallback" -#define XtNeditType "editType" -#define XtNfile "file" -#define XtNfont "font" -#define XtNforceBars "forceBars" -#define XtNforeground "foreground" -#define XtNfunction "function" -#define XtNheight "height" -#define XtNhighlight "highlight" -#define XtNhSpace "hSpace" -#define XtNindex "index" -#define XtNinitialResourcesPersistent "initialResourcesPersistent" -#define XtNinnerHeight "innerHeight" -#define XtNinnerWidth "innerWidth" -#define XtNinnerWindow "innerWindow" -#define XtNinsertPosition "insertPosition" -#define XtNinternalHeight "internalHeight" -#define XtNinternalWidth "internalWidth" -#define XtNjumpProc "jumpProc" -#define XtNjustify "justify" -#define XtNknobHeight "knobHeight" -#define XtNknobIndent "knobIndent" -#define XtNknobPixel "knobPixel" -#define XtNknobWidth "knobWidth" -#define XtNlabel "label" -#define XtNlength "length" -#define XtNlowerRight "lowerRight" -#define XtNmappedWhenManaged "mappedWhenManaged" -#define XtNmenuEntry "menuEntry" -#define XtNname "name" -#define XtNnotify "notify" -#define XtNnumChildren "numChildren" -#define XtNorientation "orientation" -#define XtNparameter "parameter" -#define XtNpixmap "pixmap" -#define XtNpopupCallback "popupCallback" -#define XtNpopdownCallback "popdownCallback" -#define XtNresize "resize" -#define XtNreverseVideo "reverseVideo" -#define XtNscreen "screen" -#define XtNscrollProc "scrollProc" -#define XtNscrollDCursor "scrollDCursor" -#define XtNscrollHCursor "scrollHCursor" -#define XtNscrollLCursor "scrollLCursor" -#define XtNscrollRCursor "scrollRCursor" -#define XtNscrollUCursor "scrollUCursor" -#define XtNscrollVCursor "scrollVCursor" -#define XtNselection "selection" -#define XtNselectionArray "selectionArray" -#define XtNsensitive "sensitive" -#define XtNshown "shown" -#define XtNspace "space" -#define XtNstring "string" -#define XtNtextOptions "textOptions" -#define XtNtextSink "textSink" -#define XtNtextSource "textSource" -#define XtNthickness "thickness" -#define XtNthumb "thumb" -#define XtNthumbProc "thumbProc" -#define XtNtop "top" -#define XtNtranslations "translations" -#define XtNunrealizeCallback "unrealizeCallback" -#define XtNupdate "update" -#define XtNuseBottom "useBottom" -#define XtNuseRight "useRight" -#define XtNvalue "value" -#define XtNvSpace "vSpace" -#define XtNwidth "width" -#define XtNwindow "window" -#define XtNx "x" -#define XtNy "y" -#define XtCAccelerators "Accelerators" -#define XtCBackground "Background" -#define XtCBitmap "Bitmap" -#define XtCBoolean "Boolean" -#define XtCBorderColor "BorderColor" -#define XtCBorderWidth "BorderWidth" -#define XtCCallback "Callback" -#define XtCColormap "Colormap" -#define XtCColor "Color" -#define XtCCursor "Cursor" -#define XtCDepth "Depth" -#define XtCEditType "EditType" -#define XtCEventBindings "EventBindings" -#define XtCFile "File" -#define XtCFont "Font" -#define XtCForeground "Foreground" -#define XtCFraction "Fraction" -#define XtCFunction "Function" -#define XtCHeight "Height" -#define XtCHSpace "HSpace" -#define XtCIndex "Index" -#define XtCInitialResourcesPersistent "InitialResourcesPersistent" -#define XtCInsertPosition "InsertPosition" -#define XtCInterval "Interval" -#define XtCJustify "Justify" -#define XtCKnobIndent "KnobIndent" -#define XtCKnobPixel "KnobPixel" -#define XtCLabel "Label" -#define XtCLength "Length" -#define XtCMappedWhenManaged "MappedWhenManaged" -#define XtCMargin "Margin" -#define XtCMenuEntry "MenuEntry" -#define XtCNotify "Notify" -#define XtCOrientation "Orientation" -#define XtCParameter "Parameter" -#define XtCPixmap "Pixmap" -#define XtCPosition "Position" -#define XtCReadOnly "ReadOnly" -#define XtCResize "Resize" -#define XtCReverseVideo "ReverseVideo" -#define XtCScreen "Screen" -#define XtCScrollProc "ScrollProc" -#define XtCScrollDCursor "ScrollDCursor" -#define XtCScrollHCursor "ScrollHCursor" -#define XtCScrollLCursor "ScrollLCursor" -#define XtCScrollRCursor "ScrollRCursor" -#define XtCScrollUCursor "ScrollUCursor" -#define XtCScrollVCursor "ScrollVCursor" -#define XtCSelection "Selection" -#define XtCSensitive "Sensitive" -#define XtCSelectionArray "SelectionArray" -#define XtCSpace "Space" -#define XtCString "String" -#define XtCTextOptions "TextOptions" -#define XtCTextPosition "TextPosition" -#define XtCTextSink "TextSink" -#define XtCTextSource "TextSource" -#define XtCThickness "Thickness" -#define XtCThumb "Thumb" -#define XtCTranslations "Translations" -#define XtCValue "Value" -#define XtCVSpace "VSpace" -#define XtCWidth "Width" -#define XtCWindow "Window" -#define XtCX "X" -#define XtCY "Y" -#define XtRAcceleratorTable "AcceleratorTable" -#ifndef XtRAtom -#define XtRAtom "Atom" -#endif -#define XtRBitmap "Bitmap" -#define XtRBool "Bool" -#define XtRBoolean "Boolean" -#define XtRCallback "Callback" -#define XtRCallProc "CallProc" -#define XtRCardinal "Cardinal" -#define XtRColor "Color" -#define XtRColormap "Colormap" -#define XtRCursor "Cursor" -#define XtRDimension "Dimension" -#define XtRDisplay "Display" -#define XtREditMode "EditMode" -#define XtREnum "Enum" -#define XtRFile "File" -#define XtRFloat "Float" -#define XtRFont "Font" -#define XtRFontStruct "FontStruct" -#define XtRFunction "Function" -#define XtRGeometry "Geometry" -#define XtRImmediate "Immediate" -#define XtRInitialState "InitialState" -#define XtRInt "Int" -#define XtRJustify "Justify" -#define XtRLongBoolean "Bool" -#define XtRObject "Object" -#define XtROrientation "Orientation" -#define XtRPixel "Pixel" -#define XtRPixmap "Pixmap" -#define XtRPointer "Pointer" -#define XtRPosition "Position" -#define XtRScreen "Screen" -#define XtRShort "Short" -#define XtRString "String" -#define XtRStringArray "StringArray" -#define XtRStringTable "StringTable" -#define XtRUnsignedChar "UnsignedChar" -#define XtRTranslationTable "TranslationTable" -#define XtRVisual "Visual" -#define XtRWidget "Widget" -#define XtRWidgetClass "WidgetClass" -#define XtRWidgetList "WidgetList" -#define XtRWindow "Window" -#define XtEoff "off" -#define XtEfalse "false" -#define XtEno "no" -#define XtEon "on" -#define XtEtrue "true" -#define XtEyes "yes" -#define XtEvertical "vertical" -#define XtEhorizontal "horizontal" -#define XtEtextRead "read" -#define XtEtextAppend "append" -#define XtEtextEdit "edit" -#define XtExtdefaultbackground "xtdefaultbackground" -#define XtExtdefaultforeground "xtdefaultforeground" -#define XtExtdefaultfont "xtdefaultfont" -#define XtNfontSet "fontSet" -#define XtRFontSet "FontSet" -#define XtCFontSet "FontSet" -#define XtRGravity "Gravity" -#define XtNcreateHook "createHook" -#define XtNchangeHook "changeHook" -#define XtNconfigureHook "configureHook" -#define XtNgeometryHook "geometryHook" -#define XtNdestroyHook "destroyHook" -#define XtNshells "shells" -#define XtNnumShells "numShells" -#define XtRCommandArgArray "CommandArgArray" -#define XtRDirectoryString "DirectoryString" -#define XtREnvironmentArray "EnvironmentArray" -#define XtRRestartStyle "RestartStyle" -#define XtRSmcConn "SmcConn" -#define XtHcreate "Xtcreate" -#define XtHsetValues "XtsetValues" -#define XtHmanageChildren "XtmanageChildren" -#define XtHunmanageChildren "XtunmanageChildren" -#define XtHmanageSet "XtmanageSet" -#define XtHunmanageSet "XtunmanageSet" -#define XtHrealizeWidget "XtrealizeWidget" -#define XtHunrealizeWidget "XtunrealizeWidget" -#define XtHaddCallback "XtaddCallback" -#define XtHaddCallbacks "XtaddCallbacks" -#define XtHremoveCallback "XtremoveCallback" -#define XtHremoveCallbacks "XtremoveCallbacks" -#define XtHremoveAllCallbacks "XtremoveAllCallbacks" -#define XtHaugmentTranslations "XtaugmentTranslations" -#define XtHoverrideTranslations "XtoverrideTranslations" -#define XtHuninstallTranslations "XtuninstallTranslations" -#define XtHsetKeyboardFocus "XtsetKeyboardFocus" -#define XtHsetWMColormapWindows "XtsetWMColormapWindows" -#define XtHsetMappedWhenManaged "XtsetMappedWhenManaged" -#define XtHmapWidget "XtmapWidget" -#define XtHunmapWidget "XtunmapWidget" -#define XtHpopup "Xtpopup" -#define XtHpopupSpringLoaded "XtpopupSpringLoaded" -#define XtHpopdown "Xtpopdown" -#define XtHconfigure "Xtconfigure" -#define XtHpreGeometry "XtpreGeometry" -#define XtHpostGeometry "XtpostGeometry" -#define XtHdestroy "Xtdestroy" -#else -extern _XtStringDefs_h_Const char XtStrings[]; -#ifndef XtNaccelerators -#define XtNaccelerators ((char*)&XtStrings[0]) -#endif -#ifndef XtNallowHoriz -#define XtNallowHoriz ((char*)&XtStrings[13]) -#endif -#ifndef XtNallowVert -#define XtNallowVert ((char*)&XtStrings[24]) -#endif -#ifndef XtNancestorSensitive -#define XtNancestorSensitive ((char*)&XtStrings[34]) -#endif -#ifndef XtNbackground -#define XtNbackground ((char*)&XtStrings[52]) -#endif -#ifndef XtNbackgroundPixmap -#define XtNbackgroundPixmap ((char*)&XtStrings[63]) -#endif -#ifndef XtNbitmap -#define XtNbitmap ((char*)&XtStrings[80]) -#endif -#ifndef XtNborderColor -#define XtNborderColor ((char*)&XtStrings[87]) -#endif -#ifndef XtNborder -#define XtNborder ((char*)&XtStrings[99]) -#endif -#ifndef XtNborderPixmap -#define XtNborderPixmap ((char*)&XtStrings[111]) -#endif -#ifndef XtNborderWidth -#define XtNborderWidth ((char*)&XtStrings[124]) -#endif -#ifndef XtNcallback -#define XtNcallback ((char*)&XtStrings[136]) -#endif -#ifndef XtNchildren -#define XtNchildren ((char*)&XtStrings[145]) -#endif -#ifndef XtNcolormap -#define XtNcolormap ((char*)&XtStrings[154]) -#endif -#ifndef XtNdepth -#define XtNdepth ((char*)&XtStrings[163]) -#endif -#ifndef XtNdestroyCallback -#define XtNdestroyCallback ((char*)&XtStrings[169]) -#endif -#ifndef XtNeditType -#define XtNeditType ((char*)&XtStrings[185]) -#endif -#ifndef XtNfile -#define XtNfile ((char*)&XtStrings[194]) -#endif -#ifndef XtNfont -#define XtNfont ((char*)&XtStrings[199]) -#endif -#ifndef XtNforceBars -#define XtNforceBars ((char*)&XtStrings[204]) -#endif -#ifndef XtNforeground -#define XtNforeground ((char*)&XtStrings[214]) -#endif -#ifndef XtNfunction -#define XtNfunction ((char*)&XtStrings[225]) -#endif -#ifndef XtNheight -#define XtNheight ((char*)&XtStrings[234]) -#endif -#ifndef XtNhighlight -#define XtNhighlight ((char*)&XtStrings[241]) -#endif -#ifndef XtNhSpace -#define XtNhSpace ((char*)&XtStrings[251]) -#endif -#ifndef XtNindex -#define XtNindex ((char*)&XtStrings[258]) -#endif -#ifndef XtNinitialResourcesPersistent -#define XtNinitialResourcesPersistent ((char*)&XtStrings[264]) -#endif -#ifndef XtNinnerHeight -#define XtNinnerHeight ((char*)&XtStrings[291]) -#endif -#ifndef XtNinnerWidth -#define XtNinnerWidth ((char*)&XtStrings[303]) -#endif -#ifndef XtNinnerWindow -#define XtNinnerWindow ((char*)&XtStrings[314]) -#endif -#ifndef XtNinsertPosition -#define XtNinsertPosition ((char*)&XtStrings[326]) -#endif -#ifndef XtNinternalHeight -#define XtNinternalHeight ((char*)&XtStrings[341]) -#endif -#ifndef XtNinternalWidth -#define XtNinternalWidth ((char*)&XtStrings[356]) -#endif -#ifndef XtNjumpProc -#define XtNjumpProc ((char*)&XtStrings[370]) -#endif -#ifndef XtNjustify -#define XtNjustify ((char*)&XtStrings[379]) -#endif -#ifndef XtNknobHeight -#define XtNknobHeight ((char*)&XtStrings[387]) -#endif -#ifndef XtNknobIndent -#define XtNknobIndent ((char*)&XtStrings[398]) -#endif -#ifndef XtNknobPixel -#define XtNknobPixel ((char*)&XtStrings[409]) -#endif -#ifndef XtNknobWidth -#define XtNknobWidth ((char*)&XtStrings[419]) -#endif -#ifndef XtNlabel -#define XtNlabel ((char*)&XtStrings[429]) -#endif -#ifndef XtNlength -#define XtNlength ((char*)&XtStrings[435]) -#endif -#ifndef XtNlowerRight -#define XtNlowerRight ((char*)&XtStrings[442]) -#endif -#ifndef XtNmappedWhenManaged -#define XtNmappedWhenManaged ((char*)&XtStrings[453]) -#endif -#ifndef XtNmenuEntry -#define XtNmenuEntry ((char*)&XtStrings[471]) -#endif -#ifndef XtNname -#define XtNname ((char*)&XtStrings[481]) -#endif -#ifndef XtNnotify -#define XtNnotify ((char*)&XtStrings[486]) -#endif -#ifndef XtNnumChildren -#define XtNnumChildren ((char*)&XtStrings[493]) -#endif -#ifndef XtNorientation -#define XtNorientation ((char*)&XtStrings[505]) -#endif -#ifndef XtNparameter -#define XtNparameter ((char*)&XtStrings[517]) -#endif -#ifndef XtNpixmap -#define XtNpixmap ((char*)&XtStrings[527]) -#endif -#ifndef XtNpopupCallback -#define XtNpopupCallback ((char*)&XtStrings[534]) -#endif -#ifndef XtNpopdownCallback -#define XtNpopdownCallback ((char*)&XtStrings[548]) -#endif -#ifndef XtNresize -#define XtNresize ((char*)&XtStrings[564]) -#endif -#ifndef XtNreverseVideo -#define XtNreverseVideo ((char*)&XtStrings[571]) -#endif -#ifndef XtNscreen -#define XtNscreen ((char*)&XtStrings[584]) -#endif -#ifndef XtNscrollProc -#define XtNscrollProc ((char*)&XtStrings[591]) -#endif -#ifndef XtNscrollDCursor -#define XtNscrollDCursor ((char*)&XtStrings[602]) -#endif -#ifndef XtNscrollHCursor -#define XtNscrollHCursor ((char*)&XtStrings[616]) -#endif -#ifndef XtNscrollLCursor -#define XtNscrollLCursor ((char*)&XtStrings[630]) -#endif -#ifndef XtNscrollRCursor -#define XtNscrollRCursor ((char*)&XtStrings[644]) -#endif -#ifndef XtNscrollUCursor -#define XtNscrollUCursor ((char*)&XtStrings[658]) -#endif -#ifndef XtNscrollVCursor -#define XtNscrollVCursor ((char*)&XtStrings[672]) -#endif -#ifndef XtNselection -#define XtNselection ((char*)&XtStrings[686]) -#endif -#ifndef XtNselectionArray -#define XtNselectionArray ((char*)&XtStrings[696]) -#endif -#ifndef XtNsensitive -#define XtNsensitive ((char*)&XtStrings[711]) -#endif -#ifndef XtNshown -#define XtNshown ((char*)&XtStrings[721]) -#endif -#ifndef XtNspace -#define XtNspace ((char*)&XtStrings[727]) -#endif -#ifndef XtNstring -#define XtNstring ((char*)&XtStrings[733]) -#endif -#ifndef XtNtextOptions -#define XtNtextOptions ((char*)&XtStrings[740]) -#endif -#ifndef XtNtextSink -#define XtNtextSink ((char*)&XtStrings[752]) -#endif -#ifndef XtNtextSource -#define XtNtextSource ((char*)&XtStrings[761]) -#endif -#ifndef XtNthickness -#define XtNthickness ((char*)&XtStrings[772]) -#endif -#ifndef XtNthumb -#define XtNthumb ((char*)&XtStrings[782]) -#endif -#ifndef XtNthumbProc -#define XtNthumbProc ((char*)&XtStrings[788]) -#endif -#ifndef XtNtop -#define XtNtop ((char*)&XtStrings[798]) -#endif -#ifndef XtNtranslations -#define XtNtranslations ((char*)&XtStrings[802]) -#endif -#ifndef XtNunrealizeCallback -#define XtNunrealizeCallback ((char*)&XtStrings[815]) -#endif -#ifndef XtNupdate -#define XtNupdate ((char*)&XtStrings[833]) -#endif -#ifndef XtNuseBottom -#define XtNuseBottom ((char*)&XtStrings[840]) -#endif -#ifndef XtNuseRight -#define XtNuseRight ((char*)&XtStrings[850]) -#endif -#ifndef XtNvalue -#define XtNvalue ((char*)&XtStrings[859]) -#endif -#ifndef XtNvSpace -#define XtNvSpace ((char*)&XtStrings[865]) -#endif -#ifndef XtNwidth -#define XtNwidth ((char*)&XtStrings[872]) -#endif -#ifndef XtNwindow -#define XtNwindow ((char*)&XtStrings[878]) -#endif -#ifndef XtNx -#define XtNx ((char*)&XtStrings[885]) -#endif -#ifndef XtNy -#define XtNy ((char*)&XtStrings[887]) -#endif -#ifndef XtCAccelerators -#define XtCAccelerators ((char*)&XtStrings[889]) -#endif -#ifndef XtCBackground -#define XtCBackground ((char*)&XtStrings[902]) -#endif -#ifndef XtCBitmap -#define XtCBitmap ((char*)&XtStrings[913]) -#endif -#ifndef XtCBoolean -#define XtCBoolean ((char*)&XtStrings[920]) -#endif -#ifndef XtCBorderColor -#define XtCBorderColor ((char*)&XtStrings[928]) -#endif -#ifndef XtCBorderWidth -#define XtCBorderWidth ((char*)&XtStrings[940]) -#endif -#ifndef XtCCallback -#define XtCCallback ((char*)&XtStrings[952]) -#endif -#ifndef XtCColormap -#define XtCColormap ((char*)&XtStrings[961]) -#endif -#ifndef XtCColor -#define XtCColor ((char*)&XtStrings[970]) -#endif -#ifndef XtCCursor -#define XtCCursor ((char*)&XtStrings[976]) -#endif -#ifndef XtCDepth -#define XtCDepth ((char*)&XtStrings[983]) -#endif -#ifndef XtCEditType -#define XtCEditType ((char*)&XtStrings[989]) -#endif -#ifndef XtCEventBindings -#define XtCEventBindings ((char*)&XtStrings[998]) -#endif -#ifndef XtCFile -#define XtCFile ((char*)&XtStrings[1012]) -#endif -#ifndef XtCFont -#define XtCFont ((char*)&XtStrings[1017]) -#endif -#ifndef XtCForeground -#define XtCForeground ((char*)&XtStrings[1022]) -#endif -#ifndef XtCFraction -#define XtCFraction ((char*)&XtStrings[1033]) -#endif -#ifndef XtCFunction -#define XtCFunction ((char*)&XtStrings[1042]) -#endif -#ifndef XtCHeight -#define XtCHeight ((char*)&XtStrings[1051]) -#endif -#ifndef XtCHSpace -#define XtCHSpace ((char*)&XtStrings[1058]) -#endif -#ifndef XtCIndex -#define XtCIndex ((char*)&XtStrings[1065]) -#endif -#ifndef XtCInitialResourcesPersistent -#define XtCInitialResourcesPersistent ((char*)&XtStrings[1071]) -#endif -#ifndef XtCInsertPosition -#define XtCInsertPosition ((char*)&XtStrings[1098]) -#endif -#ifndef XtCInterval -#define XtCInterval ((char*)&XtStrings[1113]) -#endif -#ifndef XtCJustify -#define XtCJustify ((char*)&XtStrings[1122]) -#endif -#ifndef XtCKnobIndent -#define XtCKnobIndent ((char*)&XtStrings[1130]) -#endif -#ifndef XtCKnobPixel -#define XtCKnobPixel ((char*)&XtStrings[1141]) -#endif -#ifndef XtCLabel -#define XtCLabel ((char*)&XtStrings[1151]) -#endif -#ifndef XtCLength -#define XtCLength ((char*)&XtStrings[1157]) -#endif -#ifndef XtCMappedWhenManaged -#define XtCMappedWhenManaged ((char*)&XtStrings[1164]) -#endif -#ifndef XtCMargin -#define XtCMargin ((char*)&XtStrings[1182]) -#endif -#ifndef XtCMenuEntry -#define XtCMenuEntry ((char*)&XtStrings[1189]) -#endif -#ifndef XtCNotify -#define XtCNotify ((char*)&XtStrings[1199]) -#endif -#ifndef XtCOrientation -#define XtCOrientation ((char*)&XtStrings[1206]) -#endif -#ifndef XtCParameter -#define XtCParameter ((char*)&XtStrings[1218]) -#endif -#ifndef XtCPixmap -#define XtCPixmap ((char*)&XtStrings[1228]) -#endif -#ifndef XtCPosition -#define XtCPosition ((char*)&XtStrings[1235]) -#endif -#ifndef XtCReadOnly -#define XtCReadOnly ((char*)&XtStrings[1244]) -#endif -#ifndef XtCResize -#define XtCResize ((char*)&XtStrings[1253]) -#endif -#ifndef XtCReverseVideo -#define XtCReverseVideo ((char*)&XtStrings[1260]) -#endif -#ifndef XtCScreen -#define XtCScreen ((char*)&XtStrings[1273]) -#endif -#ifndef XtCScrollProc -#define XtCScrollProc ((char*)&XtStrings[1280]) -#endif -#ifndef XtCScrollDCursor -#define XtCScrollDCursor ((char*)&XtStrings[1291]) -#endif -#ifndef XtCScrollHCursor -#define XtCScrollHCursor ((char*)&XtStrings[1305]) -#endif -#ifndef XtCScrollLCursor -#define XtCScrollLCursor ((char*)&XtStrings[1319]) -#endif -#ifndef XtCScrollRCursor -#define XtCScrollRCursor ((char*)&XtStrings[1333]) -#endif -#ifndef XtCScrollUCursor -#define XtCScrollUCursor ((char*)&XtStrings[1347]) -#endif -#ifndef XtCScrollVCursor -#define XtCScrollVCursor ((char*)&XtStrings[1361]) -#endif -#ifndef XtCSelection -#define XtCSelection ((char*)&XtStrings[1375]) -#endif -#ifndef XtCSensitive -#define XtCSensitive ((char*)&XtStrings[1385]) -#endif -#ifndef XtCSelectionArray -#define XtCSelectionArray ((char*)&XtStrings[1395]) -#endif -#ifndef XtCSpace -#define XtCSpace ((char*)&XtStrings[1410]) -#endif -#ifndef XtCString -#define XtCString ((char*)&XtStrings[1416]) -#endif -#ifndef XtCTextOptions -#define XtCTextOptions ((char*)&XtStrings[1423]) -#endif -#ifndef XtCTextPosition -#define XtCTextPosition ((char*)&XtStrings[1435]) -#endif -#ifndef XtCTextSink -#define XtCTextSink ((char*)&XtStrings[1448]) -#endif -#ifndef XtCTextSource -#define XtCTextSource ((char*)&XtStrings[1457]) -#endif -#ifndef XtCThickness -#define XtCThickness ((char*)&XtStrings[1468]) -#endif -#ifndef XtCThumb -#define XtCThumb ((char*)&XtStrings[1478]) -#endif -#ifndef XtCTranslations -#define XtCTranslations ((char*)&XtStrings[1484]) -#endif -#ifndef XtCValue -#define XtCValue ((char*)&XtStrings[1497]) -#endif -#ifndef XtCVSpace -#define XtCVSpace ((char*)&XtStrings[1503]) -#endif -#ifndef XtCWidth -#define XtCWidth ((char*)&XtStrings[1510]) -#endif -#ifndef XtCWindow -#define XtCWindow ((char*)&XtStrings[1516]) -#endif -#ifndef XtCX -#define XtCX ((char*)&XtStrings[1523]) -#endif -#ifndef XtCY -#define XtCY ((char*)&XtStrings[1525]) -#endif -#ifndef XtRAcceleratorTable -#define XtRAcceleratorTable ((char*)&XtStrings[1527]) -#endif -#ifndef XtRAtom -#define XtRAtom ((char*)&XtStrings[1544]) -#endif -#ifndef XtRBitmap -#define XtRBitmap ((char*)&XtStrings[1549]) -#endif -#ifndef XtRBool -#define XtRBool ((char*)&XtStrings[1556]) -#endif -#ifndef XtRBoolean -#define XtRBoolean ((char*)&XtStrings[1561]) -#endif -#ifndef XtRCallback -#define XtRCallback ((char*)&XtStrings[1569]) -#endif -#ifndef XtRCallProc -#define XtRCallProc ((char*)&XtStrings[1578]) -#endif -#ifndef XtRCardinal -#define XtRCardinal ((char*)&XtStrings[1587]) -#endif -#ifndef XtRColor -#define XtRColor ((char*)&XtStrings[1596]) -#endif -#ifndef XtRColormap -#define XtRColormap ((char*)&XtStrings[1602]) -#endif -#ifndef XtRCursor -#define XtRCursor ((char*)&XtStrings[1611]) -#endif -#ifndef XtRDimension -#define XtRDimension ((char*)&XtStrings[1618]) -#endif -#ifndef XtRDisplay -#define XtRDisplay ((char*)&XtStrings[1628]) -#endif -#ifndef XtREditMode -#define XtREditMode ((char*)&XtStrings[1636]) -#endif -#ifndef XtREnum -#define XtREnum ((char*)&XtStrings[1645]) -#endif -#ifndef XtRFile -#define XtRFile ((char*)&XtStrings[1650]) -#endif -#ifndef XtRFloat -#define XtRFloat ((char*)&XtStrings[1655]) -#endif -#ifndef XtRFont -#define XtRFont ((char*)&XtStrings[1661]) -#endif -#ifndef XtRFontStruct -#define XtRFontStruct ((char*)&XtStrings[1666]) -#endif -#ifndef XtRFunction -#define XtRFunction ((char*)&XtStrings[1677]) -#endif -#ifndef XtRGeometry -#define XtRGeometry ((char*)&XtStrings[1686]) -#endif -#ifndef XtRImmediate -#define XtRImmediate ((char*)&XtStrings[1695]) -#endif -#ifndef XtRInitialState -#define XtRInitialState ((char*)&XtStrings[1705]) -#endif -#ifndef XtRInt -#define XtRInt ((char*)&XtStrings[1718]) -#endif -#ifndef XtRJustify -#define XtRJustify ((char*)&XtStrings[1722]) -#endif -#ifndef XtRLongBoolean -#define XtRLongBoolean ((char*)&XtStrings[1730]) -#endif -#ifndef XtRObject -#define XtRObject ((char*)&XtStrings[1735]) -#endif -#ifndef XtROrientation -#define XtROrientation ((char*)&XtStrings[1742]) -#endif -#ifndef XtRPixel -#define XtRPixel ((char*)&XtStrings[1754]) -#endif -#ifndef XtRPixmap -#define XtRPixmap ((char*)&XtStrings[1760]) -#endif -#ifndef XtRPointer -#define XtRPointer ((char*)&XtStrings[1767]) -#endif -#ifndef XtRPosition -#define XtRPosition ((char*)&XtStrings[1775]) -#endif -#ifndef XtRScreen -#define XtRScreen ((char*)&XtStrings[1784]) -#endif -#ifndef XtRShort -#define XtRShort ((char*)&XtStrings[1791]) -#endif -#ifndef XtRString -#define XtRString ((char*)&XtStrings[1797]) -#endif -#ifndef XtRStringArray -#define XtRStringArray ((char*)&XtStrings[1804]) -#endif -#ifndef XtRStringTable -#define XtRStringTable ((char*)&XtStrings[1816]) -#endif -#ifndef XtRUnsignedChar -#define XtRUnsignedChar ((char*)&XtStrings[1828]) -#endif -#ifndef XtRTranslationTable -#define XtRTranslationTable ((char*)&XtStrings[1841]) -#endif -#ifndef XtRVisual -#define XtRVisual ((char*)&XtStrings[1858]) -#endif -#ifndef XtRWidget -#define XtRWidget ((char*)&XtStrings[1865]) -#endif -#ifndef XtRWidgetClass -#define XtRWidgetClass ((char*)&XtStrings[1872]) -#endif -#ifndef XtRWidgetList -#define XtRWidgetList ((char*)&XtStrings[1884]) -#endif -#ifndef XtRWindow -#define XtRWindow ((char*)&XtStrings[1895]) -#endif -#ifndef XtEoff -#define XtEoff ((char*)&XtStrings[1902]) -#endif -#ifndef XtEfalse -#define XtEfalse ((char*)&XtStrings[1906]) -#endif -#ifndef XtEno -#define XtEno ((char*)&XtStrings[1912]) -#endif -#ifndef XtEon -#define XtEon ((char*)&XtStrings[1915]) -#endif -#ifndef XtEtrue -#define XtEtrue ((char*)&XtStrings[1918]) -#endif -#ifndef XtEyes -#define XtEyes ((char*)&XtStrings[1923]) -#endif -#ifndef XtEvertical -#define XtEvertical ((char*)&XtStrings[1927]) -#endif -#ifndef XtEhorizontal -#define XtEhorizontal ((char*)&XtStrings[1936]) -#endif -#ifndef XtEtextRead -#define XtEtextRead ((char*)&XtStrings[1947]) -#endif -#ifndef XtEtextAppend -#define XtEtextAppend ((char*)&XtStrings[1952]) -#endif -#ifndef XtEtextEdit -#define XtEtextEdit ((char*)&XtStrings[1959]) -#endif -#ifndef XtExtdefaultbackground -#define XtExtdefaultbackground ((char*)&XtStrings[1964]) -#endif -#ifndef XtExtdefaultforeground -#define XtExtdefaultforeground ((char*)&XtStrings[1984]) -#endif -#ifndef XtExtdefaultfont -#define XtExtdefaultfont ((char*)&XtStrings[2004]) -#endif -#ifndef XtNfontSet -#define XtNfontSet ((char*)&XtStrings[2018]) -#endif -#ifndef XtRFontSet -#define XtRFontSet ((char*)&XtStrings[2026]) -#endif -#ifndef XtCFontSet -#define XtCFontSet ((char*)&XtStrings[2034]) -#endif -#ifndef XtRGravity -#define XtRGravity ((char*)&XtStrings[2042]) -#endif -#ifndef XtNcreateHook -#define XtNcreateHook ((char*)&XtStrings[2050]) -#endif -#ifndef XtNchangeHook -#define XtNchangeHook ((char*)&XtStrings[2061]) -#endif -#ifndef XtNconfigureHook -#define XtNconfigureHook ((char*)&XtStrings[2072]) -#endif -#ifndef XtNgeometryHook -#define XtNgeometryHook ((char*)&XtStrings[2086]) -#endif -#ifndef XtNdestroyHook -#define XtNdestroyHook ((char*)&XtStrings[2099]) -#endif -#ifndef XtNshells -#define XtNshells ((char*)&XtStrings[2111]) -#endif -#ifndef XtNnumShells -#define XtNnumShells ((char*)&XtStrings[2118]) -#endif -#ifndef XtRCommandArgArray -#define XtRCommandArgArray ((char*)&XtStrings[2128]) -#endif -#ifndef XtRDirectoryString -#define XtRDirectoryString ((char*)&XtStrings[2144]) -#endif -#ifndef XtREnvironmentArray -#define XtREnvironmentArray ((char*)&XtStrings[2160]) -#endif -#ifndef XtRRestartStyle -#define XtRRestartStyle ((char*)&XtStrings[2177]) -#endif -#ifndef XtRSmcConn -#define XtRSmcConn ((char*)&XtStrings[2190]) -#endif -#ifndef XtHcreate -#define XtHcreate ((char*)&XtStrings[2198]) -#endif -#ifndef XtHsetValues -#define XtHsetValues ((char*)&XtStrings[2207]) -#endif -#ifndef XtHmanageChildren -#define XtHmanageChildren ((char*)&XtStrings[2219]) -#endif -#ifndef XtHunmanageChildren -#define XtHunmanageChildren ((char*)&XtStrings[2236]) -#endif -#ifndef XtHmanageSet -#define XtHmanageSet ((char*)&XtStrings[2255]) -#endif -#ifndef XtHunmanageSet -#define XtHunmanageSet ((char*)&XtStrings[2267]) -#endif -#ifndef XtHrealizeWidget -#define XtHrealizeWidget ((char*)&XtStrings[2281]) -#endif -#ifndef XtHunrealizeWidget -#define XtHunrealizeWidget ((char*)&XtStrings[2297]) -#endif -#ifndef XtHaddCallback -#define XtHaddCallback ((char*)&XtStrings[2315]) -#endif -#ifndef XtHaddCallbacks -#define XtHaddCallbacks ((char*)&XtStrings[2329]) -#endif -#ifndef XtHremoveCallback -#define XtHremoveCallback ((char*)&XtStrings[2344]) -#endif -#ifndef XtHremoveCallbacks -#define XtHremoveCallbacks ((char*)&XtStrings[2361]) -#endif -#ifndef XtHremoveAllCallbacks -#define XtHremoveAllCallbacks ((char*)&XtStrings[2379]) -#endif -#ifndef XtHaugmentTranslations -#define XtHaugmentTranslations ((char*)&XtStrings[2400]) -#endif -#ifndef XtHoverrideTranslations -#define XtHoverrideTranslations ((char*)&XtStrings[2422]) -#endif -#ifndef XtHuninstallTranslations -#define XtHuninstallTranslations ((char*)&XtStrings[2445]) -#endif -#ifndef XtHsetKeyboardFocus -#define XtHsetKeyboardFocus ((char*)&XtStrings[2469]) -#endif -#ifndef XtHsetWMColormapWindows -#define XtHsetWMColormapWindows ((char*)&XtStrings[2488]) -#endif -#ifndef XtHsetMappedWhenManaged -#define XtHsetMappedWhenManaged ((char*)&XtStrings[2511]) -#endif -#ifndef XtHmapWidget -#define XtHmapWidget ((char*)&XtStrings[2534]) -#endif -#ifndef XtHunmapWidget -#define XtHunmapWidget ((char*)&XtStrings[2546]) -#endif -#ifndef XtHpopup -#define XtHpopup ((char*)&XtStrings[2560]) -#endif -#ifndef XtHpopupSpringLoaded -#define XtHpopupSpringLoaded ((char*)&XtStrings[2568]) -#endif -#ifndef XtHpopdown -#define XtHpopdown ((char*)&XtStrings[2588]) -#endif -#ifndef XtHconfigure -#define XtHconfigure ((char*)&XtStrings[2598]) -#endif -#ifndef XtHpreGeometry -#define XtHpreGeometry ((char*)&XtStrings[2610]) -#endif -#ifndef XtHpostGeometry -#define XtHpostGeometry ((char*)&XtStrings[2624]) -#endif -#ifndef XtHdestroy -#define XtHdestroy ((char*)&XtStrings[2639]) -#endif -#endif /* XTSTRINGDEFINES */ - -#ifndef XTSTRINGDEFINES -#undef _XtStringDefs_h_Const -#endif - -#endif /* _XtStringDefs_h_ */ diff --git a/openflow/usr/include/X11/Sunkeysym.h b/openflow/usr/include/X11/Sunkeysym.h deleted file mode 100644 index 78d1286..0000000 --- a/openflow/usr/include/X11/Sunkeysym.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 1991, Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/************************************************************ - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -***********************************************************/ - -/* - * Floating Accent - */ - -#define SunXK_FA_Grave 0x1005FF00 -#define SunXK_FA_Circum 0x1005FF01 -#define SunXK_FA_Tilde 0x1005FF02 -#define SunXK_FA_Acute 0x1005FF03 -#define SunXK_FA_Diaeresis 0x1005FF04 -#define SunXK_FA_Cedilla 0x1005FF05 - -/* - * Miscellaneous Functions - */ - -#define SunXK_F36 0x1005FF10 /* Labeled F11 */ -#define SunXK_F37 0x1005FF11 /* Labeled F12 */ - -#define SunXK_Sys_Req 0x1005FF60 -#define SunXK_Print_Screen 0x0000FF61 /* Same as XK_Print */ - -/* - * International & Multi-Key Character Composition - */ - -#define SunXK_Compose 0x0000FF20 /* Same as XK_Multi_key */ -#define SunXK_AltGraph 0x0000FF7E /* Same as XK_Mode_switch */ - -/* - * Cursor Control - */ - -#define SunXK_PageUp 0x0000FF55 /* Same as XK_Prior */ -#define SunXK_PageDown 0x0000FF56 /* Same as XK_Next */ - -/* - * Open Look Functions - */ - -#define SunXK_Undo 0x0000FF65 /* Same as XK_Undo */ -#define SunXK_Again 0x0000FF66 /* Same as XK_Redo */ -#define SunXK_Find 0x0000FF68 /* Same as XK_Find */ -#define SunXK_Stop 0x0000FF69 /* Same as XK_Cancel */ -#define SunXK_Props 0x1005FF70 -#define SunXK_Front 0x1005FF71 -#define SunXK_Copy 0x1005FF72 -#define SunXK_Open 0x1005FF73 -#define SunXK_Paste 0x1005FF74 -#define SunXK_Cut 0x1005FF75 - -#define SunXK_PowerSwitch 0x1005FF76 -#define SunXK_AudioLowerVolume 0x1005FF77 -#define SunXK_AudioMute 0x1005FF78 -#define SunXK_AudioRaiseVolume 0x1005FF79 -#define SunXK_VideoDegauss 0x1005FF7A -#define SunXK_VideoLowerBrightness 0x1005FF7B -#define SunXK_VideoRaiseBrightness 0x1005FF7C -#define SunXK_PowerSwitchShift 0x1005FF7D diff --git a/openflow/usr/include/X11/ThreadsI.h b/openflow/usr/include/X11/ThreadsI.h deleted file mode 100644 index ff6dee3..0000000 --- a/openflow/usr/include/X11/ThreadsI.h +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************ - -Copyright (c) 1993, Oracle and/or its affiliates. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice (including the next -paragraph) shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - -********************************************************/ - -/* - -Copyright 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ -/* $XFree86: xc/lib/Xt/ThreadsI.h,v 3.5 2001/12/14 19:56:31 dawes Exp $ */ - -#ifndef _XtThreadsI_h -#define _XtThreadsI_h - -#include - -#ifdef XTHREADS - -typedef struct _LockRec *LockPtr; - -typedef void (*ThreadAppProc)( - XtAppContext /* app */ -); - -typedef void (*ThreadAppYieldLockProc)( - XtAppContext, /* app */ - Boolean*, /* push_thread */ - Boolean*, /* pushed_thread */ - int* /* level */ -); - -typedef void (*ThreadAppRestoreLockProc)( - XtAppContext /* app */, - int, /* level */ - Boolean* /* pushed_thread */ -); - -_XFUNCPROTOBEGIN - -extern void (*_XtProcessLock)( - void -); - -extern void (*_XtProcessUnlock)( - void -); - -extern void (*_XtInitAppLock)( - XtAppContext /* app */ -); - -_XFUNCPROTOEND - -#define INIT_APP_LOCK(app) if(_XtInitAppLock) (*_XtInitAppLock)(app) -#define FREE_APP_LOCK(app) if(app && app->free_lock)(*app->free_lock)(app) - -#define LOCK_PROCESS if(_XtProcessLock)(*_XtProcessLock)() -#define UNLOCK_PROCESS if(_XtProcessUnlock)(*_XtProcessUnlock)() -#define LOCK_APP(app) if(app && app->lock)(*app->lock)(app) -#define UNLOCK_APP(app) if(app && app->unlock)(*app->unlock)(app) - -#define YIELD_APP_LOCK(app,push,pushed,level)\ - if(app && app->yield_lock) (*app->yield_lock)(app,push,pushed,level) -#define RESTORE_APP_LOCK(app,level,pushed)\ - if(app && app->restore_lock) (*app->restore_lock)(app,level,pushed) - -#define WIDGET_TO_APPCON(w) \ - XtAppContext app = (w && _XtProcessLock ? \ - XtWidgetToApplicationContext(w) : NULL) - -#define DPY_TO_APPCON(d) \ - XtAppContext app = (_XtProcessLock ? XtDisplayToApplicationContext(d): NULL) - -#else /* defined(XTHREADS) */ - -#define LOCK_PROCESS -#define UNLOCK_PROCESS -#define LOCK_APP(app) -#define UNLOCK_APP(app) - -#define INIT_APP_LOCK(app) -#define FREE_APP_LOCK(app) - -#define WIDGET_TO_APPCON(w) -#define DPY_TO_APPCON(d) - -#endif /* !defined(XTHREADS) */ -#endif /* _XtThreadsI_h */ diff --git a/openflow/usr/include/X11/TranslateI.h b/openflow/usr/include/X11/TranslateI.h deleted file mode 100644 index 7da70b9..0000000 --- a/openflow/usr/include/X11/TranslateI.h +++ /dev/null @@ -1,606 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -/* - * TranslateI.h - Header file private to translation management - * - * Author: Gabe Beged-Dov, HP - * - * Former Author: Charles Haynes - * Digital Equipment Corporation - * Western Research Laboratory - * Date: Sat Aug 29 1987 - */ - -/*#define REFCNT_TRANSLATIONS*/ -#define CACHE_TRANSLATIONS - -#define TM_NO_MATCH (-2) - -#define _XtRStateTablePair "_XtStateTablePair" - -typedef unsigned char TMByteCard; -typedef unsigned short TMShortCard; -typedef unsigned long TMLongCard; -typedef short TMShortInt; - -typedef struct _TMTypeMatchRec *TMTypeMatch; -typedef struct _TMModifierMatchRec *TMModifierMatch; -typedef struct _TMEventRec *TMEventPtr; - -typedef Boolean (*MatchProc)(TMTypeMatch typeMatch, - TMModifierMatch modMatch, - TMEventPtr eventSeq); - -typedef struct _ModToKeysymTable { - Modifiers mask; - int count; - int idx; -} ModToKeysymTable; - -typedef struct _LateBindings { - unsigned int knot:1; - unsigned int pair:1; - unsigned short ref_count; /* garbage collection */ - KeySym keysym; -} LateBindings, *LateBindingsPtr; - -typedef short ModifierMask; - -typedef struct _ActionsRec *ActionPtr; -typedef struct _ActionsRec { - int idx; /* index into quarkTable to find proc */ - String *params; /* pointer to array of params */ - Cardinal num_params; /* number of params */ - ActionPtr next; /* next action to perform */ -} ActionRec; - -typedef struct _XtStateRec *StatePtr; -typedef struct _XtStateRec { - unsigned int isCycleStart:1; - unsigned int isCycleEnd:1; - TMShortCard typeIndex; - TMShortCard modIndex; - ActionPtr actions; /* rhs list of actions to perform */ - StatePtr nextLevel; -}StateRec; - - -#define XtTableReplace 0 -#define XtTableAugment 1 -#define XtTableOverride 2 -#define XtTableUnmerge 3 - -typedef unsigned int _XtTranslateOp; - -/* - * New Definitions - */ -typedef struct _TMModifierMatchRec{ - TMLongCard modifiers; - TMLongCard modifierMask; - LateBindingsPtr lateModifiers; - Boolean standard; -}TMModifierMatchRec; - -typedef struct _TMTypeMatchRec{ - TMLongCard eventType; - TMLongCard eventCode; - TMLongCard eventCodeMask; - MatchProc matchEvent; -}TMTypeMatchRec; - -typedef struct _TMBranchHeadRec { - unsigned int isSimple:1; - unsigned int hasActions:1; - unsigned int hasCycles:1; - unsigned int more:13; - TMShortCard typeIndex; - TMShortCard modIndex; -}TMBranchHeadRec, *TMBranchHead; - -/* NOTE: elements of this structure must match those of - * TMComplexStateTreeRec and TMParseStateTreeRec. - */ -typedef struct _TMSimpleStateTreeRec{ - unsigned int isSimple:1; - unsigned int isAccelerator:1; - unsigned int mappingNotifyInterest:1; - unsigned int refCount:13; - TMShortCard numBranchHeads; - TMShortCard numQuarks; /* # of entries in quarkTbl */ - TMShortCard unused; /* to ensure same alignment */ - TMBranchHeadRec *branchHeadTbl; - XrmQuark *quarkTbl; /* table of quarkified rhs*/ -}TMSimpleStateTreeRec, *TMSimpleStateTree; - -/* NOTE: elements of this structure must match those of - * TMSimpleStateTreeRec and TMParseStateTreeRec. - */ -typedef struct _TMComplexStateTreeRec{ - unsigned int isSimple:1; - unsigned int isAccelerator:1; - unsigned int mappingNotifyInterest:1; - unsigned int refCount:13; - TMShortCard numBranchHeads; - TMShortCard numQuarks; /* # of entries in quarkTbl */ - TMShortCard numComplexBranchHeads; - TMBranchHeadRec *branchHeadTbl; - XrmQuark *quarkTbl; /* table of quarkified rhs*/ - StatePtr *complexBranchHeadTbl; -}TMComplexStateTreeRec, *TMComplexStateTree; - -/* NOTE: elements of this structure must match those of - * TMSimpleStateTreeRec and TMComplexStateTreeRec. - */ -typedef struct _TMParseStateTreeRec{ - unsigned int isSimple:1; - unsigned int isAccelerator:1; - unsigned int mappingNotifyInterest:1; - unsigned int isStackQuarks:1; - unsigned int isStackBranchHeads:1; - unsigned int isStackComplexBranchHeads:1; - unsigned int unused:10; /* to ensure correct alignment */ - TMShortCard numBranchHeads; - TMShortCard numQuarks; /* # of entries in quarkTbl */ - TMShortCard numComplexBranchHeads; - TMBranchHeadRec *branchHeadTbl; - XrmQuark *quarkTbl; /* table of quarkified rhs*/ - StatePtr *complexBranchHeadTbl; - TMShortCard branchHeadTblSize; - TMShortCard quarkTblSize; /*total size of quarkTbl */ - TMShortCard complexBranchHeadTblSize; - StatePtr head; -}TMParseStateTreeRec, *TMParseStateTree; - -typedef union _TMStateTreeRec{ - TMSimpleStateTreeRec simple; - TMParseStateTreeRec parse; - TMComplexStateTreeRec complex; -}*TMStateTree, **TMStateTreePtr, **TMStateTreeList; - -typedef struct _TMSimpleBindProcsRec { - XtActionProc *procs; -}TMSimpleBindProcsRec, *TMSimpleBindProcs; - -typedef struct _TMComplexBindProcsRec { - Widget widget; /*widgetID to pass to action Proc*/ - XtTranslations aXlations; - XtActionProc *procs; -}TMComplexBindProcsRec, *TMComplexBindProcs; - -typedef struct _TMSimpleBindDataRec { - unsigned int isComplex:1; /* must be first */ - TMSimpleBindProcsRec bindTbl[1]; /* variable length */ -}TMSimpleBindDataRec, *TMSimpleBindData; - -typedef struct _TMComplexBindDataRec { - unsigned int isComplex:1; /* must be first */ - struct _ATranslationData *accel_context; /* for GetValues */ - TMComplexBindProcsRec bindTbl[1]; /* variable length */ -}TMComplexBindDataRec, *TMComplexBindData; - -typedef union _TMBindDataRec{ - TMSimpleBindDataRec simple; - TMComplexBindDataRec complex; -}*TMBindData; - -typedef struct _TranslationData{ - unsigned char hasBindings; /* must be first */ - unsigned char operation; /*replace,augment,override*/ - TMShortCard numStateTrees; - struct _TranslationData *composers[2]; - EventMask eventMask; - TMStateTree stateTreeTbl[1]; /* variable length */ -}TranslationData; - -/* - * ATranslations is returned by GetValues for translations that contain - * accelerators. The TM can differentiate between this and TranslationData - * (that don't have a bindTbl) by looking at the first field (hasBindings) - * of either structure. All ATranslationData structures associated with a - * widget are chained off the BindData record of the widget. - */ -typedef struct _ATranslationData{ - unsigned char hasBindings; /* must be first */ - unsigned char operation; - struct _TranslationData *xlations; /* actual translations */ - struct _ATranslationData *next; /* chain the contexts together */ - TMComplexBindProcsRec bindTbl[1]; /* accelerator bindings */ -}ATranslationData, *ATranslations; - -typedef struct _TMConvertRec { - XtTranslations old; /* table to merge into */ - XtTranslations new; /* table to merge from */ -} TMConvertRec; - -#define _XtEventTimerEventType ((TMLongCard)~0L) -#define KeysymModMask (1L<<27) /* private to TM */ -#define AnyButtonMask (1L<<28) /* private to TM */ - -typedef struct _EventRec { - TMLongCard modifiers; - TMLongCard modifierMask; - LateBindingsPtr lateModifiers; - TMLongCard eventType; - TMLongCard eventCode; - TMLongCard eventCodeMask; - MatchProc matchEvent; - Boolean standard; -} Event; - -typedef struct _EventSeqRec *EventSeqPtr; -typedef struct _EventSeqRec { - Event event; /* X event description */ - StatePtr state; /* private to state table builder */ - EventSeqPtr next; /* next event on line */ - ActionPtr actions; /* r.h.s. list of actions to perform */ -} EventSeqRec; - -typedef EventSeqRec EventRec; -typedef EventSeqPtr EventPtr; - -typedef struct _TMEventRec { - XEvent *xev; - Event event; -}TMEventRec; - -typedef struct _ActionHookRec { - struct _ActionHookRec* next; /* must remain first */ - XtAppContext app; - XtActionHookProc proc; - XtPointer closure; -} ActionHookRec, *ActionHook; - -/* choose a number between 2 and 8 */ -#define TMKEYCACHELOG2 6 -#define TMKEYCACHESIZE (1<> 4)])[(idx) & 15])) -#define TMGetModifierMatch(idx) \ - ((TMModifierMatch) \ - &((_XtGlobalTM.modMatchSegmentTbl[(idx) >> 4])[(idx) & 15])) - -/* Useful Access Macros */ -#define TMNewMatchSemantics() (_XtGlobalTM.newMatchSemantics) -#define TMBranchMore(branch) (branch->more) -#define TMComplexBranchHead(tree, br) \ - (((TMComplexStateTree)tree)->complexBranchHeadTbl[TMBranchMore(br)]) - -#define TMGetComplexBindEntry(bindData, idx) \ - ((TMComplexBindProcs)&(((TMComplexBindData)bindData)->bindTbl[idx])) - -#define TMGetSimpleBindEntry(bindData, idx) \ - ((TMSimpleBindProcs)&(((TMSimpleBindData)bindData)->bindTbl[idx])) - - -#define _InitializeKeysymTables(dpy, pd) \ - if (pd->keysyms == NULL) \ - _XtBuildKeysymTables(dpy, pd) - -/* - * Internal Functions - */ - -extern void _XtPopup( - Widget /* widget */, - XtGrabKind /* grab_kind */, - _XtBoolean /* spring_loaded */ -); - -extern String _XtPrintXlations( - Widget /* w */, - XtTranslations /* xlations */, - Widget /* accelWidget */, - _XtBoolean /* includeRHS */ -); - -extern void _XtRegisterGrabs( - Widget /* widget */ -); - -extern XtPointer _XtInitializeActionData( - struct _XtActionsRec * /* actions */, - Cardinal /* count */, - _XtBoolean /* inPlace */ -); - -extern void _XtAddEventSeqToStateTree( - EventSeqPtr /* eventSeq */, - TMParseStateTree /* stateTree */ -); - -extern Boolean _XtMatchUsingStandardMods( - TMTypeMatch /* typeMatch */, - TMModifierMatch /* modMatch */, - TMEventPtr /* eventSeq */ -); - -extern Boolean _XtMatchUsingDontCareMods( - TMTypeMatch /* typeMatch */, - TMModifierMatch /* modMatch */, - TMEventPtr /* eventSeq */ -); - -extern Boolean _XtRegularMatch( - TMTypeMatch /* typeMatch */, - TMModifierMatch /* modMatch */, - TMEventPtr /* eventSeq */ -); - -extern Boolean _XtMatchAtom( - TMTypeMatch /* typeMatch */, - TMModifierMatch /* modMatch */, - TMEventPtr /* eventSeq */ -); - -extern void _XtTranslateEvent( - Widget /* widget */, - XEvent* /* event */ -); - -#include "CallbackI.h" -#include "EventI.h" -#include "HookObjI.h" -#include "PassivGraI.h" -#include "ThreadsI.h" -#include "InitialI.h" -#include "ResourceI.h" -#include "StringDefs.h" - -extern void _XtBuildKeysymTables(Display *dpy, XtPerDisplay pd); - -#ifndef NO_MIT_HACKS -extern void _XtDisplayTranslations( - Widget /* widget */, - XEvent* /* event */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern void _XtDisplayAccelerators( - Widget /* widget */, - XEvent* /* event */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern void _XtDisplayInstalledAccelerators( - Widget /* widget */, - XEvent* /* event */, - String* /* params */, - Cardinal* /* num_params */ -); -#endif /* ifndef NO_MIT_HACKS */ - -extern void _XtPopupInitialize( - XtAppContext /* app_context */ -); - -extern void _XtBindActions( - Widget /* widget */, - XtTM /* tm_rec */ -); - -extern Boolean _XtComputeLateBindings( - Display* /* dpy */, - LateBindingsPtr /* lateModifiers */, - Modifiers* /* computed */, - Modifiers* /* computedMask */ -); - -extern XtTranslations _XtCreateXlations( - TMStateTree * /* stateTrees */, - TMShortCard /* numStateTrees */, - XtTranslations /* first */, - XtTranslations /* second */ -); - -extern Boolean _XtCvtMergeTranslations( - Display* /* dpy */, - XrmValuePtr /* args */, - Cardinal* /* num_args */, - XrmValuePtr /* from */, - XrmValuePtr /* to */, - XtPointer* /* closure_ret */ -); - -void _XtRemoveStateTreeByIndex( - XtTranslations /* xlations */, - TMShortCard /* i */); - -void _XtFreeTranslations( - XtAppContext /* app */, - XrmValuePtr /* toVal */, - XtPointer /* closure */, - XrmValuePtr /* args */, - Cardinal* /* num_args */ -); - -extern TMShortCard _XtGetModifierIndex( - Event* /* event */ -); - -extern TMShortCard _XtGetQuarkIndex( - TMParseStateTree /* stateTreePtr */, - XrmQuark /* quark */ -); - -extern XtTranslations _XtGetTranslationValue( - Widget /* widget */ -); - -extern TMShortCard _XtGetTypeIndex( - Event* /* event */ -); - -extern void _XtGrabInitialize( - XtAppContext /* app */ -); - -extern void _XtInstallTranslations( - Widget /* widget */ -); - -extern void _XtRemoveTranslations( - Widget /* widget */ -); - -extern void _XtDestroyTMData( - Widget /* widget */ -); - -extern void _XtMergeTranslations( - Widget /* widget */, - XtTranslations /* newXlations */, - _XtTranslateOp /* operation */ -); - -extern void _XtActionInitialize( - XtAppContext /* app */ -); - -extern TMStateTree _XtParseTreeToStateTree( - TMParseStateTree /* parseTree */ -); - -extern String _XtPrintActions( - ActionRec* /* actions */, - XrmQuark* /* quarkTbl */ -); - -extern String _XtPrintState( - TMStateTree /* stateTree */, - TMBranchHead /* branchHead */); - -extern String _XtPrintEventSeq( - EventSeqPtr /* eventSeq */, - Display* /* dpy */ -); - -typedef Boolean (*_XtTraversalProc)( - StatePtr /* state */, - XtPointer /* data */ -); - -extern void _XtTraverseStateTree( - TMStateTree /* tree */, - _XtTraversalProc /* func */, - XtPointer /* data */ -); - -extern void _XtTranslateInitialize( - void -); - -extern void _XtAddTMConverters( - ConverterTable /* table */ -); - -extern void _XtUnbindActions( - Widget /* widget */, - XtTranslations /* xlations */, - TMBindData /* bindData */ -); - -extern void _XtUnmergeTranslations( - Widget /* widget */, - XtTranslations /* xlations */ -); - -/* TMKey.c */ -extern void _XtAllocTMContext(XtPerDisplay pd); - -_XFUNCPROTOEND diff --git a/openflow/usr/include/X11/VarargsI.h b/openflow/usr/include/X11/VarargsI.h deleted file mode 100644 index 790a271..0000000 --- a/openflow/usr/include/X11/VarargsI.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - -Copyright 1985, 1986, 1987, 1988, 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifndef _VarargsI_h_ -#define _VarargsI_h_ - -#include - -/* private routines */ - -_XFUNCPROTOBEGIN - -extern void _XtCountVaList( - va_list /*var*/, int* /*total_count*/, int* /*typed_count*/ -); - -extern void _XtVaToArgList( - Widget /*widget*/, va_list /*var*/, int /*max_count*/, ArgList* /*args_return*/, Cardinal* /*num_args_return*/ -); - -extern void _XtVaToTypedArgList( - va_list /*var*/, int /*count*/, XtTypedArgList* /*args_return*/, Cardinal* /*num_args_return*/ -); - -extern XtTypedArgList _XtVaCreateTypedArgList( - va_list /*var*/, int /*count*/ -); - -extern void _XtFreeArgList( - ArgList /*args*/, int /*total_count*/, int /*typed_count*/ -); - -extern void _XtGetApplicationResources( - Widget /*w*/, XtPointer /*base*/, XtResourceList /*resources*/, Cardinal /*num_resources*/, ArgList /*args*/, Cardinal /*num_args*/, XtTypedArgList /*typed_args*/, Cardinal /*num_typed_args*/ -); - -extern void _XtGetSubresources( - Widget /*w*/, XtPointer /*base*/, const char* /*name*/, const char* /*class*/, XtResourceList /*resources*/, Cardinal /*num_resources*/, ArgList /*args*/, Cardinal /*num_args*/, XtTypedArgList /*typed_args*/, Cardinal /*num_typed_args*/ -); - -_XFUNCPROTOEND - -#endif /* _VarargsI_h_ */ diff --git a/openflow/usr/include/X11/Vendor.h b/openflow/usr/include/X11/Vendor.h deleted file mode 100644 index 6d783c6..0000000 --- a/openflow/usr/include/X11/Vendor.h +++ /dev/null @@ -1,70 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _XtVendor_h -#define _XtVendor_h - -#include - -/*********************************************************************** - * - * VendorShell Widget - * - ***********************************************************************/ - -/* Class record constants */ - -typedef struct _VendorShellClassRec *VendorShellWidgetClass; - -_XFUNCPROTOBEGIN - -externalref WidgetClass vendorShellWidgetClass; - -_XFUNCPROTOEND - -#endif /* _XtVendor_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/VendorP.h b/openflow/usr/include/X11/VendorP.h deleted file mode 100644 index 4eb9404..0000000 --- a/openflow/usr/include/X11/VendorP.h +++ /dev/null @@ -1,102 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -/* - * VendorP.h - Private definitions for VendorShell widget - * - * Author: Paul Asente - * Digital Equipment Corporation - * Western Software Laboratory - * Date: Thu Dec 3, 1987 - */ - -/*********************************************************************** - * - * VendorShell Widget Private Data - * - ***********************************************************************/ - -#ifndef _XtVendorPrivate_h -#define _XtVendorPrivate_h - -#include - -/* New fields for the VendorShell widget class record */ - -_XFUNCPROTOBEGIN - -typedef struct { - XtPointer extension; /* pointer to extension record */ -} VendorShellClassPart; - -typedef struct _VendorShellClassRec { - CoreClassPart core_class; - CompositeClassPart composite_class; - ShellClassPart shell_class; - WMShellClassPart wm_shell_class; - VendorShellClassPart vendor_shell_class; -} VendorShellClassRec; - -externalref VendorShellClassRec vendorShellClassRec; - -/* New fields for the vendor shell widget. */ - -typedef struct { - int vendor_specific; -} VendorShellPart; - -typedef struct { - CorePart core; - CompositePart composite; - ShellPart shell; - WMShellPart wm; - VendorShellPart vendor; -} VendorShellRec, *VendorShellWidget; - -_XFUNCPROTOEND - -#endif /* _XtVendorPrivate_h */ diff --git a/openflow/usr/include/X11/X.h b/openflow/usr/include/X11/X.h deleted file mode 100644 index 5cf695d..0000000 --- a/openflow/usr/include/X11/X.h +++ /dev/null @@ -1,717 +0,0 @@ -/* Definitions for the X window system likely to be used by applications */ - -#ifndef X_H -#define X_H - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#define X_PROTOCOL 11 /* current protocol version */ -#define X_PROTOCOL_REVISION 0 /* current minor version */ - -/* Resources */ - -/* - * _XSERVER64 must ONLY be defined when compiling X server sources on - * systems where unsigned long is not 32 bits, must NOT be used in - * client or library code. - */ -#ifndef _XSERVER64 -# ifndef _XTYPEDEF_XID -# define _XTYPEDEF_XID -typedef unsigned long XID; -# endif -# ifndef _XTYPEDEF_MASK -# define _XTYPEDEF_MASK -typedef unsigned long Mask; -# endif -# ifndef _XTYPEDEF_ATOM -# define _XTYPEDEF_ATOM -typedef unsigned long Atom; /* Also in Xdefs.h */ -# endif -typedef unsigned long VisualID; -typedef unsigned long Time; -#else -# include -# ifndef _XTYPEDEF_XID -# define _XTYPEDEF_XID -typedef CARD32 XID; -# endif -# ifndef _XTYPEDEF_MASK -# define _XTYPEDEF_MASK -typedef CARD32 Mask; -# endif -# ifndef _XTYPEDEF_ATOM -# define _XTYPEDEF_ATOM -typedef CARD32 Atom; -# endif -typedef CARD32 VisualID; -typedef CARD32 Time; -#endif - -typedef XID Window; -typedef XID Drawable; -#ifndef _XTYPEDEF_FONT -# define _XTYPEDEF_FONT -typedef XID Font; -#endif -typedef XID Pixmap; -typedef XID Cursor; -typedef XID Colormap; -typedef XID GContext; -typedef XID KeySym; - -typedef unsigned char KeyCode; - -/***************************************************************** - * RESERVED RESOURCE AND CONSTANT DEFINITIONS - *****************************************************************/ - -#ifndef None -#define None 0L /* universal null resource or null atom */ -#endif - -#define ParentRelative 1L /* background pixmap in CreateWindow - and ChangeWindowAttributes */ - -#define CopyFromParent 0L /* border pixmap in CreateWindow - and ChangeWindowAttributes - special VisualID and special window - class passed to CreateWindow */ - -#define PointerWindow 0L /* destination window in SendEvent */ -#define InputFocus 1L /* destination window in SendEvent */ - -#define PointerRoot 1L /* focus window in SetInputFocus */ - -#define AnyPropertyType 0L /* special Atom, passed to GetProperty */ - -#define AnyKey 0L /* special Key Code, passed to GrabKey */ - -#define AnyButton 0L /* special Button Code, passed to GrabButton */ - -#define AllTemporary 0L /* special Resource ID passed to KillClient */ - -#define CurrentTime 0L /* special Time */ - -#define NoSymbol 0L /* special KeySym */ - -/***************************************************************** - * EVENT DEFINITIONS - *****************************************************************/ - -/* Input Event Masks. Used as event-mask window attribute and as arguments - to Grab requests. Not to be confused with event names. */ - -#define NoEventMask 0L -#define KeyPressMask (1L<<0) -#define KeyReleaseMask (1L<<1) -#define ButtonPressMask (1L<<2) -#define ButtonReleaseMask (1L<<3) -#define EnterWindowMask (1L<<4) -#define LeaveWindowMask (1L<<5) -#define PointerMotionMask (1L<<6) -#define PointerMotionHintMask (1L<<7) -#define Button1MotionMask (1L<<8) -#define Button2MotionMask (1L<<9) -#define Button3MotionMask (1L<<10) -#define Button4MotionMask (1L<<11) -#define Button5MotionMask (1L<<12) -#define ButtonMotionMask (1L<<13) -#define KeymapStateMask (1L<<14) -#define ExposureMask (1L<<15) -#define VisibilityChangeMask (1L<<16) -#define StructureNotifyMask (1L<<17) -#define ResizeRedirectMask (1L<<18) -#define SubstructureNotifyMask (1L<<19) -#define SubstructureRedirectMask (1L<<20) -#define FocusChangeMask (1L<<21) -#define PropertyChangeMask (1L<<22) -#define ColormapChangeMask (1L<<23) -#define OwnerGrabButtonMask (1L<<24) - -/* Event names. Used in "type" field in XEvent structures. Not to be -confused with event masks above. They start from 2 because 0 and 1 -are reserved in the protocol for errors and replies. */ - -#define KeyPress 2 -#define KeyRelease 3 -#define ButtonPress 4 -#define ButtonRelease 5 -#define MotionNotify 6 -#define EnterNotify 7 -#define LeaveNotify 8 -#define FocusIn 9 -#define FocusOut 10 -#define KeymapNotify 11 -#define Expose 12 -#define GraphicsExpose 13 -#define NoExpose 14 -#define VisibilityNotify 15 -#define CreateNotify 16 -#define DestroyNotify 17 -#define UnmapNotify 18 -#define MapNotify 19 -#define MapRequest 20 -#define ReparentNotify 21 -#define ConfigureNotify 22 -#define ConfigureRequest 23 -#define GravityNotify 24 -#define ResizeRequest 25 -#define CirculateNotify 26 -#define CirculateRequest 27 -#define PropertyNotify 28 -#define SelectionClear 29 -#define SelectionRequest 30 -#define SelectionNotify 31 -#define ColormapNotify 32 -#define ClientMessage 33 -#define MappingNotify 34 -#define GenericEvent 35 -#define LASTEvent 36 /* must be bigger than any event # */ - - -/* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer, - state in various key-, mouse-, and button-related events. */ - -#define ShiftMask (1<<0) -#define LockMask (1<<1) -#define ControlMask (1<<2) -#define Mod1Mask (1<<3) -#define Mod2Mask (1<<4) -#define Mod3Mask (1<<5) -#define Mod4Mask (1<<6) -#define Mod5Mask (1<<7) - -/* modifier names. Used to build a SetModifierMapping request or - to read a GetModifierMapping request. These correspond to the - masks defined above. */ -#define ShiftMapIndex 0 -#define LockMapIndex 1 -#define ControlMapIndex 2 -#define Mod1MapIndex 3 -#define Mod2MapIndex 4 -#define Mod3MapIndex 5 -#define Mod4MapIndex 6 -#define Mod5MapIndex 7 - - -/* button masks. Used in same manner as Key masks above. Not to be confused - with button names below. */ - -#define Button1Mask (1<<8) -#define Button2Mask (1<<9) -#define Button3Mask (1<<10) -#define Button4Mask (1<<11) -#define Button5Mask (1<<12) - -#define AnyModifier (1<<15) /* used in GrabButton, GrabKey */ - - -/* button names. Used as arguments to GrabButton and as detail in ButtonPress - and ButtonRelease events. Not to be confused with button masks above. - Note that 0 is already defined above as "AnyButton". */ - -#define Button1 1 -#define Button2 2 -#define Button3 3 -#define Button4 4 -#define Button5 5 - -/* Notify modes */ - -#define NotifyNormal 0 -#define NotifyGrab 1 -#define NotifyUngrab 2 -#define NotifyWhileGrabbed 3 - -#define NotifyHint 1 /* for MotionNotify events */ - -/* Notify detail */ - -#define NotifyAncestor 0 -#define NotifyVirtual 1 -#define NotifyInferior 2 -#define NotifyNonlinear 3 -#define NotifyNonlinearVirtual 4 -#define NotifyPointer 5 -#define NotifyPointerRoot 6 -#define NotifyDetailNone 7 - -/* Visibility notify */ - -#define VisibilityUnobscured 0 -#define VisibilityPartiallyObscured 1 -#define VisibilityFullyObscured 2 - -/* Circulation request */ - -#define PlaceOnTop 0 -#define PlaceOnBottom 1 - -/* protocol families */ - -#define FamilyInternet 0 /* IPv4 */ -#define FamilyDECnet 1 -#define FamilyChaos 2 -#define FamilyInternet6 6 /* IPv6 */ - -/* authentication families not tied to a specific protocol */ -#define FamilyServerInterpreted 5 - -/* Property notification */ - -#define PropertyNewValue 0 -#define PropertyDelete 1 - -/* Color Map notification */ - -#define ColormapUninstalled 0 -#define ColormapInstalled 1 - -/* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */ - -#define GrabModeSync 0 -#define GrabModeAsync 1 - -/* GrabPointer, GrabKeyboard reply status */ - -#define GrabSuccess 0 -#define AlreadyGrabbed 1 -#define GrabInvalidTime 2 -#define GrabNotViewable 3 -#define GrabFrozen 4 - -/* AllowEvents modes */ - -#define AsyncPointer 0 -#define SyncPointer 1 -#define ReplayPointer 2 -#define AsyncKeyboard 3 -#define SyncKeyboard 4 -#define ReplayKeyboard 5 -#define AsyncBoth 6 -#define SyncBoth 7 - -/* Used in SetInputFocus, GetInputFocus */ - -#define RevertToNone (int)None -#define RevertToPointerRoot (int)PointerRoot -#define RevertToParent 2 - -/***************************************************************** - * ERROR CODES - *****************************************************************/ - -#define Success 0 /* everything's okay */ -#define BadRequest 1 /* bad request code */ -#define BadValue 2 /* int parameter out of range */ -#define BadWindow 3 /* parameter not a Window */ -#define BadPixmap 4 /* parameter not a Pixmap */ -#define BadAtom 5 /* parameter not an Atom */ -#define BadCursor 6 /* parameter not a Cursor */ -#define BadFont 7 /* parameter not a Font */ -#define BadMatch 8 /* parameter mismatch */ -#define BadDrawable 9 /* parameter not a Pixmap or Window */ -#define BadAccess 10 /* depending on context: - - key/button already grabbed - - attempt to free an illegal - cmap entry - - attempt to store into a read-only - color map entry. - - attempt to modify the access control - list from other than the local host. - */ -#define BadAlloc 11 /* insufficient resources */ -#define BadColor 12 /* no such colormap */ -#define BadGC 13 /* parameter not a GC */ -#define BadIDChoice 14 /* choice not in range or already used */ -#define BadName 15 /* font or color name doesn't exist */ -#define BadLength 16 /* Request length incorrect */ -#define BadImplementation 17 /* server is defective */ - -#define FirstExtensionError 128 -#define LastExtensionError 255 - -/***************************************************************** - * WINDOW DEFINITIONS - *****************************************************************/ - -/* Window classes used by CreateWindow */ -/* Note that CopyFromParent is already defined as 0 above */ - -#define InputOutput 1 -#define InputOnly 2 - -/* Window attributes for CreateWindow and ChangeWindowAttributes */ - -#define CWBackPixmap (1L<<0) -#define CWBackPixel (1L<<1) -#define CWBorderPixmap (1L<<2) -#define CWBorderPixel (1L<<3) -#define CWBitGravity (1L<<4) -#define CWWinGravity (1L<<5) -#define CWBackingStore (1L<<6) -#define CWBackingPlanes (1L<<7) -#define CWBackingPixel (1L<<8) -#define CWOverrideRedirect (1L<<9) -#define CWSaveUnder (1L<<10) -#define CWEventMask (1L<<11) -#define CWDontPropagate (1L<<12) -#define CWColormap (1L<<13) -#define CWCursor (1L<<14) - -/* ConfigureWindow structure */ - -#define CWX (1<<0) -#define CWY (1<<1) -#define CWWidth (1<<2) -#define CWHeight (1<<3) -#define CWBorderWidth (1<<4) -#define CWSibling (1<<5) -#define CWStackMode (1<<6) - - -/* Bit Gravity */ - -#define ForgetGravity 0 -#define NorthWestGravity 1 -#define NorthGravity 2 -#define NorthEastGravity 3 -#define WestGravity 4 -#define CenterGravity 5 -#define EastGravity 6 -#define SouthWestGravity 7 -#define SouthGravity 8 -#define SouthEastGravity 9 -#define StaticGravity 10 - -/* Window gravity + bit gravity above */ - -#define UnmapGravity 0 - -/* Used in CreateWindow for backing-store hint */ - -#define NotUseful 0 -#define WhenMapped 1 -#define Always 2 - -/* Used in GetWindowAttributes reply */ - -#define IsUnmapped 0 -#define IsUnviewable 1 -#define IsViewable 2 - -/* Used in ChangeSaveSet */ - -#define SetModeInsert 0 -#define SetModeDelete 1 - -/* Used in ChangeCloseDownMode */ - -#define DestroyAll 0 -#define RetainPermanent 1 -#define RetainTemporary 2 - -/* Window stacking method (in configureWindow) */ - -#define Above 0 -#define Below 1 -#define TopIf 2 -#define BottomIf 3 -#define Opposite 4 - -/* Circulation direction */ - -#define RaiseLowest 0 -#define LowerHighest 1 - -/* Property modes */ - -#define PropModeReplace 0 -#define PropModePrepend 1 -#define PropModeAppend 2 - -/***************************************************************** - * GRAPHICS DEFINITIONS - *****************************************************************/ - -/* graphics functions, as in GC.alu */ - -#define GXclear 0x0 /* 0 */ -#define GXand 0x1 /* src AND dst */ -#define GXandReverse 0x2 /* src AND NOT dst */ -#define GXcopy 0x3 /* src */ -#define GXandInverted 0x4 /* NOT src AND dst */ -#define GXnoop 0x5 /* dst */ -#define GXxor 0x6 /* src XOR dst */ -#define GXor 0x7 /* src OR dst */ -#define GXnor 0x8 /* NOT src AND NOT dst */ -#define GXequiv 0x9 /* NOT src XOR dst */ -#define GXinvert 0xa /* NOT dst */ -#define GXorReverse 0xb /* src OR NOT dst */ -#define GXcopyInverted 0xc /* NOT src */ -#define GXorInverted 0xd /* NOT src OR dst */ -#define GXnand 0xe /* NOT src OR NOT dst */ -#define GXset 0xf /* 1 */ - -/* LineStyle */ - -#define LineSolid 0 -#define LineOnOffDash 1 -#define LineDoubleDash 2 - -/* capStyle */ - -#define CapNotLast 0 -#define CapButt 1 -#define CapRound 2 -#define CapProjecting 3 - -/* joinStyle */ - -#define JoinMiter 0 -#define JoinRound 1 -#define JoinBevel 2 - -/* fillStyle */ - -#define FillSolid 0 -#define FillTiled 1 -#define FillStippled 2 -#define FillOpaqueStippled 3 - -/* fillRule */ - -#define EvenOddRule 0 -#define WindingRule 1 - -/* subwindow mode */ - -#define ClipByChildren 0 -#define IncludeInferiors 1 - -/* SetClipRectangles ordering */ - -#define Unsorted 0 -#define YSorted 1 -#define YXSorted 2 -#define YXBanded 3 - -/* CoordinateMode for drawing routines */ - -#define CoordModeOrigin 0 /* relative to the origin */ -#define CoordModePrevious 1 /* relative to previous point */ - -/* Polygon shapes */ - -#define Complex 0 /* paths may intersect */ -#define Nonconvex 1 /* no paths intersect, but not convex */ -#define Convex 2 /* wholly convex */ - -/* Arc modes for PolyFillArc */ - -#define ArcChord 0 /* join endpoints of arc */ -#define ArcPieSlice 1 /* join endpoints to center of arc */ - -/* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into - GC.stateChanges */ - -#define GCFunction (1L<<0) -#define GCPlaneMask (1L<<1) -#define GCForeground (1L<<2) -#define GCBackground (1L<<3) -#define GCLineWidth (1L<<4) -#define GCLineStyle (1L<<5) -#define GCCapStyle (1L<<6) -#define GCJoinStyle (1L<<7) -#define GCFillStyle (1L<<8) -#define GCFillRule (1L<<9) -#define GCTile (1L<<10) -#define GCStipple (1L<<11) -#define GCTileStipXOrigin (1L<<12) -#define GCTileStipYOrigin (1L<<13) -#define GCFont (1L<<14) -#define GCSubwindowMode (1L<<15) -#define GCGraphicsExposures (1L<<16) -#define GCClipXOrigin (1L<<17) -#define GCClipYOrigin (1L<<18) -#define GCClipMask (1L<<19) -#define GCDashOffset (1L<<20) -#define GCDashList (1L<<21) -#define GCArcMode (1L<<22) - -#define GCLastBit 22 -/***************************************************************** - * FONTS - *****************************************************************/ - -/* used in QueryFont -- draw direction */ - -#define FontLeftToRight 0 -#define FontRightToLeft 1 - -#define FontChange 255 - -/***************************************************************** - * IMAGING - *****************************************************************/ - -/* ImageFormat -- PutImage, GetImage */ - -#define XYBitmap 0 /* depth 1, XYFormat */ -#define XYPixmap 1 /* depth == drawable depth */ -#define ZPixmap 2 /* depth == drawable depth */ - -/***************************************************************** - * COLOR MAP STUFF - *****************************************************************/ - -/* For CreateColormap */ - -#define AllocNone 0 /* create map with no entries */ -#define AllocAll 1 /* allocate entire map writeable */ - - -/* Flags used in StoreNamedColor, StoreColors */ - -#define DoRed (1<<0) -#define DoGreen (1<<1) -#define DoBlue (1<<2) - -/***************************************************************** - * CURSOR STUFF - *****************************************************************/ - -/* QueryBestSize Class */ - -#define CursorShape 0 /* largest size that can be displayed */ -#define TileShape 1 /* size tiled fastest */ -#define StippleShape 2 /* size stippled fastest */ - -/***************************************************************** - * KEYBOARD/POINTER STUFF - *****************************************************************/ - -#define AutoRepeatModeOff 0 -#define AutoRepeatModeOn 1 -#define AutoRepeatModeDefault 2 - -#define LedModeOff 0 -#define LedModeOn 1 - -/* masks for ChangeKeyboardControl */ - -#define KBKeyClickPercent (1L<<0) -#define KBBellPercent (1L<<1) -#define KBBellPitch (1L<<2) -#define KBBellDuration (1L<<3) -#define KBLed (1L<<4) -#define KBLedMode (1L<<5) -#define KBKey (1L<<6) -#define KBAutoRepeatMode (1L<<7) - -#define MappingSuccess 0 -#define MappingBusy 1 -#define MappingFailed 2 - -#define MappingModifier 0 -#define MappingKeyboard 1 -#define MappingPointer 2 - -/***************************************************************** - * SCREEN SAVER STUFF - *****************************************************************/ - -#define DontPreferBlanking 0 -#define PreferBlanking 1 -#define DefaultBlanking 2 - -#define DisableScreenSaver 0 -#define DisableScreenInterval 0 - -#define DontAllowExposures 0 -#define AllowExposures 1 -#define DefaultExposures 2 - -/* for ForceScreenSaver */ - -#define ScreenSaverReset 0 -#define ScreenSaverActive 1 - -/***************************************************************** - * HOSTS AND CONNECTIONS - *****************************************************************/ - -/* for ChangeHosts */ - -#define HostInsert 0 -#define HostDelete 1 - -/* for ChangeAccessControl */ - -#define EnableAccess 1 -#define DisableAccess 0 - -/* Display classes used in opening the connection - * Note that the statically allocated ones are even numbered and the - * dynamically changeable ones are odd numbered */ - -#define StaticGray 0 -#define GrayScale 1 -#define StaticColor 2 -#define PseudoColor 3 -#define TrueColor 4 -#define DirectColor 5 - - -/* Byte order used in imageByteOrder and bitmapBitOrder */ - -#define LSBFirst 0 -#define MSBFirst 1 - -#endif /* X_H */ diff --git a/openflow/usr/include/X11/XF86keysym.h b/openflow/usr/include/X11/XF86keysym.h deleted file mode 100644 index 8b5646e..0000000 --- a/openflow/usr/include/X11/XF86keysym.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - * XFree86 vendor specific keysyms. - * - * The XFree86 keysym range is 0x10080001 - 0x1008FFFF. - * - * X.Org will not be adding to the XF86 set of keysyms, though they have - * been adopted and are considered a "standard" part of X keysym definitions. - * XFree86 never properly commented these keysyms, so we have done our - * best to explain the semantic meaning of these keys. - * - * XFree86 has removed their mail archives of the period, that might have - * shed more light on some of these definitions. Until/unless we resurrect - * these archives, these are from memory and usage. - */ - -/* - * ModeLock - * - * This one is old, and not really used any more since XKB offers this - * functionality. - */ - -#define XF86XK_ModeLock 0x1008FF01 /* Mode Switch Lock */ - -/* Backlight controls. */ -#define XF86XK_MonBrightnessUp 0x1008FF02 /* Monitor/panel brightness */ -#define XF86XK_MonBrightnessDown 0x1008FF03 /* Monitor/panel brightness */ -#define XF86XK_KbdLightOnOff 0x1008FF04 /* Keyboards may be lit */ -#define XF86XK_KbdBrightnessUp 0x1008FF05 /* Keyboards may be lit */ -#define XF86XK_KbdBrightnessDown 0x1008FF06 /* Keyboards may be lit */ - -/* - * Keys found on some "Internet" keyboards. - */ -#define XF86XK_Standby 0x1008FF10 /* System into standby mode */ -#define XF86XK_AudioLowerVolume 0x1008FF11 /* Volume control down */ -#define XF86XK_AudioMute 0x1008FF12 /* Mute sound from the system */ -#define XF86XK_AudioRaiseVolume 0x1008FF13 /* Volume control up */ -#define XF86XK_AudioPlay 0x1008FF14 /* Start playing of audio > */ -#define XF86XK_AudioStop 0x1008FF15 /* Stop playing audio */ -#define XF86XK_AudioPrev 0x1008FF16 /* Previous track */ -#define XF86XK_AudioNext 0x1008FF17 /* Next track */ -#define XF86XK_HomePage 0x1008FF18 /* Display user's home page */ -#define XF86XK_Mail 0x1008FF19 /* Invoke user's mail program */ -#define XF86XK_Start 0x1008FF1A /* Start application */ -#define XF86XK_Search 0x1008FF1B /* Search */ -#define XF86XK_AudioRecord 0x1008FF1C /* Record audio application */ - -/* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere) */ -#define XF86XK_Calculator 0x1008FF1D /* Invoke calculator program */ -#define XF86XK_Memo 0x1008FF1E /* Invoke Memo taking program */ -#define XF86XK_ToDoList 0x1008FF1F /* Invoke To Do List program */ -#define XF86XK_Calendar 0x1008FF20 /* Invoke Calendar program */ -#define XF86XK_PowerDown 0x1008FF21 /* Deep sleep the system */ -#define XF86XK_ContrastAdjust 0x1008FF22 /* Adjust screen contrast */ -#define XF86XK_RockerUp 0x1008FF23 /* Rocker switches exist up */ -#define XF86XK_RockerDown 0x1008FF24 /* and down */ -#define XF86XK_RockerEnter 0x1008FF25 /* and let you press them */ - -/* Some more "Internet" keyboard symbols */ -#define XF86XK_Back 0x1008FF26 /* Like back on a browser */ -#define XF86XK_Forward 0x1008FF27 /* Like forward on a browser */ -#define XF86XK_Stop 0x1008FF28 /* Stop current operation */ -#define XF86XK_Refresh 0x1008FF29 /* Refresh the page */ -#define XF86XK_PowerOff 0x1008FF2A /* Power off system entirely */ -#define XF86XK_WakeUp 0x1008FF2B /* Wake up system from sleep */ -#define XF86XK_Eject 0x1008FF2C /* Eject device (e.g. DVD) */ -#define XF86XK_ScreenSaver 0x1008FF2D /* Invoke screensaver */ -#define XF86XK_WWW 0x1008FF2E /* Invoke web browser */ -#define XF86XK_Sleep 0x1008FF2F /* Put system to sleep */ -#define XF86XK_Favorites 0x1008FF30 /* Show favorite locations */ -#define XF86XK_AudioPause 0x1008FF31 /* Pause audio playing */ -#define XF86XK_AudioMedia 0x1008FF32 /* Launch media collection app */ -#define XF86XK_MyComputer 0x1008FF33 /* Display "My Computer" window */ -#define XF86XK_VendorHome 0x1008FF34 /* Display vendor home web site */ -#define XF86XK_LightBulb 0x1008FF35 /* Light bulb keys exist */ -#define XF86XK_Shop 0x1008FF36 /* Display shopping web site */ -#define XF86XK_History 0x1008FF37 /* Show history of web surfing */ -#define XF86XK_OpenURL 0x1008FF38 /* Open selected URL */ -#define XF86XK_AddFavorite 0x1008FF39 /* Add URL to favorites list */ -#define XF86XK_HotLinks 0x1008FF3A /* Show "hot" links */ -#define XF86XK_BrightnessAdjust 0x1008FF3B /* Invoke brightness adj. UI */ -#define XF86XK_Finance 0x1008FF3C /* Display financial site */ -#define XF86XK_Community 0x1008FF3D /* Display user's community */ -#define XF86XK_AudioRewind 0x1008FF3E /* "rewind" audio track */ -#define XF86XK_BackForward 0x1008FF3F /* ??? */ -#define XF86XK_Launch0 0x1008FF40 /* Launch Application */ -#define XF86XK_Launch1 0x1008FF41 /* Launch Application */ -#define XF86XK_Launch2 0x1008FF42 /* Launch Application */ -#define XF86XK_Launch3 0x1008FF43 /* Launch Application */ -#define XF86XK_Launch4 0x1008FF44 /* Launch Application */ -#define XF86XK_Launch5 0x1008FF45 /* Launch Application */ -#define XF86XK_Launch6 0x1008FF46 /* Launch Application */ -#define XF86XK_Launch7 0x1008FF47 /* Launch Application */ -#define XF86XK_Launch8 0x1008FF48 /* Launch Application */ -#define XF86XK_Launch9 0x1008FF49 /* Launch Application */ -#define XF86XK_LaunchA 0x1008FF4A /* Launch Application */ -#define XF86XK_LaunchB 0x1008FF4B /* Launch Application */ -#define XF86XK_LaunchC 0x1008FF4C /* Launch Application */ -#define XF86XK_LaunchD 0x1008FF4D /* Launch Application */ -#define XF86XK_LaunchE 0x1008FF4E /* Launch Application */ -#define XF86XK_LaunchF 0x1008FF4F /* Launch Application */ - -#define XF86XK_ApplicationLeft 0x1008FF50 /* switch to application, left */ -#define XF86XK_ApplicationRight 0x1008FF51 /* switch to application, right*/ -#define XF86XK_Book 0x1008FF52 /* Launch bookreader */ -#define XF86XK_CD 0x1008FF53 /* Launch CD/DVD player */ -#define XF86XK_Calculater 0x1008FF54 /* Launch Calculater */ -#define XF86XK_Clear 0x1008FF55 /* Clear window, screen */ -#define XF86XK_Close 0x1008FF56 /* Close window */ -#define XF86XK_Copy 0x1008FF57 /* Copy selection */ -#define XF86XK_Cut 0x1008FF58 /* Cut selection */ -#define XF86XK_Display 0x1008FF59 /* Output switch key */ -#define XF86XK_DOS 0x1008FF5A /* Launch DOS (emulation) */ -#define XF86XK_Documents 0x1008FF5B /* Open documents window */ -#define XF86XK_Excel 0x1008FF5C /* Launch spread sheet */ -#define XF86XK_Explorer 0x1008FF5D /* Launch file explorer */ -#define XF86XK_Game 0x1008FF5E /* Launch game */ -#define XF86XK_Go 0x1008FF5F /* Go to URL */ -#define XF86XK_iTouch 0x1008FF60 /* Logitch iTouch- don't use */ -#define XF86XK_LogOff 0x1008FF61 /* Log off system */ -#define XF86XK_Market 0x1008FF62 /* ?? */ -#define XF86XK_Meeting 0x1008FF63 /* enter meeting in calendar */ -#define XF86XK_MenuKB 0x1008FF65 /* distingush keyboard from PB */ -#define XF86XK_MenuPB 0x1008FF66 /* distinuish PB from keyboard */ -#define XF86XK_MySites 0x1008FF67 /* Favourites */ -#define XF86XK_New 0x1008FF68 /* New (folder, document... */ -#define XF86XK_News 0x1008FF69 /* News */ -#define XF86XK_OfficeHome 0x1008FF6A /* Office home (old Staroffice)*/ -#define XF86XK_Open 0x1008FF6B /* Open */ -#define XF86XK_Option 0x1008FF6C /* ?? */ -#define XF86XK_Paste 0x1008FF6D /* Paste */ -#define XF86XK_Phone 0x1008FF6E /* Launch phone; dial number */ -#define XF86XK_Q 0x1008FF70 /* Compaq's Q - don't use */ -#define XF86XK_Reply 0x1008FF72 /* Reply e.g., mail */ -#define XF86XK_Reload 0x1008FF73 /* Reload web page, file, etc. */ -#define XF86XK_RotateWindows 0x1008FF74 /* Rotate windows e.g. xrandr */ -#define XF86XK_RotationPB 0x1008FF75 /* don't use */ -#define XF86XK_RotationKB 0x1008FF76 /* don't use */ -#define XF86XK_Save 0x1008FF77 /* Save (file, document, state */ -#define XF86XK_ScrollUp 0x1008FF78 /* Scroll window/contents up */ -#define XF86XK_ScrollDown 0x1008FF79 /* Scrool window/contentd down */ -#define XF86XK_ScrollClick 0x1008FF7A /* Use XKB mousekeys instead */ -#define XF86XK_Send 0x1008FF7B /* Send mail, file, object */ -#define XF86XK_Spell 0x1008FF7C /* Spell checker */ -#define XF86XK_SplitScreen 0x1008FF7D /* Split window or screen */ -#define XF86XK_Support 0x1008FF7E /* Get support (??) */ -#define XF86XK_TaskPane 0x1008FF7F /* Show tasks */ -#define XF86XK_Terminal 0x1008FF80 /* Launch terminal emulator */ -#define XF86XK_Tools 0x1008FF81 /* toolbox of desktop/app. */ -#define XF86XK_Travel 0x1008FF82 /* ?? */ -#define XF86XK_UserPB 0x1008FF84 /* ?? */ -#define XF86XK_User1KB 0x1008FF85 /* ?? */ -#define XF86XK_User2KB 0x1008FF86 /* ?? */ -#define XF86XK_Video 0x1008FF87 /* Launch video player */ -#define XF86XK_WheelButton 0x1008FF88 /* button from a mouse wheel */ -#define XF86XK_Word 0x1008FF89 /* Launch word processor */ -#define XF86XK_Xfer 0x1008FF8A -#define XF86XK_ZoomIn 0x1008FF8B /* zoom in view, map, etc. */ -#define XF86XK_ZoomOut 0x1008FF8C /* zoom out view, map, etc. */ - -#define XF86XK_Away 0x1008FF8D /* mark yourself as away */ -#define XF86XK_Messenger 0x1008FF8E /* as in instant messaging */ -#define XF86XK_WebCam 0x1008FF8F /* Launch web camera app. */ -#define XF86XK_MailForward 0x1008FF90 /* Forward in mail */ -#define XF86XK_Pictures 0x1008FF91 /* Show pictures */ -#define XF86XK_Music 0x1008FF92 /* Launch music application */ - -#define XF86XK_Battery 0x1008FF93 /* Display battery information */ -#define XF86XK_Bluetooth 0x1008FF94 /* Enable/disable Bluetooth */ -#define XF86XK_WLAN 0x1008FF95 /* Enable/disable WLAN */ -#define XF86XK_UWB 0x1008FF96 /* Enable/disable UWB */ - -#define XF86XK_AudioForward 0x1008FF97 /* fast-forward audio track */ -#define XF86XK_AudioRepeat 0x1008FF98 /* toggle repeat mode */ -#define XF86XK_AudioRandomPlay 0x1008FF99 /* toggle shuffle mode */ -#define XF86XK_Subtitle 0x1008FF9A /* cycle through subtitle */ -#define XF86XK_AudioCycleTrack 0x1008FF9B /* cycle through audio tracks */ -#define XF86XK_CycleAngle 0x1008FF9C /* cycle through angles */ -#define XF86XK_FrameBack 0x1008FF9D /* video: go one frame back */ -#define XF86XK_FrameForward 0x1008FF9E /* video: go one frame forward */ -#define XF86XK_Time 0x1008FF9F /* display, or shows an entry for time seeking */ -#define XF86XK_Select 0x1008FFA0 /* Select button on joypads and remotes */ -#define XF86XK_View 0x1008FFA1 /* Show a view options/properties */ -#define XF86XK_TopMenu 0x1008FFA2 /* Go to a top-level menu in a video */ - -#define XF86XK_Red 0x1008FFA3 /* Red button */ -#define XF86XK_Green 0x1008FFA4 /* Green button */ -#define XF86XK_Yellow 0x1008FFA5 /* Yellow button */ -#define XF86XK_Blue 0x1008FFA6 /* Blue button */ - -#define XF86XK_Suspend 0x1008FFA7 /* Sleep to RAM */ -#define XF86XK_Hibernate 0x1008FFA8 /* Sleep to disk */ -#define XF86XK_TouchpadToggle 0x1008FFA9 /* Toggle between touchpad/trackstick */ -#define XF86XK_TouchpadOn 0x1008FFB0 /* The touchpad got switched on */ -#define XF86XK_TouchpadOff 0x1008FFB1 /* The touchpad got switched off */ - -#define XF86XK_AudioMicMute 0x1008FFB2 /* Mute the Mic from the system */ - -/* Keys for special action keys (hot keys) */ -/* Virtual terminals on some operating systems */ -#define XF86XK_Switch_VT_1 0x1008FE01 -#define XF86XK_Switch_VT_2 0x1008FE02 -#define XF86XK_Switch_VT_3 0x1008FE03 -#define XF86XK_Switch_VT_4 0x1008FE04 -#define XF86XK_Switch_VT_5 0x1008FE05 -#define XF86XK_Switch_VT_6 0x1008FE06 -#define XF86XK_Switch_VT_7 0x1008FE07 -#define XF86XK_Switch_VT_8 0x1008FE08 -#define XF86XK_Switch_VT_9 0x1008FE09 -#define XF86XK_Switch_VT_10 0x1008FE0A -#define XF86XK_Switch_VT_11 0x1008FE0B -#define XF86XK_Switch_VT_12 0x1008FE0C - -#define XF86XK_Ungrab 0x1008FE20 /* force ungrab */ -#define XF86XK_ClearGrab 0x1008FE21 /* kill application with grab */ -#define XF86XK_Next_VMode 0x1008FE22 /* next video mode available */ -#define XF86XK_Prev_VMode 0x1008FE23 /* prev. video mode available */ -#define XF86XK_LogWindowTree 0x1008FE24 /* print window tree to log */ -#define XF86XK_LogGrabInfo 0x1008FE25 /* print all active grabs to log */ diff --git a/openflow/usr/include/X11/XKBlib.h b/openflow/usr/include/X11/XKBlib.h deleted file mode 100644 index 8f6c72c..0000000 --- a/openflow/usr/include/X11/XKBlib.h +++ /dev/null @@ -1,1149 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -#ifndef _X11_XKBLIB_H_ -#define _X11_XKBLIB_H_ - -#include -#include - -typedef struct _XkbAnyEvent { - int type; /* XkbAnyEvent */ - unsigned long serial; /* # of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XKB event minor code */ - unsigned int device; /* device ID */ -} XkbAnyEvent; - -typedef struct _XkbNewKeyboardNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbNewKeyboardNotify */ - int device; /* device ID */ - int old_device; /* device ID of previous keyboard */ - int min_key_code; /* minimum key code */ - int max_key_code; /* maximum key code */ - int old_min_key_code;/* min key code of previous kbd */ - int old_max_key_code;/* max key code of previous kbd */ - unsigned int changed; /* changed aspects of the keyboard */ - char req_major; /* major and minor opcode of req */ - char req_minor; /* that caused change, if applicable */ -} XkbNewKeyboardNotifyEvent; - -typedef struct _XkbMapNotifyEvent { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbMapNotify */ - int device; /* device ID */ - unsigned int changed; /* fields which have been changed */ - unsigned int flags; /* reserved */ - int first_type; /* first changed key type */ - int num_types; /* number of changed key types */ - KeyCode min_key_code; - KeyCode max_key_code; - KeyCode first_key_sym; - KeyCode first_key_act; - KeyCode first_key_behavior; - KeyCode first_key_explicit; - KeyCode first_modmap_key; - KeyCode first_vmodmap_key; - int num_key_syms; - int num_key_acts; - int num_key_behaviors; - int num_key_explicit; - int num_modmap_keys; - int num_vmodmap_keys; - unsigned int vmods; /* mask of changed virtual mods */ -} XkbMapNotifyEvent; - -typedef struct _XkbStateNotifyEvent { - int type; /* XkbAnyEvent */ - unsigned long serial; /* # of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbStateNotify */ - int device; /* device ID */ - unsigned int changed; /* mask of changed state components */ - int group; /* keyboard group */ - int base_group; /* base keyboard group */ - int latched_group; /* latched keyboard group */ - int locked_group; /* locked keyboard group */ - unsigned int mods; /* modifier state */ - unsigned int base_mods; /* base modifier state */ - unsigned int latched_mods; /* latched modifiers */ - unsigned int locked_mods; /* locked modifiers */ - int compat_state; /* compatibility state */ - unsigned char grab_mods; /* mods used for grabs */ - unsigned char compat_grab_mods;/* grab mods for non-XKB clients */ - unsigned char lookup_mods; /* mods sent to clients */ - unsigned char compat_lookup_mods; /* mods sent to non-XKB clients */ - int ptr_buttons; /* pointer button state */ - KeyCode keycode; /* keycode that caused the change */ - char event_type; /* KeyPress or KeyRelease */ - char req_major; /* Major opcode of request */ - char req_minor; /* Minor opcode of request */ -} XkbStateNotifyEvent; - -typedef struct _XkbControlsNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbControlsNotify */ - int device; /* device ID */ - unsigned int changed_ctrls; /* controls with changed sub-values */ - unsigned int enabled_ctrls; /* controls currently enabled */ - unsigned int enabled_ctrl_changes;/* controls just {en,dis}abled */ - int num_groups; /* total groups on keyboard */ - KeyCode keycode; /* key that caused change or 0 */ - char event_type; /* type of event that caused change */ - char req_major; /* if keycode==0, major and minor */ - char req_minor; /* opcode of req that caused change */ -} XkbControlsNotifyEvent; - -typedef struct _XkbIndicatorNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbIndicatorNotify */ - int device; /* device ID */ - unsigned int changed; /* indicators with new state or map */ - unsigned int state; /* current state of all indicators */ -} XkbIndicatorNotifyEvent; - -typedef struct _XkbNamesNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbNamesNotify */ - int device; /* device ID */ - unsigned int changed; /* names that have changed */ - int first_type; /* first key type with new name */ - int num_types; /* number of key types with new names */ - int first_lvl; /* first key type new new level names */ - int num_lvls; /* # of key types w/new level names */ - int num_aliases; /* total number of key aliases*/ - int num_radio_groups;/* total number of radio groups */ - unsigned int changed_vmods; /* virtual modifiers with new names */ - unsigned int changed_groups; /* groups with new names */ - unsigned int changed_indicators;/* indicators with new names */ - int first_key; /* first key with new name */ - int num_keys; /* number of keys with new names */ -} XkbNamesNotifyEvent; - -typedef struct _XkbCompatMapNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbCompatMapNotify */ - int device; /* device ID */ - unsigned int changed_groups; /* groups with new compat maps */ - int first_si; /* first new symbol interp */ - int num_si; /* number of new symbol interps */ - int num_total_si; /* total # of symbol interps */ -} XkbCompatMapNotifyEvent; - -typedef struct _XkbBellNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbBellNotify */ - int device; /* device ID */ - int percent; /* requested volume as a % of maximum */ - int pitch; /* requested pitch in Hz */ - int duration; /* requested duration in useconds */ - int bell_class; /* (input extension) feedback class */ - int bell_id; /* (input extension) ID of feedback */ - Atom name; /* "name" of requested bell */ - Window window; /* window associated with event */ - Bool event_only; /* "event only" requested */ -} XkbBellNotifyEvent; - -typedef struct _XkbActionMessage { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbActionMessage */ - int device; /* device ID */ - KeyCode keycode; /* key that generated the event */ - Bool press; /* true if act caused by key press */ - Bool key_event_follows;/* true if key event also generated */ - int group; /* effective group */ - unsigned int mods; /* effective mods */ - char message[XkbActionMessageLength+1]; - /* message -- leave space for NUL */ -} XkbActionMessageEvent; - -typedef struct _XkbAccessXNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbAccessXNotify */ - int device; /* device ID */ - int detail; /* XkbAXN_* */ - int keycode; /* key of event */ - int sk_delay; /* current slow keys delay */ - int debounce_delay; /* current debounce delay */ -} XkbAccessXNotifyEvent; - -typedef struct _XkbExtensionDeviceNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbExtensionDeviceNotify */ - int device; /* device ID */ - unsigned int reason; /* reason for the event */ - unsigned int supported; /* mask of supported features */ - unsigned int unsupported; /* mask of unsupported features */ - /* that some app tried to use */ - int first_btn; /* first button that changed */ - int num_btns; /* range of buttons changed */ - unsigned int leds_defined; /* indicators with names or maps */ - unsigned int led_state; /* current state of the indicators */ - int led_class; /* feedback class for led changes */ - int led_id; /* feedback id for led changes */ -} XkbExtensionDeviceNotifyEvent; - -typedef union _XkbEvent { - int type; - XkbAnyEvent any; - XkbNewKeyboardNotifyEvent new_kbd; - XkbMapNotifyEvent map; - XkbStateNotifyEvent state; - XkbControlsNotifyEvent ctrls; - XkbIndicatorNotifyEvent indicators; - XkbNamesNotifyEvent names; - XkbCompatMapNotifyEvent compat; - XkbBellNotifyEvent bell; - XkbActionMessageEvent message; - XkbAccessXNotifyEvent accessx; - XkbExtensionDeviceNotifyEvent device; - XEvent core; -} XkbEvent; - -typedef struct _XkbKbdDpyState XkbKbdDpyStateRec,*XkbKbdDpyStatePtr; - - /* XkbOpenDisplay error codes */ -#define XkbOD_Success 0 -#define XkbOD_BadLibraryVersion 1 -#define XkbOD_ConnectionRefused 2 -#define XkbOD_NonXkbServer 3 -#define XkbOD_BadServerVersion 4 - - /* Values for XlibFlags */ -#define XkbLC_ForceLatin1Lookup (1<<0) -#define XkbLC_ConsumeLookupMods (1<<1) -#define XkbLC_AlwaysConsumeShiftAndLock (1<<2) -#define XkbLC_IgnoreNewKeyboards (1<<3) -#define XkbLC_ControlFallback (1<<4) -#define XkbLC_ConsumeKeysOnComposeFail (1<<29) -#define XkbLC_ComposeLED (1<<30) -#define XkbLC_BeepOnComposeFail (1<<31) - -#define XkbLC_AllComposeControls (0xc0000000) -#define XkbLC_AllControls (0xc000001f) - -_XFUNCPROTOBEGIN - -extern Bool XkbIgnoreExtension( - Bool /* ignore */ -); - -extern Display *XkbOpenDisplay( - char * /* name */, - int * /* ev_rtrn */, - int * /* err_rtrn */, - int * /* major_rtrn */, - int * /* minor_rtrn */, - int * /* reason */ -); - -extern Bool XkbQueryExtension( - Display * /* dpy */, - int * /* opcodeReturn */, - int * /* eventBaseReturn */, - int * /* errorBaseReturn */, - int * /* majorRtrn */, - int * /* minorRtrn */ -); - -extern Bool XkbUseExtension( - Display * /* dpy */, - int * /* major_rtrn */, - int * /* minor_rtrn */ -); - -extern Bool XkbLibraryVersion( - int * /* libMajorRtrn */, - int * /* libMinorRtrn */ -); - -extern unsigned int XkbSetXlibControls( - Display* /* dpy */, - unsigned int /* affect */, - unsigned int /* values */ -); - -extern unsigned int XkbGetXlibControls( - Display* /* dpy */ -); - -extern unsigned int XkbXlibControlsImplemented(void); - -typedef Atom (*XkbInternAtomFunc)( - Display * /* dpy */, - _Xconst char * /* name */, - Bool /* only_if_exists */ -); - -typedef char * (*XkbGetAtomNameFunc)( - Display * /* dpy */, - Atom /* atom */ -); - -extern void XkbSetAtomFuncs( - XkbInternAtomFunc /* getAtom */, - XkbGetAtomNameFunc /* getName */ -); - -extern KeySym XkbKeycodeToKeysym( - Display * /* dpy */, -#if NeedWidePrototypes - unsigned int /* kc */, -#else - KeyCode /* kc */, -#endif - int /* group */, - int /* level */ -); - -extern unsigned int XkbKeysymToModifiers( - Display * /* dpy */, - KeySym /* ks */ -); - -extern Bool XkbLookupKeySym( - Display * /* dpy */, - KeyCode /* keycode */, - unsigned int /* modifiers */, - unsigned int * /* modifiers_return */, - KeySym * /* keysym_return */ -); - -extern int XkbLookupKeyBinding( - Display * /* dpy */, - KeySym /* sym_rtrn */, - unsigned int /* mods */, - char * /* buffer */, - int /* nbytes */, - int * /* extra_rtrn */ -); - -extern Bool XkbTranslateKeyCode( - XkbDescPtr /* xkb */, - KeyCode /* keycode */, - unsigned int /* modifiers */, - unsigned int * /* modifiers_return */, - KeySym * /* keysym_return */ -); - -extern int XkbTranslateKeySym( - Display * /* dpy */, - register KeySym * /* sym_return */, - unsigned int /* modifiers */, - char * /* buffer */, - int /* nbytes */, - int * /* extra_rtrn */ -); - -extern Bool XkbSetAutoRepeatRate( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* delay */, - unsigned int /* interval */ -); - -extern Bool XkbGetAutoRepeatRate( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int * /* delayRtrn */, - unsigned int * /* intervalRtrn */ -); - -extern Bool XkbChangeEnabledControls( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* affect */, - unsigned int /* values */ -); - -extern Bool XkbDeviceBell( - Display * /* dpy */, - Window /* win */, - int /* deviceSpec */, - int /* bellClass */, - int /* bellID */, - int /* percent */, - Atom /* name */ -); - -extern Bool XkbForceDeviceBell( - Display * /* dpy */, - int /* deviceSpec */, - int /* bellClass */, - int /* bellID */, - int /* percent */ -); - -extern Bool XkbDeviceBellEvent( - Display * /* dpy */, - Window /* win */, - int /* deviceSpec */, - int /* bellClass */, - int /* bellID */, - int /* percent */, - Atom /* name */ -); - -extern Bool XkbBell( - Display * /* dpy */, - Window /* win */, - int /* percent */, - Atom /* name */ -); - -extern Bool XkbForceBell( - Display * /* dpy */, - int /* percent */ -); - -extern Bool XkbBellEvent( - Display * /* dpy */, - Window /* win */, - int /* percent */, - Atom /* name */ -); - -extern Bool XkbSelectEvents( - Display * /* dpy */, - unsigned int /* deviceID */, - unsigned int /* affect */, - unsigned int /* values */ -); - -extern Bool XkbSelectEventDetails( - Display * /* dpy */, - unsigned int /* deviceID */, - unsigned int /* eventType */, - unsigned long /* affect */, - unsigned long /* details */ -); - -extern void XkbNoteMapChanges( - XkbMapChangesPtr /* old */, - XkbMapNotifyEvent * /* new */, - unsigned int /* wanted */ -); - -extern void XkbNoteNameChanges( - XkbNameChangesPtr /* old */, - XkbNamesNotifyEvent * /* new */, - unsigned int /* wanted */ -); - -extern Status XkbGetIndicatorState( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int * /* pStateRtrn */ -); - -extern Status XkbGetDeviceIndicatorState( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* ledClass */, - unsigned int /* ledID */, - unsigned int * /* pStateRtrn */ -); - -extern Status XkbGetIndicatorMap( - Display * /* dpy */, - unsigned long /* which */, - XkbDescPtr /* desc */ -); - -extern Bool XkbSetIndicatorMap( - Display * /* dpy */, - unsigned long /* which */, - XkbDescPtr /* desc */ -); - -#define XkbNoteIndicatorMapChanges(o,n,w) \ - ((o)->map_changes|=((n)->map_changes&(w))) -#define XkbNoteIndicatorStateChanges(o,n,w)\ - ((o)->state_changes|=((n)->state_changes&(w))) -#define XkbGetIndicatorMapChanges(d,x,c) \ - (XkbGetIndicatorMap((d),(c)->map_changes,x)) -#define XkbChangeIndicatorMaps(d,x,c) \ - (XkbSetIndicatorMap((d),(c)->map_changes,x)) - -extern Bool XkbGetNamedIndicator( - Display * /* dpy */, - Atom /* name */, - int * /* pNdxRtrn */, - Bool * /* pStateRtrn */, - XkbIndicatorMapPtr /* pMapRtrn */, - Bool * /* pRealRtrn */ -); - -extern Bool XkbGetNamedDeviceIndicator( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* ledClass */, - unsigned int /* ledID */, - Atom /* name */, - int * /* pNdxRtrn */, - Bool * /* pStateRtrn */, - XkbIndicatorMapPtr /* pMapRtrn */, - Bool * /* pRealRtrn */ -); - -extern Bool XkbSetNamedIndicator( - Display * /* dpy */, - Atom /* name */, - Bool /* changeState */, - Bool /* state */, - Bool /* createNewMap */, - XkbIndicatorMapPtr /* pMap */ -); - -extern Bool XkbSetNamedDeviceIndicator( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* ledClass */, - unsigned int /* ledID */, - Atom /* name */, - Bool /* changeState */, - Bool /* state */, - Bool /* createNewMap */, - XkbIndicatorMapPtr /* pMap */ -); - -extern Bool XkbLockModifiers( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* affect */, - unsigned int /* values */ -); - -extern Bool XkbLatchModifiers( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* affect */, - unsigned int /* values */ -); - -extern Bool XkbLockGroup( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* group */ -); - -extern Bool XkbLatchGroup( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* group */ -); - -extern Bool XkbSetServerInternalMods( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* affectReal */, - unsigned int /* realValues */, - unsigned int /* affectVirtual */, - unsigned int /* virtualValues */ -); - -extern Bool XkbSetIgnoreLockMods( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* affectReal */, - unsigned int /* realValues */, - unsigned int /* affectVirtual */, - unsigned int /* virtualValues */ -); - - -extern Bool XkbVirtualModsToReal( - XkbDescPtr /* xkb */, - unsigned int /* virtual_mask */, - unsigned int * /* mask_rtrn */ -); - -extern Bool XkbComputeEffectiveMap( - XkbDescPtr /* xkb */, - XkbKeyTypePtr /* type */, - unsigned char * /* map_rtrn */ -); - -extern Status XkbInitCanonicalKeyTypes( - XkbDescPtr /* xkb */, - unsigned int /* which */, - int /* keypadVMod */ -); - -extern XkbDescPtr XkbAllocKeyboard( - void -); - -extern void XkbFreeKeyboard( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeDesc */ -); - -extern Status XkbAllocClientMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - unsigned int /* nTypes */ -); - -extern Status XkbAllocServerMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - unsigned int /* nActions */ -); - -extern void XkbFreeClientMap( - XkbDescPtr /* xkb */, - unsigned int /* what */, - Bool /* freeMap */ -); - -extern void XkbFreeServerMap( - XkbDescPtr /* xkb */, - unsigned int /* what */, - Bool /* freeMap */ -); - -extern XkbKeyTypePtr XkbAddKeyType( - XkbDescPtr /* xkb */, - Atom /* name */, - int /* map_count */, - Bool /* want_preserve */, - int /* num_lvls */ -); - -extern Status XkbAllocIndicatorMaps( - XkbDescPtr /* xkb */ -); - -extern void XkbFreeIndicatorMaps( - XkbDescPtr /* xkb */ -); - -extern XkbDescPtr XkbGetMap( - Display * /* dpy */, - unsigned int /* which */, - unsigned int /* deviceSpec */ -); - -extern Status XkbGetUpdatedMap( - Display * /* dpy */, - unsigned int /* which */, - XkbDescPtr /* desc */ -); - -extern Status XkbGetMapChanges( - Display * /* dpy */, - XkbDescPtr /* xkb */, - XkbMapChangesPtr /* changes */ -); - - -extern Status XkbRefreshKeyboardMapping( - XkbMapNotifyEvent * /* event */ -); - -extern Status XkbGetKeyTypes( - Display * /* dpy */, - unsigned int /* first */, - unsigned int /* num */, - XkbDescPtr /* xkb */ -); - -extern Status XkbGetKeySyms( - Display * /* dpy */, - unsigned int /* first */, - unsigned int /* num */, - XkbDescPtr /* xkb */ -); - -extern Status XkbGetKeyActions( - Display * /* dpy */, - unsigned int /* first */, - unsigned int /* num */, - XkbDescPtr /* xkb */ -); - -extern Status XkbGetKeyBehaviors( - Display * /* dpy */, - unsigned int /* firstKey */, - unsigned int /* nKeys */, - XkbDescPtr /* desc */ -); - -extern Status XkbGetVirtualMods( - Display * /* dpy */, - unsigned int /* which */, - XkbDescPtr /* desc */ -); - -extern Status XkbGetKeyExplicitComponents( - Display * /* dpy */, - unsigned int /* firstKey */, - unsigned int /* nKeys */, - XkbDescPtr /* desc */ -); - -extern Status XkbGetKeyModifierMap( - Display * /* dpy */, - unsigned int /* firstKey */, - unsigned int /* nKeys */, - XkbDescPtr /* desc */ -); - -extern Status XkbGetKeyVirtualModMap( - Display * /* dpy */, - unsigned int /* first */, - unsigned int /* num */, - XkbDescPtr /* xkb */ -); - -extern Status XkbAllocControls( - XkbDescPtr /* xkb */, - unsigned int /* which*/ -); - -extern void XkbFreeControls( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeMap */ -); - -extern Status XkbGetControls( - Display * /* dpy */, - unsigned long /* which */, - XkbDescPtr /* desc */ -); - -extern Bool XkbSetControls( - Display * /* dpy */, - unsigned long /* which */, - XkbDescPtr /* desc */ -); - -extern void XkbNoteControlsChanges( - XkbControlsChangesPtr /* old */, - XkbControlsNotifyEvent * /* new */, - unsigned int /* wanted */ -); - -#define XkbGetControlsChanges(d,x,c) XkbGetControls(d,(c)->changed_ctrls,x) -#define XkbChangeControls(d,x,c) XkbSetControls(d,(c)->changed_ctrls,x) - -extern Status XkbAllocCompatMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - unsigned int /* nInterpret */ -); - -extern void XkbFreeCompatMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeMap */ -); - -extern Status XkbGetCompatMap( - Display * /* dpy */, - unsigned int /* which */, - XkbDescPtr /* xkb */ -); - -extern Bool XkbSetCompatMap( - Display * /* dpy */, - unsigned int /* which */, - XkbDescPtr /* xkb */, - Bool /* updateActions */ -); - -extern XkbSymInterpretPtr XkbAddSymInterpret( - XkbDescPtr /* xkb */, - XkbSymInterpretPtr /* si */, - Bool /* updateMap */, - XkbChangesPtr /* changes */ -); - -extern Status XkbAllocNames( - XkbDescPtr /* xkb */, - unsigned int /* which */, - int /* nTotalRG */, - int /* nTotalAliases */ -); - -extern Status XkbGetNames( - Display * /* dpy */, - unsigned int /* which */, - XkbDescPtr /* desc */ -); - -extern Bool XkbSetNames( - Display * /* dpy */, - unsigned int /* which */, - unsigned int /* firstType */, - unsigned int /* nTypes */, - XkbDescPtr /* desc */ -); - -extern Bool XkbChangeNames( - Display * /* dpy */, - XkbDescPtr /* xkb */, - XkbNameChangesPtr /* changes */ -); - -extern void XkbFreeNames( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeMap */ -); - - -extern Status XkbGetState( - Display * /* dpy */, - unsigned int /* deviceSpec */, - XkbStatePtr /* rtrnState */ -); - -extern Bool XkbSetMap( - Display * /* dpy */, - unsigned int /* which */, - XkbDescPtr /* desc */ -); - -extern Bool XkbChangeMap( - Display* /* dpy */, - XkbDescPtr /* desc */, - XkbMapChangesPtr /* changes */ -); - -extern Bool XkbSetDetectableAutoRepeat( - Display * /* dpy */, - Bool /* detectable */, - Bool * /* supported */ -); - -extern Bool XkbGetDetectableAutoRepeat( - Display * /* dpy */, - Bool * /* supported */ -); - -extern Bool XkbSetAutoResetControls( - Display * /* dpy */, - unsigned int /* changes */, - unsigned int * /* auto_ctrls */, - unsigned int * /* auto_values */ -); - -extern Bool XkbGetAutoResetControls( - Display * /* dpy */, - unsigned int * /* auto_ctrls */, - unsigned int * /* auto_ctrl_values */ -); - -extern Bool XkbSetPerClientControls( - Display * /* dpy */, - unsigned int /* change */, - unsigned int * /* values */ -); - -extern Bool XkbGetPerClientControls( - Display * /* dpy */, - unsigned int * /* ctrls */ -); - -extern Status XkbCopyKeyType( - XkbKeyTypePtr /* from */, - XkbKeyTypePtr /* into */ -); - -extern Status XkbCopyKeyTypes( - XkbKeyTypePtr /* from */, - XkbKeyTypePtr /* into */, - int /* num_types */ -); - -extern Status XkbResizeKeyType( - XkbDescPtr /* xkb */, - int /* type_ndx */, - int /* map_count */, - Bool /* want_preserve */, - int /* new_num_lvls */ -); - -extern KeySym *XkbResizeKeySyms( - XkbDescPtr /* desc */, - int /* forKey */, - int /* symsNeeded */ -); - -extern XkbAction *XkbResizeKeyActions( - XkbDescPtr /* desc */, - int /* forKey */, - int /* actsNeeded */ -); - -extern Status XkbChangeTypesOfKey( - XkbDescPtr /* xkb */, - int /* key */, - int /* num_groups */, - unsigned int /* groups */, - int * /* newTypes */, - XkbMapChangesPtr /* pChanges */ -); - -extern Status XkbChangeKeycodeRange( - XkbDescPtr /* xkb */, - int /* minKC */, - int /* maxKC */, - XkbChangesPtr /* changes */ -); - -/***====================================================================***/ - -extern XkbComponentListPtr XkbListComponents( - Display * /* dpy */, - unsigned int /* deviceSpec */, - XkbComponentNamesPtr /* ptrns */, - int * /* max_inout */ -); - -extern void XkbFreeComponentList( - XkbComponentListPtr /* list */ -); - -extern XkbDescPtr XkbGetKeyboard( - Display * /* dpy */, - unsigned int /* which */, - unsigned int /* deviceSpec */ -); - -extern XkbDescPtr XkbGetKeyboardByName( - Display * /* dpy */, - unsigned int /* deviceSpec */, - XkbComponentNamesPtr /* names */, - unsigned int /* want */, - unsigned int /* need */, - Bool /* load */ -); - -/***====================================================================***/ - -extern int XkbKeyTypesForCoreSymbols( /* returns # of groups */ - XkbDescPtr /* xkb */, /* keyboard device */ - int /* map_width */, /* width of core KeySym array */ - KeySym * /* core_syms */, /* always mapWidth symbols */ - unsigned int /* protected */, /* explicit key types */ - int * /* types_inout */, /* always four type indices */ - KeySym * /* xkb_syms_rtrn */ /* must have enough space */ -); - -extern Bool XkbApplyCompatMapToKey( /* False only on error */ - XkbDescPtr /* xkb */, /* keymap to be edited */ - KeyCode /* key */, /* key to be updated */ - XkbChangesPtr /* changes */ /* resulting changes to map */ -); - -extern Bool XkbUpdateMapFromCore( /* False only on error */ - XkbDescPtr /* xkb */, /* XKB keyboard to be edited */ - KeyCode /* first_key */, /* first changed key */ - int /* num_keys */, /* number of changed keys */ - int /* map_width */, /* width of core keymap */ - KeySym * /* core_keysyms */, /* symbols from core keymap */ - XkbChangesPtr /* changes */ /* resulting changes */ -); - -/***====================================================================***/ - -extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( - XkbDeviceInfoPtr /* devi */, - unsigned int /* ledClass */, - unsigned int /* ledId */ -); - -extern Status XkbResizeDeviceButtonActions( - XkbDeviceInfoPtr /* devi */, - unsigned int /* newTotal */ -); - -extern XkbDeviceInfoPtr XkbAllocDeviceInfo( - unsigned int /* deviceSpec */, - unsigned int /* nButtons */, - unsigned int /* szLeds */ -); - -extern void XkbFreeDeviceInfo( - XkbDeviceInfoPtr /* devi */, - unsigned int /* which */, - Bool /* freeDevI */ -); - -extern void XkbNoteDeviceChanges( - XkbDeviceChangesPtr /* old */, - XkbExtensionDeviceNotifyEvent * /* new */, - unsigned int /* wanted */ -); - -extern XkbDeviceInfoPtr XkbGetDeviceInfo( - Display * /* dpy */, - unsigned int /* which */, - unsigned int /* deviceSpec */, - unsigned int /* ledClass */, - unsigned int /* ledID */ -); - -extern Status XkbGetDeviceInfoChanges( - Display * /* dpy */, - XkbDeviceInfoPtr /* devi */, - XkbDeviceChangesPtr /* changes */ -); - -extern Status XkbGetDeviceButtonActions( - Display * /* dpy */, - XkbDeviceInfoPtr /* devi */, - Bool /* all */, - unsigned int /* first */, - unsigned int /* nBtns */ -); - -extern Status XkbGetDeviceLedInfo( - Display * /* dpy */, - XkbDeviceInfoPtr /* devi */, - unsigned int /* ledClass (class, XIDflt, XIAll) */, - unsigned int /* ledId (id, XIDflt, XIAll) */, - unsigned int /* which (XkbXI_Indicator{Names,Map}Mask */ -); - -extern Bool XkbSetDeviceInfo( - Display * /* dpy */, - unsigned int /* which */, - XkbDeviceInfoPtr /* devi */ -); - -extern Bool XkbChangeDeviceInfo( - Display* /* dpy */, - XkbDeviceInfoPtr /* desc */, - XkbDeviceChangesPtr /* changes */ -); - -extern Bool XkbSetDeviceLedInfo( - Display * /* dpy */, - XkbDeviceInfoPtr /* devi */, - unsigned int /* ledClass */, - unsigned int /* ledID */, - unsigned int /* which */ -); - -extern Bool XkbSetDeviceButtonActions( - Display * /* dpy */, - XkbDeviceInfoPtr /* devi */, - unsigned int /* first */, - unsigned int /* nBtns */ -); - -/***====================================================================***/ - -extern char XkbToControl( - char /* c */ -); - -/***====================================================================***/ - -extern Bool XkbSetDebuggingFlags( - Display * /* dpy */, - unsigned int /* mask */, - unsigned int /* flags */, - char * /* msg */, - unsigned int /* ctrls_mask */, - unsigned int /* ctrls */, - unsigned int * /* rtrn_flags */, - unsigned int * /* rtrn_ctrls */ -); - -extern Bool XkbApplyVirtualModChanges( - XkbDescPtr /* xkb */, - unsigned int /* changed */, - XkbChangesPtr /* changes */ -); - -extern Bool XkbUpdateActionVirtualMods( - XkbDescPtr /* xkb */, - XkbAction * /* act */, - unsigned int /* changed */ -); - -extern void XkbUpdateKeyTypeVirtualMods( - XkbDescPtr /* xkb */, - XkbKeyTypePtr /* type */, - unsigned int /* changed */, - XkbChangesPtr /* changes */ -); - -_XFUNCPROTOEND - -#endif /* _X11_XKBLIB_H_ */ diff --git a/openflow/usr/include/X11/XWDFile.h b/openflow/usr/include/X11/XWDFile.h deleted file mode 100644 index 50e17df..0000000 --- a/openflow/usr/include/X11/XWDFile.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - -Copyright 1985, 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/* - * XWDFile.h MIT Project Athena, X Window system window raster - * image dumper, dump file format header file. - * - * Author: Tony Della Fera, DEC - * 27-Jun-85 - * - * Modifier: William F. Wyatt, SAO - * 18-Nov-86 - version 6 for saving/restoring color maps - */ - -#ifndef XWDFILE_H -#define XWDFILE_H - -#include - -#define XWD_FILE_VERSION 7 -#define sz_XWDheader 100 -#define sz_XWDColor 12 - -typedef CARD32 xwdval; /* for old broken programs */ - -/* Values in the file are most significant byte first. */ - -typedef struct _xwd_file_header { - /* header_size = SIZEOF(XWDheader) + length of null-terminated - * window name. */ - CARD32 header_size B32; - - CARD32 file_version B32; /* = XWD_FILE_VERSION above */ - CARD32 pixmap_format B32; /* ZPixmap or XYPixmap */ - CARD32 pixmap_depth B32; /* Pixmap depth */ - CARD32 pixmap_width B32; /* Pixmap width */ - CARD32 pixmap_height B32; /* Pixmap height */ - CARD32 xoffset B32; /* Bitmap x offset, normally 0 */ - CARD32 byte_order B32; /* of image data: MSBFirst, LSBFirst */ - - /* bitmap_unit applies to bitmaps (depth 1 format XY) only. - * It is the number of bits that each scanline is padded to. */ - CARD32 bitmap_unit B32; - - CARD32 bitmap_bit_order B32; /* bitmaps only: MSBFirst, LSBFirst */ - - /* bitmap_pad applies to pixmaps (non-bitmaps) only. - * It is the number of bits that each scanline is padded to. */ - CARD32 bitmap_pad B32; - - CARD32 bits_per_pixel B32; /* Bits per pixel */ - - /* bytes_per_line is pixmap_width padded to bitmap_unit (bitmaps) - * or bitmap_pad (pixmaps). It is the delta (in bytes) to get - * to the same x position on an adjacent row. */ - CARD32 bytes_per_line B32; - CARD32 visual_class B32; /* Class of colormap */ - CARD32 red_mask B32; /* Z red mask */ - CARD32 green_mask B32; /* Z green mask */ - CARD32 blue_mask B32; /* Z blue mask */ - CARD32 bits_per_rgb B32; /* Log2 of distinct color values */ - CARD32 colormap_entries B32; /* Number of entries in colormap; not used? */ - CARD32 ncolors B32; /* Number of XWDColor structures */ - CARD32 window_width B32; /* Window width */ - CARD32 window_height B32; /* Window height */ - CARD32 window_x B32; /* Window upper left X coordinate */ - CARD32 window_y B32; /* Window upper left Y coordinate */ - CARD32 window_bdrwidth B32; /* Window border width */ -} XWDFileHeader; - -/* Null-terminated window name follows the above structure. */ - -/* Next comes XWDColor structures, at offset XWDFileHeader.header_size in - * the file. XWDFileHeader.ncolors tells how many XWDColor structures - * there are. - */ - -typedef struct { - CARD32 pixel B32; - CARD16 red B16; - CARD16 green B16; - CARD16 blue B16; - CARD8 flags; - CARD8 pad; -} XWDColor; - -/* Last comes the image data in the format described by XWDFileHeader. */ - -#endif /* XWDFILE_H */ - diff --git a/openflow/usr/include/X11/Xalloca.h b/openflow/usr/include/X11/Xalloca.h deleted file mode 100644 index 1919884..0000000 --- a/openflow/usr/include/X11/Xalloca.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - -Copyright 1995, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ -/* - * The purpose of this header is to define the macros ALLOCATE_LOCAL and - * DEALLOCATE_LOCAL appropriately for the platform being compiled on. - * These macros are used to make fast, function-local memory allocations. - * Their characteristics are as follows: - * - * void *ALLOCATE_LOCAL(int size) - * Returns a pointer to size bytes of memory, or NULL if the allocation - * failed. The memory must be freed with DEALLOCATE_LOCAL before the - * function that made the allocation returns. You should not ask for - * large blocks of memory with this function, since on many platforms - * the memory comes from the stack, which may have limited size. - * - * void DEALLOCATE_LOCAL(void *) - * Frees the memory allocated by ALLOCATE_LOCAL. Omission of this - * step may be harmless on some platforms, but will result in - * memory leaks or worse on others. - * - * Before including this file, you should define two macros, - * ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK, that have the - * same characteristics as ALLOCATE_LOCAL and DEALLOCATE_LOCAL. The - * header uses the fallbacks if it doesn't know a "better" way to define - * ALLOCATE_LOCAL and DEALLOCATE_LOCAL. Typical usage would be: - * - * #define ALLOCATE_LOCAL_FALLBACK(_size) malloc(_size) - * #define DEALLOCATE_LOCAL_FALLBACK(_ptr) free(_ptr) - * #include "Xalloca.h" - */ - -#ifndef XALLOCA_H -#define XALLOCA_H 1 - -#ifndef INCLUDE_ALLOCA_H -/* Need to add more here to match Imake *.cf's */ -# if defined(HAVE_ALLOCA_H) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) -# define INCLUDE_ALLOCA_H -# endif -#endif - -#ifdef INCLUDE_ALLOCA_H -# include -#endif - -#ifndef NO_ALLOCA -/* - * os-dependent definition of local allocation and deallocation - * If you want something other than (DE)ALLOCATE_LOCAL_FALLBACK - * for ALLOCATE/DEALLOCATE_LOCAL then you add that in here. - */ - - -# ifdef __GNUC__ -# ifndef alloca -# define alloca __builtin_alloca -# endif /* !alloca */ -# define ALLOCATE_LOCAL(size) alloca((int)(size)) -# else /* ! __GNUC__ */ - -/* - * warning: old mips alloca (pre 2.10) is unusable, new one is built in - * Test is easy, the new one is named __builtin_alloca and comes - * from alloca.h which #defines alloca. - */ -# if defined(__sun) || defined(alloca) -/* - * Some System V boxes extract alloca.o from /lib/libPW.a; if you - * decide that you don't want to use alloca, you might want to fix it here. - */ -/* alloca might be a macro taking one arg (hi, Sun!), so give it one. */ -# if !defined(__cplusplus) -# define __Xnullarg /* as nothing */ - extern void *alloca(__Xnullarg); -# endif -# define ALLOCATE_LOCAL(size) alloca((int)(size)) -# endif /* who does alloca */ -# endif /* __GNUC__ */ - -#endif /* NO_ALLOCA */ - -#if !defined(ALLOCATE_LOCAL) -# if defined(ALLOCATE_LOCAL_FALLBACK) && defined(DEALLOCATE_LOCAL_FALLBACK) -# define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK(_size) -# define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK(_ptr) -# else /* no fallbacks supplied; error */ -# define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK undefined! -# define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK undefined! -# endif /* defined(ALLOCATE_LOCAL_FALLBACK && DEALLOCATE_LOCAL_FALLBACK) */ -#else -# if !defined(DEALLOCATE_LOCAL) -# define DEALLOCATE_LOCAL(_ptr) do {} while(0) -# endif -#endif /* defined(ALLOCATE_LOCAL) */ - -#endif /* XALLOCA_H */ diff --git a/openflow/usr/include/X11/Xarch.h b/openflow/usr/include/X11/Xarch.h deleted file mode 100644 index f80c580..0000000 --- a/openflow/usr/include/X11/Xarch.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef _XARCH_H_ -# define _XARCH_H_ - -/* - * Copyright 1997 Metro Link Incorporated - * - * All Rights Reserved - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of the above listed copyright holder(s) - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. The above listed - * copyright holder(s) make(s) no representations about the suitability of - * this software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -/* - * Determine the machine's byte order. - */ - -/* See if it is set in the imake config first */ -# ifdef X_BYTE_ORDER - -# define X_BIG_ENDIAN 4321 -# define X_LITTLE_ENDIAN 1234 - -# else - -# if defined(SVR4) || defined(__SVR4) -# include -# include -# elif defined(CSRG_BASED) -# if defined(__NetBSD__) || defined(__OpenBSD__) -# include -# endif -# include -# elif defined(linux) -# if defined __STRICT_ANSI__ -# undef __STRICT_ANSI__ -# include -# define __STRICT_ANSI__ -# else -# include -# endif -/* 'endian.h' might have been included before 'Xarch.h' */ -# if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN) -# define LITTLE_ENDIAN __LITTLE_ENDIAN -# endif -# if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN) -# define BIG_ENDIAN __BIG_ENDIAN -# endif -# if !defined(PDP_ENDIAN) && defined(__PDP_ENDIAN) -# define PDP_ENDIAN __PDP_ENDIAN -# endif -# if !defined(BYTE_ORDER) && defined(__BYTE_ORDER) -# define BYTE_ORDER __BYTE_ORDER -# endif -# endif - -# ifndef BYTE_ORDER -# define LITTLE_ENDIAN 1234 -# define BIG_ENDIAN 4321 - -# if defined(__sun) && defined(__SVR4) -# include -# ifdef _LITTLE_ENDIAN -# define BYTE_ORDER LITTLE_ENDIAN -# endif -# ifdef _BIG_ENDIAN -# define BYTE_ORDER BIG_ENDIAN -# endif -# endif /* sun */ -# endif /* BYTE_ORDER */ - -# define X_BYTE_ORDER BYTE_ORDER -# define X_BIG_ENDIAN BIG_ENDIAN -# define X_LITTLE_ENDIAN LITTLE_ENDIAN - -# endif /* not in imake config */ - -#endif /* _XARCH_H_ */ diff --git a/openflow/usr/include/X11/Xatom.h b/openflow/usr/include/X11/Xatom.h deleted file mode 100644 index 485a423..0000000 --- a/openflow/usr/include/X11/Xatom.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef XATOM_H -#define XATOM_H 1 - -/* THIS IS A GENERATED FILE - * - * Do not change! Changing this file implies a protocol change! - */ - -#define XA_PRIMARY ((Atom) 1) -#define XA_SECONDARY ((Atom) 2) -#define XA_ARC ((Atom) 3) -#define XA_ATOM ((Atom) 4) -#define XA_BITMAP ((Atom) 5) -#define XA_CARDINAL ((Atom) 6) -#define XA_COLORMAP ((Atom) 7) -#define XA_CURSOR ((Atom) 8) -#define XA_CUT_BUFFER0 ((Atom) 9) -#define XA_CUT_BUFFER1 ((Atom) 10) -#define XA_CUT_BUFFER2 ((Atom) 11) -#define XA_CUT_BUFFER3 ((Atom) 12) -#define XA_CUT_BUFFER4 ((Atom) 13) -#define XA_CUT_BUFFER5 ((Atom) 14) -#define XA_CUT_BUFFER6 ((Atom) 15) -#define XA_CUT_BUFFER7 ((Atom) 16) -#define XA_DRAWABLE ((Atom) 17) -#define XA_FONT ((Atom) 18) -#define XA_INTEGER ((Atom) 19) -#define XA_PIXMAP ((Atom) 20) -#define XA_POINT ((Atom) 21) -#define XA_RECTANGLE ((Atom) 22) -#define XA_RESOURCE_MANAGER ((Atom) 23) -#define XA_RGB_COLOR_MAP ((Atom) 24) -#define XA_RGB_BEST_MAP ((Atom) 25) -#define XA_RGB_BLUE_MAP ((Atom) 26) -#define XA_RGB_DEFAULT_MAP ((Atom) 27) -#define XA_RGB_GRAY_MAP ((Atom) 28) -#define XA_RGB_GREEN_MAP ((Atom) 29) -#define XA_RGB_RED_MAP ((Atom) 30) -#define XA_STRING ((Atom) 31) -#define XA_VISUALID ((Atom) 32) -#define XA_WINDOW ((Atom) 33) -#define XA_WM_COMMAND ((Atom) 34) -#define XA_WM_HINTS ((Atom) 35) -#define XA_WM_CLIENT_MACHINE ((Atom) 36) -#define XA_WM_ICON_NAME ((Atom) 37) -#define XA_WM_ICON_SIZE ((Atom) 38) -#define XA_WM_NAME ((Atom) 39) -#define XA_WM_NORMAL_HINTS ((Atom) 40) -#define XA_WM_SIZE_HINTS ((Atom) 41) -#define XA_WM_ZOOM_HINTS ((Atom) 42) -#define XA_MIN_SPACE ((Atom) 43) -#define XA_NORM_SPACE ((Atom) 44) -#define XA_MAX_SPACE ((Atom) 45) -#define XA_END_SPACE ((Atom) 46) -#define XA_SUPERSCRIPT_X ((Atom) 47) -#define XA_SUPERSCRIPT_Y ((Atom) 48) -#define XA_SUBSCRIPT_X ((Atom) 49) -#define XA_SUBSCRIPT_Y ((Atom) 50) -#define XA_UNDERLINE_POSITION ((Atom) 51) -#define XA_UNDERLINE_THICKNESS ((Atom) 52) -#define XA_STRIKEOUT_ASCENT ((Atom) 53) -#define XA_STRIKEOUT_DESCENT ((Atom) 54) -#define XA_ITALIC_ANGLE ((Atom) 55) -#define XA_X_HEIGHT ((Atom) 56) -#define XA_QUAD_WIDTH ((Atom) 57) -#define XA_WEIGHT ((Atom) 58) -#define XA_POINT_SIZE ((Atom) 59) -#define XA_RESOLUTION ((Atom) 60) -#define XA_COPYRIGHT ((Atom) 61) -#define XA_NOTICE ((Atom) 62) -#define XA_FONT_NAME ((Atom) 63) -#define XA_FAMILY_NAME ((Atom) 64) -#define XA_FULL_NAME ((Atom) 65) -#define XA_CAP_HEIGHT ((Atom) 66) -#define XA_WM_CLASS ((Atom) 67) -#define XA_WM_TRANSIENT_FOR ((Atom) 68) - -#define XA_LAST_PREDEFINED ((Atom) 68) -#endif /* XATOM_H */ diff --git a/openflow/usr/include/X11/Xauth.h b/openflow/usr/include/X11/Xauth.h deleted file mode 100644 index a707bed..0000000 --- a/openflow/usr/include/X11/Xauth.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - -Copyright 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifndef _Xauth_h -#define _Xauth_h - -/* struct xauth is full of implicit padding to properly align the pointers - after the length fields. We can't clean that up without breaking ABI, - so tell clang not to bother complaining about it. */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - -typedef struct xauth { - unsigned short family; - unsigned short address_length; - char *address; - unsigned short number_length; - char *number; - unsigned short name_length; - char *name; - unsigned short data_length; - char *data; -} Xauth; - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -#ifndef _XAUTH_STRUCT_ONLY - -# include -# include - -# include - -# define FamilyLocal (256) /* not part of X standard (i.e. X.h) */ -# define FamilyWild (65535) -# define FamilyNetname (254) /* not part of X standard */ -# define FamilyKrb5Principal (253) /* Kerberos 5 principal name */ -# define FamilyLocalHost (252) /* for local non-net authentication */ - - -_XFUNCPROTOBEGIN - -char *XauFileName(void); - -Xauth *XauReadAuth( -FILE* /* auth_file */ -); - -int XauLockAuth( -_Xconst char* /* file_name */, -int /* retries */, -int /* timeout */, -long /* dead */ -); - -int XauUnlockAuth( -_Xconst char* /* file_name */ -); - -int XauWriteAuth( -FILE* /* auth_file */, -Xauth* /* auth */ -); - -Xauth *XauGetAuthByAddr( -#if NeedWidePrototypes -unsigned int /* family */, -unsigned int /* address_length */, -#else -unsigned short /* family */, -unsigned short /* address_length */, -#endif -_Xconst char* /* address */, -#if NeedWidePrototypes -unsigned int /* number_length */, -#else -unsigned short /* number_length */, -#endif -_Xconst char* /* number */, -#if NeedWidePrototypes -unsigned int /* name_length */, -#else -unsigned short /* name_length */, -#endif -_Xconst char* /* name */ -); - -Xauth *XauGetBestAuthByAddr( -#if NeedWidePrototypes -unsigned int /* family */, -unsigned int /* address_length */, -#else -unsigned short /* family */, -unsigned short /* address_length */, -#endif -_Xconst char* /* address */, -#if NeedWidePrototypes -unsigned int /* number_length */, -#else -unsigned short /* number_length */, -#endif -_Xconst char* /* number */, -int /* types_length */, -char** /* type_names */, -_Xconst int* /* type_lengths */ -); - -void XauDisposeAuth( -Xauth* /* auth */ -); - -_XFUNCPROTOEND - -/* Return values from XauLockAuth */ - -# define LOCK_SUCCESS 0 /* lock succeeded */ -# define LOCK_ERROR 1 /* lock unexpectely failed, check errno */ -# define LOCK_TIMEOUT 2 /* lock failed, timeouts expired */ - -#endif /* _XAUTH_STRUCT_ONLY */ - -#endif /* _Xauth_h */ diff --git a/openflow/usr/include/X11/Xcms.h b/openflow/usr/include/X11/Xcms.h deleted file mode 100644 index 6631854..0000000 --- a/openflow/usr/include/X11/Xcms.h +++ /dev/null @@ -1,815 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. - * - * - * DESCRIPTION - * Public include file for X Color Management System - */ -#ifndef _X11_XCMS_H_ -#define _X11_XCMS_H_ - -#include - -/* The Xcms structs are full of implicit padding to properly align members. - We can't clean that up without breaking ABI, so tell clang not to bother - complaining about it. */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - - /* - * XCMS Status Values - */ -#define XcmsFailure 0 -#define XcmsSuccess 1 -#define XcmsSuccessWithCompression 2 - - /* - * Color Space Format ID's - * Color Space ID's are of XcmsColorFormat type. - * - * bit 31 - * 0 == Device-Independent - * 1 == Device-Dependent - * - * bit 30: - * 0 == Registered with X Consortium - * 1 == Unregistered - */ -#define XcmsUndefinedFormat (XcmsColorFormat)0x00000000 -#define XcmsCIEXYZFormat (XcmsColorFormat)0x00000001 -#define XcmsCIEuvYFormat (XcmsColorFormat)0x00000002 -#define XcmsCIExyYFormat (XcmsColorFormat)0x00000003 -#define XcmsCIELabFormat (XcmsColorFormat)0x00000004 -#define XcmsCIELuvFormat (XcmsColorFormat)0x00000005 -#define XcmsTekHVCFormat (XcmsColorFormat)0x00000006 -#define XcmsRGBFormat (XcmsColorFormat)0x80000000 -#define XcmsRGBiFormat (XcmsColorFormat)0x80000001 - - /* - * State of XcmsPerScrnInfo - */ -#define XcmsInitNone 0x00 /* no initialization attempted */ -#define XcmsInitSuccess 0x01 /* initialization successful */ -#define XcmsInitFailure 0xff /* failure, use defaults */ - -#define DisplayOfCCC(ccc) ((ccc)->dpy) -#define ScreenNumberOfCCC(ccc) ((ccc)->screenNumber) -#define VisualOfCCC(ccc) ((ccc)->visual) -#define ClientWhitePointOfCCC(ccc) (&(ccc)->clientWhitePt) -#define ScreenWhitePointOfCCC(ccc) (&(ccc)->pPerScrnInfo->screenWhitePt) -#define FunctionSetOfCCC(ccc) ((ccc)->pPerScrnInfo->functionSet) - -typedef unsigned long XcmsColorFormat; /* Color Space Format ID */ - -typedef double XcmsFloat; - - /* - * Device RGB - */ -typedef struct { - unsigned short red; /* scaled from 0x0000 to 0xffff */ - unsigned short green; /* scaled from 0x0000 to 0xffff */ - unsigned short blue; /* scaled from 0x0000 to 0xffff */ -} XcmsRGB; - - /* - * RGB Intensity - */ -typedef struct { - XcmsFloat red; /* 0.0 - 1.0 */ - XcmsFloat green; /* 0.0 - 1.0 */ - XcmsFloat blue; /* 0.0 - 1.0 */ -} XcmsRGBi; - - /* - * CIE XYZ - */ -typedef struct { - XcmsFloat X; - XcmsFloat Y; - XcmsFloat Z; -} XcmsCIEXYZ; - - /* - * CIE u'v'Y - */ -typedef struct { - XcmsFloat u_prime; /* 0.0 - 1.0 */ - XcmsFloat v_prime; /* 0.0 - 1.0 */ - XcmsFloat Y; /* 0.0 - 1.0 */ -} XcmsCIEuvY; - - /* - * CIE xyY - */ -typedef struct { - XcmsFloat x; /* 0.0 - 1.0 */ - XcmsFloat y; /* 0.0 - 1.0 */ - XcmsFloat Y; /* 0.0 - 1.0 */ -} XcmsCIExyY; - - /* - * CIE L*a*b* - */ -typedef struct { - XcmsFloat L_star; /* 0.0 - 100.0 */ - XcmsFloat a_star; - XcmsFloat b_star; -} XcmsCIELab; - - /* - * CIE L*u*v* - */ -typedef struct { - XcmsFloat L_star; /* 0.0 - 100.0 */ - XcmsFloat u_star; - XcmsFloat v_star; -} XcmsCIELuv; - - /* - * TekHVC - */ -typedef struct { - XcmsFloat H; /* 0.0 - 360.0 */ - XcmsFloat V; /* 0.0 - 100.0 */ - XcmsFloat C; /* 0.0 - 100.0 */ -} XcmsTekHVC; - - /* - * PAD - */ -typedef struct { - XcmsFloat pad0; - XcmsFloat pad1; - XcmsFloat pad2; - XcmsFloat pad3; -} XcmsPad; - - - /* - * XCMS Color Structure - */ -typedef struct { - union { - XcmsRGB RGB; - XcmsRGBi RGBi; - XcmsCIEXYZ CIEXYZ; - XcmsCIEuvY CIEuvY; - XcmsCIExyY CIExyY; - XcmsCIELab CIELab; - XcmsCIELuv CIELuv; - XcmsTekHVC TekHVC; - XcmsPad Pad; - } spec; /* the color specification */ - unsigned long pixel; /* pixel value (as needed) */ - XcmsColorFormat format; /* the specification format */ -} XcmsColor; - - - /* - * XCMS Per Screen related data - */ - -typedef struct _XcmsPerScrnInfo { - XcmsColor screenWhitePt; /* Screen White point */ - XPointer functionSet; /* pointer to Screen Color Characterization */ - /* Function Set structure */ - XPointer screenData; /* pointer to corresponding Screen Color*/ - /* Characterization Data */ - unsigned char state; /* XcmsInitNone, XcmsInitSuccess, XcmsInitFailure */ - char pad[3]; -} XcmsPerScrnInfo; - -typedef struct _XcmsCCC *XcmsCCC; - -typedef Status (*XcmsCompressionProc)( /* Gamut Compression Proc */ - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -typedef Status (*XcmsWhiteAdjustProc)( /* White Point Adjust Proc */ - XcmsCCC /* ccc */, - XcmsColor* /* initial_white_point*/, - XcmsColor* /* target_white_point*/, - XcmsColorFormat /* target_format */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - - /* - * XCMS Color Conversion Context - */ -typedef struct _XcmsCCC { - Display *dpy; /* X Display */ - int screenNumber; /* X screen number */ - Visual *visual; /* X Visual */ - XcmsColor clientWhitePt; /* Client White Point */ - XcmsCompressionProc gamutCompProc; /* Gamut Compression Function */ - XPointer gamutCompClientData; /* Gamut Comp Func Client Data */ - XcmsWhiteAdjustProc whitePtAdjProc; /* White Point Adjustment Function */ - XPointer whitePtAdjClientData; /* White Pt Adj Func Client Data */ - XcmsPerScrnInfo *pPerScrnInfo; /* pointer to per screen information */ - /* associated with the above display */ - /* screenNumber */ -} XcmsCCCRec; - -typedef Status (*XcmsScreenInitProc)( /* Screen Initialization Proc */ - Display* /* dpy */, - int /* screen_number */, - XcmsPerScrnInfo* /* screen_info */ -); - -typedef void (*XcmsScreenFreeProc)( - XPointer /* screenData */ -); - - /* - * Function List Pointer -- pointer to an array of function pointers. - * The end of list is indicated by a NULL pointer. - */ -/* - * XXX: The use of the XcmsConversionProc type is broken. The - * device-independent colour conversion code uses it as: - -typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, XcmsColor *, - unsigned int); - - * while the device-dependent code uses it as: - -typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, unsigned int, - Bool *); - - * Until this is reworked, it's probably best to leave it unprotoized. - * The code works regardless. - */ -typedef Status (*XcmsDDConversionProc)( /* using device-dependent version */ - XcmsCCC /* ccc */, - XcmsColor* /* pcolors_in_out */, - unsigned int /* ncolors */, - Bool* /* pCompressed */ - ); - -typedef Status (*XcmsDIConversionProc)( /* using device-independent version */ - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* pcolors_in_out */, - unsigned int /* ncolors */ - ); - -typedef XcmsDIConversionProc XcmsConversionProc; -typedef XcmsConversionProc *XcmsFuncListPtr; - -typedef int (*XcmsParseStringProc)( /* Color String Parsing Proc */ - char* /* color_string */, - XcmsColor* /* color_return */ -); - - /* - * Color Space -- per Color Space related data (Device-Independent - * or Device-Dependent) - */ -typedef struct _XcmsColorSpace { - const char *prefix; /* Prefix of string format. */ - XcmsColorFormat id; /* Format ID number. */ - XcmsParseStringProc parseString; - /* String format parsing function */ - XcmsFuncListPtr to_CIEXYZ; /* Pointer to an array of function */ - /* pointers such that when the */ - /* functions are executed in sequence */ - /* will convert a XcmsColor structure */ - /* from this color space to CIEXYZ */ - /* space. */ - XcmsFuncListPtr from_CIEXYZ;/* Pointer to an array of function */ - /* pointers such that when the */ - /* functions are executed in sequence */ - /* will convert a XcmsColor structure */ - /* from CIEXYZ space to this color */ - /* space. */ - int inverse_flag; /* If 1, indicates that for 0 <= i < n */ - /* where n is the number of function */ - /* pointers in the lists to_CIEXYZ */ - /* and from_CIEXYZ; for each function */ - /* to_CIEXYZ[i] its inverse function */ - /* is from_CIEXYZ[n - i]. */ - -} XcmsColorSpace; - - /* - * Screen Color Characterization Function Set -- per device class - * color space conversion functions. - */ -typedef struct _XcmsFunctionSet { - XcmsColorSpace **DDColorSpaces; - /* Pointer to an array of pointers to */ - /* Device-DEPENDENT color spaces */ - /* understood by this SCCFuncSet. */ - XcmsScreenInitProc screenInitProc; - /* Screen initialization function that */ - /* reads Screen Color Characterization*/ - /* Data off properties on the screen's*/ - /* root window. */ - XcmsScreenFreeProc screenFreeProc; - /* Function that frees the SCCData */ - /* structures. */ -} XcmsFunctionSet; - -_XFUNCPROTOBEGIN - -extern Status XcmsAddColorSpace ( - XcmsColorSpace* /* pColorSpace */ -); - -extern Status XcmsAddFunctionSet ( - XcmsFunctionSet* /* functionSet */ -); - -extern Status XcmsAllocColor ( - Display* /* dpy */, - Colormap /* colormap */, - XcmsColor* /* color_in_out */, - XcmsColorFormat /* result_format */ -); - -extern Status XcmsAllocNamedColor ( - Display* /* dpy */, - Colormap /* colormap */, - _Xconst char* /* color_string */, - XcmsColor* /* color_scrn_return */, - XcmsColor* /* color_exact_return */, - XcmsColorFormat /* result_format */ -); - -extern XcmsCCC XcmsCCCOfColormap ( - Display* /* dpy */, - Colormap /* colormap */ -); - -extern Status XcmsCIELabClipab( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELabClipL( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELabClipLab( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELabQueryMaxC ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsFloat /* L_star */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELabQueryMaxL ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsFloat /* chroma */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELabQueryMaxLC ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELabQueryMinL ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsFloat /* chroma */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELabToCIEXYZ ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIELabWhiteShiftColors( - XcmsCCC /* ccc */, - XcmsColor* /* initial_white_point*/, - XcmsColor* /* target_white_point*/, - XcmsColorFormat /* target_format */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELuvClipL( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELuvClipLuv( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELuvClipuv( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELuvQueryMaxC ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsFloat /* L_star */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELuvQueryMaxL ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsFloat /* chroma */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELuvQueryMaxLC ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELuvQueryMinL ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsFloat /* chroma */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELuvToCIEuvY ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIELuvWhiteShiftColors( - XcmsCCC /* ccc */, - XcmsColor* /* initial_white_point*/, - XcmsColor* /* target_white_point*/, - XcmsColorFormat /* target_format */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIEXYZToCIELab ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIEXYZToCIEuvY ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIEXYZToCIExyY ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIEXYZToRGBi ( - XcmsCCC /* ccc */, - XcmsColor* /* colors */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIEuvYToCIELuv ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIEuvYToCIEXYZ ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIEuvYToTekHVC ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIExyYToCIEXYZ ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern XcmsColor *XcmsClientWhitePointOfCCC ( - XcmsCCC /* ccc */ -); - -extern Status XcmsConvertColors ( - XcmsCCC /* ccc */, - XcmsColor* /* colorArry_in_out */, - unsigned int /* nColors */, - XcmsColorFormat /* targetFormat */, - Bool* /* compArry_return */ -); - -extern XcmsCCC XcmsCreateCCC ( - Display* /* dpy */, - int /* screenNumber */, - Visual* /* visual */, - XcmsColor* /* clientWhitePt */, - XcmsCompressionProc /* gamutCompProc */, - XPointer /* gamutCompClientData */, - XcmsWhiteAdjustProc /* whitePtAdjProc */, - XPointer /* whitePtAdjClientData */ -); - -extern XcmsCCC XcmsDefaultCCC ( - Display* /* dpy */, - int /* screenNumber */ -); - -extern Display *XcmsDisplayOfCCC ( - XcmsCCC /* ccc */ -); - -extern XcmsColorFormat XcmsFormatOfPrefix ( - char* /* prefix */ -); - -extern void XcmsFreeCCC ( - XcmsCCC /* ccc */ -); - -extern Status XcmsLookupColor ( - Display* /* dpy */, - Colormap /* colormap */, - _Xconst char* /* color_string */, - XcmsColor* /* pColor_exact_in_out */, - XcmsColor* /* pColor_scrn_in_out */, - XcmsColorFormat /* result_format */ -); - -extern char *XcmsPrefixOfFormat ( - XcmsColorFormat /* id */ -); - -extern Status XcmsQueryBlack ( - XcmsCCC /* ccc */, - XcmsColorFormat /* target_format */, - XcmsColor* /* color_return */ -); - -extern Status XcmsQueryBlue ( - XcmsCCC /* ccc */, - XcmsColorFormat /* target_format */, - XcmsColor* /* color_return */ -); - -extern Status XcmsQueryColor ( - Display* /* dpy */, - Colormap /* colormap */, - XcmsColor* /* pColor_in_out */, - XcmsColorFormat /* result_format */ -); - -extern Status XcmsQueryColors ( - Display* /* dpy */, - Colormap /* colormap */, - XcmsColor* /* colorArry_in_out */, - unsigned int /* nColors */, - XcmsColorFormat /* result_format */ -); - -extern Status XcmsQueryGreen ( - XcmsCCC /* ccc */, - XcmsColorFormat /* target_format */, - XcmsColor* /* color_return */ -); - -extern Status XcmsQueryRed ( - XcmsCCC /* ccc */, - XcmsColorFormat /* target_format */, - XcmsColor* /* color_return */ -); - -extern Status XcmsQueryWhite ( - XcmsCCC /* ccc */, - XcmsColorFormat /* target_format */, - XcmsColor* /* color_return */ -); - -extern Status XcmsRGBiToCIEXYZ ( - XcmsCCC /* ccc */, - XcmsColor* /* colors */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsRGBiToRGB ( - XcmsCCC /* ccc */, - XcmsColor* /* colors */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsRGBToRGBi ( - XcmsCCC /* ccc */, - XcmsColor* /* colors */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern int XcmsScreenNumberOfCCC ( - XcmsCCC /* ccc */ -); - -extern XcmsColor *XcmsScreenWhitePointOfCCC ( - XcmsCCC /* ccc */ -); - -extern XcmsCCC XcmsSetCCCOfColormap( - Display* /* dpy */, - Colormap /* colormap */, - XcmsCCC /* ccc */ -); - -extern XcmsCompressionProc XcmsSetCompressionProc ( - XcmsCCC /* ccc */, - XcmsCompressionProc /* compression_proc */, - XPointer /* client_data */ -); - -extern XcmsWhiteAdjustProc XcmsSetWhiteAdjustProc ( - XcmsCCC /* ccc */, - XcmsWhiteAdjustProc /* white_adjust_proc */, - XPointer /* client_data */ -); - -extern Status XcmsSetWhitePoint ( - XcmsCCC /* ccc */, - XcmsColor* /* color */ -); - -extern Status XcmsStoreColor ( - Display* /* dpy */, - Colormap /* colormap */, - XcmsColor* /* pColor_in */ -); - -extern Status XcmsStoreColors ( - Display* /* dpy */, - Colormap /* colormap */, - XcmsColor* /* colorArry_in */, - unsigned int /* nColors */, - Bool* /* compArry_return */ -); - -extern Status XcmsTekHVCClipC( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsTekHVCClipV( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsTekHVCClipVC( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsTekHVCQueryMaxC ( - XcmsCCC /* ccc */, - XcmsFloat /* hue */, - XcmsFloat /* value */, - XcmsColor* /* color_return */ -); - -extern Status XcmsTekHVCQueryMaxV ( - XcmsCCC /* ccc */, - XcmsFloat /* hue */, - XcmsFloat /* chroma */, - XcmsColor* /* color_return */ -); - -extern Status XcmsTekHVCQueryMaxVC ( - XcmsCCC /* ccc */, - XcmsFloat /* hue */, - XcmsColor* /* color_return */ -); - -extern Status XcmsTekHVCQueryMaxVSamples ( - XcmsCCC /* ccc */, - XcmsFloat /* hue */, - XcmsColor* /* colors_return */, - unsigned int /* nsamples */ -); - -extern Status XcmsTekHVCQueryMinV ( - XcmsCCC /* ccc */, - XcmsFloat /* hue */, - XcmsFloat /* chroma */, - XcmsColor* /* color_return */ -); - -extern Status XcmsTekHVCToCIEuvY ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsTekHVCWhiteShiftColors( - XcmsCCC /* ccc */, - XcmsColor* /* initial_white_point*/, - XcmsColor* /* target_white_point*/, - XcmsColorFormat /* target_format */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern Visual *XcmsVisualOfCCC ( - XcmsCCC /* ccc */ -); - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -_XFUNCPROTOEND - -#endif /* _X11_XCMS_H_ */ diff --git a/openflow/usr/include/X11/Xdefs.h b/openflow/usr/include/X11/Xdefs.h deleted file mode 100644 index e25a208..0000000 --- a/openflow/usr/include/X11/Xdefs.h +++ /dev/null @@ -1,108 +0,0 @@ -/*********************************************************** - -Copyright (c) 1999 The XFree86 Project Inc. - -All Rights Reserved. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The XFree86 Project -Inc. shall not be used in advertising or otherwise to promote the -sale, use or other dealings in this Software without prior written -authorization from The XFree86 Project Inc.. - -*/ - -/** - ** Types definitions shared between server and clients - **/ - -#ifndef _XDEFS_H -#define _XDEFS_H - -#ifdef _XSERVER64 -#include -#endif - -#ifndef _XTYPEDEF_ATOM -# define _XTYPEDEF_ATOM -# ifndef _XSERVER64 -typedef unsigned long Atom; -# else -typedef CARD32 Atom; -# endif -#endif - -#ifndef Bool -# ifndef _XTYPEDEF_BOOL -# define _XTYPEDEF_BOOL -typedef int Bool; -# endif -#endif - -#ifndef _XTYPEDEF_POINTER -# define _XTYPEDEF_POINTER -typedef void *pointer; -#endif - -#ifndef _XTYPEDEF_CLIENTPTR -typedef struct _Client *ClientPtr; -# define _XTYPEDEF_CLIENTPTR -#endif - -#ifndef _XTYPEDEF_XID -# define _XTYPEDEF_XID -# ifndef _XSERVER64 -typedef unsigned long XID; -# else -typedef CARD32 XID; -# endif -#endif - -#ifndef _XTYPEDEF_MASK -# define _XTYPEDEF_MASK -# ifndef _XSERVER64 -typedef unsigned long Mask; -# else -typedef CARD32 Mask; -# endif -#endif - -#ifndef _XTYPEDEF_FONTPTR -# define _XTYPEDEF_FONTPTR -typedef struct _Font *FontPtr; /* also in fonts/include/font.h */ -#endif - -#ifndef _XTYPEDEF_FONT -# define _XTYPEDEF_FONT -typedef XID Font; -#endif - -#ifndef _XTYPEDEF_FSID -# ifndef _XSERVER64 -typedef unsigned long FSID; -# else -typedef CARD32 FSID; -# endif -#endif - -typedef FSID AccContext; - -/* OS independent time value - XXX Should probably go in Xos.h */ -typedef struct timeval **OSTimePtr; - - -typedef void (* BlockHandlerProcPtr)(void * /* blockData */, - OSTimePtr /* pTimeout */, - void * /* pReadmask */); - -#endif diff --git a/openflow/usr/include/X11/Xdmcp.h b/openflow/usr/include/X11/Xdmcp.h deleted file mode 100644 index 0b531de..0000000 --- a/openflow/usr/include/X11/Xdmcp.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright 1989 Network Computing Devices, Inc., Mountain View, California. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of N.C.D. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. N.C.D. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - */ - -#ifndef _XDMCP_H_ -#define _XDMCP_H_ - -#include - -#include - -_XFUNCPROTOBEGIN - -#define XDM_PROTOCOL_VERSION 1 -#define XDM_UDP_PORT 177 - -/* IANA has assigned FF0X:0:0:0:0:0:0:12B as the permanently assigned - * multicast addresses for XDMCP, where X in the prefix may be replaced - * by any valid scope identifier, such as 1 for Node-Local, 2 for Link-Local, - * 5 for Site-Local, and so on. We set the default here to the Link-Local - * version to most closely match the old IPv4 subnet broadcast behavior. - * Both xdm and X -query allow specifying a different address if a different - * scope is defined. - */ -#define XDM_DEFAULT_MCAST_ADDR6 "ff02:0:0:0:0:0:0:12b" - -#define XDM_MAX_MSGLEN 8192 -#define XDM_MIN_RTX 2 -#define XDM_MAX_RTX 32 -#define XDM_RTX_LIMIT 7 -#define XDM_KA_RTX_LIMIT 4 -#define XDM_DEF_DORMANCY (3 * 60) /* 3 minutes */ -#define XDM_MAX_DORMANCY (24 * 60 * 60) /* 24 hours */ - -typedef enum { - BROADCAST_QUERY = 1, QUERY, INDIRECT_QUERY, FORWARD_QUERY, - WILLING, UNWILLING, REQUEST, ACCEPT, DECLINE, MANAGE, REFUSE, - FAILED, KEEPALIVE, ALIVE -} xdmOpCode; - -typedef enum { - XDM_QUERY, XDM_BROADCAST, XDM_INDIRECT, XDM_COLLECT_QUERY, - XDM_COLLECT_BROADCAST_QUERY, XDM_COLLECT_INDIRECT_QUERY, - XDM_START_CONNECTION, XDM_AWAIT_REQUEST_RESPONSE, - XDM_AWAIT_MANAGE_RESPONSE, XDM_MANAGE, XDM_RUN_SESSION, XDM_OFF, - XDM_AWAIT_USER_INPUT, XDM_KEEPALIVE, XDM_AWAIT_ALIVE_RESPONSE, -#if defined(IPv6) && defined(AF_INET6) - XDM_MULTICAST, XDM_COLLECT_MULTICAST_QUERY, -#endif - XDM_KEEP_ME_LAST -} xdmcp_states; - -#ifdef NOTDEF -/* table of hosts */ - -#define XDM_MAX_STR_LEN 21 -#define XDM_MAX_HOSTS 20 -struct xdm_host_table { - struct sockaddr_in sockaddr; - char name[XDM_MAX_STR_LEN]; - char status[XDM_MAX_STR_LEN]; -}; -#endif /* NOTDEF */ - -typedef CARD8 *CARD8Ptr; -typedef CARD16 *CARD16Ptr; -typedef CARD32 *CARD32Ptr; - -typedef struct _ARRAY8 { - CARD16 length; - CARD8Ptr data; -} ARRAY8, *ARRAY8Ptr; - -typedef struct _ARRAY16 { - CARD8 length; - CARD16Ptr data; -} ARRAY16, *ARRAY16Ptr; - -typedef struct _ARRAY32 { - CARD8 length; - CARD32Ptr data; -} ARRAY32, *ARRAY32Ptr; - -typedef struct _ARRAYofARRAY8 { - CARD8 length; - ARRAY8Ptr data; -} ARRAYofARRAY8, *ARRAYofARRAY8Ptr; - -typedef struct _XdmcpHeader { - CARD16 version, opcode, length; -} XdmcpHeader, *XdmcpHeaderPtr; - -typedef struct _XdmcpBuffer { - BYTE *data; - int size; /* size of buffer pointed by to data */ - int pointer; /* current index into data */ - int count; /* bytes read from network into data */ -} XdmcpBuffer, *XdmcpBufferPtr; - -typedef struct _XdmAuthKey { - BYTE data[8]; -} XdmAuthKeyRec, *XdmAuthKeyPtr; - - -/* implementation-independent network address structure. - Equiv to sockaddr* for sockets. */ - -typedef char *XdmcpNetaddr; - -extern int XdmcpWriteARRAY16(XdmcpBufferPtr buffer, const ARRAY16Ptr array); -extern int XdmcpWriteARRAY32(XdmcpBufferPtr buffer, const ARRAY32Ptr array); -extern int XdmcpWriteARRAY8(XdmcpBufferPtr buffer, const ARRAY8Ptr array); -extern int XdmcpWriteARRAYofARRAY8(XdmcpBufferPtr buffer, const ARRAYofARRAY8Ptr array); -extern int XdmcpWriteCARD16(XdmcpBufferPtr buffer, unsigned value); -extern int XdmcpWriteCARD32(XdmcpBufferPtr buffer, unsigned value); -extern int XdmcpWriteCARD8(XdmcpBufferPtr buffer, unsigned value); -extern int XdmcpWriteHeader(XdmcpBufferPtr buffer, const XdmcpHeaderPtr header); - -extern int XdmcpFlush(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr to, int tolen); - -extern int XdmcpReadARRAY16(XdmcpBufferPtr buffer, ARRAY16Ptr array); -extern int XdmcpReadARRAY32(XdmcpBufferPtr buffer, ARRAY32Ptr array); -extern int XdmcpReadARRAY8(XdmcpBufferPtr buffer, ARRAY8Ptr array); -extern int XdmcpReadARRAYofARRAY8(XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array); -extern int XdmcpReadCARD16(XdmcpBufferPtr buffer, CARD16Ptr valuep); -extern int XdmcpReadCARD32(XdmcpBufferPtr buffer, CARD32Ptr valuep); -extern int XdmcpReadCARD8(XdmcpBufferPtr buffer, CARD8Ptr valuep); -extern int XdmcpReadHeader(XdmcpBufferPtr buffer, XdmcpHeaderPtr header); - -extern int XdmcpFill(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr from, int *fromlen); - -extern int XdmcpReadRemaining(const XdmcpBufferPtr buffer); - -extern void XdmcpDisposeARRAY8(ARRAY8Ptr array); -extern void XdmcpDisposeARRAY16(ARRAY16Ptr array); -extern void XdmcpDisposeARRAY32(ARRAY32Ptr array); -extern void XdmcpDisposeARRAYofARRAY8(ARRAYofARRAY8Ptr array); - -extern int XdmcpCopyARRAY8(const ARRAY8Ptr src, ARRAY8Ptr dst); - -extern int XdmcpARRAY8Equal(const ARRAY8Ptr array1, const ARRAY8Ptr array2); - -extern void XdmcpGenerateKey (XdmAuthKeyPtr key); -extern void XdmcpIncrementKey (XdmAuthKeyPtr key); -extern void XdmcpDecrementKey (XdmAuthKeyPtr key); -#ifdef HASXDMAUTH -extern void XdmcpWrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes); -extern void XdmcpUnwrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes); -#endif - -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif - -extern int XdmcpCompareKeys (const XdmAuthKeyPtr a, const XdmAuthKeyPtr b); - -extern int XdmcpAllocARRAY16 (ARRAY16Ptr array, int length); -extern int XdmcpAllocARRAY32 (ARRAY32Ptr array, int length); -extern int XdmcpAllocARRAY8 (ARRAY8Ptr array, int length); -extern int XdmcpAllocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length); - -extern int XdmcpReallocARRAY16 (ARRAY16Ptr array, int length); -extern int XdmcpReallocARRAY32 (ARRAY32Ptr array, int length); -extern int XdmcpReallocARRAY8 (ARRAY8Ptr array, int length); -extern int XdmcpReallocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length); - -_XFUNCPROTOEND - -#endif /* _XDMCP_H_ */ diff --git a/openflow/usr/include/X11/Xfuncproto.h b/openflow/usr/include/X11/Xfuncproto.h deleted file mode 100644 index 61fa8fa..0000000 --- a/openflow/usr/include/X11/Xfuncproto.h +++ /dev/null @@ -1,221 +0,0 @@ -/* Xfuncproto.h. Generated from Xfuncproto.h.in by configure. */ -/* - * -Copyright 1989, 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - */ - -/* Definitions to make function prototypes manageable */ - -#ifndef _XFUNCPROTO_H_ -#define _XFUNCPROTO_H_ - -#ifndef NeedFunctionPrototypes -#define NeedFunctionPrototypes 1 -#endif /* NeedFunctionPrototypes */ - -#ifndef NeedVarargsPrototypes -#define NeedVarargsPrototypes 1 -#endif /* NeedVarargsPrototypes */ - -#if NeedFunctionPrototypes - -#ifndef NeedNestedPrototypes -#define NeedNestedPrototypes 1 -#endif /* NeedNestedPrototypes */ - -#ifndef _Xconst -#define _Xconst const -#endif /* _Xconst */ - -/* Function prototype configuration (see configure for more info) */ -#ifndef NARROWPROTO -#define NARROWPROTO /**/ -#endif -#ifndef FUNCPROTO -#define FUNCPROTO 15 -#endif - -#ifndef NeedWidePrototypes -#ifdef NARROWPROTO -#define NeedWidePrototypes 0 -#else -#define NeedWidePrototypes 1 /* default to make interropt. easier */ -#endif -#endif /* NeedWidePrototypes */ - -#endif /* NeedFunctionPrototypes */ - -#ifndef _XFUNCPROTOBEGIN -#if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */ -#define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */ -#define _XFUNCPROTOEND } -#else -#define _XFUNCPROTOBEGIN -#define _XFUNCPROTOEND -#endif -#endif /* _XFUNCPROTOBEGIN */ - -/* http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute */ -#ifndef __has_attribute -# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ -#endif -#ifndef __has_feature -# define __has_feature(x) 0 /* Compatibility with non-clang compilers. */ -#endif -#ifndef __has_extension -# define __has_extension(x) 0 /* Compatibility with non-clang compilers. */ -#endif - -/* Added in X11R6.9, so available in any version of modular xproto */ -#if __has_attribute(__sentinel__) || (defined(__GNUC__) && (__GNUC__ >= 4)) -# define _X_SENTINEL(x) __attribute__ ((__sentinel__(x))) -#else -# define _X_SENTINEL(x) -#endif /* GNUC >= 4 */ - -/* Added in X11R6.9, so available in any version of modular xproto */ -#if (__has_attribute(visibility) || (defined(__GNUC__) && (__GNUC__ >= 4))) \ - && !defined(__CYGWIN__) && !defined(__MINGW32__) -# define _X_EXPORT __attribute__((visibility("default"))) -# define _X_HIDDEN __attribute__((visibility("hidden"))) -# define _X_INTERNAL __attribute__((visibility("internal"))) -#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) -# define _X_EXPORT __global -# define _X_HIDDEN __hidden -# define _X_INTERNAL __hidden -#else /* not gcc >= 4 and not Sun Studio >= 8 */ -# define _X_EXPORT -# define _X_HIDDEN -# define _X_INTERNAL -#endif /* GNUC >= 4 */ - -/* Branch prediction hints for individual conditionals */ -/* requires xproto >= 7.0.9 */ -#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303) -# define _X_LIKELY(x) __builtin_expect(!!(x), 1) -# define _X_UNLIKELY(x) __builtin_expect(!!(x), 0) -#else /* not gcc >= 3.3 */ -# define _X_LIKELY(x) (x) -# define _X_UNLIKELY(x) (x) -#endif - -/* Bulk branch prediction hints via marking error path functions as "cold" */ -/* requires xproto >= 7.0.25 */ -#if __has_attribute(__cold__) || \ - (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403)) /* 4.3+ */ -# define _X_COLD __attribute__((__cold__)) -#else -# define _X_COLD /* nothing */ -#endif - -/* Added in X11R6.9, so available in any version of modular xproto */ -#if __has_attribute(deprecated) \ - || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)) \ - || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5130)) -# define _X_DEPRECATED __attribute__((deprecated)) -#else /* not gcc >= 3.1 */ -# define _X_DEPRECATED -#endif - -/* requires xproto >= 7.0.30 */ -#if __has_extension(attribute_deprecated_with_message) || \ - (defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)))) -# define _X_DEPRECATED_MSG(_msg) __attribute__((deprecated(_msg))) -#else -# define _X_DEPRECATED_MSG(_msg) _X_DEPRECATED -#endif - -/* requires xproto >= 7.0.17 */ -#if __has_attribute(noreturn) \ - || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \ - || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) -# define _X_NORETURN __attribute((noreturn)) -#else -# define _X_NORETURN -#endif /* GNUC */ - -/* Added in X11R6.9, so available in any version of modular xproto */ -#if __has_attribute(__format__) \ - || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203) -# define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y))) -#else /* not gcc >= 2.3 */ -# define _X_ATTRIBUTE_PRINTF(x,y) -#endif - -/* requires xproto >= 7.0.22 - since this uses either gcc or C99 variable - argument macros, must be only used inside #ifdef _X_NONNULL guards, as - many legacy X clients are compiled in C89 mode still. */ -#if __has_attribute(nonnull) \ - && defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ -#define _X_NONNULL(...) __attribute__((nonnull(__VA_ARGS__))) -#elif __has_attribute(nonnull) \ - || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303) -#define _X_NONNULL(args...) __attribute__((nonnull(args))) -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ -#define _X_NONNULL(...) /* */ -#endif - -/* requires xproto >= 7.0.22 */ -#if __has_attribute(__unused__) \ - || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205) -#define _X_UNUSED __attribute__((__unused__)) -#else -#define _X_UNUSED /* */ -#endif - -/* C99 keyword "inline" or equivalent extensions in pre-C99 compilers */ -/* requires xproto >= 7.0.9 - (introduced in 7.0.8 but didn't support all compilers until 7.0.9) */ -#if defined(inline) /* assume autoconf set it correctly */ || \ - (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ || \ - (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)) -# define _X_INLINE inline -#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */ -# define _X_INLINE __inline__ -#else -# define _X_INLINE -#endif - -/* C99 keyword "restrict" or equivalent extensions in pre-C99 compilers */ -/* requires xproto >= 7.0.21 */ -#ifndef _X_RESTRICT_KYWD -# if defined(restrict) /* assume autoconf set it correctly */ || \ - (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ \ - && !defined(__cplusplus)) /* Workaround g++ issue on Solaris */ -# define _X_RESTRICT_KYWD restrict -# elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */ -# define _X_RESTRICT_KYWD __restrict__ -# else -# define _X_RESTRICT_KYWD -# endif -#endif - -/* requires xproto >= 7.0.30 */ -#if __has_attribute(no_sanitize_thread) -# define _X_NOTSAN __attribute__((no_sanitize_thread)) -#else -# define _X_NOTSAN -#endif - -#endif /* _XFUNCPROTO_H_ */ diff --git a/openflow/usr/include/X11/Xfuncs.h b/openflow/usr/include/X11/Xfuncs.h deleted file mode 100644 index b7c4029..0000000 --- a/openflow/usr/include/X11/Xfuncs.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - */ - -#ifndef _XFUNCS_H_ -# define _XFUNCS_H_ - -# include - -/* the old Xfuncs.h, for pre-R6 */ -# if !(defined(XFree86LOADER) && defined(IN_MODULE)) - -# ifdef X_USEBFUNCS -void bcopy(); -void bzero(); -int bcmp(); -# else -# if defined(SYSV) && !defined(__SCO__) && !defined(__sun) && !defined(__UNIXWARE__) && !defined(_AIX) -# include -void bcopy(); -# define bzero(b,len) memset(b, 0, len) -# define bcmp(b1,b2,len) memcmp(b1, b2, len) -# else -# include -# if defined(__SCO__) || defined(__sun) || defined(__UNIXWARE__) || defined(__CYGWIN__) || defined(_AIX) || defined(__APPLE__) -# include -# endif -# define _XFUNCS_H_INCLUDED_STRING_H -# endif -# endif /* X_USEBFUNCS */ - -/* the new Xfuncs.h */ - -/* the ANSI C way */ -# ifndef _XFUNCS_H_INCLUDED_STRING_H -# include -# endif -# undef bzero -# define bzero(b,len) memset(b,0,len) - -# if defined WIN32 && defined __MINGW32__ -# define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len)) -# endif - -# endif /* !(defined(XFree86LOADER) && defined(IN_MODULE)) */ - -#endif /* _XFUNCS_H_ */ diff --git a/openflow/usr/include/X11/Xlib.h b/openflow/usr/include/X11/Xlib.h deleted file mode 100644 index 2bffa76..0000000 --- a/openflow/usr/include/X11/Xlib.h +++ /dev/null @@ -1,4015 +0,0 @@ -/* - -Copyright 1985, 1986, 1987, 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - - -/* - * Xlib.h - Header definition and support file for the C subroutine - * interface library (Xlib) to the X Window System Protocol (V11). - * Structures and symbols starting with "_" are private to the library. - */ -#ifndef _X11_XLIB_H_ -#define _X11_XLIB_H_ - -#define XlibSpecificationRelease 6 - -#include - -#if defined(__SCO__) || defined(__UNIXWARE__) -#include -#endif - -#include - -/* applications should not depend on these two headers being included! */ -#include -#include - -#ifndef X_WCHAR -#include -#else -#ifdef __UNIXOS2__ -#include -#else -/* replace this with #include or typedef appropriate for your system */ -typedef unsigned long wchar_t; -#endif -#endif - - -extern int -_Xmblen( - char *str, - int len - ); - -/* API mentioning "UTF8" or "utf8" is an XFree86 extension, introduced in - November 2000. Its presence is indicated through the following macro. */ -#define X_HAVE_UTF8_STRING 1 - -/* The Xlib structs are full of implicit padding to properly align members. - We can't clean that up without breaking ABI, so tell clang not to bother - complaining about it. */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - -typedef char *XPointer; - -#define Bool int -#define Status int -#define True 1 -#define False 0 - -#define QueuedAlready 0 -#define QueuedAfterReading 1 -#define QueuedAfterFlush 2 - -#define ConnectionNumber(dpy) (((_XPrivDisplay)dpy)->fd) -#define RootWindow(dpy, scr) (ScreenOfDisplay(dpy,scr)->root) -#define DefaultScreen(dpy) (((_XPrivDisplay)dpy)->default_screen) -#define DefaultRootWindow(dpy) (ScreenOfDisplay(dpy,DefaultScreen(dpy))->root) -#define DefaultVisual(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_visual) -#define DefaultGC(dpy, scr) (ScreenOfDisplay(dpy,scr)->default_gc) -#define BlackPixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->black_pixel) -#define WhitePixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->white_pixel) -#define AllPlanes ((unsigned long)~0L) -#define QLength(dpy) (((_XPrivDisplay)dpy)->qlen) -#define DisplayWidth(dpy, scr) (ScreenOfDisplay(dpy,scr)->width) -#define DisplayHeight(dpy, scr) (ScreenOfDisplay(dpy,scr)->height) -#define DisplayWidthMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mwidth) -#define DisplayHeightMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mheight) -#define DisplayPlanes(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth) -#define DisplayCells(dpy, scr) (DefaultVisual(dpy,scr)->map_entries) -#define ScreenCount(dpy) (((_XPrivDisplay)dpy)->nscreens) -#define ServerVendor(dpy) (((_XPrivDisplay)dpy)->vendor) -#define ProtocolVersion(dpy) (((_XPrivDisplay)dpy)->proto_major_version) -#define ProtocolRevision(dpy) (((_XPrivDisplay)dpy)->proto_minor_version) -#define VendorRelease(dpy) (((_XPrivDisplay)dpy)->release) -#define DisplayString(dpy) (((_XPrivDisplay)dpy)->display_name) -#define DefaultDepth(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth) -#define DefaultColormap(dpy, scr)(ScreenOfDisplay(dpy,scr)->cmap) -#define BitmapUnit(dpy) (((_XPrivDisplay)dpy)->bitmap_unit) -#define BitmapBitOrder(dpy) (((_XPrivDisplay)dpy)->bitmap_bit_order) -#define BitmapPad(dpy) (((_XPrivDisplay)dpy)->bitmap_pad) -#define ImageByteOrder(dpy) (((_XPrivDisplay)dpy)->byte_order) -#define NextRequest(dpy) (((_XPrivDisplay)dpy)->request + 1) -#define LastKnownRequestProcessed(dpy) (((_XPrivDisplay)dpy)->last_request_read) - -/* macros for screen oriented applications (toolkit) */ -#define ScreenOfDisplay(dpy, scr)(&((_XPrivDisplay)dpy)->screens[scr]) -#define DefaultScreenOfDisplay(dpy) ScreenOfDisplay(dpy,DefaultScreen(dpy)) -#define DisplayOfScreen(s) ((s)->display) -#define RootWindowOfScreen(s) ((s)->root) -#define BlackPixelOfScreen(s) ((s)->black_pixel) -#define WhitePixelOfScreen(s) ((s)->white_pixel) -#define DefaultColormapOfScreen(s)((s)->cmap) -#define DefaultDepthOfScreen(s) ((s)->root_depth) -#define DefaultGCOfScreen(s) ((s)->default_gc) -#define DefaultVisualOfScreen(s)((s)->root_visual) -#define WidthOfScreen(s) ((s)->width) -#define HeightOfScreen(s) ((s)->height) -#define WidthMMOfScreen(s) ((s)->mwidth) -#define HeightMMOfScreen(s) ((s)->mheight) -#define PlanesOfScreen(s) ((s)->root_depth) -#define CellsOfScreen(s) (DefaultVisualOfScreen((s))->map_entries) -#define MinCmapsOfScreen(s) ((s)->min_maps) -#define MaxCmapsOfScreen(s) ((s)->max_maps) -#define DoesSaveUnders(s) ((s)->save_unders) -#define DoesBackingStore(s) ((s)->backing_store) -#define EventMaskOfScreen(s) ((s)->root_input_mask) - -/* - * Extensions need a way to hang private data on some structures. - */ -typedef struct _XExtData { - int number; /* number returned by XRegisterExtension */ - struct _XExtData *next; /* next item on list of data for structure */ - int (*free_private)( /* called to free private storage */ - struct _XExtData *extension - ); - XPointer private_data; /* data private to this extension. */ -} XExtData; - -/* - * This file contains structures used by the extension mechanism. - */ -typedef struct { /* public to extension, cannot be changed */ - int extension; /* extension number */ - int major_opcode; /* major op-code assigned by server */ - int first_event; /* first event number for the extension */ - int first_error; /* first error number for the extension */ -} XExtCodes; - -/* - * Data structure for retrieving info about pixmap formats. - */ - -typedef struct { - int depth; - int bits_per_pixel; - int scanline_pad; -} XPixmapFormatValues; - - -/* - * Data structure for setting graphics context. - */ -typedef struct { - int function; /* logical operation */ - unsigned long plane_mask;/* plane mask */ - unsigned long foreground;/* foreground pixel */ - unsigned long background;/* background pixel */ - int line_width; /* line width */ - int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ - int cap_style; /* CapNotLast, CapButt, - CapRound, CapProjecting */ - int join_style; /* JoinMiter, JoinRound, JoinBevel */ - int fill_style; /* FillSolid, FillTiled, - FillStippled, FillOpaeueStippled */ - int fill_rule; /* EvenOddRule, WindingRule */ - int arc_mode; /* ArcChord, ArcPieSlice */ - Pixmap tile; /* tile pixmap for tiling operations */ - Pixmap stipple; /* stipple 1 plane pixmap for stipping */ - int ts_x_origin; /* offset for tile or stipple operations */ - int ts_y_origin; - Font font; /* default text font for text operations */ - int subwindow_mode; /* ClipByChildren, IncludeInferiors */ - Bool graphics_exposures;/* boolean, should exposures be generated */ - int clip_x_origin; /* origin for clipping */ - int clip_y_origin; - Pixmap clip_mask; /* bitmap clipping; other calls for rects */ - int dash_offset; /* patterned/dashed line information */ - char dashes; -} XGCValues; - -/* - * Graphics context. The contents of this structure are implementation - * dependent. A GC should be treated as opaque by application code. - */ - -typedef struct _XGC -#ifdef XLIB_ILLEGAL_ACCESS -{ - XExtData *ext_data; /* hook for extension to hang data */ - GContext gid; /* protocol ID for graphics context */ - /* there is more to this structure, but it is private to Xlib */ -} -#endif -*GC; - -/* - * Visual structure; contains information about colormapping possible. - */ -typedef struct { - XExtData *ext_data; /* hook for extension to hang data */ - VisualID visualid; /* visual id of this visual */ -#if defined(__cplusplus) || defined(c_plusplus) - int c_class; /* C++ class of screen (monochrome, etc.) */ -#else - int class; /* class of screen (monochrome, etc.) */ -#endif - unsigned long red_mask, green_mask, blue_mask; /* mask values */ - int bits_per_rgb; /* log base 2 of distinct color values */ - int map_entries; /* color map entries */ -} Visual; - -/* - * Depth structure; contains information for each possible depth. - */ -typedef struct { - int depth; /* this depth (Z) of the depth */ - int nvisuals; /* number of Visual types at this depth */ - Visual *visuals; /* list of visuals possible at this depth */ -} Depth; - -/* - * Information about the screen. The contents of this structure are - * implementation dependent. A Screen should be treated as opaque - * by application code. - */ - -struct _XDisplay; /* Forward declare before use for C++ */ - -typedef struct { - XExtData *ext_data; /* hook for extension to hang data */ - struct _XDisplay *display;/* back pointer to display structure */ - Window root; /* Root window id. */ - int width, height; /* width and height of screen */ - int mwidth, mheight; /* width and height of in millimeters */ - int ndepths; /* number of depths possible */ - Depth *depths; /* list of allowable depths on the screen */ - int root_depth; /* bits per pixel */ - Visual *root_visual; /* root visual */ - GC default_gc; /* GC for the root root visual */ - Colormap cmap; /* default color map */ - unsigned long white_pixel; - unsigned long black_pixel; /* White and Black pixel values */ - int max_maps, min_maps; /* max and min color maps */ - int backing_store; /* Never, WhenMapped, Always */ - Bool save_unders; - long root_input_mask; /* initial root input mask */ -} Screen; - -/* - * Format structure; describes ZFormat data the screen will understand. - */ -typedef struct { - XExtData *ext_data; /* hook for extension to hang data */ - int depth; /* depth of this image format */ - int bits_per_pixel; /* bits/pixel at this depth */ - int scanline_pad; /* scanline must padded to this multiple */ -} ScreenFormat; - -/* - * Data structure for setting window attributes. - */ -typedef struct { - Pixmap background_pixmap; /* background or None or ParentRelative */ - unsigned long background_pixel; /* background pixel */ - Pixmap border_pixmap; /* border of the window */ - unsigned long border_pixel; /* border pixel value */ - int bit_gravity; /* one of bit gravity values */ - int win_gravity; /* one of the window gravity values */ - int backing_store; /* NotUseful, WhenMapped, Always */ - unsigned long backing_planes;/* planes to be preseved if possible */ - unsigned long backing_pixel;/* value to use in restoring planes */ - Bool save_under; /* should bits under be saved? (popups) */ - long event_mask; /* set of events that should be saved */ - long do_not_propagate_mask; /* set of events that should not propagate */ - Bool override_redirect; /* boolean value for override-redirect */ - Colormap colormap; /* color map to be associated with window */ - Cursor cursor; /* cursor to be displayed (or None) */ -} XSetWindowAttributes; - -typedef struct { - int x, y; /* location of window */ - int width, height; /* width and height of window */ - int border_width; /* border width of window */ - int depth; /* depth of window */ - Visual *visual; /* the associated visual structure */ - Window root; /* root of screen containing window */ -#if defined(__cplusplus) || defined(c_plusplus) - int c_class; /* C++ InputOutput, InputOnly*/ -#else - int class; /* InputOutput, InputOnly*/ -#endif - int bit_gravity; /* one of bit gravity values */ - int win_gravity; /* one of the window gravity values */ - int backing_store; /* NotUseful, WhenMapped, Always */ - unsigned long backing_planes;/* planes to be preserved if possible */ - unsigned long backing_pixel;/* value to be used when restoring planes */ - Bool save_under; /* boolean, should bits under be saved? */ - Colormap colormap; /* color map to be associated with window */ - Bool map_installed; /* boolean, is color map currently installed*/ - int map_state; /* IsUnmapped, IsUnviewable, IsViewable */ - long all_event_masks; /* set of events all people have interest in*/ - long your_event_mask; /* my event mask */ - long do_not_propagate_mask; /* set of events that should not propagate */ - Bool override_redirect; /* boolean value for override-redirect */ - Screen *screen; /* back pointer to correct screen */ -} XWindowAttributes; - -/* - * Data structure for host setting; getting routines. - * - */ - -typedef struct { - int family; /* for example FamilyInternet */ - int length; /* length of address, in bytes */ - char *address; /* pointer to where to find the bytes */ -} XHostAddress; - -/* - * Data structure for ServerFamilyInterpreted addresses in host routines - */ -typedef struct { - int typelength; /* length of type string, in bytes */ - int valuelength; /* length of value string, in bytes */ - char *type; /* pointer to where to find the type string */ - char *value; /* pointer to where to find the address */ -} XServerInterpretedAddress; - -/* - * Data structure for "image" data, used by image manipulation routines. - */ -typedef struct _XImage { - int width, height; /* size of image */ - int xoffset; /* number of pixels offset in X direction */ - int format; /* XYBitmap, XYPixmap, ZPixmap */ - char *data; /* pointer to image data */ - int byte_order; /* data byte order, LSBFirst, MSBFirst */ - int bitmap_unit; /* quant. of scanline 8, 16, 32 */ - int bitmap_bit_order; /* LSBFirst, MSBFirst */ - int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */ - int depth; /* depth of image */ - int bytes_per_line; /* accelarator to next line */ - int bits_per_pixel; /* bits per pixel (ZPixmap) */ - unsigned long red_mask; /* bits in z arrangment */ - unsigned long green_mask; - unsigned long blue_mask; - XPointer obdata; /* hook for the object routines to hang on */ - struct funcs { /* image manipulation routines */ - struct _XImage *(*create_image)( - struct _XDisplay* /* display */, - Visual* /* visual */, - unsigned int /* depth */, - int /* format */, - int /* offset */, - char* /* data */, - unsigned int /* width */, - unsigned int /* height */, - int /* bitmap_pad */, - int /* bytes_per_line */); - int (*destroy_image) (struct _XImage *); - unsigned long (*get_pixel) (struct _XImage *, int, int); - int (*put_pixel) (struct _XImage *, int, int, unsigned long); - struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int); - int (*add_pixel) (struct _XImage *, long); - } f; -} XImage; - -/* - * Data structure for XReconfigureWindow - */ -typedef struct { - int x, y; - int width, height; - int border_width; - Window sibling; - int stack_mode; -} XWindowChanges; - -/* - * Data structure used by color operations - */ -typedef struct { - unsigned long pixel; - unsigned short red, green, blue; - char flags; /* do_red, do_green, do_blue */ - char pad; -} XColor; - -/* - * Data structures for graphics operations. On most machines, these are - * congruent with the wire protocol structures, so reformatting the data - * can be avoided on these architectures. - */ -typedef struct { - short x1, y1, x2, y2; -} XSegment; - -typedef struct { - short x, y; -} XPoint; - -typedef struct { - short x, y; - unsigned short width, height; -} XRectangle; - -typedef struct { - short x, y; - unsigned short width, height; - short angle1, angle2; -} XArc; - - -/* Data structure for XChangeKeyboardControl */ - -typedef struct { - int key_click_percent; - int bell_percent; - int bell_pitch; - int bell_duration; - int led; - int led_mode; - int key; - int auto_repeat_mode; /* On, Off, Default */ -} XKeyboardControl; - -/* Data structure for XGetKeyboardControl */ - -typedef struct { - int key_click_percent; - int bell_percent; - unsigned int bell_pitch, bell_duration; - unsigned long led_mask; - int global_auto_repeat; - char auto_repeats[32]; -} XKeyboardState; - -/* Data structure for XGetMotionEvents. */ - -typedef struct { - Time time; - short x, y; -} XTimeCoord; - -/* Data structure for X{Set,Get}ModifierMapping */ - -typedef struct { - int max_keypermod; /* The server's max # of keys per modifier */ - KeyCode *modifiermap; /* An 8 by max_keypermod array of modifiers */ -} XModifierKeymap; - - -/* - * Display datatype maintaining display specific data. - * The contents of this structure are implementation dependent. - * A Display should be treated as opaque by application code. - */ -#ifndef XLIB_ILLEGAL_ACCESS -typedef struct _XDisplay Display; -#endif - -struct _XPrivate; /* Forward declare before use for C++ */ -struct _XrmHashBucketRec; - -typedef struct -#ifdef XLIB_ILLEGAL_ACCESS -_XDisplay -#endif -{ - XExtData *ext_data; /* hook for extension to hang data */ - struct _XPrivate *private1; - int fd; /* Network socket. */ - int private2; - int proto_major_version;/* major version of server's X protocol */ - int proto_minor_version;/* minor version of servers X protocol */ - char *vendor; /* vendor of the server hardware */ - XID private3; - XID private4; - XID private5; - int private6; - XID (*resource_alloc)( /* allocator function */ - struct _XDisplay* - ); - int byte_order; /* screen byte order, LSBFirst, MSBFirst */ - int bitmap_unit; /* padding and data requirements */ - int bitmap_pad; /* padding requirements on bitmaps */ - int bitmap_bit_order; /* LeastSignificant or MostSignificant */ - int nformats; /* number of pixmap formats in list */ - ScreenFormat *pixmap_format; /* pixmap format list */ - int private8; - int release; /* release of the server */ - struct _XPrivate *private9, *private10; - int qlen; /* Length of input event queue */ - unsigned long last_request_read; /* seq number of last event read */ - unsigned long request; /* sequence number of last request. */ - XPointer private11; - XPointer private12; - XPointer private13; - XPointer private14; - unsigned max_request_size; /* maximum number 32 bit words in request*/ - struct _XrmHashBucketRec *db; - int (*private15)( - struct _XDisplay* - ); - char *display_name; /* "host:display" string used on this connect*/ - int default_screen; /* default screen for operations */ - int nscreens; /* number of screens on this server*/ - Screen *screens; /* pointer to list of screens */ - unsigned long motion_buffer; /* size of motion buffer */ - unsigned long private16; - int min_keycode; /* minimum defined keycode */ - int max_keycode; /* maximum defined keycode */ - XPointer private17; - XPointer private18; - int private19; - char *xdefaults; /* contents of defaults from server */ - /* there is more to this structure, but it is private to Xlib */ -} -#ifdef XLIB_ILLEGAL_ACCESS -Display, -#endif -*_XPrivDisplay; - -#undef _XEVENT_ -#ifndef _XEVENT_ -/* - * Definitions of specific events. - */ -typedef struct { - int type; /* of event */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* "event" window it is reported relative to */ - Window root; /* root window that the event occurred on */ - Window subwindow; /* child window */ - Time time; /* milliseconds */ - int x, y; /* pointer x, y coordinates in event window */ - int x_root, y_root; /* coordinates relative to root */ - unsigned int state; /* key or button mask */ - unsigned int keycode; /* detail */ - Bool same_screen; /* same screen flag */ -} XKeyEvent; -typedef XKeyEvent XKeyPressedEvent; -typedef XKeyEvent XKeyReleasedEvent; - -typedef struct { - int type; /* of event */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* "event" window it is reported relative to */ - Window root; /* root window that the event occurred on */ - Window subwindow; /* child window */ - Time time; /* milliseconds */ - int x, y; /* pointer x, y coordinates in event window */ - int x_root, y_root; /* coordinates relative to root */ - unsigned int state; /* key or button mask */ - unsigned int button; /* detail */ - Bool same_screen; /* same screen flag */ -} XButtonEvent; -typedef XButtonEvent XButtonPressedEvent; -typedef XButtonEvent XButtonReleasedEvent; - -typedef struct { - int type; /* of event */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* "event" window reported relative to */ - Window root; /* root window that the event occurred on */ - Window subwindow; /* child window */ - Time time; /* milliseconds */ - int x, y; /* pointer x, y coordinates in event window */ - int x_root, y_root; /* coordinates relative to root */ - unsigned int state; /* key or button mask */ - char is_hint; /* detail */ - Bool same_screen; /* same screen flag */ -} XMotionEvent; -typedef XMotionEvent XPointerMovedEvent; - -typedef struct { - int type; /* of event */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* "event" window reported relative to */ - Window root; /* root window that the event occurred on */ - Window subwindow; /* child window */ - Time time; /* milliseconds */ - int x, y; /* pointer x, y coordinates in event window */ - int x_root, y_root; /* coordinates relative to root */ - int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */ - int detail; - /* - * NotifyAncestor, NotifyVirtual, NotifyInferior, - * NotifyNonlinear,NotifyNonlinearVirtual - */ - Bool same_screen; /* same screen flag */ - Bool focus; /* boolean focus */ - unsigned int state; /* key or button mask */ -} XCrossingEvent; -typedef XCrossingEvent XEnterWindowEvent; -typedef XCrossingEvent XLeaveWindowEvent; - -typedef struct { - int type; /* FocusIn or FocusOut */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* window of event */ - int mode; /* NotifyNormal, NotifyWhileGrabbed, - NotifyGrab, NotifyUngrab */ - int detail; - /* - * NotifyAncestor, NotifyVirtual, NotifyInferior, - * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer, - * NotifyPointerRoot, NotifyDetailNone - */ -} XFocusChangeEvent; -typedef XFocusChangeEvent XFocusInEvent; -typedef XFocusChangeEvent XFocusOutEvent; - -/* generated on EnterWindow and FocusIn when KeyMapState selected */ -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - char key_vector[32]; -} XKeymapEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - int x, y; - int width, height; - int count; /* if non-zero, at least this many more */ -} XExposeEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Drawable drawable; - int x, y; - int width, height; - int count; /* if non-zero, at least this many more */ - int major_code; /* core is CopyArea or CopyPlane */ - int minor_code; /* not defined in the core */ -} XGraphicsExposeEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Drawable drawable; - int major_code; /* core is CopyArea or CopyPlane */ - int minor_code; /* not defined in the core */ -} XNoExposeEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - int state; /* Visibility state */ -} XVisibilityEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window parent; /* parent of the window */ - Window window; /* window id of window created */ - int x, y; /* window location */ - int width, height; /* size of window */ - int border_width; /* border width */ - Bool override_redirect; /* creation should be overridden */ -} XCreateWindowEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; -} XDestroyWindowEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; - Bool from_configure; -} XUnmapEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; - Bool override_redirect; /* boolean, is override set... */ -} XMapEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window parent; - Window window; -} XMapRequestEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; - Window parent; - int x, y; - Bool override_redirect; -} XReparentEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; - int x, y; - int width, height; - int border_width; - Window above; - Bool override_redirect; -} XConfigureEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; - int x, y; -} XGravityEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - int width, height; -} XResizeRequestEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window parent; - Window window; - int x, y; - int width, height; - int border_width; - Window above; - int detail; /* Above, Below, TopIf, BottomIf, Opposite */ - unsigned long value_mask; -} XConfigureRequestEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; - int place; /* PlaceOnTop, PlaceOnBottom */ -} XCirculateEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window parent; - Window window; - int place; /* PlaceOnTop, PlaceOnBottom */ -} XCirculateRequestEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - Atom atom; - Time time; - int state; /* NewValue, Deleted */ -} XPropertyEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - Atom selection; - Time time; -} XSelectionClearEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window owner; - Window requestor; - Atom selection; - Atom target; - Atom property; - Time time; -} XSelectionRequestEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window requestor; - Atom selection; - Atom target; - Atom property; /* ATOM or None */ - Time time; -} XSelectionEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - Colormap colormap; /* COLORMAP or None */ -#if defined(__cplusplus) || defined(c_plusplus) - Bool c_new; /* C++ */ -#else - Bool new; -#endif - int state; /* ColormapInstalled, ColormapUninstalled */ -} XColormapEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - Atom message_type; - int format; - union { - char b[20]; - short s[10]; - long l[5]; - } data; -} XClientMessageEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* unused */ - int request; /* one of MappingModifier, MappingKeyboard, - MappingPointer */ - int first_keycode; /* first keycode */ - int count; /* defines range of change w. first_keycode*/ -} XMappingEvent; - -typedef struct { - int type; - Display *display; /* Display the event was read from */ - XID resourceid; /* resource id */ - unsigned long serial; /* serial number of failed request */ - unsigned char error_code; /* error code of failed request */ - unsigned char request_code; /* Major op-code of failed request */ - unsigned char minor_code; /* Minor op-code of failed request */ -} XErrorEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display;/* Display the event was read from */ - Window window; /* window on which event was requested in event mask */ -} XAnyEvent; - - -/*************************************************************** - * - * GenericEvent. This event is the standard event for all newer extensions. - */ - -typedef struct - { - int type; /* of event. Always GenericEvent */ - unsigned long serial; /* # of last request processed */ - Bool send_event; /* true if from SendEvent request */ - Display *display; /* Display the event was read from */ - int extension; /* major opcode of extension that caused the event */ - int evtype; /* actual event type. */ - } XGenericEvent; - -typedef struct { - int type; /* of event. Always GenericEvent */ - unsigned long serial; /* # of last request processed */ - Bool send_event; /* true if from SendEvent request */ - Display *display; /* Display the event was read from */ - int extension; /* major opcode of extension that caused the event */ - int evtype; /* actual event type. */ - unsigned int cookie; - void *data; -} XGenericEventCookie; - -/* - * this union is defined so Xlib can always use the same sized - * event structure internally, to avoid memory fragmentation. - */ -typedef union _XEvent { - int type; /* must not be changed; first element */ - XAnyEvent xany; - XKeyEvent xkey; - XButtonEvent xbutton; - XMotionEvent xmotion; - XCrossingEvent xcrossing; - XFocusChangeEvent xfocus; - XExposeEvent xexpose; - XGraphicsExposeEvent xgraphicsexpose; - XNoExposeEvent xnoexpose; - XVisibilityEvent xvisibility; - XCreateWindowEvent xcreatewindow; - XDestroyWindowEvent xdestroywindow; - XUnmapEvent xunmap; - XMapEvent xmap; - XMapRequestEvent xmaprequest; - XReparentEvent xreparent; - XConfigureEvent xconfigure; - XGravityEvent xgravity; - XResizeRequestEvent xresizerequest; - XConfigureRequestEvent xconfigurerequest; - XCirculateEvent xcirculate; - XCirculateRequestEvent xcirculaterequest; - XPropertyEvent xproperty; - XSelectionClearEvent xselectionclear; - XSelectionRequestEvent xselectionrequest; - XSelectionEvent xselection; - XColormapEvent xcolormap; - XClientMessageEvent xclient; - XMappingEvent xmapping; - XErrorEvent xerror; - XKeymapEvent xkeymap; - XGenericEvent xgeneric; - XGenericEventCookie xcookie; - long pad[24]; -} XEvent; -#endif - -#define XAllocID(dpy) ((*((_XPrivDisplay)dpy)->resource_alloc)((dpy))) - -/* - * per character font metric information. - */ -typedef struct { - short lbearing; /* origin to left edge of raster */ - short rbearing; /* origin to right edge of raster */ - short width; /* advance to next char's origin */ - short ascent; /* baseline to top edge of raster */ - short descent; /* baseline to bottom edge of raster */ - unsigned short attributes; /* per char flags (not predefined) */ -} XCharStruct; - -/* - * To allow arbitrary information with fonts, there are additional properties - * returned. - */ -typedef struct { - Atom name; - unsigned long card32; -} XFontProp; - -typedef struct { - XExtData *ext_data; /* hook for extension to hang data */ - Font fid; /* Font id for this font */ - unsigned direction; /* hint about direction the font is painted */ - unsigned min_char_or_byte2;/* first character */ - unsigned max_char_or_byte2;/* last character */ - unsigned min_byte1; /* first row that exists */ - unsigned max_byte1; /* last row that exists */ - Bool all_chars_exist;/* flag if all characters have non-zero size*/ - unsigned default_char; /* char to print for undefined character */ - int n_properties; /* how many properties there are */ - XFontProp *properties; /* pointer to array of additional properties*/ - XCharStruct min_bounds; /* minimum bounds over all existing char*/ - XCharStruct max_bounds; /* maximum bounds over all existing char*/ - XCharStruct *per_char; /* first_char to last_char information */ - int ascent; /* log. extent above baseline for spacing */ - int descent; /* log. descent below baseline for spacing */ -} XFontStruct; - -/* - * PolyText routines take these as arguments. - */ -typedef struct { - char *chars; /* pointer to string */ - int nchars; /* number of characters */ - int delta; /* delta between strings */ - Font font; /* font to print it in, None don't change */ -} XTextItem; - -typedef struct { /* normal 16 bit characters are two bytes */ - unsigned char byte1; - unsigned char byte2; -} XChar2b; - -typedef struct { - XChar2b *chars; /* two byte characters */ - int nchars; /* number of characters */ - int delta; /* delta between strings */ - Font font; /* font to print it in, None don't change */ -} XTextItem16; - - -typedef union { Display *display; - GC gc; - Visual *visual; - Screen *screen; - ScreenFormat *pixmap_format; - XFontStruct *font; } XEDataObject; - -typedef struct { - XRectangle max_ink_extent; - XRectangle max_logical_extent; -} XFontSetExtents; - -/* unused: -typedef void (*XOMProc)(); - */ - -typedef struct _XOM *XOM; -typedef struct _XOC *XOC, *XFontSet; - -typedef struct { - char *chars; - int nchars; - int delta; - XFontSet font_set; -} XmbTextItem; - -typedef struct { - wchar_t *chars; - int nchars; - int delta; - XFontSet font_set; -} XwcTextItem; - -#define XNRequiredCharSet "requiredCharSet" -#define XNQueryOrientation "queryOrientation" -#define XNBaseFontName "baseFontName" -#define XNOMAutomatic "omAutomatic" -#define XNMissingCharSet "missingCharSet" -#define XNDefaultString "defaultString" -#define XNOrientation "orientation" -#define XNDirectionalDependentDrawing "directionalDependentDrawing" -#define XNContextualDrawing "contextualDrawing" -#define XNFontInfo "fontInfo" - -typedef struct { - int charset_count; - char **charset_list; -} XOMCharSetList; - -typedef enum { - XOMOrientation_LTR_TTB, - XOMOrientation_RTL_TTB, - XOMOrientation_TTB_LTR, - XOMOrientation_TTB_RTL, - XOMOrientation_Context -} XOrientation; - -typedef struct { - int num_orientation; - XOrientation *orientation; /* Input Text description */ -} XOMOrientation; - -typedef struct { - int num_font; - XFontStruct **font_struct_list; - char **font_name_list; -} XOMFontInfo; - -typedef struct _XIM *XIM; -typedef struct _XIC *XIC; - -typedef void (*XIMProc)( - XIM, - XPointer, - XPointer -); - -typedef Bool (*XICProc)( - XIC, - XPointer, - XPointer -); - -typedef void (*XIDProc)( - Display*, - XPointer, - XPointer -); - -typedef unsigned long XIMStyle; - -typedef struct { - unsigned short count_styles; - XIMStyle *supported_styles; -} XIMStyles; - -#define XIMPreeditArea 0x0001L -#define XIMPreeditCallbacks 0x0002L -#define XIMPreeditPosition 0x0004L -#define XIMPreeditNothing 0x0008L -#define XIMPreeditNone 0x0010L -#define XIMStatusArea 0x0100L -#define XIMStatusCallbacks 0x0200L -#define XIMStatusNothing 0x0400L -#define XIMStatusNone 0x0800L - -#define XNVaNestedList "XNVaNestedList" -#define XNQueryInputStyle "queryInputStyle" -#define XNClientWindow "clientWindow" -#define XNInputStyle "inputStyle" -#define XNFocusWindow "focusWindow" -#define XNResourceName "resourceName" -#define XNResourceClass "resourceClass" -#define XNGeometryCallback "geometryCallback" -#define XNDestroyCallback "destroyCallback" -#define XNFilterEvents "filterEvents" -#define XNPreeditStartCallback "preeditStartCallback" -#define XNPreeditDoneCallback "preeditDoneCallback" -#define XNPreeditDrawCallback "preeditDrawCallback" -#define XNPreeditCaretCallback "preeditCaretCallback" -#define XNPreeditStateNotifyCallback "preeditStateNotifyCallback" -#define XNPreeditAttributes "preeditAttributes" -#define XNStatusStartCallback "statusStartCallback" -#define XNStatusDoneCallback "statusDoneCallback" -#define XNStatusDrawCallback "statusDrawCallback" -#define XNStatusAttributes "statusAttributes" -#define XNArea "area" -#define XNAreaNeeded "areaNeeded" -#define XNSpotLocation "spotLocation" -#define XNColormap "colorMap" -#define XNStdColormap "stdColorMap" -#define XNForeground "foreground" -#define XNBackground "background" -#define XNBackgroundPixmap "backgroundPixmap" -#define XNFontSet "fontSet" -#define XNLineSpace "lineSpace" -#define XNCursor "cursor" - -#define XNQueryIMValuesList "queryIMValuesList" -#define XNQueryICValuesList "queryICValuesList" -#define XNVisiblePosition "visiblePosition" -#define XNR6PreeditCallback "r6PreeditCallback" -#define XNStringConversionCallback "stringConversionCallback" -#define XNStringConversion "stringConversion" -#define XNResetState "resetState" -#define XNHotKey "hotKey" -#define XNHotKeyState "hotKeyState" -#define XNPreeditState "preeditState" -#define XNSeparatorofNestedList "separatorofNestedList" - -#define XBufferOverflow -1 -#define XLookupNone 1 -#define XLookupChars 2 -#define XLookupKeySym 3 -#define XLookupBoth 4 - -typedef void *XVaNestedList; - -typedef struct { - XPointer client_data; - XIMProc callback; -} XIMCallback; - -typedef struct { - XPointer client_data; - XICProc callback; -} XICCallback; - -typedef unsigned long XIMFeedback; - -#define XIMReverse 1L -#define XIMUnderline (1L<<1) -#define XIMHighlight (1L<<2) -#define XIMPrimary (1L<<5) -#define XIMSecondary (1L<<6) -#define XIMTertiary (1L<<7) -#define XIMVisibleToForward (1L<<8) -#define XIMVisibleToBackword (1L<<9) -#define XIMVisibleToCenter (1L<<10) - -typedef struct _XIMText { - unsigned short length; - XIMFeedback *feedback; - Bool encoding_is_wchar; - union { - char *multi_byte; - wchar_t *wide_char; - } string; -} XIMText; - -typedef unsigned long XIMPreeditState; - -#define XIMPreeditUnKnown 0L -#define XIMPreeditEnable 1L -#define XIMPreeditDisable (1L<<1) - -typedef struct _XIMPreeditStateNotifyCallbackStruct { - XIMPreeditState state; -} XIMPreeditStateNotifyCallbackStruct; - -typedef unsigned long XIMResetState; - -#define XIMInitialState 1L -#define XIMPreserveState (1L<<1) - -typedef unsigned long XIMStringConversionFeedback; - -#define XIMStringConversionLeftEdge (0x00000001) -#define XIMStringConversionRightEdge (0x00000002) -#define XIMStringConversionTopEdge (0x00000004) -#define XIMStringConversionBottomEdge (0x00000008) -#define XIMStringConversionConcealed (0x00000010) -#define XIMStringConversionWrapped (0x00000020) - -typedef struct _XIMStringConversionText { - unsigned short length; - XIMStringConversionFeedback *feedback; - Bool encoding_is_wchar; - union { - char *mbs; - wchar_t *wcs; - } string; -} XIMStringConversionText; - -typedef unsigned short XIMStringConversionPosition; - -typedef unsigned short XIMStringConversionType; - -#define XIMStringConversionBuffer (0x0001) -#define XIMStringConversionLine (0x0002) -#define XIMStringConversionWord (0x0003) -#define XIMStringConversionChar (0x0004) - -typedef unsigned short XIMStringConversionOperation; - -#define XIMStringConversionSubstitution (0x0001) -#define XIMStringConversionRetrieval (0x0002) - -typedef enum { - XIMForwardChar, XIMBackwardChar, - XIMForwardWord, XIMBackwardWord, - XIMCaretUp, XIMCaretDown, - XIMNextLine, XIMPreviousLine, - XIMLineStart, XIMLineEnd, - XIMAbsolutePosition, - XIMDontChange -} XIMCaretDirection; - -typedef struct _XIMStringConversionCallbackStruct { - XIMStringConversionPosition position; - XIMCaretDirection direction; - XIMStringConversionOperation operation; - unsigned short factor; - XIMStringConversionText *text; -} XIMStringConversionCallbackStruct; - -typedef struct _XIMPreeditDrawCallbackStruct { - int caret; /* Cursor offset within pre-edit string */ - int chg_first; /* Starting change position */ - int chg_length; /* Length of the change in character count */ - XIMText *text; -} XIMPreeditDrawCallbackStruct; - -typedef enum { - XIMIsInvisible, /* Disable caret feedback */ - XIMIsPrimary, /* UI defined caret feedback */ - XIMIsSecondary /* UI defined caret feedback */ -} XIMCaretStyle; - -typedef struct _XIMPreeditCaretCallbackStruct { - int position; /* Caret offset within pre-edit string */ - XIMCaretDirection direction; /* Caret moves direction */ - XIMCaretStyle style; /* Feedback of the caret */ -} XIMPreeditCaretCallbackStruct; - -typedef enum { - XIMTextType, - XIMBitmapType -} XIMStatusDataType; - -typedef struct _XIMStatusDrawCallbackStruct { - XIMStatusDataType type; - union { - XIMText *text; - Pixmap bitmap; - } data; -} XIMStatusDrawCallbackStruct; - -typedef struct _XIMHotKeyTrigger { - KeySym keysym; - int modifier; - int modifier_mask; -} XIMHotKeyTrigger; - -typedef struct _XIMHotKeyTriggers { - int num_hot_key; - XIMHotKeyTrigger *key; -} XIMHotKeyTriggers; - -typedef unsigned long XIMHotKeyState; - -#define XIMHotKeyStateON (0x0001L) -#define XIMHotKeyStateOFF (0x0002L) - -typedef struct { - unsigned short count_values; - char **supported_values; -} XIMValuesList; - -_XFUNCPROTOBEGIN - -#if defined(WIN32) && !defined(_XLIBINT_) -#define _Xdebug (*_Xdebug_p) -#endif - -extern int _Xdebug; - -extern XFontStruct *XLoadQueryFont( - Display* /* display */, - _Xconst char* /* name */ -); - -extern XFontStruct *XQueryFont( - Display* /* display */, - XID /* font_ID */ -); - - -extern XTimeCoord *XGetMotionEvents( - Display* /* display */, - Window /* w */, - Time /* start */, - Time /* stop */, - int* /* nevents_return */ -); - -extern XModifierKeymap *XDeleteModifiermapEntry( - XModifierKeymap* /* modmap */, -#if NeedWidePrototypes - unsigned int /* keycode_entry */, -#else - KeyCode /* keycode_entry */, -#endif - int /* modifier */ -); - -extern XModifierKeymap *XGetModifierMapping( - Display* /* display */ -); - -extern XModifierKeymap *XInsertModifiermapEntry( - XModifierKeymap* /* modmap */, -#if NeedWidePrototypes - unsigned int /* keycode_entry */, -#else - KeyCode /* keycode_entry */, -#endif - int /* modifier */ -); - -extern XModifierKeymap *XNewModifiermap( - int /* max_keys_per_mod */ -); - -extern XImage *XCreateImage( - Display* /* display */, - Visual* /* visual */, - unsigned int /* depth */, - int /* format */, - int /* offset */, - char* /* data */, - unsigned int /* width */, - unsigned int /* height */, - int /* bitmap_pad */, - int /* bytes_per_line */ -); -extern Status XInitImage( - XImage* /* image */ -); -extern XImage *XGetImage( - Display* /* display */, - Drawable /* d */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - unsigned long /* plane_mask */, - int /* format */ -); -extern XImage *XGetSubImage( - Display* /* display */, - Drawable /* d */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - unsigned long /* plane_mask */, - int /* format */, - XImage* /* dest_image */, - int /* dest_x */, - int /* dest_y */ -); - -/* - * X function declarations. - */ -extern Display *XOpenDisplay( - _Xconst char* /* display_name */ -); - -extern void XrmInitialize( - void -); - -extern char *XFetchBytes( - Display* /* display */, - int* /* nbytes_return */ -); -extern char *XFetchBuffer( - Display* /* display */, - int* /* nbytes_return */, - int /* buffer */ -); -extern char *XGetAtomName( - Display* /* display */, - Atom /* atom */ -); -extern Status XGetAtomNames( - Display* /* dpy */, - Atom* /* atoms */, - int /* count */, - char** /* names_return */ -); -extern char *XGetDefault( - Display* /* display */, - _Xconst char* /* program */, - _Xconst char* /* option */ -); -extern char *XDisplayName( - _Xconst char* /* string */ -); -extern char *XKeysymToString( - KeySym /* keysym */ -); - -extern int (*XSynchronize( - Display* /* display */, - Bool /* onoff */ -))( - Display* /* display */ -); -extern int (*XSetAfterFunction( - Display* /* display */, - int (*) ( - Display* /* display */ - ) /* procedure */ -))( - Display* /* display */ -); -extern Atom XInternAtom( - Display* /* display */, - _Xconst char* /* atom_name */, - Bool /* only_if_exists */ -); -extern Status XInternAtoms( - Display* /* dpy */, - char** /* names */, - int /* count */, - Bool /* onlyIfExists */, - Atom* /* atoms_return */ -); -extern Colormap XCopyColormapAndFree( - Display* /* display */, - Colormap /* colormap */ -); -extern Colormap XCreateColormap( - Display* /* display */, - Window /* w */, - Visual* /* visual */, - int /* alloc */ -); -extern Cursor XCreatePixmapCursor( - Display* /* display */, - Pixmap /* source */, - Pixmap /* mask */, - XColor* /* foreground_color */, - XColor* /* background_color */, - unsigned int /* x */, - unsigned int /* y */ -); -extern Cursor XCreateGlyphCursor( - Display* /* display */, - Font /* source_font */, - Font /* mask_font */, - unsigned int /* source_char */, - unsigned int /* mask_char */, - XColor _Xconst * /* foreground_color */, - XColor _Xconst * /* background_color */ -); -extern Cursor XCreateFontCursor( - Display* /* display */, - unsigned int /* shape */ -); -extern Font XLoadFont( - Display* /* display */, - _Xconst char* /* name */ -); -extern GC XCreateGC( - Display* /* display */, - Drawable /* d */, - unsigned long /* valuemask */, - XGCValues* /* values */ -); -extern GContext XGContextFromGC( - GC /* gc */ -); -extern void XFlushGC( - Display* /* display */, - GC /* gc */ -); -extern Pixmap XCreatePixmap( - Display* /* display */, - Drawable /* d */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int /* depth */ -); -extern Pixmap XCreateBitmapFromData( - Display* /* display */, - Drawable /* d */, - _Xconst char* /* data */, - unsigned int /* width */, - unsigned int /* height */ -); -extern Pixmap XCreatePixmapFromBitmapData( - Display* /* display */, - Drawable /* d */, - char* /* data */, - unsigned int /* width */, - unsigned int /* height */, - unsigned long /* fg */, - unsigned long /* bg */, - unsigned int /* depth */ -); -extern Window XCreateSimpleWindow( - Display* /* display */, - Window /* parent */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int /* border_width */, - unsigned long /* border */, - unsigned long /* background */ -); -extern Window XGetSelectionOwner( - Display* /* display */, - Atom /* selection */ -); -extern Window XCreateWindow( - Display* /* display */, - Window /* parent */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int /* border_width */, - int /* depth */, - unsigned int /* class */, - Visual* /* visual */, - unsigned long /* valuemask */, - XSetWindowAttributes* /* attributes */ -); -extern Colormap *XListInstalledColormaps( - Display* /* display */, - Window /* w */, - int* /* num_return */ -); -extern char **XListFonts( - Display* /* display */, - _Xconst char* /* pattern */, - int /* maxnames */, - int* /* actual_count_return */ -); -extern char **XListFontsWithInfo( - Display* /* display */, - _Xconst char* /* pattern */, - int /* maxnames */, - int* /* count_return */, - XFontStruct** /* info_return */ -); -extern char **XGetFontPath( - Display* /* display */, - int* /* npaths_return */ -); -extern char **XListExtensions( - Display* /* display */, - int* /* nextensions_return */ -); -extern Atom *XListProperties( - Display* /* display */, - Window /* w */, - int* /* num_prop_return */ -); -extern XHostAddress *XListHosts( - Display* /* display */, - int* /* nhosts_return */, - Bool* /* state_return */ -); -_X_DEPRECATED -extern KeySym XKeycodeToKeysym( - Display* /* display */, -#if NeedWidePrototypes - unsigned int /* keycode */, -#else - KeyCode /* keycode */, -#endif - int /* index */ -); -extern KeySym XLookupKeysym( - XKeyEvent* /* key_event */, - int /* index */ -); -extern KeySym *XGetKeyboardMapping( - Display* /* display */, -#if NeedWidePrototypes - unsigned int /* first_keycode */, -#else - KeyCode /* first_keycode */, -#endif - int /* keycode_count */, - int* /* keysyms_per_keycode_return */ -); -extern KeySym XStringToKeysym( - _Xconst char* /* string */ -); -extern long XMaxRequestSize( - Display* /* display */ -); -extern long XExtendedMaxRequestSize( - Display* /* display */ -); -extern char *XResourceManagerString( - Display* /* display */ -); -extern char *XScreenResourceString( - Screen* /* screen */ -); -extern unsigned long XDisplayMotionBufferSize( - Display* /* display */ -); -extern VisualID XVisualIDFromVisual( - Visual* /* visual */ -); - -/* multithread routines */ - -extern Status XInitThreads( - void -); - -extern void XLockDisplay( - Display* /* display */ -); - -extern void XUnlockDisplay( - Display* /* display */ -); - -/* routines for dealing with extensions */ - -extern XExtCodes *XInitExtension( - Display* /* display */, - _Xconst char* /* name */ -); - -extern XExtCodes *XAddExtension( - Display* /* display */ -); -extern XExtData *XFindOnExtensionList( - XExtData** /* structure */, - int /* number */ -); -extern XExtData **XEHeadOfExtensionList( - XEDataObject /* object */ -); - -/* these are routines for which there are also macros */ -extern Window XRootWindow( - Display* /* display */, - int /* screen_number */ -); -extern Window XDefaultRootWindow( - Display* /* display */ -); -extern Window XRootWindowOfScreen( - Screen* /* screen */ -); -extern Visual *XDefaultVisual( - Display* /* display */, - int /* screen_number */ -); -extern Visual *XDefaultVisualOfScreen( - Screen* /* screen */ -); -extern GC XDefaultGC( - Display* /* display */, - int /* screen_number */ -); -extern GC XDefaultGCOfScreen( - Screen* /* screen */ -); -extern unsigned long XBlackPixel( - Display* /* display */, - int /* screen_number */ -); -extern unsigned long XWhitePixel( - Display* /* display */, - int /* screen_number */ -); -extern unsigned long XAllPlanes( - void -); -extern unsigned long XBlackPixelOfScreen( - Screen* /* screen */ -); -extern unsigned long XWhitePixelOfScreen( - Screen* /* screen */ -); -extern unsigned long XNextRequest( - Display* /* display */ -); -extern unsigned long XLastKnownRequestProcessed( - Display* /* display */ -); -extern char *XServerVendor( - Display* /* display */ -); -extern char *XDisplayString( - Display* /* display */ -); -extern Colormap XDefaultColormap( - Display* /* display */, - int /* screen_number */ -); -extern Colormap XDefaultColormapOfScreen( - Screen* /* screen */ -); -extern Display *XDisplayOfScreen( - Screen* /* screen */ -); -extern Screen *XScreenOfDisplay( - Display* /* display */, - int /* screen_number */ -); -extern Screen *XDefaultScreenOfDisplay( - Display* /* display */ -); -extern long XEventMaskOfScreen( - Screen* /* screen */ -); - -extern int XScreenNumberOfScreen( - Screen* /* screen */ -); - -typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */ - Display* /* display */, - XErrorEvent* /* error_event */ -); - -extern XErrorHandler XSetErrorHandler ( - XErrorHandler /* handler */ -); - - -typedef int (*XIOErrorHandler) ( /* WARNING, this type not in Xlib spec */ - Display* /* display */ -); - -extern XIOErrorHandler XSetIOErrorHandler ( - XIOErrorHandler /* handler */ -); - - -extern XPixmapFormatValues *XListPixmapFormats( - Display* /* display */, - int* /* count_return */ -); -extern int *XListDepths( - Display* /* display */, - int /* screen_number */, - int* /* count_return */ -); - -/* ICCCM routines for things that don't require special include files; */ -/* other declarations are given in Xutil.h */ -extern Status XReconfigureWMWindow( - Display* /* display */, - Window /* w */, - int /* screen_number */, - unsigned int /* mask */, - XWindowChanges* /* changes */ -); - -extern Status XGetWMProtocols( - Display* /* display */, - Window /* w */, - Atom** /* protocols_return */, - int* /* count_return */ -); -extern Status XSetWMProtocols( - Display* /* display */, - Window /* w */, - Atom* /* protocols */, - int /* count */ -); -extern Status XIconifyWindow( - Display* /* display */, - Window /* w */, - int /* screen_number */ -); -extern Status XWithdrawWindow( - Display* /* display */, - Window /* w */, - int /* screen_number */ -); -extern Status XGetCommand( - Display* /* display */, - Window /* w */, - char*** /* argv_return */, - int* /* argc_return */ -); -extern Status XGetWMColormapWindows( - Display* /* display */, - Window /* w */, - Window** /* windows_return */, - int* /* count_return */ -); -extern Status XSetWMColormapWindows( - Display* /* display */, - Window /* w */, - Window* /* colormap_windows */, - int /* count */ -); -extern void XFreeStringList( - char** /* list */ -); -extern int XSetTransientForHint( - Display* /* display */, - Window /* w */, - Window /* prop_window */ -); - -/* The following are given in alphabetical order */ - -extern int XActivateScreenSaver( - Display* /* display */ -); - -extern int XAddHost( - Display* /* display */, - XHostAddress* /* host */ -); - -extern int XAddHosts( - Display* /* display */, - XHostAddress* /* hosts */, - int /* num_hosts */ -); - -extern int XAddToExtensionList( - struct _XExtData** /* structure */, - XExtData* /* ext_data */ -); - -extern int XAddToSaveSet( - Display* /* display */, - Window /* w */ -); - -extern Status XAllocColor( - Display* /* display */, - Colormap /* colormap */, - XColor* /* screen_in_out */ -); - -extern Status XAllocColorCells( - Display* /* display */, - Colormap /* colormap */, - Bool /* contig */, - unsigned long* /* plane_masks_return */, - unsigned int /* nplanes */, - unsigned long* /* pixels_return */, - unsigned int /* npixels */ -); - -extern Status XAllocColorPlanes( - Display* /* display */, - Colormap /* colormap */, - Bool /* contig */, - unsigned long* /* pixels_return */, - int /* ncolors */, - int /* nreds */, - int /* ngreens */, - int /* nblues */, - unsigned long* /* rmask_return */, - unsigned long* /* gmask_return */, - unsigned long* /* bmask_return */ -); - -extern Status XAllocNamedColor( - Display* /* display */, - Colormap /* colormap */, - _Xconst char* /* color_name */, - XColor* /* screen_def_return */, - XColor* /* exact_def_return */ -); - -extern int XAllowEvents( - Display* /* display */, - int /* event_mode */, - Time /* time */ -); - -extern int XAutoRepeatOff( - Display* /* display */ -); - -extern int XAutoRepeatOn( - Display* /* display */ -); - -extern int XBell( - Display* /* display */, - int /* percent */ -); - -extern int XBitmapBitOrder( - Display* /* display */ -); - -extern int XBitmapPad( - Display* /* display */ -); - -extern int XBitmapUnit( - Display* /* display */ -); - -extern int XCellsOfScreen( - Screen* /* screen */ -); - -extern int XChangeActivePointerGrab( - Display* /* display */, - unsigned int /* event_mask */, - Cursor /* cursor */, - Time /* time */ -); - -extern int XChangeGC( - Display* /* display */, - GC /* gc */, - unsigned long /* valuemask */, - XGCValues* /* values */ -); - -extern int XChangeKeyboardControl( - Display* /* display */, - unsigned long /* value_mask */, - XKeyboardControl* /* values */ -); - -extern int XChangeKeyboardMapping( - Display* /* display */, - int /* first_keycode */, - int /* keysyms_per_keycode */, - KeySym* /* keysyms */, - int /* num_codes */ -); - -extern int XChangePointerControl( - Display* /* display */, - Bool /* do_accel */, - Bool /* do_threshold */, - int /* accel_numerator */, - int /* accel_denominator */, - int /* threshold */ -); - -extern int XChangeProperty( - Display* /* display */, - Window /* w */, - Atom /* property */, - Atom /* type */, - int /* format */, - int /* mode */, - _Xconst unsigned char* /* data */, - int /* nelements */ -); - -extern int XChangeSaveSet( - Display* /* display */, - Window /* w */, - int /* change_mode */ -); - -extern int XChangeWindowAttributes( - Display* /* display */, - Window /* w */, - unsigned long /* valuemask */, - XSetWindowAttributes* /* attributes */ -); - -extern Bool XCheckIfEvent( - Display* /* display */, - XEvent* /* event_return */, - Bool (*) ( - Display* /* display */, - XEvent* /* event */, - XPointer /* arg */ - ) /* predicate */, - XPointer /* arg */ -); - -extern Bool XCheckMaskEvent( - Display* /* display */, - long /* event_mask */, - XEvent* /* event_return */ -); - -extern Bool XCheckTypedEvent( - Display* /* display */, - int /* event_type */, - XEvent* /* event_return */ -); - -extern Bool XCheckTypedWindowEvent( - Display* /* display */, - Window /* w */, - int /* event_type */, - XEvent* /* event_return */ -); - -extern Bool XCheckWindowEvent( - Display* /* display */, - Window /* w */, - long /* event_mask */, - XEvent* /* event_return */ -); - -extern int XCirculateSubwindows( - Display* /* display */, - Window /* w */, - int /* direction */ -); - -extern int XCirculateSubwindowsDown( - Display* /* display */, - Window /* w */ -); - -extern int XCirculateSubwindowsUp( - Display* /* display */, - Window /* w */ -); - -extern int XClearArea( - Display* /* display */, - Window /* w */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - Bool /* exposures */ -); - -extern int XClearWindow( - Display* /* display */, - Window /* w */ -); - -extern int XCloseDisplay( - Display* /* display */ -); - -extern int XConfigureWindow( - Display* /* display */, - Window /* w */, - unsigned int /* value_mask */, - XWindowChanges* /* values */ -); - -extern int XConnectionNumber( - Display* /* display */ -); - -extern int XConvertSelection( - Display* /* display */, - Atom /* selection */, - Atom /* target */, - Atom /* property */, - Window /* requestor */, - Time /* time */ -); - -extern int XCopyArea( - Display* /* display */, - Drawable /* src */, - Drawable /* dest */, - GC /* gc */, - int /* src_x */, - int /* src_y */, - unsigned int /* width */, - unsigned int /* height */, - int /* dest_x */, - int /* dest_y */ -); - -extern int XCopyGC( - Display* /* display */, - GC /* src */, - unsigned long /* valuemask */, - GC /* dest */ -); - -extern int XCopyPlane( - Display* /* display */, - Drawable /* src */, - Drawable /* dest */, - GC /* gc */, - int /* src_x */, - int /* src_y */, - unsigned int /* width */, - unsigned int /* height */, - int /* dest_x */, - int /* dest_y */, - unsigned long /* plane */ -); - -extern int XDefaultDepth( - Display* /* display */, - int /* screen_number */ -); - -extern int XDefaultDepthOfScreen( - Screen* /* screen */ -); - -extern int XDefaultScreen( - Display* /* display */ -); - -extern int XDefineCursor( - Display* /* display */, - Window /* w */, - Cursor /* cursor */ -); - -extern int XDeleteProperty( - Display* /* display */, - Window /* w */, - Atom /* property */ -); - -extern int XDestroyWindow( - Display* /* display */, - Window /* w */ -); - -extern int XDestroySubwindows( - Display* /* display */, - Window /* w */ -); - -extern int XDoesBackingStore( - Screen* /* screen */ -); - -extern Bool XDoesSaveUnders( - Screen* /* screen */ -); - -extern int XDisableAccessControl( - Display* /* display */ -); - - -extern int XDisplayCells( - Display* /* display */, - int /* screen_number */ -); - -extern int XDisplayHeight( - Display* /* display */, - int /* screen_number */ -); - -extern int XDisplayHeightMM( - Display* /* display */, - int /* screen_number */ -); - -extern int XDisplayKeycodes( - Display* /* display */, - int* /* min_keycodes_return */, - int* /* max_keycodes_return */ -); - -extern int XDisplayPlanes( - Display* /* display */, - int /* screen_number */ -); - -extern int XDisplayWidth( - Display* /* display */, - int /* screen_number */ -); - -extern int XDisplayWidthMM( - Display* /* display */, - int /* screen_number */ -); - -extern int XDrawArc( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - int /* angle1 */, - int /* angle2 */ -); - -extern int XDrawArcs( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XArc* /* arcs */, - int /* narcs */ -); - -extern int XDrawImageString( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* string */, - int /* length */ -); - -extern int XDrawImageString16( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst XChar2b* /* string */, - int /* length */ -); - -extern int XDrawLine( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x1 */, - int /* y1 */, - int /* x2 */, - int /* y2 */ -); - -extern int XDrawLines( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XPoint* /* points */, - int /* npoints */, - int /* mode */ -); - -extern int XDrawPoint( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */ -); - -extern int XDrawPoints( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XPoint* /* points */, - int /* npoints */, - int /* mode */ -); - -extern int XDrawRectangle( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */ -); - -extern int XDrawRectangles( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XRectangle* /* rectangles */, - int /* nrectangles */ -); - -extern int XDrawSegments( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XSegment* /* segments */, - int /* nsegments */ -); - -extern int XDrawString( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* string */, - int /* length */ -); - -extern int XDrawString16( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst XChar2b* /* string */, - int /* length */ -); - -extern int XDrawText( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - XTextItem* /* items */, - int /* nitems */ -); - -extern int XDrawText16( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - XTextItem16* /* items */, - int /* nitems */ -); - -extern int XEnableAccessControl( - Display* /* display */ -); - -extern int XEventsQueued( - Display* /* display */, - int /* mode */ -); - -extern Status XFetchName( - Display* /* display */, - Window /* w */, - char** /* window_name_return */ -); - -extern int XFillArc( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - int /* angle1 */, - int /* angle2 */ -); - -extern int XFillArcs( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XArc* /* arcs */, - int /* narcs */ -); - -extern int XFillPolygon( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XPoint* /* points */, - int /* npoints */, - int /* shape */, - int /* mode */ -); - -extern int XFillRectangle( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */ -); - -extern int XFillRectangles( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XRectangle* /* rectangles */, - int /* nrectangles */ -); - -extern int XFlush( - Display* /* display */ -); - -extern int XForceScreenSaver( - Display* /* display */, - int /* mode */ -); - -extern int XFree( - void* /* data */ -); - -extern int XFreeColormap( - Display* /* display */, - Colormap /* colormap */ -); - -extern int XFreeColors( - Display* /* display */, - Colormap /* colormap */, - unsigned long* /* pixels */, - int /* npixels */, - unsigned long /* planes */ -); - -extern int XFreeCursor( - Display* /* display */, - Cursor /* cursor */ -); - -extern int XFreeExtensionList( - char** /* list */ -); - -extern int XFreeFont( - Display* /* display */, - XFontStruct* /* font_struct */ -); - -extern int XFreeFontInfo( - char** /* names */, - XFontStruct* /* free_info */, - int /* actual_count */ -); - -extern int XFreeFontNames( - char** /* list */ -); - -extern int XFreeFontPath( - char** /* list */ -); - -extern int XFreeGC( - Display* /* display */, - GC /* gc */ -); - -extern int XFreeModifiermap( - XModifierKeymap* /* modmap */ -); - -extern int XFreePixmap( - Display* /* display */, - Pixmap /* pixmap */ -); - -extern int XGeometry( - Display* /* display */, - int /* screen */, - _Xconst char* /* position */, - _Xconst char* /* default_position */, - unsigned int /* bwidth */, - unsigned int /* fwidth */, - unsigned int /* fheight */, - int /* xadder */, - int /* yadder */, - int* /* x_return */, - int* /* y_return */, - int* /* width_return */, - int* /* height_return */ -); - -extern int XGetErrorDatabaseText( - Display* /* display */, - _Xconst char* /* name */, - _Xconst char* /* message */, - _Xconst char* /* default_string */, - char* /* buffer_return */, - int /* length */ -); - -extern int XGetErrorText( - Display* /* display */, - int /* code */, - char* /* buffer_return */, - int /* length */ -); - -extern Bool XGetFontProperty( - XFontStruct* /* font_struct */, - Atom /* atom */, - unsigned long* /* value_return */ -); - -extern Status XGetGCValues( - Display* /* display */, - GC /* gc */, - unsigned long /* valuemask */, - XGCValues* /* values_return */ -); - -extern Status XGetGeometry( - Display* /* display */, - Drawable /* d */, - Window* /* root_return */, - int* /* x_return */, - int* /* y_return */, - unsigned int* /* width_return */, - unsigned int* /* height_return */, - unsigned int* /* border_width_return */, - unsigned int* /* depth_return */ -); - -extern Status XGetIconName( - Display* /* display */, - Window /* w */, - char** /* icon_name_return */ -); - -extern int XGetInputFocus( - Display* /* display */, - Window* /* focus_return */, - int* /* revert_to_return */ -); - -extern int XGetKeyboardControl( - Display* /* display */, - XKeyboardState* /* values_return */ -); - -extern int XGetPointerControl( - Display* /* display */, - int* /* accel_numerator_return */, - int* /* accel_denominator_return */, - int* /* threshold_return */ -); - -extern int XGetPointerMapping( - Display* /* display */, - unsigned char* /* map_return */, - int /* nmap */ -); - -extern int XGetScreenSaver( - Display* /* display */, - int* /* timeout_return */, - int* /* interval_return */, - int* /* prefer_blanking_return */, - int* /* allow_exposures_return */ -); - -extern Status XGetTransientForHint( - Display* /* display */, - Window /* w */, - Window* /* prop_window_return */ -); - -extern int XGetWindowProperty( - Display* /* display */, - Window /* w */, - Atom /* property */, - long /* long_offset */, - long /* long_length */, - Bool /* delete */, - Atom /* req_type */, - Atom* /* actual_type_return */, - int* /* actual_format_return */, - unsigned long* /* nitems_return */, - unsigned long* /* bytes_after_return */, - unsigned char** /* prop_return */ -); - -extern Status XGetWindowAttributes( - Display* /* display */, - Window /* w */, - XWindowAttributes* /* window_attributes_return */ -); - -extern int XGrabButton( - Display* /* display */, - unsigned int /* button */, - unsigned int /* modifiers */, - Window /* grab_window */, - Bool /* owner_events */, - unsigned int /* event_mask */, - int /* pointer_mode */, - int /* keyboard_mode */, - Window /* confine_to */, - Cursor /* cursor */ -); - -extern int XGrabKey( - Display* /* display */, - int /* keycode */, - unsigned int /* modifiers */, - Window /* grab_window */, - Bool /* owner_events */, - int /* pointer_mode */, - int /* keyboard_mode */ -); - -extern int XGrabKeyboard( - Display* /* display */, - Window /* grab_window */, - Bool /* owner_events */, - int /* pointer_mode */, - int /* keyboard_mode */, - Time /* time */ -); - -extern int XGrabPointer( - Display* /* display */, - Window /* grab_window */, - Bool /* owner_events */, - unsigned int /* event_mask */, - int /* pointer_mode */, - int /* keyboard_mode */, - Window /* confine_to */, - Cursor /* cursor */, - Time /* time */ -); - -extern int XGrabServer( - Display* /* display */ -); - -extern int XHeightMMOfScreen( - Screen* /* screen */ -); - -extern int XHeightOfScreen( - Screen* /* screen */ -); - -extern int XIfEvent( - Display* /* display */, - XEvent* /* event_return */, - Bool (*) ( - Display* /* display */, - XEvent* /* event */, - XPointer /* arg */ - ) /* predicate */, - XPointer /* arg */ -); - -extern int XImageByteOrder( - Display* /* display */ -); - -extern int XInstallColormap( - Display* /* display */, - Colormap /* colormap */ -); - -extern KeyCode XKeysymToKeycode( - Display* /* display */, - KeySym /* keysym */ -); - -extern int XKillClient( - Display* /* display */, - XID /* resource */ -); - -extern Status XLookupColor( - Display* /* display */, - Colormap /* colormap */, - _Xconst char* /* color_name */, - XColor* /* exact_def_return */, - XColor* /* screen_def_return */ -); - -extern int XLowerWindow( - Display* /* display */, - Window /* w */ -); - -extern int XMapRaised( - Display* /* display */, - Window /* w */ -); - -extern int XMapSubwindows( - Display* /* display */, - Window /* w */ -); - -extern int XMapWindow( - Display* /* display */, - Window /* w */ -); - -extern int XMaskEvent( - Display* /* display */, - long /* event_mask */, - XEvent* /* event_return */ -); - -extern int XMaxCmapsOfScreen( - Screen* /* screen */ -); - -extern int XMinCmapsOfScreen( - Screen* /* screen */ -); - -extern int XMoveResizeWindow( - Display* /* display */, - Window /* w */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */ -); - -extern int XMoveWindow( - Display* /* display */, - Window /* w */, - int /* x */, - int /* y */ -); - -extern int XNextEvent( - Display* /* display */, - XEvent* /* event_return */ -); - -extern int XNoOp( - Display* /* display */ -); - -extern Status XParseColor( - Display* /* display */, - Colormap /* colormap */, - _Xconst char* /* spec */, - XColor* /* exact_def_return */ -); - -extern int XParseGeometry( - _Xconst char* /* parsestring */, - int* /* x_return */, - int* /* y_return */, - unsigned int* /* width_return */, - unsigned int* /* height_return */ -); - -extern int XPeekEvent( - Display* /* display */, - XEvent* /* event_return */ -); - -extern int XPeekIfEvent( - Display* /* display */, - XEvent* /* event_return */, - Bool (*) ( - Display* /* display */, - XEvent* /* event */, - XPointer /* arg */ - ) /* predicate */, - XPointer /* arg */ -); - -extern int XPending( - Display* /* display */ -); - -extern int XPlanesOfScreen( - Screen* /* screen */ -); - -extern int XProtocolRevision( - Display* /* display */ -); - -extern int XProtocolVersion( - Display* /* display */ -); - - -extern int XPutBackEvent( - Display* /* display */, - XEvent* /* event */ -); - -extern int XPutImage( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XImage* /* image */, - int /* src_x */, - int /* src_y */, - int /* dest_x */, - int /* dest_y */, - unsigned int /* width */, - unsigned int /* height */ -); - -extern int XQLength( - Display* /* display */ -); - -extern Status XQueryBestCursor( - Display* /* display */, - Drawable /* d */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int* /* width_return */, - unsigned int* /* height_return */ -); - -extern Status XQueryBestSize( - Display* /* display */, - int /* class */, - Drawable /* which_screen */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int* /* width_return */, - unsigned int* /* height_return */ -); - -extern Status XQueryBestStipple( - Display* /* display */, - Drawable /* which_screen */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int* /* width_return */, - unsigned int* /* height_return */ -); - -extern Status XQueryBestTile( - Display* /* display */, - Drawable /* which_screen */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int* /* width_return */, - unsigned int* /* height_return */ -); - -extern int XQueryColor( - Display* /* display */, - Colormap /* colormap */, - XColor* /* def_in_out */ -); - -extern int XQueryColors( - Display* /* display */, - Colormap /* colormap */, - XColor* /* defs_in_out */, - int /* ncolors */ -); - -extern Bool XQueryExtension( - Display* /* display */, - _Xconst char* /* name */, - int* /* major_opcode_return */, - int* /* first_event_return */, - int* /* first_error_return */ -); - -extern int XQueryKeymap( - Display* /* display */, - char [32] /* keys_return */ -); - -extern Bool XQueryPointer( - Display* /* display */, - Window /* w */, - Window* /* root_return */, - Window* /* child_return */, - int* /* root_x_return */, - int* /* root_y_return */, - int* /* win_x_return */, - int* /* win_y_return */, - unsigned int* /* mask_return */ -); - -extern int XQueryTextExtents( - Display* /* display */, - XID /* font_ID */, - _Xconst char* /* string */, - int /* nchars */, - int* /* direction_return */, - int* /* font_ascent_return */, - int* /* font_descent_return */, - XCharStruct* /* overall_return */ -); - -extern int XQueryTextExtents16( - Display* /* display */, - XID /* font_ID */, - _Xconst XChar2b* /* string */, - int /* nchars */, - int* /* direction_return */, - int* /* font_ascent_return */, - int* /* font_descent_return */, - XCharStruct* /* overall_return */ -); - -extern Status XQueryTree( - Display* /* display */, - Window /* w */, - Window* /* root_return */, - Window* /* parent_return */, - Window** /* children_return */, - unsigned int* /* nchildren_return */ -); - -extern int XRaiseWindow( - Display* /* display */, - Window /* w */ -); - -extern int XReadBitmapFile( - Display* /* display */, - Drawable /* d */, - _Xconst char* /* filename */, - unsigned int* /* width_return */, - unsigned int* /* height_return */, - Pixmap* /* bitmap_return */, - int* /* x_hot_return */, - int* /* y_hot_return */ -); - -extern int XReadBitmapFileData( - _Xconst char* /* filename */, - unsigned int* /* width_return */, - unsigned int* /* height_return */, - unsigned char** /* data_return */, - int* /* x_hot_return */, - int* /* y_hot_return */ -); - -extern int XRebindKeysym( - Display* /* display */, - KeySym /* keysym */, - KeySym* /* list */, - int /* mod_count */, - _Xconst unsigned char* /* string */, - int /* bytes_string */ -); - -extern int XRecolorCursor( - Display* /* display */, - Cursor /* cursor */, - XColor* /* foreground_color */, - XColor* /* background_color */ -); - -extern int XRefreshKeyboardMapping( - XMappingEvent* /* event_map */ -); - -extern int XRemoveFromSaveSet( - Display* /* display */, - Window /* w */ -); - -extern int XRemoveHost( - Display* /* display */, - XHostAddress* /* host */ -); - -extern int XRemoveHosts( - Display* /* display */, - XHostAddress* /* hosts */, - int /* num_hosts */ -); - -extern int XReparentWindow( - Display* /* display */, - Window /* w */, - Window /* parent */, - int /* x */, - int /* y */ -); - -extern int XResetScreenSaver( - Display* /* display */ -); - -extern int XResizeWindow( - Display* /* display */, - Window /* w */, - unsigned int /* width */, - unsigned int /* height */ -); - -extern int XRestackWindows( - Display* /* display */, - Window* /* windows */, - int /* nwindows */ -); - -extern int XRotateBuffers( - Display* /* display */, - int /* rotate */ -); - -extern int XRotateWindowProperties( - Display* /* display */, - Window /* w */, - Atom* /* properties */, - int /* num_prop */, - int /* npositions */ -); - -extern int XScreenCount( - Display* /* display */ -); - -extern int XSelectInput( - Display* /* display */, - Window /* w */, - long /* event_mask */ -); - -extern Status XSendEvent( - Display* /* display */, - Window /* w */, - Bool /* propagate */, - long /* event_mask */, - XEvent* /* event_send */ -); - -extern int XSetAccessControl( - Display* /* display */, - int /* mode */ -); - -extern int XSetArcMode( - Display* /* display */, - GC /* gc */, - int /* arc_mode */ -); - -extern int XSetBackground( - Display* /* display */, - GC /* gc */, - unsigned long /* background */ -); - -extern int XSetClipMask( - Display* /* display */, - GC /* gc */, - Pixmap /* pixmap */ -); - -extern int XSetClipOrigin( - Display* /* display */, - GC /* gc */, - int /* clip_x_origin */, - int /* clip_y_origin */ -); - -extern int XSetClipRectangles( - Display* /* display */, - GC /* gc */, - int /* clip_x_origin */, - int /* clip_y_origin */, - XRectangle* /* rectangles */, - int /* n */, - int /* ordering */ -); - -extern int XSetCloseDownMode( - Display* /* display */, - int /* close_mode */ -); - -extern int XSetCommand( - Display* /* display */, - Window /* w */, - char** /* argv */, - int /* argc */ -); - -extern int XSetDashes( - Display* /* display */, - GC /* gc */, - int /* dash_offset */, - _Xconst char* /* dash_list */, - int /* n */ -); - -extern int XSetFillRule( - Display* /* display */, - GC /* gc */, - int /* fill_rule */ -); - -extern int XSetFillStyle( - Display* /* display */, - GC /* gc */, - int /* fill_style */ -); - -extern int XSetFont( - Display* /* display */, - GC /* gc */, - Font /* font */ -); - -extern int XSetFontPath( - Display* /* display */, - char** /* directories */, - int /* ndirs */ -); - -extern int XSetForeground( - Display* /* display */, - GC /* gc */, - unsigned long /* foreground */ -); - -extern int XSetFunction( - Display* /* display */, - GC /* gc */, - int /* function */ -); - -extern int XSetGraphicsExposures( - Display* /* display */, - GC /* gc */, - Bool /* graphics_exposures */ -); - -extern int XSetIconName( - Display* /* display */, - Window /* w */, - _Xconst char* /* icon_name */ -); - -extern int XSetInputFocus( - Display* /* display */, - Window /* focus */, - int /* revert_to */, - Time /* time */ -); - -extern int XSetLineAttributes( - Display* /* display */, - GC /* gc */, - unsigned int /* line_width */, - int /* line_style */, - int /* cap_style */, - int /* join_style */ -); - -extern int XSetModifierMapping( - Display* /* display */, - XModifierKeymap* /* modmap */ -); - -extern int XSetPlaneMask( - Display* /* display */, - GC /* gc */, - unsigned long /* plane_mask */ -); - -extern int XSetPointerMapping( - Display* /* display */, - _Xconst unsigned char* /* map */, - int /* nmap */ -); - -extern int XSetScreenSaver( - Display* /* display */, - int /* timeout */, - int /* interval */, - int /* prefer_blanking */, - int /* allow_exposures */ -); - -extern int XSetSelectionOwner( - Display* /* display */, - Atom /* selection */, - Window /* owner */, - Time /* time */ -); - -extern int XSetState( - Display* /* display */, - GC /* gc */, - unsigned long /* foreground */, - unsigned long /* background */, - int /* function */, - unsigned long /* plane_mask */ -); - -extern int XSetStipple( - Display* /* display */, - GC /* gc */, - Pixmap /* stipple */ -); - -extern int XSetSubwindowMode( - Display* /* display */, - GC /* gc */, - int /* subwindow_mode */ -); - -extern int XSetTSOrigin( - Display* /* display */, - GC /* gc */, - int /* ts_x_origin */, - int /* ts_y_origin */ -); - -extern int XSetTile( - Display* /* display */, - GC /* gc */, - Pixmap /* tile */ -); - -extern int XSetWindowBackground( - Display* /* display */, - Window /* w */, - unsigned long /* background_pixel */ -); - -extern int XSetWindowBackgroundPixmap( - Display* /* display */, - Window /* w */, - Pixmap /* background_pixmap */ -); - -extern int XSetWindowBorder( - Display* /* display */, - Window /* w */, - unsigned long /* border_pixel */ -); - -extern int XSetWindowBorderPixmap( - Display* /* display */, - Window /* w */, - Pixmap /* border_pixmap */ -); - -extern int XSetWindowBorderWidth( - Display* /* display */, - Window /* w */, - unsigned int /* width */ -); - -extern int XSetWindowColormap( - Display* /* display */, - Window /* w */, - Colormap /* colormap */ -); - -extern int XStoreBuffer( - Display* /* display */, - _Xconst char* /* bytes */, - int /* nbytes */, - int /* buffer */ -); - -extern int XStoreBytes( - Display* /* display */, - _Xconst char* /* bytes */, - int /* nbytes */ -); - -extern int XStoreColor( - Display* /* display */, - Colormap /* colormap */, - XColor* /* color */ -); - -extern int XStoreColors( - Display* /* display */, - Colormap /* colormap */, - XColor* /* color */, - int /* ncolors */ -); - -extern int XStoreName( - Display* /* display */, - Window /* w */, - _Xconst char* /* window_name */ -); - -extern int XStoreNamedColor( - Display* /* display */, - Colormap /* colormap */, - _Xconst char* /* color */, - unsigned long /* pixel */, - int /* flags */ -); - -extern int XSync( - Display* /* display */, - Bool /* discard */ -); - -extern int XTextExtents( - XFontStruct* /* font_struct */, - _Xconst char* /* string */, - int /* nchars */, - int* /* direction_return */, - int* /* font_ascent_return */, - int* /* font_descent_return */, - XCharStruct* /* overall_return */ -); - -extern int XTextExtents16( - XFontStruct* /* font_struct */, - _Xconst XChar2b* /* string */, - int /* nchars */, - int* /* direction_return */, - int* /* font_ascent_return */, - int* /* font_descent_return */, - XCharStruct* /* overall_return */ -); - -extern int XTextWidth( - XFontStruct* /* font_struct */, - _Xconst char* /* string */, - int /* count */ -); - -extern int XTextWidth16( - XFontStruct* /* font_struct */, - _Xconst XChar2b* /* string */, - int /* count */ -); - -extern Bool XTranslateCoordinates( - Display* /* display */, - Window /* src_w */, - Window /* dest_w */, - int /* src_x */, - int /* src_y */, - int* /* dest_x_return */, - int* /* dest_y_return */, - Window* /* child_return */ -); - -extern int XUndefineCursor( - Display* /* display */, - Window /* w */ -); - -extern int XUngrabButton( - Display* /* display */, - unsigned int /* button */, - unsigned int /* modifiers */, - Window /* grab_window */ -); - -extern int XUngrabKey( - Display* /* display */, - int /* keycode */, - unsigned int /* modifiers */, - Window /* grab_window */ -); - -extern int XUngrabKeyboard( - Display* /* display */, - Time /* time */ -); - -extern int XUngrabPointer( - Display* /* display */, - Time /* time */ -); - -extern int XUngrabServer( - Display* /* display */ -); - -extern int XUninstallColormap( - Display* /* display */, - Colormap /* colormap */ -); - -extern int XUnloadFont( - Display* /* display */, - Font /* font */ -); - -extern int XUnmapSubwindows( - Display* /* display */, - Window /* w */ -); - -extern int XUnmapWindow( - Display* /* display */, - Window /* w */ -); - -extern int XVendorRelease( - Display* /* display */ -); - -extern int XWarpPointer( - Display* /* display */, - Window /* src_w */, - Window /* dest_w */, - int /* src_x */, - int /* src_y */, - unsigned int /* src_width */, - unsigned int /* src_height */, - int /* dest_x */, - int /* dest_y */ -); - -extern int XWidthMMOfScreen( - Screen* /* screen */ -); - -extern int XWidthOfScreen( - Screen* /* screen */ -); - -extern int XWindowEvent( - Display* /* display */, - Window /* w */, - long /* event_mask */, - XEvent* /* event_return */ -); - -extern int XWriteBitmapFile( - Display* /* display */, - _Xconst char* /* filename */, - Pixmap /* bitmap */, - unsigned int /* width */, - unsigned int /* height */, - int /* x_hot */, - int /* y_hot */ -); - -extern Bool XSupportsLocale (void); - -extern char *XSetLocaleModifiers( - const char* /* modifier_list */ -); - -extern XOM XOpenOM( - Display* /* display */, - struct _XrmHashBucketRec* /* rdb */, - _Xconst char* /* res_name */, - _Xconst char* /* res_class */ -); - -extern Status XCloseOM( - XOM /* om */ -); - -extern char *XSetOMValues( - XOM /* om */, - ... -) _X_SENTINEL(0); - -extern char *XGetOMValues( - XOM /* om */, - ... -) _X_SENTINEL(0); - -extern Display *XDisplayOfOM( - XOM /* om */ -); - -extern char *XLocaleOfOM( - XOM /* om */ -); - -extern XOC XCreateOC( - XOM /* om */, - ... -) _X_SENTINEL(0); - -extern void XDestroyOC( - XOC /* oc */ -); - -extern XOM XOMOfOC( - XOC /* oc */ -); - -extern char *XSetOCValues( - XOC /* oc */, - ... -) _X_SENTINEL(0); - -extern char *XGetOCValues( - XOC /* oc */, - ... -) _X_SENTINEL(0); - -extern XFontSet XCreateFontSet( - Display* /* display */, - _Xconst char* /* base_font_name_list */, - char*** /* missing_charset_list */, - int* /* missing_charset_count */, - char** /* def_string */ -); - -extern void XFreeFontSet( - Display* /* display */, - XFontSet /* font_set */ -); - -extern int XFontsOfFontSet( - XFontSet /* font_set */, - XFontStruct*** /* font_struct_list */, - char*** /* font_name_list */ -); - -extern char *XBaseFontNameListOfFontSet( - XFontSet /* font_set */ -); - -extern char *XLocaleOfFontSet( - XFontSet /* font_set */ -); - -extern Bool XContextDependentDrawing( - XFontSet /* font_set */ -); - -extern Bool XDirectionalDependentDrawing( - XFontSet /* font_set */ -); - -extern Bool XContextualDrawing( - XFontSet /* font_set */ -); - -extern XFontSetExtents *XExtentsOfFontSet( - XFontSet /* font_set */ -); - -extern int XmbTextEscapement( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* bytes_text */ -); - -extern int XwcTextEscapement( - XFontSet /* font_set */, - _Xconst wchar_t* /* text */, - int /* num_wchars */ -); - -extern int Xutf8TextEscapement( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* bytes_text */ -); - -extern int XmbTextExtents( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* bytes_text */, - XRectangle* /* overall_ink_return */, - XRectangle* /* overall_logical_return */ -); - -extern int XwcTextExtents( - XFontSet /* font_set */, - _Xconst wchar_t* /* text */, - int /* num_wchars */, - XRectangle* /* overall_ink_return */, - XRectangle* /* overall_logical_return */ -); - -extern int Xutf8TextExtents( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* bytes_text */, - XRectangle* /* overall_ink_return */, - XRectangle* /* overall_logical_return */ -); - -extern Status XmbTextPerCharExtents( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* bytes_text */, - XRectangle* /* ink_extents_buffer */, - XRectangle* /* logical_extents_buffer */, - int /* buffer_size */, - int* /* num_chars */, - XRectangle* /* overall_ink_return */, - XRectangle* /* overall_logical_return */ -); - -extern Status XwcTextPerCharExtents( - XFontSet /* font_set */, - _Xconst wchar_t* /* text */, - int /* num_wchars */, - XRectangle* /* ink_extents_buffer */, - XRectangle* /* logical_extents_buffer */, - int /* buffer_size */, - int* /* num_chars */, - XRectangle* /* overall_ink_return */, - XRectangle* /* overall_logical_return */ -); - -extern Status Xutf8TextPerCharExtents( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* bytes_text */, - XRectangle* /* ink_extents_buffer */, - XRectangle* /* logical_extents_buffer */, - int /* buffer_size */, - int* /* num_chars */, - XRectangle* /* overall_ink_return */, - XRectangle* /* overall_logical_return */ -); - -extern void XmbDrawText( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - XmbTextItem* /* text_items */, - int /* nitems */ -); - -extern void XwcDrawText( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - XwcTextItem* /* text_items */, - int /* nitems */ -); - -extern void Xutf8DrawText( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - XmbTextItem* /* text_items */, - int /* nitems */ -); - -extern void XmbDrawString( - Display* /* display */, - Drawable /* d */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* text */, - int /* bytes_text */ -); - -extern void XwcDrawString( - Display* /* display */, - Drawable /* d */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst wchar_t* /* text */, - int /* num_wchars */ -); - -extern void Xutf8DrawString( - Display* /* display */, - Drawable /* d */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* text */, - int /* bytes_text */ -); - -extern void XmbDrawImageString( - Display* /* display */, - Drawable /* d */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* text */, - int /* bytes_text */ -); - -extern void XwcDrawImageString( - Display* /* display */, - Drawable /* d */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst wchar_t* /* text */, - int /* num_wchars */ -); - -extern void Xutf8DrawImageString( - Display* /* display */, - Drawable /* d */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* text */, - int /* bytes_text */ -); - -extern XIM XOpenIM( - Display* /* dpy */, - struct _XrmHashBucketRec* /* rdb */, - char* /* res_name */, - char* /* res_class */ -); - -extern Status XCloseIM( - XIM /* im */ -); - -extern char *XGetIMValues( - XIM /* im */, ... -) _X_SENTINEL(0); - -extern char *XSetIMValues( - XIM /* im */, ... -) _X_SENTINEL(0); - -extern Display *XDisplayOfIM( - XIM /* im */ -); - -extern char *XLocaleOfIM( - XIM /* im*/ -); - -extern XIC XCreateIC( - XIM /* im */, ... -) _X_SENTINEL(0); - -extern void XDestroyIC( - XIC /* ic */ -); - -extern void XSetICFocus( - XIC /* ic */ -); - -extern void XUnsetICFocus( - XIC /* ic */ -); - -extern wchar_t *XwcResetIC( - XIC /* ic */ -); - -extern char *XmbResetIC( - XIC /* ic */ -); - -extern char *Xutf8ResetIC( - XIC /* ic */ -); - -extern char *XSetICValues( - XIC /* ic */, ... -) _X_SENTINEL(0); - -extern char *XGetICValues( - XIC /* ic */, ... -) _X_SENTINEL(0); - -extern XIM XIMOfIC( - XIC /* ic */ -); - -extern Bool XFilterEvent( - XEvent* /* event */, - Window /* window */ -); - -extern int XmbLookupString( - XIC /* ic */, - XKeyPressedEvent* /* event */, - char* /* buffer_return */, - int /* bytes_buffer */, - KeySym* /* keysym_return */, - Status* /* status_return */ -); - -extern int XwcLookupString( - XIC /* ic */, - XKeyPressedEvent* /* event */, - wchar_t* /* buffer_return */, - int /* wchars_buffer */, - KeySym* /* keysym_return */, - Status* /* status_return */ -); - -extern int Xutf8LookupString( - XIC /* ic */, - XKeyPressedEvent* /* event */, - char* /* buffer_return */, - int /* bytes_buffer */, - KeySym* /* keysym_return */, - Status* /* status_return */ -); - -extern XVaNestedList XVaCreateNestedList( - int /*unused*/, ... -) _X_SENTINEL(0); - -/* internal connections for IMs */ - -extern Bool XRegisterIMInstantiateCallback( - Display* /* dpy */, - struct _XrmHashBucketRec* /* rdb */, - char* /* res_name */, - char* /* res_class */, - XIDProc /* callback */, - XPointer /* client_data */ -); - -extern Bool XUnregisterIMInstantiateCallback( - Display* /* dpy */, - struct _XrmHashBucketRec* /* rdb */, - char* /* res_name */, - char* /* res_class */, - XIDProc /* callback */, - XPointer /* client_data */ -); - -typedef void (*XConnectionWatchProc)( - Display* /* dpy */, - XPointer /* client_data */, - int /* fd */, - Bool /* opening */, /* open or close flag */ - XPointer* /* watch_data */ /* open sets, close uses */ -); - - -extern Status XInternalConnectionNumbers( - Display* /* dpy */, - int** /* fd_return */, - int* /* count_return */ -); - -extern void XProcessInternalConnection( - Display* /* dpy */, - int /* fd */ -); - -extern Status XAddConnectionWatch( - Display* /* dpy */, - XConnectionWatchProc /* callback */, - XPointer /* client_data */ -); - -extern void XRemoveConnectionWatch( - Display* /* dpy */, - XConnectionWatchProc /* callback */, - XPointer /* client_data */ -); - -extern void XSetAuthorization( - char * /* name */, - int /* namelen */, - char * /* data */, - int /* datalen */ -); - -extern int _Xmbtowc( - wchar_t * /* wstr */, - char * /* str */, - int /* len */ -); - -extern int _Xwctomb( - char * /* str */, - wchar_t /* wc */ -); - -extern Bool XGetEventData( - Display* /* dpy */, - XGenericEventCookie* /* cookie*/ -); - -extern void XFreeEventData( - Display* /* dpy */, - XGenericEventCookie* /* cookie*/ -); - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -_XFUNCPROTOEND - -#endif /* _X11_XLIB_H_ */ diff --git a/openflow/usr/include/X11/XlibConf.h b/openflow/usr/include/X11/XlibConf.h deleted file mode 100644 index 9f9b940..0000000 --- a/openflow/usr/include/X11/XlibConf.h +++ /dev/null @@ -1,38 +0,0 @@ -/* include/X11/XlibConf.h. Generated from XlibConf.h.in by configure. */ -/* - * Copyright © 2005 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _XLIBCONF_H_ -#define _XLIBCONF_H_ -/* - * This header file exports defines necessary to correctly - * use Xlibint.h both inside Xlib and by external libraries - * such as extensions. - */ - -/* Threading support? */ -#define XTHREADS 1 - -/* Use multi-threaded libc functions? */ -#define XUSE_MTSAFE_API 1 - -#endif /* _XLIBCONF_H_ */ diff --git a/openflow/usr/include/X11/Xlibint.h b/openflow/usr/include/X11/Xlibint.h deleted file mode 100644 index 4431559..0000000 --- a/openflow/usr/include/X11/Xlibint.h +++ /dev/null @@ -1,1334 +0,0 @@ - -/* - -Copyright 1984, 1985, 1987, 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifndef _X11_XLIBINT_H_ -#define _X11_XLIBINT_H_ 1 - -/* - * Xlibint.h - Header definition and support file for the internal - * support routines used by the C subroutine interface - * library (Xlib) to the X Window System. - * - * Warning, there be dragons here.... - */ - -#include -#include /* to declare xEvent */ -#include /* for configured options like XTHREADS */ - -/* The Xlib structs are full of implicit padding to properly align members. - We can't clean that up without breaking ABI, so tell clang not to bother - complaining about it. */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - -#ifdef WIN32 -#define _XFlush _XFlushIt -#endif - -/* - * If your BytesReadable correctly detects broken connections, then - * you should NOT define XCONN_CHECK_FREQ. - */ -#ifndef XCONN_CHECK_FREQ -#define XCONN_CHECK_FREQ 256 -#endif - -struct _XGC -{ - XExtData *ext_data; /* hook for extension to hang data */ - GContext gid; /* protocol ID for graphics context */ - Bool rects; /* boolean: TRUE if clipmask is list of rectangles */ - Bool dashes; /* boolean: TRUE if dash-list is really a list */ - unsigned long dirty;/* cache dirty bits */ - XGCValues values; /* shadow structure of values */ -}; - -struct _XDisplay -{ - XExtData *ext_data; /* hook for extension to hang data */ - struct _XFreeFuncs *free_funcs; /* internal free functions */ - int fd; /* Network socket. */ - int conn_checker; /* ugly thing used by _XEventsQueued */ - int proto_major_version;/* maj. version of server's X protocol */ - int proto_minor_version;/* minor version of server's X protocol */ - char *vendor; /* vendor of the server hardware */ - XID resource_base; /* resource ID base */ - XID resource_mask; /* resource ID mask bits */ - XID resource_id; /* allocator current ID */ - int resource_shift; /* allocator shift to correct bits */ - XID (*resource_alloc)( /* allocator function */ - struct _XDisplay* - ); - int byte_order; /* screen byte order, LSBFirst, MSBFirst */ - int bitmap_unit; /* padding and data requirements */ - int bitmap_pad; /* padding requirements on bitmaps */ - int bitmap_bit_order; /* LeastSignificant or MostSignificant */ - int nformats; /* number of pixmap formats in list */ - ScreenFormat *pixmap_format; /* pixmap format list */ - int vnumber; /* Xlib's X protocol version number. */ - int release; /* release of the server */ - struct _XSQEvent *head, *tail; /* Input event queue. */ - int qlen; /* Length of input event queue */ - unsigned long last_request_read; /* seq number of last event read */ - unsigned long request; /* sequence number of last request. */ - char *last_req; /* beginning of last request, or dummy */ - char *buffer; /* Output buffer starting address. */ - char *bufptr; /* Output buffer index pointer. */ - char *bufmax; /* Output buffer maximum+1 address. */ - unsigned max_request_size; /* maximum number 32 bit words in request*/ - struct _XrmHashBucketRec *db; - int (*synchandler)( /* Synchronization handler */ - struct _XDisplay* - ); - char *display_name; /* "host:display" string used on this connect*/ - int default_screen; /* default screen for operations */ - int nscreens; /* number of screens on this server*/ - Screen *screens; /* pointer to list of screens */ - unsigned long motion_buffer; /* size of motion buffer */ - volatile unsigned long flags; /* internal connection flags */ - int min_keycode; /* minimum defined keycode */ - int max_keycode; /* maximum defined keycode */ - KeySym *keysyms; /* This server's keysyms */ - XModifierKeymap *modifiermap; /* This server's modifier keymap */ - int keysyms_per_keycode;/* number of rows */ - char *xdefaults; /* contents of defaults from server */ - char *scratch_buffer; /* place to hang scratch buffer */ - unsigned long scratch_length; /* length of scratch buffer */ - int ext_number; /* extension number on this display */ - struct _XExten *ext_procs; /* extensions initialized on this display */ - /* - * the following can be fixed size, as the protocol defines how - * much address space is available. - * While this could be done using the extension vector, there - * may be MANY events processed, so a search through the extension - * list to find the right procedure for each event might be - * expensive if many extensions are being used. - */ - Bool (*event_vec[128])( /* vector for wire to event */ - Display * /* dpy */, - XEvent * /* re */, - xEvent * /* event */ - ); - Status (*wire_vec[128])( /* vector for event to wire */ - Display * /* dpy */, - XEvent * /* re */, - xEvent * /* event */ - ); - KeySym lock_meaning; /* for XLookupString */ - struct _XLockInfo *lock; /* multi-thread state, display lock */ - struct _XInternalAsync *async_handlers; /* for internal async */ - unsigned long bigreq_size; /* max size of big requests */ - struct _XLockPtrs *lock_fns; /* pointers to threads functions */ - void (*idlist_alloc)( /* XID list allocator function */ - Display * /* dpy */, - XID * /* ids */, - int /* count */ - ); - /* things above this line should not move, for binary compatibility */ - struct _XKeytrans *key_bindings; /* for XLookupString */ - Font cursor_font; /* for XCreateFontCursor */ - struct _XDisplayAtoms *atoms; /* for XInternAtom */ - unsigned int mode_switch; /* keyboard group modifiers */ - unsigned int num_lock; /* keyboard numlock modifiers */ - struct _XContextDB *context_db; /* context database */ - Bool (**error_vec)( /* vector for wire to error */ - Display * /* display */, - XErrorEvent * /* he */, - xError * /* we */ - ); - /* - * Xcms information - */ - struct { - XPointer defaultCCCs; /* pointer to an array of default XcmsCCC */ - XPointer clientCmaps; /* pointer to linked list of XcmsCmapRec */ - XPointer perVisualIntensityMaps; - /* linked list of XcmsIntensityMap */ - } cms; - struct _XIMFilter *im_filters; - struct _XSQEvent *qfree; /* unallocated event queue elements */ - unsigned long next_event_serial_num; /* inserted into next queue elt */ - struct _XExten *flushes; /* Flush hooks */ - struct _XConnectionInfo *im_fd_info; /* _XRegisterInternalConnection */ - int im_fd_length; /* number of im_fd_info */ - struct _XConnWatchInfo *conn_watchers; /* XAddConnectionWatch */ - int watcher_count; /* number of conn_watchers */ - XPointer filedes; /* struct pollfd cache for _XWaitForReadable */ - int (*savedsynchandler)( /* user synchandler when Xlib usurps */ - Display * /* dpy */ - ); - XID resource_max; /* allocator max ID */ - int xcmisc_opcode; /* major opcode for XC-MISC */ - struct _XkbInfoRec *xkb_info; /* XKB info */ - struct _XtransConnInfo *trans_conn; /* transport connection object */ - struct _X11XCBPrivate *xcb; /* XCB glue private data */ - - /* Generic event cookie handling */ - unsigned int next_cookie; /* next event cookie */ - /* vector for wire to generic event, index is (extension - 128) */ - Bool (*generic_event_vec[128])( - Display * /* dpy */, - XGenericEventCookie * /* Xlib event */, - xEvent * /* wire event */); - /* vector for event copy, index is (extension - 128) */ - Bool (*generic_event_copy_vec[128])( - Display * /* dpy */, - XGenericEventCookie * /* in */, - XGenericEventCookie * /* out*/); - void *cookiejar; /* cookie events returned but not claimed */ -}; - -#define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n) - -#ifndef _XEVENT_ -/* - * _QEvent datatype for use in input queueing. - */ -typedef struct _XSQEvent -{ - struct _XSQEvent *next; - XEvent event; - unsigned long qserial_num; /* so multi-threaded code can find new ones */ -} _XQEvent; -#endif - -#include -#ifdef __sgi -#define _SGI_MP_SOURCE /* turn this on to get MP safe errno */ -#endif -#include -#define _XBCOPYFUNC _Xbcopy -#include -#include - -/* Utek leaves kernel macros around in include files (bleah) */ -#ifdef dirty -#undef dirty -#endif - -#include -#include - -#include - -_XFUNCPROTOBEGIN - -/* - * The following definitions can be used for locking requests in multi-threaded - * address spaces. - */ -#ifdef XTHREADS -/* Author: Stephen Gildea, MIT X Consortium - * - * declarations for C Threads locking - */ - -typedef struct _LockInfoRec *LockInfoPtr; - -/* interfaces for locking.c */ -struct _XLockPtrs { - /* used by all, including extensions; do not move */ - void (*lock_display)( - Display *dpy -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char *file - , int line -#endif - ); - void (*unlock_display)( - Display *dpy -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char *file - , int line -#endif - ); -}; - -#if defined(WIN32) && !defined(_XLIBINT_) -#define _XCreateMutex_fn (*_XCreateMutex_fn_p) -#define _XFreeMutex_fn (*_XFreeMutex_fn_p) -#define _XLockMutex_fn (*_XLockMutex_fn_p) -#define _XUnlockMutex_fn (*_XUnlockMutex_fn_p) -#define _Xglobal_lock (*_Xglobal_lock_p) -#endif - -/* in XlibInt.c */ -extern void (*_XCreateMutex_fn)( - LockInfoPtr /* lock */ -); -extern void (*_XFreeMutex_fn)( - LockInfoPtr /* lock */ -); -extern void (*_XLockMutex_fn)( - LockInfoPtr /* lock */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char * /* file */ - , int /* line */ -#endif -); -extern void (*_XUnlockMutex_fn)( - LockInfoPtr /* lock */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char * /* file */ - , int /* line */ -#endif -); - -extern LockInfoPtr _Xglobal_lock; - -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__) -#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__) -#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__) -#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__) -#else -/* used everywhere, so must be fast if not using threads */ -#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d) -#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d) -#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock) -#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock) -#endif -#define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock); -#define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock); - -#else /* XTHREADS */ -#define LockDisplay(dis) -#define _XLockMutex(lock) -#define _XUnlockMutex(lock) -#define UnlockDisplay(dis) -#define _XCreateMutex(lock) -#define _XFreeMutex(lock) -#endif - -#define Xfree(ptr) free((ptr)) - -/* - * Note that some machines do not return a valid pointer for malloc(0), in - * which case we provide an alternate under the control of the - * define MALLOC_0_RETURNS_NULL. This is necessary because some - * Xlib code expects malloc(0) to return a valid pointer to storage. - */ -#if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__) - -# define Xmalloc(size) malloc(((size) == 0 ? 1 : (size))) -# define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size))) -# define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize)) - -#else - -# define Xmalloc(size) malloc((size)) -# define Xrealloc(ptr, size) realloc((ptr), (size)) -# define Xcalloc(nelem, elsize) calloc((nelem), (elsize)) - -#endif - -#include - -#define LOCKED 1 -#define UNLOCKED 0 - -#ifndef BUFSIZE -#define BUFSIZE 2048 /* X output buffer size. */ -#endif -#ifndef PTSPERBATCH -#define PTSPERBATCH 1024 /* point batching */ -#endif -#ifndef WLNSPERBATCH -#define WLNSPERBATCH 50 /* wide line batching */ -#endif -#ifndef ZLNSPERBATCH -#define ZLNSPERBATCH 1024 /* thin line batching */ -#endif -#ifndef WRCTSPERBATCH -#define WRCTSPERBATCH 10 /* wide line rectangle batching */ -#endif -#ifndef ZRCTSPERBATCH -#define ZRCTSPERBATCH 256 /* thin line rectangle batching */ -#endif -#ifndef FRCTSPERBATCH -#define FRCTSPERBATCH 256 /* filled rectangle batching */ -#endif -#ifndef FARCSPERBATCH -#define FARCSPERBATCH 256 /* filled arc batching */ -#endif -#ifndef CURSORFONT -#define CURSORFONT "cursor" /* standard cursor fonts */ -#endif - -/* - * Display flags - */ -#define XlibDisplayIOError (1L << 0) -#define XlibDisplayClosing (1L << 1) -#define XlibDisplayNoXkb (1L << 2) -#define XlibDisplayPrivSync (1L << 3) -#define XlibDisplayProcConni (1L << 4) /* in _XProcessInternalConnection */ -#define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */ -#define XlibDisplayReply (1L << 5) /* in _XReply */ -#define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */ -#define XlibDisplayDfltRMDB (1L << 7) /* mark if RM db from XGetDefault */ - -/* - * X Protocol packetizing macros. - */ - -/* Leftover from CRAY support - was defined empty on all non-Cray systems */ -#define WORD64ALIGN - -/** - * Return a len-sized request buffer for the request type. This function may - * flush the output queue. - * - * @param dpy The display connection - * @param type The request type - * @param len Length of the request in bytes - * - * @returns A pointer to the request buffer with a few default values - * initialized. - */ -extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); - -/* GetReqSized is the same as GetReq but allows the caller to specify the - * size in bytes. 'sz' must be a multiple of 4! */ - -#define GetReqSized(name, sz, req) \ - req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz) - -/* - * GetReq - Get the next available X request packet in the buffer and - * return it. - * - * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc. - * "req" is the name of the request pointer. - * - */ - -#define GetReq(name, req) \ - GetReqSized(name, SIZEOF(x##name##Req), req) - -/* GetReqExtra is the same as GetReq, but allocates "n" additional - bytes after the request. "n" must be a multiple of 4! */ - -#define GetReqExtra(name, n, req) \ - GetReqSized(name, SIZEOF(x##name##Req) + n, req) - -/* - * GetResReq is for those requests that have a resource ID - * (Window, Pixmap, GContext, etc.) as their single argument. - * "rid" is the name of the resource. - */ - -#define GetResReq(name, rid, req) \ - req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \ - req->id = (rid) - -/* - * GetEmptyReq is for those requests that have no arguments - * at all. - */ - -#define GetEmptyReq(name, req) \ - req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq)) - -/* - * MakeBigReq sets the CARD16 "req->length" to 0 and inserts a new CARD32 - * length, after req->length, before the data in the request. The new length - * includes the "n" extra 32-bit words. - * - * Do not use MakeBigReq if there is no data already in the request. - * req->length must already be >= 2. - */ -#ifdef LONG64 -#define MakeBigReq(req,n) \ - { \ - CARD64 _BRdat; \ - CARD32 _BRlen = req->length - 1; \ - req->length = 0; \ - _BRdat = ((CARD32 *)req)[_BRlen]; \ - memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ - ((CARD32 *)req)[1] = _BRlen + n + 2; \ - Data32(dpy, &_BRdat, 4); \ - } -#else -#define MakeBigReq(req,n) \ - { \ - CARD32 _BRdat; \ - CARD32 _BRlen = req->length - 1; \ - req->length = 0; \ - _BRdat = ((CARD32 *)req)[_BRlen]; \ - memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ - ((CARD32 *)req)[1] = _BRlen + n + 2; \ - Data32(dpy, &_BRdat, 4); \ - } -#endif - -/* - * SetReqLen increases the count of 32-bit words in the request by "n", - * or by "badlen" if "n" is too large. - * - * Do not use SetReqLen if "req" does not already have data after the - * xReq header. req->length must already be >= 2. - */ -#ifndef __clang_analyzer__ -#define SetReqLen(req,n,badlen) \ - if ((req->length + n) > (unsigned)65535) { \ - if (dpy->bigreq_size) { \ - MakeBigReq(req,n) \ - } else { \ - n = badlen; \ - req->length += n; \ - } \ - } else \ - req->length += n -#else -#define SetReqLen(req,n,badlen) \ - req->length += n -#endif - -#define SyncHandle() \ - if (dpy->synchandler) (*dpy->synchandler)(dpy) - -extern void _XFlushGCCache(Display *dpy, GC gc); -#define FlushGC(dpy, gc) \ - if ((gc)->dirty) _XFlushGCCache((dpy), (gc)) -/* - * Data - Place data in the buffer and pad the end to provide - * 32 bit word alignment. Transmit if the buffer fills. - * - * "dpy" is a pointer to a Display. - * "data" is a pointer to a data buffer. - * "len" is the length of the data buffer. - */ -#ifndef DataRoutineIsProcedure -#define Data(dpy, data, len) {\ - if (dpy->bufptr + (len) <= dpy->bufmax) {\ - memcpy(dpy->bufptr, data, (int)len);\ - dpy->bufptr += ((len) + 3) & ~3;\ - } else\ - _XSend(dpy, data, len);\ -} -#endif /* DataRoutineIsProcedure */ - - -/* Allocate bytes from the buffer. No padding is done, so if - * the length is not a multiple of 4, the caller must be - * careful to leave the buffer aligned after sending the - * current request. - * - * "type" is the type of the pointer being assigned to. - * "ptr" is the pointer being assigned to. - * "n" is the number of bytes to allocate. - * - * Example: - * xTextElt *elt; - * BufAlloc (xTextElt *, elt, nbytes) - */ - -#define BufAlloc(type, ptr, n) \ - if (dpy->bufptr + (n) > dpy->bufmax) \ - _XFlush (dpy); \ - ptr = (type) dpy->bufptr; \ - memset(ptr, '\0', n); \ - dpy->bufptr += (n); - -#define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) -#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) -#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) -#ifdef LONG64 -#define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)data, len) -extern int _XData32( - Display *dpy, - register _Xconst long *data, - unsigned len -); -extern void _XRead32( - Display *dpy, - register long *data, - long len -); -#else -#define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) -#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) -#endif - -#define PackData16(dpy,data,len) Data16 (dpy, data, len) -#define PackData32(dpy,data,len) Data32 (dpy, data, len) - -/* Xlib manual is bogus */ -#define PackData(dpy,data,len) PackData16 (dpy, data, len) - -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#define max(a,b) (((a) > (b)) ? (a) : (b)) - -#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \ - (((cs)->rbearing|(cs)->lbearing| \ - (cs)->ascent|(cs)->descent) == 0)) - -/* - * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit - * character. If the character is in the column and exists, then return the - * appropriate metrics (note that fonts with common per-character metrics will - * return min_bounds). If none of these hold true, try again with the default - * char. - */ -#define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \ -{ \ - cs = def; \ - if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ - if (fs->per_char == NULL) { \ - cs = &fs->min_bounds; \ - } else { \ - cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \ - if (CI_NONEXISTCHAR(cs)) cs = def; \ - } \ - } \ -} - -#define CI_GET_DEFAULT_INFO_1D(fs,cs) \ - CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs) - - - -/* - * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and - * column. This is used for fonts that have more than row zero. - */ -#define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \ -{ \ - cs = def; \ - if (row >= fs->min_byte1 && row <= fs->max_byte1 && \ - col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ - if (fs->per_char == NULL) { \ - cs = &fs->min_bounds; \ - } else { \ - cs = &fs->per_char[((row - fs->min_byte1) * \ - (fs->max_char_or_byte2 - \ - fs->min_char_or_byte2 + 1)) + \ - (col - fs->min_char_or_byte2)]; \ - if (CI_NONEXISTCHAR(cs)) cs = def; \ - } \ - } \ -} - -#define CI_GET_DEFAULT_INFO_2D(fs,cs) \ -{ \ - unsigned int r = (fs->default_char >> 8); \ - unsigned int c = (fs->default_char & 0xff); \ - CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \ -} - - -/* srcvar must be a variable for large architecture version */ -#define OneDataCard32(dpy,dstaddr,srcvar) \ - { *(CARD32 *)(dstaddr) = (srcvar); } - - -typedef struct _XInternalAsync { - struct _XInternalAsync *next; - /* - * handler arguments: - * rep is the generic reply that caused this handler - * to be invoked. It must also be passed to _XGetAsyncReply. - * buf and len are opaque values that must be passed to - * _XGetAsyncReply or _XGetAsyncData. - * data is the closure stored in this struct. - * The handler returns True iff it handled this reply. - */ - Bool (*handler)( - Display* /* dpy */, - xReply* /* rep */, - char* /* buf */, - int /* len */, - XPointer /* data */ - ); - XPointer data; -} _XAsyncHandler; - -typedef struct _XAsyncEState { - unsigned long min_sequence_number; - unsigned long max_sequence_number; - unsigned char error_code; - unsigned char major_opcode; - unsigned short minor_opcode; - unsigned char last_error_received; - int error_count; -} _XAsyncErrorState; - -extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler); -#define DeqAsyncHandler(dpy,handler) { \ - if (dpy->async_handlers == (handler)) \ - dpy->async_handlers = (handler)->next; \ - else \ - _XDeqAsyncHandler(dpy, handler); \ - } - -typedef void (*FreeFuncType) ( - Display* /* display */ -); - -typedef int (*FreeModmapType) ( - XModifierKeymap* /* modmap */ -); - -/* - * This structure is private to the library. - */ -typedef struct _XFreeFuncs { - FreeFuncType atoms; /* _XFreeAtomTable */ - FreeModmapType modifiermap; /* XFreeModifiermap */ - FreeFuncType key_bindings; /* _XFreeKeyBindings */ - FreeFuncType context_db; /* _XFreeContextDB */ - FreeFuncType defaultCCCs; /* _XcmsFreeDefaultCCCs */ - FreeFuncType clientCmaps; /* _XcmsFreeClientCmaps */ - FreeFuncType intensityMaps; /* _XcmsFreeIntensityMaps */ - FreeFuncType im_filters; /* _XFreeIMFilters */ - FreeFuncType xkb; /* _XkbFreeInfo */ -} _XFreeFuncRec; - -/* types for InitExt.c */ -typedef int (*CreateGCType) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -); - -typedef int (*CopyGCType)( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -); - -typedef int (*FlushGCType) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -); - -typedef int (*FreeGCType) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -); - -typedef int (*CreateFontType) ( - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ -); - -typedef int (*FreeFontType) ( - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ -); - -typedef int (*CloseDisplayType) ( - Display* /* display */, - XExtCodes* /* codes */ -); - -typedef int (*ErrorType) ( - Display* /* display */, - xError* /* err */, - XExtCodes* /* codes */, - int* /* ret_code */ -); - -typedef char* (*ErrorStringType) ( - Display* /* display */, - int /* code */, - XExtCodes* /* codes */, - char* /* buffer */, - int /* nbytes */ -); - -typedef void (*PrintErrorType)( - Display* /* display */, - XErrorEvent* /* ev */, - void* /* fp */ -); - -typedef void (*BeforeFlushType)( - Display* /* display */, - XExtCodes* /* codes */, - _Xconst char* /* data */, - long /* len */ -); - -/* - * This structure is private to the library. - */ -typedef struct _XExten { /* private to extension mechanism */ - struct _XExten *next; /* next in list */ - XExtCodes codes; /* public information, all extension told */ - CreateGCType create_GC; /* routine to call when GC created */ - CopyGCType copy_GC; /* routine to call when GC copied */ - FlushGCType flush_GC; /* routine to call when GC flushed */ - FreeGCType free_GC; /* routine to call when GC freed */ - CreateFontType create_Font; /* routine to call when Font created */ - FreeFontType free_Font; /* routine to call when Font freed */ - CloseDisplayType close_display; /* routine to call when connection closed */ - ErrorType error; /* who to call when an error occurs */ - ErrorStringType error_string; /* routine to supply error string */ - char *name; /* name of this extension */ - PrintErrorType error_values; /* routine to supply error values */ - BeforeFlushType before_flush; /* routine to call when sending data */ - struct _XExten *next_flush; /* next in list of those with flushes */ -} _XExtension; - -/* Temporary definition until we can depend on an xproto release with it */ -#ifdef _X_COLD -# define _XLIB_COLD _X_COLD -#elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403) /* 4.3+ */ -# define _XLIB_COLD __attribute__((__cold__)) -#else -# define _XLIB_COLD /* nothing */ -#endif - -/* extension hooks */ - -#ifdef DataRoutineIsProcedure -extern void Data(Display *dpy, char *data, long len); -#endif -extern int _XError( - Display* /* dpy */, - xError* /* rep */ -); -extern int _XIOError( - Display* /* dpy */ -) _X_NORETURN; -extern int (*_XIOErrorFunction)( - Display* /* dpy */ -); -extern int (*_XErrorFunction)( - Display* /* dpy */, - XErrorEvent* /* error_event */ -); -extern void _XEatData( - Display* /* dpy */, - unsigned long /* n */ -) _XLIB_COLD; -extern void _XEatDataWords( - Display* /* dpy */, - unsigned long /* n */ -) _XLIB_COLD; -#if defined(__SUNPRO_C) /* Studio compiler alternative to "cold" attribute */ -# pragma rarely_called(_XEatData, _XEatDataWords) -#endif -extern char *_XAllocScratch( - Display* /* dpy */, - unsigned long /* nbytes */ -); -extern char *_XAllocTemp( - Display* /* dpy */, - unsigned long /* nbytes */ -); -extern void _XFreeTemp( - Display* /* dpy */, - char* /* buf */, - unsigned long /* nbytes */ -); -extern Visual *_XVIDtoVisual( - Display* /* dpy */, - VisualID /* id */ -); -extern unsigned long _XSetLastRequestRead( - Display* /* dpy */, - xGenericReply* /* rep */ -); -extern int _XGetHostname( - char* /* buf */, - int /* maxlen */ -); -extern Screen *_XScreenOfWindow( - Display* /* dpy */, - Window /* w */ -); -extern Bool _XAsyncErrorHandler( - Display* /* dpy */, - xReply* /* rep */, - char* /* buf */, - int /* len */, - XPointer /* data */ -); -extern char *_XGetAsyncReply( - Display* /* dpy */, - char* /* replbuf */, - xReply* /* rep */, - char* /* buf */, - int /* len */, - int /* extra */, - Bool /* discard */ -); -extern void _XGetAsyncData( - Display* /* dpy */, - char * /* data */, - char * /* buf */, - int /* len */, - int /* skip */, - int /* datalen */, - int /* discardtotal */ -); -extern void _XFlush( - Display* /* dpy */ -); -extern int _XEventsQueued( - Display* /* dpy */, - int /* mode */ -); -extern void _XReadEvents( - Display* /* dpy */ -); -extern int _XRead( - Display* /* dpy */, - char* /* data */, - long /* size */ -); -extern void _XReadPad( - Display* /* dpy */, - char* /* data */, - long /* size */ -); -extern void _XSend( - Display* /* dpy */, - _Xconst char* /* data */, - long /* size */ -); -extern Status _XReply( - Display* /* dpy */, - xReply* /* rep */, - int /* extra */, - Bool /* discard */ -); -extern void _XEnq( - Display* /* dpy */, - xEvent* /* event */ -); -extern void _XDeq( - Display* /* dpy */, - _XQEvent* /* prev */, - _XQEvent* /* qelt */ -); - -extern Bool _XUnknownWireEvent( - Display* /* dpy */, - XEvent* /* re */, - xEvent* /* event */ -); - -extern Bool _XUnknownWireEventCookie( - Display* /* dpy */, - XGenericEventCookie* /* re */, - xEvent* /* event */ -); - -extern Bool _XUnknownCopyEventCookie( - Display* /* dpy */, - XGenericEventCookie* /* in */, - XGenericEventCookie* /* out */ -); - -extern Status _XUnknownNativeEvent( - Display* /* dpy */, - XEvent* /* re */, - xEvent* /* event */ -); - -extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event); -extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we); -extern Bool _XPollfdCacheInit(Display *dpy); -extern void _XPollfdCacheAdd(Display *dpy, int fd); -extern void _XPollfdCacheDel(Display *dpy, int fd); -extern XID _XAllocID(Display *dpy); -extern void _XAllocIDs(Display *dpy, XID *ids, int count); - -extern int _XFreeExtData( - XExtData* /* extension */ -); - -extern int (*XESetCreateGC( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, GC, XExtCodes* -); - -extern int (*XESetCopyGC( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, GC, XExtCodes* -); - -extern int (*XESetFlushGC( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, GC, XExtCodes* -); - -extern int (*XESetFreeGC( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, GC, XExtCodes* -); - -extern int (*XESetCreateFont( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, XFontStruct*, XExtCodes* -); - -extern int (*XESetFreeFont( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, XFontStruct*, XExtCodes* -); - -extern int (*XESetCloseDisplay( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, XExtCodes* -); - -extern int (*XESetError( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - xError* /* err */, - XExtCodes* /* codes */, - int* /* ret_code */ - ) /* proc */ -))( - Display*, xError*, XExtCodes*, int* -); - -extern char* (*XESetErrorString( - Display* /* display */, - int /* extension */, - char* (*) ( - Display* /* display */, - int /* code */, - XExtCodes* /* codes */, - char* /* buffer */, - int /* nbytes */ - ) /* proc */ -))( - Display*, int, XExtCodes*, char*, int -); - -extern void (*XESetPrintErrorValues ( - Display* /* display */, - int /* extension */, - void (*)( - Display* /* display */, - XErrorEvent* /* ev */, - void* /* fp */ - ) /* proc */ -))( - Display*, XErrorEvent*, void* -); - -extern Bool (*XESetWireToEvent( - Display* /* display */, - int /* event_number */, - Bool (*) ( - Display* /* display */, - XEvent* /* re */, - xEvent* /* event */ - ) /* proc */ -))( - Display*, XEvent*, xEvent* -); - -extern Bool (*XESetWireToEventCookie( - Display* /* display */, - int /* extension */, - Bool (*) ( - Display* /* display */, - XGenericEventCookie* /* re */, - xEvent* /* event */ - ) /* proc */ -))( - Display*, XGenericEventCookie*, xEvent* -); - -extern Bool (*XESetCopyEventCookie( - Display* /* display */, - int /* extension */, - Bool (*) ( - Display* /* display */, - XGenericEventCookie* /* in */, - XGenericEventCookie* /* out */ - ) /* proc */ -))( - Display*, XGenericEventCookie*, XGenericEventCookie* -); - - -extern Status (*XESetEventToWire( - Display* /* display */, - int /* event_number */, - Status (*) ( - Display* /* display */, - XEvent* /* re */, - xEvent* /* event */ - ) /* proc */ -))( - Display*, XEvent*, xEvent* -); - -extern Bool (*XESetWireToError( - Display* /* display */, - int /* error_number */, - Bool (*) ( - Display* /* display */, - XErrorEvent* /* he */, - xError* /* we */ - ) /* proc */ -))( - Display*, XErrorEvent*, xError* -); - -extern void (*XESetBeforeFlush( - Display* /* display */, - int /* error_number */, - void (*) ( - Display* /* display */, - XExtCodes* /* codes */, - _Xconst char* /* data */, - long /* len */ - ) /* proc */ -))( - Display*, XExtCodes*, _Xconst char*, long -); - -/* internal connections for IMs */ - -typedef void (*_XInternalConnectionProc)( - Display* /* dpy */, - int /* fd */, - XPointer /* call_data */ -); - - -extern Status _XRegisterInternalConnection( - Display* /* dpy */, - int /* fd */, - _XInternalConnectionProc /* callback */, - XPointer /* call_data */ -); - -extern void _XUnregisterInternalConnection( - Display* /* dpy */, - int /* fd */ -); - -extern void _XProcessInternalConnection( - Display* /* dpy */, - struct _XConnectionInfo* /* conn_info */ -); - -/* Display structure has pointers to these */ - -struct _XConnectionInfo { /* info from _XRegisterInternalConnection */ - int fd; - _XInternalConnectionProc read_callback; - XPointer call_data; - XPointer *watch_data; /* set/used by XConnectionWatchProc */ - struct _XConnectionInfo *next; -}; - -struct _XConnWatchInfo { /* info from XAddConnectionWatch */ - XConnectionWatchProc fn; - XPointer client_data; - struct _XConnWatchInfo *next; -}; - -#ifdef __UNIXOS2__ -extern char* __XOS2RedirRoot( - char* -); -#endif - -extern int _XTextHeight( - XFontStruct* /* font_struct */, - _Xconst char* /* string */, - int /* count */ -); - -extern int _XTextHeight16( - XFontStruct* /* font_struct */, - _Xconst XChar2b* /* string */, - int /* count */ -); - -#if defined(WIN32) - -extern int _XOpenFile( - _Xconst char* /* path */, - int /* flags */ -); - -extern int _XOpenFileMode( - _Xconst char* /* path */, - int /* flags */, - mode_t /* mode */ -); - -extern void* _XFopenFile( - _Xconst char* /* path */, - _Xconst char* /* mode */ -); - -extern int _XAccessFile( - _Xconst char* /* path */ -); -#else -#define _XOpenFile(path,flags) open(path,flags) -#define _XOpenFileMode(path,flags,mode) open(path,flags,mode) -#define _XFopenFile(path,mode) fopen(path,mode) -#endif - -/* EvToWire.c */ -extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event); - -extern int _XF86LoadQueryLocaleFont( - Display* /* dpy */, - _Xconst char* /* name*/, - XFontStruct** /* xfp*/, - Font* /* fidp */ -); - -extern void _XProcessWindowAttributes ( - register Display *dpy, - xChangeWindowAttributesReq *req, - register unsigned long valuemask, - register XSetWindowAttributes *attributes); - -extern int _XDefaultError( - Display *dpy, - XErrorEvent *event); - -extern int _XDefaultIOError( - Display *dpy); - -extern void _XSetClipRectangles ( - register Display *dpy, - GC gc, - int clip_x_origin, int clip_y_origin, - XRectangle *rectangles, - int n, - int ordering); - -Status _XGetWindowAttributes( - register Display *dpy, - Window w, - XWindowAttributes *attr); - -int _XPutBackEvent ( - register Display *dpy, - register XEvent *event); - -extern Bool _XIsEventCookie( - Display *dpy, - XEvent *ev); - -extern void _XFreeEventCookies( - Display *dpy); - -extern void _XStoreEventCookie( - Display *dpy, - XEvent *ev); - -extern Bool _XFetchEventCookie( - Display *dpy, - XGenericEventCookie *ev); - -extern Bool _XCopyEventCookie( - Display *dpy, - XGenericEventCookie *in, - XGenericEventCookie *out); - -/* lcFile.c */ - -extern void xlocaledir( - char *buf, - int buf_len -); - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -_XFUNCPROTOEND - -#endif /* _X11_XLIBINT_H_ */ diff --git a/openflow/usr/include/X11/Xlocale.h b/openflow/usr/include/X11/Xlocale.h deleted file mode 100644 index db46e70..0000000 --- a/openflow/usr/include/X11/Xlocale.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifndef _X11_XLOCALE_H_ -#define _X11_XLOCALE_H_ - -#include -#include - -#include - -#endif /* _X11_XLOCALE_H_ */ diff --git a/openflow/usr/include/X11/Xmd.h b/openflow/usr/include/X11/Xmd.h deleted file mode 100644 index 492465e..0000000 --- a/openflow/usr/include/X11/Xmd.h +++ /dev/null @@ -1,142 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -#ifndef XMD_H -# define XMD_H 1 -/* - * Xmd.h: MACHINE DEPENDENT DECLARATIONS. - */ - -/* - * Special per-machine configuration flags. - */ -# if defined(__sun) && defined(__SVR4) -# include /* Solaris: defines _LP64 if necessary */ -# endif - -# if defined (_LP64) || defined(__LP64__) || \ - defined(__alpha) || defined(__alpha__) || \ - defined(__ia64__) || defined(ia64) || \ - defined(__sparc64__) || \ - defined(__s390x__) || \ - defined(__amd64__) || defined(amd64) || \ - defined(__powerpc64__) -# if !defined(__ILP32__) /* amd64-x32 is 32bit */ -# define LONG64 /* 32/64-bit architecture */ -# endif /* !__ILP32__ */ -# endif - -/* - * Definition of macro used to set constants for size of network structures; - * machines with preprocessors that can't handle all of the sz_ symbols - * can define this macro to be sizeof(x) if and only if their compiler doesn't - * pad out structures (esp. the xTextElt structure which contains only two - * one-byte fields). Network structures should always define sz_symbols. - * - * The sz_ prefix is used instead of something more descriptive so that the - * symbols are no more than 32 characters long (which causes problems for some - * compilers and preprocessors). - * - * The extra indirection is to get macro arguments to expand correctly before - * the concatenation, rather than afterward. - */ -# define _SIZEOF(x) sz_##x -# define SIZEOF(x) _SIZEOF(x) - -/* - * Bitfield suffixes for the protocol structure elements, if you - * need them. Note that bitfields are not guaranteed to be signed - * (or even unsigned) according to ANSI C. - */ -# define B32 /* bitfield not needed on architectures with native 32-bit type */ -# define B16 /* bitfield not needed on architectures with native 16-bit type */ -# ifdef LONG64 -typedef long INT64; -typedef int INT32; -# else -typedef long INT32; -# endif -typedef short INT16; - -typedef signed char INT8; - -# ifdef LONG64 -typedef unsigned long CARD64; -typedef unsigned int CARD32; -# else -typedef unsigned long long CARD64; -typedef unsigned long CARD32; -# endif -typedef unsigned short CARD16; -typedef unsigned char CARD8; - -typedef CARD32 BITS32; -typedef CARD16 BITS16; - -typedef CARD8 BYTE; -typedef CARD8 BOOL; - -/* - * was definitions for sign-extending bitfields on architectures without - * native types smaller than 64-bit, now just backwards compatibility - */ -# define cvtINT8toInt(val) (val) -# define cvtINT16toInt(val) (val) -# define cvtINT32toInt(val) (val) -# define cvtINT8toShort(val) (val) -# define cvtINT16toShort(val) (val) -# define cvtINT32toShort(val) (val) -# define cvtINT8toLong(val) (val) -# define cvtINT16toLong(val) (val) -# define cvtINT32toLong(val) (val) - -/* - * this version should leave result of type (t *), but that should only be - * used when not in MUSTCOPY - */ -# define NEXTPTR(p,t) (((t *)(p)) + 1) - -#endif /* XMD_H */ diff --git a/openflow/usr/include/X11/Xos.h b/openflow/usr/include/X11/Xos.h deleted file mode 100644 index 28dfc67..0000000 --- a/openflow/usr/include/X11/Xos.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * The X Window System is a Trademark of The Open Group. - * - */ - -/* This is a collection of things to try and minimize system dependencies - * in a "significant" number of source files. - */ - -#ifndef _XOS_H_ -# define _XOS_H_ - -# include - -/* - * Get major data types (esp. caddr_t) - */ - -# include - -# if defined(__SCO__) || defined(__UNIXWARE__) -# include -# endif - - -/* - * Just about everyone needs the strings routines. We provide both forms here, - * index/rindex and strchr/strrchr, so any systems that don't provide them all - * need to have #defines here. - * - * These macros are defined this way, rather than, e.g.: - * #defined index(s,c) strchr(s,c) - * because someone might be using them as function pointers, and such - * a change would break compatibility for anyone who's relying on them - * being the way they currently are. So we're stuck with them this way, - * which can be really inconvenient. :-( - */ - -# include -# if defined(__SCO__) || defined(__UNIXWARE__) || defined(__sun) || defined(__CYGWIN__) || defined(_AIX) || defined(__APPLE__) -# include -# else -# ifndef index -# define index(s,c) (strchr((s),(c))) -# endif -# ifndef rindex -# define rindex(s,c) (strrchr((s),(c))) -# endif -# endif - -/* - * Get open(2) constants - */ -# if defined(X_NOT_POSIX) -# include -# if defined(USL) || defined(__i386__) && (defined(SYSV) || defined(SVR4)) -# include -# endif -# ifdef WIN32 -# include -# else -# include -# endif -# else /* X_NOT_POSIX */ -# include -# include -# endif /* X_NOT_POSIX else */ - -/* - * Get struct timeval and struct tm - */ - -# if defined(_POSIX_SOURCE) && defined(SVR4) -/* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */ -# undef _POSIX_SOURCE -# include -# define _POSIX_SOURCE -# elif defined(WIN32) -# include -# if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_) && !defined(_TIMEVAL_DEFINED) && !defined(_STRUCT_TIMEVAL) -struct timeval { - long tv_sec; /* seconds */ - long tv_usec; /* and microseconds */ -}; -# define _TIMEVAL_DEFINED -# endif -# include -# define gettimeofday(t) \ -{ \ - struct _timeb _gtodtmp; \ - _ftime (&_gtodtmp); \ - (t)->tv_sec = _gtodtmp.time; \ - (t)->tv_usec = _gtodtmp.millitm * 1000; \ -} -# else -# include -# include -# endif /* defined(_POSIX_SOURCE) && defined(SVR4) */ - -/* define X_GETTIMEOFDAY macro, a portable gettimeofday() */ -# if defined(_XOPEN_XPG4) || defined(_XOPEN_UNIX) /* _XOPEN_UNIX is XPG4.2 */ -# define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) -# else -# if defined(SVR4) || defined(__SVR4) || defined(WIN32) -# define X_GETTIMEOFDAY(t) gettimeofday(t) -# else -# define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) -# endif -# endif /* XPG4 else */ - - -# ifdef __GNU__ -# define PATH_MAX 4096 -# define MAXPATHLEN 4096 -# define OPEN_MAX 256 /* We define a reasonable limit. */ -# endif - -/* use POSIX name for signal */ -# if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD) -# define SIGCHLD SIGCLD -# endif - -# include - -#endif /* _XOS_H_ */ diff --git a/openflow/usr/include/X11/Xos_r.h b/openflow/usr/include/X11/Xos_r.h deleted file mode 100644 index f963b64..0000000 --- a/openflow/usr/include/X11/Xos_r.h +++ /dev/null @@ -1,1095 +0,0 @@ -/* -Copyright 1996, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. -*/ - -/* - * Various and sundry Thread-Safe functions used by X11, Motif, and CDE. - * - * Use this file in MT-safe code where you would have included - * for readdir() - * for getgrgid() or getgrnam() - * for gethostbyname(), gethostbyaddr(), or getservbyname() - * for getpwnam() or getpwuid() - * for strtok() - * for asctime(), ctime(), localtime(), or gmtime() - * for getlogin() or ttyname() - * or their thread-safe analogs. - * - * If you are on a platform that defines XTHREADS but does not have - * MT-safe system API (e.g. UnixWare) you must define _Xos_processLock - * and _Xos_processUnlock macros before including this header. - * - * For convenience XOS_USE_XLIB_LOCKING or XOS_USE_XT_LOCKING may be defined - * to obtain either Xlib-only or Xt-based versions of these macros. These - * macros won't result in truly thread-safe calls, but they are better than - * nothing. If you do not want locking in this situation define - * XOS_USE_NO_LOCKING. - * - * NOTE: On systems lacking appropriate _r functions Gethostbyname(), - * Gethostbyaddr(), and Getservbyname() do NOT copy the host or - * protocol lists! - * - * NOTE: On systems lacking appropriate _r functions Getgrgid() and - * Getgrnam() do NOT copy the list of group members! - * - * This header is nominally intended to simplify porting X11, Motif, and - * CDE; it may be useful to other people too. The structure below is - * complicated, mostly because P1003.1c (the IEEE POSIX Threads spec) - * went through lots of drafts, and some vendors shipped systems based - * on draft API that were changed later. Unfortunately POSIX did not - * provide a feature-test macro for distinguishing each of the drafts. - */ - -/* - * This header has several parts. Search for "Effective prototypes" - * to locate the beginning of a section. - */ - -/* This header can be included multiple times with different defines! */ -#ifndef _XOS_R_H_ -# define _XOS_R_H_ - -# include -# include - -# ifndef X_NOT_POSIX -# ifdef _POSIX_SOURCE -# include -# else -# define _POSIX_SOURCE -# include -# undef _POSIX_SOURCE -# endif -# ifndef LINE_MAX -# define X_LINE_MAX 2048 -# else -# define X_LINE_MAX LINE_MAX -# endif -# endif -#endif /* _XOS_R_H */ - -#ifndef WIN32 - -#ifdef __cplusplus -extern "C" { -#endif - -# if defined(XOS_USE_XLIB_LOCKING) -# ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */ -typedef struct _LockInfoRec *LockInfoPtr; -extern LockInfoPtr _Xglobal_lock; -# endif -# ifndef _Xos_isThreadInitialized -# define _Xos_isThreadInitialized (_Xglobal_lock) -# endif -# if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -# ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */ -# include /* for NeedFunctionPrototypes */ -extern void (*_XLockMutex_fn)( -# if NeedFunctionPrototypes - LockInfoPtr /* lock */, char * /* file */, int /* line */ -# endif -); -extern void (*_XUnlockMutex_fn)( -# if NeedFunctionPrototypes - LockInfoPtr /* lock */, char * /* file */, int /* line */ -# endif -); -# endif -# ifndef _Xos_processLock -# define _Xos_processLock \ - (_XLockMutex_fn ? (*_XLockMutex_fn)(_Xglobal_lock,__FILE__,__LINE__) : 0) -# endif -# ifndef _Xos_processUnlock -# define _Xos_processUnlock \ - (_XUnlockMutex_fn ? (*_XUnlockMutex_fn)(_Xglobal_lock,__FILE__,__LINE__) : 0) -# endif -# else -# ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */ -# include /* for NeedFunctionPrototypes */ -extern void (*_XLockMutex_fn)( -# if NeedFunctionPrototypes - LockInfoPtr /* lock */ -# endif -); -extern void (*_XUnlockMutex_fn)( -# if NeedFunctionPrototypes - LockInfoPtr /* lock */ -# endif -); -# endif -# ifndef _Xos_processLock -# define _Xos_processLock \ - (_XLockMutex_fn ? ((*_XLockMutex_fn)(_Xglobal_lock), 0) : 0) -# endif -# ifndef _Xos_processUnlock -# define _Xos_processUnlock \ - (_XUnlockMutex_fn ? ((*_XUnlockMutex_fn)(_Xglobal_lock), 0) : 0) -# endif -# endif -# elif defined(XOS_USE_XT_LOCKING) -# ifndef _XtThreadsI_h -extern void (*_XtProcessLock)(void); -# endif -# ifndef _XtintrinsicP_h -# include /* for NeedFunctionPrototypes */ -extern void XtProcessLock( -# if NeedFunctionPrototypes - void -# endif -); -extern void XtProcessUnlock( -# if NeedFunctionPrototypes - void -# endif -); -# endif -# ifndef _Xos_isThreadInitialized -# define _Xos_isThreadInitialized _XtProcessLock -# endif -# ifndef _Xos_processLock -# define _Xos_processLock XtProcessLock() -# endif -# ifndef _Xos_processUnlock -# define _Xos_processUnlock XtProcessUnlock() -# endif -# elif defined(XOS_USE_NO_LOCKING) -# ifndef _Xos_isThreadInitialized -# define _Xos_isThreadInitialized 0 -# endif -# ifndef _Xos_processLock -# define _Xos_processLock 0 -# endif -# ifndef _Xos_processUnlock -# define _Xos_processUnlock 0 -# endif -# endif - -#endif /* !defined WIN32 */ - -/* - * Solaris defines the POSIX thread-safe feature test macro, but - * uses the older SVR4 thread-safe functions unless the POSIX ones - * are specifically requested. Fix the feature test macro. - */ -#if defined(__sun) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && \ - (_POSIX_C_SOURCE - 0 < 199506L) && !defined(_POSIX_PTHREAD_SEMANTICS) -# undef _POSIX_THREAD_SAFE_FUNCTIONS -#endif - -/***** wrappers *****/ - -/* - * Effective prototypes for wrappers: - * - * #define X_INCLUDE_PWD_H - * #define XOS_USE_..._LOCKING - * #include - * - * typedef ... _Xgetpwparams; - * - * struct passwd* _XGetpwnam(const char *name, _Xgetpwparams); - * struct passwd* _XGetpwuid(uid_t uid, _Xgetpwparams); - */ - -#if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H) -# include -# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_PWDAPI) -# define XOS_USE_MTSAFE_PWDAPI 1 -# endif -#endif - -#undef X_NEEDS_PWPARAMS -#if !defined(X_INCLUDE_PWD_H) || defined(_XOS_INCLUDED_PWD_H) -/* Do nothing */ - -#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) -/* Use regular, unsafe API. */ -# if defined(X_NOT_POSIX) && !defined(__i386__) && !defined(SYSV) -extern struct passwd *getpwuid(), *getpwnam(); -# endif -typedef int _Xgetpwparams; /* dummy */ -# define _XGetpwuid(u,p) getpwuid((u)) -# define _XGetpwnam(u,p) getpwnam((u)) - -#elif !defined(XOS_USE_MTSAFE_PWDAPI) || defined(XNO_MTSAFE_PWDAPI) -/* UnixWare 2.0, or other systems with thread support but no _r API. */ -# define X_NEEDS_PWPARAMS -typedef struct { - struct passwd pws; - char pwbuf[1024]; - struct passwd* pwp; - size_t len; -} _Xgetpwparams; - -/* - * NetBSD and FreeBSD, at least, are missing several of the unixware passwd - * fields. - */ - -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ - defined(__APPLE__) || defined(__DragonFly__) -static __inline__ void _Xpw_copyPasswd(_Xgetpwparams p) -{ - memcpy(&(p).pws, (p).pwp, sizeof(struct passwd)); - - (p).pws.pw_name = (p).pwbuf; - (p).len = strlen((p).pwp->pw_name); - strcpy((p).pws.pw_name, (p).pwp->pw_name); - - (p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1; - (p).len = strlen((p).pwp->pw_passwd); - strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd); - - (p).pws.pw_class = (p).pws.pw_passwd + (p).len + 1; - (p).len = strlen((p).pwp->pw_class); - strcpy((p).pws.pw_class, (p).pwp->pw_class); - - (p).pws.pw_gecos = (p).pws.pw_class + (p).len + 1; - (p).len = strlen((p).pwp->pw_gecos); - strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos); - - (p).pws.pw_dir = (p).pws.pw_gecos + (p).len + 1; - (p).len = strlen((p).pwp->pw_dir); - strcpy((p).pws.pw_dir, (p).pwp->pw_dir); - - (p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1; - (p).len = strlen((p).pwp->pw_shell); - strcpy((p).pws.pw_shell, (p).pwp->pw_shell); - - (p).pwp = &(p).pws; -} - -#else -# define _Xpw_copyPasswd(p) \ - (memcpy(&(p).pws, (p).pwp, sizeof(struct passwd)), \ - ((p).pws.pw_name = (p).pwbuf), \ - ((p).len = strlen((p).pwp->pw_name)), \ - strcpy((p).pws.pw_name, (p).pwp->pw_name), \ - ((p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1), \ - ((p).len = strlen((p).pwp->pw_passwd)), \ - strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd), \ - ((p).pws.pw_age = (p).pws.pw_passwd + (p).len + 1), \ - ((p).len = strlen((p).pwp->pw_age)), \ - strcpy((p).pws.pw_age, (p).pwp->pw_age), \ - ((p).pws.pw_comment = (p).pws.pw_age + (p).len + 1), \ - ((p).len = strlen((p).pwp->pw_comment)), \ - strcpy((p).pws.pw_comment, (p).pwp->pw_comment), \ - ((p).pws.pw_gecos = (p).pws.pw_comment + (p).len + 1), \ - ((p).len = strlen((p).pwp->pw_gecos)), \ - strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos), \ - ((p).pws.pw_dir = (p).pws.pw_comment + (p).len + 1), \ - ((p).len = strlen((p).pwp->pw_dir)), \ - strcpy((p).pws.pw_dir, (p).pwp->pw_dir), \ - ((p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1), \ - ((p).len = strlen((p).pwp->pw_shell)), \ - strcpy((p).pws.pw_shell, (p).pwp->pw_shell), \ - ((p).pwp = &(p).pws), \ - 0 ) -#endif -# define _XGetpwuid(u,p) \ -( (_Xos_processLock), \ - (((p).pwp = getpwuid((u))) ? _Xpw_copyPasswd(p), 0 : 0), \ - (_Xos_processUnlock), \ - (p).pwp ) -# define _XGetpwnam(u,p) \ -( (_Xos_processLock), \ - (((p).pwp = getpwnam((u))) ? _Xpw_copyPasswd(p), 0 : 0), \ - (_Xos_processUnlock), \ - (p).pwp ) - -#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__) -# define X_NEEDS_PWPARAMS -typedef struct { - struct passwd pws; - char pwbuf[X_LINE_MAX]; -} _Xgetpwparams; -# if defined(_POSIX_REENTRANT_FUNCTIONS) || !defined(SVR4) -# define _XGetpwuid(u,p) \ -((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) -# define _XGetpwnam(u,p) \ -((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) -# else /* SVR4 */ -# define _XGetpwuid(u,p) \ -((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws) -# define _XGetpwnam(u,p) \ -((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws) -# endif /* SVR4 */ - -#else /* _POSIX_THREAD_SAFE_FUNCTIONS */ -# define X_NEEDS_PWPARAMS -typedef struct { - struct passwd pws; - char pwbuf[X_LINE_MAX]; - struct passwd* pwp; -} _Xgetpwparams; -typedef int _Xgetpwret; -# define _XGetpwuid(u,p) \ -((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == 0) ? \ - (p).pwp : NULL) -# define _XGetpwnam(u,p) \ -((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == 0) ? \ - (p).pwp : NULL) -#endif /* X_INCLUDE_PWD_H */ - -#if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H) -# define _XOS_INCLUDED_PWD_H -#endif - - -/***** wrappers *****/ - -/* - * Effective prototypes for wrappers: - * - * NOTE: On systems lacking the appropriate _r functions Gethostbyname(), - * Gethostbyaddr(), and Getservbyname() do NOT copy the host or - * protocol lists! - * - * #define X_INCLUDE_NETDB_H - * #define XOS_USE_..._LOCKING - * #include - * - * typedef ... _Xgethostbynameparams; - * typedef ... _Xgetservbynameparams; - * - * struct hostent* _XGethostbyname(const char* name,_Xgethostbynameparams); - * struct hostent* _XGethostbyaddr(const char* addr, int len, int type, - * _Xgethostbynameparams); - * struct servent* _XGetservbyname(const char* name, const char* proto, - * _Xgetservbynameparams); - */ - -#undef XTHREADS_NEEDS_BYNAMEPARAMS -#if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H) \ - && !defined(WIN32) -# include -# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_NETDBAPI) -# define XOS_USE_MTSAFE_NETDBAPI 1 -# endif -#endif - -#if !defined(X_INCLUDE_NETDB_H) || defined(_XOS_INCLUDED_NETDB_H) -/* Do nothing. */ - -#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) -/* Use regular, unsafe API. */ -typedef int _Xgethostbynameparams; /* dummy */ -typedef int _Xgetservbynameparams; /* dummy */ -# define _XGethostbyname(h,hp) gethostbyname((h)) -# define _XGethostbyaddr(a,al,t,hp) gethostbyaddr((a),(al),(t)) -# define _XGetservbyname(s,p,sp) getservbyname((s),(p)) - -#elif !defined(XOS_USE_MTSAFE_NETDBAPI) || defined(XNO_MTSAFE_NETDBAPI) -/* WARNING: The h_addr_list and s_aliases values are *not* copied! */ - -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) -#include -#endif - -typedef struct { - struct hostent hent; - char h_name[MAXHOSTNAMELEN]; - struct hostent *hptr; -} _Xgethostbynameparams; -typedef struct { - struct servent sent; - char s_name[255]; - char s_proto[255]; - struct servent *sptr; -} _Xgetservbynameparams; - -# define XTHREADS_NEEDS_BYNAMEPARAMS - -# define _Xg_copyHostent(hp) \ - (memcpy(&(hp).hent, (hp).hptr, sizeof(struct hostent)), \ - strcpy((hp).h_name, (hp).hptr->h_name), \ - ((hp).hent.h_name = (hp).h_name), \ - ((hp).hptr = &(hp).hent), \ - 0 ) -# define _Xg_copyServent(sp) \ - (memcpy(&(sp).sent, (sp).sptr, sizeof(struct servent)), \ - strcpy((sp).s_name, (sp).sptr->s_name), \ - ((sp).sent.s_name = (sp).s_name), \ - strcpy((sp).s_proto, (sp).sptr->s_proto), \ - ((sp).sent.s_proto = (sp).s_proto), \ - ((sp).sptr = &(sp).sent), \ - 0 ) -# define _XGethostbyname(h,hp) \ - ((_Xos_processLock), \ - (((hp).hptr = gethostbyname((h))) ? _Xg_copyHostent(hp) : 0), \ - (_Xos_processUnlock), \ - (hp).hptr ) -# define _XGethostbyaddr(a,al,t,hp) \ - ((_Xos_processLock), \ - (((hp).hptr = gethostbyaddr((a),(al),(t))) ? _Xg_copyHostent(hp) : 0), \ - (_Xos_processUnlock), \ - (hp).hptr ) -# define _XGetservbyname(s,p,sp) \ - ((_Xos_processLock), \ - (((sp).sptr = getservbyname((s),(p))) ? _Xg_copyServent(sp) : 0), \ - (_Xos_processUnlock), \ - (sp).sptr ) - -#elif defined(XUSE_NETDB_R_API) -/* - * POSIX does not specify _r equivalents for API, but some - * vendors provide them anyway. Use them only when explicitly asked. - */ -# ifdef _POSIX_REENTRANT_FUNCTIONS -# ifndef _POSIX_THREAD_SAFE_FUNCTIONS -# endif -# endif -# ifdef _POSIX_THREAD_SAFE_FUNCTIONS -# define X_POSIX_THREAD_SAFE_FUNCTIONS 1 -# endif - -# define XTHREADS_NEEDS_BYNAMEPARAMS - -# ifndef X_POSIX_THREAD_SAFE_FUNCTIONS -typedef struct { - struct hostent hent; - char hbuf[X_LINE_MAX]; - int herr; -} _Xgethostbynameparams; -typedef struct { - struct servent sent; - char sbuf[X_LINE_MAX]; -} _Xgetservbynameparams; -# define _XGethostbyname(h,hp) \ - gethostbyname_r((h),&(hp).hent,(hp).hbuf,sizeof((hp).hbuf),&(hp).herr) -# define _XGethostbyaddr(a,al,t,hp) \ - gethostbyaddr_r((a),(al),(t),&(hp).hent,(hp).hbuf,sizeof((hp).hbuf),&(hp).herr) -# define _XGetservbyname(s,p,sp) \ - getservbyname_r((s),(p),&(sp).sent,(sp).sbuf,sizeof((sp).sbuf)) -# else -typedef struct { - struct hostent hent; - struct hostent_data hdata; -} _Xgethostbynameparams; -typedef struct { - struct servent sent; - struct servent_data sdata; -} _Xgetservbynameparams; -# define _XGethostbyname(h,hp) \ - (bzero((char*)&(hp).hdata,sizeof((hp).hdata)), \ - ((gethostbyname_r((h),&(hp).hent,&(hp).hdata) == -1) ? NULL : &(hp).hent)) -# define _XGethostbyaddr(a,al,t,hp) \ - (bzero((char*)&(hp).hdata,sizeof((hp).hdata)), \ - ((gethostbyaddr_r((a),(al),(t),&(hp).hent,&(hp).hdata) == -1) ? NULL : &(hp).hent)) -# define _XGetservbyname(s,p,sp) \ - (bzero((char*)&(sp).sdata,sizeof((sp).sdata)), \ - ((getservbyname_r((s),(p),&(sp).sent,&(sp).sdata) == -1) ? NULL : &(sp).sent) ) -# endif -# ifdef X_POSIX_THREAD_SAFE_FUNCTIONS -# undef X_POSIX_THREAD_SAFE_FUNCTIONS -# endif - -#else -/* The regular API is assumed to be MT-safe under POSIX. */ -typedef int _Xgethostbynameparams; /* dummy */ -typedef int _Xgetservbynameparams; /* dummy */ -# define _XGethostbyname(h,hp) gethostbyname((h)) -# define _XGethostbyaddr(a,al,t,hp) gethostbyaddr((a),(al),(t)) -# define _XGetservbyname(s,p,sp) getservbyname((s),(p)) -#endif /* X_INCLUDE_NETDB_H */ - -#if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H) -# define _XOS_INCLUDED_NETDB_H -#endif - - -/***** wrappers *****/ - -/* - * Effective prototypes for wrappers: - * - * #define X_INCLUDE_DIRENT_H - * #define XOS_USE_..._LOCKING - * #include - * - * typedef ... _Xreaddirparams; - * - * struct dirent *_XReaddir(DIR *dir_pointer, _Xreaddirparams); - */ - -#if defined(X_INCLUDE_DIRENT_H) && !defined(_XOS_INCLUDED_DIRENT_H) -# include -# if !defined(X_NOT_POSIX) || defined(SYSV) -# include -# else -# include -# ifndef dirent -# define dirent direct -# endif -# endif -# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_DIRENTAPI) -# define XOS_USE_MTSAFE_DIRENTAPI 1 -# endif -#endif - -#if !defined(X_INCLUDE_DIRENT_H) || defined(_XOS_INCLUDED_DIRENT_H) -/* Do nothing. */ - -#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) -/* Use regular, unsafe API. */ -typedef int _Xreaddirparams; /* dummy */ -# define _XReaddir(d,p) readdir(d) - -#elif !defined(XOS_USE_MTSAFE_DIRENTAPI) || defined(XNO_MTSAFE_DIRENTAPI) -/* Systems with thread support but no _r API. */ -typedef struct { - struct dirent *result; - struct dirent dir_entry; -# ifdef _POSIX_PATH_MAX - char buf[_POSIX_PATH_MAX]; -# elif defined(NAME_MAX) - char buf[NAME_MAX]; -# else - char buf[255]; -# endif -} _Xreaddirparams; - -# define _XReaddir(d,p) \ - ( (_Xos_processLock), \ - (((p).result = readdir((d))) ? \ - (memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen), \ - ((p).result = &(p).dir_entry), 0) : \ - 0), \ - (_Xos_processUnlock), \ - (p).result ) - -#else -typedef struct { - struct dirent *result; - struct dirent dir_entry; -# ifdef _POSIX_PATH_MAX - char buf[_POSIX_PATH_MAX]; -# elif defined(NAME_MAX) - char buf[NAME_MAX]; -# else - char buf[255]; -# endif -} _Xreaddirparams; - -# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(__APPLE__) -/* POSIX final API, returns (int)0 on success. */ -# define _XReaddir(d,p) \ - (readdir_r((d), &((p).dir_entry), &((p).result)) ? NULL : (p).result) -# elif defined(_POSIX_REENTRANT_FUNCTIONS) -/* POSIX draft API, returns (int)0 on success. */ -# define _XReaddir(d,p) \ - (readdir_r((d),&((p).dir_entry)) ? NULL : &((p).dir_entry)) -# elif defined(SVR4) -/* Pre-POSIX API, returns non-NULL on success. */ -# define _XReaddir(d,p) (readdir_r((d), &(p).dir_entry)) -# else -/* We have no idea what is going on. Fake it all using process locks. */ -# define _XReaddir(d,p) \ - ( (_Xos_processLock), \ - (((p).result = readdir((d))) ? \ - (memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen), \ - ((p).result = &(p).dir_entry), 0) : \ - 0), \ - (_Xos_processUnlock), \ - (p).result ) -# endif -#endif /* X_INCLUDE_DIRENT_H */ - -#if defined(X_INCLUDE_DIRENT_H) && !defined(_XOS_INCLUDED_DIRENT_H) -# define _XOS_INCLUDED_DIRENT_H -#endif - - -/***** wrappers *****/ - -/* - * Effective prototypes for wrappers: - * - * #define X_INCLUDE_UNISTD_H - * #define XOS_USE_..._LOCKING - * #include - * - * typedef ... _Xgetloginparams; - * typedef ... _Xttynameparams; - * - * char *_XGetlogin(_Xgetloginparams); - * char *_XTtyname(int, _Xttynameparams); - */ - -#if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H) -/* already included by */ -# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_UNISTDAPI) -# define XOS_USE_MTSAFE_UNISTDAPI 1 -# endif -#endif - -#if !defined(X_INCLUDE_UNISTD_H) || defined(_XOS_INCLUDED_UNISTD_H) -/* Do nothing. */ - -#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) -/* Use regular, unsafe API. */ -typedef int _Xgetloginparams; /* dummy */ -typedef int _Xttynameparams; /* dummy */ -# define _XGetlogin(p) getlogin() -# define _XTtyname(f) ttyname((f)) - -#elif !defined(XOS_USE_MTSAFE_UNISTDAPI) || defined(XNO_MTSAFE_UNISTDAPI) -/* Systems with thread support but no _r API. */ -typedef struct { - char *result; -# if defined(MAXLOGNAME) - char buf[MAXLOGNAME]; -# elif defined(LOGIN_NAME_MAX) - char buf[LOGIN_NAME_MAX]; -# else - char buf[64]; -# endif -} _Xgetloginparams; -typedef struct { - char *result; -# ifdef TTY_NAME_MAX - char buf[TTY_NAME_MAX]; -# elif defined(_POSIX_TTY_NAME_MAX) - char buf[_POSIX_TTY_NAME_MAX]; -# elif defined(_POSIX_PATH_MAX) - char buf[_POSIX_PATH_MAX]; -# else - char buf[256]; -# endif -} _Xttynameparams; - -# define _XGetlogin(p) \ - ( (_Xos_processLock), \ - (((p).result = getlogin()) ? \ - (strncpy((p).buf, (p).result, sizeof((p).buf)), \ - ((p).buf[sizeof((p).buf)-1] = '\0'), \ - ((p).result = (p).buf), 0) : 0), \ - (_Xos_processUnlock), \ - (p).result ) -#define _XTtyname(f,p) \ - ( (_Xos_processLock), \ - (((p).result = ttyname(f)) ? \ - (strncpy((p).buf, (p).result, sizeof((p).buf)), \ - ((p).buf[sizeof((p).buf)-1] = '\0'), \ - ((p).result = (p).buf), 0) : 0), \ - (_Xos_processUnlock), \ - (p).result ) - -#elif defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_POSIX_REENTRANT_FUNCTIONS) -/* POSIX API. - * - * extern int getlogin_r(char *, size_t); - * extern int ttyname_r(int, char *, size_t); - */ -typedef struct { -# if defined(MAXLOGNAME) - char buf[MAXLOGNAME]; -# elif defined(LOGIN_NAME_MAX) - char buf[LOGIN_NAME_MAX]; -# else - char buf[64]; -# endif -} _Xgetloginparams; -typedef struct { -# ifdef TTY_NAME_MAX - char buf[TTY_NAME_MAX]; -# elif defined(_POSIX_TTY_NAME_MAX) - char buf[_POSIX_TTY_NAME_MAX]; -# elif defined(_POSIX_PATH_MAX) - char buf[_POSIX_PATH_MAX]; -# else - char buf[256]; -# endif -} _Xttynameparams; - -# define _XGetlogin(p) (getlogin_r((p).buf, sizeof((p).buf)) ? NULL : (p).buf) -# define _XTtyname(f,p) \ - (ttyname_r((f), (p).buf, sizeof((p).buf)) ? NULL : (p).buf) - -#else -/* Pre-POSIX API. - * - * extern char *getlogin_r(char *, size_t); - * extern char *ttyname_r(int, char *, size_t); - */ -typedef struct { -# if defined(MAXLOGNAME) - char buf[MAXLOGNAME]; -# elif defined(LOGIN_NAME_MAX) - char buf[LOGIN_NAME_MAX]; -# else - char buf[64]; -# endif -} _Xgetloginparams; -typedef struct { -# ifdef TTY_NAME_MAX - char buf[TTY_NAME_MAX]; -# elif defined(_POSIX_TTY_NAME_MAX) - char buf[_POSIX_TTY_NAME_MAX]; -# elif defined(_POSIX_PATH_MAX) - char buf[_POSIX_PATH_MAX]; -# else - char buf[256]; -# endif -} _Xttynameparams; - -# define _XGetlogin(p) getlogin_r((p).buf, sizeof((p).buf)) -# define _XTtyname(f,p) ttyname_r((f), (p).buf, sizeof((p).buf)) -#endif /* X_INCLUDE_UNISTD_H */ - -#if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H) -# define _XOS_INCLUDED_UNISTD_H -#endif - - -/***** wrappers *****/ - -/* - * Effective prototypes for wrappers: - * - * #define X_INCLUDE_STRING_H - * #define XOS_USE_..._LOCKING - * #include - * - * typedef ... _Xstrtokparams; - * - * char *_XStrtok(char *, const char*, _Xstrtokparams); - */ - -#if defined(X_INCLUDE_STRING_H) && !defined(_XOS_INCLUDED_STRING_H) -/* has already been included by */ -# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_STRINGAPI) -# define XOS_USE_MTSAFE_STRINGAPI 1 -# endif -#endif - -#if !defined(X_INCLUDE_STRING_H) || defined(_XOS_INCLUDED_STRING_H) -/* Do nothing. */ - -#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) -/* Use regular, unsafe API. */ -typedef int _Xstrtokparams; /* dummy */ -# define _XStrtok(s1,s2,p) \ - ( p = 0, (void)p, strtok((s1),(s2)) ) - -#elif !defined(XOS_USE_MTSAFE_STRINGAPI) || defined(XNO_MTSAFE_STRINGAPI) -/* Systems with thread support but no _r API. */ -typedef char *_Xstrtokparams; -# define _XStrtok(s1,s2,p) \ - ( (_Xos_processLock), \ - ((p) = strtok((s1),(s2))), \ - (_Xos_processUnlock), \ - (p) ) - -#else -/* POSIX or pre-POSIX API. */ -typedef char * _Xstrtokparams; -# define _XStrtok(s1,s2,p) strtok_r((s1),(s2),&(p)) -#endif /* X_INCLUDE_STRING_H */ - - -/***** wrappers *****/ - -/* - * Effective prototypes for wrappers: - * - * #define X_INCLUDE_TIME_H - * #define XOS_USE_..._LOCKING - * #include - * - * typedef ... _Xatimeparams; - * typedef ... _Xctimeparams; - * typedef ... _Xgtimeparams; - * typedef ... _Xltimeparams; - * - * char *_XAsctime(const struct tm *, _Xatimeparams); - * char *_XCtime(const time_t *, _Xctimeparams); - * struct tm *_XGmtime(const time_t *, _Xgtimeparams); - * struct tm *_XLocaltime(const time_t *, _Xltimeparams); - */ - -#if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H) -# include -# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_TIMEAPI) -# define XOS_USE_MTSAFE_TIMEAPI 1 -# endif -#endif - -#if !defined(X_INCLUDE_TIME_H) || defined(_XOS_INCLUDED_TIME_H) -/* Do nothing. */ - -#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) -/* Use regular, unsafe API. */ -typedef int _Xatimeparams; /* dummy */ -# define _XAsctime(t,p) asctime((t)) -typedef int _Xctimeparams; /* dummy */ -# define _XCtime(t,p) ctime((t)) -typedef int _Xgtimeparams; /* dummy */ -# define _XGmtime(t,p) gmtime((t)) -typedef int _Xltimeparams; /* dummy */ -# define _XLocaltime(t,p) localtime((t)) - -#elif !defined(XOS_USE_MTSAFE_TIMEAPI) || defined(XNO_MTSAFE_TIMEAPI) -/* Systems with thread support but no _r API. */ -typedef struct { -# ifdef TIMELEN - char buf[TIMELEN]; -# else - char buf[26]; -# endif - char *result; -} _Xctimeparams, _Xatimeparams; -typedef struct { - struct tm buf; - struct tm *result; -} _Xgtimeparams, _Xltimeparams; -# define _XAsctime(t,p) \ - ( (_Xos_processLock), \ - (((p).result = asctime((t))) ? \ - (strncpy((p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ - 0), \ - (_Xos_processUnlock), \ - (p).result ) -# define _XCtime(t,p) \ - ( (_Xos_processLock), \ - (((p).result = ctime((t))) ? \ - (strncpy((p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ - 0), \ - (_Xos_processUnlock), \ - (p).result ) -# define _XGmtime(t,p) \ - ( (_Xos_processLock), \ - (((p).result = gmtime(t)) ? \ - (memcpy(&(p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ - 0), \ - (_Xos_processUnlock), \ - (p).result ) -# define _XLocaltime(t,p) \ - ( (_Xos_processLock), \ - (((p).result = localtime(t)) ? \ - (memcpy(&(p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ - 0), \ - (_Xos_processUnlock), \ - (p).result ) - -#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(hpV4) -/* Returns (int)0 on success. - * - * extern int asctime_r(const struct tm *timeptr, char *buffer, int buflen); - * extern int ctime_r(const time_t *timer, char *buffer, int buflen); - * extern int gmtime_r(const time_t *timer, struct tm *result); - * extern int localtime_r(const time_t *timer, struct tm *result); - */ -# ifdef TIMELEN -typedef char _Xatimeparams[TIMELEN]; -typedef char _Xctimeparams[TIMELEN]; -# else -typedef char _Xatimeparams[26]; -typedef char _Xctimeparams[26]; -# endif -typedef struct tm _Xgtimeparams; -typedef struct tm _Xltimeparams; -# define _XAsctime(t,p) (asctime_r((t),(p),sizeof((p))) ? NULL : (p)) -# define _XCtime(t,p) (ctime_r((t),(p),sizeof((p))) ? NULL : (p)) -# define _XGmtime(t,p) (gmtime_r((t),&(p)) ? NULL : &(p)) -# define _XLocaltime(t,p) (localtime_r((t),&(p)) ? NULL : &(p)) - -#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(__sun) -/* Returns NULL on failure. Solaris 2.5 - * - * extern char *asctime_r(const struct tm *tm,char *buf, int buflen); - * extern char *ctime_r(const time_t *clock, char *buf, int buflen); - * extern struct tm *gmtime_r(const time_t *clock, struct tm *res); - * extern struct tm *localtime_r(const time_t *clock, struct tm *res); - */ -# ifdef TIMELEN -typedef char _Xatimeparams[TIMELEN]; -typedef char _Xctimeparams[TIMELEN]; -# else -typedef char _Xatimeparams[26]; -typedef char _Xctimeparams[26]; -# endif -typedef struct tm _Xgtimeparams; -typedef struct tm _Xltimeparams; -# define _XAsctime(t,p) asctime_r((t),(p),sizeof((p))) -# define _XCtime(t,p) ctime_r((t),(p),sizeof((p))) -# define _XGmtime(t,p) gmtime_r((t),&(p)) -# define _XLocaltime(t,p) localtime_r((t),&(p)) - -#else /* defined(_POSIX_THREAD_SAFE_FUNCTIONS) */ -/* POSIX final API. - * extern char *asctime_r(const struct tm *timeptr, char *buffer); - * extern char *ctime_r(const time_t *timer, char *buffer); - * extern struct tm *gmtime_r(const time_t *timer, struct tm *result); - * extern struct tm *localtime_r(const time_t *timer, struct tm *result); - */ -# ifdef TIMELEN -typedef char _Xatimeparams[TIMELEN]; -typedef char _Xctimeparams[TIMELEN]; -# else -typedef char _Xatimeparams[26]; -typedef char _Xctimeparams[26]; -# endif -typedef struct tm _Xgtimeparams; -typedef struct tm _Xltimeparams; -# define _XAsctime(t,p) asctime_r((t),(p)) -# define _XCtime(t,p) ctime_r((t),(p)) -# define _XGmtime(t,p) gmtime_r((t),&(p)) -# define _XLocaltime(t,p) localtime_r((t),&(p)) -#endif /* X_INCLUDE_TIME_H */ - -#if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H) -# define _XOS_INCLUDED_TIME_H -#endif - - -/***** wrappers *****/ - -/* - * Effective prototypes for wrappers: - * - * NOTE: On systems lacking appropriate _r functions Getgrgid() and - * Getgrnam() do NOT copy the list of group members! - * - * Remember that fgetgrent(), setgrent(), getgrent(), and endgrent() - * are not included in POSIX. - * - * #define X_INCLUDE_GRP_H - * #define XOS_USE_..._LOCKING - * #include - * - * typedef ... _Xgetgrparams; - * - * struct group *_XGetgrgid(gid_t, _Xgetgrparams); - * struct group *_XGetgrnam(const char *, _Xgetgrparams); - */ - -#if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H) -# include -# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_GRPAPI) -# define XOS_USE_MTSAFE_GRPAPI 1 -# endif -#endif - -#if !defined(X_INCLUDE_GRP_H) || defined(_XOS_INCLUDED_GRP_H) -/* Do nothing. */ - -#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) -/* Use regular, unsafe API. */ -typedef int _Xgetgrparams; /* dummy */ -#define _XGetgrgid(g,p) getgrgid((g)) -#define _XGetgrnam(n,p) getgrnam((n)) - -#elif !defined(XOS_USE_MTSAFE_GRPAPI) || defined(XNO_MTSAFE_GRPAPI) -/* Systems with thread support but no _r API. UnixWare 2.0. */ -typedef struct { - struct group grp; - char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ - struct group *pgrp; - size_t len; -} _Xgetgrparams; -#ifdef SVR4 -/* Copy the gr_passwd field too. */ -# define _Xgrp_copyGroup(p) \ - ( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \ - ((p).grp.gr_name = (p).buf), \ - ((p).len = strlen((p).pgrp->gr_name)), \ - strcpy((p).grp.gr_name, (p).pgrp->gr_name), \ - ((p).grp.gr_passwd = (p).grp.gr_name + (p).len + 1), \ - ((p).pgrp = &(p).grp), \ - 0 ) -#else -# define _Xgrp_copyGroup(p) \ - ( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \ - ((p).grp.gr_name = (p).buf), \ - strcpy((p).grp.gr_name, (p).pgrp->gr_name), \ - ((p).pgrp = &(p).grp), \ - 0 ) -#endif -#define _XGetgrgid(g,p) \ - ( (_Xos_processLock), \ - (((p).pgrp = getgrgid((g))) ? _Xgrp_copyGroup(p) : 0), \ - (_Xos_processUnlock), \ - (p).pgrp ) -#define _XGetgrnam(n,p) \ - ( (_Xos_processLock), \ - (((p).pgrp = getgrnam((n))) ? _Xgrp_copyGroup(p) : 0), \ - (_Xos_processUnlock), \ - (p).pgrp ) - -#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(__sun) -/* Non-POSIX API. Solaris. - * - * extern struct group *getgrgid_r(gid_t, struct group *, char *, int); - * extern struct group *getgrnam_r(const char *, struct group *, char *, int); - */ -typedef struct { - struct group grp; - char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ -} _Xgetgrparams; -#define _XGetgrgid(g,p) getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf)) -#define _XGetgrnam(n,p) getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf)) - -#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) -/* Non-POSIX API. - * extern int getgrgid_r(gid_t, struct group *, char *, int); - * extern int getgrnam_r(const char *, struct group *, char *, int); - */ -typedef struct { - struct group grp; - char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ -} _Xgetgrparams; -#define _XGetgrgid(g,p) \ - ((getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf)) ? NULL : &(p).grp)) -#define _XGetgrnam(n,p) \ - ((getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf)) ? NULL : &(p).grp)) - -#else -/* POSIX final API. - * - * int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **); - * int getgrnam_r(const char *, struct group *, char *, size_t, struct group **); - */ -typedef struct { - struct group grp; - char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ - struct group *result; -} _Xgetgrparams; - -#define _XGetgrgid(g,p) \ - ((getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf), &(p).result) ? \ - NULL : (p).result)) -#define _XGetgrnam(n,p) \ - ((getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf), &(p).result) ? \ - NULL : (p).result)) -#endif - -#if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H) -# define _XOS_INCLUDED_GRP_H -#endif - - -#ifdef __cplusplus -} /* Close scope of 'extern "C"' declaration which encloses file. */ -#endif diff --git a/openflow/usr/include/X11/Xosdefs.h b/openflow/usr/include/X11/Xosdefs.h deleted file mode 100644 index 33eaee4..0000000 --- a/openflow/usr/include/X11/Xosdefs.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * O/S-dependent (mis)feature macro definitions - * -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - */ - -#ifndef _XOSDEFS_H_ -# define _XOSDEFS_H_ - -/* - * X_NOT_POSIX means does not have POSIX header files. Lack of this - * symbol does NOT mean that the POSIX environment is the default. - * You may still have to define _POSIX_SOURCE to get it. - */ - - -# ifdef _SCO_DS -# ifndef __SCO__ -# define __SCO__ -# endif -# endif - -# ifdef __i386__ -# ifdef SYSV -# if !defined(__SCO__) && \ - !defined(__UNIXWARE__) && !defined(__sun) -# if !defined(_POSIX_SOURCE) -# define X_NOT_POSIX -# endif -# endif -# endif -# endif - -# ifdef __sun -/* Imake configs define SVR4 on Solaris, but cc & gcc only define __SVR4 - * This check allows non-Imake configured programs to build correctly. - */ -# if defined(__SVR4) && !defined(SVR4) -# define SVR4 1 -# endif -# ifdef SVR4 -/* define this to whatever it needs to be */ -# define X_POSIX_C_SOURCE 199300L -# endif -# endif - -# ifdef WIN32 -# ifndef _POSIX_ -# define X_NOT_POSIX -# endif -# endif - - -# ifdef __APPLE__ -# define NULL_NOT_ZERO - -/* Defining any of these will sanitize the namespace to JUST want is defined by - * that particular standard. If that happens, we don't get some expected - * prototypes, typedefs, etc (like fd_mask). We can define _DARWIN_C_SOURCE to - * loosen our belts a tad. - */ -# if defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) -# ifndef _DARWIN_C_SOURCE -# define _DARWIN_C_SOURCE -# endif -# endif - -# endif - -# ifdef __GNU__ -# ifndef PATH_MAX -# define PATH_MAX 4096 -# endif -# ifndef MAXPATHLEN -# define MAXPATHLEN 4096 -# endif -# endif - -# if defined(__SCO__) || defined(__UNIXWARE__) -# ifndef PATH_MAX -# define PATH_MAX 1024 -# endif -# ifndef MAXPATHLEN -# define MAXPATHLEN 1024 -# endif -# endif - -# if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) \ - || defined(__APPLE__) || defined(__DragonFly__) -# ifndef CSRG_BASED -# define CSRG_BASED -# endif -# endif - -#endif /* _XOSDEFS_H_ */ - diff --git a/openflow/usr/include/X11/Xpoll.h b/openflow/usr/include/X11/Xpoll.h deleted file mode 100644 index 0940865..0000000 --- a/openflow/usr/include/X11/Xpoll.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - -Copyright 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* - * Copyright © 2005 Daniel Stone - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Daniel Stone not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. Daniel Stone makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * DANIEL STONE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * DANIEL STONE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR - * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#ifndef _XPOLL_H_ -#define _XPOLL_H_ - -#if !defined(WIN32) || defined(__CYGWIN__) - -#ifndef USE_POLL - -#include - -#include /* Get the FD_* macros. */ - -#include - -#ifdef CSRG_BASED -#include -# if BSD < 199103 -typedef long fd_mask; -# endif -#endif - -#if defined(FD_SETSIZE) && FD_SETSIZE < 512 -# define XFD_SETSIZE FD_SETSIZE -#else -# define XFD_SETSIZE 512 -# ifndef FD_SETSIZE -# define FD_SETSIZE XFD_SETSIZE -# endif -#endif - -#ifndef NBBY -#define NBBY 8 /* number of bits in a byte */ -#endif - -#ifndef NFDBITS -#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ -#endif - -#ifndef howmany -#define howmany(x,y) (((x)+((y)-1))/(y)) -#endif - -#if defined(BSD) && BSD < 198911 -typedef struct fd_set { - fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; -} fd_set; -#endif - -# define Select(n,r,w,e,t) select(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t) - -#define __X_FDS_BITS __fds_bits - -#ifndef __FDS_BITS -# define __FDS_BITS(p) ((p)->__X_FDS_BITS) -#endif - -#define __XFDS_BITS(p, n) (__FDS_BITS(p))[n] - -#ifndef FD_SET -#define FD_SET(n, p) (__XFDS_BITS(p, ((n)/NFDBITS)) |= ((fd_mask)1 << ((n) % NFDBITS))) -#endif -#ifndef FD_CLR -#define FD_CLR(n, p) (__XFDS_BITS((p), ((n)/NFDBITS)) &= ~((fd_mask)1 << ((n) % NFDBITS))) -#endif -#ifndef FD_ISSET -#define FD_ISSET(n, p) ((__XFDS_BITS((p), ((n)/NFDBITS))) & ((fd_mask)1 << ((n) % NFDBITS))) -#endif -#ifndef FD_ZERO -#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) -#endif - -/* - * The howmany(FD_SETSIZE, NFDBITS) computes the number of elements in the - * array. before accessing an element in the array we check it exists. - * If it does not exist then the compiler discards the code to access it. - */ -#define XFD_ANYSET(p) \ - ((howmany(FD_SETSIZE, NFDBITS) > 0 && (__XFDS_BITS(p, 0))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 1 && (__XFDS_BITS(p, 1))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 2 && (__XFDS_BITS(p, 2))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 3 && (__XFDS_BITS(p, 3))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 4 && (__XFDS_BITS(p, 4))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 5 && (__XFDS_BITS(p, 5))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 6 && (__XFDS_BITS(p, 6))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 7 && (__XFDS_BITS(p, 7))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 8 && (__XFDS_BITS(p, 8))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 9 && (__XFDS_BITS(p, 9))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 10 && (__XFDS_BITS(p, 10))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 11 && (__XFDS_BITS(p, 11))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 12 && (__XFDS_BITS(p, 12))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 13 && (__XFDS_BITS(p, 13))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 14 && (__XFDS_BITS(p, 14))) || \ - (howmany(FD_SETSIZE, NFDBITS) > 15 && (__XFDS_BITS(p, 15)))) - - -#define XFD_COPYSET(src,dst) { \ - int __i__; \ - for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \ - __XFDS_BITS((dst), __i__) = __XFDS_BITS((src), __i__); \ - } -#define XFD_ANDSET(dst,b1,b2) { \ - int __i__; \ - for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \ - __XFDS_BITS((dst), __i__) = ((__XFDS_BITS((b1), __i__)) & (__XFDS_BITS((b2), __i__))); \ - } -#define XFD_ORSET(dst,b1,b2) { \ - int __i__; \ - for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \ - __XFDS_BITS((dst), __i__) = ((__XFDS_BITS((b1), __i__)) | (__XFDS_BITS((b2), __i__))); \ - } -#define XFD_UNSET(dst,b1) { \ - int __i__; \ - for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \ - __XFDS_BITS((dst), __i__) &= ~(__XFDS_BITS((b1), __i__)); \ - } - -#else /* USE_POLL */ -#include -#endif /* USE_POLL */ - -#else /* WIN32 */ - -#define XFD_SETSIZE 512 -#ifndef FD_SETSIZE -#define FD_SETSIZE XFD_SETSIZE -#endif -#include - -#define Select(n,r,w,e,t) select(0,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t) - -#define XFD_SETCOUNT(p) (((fd_set FAR *)(p))->fd_count) -#define XFD_FD(p,i) (((fd_set FAR *)(p))->fd_array[i]) -#define XFD_ANYSET(p) XFD_SETCOUNT(p) - -#define XFD_COPYSET(src,dst) { \ - u_int __i; \ - FD_ZERO(dst); \ - for (__i = 0; __i < XFD_SETCOUNT(src) ; __i++) { \ - XFD_FD(dst,__i) = XFD_FD(src,__i); \ - } \ - XFD_SETCOUNT(dst) = XFD_SETCOUNT(src); \ -} - -#define XFD_ANDSET(dst,b1,b2) { \ - u_int __i; \ - FD_ZERO(dst); \ - for (__i = 0; __i < XFD_SETCOUNT(b1) ; __i++) { \ - if (FD_ISSET(XFD_FD(b1,__i), b2)) \ - FD_SET(XFD_FD(b1,__i), dst); \ - } \ -} - -#define XFD_ORSET(dst,b1,b2) { \ - u_int __i; \ - if (dst != b1) XFD_COPYSET(b1,dst); \ - for (__i = 0; __i < XFD_SETCOUNT(b2) ; __i++) { \ - if (!FD_ISSET(XFD_FD(b2,__i), dst)) \ - FD_SET(XFD_FD(b2,__i), dst); \ - } \ -} - -/* this one is really sub-optimal */ -#define XFD_UNSET(dst,b1) { \ - u_int __i; \ - for (__i = 0; __i < XFD_SETCOUNT(b1) ; __i++) { \ - FD_CLR(XFD_FD(b1,__i), dst); \ - } \ -} - -/* we have to pay the price of having an array here, unlike with bitmasks - calling twice FD_SET with the same fd is not transparent, so be careful */ -#undef FD_SET -#define FD_SET(fd,set) do { \ - if (XFD_SETCOUNT(set) < FD_SETSIZE && !FD_ISSET(fd,set)) \ - XFD_FD(set,XFD_SETCOUNT(set)++)=(fd); \ -} while(0) - -#define getdtablesize() FD_SETSIZE - -#endif /* WIN32 */ - -#endif /* _XPOLL_H_ */ diff --git a/openflow/usr/include/X11/Xproto.h b/openflow/usr/include/X11/Xproto.h deleted file mode 100644 index 6cdea89..0000000 --- a/openflow/usr/include/X11/Xproto.h +++ /dev/null @@ -1,2157 +0,0 @@ -/* Definitions for the X window system used by server and c bindings */ - -/* - * This packet-construction scheme makes the following assumptions: - * - * 1. The compiler is able - * to generate code which addresses one- and two-byte quantities. - * In the worst case, this would be done with bit-fields. If bit-fields - * are used it may be necessary to reorder the request fields in this file, - * depending on the order in which the machine assigns bit fields to - * machine words. There may also be a problem with sign extension, - * as K+R specify that bitfields are always unsigned. - * - * 2. 2- and 4-byte fields in packet structures must be ordered by hand - * such that they are naturally-aligned, so that no compiler will ever - * insert padding bytes. - * - * 3. All packets are hand-padded to a multiple of 4 bytes, for - * the same reason. - */ - -#ifndef XPROTO_H -#define XPROTO_H - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#include -#include - -/* - * Define constants for the sizes of the network packets. The sz_ prefix is - * used instead of something more descriptive so that the symbols are no more - * than 32 characters in length (which causes problems for some compilers). - */ -#define sz_xSegment 8 -#define sz_xPoint 4 -#define sz_xRectangle 8 -#define sz_xArc 12 -#define sz_xConnClientPrefix 12 -#define sz_xConnSetupPrefix 8 -#define sz_xConnSetup 32 -#define sz_xPixmapFormat 8 -#define sz_xDepth 8 -#define sz_xVisualType 24 -#define sz_xWindowRoot 40 -#define sz_xTimecoord 8 -#define sz_xHostEntry 4 -#define sz_xCharInfo 12 -#define sz_xFontProp 8 -#define sz_xTextElt 2 -#define sz_xColorItem 12 -#define sz_xrgb 8 -#define sz_xGenericReply 32 -#define sz_xGetWindowAttributesReply 44 -#define sz_xGetGeometryReply 32 -#define sz_xQueryTreeReply 32 -#define sz_xInternAtomReply 32 -#define sz_xGetAtomNameReply 32 -#define sz_xGetPropertyReply 32 -#define sz_xListPropertiesReply 32 -#define sz_xGetSelectionOwnerReply 32 -#define sz_xGrabPointerReply 32 -#define sz_xQueryPointerReply 32 -#define sz_xGetMotionEventsReply 32 -#define sz_xTranslateCoordsReply 32 -#define sz_xGetInputFocusReply 32 -#define sz_xQueryKeymapReply 40 -#define sz_xQueryFontReply 60 -#define sz_xQueryTextExtentsReply 32 -#define sz_xListFontsReply 32 -#define sz_xGetFontPathReply 32 -#define sz_xGetImageReply 32 -#define sz_xListInstalledColormapsReply 32 -#define sz_xAllocColorReply 32 -#define sz_xAllocNamedColorReply 32 -#define sz_xAllocColorCellsReply 32 -#define sz_xAllocColorPlanesReply 32 -#define sz_xQueryColorsReply 32 -#define sz_xLookupColorReply 32 -#define sz_xQueryBestSizeReply 32 -#define sz_xQueryExtensionReply 32 -#define sz_xListExtensionsReply 32 -#define sz_xSetMappingReply 32 -#define sz_xGetKeyboardControlReply 52 -#define sz_xGetPointerControlReply 32 -#define sz_xGetScreenSaverReply 32 -#define sz_xListHostsReply 32 -#define sz_xSetModifierMappingReply 32 -#define sz_xError 32 -#define sz_xEvent 32 -#define sz_xKeymapEvent 32 -#define sz_xReq 4 -#define sz_xResourceReq 8 -#define sz_xCreateWindowReq 32 -#define sz_xChangeWindowAttributesReq 12 -#define sz_xChangeSaveSetReq 8 -#define sz_xReparentWindowReq 16 -#define sz_xConfigureWindowReq 12 -#define sz_xCirculateWindowReq 8 -#define sz_xInternAtomReq 8 -#define sz_xChangePropertyReq 24 -#define sz_xDeletePropertyReq 12 -#define sz_xGetPropertyReq 24 -#define sz_xSetSelectionOwnerReq 16 -#define sz_xConvertSelectionReq 24 -#define sz_xSendEventReq 44 -#define sz_xGrabPointerReq 24 -#define sz_xGrabButtonReq 24 -#define sz_xUngrabButtonReq 12 -#define sz_xChangeActivePointerGrabReq 16 -#define sz_xGrabKeyboardReq 16 -#define sz_xGrabKeyReq 16 -#define sz_xUngrabKeyReq 12 -#define sz_xAllowEventsReq 8 -#define sz_xGetMotionEventsReq 16 -#define sz_xTranslateCoordsReq 16 -#define sz_xWarpPointerReq 24 -#define sz_xSetInputFocusReq 12 -#define sz_xOpenFontReq 12 -#define sz_xQueryTextExtentsReq 8 -#define sz_xListFontsReq 8 -#define sz_xSetFontPathReq 8 -#define sz_xCreatePixmapReq 16 -#define sz_xCreateGCReq 16 -#define sz_xChangeGCReq 12 -#define sz_xCopyGCReq 16 -#define sz_xSetDashesReq 12 -#define sz_xSetClipRectanglesReq 12 -#define sz_xCopyAreaReq 28 -#define sz_xCopyPlaneReq 32 -#define sz_xPolyPointReq 12 -#define sz_xPolySegmentReq 12 -#define sz_xFillPolyReq 16 -#define sz_xPutImageReq 24 -#define sz_xGetImageReq 20 -#define sz_xPolyTextReq 16 -#define sz_xImageTextReq 16 -#define sz_xCreateColormapReq 16 -#define sz_xCopyColormapAndFreeReq 12 -#define sz_xAllocColorReq 16 -#define sz_xAllocNamedColorReq 12 -#define sz_xAllocColorCellsReq 12 -#define sz_xAllocColorPlanesReq 16 -#define sz_xFreeColorsReq 12 -#define sz_xStoreColorsReq 8 -#define sz_xStoreNamedColorReq 16 -#define sz_xQueryColorsReq 8 -#define sz_xLookupColorReq 12 -#define sz_xCreateCursorReq 32 -#define sz_xCreateGlyphCursorReq 32 -#define sz_xRecolorCursorReq 20 -#define sz_xQueryBestSizeReq 12 -#define sz_xQueryExtensionReq 8 -#define sz_xChangeKeyboardControlReq 8 -#define sz_xBellReq 4 -#define sz_xChangePointerControlReq 12 -#define sz_xSetScreenSaverReq 12 -#define sz_xChangeHostsReq 8 -#define sz_xListHostsReq 4 -#define sz_xChangeModeReq 4 -#define sz_xRotatePropertiesReq 12 -#define sz_xReply 32 -#define sz_xGrabKeyboardReply 32 -#define sz_xListFontsWithInfoReply 60 -#define sz_xSetPointerMappingReply 32 -#define sz_xGetKeyboardMappingReply 32 -#define sz_xGetPointerMappingReply 32 -#define sz_xGetModifierMappingReply 32 -#define sz_xListFontsWithInfoReq 8 -#define sz_xPolyLineReq 12 -#define sz_xPolyArcReq 12 -#define sz_xPolyRectangleReq 12 -#define sz_xPolyFillRectangleReq 12 -#define sz_xPolyFillArcReq 12 -#define sz_xPolyText8Req 16 -#define sz_xPolyText16Req 16 -#define sz_xImageText8Req 16 -#define sz_xImageText16Req 16 -#define sz_xSetPointerMappingReq 4 -#define sz_xForceScreenSaverReq 4 -#define sz_xSetCloseDownModeReq 4 -#define sz_xClearAreaReq 16 -#define sz_xSetAccessControlReq 4 -#define sz_xGetKeyboardMappingReq 8 -#define sz_xSetModifierMappingReq 4 -#define sz_xPropIconSize 24 -#define sz_xChangeKeyboardMappingReq 8 - - -/* For the purpose of the structure definitions in this file, -we must redefine the following types in terms of Xmd.h's types, which may -include bit fields. All of these are #undef'd at the end of this file, -restoring the definitions in X.h. */ - -#define Window CARD32 -#define Drawable CARD32 -#define Font CARD32 -#define Pixmap CARD32 -#define Cursor CARD32 -#define Colormap CARD32 -#define GContext CARD32 -#define Atom CARD32 -#define VisualID CARD32 -#define Time CARD32 -#define KeyCode CARD8 -#define KeySym CARD32 - -#define X_TCP_PORT 6000 /* add display number */ - -#define xTrue 1 -#define xFalse 0 - - -typedef CARD16 KeyButMask; - -/***************** - Connection setup structures. See Chapter 8: Connection Setup - of the X Window System Protocol specification for details. -*****************/ - -/* Client initiates handshake with this data, followed by the strings - * for the auth protocol & data. - */ -typedef struct { - CARD8 byteOrder; - BYTE pad; - CARD16 majorVersion B16, minorVersion B16; - CARD16 nbytesAuthProto B16; /* Authorization protocol */ - CARD16 nbytesAuthString B16; /* Authorization string */ - CARD16 pad2 B16; -} xConnClientPrefix; - -/* Server response to xConnClientPrefix. - * - * If success == Success, this is followed by xConnSetup and - * numRoots xWindowRoot structs. - * - * If success == Failure, this is followed by a reason string. - * - * The protocol also defines a case of success == Authenticate, but - * that doesn't seem to have ever been implemented by the X Consortium. - */ -typedef struct { - CARD8 success; - BYTE lengthReason; /*num bytes in string following if failure */ - CARD16 majorVersion B16, - minorVersion B16; - CARD16 length B16; /* 1/4 additional bytes in setup info */ -} xConnSetupPrefix; - - -typedef struct { - CARD32 release B32; - CARD32 ridBase B32, - ridMask B32; - CARD32 motionBufferSize B32; - CARD16 nbytesVendor B16; /* number of bytes in vendor string */ - CARD16 maxRequestSize B16; - CARD8 numRoots; /* number of roots structs to follow */ - CARD8 numFormats; /* number of pixmap formats */ - CARD8 imageByteOrder; /* LSBFirst, MSBFirst */ - CARD8 bitmapBitOrder; /* LeastSignificant, MostSign...*/ - CARD8 bitmapScanlineUnit, /* 8, 16, 32 */ - bitmapScanlinePad; /* 8, 16, 32 */ - KeyCode minKeyCode, maxKeyCode; - CARD32 pad2 B32; -} xConnSetup; - -typedef struct { - CARD8 depth; - CARD8 bitsPerPixel; - CARD8 scanLinePad; - CARD8 pad1; - CARD32 pad2 B32; -} xPixmapFormat; - -/* window root */ - -typedef struct { - CARD8 depth; - CARD8 pad1; - CARD16 nVisuals B16; /* number of xVisualType structures following */ - CARD32 pad2 B32; - } xDepth; - -typedef struct { - VisualID visualID B32; -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; -#else - CARD8 class; -#endif - CARD8 bitsPerRGB; - CARD16 colormapEntries B16; - CARD32 redMask B32, greenMask B32, blueMask B32; - CARD32 pad B32; - } xVisualType; - -typedef struct { - Window windowId B32; - Colormap defaultColormap B32; - CARD32 whitePixel B32, blackPixel B32; - CARD32 currentInputMask B32; - CARD16 pixWidth B16, pixHeight B16; - CARD16 mmWidth B16, mmHeight B16; - CARD16 minInstalledMaps B16, maxInstalledMaps B16; - VisualID rootVisualID B32; - CARD8 backingStore; - BOOL saveUnders; - CARD8 rootDepth; - CARD8 nDepths; /* number of xDepth structures following */ -} xWindowRoot; - - -/***************************************************************** - * Structure Defns - * Structures needed for replies - *****************************************************************/ - -/* Used in GetMotionEvents */ - -typedef struct { - CARD32 time B32; - INT16 x B16, y B16; -} xTimecoord; - -typedef struct { - CARD8 family; - BYTE pad; - CARD16 length B16; -} xHostEntry; - -typedef struct { - INT16 leftSideBearing B16, - rightSideBearing B16, - characterWidth B16, - ascent B16, - descent B16; - CARD16 attributes B16; -} xCharInfo; - -typedef struct { - Atom name B32; - CARD32 value B32; -} xFontProp; - -/* - * non-aligned big-endian font ID follows this struct - */ -typedef struct { /* followed by string */ - CARD8 len; /* number of *characters* in string, or FontChange (255) - for font change, or 0 if just delta given */ - INT8 delta; -} xTextElt; - - -typedef struct { - CARD32 pixel B32; - CARD16 red B16, green B16, blue B16; - CARD8 flags; /* DoRed, DoGreen, DoBlue booleans */ - CARD8 pad; -} xColorItem; - - -typedef struct { - CARD16 red B16, green B16, blue B16, pad B16; -} xrgb; - -typedef CARD8 KEYCODE; - - -/***************** - * XRep: - * meant to be 32 byte quantity - *****************/ - -/* GenericReply is the common format of all replies. The "data" items - are specific to each individual reply type. */ - -typedef struct { - BYTE type; /* X_Reply */ - BYTE data1; /* depends on reply type */ - CARD16 sequenceNumber B16; /* of last request received by server */ - CARD32 length B32; /* 4 byte quantities beyond size of GenericReply */ - CARD32 data00 B32; - CARD32 data01 B32; - CARD32 data02 B32; - CARD32 data03 B32; - CARD32 data04 B32; - CARD32 data05 B32; - } xGenericReply; - -/* Individual reply formats. */ - -typedef struct { - BYTE type; /* X_Reply */ - CARD8 backingStore; - CARD16 sequenceNumber B16; - CARD32 length B32; /* NOT 0; this is an extra-large reply */ - VisualID visualID B32; -#if defined(__cplusplus) || defined(c_plusplus) - CARD16 c_class B16; -#else - CARD16 class B16; -#endif - CARD8 bitGravity; - CARD8 winGravity; - CARD32 backingBitPlanes B32; - CARD32 backingPixel B32; - BOOL saveUnder; - BOOL mapInstalled; - CARD8 mapState; - BOOL override; - Colormap colormap B32; - CARD32 allEventMasks B32; - CARD32 yourEventMask B32; - CARD16 doNotPropagateMask B16; - CARD16 pad B16; - } xGetWindowAttributesReply; - -typedef struct { - BYTE type; /* X_Reply */ - CARD8 depth; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - Window root B32; - INT16 x B16, y B16; - CARD16 width B16, height B16; - CARD16 borderWidth B16; - CARD16 pad1 B16; - CARD32 pad2 B32; - CARD32 pad3 B32; - } xGetGeometryReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - Window root B32, parent B32; - CARD16 nChildren B16; - CARD16 pad2 B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - } xQueryTreeReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - Atom atom B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - } xInternAtomReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* of additional bytes */ - CARD16 nameLength B16; /* # of characters in name */ - CARD16 pad2 B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xGetAtomNameReply; - -typedef struct { - BYTE type; /* X_Reply */ - CARD8 format; - CARD16 sequenceNumber B16; - CARD32 length B32; /* of additional bytes */ - Atom propertyType B32; - CARD32 bytesAfter B32; - CARD32 nItems B32; /* # of 8, 16, or 32-bit entities in reply */ - CARD32 pad1 B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - } xGetPropertyReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 nProperties B16; - CARD16 pad2 B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xListPropertiesReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - Window owner B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - } xGetSelectionOwnerReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE status; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - CARD32 pad1 B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - } xGrabPointerReply; - -typedef xGrabPointerReply xGrabKeyboardReply; - -typedef struct { - BYTE type; /* X_Reply */ - BOOL sameScreen; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - Window root B32, child B32; - INT16 rootX B16, rootY B16, winX B16, winY B16; - CARD16 mask B16; - CARD16 pad1 B16; - CARD32 pad B32; - } xQueryPointerReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 nEvents B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - } xGetMotionEventsReply; - -typedef struct { - BYTE type; /* X_Reply */ - BOOL sameScreen; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - Window child B32; - INT16 dstX B16, dstY B16; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - } xTranslateCoordsReply; - -typedef struct { - BYTE type; /* X_Reply */ - CARD8 revertTo; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - Window focus B32; - CARD32 pad1 B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - } xGetInputFocusReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 2, NOT 0; this is an extra-large reply */ - BYTE map[32]; - } xQueryKeymapReply; - -/* Warning: this MUST match (up to component renaming) xListFontsWithInfoReply */ -typedef struct _xQueryFontReply { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* definitely > 0, even if "nCharInfos" is 0 */ - xCharInfo minBounds; - CARD32 walign1 B32; - xCharInfo maxBounds; - CARD32 walign2 B32; - CARD16 minCharOrByte2 B16, maxCharOrByte2 B16; - CARD16 defaultChar B16; - CARD16 nFontProps B16; /* followed by this many xFontProp structures */ - CARD8 drawDirection; - CARD8 minByte1, maxByte1; - BOOL allCharsExist; - INT16 fontAscent B16, fontDescent B16; - CARD32 nCharInfos B32; /* followed by this many xCharInfo structures */ -} xQueryFontReply; - -typedef struct { - BYTE type; /* X_Reply */ - CARD8 drawDirection; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - INT16 fontAscent B16, fontDescent B16; - INT16 overallAscent B16, overallDescent B16; - INT32 overallWidth B32, overallLeft B32, overallRight B32; - CARD32 pad B32; - } xQueryTextExtentsReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 nFonts B16; - CARD16 pad2 B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xListFontsReply; - -/* Warning: this MUST match (up to component renaming) xQueryFontReply */ -typedef struct { - BYTE type; /* X_Reply */ - CARD8 nameLength; /* 0 indicates end-of-reply-sequence */ - CARD16 sequenceNumber B16; - CARD32 length B32; /* definitely > 0, even if "nameLength" is 0 */ - xCharInfo minBounds; - CARD32 walign1 B32; - xCharInfo maxBounds; - CARD32 walign2 B32; - CARD16 minCharOrByte2 B16, maxCharOrByte2 B16; - CARD16 defaultChar B16; - CARD16 nFontProps B16; /* followed by this many xFontProp structures */ - CARD8 drawDirection; - CARD8 minByte1, maxByte1; - BOOL allCharsExist; - INT16 fontAscent B16, fontDescent B16; - CARD32 nReplies B32; /* hint as to how many more replies might be coming */ -} xListFontsWithInfoReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 nPaths B16; - CARD16 pad2 B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xGetFontPathReply; - -typedef struct { - BYTE type; /* X_Reply */ - CARD8 depth; - CARD16 sequenceNumber B16; - CARD32 length B32; - VisualID visual B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xGetImageReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 nColormaps B16; - CARD16 pad2 B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xListInstalledColormapsReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - CARD16 red B16, green B16, blue B16; - CARD16 pad2 B16; - CARD32 pixel B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - } xAllocColorReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - CARD32 pixel B32; - CARD16 exactRed B16, exactGreen B16, exactBlue B16; - CARD16 screenRed B16, screenGreen B16, screenBlue B16; - CARD32 pad2 B32; - CARD32 pad3 B32; - } xAllocNamedColorReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 nPixels B16, nMasks B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xAllocColorCellsReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 nPixels B16; - CARD16 pad2 B16; - CARD32 redMask B32, greenMask B32, blueMask B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - } xAllocColorPlanesReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 nColors B16; - CARD16 pad2 B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xQueryColorsReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - CARD16 exactRed B16, exactGreen B16, exactBlue B16; - CARD16 screenRed B16, screenGreen B16, screenBlue B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - } xLookupColorReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - CARD16 width B16, height B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xQueryBestSizeReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - BOOL present; - CARD8 major_opcode; - CARD8 first_event; - CARD8 first_error; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xQueryExtensionReply; - -typedef struct { - BYTE type; /* X_Reply */ - CARD8 nExtensions; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xListExtensionsReply; - - -typedef struct { - BYTE type; /* X_Reply */ - CARD8 success; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xSetMappingReply; -typedef xSetMappingReply xSetPointerMappingReply; -typedef xSetMappingReply xSetModifierMappingReply; - -typedef struct { - BYTE type; /* X_Reply */ - CARD8 nElts; /* how many elements does the map have */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xGetPointerMappingReply; - -typedef struct { - BYTE type; - CARD8 keySymsPerKeyCode; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; -} xGetKeyboardMappingReply; - -typedef struct { - BYTE type; - CARD8 numKeyPerModifier; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 pad1 B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xGetModifierMappingReply; - -typedef struct { - BYTE type; /* X_Reply */ - BOOL globalAutoRepeat; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 5 */ - CARD32 ledMask B32; - CARD8 keyClickPercent, bellPercent; - CARD16 bellPitch B16, bellDuration B16; - CARD16 pad B16; - BYTE map[32]; /* bit masks start here */ - } xGetKeyboardControlReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - CARD16 accelNumerator B16, accelDenominator B16; - CARD16 threshold B16; - CARD16 pad2 B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - } xGetPointerControlReply; - -typedef struct { - BYTE type; /* X_Reply */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - CARD16 timeout B16, interval B16; - BOOL preferBlanking; - BOOL allowExposures; - CARD16 pad2 B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - } xGetScreenSaverReply; - -typedef struct { - BYTE type; /* X_Reply */ - BOOL enabled; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 nHosts B16; - CARD16 pad1 B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - } xListHostsReply; - - - - -/***************************************************************** - * Xerror - * All errors are 32 bytes - *****************************************************************/ - -typedef struct { - BYTE type; /* X_Error */ - BYTE errorCode; - CARD16 sequenceNumber B16; /* the nth request from this client */ - CARD32 resourceID B32; - CARD16 minorCode B16; - CARD8 majorCode; - BYTE pad1; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; -} xError; - -/***************************************************************** - * xEvent - * All events are 32 bytes - *****************************************************************/ - -typedef struct _xEvent { - union { - struct { - BYTE type; - BYTE detail; - CARD16 sequenceNumber B16; - } u; - struct { - CARD32 pad00 B32; - Time time B32; - Window root B32, event B32, child B32; - INT16 rootX B16, rootY B16, eventX B16, eventY B16; - KeyButMask state B16; - BOOL sameScreen; - BYTE pad1; - } keyButtonPointer; - struct { - CARD32 pad00 B32; - Time time B32; - Window root B32, event B32, child B32; - INT16 rootX B16, rootY B16, eventX B16, eventY B16; - KeyButMask state B16; - BYTE mode; /* really XMode */ - BYTE flags; /* sameScreen and focus booleans, packed together */ -#define ELFlagFocus (1<<0) -#define ELFlagSameScreen (1<<1) - } enterLeave; - struct { - CARD32 pad00 B32; - Window window B32; - BYTE mode; /* really XMode */ - BYTE pad1, pad2, pad3; - } focus; - struct { - CARD32 pad00 B32; - Window window B32; - CARD16 x B16, y B16, width B16, height B16; - CARD16 count B16; - CARD16 pad2 B16; - } expose; - struct { - CARD32 pad00 B32; - Drawable drawable B32; - CARD16 x B16, y B16, width B16, height B16; - CARD16 minorEvent B16; - CARD16 count B16; - BYTE majorEvent; - BYTE pad1, pad2, pad3; - } graphicsExposure; - struct { - CARD32 pad00 B32; - Drawable drawable B32; - CARD16 minorEvent B16; - BYTE majorEvent; - BYTE bpad; - } noExposure; - struct { - CARD32 pad00 B32; - Window window B32; - CARD8 state; - BYTE pad1, pad2, pad3; - } visibility; - struct { - CARD32 pad00 B32; - Window parent B32, window B32; - INT16 x B16, y B16; - CARD16 width B16, height B16, borderWidth B16; - BOOL override; - BYTE bpad; - } createNotify; -/* - * The event fields in the structures for DestroyNotify, UnmapNotify, - * MapNotify, ReparentNotify, ConfigureNotify, CirculateNotify, GravityNotify, - * must be at the same offset because server internal code is depending upon - * this to patch up the events before they are delivered. - * Also note that MapRequest, ConfigureRequest and CirculateRequest have - * the same offset for the event window. - */ - struct { - CARD32 pad00 B32; - Window event B32, window B32; - } destroyNotify; - struct { - CARD32 pad00 B32; - Window event B32, window B32; - BOOL fromConfigure; - BYTE pad1, pad2, pad3; - } unmapNotify; - struct { - CARD32 pad00 B32; - Window event B32, window B32; - BOOL override; - BYTE pad1, pad2, pad3; - } mapNotify; - struct { - CARD32 pad00 B32; - Window parent B32, window B32; - } mapRequest; - struct { - CARD32 pad00 B32; - Window event B32, window B32, parent B32; - INT16 x B16, y B16; - BOOL override; - BYTE pad1, pad2, pad3; - } reparent; - struct { - CARD32 pad00 B32; - Window event B32, window B32, aboveSibling B32; - INT16 x B16, y B16; - CARD16 width B16, height B16, borderWidth B16; - BOOL override; - BYTE bpad; - } configureNotify; - struct { - CARD32 pad00 B32; - Window parent B32, window B32, sibling B32; - INT16 x B16, y B16; - CARD16 width B16, height B16, borderWidth B16; - CARD16 valueMask B16; - CARD32 pad1 B32; - } configureRequest; - struct { - CARD32 pad00 B32; - Window event B32, window B32; - INT16 x B16, y B16; - CARD32 pad1 B32, pad2 B32, pad3 B32, pad4 B32; - } gravity; - struct { - CARD32 pad00 B32; - Window window B32; - CARD16 width B16, height B16; - } resizeRequest; - struct { -/* The event field in the circulate record is really the parent when this - is used as a CirculateRequest instead of a CirculateNotify */ - CARD32 pad00 B32; - Window event B32, window B32, parent B32; - BYTE place; /* Top or Bottom */ - BYTE pad1, pad2, pad3; - } circulate; - struct { - CARD32 pad00 B32; - Window window B32; - Atom atom B32; - Time time B32; - BYTE state; /* NewValue or Deleted */ - BYTE pad1; - CARD16 pad2 B16; - } property; - struct { - CARD32 pad00 B32; - Time time B32; - Window window B32; - Atom atom B32; - } selectionClear; - struct { - CARD32 pad00 B32; - Time time B32; - Window owner B32, requestor B32; - Atom selection B32, target B32, property B32; - } selectionRequest; - struct { - CARD32 pad00 B32; - Time time B32; - Window requestor B32; - Atom selection B32, target B32, property B32; - } selectionNotify; - struct { - CARD32 pad00 B32; - Window window B32; - Colormap colormap B32; -#if defined(__cplusplus) || defined(c_plusplus) - BOOL c_new; -#else - BOOL new; -#endif - BYTE state; /* Installed or UnInstalled */ - BYTE pad1, pad2; - } colormap; - struct { - CARD32 pad00 B32; - CARD8 request; - KeyCode firstKeyCode; - CARD8 count; - BYTE pad1; - } mappingNotify; - struct { - CARD32 pad00 B32; - Window window B32; - union { - struct { - Atom type B32; - INT32 longs0 B32; - INT32 longs1 B32; - INT32 longs2 B32; - INT32 longs3 B32; - INT32 longs4 B32; - } l; - struct { - Atom type B32; - INT16 shorts0 B16; - INT16 shorts1 B16; - INT16 shorts2 B16; - INT16 shorts3 B16; - INT16 shorts4 B16; - INT16 shorts5 B16; - INT16 shorts6 B16; - INT16 shorts7 B16; - INT16 shorts8 B16; - INT16 shorts9 B16; - } s; - struct { - Atom type B32; - INT8 bytes[20]; - } b; - } u; - } clientMessage; - } u; -} xEvent; - -/********************************************************* - * - * Generic event - * - * Those events are not part of the core protocol spec and can be used by - * various extensions. - * type is always GenericEvent - * extension is the minor opcode of the extension the event belongs to. - * evtype is the actual event type, unique __per extension__. - * - * GenericEvents can be longer than 32 bytes, with the length field - * specifying the number of 4 byte blocks after the first 32 bytes. - * - * - */ -typedef struct -{ - BYTE type; - CARD8 extension; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 evtype B16; - CARD16 pad2 B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; -} xGenericEvent; - - - -/* KeymapNotify events are not included in the above union because they - are different from all other events: they do not have a "detail" - or "sequenceNumber", so there is room for a 248-bit key mask. */ - -typedef struct { - BYTE type; - BYTE map[31]; - } xKeymapEvent; - -#define XEventSize (sizeof(xEvent)) - -/* XReply is the union of all the replies above whose "fixed part" -fits in 32 bytes. It does NOT include GetWindowAttributesReply, -QueryFontReply, QueryKeymapReply, or GetKeyboardControlReply -ListFontsWithInfoReply */ - -typedef union { - xGenericReply generic; - xGetGeometryReply geom; - xQueryTreeReply tree; - xInternAtomReply atom; - xGetAtomNameReply atomName; - xGetPropertyReply property; - xListPropertiesReply listProperties; - xGetSelectionOwnerReply selection; - xGrabPointerReply grabPointer; - xGrabKeyboardReply grabKeyboard; - xQueryPointerReply pointer; - xGetMotionEventsReply motionEvents; - xTranslateCoordsReply coords; - xGetInputFocusReply inputFocus; - xQueryTextExtentsReply textExtents; - xListFontsReply fonts; - xGetFontPathReply fontPath; - xGetImageReply image; - xListInstalledColormapsReply colormaps; - xAllocColorReply allocColor; - xAllocNamedColorReply allocNamedColor; - xAllocColorCellsReply colorCells; - xAllocColorPlanesReply colorPlanes; - xQueryColorsReply colors; - xLookupColorReply lookupColor; - xQueryBestSizeReply bestSize; - xQueryExtensionReply extension; - xListExtensionsReply extensions; - xSetModifierMappingReply setModifierMapping; - xGetModifierMappingReply getModifierMapping; - xSetPointerMappingReply setPointerMapping; - xGetKeyboardMappingReply getKeyboardMapping; - xGetPointerMappingReply getPointerMapping; - xGetPointerControlReply pointerControl; - xGetScreenSaverReply screenSaver; - xListHostsReply hosts; - xError error; - xEvent event; -} xReply; - - - -/***************************************************************** - * REQUESTS - *****************************************************************/ - - -/* Request structure */ - -typedef struct _xReq { - CARD8 reqType; - CARD8 data; /* meaning depends on request type */ - CARD16 length B16; /* length in 4 bytes quantities - of whole request, including this header */ -} xReq; - -/***************************************************************** - * structures that follow request. - *****************************************************************/ - -/* ResourceReq is used for any request which has a resource ID - (or Atom or Time) as its one and only argument. */ - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - CARD32 id B32; /* a Window, Drawable, Font, GContext, Pixmap, etc. */ - } xResourceReq; - -typedef struct { - CARD8 reqType; - CARD8 depth; - CARD16 length B16; - Window wid B32, parent B32; - INT16 x B16, y B16; - CARD16 width B16, height B16, borderWidth B16; -#if defined(__cplusplus) || defined(c_plusplus) - CARD16 c_class B16; -#else - CARD16 class B16; -#endif - VisualID visual B32; - CARD32 mask B32; -} xCreateWindowReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Window window B32; - CARD32 valueMask B32; -} xChangeWindowAttributesReq; - -typedef struct { - CARD8 reqType; - BYTE mode; - CARD16 length B16; - Window window B32; -} xChangeSaveSetReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Window window B32, parent B32; - INT16 x B16, y B16; -} xReparentWindowReq; - -typedef struct { - CARD8 reqType; - CARD8 pad; - CARD16 length B16; - Window window B32; - CARD16 mask B16; - CARD16 pad2 B16; -} xConfigureWindowReq; - -typedef struct { - CARD8 reqType; - CARD8 direction; - CARD16 length B16; - Window window B32; -} xCirculateWindowReq; - -typedef struct { /* followed by padded string */ - CARD8 reqType; - BOOL onlyIfExists; - CARD16 length B16; - CARD16 nbytes B16; /* number of bytes in string */ - CARD16 pad B16; -} xInternAtomReq; - -typedef struct { - CARD8 reqType; - CARD8 mode; - CARD16 length B16; - Window window B32; - Atom property B32, type B32; - CARD8 format; - BYTE pad[3]; - CARD32 nUnits B32; /* length of stuff following, depends on format */ -} xChangePropertyReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Window window B32; - Atom property B32; -} xDeletePropertyReq; - -typedef struct { - CARD8 reqType; -#if defined(__cplusplus) || defined(c_plusplus) - BOOL c_delete; -#else - BOOL delete; -#endif - CARD16 length B16; - Window window B32; - Atom property B32, type B32; - CARD32 longOffset B32; - CARD32 longLength B32; -} xGetPropertyReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Window window B32; - Atom selection B32; - Time time B32; -} xSetSelectionOwnerReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Window requestor B32; - Atom selection B32, target B32, property B32; - Time time B32; - } xConvertSelectionReq; - -typedef struct { - CARD8 reqType; - BOOL propagate; - CARD16 length B16; - Window destination B32; - CARD32 eventMask B32; - xEvent event; -} xSendEventReq; - -typedef struct { - CARD8 reqType; - BOOL ownerEvents; - CARD16 length B16; - Window grabWindow B32; - CARD16 eventMask B16; - BYTE pointerMode, keyboardMode; - Window confineTo B32; - Cursor cursor B32; - Time time B32; -} xGrabPointerReq; - -typedef struct { - CARD8 reqType; - BOOL ownerEvents; - CARD16 length B16; - Window grabWindow B32; - CARD16 eventMask B16; - BYTE pointerMode, keyboardMode; - Window confineTo B32; - Cursor cursor B32; - CARD8 button; - BYTE pad; - CARD16 modifiers B16; -} xGrabButtonReq; - -typedef struct { - CARD8 reqType; - CARD8 button; - CARD16 length B16; - Window grabWindow B32; - CARD16 modifiers B16; - CARD16 pad B16; -} xUngrabButtonReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Cursor cursor B32; - Time time B32; - CARD16 eventMask B16; - CARD16 pad2 B16; -} xChangeActivePointerGrabReq; - -typedef struct { - CARD8 reqType; - BOOL ownerEvents; - CARD16 length B16; - Window grabWindow B32; - Time time B32; - BYTE pointerMode, keyboardMode; - CARD16 pad B16; -} xGrabKeyboardReq; - -typedef struct { - CARD8 reqType; - BOOL ownerEvents; - CARD16 length B16; - Window grabWindow B32; - CARD16 modifiers B16; - CARD8 key; - BYTE pointerMode, keyboardMode; - BYTE pad1, pad2, pad3; -} xGrabKeyReq; - -typedef struct { - CARD8 reqType; - CARD8 key; - CARD16 length B16; - Window grabWindow B32; - CARD16 modifiers B16; - CARD16 pad B16; -} xUngrabKeyReq; - -typedef struct { - CARD8 reqType; - CARD8 mode; - CARD16 length B16; - Time time B32; -} xAllowEventsReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Window window B32; - Time start B32, stop B32; -} xGetMotionEventsReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Window srcWid B32, dstWid B32; - INT16 srcX B16, srcY B16; -} xTranslateCoordsReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Window srcWid B32, dstWid B32; - INT16 srcX B16, srcY B16; - CARD16 srcWidth B16, srcHeight B16; - INT16 dstX B16, dstY B16; -} xWarpPointerReq; - -typedef struct { - CARD8 reqType; - CARD8 revertTo; - CARD16 length B16; - Window focus B32; - Time time B32; -} xSetInputFocusReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Font fid B32; - CARD16 nbytes B16; - BYTE pad1, pad2; /* string follows on word boundary */ -} xOpenFontReq; - -typedef struct { - CARD8 reqType; - BOOL oddLength; - CARD16 length B16; - Font fid B32; - } xQueryTextExtentsReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - CARD16 maxNames B16; - CARD16 nbytes B16; /* followed immediately by string bytes */ -} xListFontsReq; - -typedef xListFontsReq xListFontsWithInfoReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - CARD16 nFonts B16; - BYTE pad1, pad2; /* LISTofSTRING8 follows on word boundary */ -} xSetFontPathReq; - -typedef struct { - CARD8 reqType; - CARD8 depth; - CARD16 length B16; - Pixmap pid B32; - Drawable drawable B32; - CARD16 width B16, height B16; -} xCreatePixmapReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - GContext gc B32; - Drawable drawable B32; - CARD32 mask B32; -} xCreateGCReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - GContext gc B32; - CARD32 mask B32; -} xChangeGCReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - GContext srcGC B32, dstGC B32; - CARD32 mask B32; -} xCopyGCReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - GContext gc B32; - CARD16 dashOffset B16; - CARD16 nDashes B16; /* length LISTofCARD8 of values following */ -} xSetDashesReq; - -typedef struct { - CARD8 reqType; - BYTE ordering; - CARD16 length B16; - GContext gc B32; - INT16 xOrigin B16, yOrigin B16; -} xSetClipRectanglesReq; - -typedef struct { - CARD8 reqType; - BOOL exposures; - CARD16 length B16; - Window window B32; - INT16 x B16, y B16; - CARD16 width B16, height B16; -} xClearAreaReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Drawable srcDrawable B32, dstDrawable B32; - GContext gc B32; - INT16 srcX B16, srcY B16, dstX B16, dstY B16; - CARD16 width B16, height B16; -} xCopyAreaReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Drawable srcDrawable B32, dstDrawable B32; - GContext gc B32; - INT16 srcX B16, srcY B16, dstX B16, dstY B16; - CARD16 width B16, height B16; - CARD32 bitPlane B32; -} xCopyPlaneReq; - -typedef struct { - CARD8 reqType; - BYTE coordMode; - CARD16 length B16; - Drawable drawable B32; - GContext gc B32; -} xPolyPointReq; - -typedef xPolyPointReq xPolyLineReq; /* same request structure */ - -/* The following used for PolySegment, PolyRectangle, PolyArc, PolyFillRectangle, PolyFillArc */ - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Drawable drawable B32; - GContext gc B32; -} xPolySegmentReq; - -typedef xPolySegmentReq xPolyArcReq; -typedef xPolySegmentReq xPolyRectangleReq; -typedef xPolySegmentReq xPolyFillRectangleReq; -typedef xPolySegmentReq xPolyFillArcReq; - -typedef struct _FillPolyReq { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Drawable drawable B32; - GContext gc B32; - BYTE shape; - BYTE coordMode; - CARD16 pad1 B16; -} xFillPolyReq; - - -typedef struct _PutImageReq { - CARD8 reqType; - CARD8 format; - CARD16 length B16; - Drawable drawable B32; - GContext gc B32; - CARD16 width B16, height B16; - INT16 dstX B16, dstY B16; - CARD8 leftPad; - CARD8 depth; - CARD16 pad B16; -} xPutImageReq; - -typedef struct { - CARD8 reqType; - CARD8 format; - CARD16 length B16; - Drawable drawable B32; - INT16 x B16, y B16; - CARD16 width B16, height B16; - CARD32 planeMask B32; -} xGetImageReq; - -/* the following used by PolyText8 and PolyText16 */ - -typedef struct { - CARD8 reqType; - CARD8 pad; - CARD16 length B16; - Drawable drawable B32; - GContext gc B32; - INT16 x B16, y B16; /* items (xTextElt) start after struct */ -} xPolyTextReq; - -typedef xPolyTextReq xPolyText8Req; -typedef xPolyTextReq xPolyText16Req; - -typedef struct { - CARD8 reqType; - BYTE nChars; - CARD16 length B16; - Drawable drawable B32; - GContext gc B32; - INT16 x B16, y B16; -} xImageTextReq; - -typedef xImageTextReq xImageText8Req; -typedef xImageTextReq xImageText16Req; - -typedef struct { - CARD8 reqType; - BYTE alloc; - CARD16 length B16; - Colormap mid B32; - Window window B32; - VisualID visual B32; -} xCreateColormapReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Colormap mid B32; - Colormap srcCmap B32; -} xCopyColormapAndFreeReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Colormap cmap B32; - CARD16 red B16, green B16, blue B16; - CARD16 pad2 B16; -} xAllocColorReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Colormap cmap B32; - CARD16 nbytes B16; /* followed by structure */ - BYTE pad1, pad2; -} xAllocNamedColorReq; - -typedef struct { - CARD8 reqType; - BOOL contiguous; - CARD16 length B16; - Colormap cmap B32; - CARD16 colors B16, planes B16; -} xAllocColorCellsReq; - -typedef struct { - CARD8 reqType; - BOOL contiguous; - CARD16 length B16; - Colormap cmap B32; - CARD16 colors B16, red B16, green B16, blue B16; -} xAllocColorPlanesReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Colormap cmap B32; - CARD32 planeMask B32; -} xFreeColorsReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Colormap cmap B32; -} xStoreColorsReq; - -typedef struct { - CARD8 reqType; - CARD8 flags; /* DoRed, DoGreen, DoBlue, as in xColorItem */ - CARD16 length B16; - Colormap cmap B32; - CARD32 pixel B32; - CARD16 nbytes B16; /* number of name string bytes following structure */ - BYTE pad1, pad2; - } xStoreNamedColorReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Colormap cmap B32; -} xQueryColorsReq; - -typedef struct { /* followed by string of length len */ - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Colormap cmap B32; - CARD16 nbytes B16; /* number of string bytes following structure*/ - BYTE pad1, pad2; -} xLookupColorReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Cursor cid B32; - Pixmap source B32, mask B32; - CARD16 foreRed B16, foreGreen B16, foreBlue B16; - CARD16 backRed B16, backGreen B16, backBlue B16; - CARD16 x B16, y B16; -} xCreateCursorReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Cursor cid B32; - Font source B32, mask B32; - CARD16 sourceChar B16, maskChar B16; - CARD16 foreRed B16, foreGreen B16, foreBlue B16; - CARD16 backRed B16, backGreen B16, backBlue B16; -} xCreateGlyphCursorReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Cursor cursor B32; - CARD16 foreRed B16, foreGreen B16, foreBlue B16; - CARD16 backRed B16, backGreen B16, backBlue B16; -} xRecolorCursorReq; - -typedef struct { - CARD8 reqType; -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; -#else - CARD8 class; -#endif - CARD16 length B16; - Drawable drawable B32; - CARD16 width B16, height B16; -} xQueryBestSizeReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - CARD16 nbytes B16; /* number of string bytes following structure */ - BYTE pad1, pad2; -} xQueryExtensionReq; - -typedef struct { - CARD8 reqType; - CARD8 numKeyPerModifier; - CARD16 length B16; -} xSetModifierMappingReq; - -typedef struct { - CARD8 reqType; - CARD8 nElts; /* how many elements in the map */ - CARD16 length B16; -} xSetPointerMappingReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - KeyCode firstKeyCode; - CARD8 count; - CARD16 pad1 B16; -} xGetKeyboardMappingReq; - -typedef struct { - CARD8 reqType; - CARD8 keyCodes; - CARD16 length B16; - KeyCode firstKeyCode; - CARD8 keySymsPerKeyCode; - CARD16 pad1 B16; -} xChangeKeyboardMappingReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - CARD32 mask B32; -} xChangeKeyboardControlReq; - -typedef struct { - CARD8 reqType; - INT8 percent; /* -100 to 100 */ - CARD16 length B16; -} xBellReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - INT16 accelNum B16, accelDenum B16; - INT16 threshold B16; - BOOL doAccel, doThresh; -} xChangePointerControlReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - INT16 timeout B16, interval B16; - BYTE preferBlank, allowExpose; - CARD16 pad2 B16; -} xSetScreenSaverReq; - -typedef struct { - CARD8 reqType; - BYTE mode; - CARD16 length B16; - CARD8 hostFamily; - BYTE pad; - CARD16 hostLength B16; -} xChangeHostsReq; - -typedef struct { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - } xListHostsReq; - -typedef struct { - CARD8 reqType; - BYTE mode; - CARD16 length B16; - } xChangeModeReq; - -typedef xChangeModeReq xSetAccessControlReq; -typedef xChangeModeReq xSetCloseDownModeReq; -typedef xChangeModeReq xForceScreenSaverReq; - -typedef struct { /* followed by LIST of ATOM */ - CARD8 reqType; - BYTE pad; - CARD16 length B16; - Window window B32; - CARD16 nAtoms B16; - INT16 nPositions B16; - } xRotatePropertiesReq; - - - -/* Reply codes */ - -#define X_Reply 1 /* Normal reply */ -#define X_Error 0 /* Error */ - -/* Request codes */ - -#define X_CreateWindow 1 -#define X_ChangeWindowAttributes 2 -#define X_GetWindowAttributes 3 -#define X_DestroyWindow 4 -#define X_DestroySubwindows 5 -#define X_ChangeSaveSet 6 -#define X_ReparentWindow 7 -#define X_MapWindow 8 -#define X_MapSubwindows 9 -#define X_UnmapWindow 10 -#define X_UnmapSubwindows 11 -#define X_ConfigureWindow 12 -#define X_CirculateWindow 13 -#define X_GetGeometry 14 -#define X_QueryTree 15 -#define X_InternAtom 16 -#define X_GetAtomName 17 -#define X_ChangeProperty 18 -#define X_DeleteProperty 19 -#define X_GetProperty 20 -#define X_ListProperties 21 -#define X_SetSelectionOwner 22 -#define X_GetSelectionOwner 23 -#define X_ConvertSelection 24 -#define X_SendEvent 25 -#define X_GrabPointer 26 -#define X_UngrabPointer 27 -#define X_GrabButton 28 -#define X_UngrabButton 29 -#define X_ChangeActivePointerGrab 30 -#define X_GrabKeyboard 31 -#define X_UngrabKeyboard 32 -#define X_GrabKey 33 -#define X_UngrabKey 34 -#define X_AllowEvents 35 -#define X_GrabServer 36 -#define X_UngrabServer 37 -#define X_QueryPointer 38 -#define X_GetMotionEvents 39 -#define X_TranslateCoords 40 -#define X_WarpPointer 41 -#define X_SetInputFocus 42 -#define X_GetInputFocus 43 -#define X_QueryKeymap 44 -#define X_OpenFont 45 -#define X_CloseFont 46 -#define X_QueryFont 47 -#define X_QueryTextExtents 48 -#define X_ListFonts 49 -#define X_ListFontsWithInfo 50 -#define X_SetFontPath 51 -#define X_GetFontPath 52 -#define X_CreatePixmap 53 -#define X_FreePixmap 54 -#define X_CreateGC 55 -#define X_ChangeGC 56 -#define X_CopyGC 57 -#define X_SetDashes 58 -#define X_SetClipRectangles 59 -#define X_FreeGC 60 -#define X_ClearArea 61 -#define X_CopyArea 62 -#define X_CopyPlane 63 -#define X_PolyPoint 64 -#define X_PolyLine 65 -#define X_PolySegment 66 -#define X_PolyRectangle 67 -#define X_PolyArc 68 -#define X_FillPoly 69 -#define X_PolyFillRectangle 70 -#define X_PolyFillArc 71 -#define X_PutImage 72 -#define X_GetImage 73 -#define X_PolyText8 74 -#define X_PolyText16 75 -#define X_ImageText8 76 -#define X_ImageText16 77 -#define X_CreateColormap 78 -#define X_FreeColormap 79 -#define X_CopyColormapAndFree 80 -#define X_InstallColormap 81 -#define X_UninstallColormap 82 -#define X_ListInstalledColormaps 83 -#define X_AllocColor 84 -#define X_AllocNamedColor 85 -#define X_AllocColorCells 86 -#define X_AllocColorPlanes 87 -#define X_FreeColors 88 -#define X_StoreColors 89 -#define X_StoreNamedColor 90 -#define X_QueryColors 91 -#define X_LookupColor 92 -#define X_CreateCursor 93 -#define X_CreateGlyphCursor 94 -#define X_FreeCursor 95 -#define X_RecolorCursor 96 -#define X_QueryBestSize 97 -#define X_QueryExtension 98 -#define X_ListExtensions 99 -#define X_ChangeKeyboardMapping 100 -#define X_GetKeyboardMapping 101 -#define X_ChangeKeyboardControl 102 -#define X_GetKeyboardControl 103 -#define X_Bell 104 -#define X_ChangePointerControl 105 -#define X_GetPointerControl 106 -#define X_SetScreenSaver 107 -#define X_GetScreenSaver 108 -#define X_ChangeHosts 109 -#define X_ListHosts 110 -#define X_SetAccessControl 111 -#define X_SetCloseDownMode 112 -#define X_KillClient 113 -#define X_RotateProperties 114 -#define X_ForceScreenSaver 115 -#define X_SetPointerMapping 116 -#define X_GetPointerMapping 117 -#define X_SetModifierMapping 118 -#define X_GetModifierMapping 119 -#define X_NoOperation 127 - -/* restore these definitions back to the typedefs in X.h */ -#undef Window -#undef Drawable -#undef Font -#undef Pixmap -#undef Cursor -#undef Colormap -#undef GContext -#undef Atom -#undef VisualID -#undef Time -#undef KeyCode -#undef KeySym - -#endif /* XPROTO_H */ diff --git a/openflow/usr/include/X11/Xprotostr.h b/openflow/usr/include/X11/Xprotostr.h deleted file mode 100644 index a9e854d..0000000 --- a/openflow/usr/include/X11/Xprotostr.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef XPROTOSTRUCTS_H -#define XPROTOSTRUCTS_H - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -#include - -/* Used by PolySegment */ - -typedef struct _xSegment { - INT16 x1 B16, y1 B16, x2 B16, y2 B16; -} xSegment; - -/* POINT */ - -typedef struct _xPoint { - INT16 x B16, y B16; -} xPoint; - -typedef struct _xRectangle { - INT16 x B16, y B16; - CARD16 width B16, height B16; -} xRectangle; - -/* ARC */ - -typedef struct _xArc { - INT16 x B16, y B16; - CARD16 width B16, height B16; - INT16 angle1 B16, angle2 B16; -} xArc; - -#endif /* XPROTOSTRUCTS_H */ diff --git a/openflow/usr/include/X11/Xregion.h b/openflow/usr/include/X11/Xregion.h deleted file mode 100644 index cf10f86..0000000 --- a/openflow/usr/include/X11/Xregion.h +++ /dev/null @@ -1,190 +0,0 @@ -/************************************************************************ - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -************************************************************************/ - -#ifndef _X11_XREGION_H_ -#define _X11_XREGION_H_ - -typedef struct { - short x1, x2, y1, y2; -} Box, BOX, BoxRec, *BoxPtr; - -typedef struct { - short x, y, width, height; -}RECTANGLE, RectangleRec, *RectanglePtr; - -#define TRUE 1 -#define FALSE 0 -#define MAXSHORT 32767 -#define MINSHORT -MAXSHORT -#ifndef MAX -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) -#endif -#ifndef MIN -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#endif - - -/* - * clip region - */ - -typedef struct _XRegion { - long size; - long numRects; - BOX *rects; - BOX extents; -} REGION; - -/* Xutil.h contains the declaration: - * typedef struct _XRegion *Region; - */ - -/* 1 if two BOXs overlap. - * 0 if two BOXs do not overlap. - * Remember, x2 and y2 are not in the region - */ -#define EXTENTCHECK(r1, r2) \ - ((r1)->x2 > (r2)->x1 && \ - (r1)->x1 < (r2)->x2 && \ - (r1)->y2 > (r2)->y1 && \ - (r1)->y1 < (r2)->y2) - -/* - * update region extents - */ -#define EXTENTS(r,idRect){\ - if((r)->x1 < (idRect)->extents.x1)\ - (idRect)->extents.x1 = (r)->x1;\ - if((r)->y1 < (idRect)->extents.y1)\ - (idRect)->extents.y1 = (r)->y1;\ - if((r)->x2 > (idRect)->extents.x2)\ - (idRect)->extents.x2 = (r)->x2;\ - if((r)->y2 > (idRect)->extents.y2)\ - (idRect)->extents.y2 = (r)->y2;\ - } - -/* - * Check to see if there is enough memory in the present region. - */ -#define MEMCHECK(reg, rect, firstrect){\ - if ((reg)->numRects >= ((reg)->size - 1)){\ - BoxPtr tmpRect = Xrealloc ((firstrect), \ - (2 * (sizeof(BOX)) * ((reg)->size))); \ - if (tmpRect == NULL) \ - return(0);\ - (firstrect) = tmpRect; \ - (reg)->size *= 2;\ - (rect) = &(firstrect)[(reg)->numRects];\ - }\ - } - -/* this routine checks to see if the previous rectangle is the same - * or subsumes the new rectangle to add. - */ - -#define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\ - (!(((Reg)->numRects > 0)&&\ - ((R-1)->y1 == (Ry1)) &&\ - ((R-1)->y2 == (Ry2)) &&\ - ((R-1)->x1 <= (Rx1)) &&\ - ((R-1)->x2 >= (Rx2)))) - -/* add a rectangle to the given Region */ -#define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\ - if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\ - CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ - (r)->x1 = (rx1);\ - (r)->y1 = (ry1);\ - (r)->x2 = (rx2);\ - (r)->y2 = (ry2);\ - EXTENTS((r), (reg));\ - (reg)->numRects++;\ - (r)++;\ - }\ - } - - - -/* add a rectangle to the given Region */ -#define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\ - if ((rx1 < rx2) && (ry1 < ry2) &&\ - CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ - (r)->x1 = (rx1);\ - (r)->y1 = (ry1);\ - (r)->x2 = (rx2);\ - (r)->y2 = (ry2);\ - (reg)->numRects++;\ - (r)++;\ - }\ - } - -#define EMPTY_REGION(pReg) pReg->numRects = 0 - -#define REGION_NOT_EMPTY(pReg) pReg->numRects - -#define INBOX(r, x, y) \ - ( ( ((r).x2 > x)) && \ - ( ((r).x1 <= x)) && \ - ( ((r).y2 > y)) && \ - ( ((r).y1 <= y)) ) - -/* - * number of points to buffer before sending them off - * to scanlines() : Must be an even number - */ -#define NUMPTSTOBUFFER 200 - -/* - * used to allocate buffers for points and link - * the buffers together - */ -typedef struct _POINTBLOCK { - XPoint pts[NUMPTSTOBUFFER]; - struct _POINTBLOCK *next; -} POINTBLOCK; - -#endif /* _X11_XREGION_H_ */ diff --git a/openflow/usr/include/X11/Xresource.h b/openflow/usr/include/X11/Xresource.h deleted file mode 100644 index 6dbb3ce..0000000 --- a/openflow/usr/include/X11/Xresource.h +++ /dev/null @@ -1,358 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _X11_XRESOURCE_H_ -#define _X11_XRESOURCE_H_ - -#ifndef _XP_PRINT_SERVER_ -#include -#endif - -/**************************************************************** - **************************************************************** - *** *** - *** *** - *** X Resource Manager Intrinsics *** - *** *** - *** *** - **************************************************************** - ****************************************************************/ - -_XFUNCPROTOBEGIN - -/**************************************************************** - * - * Memory Management - * - ****************************************************************/ - -extern char *Xpermalloc( - unsigned int /* size */ -); - -/**************************************************************** - * - * Quark Management - * - ****************************************************************/ - -typedef int XrmQuark, *XrmQuarkList; -#define NULLQUARK ((XrmQuark) 0) - -typedef char *XrmString; -#define NULLSTRING ((XrmString) 0) - -/* find quark for string, create new quark if none already exists */ -extern XrmQuark XrmStringToQuark( - _Xconst char* /* string */ -); - -extern XrmQuark XrmPermStringToQuark( - _Xconst char* /* string */ -); - -/* find string for quark */ -extern XrmString XrmQuarkToString( - XrmQuark /* quark */ -); - -extern XrmQuark XrmUniqueQuark( - void -); - -#define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0) - - -/**************************************************************** - * - * Conversion of Strings to Lists - * - ****************************************************************/ - -typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList; - -extern void XrmStringToQuarkList( - _Xconst char* /* string */, - XrmQuarkList /* quarks_return */ -); - -extern void XrmStringToBindingQuarkList( - _Xconst char* /* string */, - XrmBindingList /* bindings_return */, - XrmQuarkList /* quarks_return */ -); - -/**************************************************************** - * - * Name and Class lists. - * - ****************************************************************/ - -typedef XrmQuark XrmName; -typedef XrmQuarkList XrmNameList; -#define XrmNameToString(name) XrmQuarkToString(name) -#define XrmStringToName(string) XrmStringToQuark(string) -#define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name) - -typedef XrmQuark XrmClass; -typedef XrmQuarkList XrmClassList; -#define XrmClassToString(c_class) XrmQuarkToString(c_class) -#define XrmStringToClass(c_class) XrmStringToQuark(c_class) -#define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class) - - - -/**************************************************************** - * - * Resource Representation Types and Values - * - ****************************************************************/ - -typedef XrmQuark XrmRepresentation; -#define XrmStringToRepresentation(string) XrmStringToQuark(string) -#define XrmRepresentationToString(type) XrmQuarkToString(type) - -typedef struct { - unsigned int size; - XPointer addr; -} XrmValue, *XrmValuePtr; - - -/**************************************************************** - * - * Resource Manager Functions - * - ****************************************************************/ - -typedef struct _XrmHashBucketRec *XrmHashBucket; -typedef XrmHashBucket *XrmHashTable; -typedef XrmHashTable XrmSearchList[]; -typedef struct _XrmHashBucketRec *XrmDatabase; - - -extern void XrmDestroyDatabase( - XrmDatabase /* database */ -); - -extern void XrmQPutResource( - XrmDatabase* /* database */, - XrmBindingList /* bindings */, - XrmQuarkList /* quarks */, - XrmRepresentation /* type */, - XrmValue* /* value */ -); - -extern void XrmPutResource( - XrmDatabase* /* database */, - _Xconst char* /* specifier */, - _Xconst char* /* type */, - XrmValue* /* value */ -); - -extern void XrmQPutStringResource( - XrmDatabase* /* database */, - XrmBindingList /* bindings */, - XrmQuarkList /* quarks */, - _Xconst char* /* value */ -); - -extern void XrmPutStringResource( - XrmDatabase* /* database */, - _Xconst char* /* specifier */, - _Xconst char* /* value */ -); - -extern void XrmPutLineResource( - XrmDatabase* /* database */, - _Xconst char* /* line */ -); - -extern Bool XrmQGetResource( - XrmDatabase /* database */, - XrmNameList /* quark_name */, - XrmClassList /* quark_class */, - XrmRepresentation* /* quark_type_return */, - XrmValue* /* value_return */ -); - -extern Bool XrmGetResource( - XrmDatabase /* database */, - _Xconst char* /* str_name */, - _Xconst char* /* str_class */, - char** /* str_type_return */, - XrmValue* /* value_return */ -); - -extern Bool XrmQGetSearchList( - XrmDatabase /* database */, - XrmNameList /* names */, - XrmClassList /* classes */, - XrmSearchList /* list_return */, - int /* list_length */ -); - -extern Bool XrmQGetSearchResource( - XrmSearchList /* list */, - XrmName /* name */, - XrmClass /* class */, - XrmRepresentation* /* type_return */, - XrmValue* /* value_return */ -); - -/**************************************************************** - * - * Resource Database Management - * - ****************************************************************/ - -#ifndef _XP_PRINT_SERVER_ - -extern void XrmSetDatabase( - Display* /* display */, - XrmDatabase /* database */ -); - -extern XrmDatabase XrmGetDatabase( - Display* /* display */ -); - -#endif /* !_XP_PRINT_SERVER_ */ - -extern XrmDatabase XrmGetFileDatabase( - _Xconst char* /* filename */ -); - -extern Status XrmCombineFileDatabase( - _Xconst char* /* filename */, - XrmDatabase* /* target */, - Bool /* override */ -); - -extern XrmDatabase XrmGetStringDatabase( - _Xconst char* /* data */ /* null terminated string */ -); - -extern void XrmPutFileDatabase( - XrmDatabase /* database */, - _Xconst char* /* filename */ -); - -extern void XrmMergeDatabases( - XrmDatabase /* source_db */, - XrmDatabase* /* target_db */ -); - -extern void XrmCombineDatabase( - XrmDatabase /* source_db */, - XrmDatabase* /* target_db */, - Bool /* override */ -); - -#define XrmEnumAllLevels 0 -#define XrmEnumOneLevel 1 - -extern Bool XrmEnumerateDatabase( - XrmDatabase /* db */, - XrmNameList /* name_prefix */, - XrmClassList /* class_prefix */, - int /* mode */, - Bool (*)( - XrmDatabase* /* db */, - XrmBindingList /* bindings */, - XrmQuarkList /* quarks */, - XrmRepresentation* /* type */, - XrmValue* /* value */, - XPointer /* closure */ - ) /* proc */, - XPointer /* closure */ -); - -extern const char *XrmLocaleOfDatabase( - XrmDatabase /* database */ -); - - -/**************************************************************** - * - * Command line option mapping to resource entries - * - ****************************************************************/ - -typedef enum { - XrmoptionNoArg, /* Value is specified in OptionDescRec.value */ - XrmoptionIsArg, /* Value is the option string itself */ - XrmoptionStickyArg, /* Value is characters immediately following option */ - XrmoptionSepArg, /* Value is next argument in argv */ - XrmoptionResArg, /* Resource and value in next argument in argv */ - XrmoptionSkipArg, /* Ignore this option and the next argument in argv */ - XrmoptionSkipLine, /* Ignore this option and the rest of argv */ - XrmoptionSkipNArgs /* Ignore this option and the next - OptionDescRes.value arguments in argv */ -} XrmOptionKind; - -typedef struct { - char *option; /* Option abbreviation in argv */ - char *specifier; /* Resource specifier */ - XrmOptionKind argKind; /* Which style of option it is */ - XPointer value; /* Value to provide if XrmoptionNoArg */ -} XrmOptionDescRec, *XrmOptionDescList; - - -extern void XrmParseCommand( - XrmDatabase* /* database */, - XrmOptionDescList /* table */, - int /* table_count */, - _Xconst char* /* name */, - int* /* argc_in_out */, - char** /* argv_in_out */ -); - -_XFUNCPROTOEND - -#endif /* _X11_XRESOURCE_H_ */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/Xthreads.h b/openflow/usr/include/X11/Xthreads.h deleted file mode 100644 index 2027127..0000000 --- a/openflow/usr/include/X11/Xthreads.h +++ /dev/null @@ -1,314 +0,0 @@ -/* - * -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * * - */ - -#ifndef _XTHREADS_H_ -# define _XTHREADS_H_ - -/* Redefine these to XtMalloc/XtFree or whatever you want before including - * this header file. - */ -# ifndef xmalloc -# define xmalloc malloc -# endif -# ifndef xfree -# define xfree free -# endif - -# ifdef CTHREADS -# include -typedef cthread_t xthread_t; -typedef struct condition xcondition_rec; -typedef struct mutex xmutex_rec; -# define xthread_init() cthread_init() -# define xthread_self cthread_self -# define xthread_fork(func,closure) cthread_fork(func,closure) -# define xthread_yield() cthread_yield() -# define xthread_exit(v) cthread_exit(v) -# define xthread_set_name(t,str) cthread_set_name(t,str) -# define xmutex_init(m) mutex_init(m) -# define xmutex_clear(m) mutex_clear(m) -# define xmutex_lock(m) mutex_lock(m) -# define xmutex_unlock(m) mutex_unlock(m) -# define xmutex_set_name(m,str) mutex_set_name(m,str) -# define xcondition_init(cv) condition_init(cv) -# define xcondition_clear(cv) condition_clear(cv) -# define xcondition_wait(cv,m) condition_wait(cv,m) -# define xcondition_signal(cv) condition_signal(cv) -# define xcondition_broadcast(cv) condition_broadcast(cv) -# define xcondition_set_name(cv,str) condition_set_name(cv,str) -# else /* !CTHREADS */ -# if defined(SVR4) -# include -# include -typedef thread_t xthread_t; -typedef thread_key_t xthread_key_t; -typedef cond_t xcondition_rec; -typedef mutex_t xmutex_rec; -# if defined(__UNIXWARE__) -extern xthread_t (*_x11_thr_self)(); -# define xthread_self (_x11_thr_self) -# else -# define xthread_self thr_self -# endif -# define xthread_fork(func,closure) thr_create(NULL,0,func,closure,THR_NEW_LWP|THR_DETACHED,NULL) -# define xthread_yield() thr_yield() -# define xthread_exit(v) thr_exit(v) -# define xthread_key_create(kp,d) thr_keycreate(kp,d) -# ifdef __sun -# define xthread_key_delete(k) 0 -# else -# define xthread_key_delete(k) thr_keydelete(k) -# endif -# define xthread_set_specific(k,v) thr_setspecific(k,v) -# define xthread_get_specific(k,vp) thr_getspecific(k,vp) -# define xmutex_init(m) mutex_init(m,USYNC_THREAD,0) -# define xmutex_clear(m) mutex_destroy(m) -# define xmutex_lock(m) mutex_lock(m) -# define xmutex_unlock(m) mutex_unlock(m) -# define xcondition_init(cv) cond_init(cv,USYNC_THREAD,0) -# define xcondition_clear(cv) cond_destroy(cv) -# define xcondition_wait(cv,m) cond_wait(cv,m) -# define xcondition_signal(cv) cond_signal(cv) -# define xcondition_broadcast(cv) cond_broadcast(cv) -# else /* !SVR4 */ -# ifdef WIN32 -# include -typedef DWORD xthread_t; -typedef DWORD xthread_key_t; -struct _xthread_waiter { - HANDLE sem; - struct _xthread_waiter *next; -}; -typedef struct { - CRITICAL_SECTION cs; - struct _xthread_waiter *waiters; -} xcondition_rec; -typedef CRITICAL_SECTION xmutex_rec; -extern void _Xthread_init(void); -# define xthread_init() _Xthread_init() -# define xthread_self GetCurrentThreadId -# define xthread_fork(func,closure) { \ - DWORD _tmptid; \ - CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, (LPVOID)closure, 0, \ - &_tmptid); \ -} -# define xthread_yield() Sleep(0) -# define xthread_exit(v) ExitThread((DWORD)(v)) -# define xthread_key_create(kp,d) *(kp) = TlsAlloc() -# define xthread_key_delete(k) TlsFree(k) -# define xthread_set_specific(k,v) TlsSetValue(k,v) -# define xthread_get_specific(k,vp) TlsGetValue(k) -# define xmutex_init(m) InitializeCriticalSection(m) -# define xmutex_clear(m) DeleteCriticalSection(m) -# define _XMUTEX_NESTS -# define xmutex_lock(m) EnterCriticalSection(m) -# define xmutex_unlock(m) LeaveCriticalSection(m) -# define xcondition_init(cv) { \ - InitializeCriticalSection(&(cv)->cs); \ - (cv)->waiters = NULL; \ -} -# define xcondition_clear(cv) DeleteCriticalSection(&(cv)->cs) -extern struct _xthread_waiter *_Xthread_waiter(); -# define xcondition_wait(cv,m) { \ - struct _xthread_waiter *_tmpthr = _Xthread_waiter(); \ - EnterCriticalSection(&(cv)->cs); \ - _tmpthr->next = (cv)->waiters; \ - (cv)->waiters = _tmpthr; \ - LeaveCriticalSection(&(cv)->cs); \ - LeaveCriticalSection(m); \ - WaitForSingleObject(_tmpthr->sem, INFINITE); \ - EnterCriticalSection(m); \ -} -# define xcondition_signal(cv) { \ - EnterCriticalSection(&(cv)->cs); \ - if ((cv)->waiters) { \ - ReleaseSemaphore((cv)->waiters->sem, 1, NULL); \ - (cv)->waiters = (cv)->waiters->next; \ - } \ - LeaveCriticalSection(&(cv)->cs); \ -} -# define xcondition_broadcast(cv) { \ - struct _xthread_waiter *_tmpthr; \ - EnterCriticalSection(&(cv)->cs); \ - for (_tmpthr = (cv)->waiters; _tmpthr; _tmpthr = _tmpthr->next) \ - ReleaseSemaphore(_tmpthr->sem, 1, NULL); \ - (cv)->waiters = NULL; \ - LeaveCriticalSection(&(cv)->cs); \ -} -# else /* !WIN32 */ -# ifdef USE_TIS_SUPPORT -/* - * TIS support is intended for thread safe libraries. - * This should not be used for general client programming. - */ -# include -typedef pthread_t xthread_t; -typedef pthread_key_t xthread_key_t; -typedef pthread_cond_t xcondition_rec; -typedef pthread_mutex_t xmutex_rec; -# define xthread_self tis_self -# define xthread_fork(func,closure) { pthread_t _tmpxthr; \ - pthread_create(&_tmpxthr,NULL,func,closure); } -# define xthread_yield() pthread_yield_np() -# define xthread_exit(v) pthread_exit(v) -# define xthread_key_create(kp,d) tis_key_create(kp,d) -# define xthread_key_delete(k) tis_key_delete(k) -# define xthread_set_specific(k,v) tis_setspecific(k,v) -# define xthread_get_specific(k,vp) *(vp) = tis_getspecific(k) -# define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER -# define xmutex_init(m) tis_mutex_init(m) -# define xmutex_clear(m) tis_mutex_destroy(m) -# define xmutex_lock(m) tis_mutex_lock(m) -# define xmutex_unlock(m) tis_mutex_unlock(m) -# define xcondition_init(c) tis_cond_init(c) -# define xcondition_clear(c) tis_cond_destroy(c) -# define xcondition_wait(c,m) tis_cond_wait(c,m) -# define xcondition_signal(c) tis_cond_signal(c) -# define xcondition_broadcast(c) tis_cond_broadcast(c) -# else -# ifdef USE_NBSD_THREADLIB -/* - * NetBSD threadlib support is intended for thread safe libraries. - * This should not be used for general client programming. - */ -# include -typedef thr_t xthread_t; -typedef thread_key_t xthread_key_t; -typedef cond_t xcondition_rec; -typedef mutex_t xmutex_rec; -# define xthread_self thr_self -# define xthread_fork(func,closure) { thr_t _tmpxthr; \ - /* XXX Create it detached? --thorpej */ \ - thr_create(&_tmpxthr,NULL,func,closure); } -# define xthread_yield() thr_yield() -# define xthread_exit(v) thr_exit(v) -# define xthread_key_create(kp,d) thr_keycreate(kp,d) -# define xthread_key_delete(k) thr_keydelete(k) -# define xthread_set_specific(k,v) thr_setspecific(k,v) -# define xthread_get_specific(k,vp) *(vp) = thr_getspecific(k) -# define XMUTEX_INITIALIZER MUTEX_INITIALIZER -# define xmutex_init(m) mutex_init(m, 0) -# define xmutex_clear(m) mutex_destroy(m) -# define xmutex_lock(m) mutex_lock(m) -# define xmutex_unlock(m) mutex_unlock(m) -# define xcondition_init(c) cond_init(c, 0, 0) -# define xcondition_clear(c) cond_destroy(c) -# define xcondition_wait(c,m) cond_wait(c,m) -# define xcondition_signal(c) cond_signal(c) -# define xcondition_broadcast(c) cond_broadcast(c) -# else -# include -typedef pthread_t xthread_t; -typedef pthread_key_t xthread_key_t; -typedef pthread_cond_t xcondition_rec; -typedef pthread_mutex_t xmutex_rec; -# define xthread_self pthread_self -# define xthread_yield() pthread_yield() -# define xthread_exit(v) pthread_exit(v) -# define xthread_set_specific(k,v) pthread_setspecific(k,v) -# define xmutex_clear(m) pthread_mutex_destroy(m) -# define xmutex_lock(m) pthread_mutex_lock(m) -# define xmutex_unlock(m) pthread_mutex_unlock(m) -# ifndef XPRE_STANDARD_API -# define xthread_key_create(kp,d) pthread_key_create(kp,d) -# define xthread_key_delete(k) pthread_key_delete(k) -# define xthread_get_specific(k,vp) *(vp) = pthread_getspecific(k) -# define xthread_fork(func,closure) { pthread_t _tmpxthr; \ - pthread_create(&_tmpxthr,NULL,func,closure); } -# define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER -# define xmutex_init(m) pthread_mutex_init(m, NULL) -# define xcondition_init(c) pthread_cond_init(c, NULL) -# else /* XPRE_STANDARD_API */ -# define xthread_key_create(kp,d) pthread_keycreate(kp,d) -# define xthread_key_delete(k) 0 -# define xthread_get_specific(k,vp) pthread_getspecific(k,vp) -# define xthread_fork(func,closure) { pthread_t _tmpxthr; \ - pthread_create(&_tmpxthr,pthread_attr_default,func,closure); } -# define xmutex_init(m) pthread_mutex_init(m, pthread_mutexattr_default) -# define xcondition_init(c) pthread_cond_init(c, pthread_condattr_default) -# endif /* XPRE_STANDARD_API */ -# define xcondition_clear(c) pthread_cond_destroy(c) -# define xcondition_wait(c,m) pthread_cond_wait(c,m) -# define xcondition_signal(c) pthread_cond_signal(c) -# define xcondition_broadcast(c) pthread_cond_broadcast(c) -# if defined(_DECTHREADS_) -static xthread_t _X_no_thread_id; -# define xthread_have_id(id) !pthread_equal(id, _X_no_thread_id) -# define xthread_clear_id(id) id = _X_no_thread_id -# define xthread_equal(id1,id2) pthread_equal(id1, id2) -# endif /* _DECTHREADS_ */ -# if defined(__linux__) -# define xthread_have_id(id) !pthread_equal(id, 0) -# define xthread_clear_id(id) id = 0 -# define xthread_equal(id1,id2) pthread_equal(id1, id2) -# endif /* linux */ -# if defined(_CMA_VENDOR_) && defined(_CMA__IBM) && (_CMA_VENDOR_ == _CMA__IBM) -# ifdef DEBUG /* too much of a hack to enable normally */ -/* see also cma__obj_set_name() */ -# define xmutex_set_name(m,str) ((char**)(m)->field1)[5] = (str) -# define xcondition_set_name(cv,str) ((char**)(cv)->field1)[5] = (str) -# endif /* DEBUG */ -# endif /* _CMA_VENDOR_ == _CMA__IBM */ -# endif /* USE_NBSD_THREADLIB */ -# endif /* USE_TIS_SUPPORT */ -# endif /* WIN32 */ -# endif /* SVR4 */ -# endif /* CTHREADS */ -typedef xcondition_rec *xcondition_t; -typedef xmutex_rec *xmutex_t; -# ifndef xcondition_malloc -# define xcondition_malloc() (xcondition_t)xmalloc(sizeof(xcondition_rec)) -# endif -# ifndef xcondition_free -# define xcondition_free(c) xfree((char *)c) -# endif -# ifndef xmutex_malloc -# define xmutex_malloc() (xmutex_t)xmalloc(sizeof(xmutex_rec)) -# endif -# ifndef xmutex_free -# define xmutex_free(m) xfree((char *)m) -# endif -# ifndef xthread_have_id -# define xthread_have_id(id) id -# endif -# ifndef xthread_clear_id -# define xthread_clear_id(id) id = 0 -# endif -# ifndef xthread_equal -# define xthread_equal(id1,id2) ((id1) == (id2)) -# endif -/* aids understood by some debuggers */ -# ifndef xthread_set_name -# define xthread_set_name(t,str) -# endif -# ifndef xmutex_set_name -# define xmutex_set_name(m,str) -# endif -# ifndef xcondition_set_name -# define xcondition_set_name(cv,str) -# endif - -#endif /* _XTHREADS_H_ */ diff --git a/openflow/usr/include/X11/Xtos.h b/openflow/usr/include/X11/Xtos.h deleted file mode 100644 index 64b2da8..0000000 --- a/openflow/usr/include/X11/Xtos.h +++ /dev/null @@ -1,69 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _Xtos_h -#define _Xtos_h - -#define ALLOCATE_LOCAL_FALLBACK(_size) XtMalloc((unsigned long)(_size)) -#define DEALLOCATE_LOCAL_FALLBACK(_ptr) XtFree((XtPointer)(_ptr)) -#include - - -#if defined (_LP64) || \ - defined(__alpha) || defined(__alpha__) || \ - defined(__ia64__) || defined(ia64) || \ - defined(__sparc64__) || \ - defined(__s390x__) || \ - (defined(__hppa__) && defined(__LP64__)) || \ - defined(__amd64__) || defined(amd64) || \ - defined(__powerpc64__) || \ - (defined(sgi) && (_MIPS_SZLONG == 64)) -#define LONG64 -#endif - -#endif /* _Xtos_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/openflow/usr/include/X11/Xtrans/Xtrans.c b/openflow/usr/include/X11/Xtrans/Xtrans.c deleted file mode 100644 index bfba1ad..0000000 --- a/openflow/usr/include/X11/Xtrans/Xtrans.c +++ /dev/null @@ -1,1514 +0,0 @@ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#ifdef HAVE_SYSTEMD_DAEMON -#include -#endif - -/* - * The transport table contains a definition for every transport (protocol) - * family. All operations that can be made on the transport go through this - * table. - * - * Each transport is assigned a unique transport id. - * - * New transports can be added by adding an entry in this table. - * For compatiblity, the transport ids should never be renumbered. - * Always add to the end of the list. - */ - -#define TRANS_TLI_INET_INDEX 1 -#define TRANS_TLI_TCP_INDEX 2 -#define TRANS_TLI_TLI_INDEX 3 -#define TRANS_SOCKET_UNIX_INDEX 4 -#define TRANS_SOCKET_LOCAL_INDEX 5 -#define TRANS_SOCKET_INET_INDEX 6 -#define TRANS_SOCKET_TCP_INDEX 7 -#define TRANS_DNET_INDEX 8 -#define TRANS_LOCAL_LOCAL_INDEX 9 -#define TRANS_LOCAL_PTS_INDEX 10 -#define TRANS_LOCAL_NAMED_INDEX 11 -/* 12 used to be ISC, but that's gone. */ -#define TRANS_LOCAL_SCO_INDEX 13 -#define TRANS_SOCKET_INET6_INDEX 14 -#define TRANS_LOCAL_PIPE_INDEX 15 - - -static -Xtransport_table Xtransports[] = { -#if defined(TCPCONN) - { &TRANS(SocketTCPFuncs), TRANS_SOCKET_TCP_INDEX }, -#if defined(IPv6) && defined(AF_INET6) - { &TRANS(SocketINET6Funcs), TRANS_SOCKET_INET6_INDEX }, -#endif /* IPv6 */ - { &TRANS(SocketINETFuncs), TRANS_SOCKET_INET_INDEX }, -#endif /* TCPCONN */ -#if defined(UNIXCONN) -#if !defined(LOCALCONN) - { &TRANS(SocketLocalFuncs), TRANS_SOCKET_LOCAL_INDEX }, -#endif /* !LOCALCONN */ - { &TRANS(SocketUNIXFuncs), TRANS_SOCKET_UNIX_INDEX }, -#endif /* UNIXCONN */ -#if defined(LOCALCONN) - { &TRANS(LocalFuncs), TRANS_LOCAL_LOCAL_INDEX }, -#ifndef sun - { &TRANS(PTSFuncs), TRANS_LOCAL_PTS_INDEX }, -#endif /* sun */ -#if defined(SVR4) || defined(__SVR4) - { &TRANS(NAMEDFuncs), TRANS_LOCAL_NAMED_INDEX }, -#endif -#ifdef sun - { &TRANS(PIPEFuncs), TRANS_LOCAL_PIPE_INDEX }, -#endif /* sun */ -#if defined(__SCO__) || defined(__UNIXWARE__) - { &TRANS(SCOFuncs), TRANS_LOCAL_SCO_INDEX }, -#endif /* __SCO__ || __UNIXWARE__ */ -#endif /* LOCALCONN */ -}; - -#define NUMTRANS (sizeof(Xtransports)/sizeof(Xtransport_table)) - - -#ifdef WIN32 -#define ioctl ioctlsocket -#endif - - - -/* - * These are a few utility function used by the public interface functions. - */ - -void -TRANS(FreeConnInfo) (XtransConnInfo ciptr) - -{ - prmsg (3,"FreeConnInfo(%p)\n", ciptr); - - if (ciptr->addr) - free (ciptr->addr); - - if (ciptr->peeraddr) - free (ciptr->peeraddr); - - if (ciptr->port) - free (ciptr->port); - - free (ciptr); -} - - -#define PROTOBUFSIZE 20 - -static Xtransport * -TRANS(SelectTransport) (const char *protocol) - -{ - char protobuf[PROTOBUFSIZE]; - int i; - - prmsg (3,"SelectTransport(%s)\n", protocol); - - /* - * Force Protocol to be lowercase as a way of doing - * a case insensitive match. - */ - - strncpy (protobuf, protocol, PROTOBUFSIZE - 1); - protobuf[PROTOBUFSIZE-1] = '\0'; - - for (i = 0; i < PROTOBUFSIZE && protobuf[i] != '\0'; i++) - if (isupper ((unsigned char)protobuf[i])) - protobuf[i] = tolower ((unsigned char)protobuf[i]); - - /* Look at all of the configured protocols */ - - for (i = 0; i < NUMTRANS; i++) - { - if (!strcmp (protobuf, Xtransports[i].transport->TransName)) - return Xtransports[i].transport; - } - - return NULL; -} - -#ifndef TEST_t -static -#endif /* TEST_t */ -int -TRANS(ParseAddress) (const char *address, - char **protocol, char **host, char **port) - -{ - /* - * For the font library, the address is a string formatted - * as "protocol/host:port[/catalogue]". Note that the catologue - * is optional. At this time, the catologue info is ignored, but - * we have to parse it anyways. - * - * Other than fontlib, the address is a string formatted - * as "protocol/host:port". - * - * If the protocol part is missing, then assume TCP. - * If the protocol part and host part are missing, then assume local. - * If a "::" is found then assume DNET. - */ - - char *mybuf, *tmpptr; - const char *_protocol; - char *_host, *_port; - char hostnamebuf[256]; - int _host_len; - - prmsg (3,"ParseAddress(%s)\n", address); - - /* Copy the string so it can be changed */ - - tmpptr = mybuf = strdup (address); - - /* Parse the string to get each component */ - - /* Get the protocol part */ - - _protocol = mybuf; - - - if ( ((mybuf = strchr (mybuf,'/')) == NULL) && - ((mybuf = strrchr (tmpptr,':')) == NULL) ) - { - /* address is in a bad format */ - *protocol = NULL; - *host = NULL; - *port = NULL; - free (tmpptr); - return 0; - } - - if (*mybuf == ':') - { - /* - * If there is a hostname, then assume tcp, otherwise - * it must be local. - */ - if (mybuf == tmpptr) - { - /* There is neither a protocol or host specified */ - _protocol = "local"; - } - else - { - /* There is a hostname specified */ - _protocol = "tcp"; - mybuf = tmpptr; /* reset to the begining of the host ptr */ - } - } - else - { - /* *mybuf == '/' */ - - *mybuf ++= '\0'; /* put a null at the end of the protocol */ - - if (strlen(_protocol) == 0) - { - /* - * If there is a hostname, then assume tcp, otherwise - * it must be local. - */ - if (*mybuf != ':') - _protocol = "tcp"; - else - _protocol = "local"; - } - } - - /* Get the host part */ - - _host = mybuf; - - if ((mybuf = strrchr (mybuf,':')) == NULL) - { - *protocol = NULL; - *host = NULL; - *port = NULL; - free (tmpptr); - return 0; - } - - *mybuf ++= '\0'; - - _host_len = strlen(_host); - if (_host_len == 0) - { - TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf)); - _host = hostnamebuf; - } -#if defined(IPv6) && defined(AF_INET6) - /* hostname in IPv6 [numeric_addr]:0 form? */ - else if ( (_host_len > 3) && - ((strcmp(_protocol, "tcp") == 0) || (strcmp(_protocol, "inet6") == 0)) - && (*_host == '[') && (*(_host + _host_len - 1) == ']') ) { - struct sockaddr_in6 sin6; - - *(_host + _host_len - 1) = '\0'; - - /* Verify address is valid IPv6 numeric form */ - if (inet_pton(AF_INET6, _host + 1, &sin6) == 1) { - /* It is. Use it as such. */ - _host++; - _protocol = "inet6"; - } else { - /* It's not, restore it just in case some other code can use it. */ - *(_host + _host_len - 1) = ']'; - } - } -#endif - - - /* Get the port */ - - _port = mybuf; - -#if defined(FONT_t) || defined(FS_t) - /* - * Is there an optional catalogue list? - */ - - if ((mybuf = strchr (mybuf,'/')) != NULL) - *mybuf ++= '\0'; - - /* - * The rest, if any, is the (currently unused) catalogue list. - * - * _catalogue = mybuf; - */ -#endif - -#ifdef HAVE_LAUNCHD - /* launchd sockets will look like 'local//tmp/launch-XgkNns/:0' */ - if(address != NULL && strlen(address)>8 && (!strncmp(address,"local//",7))) { - _protocol="local"; - _host=""; - _port=address+6; - } -#endif - - /* - * Now that we have all of the components, allocate new - * string space for them. - */ - - if ((*protocol = strdup (_protocol)) == NULL) - { - /* Malloc failed */ - *port = NULL; - *host = NULL; - *protocol = NULL; - free (tmpptr); - return 0; - } - - if ((*host = strdup (_host)) == NULL) - { - /* Malloc failed */ - *port = NULL; - *host = NULL; - free (*protocol); - *protocol = NULL; - free (tmpptr); - return 0; - } - - if ((*port = strdup (_port)) == NULL) - { - /* Malloc failed */ - *port = NULL; - free (*host); - *host = NULL; - free (*protocol); - *protocol = NULL; - free (tmpptr); - return 0; - } - - free (tmpptr); - - return 1; -} - - -/* - * TRANS(Open) does all of the real work opening a connection. The only - * funny part about this is the type parameter which is used to decide which - * type of open to perform. - */ - -static XtransConnInfo -TRANS(Open) (int type, const char *address) - -{ - char *protocol = NULL, *host = NULL, *port = NULL; - XtransConnInfo ciptr = NULL; - Xtransport *thistrans; - - prmsg (2,"Open(%d,%s)\n", type, address); - -#if defined(WIN32) && defined(TCPCONN) - if (TRANS(WSAStartup)()) - { - prmsg (1,"Open: WSAStartup failed\n"); - return NULL; - } -#endif - - /* Parse the Address */ - - if (TRANS(ParseAddress) (address, &protocol, &host, &port) == 0) - { - prmsg (1,"Open: Unable to Parse address %s\n", address); - return NULL; - } - - /* Determine the transport type */ - - if ((thistrans = TRANS(SelectTransport) (protocol)) == NULL) - { - prmsg (1,"Open: Unable to find transport for %s\n", - protocol); - - free (protocol); - free (host); - free (port); - return NULL; - } - - /* Open the transport */ - - switch (type) - { - case XTRANS_OPEN_COTS_CLIENT: -#ifdef TRANS_CLIENT - ciptr = thistrans->OpenCOTSClient(thistrans, protocol, host, port); -#endif /* TRANS_CLIENT */ - break; - case XTRANS_OPEN_COTS_SERVER: -#ifdef TRANS_SERVER - ciptr = thistrans->OpenCOTSServer(thistrans, protocol, host, port); -#endif /* TRANS_SERVER */ - break; - case XTRANS_OPEN_CLTS_CLIENT: -#ifdef TRANS_CLIENT - ciptr = thistrans->OpenCLTSClient(thistrans, protocol, host, port); -#endif /* TRANS_CLIENT */ - break; - case XTRANS_OPEN_CLTS_SERVER: -#ifdef TRANS_SERVER - ciptr = thistrans->OpenCLTSServer(thistrans, protocol, host, port); -#endif /* TRANS_SERVER */ - break; - default: - prmsg (1,"Open: Unknown Open type %d\n", type); - } - - if (ciptr == NULL) - { - if (!(thistrans->flags & TRANS_DISABLED)) - { - prmsg (1,"Open: transport open failed for %s/%s:%s\n", - protocol, host, port); - } - free (protocol); - free (host); - free (port); - return NULL; - } - - ciptr->transptr = thistrans; - ciptr->port = port; /* We need this for TRANS(Reopen) */ - - free (protocol); - free (host); - - return ciptr; -} - - -#ifdef TRANS_REOPEN - -/* - * We might want to create an XtransConnInfo object based on a previously - * opened connection. For example, the font server may clone itself and - * pass file descriptors to the parent. - */ - -static XtransConnInfo -TRANS(Reopen) (int type, int trans_id, int fd, const char *port) - -{ - XtransConnInfo ciptr = NULL; - Xtransport *thistrans = NULL; - char *save_port; - int i; - - prmsg (2,"Reopen(%d,%d,%s)\n", trans_id, fd, port); - - /* Determine the transport type */ - - for (i = 0; i < NUMTRANS; i++) - if (Xtransports[i].transport_id == trans_id) - { - thistrans = Xtransports[i].transport; - break; - } - - if (thistrans == NULL) - { - prmsg (1,"Reopen: Unable to find transport id %d\n", - trans_id); - - return NULL; - } - - if ((save_port = strdup (port)) == NULL) - { - prmsg (1,"Reopen: Unable to malloc port string\n"); - - return NULL; - } - - /* Get a new XtransConnInfo object */ - - switch (type) - { - case XTRANS_OPEN_COTS_SERVER: - ciptr = thistrans->ReopenCOTSServer(thistrans, fd, port); - break; - case XTRANS_OPEN_CLTS_SERVER: - ciptr = thistrans->ReopenCLTSServer(thistrans, fd, port); - break; - default: - prmsg (1,"Reopen: Bad Open type %d\n", type); - } - - if (ciptr == NULL) - { - prmsg (1,"Reopen: transport open failed\n"); - free (save_port); - return NULL; - } - - ciptr->transptr = thistrans; - ciptr->port = save_port; - - return ciptr; -} - -#endif /* TRANS_REOPEN */ - - - -/* - * These are the public interfaces to this Transport interface. - * These are the only functions that should have knowledge of the transport - * table. - */ - -#ifdef TRANS_CLIENT - -XtransConnInfo -TRANS(OpenCOTSClient) (const char *address) - -{ - prmsg (2,"OpenCOTSClient(%s)\n", address); - return TRANS(Open) (XTRANS_OPEN_COTS_CLIENT, address); -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -XtransConnInfo -TRANS(OpenCOTSServer) (const char *address) - -{ - prmsg (2,"OpenCOTSServer(%s)\n", address); - return TRANS(Open) (XTRANS_OPEN_COTS_SERVER, address); -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_CLIENT - -XtransConnInfo -TRANS(OpenCLTSClient) (const char *address) - -{ - prmsg (2,"OpenCLTSClient(%s)\n", address); - return TRANS(Open) (XTRANS_OPEN_CLTS_CLIENT, address); -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -XtransConnInfo -TRANS(OpenCLTSServer) (const char *address) - -{ - prmsg (2,"OpenCLTSServer(%s)\n", address); - return TRANS(Open) (XTRANS_OPEN_CLTS_SERVER, address); -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_REOPEN - -XtransConnInfo -TRANS(ReopenCOTSServer) (int trans_id, int fd, const char *port) - -{ - prmsg (2,"ReopenCOTSServer(%d, %d, %s)\n", trans_id, fd, port); - return TRANS(Reopen) (XTRANS_OPEN_COTS_SERVER, trans_id, fd, port); -} - -XtransConnInfo -TRANS(ReopenCLTSServer) (int trans_id, int fd, const char *port) - -{ - prmsg (2,"ReopenCLTSServer(%d, %d, %s)\n", trans_id, fd, port); - return TRANS(Reopen) (XTRANS_OPEN_CLTS_SERVER, trans_id, fd, port); -} - - -int -TRANS(GetReopenInfo) (XtransConnInfo ciptr, - int *trans_id, int *fd, char **port) - -{ - int i; - - for (i = 0; i < NUMTRANS; i++) - if (Xtransports[i].transport == ciptr->transptr) - { - *trans_id = Xtransports[i].transport_id; - *fd = ciptr->fd; - - if ((*port = strdup (ciptr->port)) == NULL) - return 0; - else - return 1; - } - - return 0; -} - -#endif /* TRANS_REOPEN */ - - -int -TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg) - -{ - int fd = ciptr->fd; - int ret = 0; - - prmsg (2,"SetOption(%d,%d,%d)\n", fd, option, arg); - - /* - * For now, all transport type use the same stuff for setting options. - * As long as this is true, we can put the common code here. Once a more - * complicated transport such as shared memory or an OSI implementation - * that uses the session and application libraries is implemented, this - * code may have to move to a transport dependent function. - * - * ret = ciptr->transptr->SetOption (ciptr, option, arg); - */ - - switch (option) - { - case TRANS_NONBLOCKING: - switch (arg) - { - case 0: - /* Set to blocking mode */ - break; - case 1: /* Set to non-blocking mode */ - -#if defined(O_NONBLOCK) && !defined(SCO325) - ret = fcntl (fd, F_GETFL, 0); - if (ret != -1) - ret = fcntl (fd, F_SETFL, ret | O_NONBLOCK); -#else -#ifdef FIOSNBIO - { - int arg; - arg = 1; - ret = ioctl (fd, FIOSNBIO, &arg); - } -#else -#if defined(WIN32) - { -#ifdef WIN32 - u_long arg; -#else - int arg; -#endif - arg = 1; -/* IBM TCP/IP understands this option too well: it causes TRANS(Read) to fail - * eventually with EWOULDBLOCK */ - ret = ioctl (fd, FIONBIO, &arg); - } -#else - ret = fcntl (fd, F_GETFL, 0); -#ifdef FNDELAY - ret = fcntl (fd, F_SETFL, ret | FNDELAY); -#else - ret = fcntl (fd, F_SETFL, ret | O_NDELAY); -#endif -#endif /* AIXV3 || uniosu */ -#endif /* FIOSNBIO */ -#endif /* O_NONBLOCK */ - break; - default: - /* Unknown option */ - break; - } - break; - case TRANS_CLOSEONEXEC: -#ifdef F_SETFD -#ifdef FD_CLOEXEC - ret = fcntl (fd, F_SETFD, FD_CLOEXEC); -#else - ret = fcntl (fd, F_SETFD, 1); -#endif /* FD_CLOEXEC */ -#endif /* F_SETFD */ - break; - } - - return ret; -} - -#ifdef TRANS_SERVER - -int -TRANS(CreateListener) (XtransConnInfo ciptr, const char *port, unsigned int flags) - -{ - return ciptr->transptr->CreateListener (ciptr, port, flags); -} - -int -TRANS(Received) (const char * protocol) - -{ - Xtransport *trans; - int i = 0, ret = 0; - - prmsg (5, "Received(%s)\n", protocol); - - if ((trans = TRANS(SelectTransport)(protocol)) == NULL) - { - prmsg (1,"Received: unable to find transport: %s\n", - protocol); - - return -1; - } - if (trans->flags & TRANS_ALIAS) { - if (trans->nolisten) - while (trans->nolisten[i]) { - ret |= TRANS(Received)(trans->nolisten[i]); - i++; - } - } - - trans->flags |= TRANS_RECEIVED; - return ret; -} - -int -TRANS(NoListen) (const char * protocol) - -{ - Xtransport *trans; - int i = 0, ret = 0; - - if ((trans = TRANS(SelectTransport)(protocol)) == NULL) - { - prmsg (1,"TransNoListen: unable to find transport: %s\n", - protocol); - - return -1; - } - if (trans->flags & TRANS_ALIAS) { - if (trans->nolisten) - while (trans->nolisten[i]) { - ret |= TRANS(NoListen)(trans->nolisten[i]); - i++; - } - } - - trans->flags |= TRANS_NOLISTEN; - return ret; -} - -int -TRANS(Listen) (const char * protocol) -{ - Xtransport *trans; - int i = 0, ret = 0; - - if ((trans = TRANS(SelectTransport)(protocol)) == NULL) - { - prmsg (1,"TransListen: unable to find transport: %s\n", - protocol); - - return -1; - } - if (trans->flags & TRANS_ALIAS) { - if (trans->nolisten) - while (trans->nolisten[i]) { - ret |= TRANS(Listen)(trans->nolisten[i]); - i++; - } - } - - trans->flags &= ~TRANS_NOLISTEN; - return ret; -} - -int -TRANS(IsListening) (const char * protocol) -{ - Xtransport *trans; - - if ((trans = TRANS(SelectTransport)(protocol)) == NULL) - { - prmsg (1,"TransIsListening: unable to find transport: %s\n", - protocol); - - return 0; - } - - return !(trans->flags & TRANS_NOLISTEN); -} - -int -TRANS(ResetListener) (XtransConnInfo ciptr) - -{ - if (ciptr->transptr->ResetListener) - return ciptr->transptr->ResetListener (ciptr); - else - return TRANS_RESET_NOOP; -} - - -XtransConnInfo -TRANS(Accept) (XtransConnInfo ciptr, int *status) - -{ - XtransConnInfo newciptr; - - prmsg (2,"Accept(%d)\n", ciptr->fd); - - newciptr = ciptr->transptr->Accept (ciptr, status); - - if (newciptr) - newciptr->transptr = ciptr->transptr; - - return newciptr; -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_CLIENT - -int -TRANS(Connect) (XtransConnInfo ciptr, const char *address) - -{ - char *protocol; - char *host; - char *port; - int ret; - - prmsg (2,"Connect(%d,%s)\n", ciptr->fd, address); - - if (TRANS(ParseAddress) (address, &protocol, &host, &port) == 0) - { - prmsg (1,"Connect: Unable to Parse address %s\n", - address); - return -1; - } - -#ifdef HAVE_LAUNCHD - if (!host) host=strdup(""); -#endif - - if (!port || !*port) - { - prmsg (1,"Connect: Missing port specification in %s\n", - address); - if (protocol) free (protocol); - if (host) free (host); - return -1; - } - - ret = ciptr->transptr->Connect (ciptr, host, port); - - if (protocol) free (protocol); - if (host) free (host); - if (port) free (port); - - return ret; -} - -#endif /* TRANS_CLIENT */ - - -int -TRANS(BytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) - -{ - return ciptr->transptr->BytesReadable (ciptr, pend); -} - -int -TRANS(Read) (XtransConnInfo ciptr, char *buf, int size) - -{ - return ciptr->transptr->Read (ciptr, buf, size); -} - -int -TRANS(Write) (XtransConnInfo ciptr, char *buf, int size) - -{ - return ciptr->transptr->Write (ciptr, buf, size); -} - -int -TRANS(Readv) (XtransConnInfo ciptr, struct iovec *buf, int size) - -{ - return ciptr->transptr->Readv (ciptr, buf, size); -} - -int -TRANS(Writev) (XtransConnInfo ciptr, struct iovec *buf, int size) - -{ - return ciptr->transptr->Writev (ciptr, buf, size); -} - -#if XTRANS_SEND_FDS -int -TRANS(SendFd) (XtransConnInfo ciptr, int fd, int do_close) -{ - return ciptr->transptr->SendFd(ciptr, fd, do_close); -} - -int -TRANS(RecvFd) (XtransConnInfo ciptr) -{ - return ciptr->transptr->RecvFd(ciptr); -} -#endif - -int -TRANS(Disconnect) (XtransConnInfo ciptr) - -{ - return ciptr->transptr->Disconnect (ciptr); -} - -int -TRANS(Close) (XtransConnInfo ciptr) - -{ - int ret; - - prmsg (2,"Close(%d)\n", ciptr->fd); - - ret = ciptr->transptr->Close (ciptr); - - TRANS(FreeConnInfo) (ciptr); - - return ret; -} - -int -TRANS(CloseForCloning) (XtransConnInfo ciptr) - -{ - int ret; - - prmsg (2,"CloseForCloning(%d)\n", ciptr->fd); - - ret = ciptr->transptr->CloseForCloning (ciptr); - - TRANS(FreeConnInfo) (ciptr); - - return ret; -} - -int -TRANS(IsLocal) (XtransConnInfo ciptr) - -{ - return (ciptr->family == AF_UNIX); -} - - -int -TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp, - Xtransaddr **addrp) - -{ - prmsg (2,"GetMyAddr(%d)\n", ciptr->fd); - - *familyp = ciptr->family; - *addrlenp = ciptr->addrlen; - - if ((*addrp = malloc (ciptr->addrlen)) == NULL) - { - prmsg (1,"GetMyAddr: malloc failed\n"); - return -1; - } - memcpy(*addrp, ciptr->addr, ciptr->addrlen); - - return 0; -} - -int -TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp, - Xtransaddr **addrp) - -{ - prmsg (2,"GetPeerAddr(%d)\n", ciptr->fd); - - *familyp = ciptr->family; - *addrlenp = ciptr->peeraddrlen; - - if ((*addrp = malloc (ciptr->peeraddrlen)) == NULL) - { - prmsg (1,"GetPeerAddr: malloc failed\n"); - return -1; - } - memcpy(*addrp, ciptr->peeraddr, ciptr->peeraddrlen); - - return 0; -} - - -int -TRANS(GetConnectionNumber) (XtransConnInfo ciptr) - -{ - return ciptr->fd; -} - - -/* - * These functions are really utility functions, but they require knowledge - * of the internal data structures, so they have to be part of the Transport - * Independant API. - */ - -#ifdef TRANS_SERVER - -static int -complete_network_count (void) - -{ - int count = 0; - int found_local = 0; - int i; - - /* - * For a complete network, we only need one LOCALCONN transport to work - */ - - for (i = 0; i < NUMTRANS; i++) - { - if (Xtransports[i].transport->flags & TRANS_ALIAS - || Xtransports[i].transport->flags & TRANS_NOLISTEN) - continue; - - if (Xtransports[i].transport->flags & TRANS_LOCAL) - found_local = 1; - else - count++; - } - - return (count + found_local); -} - - -static int -receive_listening_fds(const char* port, XtransConnInfo* temp_ciptrs, - int* count_ret) - -{ -#ifdef HAVE_SYSTEMD_DAEMON - XtransConnInfo ciptr; - int i, systemd_listen_fds; - - systemd_listen_fds = sd_listen_fds(1); - if (systemd_listen_fds < 0) - { - prmsg (1, "receive_listening_fds: sd_listen_fds error: %s\n", - strerror(-systemd_listen_fds)); - return -1; - } - - for (i = 0; i < systemd_listen_fds && *count_ret < NUMTRANS; i++) - { - struct sockaddr_storage a; - int ti; - const char* tn; - socklen_t al; - - al = sizeof(a); - if (getsockname(i + SD_LISTEN_FDS_START, (struct sockaddr*)&a, &al) < 0) { - prmsg (1, "receive_listening_fds: getsockname error: %s\n", - strerror(errno)); - return -1; - } - - switch (a.ss_family) - { - case AF_UNIX: - ti = TRANS_SOCKET_UNIX_INDEX; - if (*((struct sockaddr_un*)&a)->sun_path == '\0' && - al > sizeof(sa_family_t)) - tn = "local"; - else - tn = "unix"; - break; - case AF_INET: - ti = TRANS_SOCKET_INET_INDEX; - tn = "inet"; - break; -#if defined(IPv6) && defined(AF_INET6) - case AF_INET6: - ti = TRANS_SOCKET_INET6_INDEX; - tn = "inet6"; - break; -#endif /* IPv6 */ - default: - prmsg (1, "receive_listening_fds:" - "Got unknown socket address family\n"); - return -1; - } - - ciptr = TRANS(ReopenCOTSServer)(ti, i + SD_LISTEN_FDS_START, port); - if (!ciptr) - { - prmsg (1, "receive_listening_fds:" - "Got NULL while trying to reopen socket received from systemd.\n"); - return -1; - } - - prmsg (5, "receive_listening_fds: received listener for %s, %d\n", - tn, ciptr->fd); - temp_ciptrs[(*count_ret)++] = ciptr; - TRANS(Received)(tn); - } -#endif /* HAVE_SYSTEMD_DAEMON */ - return 0; -} - -#ifdef XQUARTZ_EXPORTS_LAUNCHD_FD -extern int xquartz_launchd_fd; -#endif - -int -TRANS(MakeAllCOTSServerListeners) (const char *port, int *partial, - int *count_ret, XtransConnInfo **ciptrs_ret) - -{ - char buffer[256]; /* ??? What size ?? */ - XtransConnInfo ciptr, temp_ciptrs[NUMTRANS]; - int status, i, j; - -#if defined(IPv6) && defined(AF_INET6) - int ipv6_succ = 0; -#endif - prmsg (2,"MakeAllCOTSServerListeners(%s,%p)\n", - port ? port : "NULL", ciptrs_ret); - - *count_ret = 0; - -#ifdef XQUARTZ_EXPORTS_LAUNCHD_FD - fprintf(stderr, "Launchd socket fd: %d\n", xquartz_launchd_fd); - if(xquartz_launchd_fd != -1) { - if((ciptr = TRANS(ReopenCOTSServer(TRANS_SOCKET_LOCAL_INDEX, - xquartz_launchd_fd, getenv("DISPLAY"))))==NULL) - fprintf(stderr,"Got NULL while trying to Reopen launchd port\n"); - else - temp_ciptrs[(*count_ret)++] = ciptr; - } -#endif - - if (receive_listening_fds(port, temp_ciptrs, count_ret) < 0) - return -1; - - for (i = 0; i < NUMTRANS; i++) - { - Xtransport *trans = Xtransports[i].transport; - unsigned int flags = 0; - - if (trans->flags&TRANS_ALIAS || trans->flags&TRANS_NOLISTEN || - trans->flags&TRANS_RECEIVED) - continue; - - snprintf(buffer, sizeof(buffer), "%s/:%s", - trans->TransName, port ? port : ""); - - prmsg (5,"MakeAllCOTSServerListeners: opening %s\n", - buffer); - - if ((ciptr = TRANS(OpenCOTSServer(buffer))) == NULL) - { - if (trans->flags & TRANS_DISABLED) - continue; - - prmsg (1, - "MakeAllCOTSServerListeners: failed to open listener for %s\n", - trans->TransName); - continue; - } -#if defined(IPv6) && defined(AF_INET6) - if ((Xtransports[i].transport_id == TRANS_SOCKET_INET_INDEX - && ipv6_succ)) - flags |= ADDR_IN_USE_ALLOWED; -#endif - - if ((status = TRANS(CreateListener (ciptr, port, flags))) < 0) - { - if (status == TRANS_ADDR_IN_USE) - { - /* - * We failed to bind to the specified address because the - * address is in use. It must be that a server is already - * running at this address, and this function should fail. - */ - - prmsg (1, - "MakeAllCOTSServerListeners: server already running\n"); - - for (j = 0; j < *count_ret; j++) - TRANS(Close) (temp_ciptrs[j]); - - *count_ret = 0; - *ciptrs_ret = NULL; - *partial = 0; - return -1; - } - else - { - prmsg (1, - "MakeAllCOTSServerListeners: failed to create listener for %s\n", - trans->TransName); - - continue; - } - } - -#if defined(IPv6) && defined(AF_INET6) - if (Xtransports[i].transport_id == TRANS_SOCKET_INET6_INDEX) - ipv6_succ = 1; -#endif - - prmsg (5, - "MakeAllCOTSServerListeners: opened listener for %s, %d\n", - trans->TransName, ciptr->fd); - - temp_ciptrs[*count_ret] = ciptr; - (*count_ret)++; - } - - *partial = (*count_ret < complete_network_count()); - - prmsg (5, - "MakeAllCOTSServerListeners: partial=%d, actual=%d, complete=%d \n", - *partial, *count_ret, complete_network_count()); - - if (*count_ret > 0) - { - if ((*ciptrs_ret = malloc ( - *count_ret * sizeof (XtransConnInfo))) == NULL) - { - return -1; - } - - for (i = 0; i < *count_ret; i++) - { - (*ciptrs_ret)[i] = temp_ciptrs[i]; - } - } - else - *ciptrs_ret = NULL; - - return 0; -} - -int -TRANS(MakeAllCLTSServerListeners) (const char *port, int *partial, - int *count_ret, XtransConnInfo **ciptrs_ret) - -{ - char buffer[256]; /* ??? What size ?? */ - XtransConnInfo ciptr, temp_ciptrs[NUMTRANS]; - int status, i, j; - - prmsg (2,"MakeAllCLTSServerListeners(%s,%p)\n", - port ? port : "NULL", ciptrs_ret); - - *count_ret = 0; - - for (i = 0; i < NUMTRANS; i++) - { - Xtransport *trans = Xtransports[i].transport; - - if (trans->flags&TRANS_ALIAS || trans->flags&TRANS_NOLISTEN) - continue; - - snprintf(buffer, sizeof(buffer), "%s/:%s", - trans->TransName, port ? port : ""); - - prmsg (5,"MakeAllCLTSServerListeners: opening %s\n", - buffer); - - if ((ciptr = TRANS(OpenCLTSServer (buffer))) == NULL) - { - prmsg (1, - "MakeAllCLTSServerListeners: failed to open listener for %s\n", - trans->TransName); - continue; - } - - if ((status = TRANS(CreateListener (ciptr, port, 0))) < 0) - { - if (status == TRANS_ADDR_IN_USE) - { - /* - * We failed to bind to the specified address because the - * address is in use. It must be that a server is already - * running at this address, and this function should fail. - */ - - prmsg (1, - "MakeAllCLTSServerListeners: server already running\n"); - - for (j = 0; j < *count_ret; j++) - TRANS(Close) (temp_ciptrs[j]); - - *count_ret = 0; - *ciptrs_ret = NULL; - *partial = 0; - return -1; - } - else - { - prmsg (1, - "MakeAllCLTSServerListeners: failed to create listener for %s\n", - trans->TransName); - - continue; - } - } - - prmsg (5, - "MakeAllCLTSServerListeners: opened listener for %s, %d\n", - trans->TransName, ciptr->fd); - temp_ciptrs[*count_ret] = ciptr; - (*count_ret)++; - } - - *partial = (*count_ret < complete_network_count()); - - prmsg (5, - "MakeAllCLTSServerListeners: partial=%d, actual=%d, complete=%d \n", - *partial, *count_ret, complete_network_count()); - - if (*count_ret > 0) - { - if ((*ciptrs_ret = malloc ( - *count_ret * sizeof (XtransConnInfo))) == NULL) - { - return -1; - } - - for (i = 0; i < *count_ret; i++) - { - (*ciptrs_ret)[i] = temp_ciptrs[i]; - } - } - else - *ciptrs_ret = NULL; - - return 0; -} - -#endif /* TRANS_SERVER */ - - - -/* - * These routines are not part of the X Transport Interface, but they - * may be used by it. - */ - - -#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32) - -/* - * emulate readv - */ - -static int TRANS(ReadV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt) - -{ - int i, len, total; - char *base; - - ESET(0); - for (i = 0, total = 0; i < iovcnt; i++, iov++) { - len = iov->iov_len; - base = iov->iov_base; - while (len > 0) { - register int nbytes; - nbytes = TRANS(Read) (ciptr, base, len); - if (nbytes < 0 && total == 0) return -1; - if (nbytes <= 0) return total; - ESET(0); - len -= nbytes; - total += nbytes; - base += nbytes; - } - } - return total; -} - -#endif /* SYSV && __i386__ || WIN32 || __sxg__ */ - -#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32) - -/* - * emulate writev - */ - -static int TRANS(WriteV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt) - -{ - int i, len, total; - char *base; - - ESET(0); - for (i = 0, total = 0; i < iovcnt; i++, iov++) { - len = iov->iov_len; - base = iov->iov_base; - while (len > 0) { - register int nbytes; - nbytes = TRANS(Write) (ciptr, base, len); - if (nbytes < 0 && total == 0) return -1; - if (nbytes <= 0) return total; - ESET(0); - len -= nbytes; - total += nbytes; - base += nbytes; - } - } - return total; -} - -#endif /* SYSV && __i386__ || WIN32 || __sxg__ */ - - -#if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SVR4) || defined(__SCO__) -#ifndef NEED_UTSNAME -#define NEED_UTSNAME -#endif -#include -#endif - -/* - * TRANS(GetHostname) - similar to gethostname but allows special processing. - */ - -int TRANS(GetHostname) (char *buf, int maxlen) - -{ - int len; - -#ifdef NEED_UTSNAME - struct utsname name; - - uname (&name); - len = strlen (name.nodename); - if (len >= maxlen) len = maxlen - 1; - strncpy (buf, name.nodename, len); - buf[len] = '\0'; -#else - buf[0] = '\0'; - (void) gethostname (buf, maxlen); - buf [maxlen - 1] = '\0'; - len = strlen(buf); -#endif /* NEED_UTSNAME */ - return len; -} diff --git a/openflow/usr/include/X11/Xtrans/Xtrans.h b/openflow/usr/include/X11/Xtrans/Xtrans.h deleted file mode 100644 index 026fbd7..0000000 --- a/openflow/usr/include/X11/Xtrans/Xtrans.h +++ /dev/null @@ -1,466 +0,0 @@ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _XTRANS_H_ -#define _XTRANS_H_ - -#include -#include - -#ifndef WIN32 -#include -#endif - -#ifdef __clang__ -/* Not all clients make use of all provided statics */ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-function" -#endif - -/* - * Set the functions names according to where this code is being compiled. - */ - -#ifdef X11_t -#define TRANS(func) _X11Trans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_X11Trans"; -#endif -#endif /* X11_t */ - -#ifdef XSERV_t -#define TRANS(func) _XSERVTrans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_XSERVTrans"; -#endif -#define X11_t -#endif /* XSERV_t */ - -#ifdef XIM_t -#define TRANS(func) _XimXTrans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_XimTrans"; -#endif -#endif /* XIM_t */ - -#ifdef FS_t -#define TRANS(func) _FSTrans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_FSTrans"; -#endif -#endif /* FS_t */ - -#ifdef FONT_t -#define TRANS(func) _FontTrans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_FontTrans"; -#endif -#endif /* FONT_t */ - -#ifdef ICE_t -#define TRANS(func) _IceTrans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_IceTrans"; -#endif -#endif /* ICE_t */ - -#ifdef TEST_t -#define TRANS(func) _TESTTrans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_TESTTrans"; -#endif -#endif /* TEST_t */ - -#ifdef LBXPROXY_t -#define TRANS(func) _LBXPROXYTrans##func -#define X11_t /* The server defines this - so should the LBX proxy */ -#ifdef XTRANSDEBUG -static const char *__xtransname = "_LBXPROXYTrans"; -#endif -#endif /* LBXPROXY_t */ - -#if !defined(TRANS) -#define TRANS(func) _XTrans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_XTrans"; -#endif -#endif /* !TRANS */ - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -/* - * Create a single address structure that can be used wherever - * an address structure is needed. struct sockaddr is not big enough - * to hold a sockadd_un, so we create this definition to have a single - * structure that is big enough for all the structures we might need. - * - * This structure needs to be independent of the socket/TLI interface used. - */ - -#if defined(IPv6) && defined(AF_INET6) -typedef struct sockaddr_storage Xtransaddr; -#else -#define XTRANS_MAX_ADDR_LEN 128 /* large enough to hold sun_path */ - -typedef struct { - unsigned char addr[XTRANS_MAX_ADDR_LEN]; -} Xtransaddr; -#endif - -#ifdef LONG64 -typedef int BytesReadable_t; -#else -typedef long BytesReadable_t; -#endif - - -#if defined(WIN32) || defined(USG) - -/* - * TRANS(Readv) and TRANS(Writev) use struct iovec, normally found - * in Berkeley systems in . See the readv(2) and writev(2) - * manual pages for details. - */ - -struct iovec { - caddr_t iov_base; - int iov_len; -}; - -#else -#include -#endif - -typedef struct _XtransConnInfo *XtransConnInfo; - - -/* - * Transport Option definitions - */ - -#define TRANS_NONBLOCKING 1 -#define TRANS_CLOSEONEXEC 2 - - -/* - * Return values of Connect (0 is success) - */ - -#define TRANS_CONNECT_FAILED -1 -#define TRANS_TRY_CONNECT_AGAIN -2 -#define TRANS_IN_PROGRESS -3 - - -/* - * Return values of CreateListener (0 is success) - */ - -#define TRANS_CREATE_LISTENER_FAILED -1 -#define TRANS_ADDR_IN_USE -2 - - -/* - * Return values of Accept (0 is success) - */ - -#define TRANS_ACCEPT_BAD_MALLOC -1 -#define TRANS_ACCEPT_FAILED -2 -#define TRANS_ACCEPT_MISC_ERROR -3 - - -/* - * ResetListener return values - */ - -#define TRANS_RESET_NOOP 1 -#define TRANS_RESET_NEW_FD 2 -#define TRANS_RESET_FAILURE 3 - - -/* - * Function prototypes for the exposed interface - */ - -void TRANS(FreeConnInfo) ( - XtransConnInfo /* ciptr */ -); - -#ifdef TRANS_CLIENT - -XtransConnInfo TRANS(OpenCOTSClient)( - const char * /* address */ -); - -#endif /* TRANS_CLIENT */ - -#ifdef TRANS_SERVER - -XtransConnInfo TRANS(OpenCOTSServer)( - const char * /* address */ -); - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_CLIENT - -XtransConnInfo TRANS(OpenCLTSClient)( - const char * /* address */ -); - -#endif /* TRANS_CLIENT */ - -#ifdef TRANS_SERVER - -XtransConnInfo TRANS(OpenCLTSServer)( - const char * /* address */ -); - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_REOPEN - -XtransConnInfo TRANS(ReopenCOTSServer)( - int, /* trans_id */ - int, /* fd */ - const char * /* port */ -); - -XtransConnInfo TRANS(ReopenCLTSServer)( - int, /* trans_id */ - int, /* fd */ - const char * /* port */ -); - -int TRANS(GetReopenInfo)( - XtransConnInfo, /* ciptr */ - int *, /* trans_id */ - int *, /* fd */ - char ** /* port */ -); - -#endif /* TRANS_REOPEN */ - - -int TRANS(SetOption)( - XtransConnInfo, /* ciptr */ - int, /* option */ - int /* arg */ -); - -#ifdef TRANS_SERVER - -int TRANS(CreateListener)( - XtransConnInfo, /* ciptr */ - const char *, /* port */ - unsigned int /* flags */ -); - -int TRANS(Received) ( - const char* /* protocol*/ -); - -int TRANS(NoListen) ( - const char* /* protocol*/ -); - -int TRANS(Listen) ( - const char* /* protocol*/ -); - -int TRANS(IsListening) ( - const char* /* protocol*/ -); - -int TRANS(ResetListener)( - XtransConnInfo /* ciptr */ -); - -XtransConnInfo TRANS(Accept)( - XtransConnInfo, /* ciptr */ - int * /* status */ -); - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_CLIENT - -int TRANS(Connect)( - XtransConnInfo, /* ciptr */ - const char * /* address */ -); - -#endif /* TRANS_CLIENT */ - -int TRANS(BytesReadable)( - XtransConnInfo, /* ciptr */ - BytesReadable_t * /* pend */ -); - -int TRANS(Read)( - XtransConnInfo, /* ciptr */ - char *, /* buf */ - int /* size */ -); - -int TRANS(Write)( - XtransConnInfo, /* ciptr */ - char *, /* buf */ - int /* size */ -); - -int TRANS(Readv)( - XtransConnInfo, /* ciptr */ - struct iovec *, /* buf */ - int /* size */ -); - -int TRANS(Writev)( - XtransConnInfo, /* ciptr */ - struct iovec *, /* buf */ - int /* size */ -); - -int TRANS(SendFd) (XtransConnInfo ciptr, int fd, int do_close); - -int TRANS(RecvFd) (XtransConnInfo ciptr); - -int TRANS(Disconnect)( - XtransConnInfo /* ciptr */ -); - -int TRANS(Close)( - XtransConnInfo /* ciptr */ -); - -int TRANS(CloseForCloning)( - XtransConnInfo /* ciptr */ -); - -int TRANS(IsLocal)( - XtransConnInfo /* ciptr */ -); - -int TRANS(GetMyAddr)( - XtransConnInfo, /* ciptr */ - int *, /* familyp */ - int *, /* addrlenp */ - Xtransaddr ** /* addrp */ -); - -int TRANS(GetPeerAddr)( - XtransConnInfo, /* ciptr */ - int *, /* familyp */ - int *, /* addrlenp */ - Xtransaddr ** /* addrp */ -); - -int TRANS(GetConnectionNumber)( - XtransConnInfo /* ciptr */ -); - -#ifdef TRANS_SERVER - -int TRANS(MakeAllCOTSServerListeners)( - const char *, /* port */ - int *, /* partial */ - int *, /* count_ret */ - XtransConnInfo ** /* ciptrs_ret */ -); - -int TRANS(MakeAllCLTSServerListeners)( - const char *, /* port */ - int *, /* partial */ - int *, /* count_ret */ - XtransConnInfo ** /* ciptrs_ret */ -); - -#endif /* TRANS_SERVER */ - - -/* - * Function Prototypes for Utility Functions. - */ - -#ifdef X11_t - -int TRANS(ConvertAddress)( - int *, /* familyp */ - int *, /* addrlenp */ - Xtransaddr ** /* addrp */ -); - -#endif /* X11_t */ - -#ifdef ICE_t - -char * -TRANS(GetMyNetworkId)( - XtransConnInfo /* ciptr */ -); - -char * -TRANS(GetPeerNetworkId)( - XtransConnInfo /* ciptr */ -); - -#endif /* ICE_t */ - -int -TRANS(GetHostname) ( - char * /* buf */, - int /* maxlen */ -); - -#if defined(WIN32) && defined(TCPCONN) -int TRANS(WSAStartup)(); -#endif - -#endif /* _XTRANS_H_ */ diff --git a/openflow/usr/include/X11/Xtrans/Xtransint.h b/openflow/usr/include/X11/Xtrans/Xtransint.h deleted file mode 100644 index 5ff824d..0000000 --- a/openflow/usr/include/X11/Xtrans/Xtransint.h +++ /dev/null @@ -1,464 +0,0 @@ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _XTRANSINT_H_ -#define _XTRANSINT_H_ - -/* - * XTRANSDEBUG will enable the PRMSG() macros used in the X Transport - * Interface code. Each use of the PRMSG macro has a level associated with - * it. XTRANSDEBUG is defined to be a level. If the invocation level is =< - * the value of XTRANSDEBUG, then the message will be printed out to stderr. - * Recommended levels are: - * - * XTRANSDEBUG=1 Error messages - * XTRANSDEBUG=2 API Function Tracing - * XTRANSDEBUG=3 All Function Tracing - * XTRANSDEBUG=4 printing of intermediate values - * XTRANSDEBUG=5 really detailed stuff -#define XTRANSDEBUG 2 - * - * Defining XTRANSDEBUGTIMESTAMP will cause printing timestamps with each - * message. - */ - -#if !defined(XTRANSDEBUG) && defined(XTRANS_TRANSPORT_C) -# define XTRANSDEBUG 1 -#endif - -#ifdef WIN32 -# define _WILLWINSOCK_ -#endif - -#include "Xtrans.h" - -#ifndef _X_UNUSED /* Defined in Xfuncproto.h in xproto >= 7.0.22 */ -# define _X_UNUSED /* */ -#endif - -#ifdef XTRANSDEBUG -# include -#endif /* XTRANSDEBUG */ - -#include - -#ifndef WIN32 -# include -# include -# include - -/* - * Moved the setting of NEED_UTSNAME to this header file from Xtrans.c, - * to avoid a race condition. JKJ (6/5/97) - */ - -# if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SVR4) || defined(__SCO__) -# ifndef NEED_UTSNAME -# define NEED_UTSNAME -# endif -# include -# endif - -# define ESET(val) errno = val -# define EGET() errno - -#else /* WIN32 */ - -# include /* for USHRT_MAX */ - -# define ESET(val) WSASetLastError(val) -# define EGET() WSAGetLastError() - -#endif /* WIN32 */ - -#include - -#ifdef X11_t -#define X_TCP_PORT 6000 -#endif - -#if XTRANS_SEND_FDS - -struct _XtransConnFd { - struct _XtransConnFd *next; - int fd; - int do_close; -}; - -#endif - -struct _XtransConnInfo { - struct _Xtransport *transptr; - int index; - char *priv; - int flags; - int fd; - char *port; - int family; - char *addr; - int addrlen; - char *peeraddr; - int peeraddrlen; - struct _XtransConnFd *recv_fds; - struct _XtransConnFd *send_fds; -}; - -#define XTRANS_OPEN_COTS_CLIENT 1 -#define XTRANS_OPEN_COTS_SERVER 2 -#define XTRANS_OPEN_CLTS_CLIENT 3 -#define XTRANS_OPEN_CLTS_SERVER 4 - - -typedef struct _Xtransport { - const char *TransName; - int flags; - -#ifdef TRANS_CLIENT - - XtransConnInfo (*OpenCOTSClient)( - struct _Xtransport *, /* transport */ - const char *, /* protocol */ - const char *, /* host */ - const char * /* port */ - ); - -#endif /* TRANS_CLIENT */ - -#ifdef TRANS_SERVER - const char ** nolisten; - XtransConnInfo (*OpenCOTSServer)( - struct _Xtransport *, /* transport */ - const char *, /* protocol */ - const char *, /* host */ - const char * /* port */ - ); - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_CLIENT - - XtransConnInfo (*OpenCLTSClient)( - struct _Xtransport *, /* transport */ - const char *, /* protocol */ - const char *, /* host */ - const char * /* port */ - ); - -#endif /* TRANS_CLIENT */ - -#ifdef TRANS_SERVER - - XtransConnInfo (*OpenCLTSServer)( - struct _Xtransport *, /* transport */ - const char *, /* protocol */ - const char *, /* host */ - const char * /* port */ - ); - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_REOPEN - - XtransConnInfo (*ReopenCOTSServer)( - struct _Xtransport *, /* transport */ - int, /* fd */ - const char * /* port */ - ); - - XtransConnInfo (*ReopenCLTSServer)( - struct _Xtransport *, /* transport */ - int, /* fd */ - const char * /* port */ - ); - -#endif /* TRANS_REOPEN */ - - - int (*SetOption)( - XtransConnInfo, /* connection */ - int, /* option */ - int /* arg */ - ); - -#ifdef TRANS_SERVER -/* Flags */ -# define ADDR_IN_USE_ALLOWED 1 - - int (*CreateListener)( - XtransConnInfo, /* connection */ - const char *, /* port */ - unsigned int /* flags */ - ); - - int (*ResetListener)( - XtransConnInfo /* connection */ - ); - - XtransConnInfo (*Accept)( - XtransConnInfo, /* connection */ - int * /* status */ - ); - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_CLIENT - - int (*Connect)( - XtransConnInfo, /* connection */ - const char *, /* host */ - const char * /* port */ - ); - -#endif /* TRANS_CLIENT */ - - int (*BytesReadable)( - XtransConnInfo, /* connection */ - BytesReadable_t * /* pend */ - ); - - int (*Read)( - XtransConnInfo, /* connection */ - char *, /* buf */ - int /* size */ - ); - - int (*Write)( - XtransConnInfo, /* connection */ - char *, /* buf */ - int /* size */ - ); - - int (*Readv)( - XtransConnInfo, /* connection */ - struct iovec *, /* buf */ - int /* size */ - ); - - int (*Writev)( - XtransConnInfo, /* connection */ - struct iovec *, /* buf */ - int /* size */ - ); - -#if XTRANS_SEND_FDS - int (*SendFd)( - XtransConnInfo, /* connection */ - int, /* fd */ - int /* do_close */ - ); - - int (*RecvFd)( - XtransConnInfo /* connection */ - ); -#endif - - int (*Disconnect)( - XtransConnInfo /* connection */ - ); - - int (*Close)( - XtransConnInfo /* connection */ - ); - - int (*CloseForCloning)( - XtransConnInfo /* connection */ - ); - -} Xtransport; - - -typedef struct _Xtransport_table { - Xtransport *transport; - int transport_id; -} Xtransport_table; - - -/* - * Flags for the flags member of Xtransport. - */ - -#define TRANS_ALIAS (1<<0) /* record is an alias, don't create server */ -#define TRANS_LOCAL (1<<1) /* local transport */ -#define TRANS_DISABLED (1<<2) /* Don't open this one */ -#define TRANS_NOLISTEN (1<<3) /* Don't listen on this one */ -#define TRANS_NOUNLINK (1<<4) /* Don't unlink transport endpoints */ -#define TRANS_ABSTRACT (1<<5) /* Use abstract sockets if available */ -#define TRANS_NOXAUTH (1<<6) /* Don't verify authentication (because it's secure some other way at the OS layer) */ -#define TRANS_RECEIVED (1<<7) /* The fd for this has already been opened by someone else. */ - -/* Flags to preserve when setting others */ -#define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT) - -#ifdef XTRANS_TRANSPORT_C /* only provide static function prototypes when - building the transport.c file that has them in */ - -#ifdef __clang__ -/* Not all clients make use of all provided statics */ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-function" -#endif - -/* - * readv() and writev() don't exist or don't work correctly on some - * systems, so they may be emulated. - */ - -#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32) - -#define READV(ciptr, iov, iovcnt) TRANS(ReadV)(ciptr, iov, iovcnt) - -static int TRANS(ReadV)( - XtransConnInfo, /* ciptr */ - struct iovec *, /* iov */ - int /* iovcnt */ -); - -#else - -#define READV(ciptr, iov, iovcnt) readv(ciptr->fd, iov, iovcnt) - -#endif /* CRAY || (SYSV && __i386__) || WIN32 || __sxg__ || */ - - -#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32) - -#define WRITEV(ciptr, iov, iovcnt) TRANS(WriteV)(ciptr, iov, iovcnt) - -static int TRANS(WriteV)( - XtransConnInfo, /* ciptr */ - struct iovec *, /* iov */ - int /* iovcnt */ -); - -#else - -#define WRITEV(ciptr, iov, iovcnt) writev(ciptr->fd, iov, iovcnt) - -#endif /* CRAY || WIN32 || __sxg__ */ - - -static int is_numeric ( - const char * /* str */ -); - -#ifdef TRANS_SERVER -static int trans_mkdir ( - const char *, /* path */ - int /* mode */ -); -#endif - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -/* - * Some XTRANSDEBUG stuff - */ - -#ifdef XTRANSDEBUG -#include - -/* - * The X server provides ErrorF() & VErrorF(), for other software that uses - * xtrans, we provide our own simple versions. - */ -# if defined(XSERV_t) && defined(TRANS_SERVER) -# include "os.h" -# else -static inline void _X_ATTRIBUTE_PRINTF(1, 0) -VErrorF(const char *f, va_list args) -{ - vfprintf(stderr, f, args); - fflush(stderr); -} - -static inline void _X_ATTRIBUTE_PRINTF(1, 2) -ErrorF(const char *f, ...) -{ - va_list args; - - va_start(args, f); - VErrorF(f, args); - va_end(args); -} -# endif /* xserver */ -#endif /* XTRANSDEBUG */ - -static inline void _X_ATTRIBUTE_PRINTF(2, 3) -prmsg(int lvl, const char *f, ...) -{ -#ifdef XTRANSDEBUG - va_list args; - - va_start(args, f); - if (lvl <= XTRANSDEBUG) { - int saveerrno = errno; - - ErrorF("%s", __xtransname); - VErrorF(f, args); - -# ifdef XTRANSDEBUGTIMESTAMP - { - struct timeval tp; - gettimeofday(&tp, 0); - ErrorF("timestamp (ms): %d\n", - tp.tv_sec * 1000 + tp.tv_usec / 1000); - } -# endif - errno = saveerrno; - } - va_end(args); -#endif /* XTRANSDEBUG */ -} - -#endif /* XTRANS_TRANSPORT_C */ - -#endif /* _XTRANSINT_H_ */ diff --git a/openflow/usr/include/X11/Xtrans/Xtranslcl.c b/openflow/usr/include/X11/Xtrans/Xtranslcl.c deleted file mode 100644 index 3217506..0000000 --- a/openflow/usr/include/X11/Xtrans/Xtranslcl.c +++ /dev/null @@ -1,2587 +0,0 @@ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * - * The connection code/ideas in lib/X and server/os for SVR4/Intel - * environments was contributed by the following companies/groups: - * - * MetroLink Inc - * NCR - * Pittsburgh Powercomputing Corporation (PPc)/Quarterdeck Office Systems - * SGCS - * Unix System Laboratories (USL) / Novell - * XFree86 - * - * The goal is to have common connection code among all SVR4/Intel vendors. - * - * ALL THE ABOVE COMPANIES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, - * IN NO EVENT SHALL THESE COMPANIES * BE LIABLE FOR ANY SPECIAL, INDIRECT - * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE - * OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#if defined(SVR4) || defined(__SVR4) -#include -#endif -#ifdef sun -# include -#else -# include -#endif -#include -#include - -/* - * The local transports should be treated the same as a UNIX domain socket - * wrt authentication, etc. Because of this, we will use struct sockaddr_un - * for the address format. This will simplify the code in other places like - * The X Server. - */ - -#include -#ifndef X_NO_SYS_UN -#include -#endif - - -/* Types of local connections supported: - * - PTS - * - named pipes - * - SCO - */ -#if !defined(sun) -# define LOCAL_TRANS_PTS -#endif -#if defined(SVR4) || defined(__SVR4) -# define LOCAL_TRANS_NAMED -#endif -#if defined(__SCO__) || defined(__UNIXWARE__) -# define LOCAL_TRANS_SCO -#endif - -static int TRANS(LocalClose)(XtransConnInfo ciptr); - -/* - * These functions actually implement the local connection mechanisms. - */ - -/* Type Not Supported */ - -static int -TRANS(OpenFail)(XtransConnInfo ciptr _X_UNUSED, const char *port _X_UNUSED) - -{ - return -1; -} - -#ifdef TRANS_REOPEN - -static int -TRANS(ReopenFail)(XtransConnInfo ciptr _X_UNUSED, int fd _X_UNUSED, - const char *port _X_UNUSED) - -{ - return 0; -} - -#endif /* TRANS_REOPEN */ - -#if XTRANS_SEND_FDS -static int -TRANS(LocalRecvFdInvalid)(XtransConnInfo ciptr) -{ - errno = EINVAL; - return -1; -} - -static int -TRANS(LocalSendFdInvalid)(XtransConnInfo ciptr, int fd, int do_close) -{ - errno = EINVAL; - return -1; -} -#endif - - -static int -TRANS(FillAddrInfo)(XtransConnInfo ciptr, - const char *sun_path, const char *peer_sun_path) - -{ - struct sockaddr_un *sunaddr; - struct sockaddr_un *p_sunaddr; - - ciptr->family = AF_UNIX; - ciptr->addrlen = sizeof (struct sockaddr_un); - - if ((sunaddr = malloc (ciptr->addrlen)) == NULL) - { - prmsg(1,"FillAddrInfo: failed to allocate memory for addr\n"); - return 0; - } - - sunaddr->sun_family = AF_UNIX; - - if (strlen(sun_path) > sizeof(sunaddr->sun_path) - 1) { - prmsg(1, "FillAddrInfo: path too long\n"); - free((char *) sunaddr); - return 0; - } - strcpy (sunaddr->sun_path, sun_path); -#if defined(BSD44SOCKETS) - sunaddr->sun_len = strlen (sunaddr->sun_path); -#endif - - ciptr->addr = (char *) sunaddr; - - ciptr->peeraddrlen = sizeof (struct sockaddr_un); - - if ((p_sunaddr = malloc (ciptr->peeraddrlen)) == NULL) - { - prmsg(1, - "FillAddrInfo: failed to allocate memory for peer addr\n"); - free (sunaddr); - ciptr->addr = NULL; - - return 0; - } - - p_sunaddr->sun_family = AF_UNIX; - - if (strlen(peer_sun_path) > sizeof(p_sunaddr->sun_path) - 1) { - prmsg(1, "FillAddrInfo: peer path too long\n"); - free((char *) p_sunaddr); - return 0; - } - strcpy (p_sunaddr->sun_path, peer_sun_path); -#if defined(BSD44SOCKETS) - p_sunaddr->sun_len = strlen (p_sunaddr->sun_path); -#endif - - ciptr->peeraddr = (char *) p_sunaddr; - - return 1; -} - - - -#ifdef LOCAL_TRANS_PTS -/* PTS */ - -#if defined(SYSV) && !defined(__SCO__) -#define SIGNAL_T int -#else -#define SIGNAL_T void -#endif /* SYSV */ - -typedef SIGNAL_T (*PFV)(); - -extern PFV signal(); - -extern char *ptsname( - int -); - -static void _dummy(int sig _X_UNUSED) - -{ -} -#endif /* LOCAL_TRANS_PTS */ - -#ifndef sun -#define X_STREAMS_DIR "/dev/X" -#define DEV_SPX "/dev/spx" -#else -#ifndef X11_t -#define X_STREAMS_DIR "/dev/X" -#else -#define X_STREAMS_DIR "/tmp/.X11-pipe" -#endif -#endif - -#define DEV_PTMX "/dev/ptmx" - -#if defined(X11_t) - -#define PTSNODENAME "/dev/X/server." -#ifdef sun -#define NAMEDNODENAME "/tmp/.X11-pipe/X" -#else -#define NAMEDNODENAME "/dev/X/Nserver." - -#define SCORNODENAME "/dev/X%1sR" -#define SCOSNODENAME "/dev/X%1sS" -#endif /* !sun */ -#endif -#if defined(XIM_t) -#ifdef sun -#define NAMEDNODENAME "/tmp/.XIM-pipe/XIM" -#else -#define PTSNODENAME "/dev/X/XIM." -#define NAMEDNODENAME "/dev/X/NXIM." -#define SCORNODENAME "/dev/XIM.%sR" -#define SCOSNODENAME "/dev/XIM.%sS" -#endif -#endif -#if defined(FS_t) || defined (FONT_t) -#ifdef sun -#define NAMEDNODENAME "/tmp/.font-pipe/fs" -#else -/* - * USL has already defined something here. We need to check with them - * and see if their choice is usable here. - */ -#define PTSNODENAME "/dev/X/fontserver." -#define NAMEDNODENAME "/dev/X/Nfontserver." -#define SCORNODENAME "/dev/fontserver.%sR" -#define SCOSNODENAME "/dev/fontserver.%sS" -#endif -#endif -#if defined(ICE_t) -#ifdef sun -#define NAMEDNODENAME "/tmp/.ICE-pipe/" -#else -#define PTSNODENAME "/dev/X/ICE." -#define NAMEDNODENAME "/dev/X/NICE." -#define SCORNODENAME "/dev/ICE.%sR" -#define SCOSNODENAME "/dev/ICE.%sS" -#endif -#endif -#if defined(TEST_t) -#ifdef sun -#define NAMEDNODENAME "/tmp/.Test-unix/test" -#endif -#define PTSNODENAME "/dev/X/transtest." -#define NAMEDNODENAME "/dev/X/Ntranstest." -#define SCORNODENAME "/dev/transtest.%sR" -#define SCOSNODENAME "/dev/transtest.%sS" -#endif - - - -#ifdef LOCAL_TRANS_PTS -#ifdef TRANS_CLIENT - -static int -TRANS(PTSOpenClient)(XtransConnInfo ciptr, const char *port) - -{ -#ifdef PTSNODENAME - int fd,server,exitval,alarm_time,ret; - char server_path[64]; - char *slave, namelen; - char buf[20]; /* MAX_PATH_LEN?? */ - PFV savef; - pid_t saved_pid; -#endif - - prmsg(2,"PTSOpenClient(%s)\n", port); - -#if !defined(PTSNODENAME) - prmsg(1,"PTSOpenClient: Protocol is not supported by a pts connection\n"); - return -1; -#else - if (port && *port ) { - if( *port == '/' ) { /* A full pathname */ - snprintf(server_path, sizeof(server_path), "%s", port); - } else { - snprintf(server_path, sizeof(server_path), "%s%s", - PTSNODENAME, port); - } - } else { - snprintf(server_path, sizeof(server_path), "%s%d", - PTSNODENAME, getpid()); - } - - - /* - * Open the node the on which the server is listening. - */ - - if ((server = open (server_path, O_RDWR)) < 0) { - prmsg(1,"PTSOpenClient: failed to open %s\n", server_path); - return -1; - } - - - /* - * Open the streams based pipe that will be this connection. - */ - - if ((fd = open(DEV_PTMX, O_RDWR)) < 0) { - prmsg(1,"PTSOpenClient: failed to open %s\n", DEV_PTMX); - close(server); - return(-1); - } - - (void) grantpt(fd); - (void) unlockpt(fd); - - slave = ptsname(fd); /* get name */ - - if( slave == NULL ) { - prmsg(1,"PTSOpenClient: failed to get ptsname()\n"); - close(fd); - close(server); - return -1; - } - - /* - * This is neccesary for the case where a program is setuid to non-root. - * grantpt() calls /usr/lib/pt_chmod which is set-uid root. This program will - * set the owner of the pt device incorrectly if the uid is not restored - * before it is called. The problem is that once it gets restored, it - * cannot be changed back to its original condition, hence the fork(). - */ - - if(!(saved_pid=fork())) { - uid_t saved_euid; - - saved_euid = geteuid(); - /** sets the euid to the actual/real uid **/ - if (setuid( getuid() ) == -1) { - exit(1); - } - if( chown( slave, saved_euid, -1 ) < 0 ) { - exit( 1 ); - } - - exit( 0 ); - } - - waitpid(saved_pid, &exitval, 0); - if (WIFEXITED(exitval) && WEXITSTATUS(exitval) != 0) { - close(fd); - close(server); - prmsg(1, "PTSOpenClient: cannot set the owner of %s\n", - slave); - return(-1); - } - if (chmod(slave, 0666) < 0) { - close(fd); - close(server); - prmsg(1,"PTSOpenClient: Cannot chmod %s\n", slave); - return(-1); - } - - /* - * write slave name to server - */ - - namelen = strlen(slave); - buf[0] = namelen; - (void) sprintf(&buf[1], slave); - (void) write(server, buf, namelen+1); - (void) close(server); - - /* - * wait for server to respond - */ - - savef = signal(SIGALRM, _dummy); - alarm_time = alarm (30); /* CONNECT_TIMEOUT */ - - ret = read(fd, buf, 1); - - (void) alarm(alarm_time); - (void) signal(SIGALRM, savef); - - if (ret != 1) { - prmsg(1, - "PTSOpenClient: failed to get acknoledgement from server\n"); - (void) close(fd); - fd = -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - if (TRANS(FillAddrInfo) (ciptr, slave, server_path) == 0) - { - prmsg(1,"PTSOpenClient: failed to fill in addr info\n"); - close(fd); - return -1; - } - - return(fd); - -#endif /* !PTSNODENAME */ -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -static int -TRANS(PTSOpenServer)(XtransConnInfo ciptr, const char *port) - -{ -#ifdef PTSNODENAME - int fd, server; - char server_path[64], *slave; - int mode; -#endif - - prmsg(2,"PTSOpenServer(%s)\n", port); - -#if !defined(PTSNODENAME) - prmsg(1,"PTSOpenServer: Protocol is not supported by a pts connection\n"); - return -1; -#else - if (port && *port ) { - if( *port == '/' ) { /* A full pathname */ - (void) sprintf(server_path, "%s", port); - } else { - (void) sprintf(server_path, "%s%s", PTSNODENAME, port); - } - } else { - (void) sprintf(server_path, "%s%d", PTSNODENAME, getpid()); - } - -#ifdef HAS_STICKY_DIR_BIT - mode = 01777; -#else - mode = 0777; -#endif - if (trans_mkdir(X_STREAMS_DIR, mode) == -1) { - prmsg (1, "PTSOpenServer: mkdir(%s) failed, errno = %d\n", - X_STREAMS_DIR, errno); - return(-1); - } - -#if 0 - if( (fd=open(server_path, O_RDWR)) >= 0 ) { - /* - * This doesn't prevent the server from starting up, and doesn't - * prevent clients from trying to connect to the in-use PTS (which - * is often in use by something other than another server). - */ - prmsg(1, "PTSOpenServer: A server is already running on port %s\n", port); - prmsg(1, "PTSOpenServer: Remove %s if this is incorrect.\n", server_path); - close(fd); - return(-1); - } -#else - /* Just remove the old path (which is what happens with UNIXCONN) */ -#endif - - unlink(server_path); - - if( (fd=open(DEV_PTMX, O_RDWR)) < 0) { - prmsg(1, "PTSOpenServer: Unable to open %s\n", DEV_PTMX); - return(-1); - } - - grantpt(fd); - unlockpt(fd); - - if( (slave=ptsname(fd)) == NULL) { - prmsg(1, "PTSOpenServer: Unable to get slave device name\n"); - close(fd); - return(-1); - } - - if( link(slave,server_path) < 0 ) { - prmsg(1, "PTSOpenServer: Unable to link %s to %s\n", slave, server_path); - close(fd); - return(-1); - } - - if( chmod(server_path, 0666) < 0 ) { - prmsg(1, "PTSOpenServer: Unable to chmod %s to 0666\n", server_path); - close(fd); - return(-1); - } - - if( (server=open(server_path, O_RDWR)) < 0 ) { - prmsg(1, "PTSOpenServer: Unable to open server device %s\n", server_path); - close(fd); - return(-1); - } - - close(server); - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) - { - prmsg(1,"PTSOpenServer: failed to fill in addr info\n"); - close(fd); - return -1; - } - - return fd; - -#endif /* !PTSNODENAME */ -} - -static int -TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) - -{ - int newfd; - int in; - unsigned char length; - char buf[256]; - struct sockaddr_un *sunaddr; - - prmsg(2,"PTSAccept(%x->%d)\n",ciptr,ciptr->fd); - - if( (in=read(ciptr->fd,&length,1)) <= 0 ){ - if( !in ) { - prmsg(2, - "PTSAccept: Incoming connection closed\n"); - } - else { - prmsg(1, - "PTSAccept: Error reading incoming connection. errno=%d \n", - errno); - } - *status = TRANS_ACCEPT_MISC_ERROR; - return -1; - } - - if( (in=read(ciptr->fd,buf,length)) <= 0 ){ - if( !in ) { - prmsg(2, - "PTSAccept: Incoming connection closed\n"); - } - else { - prmsg(1, -"PTSAccept: Error reading device name for new connection. errno=%d \n", - errno); - } - *status = TRANS_ACCEPT_MISC_ERROR; - return -1; - } - - buf[length] = '\0'; - - if( (newfd=open(buf,O_RDWR)) < 0 ) { - prmsg(1, "PTSAccept: Failed to open %s\n",buf); - *status = TRANS_ACCEPT_MISC_ERROR; - return -1; - } - - write(newfd,"1",1); - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - newciptr->addrlen=ciptr->addrlen; - if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) { - prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n"); - close(newfd); - *status = TRANS_ACCEPT_BAD_MALLOC; - return -1; - } - - memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); - - newciptr->peeraddrlen=sizeof(struct sockaddr_un); - if( (sunaddr = malloc(newciptr->peeraddrlen)) == NULL ) { - prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n"); - free(newciptr->addr); - close(newfd); - *status = TRANS_ACCEPT_BAD_MALLOC; - return -1; - } - - sunaddr->sun_family=AF_UNIX; - strcpy(sunaddr->sun_path,buf); -#if defined(BSD44SOCKETS) - sunaddr->sun_len=strlen(sunaddr->sun_path); -#endif - - newciptr->peeraddr=(char *)sunaddr; - - *status = 0; - - return newfd; -} - -#endif /* TRANS_SERVER */ -#endif /* LOCAL_TRANS_PTS */ - - -#ifdef LOCAL_TRANS_NAMED - -/* NAMED */ - -#ifdef TRANS_CLIENT - -static int -TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, const char *port) - -{ -#ifdef NAMEDNODENAME - int fd; - char server_path[64]; - struct stat filestat; -# ifndef sun - extern int isastream(int); -# endif -#endif - - prmsg(2,"NAMEDOpenClient(%s)\n", port); - -#if !defined(NAMEDNODENAME) - prmsg(1,"NAMEDOpenClient: Protocol is not supported by a NAMED connection\n"); - return -1; -#else - if ( port && *port ) { - if( *port == '/' ) { /* A full pathname */ - (void) snprintf(server_path, sizeof(server_path), "%s", port); - } else { - (void) snprintf(server_path, sizeof(server_path), "%s%s", NAMEDNODENAME, port); - } - } else { - (void) snprintf(server_path, sizeof(server_path), "%s%ld", NAMEDNODENAME, (long)getpid()); - } - - if ((fd = open(server_path, O_RDWR)) < 0) { - prmsg(1,"NAMEDOpenClient: Cannot open %s for NAMED connection\n", server_path); - return -1; - } - - if (fstat(fd, &filestat) < 0 ) { - prmsg(1,"NAMEDOpenClient: Cannot stat %s for NAMED connection\n", server_path); - (void) close(fd); - return -1; - } - - if ((filestat.st_mode & S_IFMT) != S_IFIFO) { - prmsg(1,"NAMEDOpenClient: Device %s is not a FIFO\n", server_path); - /* Is this really a failure? */ - (void) close(fd); - return -1; - } - - - if (isastream(fd) <= 0) { - prmsg(1,"NAMEDOpenClient: %s is not a streams device\n", server_path); - (void) close(fd); - return -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) - { - prmsg(1,"NAMEDOpenClient: failed to fill in addr info\n"); - close(fd); - return -1; - } - - return(fd); - -#endif /* !NAMEDNODENAME */ -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - - -#ifdef NAMEDNODENAME -static int -TRANS(NAMEDOpenPipe)(const char *server_path) -{ - int fd, pipefd[2]; - struct stat sbuf; - int mode; - - prmsg(2,"NAMEDOpenPipe(%s)\n", server_path); - -#ifdef HAS_STICKY_DIR_BIT - mode = 01777; -#else - mode = 0777; -#endif - if (trans_mkdir(X_STREAMS_DIR, mode) == -1) { - prmsg (1, "NAMEDOpenPipe: mkdir(%s) failed, errno = %d\n", - X_STREAMS_DIR, errno); - return(-1); - } - - if(stat(server_path, &sbuf) != 0) { - if (errno == ENOENT) { - if ((fd = creat(server_path, (mode_t)0666)) == -1) { - prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path); - return(-1); - } - close(fd); - if (chmod(server_path, (mode_t)0666) < 0) { - prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path); - return(-1); - } - } else { - prmsg(1, "NAMEDOpenPipe: stat on %s failed\n", server_path); - return(-1); - } - } - - if( pipe(pipefd) != 0) { - prmsg(1, "NAMEDOpenPipe: pipe() failed, errno=%d\n",errno); - return(-1); - } - - if( ioctl(pipefd[0], I_PUSH, "connld") != 0) { - prmsg(1, "NAMEDOpenPipe: ioctl(I_PUSH,\"connld\") failed, errno=%d\n",errno); - close(pipefd[0]); - close(pipefd[1]); - return(-1); - } - - if( fattach(pipefd[0], server_path) != 0) { - prmsg(1, "NAMEDOpenPipe: fattach(%s) failed, errno=%d\n", server_path,errno); - close(pipefd[0]); - close(pipefd[1]); - return(-1); - } - - return(pipefd[1]); -} -#endif - -static int -TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, const char *port) -{ -#ifdef NAMEDNODENAME - int fd; - char server_path[64]; -#endif - - prmsg(2,"NAMEDOpenServer(%s)\n", port); - -#if !defined(NAMEDNODENAME) - prmsg(1,"NAMEDOpenServer: Protocol is not supported by a NAMED connection\n"); - return -1; -#else - if ( port && *port ) { - if( *port == '/' ) { /* A full pathname */ - (void) snprintf(server_path, sizeof(server_path), "%s", port); - } else { - (void) snprintf(server_path, sizeof(server_path), "%s%s", - NAMEDNODENAME, port); - } - } else { - (void) snprintf(server_path, sizeof(server_path), "%s%ld", - NAMEDNODENAME, (long)getpid()); - } - - fd = TRANS(NAMEDOpenPipe)(server_path); - if (fd < 0) { - return -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) - { - prmsg(1,"NAMEDOpenServer: failed to fill in addr info\n"); - TRANS(LocalClose)(ciptr); - return -1; - } - - return fd; - -#endif /* !NAMEDNODENAME */ -} - -static int -TRANS(NAMEDResetListener) (XtransConnInfo ciptr) - -{ - struct sockaddr_un *sockname=(struct sockaddr_un *) ciptr->addr; - struct stat statb; - - prmsg(2,"NAMEDResetListener(%p, %d)\n", ciptr, ciptr->fd); - - if (ciptr->fd != -1) { - /* - * see if the pipe has disappeared - */ - - if (stat (sockname->sun_path, &statb) == -1 || - (statb.st_mode & S_IFMT) != S_IFIFO) { - prmsg(3, "Pipe %s trashed, recreating\n", sockname->sun_path); - TRANS(LocalClose)(ciptr); - ciptr->fd = TRANS(NAMEDOpenPipe)(sockname->sun_path); - if (ciptr->fd >= 0) - return TRANS_RESET_NEW_FD; - else - return TRANS_CREATE_LISTENER_FAILED; - } - } - return TRANS_RESET_NOOP; -} - -static int -TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) - -{ - struct strrecvfd str; - - prmsg(2,"NAMEDAccept(%p->%d)\n", ciptr, ciptr->fd); - - if( ioctl(ciptr->fd, I_RECVFD, &str ) < 0 ) { - prmsg(1, "NAMEDAccept: ioctl(I_RECVFD) failed, errno=%d\n", errno); - *status = TRANS_ACCEPT_MISC_ERROR; - return(-1); - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - newciptr->family=ciptr->family; - newciptr->addrlen=ciptr->addrlen; - if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) { - prmsg(1, - "NAMEDAccept: failed to allocate memory for pipe addr\n"); - close(str.fd); - *status = TRANS_ACCEPT_BAD_MALLOC; - return -1; - } - - memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); - - newciptr->peeraddrlen=newciptr->addrlen; - if( (newciptr->peeraddr = malloc(newciptr->peeraddrlen)) == NULL ) { - prmsg(1, - "NAMEDAccept: failed to allocate memory for peer addr\n"); - free(newciptr->addr); - close(str.fd); - *status = TRANS_ACCEPT_BAD_MALLOC; - return -1; - } - - memcpy(newciptr->peeraddr,newciptr->addr,newciptr->peeraddrlen); - - *status = 0; - - return str.fd; -} - -#endif /* TRANS_SERVER */ - -#endif /* LOCAL_TRANS_NAMED */ - - - -#if defined(LOCAL_TRANS_SCO) - -/* - * connect_spipe is used by the SCO connection type. - */ -static int -connect_spipe(int fd1, int fd2) -{ - long temp; - struct strfdinsert sbuf; - - sbuf.databuf.maxlen = -1; - sbuf.databuf.len = -1; - sbuf.databuf.buf = NULL; - sbuf.ctlbuf.maxlen = sizeof(long); - sbuf.ctlbuf.len = sizeof(long); - sbuf.ctlbuf.buf = (caddr_t)&temp; - sbuf.offset = 0; - sbuf.fildes = fd2; - sbuf.flags = 0; - - if( ioctl(fd1, I_FDINSERT, &sbuf) < 0 ) - return(-1); - - return(0); -} - -/* - * named_spipe is used by the SCO connection type. - */ - -static int -named_spipe(int fd, char *path) - -{ - int oldUmask, ret; - struct stat sbuf; - - oldUmask = umask(0); - - (void) fstat(fd, &sbuf); - ret = mknod(path, 0020666, sbuf.st_rdev); - - umask(oldUmask); - - if (ret < 0) { - ret = -1; - } else { - ret = fd; - } - - return(ret); -} - -#endif /* defined(LOCAL_TRANS_SCO) */ - - - - -#ifdef LOCAL_TRANS_SCO -/* SCO */ - -/* - * 2002-11-09 (jkj@sco.com) - * - * This code has been modified to match what is in the actual SCO X server. - * This greatly helps inter-operability between X11R6 and X11R5 (the native - * SCO server). Mainly, it relies on streams nodes existing in /dev, not - * creating them or unlinking them, which breaks the native X server. - * - * However, this is only for the X protocol. For all other protocols, we - * do in fact create the nodes, as only X11R6 will use them, and this makes - * it possible to have both types of clients running, otherwise we get all - * kinds of nasty errors on startup for anything that doesnt use the X - * protocol (like SM, when KDE starts up). - */ - -#ifdef TRANS_CLIENT - -static int -TRANS(SCOOpenClient)(XtransConnInfo ciptr, const char *port) -{ -#ifdef SCORNODENAME - int fd, server, fl, ret; - char server_path[64]; - struct strbuf ctlbuf; - unsigned long alarm_time; - void (*savef)(); - long temp; - extern int getmsg(), putmsg(); -#endif - - prmsg(2,"SCOOpenClient(%s)\n", port); - if (!port || !port[0]) - port = "0"; - -#if !defined(SCORNODENAME) - prmsg(2,"SCOOpenClient: Protocol is not supported by a SCO connection\n"); - return -1; -#else - (void) sprintf(server_path, SCORNODENAME, port); - - if ((server = open(server_path, O_RDWR)) < 0) { - prmsg(1,"SCOOpenClient: failed to open %s\n", server_path); - return -1; - } - - if ((fd = open(DEV_SPX, O_RDWR)) < 0) { - prmsg(1,"SCOOpenClient: failed to open %s\n", DEV_SPX); - close(server); - return -1; - } - - (void) write(server, &server, 1); - ctlbuf.len = 0; - ctlbuf.maxlen = sizeof(long); - ctlbuf.buf = (caddr_t)&temp; - fl = 0; - - savef = signal(SIGALRM, _dummy); - alarm_time = alarm(10); - - ret = getmsg(server, &ctlbuf, 0, &fl); - - (void) alarm(alarm_time); - (void) signal(SIGALRM, savef); - - if (ret < 0) { - prmsg(1,"SCOOpenClient: error from getmsg\n"); - close(fd); - close(server); - return -1; - } - - /* The msg we got via getmsg is the result of an - * I_FDINSERT, so if we do a putmsg with whatever - * we recieved, we're doing another I_FDINSERT ... - */ - (void) putmsg(fd, &ctlbuf, 0, 0); - (void) fcntl(fd,F_SETFL,fcntl(fd,F_GETFL,0)|O_NDELAY); - - (void) close(server); - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - -#if defined(X11_t) && defined(__SCO__) - ciptr->flags |= TRANS_NOUNLINK; -#endif - if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) - { - prmsg(1,"SCOOpenClient: failed to fill addr info\n"); - close(fd); - return -1; - } - - return(fd); - -#endif /* !SCORNODENAME */ -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -static int -TRANS(SCOOpenServer)(XtransConnInfo ciptr, const char *port) -{ -#ifdef SCORNODENAME - char serverR_path[64]; - char serverS_path[64]; - struct flock mylock; - int fdr = -1; - int fds = -1; -#endif - - prmsg(2,"SCOOpenServer(%s)\n", port); - if (!port || !port[0]) - port = "0"; - -#if !defined(SCORNODENAME) - prmsg(1,"SCOOpenServer: Protocol is not supported by a SCO connection\n"); - return -1; -#else - (void) sprintf(serverR_path, SCORNODENAME, port); - (void) sprintf(serverS_path, SCOSNODENAME, port); - -#if !defined(X11_t) || !defined(__SCO__) - unlink(serverR_path); - unlink(serverS_path); - - if ((fds = open(DEV_SPX, O_RDWR)) < 0 || - (fdr = open(DEV_SPX, O_RDWR)) < 0 ) { - prmsg(1,"SCOOpenServer: failed to open %s\n", DEV_SPX); - if (fds >= 0) - close(fds); - if (fdr >= 0) - close(fdr); - return -1; - } - - if (named_spipe (fds, serverS_path) == -1) { - prmsg(1,"SCOOpenServer: failed to create %s\n", serverS_path); - close (fdr); - close (fds); - return -1; - } - - if (named_spipe (fdr, serverR_path) == -1) { - prmsg(1,"SCOOpenServer: failed to create %s\n", serverR_path); - close (fdr); - close (fds); - return -1; - } -#else /* X11_t */ - - fds = open (serverS_path, O_RDWR | O_NDELAY); - if (fds < 0) { - prmsg(1,"SCOOpenServer: failed to open %s\n", serverS_path); - return -1; - } - - /* - * Lock the connection device for the duration of the server. - * This resolves multiple server starts especially on SMP machines. - */ - mylock.l_type = F_WRLCK; - mylock.l_whence = 0; - mylock.l_start = 0; - mylock.l_len = 0; - if (fcntl (fds, F_SETLK, &mylock) < 0) { - prmsg(1,"SCOOpenServer: failed to lock %s\n", serverS_path); - close (fds); - return -1; - } - - fdr = open (serverR_path, O_RDWR | O_NDELAY); - if (fdr < 0) { - prmsg(1,"SCOOpenServer: failed to open %s\n", serverR_path); - close (fds); - return -1; - } -#endif /* X11_t */ - - if (connect_spipe(fds, fdr)) { - prmsg(1,"SCOOpenServer: ioctl(I_FDINSERT) failed on %s\n", - serverS_path); - close (fdr); - close (fds); - return -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - -#if defined(X11_t) && defined(__SCO__) - ciptr->flags |= TRANS_NOUNLINK; -#endif - if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0) { - prmsg(1,"SCOOpenServer: failed to fill in addr info\n"); - close(fds); - close(fdr); - return -1; - } - - return(fds); - -#endif /* !SCORNODENAME */ -} - -static int -TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) -{ - char c; - int fd; - - prmsg(2,"SCOAccept(%d)\n", ciptr->fd); - - if (read(ciptr->fd, &c, 1) < 0) { - prmsg(1,"SCOAccept: can't read from client\n"); - *status = TRANS_ACCEPT_MISC_ERROR; - return(-1); - } - - if( (fd = open(DEV_SPX, O_RDWR)) < 0 ) { - prmsg(1,"SCOAccept: can't open \"%s\"\n",DEV_SPX); - *status = TRANS_ACCEPT_MISC_ERROR; - return(-1); - } - - if (connect_spipe (ciptr->fd, fd) < 0) { - prmsg(1,"SCOAccept: ioctl(I_FDINSERT) failed\n"); - close (fd); - *status = TRANS_ACCEPT_MISC_ERROR; - return -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - newciptr->addrlen=ciptr->addrlen; - if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) { - prmsg(1, - "SCOAccept: failed to allocate memory for peer addr\n"); - close(fd); - *status = TRANS_ACCEPT_BAD_MALLOC; - return -1; - } - - memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); -#if defined(__SCO__) - newciptr->flags |= TRANS_NOUNLINK; -#endif - - newciptr->peeraddrlen=newciptr->addrlen; - if( (newciptr->peeraddr = malloc(newciptr->peeraddrlen)) == NULL ) { - prmsg(1, - "SCOAccept: failed to allocate memory for peer addr\n"); - free(newciptr->addr); - close(fd); - *status = TRANS_ACCEPT_BAD_MALLOC; - return -1; - } - - memcpy(newciptr->peeraddr,newciptr->addr,newciptr->peeraddrlen); - - *status = 0; - - return(fd); -} - -#endif /* TRANS_SERVER */ -#endif /* LOCAL_TRANS_SCO */ - - - -#ifdef TRANS_REOPEN -#ifdef LOCAL_TRANS_PTS - -static int -TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, const char *port) - -{ -#ifdef PTSNODENAME - char server_path[64]; -#endif - - prmsg(2,"PTSReopenServer(%d,%s)\n", fd, port); - -#if !defined(PTSNODENAME) - prmsg(1,"PTSReopenServer: Protocol is not supported by a pts connection\n"); - return 0; -#else - if (port && *port ) { - if( *port == '/' ) { /* A full pathname */ - snprintf(server_path, sizeof(server_path), "%s", port); - } else { - snprintf(server_path, sizeof(server_path), "%s%s", - PTSNODENAME, port); - } - } else { - snprintf(server_path, sizeof(server_path), "%s%ld", - PTSNODENAME, (long)getpid()); - } - - if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) - { - prmsg(1,"PTSReopenServer: failed to fill in addr info\n"); - return 0; - } - - return 1; - -#endif /* !PTSNODENAME */ -} - -#endif /* LOCAL_TRANS_PTS */ - -#ifdef LOCAL_TRANS_NAMED - -static int -TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd _X_UNUSED, const char *port) - -{ -#ifdef NAMEDNODENAME - char server_path[64]; -#endif - - prmsg(2,"NAMEDReopenServer(%s)\n", port); - -#if !defined(NAMEDNODENAME) - prmsg(1,"NAMEDReopenServer: Protocol is not supported by a NAMED connection\n"); - return 0; -#else - if ( port && *port ) { - if( *port == '/' ) { /* A full pathname */ - snprintf(server_path, sizeof(server_path),"%s", port); - } else { - snprintf(server_path, sizeof(server_path), "%s%s", - NAMEDNODENAME, port); - } - } else { - snprintf(server_path, sizeof(server_path), "%s%ld", - NAMEDNODENAME, (long)getpid()); - } - - if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) - { - prmsg(1,"NAMEDReopenServer: failed to fill in addr info\n"); - return 0; - } - - return 1; - -#endif /* !NAMEDNODENAME */ -} - -#endif /* LOCAL_TRANS_NAMED */ - - -#ifdef LOCAL_TRANS_SCO -static int -TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, const char *port) - -{ -#ifdef SCORNODENAME - char serverR_path[64], serverS_path[64]; -#endif - - prmsg(2,"SCOReopenServer(%s)\n", port); - if (!port || !port[0]) - port = "0"; - -#if !defined(SCORNODENAME) - prmsg(2,"SCOReopenServer: Protocol is not supported by a SCO connection\n"); - return 0; -#else - (void) sprintf(serverR_path, SCORNODENAME, port); - (void) sprintf(serverS_path, SCOSNODENAME, port); - -#if defined(X11_t) && defined(__SCO__) - ciptr->flags |= TRANS_NOUNLINK; -#endif - if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0) - { - prmsg(1, "SCOReopenServer: failed to fill in addr info\n"); - return 0; - } - - return 1; - -#endif /* SCORNODENAME */ -} - -#endif /* LOCAL_TRANS_SCO */ - -#endif /* TRANS_REOPEN */ - - - -/* - * This table contains all of the entry points for the different local - * connection mechanisms. - */ - -typedef struct _LOCALtrans2dev { - const char *transname; - -#ifdef TRANS_CLIENT - - int (*devcotsopenclient)( - XtransConnInfo, const char * /*port*/ -); - -#endif /* TRANS_CLIENT */ - -#ifdef TRANS_SERVER - - int (*devcotsopenserver)( - XtransConnInfo, const char * /*port*/ -); - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_CLIENT - - int (*devcltsopenclient)( - XtransConnInfo, const char * /*port*/ -); - -#endif /* TRANS_CLIENT */ - -#ifdef TRANS_SERVER - - int (*devcltsopenserver)( - XtransConnInfo, const char * /*port*/ -); - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_REOPEN - - int (*devcotsreopenserver)( - XtransConnInfo, - int, /* fd */ - const char * /* port */ -); - - int (*devcltsreopenserver)( - XtransConnInfo, - int, /* fd */ - const char * /* port */ -); - -#endif /* TRANS_REOPEN */ - -#ifdef TRANS_SERVER - - int (*devreset)( - XtransConnInfo /* ciptr */ -); - - int (*devaccept)( - XtransConnInfo, XtransConnInfo, int * -); - -#endif /* TRANS_SERVER */ - -} LOCALtrans2dev; - -static LOCALtrans2dev LOCALtrans2devtab[] = { -#ifdef LOCAL_TRANS_PTS -{"", -#ifdef TRANS_CLIENT - TRANS(PTSOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(PTSOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(PTSReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - NULL, /* ResetListener */ - TRANS(PTSAccept) -#endif /* TRANS_SERVER */ -}, - -{"local", -#ifdef TRANS_CLIENT - TRANS(PTSOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(PTSOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(PTSReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - NULL, /* ResetListener */ - TRANS(PTSAccept) -#endif /* TRANS_SERVER */ -}, - -{"pts", -#ifdef TRANS_CLIENT - TRANS(PTSOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(PTSOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(PTSReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - NULL, /* ResetListener */ - TRANS(PTSAccept) -#endif /* TRANS_SERVER */ -}, -#else /* !LOCAL_TRANS_PTS */ -{"", -#ifdef TRANS_CLIENT - TRANS(NAMEDOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(NAMEDOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(NAMEDReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - TRANS(NAMEDResetListener), - TRANS(NAMEDAccept) -#endif /* TRANS_SERVER */ -}, - -{"local", -#ifdef TRANS_CLIENT - TRANS(NAMEDOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(NAMEDOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(NAMEDReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - TRANS(NAMEDResetListener), - TRANS(NAMEDAccept) -#endif /* TRANS_SERVER */ -}, -#endif /* !LOCAL_TRANS_PTS */ - -#ifdef LOCAL_TRANS_NAMED -{"named", -#ifdef TRANS_CLIENT - TRANS(NAMEDOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(NAMEDOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(NAMEDReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - TRANS(NAMEDResetListener), - TRANS(NAMEDAccept) -#endif /* TRANS_SERVER */ -}, - -#ifdef sun /* Alias "pipe" to named, since that's what Solaris called it */ -{"pipe", -#ifdef TRANS_CLIENT - TRANS(NAMEDOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(NAMEDOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(NAMEDReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - TRANS(NAMEDResetListener), - TRANS(NAMEDAccept) -#endif /* TRANS_SERVER */ -}, -#endif /* sun */ -#endif /* LOCAL_TRANS_NAMED */ - - -#ifdef LOCAL_TRANS_SCO -{"sco", -#ifdef TRANS_CLIENT - TRANS(SCOOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(SCOOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(SCOReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - NULL, /* ResetListener */ - TRANS(SCOAccept) -#endif /* TRANS_SERVER */ -}, -#endif /* LOCAL_TRANS_SCO */ -}; - -#define NUMTRANSPORTS (sizeof(LOCALtrans2devtab)/sizeof(LOCALtrans2dev)) - -static const char *XLOCAL=NULL; -static char *workingXLOCAL=NULL; -static char *freeXLOCAL=NULL; - -#if defined(__SCO__) -#define DEF_XLOCAL "SCO:UNIX:PTS" -#elif defined(__UNIXWARE__) -#define DEF_XLOCAL "UNIX:PTS:NAMED:SCO" -#elif defined(sun) -#define DEF_XLOCAL "UNIX:NAMED" -#else -#define DEF_XLOCAL "UNIX:PTS:NAMED:SCO" -#endif - -static void -TRANS(LocalInitTransports)(const char *protocol) - -{ - prmsg(3,"LocalInitTransports(%s)\n", protocol); - - if( strcmp(protocol,"local") && strcmp(protocol,"LOCAL") ) - { - workingXLOCAL = freeXLOCAL = strdup (protocol); - } - else { - XLOCAL=(char *)getenv("XLOCAL"); - if(XLOCAL==NULL) - XLOCAL=DEF_XLOCAL; - workingXLOCAL = freeXLOCAL = strdup (XLOCAL); - } -} - -static void -TRANS(LocalEndTransports)(void) - -{ - prmsg(3,"LocalEndTransports()\n"); - free(freeXLOCAL); -} - -#define TYPEBUFSIZE 32 - -#ifdef TRANS_CLIENT - -static LOCALtrans2dev * -TRANS(LocalGetNextTransport)(void) - -{ - int i,j; - char *typetocheck; - char typebuf[TYPEBUFSIZE]; - prmsg(3,"LocalGetNextTransport()\n"); - - while(1) - { - if( workingXLOCAL == NULL || *workingXLOCAL == '\0' ) - return NULL; - - typetocheck=workingXLOCAL; - workingXLOCAL=strchr(workingXLOCAL,':'); - if(workingXLOCAL && *workingXLOCAL) - *workingXLOCAL++='\0'; - - for(i=0;i -#endif - -/* - * Make sure 'host' is really local. - */ - -static int -HostReallyLocal (const char *host) - -{ - /* - * The 'host' passed to this function may have been generated - * by either uname() or gethostname(). We try both if possible. - */ - -#ifdef NEED_UTSNAME - struct utsname name; -#endif - char buf[256]; - -#ifdef NEED_UTSNAME - if (uname (&name) >= 0 && strcmp (host, name.nodename) == 0) - return (1); -#endif - - buf[0] = '\0'; - (void) gethostname (buf, 256); - buf[255] = '\0'; - - if (strcmp (host, buf) == 0) - return (1); - - return (0); -} - - -static XtransConnInfo -TRANS(LocalOpenClient)(int type, const char *protocol, - const char *host, const char *port) - -{ - LOCALtrans2dev *transptr; - XtransConnInfo ciptr; - int index; - - prmsg(3,"LocalOpenClient()\n"); - - /* - * Make sure 'host' is really local. If not, we return failure. - * The reason we make this check is because a process may advertise - * a "local" address for which it can accept connections, but if a - * process on a remote machine tries to connect to this address, - * we know for sure it will fail. - */ - - if (strcmp (host, "unix") != 0 && !HostReallyLocal (host)) - { - prmsg (1, - "LocalOpenClient: Cannot connect to non-local host %s\n", - host); - return NULL; - } - - -#if defined(X11_t) - /* - * X has a well known port, that is transport dependant. It is easier - * to handle it here, than try and come up with a transport independent - * representation that can be passed in and resolved the usual way. - * - * The port that is passed here is really a string containing the idisplay - * from ConnectDisplay(). Since that is what we want for the local transports, - * we don't have to do anything special. - */ -#endif /* X11_t */ - - if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) - { - prmsg(1,"LocalOpenClient: calloc(1,%lu) failed\n", - sizeof(struct _XtransConnInfo)); - return NULL; - } - - ciptr->fd = -1; - - TRANS(LocalInitTransports)(protocol); - - index = 0; - for(transptr=TRANS(LocalGetNextTransport)(); - transptr!=NULL;transptr=TRANS(LocalGetNextTransport)(), index++) - { - switch( type ) - { - case XTRANS_OPEN_COTS_CLIENT: - ciptr->fd=transptr->devcotsopenclient(ciptr,port); - break; - case XTRANS_OPEN_CLTS_CLIENT: - ciptr->fd=transptr->devcltsopenclient(ciptr,port); - break; - case XTRANS_OPEN_COTS_SERVER: - case XTRANS_OPEN_CLTS_SERVER: - prmsg(1, - "LocalOpenClient: Should not be opening a server with this function\n"); - break; - default: - prmsg(1, - "LocalOpenClient: Unknown Open type %d\n", - type); - } - if( ciptr->fd >= 0 ) - break; - } - - TRANS(LocalEndTransports)(); - - if( ciptr->fd < 0 ) - { - free(ciptr); - return NULL; - } - - ciptr->priv=(char *)transptr; - ciptr->index = index; - - return ciptr; -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -static XtransConnInfo -TRANS(LocalOpenServer)(int type, const char *protocol, - const char *host _X_UNUSED, const char *port) - -{ - int i; - XtransConnInfo ciptr; - - prmsg(2,"LocalOpenServer(%d,%s,%s)\n", type, protocol, port); - -#if defined(X11_t) - /* - * For X11, the port will be in the format xserverN where N is the - * display number. All of the local connections just need to know - * the display number because they don't do any name resolution on - * the port. This just truncates port to the display portion. - */ -#endif /* X11_t */ - - if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) - { - prmsg(1,"LocalOpenServer: calloc(1,%lu) failed\n", - sizeof(struct _XtransConnInfo)); - return NULL; - } - - for(i=1;ifd=LOCALtrans2devtab[i].devcotsopenserver(ciptr,port); - break; - case XTRANS_OPEN_CLTS_SERVER: - ciptr->fd=LOCALtrans2devtab[i].devcltsopenserver(ciptr,port); - break; - default: - prmsg(1,"LocalOpenServer: Unknown Open type %d\n", - type ); - } - if( ciptr->fd >= 0 ) { - ciptr->priv=(char *)&LOCALtrans2devtab[i]; - ciptr->index=i; - ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS); - return ciptr; - } - } - - free(ciptr); - return NULL; -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_REOPEN - -static XtransConnInfo -TRANS(LocalReopenServer)(int type, int index, int fd, const char *port) - -{ - XtransConnInfo ciptr; - int stat = 0; - - prmsg(2,"LocalReopenServer(%d,%d,%d)\n", type, index, fd); - - if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) - { - prmsg(1,"LocalReopenServer: calloc(1,%lu) failed\n", - sizeof(struct _XtransConnInfo)); - return NULL; - } - - ciptr->fd = fd; - - switch( type ) - { - case XTRANS_OPEN_COTS_SERVER: - stat = LOCALtrans2devtab[index].devcotsreopenserver(ciptr,fd,port); - break; - case XTRANS_OPEN_CLTS_SERVER: - stat = LOCALtrans2devtab[index].devcltsreopenserver(ciptr,fd,port); - break; - default: - prmsg(1,"LocalReopenServer: Unknown Open type %d\n", - type ); - } - - if( stat > 0 ) { - ciptr->priv=(char *)&LOCALtrans2devtab[index]; - ciptr->index=index; - ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS); - return ciptr; - } - - free(ciptr); - return NULL; -} - -#endif /* TRANS_REOPEN */ - - - -/* - * This is the Local implementation of the X Transport service layer - */ - -#ifdef TRANS_CLIENT - -static XtransConnInfo -TRANS(LocalOpenCOTSClient)(Xtransport *thistrans _X_UNUSED, const char *protocol, - const char *host, const char *port) - -{ - prmsg(2,"LocalOpenCOTSClient(%s,%s,%s)\n",protocol,host,port); - - return TRANS(LocalOpenClient)(XTRANS_OPEN_COTS_CLIENT, protocol, host, port); -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -static XtransConnInfo -TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, const char *protocol, - const char *host, const char *port) - -{ - char *typetocheck = NULL; - int found = 0; - char typebuf[TYPEBUFSIZE]; - - prmsg(2,"LocalOpenCOTSServer(%s,%s,%s)\n",protocol,host,port); - - /* Check if this local type is in the XLOCAL list */ - TRANS(LocalInitTransports)("local"); - typetocheck = workingXLOCAL; - while (typetocheck && !found) { - int j; - - workingXLOCAL = strchr(workingXLOCAL, ':'); - if (workingXLOCAL && *workingXLOCAL) - *workingXLOCAL++ = '\0'; - strncpy(typebuf, typetocheck, TYPEBUFSIZE); - for (j = 0; j < TYPEBUFSIZE; j++) - if (isupper(typebuf[j])) - typebuf[j] = tolower(typebuf[j]); - if (!strcmp(thistrans->TransName, typebuf)) - found = 1; - typetocheck = workingXLOCAL; - } - TRANS(LocalEndTransports)(); - - if (!found) { - prmsg(3,"LocalOpenCOTSServer: disabling %s\n",thistrans->TransName); - thistrans->flags |= TRANS_DISABLED; - return NULL; - } - - return TRANS(LocalOpenServer)(XTRANS_OPEN_COTS_SERVER, protocol, host, port); -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_CLIENT - -static XtransConnInfo -TRANS(LocalOpenCLTSClient)(Xtransport *thistrans _X_UNUSED, const char *protocol, - const char *host, const char *port) - -{ - prmsg(2,"LocalOpenCLTSClient(%s,%s,%s)\n",protocol,host,port); - - return TRANS(LocalOpenClient)(XTRANS_OPEN_CLTS_CLIENT, protocol, host, port); -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -static XtransConnInfo -TRANS(LocalOpenCLTSServer)(Xtransport *thistrans _X_UNUSED, const char *protocol, - const char *host, const char *port) - -{ - prmsg(2,"LocalOpenCLTSServer(%s,%s,%s)\n",protocol,host,port); - - return TRANS(LocalOpenServer)(XTRANS_OPEN_CLTS_SERVER, protocol, host, port); -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_REOPEN - -static XtransConnInfo -TRANS(LocalReopenCOTSServer)(Xtransport *thistrans, int fd, const char *port) - -{ - int index; - - prmsg(2,"LocalReopenCOTSServer(%d,%s)\n", fd, port); - - for(index=1;indexTransName, - LOCALtrans2devtab[index].transname) == 0 ) - break; - } - - if (index >= NUMTRANSPORTS) - { - return (NULL); - } - - return TRANS(LocalReopenServer)(XTRANS_OPEN_COTS_SERVER, - index, fd, port); -} - -static XtransConnInfo -TRANS(LocalReopenCLTSServer)(Xtransport *thistrans, int fd, const char *port) - -{ - int index; - - prmsg(2,"LocalReopenCLTSServer(%d,%s)\n", fd, port); - - for(index=1;indexTransName, - LOCALtrans2devtab[index].transname) == 0 ) - break; - } - - if (index >= NUMTRANSPORTS) - { - return (NULL); - } - - return TRANS(LocalReopenServer)(XTRANS_OPEN_CLTS_SERVER, - index, fd, port); -} - -#endif /* TRANS_REOPEN */ - - - -static int -TRANS(LocalSetOption)(XtransConnInfo ciptr, int option, int arg) - -{ - prmsg(2,"LocalSetOption(%d,%d,%d)\n",ciptr->fd,option,arg); - - return -1; -} - - -#ifdef TRANS_SERVER - -static int -TRANS(LocalCreateListener)(XtransConnInfo ciptr, const char *port, - unsigned int flags _X_UNUSED) - -{ - prmsg(2,"LocalCreateListener(%p->%d,%s)\n",ciptr,ciptr->fd,port); - - return 0; -} - -static int -TRANS(LocalResetListener)(XtransConnInfo ciptr) - -{ - LOCALtrans2dev *transptr; - - prmsg(2,"LocalResetListener(%p)\n",ciptr); - - transptr=(LOCALtrans2dev *)ciptr->priv; - if (transptr->devreset != NULL) { - return transptr->devreset(ciptr); - } - return TRANS_RESET_NOOP; -} - - -static XtransConnInfo -TRANS(LocalAccept)(XtransConnInfo ciptr, int *status) - -{ - XtransConnInfo newciptr; - LOCALtrans2dev *transptr; - - prmsg(2,"LocalAccept(%p->%d)\n", ciptr, ciptr->fd); - - transptr=(LOCALtrans2dev *)ciptr->priv; - - if( (newciptr = calloc(1,sizeof(struct _XtransConnInfo)))==NULL ) - { - prmsg(1,"LocalAccept: calloc(1,%lu) failed\n", - sizeof(struct _XtransConnInfo)); - *status = TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - - newciptr->fd=transptr->devaccept(ciptr,newciptr,status); - - if( newciptr->fd < 0 ) - { - free(newciptr); - return NULL; - } - - newciptr->priv=(char *)transptr; - newciptr->index = ciptr->index; - - *status = 0; - - return newciptr; -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_CLIENT - -static int -TRANS(LocalConnect)(XtransConnInfo ciptr, - const char *host _X_UNUSED, const char *port) - -{ - prmsg(2,"LocalConnect(%p->%d,%s)\n", ciptr, ciptr->fd, port); - - return 0; -} - -#endif /* TRANS_CLIENT */ - - -static int -TRANS(LocalBytesReadable)(XtransConnInfo ciptr, BytesReadable_t *pend ) - -{ - prmsg(2,"LocalBytesReadable(%p->%d,%p)\n", ciptr, ciptr->fd, pend); - -#if defined(SCO325) - return ioctl(ciptr->fd, I_NREAD, (char *)pend); -#else - return ioctl(ciptr->fd, FIONREAD, (char *)pend); -#endif -} - -static int -TRANS(LocalRead)(XtransConnInfo ciptr, char *buf, int size) - -{ - prmsg(2,"LocalRead(%d,%p,%d)\n", ciptr->fd, buf, size ); - - return read(ciptr->fd,buf,size); -} - -static int -TRANS(LocalWrite)(XtransConnInfo ciptr, char *buf, int size) - -{ - prmsg(2,"LocalWrite(%d,%p,%d)\n", ciptr->fd, buf, size ); - - return write(ciptr->fd,buf,size); -} - -static int -TRANS(LocalReadv)(XtransConnInfo ciptr, struct iovec *buf, int size) - -{ - prmsg(2,"LocalReadv(%d,%p,%d)\n", ciptr->fd, buf, size ); - - return READV(ciptr,buf,size); -} - -static int -TRANS(LocalWritev)(XtransConnInfo ciptr, struct iovec *buf, int size) - -{ - prmsg(2,"LocalWritev(%d,%p,%d)\n", ciptr->fd, buf, size ); - - return WRITEV(ciptr,buf,size); -} - -static int -TRANS(LocalDisconnect)(XtransConnInfo ciptr) - -{ - prmsg(2,"LocalDisconnect(%p->%d)\n", ciptr, ciptr->fd); - - return 0; -} - -static int -TRANS(LocalClose)(XtransConnInfo ciptr) - -{ - struct sockaddr_un *sockname=(struct sockaddr_un *) ciptr->addr; - int ret; - - prmsg(2,"LocalClose(%p->%d)\n", ciptr, ciptr->fd ); - - ret=close(ciptr->fd); - - if(ciptr->flags - && sockname - && sockname->sun_family == AF_UNIX - && sockname->sun_path[0] ) - { - if (!(ciptr->flags & TRANS_NOUNLINK)) - unlink(sockname->sun_path); - } - - return ret; -} - -static int -TRANS(LocalCloseForCloning)(XtransConnInfo ciptr) - -{ - int ret; - - prmsg(2,"LocalCloseForCloning(%p->%d)\n", ciptr, ciptr->fd ); - - /* Don't unlink path */ - - ret=close(ciptr->fd); - - return ret; -} - - -/* - * MakeAllCOTSServerListeners() will go through the entire Xtransports[] - * array defined in Xtrans.c and try to OpenCOTSServer() for each entry. - * We will add duplicate entries to that table so that the OpenCOTSServer() - * function will get called once for each type of local transport. - * - * The TransName is in lowercase, so it will never match during a normal - * call to SelectTransport() in Xtrans.c. - */ - -#ifdef TRANS_SERVER -static const char * local_aliases[] = { -# ifdef LOCAL_TRANS_PTS - "pts", -# endif - "named", -# ifdef sun - "pipe", /* compatibility with Solaris Xlib */ -# endif -# ifdef LOCAL_TRANS_SCO - "sco", -# endif - NULL }; -#endif - -Xtransport TRANS(LocalFuncs) = { - /* Local Interface */ - "local", - TRANS_ALIAS | TRANS_LOCAL, -#ifdef TRANS_CLIENT - TRANS(LocalOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - local_aliases, - TRANS(LocalOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalOpenCLTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(LocalOpenCLTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(LocalReopenCOTSServer), - TRANS(LocalReopenCLTSServer), -#endif - TRANS(LocalSetOption), -#ifdef TRANS_SERVER - TRANS(LocalCreateListener), - TRANS(LocalResetListener), - TRANS(LocalAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalConnect), -#endif /* TRANS_CLIENT */ - TRANS(LocalBytesReadable), - TRANS(LocalRead), - TRANS(LocalWrite), - TRANS(LocalReadv), - TRANS(LocalWritev), -#if XTRANS_SEND_FDS - TRANS(LocalSendFdInvalid), - TRANS(LocalRecvFdInvalid), -#endif - TRANS(LocalDisconnect), - TRANS(LocalClose), - TRANS(LocalCloseForCloning), -}; - -#ifdef LOCAL_TRANS_PTS - -Xtransport TRANS(PTSFuncs) = { - /* Local Interface */ - "pts", - TRANS_LOCAL, -#ifdef TRANS_CLIENT - TRANS(LocalOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(LocalOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalOpenCLTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(LocalOpenCLTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(LocalReopenCOTSServer), - TRANS(LocalReopenCLTSServer), -#endif - TRANS(LocalSetOption), -#ifdef TRANS_SERVER - TRANS(LocalCreateListener), - TRANS(LocalResetListener), - TRANS(LocalAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalConnect), -#endif /* TRANS_CLIENT */ - TRANS(LocalBytesReadable), - TRANS(LocalRead), - TRANS(LocalWrite), - TRANS(LocalReadv), - TRANS(LocalWritev), -#if XTRANS_SEND_FDS - TRANS(LocalSendFdInvalid), - TRANS(LocalRecvFdInvalid), -#endif - TRANS(LocalDisconnect), - TRANS(LocalClose), - TRANS(LocalCloseForCloning), -}; - -#endif /* LOCAL_TRANS_PTS */ - -#ifdef LOCAL_TRANS_NAMED - -Xtransport TRANS(NAMEDFuncs) = { - /* Local Interface */ - "named", - TRANS_LOCAL, -#ifdef TRANS_CLIENT - TRANS(LocalOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(LocalOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalOpenCLTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(LocalOpenCLTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(LocalReopenCOTSServer), - TRANS(LocalReopenCLTSServer), -#endif - TRANS(LocalSetOption), -#ifdef TRANS_SERVER - TRANS(LocalCreateListener), - TRANS(LocalResetListener), - TRANS(LocalAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalConnect), -#endif /* TRANS_CLIENT */ - TRANS(LocalBytesReadable), - TRANS(LocalRead), - TRANS(LocalWrite), - TRANS(LocalReadv), - TRANS(LocalWritev), -#if XTRANS_SEND_FDS - TRANS(LocalSendFdInvalid), - TRANS(LocalRecvFdInvalid), -#endif - TRANS(LocalDisconnect), - TRANS(LocalClose), - TRANS(LocalCloseForCloning), -}; - -#ifdef sun -Xtransport TRANS(PIPEFuncs) = { - /* Local Interface */ - "pipe", - TRANS_ALIAS | TRANS_LOCAL, -#ifdef TRANS_CLIENT - TRANS(LocalOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(LocalOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalOpenCLTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(LocalOpenCLTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(LocalReopenCOTSServer), - TRANS(LocalReopenCLTSServer), -#endif - TRANS(LocalSetOption), -#ifdef TRANS_SERVER - TRANS(LocalCreateListener), - TRANS(LocalResetListener), - TRANS(LocalAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalConnect), -#endif /* TRANS_CLIENT */ - TRANS(LocalBytesReadable), - TRANS(LocalRead), - TRANS(LocalWrite), - TRANS(LocalReadv), - TRANS(LocalWritev), -#if XTRANS_SEND_FDS - TRANS(LocalSendFdInvalid), - TRANS(LocalRecvFdInvalid), -#endif - TRANS(LocalDisconnect), - TRANS(LocalClose), - TRANS(LocalCloseForCloning), -}; -#endif /* sun */ -#endif /* LOCAL_TRANS_NAMED */ - - -#ifdef LOCAL_TRANS_SCO -Xtransport TRANS(SCOFuncs) = { - /* Local Interface */ - "sco", - TRANS_LOCAL, -#ifdef TRANS_CLIENT - TRANS(LocalOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(LocalOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalOpenCLTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(LocalOpenCLTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(LocalReopenCOTSServer), - TRANS(LocalReopenCLTSServer), -#endif - TRANS(LocalSetOption), -#ifdef TRANS_SERVER - TRANS(LocalCreateListener), - TRANS(LocalResetListener), - TRANS(LocalAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalConnect), -#endif /* TRANS_CLIENT */ - TRANS(LocalBytesReadable), - TRANS(LocalRead), - TRANS(LocalWrite), - TRANS(LocalReadv), - TRANS(LocalWritev), -#if XTRANS_SEND_FDS - TRANS(LocalSendFdInvalid), - TRANS(LocalRecvFdInvalid), -#endif - TRANS(LocalDisconnect), - TRANS(LocalClose), - TRANS(LocalCloseForCloning), -}; -#endif /* LOCAL_TRANS_SCO */ diff --git a/openflow/usr/include/X11/Xtrans/Xtranssock.c b/openflow/usr/include/X11/Xtrans/Xtranssock.c deleted file mode 100644 index d830e7c..0000000 --- a/openflow/usr/include/X11/Xtrans/Xtranssock.c +++ /dev/null @@ -1,2749 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from the copyright holders. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#ifdef XTHREADS -#include -#endif - -#ifndef WIN32 - -#if defined(TCPCONN) || defined(UNIXCONN) -#include -#include -#include -#endif - -#if defined(TCPCONN) || defined(UNIXCONN) -#define X_INCLUDE_NETDB_H -#define XOS_USE_NO_LOCKING -#include -#endif - -#ifdef UNIXCONN -#ifndef X_NO_SYS_UN -#include -#endif -#include -#endif - - -#ifndef NO_TCP_H -#if defined(linux) || defined(__GLIBC__) -#include -#endif /* osf */ -#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) -#include -#include -#endif /* __NetBSD__ || __OpenBSD__ || __FreeBSD__ || __DragonFly__ */ -#include -#endif /* !NO_TCP_H */ - -#include -#if defined(SVR4) || defined(__SVR4) -#include -#endif - -#if (defined(__i386__) && defined(SYSV)) && !defined(SCO325) && !defined(sun) -#include -#endif - -#if defined(__i386__) && defined(SYSV) -#include -#endif - -#include - -#else /* !WIN32 */ - -#include -#include -#include -#undef close -#define close closesocket -#define ECONNREFUSED WSAECONNREFUSED -#define EADDRINUSE WSAEADDRINUSE -#define EPROTOTYPE WSAEPROTOTYPE -#undef EWOULDBLOCK -#define EWOULDBLOCK WSAEWOULDBLOCK -#define EINPROGRESS WSAEINPROGRESS -#undef EINTR -#define EINTR WSAEINTR -#define X_INCLUDE_NETDB_H -#define XOS_USE_MTSAFE_NETDBAPI -#include -#endif /* WIN32 */ - -#if defined(SO_DONTLINGER) && defined(SO_LINGER) -#undef SO_DONTLINGER -#endif - -/* others don't need this */ -#define SocketInitOnce() /**/ - -#ifdef linux -#define HAVE_ABSTRACT_SOCKETS -#endif - -#define MIN_BACKLOG 128 -#ifdef SOMAXCONN -#if SOMAXCONN > MIN_BACKLOG -#define BACKLOG SOMAXCONN -#endif -#endif -#ifndef BACKLOG -#define BACKLOG MIN_BACKLOG -#endif - -/* - * This is the Socket implementation of the X Transport service layer - * - * This file contains the implementation for both the UNIX and INET domains, - * and can be built for either one, or both. - * - */ - -typedef struct _Sockettrans2dev { - const char *transname; - int family; - int devcotsname; - int devcltsname; - int protocol; -} Sockettrans2dev; - -static Sockettrans2dev Sockettrans2devtab[] = { -#ifdef TCPCONN - {"inet",AF_INET,SOCK_STREAM,SOCK_DGRAM,0}, -#if !defined(IPv6) || !defined(AF_INET6) - {"tcp",AF_INET,SOCK_STREAM,SOCK_DGRAM,0}, -#else /* IPv6 */ - {"tcp",AF_INET6,SOCK_STREAM,SOCK_DGRAM,0}, - {"tcp",AF_INET,SOCK_STREAM,SOCK_DGRAM,0}, /* fallback */ - {"inet6",AF_INET6,SOCK_STREAM,SOCK_DGRAM,0}, -#endif -#endif /* TCPCONN */ -#ifdef UNIXCONN - {"unix",AF_UNIX,SOCK_STREAM,SOCK_DGRAM,0}, -#if !defined(LOCALCONN) - {"local",AF_UNIX,SOCK_STREAM,SOCK_DGRAM,0}, -#endif /* !LOCALCONN */ -#endif /* UNIXCONN */ -}; - -#define NUMSOCKETFAMILIES (sizeof(Sockettrans2devtab)/sizeof(Sockettrans2dev)) - -#ifdef TCPCONN -static int TRANS(SocketINETClose) (XtransConnInfo ciptr); -#endif - -#ifdef UNIXCONN - - -#if defined(X11_t) -#define UNIX_PATH "/tmp/.X11-unix/X" -#define UNIX_DIR "/tmp/.X11-unix" -#endif /* X11_t */ -#if defined(XIM_t) -#define UNIX_PATH "/tmp/.XIM-unix/XIM" -#define UNIX_DIR "/tmp/.XIM-unix" -#endif /* XIM_t */ -#if defined(FS_t) || defined(FONT_t) -#define UNIX_PATH "/tmp/.font-unix/fs" -#define UNIX_DIR "/tmp/.font-unix" -#endif /* FS_t || FONT_t */ -#if defined(ICE_t) -#define UNIX_PATH "/tmp/.ICE-unix/" -#define UNIX_DIR "/tmp/.ICE-unix" -#endif /* ICE_t */ -#if defined(TEST_t) -#define UNIX_PATH "/tmp/.Test-unix/test" -#define UNIX_DIR "/tmp/.Test-unix" -#endif -#if defined(LBXPROXY_t) -#define UNIX_PATH "/tmp/.X11-unix/X" -#define UNIX_DIR "/tmp/.X11-unix" -#endif - - -#endif /* UNIXCONN */ - -#define PORTBUFSIZE 32 - -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 255 -#endif - -#if defined HAVE_SOCKLEN_T || (defined(IPv6) && defined(AF_INET6)) -# define SOCKLEN_T socklen_t -#elif defined(SVR4) || defined(__SVR4) || defined(__SCO__) -# define SOCKLEN_T size_t -#else -# define SOCKLEN_T int -#endif - -/* - * These are some utility function used by the real interface function below. - */ - -static int -TRANS(SocketSelectFamily) (int first, const char *family) - -{ - int i; - - prmsg (3,"SocketSelectFamily(%s)\n", family); - - for (i = first + 1; i < NUMSOCKETFAMILIES;i++) - { - if (!strcmp (family, Sockettrans2devtab[i].transname)) - return i; - } - - return (first == -1 ? -2 : -1); -} - - -/* - * This function gets the local address of the socket and stores it in the - * XtransConnInfo structure for the connection. - */ - -static int -TRANS(SocketINETGetAddr) (XtransConnInfo ciptr) - -{ -#if defined(IPv6) && defined(AF_INET6) - struct sockaddr_storage socknamev6; -#else - struct sockaddr_in socknamev4; -#endif - void *socknamePtr; - SOCKLEN_T namelen; - - prmsg (3,"SocketINETGetAddr(%p)\n", ciptr); - -#if defined(IPv6) && defined(AF_INET6) - namelen = sizeof(socknamev6); - socknamePtr = &socknamev6; -#else - namelen = sizeof(socknamev4); - socknamePtr = &socknamev4; -#endif - - bzero(socknamePtr, namelen); - - if (getsockname (ciptr->fd,(struct sockaddr *) socknamePtr, - (void *)&namelen) < 0) - { -#ifdef WIN32 - errno = WSAGetLastError(); -#endif - prmsg (1,"SocketINETGetAddr: getsockname() failed: %d\n", - EGET()); - return -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - if ((ciptr->addr = malloc (namelen)) == NULL) - { - prmsg (1, - "SocketINETGetAddr: Can't allocate space for the addr\n"); - return -1; - } - -#if defined(IPv6) && defined(AF_INET6) - ciptr->family = ((struct sockaddr *)socknamePtr)->sa_family; -#else - ciptr->family = socknamev4.sin_family; -#endif - ciptr->addrlen = namelen; - memcpy (ciptr->addr, socknamePtr, ciptr->addrlen); - - return 0; -} - - -/* - * This function gets the remote address of the socket and stores it in the - * XtransConnInfo structure for the connection. - */ - -static int -TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr) - -{ -#if defined(IPv6) && defined(AF_INET6) - struct sockaddr_storage socknamev6; -#endif - struct sockaddr_in socknamev4; - void *socknamePtr; - SOCKLEN_T namelen; - -#if defined(IPv6) && defined(AF_INET6) - if (ciptr->family == AF_INET6) - { - namelen = sizeof(socknamev6); - socknamePtr = &socknamev6; - } - else -#endif - { - namelen = sizeof(socknamev4); - socknamePtr = &socknamev4; - } - - bzero(socknamePtr, namelen); - - prmsg (3,"SocketINETGetPeerAddr(%p)\n", ciptr); - - if (getpeername (ciptr->fd, (struct sockaddr *) socknamePtr, - (void *)&namelen) < 0) - { -#ifdef WIN32 - errno = WSAGetLastError(); -#endif - prmsg (1,"SocketINETGetPeerAddr: getpeername() failed: %d\n", - EGET()); - return -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - if ((ciptr->peeraddr = malloc (namelen)) == NULL) - { - prmsg (1, - "SocketINETGetPeerAddr: Can't allocate space for the addr\n"); - return -1; - } - - ciptr->peeraddrlen = namelen; - memcpy (ciptr->peeraddr, socknamePtr, ciptr->peeraddrlen); - - return 0; -} - - -static XtransConnInfo -TRANS(SocketOpen) (int i, int type) - -{ - XtransConnInfo ciptr; - - prmsg (3,"SocketOpen(%d,%d)\n", i, type); - - if ((ciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) - { - prmsg (1, "SocketOpen: malloc failed\n"); - return NULL; - } - - if ((ciptr->fd = socket(Sockettrans2devtab[i].family, type, - Sockettrans2devtab[i].protocol)) < 0 -#ifndef WIN32 -#if (defined(X11_t) && !defined(USE_POLL)) || defined(FS_t) || defined(FONT_t) - || ciptr->fd >= sysconf(_SC_OPEN_MAX) -#endif -#endif - ) { -#ifdef WIN32 - errno = WSAGetLastError(); -#endif - prmsg (2, "SocketOpen: socket() failed for %s\n", - Sockettrans2devtab[i].transname); - - free (ciptr); - return NULL; - } - -#ifdef TCP_NODELAY - if (Sockettrans2devtab[i].family == AF_INET -#if defined(IPv6) && defined(AF_INET6) - || Sockettrans2devtab[i].family == AF_INET6 -#endif - ) - { - /* - * turn off TCP coalescence for INET sockets - */ - - int tmp = 1; - setsockopt (ciptr->fd, IPPROTO_TCP, TCP_NODELAY, - (char *) &tmp, sizeof (int)); - } -#endif - - /* - * Some systems provide a really small default buffer size for - * UNIX sockets. Bump it up a bit such that large transfers don't - * proceed at glacial speed. - */ -#ifdef SO_SNDBUF - if (Sockettrans2devtab[i].family == AF_UNIX) - { - SOCKLEN_T len = sizeof (int); - int val; - - if (getsockopt (ciptr->fd, SOL_SOCKET, SO_SNDBUF, - (char *) &val, &len) == 0 && val < 64 * 1024) - { - val = 64 * 1024; - setsockopt (ciptr->fd, SOL_SOCKET, SO_SNDBUF, - (char *) &val, sizeof (int)); - } - } -#endif - - return ciptr; -} - - -#ifdef TRANS_REOPEN - -static XtransConnInfo -TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, const char *port) - -{ - XtransConnInfo ciptr; - int portlen; - struct sockaddr *addr; - size_t addrlen; - - prmsg (3,"SocketReopen(%d,%d,%s)\n", type, fd, port); - - if (port == NULL) { - prmsg (1, "SocketReopen: port was null!\n"); - return NULL; - } - - portlen = strlen(port) + 1; // include space for trailing null -#ifdef SOCK_MAXADDRLEN - if (portlen < 0 || portlen > (SOCK_MAXADDRLEN + 2)) { - prmsg (1, "SocketReopen: invalid portlen %d\n", portlen); - return NULL; - } - if (portlen < 14) portlen = 14; -#else - if (portlen < 0 || portlen > 14) { - prmsg (1, "SocketReopen: invalid portlen %d\n", portlen); - return NULL; - } -#endif /*SOCK_MAXADDRLEN*/ - - if ((ciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) - { - prmsg (1, "SocketReopen: malloc(ciptr) failed\n"); - return NULL; - } - - ciptr->fd = fd; - - addrlen = portlen + offsetof(struct sockaddr, sa_data); - if ((addr = calloc (1, addrlen)) == NULL) { - prmsg (1, "SocketReopen: malloc(addr) failed\n"); - free (ciptr); - return NULL; - } - ciptr->addr = (char *) addr; - ciptr->addrlen = addrlen; - - if ((ciptr->peeraddr = calloc (1, addrlen)) == NULL) { - prmsg (1, "SocketReopen: malloc(portaddr) failed\n"); - free (addr); - free (ciptr); - return NULL; - } - ciptr->peeraddrlen = addrlen; - - /* Initialize ciptr structure as if it were a normally-opened unix socket */ - ciptr->flags = TRANS_LOCAL | TRANS_NOUNLINK; -#ifdef BSD44SOCKETS - addr->sa_len = addrlen; -#endif - addr->sa_family = AF_UNIX; -#ifdef HAS_STRLCPY - strlcpy(addr->sa_data, port, portlen); -#else - strncpy(addr->sa_data, port, portlen); -#endif - ciptr->family = AF_UNIX; - memcpy(ciptr->peeraddr, ciptr->addr, addrlen); - ciptr->port = rindex(addr->sa_data, ':'); - if (ciptr->port == NULL) { - if (is_numeric(addr->sa_data)) { - ciptr->port = addr->sa_data; - } - } else if (ciptr->port[0] == ':') { - ciptr->port++; - } - /* port should now point to portnum or NULL */ - return ciptr; -} - -#endif /* TRANS_REOPEN */ - - -/* - * These functions are the interface supplied in the Xtransport structure - */ - -#ifdef TRANS_CLIENT - -static XtransConnInfo -TRANS(SocketOpenCOTSClientBase) (const char *transname, const char *protocol, - const char *host, const char *port, int previndex) -{ - XtransConnInfo ciptr; - int i = previndex; - - prmsg (2, "SocketOpenCOTSClient(%s,%s,%s)\n", - protocol, host, port); - - SocketInitOnce(); - - while ((i = TRANS(SocketSelectFamily) (i, transname)) >= 0) { - if ((ciptr = TRANS(SocketOpen) ( - i, Sockettrans2devtab[i].devcotsname)) != NULL) { - /* Save the index for later use */ - - ciptr->index = i; - break; - } - } - if (i < 0) { - if (i == -1) - prmsg (1,"SocketOpenCOTSClient: Unable to open socket for %s\n", - transname); - else - prmsg (1,"SocketOpenCOTSClient: Unable to determine socket type for %s\n", - transname); - return NULL; - } - - return ciptr; -} - -static XtransConnInfo -TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, const char *protocol, - const char *host, const char *port) -{ - return TRANS(SocketOpenCOTSClientBase)( - thistrans->TransName, protocol, host, port, -1); -} - - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -static XtransConnInfo -TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, const char *protocol, - const char *host, const char *port) - -{ - XtransConnInfo ciptr; - int i = -1; - - prmsg (2,"SocketOpenCOTSServer(%s,%s,%s)\n", protocol, host, port); - - SocketInitOnce(); - - while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) { - if ((ciptr = TRANS(SocketOpen) ( - i, Sockettrans2devtab[i].devcotsname)) != NULL) - break; - } - if (i < 0) { - if (i == -1) - prmsg (1,"SocketOpenCOTSServer: Unable to open socket for %s\n", - thistrans->TransName); - else - prmsg (1,"SocketOpenCOTSServer: Unable to determine socket type for %s\n", - thistrans->TransName); - return NULL; - } - - /* - * Using this prevents the bind() check for an existing server listening - * on the same port, but it is required for other reasons. - */ -#ifdef SO_REUSEADDR - - /* - * SO_REUSEADDR only applied to AF_INET && AF_INET6 - */ - - if (Sockettrans2devtab[i].family == AF_INET -#if defined(IPv6) && defined(AF_INET6) - || Sockettrans2devtab[i].family == AF_INET6 -#endif - ) - { - int one = 1; - setsockopt (ciptr->fd, SOL_SOCKET, SO_REUSEADDR, - (char *) &one, sizeof (int)); - } -#endif -#ifdef IPV6_V6ONLY - if (Sockettrans2devtab[i].family == AF_INET6) - { - int one = 1; - setsockopt(ciptr->fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(int)); - } -#endif - /* Save the index for later use */ - - ciptr->index = i; - - return ciptr; -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_CLIENT - -static XtransConnInfo -TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, const char *protocol, - const char *host, const char *port) - -{ - XtransConnInfo ciptr; - int i = -1; - - prmsg (2,"SocketOpenCLTSClient(%s,%s,%s)\n", protocol, host, port); - - SocketInitOnce(); - - while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) { - if ((ciptr = TRANS(SocketOpen) ( - i, Sockettrans2devtab[i].devcotsname)) != NULL) - break; - } - if (i < 0) { - if (i == -1) - prmsg (1,"SocketOpenCLTSClient: Unable to open socket for %s\n", - thistrans->TransName); - else - prmsg (1,"SocketOpenCLTSClient: Unable to determine socket type for %s\n", - thistrans->TransName); - return NULL; - } - - /* Save the index for later use */ - - ciptr->index = i; - - return ciptr; -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -static XtransConnInfo -TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, const char *protocol, - const char *host, const char *port) - -{ - XtransConnInfo ciptr; - int i = -1; - - prmsg (2,"SocketOpenCLTSServer(%s,%s,%s)\n", protocol, host, port); - - SocketInitOnce(); - - while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) { - if ((ciptr = TRANS(SocketOpen) ( - i, Sockettrans2devtab[i].devcotsname)) != NULL) - break; - } - if (i < 0) { - if (i == -1) - prmsg (1,"SocketOpenCLTSServer: Unable to open socket for %s\n", - thistrans->TransName); - else - prmsg (1,"SocketOpenCLTSServer: Unable to determine socket type for %s\n", - thistrans->TransName); - return NULL; - } - -#ifdef IPV6_V6ONLY - if (Sockettrans2devtab[i].family == AF_INET6) - { - int one = 1; - setsockopt(ciptr->fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(int)); - } -#endif - /* Save the index for later use */ - - ciptr->index = i; - - return ciptr; -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_REOPEN - -static XtransConnInfo -TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, const char *port) - -{ - XtransConnInfo ciptr; - int i = -1; - - prmsg (2, - "SocketReopenCOTSServer(%d, %s)\n", fd, port); - - SocketInitOnce(); - - while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) { - if ((ciptr = TRANS(SocketReopen) ( - i, Sockettrans2devtab[i].devcotsname, fd, port)) != NULL) - break; - } - if (i < 0) { - if (i == -1) - prmsg (1,"SocketReopenCOTSServer: Unable to open socket for %s\n", - thistrans->TransName); - else - prmsg (1,"SocketReopenCOTSServer: Unable to determine socket type for %s\n", - thistrans->TransName); - return NULL; - } - - /* Save the index for later use */ - - ciptr->index = i; - - return ciptr; -} - -static XtransConnInfo -TRANS(SocketReopenCLTSServer) (Xtransport *thistrans, int fd, const char *port) - -{ - XtransConnInfo ciptr; - int i = -1; - - prmsg (2, - "SocketReopenCLTSServer(%d, %s)\n", fd, port); - - SocketInitOnce(); - - while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) { - if ((ciptr = TRANS(SocketReopen) ( - i, Sockettrans2devtab[i].devcotsname, fd, port)) != NULL) - break; - } - if (i < 0) { - if (i == -1) - prmsg (1,"SocketReopenCLTSServer: Unable to open socket for %s\n", - thistrans->TransName); - else - prmsg (1,"SocketReopenCLTSServer: Unable to determine socket type for %s\n", - thistrans->TransName); - return NULL; - } - - /* Save the index for later use */ - - ciptr->index = i; - - return ciptr; -} - -#endif /* TRANS_REOPEN */ - - -static int -TRANS(SocketSetOption) (XtransConnInfo ciptr, int option, int arg) - -{ - prmsg (2,"SocketSetOption(%d,%d,%d)\n", ciptr->fd, option, arg); - - return -1; -} - -#ifdef UNIXCONN -static int -set_sun_path(const char *port, const char *upath, char *path, int abstract) -{ - struct sockaddr_un s; - int maxlen = sizeof(s.sun_path) - 1; - const char *at = ""; - - if (!port || !*port || !path) - return -1; - -#ifdef HAVE_ABSTRACT_SOCKETS - if (port[0] == '@') - upath = ""; - else if (abstract) - at = "@"; -#endif - - if (*port == '/') /* a full pathname */ - upath = ""; - - if (strlen(port) + strlen(upath) > maxlen) - return -1; - snprintf(path, sizeof(s.sun_path), "%s%s%s", at, upath, port); - return 0; -} -#endif - -#ifdef TRANS_SERVER - -static int -TRANS(SocketCreateListener) (XtransConnInfo ciptr, - struct sockaddr *sockname, - int socknamelen, unsigned int flags) - -{ - SOCKLEN_T namelen = socknamelen; - int fd = ciptr->fd; - int retry; - - prmsg (3, "SocketCreateListener(%p,%d)\n", ciptr, fd); - - if (Sockettrans2devtab[ciptr->index].family == AF_INET -#if defined(IPv6) && defined(AF_INET6) - || Sockettrans2devtab[ciptr->index].family == AF_INET6 -#endif - ) - retry = 20; - else - retry = 0; - - while (bind (fd, (struct sockaddr *) sockname, namelen) < 0) - { - if (errno == EADDRINUSE) { - if (flags & ADDR_IN_USE_ALLOWED) - break; - else - return TRANS_ADDR_IN_USE; - } - - if (retry-- == 0) { - prmsg (1, "SocketCreateListener: failed to bind listener\n"); - close (fd); - return TRANS_CREATE_LISTENER_FAILED; - } -#ifdef SO_REUSEADDR - sleep (1); -#else - sleep (10); -#endif /* SO_REUSEDADDR */ - } - - if (Sockettrans2devtab[ciptr->index].family == AF_INET -#if defined(IPv6) && defined(AF_INET6) - || Sockettrans2devtab[ciptr->index].family == AF_INET6 -#endif - ) { -#ifdef SO_DONTLINGER - setsockopt (fd, SOL_SOCKET, SO_DONTLINGER, (char *) NULL, 0); -#else -#ifdef SO_LINGER - { - static int linger[2] = { 0, 0 }; - setsockopt (fd, SOL_SOCKET, SO_LINGER, - (char *) linger, sizeof (linger)); - } -#endif -#endif -} - - if (listen (fd, BACKLOG) < 0) - { - prmsg (1, "SocketCreateListener: listen() failed\n"); - close (fd); - return TRANS_CREATE_LISTENER_FAILED; - } - - /* Set a flag to indicate that this connection is a listener */ - - ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS); - - return 0; -} - -#ifdef TCPCONN -static int -TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, const char *port, - unsigned int flags) - -{ -#if defined(IPv6) && defined(AF_INET6) - struct sockaddr_storage sockname; -#else - struct sockaddr_in sockname; -#endif - unsigned short sport; - SOCKLEN_T namelen = sizeof(sockname); - int status; - long tmpport; -#ifdef XTHREADS_NEEDS_BYNAMEPARAMS - _Xgetservbynameparams sparams; -#endif - struct servent *servp; - -#ifdef X11_t - char portbuf[PORTBUFSIZE]; -#endif - - prmsg (2, "SocketINETCreateListener(%s)\n", port); - -#ifdef X11_t - /* - * X has a well known port, that is transport dependent. It is easier - * to handle it here, than try and come up with a transport independent - * representation that can be passed in and resolved the usual way. - * - * The port that is passed here is really a string containing the idisplay - * from ConnectDisplay(). - */ - - if (is_numeric (port)) - { - /* fixup the server port address */ - tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10); - snprintf (portbuf, sizeof(portbuf), "%lu", tmpport); - port = portbuf; - } -#endif - - if (port && *port) - { - /* Check to see if the port string is just a number (handles X11) */ - - if (!is_numeric (port)) - { - if ((servp = _XGetservbyname (port,"tcp",sparams)) == NULL) - { - prmsg (1, - "SocketINETCreateListener: Unable to get service for %s\n", - port); - return TRANS_CREATE_LISTENER_FAILED; - } - /* we trust getservbyname to return a valid number */ - sport = servp->s_port; - } - else - { - tmpport = strtol (port, (char**)NULL, 10); - /* - * check that somehow the port address isn't negative or in - * the range of reserved port addresses. This can happen and - * be very bad if the server is suid-root and the user does - * something (dumb) like `X :60049`. - */ - if (tmpport < 1024 || tmpport > USHRT_MAX) - return TRANS_CREATE_LISTENER_FAILED; - - sport = (unsigned short) tmpport; - } - } - else - sport = 0; - - bzero(&sockname, sizeof(sockname)); -#if defined(IPv6) && defined(AF_INET6) - if (Sockettrans2devtab[ciptr->index].family == AF_INET) { - namelen = sizeof (struct sockaddr_in); -#ifdef BSD44SOCKETS - ((struct sockaddr_in *)&sockname)->sin_len = namelen; -#endif - ((struct sockaddr_in *)&sockname)->sin_family = AF_INET; - ((struct sockaddr_in *)&sockname)->sin_port = htons(sport); - ((struct sockaddr_in *)&sockname)->sin_addr.s_addr = htonl(INADDR_ANY); - } else { - namelen = sizeof (struct sockaddr_in6); -#ifdef SIN6_LEN - ((struct sockaddr_in6 *)&sockname)->sin6_len = sizeof(sockname); -#endif - ((struct sockaddr_in6 *)&sockname)->sin6_family = AF_INET6; - ((struct sockaddr_in6 *)&sockname)->sin6_port = htons(sport); - ((struct sockaddr_in6 *)&sockname)->sin6_addr = in6addr_any; - } -#else -#ifdef BSD44SOCKETS - sockname.sin_len = sizeof (sockname); -#endif - sockname.sin_family = AF_INET; - sockname.sin_port = htons (sport); - sockname.sin_addr.s_addr = htonl (INADDR_ANY); -#endif - - if ((status = TRANS(SocketCreateListener) (ciptr, - (struct sockaddr *) &sockname, namelen, flags)) < 0) - { - prmsg (1, - "SocketINETCreateListener: ...SocketCreateListener() failed\n"); - return status; - } - - if (TRANS(SocketINETGetAddr) (ciptr) < 0) - { - prmsg (1, - "SocketINETCreateListener: ...SocketINETGetAddr() failed\n"); - return TRANS_CREATE_LISTENER_FAILED; - } - - return 0; -} - -#endif /* TCPCONN */ - - -#ifdef UNIXCONN - -static int -TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, const char *port, - unsigned int flags) - -{ - struct sockaddr_un sockname; - int namelen; - int oldUmask; - int status; - unsigned int mode; - char tmpport[108]; - - int abstract = 0; -#ifdef HAVE_ABSTRACT_SOCKETS - abstract = ciptr->transptr->flags & TRANS_ABSTRACT; -#endif - - prmsg (2, "SocketUNIXCreateListener(%s)\n", - port ? port : "NULL"); - - /* Make sure the directory is created */ - - oldUmask = umask (0); - -#ifdef UNIX_DIR -#ifdef HAS_STICKY_DIR_BIT - mode = 01777; -#else - mode = 0777; -#endif - if (!abstract && trans_mkdir(UNIX_DIR, mode) == -1) { - prmsg (1, "SocketUNIXCreateListener: mkdir(%s) failed, errno = %d\n", - UNIX_DIR, errno); - (void) umask (oldUmask); - return TRANS_CREATE_LISTENER_FAILED; - } -#endif - - memset(&sockname, 0, sizeof(sockname)); - sockname.sun_family = AF_UNIX; - - if (!(port && *port)) { - snprintf (tmpport, sizeof(tmpport), "%s%ld", UNIX_PATH, (long)getpid()); - port = tmpport; - } - if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) { - prmsg (1, "SocketUNIXCreateListener: path too long\n"); - return TRANS_CREATE_LISTENER_FAILED; - } - -#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) - sockname.sun_len = strlen(sockname.sun_path); -#endif - -#if defined(BSD44SOCKETS) || defined(SUN_LEN) - namelen = SUN_LEN(&sockname); -#else - namelen = strlen(sockname.sun_path) + offsetof(struct sockaddr_un, sun_path); -#endif - - if (abstract) { - sockname.sun_path[0] = '\0'; - namelen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&sockname.sun_path[1]); - } - else - unlink (sockname.sun_path); - - if ((status = TRANS(SocketCreateListener) (ciptr, - (struct sockaddr *) &sockname, namelen, flags)) < 0) - { - prmsg (1, - "SocketUNIXCreateListener: ...SocketCreateListener() failed\n"); - (void) umask (oldUmask); - return status; - } - - /* - * Now that the listener is esablished, create the addr info for - * this connection. getpeername() doesn't work for UNIX Domain Sockets - * on some systems (hpux at least), so we will just do it manually, instead - * of calling something like TRANS(SocketUNIXGetAddr). - */ - - namelen = sizeof (sockname); /* this will always make it the same size */ - - if ((ciptr->addr = malloc (namelen)) == NULL) - { - prmsg (1, - "SocketUNIXCreateListener: Can't allocate space for the addr\n"); - (void) umask (oldUmask); - return TRANS_CREATE_LISTENER_FAILED; - } - - if (abstract) - sockname.sun_path[0] = '@'; - - ciptr->family = sockname.sun_family; - ciptr->addrlen = namelen; - memcpy (ciptr->addr, &sockname, ciptr->addrlen); - - (void) umask (oldUmask); - - return 0; -} - - -static int -TRANS(SocketUNIXResetListener) (XtransConnInfo ciptr) - -{ - /* - * See if the unix domain socket has disappeared. If it has, recreate it. - */ - - struct sockaddr_un *unsock = (struct sockaddr_un *) ciptr->addr; - struct stat statb; - int status = TRANS_RESET_NOOP; - unsigned int mode; - int abstract = 0; -#ifdef HAVE_ABSTRACT_SOCKETS - abstract = ciptr->transptr->flags & TRANS_ABSTRACT; -#endif - - prmsg (3, "SocketUNIXResetListener(%p,%d)\n", ciptr, ciptr->fd); - - if (!abstract && ( - stat (unsock->sun_path, &statb) == -1 || - ((statb.st_mode & S_IFMT) != -#if defined(NCR) || defined(SCO325) || !defined(S_IFSOCK) - S_IFIFO -#else - S_IFSOCK -#endif - ))) - { - int oldUmask = umask (0); - -#ifdef UNIX_DIR -#ifdef HAS_STICKY_DIR_BIT - mode = 01777; -#else - mode = 0777; -#endif - if (trans_mkdir(UNIX_DIR, mode) == -1) { - prmsg (1, "SocketUNIXResetListener: mkdir(%s) failed, errno = %d\n", - UNIX_DIR, errno); - (void) umask (oldUmask); - return TRANS_RESET_FAILURE; - } -#endif - - close (ciptr->fd); - unlink (unsock->sun_path); - - if ((ciptr->fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) - { - TRANS(FreeConnInfo) (ciptr); - (void) umask (oldUmask); - return TRANS_RESET_FAILURE; - } - - if (bind (ciptr->fd, (struct sockaddr *) unsock, ciptr->addrlen) < 0) - { - close (ciptr->fd); - TRANS(FreeConnInfo) (ciptr); - return TRANS_RESET_FAILURE; - } - - if (listen (ciptr->fd, BACKLOG) < 0) - { - close (ciptr->fd); - TRANS(FreeConnInfo) (ciptr); - (void) umask (oldUmask); - return TRANS_RESET_FAILURE; - } - - umask (oldUmask); - - status = TRANS_RESET_NEW_FD; - } - - return status; -} - -#endif /* UNIXCONN */ - - -#ifdef TCPCONN - -static XtransConnInfo -TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status) - -{ - XtransConnInfo newciptr; - struct sockaddr_in sockname; - SOCKLEN_T namelen = sizeof(sockname); - - prmsg (2, "SocketINETAccept(%p,%d)\n", ciptr, ciptr->fd); - - if ((newciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) - { - prmsg (1, "SocketINETAccept: malloc failed\n"); - *status = TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - - if ((newciptr->fd = accept (ciptr->fd, - (struct sockaddr *) &sockname, (void *)&namelen)) < 0) - { -#ifdef WIN32 - errno = WSAGetLastError(); -#endif - prmsg (1, "SocketINETAccept: accept() failed\n"); - free (newciptr); - *status = TRANS_ACCEPT_FAILED; - return NULL; - } - -#ifdef TCP_NODELAY - { - /* - * turn off TCP coalescence for INET sockets - */ - - int tmp = 1; - setsockopt (newciptr->fd, IPPROTO_TCP, TCP_NODELAY, - (char *) &tmp, sizeof (int)); - } -#endif - - /* - * Get this address again because the transport may give a more - * specific address now that a connection is established. - */ - - if (TRANS(SocketINETGetAddr) (newciptr) < 0) - { - prmsg (1, - "SocketINETAccept: ...SocketINETGetAddr() failed:\n"); - close (newciptr->fd); - free (newciptr); - *status = TRANS_ACCEPT_MISC_ERROR; - return NULL; - } - - if (TRANS(SocketINETGetPeerAddr) (newciptr) < 0) - { - prmsg (1, - "SocketINETAccept: ...SocketINETGetPeerAddr() failed:\n"); - close (newciptr->fd); - if (newciptr->addr) free (newciptr->addr); - free (newciptr); - *status = TRANS_ACCEPT_MISC_ERROR; - return NULL; - } - - *status = 0; - - return newciptr; -} - -#endif /* TCPCONN */ - - -#ifdef UNIXCONN -static XtransConnInfo -TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) - -{ - XtransConnInfo newciptr; - struct sockaddr_un sockname; - SOCKLEN_T namelen = sizeof sockname; - - prmsg (2, "SocketUNIXAccept(%p,%d)\n", ciptr, ciptr->fd); - - if ((newciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) - { - prmsg (1, "SocketUNIXAccept: malloc() failed\n"); - *status = TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - - if ((newciptr->fd = accept (ciptr->fd, - (struct sockaddr *) &sockname, (void *)&namelen)) < 0) - { - prmsg (1, "SocketUNIXAccept: accept() failed\n"); - free (newciptr); - *status = TRANS_ACCEPT_FAILED; - return NULL; - } - - ciptr->addrlen = namelen; - /* - * Get the socket name and the peer name from the listener socket, - * since this is unix domain. - */ - - if ((newciptr->addr = malloc (ciptr->addrlen)) == NULL) - { - prmsg (1, - "SocketUNIXAccept: Can't allocate space for the addr\n"); - close (newciptr->fd); - free (newciptr); - *status = TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - - /* - * if the socket is abstract, we already modified the address to have a - * @ instead of the initial NUL, so no need to do that again here. - */ - - newciptr->addrlen = ciptr->addrlen; - memcpy (newciptr->addr, ciptr->addr, newciptr->addrlen); - - if ((newciptr->peeraddr = malloc (ciptr->addrlen)) == NULL) - { - prmsg (1, - "SocketUNIXAccept: Can't allocate space for the addr\n"); - close (newciptr->fd); - if (newciptr->addr) free (newciptr->addr); - free (newciptr); - *status = TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - - newciptr->peeraddrlen = ciptr->addrlen; - memcpy (newciptr->peeraddr, ciptr->addr, newciptr->addrlen); - - newciptr->family = AF_UNIX; - - *status = 0; - - return newciptr; -} - -#endif /* UNIXCONN */ - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_CLIENT - -#ifdef TCPCONN - -#if defined(IPv6) && defined(AF_INET6) -struct addrlist { - struct addrinfo * addr; - struct addrinfo * firstaddr; - char port[PORTBUFSIZE]; - char host[MAXHOSTNAMELEN]; -}; -static struct addrlist *addrlist = NULL; -#endif - - -static int -TRANS(SocketINETConnect) (XtransConnInfo ciptr, - const char *host, const char *port) - -{ - struct sockaddr * socketaddr = NULL; - int socketaddrlen = 0; - int res; -#if defined(IPv6) && defined(AF_INET6) - struct addrinfo hints; - char ntopbuf[INET6_ADDRSTRLEN]; - int resetonce = 0; -#else - struct sockaddr_in sockname; - struct hostent *hostp; - struct servent *servp; - unsigned long tmpaddr; -#endif -#ifdef XTHREADS_NEEDS_BYNAMEPARAMS - _Xgethostbynameparams hparams; - _Xgetservbynameparams sparams; -#endif -#ifdef X11_t - char portbuf[PORTBUFSIZE]; -#endif - - char hostnamebuf[256]; /* tmp space */ - - prmsg (2,"SocketINETConnect(%d,%s,%s)\n", ciptr->fd, host, port); - - if (!host) - { - hostnamebuf[0] = '\0'; - (void) TRANS(GetHostname) (hostnamebuf, sizeof hostnamebuf); - host = hostnamebuf; - } - -#ifdef X11_t - /* - * X has a well known port, that is transport dependent. It is easier - * to handle it here, than try and come up with a transport independent - * representation that can be passed in and resolved the usual way. - * - * The port that is passed here is really a string containing the idisplay - * from ConnectDisplay(). - */ - - if (is_numeric (port)) - { - long tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10); - snprintf (portbuf, sizeof(portbuf), "%lu", tmpport); - port = portbuf; - } -#endif - -#if defined(IPv6) && defined(AF_INET6) - { - if (addrlist != NULL) { - if (strcmp(host,addrlist->host) || strcmp(port,addrlist->port)) { - if (addrlist->firstaddr) - freeaddrinfo(addrlist->firstaddr); - addrlist->firstaddr = NULL; - } - } else { - addrlist = malloc(sizeof(struct addrlist)); - addrlist->firstaddr = NULL; - } - - if (addrlist->firstaddr == NULL) { - strncpy(addrlist->port, port, sizeof(addrlist->port)); - addrlist->port[sizeof(addrlist->port) - 1] = '\0'; - strncpy(addrlist->host, host, sizeof(addrlist->host)); - addrlist->host[sizeof(addrlist->host) - 1] = '\0'; - - bzero(&hints,sizeof(hints)); - hints.ai_socktype = Sockettrans2devtab[ciptr->index].devcotsname; - - res = getaddrinfo(host,port,&hints,&addrlist->firstaddr); - if (res != 0) { - prmsg (1, "SocketINETConnect() can't get address " - "for %s:%s: %s\n", host, port, gai_strerror(res)); - ESET(EINVAL); - return TRANS_CONNECT_FAILED; - } - for (res = 0, addrlist->addr = addrlist->firstaddr; - addrlist->addr ; res++) { - addrlist->addr = addrlist->addr->ai_next; - } - prmsg(4,"Got New Address list with %d addresses\n", res); - res = 0; - addrlist->addr = NULL; - } - - while (socketaddr == NULL) { - if (addrlist->addr == NULL) { - if (resetonce) { - /* Already checked entire list - no usable addresses */ - prmsg (1, "SocketINETConnect() no usable address " - "for %s:%s\n", host, port); - return TRANS_CONNECT_FAILED; - } else { - /* Go back to beginning of list */ - resetonce = 1; - addrlist->addr = addrlist->firstaddr; - } - } - - socketaddr = addrlist->addr->ai_addr; - socketaddrlen = addrlist->addr->ai_addrlen; - - if (addrlist->addr->ai_family == AF_INET) { - struct sockaddr_in *sin = (struct sockaddr_in *) socketaddr; - - prmsg (4,"SocketINETConnect() sockname.sin_addr = %s\n", - inet_ntop(addrlist->addr->ai_family,&sin->sin_addr, - ntopbuf,sizeof(ntopbuf))); - - prmsg (4,"SocketINETConnect() sockname.sin_port = %d\n", - ntohs(sin->sin_port)); - - if (Sockettrans2devtab[ciptr->index].family == AF_INET6) { - if (strcmp(Sockettrans2devtab[ciptr->index].transname, - "tcp") == 0) { - XtransConnInfo newciptr; - - /* - * Our socket is an IPv6 socket, but the address is - * IPv4. Close it and get an IPv4 socket. This is - * needed for IPv4 connections to work on platforms - * that don't allow IPv4 over IPv6 sockets. - */ - TRANS(SocketINETClose)(ciptr); - newciptr = TRANS(SocketOpenCOTSClientBase)( - "tcp", "tcp", host, port, ciptr->index); - if (newciptr) - ciptr->fd = newciptr->fd; - if (!newciptr || - Sockettrans2devtab[newciptr->index].family != - AF_INET) { - socketaddr = NULL; - prmsg (4,"SocketINETConnect() Cannot get IPv4 " - " socketfor IPv4 address\n"); - } - if (newciptr) - free(newciptr); - } else { - socketaddr = NULL; - prmsg (4,"SocketINETConnect Skipping IPv4 address\n"); - } - } - } else if (addrlist->addr->ai_family == AF_INET6) { - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) socketaddr; - - prmsg (4,"SocketINETConnect() sockname.sin6_addr = %s\n", - inet_ntop(addrlist->addr->ai_family, - &sin6->sin6_addr,ntopbuf,sizeof(ntopbuf))); - prmsg (4,"SocketINETConnect() sockname.sin6_port = %d\n", - ntohs(sin6->sin6_port)); - - if (Sockettrans2devtab[ciptr->index].family == AF_INET) { - if (strcmp(Sockettrans2devtab[ciptr->index].transname, - "tcp") == 0) { - XtransConnInfo newciptr; - - /* - * Close the IPv4 socket and try to open an IPv6 socket. - */ - TRANS(SocketINETClose)(ciptr); - newciptr = TRANS(SocketOpenCOTSClientBase)( - "tcp", "tcp", host, port, -1); - if (newciptr) - ciptr->fd = newciptr->fd; - if (!newciptr || - Sockettrans2devtab[newciptr->index].family != - AF_INET6) { - socketaddr = NULL; - prmsg (4,"SocketINETConnect() Cannot get IPv6 " - "socket for IPv6 address\n"); - } - if (newciptr) - free(newciptr); - } - else - { - socketaddr = NULL; - prmsg (4,"SocketINETConnect() Skipping IPv6 address\n"); - } - } - } else { - socketaddr = NULL; /* Unsupported address type */ - } - if (socketaddr == NULL) { - addrlist->addr = addrlist->addr->ai_next; - } - } - } -#else - { - /* - * Build the socket name. - */ - -#ifdef BSD44SOCKETS - sockname.sin_len = sizeof (struct sockaddr_in); -#endif - sockname.sin_family = AF_INET; - - /* - * fill in sin_addr - */ - -#ifndef INADDR_NONE -#define INADDR_NONE ((in_addr_t) 0xffffffff) -#endif - - /* check for ww.xx.yy.zz host string */ - - if (isascii (host[0]) && isdigit (host[0])) { - tmpaddr = inet_addr (host); /* returns network byte order */ - } else { - tmpaddr = INADDR_NONE; - } - - prmsg (4,"SocketINETConnect() inet_addr(%s) = %x\n", host, tmpaddr); - - if (tmpaddr == INADDR_NONE) { - if ((hostp = _XGethostbyname(host,hparams)) == NULL) { - prmsg (1,"SocketINETConnect: Can't get address for %s\n", - host); - ESET(EINVAL); - return TRANS_CONNECT_FAILED; - } - if (hostp->h_addrtype != AF_INET) { /* is IP host? */ - prmsg (1,"SocketINETConnect: not INET host%s\n", host); - ESET(EPROTOTYPE); - return TRANS_CONNECT_FAILED; - } - - memcpy ((char *) &sockname.sin_addr, (char *) hostp->h_addr, - sizeof (sockname.sin_addr)); - - } else { - sockname.sin_addr.s_addr = tmpaddr; - } - - /* - * fill in sin_port - */ - - /* Check for number in the port string */ - - if (!is_numeric (port)) { - if ((servp = _XGetservbyname (port,"tcp",sparams)) == NULL) { - prmsg (1,"SocketINETConnect: can't get service for %s\n", - port); - return TRANS_CONNECT_FAILED; - } - sockname.sin_port = htons (servp->s_port); - } else { - long tmpport = strtol (port, (char**)NULL, 10); - if (tmpport < 1024 || tmpport > USHRT_MAX) - return TRANS_CONNECT_FAILED; - sockname.sin_port = htons (((unsigned short) tmpport)); - } - - prmsg (4,"SocketINETConnect: sockname.sin_port = %d\n", - ntohs(sockname.sin_port)); - socketaddr = (struct sockaddr *) &sockname; - socketaddrlen = sizeof(sockname); - } -#endif - - /* - * Turn on socket keepalive so the client process will eventually - * be notified with a SIGPIPE signal if the display server fails - * to respond to a periodic transmission of messages - * on the connected socket. - * This is useful to avoid hung application processes when the - * processes are not spawned from the xdm session and - * the display server terminates abnormally. - * (Someone turned off the power switch.) - */ - - { - int tmp = 1; - setsockopt (ciptr->fd, SOL_SOCKET, SO_KEEPALIVE, - (char *) &tmp, sizeof (int)); - } - - /* - * Do the connect() - */ - - if (connect (ciptr->fd, socketaddr, socketaddrlen ) < 0) - { -#ifdef WIN32 - int olderrno = WSAGetLastError(); -#else - int olderrno = errno; -#endif - - /* - * If the error was ECONNREFUSED, the server may be overloaded - * and we should try again. - * - * If the error was EWOULDBLOCK or EINPROGRESS then the socket - * was non-blocking and we should poll using select - * - * If the error was EINTR, the connect was interrupted and we - * should try again. - * - * If multiple addresses are found for a host then we should - * try to connect again with a different address for a larger - * number of errors that made us quit before, since those - * could be caused by trying to use an IPv6 address to contact - * a machine with an IPv4-only server or other reasons that - * only affect one of a set of addresses. - */ - - if (olderrno == ECONNREFUSED || olderrno == EINTR -#if defined(IPv6) && defined(AF_INET6) - || (((addrlist->addr->ai_next != NULL) || - (addrlist->addr != addrlist->firstaddr)) && - (olderrno == ENETUNREACH || olderrno == EAFNOSUPPORT || - olderrno == EADDRNOTAVAIL || olderrno == ETIMEDOUT -#if defined(EHOSTDOWN) - || olderrno == EHOSTDOWN -#endif - )) -#endif - ) - res = TRANS_TRY_CONNECT_AGAIN; - else if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS) - res = TRANS_IN_PROGRESS; - else - { - prmsg (2,"SocketINETConnect: Can't connect: errno = %d\n", - olderrno); - - res = TRANS_CONNECT_FAILED; - } - } else { - res = 0; - - - /* - * Sync up the address fields of ciptr. - */ - - if (TRANS(SocketINETGetAddr) (ciptr) < 0) - { - prmsg (1, - "SocketINETConnect: ...SocketINETGetAddr() failed:\n"); - res = TRANS_CONNECT_FAILED; - } - - else if (TRANS(SocketINETGetPeerAddr) (ciptr) < 0) - { - prmsg (1, - "SocketINETConnect: ...SocketINETGetPeerAddr() failed:\n"); - res = TRANS_CONNECT_FAILED; - } - } - -#if defined(IPv6) && defined(AF_INET6) - if (res != 0) { - addrlist->addr = addrlist->addr->ai_next; - } -#endif - - return res; -} - -#endif /* TCPCONN */ - - - -#ifdef UNIXCONN - -/* - * Make sure 'host' is really local. - */ - -static int -UnixHostReallyLocal (const char *host) - -{ - char hostnamebuf[256]; - - TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf)); - - if (strcmp (hostnamebuf, host) == 0) - { - return (1); - } else { -#if defined(IPv6) && defined(AF_INET6) - struct addrinfo *localhostaddr; - struct addrinfo *otherhostaddr; - struct addrinfo *i, *j; - int equiv = 0; - - if (getaddrinfo(hostnamebuf, NULL, NULL, &localhostaddr) != 0) - return 0; - if (getaddrinfo(host, NULL, NULL, &otherhostaddr) != 0) { - freeaddrinfo(localhostaddr); - return 0; - } - - for (i = localhostaddr; i != NULL && equiv == 0; i = i->ai_next) { - for (j = otherhostaddr; j != NULL && equiv == 0; j = j->ai_next) { - if (i->ai_family == j->ai_family) { - if (i->ai_family == AF_INET) { - struct sockaddr_in *sinA - = (struct sockaddr_in *) i->ai_addr; - struct sockaddr_in *sinB - = (struct sockaddr_in *) j->ai_addr; - struct in_addr *A = &sinA->sin_addr; - struct in_addr *B = &sinB->sin_addr; - - if (memcmp(A,B,sizeof(struct in_addr)) == 0) { - equiv = 1; - } - } else if (i->ai_family == AF_INET6) { - struct sockaddr_in6 *sinA - = (struct sockaddr_in6 *) i->ai_addr; - struct sockaddr_in6 *sinB - = (struct sockaddr_in6 *) j->ai_addr; - struct in6_addr *A = &sinA->sin6_addr; - struct in6_addr *B = &sinB->sin6_addr; - - if (memcmp(A,B,sizeof(struct in6_addr)) == 0) { - equiv = 1; - } - } - } - } - } - - freeaddrinfo(localhostaddr); - freeaddrinfo(otherhostaddr); - return equiv; -#else - /* - * A host may have more than one network address. If any of the - * network addresses of 'host' (specified to the connect call) - * match any of the network addresses of 'hostname' (determined - * by TRANS(GetHostname)), then the two hostnames are equivalent, - * and we know that 'host' is really a local host. - */ - char specified_local_addr_list[10][4]; - int scount, equiv, i, j; -#ifdef XTHREADS_NEEDS_BYNAMEPARAMS - _Xgethostbynameparams hparams; -#endif - struct hostent *hostp; - - if ((hostp = _XGethostbyname (host,hparams)) == NULL) - return (0); - - scount = 0; - while (hostp->h_addr_list[scount] && scount <= 8) - { - /* - * The 2nd call to gethostname() overrides the data - * from the 1st call, so we must save the address list. - */ - - specified_local_addr_list[scount][0] = - hostp->h_addr_list[scount][0]; - specified_local_addr_list[scount][1] = - hostp->h_addr_list[scount][1]; - specified_local_addr_list[scount][2] = - hostp->h_addr_list[scount][2]; - specified_local_addr_list[scount][3] = - hostp->h_addr_list[scount][3]; - scount++; - } - if ((hostp = _XGethostbyname (hostnamebuf,hparams)) == NULL) - return (0); - - equiv = 0; - i = 0; - - while (i < scount && !equiv) - { - j = 0; - - while (hostp->h_addr_list[j]) - { - if ((specified_local_addr_list[i][0] == - hostp->h_addr_list[j][0]) && - (specified_local_addr_list[i][1] == - hostp->h_addr_list[j][1]) && - (specified_local_addr_list[i][2] == - hostp->h_addr_list[j][2]) && - (specified_local_addr_list[i][3] == - hostp->h_addr_list[j][3])) - { - /* They're equal, so we're done */ - - equiv = 1; - break; - } - - j++; - } - - i++; - } - return (equiv); -#endif - } -} - -static int -TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, - const char *host, const char *port) - -{ - struct sockaddr_un sockname; - SOCKLEN_T namelen; - - - int abstract = 0; -#ifdef HAVE_ABSTRACT_SOCKETS - abstract = ciptr->transptr->flags & TRANS_ABSTRACT; -#endif - - prmsg (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port); - - /* - * Make sure 'host' is really local. If not, we return failure. - * The reason we make this check is because a process may advertise - * a "local" network ID for which it can accept connections, but if - * a process on a remote machine tries to connect to this network ID, - * we know for sure it will fail. - */ - - if (host && *host && host[0]!='/' && strcmp (host, "unix") != 0 && !UnixHostReallyLocal (host)) - { - prmsg (1, - "SocketUNIXConnect: Cannot connect to non-local host %s\n", - host); - return TRANS_CONNECT_FAILED; - } - - - /* - * Check the port. - */ - - if (!port || !*port) - { - prmsg (1,"SocketUNIXConnect: Missing port specification\n"); - return TRANS_CONNECT_FAILED; - } - - /* - * Build the socket name. - */ - - sockname.sun_family = AF_UNIX; - - if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) { - prmsg (1, "SocketUNIXConnect: path too long\n"); - return TRANS_CONNECT_FAILED; - } - -#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) - sockname.sun_len = strlen (sockname.sun_path); -#endif - -#if defined(BSD44SOCKETS) || defined(SUN_LEN) - namelen = SUN_LEN (&sockname); -#else - namelen = strlen (sockname.sun_path) + offsetof(struct sockaddr_un, sun_path); -#endif - - - - /* - * Adjust the socket path if using abstract sockets. - * Done here because otherwise all the strlen() calls above would fail. - */ - - if (abstract) { - sockname.sun_path[0] = '\0'; - } - - /* - * Do the connect() - */ - - if (connect (ciptr->fd, (struct sockaddr *) &sockname, namelen) < 0) - { - int olderrno = errno; - int connected = 0; - - if (!connected) - { - errno = olderrno; - - /* - * If the error was ENOENT, the server may be starting up; we used - * to suggest to try again in this case with - * TRANS_TRY_CONNECT_AGAIN, but this introduced problems for - * processes still referencing stale sockets in their environment. - * Hence, we now return a hard error, TRANS_CONNECT_FAILED, and it - * is suggested that higher level stacks handle retries on their - * level when they face a slow starting server. - * - * If the error was EWOULDBLOCK or EINPROGRESS then the socket - * was non-blocking and we should poll using select - * - * If the error was EINTR, the connect was interrupted and we - * should try again. - */ - - if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS) - return TRANS_IN_PROGRESS; - else if (olderrno == EINTR) - return TRANS_TRY_CONNECT_AGAIN; - else if (olderrno == ENOENT || olderrno == ECONNREFUSED) { - /* If opening as abstract socket failed, try again normally */ - if (abstract) { - ciptr->transptr->flags &= ~(TRANS_ABSTRACT); - return TRANS_TRY_CONNECT_AGAIN; - } else { - return TRANS_CONNECT_FAILED; - } - } else { - prmsg (2,"SocketUNIXConnect: Can't connect: errno = %d\n", - EGET()); - - return TRANS_CONNECT_FAILED; - } - } - } - - /* - * Get the socket name and the peer name from the connect socket, - * since this is unix domain. - */ - - if ((ciptr->addr = malloc(namelen)) == NULL || - (ciptr->peeraddr = malloc(namelen)) == NULL) - { - prmsg (1, - "SocketUNIXCreateListener: Can't allocate space for the addr\n"); - return TRANS_CONNECT_FAILED; - } - - if (abstract) - sockname.sun_path[0] = '@'; - - ciptr->family = AF_UNIX; - ciptr->addrlen = namelen; - ciptr->peeraddrlen = namelen; - memcpy (ciptr->addr, &sockname, ciptr->addrlen); - memcpy (ciptr->peeraddr, &sockname, ciptr->peeraddrlen); - - return 0; -} - -#endif /* UNIXCONN */ - -#endif /* TRANS_CLIENT */ - - -static int -TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) - -{ - prmsg (2,"SocketBytesReadable(%p,%d,%p)\n", - ciptr, ciptr->fd, pend); -#ifdef WIN32 - { - int ret = ioctlsocket ((SOCKET) ciptr->fd, FIONREAD, (u_long *) pend); - if (ret == SOCKET_ERROR) errno = WSAGetLastError(); - return ret; - } -#else -#if defined(__i386__) && defined(SYSV) && !defined(SCO325) - return ioctl (ciptr->fd, I_NREAD, (char *) pend); -#else - return ioctl (ciptr->fd, FIONREAD, (char *) pend); -#endif /* __i386__ && SYSV || _SEQUENT_ && _SOCKET_VERSION == 1 */ -#endif /* WIN32 */ -} - -#if XTRANS_SEND_FDS - -static void -appendFd(struct _XtransConnFd **prev, int fd, int do_close) -{ - struct _XtransConnFd *cf, *new; - - new = malloc (sizeof (struct _XtransConnFd)); - if (!new) { - /* XXX mark connection as broken */ - close(fd); - return; - } - new->next = 0; - new->fd = fd; - new->do_close = do_close; - /* search to end of list */ - for (; (cf = *prev); prev = &(cf->next)); - *prev = new; -} - -static int -removeFd(struct _XtransConnFd **prev) -{ - struct _XtransConnFd *cf; - int fd; - - if ((cf = *prev)) { - *prev = cf->next; - fd = cf->fd; - free(cf); - } else - fd = -1; - return fd; -} - -static void -discardFd(struct _XtransConnFd **prev, struct _XtransConnFd *upto, int do_close) -{ - struct _XtransConnFd *cf, *next; - - for (cf = *prev; cf != upto; cf = next) { - next = cf->next; - if (do_close || cf->do_close) - close(cf->fd); - free(cf); - } - *prev = upto; -} - -static void -cleanupFds(XtransConnInfo ciptr) -{ - /* Clean up the send list but don't close the fds */ - discardFd(&ciptr->send_fds, NULL, 0); - /* Clean up the recv list and *do* close the fds */ - discardFd(&ciptr->recv_fds, NULL, 1); -} - -static int -nFd(struct _XtransConnFd **prev) -{ - struct _XtransConnFd *cf; - int n = 0; - - for (cf = *prev; cf; cf = cf->next) - n++; - return n; -} - -static int -TRANS(SocketRecvFd) (XtransConnInfo ciptr) -{ - prmsg (2, "SocketRecvFd(%d)\n", ciptr->fd); - return removeFd(&ciptr->recv_fds); -} - -static int -TRANS(SocketSendFd) (XtransConnInfo ciptr, int fd, int do_close) -{ - appendFd(&ciptr->send_fds, fd, do_close); - return 0; -} - -static int -TRANS(SocketRecvFdInvalid)(XtransConnInfo ciptr) -{ - errno = EINVAL; - return -1; -} - -static int -TRANS(SocketSendFdInvalid)(XtransConnInfo ciptr, int fd, int do_close) -{ - errno = EINVAL; - return -1; -} - -#define MAX_FDS 128 - -union fd_pass { - struct cmsghdr cmsghdr; - char buf[CMSG_SPACE(MAX_FDS * sizeof(int))]; -}; - -#endif /* XTRANS_SEND_FDS */ - -static int -TRANS(SocketRead) (XtransConnInfo ciptr, char *buf, int size) - -{ - prmsg (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, buf, size); - -#if defined(WIN32) - { - int ret = recv ((SOCKET)ciptr->fd, buf, size, 0); -#ifdef WIN32 - if (ret == SOCKET_ERROR) errno = WSAGetLastError(); -#endif - return ret; - } -#else -#if XTRANS_SEND_FDS - { - struct iovec iov = { - .iov_base = buf, - .iov_len = size - }; - union fd_pass cmsgbuf; - struct msghdr msg = { - .msg_name = NULL, - .msg_namelen = 0, - .msg_iov = &iov, - .msg_iovlen = 1, - .msg_control = cmsgbuf.buf, - .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) - }; - - size = recvmsg(ciptr->fd, &msg, 0); - if (size >= 0) { - struct cmsghdr *hdr; - - for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { - if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { - int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); - int i; - int *fd = (int *) CMSG_DATA(hdr); - - for (i = 0; i < nfd; i++) - appendFd(&ciptr->recv_fds, fd[i], 0); - } - } - } - return size; - } -#else - return read(ciptr->fd, buf, size); -#endif /* XTRANS_SEND_FDS */ -#endif /* WIN32 */ -} - -static int -TRANS(SocketReadv) (XtransConnInfo ciptr, struct iovec *buf, int size) - -{ - prmsg (2,"SocketReadv(%d,%p,%d)\n", ciptr->fd, buf, size); - -#if XTRANS_SEND_FDS - { - union fd_pass cmsgbuf; - struct msghdr msg = { - .msg_name = NULL, - .msg_namelen = 0, - .msg_iov = buf, - .msg_iovlen = size, - .msg_control = cmsgbuf.buf, - .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) - }; - - size = recvmsg(ciptr->fd, &msg, 0); - if (size >= 0) { - struct cmsghdr *hdr; - - for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { - if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { - int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); - int i; - int *fd = (int *) CMSG_DATA(hdr); - - for (i = 0; i < nfd; i++) - appendFd(&ciptr->recv_fds, fd[i], 0); - } - } - } - return size; - } -#else - return READV (ciptr, buf, size); -#endif -} - - -static int -TRANS(SocketWritev) (XtransConnInfo ciptr, struct iovec *buf, int size) - -{ - prmsg (2,"SocketWritev(%d,%p,%d)\n", ciptr->fd, buf, size); - -#if XTRANS_SEND_FDS - if (ciptr->send_fds) - { - union fd_pass cmsgbuf; - int nfd = nFd(&ciptr->send_fds); - struct _XtransConnFd *cf = ciptr->send_fds; - struct msghdr msg = { - .msg_name = NULL, - .msg_namelen = 0, - .msg_iov = buf, - .msg_iovlen = size, - .msg_control = cmsgbuf.buf, - .msg_controllen = CMSG_LEN(nfd * sizeof(int)) - }; - struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); - int i; - int *fds; - - hdr->cmsg_len = msg.msg_controllen; - hdr->cmsg_level = SOL_SOCKET; - hdr->cmsg_type = SCM_RIGHTS; - - fds = (int *) CMSG_DATA(hdr); - /* Set up fds */ - for (i = 0; i < nfd; i++) { - fds[i] = cf->fd; - cf = cf->next; - } - - i = sendmsg(ciptr->fd, &msg, 0); - if (i > 0) - discardFd(&ciptr->send_fds, cf, 0); - return i; - } -#endif - return WRITEV (ciptr, buf, size); -} - - -static int -TRANS(SocketWrite) (XtransConnInfo ciptr, char *buf, int size) - -{ - prmsg (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, buf, size); - -#if defined(WIN32) - { - int ret = send ((SOCKET)ciptr->fd, buf, size, 0); -#ifdef WIN32 - if (ret == SOCKET_ERROR) errno = WSAGetLastError(); -#endif - return ret; - } -#else -#if XTRANS_SEND_FDS - if (ciptr->send_fds) - { - struct iovec iov; - - iov.iov_base = buf; - iov.iov_len = size; - return TRANS(SocketWritev)(ciptr, &iov, 1); - } -#endif /* XTRANS_SEND_FDS */ - return write (ciptr->fd, buf, size); -#endif /* WIN32 */ -} - -static int -TRANS(SocketDisconnect) (XtransConnInfo ciptr) - -{ - prmsg (2,"SocketDisconnect(%p,%d)\n", ciptr, ciptr->fd); - -#ifdef WIN32 - { - int ret = shutdown (ciptr->fd, 2); - if (ret == SOCKET_ERROR) errno = WSAGetLastError(); - return ret; - } -#else - return shutdown (ciptr->fd, 2); /* disallow further sends and receives */ -#endif -} - - -#ifdef TCPCONN -static int -TRANS(SocketINETClose) (XtransConnInfo ciptr) - -{ - prmsg (2,"SocketINETClose(%p,%d)\n", ciptr, ciptr->fd); - -#ifdef WIN32 - { - int ret = close (ciptr->fd); - if (ret == SOCKET_ERROR) errno = WSAGetLastError(); - return ret; - } -#else - return close (ciptr->fd); -#endif -} - -#endif /* TCPCONN */ - - -#ifdef UNIXCONN -static int -TRANS(SocketUNIXClose) (XtransConnInfo ciptr) -{ - /* - * If this is the server side, then once the socket is closed, - * it must be unlinked to completely close it - */ - - struct sockaddr_un *sockname = (struct sockaddr_un *) ciptr->addr; - int ret; - - prmsg (2,"SocketUNIXClose(%p,%d)\n", ciptr, ciptr->fd); - -#if XTRANS_SEND_FDS - cleanupFds(ciptr); -#endif - ret = close(ciptr->fd); - - if (ciptr->flags - && sockname - && sockname->sun_family == AF_UNIX - && sockname->sun_path[0]) - { - if (!(ciptr->flags & TRANS_NOUNLINK - || ciptr->transptr->flags & TRANS_ABSTRACT)) - unlink (sockname->sun_path); - } - - return ret; -} - -static int -TRANS(SocketUNIXCloseForCloning) (XtransConnInfo ciptr) - -{ - /* - * Don't unlink path. - */ - - int ret; - - prmsg (2,"SocketUNIXCloseForCloning(%p,%d)\n", - ciptr, ciptr->fd); - -#if XTRANS_SEND_FDS - cleanupFds(ciptr); -#endif - ret = close(ciptr->fd); - - return ret; -} - -#endif /* UNIXCONN */ - - -#ifdef TCPCONN -# ifdef TRANS_SERVER -static const char* tcp_nolisten[] = { - "inet", -#if defined(IPv6) && defined(AF_INET6) - "inet6", -#endif - NULL -}; -# endif - -Xtransport TRANS(SocketTCPFuncs) = { - /* Socket Interface */ - "tcp", - TRANS_ALIAS, -#ifdef TRANS_CLIENT - TRANS(SocketOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - tcp_nolisten, - TRANS(SocketOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketOpenCLTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(SocketOpenCLTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(SocketReopenCOTSServer), - TRANS(SocketReopenCLTSServer), -#endif - TRANS(SocketSetOption), -#ifdef TRANS_SERVER - TRANS(SocketINETCreateListener), - NULL, /* ResetListener */ - TRANS(SocketINETAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketINETConnect), -#endif /* TRANS_CLIENT */ - TRANS(SocketBytesReadable), - TRANS(SocketRead), - TRANS(SocketWrite), - TRANS(SocketReadv), - TRANS(SocketWritev), -#if XTRANS_SEND_FDS - TRANS(SocketSendFdInvalid), - TRANS(SocketRecvFdInvalid), -#endif - TRANS(SocketDisconnect), - TRANS(SocketINETClose), - TRANS(SocketINETClose), - }; - -Xtransport TRANS(SocketINETFuncs) = { - /* Socket Interface */ - "inet", - 0, -#ifdef TRANS_CLIENT - TRANS(SocketOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(SocketOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketOpenCLTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(SocketOpenCLTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(SocketReopenCOTSServer), - TRANS(SocketReopenCLTSServer), -#endif - TRANS(SocketSetOption), -#ifdef TRANS_SERVER - TRANS(SocketINETCreateListener), - NULL, /* ResetListener */ - TRANS(SocketINETAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketINETConnect), -#endif /* TRANS_CLIENT */ - TRANS(SocketBytesReadable), - TRANS(SocketRead), - TRANS(SocketWrite), - TRANS(SocketReadv), - TRANS(SocketWritev), -#if XTRANS_SEND_FDS - TRANS(SocketSendFdInvalid), - TRANS(SocketRecvFdInvalid), -#endif - TRANS(SocketDisconnect), - TRANS(SocketINETClose), - TRANS(SocketINETClose), - }; - -#if defined(IPv6) && defined(AF_INET6) -Xtransport TRANS(SocketINET6Funcs) = { - /* Socket Interface */ - "inet6", - 0, -#ifdef TRANS_CLIENT - TRANS(SocketOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(SocketOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketOpenCLTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(SocketOpenCLTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(SocketReopenCOTSServer), - TRANS(SocketReopenCLTSServer), -#endif - TRANS(SocketSetOption), -#ifdef TRANS_SERVER - TRANS(SocketINETCreateListener), - NULL, /* ResetListener */ - TRANS(SocketINETAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketINETConnect), -#endif /* TRANS_CLIENT */ - TRANS(SocketBytesReadable), - TRANS(SocketRead), - TRANS(SocketWrite), - TRANS(SocketReadv), - TRANS(SocketWritev), -#if XTRANS_SEND_FDS - TRANS(SocketSendFdInvalid), - TRANS(SocketRecvFdInvalid), -#endif - TRANS(SocketDisconnect), - TRANS(SocketINETClose), - TRANS(SocketINETClose), - }; -#endif /* IPv6 */ -#endif /* TCPCONN */ - -#ifdef UNIXCONN -#if !defined(LOCALCONN) -Xtransport TRANS(SocketLocalFuncs) = { - /* Socket Interface */ - "local", -#ifdef HAVE_ABSTRACT_SOCKETS - TRANS_ABSTRACT, -#else - 0, -#endif -#ifdef TRANS_CLIENT - TRANS(SocketOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(SocketOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketOpenCLTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(SocketOpenCLTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(SocketReopenCOTSServer), - TRANS(SocketReopenCLTSServer), -#endif - TRANS(SocketSetOption), -#ifdef TRANS_SERVER - TRANS(SocketUNIXCreateListener), - TRANS(SocketUNIXResetListener), - TRANS(SocketUNIXAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketUNIXConnect), -#endif /* TRANS_CLIENT */ - TRANS(SocketBytesReadable), - TRANS(SocketRead), - TRANS(SocketWrite), - TRANS(SocketReadv), - TRANS(SocketWritev), -#if XTRANS_SEND_FDS - TRANS(SocketSendFd), - TRANS(SocketRecvFd), -#endif - TRANS(SocketDisconnect), - TRANS(SocketUNIXClose), - TRANS(SocketUNIXCloseForCloning), - }; -#endif /* !LOCALCONN */ -# ifdef TRANS_SERVER -# if !defined(LOCALCONN) -static const char* unix_nolisten[] = { "local" , NULL }; -# endif -# endif - -Xtransport TRANS(SocketUNIXFuncs) = { - /* Socket Interface */ - "unix", -#if !defined(LOCALCONN) && !defined(HAVE_ABSTRACT_SOCKETS) - TRANS_ALIAS, -#else - 0, -#endif -#ifdef TRANS_CLIENT - TRANS(SocketOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER -#if !defined(LOCALCONN) - unix_nolisten, -#else - NULL, -#endif - TRANS(SocketOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketOpenCLTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(SocketOpenCLTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(SocketReopenCOTSServer), - TRANS(SocketReopenCLTSServer), -#endif - TRANS(SocketSetOption), -#ifdef TRANS_SERVER - TRANS(SocketUNIXCreateListener), - TRANS(SocketUNIXResetListener), - TRANS(SocketUNIXAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketUNIXConnect), -#endif /* TRANS_CLIENT */ - TRANS(SocketBytesReadable), - TRANS(SocketRead), - TRANS(SocketWrite), - TRANS(SocketReadv), - TRANS(SocketWritev), -#if XTRANS_SEND_FDS - TRANS(SocketSendFd), - TRANS(SocketRecvFd), -#endif - TRANS(SocketDisconnect), - TRANS(SocketUNIXClose), - TRANS(SocketUNIXCloseForCloning), - }; - -#endif /* UNIXCONN */ diff --git a/openflow/usr/include/X11/Xtrans/Xtransutil.c b/openflow/usr/include/X11/Xtrans/Xtransutil.c deleted file mode 100644 index 63f0fc3..0000000 --- a/openflow/usr/include/X11/Xtrans/Xtransutil.c +++ /dev/null @@ -1,637 +0,0 @@ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCRS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * These are some utility functions created for convenience or to provide - * an interface that is similar to an existing interface. These are built - * only using the Transport Independant API, and have no knowledge of - * the internal implementation. - */ - -#ifdef XTHREADS -#include -#endif -#ifdef WIN32 -#include -#include -#endif - -#ifdef X11_t - -/* - * These values come from X.h and Xauth.h, and MUST match them. Some - * of these values are also defined by the ChangeHost protocol message. - */ - -#define FamilyInternet 0 /* IPv4 */ -#define FamilyDECnet 1 -#define FamilyChaos 2 -#define FamilyInternet6 6 -#define FamilyAmoeba 33 -#define FamilyLocalHost 252 -#define FamilyKrb5Principal 253 -#define FamilyNetname 254 -#define FamilyLocal 256 -#define FamilyWild 65535 - -/* - * TRANS(ConvertAddress) converts a sockaddr based address to an - * X authorization based address. Some of this is defined as part of - * the ChangeHost protocol. The rest is just done in a consistent manner. - */ - -int -TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp) - -{ - - prmsg(2,"ConvertAddress(%d,%d,%p)\n",*familyp,*addrlenp,*addrp); - - switch( *familyp ) - { -#if defined(TCPCONN) - case AF_INET: - { - /* - * Check for the BSD hack localhost address 127.0.0.1. - * In this case, we are really FamilyLocal. - */ - - struct sockaddr_in saddr; - int len = sizeof(saddr.sin_addr.s_addr); - char *cp = (char *) &saddr.sin_addr.s_addr; - - memcpy (&saddr, *addrp, sizeof (struct sockaddr_in)); - - if ((len == 4) && (cp[0] == 127) && (cp[1] == 0) && - (cp[2] == 0) && (cp[3] == 1)) - { - *familyp=FamilyLocal; - } - else - { - *familyp=FamilyInternet; - *addrlenp=len; - memcpy(*addrp,&saddr.sin_addr,len); - } - break; - } - -#if defined(IPv6) && defined(AF_INET6) - case AF_INET6: - { - struct sockaddr_in6 saddr6; - - memcpy (&saddr6, *addrp, sizeof (struct sockaddr_in6)); - - if (IN6_IS_ADDR_LOOPBACK(&saddr6.sin6_addr)) - { - *familyp=FamilyLocal; - } - else if (IN6_IS_ADDR_V4MAPPED(&(saddr6.sin6_addr))) { - char *cp = (char *) &saddr6.sin6_addr.s6_addr[12]; - - if ((cp[0] == 127) && (cp[1] == 0) && - (cp[2] == 0) && (cp[3] == 1)) - { - *familyp=FamilyLocal; - } - else - { - *familyp=FamilyInternet; - *addrlenp = sizeof (struct in_addr); - memcpy(*addrp,cp,*addrlenp); - } - } - else - { - *familyp=FamilyInternet6; - *addrlenp=sizeof(saddr6.sin6_addr); - memcpy(*addrp,&saddr6.sin6_addr,sizeof(saddr6.sin6_addr)); - } - break; - } -#endif /* IPv6 */ -#endif /* defined(TCPCONN) */ - - -#if defined(UNIXCONN) || defined(LOCALCONN) - case AF_UNIX: - { - *familyp=FamilyLocal; - break; - } -#endif /* defined(UNIXCONN) || defined(LOCALCONN) */ - -#if (defined(__SCO__) || defined(__UNIXWARE__)) && defined(LOCALCONN) - case 0: - { - *familyp=FamilyLocal; - break; - } -#endif - - default: - prmsg(1,"ConvertAddress: Unknown family type %d\n", - *familyp); - return -1; - } - - - if (*familyp == FamilyLocal) - { - /* - * In the case of a local connection, we need to get the - * host name for authentication. - */ - - char hostnamebuf[256]; - int len = TRANS(GetHostname) (hostnamebuf, sizeof hostnamebuf); - - if (len > 0) { - if (*addrp && *addrlenp < (len + 1)) - { - free (*addrp); - *addrp = NULL; - } - if (!*addrp) - *addrp = malloc (len + 1); - if (*addrp) { - strcpy ((char *) *addrp, hostnamebuf); - *addrlenp = len; - } else { - *addrlenp = 0; - } - } - else - { - if (*addrp) - free (*addrp); - *addrp = NULL; - *addrlenp = 0; - } - } - - return 0; -} - -#endif /* X11_t */ - -#ifdef ICE_t - -/* Needed for _XGethostbyaddr usage in TRANS(GetPeerNetworkId) */ -# if defined(TCPCONN) || defined(UNIXCONN) -# define X_INCLUDE_NETDB_H -# define XOS_USE_NO_LOCKING -# include -# endif - -#include - -char * -TRANS(GetMyNetworkId) (XtransConnInfo ciptr) - -{ - int family = ciptr->family; - char *addr = ciptr->addr; - char hostnamebuf[256]; - char *networkId = NULL; - const char *transName = ciptr->transptr->TransName; - - if (gethostname (hostnamebuf, sizeof (hostnamebuf)) < 0) - { - return (NULL); - } - - switch (family) - { -#if defined(UNIXCONN) || defined(LOCALCONN) - case AF_UNIX: - { - struct sockaddr_un *saddr = (struct sockaddr_un *) addr; - networkId = malloc (3 + strlen (transName) + - strlen (hostnamebuf) + strlen (saddr->sun_path)); - sprintf (networkId, "%s/%s:%s", transName, - hostnamebuf, saddr->sun_path); - break; - } -#endif /* defined(UNIXCONN) || defined(LOCALCONN) */ - -#if defined(TCPCONN) - case AF_INET: -#if defined(IPv6) && defined(AF_INET6) - case AF_INET6: -#endif - { - struct sockaddr_in *saddr = (struct sockaddr_in *) addr; -#if defined(IPv6) && defined(AF_INET6) - struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) addr; -#endif - int portnum; - char portnumbuf[10]; - - -#if defined(IPv6) && defined(AF_INET6) - if (family == AF_INET6) - portnum = ntohs (saddr6->sin6_port); - else -#endif - portnum = ntohs (saddr->sin_port); - - snprintf (portnumbuf, sizeof(portnumbuf), "%d", portnum); - networkId = malloc (3 + strlen (transName) + - strlen (hostnamebuf) + strlen (portnumbuf)); - sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, portnumbuf); - break; - } -#endif /* defined(TCPCONN) */ - - - default: - break; - } - - return (networkId); -} - -#include -static jmp_buf env; - -#ifdef SIGALRM -static volatile int nameserver_timedout = 0; - -static void -nameserver_lost(int sig _X_UNUSED) -{ - nameserver_timedout = 1; - longjmp (env, -1); - /* NOTREACHED */ -} -#endif /* SIGALARM */ - - -char * -TRANS(GetPeerNetworkId) (XtransConnInfo ciptr) - -{ - int family = ciptr->family; - char *peer_addr = ciptr->peeraddr; - char *hostname; - char addrbuf[256]; - const char *addr = NULL; - - switch (family) - { - case AF_UNSPEC: -#if defined(UNIXCONN) || defined(LOCALCONN) - case AF_UNIX: - { - if (gethostname (addrbuf, sizeof (addrbuf)) == 0) - addr = addrbuf; - break; - } -#endif /* defined(UNIXCONN) || defined(LOCALCONN) */ - -#if defined(TCPCONN) - case AF_INET: -#if defined(IPv6) && defined(AF_INET6) - case AF_INET6: -#endif - { - struct sockaddr_in *saddr = (struct sockaddr_in *) peer_addr; -#if defined(IPv6) && defined(AF_INET6) - struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) peer_addr; -#endif - char *address; - int addresslen; -#ifdef XTHREADS_NEEDS_BYNAMEPARAMS - _Xgethostbynameparams hparams; -#endif - struct hostent * volatile hostp = NULL; - -#if defined(IPv6) && defined(AF_INET6) - if (family == AF_INET6) - { - address = (char *) &saddr6->sin6_addr; - addresslen = sizeof (saddr6->sin6_addr); - } - else -#endif - { - address = (char *) &saddr->sin_addr; - addresslen = sizeof (saddr->sin_addr); - } - -#ifdef SIGALRM - /* - * gethostbyaddr can take a LONG time if the host does not exist. - * Assume that if it does not respond in NAMESERVER_TIMEOUT seconds - * that something is wrong and do not make the user wait. - * gethostbyaddr will continue after a signal, so we have to - * jump out of it. - */ - - nameserver_timedout = 0; - signal (SIGALRM, nameserver_lost); - alarm (4); - if (setjmp(env) == 0) { -#endif - hostp = _XGethostbyaddr (address, addresslen, family, hparams); -#ifdef SIGALRM - } - alarm (0); -#endif - if (hostp != NULL) - addr = hostp->h_name; - else -#if defined(IPv6) && defined(AF_INET6) - addr = inet_ntop (family, address, addrbuf, sizeof (addrbuf)); -#else - addr = inet_ntoa (saddr->sin_addr); -#endif - break; - } - -#endif /* defined(TCPCONN) */ - - - default: - return (NULL); - } - - - hostname = malloc (strlen (ciptr->transptr->TransName) + strlen (addr) + 2); - strcpy (hostname, ciptr->transptr->TransName); - strcat (hostname, "/"); - if (addr) - strcat (hostname, addr); - - return (hostname); -} - -#endif /* ICE_t */ - - -#if defined(WIN32) && defined(TCPCONN) -int -TRANS(WSAStartup) (void) -{ - static WSADATA wsadata; - - prmsg (2,"WSAStartup()\n"); - - if (!wsadata.wVersion && WSAStartup(MAKEWORD(2,2), &wsadata)) - return 1; - return 0; -} -#endif - -#include - -static int -is_numeric (const char *str) -{ - int i; - - for (i = 0; i < (int) strlen (str); i++) - if (!isdigit (str[i])) - return (0); - - return (1); -} - -#ifdef TRANS_SERVER -#include -#include -#include - -#if !defined(S_IFLNK) && !defined(S_ISLNK) -#undef lstat -#define lstat(a,b) stat(a,b) -#endif - -#define FAIL_IF_NOMODE 1 -#define FAIL_IF_NOT_ROOT 2 -#define WARN_NO_ACCESS 4 - -/* - * We make the assumption that when the 'sticky' (t) bit is requested - * it's not save if the directory has non-root ownership or the sticky - * bit cannot be set and fail. - */ -static int -trans_mkdir(const char *path, int mode) -{ - struct stat buf; - - if (lstat(path, &buf) != 0) { - if (errno != ENOENT) { - prmsg(1, "mkdir: ERROR: (l)stat failed for %s (%d)\n", - path, errno); - return -1; - } - /* Dir doesn't exist. Try to create it */ - -#if !defined(WIN32) && !defined(__CYGWIN__) - /* - * 'sticky' bit requested: assume application makes - * certain security implications. If effective user ID - * is != 0: fail as we may not be able to meet them. - */ - if (geteuid() != 0) { - if (mode & 01000) { - prmsg(1, "mkdir: ERROR: euid != 0," - "directory %s will not be created.\n", - path); -#ifdef FAIL_HARD - return -1; -#endif - } else { - prmsg(1, "mkdir: Cannot create %s with root ownership\n", - path); - } - } -#endif - -#ifndef WIN32 - if (mkdir(path, mode) == 0) { - if (chmod(path, mode)) { - prmsg(1, "mkdir: ERROR: Mode of %s should be set to %04o\n", - path, mode); -#ifdef FAIL_HARD - return -1; -#endif - } -#else - if (mkdir(path) == 0) { -#endif - } else { - prmsg(1, "mkdir: ERROR: Cannot create %s\n", - path); - return -1; - } - - return 0; - - } else { - if (S_ISDIR(buf.st_mode)) { - int updateOwner = 0; - int updateMode = 0; - int updatedOwner = 0; - int updatedMode = 0; - int status = 0; - /* Check if the directory's ownership is OK. */ - if (buf.st_uid != 0) - updateOwner = 1; - - /* - * Check if the directory's mode is OK. An exact match isn't - * required, just a mode that isn't more permissive than the - * one requested. - */ - if ((~mode) & 0077 & buf.st_mode) - updateMode = 1; - - /* - * If the directory is not writeable not everybody may - * be able to create sockets. Therefore warn if mode - * cannot be fixed. - */ - if ((~buf.st_mode) & 0022 & mode) { - updateMode = 1; - status |= WARN_NO_ACCESS; - } - - /* - * If 'sticky' bit is requested fail if owner isn't root - * as we assume the caller makes certain security implications - */ - if (mode & 01000) { - status |= FAIL_IF_NOT_ROOT; - if (!(buf.st_mode & 01000)) { - status |= FAIL_IF_NOMODE; - updateMode = 1; - } - } - -#ifdef HAS_FCHOWN - /* - * If fchown(2) and fchmod(2) are available, try to correct the - * directory's owner and mode. Otherwise it isn't safe to attempt - * to do this. - */ - if (updateMode || updateOwner) { - int fd = -1; - struct stat fbuf; - if ((fd = open(path, O_RDONLY)) != -1) { - if (fstat(fd, &fbuf) == -1) { - prmsg(1, "mkdir: ERROR: fstat failed for %s (%d)\n", - path, errno); - close(fd); - return -1; - } - /* - * Verify that we've opened the same directory as was - * checked above. - */ - if (!S_ISDIR(fbuf.st_mode) || - buf.st_dev != fbuf.st_dev || - buf.st_ino != fbuf.st_ino) { - prmsg(1, "mkdir: ERROR: inode for %s changed\n", - path); - close(fd); - return -1; - } - if (updateOwner && fchown(fd, 0, 0) == 0) - updatedOwner = 1; - if (updateMode && fchmod(fd, mode) == 0) - updatedMode = 1; - close(fd); - } - } -#endif - - if (updateOwner && !updatedOwner) { -#ifdef FAIL_HARD - if (status & FAIL_IF_NOT_ROOT) { - prmsg(1, "mkdir: ERROR: Owner of %s must be set to root\n", - path); - return -1; - } -#endif -#if !defined(__APPLE_CC__) && !defined(__CYGWIN__) - prmsg(1, "mkdir: Owner of %s should be set to root\n", - path); -#endif - } - - if (updateMode && !updatedMode) { -#ifdef FAIL_HARD - if (status & FAIL_IF_NOMODE) { - prmsg(1, "mkdir: ERROR: Mode of %s must be set to %04o\n", - path, mode); - return -1; - } -#endif - prmsg(1, "mkdir: Mode of %s should be set to %04o\n", - path, mode); - if (status & WARN_NO_ACCESS) { - prmsg(1, "mkdir: this may cause subsequent errors\n"); - } - } - return 0; - } - return -1; - } - - /* In all other cases, fail */ - return -1; -} - -#endif /* TRANS_SERVER */ diff --git a/openflow/usr/include/X11/Xtrans/transport.c b/openflow/usr/include/X11/Xtrans/transport.c deleted file mode 100644 index b62fc7b..0000000 --- a/openflow/usr/include/X11/Xtrans/transport.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#define XTRANS_TRANSPORT_C /* used to flag Xtransint.h that it's being used - here, not just #included in another file */ - -#include "Xtransint.h" - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wformat-nonliteral" -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -#endif - -#ifdef LOCALCONN -#include "Xtranslcl.c" -#endif -#if defined(TCPCONN) || defined(UNIXCONN) -#include "Xtranssock.c" -#endif -#include "Xtrans.c" -#include "Xtransutil.c" - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif diff --git a/openflow/usr/include/X11/Xutil.h b/openflow/usr/include/X11/Xutil.h deleted file mode 100644 index 62cdf55..0000000 --- a/openflow/usr/include/X11/Xutil.h +++ /dev/null @@ -1,838 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef _X11_XUTIL_H_ -#define _X11_XUTIL_H_ - -/* You must include before including this file */ -#include -#include - -/* The Xlib structs are full of implicit padding to properly align members. - We can't clean that up without breaking ABI, so tell clang not to bother - complaining about it. */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - -/* - * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding - * value (x, y, width, height) was found in the parsed string. - */ -#define NoValue 0x0000 -#define XValue 0x0001 -#define YValue 0x0002 -#define WidthValue 0x0004 -#define HeightValue 0x0008 -#define AllValues 0x000F -#define XNegative 0x0010 -#define YNegative 0x0020 - -/* - * new version containing base_width, base_height, and win_gravity fields; - * used with WM_NORMAL_HINTS. - */ -typedef struct { - long flags; /* marks which fields in this structure are defined */ - int x, y; /* obsolete for new window mgrs, but clients */ - int width, height; /* should set so old wm's don't mess up */ - int min_width, min_height; - int max_width, max_height; - int width_inc, height_inc; - struct { - int x; /* numerator */ - int y; /* denominator */ - } min_aspect, max_aspect; - int base_width, base_height; /* added by ICCCM version 1 */ - int win_gravity; /* added by ICCCM version 1 */ -} XSizeHints; - -/* - * The next block of definitions are for window manager properties that - * clients and applications use for communication. - */ - -/* flags argument in size hints */ -#define USPosition (1L << 0) /* user specified x, y */ -#define USSize (1L << 1) /* user specified width, height */ - -#define PPosition (1L << 2) /* program specified position */ -#define PSize (1L << 3) /* program specified size */ -#define PMinSize (1L << 4) /* program specified minimum size */ -#define PMaxSize (1L << 5) /* program specified maximum size */ -#define PResizeInc (1L << 6) /* program specified resize increments */ -#define PAspect (1L << 7) /* program specified min and max aspect ratios */ -#define PBaseSize (1L << 8) /* program specified base for incrementing */ -#define PWinGravity (1L << 9) /* program specified window gravity */ - -/* obsolete */ -#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect) - - - -typedef struct { - long flags; /* marks which fields in this structure are defined */ - Bool input; /* does this application rely on the window manager to - get keyboard input? */ - int initial_state; /* see below */ - Pixmap icon_pixmap; /* pixmap to be used as icon */ - Window icon_window; /* window to be used as icon */ - int icon_x, icon_y; /* initial position of icon */ - Pixmap icon_mask; /* icon mask bitmap */ - XID window_group; /* id of related window group */ - /* this structure may be extended in the future */ -} XWMHints; - -/* definition for flags of XWMHints */ - -#define InputHint (1L << 0) -#define StateHint (1L << 1) -#define IconPixmapHint (1L << 2) -#define IconWindowHint (1L << 3) -#define IconPositionHint (1L << 4) -#define IconMaskHint (1L << 5) -#define WindowGroupHint (1L << 6) -#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \ -IconPositionHint|IconMaskHint|WindowGroupHint) -#define XUrgencyHint (1L << 8) - -/* definitions for initial window state */ -#define WithdrawnState 0 /* for windows that are not mapped */ -#define NormalState 1 /* most applications want to start this way */ -#define IconicState 3 /* application wants to start as an icon */ - -/* - * Obsolete states no longer defined by ICCCM - */ -#define DontCareState 0 /* don't know or care */ -#define ZoomState 2 /* application wants to start zoomed */ -#define InactiveState 4 /* application believes it is seldom used; */ - /* some wm's may put it on inactive menu */ - - -/* - * new structure for manipulating TEXT properties; used with WM_NAME, - * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND. - */ -typedef struct { - unsigned char *value; /* same as Property routines */ - Atom encoding; /* prop type */ - int format; /* prop data format: 8, 16, or 32 */ - unsigned long nitems; /* number of data items in value */ -} XTextProperty; - -#define XNoMemory -1 -#define XLocaleNotSupported -2 -#define XConverterNotFound -3 - -typedef enum { - XStringStyle, /* STRING */ - XCompoundTextStyle, /* COMPOUND_TEXT */ - XTextStyle, /* text in owner's encoding (current locale)*/ - XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */ - /* The following is an XFree86 extension, introduced in November 2000 */ - XUTF8StringStyle /* UTF8_STRING */ -} XICCEncodingStyle; - -typedef struct { - int min_width, min_height; - int max_width, max_height; - int width_inc, height_inc; -} XIconSize; - -typedef struct { - char *res_name; - char *res_class; -} XClassHint; - -#ifdef XUTIL_DEFINE_FUNCTIONS -extern int XDestroyImage( - XImage *ximage); -extern unsigned long XGetPixel( - XImage *ximage, - int x, int y); -extern int XPutPixel( - XImage *ximage, - int x, int y, - unsigned long pixel); -extern XImage *XSubImage( - XImage *ximage, - int x, int y, - unsigned int width, unsigned int height); -extern int XAddPixel( - XImage *ximage, - long value); -#else -/* - * These macros are used to give some sugar to the image routines so that - * naive people are more comfortable with them. - */ -#define XDestroyImage(ximage) \ - ((*((ximage)->f.destroy_image))((ximage))) -#define XGetPixel(ximage, x, y) \ - ((*((ximage)->f.get_pixel))((ximage), (x), (y))) -#define XPutPixel(ximage, x, y, pixel) \ - ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel))) -#define XSubImage(ximage, x, y, width, height) \ - ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height))) -#define XAddPixel(ximage, value) \ - ((*((ximage)->f.add_pixel))((ximage), (value))) -#endif - -/* - * Compose sequence status structure, used in calling XLookupString. - */ -typedef struct _XComposeStatus { - XPointer compose_ptr; /* state table pointer */ - int chars_matched; /* match state */ -} XComposeStatus; - -/* - * Keysym macros, used on Keysyms to test for classes of symbols - */ -#define IsKeypadKey(keysym) \ - (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal)) - -#define IsPrivateKeypadKey(keysym) \ - (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF)) - -#define IsCursorKey(keysym) \ - (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select)) - -#define IsPFKey(keysym) \ - (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4)) - -#define IsFunctionKey(keysym) \ - (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35)) - -#define IsMiscFunctionKey(keysym) \ - (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break)) - -#ifdef XK_XKB_KEYS -#define IsModifierKey(keysym) \ - ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ - || (((KeySym)(keysym) >= XK_ISO_Lock) && \ - ((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \ - || ((KeySym)(keysym) == XK_Mode_switch) \ - || ((KeySym)(keysym) == XK_Num_Lock)) -#else -#define IsModifierKey(keysym) \ - ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ - || ((KeySym)(keysym) == XK_Mode_switch) \ - || ((KeySym)(keysym) == XK_Num_Lock)) -#endif -/* - * opaque reference to Region data type - */ -typedef struct _XRegion *Region; - -/* Return values from XRectInRegion() */ - -#define RectangleOut 0 -#define RectangleIn 1 -#define RectanglePart 2 - - -/* - * Information used by the visual utility routines to find desired visual - * type from the many visuals a display may support. - */ - -typedef struct { - Visual *visual; - VisualID visualid; - int screen; - int depth; -#if defined(__cplusplus) || defined(c_plusplus) - int c_class; /* C++ */ -#else - int class; -#endif - unsigned long red_mask; - unsigned long green_mask; - unsigned long blue_mask; - int colormap_size; - int bits_per_rgb; -} XVisualInfo; - -#define VisualNoMask 0x0 -#define VisualIDMask 0x1 -#define VisualScreenMask 0x2 -#define VisualDepthMask 0x4 -#define VisualClassMask 0x8 -#define VisualRedMaskMask 0x10 -#define VisualGreenMaskMask 0x20 -#define VisualBlueMaskMask 0x40 -#define VisualColormapSizeMask 0x80 -#define VisualBitsPerRGBMask 0x100 -#define VisualAllMask 0x1FF - -/* - * This defines a window manager property that clients may use to - * share standard color maps of type RGB_COLOR_MAP: - */ -typedef struct { - Colormap colormap; - unsigned long red_max; - unsigned long red_mult; - unsigned long green_max; - unsigned long green_mult; - unsigned long blue_max; - unsigned long blue_mult; - unsigned long base_pixel; - VisualID visualid; /* added by ICCCM version 1 */ - XID killid; /* added by ICCCM version 1 */ -} XStandardColormap; - -#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */ - - -/* - * return codes for XReadBitmapFile and XWriteBitmapFile - */ -#define BitmapSuccess 0 -#define BitmapOpenFailed 1 -#define BitmapFileInvalid 2 -#define BitmapNoMemory 3 - -/**************************************************************** - * - * Context Management - * - ****************************************************************/ - - -/* Associative lookup table return codes */ - -#define XCSUCCESS 0 /* No error. */ -#define XCNOMEM 1 /* Out of memory */ -#define XCNOENT 2 /* No entry in table */ - -typedef int XContext; - -#define XUniqueContext() ((XContext) XrmUniqueQuark()) -#define XStringToContext(string) ((XContext) XrmStringToQuark(string)) - -_XFUNCPROTOBEGIN - -/* The following declarations are alphabetized. */ - -extern XClassHint *XAllocClassHint ( - void -); - -extern XIconSize *XAllocIconSize ( - void -); - -extern XSizeHints *XAllocSizeHints ( - void -); - -extern XStandardColormap *XAllocStandardColormap ( - void -); - -extern XWMHints *XAllocWMHints ( - void -); - -extern int XClipBox( - Region /* r */, - XRectangle* /* rect_return */ -); - -extern Region XCreateRegion( - void -); - -extern const char *XDefaultString (void); - -extern int XDeleteContext( - Display* /* display */, - XID /* rid */, - XContext /* context */ -); - -extern int XDestroyRegion( - Region /* r */ -); - -extern int XEmptyRegion( - Region /* r */ -); - -extern int XEqualRegion( - Region /* r1 */, - Region /* r2 */ -); - -extern int XFindContext( - Display* /* display */, - XID /* rid */, - XContext /* context */, - XPointer* /* data_return */ -); - -extern Status XGetClassHint( - Display* /* display */, - Window /* w */, - XClassHint* /* class_hints_return */ -); - -extern Status XGetIconSizes( - Display* /* display */, - Window /* w */, - XIconSize** /* size_list_return */, - int* /* count_return */ -); - -extern Status XGetNormalHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints_return */ -); - -extern Status XGetRGBColormaps( - Display* /* display */, - Window /* w */, - XStandardColormap** /* stdcmap_return */, - int* /* count_return */, - Atom /* property */ -); - -extern Status XGetSizeHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints_return */, - Atom /* property */ -); - -extern Status XGetStandardColormap( - Display* /* display */, - Window /* w */, - XStandardColormap* /* colormap_return */, - Atom /* property */ -); - -extern Status XGetTextProperty( - Display* /* display */, - Window /* window */, - XTextProperty* /* text_prop_return */, - Atom /* property */ -); - -extern XVisualInfo *XGetVisualInfo( - Display* /* display */, - long /* vinfo_mask */, - XVisualInfo* /* vinfo_template */, - int* /* nitems_return */ -); - -extern Status XGetWMClientMachine( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop_return */ -); - -extern XWMHints *XGetWMHints( - Display* /* display */, - Window /* w */ -); - -extern Status XGetWMIconName( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop_return */ -); - -extern Status XGetWMName( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop_return */ -); - -extern Status XGetWMNormalHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints_return */, - long* /* supplied_return */ -); - -extern Status XGetWMSizeHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints_return */, - long* /* supplied_return */, - Atom /* property */ -); - -extern Status XGetZoomHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* zhints_return */ -); - -extern int XIntersectRegion( - Region /* sra */, - Region /* srb */, - Region /* dr_return */ -); - -extern void XConvertCase( - KeySym /* sym */, - KeySym* /* lower */, - KeySym* /* upper */ -); - -extern int XLookupString( - XKeyEvent* /* event_struct */, - char* /* buffer_return */, - int /* bytes_buffer */, - KeySym* /* keysym_return */, - XComposeStatus* /* status_in_out */ -); - -extern Status XMatchVisualInfo( - Display* /* display */, - int /* screen */, - int /* depth */, - int /* class */, - XVisualInfo* /* vinfo_return */ -); - -extern int XOffsetRegion( - Region /* r */, - int /* dx */, - int /* dy */ -); - -extern Bool XPointInRegion( - Region /* r */, - int /* x */, - int /* y */ -); - -extern Region XPolygonRegion( - XPoint* /* points */, - int /* n */, - int /* fill_rule */ -); - -extern int XRectInRegion( - Region /* r */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */ -); - -extern int XSaveContext( - Display* /* display */, - XID /* rid */, - XContext /* context */, - _Xconst char* /* data */ -); - -extern int XSetClassHint( - Display* /* display */, - Window /* w */, - XClassHint* /* class_hints */ -); - -extern int XSetIconSizes( - Display* /* display */, - Window /* w */, - XIconSize* /* size_list */, - int /* count */ -); - -extern int XSetNormalHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints */ -); - -extern void XSetRGBColormaps( - Display* /* display */, - Window /* w */, - XStandardColormap* /* stdcmaps */, - int /* count */, - Atom /* property */ -); - -extern int XSetSizeHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints */, - Atom /* property */ -); - -extern int XSetStandardProperties( - Display* /* display */, - Window /* w */, - _Xconst char* /* window_name */, - _Xconst char* /* icon_name */, - Pixmap /* icon_pixmap */, - char** /* argv */, - int /* argc */, - XSizeHints* /* hints */ -); - -extern void XSetTextProperty( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop */, - Atom /* property */ -); - -extern void XSetWMClientMachine( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop */ -); - -extern int XSetWMHints( - Display* /* display */, - Window /* w */, - XWMHints* /* wm_hints */ -); - -extern void XSetWMIconName( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop */ -); - -extern void XSetWMName( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop */ -); - -extern void XSetWMNormalHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints */ -); - -extern void XSetWMProperties( - Display* /* display */, - Window /* w */, - XTextProperty* /* window_name */, - XTextProperty* /* icon_name */, - char** /* argv */, - int /* argc */, - XSizeHints* /* normal_hints */, - XWMHints* /* wm_hints */, - XClassHint* /* class_hints */ -); - -extern void XmbSetWMProperties( - Display* /* display */, - Window /* w */, - _Xconst char* /* window_name */, - _Xconst char* /* icon_name */, - char** /* argv */, - int /* argc */, - XSizeHints* /* normal_hints */, - XWMHints* /* wm_hints */, - XClassHint* /* class_hints */ -); - -extern void Xutf8SetWMProperties( - Display* /* display */, - Window /* w */, - _Xconst char* /* window_name */, - _Xconst char* /* icon_name */, - char** /* argv */, - int /* argc */, - XSizeHints* /* normal_hints */, - XWMHints* /* wm_hints */, - XClassHint* /* class_hints */ -); - -extern void XSetWMSizeHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints */, - Atom /* property */ -); - -extern int XSetRegion( - Display* /* display */, - GC /* gc */, - Region /* r */ -); - -extern void XSetStandardColormap( - Display* /* display */, - Window /* w */, - XStandardColormap* /* colormap */, - Atom /* property */ -); - -extern int XSetZoomHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* zhints */ -); - -extern int XShrinkRegion( - Region /* r */, - int /* dx */, - int /* dy */ -); - -extern Status XStringListToTextProperty( - char** /* list */, - int /* count */, - XTextProperty* /* text_prop_return */ -); - -extern int XSubtractRegion( - Region /* sra */, - Region /* srb */, - Region /* dr_return */ -); - -extern int XmbTextListToTextProperty( - Display* display, - char** list, - int count, - XICCEncodingStyle style, - XTextProperty* text_prop_return -); - -extern int XwcTextListToTextProperty( - Display* display, - wchar_t** list, - int count, - XICCEncodingStyle style, - XTextProperty* text_prop_return -); - -extern int Xutf8TextListToTextProperty( - Display* display, - char** list, - int count, - XICCEncodingStyle style, - XTextProperty* text_prop_return -); - -extern void XwcFreeStringList( - wchar_t** list -); - -extern Status XTextPropertyToStringList( - XTextProperty* /* text_prop */, - char*** /* list_return */, - int* /* count_return */ -); - -extern int XmbTextPropertyToTextList( - Display* display, - const XTextProperty* text_prop, - char*** list_return, - int* count_return -); - -extern int XwcTextPropertyToTextList( - Display* display, - const XTextProperty* text_prop, - wchar_t*** list_return, - int* count_return -); - -extern int Xutf8TextPropertyToTextList( - Display* display, - const XTextProperty* text_prop, - char*** list_return, - int* count_return -); - -extern int XUnionRectWithRegion( - XRectangle* /* rectangle */, - Region /* src_region */, - Region /* dest_region_return */ -); - -extern int XUnionRegion( - Region /* sra */, - Region /* srb */, - Region /* dr_return */ -); - -extern int XWMGeometry( - Display* /* display */, - int /* screen_number */, - _Xconst char* /* user_geometry */, - _Xconst char* /* default_geometry */, - unsigned int /* border_width */, - XSizeHints* /* hints */, - int* /* x_return */, - int* /* y_return */, - int* /* width_return */, - int* /* height_return */, - int* /* gravity_return */ -); - -extern int XXorRegion( - Region /* sra */, - Region /* srb */, - Region /* dr_return */ -); - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -_XFUNCPROTOEND - -#endif /* _X11_XUTIL_H_ */ diff --git a/openflow/usr/include/X11/Xw32defs.h b/openflow/usr/include/X11/Xw32defs.h deleted file mode 100644 index b2e4b33..0000000 --- a/openflow/usr/include/X11/Xw32defs.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef _XW32DEFS_H -# define _XW32DEFS_H - -# ifdef __GNUC__ /* mingw is more close to unix than msvc */ -# if !defined(__daddr_t_defined) -typedef char *caddr_t; -# endif -# define lstat stat - -# else -typedef char *caddr_t; - -# define access _access -# define alloca _alloca -# define chdir _chdir -# define chmod _chmod -# define close _close -# define creat _creat -# define dup _dup -# define dup2 _dup2 -# define environ _environ -# define execl _execl -# define execle _execle -# define execlp _execlp -# define execlpe _execlpe -# define execv _execv -# define execve _execve -# define execvp _execvp -# define execvpe _execvpe -# define fdopen _fdopen -# define fileno _fileno -# define fstat _fstat -# define getcwd _getcwd -# define getpid _getpid -# define hypot _hypot -# define isascii __isascii -# define isatty _isatty -# define lseek _lseek -# define mkdir _mkdir -# define mktemp _mktemp -# define open _open -# define putenv _putenv -# define read _read -# define rmdir _rmdir -# define sleep(x) Sleep((x) * 1000) -# define stat _stat -# define sys_errlist _sys_errlist -# define sys_nerr _sys_nerr -# define umask _umask -# define unlink _unlink -# define write _write -# define random rand -# define srandom srand - -# define O_RDONLY _O_RDONLY -# define O_WRONLY _O_WRONLY -# define O_RDWR _O_RDWR -# define O_APPEND _O_APPEND -# define O_CREAT _O_CREAT -# define O_TRUNC _O_TRUNC -# define O_EXCL _O_EXCL -# define O_TEXT _O_TEXT -# define O_BINARY _O_BINARY -# define O_RAW _O_BINARY - -# define S_IFMT _S_IFMT -# define S_IFDIR _S_IFDIR -# define S_IFCHR _S_IFCHR -# define S_IFREG _S_IFREG -# define S_IREAD _S_IREAD -# define S_IWRITE _S_IWRITE -# define S_IEXEC _S_IEXEC - -# define F_OK 0 -# define X_OK 1 -# define W_OK 2 -# define R_OK 4 -# endif /* __GNUC__ */ -#endif diff --git a/openflow/usr/include/X11/Xwindows.h b/openflow/usr/include/X11/Xwindows.h deleted file mode 100644 index 70e1deb..0000000 --- a/openflow/usr/include/X11/Xwindows.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - -Copyright 1996, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- -ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL- -ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization from -The Open Group. - -*/ - -/* - * This header file has the sole purpose of allowing the inclusion of - * windows.h without getting any name conflicts with X headers code, by - * renaming or disabling the conflicting definitions from windows.h - */ - -/* - * Mingw.org versions of the Windows API headers actually avoid - * making the conflicting definitions if XFree86Server is defined, so we - * need to remember if that was defined and undefine it during including - * windows.h (so the conflicting definitions get wrapped correctly), and - * then redefine it afterwards. (This was never the correct thing to - * do as it's no help at all to X11 clients which also need to use the - * Win32 API) - */ -#undef _XFree86Server -#ifdef XFree86Server -# define _XFree86Server -# undef XFree86Server -#endif - -/* - * There doesn't seem to be a good way to wrap the min/max macros from - * windows.h, so we simply avoid defining them completely, allowing any - * pre-existing definition to stand. - * - */ -#define NOMINMAX - -/* - * mingw-w64 headers define BOOL as a typedef, protecting against macros - * mingw.org headers define BOOL in terms of WINBOOL - * ... so try to come up with something which works with both :-) - */ -#define _NO_BOOL_TYPEDEF -#define BOOL WINBOOL -#define INT32 wINT32 -#ifdef __x86_64__ -#define INT64 wINT64 -#define LONG64 wLONG64 -#endif -#undef Status -#define Status wStatus -#define ATOM wATOM -#define BYTE wBYTE -#define FreeResource wFreeResource -#include -#undef NOMINMAX -#undef Status -#define Status int -#undef BYTE -#undef BOOL -#undef INT32 -#undef INT64 -#undef LONG64 -#undef ATOM -#undef FreeResource -#undef CreateWindowA - -/* - * Older version of this header used to name the windows API bool type wBOOL, - * rather than more standard name WINBOOL - */ -#define wBOOL WINBOOL - -#ifdef RESOURCE_H -# undef RT_FONT -# undef RT_CURSOR -# define RT_FONT ((RESTYPE)4) -# define RT_CURSOR ((RESTYPE)5) -#endif - -#ifndef __CYGWIN__ -#define sleep(x) Sleep((x) * 1000) -#endif - -#if defined(WIN32) && (!defined(PATH_MAX) || PATH_MAX < 1024) -# undef PATH_MAX -# define PATH_MAX 1024 -#endif - -#ifdef _XFree86Server -# define XFree86Server -# undef _XFree86Server -#endif - diff --git a/openflow/usr/include/X11/Xwinsock.h b/openflow/usr/include/X11/Xwinsock.h deleted file mode 100644 index a81dd7a..0000000 --- a/openflow/usr/include/X11/Xwinsock.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - -Copyright 1996, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- -ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL- -ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization from -The Open Group. - -*/ - -/* - * This header file has for sole purpose to allow to include winsock.h - * without getting any name conflicts with our code. - * Conflicts come from the fact that including winsock.h actually pulls - * in the whole Windows API... - */ - -#undef _XFree86Server -#ifdef XFree86Server -# define _XFree86Server -# undef XFree86Server -#endif - -/* - * mingw-w64 headers define BOOL as a typedef, protecting against macros - * mingw.org headers define BOOL in terms of WINBOOL - * ... so try to come up with something which works with both :-) - */ -#define _NO_BOOL_TYPEDEF -#define BOOL WINBOOL -#define INT32 wINT32 -#undef Status -#define Status wStatus -#define ATOM wATOM -#define BYTE wBYTE -#define FreeResource wFreeResource -#include -#undef Status -#define Status int -#undef BYTE -#undef BOOL -#undef INT32 -#undef ATOM -#undef FreeResource -#undef CreateWindowA -#undef RT_FONT -#undef RT_CURSOR - -/* - * Older version of this header used to name the windows API bool type wBOOL, - * rather than more standard name WINBOOL - */ -#define wBOOL WINBOOL - -#ifdef _XFree86Server -# define XFree86Server -# undef _XFree86Server -#endif - diff --git a/openflow/usr/include/X11/ap_keysym.h b/openflow/usr/include/X11/ap_keysym.h deleted file mode 100644 index 9a11971..0000000 --- a/openflow/usr/include/X11/ap_keysym.h +++ /dev/null @@ -1,51 +0,0 @@ -/****************************************************************** -Copyright 1987 by Apollo Computer Inc., Chelmsford, Massachusetts. -Copyright 1989 by Hewlett-Packard Company. - - All Rights Reserved - -Permission to use, duplicate, change, and distribute this software and -its documentation for any purpose and without fee is granted, provided -that the above copyright notice appear in such copy and that this -copyright notice appear in all supporting documentation, and that the -names of Apollo Computer Inc., the Hewlett-Packard Company, or the X -Consortium not be used in advertising or publicity pertaining to -distribution of the software without written prior permission. - -HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD -TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. Hewlett-Packard shall not be liable for errors -contained herein or direct, indirect, special, incidental or -consequential damages in connection with the furnishing, -performance, or use of this material. - -This software is not subject to any license of the American -Telephone and Telegraph Company or of the Regents of the -University of California. -******************************************************************/ - -#define apXK_LineDel 0x1000FF00 -#define apXK_CharDel 0x1000FF01 -#define apXK_Copy 0x1000FF02 -#define apXK_Cut 0x1000FF03 -#define apXK_Paste 0x1000FF04 -#define apXK_Move 0x1000FF05 -#define apXK_Grow 0x1000FF06 -#define apXK_Cmd 0x1000FF07 -#define apXK_Shell 0x1000FF08 -#define apXK_LeftBar 0x1000FF09 -#define apXK_RightBar 0x1000FF0A -#define apXK_LeftBox 0x1000FF0B -#define apXK_RightBox 0x1000FF0C -#define apXK_UpBox 0x1000FF0D -#define apXK_DownBox 0x1000FF0E -#define apXK_Pop 0x1000FF0F -#define apXK_Read 0x1000FF10 -#define apXK_Edit 0x1000FF11 -#define apXK_Save 0x1000FF12 -#define apXK_Exit 0x1000FF13 -#define apXK_Repeat 0x1000FF14 - -#define apXK_KP_parenleft 0x1000FFA8 -#define apXK_KP_parenright 0x1000FFA9 diff --git a/openflow/usr/include/X11/cursorfont.h b/openflow/usr/include/X11/cursorfont.h deleted file mode 100644 index c69d508..0000000 --- a/openflow/usr/include/X11/cursorfont.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifndef _X11_CURSORFONT_H_ -#define _X11_CURSORFONT_H_ - -#define XC_num_glyphs 154 -#define XC_X_cursor 0 -#define XC_arrow 2 -#define XC_based_arrow_down 4 -#define XC_based_arrow_up 6 -#define XC_boat 8 -#define XC_bogosity 10 -#define XC_bottom_left_corner 12 -#define XC_bottom_right_corner 14 -#define XC_bottom_side 16 -#define XC_bottom_tee 18 -#define XC_box_spiral 20 -#define XC_center_ptr 22 -#define XC_circle 24 -#define XC_clock 26 -#define XC_coffee_mug 28 -#define XC_cross 30 -#define XC_cross_reverse 32 -#define XC_crosshair 34 -#define XC_diamond_cross 36 -#define XC_dot 38 -#define XC_dotbox 40 -#define XC_double_arrow 42 -#define XC_draft_large 44 -#define XC_draft_small 46 -#define XC_draped_box 48 -#define XC_exchange 50 -#define XC_fleur 52 -#define XC_gobbler 54 -#define XC_gumby 56 -#define XC_hand1 58 -#define XC_hand2 60 -#define XC_heart 62 -#define XC_icon 64 -#define XC_iron_cross 66 -#define XC_left_ptr 68 -#define XC_left_side 70 -#define XC_left_tee 72 -#define XC_leftbutton 74 -#define XC_ll_angle 76 -#define XC_lr_angle 78 -#define XC_man 80 -#define XC_middlebutton 82 -#define XC_mouse 84 -#define XC_pencil 86 -#define XC_pirate 88 -#define XC_plus 90 -#define XC_question_arrow 92 -#define XC_right_ptr 94 -#define XC_right_side 96 -#define XC_right_tee 98 -#define XC_rightbutton 100 -#define XC_rtl_logo 102 -#define XC_sailboat 104 -#define XC_sb_down_arrow 106 -#define XC_sb_h_double_arrow 108 -#define XC_sb_left_arrow 110 -#define XC_sb_right_arrow 112 -#define XC_sb_up_arrow 114 -#define XC_sb_v_double_arrow 116 -#define XC_shuttle 118 -#define XC_sizing 120 -#define XC_spider 122 -#define XC_spraycan 124 -#define XC_star 126 -#define XC_target 128 -#define XC_tcross 130 -#define XC_top_left_arrow 132 -#define XC_top_left_corner 134 -#define XC_top_right_corner 136 -#define XC_top_side 138 -#define XC_top_tee 140 -#define XC_trek 142 -#define XC_ul_angle 144 -#define XC_umbrella 146 -#define XC_ur_angle 148 -#define XC_watch 150 -#define XC_xterm 152 - -#endif /* _X11_CURSORFONT_H_ */ diff --git a/openflow/usr/include/X11/extensions/XI.h b/openflow/usr/include/X11/extensions/XI.h deleted file mode 100644 index 7b44399..0000000 --- a/openflow/usr/include/X11/extensions/XI.h +++ /dev/null @@ -1,308 +0,0 @@ -/************************************************************ - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Hewlett-Packard not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -********************************************************/ - -/* Definitions used by the server, library and client */ - -#ifndef _XI_H_ -#define _XI_H_ - -#define sz_xGetExtensionVersionReq 8 -#define sz_xGetExtensionVersionReply 32 -#define sz_xListInputDevicesReq 4 -#define sz_xListInputDevicesReply 32 -#define sz_xOpenDeviceReq 8 -#define sz_xOpenDeviceReply 32 -#define sz_xCloseDeviceReq 8 -#define sz_xSetDeviceModeReq 8 -#define sz_xSetDeviceModeReply 32 -#define sz_xSelectExtensionEventReq 12 -#define sz_xGetSelectedExtensionEventsReq 8 -#define sz_xGetSelectedExtensionEventsReply 32 -#define sz_xChangeDeviceDontPropagateListReq 12 -#define sz_xGetDeviceDontPropagateListReq 8 -#define sz_xGetDeviceDontPropagateListReply 32 -#define sz_xGetDeviceMotionEventsReq 16 -#define sz_xGetDeviceMotionEventsReply 32 -#define sz_xChangeKeyboardDeviceReq 8 -#define sz_xChangeKeyboardDeviceReply 32 -#define sz_xChangePointerDeviceReq 8 -#define sz_xChangePointerDeviceReply 32 -#define sz_xGrabDeviceReq 20 -#define sz_xGrabDeviceReply 32 -#define sz_xUngrabDeviceReq 12 -#define sz_xGrabDeviceKeyReq 20 -#define sz_xGrabDeviceKeyReply 32 -#define sz_xUngrabDeviceKeyReq 16 -#define sz_xGrabDeviceButtonReq 20 -#define sz_xGrabDeviceButtonReply 32 -#define sz_xUngrabDeviceButtonReq 16 -#define sz_xAllowDeviceEventsReq 12 -#define sz_xGetDeviceFocusReq 8 -#define sz_xGetDeviceFocusReply 32 -#define sz_xSetDeviceFocusReq 16 -#define sz_xGetFeedbackControlReq 8 -#define sz_xGetFeedbackControlReply 32 -#define sz_xChangeFeedbackControlReq 12 -#define sz_xGetDeviceKeyMappingReq 8 -#define sz_xGetDeviceKeyMappingReply 32 -#define sz_xChangeDeviceKeyMappingReq 8 -#define sz_xGetDeviceModifierMappingReq 8 -#define sz_xSetDeviceModifierMappingReq 8 -#define sz_xSetDeviceModifierMappingReply 32 -#define sz_xGetDeviceButtonMappingReq 8 -#define sz_xGetDeviceButtonMappingReply 32 -#define sz_xSetDeviceButtonMappingReq 8 -#define sz_xSetDeviceButtonMappingReply 32 -#define sz_xQueryDeviceStateReq 8 -#define sz_xQueryDeviceStateReply 32 -#define sz_xSendExtensionEventReq 16 -#define sz_xDeviceBellReq 8 -#define sz_xSetDeviceValuatorsReq 8 -#define sz_xSetDeviceValuatorsReply 32 -#define sz_xGetDeviceControlReq 8 -#define sz_xGetDeviceControlReply 32 -#define sz_xChangeDeviceControlReq 8 -#define sz_xChangeDeviceControlReply 32 -#define sz_xListDevicePropertiesReq 8 -#define sz_xListDevicePropertiesReply 32 -#define sz_xChangeDevicePropertyReq 20 -#define sz_xDeleteDevicePropertyReq 12 -#define sz_xGetDevicePropertyReq 24 -#define sz_xGetDevicePropertyReply 32 - -#define INAME "XInputExtension" - -#define XI_KEYBOARD "KEYBOARD" -#define XI_MOUSE "MOUSE" -#define XI_TABLET "TABLET" -#define XI_TOUCHSCREEN "TOUCHSCREEN" -#define XI_TOUCHPAD "TOUCHPAD" -#define XI_BARCODE "BARCODE" -#define XI_BUTTONBOX "BUTTONBOX" -#define XI_KNOB_BOX "KNOB_BOX" -#define XI_ONE_KNOB "ONE_KNOB" -#define XI_NINE_KNOB "NINE_KNOB" -#define XI_TRACKBALL "TRACKBALL" -#define XI_QUADRATURE "QUADRATURE" -#define XI_ID_MODULE "ID_MODULE" -#define XI_SPACEBALL "SPACEBALL" -#define XI_DATAGLOVE "DATAGLOVE" -#define XI_EYETRACKER "EYETRACKER" -#define XI_CURSORKEYS "CURSORKEYS" -#define XI_FOOTMOUSE "FOOTMOUSE" -#define XI_JOYSTICK "JOYSTICK" - -/* Indices into the versions[] array (XExtInt.c). Used as a index to - * retrieve the minimum version of XI from _XiCheckExtInit */ -#define Dont_Check 0 -#define XInput_Initial_Release 1 -#define XInput_Add_XDeviceBell 2 -#define XInput_Add_XSetDeviceValuators 3 -#define XInput_Add_XChangeDeviceControl 4 -#define XInput_Add_DevicePresenceNotify 5 -#define XInput_Add_DeviceProperties 6 -/* DO NOT ADD TO HERE -> XI2 */ - -#define XI_Absent 0 -#define XI_Present 1 - -#define XI_Initial_Release_Major 1 -#define XI_Initial_Release_Minor 0 - -#define XI_Add_XDeviceBell_Major 1 -#define XI_Add_XDeviceBell_Minor 1 - -#define XI_Add_XSetDeviceValuators_Major 1 -#define XI_Add_XSetDeviceValuators_Minor 2 - -#define XI_Add_XChangeDeviceControl_Major 1 -#define XI_Add_XChangeDeviceControl_Minor 3 - -#define XI_Add_DevicePresenceNotify_Major 1 -#define XI_Add_DevicePresenceNotify_Minor 4 - -#define XI_Add_DeviceProperties_Major 1 -#define XI_Add_DeviceProperties_Minor 5 - -#define DEVICE_RESOLUTION 1 -#define DEVICE_ABS_CALIB 2 -#define DEVICE_CORE 3 -#define DEVICE_ENABLE 4 -#define DEVICE_ABS_AREA 5 - -#define NoSuchExtension 1 - -#define COUNT 0 -#define CREATE 1 - -#define NewPointer 0 -#define NewKeyboard 1 - -#define XPOINTER 0 -#define XKEYBOARD 1 - -#define UseXKeyboard 0xFF - -#define IsXPointer 0 -#define IsXKeyboard 1 -#define IsXExtensionDevice 2 -#define IsXExtensionKeyboard 3 -#define IsXExtensionPointer 4 - -#define AsyncThisDevice 0 -#define SyncThisDevice 1 -#define ReplayThisDevice 2 -#define AsyncOtherDevices 3 -#define AsyncAll 4 -#define SyncAll 5 - -#define FollowKeyboard 3 -#ifndef RevertToFollowKeyboard -#define RevertToFollowKeyboard 3 -#endif - -#define DvAccelNum (1L << 0) -#define DvAccelDenom (1L << 1) -#define DvThreshold (1L << 2) - -#define DvKeyClickPercent (1L<<0) -#define DvPercent (1L<<1) -#define DvPitch (1L<<2) -#define DvDuration (1L<<3) -#define DvLed (1L<<4) -#define DvLedMode (1L<<5) -#define DvKey (1L<<6) -#define DvAutoRepeatMode (1L<<7) - -#define DvString (1L << 0) - -#define DvInteger (1L << 0) - -#define DeviceMode (1L << 0) -#define Relative 0 -#define Absolute 1 - -#define ProximityState (1L << 1) -#define InProximity (0L << 1) -#define OutOfProximity (1L << 1) - -#define AddToList 0 -#define DeleteFromList 1 - -#define KeyClass 0 -#define ButtonClass 1 -#define ValuatorClass 2 -#define FeedbackClass 3 -#define ProximityClass 4 -#define FocusClass 5 -#define OtherClass 6 -#define AttachClass 7 - -#define KbdFeedbackClass 0 -#define PtrFeedbackClass 1 -#define StringFeedbackClass 2 -#define IntegerFeedbackClass 3 -#define LedFeedbackClass 4 -#define BellFeedbackClass 5 - -#define _devicePointerMotionHint 0 -#define _deviceButton1Motion 1 -#define _deviceButton2Motion 2 -#define _deviceButton3Motion 3 -#define _deviceButton4Motion 4 -#define _deviceButton5Motion 5 -#define _deviceButtonMotion 6 -#define _deviceButtonGrab 7 -#define _deviceOwnerGrabButton 8 -#define _noExtensionEvent 9 - -#define _devicePresence 0 - -#define _deviceEnter 0 -#define _deviceLeave 1 - -/* Device presence notify states */ -#define DeviceAdded 0 -#define DeviceRemoved 1 -#define DeviceEnabled 2 -#define DeviceDisabled 3 -#define DeviceUnrecoverable 4 -#define DeviceControlChanged 5 - -/* XI Errors */ -#define XI_BadDevice 0 -#define XI_BadEvent 1 -#define XI_BadMode 2 -#define XI_DeviceBusy 3 -#define XI_BadClass 4 - -/* - * Make XEventClass be a CARD32 for 64 bit servers. Don't affect client - * definition of XEventClass since that would be a library interface change. - * See the top of X.h for more _XSERVER64 magic. - * - * But, don't actually use the CARD32 type. We can't get it defined here - * without polluting the namespace. - */ -#ifdef _XSERVER64 -typedef unsigned int XEventClass; -#else -typedef unsigned long XEventClass; -#endif - -/******************************************************************* - * - * Extension version structure. - * - */ - -typedef struct { - int present; - short major_version; - short minor_version; -} XExtensionVersion; - -#endif /* _XI_H_ */ diff --git a/openflow/usr/include/X11/extensions/XI2.h b/openflow/usr/include/X11/extensions/XI2.h deleted file mode 100644 index 5a1c66a..0000000 --- a/openflow/usr/include/X11/extensions/XI2.h +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright © 2009 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef _XI2_H_ -#define _XI2_H_ - -#define XInput_2_0 7 -/* DO NOT ADD TO THIS LIST. These are libXi-specific defines. - See commit libXi-1.4.2-21-ge8531dd */ - -#define XI_2_Major 2 -#define XI_2_Minor 3 - -/* Property event flags */ -#define XIPropertyDeleted 0 -#define XIPropertyCreated 1 -#define XIPropertyModified 2 - -/* Property modes */ -#define XIPropModeReplace 0 -#define XIPropModePrepend 1 -#define XIPropModeAppend 2 - -/* Special property type used for XIGetProperty */ -#define XIAnyPropertyType 0L - -/* Enter/Leave and Focus In/Out modes */ -#define XINotifyNormal 0 -#define XINotifyGrab 1 -#define XINotifyUngrab 2 -#define XINotifyWhileGrabbed 3 -#define XINotifyPassiveGrab 4 -#define XINotifyPassiveUngrab 5 - -/* Enter/Leave and focus In/out detail */ -#define XINotifyAncestor 0 -#define XINotifyVirtual 1 -#define XINotifyInferior 2 -#define XINotifyNonlinear 3 -#define XINotifyNonlinearVirtual 4 -#define XINotifyPointer 5 -#define XINotifyPointerRoot 6 -#define XINotifyDetailNone 7 - -/* Grab modes */ -#define XIGrabModeSync 0 -#define XIGrabModeAsync 1 -#define XIGrabModeTouch 2 - -/* Grab reply status codes */ -#define XIGrabSuccess 0 -#define XIAlreadyGrabbed 1 -#define XIGrabInvalidTime 2 -#define XIGrabNotViewable 3 -#define XIGrabFrozen 4 - -/* Grab owner events values */ -#define XIOwnerEvents True -#define XINoOwnerEvents False - -/* Passive grab types */ -#define XIGrabtypeButton 0 -#define XIGrabtypeKeycode 1 -#define XIGrabtypeEnter 2 -#define XIGrabtypeFocusIn 3 -#define XIGrabtypeTouchBegin 4 - -/* Passive grab modifier */ -#define XIAnyModifier (1U << 31) -#define XIAnyButton 0 -#define XIAnyKeycode 0 - -/* XIAllowEvents event-modes */ -#define XIAsyncDevice 0 -#define XISyncDevice 1 -#define XIReplayDevice 2 -#define XIAsyncPairedDevice 3 -#define XIAsyncPair 4 -#define XISyncPair 5 -#define XIAcceptTouch 6 -#define XIRejectTouch 7 - -/* DeviceChangedEvent change reasons */ -#define XISlaveSwitch 1 -#define XIDeviceChange 2 - -/* Hierarchy flags */ -#define XIMasterAdded (1 << 0) -#define XIMasterRemoved (1 << 1) -#define XISlaveAdded (1 << 2) -#define XISlaveRemoved (1 << 3) -#define XISlaveAttached (1 << 4) -#define XISlaveDetached (1 << 5) -#define XIDeviceEnabled (1 << 6) -#define XIDeviceDisabled (1 << 7) - -/* ChangeHierarchy constants */ -#define XIAddMaster 1 -#define XIRemoveMaster 2 -#define XIAttachSlave 3 -#define XIDetachSlave 4 - -#define XIAttachToMaster 1 -#define XIFloating 2 - -/* Valuator modes */ -#define XIModeRelative 0 -#define XIModeAbsolute 1 - -/* Device types */ -#define XIMasterPointer 1 -#define XIMasterKeyboard 2 -#define XISlavePointer 3 -#define XISlaveKeyboard 4 -#define XIFloatingSlave 5 - -/* Device classes: classes that are not identical to Xi 1.x classes must be - * numbered starting from 8. */ -#define XIKeyClass 0 -#define XIButtonClass 1 -#define XIValuatorClass 2 -#define XIScrollClass 3 -#define XITouchClass 8 - -/* Scroll class types */ -#define XIScrollTypeVertical 1 -#define XIScrollTypeHorizontal 2 - -/* Scroll class flags */ -#define XIScrollFlagNoEmulation (1 << 0) -#define XIScrollFlagPreferred (1 << 1) - -/* Device event flags (common) */ -/* Device event flags (key events only) */ -#define XIKeyRepeat (1 << 16) -/* Device event flags (pointer events only) */ -#define XIPointerEmulated (1 << 16) -/* Device event flags (touch events only) */ -#define XITouchPendingEnd (1 << 16) -#define XITouchEmulatingPointer (1 << 17) - -/* Barrier event flags */ -#define XIBarrierPointerReleased (1 << 0) -#define XIBarrierDeviceIsGrabbed (1 << 1) - - -/* Touch modes */ -#define XIDirectTouch 1 -#define XIDependentTouch 2 - -/* XI2 event mask macros */ -#define XISetMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] |= (1 << ((event) & 7))) -#define XIClearMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &= ~(1 << ((event) & 7))) -#define XIMaskIsSet(ptr, event) (((unsigned char*)(ptr))[(event)>>3] & (1 << ((event) & 7))) -#define XIMaskLen(event) (((event) >> 3) + 1) - -/* Fake device ID's for event selection */ -#define XIAllDevices 0 -#define XIAllMasterDevices 1 - -/* Event types */ -#define XI_DeviceChanged 1 -#define XI_KeyPress 2 -#define XI_KeyRelease 3 -#define XI_ButtonPress 4 -#define XI_ButtonRelease 5 -#define XI_Motion 6 -#define XI_Enter 7 -#define XI_Leave 8 -#define XI_FocusIn 9 -#define XI_FocusOut 10 -#define XI_HierarchyChanged 11 -#define XI_PropertyEvent 12 -#define XI_RawKeyPress 13 -#define XI_RawKeyRelease 14 -#define XI_RawButtonPress 15 -#define XI_RawButtonRelease 16 -#define XI_RawMotion 17 -#define XI_TouchBegin 18 /* XI 2.2 */ -#define XI_TouchUpdate 19 -#define XI_TouchEnd 20 -#define XI_TouchOwnership 21 -#define XI_RawTouchBegin 22 -#define XI_RawTouchUpdate 23 -#define XI_RawTouchEnd 24 -#define XI_BarrierHit 25 /* XI 2.3 */ -#define XI_BarrierLeave 26 -#define XI_LASTEVENT XI_BarrierLeave -/* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value - * as XI_LASTEVENT if the server is supposed to handle masks etc. for this - * type of event. */ - -/* Event masks. - * Note: the protocol spec defines a mask to be of (1 << type). Clients are - * free to create masks by bitshifting instead of using these defines. - */ -#define XI_DeviceChangedMask (1 << XI_DeviceChanged) -#define XI_KeyPressMask (1 << XI_KeyPress) -#define XI_KeyReleaseMask (1 << XI_KeyRelease) -#define XI_ButtonPressMask (1 << XI_ButtonPress) -#define XI_ButtonReleaseMask (1 << XI_ButtonRelease) -#define XI_MotionMask (1 << XI_Motion) -#define XI_EnterMask (1 << XI_Enter) -#define XI_LeaveMask (1 << XI_Leave) -#define XI_FocusInMask (1 << XI_FocusIn) -#define XI_FocusOutMask (1 << XI_FocusOut) -#define XI_HierarchyChangedMask (1 << XI_HierarchyChanged) -#define XI_PropertyEventMask (1 << XI_PropertyEvent) -#define XI_RawKeyPressMask (1 << XI_RawKeyPress) -#define XI_RawKeyReleaseMask (1 << XI_RawKeyRelease) -#define XI_RawButtonPressMask (1 << XI_RawButtonPress) -#define XI_RawButtonReleaseMask (1 << XI_RawButtonRelease) -#define XI_RawMotionMask (1 << XI_RawMotion) -#define XI_TouchBeginMask (1 << XI_TouchBegin) -#define XI_TouchEndMask (1 << XI_TouchEnd) -#define XI_TouchOwnershipChangedMask (1 << XI_TouchOwnership) -#define XI_TouchUpdateMask (1 << XI_TouchUpdate) -#define XI_RawTouchBeginMask (1 << XI_RawTouchBegin) -#define XI_RawTouchEndMask (1 << XI_RawTouchEnd) -#define XI_RawTouchUpdateMask (1 << XI_RawTouchUpdate) -#define XI_BarrierHitMask (1 << XI_BarrierHit) -#define XI_BarrierLeaveMask (1 << XI_BarrierLeave) - -#endif /* _XI2_H_ */ diff --git a/openflow/usr/include/X11/extensions/XI2proto.h b/openflow/usr/include/X11/extensions/XI2proto.h deleted file mode 100644 index 4cdaa0d..0000000 --- a/openflow/usr/include/X11/extensions/XI2proto.h +++ /dev/null @@ -1,1091 +0,0 @@ -/* - * Copyright © 2009 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - */ - -/* Conventions for this file: - * Names: - * structs: always typedef'd, prefixed with xXI, CamelCase - * struct members: lower_case_with_underscores - * Exceptions: reqType, ReqType, repType, RepType, sequenceNumber are - * named as such for historical reasons. - * request opcodes: X_XIRequestName as CamelCase - * defines: defines used in client applications must go in XI2.h - * defines used only in protocol handling: XISOMENAME - * - * Data types: unless there is a historical name for a datatype (e.g. - * Window), use stdint types specifying the size of the datatype. - * historical data type names must be defined and undefined at the top and - * end of the file. - * - * General: - * spaces, not tabs. - * structs specific to a request or reply added before the request - * definition. structs used in more than one request, reply or event - * appended to the common structs section before the definition of the - * first request. - * members of structs vertically aligned on column 16 if datatypes permit. - * otherwise alingned on next available 8n column. - */ - -/** - * Protocol definitions for the XI2 protocol. - * This file should not be included by clients that merely use XI2, but do not - * need the wire protocol. Such clients should include XI2.h, or the matching - * header from the library. - * - */ -#ifndef _XI2PROTO_H_ -#define _XI2PROTO_H_ - -#include -#include -#include -#include - -/* make sure types have right sizes for protocol structures. */ -#define Window uint32_t -#define Time uint32_t -#define Atom uint32_t -#define Cursor uint32_t -#define Barrier uint32_t - -/** - * XI2 Request opcodes - */ -#define X_XIQueryPointer 40 -#define X_XIWarpPointer 41 -#define X_XIChangeCursor 42 -#define X_XIChangeHierarchy 43 -#define X_XISetClientPointer 44 -#define X_XIGetClientPointer 45 -#define X_XISelectEvents 46 -#define X_XIQueryVersion 47 -#define X_XIQueryDevice 48 -#define X_XISetFocus 49 -#define X_XIGetFocus 50 -#define X_XIGrabDevice 51 -#define X_XIUngrabDevice 52 -#define X_XIAllowEvents 53 -#define X_XIPassiveGrabDevice 54 -#define X_XIPassiveUngrabDevice 55 -#define X_XIListProperties 56 -#define X_XIChangeProperty 57 -#define X_XIDeleteProperty 58 -#define X_XIGetProperty 59 -#define X_XIGetSelectedEvents 60 -#define X_XIBarrierReleasePointer 61 - -/** Number of XI requests */ -#define XI2REQUESTS (X_XIBarrierReleasePointer - X_XIQueryPointer + 1) -/** Number of XI2 events */ -#define XI2EVENTS (XI_LASTEVENT + 1) - -/************************************************************************************* - * * - * COMMON STRUCTS * - * * - *************************************************************************************/ -/** Fixed point 16.16 */ -typedef int32_t FP1616; - -/** Fixed point 32.32 */ -typedef struct { - int32_t integral; - uint32_t frac; -} FP3232; - -/** - * Struct to describe a device. - * - * For a MasterPointer or a MasterKeyboard, 'attachment' specifies the - * paired master device. - * For a SlaveKeyboard or SlavePointer, 'attachment' specifies the master - * device this device is attached to. - * For a FloatingSlave, 'attachment' is undefined. - */ -typedef struct { - uint16_t deviceid; - uint16_t use; /**< ::XIMasterPointer, ::XIMasterKeyboard, - ::XISlavePointer, ::XISlaveKeyboard, - ::XIFloatingSlave */ - uint16_t attachment; /**< Current attachment or pairing.*/ - uint16_t num_classes; /**< Number of classes following this struct. */ - uint16_t name_len; /**< Length of name in bytes. */ - uint8_t enabled; /**< TRUE if device is enabled. */ - uint8_t pad; -} xXIDeviceInfo; - -/** - * Default template for a device class. - * A device class is equivalent to a device's capabilities. Multiple classes - * are supported per device. - */ -typedef struct { - uint16_t type; /**< One of *class */ - uint16_t length; /**< Length in 4 byte units */ - uint16_t sourceid; /**< source device for this class */ - uint16_t pad; -} xXIAnyInfo; - -/** - * Denotes button capability on a device. - * Struct is followed by num_buttons * Atom that names the buttons in the - * device-native setup (i.e. ignoring button mappings). - */ -typedef struct { - uint16_t type; /**< Always ButtonClass */ - uint16_t length; /**< Length in 4 byte units */ - uint16_t sourceid; /**< source device for this class */ - uint16_t num_buttons; /**< Number of buttons provided */ -} xXIButtonInfo; - -/** - * Denotes key capability on a device. - * Struct is followed by num_keys * CARD32 that lists the keycodes available - * on the device. - */ -typedef struct { - uint16_t type; /**< Always KeyClass */ - uint16_t length; /**< Length in 4 byte units */ - uint16_t sourceid; /**< source device for this class */ - uint16_t num_keycodes; /**< Number of keys provided */ -} xXIKeyInfo; - -/** - * Denotes an valuator capability on a device. - * One XIValuatorInfo describes exactly one valuator (axis) on the device. - */ -typedef struct { - uint16_t type; /**< Always ValuatorClass */ - uint16_t length; /**< Length in 4 byte units */ - uint16_t sourceid; /**< source device for this class */ - uint16_t number; /**< Valuator number */ - Atom label; /**< Axis label */ - FP3232 min; /**< Min value */ - FP3232 max; /**< Max value */ - FP3232 value; /**< Last published value */ - uint32_t resolution; /**< Resolutions in units/m */ - uint8_t mode; /**< ModeRelative or ModeAbsolute */ - uint8_t pad1; - uint16_t pad2; -} xXIValuatorInfo; - -/*** - * Denotes a scroll valuator on a device. - * One XIScrollInfo describes exactly one scroll valuator that must have a - * XIValuatorInfo struct. - */ -typedef struct { - uint16_t type; /**< Always ValuatorClass */ - uint16_t length; /**< Length in 4 byte units */ - uint16_t sourceid; /**< source device for this class */ - uint16_t number; /**< Valuator number */ - uint16_t scroll_type; /**< ::XIScrollTypeVertical, ::XIScrollTypeHorizontal */ - uint16_t pad0; - uint32_t flags; /**< ::XIScrollFlagEmulate, ::XIScrollFlagPreferred */ - FP3232 increment; /**< Increment for one unit of scrolling */ -} xXIScrollInfo; - -/** - * Denotes multitouch capability on a device. - */ -typedef struct { - uint16_t type; /**< Always TouchClass */ - uint16_t length; /**< Length in 4 byte units */ - uint16_t sourceid; /**< source device for this class */ - uint8_t mode; /**< DirectTouch or DependentTouch */ - uint8_t num_touches; /**< Maximum number of touches (0==unlimited) */ -} xXITouchInfo; - -/** - * Used to select for events on a given window. - * Struct is followed by (mask_len * CARD8), with each bit set representing - * the event mask for the given type. A mask bit represents an event type if - * (mask == (1 << type)). - */ -typedef struct { - uint16_t deviceid; /**< Device id to select for */ - uint16_t mask_len; /**< Length of mask in 4 byte units */ -} xXIEventMask; - -/** - * XKB modifier information. - * The effective modifier is a binary mask of base, latched, and locked - * modifiers. - */ -typedef struct -{ - uint32_t base_mods; /**< Logically pressed modifiers */ - uint32_t latched_mods; /**< Logically latched modifiers */ - uint32_t locked_mods; /**< Logically locked modifiers */ - uint32_t effective_mods; /**< Effective modifiers */ -} xXIModifierInfo; - -/** - * XKB group information. - * The effective group is the mathematical sum of base, latched, and locked - * group after group wrapping is taken into account. - */ -typedef struct -{ - uint8_t base_group; /**< Logically "pressed" group */ - uint8_t latched_group; /**< Logically latched group */ - uint8_t locked_group; /**< Logically locked group */ - uint8_t effective_group; /**< Effective group */ -} xXIGroupInfo; - - -/************************************************************************************* - * * - * REQUESTS * - * * - *************************************************************************************/ - -/** - * Query the server for the supported X Input extension version. - */ - -typedef struct { - uint8_t reqType; /**< Input extension major code */ - uint8_t ReqType; /**< Always ::X_XIQueryVersion */ - uint16_t length; /**< Length in 4 byte units */ - uint16_t major_version; - uint16_t minor_version; -} xXIQueryVersionReq; -#define sz_xXIQueryVersionReq 8 - -typedef struct { - uint8_t repType; /**< ::X_Reply */ - uint8_t RepType; /**< Always ::X_XIQueryVersion */ - uint16_t sequenceNumber; - uint32_t length; - uint16_t major_version; - uint16_t minor_version; - uint32_t pad1; - uint32_t pad2; - uint32_t pad3; - uint32_t pad4; - uint32_t pad5; -} xXIQueryVersionReply; -#define sz_xXIQueryVersionReply 32 - -/** - * Query the server for information about a specific device or all input - * devices. - */ -typedef struct { - uint8_t reqType; /**< Input extension major code */ - uint8_t ReqType; /**< Always ::X_XIQueryDevice */ - uint16_t length; /**< Length in 4 byte units */ - uint16_t deviceid; - uint16_t pad; -} xXIQueryDeviceReq; -#define sz_xXIQueryDeviceReq 8 - -typedef struct { - uint8_t repType; /**< ::X_Reply */ - uint8_t RepType; /**< Always ::X_XIQueryDevice */ - uint16_t sequenceNumber; - uint32_t length; - uint16_t num_devices; - uint16_t pad0; - uint32_t pad1; - uint32_t pad2; - uint32_t pad3; - uint32_t pad4; - uint32_t pad5; -} xXIQueryDeviceReply; -#define sz_xXIQueryDeviceReply 32 - -/** - * Select for events on a given window. - */ -typedef struct { - uint8_t reqType; /**< Input extension major code */ - uint8_t ReqType; /**< Always ::X_XISelectEvents */ - uint16_t length; /**< Length in 4 byte units */ - Window win; - uint16_t num_masks; - uint16_t pad; -} xXISelectEventsReq; -#define sz_xXISelectEventsReq 12 - -/** - * Query for selected events on a given window. - */ -typedef struct { - uint8_t reqType; /**< Input extension major code */ - uint8_t ReqType; /**< Always ::X_XIGetSelectedEvents */ - uint16_t length; /**< Length in 4 byte units */ - Window win; -} xXIGetSelectedEventsReq; -#define sz_xXIGetSelectedEventsReq 8 - -typedef struct { - uint8_t repType; /**< Input extension major opcode */ - uint8_t RepType; /**< Always ::X_XIGetSelectedEvents */ - uint16_t sequenceNumber; - uint32_t length; - uint16_t num_masks; /**< Number of xXIEventMask structs - trailing the reply */ - uint16_t pad0; - uint32_t pad1; - uint32_t pad2; - uint32_t pad3; - uint32_t pad4; - uint32_t pad5; -} xXIGetSelectedEventsReply; -#define sz_xXIGetSelectedEventsReply 32 - -/** - * Query the given device's screen/window coordinates. - */ - -typedef struct { - uint8_t reqType; /**< Input extension major code */ - uint8_t ReqType; /**< Always ::X_XIQueryPointer */ - uint16_t length; /**< Length in 4 byte units */ - Window win; - uint16_t deviceid; - uint16_t pad1; -} xXIQueryPointerReq; -#define sz_xXIQueryPointerReq 12 - - -typedef struct { - uint8_t repType; /**< Input extension major opcode */ - uint8_t RepType; /**< Always ::X_XIQueryPointer */ - uint16_t sequenceNumber; - uint32_t length; - Window root; - Window child; - FP1616 root_x; - FP1616 root_y; - FP1616 win_x; - FP1616 win_y; - uint8_t same_screen; - uint8_t pad0; - uint16_t buttons_len; - xXIModifierInfo mods; - xXIGroupInfo group; -} xXIQueryPointerReply; -#define sz_xXIQueryPointerReply 56 - -/** - * Warp the given device's pointer to the specified position. - */ - -typedef struct { - uint8_t reqType; /**< Input extension major code */ - uint8_t ReqType; /**< Always ::X_XIWarpPointer */ - uint16_t length; /**< Length in 4 byte units */ - Window src_win; - Window dst_win; - FP1616 src_x; - FP1616 src_y; - uint16_t src_width; - uint16_t src_height; - FP1616 dst_x; - FP1616 dst_y; - uint16_t deviceid; - uint16_t pad1; -} xXIWarpPointerReq; -#define sz_xXIWarpPointerReq 36 - -/** - * Change the given device's sprite to the given cursor. - */ - -typedef struct { - uint8_t reqType; /**< Input extension major code */ - uint8_t ReqType; /**< Always ::X_XIChangeCursor */ - uint16_t length; /**< Length in 4 byte units */ - Window win; - Cursor cursor; - uint16_t deviceid; - uint16_t pad1; -} xXIChangeCursorReq; -#define sz_xXIChangeCursorReq 16 - -/** - * Modify the device hierarchy. - */ - -typedef struct { - uint8_t reqType; /**< Input extension major code */ - uint8_t ReqType; /**< Always ::X_XIChangeHierarchy */ - uint16_t length; /**< Length in 4 byte units */ - uint8_t num_changes; - uint8_t pad0; - uint16_t pad1; -} xXIChangeHierarchyReq; -#define sz_xXIChangeHierarchyReq 8 - -/** - * Generic header for any hierarchy change. - */ -typedef struct { - uint16_t type; - uint16_t length; /**< Length in 4 byte units */ -} xXIAnyHierarchyChangeInfo; - -/** - * Create a new master device. - * Name of new master follows struct (4-byte padded) - */ -typedef struct { - uint16_t type; /**< Always ::XIAddMaster */ - uint16_t length; /**< 2 + (namelen + padding)/4 */ - uint16_t name_len; - uint8_t send_core; - uint8_t enable; -} xXIAddMasterInfo; - -/** - * Delete a master device. Will automatically delete the master device paired - * with the given master device. - */ -typedef struct { - uint16_t type; /**< Always ::XIRemoveMaster */ - uint16_t length; /**< 3 */ - uint16_t deviceid; - uint8_t return_mode; /**< ::XIAttachToMaster, ::XIFloating */ - uint8_t pad; - uint16_t return_pointer; /**< Pointer to attach slave ptr devices to */ - uint16_t return_keyboard; /**< keyboard to attach slave keybd devices to*/ -} xXIRemoveMasterInfo; - -/** - * Attach an SD to a new device. - * NewMaster has to be of same type (pointer->pointer, keyboard->keyboard); - */ -typedef struct { - uint16_t type; /**< Always ::XIAttachSlave */ - uint16_t length; /**< 2 */ - uint16_t deviceid; - uint16_t new_master; /**< id of new master device */ -} xXIAttachSlaveInfo; - -/** - * Detach an SD from its current master device. - */ -typedef struct { - uint16_t type; /**< Always ::XIDetachSlave */ - uint16_t length; /**< 2 */ - uint16_t deviceid; - uint16_t pad; -} xXIDetachSlaveInfo; - - -/** - * Set the window/client's ClientPointer. - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always ::X_XISetClientPointer */ - uint16_t length; /**< Length in 4 byte units */ - Window win; - uint16_t deviceid; - uint16_t pad1; -} xXISetClientPointerReq; -#define sz_xXISetClientPointerReq 12 - -/** - * Query the given window/client's ClientPointer setting. - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always ::X_GetClientPointer */ - uint16_t length; /**< Length in 4 byte units */ - Window win; -} xXIGetClientPointerReq; -#define sz_xXIGetClientPointerReq 8 - -typedef struct { - uint8_t repType; /**< Input extension major opcode */ - uint8_t RepType; /**< Always ::X_GetClientPointer */ - uint16_t sequenceNumber; - uint32_t length; - BOOL set; /**< client pointer is set? */ - uint8_t pad0; - uint16_t deviceid; - uint32_t pad1; - uint32_t pad2; - uint32_t pad3; - uint32_t pad4; - uint32_t pad5; -} xXIGetClientPointerReply; -#define sz_xXIGetClientPointerReply 32 - -/** - * Set the input focus to the specified window. - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always ::X_XISetFocus */ - uint16_t length; /**< Length in 4 byte units */ - Window focus; - Time time; - uint16_t deviceid; - uint16_t pad0; -} xXISetFocusReq; -#define sz_xXISetFocusReq 16 - -/** - * Query the current input focus. - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always ::X_XIGetDeviceFocus */ - uint16_t length; /**< Length in 4 byte units */ - uint16_t deviceid; - uint16_t pad0; -} xXIGetFocusReq; -#define sz_xXIGetFocusReq 8 - -typedef struct { - uint8_t repType; /**< Input extension major opcode */ - uint8_t RepType; /**< Always ::X_XIGetFocus */ - uint16_t sequenceNumber; - uint32_t length; - Window focus; - uint32_t pad1; - uint32_t pad2; - uint32_t pad3; - uint32_t pad4; - uint32_t pad5; -} xXIGetFocusReply; -#define sz_xXIGetFocusReply 32 - - -/** - * Grab the given device. - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always ::X_XIGrabDevice */ - uint16_t length; /**< Length in 4 byte units */ - Window grab_window; - Time time; - Cursor cursor; - uint16_t deviceid; - uint8_t grab_mode; - uint8_t paired_device_mode; - uint8_t owner_events; - uint8_t pad; - uint16_t mask_len; -} xXIGrabDeviceReq; -#define sz_xXIGrabDeviceReq 24 - -/** - * Return codes from a XIPassiveGrabDevice request. - */ -typedef struct { - uint32_t modifiers; /**< Modifier state */ - uint8_t status; /**< Grab status code */ - uint8_t pad0; - uint16_t pad1; -} xXIGrabModifierInfo; - -typedef struct { - uint8_t repType; /**< Input extension major opcode */ - uint8_t RepType; /**< Always ::X_XIGrabDevice */ - uint16_t sequenceNumber; - uint32_t length; - uint8_t status; - uint8_t pad0; - uint16_t pad1; - uint32_t pad2; - uint32_t pad3; - uint32_t pad4; - uint32_t pad5; - uint32_t pad6; -} xXIGrabDeviceReply; -#define sz_xXIGrabDeviceReply 32 - -/** - * Ungrab the specified device. - * - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always ::X_XIUngrabDevice */ - uint16_t length; /**< Length in 4 byte units */ - Time time; - uint16_t deviceid; - uint16_t pad; -} xXIUngrabDeviceReq; -#define sz_xXIUngrabDeviceReq 12 - - -/** - * Allow or replay events on the specified grabbed device. - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always ::X_XIAllowEvents */ - uint16_t length; /**< Length in 4 byte units */ - Time time; - uint16_t deviceid; - uint8_t mode; - uint8_t pad; -} xXIAllowEventsReq; -#define sz_xXIAllowEventsReq 12 - -/** - * Allow or replay events on the specified grabbed device. - * Since XI 2.2 - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always ::X_XIAllowEvents */ - uint16_t length; /**< Length in 4 byte units */ - Time time; - uint16_t deviceid; - uint8_t mode; - uint8_t pad; - uint32_t touchid; /**< Since XI 2.2 */ - Window grab_window; /**< Since XI 2.2 */ -} xXI2_2AllowEventsReq; -#define sz_xXI2_2AllowEventsReq 20 - - -/** - * Passively grab the device. - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always ::X_XIPassiveGrabDevice */ - uint16_t length; /**< Length in 4 byte units */ - Time time; - Window grab_window; - Cursor cursor; - uint32_t detail; - uint16_t deviceid; - uint16_t num_modifiers; - uint16_t mask_len; - uint8_t grab_type; - uint8_t grab_mode; - uint8_t paired_device_mode; - uint8_t owner_events; - uint16_t pad1; -} xXIPassiveGrabDeviceReq; -#define sz_xXIPassiveGrabDeviceReq 32 - -typedef struct { - uint8_t repType; /**< Input extension major opcode */ - uint8_t RepType; /**< Always ::X_XIPassiveGrabDevice */ - uint16_t sequenceNumber; - uint32_t length; - uint16_t num_modifiers; - uint16_t pad1; - uint32_t pad2; - uint32_t pad3; - uint32_t pad4; - uint32_t pad5; - uint32_t pad6; -} xXIPassiveGrabDeviceReply; -#define sz_xXIPassiveGrabDeviceReply 32 - -/** - * Delete a passive grab for the given device. - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always ::X_XIPassiveUngrabDevice */ - uint16_t length; /**< Length in 4 byte units */ - Window grab_window; - uint32_t detail; - uint16_t deviceid; - uint16_t num_modifiers; - uint8_t grab_type; - uint8_t pad0; - uint16_t pad1; -} xXIPassiveUngrabDeviceReq; -#define sz_xXIPassiveUngrabDeviceReq 20 - -/** - * List all device properties on the specified device. - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always ::X_XIListProperties */ - uint16_t length; /**< Length in 4 byte units */ - uint16_t deviceid; - uint16_t pad; -} xXIListPropertiesReq; -#define sz_xXIListPropertiesReq 8 - -typedef struct { - uint8_t repType; /**< Input extension major opcode */ - uint8_t RepType; /**< Always ::X_XIListProperties */ - uint16_t sequenceNumber; - uint32_t length; - uint16_t num_properties; - uint16_t pad0; - uint32_t pad1; - uint32_t pad2; - uint32_t pad3; - uint32_t pad4; - uint32_t pad5; -} xXIListPropertiesReply; -#define sz_xXIListPropertiesReply 32 - -/** - * Change a property on the specified device. - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always ::X_XIChangeProperty */ - uint16_t length; /**< Length in 4 byte units */ - uint16_t deviceid; - uint8_t mode; - uint8_t format; - Atom property; - Atom type; - uint32_t num_items; -} xXIChangePropertyReq; -#define sz_xXIChangePropertyReq 20 - -/** - * Delete the specified property. - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always X_XIDeleteProperty */ - uint16_t length; /**< Length in 4 byte units */ - uint16_t deviceid; - uint16_t pad0; - Atom property; -} xXIDeletePropertyReq; -#define sz_xXIDeletePropertyReq 12 - -/** - * Query the specified property's values. - */ -typedef struct { - uint8_t reqType; - uint8_t ReqType; /**< Always X_XIGetProperty */ - uint16_t length; /**< Length in 4 byte units */ - uint16_t deviceid; -#if defined(__cplusplus) || defined(c_plusplus) - uint8_t c_delete; -#else - uint8_t delete; -#endif - uint8_t pad0; - Atom property; - Atom type; - uint32_t offset; - uint32_t len; -} xXIGetPropertyReq; -#define sz_xXIGetPropertyReq 24 - -typedef struct { - uint8_t repType; /**< Input extension major opcode */ - uint8_t RepType; /**< Always X_XIGetProperty */ - uint16_t sequenceNumber; - uint32_t length; - Atom type; - uint32_t bytes_after; - uint32_t num_items; - uint8_t format; - uint8_t pad0; - uint16_t pad1; - uint32_t pad2; - uint32_t pad3; -} xXIGetPropertyReply; -#define sz_xXIGetPropertyReply 32 - -typedef struct { - uint16_t deviceid; - uint16_t pad; - Barrier barrier; - uint32_t eventid; -} xXIBarrierReleasePointerInfo; - -typedef struct { - uint8_t reqType; /**< Input extension major opcode */ - uint8_t ReqType; /**< Always X_XIBarrierReleasePointer */ - uint16_t length; - uint32_t num_barriers; - /* array of xXIBarrierReleasePointerInfo */ -} xXIBarrierReleasePointerReq; -#define sz_xXIBarrierReleasePointerReq 8 - -/************************************************************************************* - * * - * EVENTS * - * * - *************************************************************************************/ - -/** - * Generic XI2 event header. All XI2 events use the same header. - */ -typedef struct -{ - uint8_t type; - uint8_t extension; /**< XI extension offset */ - uint16_t sequenceNumber; - uint32_t length; - uint16_t evtype; - uint16_t deviceid; - Time time; -} xXIGenericDeviceEvent; - -/** - * Device hierarchy information. - */ -typedef struct -{ - uint16_t deviceid; - uint16_t attachment; /**< ID of master or paired device */ - uint8_t use; /**< ::XIMasterKeyboard, - ::XIMasterPointer, - ::XISlaveKeyboard, - ::XISlavePointer, - ::XIFloatingSlave */ - BOOL enabled; /**< TRUE if the device is enabled */ - uint16_t pad; - uint32_t flags; /**< ::XIMasterAdded, ::XIMasterRemoved, - ::XISlaveAttached, ::XISlaveDetached, - ::XISlaveAdded, ::XISlaveRemoved, - ::XIDeviceEnabled, ::XIDeviceDisabled */ -} xXIHierarchyInfo; - -/** - * The device hierarchy has been modified. This event includes the device - * hierarchy after the modification has been applied. - */ -typedef struct -{ - uint8_t type; /**< Always GenericEvent */ - uint8_t extension; /**< XI extension offset */ - uint16_t sequenceNumber; - uint32_t length; /**< Length in 4 byte units */ - uint16_t evtype; /**< ::XI_Hierarchy */ - uint16_t deviceid; - Time time; - uint32_t flags; /**< ::XIMasterAdded, ::XIMasterDeleted, - ::XISlaveAttached, ::XISlaveDetached, - ::XISlaveAdded, ::XISlaveRemoved, - ::XIDeviceEnabled, ::XIDeviceDisabled */ - uint16_t num_info; - uint16_t pad0; - uint32_t pad1; - uint32_t pad2; -} xXIHierarchyEvent; - -/** - * A device has changed capabilities. - */ -typedef struct -{ - uint8_t type; /**< Always GenericEvent */ - uint8_t extension; /**< XI extension offset */ - uint16_t sequenceNumber; - uint32_t length; /**< Length in 4 byte units */ - uint16_t evtype; /**< XI_DeviceChanged */ - uint16_t deviceid; /**< Device that has changed */ - Time time; - uint16_t num_classes; /**< Number of classes that have changed */ - uint16_t sourceid; /**< Source of the new classes */ - uint8_t reason; /**< ::XISlaveSwitch, ::XIDeviceChange */ - uint8_t pad0; - uint16_t pad1; - uint32_t pad2; - uint32_t pad3; -} xXIDeviceChangedEvent; - -/** - * The owner of a touch stream has passed on ownership to another client. - */ -typedef struct -{ - uint8_t type; /**< Always GenericEvent */ - uint8_t extension; /**< XI extension offset */ - uint16_t sequenceNumber; - uint32_t length; /**< Length in 4 byte units */ - uint16_t evtype; /**< XI_TouchOwnership */ - uint16_t deviceid; /**< Device that has changed */ - Time time; - uint32_t touchid; - Window root; - Window event; - Window child; -/* └──────── 32 byte boundary ────────┘ */ - uint16_t sourceid; - uint16_t pad0; - uint32_t flags; - uint32_t pad1; - uint32_t pad2; -} xXITouchOwnershipEvent; - -/** - * Default input event for pointer, keyboard or touch input. - */ -typedef struct -{ - uint8_t type; /**< Always GenericEvent */ - uint8_t extension; /**< XI extension offset */ - uint16_t sequenceNumber; - uint32_t length; /**< Length in 4 byte uints */ - uint16_t evtype; - uint16_t deviceid; - Time time; - uint32_t detail; /**< Keycode or button */ - Window root; - Window event; - Window child; -/* └──────── 32 byte boundary ────────┘ */ - FP1616 root_x; /**< Always screen coords, 16.16 fixed point */ - FP1616 root_y; - FP1616 event_x; /**< Always screen coords, 16.16 fixed point */ - FP1616 event_y; - uint16_t buttons_len; /**< Len of button flags in 4 b units */ - uint16_t valuators_len; /**< Len of val. flags in 4 b units */ - uint16_t sourceid; /**< The source device */ - uint16_t pad0; - uint32_t flags; /**< ::XIKeyRepeat */ - xXIModifierInfo mods; - xXIGroupInfo group; -} xXIDeviceEvent; - - -/** - * Sent when an input event is generated. RawEvents include valuator - * information in both device-specific data (i.e. unaccelerated) and - * processed data (i.e. accelerated, if applicable). - */ -typedef struct -{ - uint8_t type; /**< Always GenericEvent */ - uint8_t extension; /**< XI extension offset */ - uint16_t sequenceNumber; - uint32_t length; /**< Length in 4 byte uints */ - uint16_t evtype; /**< ::XI_RawEvent */ - uint16_t deviceid; - Time time; - uint32_t detail; - uint16_t sourceid; /**< The source device (XI 2.1) */ - uint16_t valuators_len; /**< Length of trailing valuator - mask in 4 byte units */ - uint32_t flags; /**< ::XIKeyRepeat */ - uint32_t pad2; -} xXIRawEvent; - -/** - * Note that the layout of root, event, child, root_x, root_y, event_x, - * event_y must be identical to the xXIDeviceEvent. - */ -typedef struct -{ - uint8_t type; /**< Always GenericEvent */ - uint8_t extension; /**< XI extension offset */ - uint16_t sequenceNumber; - uint32_t length; /**< Length in 4 byte uints */ - uint16_t evtype; /**< ::XI_Enter */ - uint16_t deviceid; - Time time; - uint16_t sourceid; - uint8_t mode; - uint8_t detail; - Window root; - Window event; - Window child; -/* └──────── 32 byte boundary ────────┘ */ - FP1616 root_x; - FP1616 root_y; - FP1616 event_x; - FP1616 event_y; - BOOL same_screen; - BOOL focus; - uint16_t buttons_len; /**< Length of trailing button mask - in 4 byte units */ - xXIModifierInfo mods; - xXIGroupInfo group; -} xXIEnterEvent; - -typedef xXIEnterEvent xXILeaveEvent; -typedef xXIEnterEvent xXIFocusInEvent; -typedef xXIEnterEvent xXIFocusOutEvent; - -/** - * Sent when a device property is created, modified or deleted. Does not - * include property data, the client is required to query the data. - */ -typedef struct -{ - uint8_t type; /**< Always GenericEvent */ - uint8_t extension; /**< XI extension offset */ - uint16_t sequenceNumber; - uint32_t length; /**< Length in 4 byte units */ - uint16_t evtype; /**< ::XI_PropertyEvent */ - uint16_t deviceid; - Time time; - Atom property; - uint8_t what; /**< ::XIPropertyDeleted, - ::XIPropertyCreated, - ::XIPropertyMotified */ - uint8_t pad0; - uint16_t pad1; - uint32_t pad2; - uint32_t pad3; -} xXIPropertyEvent; - -typedef struct -{ - uint8_t type; /**< Always GenericEvent */ - uint8_t extension; /**< XI extension offset */ - uint16_t sequenceNumber; - uint32_t length; /**< Length in 4 byte units */ - uint16_t evtype; /**< ::XI_BarrierHit or ::XI_BarrierLeave */ - uint16_t deviceid; - Time time; - uint32_t eventid; - Window root; - Window event; - Barrier barrier; -/* └──────── 32 byte boundary ────────┘ */ - uint32_t dtime; - uint32_t flags; /**< ::XIBarrierPointerReleased - ::XIBarrierDeviceIsGrabbed */ - uint16_t sourceid; - int16_t pad; - FP1616 root_x; - FP1616 root_y; - FP3232 dx; - FP3232 dy; -} xXIBarrierEvent; - -typedef xXIBarrierEvent xXIBarrierHitEvent; -typedef xXIBarrierEvent xXIBarrierPointerReleasedEvent; -typedef xXIBarrierEvent xXIBarrierLeaveEvent; - -#undef Window -#undef Time -#undef Atom -#undef Cursor -#undef Barrier - -#endif /* _XI2PROTO_H_ */ diff --git a/openflow/usr/include/X11/extensions/XIproto.h b/openflow/usr/include/X11/extensions/XIproto.h deleted file mode 100644 index 82323d8..0000000 --- a/openflow/usr/include/X11/extensions/XIproto.h +++ /dev/null @@ -1,1758 +0,0 @@ -/************************************************************ - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Hewlett-Packard not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -********************************************************/ - -#ifndef _XIPROTO_H -#define _XIPROTO_H - -#include -#include - -/* make sure types have right sizes for protocol structures. */ -#define Window CARD32 -#define Time CARD32 -#define KeyCode CARD8 -#define Mask CARD32 -#define Atom CARD32 -#define Cursor CARD32 - -/********************************************************* - * - * number of events, errors, and extension name. - * - */ - -#define MORE_EVENTS 0x80 -#define DEVICE_BITS 0x7F - -#define InputClassBits 0x3F /* bits in mode field for input classes */ -#define ModeBitsShift 6 /* amount to shift the remaining bits */ - -#define numInputClasses 7 - -#define IEVENTS 17 /* does NOT include generic events */ -#define IERRORS 5 -#define IREQUESTS 39 - -#define CLIENT_REQ 1 - -typedef struct _XExtEventInfo - { - Mask mask; - BYTE type; - BYTE word; - } XExtEventInfo; - -#ifndef _XITYPEDEF_POINTER -typedef void *Pointer; -#endif - -struct tmask - { - Mask mask; - void *dev; - }; - -/********************************************************* - * - * Event constants used by library. - * - */ - -#define XI_DeviceValuator 0 -#define XI_DeviceKeyPress 1 -#define XI_DeviceKeyRelease 2 -#define XI_DeviceButtonPress 3 -#define XI_DeviceButtonRelease 4 -#define XI_DeviceMotionNotify 5 -#define XI_DeviceFocusIn 6 -#define XI_DeviceFocusOut 7 -#define XI_ProximityIn 8 -#define XI_ProximityOut 9 -#define XI_DeviceStateNotify 10 -#define XI_DeviceMappingNotify 11 -#define XI_ChangeDeviceNotify 12 -#define XI_DeviceKeystateNotify 13 -#define XI_DeviceButtonstateNotify 14 -#define XI_DevicePresenceNotify 15 -#define XI_DevicePropertyNotify 16 - -/********************************************************* - * - * Protocol request constants - * - */ - -#define X_GetExtensionVersion 1 -#define X_ListInputDevices 2 -#define X_OpenDevice 3 -#define X_CloseDevice 4 -#define X_SetDeviceMode 5 -#define X_SelectExtensionEvent 6 -#define X_GetSelectedExtensionEvents 7 -#define X_ChangeDeviceDontPropagateList 8 -#define X_GetDeviceDontPropagateList 9 -#define X_GetDeviceMotionEvents 10 -#define X_ChangeKeyboardDevice 11 -#define X_ChangePointerDevice 12 -#define X_GrabDevice 13 -#define X_UngrabDevice 14 -#define X_GrabDeviceKey 15 -#define X_UngrabDeviceKey 16 -#define X_GrabDeviceButton 17 -#define X_UngrabDeviceButton 18 -#define X_AllowDeviceEvents 19 -#define X_GetDeviceFocus 20 -#define X_SetDeviceFocus 21 -#define X_GetFeedbackControl 22 -#define X_ChangeFeedbackControl 23 -#define X_GetDeviceKeyMapping 24 -#define X_ChangeDeviceKeyMapping 25 -#define X_GetDeviceModifierMapping 26 -#define X_SetDeviceModifierMapping 27 -#define X_GetDeviceButtonMapping 28 -#define X_SetDeviceButtonMapping 29 -#define X_QueryDeviceState 30 -#define X_SendExtensionEvent 31 -#define X_DeviceBell 32 -#define X_SetDeviceValuators 33 -#define X_GetDeviceControl 34 -#define X_ChangeDeviceControl 35 -/* XI 1.5 */ -#define X_ListDeviceProperties 36 -#define X_ChangeDeviceProperty 37 -#define X_DeleteDeviceProperty 38 -#define X_GetDeviceProperty 39 - -/********************************************************* - * - * Protocol request and reply structures. - * - * GetExtensionVersion. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_GetExtensionVersion */ - CARD16 length B16; - CARD16 nbytes B16; - CARD8 pad1, pad2; -} xGetExtensionVersionReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_GetExtensionVersion */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 major_version B16; - CARD16 minor_version B16; - BOOL present; - CARD8 pad1, pad2, pad3; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; -} xGetExtensionVersionReply; - -/********************************************************* - * - * ListInputDevices. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_ListInputDevices */ - CARD16 length B16; -} xListInputDevicesReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_ListInputDevices */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 ndevices; - CARD8 pad1, pad2, pad3; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; -} xListInputDevicesReply; - -typedef struct _xDeviceInfo *xDeviceInfoPtr; - -typedef struct _xAnyClassinfo *xAnyClassPtr; - -typedef struct _xAnyClassinfo { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; -#else - CARD8 class; -#endif - CARD8 length; - } xAnyClassInfo; - -typedef struct _xDeviceInfo { - CARD32 type B32; - CARD8 id; - CARD8 num_classes; - CARD8 use; /* IsXPointer | IsXKeyboard | IsXExtension... */ - CARD8 attached; /* id of master dev (if IsXExtension..) */ - } xDeviceInfo; - -typedef struct _xKeyInfo *xKeyInfoPtr; - -typedef struct _xKeyInfo { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; -#else - CARD8 class; -#endif - CARD8 length; - KeyCode min_keycode; - KeyCode max_keycode; - CARD16 num_keys B16; - CARD8 pad1,pad2; - } xKeyInfo; - -typedef struct _xButtonInfo *xButtonInfoPtr; - -typedef struct _xButtonInfo { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; -#else - CARD8 class; -#endif - CARD8 length; - CARD16 num_buttons B16; - } xButtonInfo; - -typedef struct _xValuatorInfo *xValuatorInfoPtr; - -typedef struct _xValuatorInfo { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; -#else - CARD8 class; -#endif - CARD8 length; - CARD8 num_axes; - CARD8 mode; - CARD32 motion_buffer_size B32; - } xValuatorInfo; - -typedef struct _xAxisInfo *xAxisInfoPtr; - -typedef struct _xAxisInfo { - CARD32 resolution B32; - CARD32 min_value B32; - CARD32 max_value B32; - } xAxisInfo; - -/********************************************************* - * - * OpenDevice. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_OpenDevice */ - CARD16 length B16; - CARD8 deviceid; - BYTE pad1, pad2, pad3; -} xOpenDeviceReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_OpenDevice */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 num_classes; - BYTE pad1, pad2, pad3; - CARD32 pad00 B32; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - } xOpenDeviceReply; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; -#else - CARD8 class; -#endif - CARD8 event_type_base; - } xInputClassInfo; - -/********************************************************* - * - * CloseDevice. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_CloseDevice */ - CARD16 length B16; - CARD8 deviceid; - BYTE pad1, pad2, pad3; -} xCloseDeviceReq; - -/********************************************************* - * - * SetDeviceMode. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_SetDeviceMode */ - CARD16 length B16; - CARD8 deviceid; - CARD8 mode; - BYTE pad1, pad2; -} xSetDeviceModeReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_SetDeviceMode */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 status; - BYTE pad1, pad2, pad3; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; -} xSetDeviceModeReply; - -/********************************************************* - * - * SelectExtensionEvent. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_SelectExtensionEvent */ - CARD16 length B16; - Window window B32; - CARD16 count B16; - CARD16 pad00 B16; -} xSelectExtensionEventReq; - -/********************************************************* - * - * GetSelectedExtensionEvent. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* X_GetSelectedExtensionEvents */ - CARD16 length B16; - Window window B32; -} xGetSelectedExtensionEventsReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* GetSelectedExtensionEvents */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 this_client_count B16; - CARD16 all_clients_count B16; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; -} xGetSelectedExtensionEventsReply; - -/********************************************************* - * - * ChangeDeviceDontPropagateList. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* X_ChangeDeviceDontPropagateList */ - CARD16 length B16; - Window window B32; - CARD16 count B16; - CARD8 mode; - BYTE pad; -} xChangeDeviceDontPropagateListReq; - -/********************************************************* - * - * GetDeviceDontPropagateList. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* X_GetDeviceDontPropagateList */ - CARD16 length B16; - Window window B32; -} xGetDeviceDontPropagateListReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* GetDeviceDontPropagateList */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 count B16; - CARD16 pad00 B16; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; - } xGetDeviceDontPropagateListReply; - -/********************************************************* - * - * GetDeviceMotionEvents. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_GetDeviceMotionEvents*/ - CARD16 length B16; - Time start B32; - Time stop B32; - CARD8 deviceid; - BYTE pad1, pad2, pad3; -} xGetDeviceMotionEventsReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_GetDeviceMotionEvents */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 nEvents B32; - CARD8 axes; - CARD8 mode; - BYTE pad1, pad2; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; -} xGetDeviceMotionEventsReply; - -/********************************************************* - * - * ChangeKeyboardDevice. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* X_ChangeKeyboardDevice */ - CARD16 length B16; - CARD8 deviceid; - BYTE pad1, pad2, pad3; -} xChangeKeyboardDeviceReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_ChangeKeyboardDevice*/ - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - CARD8 status; - BYTE pad1, pad2, pad3; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; - } xChangeKeyboardDeviceReply; - -/********************************************************* - * - * ChangePointerDevice. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* X_ChangePointerDevice */ - CARD16 length B16; - CARD8 xaxis; - CARD8 yaxis; - CARD8 deviceid; - BYTE pad1; -} xChangePointerDeviceReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_ChangePointerDevice */ - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - CARD8 status; - BYTE pad1, pad2, pad3; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; - } xChangePointerDeviceReply; - -/********************************************************* - * - * GrabDevice. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_GrabDevice */ - CARD16 length B16; - Window grabWindow B32; - Time time B32; - CARD16 event_count B16; - CARD8 this_device_mode; - CARD8 other_devices_mode; - BOOL ownerEvents; - CARD8 deviceid; - CARD16 pad01 B16; -} xGrabDeviceReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_GrabDevice */ - CARD16 sequenceNumber B16; - CARD32 length B32; /* 0 */ - CARD8 status; - BYTE pad1, pad2, pad3; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; - } xGrabDeviceReply; - -/********************************************************* - * - * UngrabDevice. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_UnGrabDevice */ - CARD16 length B16; - Time time B32; - CARD8 deviceid; - BYTE pad1, pad2, pad3; -} xUngrabDeviceReq; - -/********************************************************* - * - * GrabDeviceKey. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_GrabDeviceKey */ - CARD16 length B16; - Window grabWindow B32; - CARD16 event_count B16; - CARD16 modifiers B16; - CARD8 modifier_device; - CARD8 grabbed_device; - CARD8 key; - BYTE this_device_mode; - BYTE other_devices_mode; - BOOL ownerEvents; - BYTE pad1, pad2; -} xGrabDeviceKeyReq; - -/********************************************************* - * - * UngrabDeviceKey. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_UngrabDeviceKey */ - CARD16 length B16; - Window grabWindow B32; - CARD16 modifiers B16; - CARD8 modifier_device; - CARD8 key; - CARD8 grabbed_device; - BYTE pad1, pad2, pad3; -} xUngrabDeviceKeyReq; - -/********************************************************* - * - * GrabDeviceButton. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_GrabDeviceButton */ - CARD16 length B16; - Window grabWindow B32; - CARD8 grabbed_device; - CARD8 modifier_device; - CARD16 event_count B16; - CARD16 modifiers B16; - BYTE this_device_mode; - BYTE other_devices_mode; - CARD8 button; - BOOL ownerEvents; - BYTE pad1, pad2; -} xGrabDeviceButtonReq; - -/********************************************************* - * - * UngrabDeviceButton. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_UngrabDeviceButton */ - CARD16 length B16; - Window grabWindow B32; - CARD16 modifiers B16; - CARD8 modifier_device; - CARD8 button; - CARD8 grabbed_device; - BYTE pad1, pad2, pad3; -} xUngrabDeviceButtonReq; - -/********************************************************* - * - * AllowDeviceEvents. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_AllowDeviceEvents */ - CARD16 length B16; - Time time B32; - CARD8 mode; - CARD8 deviceid; - BYTE pad1, pad2; -} xAllowDeviceEventsReq; - -/********************************************************* - * - * GetDeviceFocus. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_GetDeviceFocus */ - CARD16 length B16; - CARD8 deviceid; - BYTE pad1, pad2, pad3; -} xGetDeviceFocusReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_GetDeviceFocus */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 focus B32; - Time time B32; - CARD8 revertTo; - BYTE pad1, pad2, pad3; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - } xGetDeviceFocusReply; - -/********************************************************* - * - * SetDeviceFocus. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_SetDeviceFocus */ - CARD16 length B16; - Window focus B32; - Time time B32; - CARD8 revertTo; - CARD8 device; - CARD16 pad01 B16; -} xSetDeviceFocusReq; - -/********************************************************* - * - * GetFeedbackControl. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* X_GetFeedbackControl */ - CARD16 length B16; - CARD8 deviceid; - BYTE pad1, pad2, pad3; -} xGetFeedbackControlReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_GetFeedbackControl */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 num_feedbacks B16; - CARD16 pad01 B16; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; - CARD32 pad06 B32; -} xGetFeedbackControlReply; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; /* feedback class */ -#else - CARD8 class; /* feedback class */ -#endif - CARD8 id; /* feedback id */ - CARD16 length B16; /* feedback length */ -} xFeedbackState; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; -#else - CARD8 class; -#endif - CARD8 id; - CARD16 length B16; - CARD16 pitch B16; - CARD16 duration B16; - CARD32 led_mask B32; - CARD32 led_values B32; - BOOL global_auto_repeat; - CARD8 click; - CARD8 percent; - BYTE pad; - BYTE auto_repeats[32]; -} xKbdFeedbackState; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; -#else - CARD8 class; -#endif - CARD8 id; - CARD16 length B16; - CARD8 pad1,pad2; - CARD16 accelNum B16; - CARD16 accelDenom B16; - CARD16 threshold B16; -} xPtrFeedbackState; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; /* feedback class id */ -#else - CARD8 class; /* feedback class id */ -#endif - CARD8 id; - CARD16 length B16; /* feedback length */ - CARD32 resolution B32; - INT32 min_value B32; - INT32 max_value B32; -} xIntegerFeedbackState; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; /* feedback class id */ -#else - CARD8 class; /* feedback class id */ -#endif - CARD8 id; - CARD16 length B16; /* feedback length */ - CARD16 max_symbols B16; - CARD16 num_syms_supported B16; -} xStringFeedbackState; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; /* feedback class id */ -#else - CARD8 class; /* feedback class id */ -#endif - CARD8 id; - CARD16 length B16; /* feedback length */ - CARD8 percent; - BYTE pad1, pad2, pad3; - CARD16 pitch B16; - CARD16 duration B16; -} xBellFeedbackState; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; /* feedback class id */ -#else - CARD8 class; /* feedback class id */ -#endif - CARD8 id; - CARD16 length B16; /* feedback length */ - CARD32 led_mask B32; - CARD32 led_values B32; -} xLedFeedbackState; - -/********************************************************* - * - * ChangeFeedbackControl. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* X_ChangeFeedbackControl */ - CARD16 length B16; - CARD32 mask B32; - CARD8 deviceid; - CARD8 feedbackid; - BYTE pad1, pad2; -} xChangeFeedbackControlReq; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; /* feedback class id */ -#else - CARD8 class; /* feedback class id */ -#endif - CARD8 id; /* feedback id */ - CARD16 length B16; /* feedback length */ -} xFeedbackCtl; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; /* feedback class id */ -#else - CARD8 class; /* feedback class id */ -#endif - CARD8 id; /* feedback length */ - CARD16 length B16; /* feedback length */ - KeyCode key; - CARD8 auto_repeat_mode; - INT8 click; - INT8 percent; - INT16 pitch B16; - INT16 duration B16; - CARD32 led_mask B32; - CARD32 led_values B32; -} xKbdFeedbackCtl; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; /* feedback class id */ -#else - CARD8 class; /* feedback class id */ -#endif - CARD8 id; /* feedback id */ - CARD16 length B16; /* feedback length */ - CARD8 pad1,pad2; - INT16 num B16; - INT16 denom B16; - INT16 thresh B16; -} xPtrFeedbackCtl; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; /* feedback class id */ -#else - CARD8 class; /* feedback class id */ -#endif - CARD8 id; /* feedback id */ - CARD16 length B16; /* feedback length */ - INT32 int_to_display B32; -} xIntegerFeedbackCtl; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; /* feedback class id */ -#else - CARD8 class; /* feedback class id */ -#endif - CARD8 id; /* feedback id */ - CARD16 length B16; /* feedback length */ - CARD8 pad1,pad2; - CARD16 num_keysyms B16; -} xStringFeedbackCtl; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; /* feedback class id */ -#else - CARD8 class; /* feedback class id */ -#endif - CARD8 id; /* feedback id */ - CARD16 length B16; /* feedback length */ - INT8 percent; - BYTE pad1, pad2, pad3; - INT16 pitch B16; - INT16 duration B16; -} xBellFeedbackCtl; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; /* feedback class id */ -#else - CARD8 class; /* feedback class id */ -#endif - CARD8 id; /* feedback id */ - CARD16 length B16; /* feedback length */ - CARD32 led_mask B32; - CARD32 led_values B32; -} xLedFeedbackCtl; - -/********************************************************* - * - * GetDeviceKeyMapping. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_GetDeviceKeyMapping */ - CARD16 length B16; - CARD8 deviceid; - KeyCode firstKeyCode; - CARD8 count; - BYTE pad1; -} xGetDeviceKeyMappingReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_GetDeviceKeyMapping */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 keySymsPerKeyCode; - CARD8 pad0; - CARD16 pad1 B16; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xGetDeviceKeyMappingReply; - -/********************************************************* - * - * ChangeDeviceKeyMapping. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_ChangeDeviceKeyMapping */ - CARD16 length B16; - CARD8 deviceid; - KeyCode firstKeyCode; - CARD8 keySymsPerKeyCode; - CARD8 keyCodes; -} xChangeDeviceKeyMappingReq; - -/********************************************************* - * - * GetDeviceModifierMapping. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_GetDeviceModifierMapping */ - CARD16 length B16; - CARD8 deviceid; - BYTE pad1, pad2, pad3; -} xGetDeviceModifierMappingReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_GetDeviceModifierMapping */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 numKeyPerModifier; - CARD8 pad0; - CARD16 pad1 B16; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xGetDeviceModifierMappingReply; - -/********************************************************* - * - * SetDeviceModifierMapping. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_SetDeviceModifierMapping */ - CARD16 length B16; - CARD8 deviceid; - CARD8 numKeyPerModifier; - CARD16 pad1 B16; -} xSetDeviceModifierMappingReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_SetDeviceModifierMapping */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 success; - CARD8 pad0; - CARD16 pad1 B16; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xSetDeviceModifierMappingReply; - -/********************************************************* - * - * GetDeviceButtonMapping. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* X_GetDeviceButtonMapping */ - CARD16 length B16; - CARD8 deviceid; - BYTE pad1, pad2, pad3; -} xGetDeviceButtonMappingReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_GetDeviceButtonMapping */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 nElts; - BYTE pad1, pad2, pad3; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; -} xGetDeviceButtonMappingReply; - -/********************************************************* - * - * SetDeviceButtonMapping. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* X_SetDeviceButtonMapping */ - CARD16 length B16; - CARD8 deviceid; - CARD8 map_length; - BYTE pad1, pad2; -} xSetDeviceButtonMappingReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_SetDeviceButtonMapping */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 status; - BYTE pad0; - CARD16 pad1 B16; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xSetDeviceButtonMappingReply; - -/********************************************************* - * - * QueryDeviceState. - * - */ - -typedef struct { - CARD8 reqType; - CARD8 ReqType; /* always X_QueryDeviceState */ - CARD16 length B16; - CARD8 deviceid; - BYTE pad1, pad2, pad3; -} xQueryDeviceStateReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_QueryDeviceState */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 num_classes; - BYTE pad0; - CARD16 pad1 B16; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xQueryDeviceStateReply; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; -#else - CARD8 class; -#endif - CARD8 length; - CARD8 num_keys; - BYTE pad1; - CARD8 keys[32]; -} xKeyState; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; -#else - CARD8 class; -#endif - CARD8 length; - CARD8 num_buttons; - BYTE pad1; - CARD8 buttons[32]; -} xButtonState; - -typedef struct { -#if defined(__cplusplus) || defined(c_plusplus) - CARD8 c_class; -#else - CARD8 class; -#endif - CARD8 length; - CARD8 num_valuators; - CARD8 mode; -} xValuatorState; - -/********************************************************* - * - * SendExtensionEvent. - * THIS REQUEST MUST BE KEPT A MULTIPLE OF 8 BYTES IN LENGTH! - * MORE EVENTS MAY FOLLOW AND THEY MUST BE QUAD-ALIGNED! - * - */ - -typedef struct { - CARD8 reqType; - CARD8 ReqType; /* always X_SendExtensionEvent */ - CARD16 length B16; - Window destination B32; - CARD8 deviceid; - BOOL propagate; - CARD16 count B16; - CARD8 num_events; - BYTE pad1,pad2,pad3; -} xSendExtensionEventReq; - -/********************************************************* - * - * DeviceBell. - * - */ - -typedef struct { - CARD8 reqType; - CARD8 ReqType; /* always X_DeviceBell */ - CARD16 length B16; - CARD8 deviceid; - CARD8 feedbackid; - CARD8 feedbackclass; - INT8 percent; -} xDeviceBellReq; - -/********************************************************* - * - * SetDeviceValuators. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_SetDeviceValuators */ - CARD16 length B16; - CARD8 deviceid; - CARD8 first_valuator; - CARD8 num_valuators; - BYTE pad1; -} xSetDeviceValuatorsReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_SetDeviceValuators */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 status; - BYTE pad1, pad2, pad3; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; -} xSetDeviceValuatorsReply; - -/********************************************************* - * - * GetDeviceControl. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_GetDeviceControl */ - CARD16 length B16; - CARD16 control B16; - CARD8 deviceid; - BYTE pad2; -} xGetDeviceControlReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_GetDeviceControl */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 status; - BYTE pad1, pad2, pad3; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; -} xGetDeviceControlReply; - -typedef struct { - CARD16 control B16; /* control type */ - CARD16 length B16; /* control length */ -} xDeviceState; - -typedef struct { - CARD16 control B16; /* control type */ - CARD16 length B16; /* control length */ - CARD32 num_valuators B32; /* number of valuators */ -} xDeviceResolutionState; - -typedef struct { - CARD16 control B16; - CARD16 length B16; - INT32 min_x B32; - INT32 max_x B32; - INT32 min_y B32; - INT32 max_y B32; - CARD32 flip_x B32; - CARD32 flip_y B32; - CARD32 rotation B32; - CARD32 button_threshold B32; -} xDeviceAbsCalibState; - -typedef struct { - CARD16 control B16; - CARD16 length B16; - CARD32 offset_x B32; - CARD32 offset_y B32; - CARD32 width B32; - CARD32 height B32; - CARD32 screen B32; - CARD32 following B32; -} xDeviceAbsAreaState; - -typedef struct { - CARD16 control B16; /* control type */ - CARD16 length B16; /* control length */ - CARD8 status; - CARD8 iscore; - CARD16 pad1 B16; -} xDeviceCoreState; - -typedef struct { - CARD16 control B16; /* control type */ - CARD16 length B16; /* control length */ - CARD8 enable; - CARD8 pad0; - CARD16 pad1 B16; -} xDeviceEnableState; - -/********************************************************* - * - * ChangeDeviceControl. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major code */ - CARD8 ReqType; /* always X_ChangeDeviceControl */ - CARD16 length B16; - CARD16 control B16; - CARD8 deviceid; - BYTE pad0; -} xChangeDeviceControlReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_ChangeDeviceControl */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 status; - BYTE pad1, pad2, pad3; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; -} xChangeDeviceControlReply; - -typedef struct { - CARD16 control B16; /* control type */ - CARD16 length B16; /* control length */ -} xDeviceCtl; - -typedef struct { - CARD16 control B16; /* control type */ - CARD16 length B16; /* control length */ - CARD8 first_valuator; /* first valuator to change */ - CARD8 num_valuators; /* number of valuators to change*/ - CARD8 pad1,pad2; -} xDeviceResolutionCtl; - -typedef struct { - CARD16 control B16; - CARD16 length B16; - INT32 min_x; - INT32 max_x; - INT32 min_y; - INT32 max_y; - CARD32 flip_x; - CARD32 flip_y; - CARD32 rotation; - CARD32 button_threshold; -} xDeviceAbsCalibCtl; - -typedef struct { - CARD16 control B16; - CARD16 length B16; - CARD32 offset_x; - CARD32 offset_y; - INT32 width; - INT32 height; - INT32 screen; - CARD32 following; -} xDeviceAbsAreaCtl; - -typedef struct { - CARD16 control B16; - CARD16 length B16; - CARD8 status; - CARD8 pad0; - CARD16 pad1 B16; -} xDeviceCoreCtl; - -typedef struct { - CARD16 control B16; - CARD16 length B16; - CARD8 enable; - CARD8 pad0; - CARD16 pad1 B16; -} xDeviceEnableCtl; - -/* XI 1.5 */ - -/********************************************************* - * - * ListDeviceProperties. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major opcode */ - CARD8 ReqType; /* always X_ListDeviceProperties */ - CARD16 length B16; - CARD8 deviceid; - CARD8 pad0; - CARD16 pad1 B16; -} xListDevicePropertiesReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_ListDeviceProperties */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 nAtoms B16; - CARD16 pad1 B16; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xListDevicePropertiesReply; - -/********************************************************* - * - * ChangeDeviceProperty. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major opcode */ - CARD8 ReqType; /* always X_ChangeDeviceProperty */ - CARD16 length B16; - Atom property B32; - Atom type B32; - CARD8 deviceid; - CARD8 format; - CARD8 mode; - CARD8 pad; - CARD32 nUnits B32; -} xChangeDevicePropertyReq; - -/********************************************************* - * - * DeleteDeviceProperty. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major opcode */ - CARD8 ReqType; /* always X_DeleteDeviceProperty */ - CARD16 length B16; - Atom property B32; - CARD8 deviceid; - CARD8 pad0; - CARD16 pad1 B16; -} xDeleteDevicePropertyReq; - -/********************************************************* - * - * GetDeviceProperty. - * - */ - -typedef struct { - CARD8 reqType; /* input extension major opcode */ - CARD8 ReqType; /* always X_GetDeviceProperty */ - CARD16 length B16; - Atom property B32; - Atom type B32; - CARD32 longOffset B32; - CARD32 longLength B32; - CARD8 deviceid; -#if defined(__cplusplus) || defined(c_plusplus) - BOOL c_delete; -#else - BOOL delete; -#endif - CARD16 pad; -} xGetDevicePropertyReq; - -typedef struct { - CARD8 repType; /* X_Reply */ - CARD8 RepType; /* always X_GetDeviceProperty */ - CARD16 sequenceNumber B16; - CARD32 length B32; - Atom propertyType B32; - CARD32 bytesAfter B32; - CARD32 nItems B32; - CARD8 format; - CARD8 deviceid; - CARD16 pad1 B16; - CARD32 pad2 B32; - CARD32 pad3 B32; -} xGetDevicePropertyReply; - - -/********************************************************** - * - * Input extension events. - * - * DeviceValuator - * - */ - -typedef struct - { - BYTE type; - CARD8 deviceid; - CARD16 sequenceNumber B16; - KeyButMask device_state B16; - CARD8 num_valuators; - CARD8 first_valuator; - INT32 valuator0 B32; - INT32 valuator1 B32; - INT32 valuator2 B32; - INT32 valuator3 B32; - INT32 valuator4 B32; - INT32 valuator5 B32; - } deviceValuator; - -/********************************************************** - * - * DeviceKeyButtonPointer. - * - * Used for: DeviceKeyPress, DeviceKeyRelease, - * DeviceButtonPress, DeviceButtonRelease, - * ProximityIn, ProximityOut - * DeviceMotionNotify, - * - */ - -typedef struct - { - BYTE type; - BYTE detail; - CARD16 sequenceNumber B16; - Time time B32; - Window root B32; - Window event B32; - Window child B32; - INT16 root_x B16; - INT16 root_y B16; - INT16 event_x B16; - INT16 event_y B16; - KeyButMask state B16; - BOOL same_screen; - CARD8 deviceid; - } deviceKeyButtonPointer; - -/********************************************************** - * - * DeviceFocus. - * - */ - -typedef struct - { - BYTE type; - BYTE detail; - CARD16 sequenceNumber B16; - Time time B32; - Window window B32; - BYTE mode; - CARD8 deviceid; - BYTE pad1, pad2; - CARD32 pad00 B32; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - } deviceFocus; - -/********************************************************** - * - * DeviceStateNotify. - * - * Note that the two high-order bits in the classes_reported - * field are the proximity state (InProximity or OutOfProximity), - * and the device mode (Absolute or Relative), respectively. - * - */ - -typedef struct - { - BYTE type; - BYTE deviceid; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 num_keys; - CARD8 num_buttons; - CARD8 num_valuators; - CARD8 classes_reported; - CARD8 buttons[4]; - CARD8 keys[4]; - INT32 valuator0 B32; - INT32 valuator1 B32; - INT32 valuator2 B32; - } deviceStateNotify; - -/********************************************************** - * - * DeviceKeyStateNotify. - * - */ - -typedef struct - { - BYTE type; - BYTE deviceid; - CARD16 sequenceNumber B16; - CARD8 keys[28]; - } deviceKeyStateNotify; - -/********************************************************** - * - * DeviceButtonStateNotify. - * - */ - -typedef struct - { - BYTE type; - BYTE deviceid; - CARD16 sequenceNumber B16; - CARD8 buttons[28]; - } deviceButtonStateNotify; - -/********************************************************** - * - * DeviceMappingNotify. - * Fields must be kept in sync with core mappingnotify event. - * - */ - -typedef struct - { - BYTE type; - BYTE deviceid; - CARD16 sequenceNumber B16; - CARD8 request; - KeyCode firstKeyCode; - CARD8 count; - BYTE pad1; - Time time B32; - CARD32 pad00 B32; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - } deviceMappingNotify; - -/********************************************************** - * - * ChangeDeviceNotify. - * - */ - -typedef struct - { - BYTE type; - BYTE deviceid; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 request; - BYTE pad1, pad2, pad3; - CARD32 pad00 B32; - CARD32 pad01 B32; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - } changeDeviceNotify; - -/********************************************************** - * - * devicePresenceNotify. - * - */ - -typedef struct - { - BYTE type; - BYTE pad00; - CARD16 sequenceNumber B16; - Time time B32; - BYTE devchange; /* Device{Added|Removed|Enabled|Disabled|ControlChanged} */ - BYTE deviceid; - CARD16 control B16; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; - CARD32 pad06 B32; - } devicePresenceNotify; - - -/********************************************************* - * DevicePropertyNotifyEvent - * - * Sent whenever a device's property changes. - * - */ - -typedef struct - { - BYTE type; - BYTE state; /* NewValue or Deleted */ - CARD16 sequenceNumber B16; - CARD32 time B32; - Atom atom B32; /* affected property */ - CARD32 pad0 B32; - CARD32 pad1 B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD16 pad5 B16; - CARD8 pad4; - CARD8 deviceid; /* id of device */ - } devicePropertyNotify; - -#undef Window -#undef Time -#undef KeyCode -#undef Mask -#undef Atom -#undef Cursor - -#endif diff --git a/openflow/usr/include/X11/extensions/XKB.h b/openflow/usr/include/X11/extensions/XKB.h deleted file mode 100644 index ee4f740..0000000 --- a/openflow/usr/include/X11/extensions/XKB.h +++ /dev/null @@ -1,786 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -#ifndef _XKB_H_ -#define _XKB_H_ - - /* - * XKB request codes, used in: - * - xkbReqType field of all requests - * - requestMinor field of some events - */ -#define X_kbUseExtension 0 -#define X_kbSelectEvents 1 -#define X_kbBell 3 -#define X_kbGetState 4 -#define X_kbLatchLockState 5 -#define X_kbGetControls 6 -#define X_kbSetControls 7 -#define X_kbGetMap 8 -#define X_kbSetMap 9 -#define X_kbGetCompatMap 10 -#define X_kbSetCompatMap 11 -#define X_kbGetIndicatorState 12 -#define X_kbGetIndicatorMap 13 -#define X_kbSetIndicatorMap 14 -#define X_kbGetNamedIndicator 15 -#define X_kbSetNamedIndicator 16 -#define X_kbGetNames 17 -#define X_kbSetNames 18 -#define X_kbGetGeometry 19 -#define X_kbSetGeometry 20 -#define X_kbPerClientFlags 21 -#define X_kbListComponents 22 -#define X_kbGetKbdByName 23 -#define X_kbGetDeviceInfo 24 -#define X_kbSetDeviceInfo 25 -#define X_kbSetDebuggingFlags 101 - - /* - * In the X sense, XKB reports only one event. - * The type field of all XKB events is XkbEventCode - */ -#define XkbEventCode 0 -#define XkbNumberEvents (XkbEventCode+1) - - /* - * XKB has a minor event code so it can use one X event code for - * multiple purposes. - * - reported in the xkbType field of all XKB events. - * - XkbSelectEventDetails: Indicates the event for which event details - * are being changed - */ -#define XkbNewKeyboardNotify 0 -#define XkbMapNotify 1 -#define XkbStateNotify 2 -#define XkbControlsNotify 3 -#define XkbIndicatorStateNotify 4 -#define XkbIndicatorMapNotify 5 -#define XkbNamesNotify 6 -#define XkbCompatMapNotify 7 -#define XkbBellNotify 8 -#define XkbActionMessage 9 -#define XkbAccessXNotify 10 -#define XkbExtensionDeviceNotify 11 - - /* - * Event Mask: - * - XkbSelectEvents: Specifies event interest. - */ -#define XkbNewKeyboardNotifyMask (1L << 0) -#define XkbMapNotifyMask (1L << 1) -#define XkbStateNotifyMask (1L << 2) -#define XkbControlsNotifyMask (1L << 3) -#define XkbIndicatorStateNotifyMask (1L << 4) -#define XkbIndicatorMapNotifyMask (1L << 5) -#define XkbNamesNotifyMask (1L << 6) -#define XkbCompatMapNotifyMask (1L << 7) -#define XkbBellNotifyMask (1L << 8) -#define XkbActionMessageMask (1L << 9) -#define XkbAccessXNotifyMask (1L << 10) -#define XkbExtensionDeviceNotifyMask (1L << 11) -#define XkbAllEventsMask (0xFFF) - - /* - * NewKeyboardNotify event details: - */ -#define XkbNKN_KeycodesMask (1L << 0) -#define XkbNKN_GeometryMask (1L << 1) -#define XkbNKN_DeviceIDMask (1L << 2) -#define XkbAllNewKeyboardEventsMask (0x7) - - /* - * AccessXNotify event types: - * - The 'what' field of AccessXNotify events reports the - * reason that the event was generated. - */ -#define XkbAXN_SKPress 0 -#define XkbAXN_SKAccept 1 -#define XkbAXN_SKReject 2 -#define XkbAXN_SKRelease 3 -#define XkbAXN_BKAccept 4 -#define XkbAXN_BKReject 5 -#define XkbAXN_AXKWarning 6 - - /* - * AccessXNotify details: - * - Used as an event detail mask to limit the conditions under which - * AccessXNotify events are reported - */ -#define XkbAXN_SKPressMask (1L << 0) -#define XkbAXN_SKAcceptMask (1L << 1) -#define XkbAXN_SKRejectMask (1L << 2) -#define XkbAXN_SKReleaseMask (1L << 3) -#define XkbAXN_BKAcceptMask (1L << 4) -#define XkbAXN_BKRejectMask (1L << 5) -#define XkbAXN_AXKWarningMask (1L << 6) -#define XkbAllAccessXEventsMask (0x7f) - - /* - * Miscellaneous event details: - * - event detail masks for assorted events that don't reall - * have any details. - */ -#define XkbAllStateEventsMask XkbAllStateComponentsMask -#define XkbAllMapEventsMask XkbAllMapComponentsMask -#define XkbAllControlEventsMask XkbAllControlsMask -#define XkbAllIndicatorEventsMask XkbAllIndicatorsMask -#define XkbAllNameEventsMask XkbAllNamesMask -#define XkbAllCompatMapEventsMask XkbAllCompatMask -#define XkbAllBellEventsMask (1L << 0) -#define XkbAllActionMessagesMask (1L << 0) - - /* - * XKB reports one error: BadKeyboard - * A further reason for the error is encoded into to most significant - * byte of the resourceID for the error: - * XkbErr_BadDevice - the device in question was not found - * XkbErr_BadClass - the device was found but it doesn't belong to - * the appropriate class. - * XkbErr_BadId - the device was found and belongs to the right - * class, but not feedback with a matching id was - * found. - * The low byte of the resourceID for this error contains the device - * id, class specifier or feedback id that failed. - */ -#define XkbKeyboard 0 -#define XkbNumberErrors 1 - -#define XkbErr_BadDevice 0xff -#define XkbErr_BadClass 0xfe -#define XkbErr_BadId 0xfd - - /* - * Keyboard Components Mask: - * - Specifies the components that follow a GetKeyboardByNameReply - */ -#define XkbClientMapMask (1L << 0) -#define XkbServerMapMask (1L << 1) -#define XkbCompatMapMask (1L << 2) -#define XkbIndicatorMapMask (1L << 3) -#define XkbNamesMask (1L << 4) -#define XkbGeometryMask (1L << 5) -#define XkbControlsMask (1L << 6) -#define XkbAllComponentsMask (0x7f) - - /* - * State detail mask: - * - The 'changed' field of StateNotify events reports which of - * the keyboard state components have changed. - * - Used as an event detail mask to limit the conditions under - * which StateNotify events are reported. - */ -#define XkbModifierStateMask (1L << 0) -#define XkbModifierBaseMask (1L << 1) -#define XkbModifierLatchMask (1L << 2) -#define XkbModifierLockMask (1L << 3) -#define XkbGroupStateMask (1L << 4) -#define XkbGroupBaseMask (1L << 5) -#define XkbGroupLatchMask (1L << 6) -#define XkbGroupLockMask (1L << 7) -#define XkbCompatStateMask (1L << 8) -#define XkbGrabModsMask (1L << 9) -#define XkbCompatGrabModsMask (1L << 10) -#define XkbLookupModsMask (1L << 11) -#define XkbCompatLookupModsMask (1L << 12) -#define XkbPointerButtonMask (1L << 13) -#define XkbAllStateComponentsMask (0x3fff) - - /* - * Controls detail masks: - * The controls specified in XkbAllControlsMask: - * - The 'changed' field of ControlsNotify events reports which of - * the keyboard controls have changed. - * - The 'changeControls' field of the SetControls request specifies - * the controls for which values are to be changed. - * - Used as an event detail mask to limit the conditions under - * which ControlsNotify events are reported. - * - * The controls specified in the XkbAllBooleanCtrlsMask: - * - The 'enabledControls' field of ControlsNotify events reports the - * current status of the boolean controls. - * - The 'enabledControlsChanges' field of ControlsNotify events reports - * any boolean controls that have been turned on or off. - * - The 'affectEnabledControls' and 'enabledControls' fields of the - * kbSetControls request change the set of enabled controls. - * - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of - * an XkbControlsRec specify the controls to be changed if the keyboard - * times out and the values to which they should be changed. - * - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags - * request specifies the specify the controls to be reset when the - * client exits and the values to which they should be reset. - * - The 'ctrls' field of an indicator map specifies the controls - * that drive the indicator. - * - Specifies the boolean controls affected by the SetControls and - * LockControls key actions. - */ -#define XkbRepeatKeysMask (1L << 0) -#define XkbSlowKeysMask (1L << 1) -#define XkbBounceKeysMask (1L << 2) -#define XkbStickyKeysMask (1L << 3) -#define XkbMouseKeysMask (1L << 4) -#define XkbMouseKeysAccelMask (1L << 5) -#define XkbAccessXKeysMask (1L << 6) -#define XkbAccessXTimeoutMask (1L << 7) -#define XkbAccessXFeedbackMask (1L << 8) -#define XkbAudibleBellMask (1L << 9) -#define XkbOverlay1Mask (1L << 10) -#define XkbOverlay2Mask (1L << 11) -#define XkbIgnoreGroupLockMask (1L << 12) -#define XkbGroupsWrapMask (1L << 27) -#define XkbInternalModsMask (1L << 28) -#define XkbIgnoreLockModsMask (1L << 29) -#define XkbPerKeyRepeatMask (1L << 30) -#define XkbControlsEnabledMask (1L << 31) - -#define XkbAccessXOptionsMask (XkbStickyKeysMask|XkbAccessXFeedbackMask) - -#define XkbAllBooleanCtrlsMask (0x00001FFF) -#define XkbAllControlsMask (0xF8001FFF) -#define XkbAllControlEventsMask XkbAllControlsMask - - /* - * AccessX Options Mask - * - The 'accessXOptions' field of an XkbControlsRec specifies the - * AccessX options that are currently in effect. - * - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues' - * fields of an XkbControlsRec specify the Access X options to be - * changed if the keyboard times out and the values to which they - * should be changed. - */ -#define XkbAX_SKPressFBMask (1L << 0) -#define XkbAX_SKAcceptFBMask (1L << 1) -#define XkbAX_FeatureFBMask (1L << 2) -#define XkbAX_SlowWarnFBMask (1L << 3) -#define XkbAX_IndicatorFBMask (1L << 4) -#define XkbAX_StickyKeysFBMask (1L << 5) -#define XkbAX_TwoKeysMask (1L << 6) -#define XkbAX_LatchToLockMask (1L << 7) -#define XkbAX_SKReleaseFBMask (1L << 8) -#define XkbAX_SKRejectFBMask (1L << 9) -#define XkbAX_BKRejectFBMask (1L << 10) -#define XkbAX_DumbBellFBMask (1L << 11) -#define XkbAX_FBOptionsMask (0xF3F) -#define XkbAX_SKOptionsMask (0x0C0) -#define XkbAX_AllOptionsMask (0xFFF) - - /* - * XkbUseCoreKbd is used to specify the core keyboard without having - * to look up its X input extension identifier. - * XkbUseCorePtr is used to specify the core pointer without having - * to look up its X input extension identifier. - * XkbDfltXIClass is used to specify "don't care" any place that the - * XKB protocol is looking for an X Input Extension - * device class. - * XkbDfltXIId is used to specify "don't care" any place that the - * XKB protocol is looking for an X Input Extension - * feedback identifier. - * XkbAllXIClasses is used to get information about all device indicators, - * whether they're part of the indicator feedback class - * or the keyboard feedback class. - * XkbAllXIIds is used to get information about all device indicator - * feedbacks without having to list them. - * XkbXINone is used to indicate that no class or id has been specified. - * XkbLegalXILedClass(c) True if 'c' specifies a legal class with LEDs - * XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells - * XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device - * XkbExplicitXIClass(c) True if 'c' explicitly specifies a device class - * XkbExplicitXIId(c) True if 'i' explicitly specifies a device id - * XkbSingleXIClass(c) True if 'c' specifies exactly one device class, - * including the default. - * XkbSingleXIId(i) True if 'i' specifies exactly one device - * identifier, including the default. - */ -#define XkbUseCoreKbd 0x0100 -#define XkbUseCorePtr 0x0200 -#define XkbDfltXIClass 0x0300 -#define XkbDfltXIId 0x0400 -#define XkbAllXIClasses 0x0500 -#define XkbAllXIIds 0x0600 -#define XkbXINone 0xff00 - -#define XkbLegalXILedClass(c) (((c)==KbdFeedbackClass)||\ - ((c)==LedFeedbackClass)||\ - ((c)==XkbDfltXIClass)||\ - ((c)==XkbAllXIClasses)) -#define XkbLegalXIBellClass(c) (((c)==KbdFeedbackClass)||\ - ((c)==BellFeedbackClass)||\ - ((c)==XkbDfltXIClass)||\ - ((c)==XkbAllXIClasses)) -#define XkbExplicitXIDevice(c) (((c)&(~0xff))==0) -#define XkbExplicitXIClass(c) (((c)&(~0xff))==0) -#define XkbExplicitXIId(c) (((c)&(~0xff))==0) -#define XkbSingleXIClass(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass)) -#define XkbSingleXIId(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIId)) - -#define XkbNoModifier 0xff -#define XkbNoShiftLevel 0xff -#define XkbNoShape 0xff -#define XkbNoIndicator 0xff - -#define XkbNoModifierMask 0 -#define XkbAllModifiersMask 0xff -#define XkbAllVirtualModsMask 0xffff - -#define XkbNumKbdGroups 4 -#define XkbMaxKbdGroup (XkbNumKbdGroups-1) - -#define XkbMaxMouseKeysBtn 4 - - /* - * Group Index and Mask: - * - Indices into the kt_index array of a key type. - * - Mask specifies types to be changed for XkbChangeTypesOfKey - */ -#define XkbGroup1Index 0 -#define XkbGroup2Index 1 -#define XkbGroup3Index 2 -#define XkbGroup4Index 3 -#define XkbAnyGroup 254 -#define XkbAllGroups 255 - -#define XkbGroup1Mask (1<<0) -#define XkbGroup2Mask (1<<1) -#define XkbGroup3Mask (1<<2) -#define XkbGroup4Mask (1<<3) -#define XkbAnyGroupMask (1<<7) -#define XkbAllGroupsMask (0xf) - - /* - * BuildCoreState: Given a keyboard group and a modifier state, - * construct the value to be reported an event. - * GroupForCoreState: Given the state reported in an event, - * determine the keyboard group. - * IsLegalGroup: Returns TRUE if 'g' is a valid group index. - */ -#define XkbBuildCoreState(m,g) ((((g)&0x3)<<13)|((m)&0xff)) -#define XkbGroupForCoreState(s) (((s)>>13)&0x3) -#define XkbIsLegalGroup(g) (((g)>=0)&&((g)type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods)) -#define XkbIsGroupAction(a) (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup)) -#define XkbIsPtrAction(a) (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt)) - - - /* - * Key Behavior Qualifier: - * KB_Permanent indicates that the behavior describes an unalterable - * characteristic of the keyboard, not an XKB software-simulation of - * the listed behavior. - * Key Behavior Types: - * Specifies the behavior of the underlying key. - */ -#define XkbKB_Permanent 0x80 -#define XkbKB_OpMask 0x7f - -#define XkbKB_Default 0x00 -#define XkbKB_Lock 0x01 -#define XkbKB_RadioGroup 0x02 -#define XkbKB_Overlay1 0x03 -#define XkbKB_Overlay2 0x04 - -#define XkbKB_RGAllowNone 0x80 - - /* - * Various macros which describe the range of legal keycodes. - */ -#define XkbMinLegalKeyCode 8 -#define XkbMaxLegalKeyCode 255 -#define XkbMaxKeyCount (XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1) -#define XkbPerKeyBitArraySize ((XkbMaxLegalKeyCode+1)/8) -/* Seems kinda silly to check that an unsigned char is <= 255... */ -#define XkbIsLegalKeycode(k) ((k)>=XkbMinLegalKeyCode) - - /* - * Assorted constants and limits. - */ -#define XkbNumModifiers 8 -#define XkbNumVirtualMods 16 -#define XkbNumIndicators 32 -#define XkbAllIndicatorsMask (0xffffffff) -#define XkbMaxRadioGroups 32 -#define XkbAllRadioGroupsMask (0xffffffff) -#define XkbMaxShiftLevel 63 -#define XkbMaxSymsPerKey (XkbMaxShiftLevel*XkbNumKbdGroups) -#define XkbRGMaxMembers 12 -#define XkbActionMessageLength 6 -#define XkbKeyNameLength 4 -#define XkbMaxRedirectCount 8 - -#define XkbGeomPtsPerMM 10 -#define XkbGeomMaxColors 32 -#define XkbGeomMaxLabelColors 3 -#define XkbGeomMaxPriority 255 - - /* - * Key Type index and mask for the four standard key types. - */ -#define XkbOneLevelIndex 0 -#define XkbTwoLevelIndex 1 -#define XkbAlphabeticIndex 2 -#define XkbKeypadIndex 3 -#define XkbLastRequiredType XkbKeypadIndex -#define XkbNumRequiredTypes (XkbLastRequiredType+1) -#define XkbMaxKeyTypes 255 - -#define XkbOneLevelMask (1<<0) -#define XkbTwoLevelMask (1<<1) -#define XkbAlphabeticMask (1<<2) -#define XkbKeypadMask (1<<3) -#define XkbAllRequiredTypes (0xf) - -#define XkbShiftLevel(n) ((n)-1) -#define XkbShiftLevelMask(n) (1<<((n)-1)) - - /* - * Extension name and version information - */ -#define XkbName "XKEYBOARD" -#define XkbMajorVersion 1 -#define XkbMinorVersion 0 - - /* - * Explicit map components: - * - Used in the 'explicit' field of an XkbServerMap. Specifies - * the keyboard components that should _not_ be updated automatically - * in response to core protocol keyboard mapping requests. - */ -#define XkbExplicitKeyTypesMask (0x0f) -#define XkbExplicitKeyType1Mask (1<<0) -#define XkbExplicitKeyType2Mask (1<<1) -#define XkbExplicitKeyType3Mask (1<<2) -#define XkbExplicitKeyType4Mask (1<<3) -#define XkbExplicitInterpretMask (1<<4) -#define XkbExplicitAutoRepeatMask (1<<5) -#define XkbExplicitBehaviorMask (1<<6) -#define XkbExplicitVModMapMask (1<<7) -#define XkbAllExplicitMask (0xff) - - /* - * Map components masks: - * Those in AllMapComponentsMask: - * - Specifies the individual fields to be loaded or changed for the - * GetMap and SetMap requests. - * Those in ClientInfoMask: - * - Specifies the components to be allocated by XkbAllocClientMap. - * Those in ServerInfoMask: - * - Specifies the components to be allocated by XkbAllocServerMap. - */ -#define XkbKeyTypesMask (1<<0) -#define XkbKeySymsMask (1<<1) -#define XkbModifierMapMask (1<<2) -#define XkbExplicitComponentsMask (1<<3) -#define XkbKeyActionsMask (1<<4) -#define XkbKeyBehaviorsMask (1<<5) -#define XkbVirtualModsMask (1<<6) -#define XkbVirtualModMapMask (1<<7) - -#define XkbAllClientInfoMask (XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask) -#define XkbAllServerInfoMask (XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask) -#define XkbAllMapComponentsMask (XkbAllClientInfoMask|XkbAllServerInfoMask) - - /* - * Symbol interpretations flags: - * - Used in the flags field of a symbol interpretation - */ -#define XkbSI_AutoRepeat (1<<0) -#define XkbSI_LockingKey (1<<1) - - /* - * Symbol interpretations match specification: - * - Used in the match field of a symbol interpretation to specify - * the conditions under which an interpretation is used. - */ -#define XkbSI_LevelOneOnly (0x80) -#define XkbSI_OpMask (0x7f) -#define XkbSI_NoneOf (0) -#define XkbSI_AnyOfOrNone (1) -#define XkbSI_AnyOf (2) -#define XkbSI_AllOf (3) -#define XkbSI_Exactly (4) - - /* - * Indicator map flags: - * - Used in the flags field of an indicator map to indicate the - * conditions under which and indicator can be changed and the - * effects of changing the indicator. - */ -#define XkbIM_NoExplicit (1L << 7) -#define XkbIM_NoAutomatic (1L << 6) -#define XkbIM_LEDDrivesKB (1L << 5) - - /* - * Indicator map component specifications: - * - Used by the 'which_groups' and 'which_mods' fields of an indicator - * map to specify which keyboard components should be used to drive - * the indicator. - */ -#define XkbIM_UseBase (1L << 0) -#define XkbIM_UseLatched (1L << 1) -#define XkbIM_UseLocked (1L << 2) -#define XkbIM_UseEffective (1L << 3) -#define XkbIM_UseCompat (1L << 4) - -#define XkbIM_UseNone 0 -#define XkbIM_UseAnyGroup (XkbIM_UseBase|XkbIM_UseLatched|XkbIM_UseLocked\ - |XkbIM_UseEffective) -#define XkbIM_UseAnyMods (XkbIM_UseAnyGroup|XkbIM_UseCompat) - - /* - * Compatibility Map Compontents: - * - Specifies the components to be allocated in XkbAllocCompatMap. - */ -#define XkbSymInterpMask (1<<0) -#define XkbGroupCompatMask (1<<1) -#define XkbAllCompatMask (0x3) - - /* - * Names component mask: - * - Specifies the names to be loaded or changed for the GetNames and - * SetNames requests. - * - Specifies the names that have changed in a NamesNotify event. - * - Specifies the names components to be allocated by XkbAllocNames. - */ -#define XkbKeycodesNameMask (1<<0) -#define XkbGeometryNameMask (1<<1) -#define XkbSymbolsNameMask (1<<2) -#define XkbPhysSymbolsNameMask (1<<3) -#define XkbTypesNameMask (1<<4) -#define XkbCompatNameMask (1<<5) -#define XkbKeyTypeNamesMask (1<<6) -#define XkbKTLevelNamesMask (1<<7) -#define XkbIndicatorNamesMask (1<<8) -#define XkbKeyNamesMask (1<<9) -#define XkbKeyAliasesMask (1<<10) -#define XkbVirtualModNamesMask (1<<11) -#define XkbGroupNamesMask (1<<12) -#define XkbRGNamesMask (1<<13) -#define XkbComponentNamesMask (0x3f) -#define XkbAllNamesMask (0x3fff) - - /* - * GetByName components: - * - Specifies desired or necessary components to GetKbdByName request. - * - Reports the components that were found in a GetKbdByNameReply - */ -#define XkbGBN_TypesMask (1L << 0) -#define XkbGBN_CompatMapMask (1L << 1) -#define XkbGBN_ClientSymbolsMask (1L << 2) -#define XkbGBN_ServerSymbolsMask (1L << 3) -#define XkbGBN_SymbolsMask (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask) -#define XkbGBN_IndicatorMapMask (1L << 4) -#define XkbGBN_KeyNamesMask (1L << 5) -#define XkbGBN_GeometryMask (1L << 6) -#define XkbGBN_OtherNamesMask (1L << 7) -#define XkbGBN_AllComponentsMask (0xff) - - /* - * ListComponents flags - */ -#define XkbLC_Hidden (1L << 0) -#define XkbLC_Default (1L << 1) -#define XkbLC_Partial (1L << 2) - -#define XkbLC_AlphanumericKeys (1L << 8) -#define XkbLC_ModifierKeys (1L << 9) -#define XkbLC_KeypadKeys (1L << 10) -#define XkbLC_FunctionKeys (1L << 11) -#define XkbLC_AlternateGroup (1L << 12) - - /* - * X Input Extension Interactions - * - Specifies the possible interactions between XKB and the X input - * extension - * - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo) - * XKB information about an extension device. - * - Reports the list of supported optional features in the reply to - * XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event. - * XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify - * events to indicate an attempt to use an unsupported feature. - */ -#define XkbXI_KeyboardsMask (1L << 0) -#define XkbXI_ButtonActionsMask (1L << 1) -#define XkbXI_IndicatorNamesMask (1L << 2) -#define XkbXI_IndicatorMapsMask (1L << 3) -#define XkbXI_IndicatorStateMask (1L << 4) -#define XkbXI_UnsupportedFeatureMask (1L << 15) -#define XkbXI_AllFeaturesMask (0x001f) -#define XkbXI_AllDeviceFeaturesMask (0x001e) - -#define XkbXI_IndicatorsMask (0x001c) -#define XkbAllExtensionDeviceEventsMask (0x801f) - - /* - * Per-Client Flags: - * - Specifies flags to be changed by the PerClientFlags request. - */ -#define XkbPCF_DetectableAutoRepeatMask (1L << 0) -#define XkbPCF_GrabsUseXKBStateMask (1L << 1) -#define XkbPCF_AutoResetControlsMask (1L << 2) -#define XkbPCF_LookupStateWhenGrabbed (1L << 3) -#define XkbPCF_SendEventUsesXKBState (1L << 4) -#define XkbPCF_AllFlagsMask (0x1F) - - /* - * Debugging flags and controls - */ -#define XkbDF_DisableLocks (1<<0) - -#endif /* _XKB_H_ */ diff --git a/openflow/usr/include/X11/extensions/XKBgeom.h b/openflow/usr/include/X11/extensions/XKBgeom.h deleted file mode 100644 index cef78fa..0000000 --- a/openflow/usr/include/X11/extensions/XKBgeom.h +++ /dev/null @@ -1,662 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -#ifndef _XKBGEOM_H_ -#define _XKBGEOM_H_ - -#include - -#ifdef XKB_IN_SERVER -#define XkbAddGeomKeyAlias SrvXkbAddGeomKeyAlias -#define XkbAddGeomColor SrvXkbAddGeomColor -#define XkbAddGeomDoodad SrvXkbAddGeomDoodad -#define XkbAddGeomKey SrvXkbAddGeomKey -#define XkbAddGeomOutline SrvXkbAddGeomOutline -#define XkbAddGeomOverlay SrvXkbAddGeomOverlay -#define XkbAddGeomOverlayRow SrvXkbAddGeomOverlayRow -#define XkbAddGeomOverlayKey SrvXkbAddGeomOverlayKey -#define XkbAddGeomProperty SrvXkbAddGeomProperty -#define XkbAddGeomRow SrvXkbAddGeomRow -#define XkbAddGeomSection SrvXkbAddGeomSection -#define XkbAddGeomShape SrvXkbAddGeomShape -#define XkbAllocGeomKeyAliases SrvXkbAllocGeomKeyAliases -#define XkbAllocGeomColors SrvXkbAllocGeomColors -#define XkbAllocGeomDoodads SrvXkbAllocGeomDoodads -#define XkbAllocGeomKeys SrvXkbAllocGeomKeys -#define XkbAllocGeomOutlines SrvXkbAllocGeomOutlines -#define XkbAllocGeomPoints SrvXkbAllocGeomPoints -#define XkbAllocGeomProps SrvXkbAllocGeomProps -#define XkbAllocGeomRows SrvXkbAllocGeomRows -#define XkbAllocGeomSectionDoodads SrvXkbAllocGeomSectionDoodads -#define XkbAllocGeomSections SrvXkbAllocGeomSections -#define XkbAllocGeomOverlays SrvXkbAllocGeomOverlays -#define XkbAllocGeomOverlayRows SrvXkbAllocGeomOverlayRows -#define XkbAllocGeomOverlayKeys SrvXkbAllocGeomOverlayKeys -#define XkbAllocGeomShapes SrvXkbAllocGeomShapes -#define XkbAllocGeometry SrvXkbAllocGeometry -#define XkbFreeGeomKeyAliases SrvXkbFreeGeomKeyAliases -#define XkbFreeGeomColors SrvXkbFreeGeomColors -#define XkbFreeGeomDoodads SrvXkbFreeGeomDoodads -#define XkbFreeGeomProperties SrvXkbFreeGeomProperties -#define XkbFreeGeomOverlayKeys SrvXkbFreeGeomOverlayKeys -#define XkbFreeGeomOverlayRows SrvXkbFreeGeomOverlayRows -#define XkbFreeGeomOverlays SrvXkbFreeGeomOverlays -#define XkbFreeGeomKeys SrvXkbFreeGeomKeys -#define XkbFreeGeomRows SrvXkbFreeGeomRows -#define XkbFreeGeomSections SrvXkbFreeGeomSections -#define XkbFreeGeomPoints SrvXkbFreeGeomPoints -#define XkbFreeGeomOutlines SrvXkbFreeGeomOutlines -#define XkbFreeGeomShapes SrvXkbFreeGeomShapes -#define XkbFreeGeometry SrvXkbFreeGeometry -#endif - -typedef struct _XkbProperty { - char *name; - char *value; -} XkbPropertyRec,*XkbPropertyPtr; - -typedef struct _XkbColor { - unsigned int pixel; - char * spec; -} XkbColorRec,*XkbColorPtr; - -typedef struct _XkbPoint { - short x; - short y; -} XkbPointRec, *XkbPointPtr; - -typedef struct _XkbBounds { - short x1,y1; - short x2,y2; -} XkbBoundsRec, *XkbBoundsPtr; -#define XkbBoundsWidth(b) (((b)->x2)-((b)->x1)) -#define XkbBoundsHeight(b) (((b)->y2)-((b)->y1)) - -/* - * In the following structs, this pattern is used for dynamically sized arrays: - * foo is an array for which sz_foo entries are allocated & num_foo are used - */ - -typedef struct _XkbOutline { - unsigned short num_points; - unsigned short sz_points; - unsigned short corner_radius; - XkbPointPtr points; -} XkbOutlineRec, *XkbOutlinePtr; - -typedef struct _XkbShape { - Atom name; - unsigned short num_outlines; - unsigned short sz_outlines; - XkbOutlinePtr outlines; - XkbOutlinePtr approx; - XkbOutlinePtr primary; - XkbBoundsRec bounds; -} XkbShapeRec, *XkbShapePtr; -#define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0])) - -typedef struct _XkbShapeDoodad { - Atom name; - unsigned char type; - unsigned char priority; - short top; - short left; - short angle; - unsigned short color_ndx; - unsigned short shape_ndx; -} XkbShapeDoodadRec, *XkbShapeDoodadPtr; -#define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) -#define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) -#define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) -#define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) - -typedef struct _XkbTextDoodad { - Atom name; - unsigned char type; - unsigned char priority; - short top; - short left; - short angle; - short width; - short height; - unsigned short color_ndx; - char * text; - char * font; -} XkbTextDoodadRec, *XkbTextDoodadPtr; -#define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) -#define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) - -typedef struct _XkbIndicatorDoodad { - Atom name; - unsigned char type; - unsigned char priority; - short top; - short left; - short angle; - unsigned short shape_ndx; - unsigned short on_color_ndx; - unsigned short off_color_ndx; -} XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr; -#define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) -#define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx]) -#define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx]) -#define XkbSetIndicatorDoodadOnColor(g,d,c) \ - ((d)->on_color_ndx= (c)-&(g)->colors[0]) -#define XkbSetIndicatorDoodadOffColor(g,d,c) \ - ((d)->off_color_ndx= (c)-&(g)->colors[0]) -#define XkbSetIndicatorDoodadShape(g,d,s) \ - ((d)->shape_ndx= (s)-&(g)->shapes[0]) - -typedef struct _XkbLogoDoodad { - Atom name; - unsigned char type; - unsigned char priority; - short top; - short left; - short angle; - unsigned short color_ndx; - unsigned short shape_ndx; - char * logo_name; -} XkbLogoDoodadRec, *XkbLogoDoodadPtr; -#define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) -#define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) -#define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) -#define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) - -typedef struct _XkbAnyDoodad { - Atom name; - unsigned char type; - unsigned char priority; - short top; - short left; - short angle; -} XkbAnyDoodadRec, *XkbAnyDoodadPtr; - -typedef union _XkbDoodad { - XkbAnyDoodadRec any; - XkbShapeDoodadRec shape; - XkbTextDoodadRec text; - XkbIndicatorDoodadRec indicator; - XkbLogoDoodadRec logo; -} XkbDoodadRec, *XkbDoodadPtr; - -#define XkbUnknownDoodad 0 -#define XkbOutlineDoodad 1 -#define XkbSolidDoodad 2 -#define XkbTextDoodad 3 -#define XkbIndicatorDoodad 4 -#define XkbLogoDoodad 5 - -typedef struct _XkbKey { - XkbKeyNameRec name; - short gap; - unsigned char shape_ndx; - unsigned char color_ndx; -} XkbKeyRec, *XkbKeyPtr; -#define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx]) -#define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx]) -#define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0]) -#define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0]) - -typedef struct _XkbRow { - short top; - short left; - unsigned short num_keys; - unsigned short sz_keys; - int vertical; - XkbKeyPtr keys; - XkbBoundsRec bounds; -} XkbRowRec, *XkbRowPtr; - -typedef struct _XkbSection { - Atom name; - unsigned char priority; - short top; - short left; - unsigned short width; - unsigned short height; - short angle; - unsigned short num_rows; - unsigned short num_doodads; - unsigned short num_overlays; - unsigned short sz_rows; - unsigned short sz_doodads; - unsigned short sz_overlays; - XkbRowPtr rows; - XkbDoodadPtr doodads; - XkbBoundsRec bounds; - struct _XkbOverlay *overlays; -} XkbSectionRec, *XkbSectionPtr; - -typedef struct _XkbOverlayKey { - XkbKeyNameRec over; - XkbKeyNameRec under; -} XkbOverlayKeyRec,*XkbOverlayKeyPtr; - -typedef struct _XkbOverlayRow { - unsigned short row_under; - unsigned short num_keys; - unsigned short sz_keys; - XkbOverlayKeyPtr keys; -} XkbOverlayRowRec,*XkbOverlayRowPtr; - -typedef struct _XkbOverlay { - Atom name; - XkbSectionPtr section_under; - unsigned short num_rows; - unsigned short sz_rows; - XkbOverlayRowPtr rows; - XkbBoundsPtr bounds; -} XkbOverlayRec,*XkbOverlayPtr; - -typedef struct _XkbGeometry { - Atom name; - unsigned short width_mm; - unsigned short height_mm; - char * label_font; - XkbColorPtr label_color; - XkbColorPtr base_color; - unsigned short sz_properties; - unsigned short sz_colors; - unsigned short sz_shapes; - unsigned short sz_sections; - unsigned short sz_doodads; - unsigned short sz_key_aliases; - unsigned short num_properties; - unsigned short num_colors; - unsigned short num_shapes; - unsigned short num_sections; - unsigned short num_doodads; - unsigned short num_key_aliases; - XkbPropertyPtr properties; - XkbColorPtr colors; - XkbShapePtr shapes; - XkbSectionPtr sections; - XkbDoodadPtr doodads; - XkbKeyAliasPtr key_aliases; -} XkbGeometryRec; -#define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0])) - -#define XkbGeomPropertiesMask (1<<0) -#define XkbGeomColorsMask (1<<1) -#define XkbGeomShapesMask (1<<2) -#define XkbGeomSectionsMask (1<<3) -#define XkbGeomDoodadsMask (1<<4) -#define XkbGeomKeyAliasesMask (1<<5) -#define XkbGeomAllMask (0x3f) - -typedef struct _XkbGeometrySizes { - unsigned int which; - unsigned short num_properties; - unsigned short num_colors; - unsigned short num_shapes; - unsigned short num_sections; - unsigned short num_doodads; - unsigned short num_key_aliases; -} XkbGeometrySizesRec,*XkbGeometrySizesPtr; - -_XFUNCPROTOBEGIN - -extern XkbPropertyPtr -XkbAddGeomProperty( - XkbGeometryPtr /* geom */, - char * /* name */, - char * /* value */ -); - -extern XkbKeyAliasPtr -XkbAddGeomKeyAlias( - XkbGeometryPtr /* geom */, - char * /* alias */, - char * /* real */ -); - -extern XkbColorPtr -XkbAddGeomColor( - XkbGeometryPtr /* geom */, - char * /* spec */, - unsigned int /* pixel */ -); - -extern XkbOutlinePtr -XkbAddGeomOutline( - XkbShapePtr /* shape */, - int /* sz_points */ -); - -extern XkbShapePtr -XkbAddGeomShape( - XkbGeometryPtr /* geom */, - Atom /* name */, - int /* sz_outlines */ -); - -extern XkbKeyPtr -XkbAddGeomKey( - XkbRowPtr /* row */ -); - -extern XkbRowPtr -XkbAddGeomRow( - XkbSectionPtr /* section */, - int /* sz_keys */ -); - -extern XkbSectionPtr -XkbAddGeomSection( - XkbGeometryPtr /* geom */, - Atom /* name */, - int /* sz_rows */, - int /* sz_doodads */, - int /* sz_overlays */ -); - -extern XkbOverlayPtr -XkbAddGeomOverlay( - XkbSectionPtr /* section */, - Atom /* name */, - int /* sz_rows */ -); - -extern XkbOverlayRowPtr -XkbAddGeomOverlayRow( - XkbOverlayPtr /* overlay */, - int /* row_under */, - int /* sz_keys */ -); - -extern XkbOverlayKeyPtr -XkbAddGeomOverlayKey( - XkbOverlayPtr /* overlay */, - XkbOverlayRowPtr /* row */, - char * /* over */, - char * /* under */ -); - -extern XkbDoodadPtr -XkbAddGeomDoodad( - XkbGeometryPtr /* geom */, - XkbSectionPtr /* section */, - Atom /* name */ -); - - -extern void -XkbFreeGeomKeyAliases( - XkbGeometryPtr /* geom */, - int /* first */, - int /* count */, - Bool /* freeAll */ -); - -extern void -XkbFreeGeomColors( - XkbGeometryPtr /* geom */, - int /* first */, - int /* count */, - Bool /* freeAll */ -); - -extern void -XkbFreeGeomDoodads( - XkbDoodadPtr /* doodads */, - int /* nDoodads */, - Bool /* freeAll */ -); - - -extern void -XkbFreeGeomProperties( - XkbGeometryPtr /* geom */, - int /* first */, - int /* count */, - Bool /* freeAll */ -); - -extern void -XkbFreeGeomOverlayKeys( - XkbOverlayRowPtr /* row */, - int /* first */, - int /* count */, - Bool /* freeAll */ -); - -extern void -XkbFreeGeomOverlayRows( - XkbOverlayPtr /* overlay */, - int /* first */, - int /* count */, - Bool /* freeAll */ -); - -extern void -XkbFreeGeomOverlays( - XkbSectionPtr /* section */, - int /* first */, - int /* count */, - Bool /* freeAll */ -); - -extern void -XkbFreeGeomKeys( - XkbRowPtr /* row */, - int /* first */, - int /* count */, - Bool /* freeAll */ -); - -extern void -XkbFreeGeomRows( - XkbSectionPtr /* section */, - int /* first */, - int /* count */, - Bool /* freeAll */ -); - -extern void -XkbFreeGeomSections( - XkbGeometryPtr /* geom */, - int /* first */, - int /* count */, - Bool /* freeAll */ -); - - -extern void -XkbFreeGeomPoints( - XkbOutlinePtr /* outline */, - int /* first */, - int /* count */, - Bool /* freeAll */ -); - -extern void -XkbFreeGeomOutlines( - XkbShapePtr /* shape */, - int /* first */, - int /* count */, - Bool /* freeAll */ -); - -extern void -XkbFreeGeomShapes( - XkbGeometryPtr /* geom */, - int /* first */, - int /* count */, - Bool /* freeAll */ -); - -extern void -XkbFreeGeometry( - XkbGeometryPtr /* geom */, - unsigned int /* which */, - Bool /* freeMap */ -); - -extern Status -XkbAllocGeomProps( - XkbGeometryPtr /* geom */, - int /* nProps */ -); - -extern Status -XkbAllocGeomKeyAliases( - XkbGeometryPtr /* geom */, - int /* nAliases */ -); - -extern Status -XkbAllocGeomColors( - XkbGeometryPtr /* geom */, - int /* nColors */ -); - -extern Status -XkbAllocGeomShapes( - XkbGeometryPtr /* geom */, - int /* nShapes */ -); - -extern Status -XkbAllocGeomSections( - XkbGeometryPtr /* geom */, - int /* nSections */ -); - -extern Status -XkbAllocGeomOverlays( - XkbSectionPtr /* section */, - int /* num_needed */ -); - -extern Status -XkbAllocGeomOverlayRows( - XkbOverlayPtr /* overlay */, - int /* num_needed */ -); - -extern Status -XkbAllocGeomOverlayKeys( - XkbOverlayRowPtr /* row */, - int /* num_needed */ -); - -extern Status -XkbAllocGeomDoodads( - XkbGeometryPtr /* geom */, - int /* nDoodads */ -); - -extern Status -XkbAllocGeomSectionDoodads( - XkbSectionPtr /* section */, - int /* nDoodads */ -); - -extern Status -XkbAllocGeomOutlines( - XkbShapePtr /* shape */, - int /* nOL */ -); - -extern Status -XkbAllocGeomRows( - XkbSectionPtr /* section */, - int /* nRows */ -); - -extern Status -XkbAllocGeomPoints( - XkbOutlinePtr /* ol */, - int /* nPts */ -); - -extern Status -XkbAllocGeomKeys( - XkbRowPtr /* row */, - int /* nKeys */ -); - -extern Status -XkbAllocGeometry( - XkbDescPtr /* xkb */, - XkbGeometrySizesPtr /* sizes */ -); - -extern Status -XkbSetGeometry( - Display * /* dpy */, - unsigned /* deviceSpec */, - XkbGeometryPtr /* geom */ -); - -extern Bool -XkbComputeShapeTop( - XkbShapePtr /* shape */, - XkbBoundsPtr /* bounds */ -); - -extern Bool -XkbComputeShapeBounds( - XkbShapePtr /* shape */ -); - -extern Bool -XkbComputeRowBounds( - XkbGeometryPtr /* geom */, - XkbSectionPtr /* section */, - XkbRowPtr /* row */ -); - -extern Bool -XkbComputeSectionBounds( - XkbGeometryPtr /* geom */, - XkbSectionPtr /* section */ -); - -extern char * -XkbFindOverlayForKey( - XkbGeometryPtr /* geom */, - XkbSectionPtr /* wanted */, - char * /* under */ -); - -extern Status -XkbGetGeometry( - Display * /* dpy */, - XkbDescPtr /* xkb */ -); - -extern Status -XkbGetNamedGeometry( - Display * /* dpy */, - XkbDescPtr /* xkb */, - Atom /* name */ -); - -_XFUNCPROTOEND - -#endif /* _XKBSTR_H_ */ diff --git a/openflow/usr/include/X11/extensions/XKBproto.h b/openflow/usr/include/X11/extensions/XKBproto.h deleted file mode 100644 index b867659..0000000 --- a/openflow/usr/include/X11/extensions/XKBproto.h +++ /dev/null @@ -1,1281 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -#ifndef _XKBPROTO_H_ -#define _XKBPROTO_H_ - -#include -#include - -#define Window CARD32 -#define Atom CARD32 -#define Time CARD32 -#define KeyCode CARD8 -#define KeySym CARD32 - -#define XkbPaddedSize(n) ((((unsigned int)(n)+3) >> 2) << 2) - -typedef struct _xkbUseExtension { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBUseExtension */ - CARD16 length B16; - CARD16 wantedMajor B16; - CARD16 wantedMinor B16; -} xkbUseExtensionReq; -#define sz_xkbUseExtensionReq 8 - -typedef struct _xkbUseExtensionReply { - BYTE type; /* X_Reply */ - BOOL supported; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 serverMajor B16; - CARD16 serverMinor B16; - CARD32 pad1 B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; -} xkbUseExtensionReply; -#define sz_xkbUseExtensionReply 32 - -typedef struct _xkbSelectEvents { - CARD8 reqType; - CARD8 xkbReqType; /* X_KBSelectEvents */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 affectWhich B16; - CARD16 clear B16; - CARD16 selectAll B16; - CARD16 affectMap B16; - CARD16 map B16; -} xkbSelectEventsReq; -#define sz_xkbSelectEventsReq 16 - -typedef struct _xkbBell { - CARD8 reqType; - CARD8 xkbReqType; /* X_KBBell */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 bellClass B16; - CARD16 bellID B16; - INT8 percent; - BOOL forceSound; - BOOL eventOnly; - CARD8 pad1; - INT16 pitch B16; - INT16 duration B16; - CARD16 pad2 B16; - Atom name B32; - Window window B32; -} xkbBellReq; -#define sz_xkbBellReq 28 - -typedef struct _xkbGetState { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBGetState */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 pad B16; -} xkbGetStateReq; -#define sz_xkbGetStateReq 8 - -typedef struct _xkbGetStateReply { - BYTE type; - BYTE deviceID; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 mods; - CARD8 baseMods; - CARD8 latchedMods; - CARD8 lockedMods; - CARD8 group; - CARD8 lockedGroup; - INT16 baseGroup B16; - INT16 latchedGroup B16; - CARD8 compatState; - CARD8 grabMods; - CARD8 compatGrabMods; - CARD8 lookupMods; - CARD8 compatLookupMods; - CARD8 pad1; - CARD16 ptrBtnState B16; - CARD16 pad2 B16; - CARD32 pad3 B32; -} xkbGetStateReply; -#define sz_xkbGetStateReply 32 - -typedef struct _xkbLatchLockState { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBLatchLockState */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD8 affectModLocks; - CARD8 modLocks; - BOOL lockGroup; - CARD8 groupLock; - CARD8 affectModLatches; - CARD8 modLatches; - CARD8 pad; - BOOL latchGroup; - INT16 groupLatch B16; -} xkbLatchLockStateReq; -#define sz_xkbLatchLockStateReq 16 - -typedef struct _xkbGetControls { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBGetControls */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 pad B16; -} xkbGetControlsReq; -#define sz_xkbGetControlsReq 8 - -typedef struct _xkbGetControlsReply { - BYTE type; /* X_Reply */ - CARD8 deviceID; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 mkDfltBtn; - CARD8 numGroups; - CARD8 groupsWrap; - CARD8 internalMods; - CARD8 ignoreLockMods; - CARD8 internalRealMods; - CARD8 ignoreLockRealMods; - CARD8 pad1; - CARD16 internalVMods B16; - CARD16 ignoreLockVMods B16; - CARD16 repeatDelay B16; - CARD16 repeatInterval B16; - CARD16 slowKeysDelay B16; - CARD16 debounceDelay B16; - CARD16 mkDelay B16; - CARD16 mkInterval B16; - CARD16 mkTimeToMax B16; - CARD16 mkMaxSpeed B16; - INT16 mkCurve B16; - CARD16 axOptions B16; - CARD16 axTimeout B16; - CARD16 axtOptsMask B16; - CARD16 axtOptsValues B16; - CARD16 pad2 B16; - CARD32 axtCtrlsMask B32; - CARD32 axtCtrlsValues B32; - CARD32 enabledCtrls B32; - BYTE perKeyRepeat[XkbPerKeyBitArraySize]; -} xkbGetControlsReply; -#define sz_xkbGetControlsReply 92 - -typedef struct _xkbSetControls { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBSetControls */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD8 affectInternalMods; - CARD8 internalMods; - CARD8 affectIgnoreLockMods; - CARD8 ignoreLockMods; - CARD16 affectInternalVMods B16; - CARD16 internalVMods B16; - CARD16 affectIgnoreLockVMods B16; - CARD16 ignoreLockVMods B16; - CARD8 mkDfltBtn; - CARD8 groupsWrap; - CARD16 axOptions B16; - CARD16 pad1 B16; - CARD32 affectEnabledCtrls B32; - CARD32 enabledCtrls B32; - CARD32 changeCtrls B32; - CARD16 repeatDelay B16; - CARD16 repeatInterval B16; - CARD16 slowKeysDelay B16; - CARD16 debounceDelay B16; - CARD16 mkDelay B16; - CARD16 mkInterval B16; - CARD16 mkTimeToMax B16; - CARD16 mkMaxSpeed B16; - INT16 mkCurve B16; - CARD16 axTimeout B16; - CARD32 axtCtrlsMask B32; - CARD32 axtCtrlsValues B32; - CARD16 axtOptsMask B16; - CARD16 axtOptsValues B16; - BYTE perKeyRepeat[XkbPerKeyBitArraySize]; -} xkbSetControlsReq; -#define sz_xkbSetControlsReq 100 - -typedef struct _xkbKTMapEntryWireDesc { - BOOL active; - CARD8 mask; - CARD8 level; - CARD8 realMods; - CARD16 virtualMods B16; - CARD16 pad B16; -} xkbKTMapEntryWireDesc; -#define sz_xkbKTMapEntryWireDesc 8 - -typedef struct _xkbKTSetMapEntryWireDesc { - CARD8 level; - CARD8 realMods; - CARD16 virtualMods B16; -} xkbKTSetMapEntryWireDesc; -#define sz_xkbKTSetMapEntryWireDesc 4 - -typedef struct _xkbModsWireDesc { - CARD8 mask; /* GetMap only */ - CARD8 realMods; - CARD16 virtualMods B16; -} xkbModsWireDesc; -#define sz_xkbModsWireDesc 4 - -typedef struct _xkbKeyTypeWireDesc { - CARD8 mask; - CARD8 realMods; - CARD16 virtualMods B16; - CARD8 numLevels; - CARD8 nMapEntries; - BOOL preserve; - CARD8 pad; -} xkbKeyTypeWireDesc; -#define sz_xkbKeyTypeWireDesc 8 - -typedef struct _xkbSymMapWireDesc { - CARD8 ktIndex[XkbNumKbdGroups]; - CARD8 groupInfo; - CARD8 width; - CARD16 nSyms B16; -} xkbSymMapWireDesc; -#define sz_xkbSymMapWireDesc 8 - -typedef struct _xkbVModMapWireDesc { - KeyCode key; - CARD8 pad; - CARD16 vmods B16; -} xkbVModMapWireDesc; -#define sz_xkbVModMapWireDesc 4 - -typedef struct _xkbBehaviorWireDesc { - CARD8 key; - CARD8 type; - CARD8 data; - CARD8 pad; -} xkbBehaviorWireDesc; -#define sz_xkbBehaviorWireDesc 4 - -typedef struct _xkbActionWireDesc { - CARD8 type; - CARD8 data[7]; -} xkbActionWireDesc; -#define sz_xkbActionWireDesc 8 - -typedef struct _xkbGetMap { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBGetMap */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 full B16; - CARD16 partial B16; - CARD8 firstType; - CARD8 nTypes; - KeyCode firstKeySym; - CARD8 nKeySyms; - KeyCode firstKeyAct; - CARD8 nKeyActs; - KeyCode firstKeyBehavior; - CARD8 nKeyBehaviors; - CARD16 virtualMods B16; - KeyCode firstKeyExplicit; - CARD8 nKeyExplicit; - KeyCode firstModMapKey; - CARD8 nModMapKeys; - KeyCode firstVModMapKey; - CARD8 nVModMapKeys; - CARD16 pad1 B16; -} xkbGetMapReq; -#define sz_xkbGetMapReq 28 - -typedef struct _xkbGetMapReply { - CARD8 type; /* always X_Reply */ - CARD8 deviceID; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 pad1 B16; - KeyCode minKeyCode; - KeyCode maxKeyCode; - CARD16 present B16; - CARD8 firstType; - CARD8 nTypes; - CARD8 totalTypes; - KeyCode firstKeySym; - CARD16 totalSyms B16; - CARD8 nKeySyms; - KeyCode firstKeyAct; - CARD16 totalActs B16; - CARD8 nKeyActs; - KeyCode firstKeyBehavior; - CARD8 nKeyBehaviors; - CARD8 totalKeyBehaviors; - KeyCode firstKeyExplicit; - CARD8 nKeyExplicit; - CARD8 totalKeyExplicit; - KeyCode firstModMapKey; - CARD8 nModMapKeys; - CARD8 totalModMapKeys; - KeyCode firstVModMapKey; - CARD8 nVModMapKeys; - CARD8 totalVModMapKeys; - CARD8 pad2; - CARD16 virtualMods B16; -} xkbGetMapReply; -#define sz_xkbGetMapReply 40 - -#define XkbSetMapResizeTypes (1L<<0) -#define XkbSetMapRecomputeActions (1L<<1) -#define XkbSetMapAllFlags (0x3) - -typedef struct _xkbSetMap { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBSetMap */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 present B16; - CARD16 flags B16; - KeyCode minKeyCode; - KeyCode maxKeyCode; - CARD8 firstType; - CARD8 nTypes; - KeyCode firstKeySym; - CARD8 nKeySyms; - CARD16 totalSyms B16; - KeyCode firstKeyAct; - CARD8 nKeyActs; - CARD16 totalActs B16; - KeyCode firstKeyBehavior; - CARD8 nKeyBehaviors; - CARD8 totalKeyBehaviors; - KeyCode firstKeyExplicit; - CARD8 nKeyExplicit; - CARD8 totalKeyExplicit; - KeyCode firstModMapKey; - CARD8 nModMapKeys; - CARD8 totalModMapKeys; - KeyCode firstVModMapKey; - CARD8 nVModMapKeys; - CARD8 totalVModMapKeys; - CARD16 virtualMods B16; -} xkbSetMapReq; -#define sz_xkbSetMapReq 36 - -typedef struct _xkbSymInterpretWireDesc { - CARD32 sym B32; - CARD8 mods; - CARD8 match; - CARD8 virtualMod; - CARD8 flags; - xkbActionWireDesc act; -} xkbSymInterpretWireDesc; -#define sz_xkbSymInterpretWireDesc 16 - -typedef struct _xkbGetCompatMap { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBGetCompatMap */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD8 groups; - BOOL getAllSI; - CARD16 firstSI B16; - CARD16 nSI B16; -} xkbGetCompatMapReq; -#define sz_xkbGetCompatMapReq 12 - -typedef struct _xkbGetCompatMapReply { - CARD8 type; /* always X_Reply */ - CARD8 deviceID; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD8 groups; - CARD8 pad1; - CARD16 firstSI B16; - CARD16 nSI B16; - CARD16 nTotalSI B16; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; -} xkbGetCompatMapReply; -#define sz_xkbGetCompatMapReply 32 - -typedef struct _xkbSetCompatMap { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBSetCompatMap */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD8 pad1; - BOOL recomputeActions; - BOOL truncateSI; - CARD8 groups; - CARD16 firstSI B16; - CARD16 nSI B16; - CARD16 pad2 B16; -} xkbSetCompatMapReq; -#define sz_xkbSetCompatMapReq 16 - -typedef struct _xkbGetIndicatorState { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBGetIndicatorState */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 pad1 B16; -} xkbGetIndicatorStateReq; -#define sz_xkbGetIndicatorStateReq 8 - -typedef struct _xkbGetIndicatorStateReply { - CARD8 type; /* always X_Reply */ - CARD8 deviceID; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 state B32; - CARD32 pad1 B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; -} xkbGetIndicatorStateReply; -#define sz_xkbGetIndicatorStateReply 32 - -typedef struct _xkbGetIndicatorMap { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBGetIndicatorMap */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 pad B16; - CARD32 which B32; -} xkbGetIndicatorMapReq; -#define sz_xkbGetIndicatorMapReq 12 - -typedef struct _xkbGetIndicatorMapReply { - CARD8 type; /* always X_Reply */ - CARD8 deviceID; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 which B32; - CARD32 realIndicators B32; - CARD8 nIndicators; - CARD8 pad1; - CARD16 pad2 B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; -} xkbGetIndicatorMapReply; -#define sz_xkbGetIndicatorMapReply 32 - -typedef struct _xkbIndicatorMapWireDesc { - CARD8 flags; - CARD8 whichGroups; - CARD8 groups; - CARD8 whichMods; - CARD8 mods; - CARD8 realMods; - CARD16 virtualMods B16; - CARD32 ctrls B32; -} xkbIndicatorMapWireDesc; -#define sz_xkbIndicatorMapWireDesc 12 - -typedef struct _xkbSetIndicatorMap { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBSetIndicatorMap */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 pad1 B16; - CARD32 which B32; -} xkbSetIndicatorMapReq; -#define sz_xkbSetIndicatorMapReq 12 - -typedef struct _xkbGetNamedIndicator { - CARD8 reqType; - CARD8 xkbReqType; /* X_KBGetNamedIndicator */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 ledClass B16; - CARD16 ledID B16; - CARD16 pad1 B16; - Atom indicator B32; -} xkbGetNamedIndicatorReq; -#define sz_xkbGetNamedIndicatorReq 16 - -typedef struct _xkbGetNamedIndicatorReply { - BYTE type; - BYTE deviceID; - CARD16 sequenceNumber B16; - CARD32 length B32; - Atom indicator B32; - BOOL found; - BOOL on; - BOOL realIndicator; - CARD8 ndx; - CARD8 flags; - CARD8 whichGroups; - CARD8 groups; - CARD8 whichMods; - CARD8 mods; - CARD8 realMods; - CARD16 virtualMods B16; - CARD32 ctrls B32; - BOOL supported; - CARD8 pad1; - CARD16 pad2 B16; -} xkbGetNamedIndicatorReply; -#define sz_xkbGetNamedIndicatorReply 32 - -typedef struct _xkbSetNamedIndicator { - CARD8 reqType; - CARD8 xkbReqType; /* X_KBSetNamedIndicator */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 ledClass B16; - CARD16 ledID B16; - CARD16 pad1 B16; - Atom indicator B32; - BOOL setState; - BOOL on; - BOOL setMap; - BOOL createMap; - CARD8 pad2; - CARD8 flags; - CARD8 whichGroups; - CARD8 groups; - CARD8 whichMods; - CARD8 realMods; - CARD16 virtualMods B16; - CARD32 ctrls B32; -} xkbSetNamedIndicatorReq; -#define sz_xkbSetNamedIndicatorReq 32 - -typedef struct _xkbGetNames { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBGetNames */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 pad B16; - CARD32 which B32; -} xkbGetNamesReq; -#define sz_xkbGetNamesReq 12 - -typedef struct _xkbGetNamesReply { - BYTE type; - BYTE deviceID; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 which B32; - KeyCode minKeyCode; - KeyCode maxKeyCode; - CARD8 nTypes; - CARD8 groupNames; - CARD16 virtualMods B16; - KeyCode firstKey; - CARD8 nKeys; - CARD32 indicators B32; - CARD8 nRadioGroups; - CARD8 nKeyAliases; - CARD16 nKTLevels B16; - CARD32 pad3 B32; -} xkbGetNamesReply; -#define sz_xkbGetNamesReply 32 - -typedef struct _xkbSetNames { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBSetNames */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 virtualMods B16; - CARD32 which B32; - CARD8 firstType; - CARD8 nTypes; - CARD8 firstKTLevel; - CARD8 nKTLevels; - CARD32 indicators B32; - CARD8 groupNames; - CARD8 nRadioGroups; - KeyCode firstKey; - CARD8 nKeys; - CARD8 nKeyAliases; - CARD8 pad1; - CARD16 totalKTLevelNames B16; -} xkbSetNamesReq; -#define sz_xkbSetNamesReq 28 - -typedef struct _xkbPointWireDesc { - INT16 x B16; - INT16 y B16; -} xkbPointWireDesc; -#define sz_xkbPointWireDesc 4 - -typedef struct _xkbOutlineWireDesc { - CARD8 nPoints; - CARD8 cornerRadius; - CARD16 pad B16; -} xkbOutlineWireDesc; -#define sz_xkbOutlineWireDesc 4 - -typedef struct _xkbShapeWireDesc { - Atom name B32; - CARD8 nOutlines; - CARD8 primaryNdx; - CARD8 approxNdx; - CARD8 pad; -} xkbShapeWireDesc; -#define sz_xkbShapeWireDesc 8 - -typedef struct _xkbSectionWireDesc { - Atom name B32; - INT16 top B16; - INT16 left B16; - CARD16 width B16; - CARD16 height B16; - INT16 angle B16; - CARD8 priority; - CARD8 nRows; - CARD8 nDoodads; - CARD8 nOverlays; - CARD16 pad B16; -} xkbSectionWireDesc; -#define sz_xkbSectionWireDesc 20 - -typedef struct _xkbRowWireDesc { - INT16 top B16; - INT16 left B16; - CARD8 nKeys; - BOOL vertical; - CARD16 pad B16; -} xkbRowWireDesc; -#define sz_xkbRowWireDesc 8 - -typedef struct _xkbKeyWireDesc { - CARD8 name[XkbKeyNameLength]; - INT16 gap B16; - CARD8 shapeNdx; - CARD8 colorNdx; -} xkbKeyWireDesc; -#define sz_xkbKeyWireDesc 8 - -typedef struct _xkbOverlayWireDesc { - Atom name B32; - CARD8 nRows; - CARD8 pad1; - CARD16 pad2 B16; -} xkbOverlayWireDesc; -#define sz_xkbOverlayWireDesc 8 - -typedef struct _xkbOverlayRowWireDesc { - CARD8 rowUnder; - CARD8 nKeys; - CARD16 pad1 B16; -} xkbOverlayRowWireDesc; -#define sz_xkbOverlayRowWireDesc 4 - -typedef struct _xkbOverlayKeyWireDesc { - CARD8 over[XkbKeyNameLength]; - CARD8 under[XkbKeyNameLength]; -} xkbOverlayKeyWireDesc; -#define sz_xkbOverlayKeyWireDesc 8 - -typedef struct _xkbShapeDoodadWireDesc { - Atom name B32; - CARD8 type; - CARD8 priority; - INT16 top B16; - INT16 left B16; - INT16 angle B16; - CARD8 colorNdx; - CARD8 shapeNdx; - CARD16 pad1 B16; - CARD32 pad2 B32; -} xkbShapeDoodadWireDesc; -#define sz_xkbShapeDoodadWireDesc 20 - -typedef struct _xkbTextDoodadWireDesc { - Atom name B32; - CARD8 type; - CARD8 priority; - INT16 top B16; - INT16 left B16; - INT16 angle B16; - CARD16 width B16; - CARD16 height B16; - CARD8 colorNdx; - CARD8 pad1; - CARD16 pad2 B16; -} xkbTextDoodadWireDesc; -#define sz_xkbTextDoodadWireDesc 20 - -typedef struct _xkbIndicatorDoodadWireDesc { - Atom name B32; - CARD8 type; - CARD8 priority; - INT16 top B16; - INT16 left B16; - INT16 angle B16; - CARD8 shapeNdx; - CARD8 onColorNdx; - CARD8 offColorNdx; - CARD8 pad1; - CARD32 pad2 B32; -} xkbIndicatorDoodadWireDesc; -#define sz_xkbIndicatorDoodadWireDesc 20 - -typedef struct _xkbLogoDoodadWireDesc { - Atom name B32; - CARD8 type; - CARD8 priority; - INT16 top B16; - INT16 left B16; - INT16 angle B16; - CARD8 colorNdx; - CARD8 shapeNdx; - CARD16 pad1 B16; - CARD32 pad2 B32; -} xkbLogoDoodadWireDesc; -#define sz_xkbLogoDoodadWireDesc 20 - -typedef struct _xkbAnyDoodadWireDesc { - Atom name B32; - CARD8 type; - CARD8 priority; - INT16 top B16; - INT16 left B16; - INT16 angle B16; - CARD32 pad2 B32; - CARD32 pad3 B32; -} xkbAnyDoodadWireDesc; -#define sz_xkbAnyDoodadWireDesc 20 - -typedef union _xkbDoodadWireDesc { - xkbAnyDoodadWireDesc any; - xkbShapeDoodadWireDesc shape; - xkbTextDoodadWireDesc text; - xkbIndicatorDoodadWireDesc indicator; - xkbLogoDoodadWireDesc logo; -} xkbDoodadWireDesc; -#define sz_xkbDoodadWireDesc 20 - -typedef struct _xkbGetGeometry { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBGetGeometry */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 pad B16; - Atom name B32; -} xkbGetGeometryReq; -#define sz_xkbGetGeometryReq 12 - -typedef struct _xkbGetGeometryReply { - CARD8 type; /* always X_Reply */ - CARD8 deviceID; - CARD16 sequenceNumber B16; - CARD32 length B32; - Atom name B32; - BOOL found; - CARD8 pad; - CARD16 widthMM B16; - CARD16 heightMM B16; - CARD16 nProperties B16; - CARD16 nColors B16; - CARD16 nShapes B16; - CARD16 nSections B16; - CARD16 nDoodads B16; - CARD16 nKeyAliases B16; - CARD8 baseColorNdx; - CARD8 labelColorNdx; -} xkbGetGeometryReply; -#define sz_xkbGetGeometryReply 32 - -typedef struct _xkbSetGeometry { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBSetGeometry */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD8 nShapes; - CARD8 nSections; - Atom name B32; - CARD16 widthMM B16; - CARD16 heightMM B16; - CARD16 nProperties B16; - CARD16 nColors B16; - CARD16 nDoodads B16; - CARD16 nKeyAliases B16; - CARD8 baseColorNdx; - CARD8 labelColorNdx; - CARD16 pad B16; -} xkbSetGeometryReq; -#define sz_xkbSetGeometryReq 28 - -typedef struct _xkbPerClientFlags { - CARD8 reqType; - CARD8 xkbReqType;/* always X_KBPerClientFlags */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 pad1 B16; - CARD32 change B32; - CARD32 value B32; - CARD32 ctrlsToChange B32; - CARD32 autoCtrls B32; - CARD32 autoCtrlValues B32; -} xkbPerClientFlagsReq; -#define sz_xkbPerClientFlagsReq 28 - -typedef struct _xkbPerClientFlagsReply { - CARD8 type; /* always X_Reply */ - CARD8 deviceID; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 supported B32; - CARD32 value B32; - CARD32 autoCtrls B32; - CARD32 autoCtrlValues B32; - CARD32 pad1 B32; - CARD32 pad2 B32; -} xkbPerClientFlagsReply; -#define sz_xkbPerClientFlagsReply 32 - -typedef struct _xkbListComponents { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBListComponents */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 maxNames B16; -} xkbListComponentsReq; -#define sz_xkbListComponentsReq 8 - -typedef struct _xkbListComponentsReply { - CARD8 type; /* always X_Reply */ - CARD8 deviceID; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 nKeymaps B16; - CARD16 nKeycodes B16; - CARD16 nTypes B16; - CARD16 nCompatMaps B16; - CARD16 nSymbols B16; - CARD16 nGeometries B16; - CARD16 extra B16; - CARD16 pad1 B16; - CARD32 pad2 B32; - CARD32 pad3 B32; -} xkbListComponentsReply; -#define sz_xkbListComponentsReply 32 - -typedef struct _xkbGetKbdByName { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBGetKbdByName */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 need B16; /* combination of XkbGBN_* */ - CARD16 want B16; /* combination of XkbGBN_* */ - BOOL load; - CARD8 pad; -} xkbGetKbdByNameReq; -#define sz_xkbGetKbdByNameReq 12 - -typedef struct _xkbGetKbdByNameReply { - CARD8 type; /* always X_Reply */ - CARD8 deviceID; - CARD16 sequenceNumber B16; - CARD32 length B32; - KeyCode minKeyCode; - KeyCode maxKeyCode; - BOOL loaded; - BOOL newKeyboard; - CARD16 found B16; /* combination of XkbGBN_* */ - CARD16 reported B16; /* combination of XkbAllComponents */ - CARD32 pad1 B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; -} xkbGetKbdByNameReply; -#define sz_xkbGetKbdByNameReply 32 - -typedef struct _xkbDeviceLedsWireDesc { - CARD16 ledClass B16; - CARD16 ledID B16; - CARD32 namesPresent B32; - CARD32 mapsPresent B32; - CARD32 physIndicators B32; - CARD32 state B32; -} xkbDeviceLedsWireDesc; -#define sz_xkbDeviceLedsWireDesc 20 - -typedef struct _xkbGetDeviceInfo { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBGetDeviceInfo */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD16 wanted B16; - BOOL allBtns; - CARD8 firstBtn; - CARD8 nBtns; - CARD8 pad; - CARD16 ledClass B16; - CARD16 ledID B16; -} xkbGetDeviceInfoReq; -#define sz_xkbGetDeviceInfoReq 16 - -typedef struct _xkbGetDeviceInfoReply { - CARD8 type; /* always X_Reply */ - CARD8 deviceID; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 present B16; - CARD16 supported B16; - CARD16 unsupported B16; - CARD16 nDeviceLedFBs B16; - CARD8 firstBtnWanted; - CARD8 nBtnsWanted; - CARD8 firstBtnRtrn; - CARD8 nBtnsRtrn; - CARD8 totalBtns; - BOOL hasOwnState; - CARD16 dfltKbdFB B16; - CARD16 dfltLedFB B16; - CARD16 pad B16; - Atom devType B32; -} xkbGetDeviceInfoReply; -#define sz_xkbGetDeviceInfoReply 32 - -typedef struct _xkbSetDeviceInfo { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBSetDeviceInfo */ - CARD16 length B16; - CARD16 deviceSpec B16; - CARD8 firstBtn; - CARD8 nBtns; - CARD16 change B16; - CARD16 nDeviceLedFBs B16; -} xkbSetDeviceInfoReq; -#define sz_xkbSetDeviceInfoReq 12 - -typedef struct _xkbSetDebuggingFlags { - CARD8 reqType; - CARD8 xkbReqType; /* always X_KBSetDebuggingFlags */ - CARD16 length B16; - CARD16 msgLength B16; - CARD16 pad B16; - CARD32 affectFlags B32; - CARD32 flags B32; - CARD32 affectCtrls B32; - CARD32 ctrls B32; -} xkbSetDebuggingFlagsReq; -#define sz_xkbSetDebuggingFlagsReq 24 - -typedef struct _xkbSetDebuggingFlagsReply { - BYTE type; /* X_Reply */ - CARD8 pad0; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 currentFlags B32; - CARD32 currentCtrls B32; - CARD32 supportedFlags B32; - CARD32 supportedCtrls B32; - CARD32 pad1 B32; - CARD32 pad2 B32; -} xkbSetDebuggingFlagsReply; -#define sz_xkbSetDebuggingFlagsReply 32 - - /* - * X KEYBOARD EXTENSION EVENT STRUCTURES - */ - -typedef struct _xkbAnyEvent { - BYTE type; - BYTE xkbType; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 deviceID; - CARD8 pad1; - CARD16 pad2 B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; -} xkbAnyEvent; -#define sz_xkbAnyEvent 32 - -typedef struct _xkbNewKeyboardNotify { - BYTE type; - BYTE xkbType; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 deviceID; - CARD8 oldDeviceID; - KeyCode minKeyCode; - KeyCode maxKeyCode; - KeyCode oldMinKeyCode; - KeyCode oldMaxKeyCode; - CARD8 requestMajor; - CARD8 requestMinor; - CARD16 changed B16; - CARD8 detail; - CARD8 pad1; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; -} xkbNewKeyboardNotify; -#define sz_xkbNewKeyboardNotify 32 - -typedef struct _xkbMapNotify { - BYTE type; - BYTE xkbType; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 deviceID; - CARD8 ptrBtnActions; - CARD16 changed B16; - KeyCode minKeyCode; - KeyCode maxKeyCode; - CARD8 firstType; - CARD8 nTypes; - KeyCode firstKeySym; - CARD8 nKeySyms; - KeyCode firstKeyAct; - CARD8 nKeyActs; - KeyCode firstKeyBehavior; - CARD8 nKeyBehaviors; - KeyCode firstKeyExplicit; - CARD8 nKeyExplicit; - KeyCode firstModMapKey; - CARD8 nModMapKeys; - KeyCode firstVModMapKey; - CARD8 nVModMapKeys; - CARD16 virtualMods B16; - CARD16 pad1 B16; -} xkbMapNotify; -#define sz_xkbMapNotify 32 - -typedef struct _xkbStateNotify { - BYTE type; - BYTE xkbType; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 deviceID; - CARD8 mods; - CARD8 baseMods; - CARD8 latchedMods; - CARD8 lockedMods; - CARD8 group; - INT16 baseGroup B16; - INT16 latchedGroup B16; - CARD8 lockedGroup; - CARD8 compatState; - CARD8 grabMods; - CARD8 compatGrabMods; - CARD8 lookupMods; - CARD8 compatLookupMods; - CARD16 ptrBtnState B16; - CARD16 changed B16; - KeyCode keycode; - CARD8 eventType; - CARD8 requestMajor; - CARD8 requestMinor; -} xkbStateNotify; -#define sz_xkbStateNotify 32 - -typedef struct _xkbControlsNotify { - BYTE type; - BYTE xkbType; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 deviceID; - CARD8 numGroups; - CARD16 pad1 B16; - CARD32 changedControls B32; - CARD32 enabledControls B32; - CARD32 enabledControlChanges B32; - KeyCode keycode; - CARD8 eventType; - CARD8 requestMajor; - CARD8 requestMinor; - CARD32 pad2 B32; -} xkbControlsNotify; -#define sz_xkbControlsNotify 32 - -typedef struct _xkbIndicatorNotify { - BYTE type; - BYTE xkbType; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 deviceID; - CARD8 pad1; - CARD16 pad2 B16; - CARD32 state B32; - CARD32 changed B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; -} xkbIndicatorNotify; -#define sz_xkbIndicatorNotify 32 - -typedef struct _xkbNamesNotify { - BYTE type; - BYTE xkbType; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 deviceID; - CARD8 pad1; - CARD16 changed B16; - CARD8 firstType; - CARD8 nTypes; - CARD8 firstLevelName; - CARD8 nLevelNames; - CARD8 pad2; - CARD8 nRadioGroups; - CARD8 nAliases; - CARD8 changedGroupNames; - CARD16 changedVirtualMods B16; - CARD8 firstKey; - CARD8 nKeys; - CARD32 changedIndicators B32; - CARD32 pad3 B32; -} xkbNamesNotify; -#define sz_xkbNamesNotify 32 - -typedef struct _xkbCompatMapNotify { - BYTE type; - BYTE xkbType; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 deviceID; - CARD8 changedGroups; - CARD16 firstSI B16; - CARD16 nSI B16; - CARD16 nTotalSI B16; - CARD32 pad1 B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; -} xkbCompatMapNotify; -#define sz_xkbCompatMapNotify 32 - -typedef struct _xkbBellNotify { - BYTE type; - BYTE xkbType; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 deviceID; - CARD8 bellClass; - CARD8 bellID; - CARD8 percent; - CARD16 pitch B16; - CARD16 duration B16; - Atom name B32; - Window window B32; - BOOL eventOnly; - CARD8 pad1; - CARD16 pad2 B16; - CARD32 pad3 B32; -} xkbBellNotify; -#define sz_xkbBellNotify 32 - -typedef struct _xkbActionMessage { - BYTE type; - BYTE xkbType; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 deviceID; - KeyCode keycode; - BOOL press; - BOOL keyEventFollows; - CARD8 mods; - CARD8 group; - CARD8 message[8]; - CARD16 pad1 B16; - CARD32 pad2 B32; - CARD32 pad3 B32; -} xkbActionMessage; -#define sz_xkbActionMessage 32 - -typedef struct _xkbAccessXNotify { - BYTE type; - BYTE xkbType; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 deviceID; - KeyCode keycode; - CARD16 detail B16; - CARD16 slowKeysDelay B16; - CARD16 debounceDelay B16; - CARD32 pad1 B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; -} xkbAccessXNotify; -#define sz_xkbAccessXNotify 32 - -typedef struct _xkbExtensionDeviceNotify { - BYTE type; - BYTE xkbType; - CARD16 sequenceNumber B16; - Time time B32; - CARD8 deviceID; - CARD8 pad1; - CARD16 reason B16; - CARD16 ledClass B16; - CARD16 ledID B16; - CARD32 ledsDefined B32; - CARD32 ledState B32; - CARD8 firstBtn; - CARD8 nBtns; - CARD16 supported B16; - CARD16 unsupported B16; - CARD16 pad3 B16; -} xkbExtensionDeviceNotify; -#define sz_xkbExtensionDeviceNotify 32 - -typedef struct _xkbEvent { - union { - xkbAnyEvent any; - xkbNewKeyboardNotify new_kbd; - xkbMapNotify map; - xkbStateNotify state; - xkbControlsNotify ctrls; - xkbIndicatorNotify indicators; - xkbNamesNotify names; - xkbCompatMapNotify compat; - xkbBellNotify bell; - xkbActionMessage message; - xkbAccessXNotify accessx; - xkbExtensionDeviceNotify device; - } u; -} xkbEvent; -#define sz_xkbEvent 32 - -#undef Window -#undef Atom -#undef Time -#undef KeyCode -#undef KeySym - -#endif /* _XKBPROTO_H_ */ diff --git a/openflow/usr/include/X11/extensions/XKBsrv.h b/openflow/usr/include/X11/extensions/XKBsrv.h deleted file mode 100644 index be7e978..0000000 --- a/openflow/usr/include/X11/extensions/XKBsrv.h +++ /dev/null @@ -1,1184 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -#ifndef _XKBSRV_H_ -#define _XKBSRV_H_ - -#ifdef XKB_IN_SERVER -#define XkbAllocClientMap SrvXkbAllocClientMap -#define XkbAllocServerMap SrvXkbAllocServerMap -#define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey -#define XkbAddKeyType SrvXkbAddKeyType -#define XkbCopyKeyType SrvXkbCopyKeyType -#define XkbCopyKeyTypes SrvXkbCopyKeyTypes -#define XkbFreeClientMap SrvXkbFreeClientMap -#define XkbFreeServerMap SrvXkbFreeServerMap -#define XkbInitCanonicalKeyTypes SrvXkbInitCanonicalKeyTypes -#define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols -#define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey -#define XkbUpdateMapFromCore SrvXkbUpdateMapFromCore -#define XkbResizeKeyActions SrvXkbResizeKeyActions -#define XkbResizeKeySyms SrvXkbResizeKeySyms -#define XkbResizeKeyType SrvXkbResizeKeyType -#define XkbAllocCompatMap SrvXkbAllocCompatMap -#define XkbAllocControls SrvXkbAllocControls -#define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps -#define XkbAllocKeyboard SrvXkbAllocKeyboard -#define XkbAllocNames SrvXkbAllocNames -#define XkbFreeCompatMap SrvXkbFreeCompatMap -#define XkbFreeControls SrvXkbFreeControls -#define XkbFreeIndicatorMaps SrvXkbFreeIndicatorMaps -#define XkbFreeKeyboard SrvXkbFreeKeyboard -#define XkbFreeNames SrvXkbFreeNames -#define XkbAddDeviceLedInfo SrvXkbAddDeviceLedInfo -#define XkbAllocDeviceInfo SrvXkbAllocDeviceInfo -#define XkbFreeDeviceInfo SrvXkbFreeDeviceInfo -#define XkbResizeDeviceButtonActions SrvXkbResizeDeviceButtonActions -#define XkbLatchModifiers SrvXkbLatchModifiers -#define XkbLatchGroup SrvXkbLatchGroup -#define XkbVirtualModsToReal SrvXkbVirtualModsToReal -#define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange -#define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges -#define XkbUpdateActionVirtualMods SrvXkbUpdateActionVirtualMods -#define XkbUpdateKeyTypeVirtualMods SrvXkbUpdateKeyTypeVirtualMods -#endif - -#include -#include -#include "inputstr.h" - -typedef struct _XkbInterest { - DeviceIntPtr dev; - ClientPtr client; - XID resource; - struct _XkbInterest * next; - CARD16 extDevNotifyMask; - CARD16 stateNotifyMask; - CARD16 namesNotifyMask; - CARD32 ctrlsNotifyMask; - CARD8 compatNotifyMask; - BOOL bellNotifyMask; - BOOL actionMessageMask; - CARD16 accessXNotifyMask; - CARD32 iStateNotifyMask; - CARD32 iMapNotifyMask; - CARD16 altSymsNotifyMask; - CARD32 autoCtrls; - CARD32 autoCtrlValues; -} XkbInterestRec,*XkbInterestPtr; - -typedef struct _XkbRadioGroup { - CARD8 flags; - CARD8 nMembers; - CARD8 dfltDown; - CARD8 currentDown; - CARD8 members[XkbRGMaxMembers]; -} XkbRadioGroupRec, *XkbRadioGroupPtr; - -typedef struct _XkbEventCause { - CARD8 kc; - CARD8 event; - CARD8 mjr; - CARD8 mnr; - ClientPtr client; -} XkbEventCauseRec,*XkbEventCausePtr; -#define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\ - (c)->mjr= (c)->mnr= 0; \ - (c)->client= NULL; } -#define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\ - (c)->mjr= (j),(c)->mnr= (n);\ - (c)->client= (cl); } -#define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl) -#define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl) -#define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0) - -#define _OFF_TIMER 0 -#define _KRG_WARN_TIMER 1 -#define _KRG_TIMER 2 -#define _SK_TIMEOUT_TIMER 3 -#define _ALL_TIMEOUT_TIMER 4 - -#define _BEEP_NONE 0 -#define _BEEP_FEATURE_ON 1 -#define _BEEP_FEATURE_OFF 2 -#define _BEEP_FEATURE_CHANGE 3 -#define _BEEP_SLOW_WARN 4 -#define _BEEP_SLOW_PRESS 5 -#define _BEEP_SLOW_ACCEPT 6 -#define _BEEP_SLOW_REJECT 7 -#define _BEEP_SLOW_RELEASE 8 -#define _BEEP_STICKY_LATCH 9 -#define _BEEP_STICKY_LOCK 10 -#define _BEEP_STICKY_UNLOCK 11 -#define _BEEP_LED_ON 12 -#define _BEEP_LED_OFF 13 -#define _BEEP_LED_CHANGE 14 -#define _BEEP_BOUNCE_REJECT 15 - -typedef struct _XkbSrvInfo { - XkbStateRec prev_state; - XkbStateRec state; - XkbDescPtr desc; - - DeviceIntPtr device; - KbdCtrlProcPtr kbdProc; - - XkbRadioGroupPtr radioGroups; - CARD8 nRadioGroups; - CARD8 clearMods; - CARD8 setMods; - INT16 groupChange; - - CARD16 dfltPtrDelta; - - double mouseKeysCurve; - double mouseKeysCurveFactor; - INT16 mouseKeysDX; - INT16 mouseKeysDY; - CARD8 mouseKeysFlags; - Bool mouseKeysAccel; - CARD8 mouseKeysCounter; - - CARD8 lockedPtrButtons; - CARD8 shiftKeyCount; - KeyCode mouseKey; - KeyCode inactiveKey; - KeyCode slowKey; - KeyCode repeatKey; - CARD8 krgTimerActive; - CARD8 beepType; - CARD8 beepCount; - - CARD32 flags; - CARD32 lastPtrEventTime; - CARD32 lastShiftEventTime; - OsTimerPtr beepTimer; - OsTimerPtr mouseKeyTimer; - OsTimerPtr slowKeysTimer; - OsTimerPtr bounceKeysTimer; - OsTimerPtr repeatKeyTimer; - OsTimerPtr krgTimer; -} XkbSrvInfoRec, *XkbSrvInfoPtr; - -#define XkbSLI_IsDefault (1L<<0) -#define XkbSLI_HasOwnState (1L<<1) - -typedef struct _XkbSrvLedInfo { - CARD16 flags; - CARD16 class; - CARD16 id; - union { - KbdFeedbackPtr kf; - LedFeedbackPtr lf; - } fb; - - CARD32 physIndicators; - CARD32 autoState; - CARD32 explicitState; - CARD32 effectiveState; - - CARD32 mapsPresent; - CARD32 namesPresent; - XkbIndicatorMapPtr maps; - Atom * names; - - CARD32 usesBase; - CARD32 usesLatched; - CARD32 usesLocked; - CARD32 usesEffective; - CARD32 usesCompat; - CARD32 usesControls; - - CARD32 usedComponents; -} XkbSrvLedInfoRec, *XkbSrvLedInfoPtr; - -/* - * Settings for xkbClientFlags field (used by DIX) - * These flags _must_ not overlap with XkbPCF_* - */ -#define _XkbClientInitialized (1<<15) - -#define _XkbWantsDetectableAutoRepeat(c)\ - ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask) - -/* - * Settings for flags field - */ -#define _XkbStateNotifyInProgress (1<<0) - -typedef struct -{ - ProcessInputProc processInputProc; - ProcessInputProc realInputProc; - DeviceUnwrapProc unwrapProc; -} xkbDeviceInfoRec, *xkbDeviceInfoPtr; - -#define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ - device->public.processInputProc = proc; \ - oldprocs->processInputProc = \ - oldprocs->realInputProc = device->public.realInputProc; \ - device->public.realInputProc = proc; \ - oldprocs->unwrapProc = device->unwrapProc; \ - device->unwrapProc = unwrapproc; - -#define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ - if (device->public.processInputProc == device->public.realInputProc)\ - device->public.processInputProc = proc; \ - oldprocs->processInputProc = \ - oldprocs->realInputProc = device->public.realInputProc; \ - device->public.realInputProc = proc; \ - oldprocs->unwrapProc = device->unwrapProc; \ - device->unwrapProc = unwrapproc; - -#define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs) \ - device->public.processInputProc = oldprocs->processInputProc; \ - device->public.realInputProc = oldprocs->realInputProc; \ - device->unwrapProc = oldprocs->unwrapProc; - -#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr) - -/***====================================================================***/ - - -/***====================================================================***/ - -#define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask) -#define XkbAllFilteredEventsMask \ - (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask) - -/***====================================================================***/ - -extern int XkbReqCode; -extern int XkbEventBase; -extern int XkbKeyboardErrorCode; -extern int XkbDisableLockActions; -extern char * XkbBaseDirectory; -extern char * XkbBinDirectory; -extern char * XkbInitialMap; -extern int _XkbClientMajor; -extern int _XkbClientMinor; -extern unsigned int XkbXIUnsupported; - -extern char * XkbModelUsed,*XkbLayoutUsed,*XkbVariantUsed,*XkbOptionsUsed; -extern Bool noXkbExtension; -extern Bool XkbWantRulesProp; - -extern pointer XkbLastRepeatEvent; - -extern CARD32 xkbDebugFlags; -extern CARD32 xkbDebugCtrls; - -#define _XkbAlloc(s) xalloc((s)) -#define _XkbCalloc(n,s) Xcalloc((n)*(s)) -#define _XkbRealloc(o,s) Xrealloc((o),(s)) -#define _XkbTypedAlloc(t) ((t *)xalloc(sizeof(t))) -#define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n)*sizeof(t))) -#define _XkbTypedRealloc(o,n,t) \ - ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) -#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) -#define _XkbFree(p) Xfree(p) - -#define _XkbLibError(c,l,d) \ - { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } -#define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) -#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) -#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) - -extern int DeviceKeyPress,DeviceKeyRelease; -extern int DeviceButtonPress,DeviceButtonRelease; - -#ifdef XINPUT -#define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress)) -#define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease)) -#else -#define _XkbIsPressEvent(t) ((t)==KeyPress) -#define _XkbIsReleaseEvent(t) ((t)==KeyRelease) -#endif - -#define _XkbCoreKeycodeInRange(c,k) (((k)>=(c)->curKeySyms.minKeyCode)&&\ - ((k)<=(c)->curKeySyms.maxKeyCode)) -#define _XkbCoreNumKeys(c) ((c)->curKeySyms.maxKeyCode-\ - (c)->curKeySyms.minKeyCode+1) - -#define XConvertCase(s,l,u) XkbConvertCase(s,l,u) -#undef IsKeypadKey -#define IsKeypadKey(s) XkbKSIsKeypad(s) - -typedef int Status; -typedef pointer XPointer; -typedef struct _XDisplay Display; - -#ifndef True -#define True 1 -#define False 0 -#endif - -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - -_XFUNCPROTOBEGIN - -extern void XkbUseMsg( - void -); - -extern int XkbProcessArguments( - int /* argc */, - char ** /* argv */, - int /* i */ -); - -extern void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc); - -extern void XkbFreeCompatMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeMap */ -); - -extern void XkbFreeNames( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeMap */ -); - -extern DeviceIntPtr _XkbLookupAnyDevice( - int /* id */, - int * /* why_rtrn */ -); - -extern DeviceIntPtr _XkbLookupKeyboard( - int /* id */, - int * /* why_rtrn */ -); - -extern DeviceIntPtr _XkbLookupBellDevice( - int /* id */, - int * /* why_rtrn */ -); - -extern DeviceIntPtr _XkbLookupLedDevice( - int /* id */, - int * /* why_rtrn */ -); - -extern DeviceIntPtr _XkbLookupButtonDevice( - int /* id */, - int * /* why_rtrn */ -); - -extern XkbDescPtr XkbAllocKeyboard( - void -); - -extern Status XkbAllocClientMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - unsigned int /* nTypes */ -); - -extern Status XkbAllocServerMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - unsigned int /* nNewActions */ -); - -extern void XkbFreeClientMap( - XkbDescPtr /* xkb */, - unsigned int /* what */, - Bool /* freeMap */ -); - -extern void XkbFreeServerMap( - XkbDescPtr /* xkb */, - unsigned int /* what */, - Bool /* freeMap */ -); - -extern Status XkbAllocIndicatorMaps( - XkbDescPtr /* xkb */ -); - -extern Status XkbAllocCompatMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - unsigned int /* nInterpret */ -); - -extern Status XkbAllocNames( - XkbDescPtr /* xkb */, - unsigned int /* which */, - int /* nTotalRG */, - int /* nTotalAliases */ -); - -extern Status XkbAllocControls( - XkbDescPtr /* xkb */, - unsigned int /* which*/ -); - -extern Status XkbCopyKeyType( - XkbKeyTypePtr /* from */, - XkbKeyTypePtr /* into */ -); - -extern Status XkbCopyKeyTypes( - XkbKeyTypePtr /* from */, - XkbKeyTypePtr /* into */, - int /* num_types */ -); - -extern Status XkbResizeKeyType( - XkbDescPtr /* xkb */, - int /* type_ndx */, - int /* map_count */, - Bool /* want_preserve */, - int /* new_num_lvls */ -); - -extern void XkbFreeKeyboard( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeDesc */ -); - -extern void XkbSetActionKeyMods( - XkbDescPtr /* xkb */, - XkbAction * /* act */, - unsigned int /* mods */ -); - -extern Bool XkbCheckActionVMods( - XkbDescPtr /* xkb */, - XkbAction * /* act */, - unsigned int /* changed */ -); - -extern Bool XkbApplyVModChanges( - XkbSrvInfoPtr /* xkbi */, - unsigned int /* changed */, - XkbChangesPtr /* pChanges */, - unsigned int * /* needChecksRtrn */, - XkbEventCausePtr /* cause */ -); - -extern void XkbApplyVModChangesToAllDevices( - DeviceIntPtr /* dev */, - XkbDescPtr /* xkb */, - unsigned int /* changed */, - XkbEventCausePtr /* cause */ -); - -extern unsigned int XkbMaskForVMask( - XkbDescPtr /* xkb */, - unsigned int /* vmask */ -); - -extern Bool XkbVirtualModsToReal( - XkbDescPtr /* xkb */, - unsigned int /* virtua_mask */, - unsigned int * /* mask_rtrn */ -); - -extern unsigned int XkbAdjustGroup( - int /* group */, - XkbControlsPtr /* ctrls */ -); - -extern KeySym *XkbResizeKeySyms( - XkbDescPtr /* xkb */, - int /* key */, - int /* needed */ -); - -extern XkbAction *XkbResizeKeyActions( - XkbDescPtr /* xkb */, - int /* key */, - int /* needed */ -); - -extern void XkbUpdateKeyTypesFromCore( - DeviceIntPtr /* pXDev */, - KeyCode /* first */, - CARD8 /* num */, - XkbChangesPtr /* pChanges */ -); - -extern void XkbUpdateDescActions( - XkbDescPtr /* xkb */, - KeyCode /* first */, - CARD8 /* num */, - XkbChangesPtr /* changes */ -); - -extern void XkbUpdateActions( - DeviceIntPtr /* pXDev */, - KeyCode /* first */, - CARD8 /* num */, - XkbChangesPtr /* pChanges */, - unsigned int * /* needChecksRtrn */, - XkbEventCausePtr /* cause */ -); - -extern void XkbUpdateCoreDescription( - DeviceIntPtr /* keybd */, - Bool /* resize */ -); - -extern void XkbApplyMappingChange( - DeviceIntPtr /* pXDev */, - CARD8 /* request */, - KeyCode /* firstKey */, - CARD8 /* num */, - ClientPtr /* client */ -); - -extern void XkbSetIndicators( - DeviceIntPtr /* pXDev */, - CARD32 /* affect */, - CARD32 /* values */, - XkbEventCausePtr /* cause */ -); - -extern void XkbUpdateIndicators( - DeviceIntPtr /* keybd */, - CARD32 /* changed */, - Bool /* check_edevs */, - XkbChangesPtr /* pChanges */, - XkbEventCausePtr /* cause */ -); - -extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo( - DeviceIntPtr /* dev */, - KbdFeedbackPtr /* kf */, - LedFeedbackPtr /* lf */, - unsigned int /* needed_parts */ -); - -extern XkbSrvLedInfoPtr XkbFindSrvLedInfo( - DeviceIntPtr /* dev */, - unsigned int /* class */, - unsigned int /* id */, - unsigned int /* needed_parts */ -); - -extern void XkbApplyLedNameChanges( - DeviceIntPtr /* dev */, - XkbSrvLedInfoPtr /* sli */, - unsigned int /* changed_names */, - xkbExtensionDeviceNotify * /* ed */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern void XkbApplyLedMapChanges( - DeviceIntPtr /* dev */, - XkbSrvLedInfoPtr /* sli */, - unsigned int /* changed_maps */, - xkbExtensionDeviceNotify * /* ed */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern void XkbApplyLedStateChanges( - DeviceIntPtr /* dev */, - XkbSrvLedInfoPtr /* sli */, - unsigned int /* changed_leds */, - xkbExtensionDeviceNotify * /* ed */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern void XkbUpdateLedAutoState( - DeviceIntPtr /* dev */, - XkbSrvLedInfoPtr /* sli */, - unsigned int /* maps_to_check */, - xkbExtensionDeviceNotify * /* ed */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern void XkbFlushLedEvents( - DeviceIntPtr /* dev */, - DeviceIntPtr /* kbd */, - XkbSrvLedInfoPtr /* sli */, - xkbExtensionDeviceNotify * /* ed */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern void XkbUpdateAllDeviceIndicators( - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern unsigned int XkbIndicatorsToUpdate( - DeviceIntPtr /* dev */, - unsigned long /* state_changes */, - Bool /* enabled_ctrl_changes */ -); - -extern void XkbComputeDerivedState( - XkbSrvInfoPtr /* xkbi */ -); - -extern void XkbCheckSecondaryEffects( - XkbSrvInfoPtr /* xkbi */, - unsigned int /* which */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern void XkbCheckIndicatorMaps( - DeviceIntPtr /* dev */, - XkbSrvLedInfoPtr /* sli */, - unsigned int /* which */ -); - -extern unsigned int XkbStateChangedFlags( - XkbStatePtr /* old */, - XkbStatePtr /* new */ -); - -extern void XkbSendStateNotify( - DeviceIntPtr /* kbd */, - xkbStateNotify * /* pSN */ -); - -extern void XkbSendMapNotify( - DeviceIntPtr /* kbd */, - xkbMapNotify * /* ev */ -); - -extern int XkbComputeControlsNotify( - DeviceIntPtr /* kbd */, - XkbControlsPtr /* old */, - XkbControlsPtr /* new */, - xkbControlsNotify * /* pCN */, - Bool /* forceCtrlProc */ -); - -extern void XkbSendControlsNotify( - DeviceIntPtr /* kbd */, - xkbControlsNotify * /* ev */ -); - -extern void XkbSendCompatMapNotify( - DeviceIntPtr /* kbd */, - xkbCompatMapNotify * /* ev */ -); - -extern void XkbSendIndicatorNotify( - DeviceIntPtr /* kbd */, - int /* xkbType */, - xkbIndicatorNotify * /* ev */ -); - -extern void XkbHandleBell( - BOOL /* force */, - BOOL /* eventOnly */, - DeviceIntPtr /* kbd */, - CARD8 /* percent */, - pointer /* ctrl */, - CARD8 /* class */, - Atom /* name */, - WindowPtr /* pWin */, - ClientPtr /* pClient */ -); - -extern void XkbSendAccessXNotify( - DeviceIntPtr /* kbd */, - xkbAccessXNotify * /* pEv */ -); - -extern void XkbSendNamesNotify( - DeviceIntPtr /* kbd */, - xkbNamesNotify * /* ev */ -); - -extern void XkbSendCompatNotify( - DeviceIntPtr /* kbd */, - xkbCompatMapNotify * /* ev */ -); - -extern void XkbSendActionMessage( - DeviceIntPtr /* kbd */, - xkbActionMessage * /* ev */ -); - -extern void XkbSendExtensionDeviceNotify( - DeviceIntPtr /* kbd */, - ClientPtr /* client */, - xkbExtensionDeviceNotify * /* ev */ -); - -extern void XkbSendNotification( - DeviceIntPtr /* kbd */, - XkbChangesPtr /* pChanges */, - XkbEventCausePtr /* cause */ -); - -extern void XkbProcessKeyboardEvent( - struct _xEvent * /* xE */, - DeviceIntPtr /* keybd */, - int /* count */ -); - -extern void XkbProcessOtherEvent( - struct _xEvent * /* xE */, - DeviceIntPtr /* keybd */, - int /* count */ -); - -extern void XkbHandleActions( - DeviceIntPtr /* dev */, - DeviceIntPtr /* kbd */, - struct _xEvent * /* xE */, - int /* count */ -); - -extern Bool XkbEnableDisableControls( - XkbSrvInfoPtr /* xkbi */, - unsigned long /* change */, - unsigned long /* newValues */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern void AccessXInit( - DeviceIntPtr /* dev */ -); - -extern Bool AccessXFilterPressEvent( - register struct _xEvent * /* xE */, - register DeviceIntPtr /* keybd */, - int /* count */ -); - -extern Bool AccessXFilterReleaseEvent( - register struct _xEvent * /* xE */, - register DeviceIntPtr /* keybd */, - int /* count */ -); - -extern void AccessXCancelRepeatKey( - XkbSrvInfoPtr /* xkbi */, - KeyCode /* key */ -); - -extern void AccessXComputeCurveFactor( - XkbSrvInfoPtr /* xkbi */, - XkbControlsPtr /* ctrls */ -); - -extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( - XkbDeviceInfoPtr /* devi */, - unsigned int /* ledClass */, - unsigned int /* ledId */ -); - -extern XkbDeviceInfoPtr XkbAllocDeviceInfo( - unsigned int /* deviceSpec */, - unsigned int /* nButtons */, - unsigned int /* szLeds */ -); - -extern void XkbFreeDeviceInfo( - XkbDeviceInfoPtr /* devi */, - unsigned int /* which */, - Bool /* freeDevI */ -); - -extern Status XkbResizeDeviceButtonActions( - XkbDeviceInfoPtr /* devi */, - unsigned int /* newTotal */ -); - -extern XkbInterestPtr XkbFindClientResource( - DevicePtr /* inDev */, - ClientPtr /* client */ -); - -extern XkbInterestPtr XkbAddClientResource( - DevicePtr /* inDev */, - ClientPtr /* client */, - XID /* id */ -); - -extern int XkbRemoveClient( - DevicePtr /* inDev */, - ClientPtr /* client */ -); - -extern int XkbRemoveResourceClient( - DevicePtr /* inDev */, - XID /* id */ -); - -extern int XkbDDXInitDevice( - DeviceIntPtr /* dev */ -); - -extern int XkbDDXAccessXBeep( - DeviceIntPtr /* dev */, - unsigned int /* what */, - unsigned int /* which */ -); - -extern void XkbDDXKeyClick( - DeviceIntPtr /* dev */, - int /* keycode */, - int /* synthetic */ -); - -extern int XkbDDXUsesSoftRepeat( - DeviceIntPtr /* dev */ -); - -extern void XkbDDXKeybdCtrlProc( - DeviceIntPtr /* dev */, - KeybdCtrl * /* ctrl */ -); - -extern void XkbDDXChangeControls( - DeviceIntPtr /* dev */, - XkbControlsPtr /* old */, - XkbControlsPtr /* new */ -); - -extern void XkbDDXUpdateIndicators( - DeviceIntPtr /* keybd */, - CARD32 /* newState */ -); - -extern void XkbDDXUpdateDeviceIndicators( - DeviceIntPtr /* dev */, - XkbSrvLedInfoPtr /* sli */, - CARD32 /* newState */ -); - -extern void XkbDDXFakePointerButton( - int /* event */, - int /* button */ -); - -extern void XkbDDXFakePointerMotion( - unsigned int /* flags */, - int /* x */, - int /* y */ -); - -extern void XkbDDXFakeDeviceButton( - DeviceIntPtr /* dev */, - Bool /* press */, - int /* button */ -); - -extern int XkbDDXTerminateServer( - DeviceIntPtr /* dev */, - KeyCode /* key */, - XkbAction * /* act */ -); - -extern int XkbDDXSwitchScreen( - DeviceIntPtr /* dev */, - KeyCode /* key */, - XkbAction * /* act */ -); - -extern int XkbDDXPrivate( - DeviceIntPtr /* dev */, - KeyCode /* key */, - XkbAction * /* act */ -); - -extern void XkbDisableComputedAutoRepeats( - DeviceIntPtr /* pXDev */, - unsigned int /* key */ -); - -extern void XkbSetRepeatKeys( - DeviceIntPtr /* pXDev */, - int /* key */, - int /* onoff */ -); - -extern int XkbLatchModifiers( - DeviceIntPtr /* pXDev */, - CARD8 /* mask */, - CARD8 /* latches */ -); - -extern int XkbLatchGroup( - DeviceIntPtr /* pXDev */, - int /* group */ -); - -extern void XkbClearAllLatchesAndLocks( - DeviceIntPtr /* dev */, - XkbSrvInfoPtr /* xkbi */, - Bool /* genEv */, - XkbEventCausePtr /* cause */ -); - -extern void XkbSetRulesDflts( - char * /* rulesFile */, - char * /* model */, - char * /* layout */, - char * /* variant */, - char * /* options */ -); - -extern void XkbInitDevice( - DeviceIntPtr /* pXDev */ -); - -extern Bool XkbInitKeyboardDeviceStruct( - DeviceIntPtr /* pXDev */, - XkbComponentNamesPtr /* pNames */, - KeySymsPtr /* pSyms */, - CARD8 /* pMods */[], - BellProcPtr /* bellProc */, - KbdCtrlProcPtr /* ctrlProc */ -); - -extern int SProcXkbDispatch( - ClientPtr /* client */ -); - -extern XkbGeometryPtr XkbLookupNamedGeometry( - DeviceIntPtr /* dev */, - Atom /* name */, - Bool * /* shouldFree */ -); - -extern char * _XkbDupString( - char * /* str */ -); - -extern void XkbConvertCase( - KeySym /* sym */, - KeySym * /* lower */, - KeySym * /* upper */ -); - -extern Status XkbChangeKeycodeRange( - XkbDescPtr /* xkb */, - int /* minKC */, - int /* maxKC */, - XkbChangesPtr /* changes */ -); - -extern int XkbFinishDeviceInit( - DeviceIntPtr /* pXDev */ -); - -extern void XkbFreeSrvLedInfo( - XkbSrvLedInfoPtr /* sli */ -); - -extern void XkbFreeInfo( - XkbSrvInfoPtr /* xkbi */ -); - -extern Status XkbChangeTypesOfKey( - XkbDescPtr /* xkb */, - int /* key */, - int /* nGroups */, - unsigned int /* groups */, - int * /* newTypesIn */, - XkbMapChangesPtr /* changes */ -); - -extern XkbKeyTypePtr XkbAddKeyType( - XkbDescPtr /* xkb */, - Atom /* name */, - int /* map_count */, - Bool /* want_preserve */, - int /* num_lvls */ -); - -extern Status XkbInitCanonicalKeyTypes( - XkbDescPtr /* xkb */, - unsigned int /* which */, - int /* keypadVMod */ -); - -extern int XkbKeyTypesForCoreSymbols( - XkbDescPtr /* xkb */, - int /* map_width */, - KeySym * /* core_syms */, - unsigned int /* protected */, - int * /* types_inout */, - KeySym * /* xkb_syms_rtrn */ -); - -extern Bool XkbApplyCompatMapToKey( - XkbDescPtr /* xkb */, - KeyCode /* key */, - XkbChangesPtr /* changes */ -); - -extern Bool XkbUpdateMapFromCore( - XkbDescPtr /* xkb */, - KeyCode /* first_key */, - int /* num_keys */, - int /* map_width */, - KeySym * /* core_keysyms */, - XkbChangesPtr /* changes */ -); - -extern void XkbFreeControls( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeMap */ -); - -extern void XkbFreeIndicatorMaps( - XkbDescPtr /* xkb */ -); - -extern Bool XkbApplyVirtualModChanges( - XkbDescPtr /* xkb */, - unsigned int /* changed */, - XkbChangesPtr /* changes */ -); - -extern Bool XkbUpdateActionVirtualMods( - XkbDescPtr /* xkb */, - XkbAction * /* act */, - unsigned int /* changed */ -); - -extern void XkbUpdateKeyTypeVirtualMods( - XkbDescPtr /* xkb */, - XkbKeyTypePtr /* type */, - unsigned int /* changed */, - XkbChangesPtr /* changes */ -); - -extern void XkbSendNewKeyboardNotify( - DeviceIntPtr /* kbd */, - xkbNewKeyboardNotify * /* pNKN */ -); - -#ifdef XKBSRV_NEED_FILE_FUNCS - -#include -#include -#include - -#define _XkbListKeymaps 0 -#define _XkbListKeycodes 1 -#define _XkbListTypes 2 -#define _XkbListCompat 3 -#define _XkbListSymbols 4 -#define _XkbListGeometry 5 -#define _XkbListNumComponents 6 - -typedef struct _XkbSrvListInfo { - int szPool; - int nPool; - char * pool; - - int maxRtrn; - int nTotal; - - char * pattern[_XkbListNumComponents]; - int nFound[_XkbListNumComponents]; -} XkbSrvListInfoRec,*XkbSrvListInfoPtr; - -char * -XkbGetRulesDflts( - XkbRF_VarDefsPtr /* defs */ -); - -extern void XkbSetRulesUsed( - XkbRF_VarDefsPtr /* defs */ -); - - -extern Status XkbDDXList( - DeviceIntPtr /* dev */, - XkbSrvListInfoPtr /* listing */, - ClientPtr /* client */ -); - -extern unsigned int XkbDDXLoadKeymapByNames( - DeviceIntPtr /* keybd */, - XkbComponentNamesPtr /* names */, - unsigned int /* want */, - unsigned int /* need */, - XkbFileInfoPtr /* finfoRtrn */, - char * /* keymapNameRtrn */, - int /* keymapNameRtrnLen */ -); - -extern Bool XkbDDXNamesFromRules( - DeviceIntPtr /* keybd */, - char * /* rules */, - XkbRF_VarDefsPtr /* defs */, - XkbComponentNamesPtr /* names */ -); - -extern FILE *XkbDDXOpenConfigFile( - char * /* mapName */, - char * /* fileNameRtrn */, - int /* fileNameRtrnLen */ -); - -extern Bool XkbDDXApplyConfig( - XPointer /* cfg_in */, - XkbSrvInfoPtr /* xkbi */ -); - -extern XPointer XkbDDXPreloadConfig( - char ** /* rulesFileRtrn */, - XkbRF_VarDefsPtr /* defs */, - XkbComponentNamesPtr /* names */, - DeviceIntPtr /* dev */ -); - -extern int _XkbStrCaseCmp( - char * /* str1 */, - char * /* str2 */ -); - -#endif /* XKBSRV_NEED_FILE_FUNCS */ - - -_XFUNCPROTOEND - -#define XkbAtomGetString(d,s) NameForAtom(s) - -#endif /* _XKBSRV_H_ */ - - diff --git a/openflow/usr/include/X11/extensions/XKBstr.h b/openflow/usr/include/X11/extensions/XKBstr.h deleted file mode 100644 index 893a04b..0000000 --- a/openflow/usr/include/X11/extensions/XKBstr.h +++ /dev/null @@ -1,642 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -#ifndef _XKBSTR_H_ -#define _XKBSTR_H_ - -#include - -#define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) -#define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff))) -#define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l))) - -/* - * The Xkb structs are full of implicit padding to properly align members. - * We can't clean that up without breaking ABI, so tell clang not to bother - * complaining about it. - */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - - /* - * Common data structures and access macros - */ - -typedef struct _XkbStateRec { - unsigned char group; - unsigned char locked_group; - unsigned short base_group; - unsigned short latched_group; - unsigned char mods; - unsigned char base_mods; - unsigned char latched_mods; - unsigned char locked_mods; - unsigned char compat_state; - unsigned char grab_mods; - unsigned char compat_grab_mods; - unsigned char lookup_mods; - unsigned char compat_lookup_mods; - unsigned short ptr_buttons; -} XkbStateRec,*XkbStatePtr; -#define XkbModLocks(s) ((s)->locked_mods) -#define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s)) -#define XkbGroupLock(s) ((s)->locked_group) -#define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s)) -#define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group) -#define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group) - -typedef struct _XkbMods { - unsigned char mask; /* effective mods */ - unsigned char real_mods; - unsigned short vmods; -} XkbModsRec,*XkbModsPtr; - -typedef struct _XkbKTMapEntry { - Bool active; - unsigned char level; - XkbModsRec mods; -} XkbKTMapEntryRec,*XkbKTMapEntryPtr; - -typedef struct _XkbKeyType { - XkbModsRec mods; - unsigned char num_levels; - unsigned char map_count; - /* map is an array of map_count XkbKTMapEntryRec structs */ - XkbKTMapEntryPtr map; - /* preserve is an array of map_count XkbModsRec structs */ - XkbModsPtr preserve; - Atom name; - /* level_names is an array of num_levels Atoms */ - Atom * level_names; -} XkbKeyTypeRec, *XkbKeyTypePtr; - -#define XkbNumGroups(g) ((g)&0x0f) -#define XkbOutOfRangeGroupInfo(g) ((g)&0xf0) -#define XkbOutOfRangeGroupAction(g) ((g)&0xc0) -#define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4) -#define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f)) -#define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f)) - - /* - * Structures and access macros used primarily by the server - */ - -typedef struct _XkbBehavior { - unsigned char type; - unsigned char data; -} XkbBehavior; - -#define XkbAnyActionDataSize 7 -typedef struct _XkbAnyAction { - unsigned char type; - unsigned char data[XkbAnyActionDataSize]; -} XkbAnyAction; - -typedef struct _XkbModAction { - unsigned char type; - unsigned char flags; - unsigned char mask; - unsigned char real_mods; - unsigned char vmods1; - unsigned char vmods2; -} XkbModAction; -#define XkbModActionVMods(a) \ - ((short)(((a)->vmods1<<8)|((a)->vmods2))) -#define XkbSetModActionVMods(a,v) \ - (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff)) - -typedef struct _XkbGroupAction { - unsigned char type; - unsigned char flags; - char group_XXX; -} XkbGroupAction; -#define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX)) -#define XkbSASetGroup(a,g) ((a)->group_XXX=(g)) - -typedef struct _XkbISOAction { - unsigned char type; - unsigned char flags; - unsigned char mask; - unsigned char real_mods; - char group_XXX; - unsigned char affect; - unsigned char vmods1; - unsigned char vmods2; -} XkbISOAction; - -typedef struct _XkbPtrAction { - unsigned char type; - unsigned char flags; - unsigned char high_XXX; - unsigned char low_XXX; - unsigned char high_YYY; - unsigned char low_YYY; -} XkbPtrAction; -#define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX)) -#define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY)) -#define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX)) -#define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY)) - -typedef struct _XkbPtrBtnAction { - unsigned char type; - unsigned char flags; - unsigned char count; - unsigned char button; -} XkbPtrBtnAction; - -typedef struct _XkbPtrDfltAction { - unsigned char type; - unsigned char flags; - unsigned char affect; - char valueXXX; -} XkbPtrDfltAction; -#define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX)) -#define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff)) - -typedef struct _XkbSwitchScreenAction { - unsigned char type; - unsigned char flags; - char screenXXX; -} XkbSwitchScreenAction; -#define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX)) -#define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff)) - -typedef struct _XkbCtrlsAction { - unsigned char type; - unsigned char flags; - unsigned char ctrls3; - unsigned char ctrls2; - unsigned char ctrls1; - unsigned char ctrls0; -} XkbCtrlsAction; -#define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),\ - ((a)->ctrls2=(((c)>>16)&0xff)),\ - ((a)->ctrls1=(((c)>>8)&0xff)),\ - ((a)->ctrls0=((c)&0xff))) -#define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\ - (((unsigned int)(a)->ctrls2)<<16)|\ - (((unsigned int)(a)->ctrls1)<<8)|\ - ((unsigned int)((a)->ctrls0))) - -typedef struct _XkbMessageAction { - unsigned char type; - unsigned char flags; - unsigned char message[6]; -} XkbMessageAction; - -typedef struct _XkbRedirectKeyAction { - unsigned char type; - unsigned char new_key; - unsigned char mods_mask; - unsigned char mods; - unsigned char vmods_mask0; - unsigned char vmods_mask1; - unsigned char vmods0; - unsigned char vmods1; -} XkbRedirectKeyAction; - -#define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\ - ((unsigned int)(a)->vmods0)) -#define XkbSARedirectSetVMods(a,m) (((a)->vmods1=(((m)>>8)&0xff)),\ - ((a)->vmods0=((m)&0xff))) -#define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\ - ((unsigned int)(a)->vmods_mask0)) -#define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ - ((a)->vmods_mask0=((m)&0xff))) - -typedef struct _XkbDeviceBtnAction { - unsigned char type; - unsigned char flags; - unsigned char count; - unsigned char button; - unsigned char device; -} XkbDeviceBtnAction; - -typedef struct _XkbDeviceValuatorAction { - unsigned char type; - unsigned char device; - unsigned char v1_what; - unsigned char v1_ndx; - unsigned char v1_value; - unsigned char v2_what; - unsigned char v2_ndx; - unsigned char v2_value; -} XkbDeviceValuatorAction; - -typedef union _XkbAction { - XkbAnyAction any; - XkbModAction mods; - XkbGroupAction group; - XkbISOAction iso; - XkbPtrAction ptr; - XkbPtrBtnAction btn; - XkbPtrDfltAction dflt; - XkbSwitchScreenAction screen; - XkbCtrlsAction ctrls; - XkbMessageAction msg; - XkbRedirectKeyAction redirect; - XkbDeviceBtnAction devbtn; - XkbDeviceValuatorAction devval; - unsigned char type; -} XkbAction; - -typedef struct _XkbControls { - unsigned char mk_dflt_btn; - unsigned char num_groups; - unsigned char groups_wrap; - XkbModsRec internal; - XkbModsRec ignore_lock; - unsigned int enabled_ctrls; - unsigned short repeat_delay; - unsigned short repeat_interval; - unsigned short slow_keys_delay; - unsigned short debounce_delay; - unsigned short mk_delay; - unsigned short mk_interval; - unsigned short mk_time_to_max; - unsigned short mk_max_speed; - short mk_curve; - unsigned short ax_options; - unsigned short ax_timeout; - unsigned short axt_opts_mask; - unsigned short axt_opts_values; - unsigned int axt_ctrls_mask; - unsigned int axt_ctrls_values; - unsigned char per_key_repeat[XkbPerKeyBitArraySize]; -} XkbControlsRec, *XkbControlsPtr; - -#define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask) -#define XkbAX_NeedOption(c,w) ((c)->ax_options&(w)) -#define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w)) - -typedef struct _XkbServerMapRec { - /* acts is an array of XkbActions structs, with size_acts entries - allocated, and num_acts entries used. */ - unsigned short num_acts; - unsigned short size_acts; - XkbAction *acts; - - /* behaviors, key_acts, explicit, & vmodmap are all arrays with - (xkb->max_key_code + 1) entries allocated for each. */ - XkbBehavior *behaviors; - unsigned short *key_acts; -#if defined(__cplusplus) || defined(c_plusplus) - /* explicit is a C++ reserved word */ - unsigned char *c_explicit; -#else - unsigned char *explicit; -#endif - unsigned char vmods[XkbNumVirtualMods]; - unsigned short *vmodmap; -} XkbServerMapRec, *XkbServerMapPtr; - -#define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]]) - - /* - * Structures and access macros used primarily by clients - */ - -typedef struct _XkbSymMapRec { - unsigned char kt_index[XkbNumKbdGroups]; - unsigned char group_info; - unsigned char width; - unsigned short offset; -} XkbSymMapRec, *XkbSymMapPtr; - -typedef struct _XkbClientMapRec { - /* types is an array of XkbKeyTypeRec structs, with size_types entries - allocated, and num_types entries used. */ - unsigned char size_types; - unsigned char num_types; - XkbKeyTypePtr types; - - /* syms is an array of size_syms KeySyms, in which num_syms are used */ - unsigned short size_syms; - unsigned short num_syms; - KeySym *syms; - /* key_sym_map is an array of (max_key_code + 1) XkbSymMapRec structs */ - XkbSymMapPtr key_sym_map; - - /* modmap is an array of (max_key_code + 1) unsigned chars */ - unsigned char *modmap; -} XkbClientMapRec, *XkbClientMapPtr; - -#define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info) -#define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info)) -#define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels) -#define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width) -#define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3]) -#define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)]) -#define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k)) -#define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset) -#define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)]) - - /* - * Compatibility structures and access macros - */ - -typedef struct _XkbSymInterpretRec { - KeySym sym; - unsigned char flags; - unsigned char match; - unsigned char mods; - unsigned char virtual_mod; - XkbAnyAction act; -} XkbSymInterpretRec,*XkbSymInterpretPtr; - -typedef struct _XkbCompatMapRec { - /* sym_interpret is an array of XkbSymInterpretRec structs, - in which size_si are allocated & num_si are used. */ - XkbSymInterpretPtr sym_interpret; - XkbModsRec groups[XkbNumKbdGroups]; - unsigned short num_si; - unsigned short size_si; -} XkbCompatMapRec, *XkbCompatMapPtr; - -typedef struct _XkbIndicatorMapRec { - unsigned char flags; - unsigned char which_groups; - unsigned char groups; - unsigned char which_mods; - XkbModsRec mods; - unsigned int ctrls; -} XkbIndicatorMapRec, *XkbIndicatorMapPtr; - -#define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&\ - (((i)->which_groups&&(i)->groups)||\ - ((i)->which_mods&&(i)->mods.mask)||\ - ((i)->ctrls))) -#define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||\ - ((i)->which_mods)||((i)->ctrls)) - - -typedef struct _XkbIndicatorRec { - unsigned long phys_indicators; - XkbIndicatorMapRec maps[XkbNumIndicators]; -} XkbIndicatorRec,*XkbIndicatorPtr; - -typedef struct _XkbKeyNameRec { - char name[XkbKeyNameLength]; -} XkbKeyNameRec,*XkbKeyNamePtr; - -typedef struct _XkbKeyAliasRec { - char real[XkbKeyNameLength]; - char alias[XkbKeyNameLength]; -} XkbKeyAliasRec,*XkbKeyAliasPtr; - - /* - * Names for everything - */ -typedef struct _XkbNamesRec { - Atom keycodes; - Atom geometry; - Atom symbols; - Atom types; - Atom compat; - Atom vmods[XkbNumVirtualMods]; - Atom indicators[XkbNumIndicators]; - Atom groups[XkbNumKbdGroups]; - /* keys is an array of (xkb->max_key_code + 1) XkbKeyNameRec entries */ - XkbKeyNamePtr keys; - /* key_aliases is an array of num_key_aliases XkbKeyAliasRec entries */ - XkbKeyAliasPtr key_aliases; - /* radio_groups is an array of num_rg Atoms */ - Atom *radio_groups; - Atom phys_symbols; - - /* num_keys seems to be unused in libX11 */ - unsigned char num_keys; - unsigned char num_key_aliases; - unsigned short num_rg; -} XkbNamesRec,*XkbNamesPtr; - -typedef struct _XkbGeometry *XkbGeometryPtr; - /* - * Tie it all together into one big keyboard description - */ -typedef struct _XkbDesc { - struct _XDisplay * dpy; - unsigned short flags; - unsigned short device_spec; - KeyCode min_key_code; - KeyCode max_key_code; - - XkbControlsPtr ctrls; - XkbServerMapPtr server; - XkbClientMapPtr map; - XkbIndicatorPtr indicators; - XkbNamesPtr names; - XkbCompatMapPtr compat; - XkbGeometryPtr geom; -} XkbDescRec, *XkbDescPtr; -#define XkbKeyKeyTypeIndex(d,k,g) (XkbCMKeyTypeIndex((d)->map,k,g)) -#define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g)) -#define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g)) -#define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k)) -#define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k))) -#define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k))) -#define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k))) -#define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k))) -#define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n]) -#define XkbKeySymEntry(d,k,sl,g) \ - (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl)))) -#define XkbKeyAction(d,k,n) \ - (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL) -#define XkbKeyActionEntry(d,k,sl,g) \ - (XkbKeyHasActions(d,k)?\ - XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL) - -#define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0) -#define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1) -#define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k)) -#define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&&\ - ((k)<=(d)->max_key_code)) -#define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1) - - - /* - * The following structures can be used to track changes - * to a keyboard device - */ -typedef struct _XkbMapChanges { - unsigned short changed; - KeyCode min_key_code; - KeyCode max_key_code; - unsigned char first_type; - unsigned char num_types; - KeyCode first_key_sym; - unsigned char num_key_syms; - KeyCode first_key_act; - unsigned char num_key_acts; - KeyCode first_key_behavior; - unsigned char num_key_behaviors; - KeyCode first_key_explicit; - unsigned char num_key_explicit; - KeyCode first_modmap_key; - unsigned char num_modmap_keys; - KeyCode first_vmodmap_key; - unsigned char num_vmodmap_keys; - unsigned char pad; - unsigned short vmods; -} XkbMapChangesRec,*XkbMapChangesPtr; - -typedef struct _XkbControlsChanges { - unsigned int changed_ctrls; - unsigned int enabled_ctrls_changes; - Bool num_groups_changed; -} XkbControlsChangesRec,*XkbControlsChangesPtr; - -typedef struct _XkbIndicatorChanges { - unsigned int state_changes; - unsigned int map_changes; -} XkbIndicatorChangesRec,*XkbIndicatorChangesPtr; - -typedef struct _XkbNameChanges { - unsigned int changed; - unsigned char first_type; - unsigned char num_types; - unsigned char first_lvl; - unsigned char num_lvls; - unsigned char num_aliases; - unsigned char num_rg; - unsigned char first_key; - unsigned char num_keys; - unsigned short changed_vmods; - unsigned long changed_indicators; - unsigned char changed_groups; -} XkbNameChangesRec,*XkbNameChangesPtr; - -typedef struct _XkbCompatChanges { - unsigned char changed_groups; - unsigned short first_si; - unsigned short num_si; -} XkbCompatChangesRec,*XkbCompatChangesPtr; - -typedef struct _XkbChanges { - unsigned short device_spec; - unsigned short state_changes; - XkbMapChangesRec map; - XkbControlsChangesRec ctrls; - XkbIndicatorChangesRec indicators; - XkbNameChangesRec names; - XkbCompatChangesRec compat; -} XkbChangesRec, *XkbChangesPtr; - - /* - * These data structures are used to construct a keymap from - * a set of components or to list components in the server - * database. - */ -typedef struct _XkbComponentNames { - char * keymap; - char * keycodes; - char * types; - char * compat; - char * symbols; - char * geometry; -} XkbComponentNamesRec, *XkbComponentNamesPtr; - -typedef struct _XkbComponentName { - unsigned short flags; - char * name; -} XkbComponentNameRec,*XkbComponentNamePtr; - -typedef struct _XkbComponentList { - int num_keymaps; - int num_keycodes; - int num_types; - int num_compat; - int num_symbols; - int num_geometry; - XkbComponentNamePtr keymaps; - XkbComponentNamePtr keycodes; - XkbComponentNamePtr types; - XkbComponentNamePtr compat; - XkbComponentNamePtr symbols; - XkbComponentNamePtr geometry; -} XkbComponentListRec, *XkbComponentListPtr; - - /* - * The following data structures describe and track changes to a - * non-keyboard extension device - */ -typedef struct _XkbDeviceLedInfo { - unsigned short led_class; - unsigned short led_id; - unsigned int phys_indicators; - unsigned int maps_present; - unsigned int names_present; - unsigned int state; - Atom names[XkbNumIndicators]; - XkbIndicatorMapRec maps[XkbNumIndicators]; -} XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr; - -typedef struct _XkbDeviceInfo { - char * name; - Atom type; - unsigned short device_spec; - Bool has_own_state; - unsigned short supported; - unsigned short unsupported; - - /* btn_acts is an array of num_btn XkbAction entries */ - unsigned short num_btns; - XkbAction * btn_acts; - - unsigned short sz_leds; - unsigned short num_leds; - unsigned short dflt_kbd_fb; - unsigned short dflt_led_fb; - /* leds is an array of XkbDeviceLedInfoRec in which - sz_leds entries are allocated and num_leds entries are used */ - XkbDeviceLedInfoPtr leds; -} XkbDeviceInfoRec,*XkbDeviceInfoPtr; - -#define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL)) -#define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns)) -#define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL)) - -typedef struct _XkbDeviceLedChanges { - unsigned short led_class; - unsigned short led_id; - unsigned int defined; /* names or maps changed */ - struct _XkbDeviceLedChanges *next; -} XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr; - -typedef struct _XkbDeviceChanges { - unsigned int changed; - unsigned short first_btn; - unsigned short num_btns; - XkbDeviceLedChangesRec leds; -} XkbDeviceChangesRec,*XkbDeviceChangesPtr; - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -#endif /* _XKBSTR_H_ */ diff --git a/openflow/usr/include/X11/keysym.h b/openflow/usr/include/X11/keysym.h deleted file mode 100644 index 4f58488..0000000 --- a/openflow/usr/include/X11/keysym.h +++ /dev/null @@ -1,74 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -/* default keysyms */ -#define XK_MISCELLANY -#define XK_XKB_KEYS -#define XK_LATIN1 -#define XK_LATIN2 -#define XK_LATIN3 -#define XK_LATIN4 -#define XK_LATIN8 -#define XK_LATIN9 -#define XK_CAUCASUS -#define XK_GREEK -#define XK_KATAKANA -#define XK_ARABIC -#define XK_CYRILLIC -#define XK_HEBREW -#define XK_THAI -#define XK_KOREAN -#define XK_ARMENIAN -#define XK_GEORGIAN -#define XK_VIETNAMESE -#define XK_CURRENCY -#define XK_MATHEMATICAL -#define XK_BRAILLE -#define XK_SINHALA - -#include - diff --git a/openflow/usr/include/X11/keysymdef.h b/openflow/usr/include/X11/keysymdef.h deleted file mode 100644 index 147ecf5..0000000 --- a/openflow/usr/include/X11/keysymdef.h +++ /dev/null @@ -1,2497 +0,0 @@ -/*********************************************************** -Copyright 1987, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -/* - * The "X11 Window System Protocol" standard defines in Appendix A the - * keysym codes. These 29-bit integer values identify characters or - * functions associated with each key (e.g., via the visible - * engraving) of a keyboard layout. This file assigns mnemonic macro - * names for these keysyms. - * - * This file is also compiled (by src/util/makekeys.c in libX11) into - * hash tables that can be accessed with X11 library functions such as - * XStringToKeysym() and XKeysymToString(). - * - * Where a keysym corresponds one-to-one to an ISO 10646 / Unicode - * character, this is noted in a comment that provides both the U+xxxx - * Unicode position, as well as the official Unicode name of the - * character. - * - * Where the correspondence is either not one-to-one or semantically - * unclear, the Unicode position and name are enclosed in - * parentheses. Such legacy keysyms should be considered deprecated - * and are not recommended for use in future keyboard mappings. - * - * For any future extension of the keysyms with characters already - * found in ISO 10646 / Unicode, the following algorithm shall be - * used. The new keysym code position will simply be the character's - * Unicode number plus 0x01000000. The keysym values in the range - * 0x01000100 to 0x0110ffff are reserved to represent Unicode - * characters in the range U+0100 to U+10FFFF. - * - * While most newer Unicode-based X11 clients do already accept - * Unicode-mapped keysyms in the range 0x01000100 to 0x0110ffff, it - * will remain necessary for clients -- in the interest of - * compatibility with existing servers -- to also understand the - * existing legacy keysym values in the range 0x0100 to 0x20ff. - * - * Where several mnemonic names are defined for the same keysym in this - * file, all but the first one listed should be considered deprecated. - * - * Mnemonic names for keysyms are defined in this file with lines - * that match one of these Perl regular expressions: - * - * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\* U+([0-9A-F]{4,6}) (.*) \*\/\s*$/ - * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\*\(U+([0-9A-F]{4,6}) (.*)\)\*\/\s*$/ - * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*(\/\*\s*(.*)\s*\*\/)?\s*$/ - * - * Before adding new keysyms, please do consider the following: In - * addition to the keysym names defined in this file, the - * XStringToKeysym() and XKeysymToString() functions will also handle - * any keysym string of the form "U0020" to "U007E" and "U00A0" to - * "U10FFFF" for all possible Unicode characters. In other words, - * every possible Unicode character has already a keysym string - * defined algorithmically, even if it is not listed here. Therefore, - * defining an additional keysym macro is only necessary where a - * non-hexadecimal mnemonic name is needed, or where the new keysym - * does not represent any existing Unicode character. - * - * When adding new keysyms to this file, do not forget to also update the - * following as needed: - * - * - the mappings in src/KeyBind.c in the repo - * git://anongit.freedesktop.org/xorg/lib/libX11.git - * - * - the protocol specification in specs/keysyms.xml - * in the repo git://anongit.freedesktop.org/xorg/proto/x11proto.git - * - */ - -#define XK_VoidSymbol 0xffffff /* Void symbol */ - -#ifdef XK_MISCELLANY -/* - * TTY function keys, cleverly chosen to map to ASCII, for convenience of - * programming, but could have been arbitrary (at the cost of lookup - * tables in client code). - */ - -#define XK_BackSpace 0xff08 /* Back space, back char */ -#define XK_Tab 0xff09 -#define XK_Linefeed 0xff0a /* Linefeed, LF */ -#define XK_Clear 0xff0b -#define XK_Return 0xff0d /* Return, enter */ -#define XK_Pause 0xff13 /* Pause, hold */ -#define XK_Scroll_Lock 0xff14 -#define XK_Sys_Req 0xff15 -#define XK_Escape 0xff1b -#define XK_Delete 0xffff /* Delete, rubout */ - - - -/* International & multi-key character composition */ - -#define XK_Multi_key 0xff20 /* Multi-key character compose */ -#define XK_Codeinput 0xff37 -#define XK_SingleCandidate 0xff3c -#define XK_MultipleCandidate 0xff3d -#define XK_PreviousCandidate 0xff3e - -/* Japanese keyboard support */ - -#define XK_Kanji 0xff21 /* Kanji, Kanji convert */ -#define XK_Muhenkan 0xff22 /* Cancel Conversion */ -#define XK_Henkan_Mode 0xff23 /* Start/Stop Conversion */ -#define XK_Henkan 0xff23 /* Alias for Henkan_Mode */ -#define XK_Romaji 0xff24 /* to Romaji */ -#define XK_Hiragana 0xff25 /* to Hiragana */ -#define XK_Katakana 0xff26 /* to Katakana */ -#define XK_Hiragana_Katakana 0xff27 /* Hiragana/Katakana toggle */ -#define XK_Zenkaku 0xff28 /* to Zenkaku */ -#define XK_Hankaku 0xff29 /* to Hankaku */ -#define XK_Zenkaku_Hankaku 0xff2a /* Zenkaku/Hankaku toggle */ -#define XK_Touroku 0xff2b /* Add to Dictionary */ -#define XK_Massyo 0xff2c /* Delete from Dictionary */ -#define XK_Kana_Lock 0xff2d /* Kana Lock */ -#define XK_Kana_Shift 0xff2e /* Kana Shift */ -#define XK_Eisu_Shift 0xff2f /* Alphanumeric Shift */ -#define XK_Eisu_toggle 0xff30 /* Alphanumeric toggle */ -#define XK_Kanji_Bangou 0xff37 /* Codeinput */ -#define XK_Zen_Koho 0xff3d /* Multiple/All Candidate(s) */ -#define XK_Mae_Koho 0xff3e /* Previous Candidate */ - -/* 0xff31 thru 0xff3f are under XK_KOREAN */ - -/* Cursor control & motion */ - -#define XK_Home 0xff50 -#define XK_Left 0xff51 /* Move left, left arrow */ -#define XK_Up 0xff52 /* Move up, up arrow */ -#define XK_Right 0xff53 /* Move right, right arrow */ -#define XK_Down 0xff54 /* Move down, down arrow */ -#define XK_Prior 0xff55 /* Prior, previous */ -#define XK_Page_Up 0xff55 -#define XK_Next 0xff56 /* Next */ -#define XK_Page_Down 0xff56 -#define XK_End 0xff57 /* EOL */ -#define XK_Begin 0xff58 /* BOL */ - - -/* Misc functions */ - -#define XK_Select 0xff60 /* Select, mark */ -#define XK_Print 0xff61 -#define XK_Execute 0xff62 /* Execute, run, do */ -#define XK_Insert 0xff63 /* Insert, insert here */ -#define XK_Undo 0xff65 -#define XK_Redo 0xff66 /* Redo, again */ -#define XK_Menu 0xff67 -#define XK_Find 0xff68 /* Find, search */ -#define XK_Cancel 0xff69 /* Cancel, stop, abort, exit */ -#define XK_Help 0xff6a /* Help */ -#define XK_Break 0xff6b -#define XK_Mode_switch 0xff7e /* Character set switch */ -#define XK_script_switch 0xff7e /* Alias for mode_switch */ -#define XK_Num_Lock 0xff7f - -/* Keypad functions, keypad numbers cleverly chosen to map to ASCII */ - -#define XK_KP_Space 0xff80 /* Space */ -#define XK_KP_Tab 0xff89 -#define XK_KP_Enter 0xff8d /* Enter */ -#define XK_KP_F1 0xff91 /* PF1, KP_A, ... */ -#define XK_KP_F2 0xff92 -#define XK_KP_F3 0xff93 -#define XK_KP_F4 0xff94 -#define XK_KP_Home 0xff95 -#define XK_KP_Left 0xff96 -#define XK_KP_Up 0xff97 -#define XK_KP_Right 0xff98 -#define XK_KP_Down 0xff99 -#define XK_KP_Prior 0xff9a -#define XK_KP_Page_Up 0xff9a -#define XK_KP_Next 0xff9b -#define XK_KP_Page_Down 0xff9b -#define XK_KP_End 0xff9c -#define XK_KP_Begin 0xff9d -#define XK_KP_Insert 0xff9e -#define XK_KP_Delete 0xff9f -#define XK_KP_Equal 0xffbd /* Equals */ -#define XK_KP_Multiply 0xffaa -#define XK_KP_Add 0xffab -#define XK_KP_Separator 0xffac /* Separator, often comma */ -#define XK_KP_Subtract 0xffad -#define XK_KP_Decimal 0xffae -#define XK_KP_Divide 0xffaf - -#define XK_KP_0 0xffb0 -#define XK_KP_1 0xffb1 -#define XK_KP_2 0xffb2 -#define XK_KP_3 0xffb3 -#define XK_KP_4 0xffb4 -#define XK_KP_5 0xffb5 -#define XK_KP_6 0xffb6 -#define XK_KP_7 0xffb7 -#define XK_KP_8 0xffb8 -#define XK_KP_9 0xffb9 - - - -/* - * Auxiliary functions; note the duplicate definitions for left and right - * function keys; Sun keyboards and a few other manufacturers have such - * function key groups on the left and/or right sides of the keyboard. - * We've not found a keyboard with more than 35 function keys total. - */ - -#define XK_F1 0xffbe -#define XK_F2 0xffbf -#define XK_F3 0xffc0 -#define XK_F4 0xffc1 -#define XK_F5 0xffc2 -#define XK_F6 0xffc3 -#define XK_F7 0xffc4 -#define XK_F8 0xffc5 -#define XK_F9 0xffc6 -#define XK_F10 0xffc7 -#define XK_F11 0xffc8 -#define XK_L1 0xffc8 -#define XK_F12 0xffc9 -#define XK_L2 0xffc9 -#define XK_F13 0xffca -#define XK_L3 0xffca -#define XK_F14 0xffcb -#define XK_L4 0xffcb -#define XK_F15 0xffcc -#define XK_L5 0xffcc -#define XK_F16 0xffcd -#define XK_L6 0xffcd -#define XK_F17 0xffce -#define XK_L7 0xffce -#define XK_F18 0xffcf -#define XK_L8 0xffcf -#define XK_F19 0xffd0 -#define XK_L9 0xffd0 -#define XK_F20 0xffd1 -#define XK_L10 0xffd1 -#define XK_F21 0xffd2 -#define XK_R1 0xffd2 -#define XK_F22 0xffd3 -#define XK_R2 0xffd3 -#define XK_F23 0xffd4 -#define XK_R3 0xffd4 -#define XK_F24 0xffd5 -#define XK_R4 0xffd5 -#define XK_F25 0xffd6 -#define XK_R5 0xffd6 -#define XK_F26 0xffd7 -#define XK_R6 0xffd7 -#define XK_F27 0xffd8 -#define XK_R7 0xffd8 -#define XK_F28 0xffd9 -#define XK_R8 0xffd9 -#define XK_F29 0xffda -#define XK_R9 0xffda -#define XK_F30 0xffdb -#define XK_R10 0xffdb -#define XK_F31 0xffdc -#define XK_R11 0xffdc -#define XK_F32 0xffdd -#define XK_R12 0xffdd -#define XK_F33 0xffde -#define XK_R13 0xffde -#define XK_F34 0xffdf -#define XK_R14 0xffdf -#define XK_F35 0xffe0 -#define XK_R15 0xffe0 - -/* Modifiers */ - -#define XK_Shift_L 0xffe1 /* Left shift */ -#define XK_Shift_R 0xffe2 /* Right shift */ -#define XK_Control_L 0xffe3 /* Left control */ -#define XK_Control_R 0xffe4 /* Right control */ -#define XK_Caps_Lock 0xffe5 /* Caps lock */ -#define XK_Shift_Lock 0xffe6 /* Shift lock */ - -#define XK_Meta_L 0xffe7 /* Left meta */ -#define XK_Meta_R 0xffe8 /* Right meta */ -#define XK_Alt_L 0xffe9 /* Left alt */ -#define XK_Alt_R 0xffea /* Right alt */ -#define XK_Super_L 0xffeb /* Left super */ -#define XK_Super_R 0xffec /* Right super */ -#define XK_Hyper_L 0xffed /* Left hyper */ -#define XK_Hyper_R 0xffee /* Right hyper */ -#endif /* XK_MISCELLANY */ - -/* - * Keyboard (XKB) Extension function and modifier keys - * (from Appendix C of "The X Keyboard Extension: Protocol Specification") - * Byte 3 = 0xfe - */ - -#ifdef XK_XKB_KEYS -#define XK_ISO_Lock 0xfe01 -#define XK_ISO_Level2_Latch 0xfe02 -#define XK_ISO_Level3_Shift 0xfe03 -#define XK_ISO_Level3_Latch 0xfe04 -#define XK_ISO_Level3_Lock 0xfe05 -#define XK_ISO_Level5_Shift 0xfe11 -#define XK_ISO_Level5_Latch 0xfe12 -#define XK_ISO_Level5_Lock 0xfe13 -#define XK_ISO_Group_Shift 0xff7e /* Alias for mode_switch */ -#define XK_ISO_Group_Latch 0xfe06 -#define XK_ISO_Group_Lock 0xfe07 -#define XK_ISO_Next_Group 0xfe08 -#define XK_ISO_Next_Group_Lock 0xfe09 -#define XK_ISO_Prev_Group 0xfe0a -#define XK_ISO_Prev_Group_Lock 0xfe0b -#define XK_ISO_First_Group 0xfe0c -#define XK_ISO_First_Group_Lock 0xfe0d -#define XK_ISO_Last_Group 0xfe0e -#define XK_ISO_Last_Group_Lock 0xfe0f - -#define XK_ISO_Left_Tab 0xfe20 -#define XK_ISO_Move_Line_Up 0xfe21 -#define XK_ISO_Move_Line_Down 0xfe22 -#define XK_ISO_Partial_Line_Up 0xfe23 -#define XK_ISO_Partial_Line_Down 0xfe24 -#define XK_ISO_Partial_Space_Left 0xfe25 -#define XK_ISO_Partial_Space_Right 0xfe26 -#define XK_ISO_Set_Margin_Left 0xfe27 -#define XK_ISO_Set_Margin_Right 0xfe28 -#define XK_ISO_Release_Margin_Left 0xfe29 -#define XK_ISO_Release_Margin_Right 0xfe2a -#define XK_ISO_Release_Both_Margins 0xfe2b -#define XK_ISO_Fast_Cursor_Left 0xfe2c -#define XK_ISO_Fast_Cursor_Right 0xfe2d -#define XK_ISO_Fast_Cursor_Up 0xfe2e -#define XK_ISO_Fast_Cursor_Down 0xfe2f -#define XK_ISO_Continuous_Underline 0xfe30 -#define XK_ISO_Discontinuous_Underline 0xfe31 -#define XK_ISO_Emphasize 0xfe32 -#define XK_ISO_Center_Object 0xfe33 -#define XK_ISO_Enter 0xfe34 - -#define XK_dead_grave 0xfe50 -#define XK_dead_acute 0xfe51 -#define XK_dead_circumflex 0xfe52 -#define XK_dead_tilde 0xfe53 -#define XK_dead_perispomeni 0xfe53 /* alias for dead_tilde */ -#define XK_dead_macron 0xfe54 -#define XK_dead_breve 0xfe55 -#define XK_dead_abovedot 0xfe56 -#define XK_dead_diaeresis 0xfe57 -#define XK_dead_abovering 0xfe58 -#define XK_dead_doubleacute 0xfe59 -#define XK_dead_caron 0xfe5a -#define XK_dead_cedilla 0xfe5b -#define XK_dead_ogonek 0xfe5c -#define XK_dead_iota 0xfe5d -#define XK_dead_voiced_sound 0xfe5e -#define XK_dead_semivoiced_sound 0xfe5f -#define XK_dead_belowdot 0xfe60 -#define XK_dead_hook 0xfe61 -#define XK_dead_horn 0xfe62 -#define XK_dead_stroke 0xfe63 -#define XK_dead_abovecomma 0xfe64 -#define XK_dead_psili 0xfe64 /* alias for dead_abovecomma */ -#define XK_dead_abovereversedcomma 0xfe65 -#define XK_dead_dasia 0xfe65 /* alias for dead_abovereversedcomma */ -#define XK_dead_doublegrave 0xfe66 -#define XK_dead_belowring 0xfe67 -#define XK_dead_belowmacron 0xfe68 -#define XK_dead_belowcircumflex 0xfe69 -#define XK_dead_belowtilde 0xfe6a -#define XK_dead_belowbreve 0xfe6b -#define XK_dead_belowdiaeresis 0xfe6c -#define XK_dead_invertedbreve 0xfe6d -#define XK_dead_belowcomma 0xfe6e -#define XK_dead_currency 0xfe6f - -/* extra dead elements for German T3 layout */ -#define XK_dead_lowline 0xfe90 -#define XK_dead_aboveverticalline 0xfe91 -#define XK_dead_belowverticalline 0xfe92 -#define XK_dead_longsolidusoverlay 0xfe93 - -/* dead vowels for universal syllable entry */ -#define XK_dead_a 0xfe80 -#define XK_dead_A 0xfe81 -#define XK_dead_e 0xfe82 -#define XK_dead_E 0xfe83 -#define XK_dead_i 0xfe84 -#define XK_dead_I 0xfe85 -#define XK_dead_o 0xfe86 -#define XK_dead_O 0xfe87 -#define XK_dead_u 0xfe88 -#define XK_dead_U 0xfe89 -#define XK_dead_small_schwa 0xfe8a -#define XK_dead_capital_schwa 0xfe8b - -#define XK_dead_greek 0xfe8c - -#define XK_First_Virtual_Screen 0xfed0 -#define XK_Prev_Virtual_Screen 0xfed1 -#define XK_Next_Virtual_Screen 0xfed2 -#define XK_Last_Virtual_Screen 0xfed4 -#define XK_Terminate_Server 0xfed5 - -#define XK_AccessX_Enable 0xfe70 -#define XK_AccessX_Feedback_Enable 0xfe71 -#define XK_RepeatKeys_Enable 0xfe72 -#define XK_SlowKeys_Enable 0xfe73 -#define XK_BounceKeys_Enable 0xfe74 -#define XK_StickyKeys_Enable 0xfe75 -#define XK_MouseKeys_Enable 0xfe76 -#define XK_MouseKeys_Accel_Enable 0xfe77 -#define XK_Overlay1_Enable 0xfe78 -#define XK_Overlay2_Enable 0xfe79 -#define XK_AudibleBell_Enable 0xfe7a - -#define XK_Pointer_Left 0xfee0 -#define XK_Pointer_Right 0xfee1 -#define XK_Pointer_Up 0xfee2 -#define XK_Pointer_Down 0xfee3 -#define XK_Pointer_UpLeft 0xfee4 -#define XK_Pointer_UpRight 0xfee5 -#define XK_Pointer_DownLeft 0xfee6 -#define XK_Pointer_DownRight 0xfee7 -#define XK_Pointer_Button_Dflt 0xfee8 -#define XK_Pointer_Button1 0xfee9 -#define XK_Pointer_Button2 0xfeea -#define XK_Pointer_Button3 0xfeeb -#define XK_Pointer_Button4 0xfeec -#define XK_Pointer_Button5 0xfeed -#define XK_Pointer_DblClick_Dflt 0xfeee -#define XK_Pointer_DblClick1 0xfeef -#define XK_Pointer_DblClick2 0xfef0 -#define XK_Pointer_DblClick3 0xfef1 -#define XK_Pointer_DblClick4 0xfef2 -#define XK_Pointer_DblClick5 0xfef3 -#define XK_Pointer_Drag_Dflt 0xfef4 -#define XK_Pointer_Drag1 0xfef5 -#define XK_Pointer_Drag2 0xfef6 -#define XK_Pointer_Drag3 0xfef7 -#define XK_Pointer_Drag4 0xfef8 -#define XK_Pointer_Drag5 0xfefd - -#define XK_Pointer_EnableKeys 0xfef9 -#define XK_Pointer_Accelerate 0xfefa -#define XK_Pointer_DfltBtnNext 0xfefb -#define XK_Pointer_DfltBtnPrev 0xfefc - -/* Single-Stroke Multiple-Character N-Graph Keysyms For The X Input Method */ - -#define XK_ch 0xfea0 -#define XK_Ch 0xfea1 -#define XK_CH 0xfea2 -#define XK_c_h 0xfea3 -#define XK_C_h 0xfea4 -#define XK_C_H 0xfea5 - -#endif /* XK_XKB_KEYS */ - -/* - * 3270 Terminal Keys - * Byte 3 = 0xfd - */ - -#ifdef XK_3270 -#define XK_3270_Duplicate 0xfd01 -#define XK_3270_FieldMark 0xfd02 -#define XK_3270_Right2 0xfd03 -#define XK_3270_Left2 0xfd04 -#define XK_3270_BackTab 0xfd05 -#define XK_3270_EraseEOF 0xfd06 -#define XK_3270_EraseInput 0xfd07 -#define XK_3270_Reset 0xfd08 -#define XK_3270_Quit 0xfd09 -#define XK_3270_PA1 0xfd0a -#define XK_3270_PA2 0xfd0b -#define XK_3270_PA3 0xfd0c -#define XK_3270_Test 0xfd0d -#define XK_3270_Attn 0xfd0e -#define XK_3270_CursorBlink 0xfd0f -#define XK_3270_AltCursor 0xfd10 -#define XK_3270_KeyClick 0xfd11 -#define XK_3270_Jump 0xfd12 -#define XK_3270_Ident 0xfd13 -#define XK_3270_Rule 0xfd14 -#define XK_3270_Copy 0xfd15 -#define XK_3270_Play 0xfd16 -#define XK_3270_Setup 0xfd17 -#define XK_3270_Record 0xfd18 -#define XK_3270_ChangeScreen 0xfd19 -#define XK_3270_DeleteWord 0xfd1a -#define XK_3270_ExSelect 0xfd1b -#define XK_3270_CursorSelect 0xfd1c -#define XK_3270_PrintScreen 0xfd1d -#define XK_3270_Enter 0xfd1e -#endif /* XK_3270 */ - -/* - * Latin 1 - * (ISO/IEC 8859-1 = Unicode U+0020..U+00FF) - * Byte 3 = 0 - */ -#ifdef XK_LATIN1 -#define XK_space 0x0020 /* U+0020 SPACE */ -#define XK_exclam 0x0021 /* U+0021 EXCLAMATION MARK */ -#define XK_quotedbl 0x0022 /* U+0022 QUOTATION MARK */ -#define XK_numbersign 0x0023 /* U+0023 NUMBER SIGN */ -#define XK_dollar 0x0024 /* U+0024 DOLLAR SIGN */ -#define XK_percent 0x0025 /* U+0025 PERCENT SIGN */ -#define XK_ampersand 0x0026 /* U+0026 AMPERSAND */ -#define XK_apostrophe 0x0027 /* U+0027 APOSTROPHE */ -#define XK_quoteright 0x0027 /* deprecated */ -#define XK_parenleft 0x0028 /* U+0028 LEFT PARENTHESIS */ -#define XK_parenright 0x0029 /* U+0029 RIGHT PARENTHESIS */ -#define XK_asterisk 0x002a /* U+002A ASTERISK */ -#define XK_plus 0x002b /* U+002B PLUS SIGN */ -#define XK_comma 0x002c /* U+002C COMMA */ -#define XK_minus 0x002d /* U+002D HYPHEN-MINUS */ -#define XK_period 0x002e /* U+002E FULL STOP */ -#define XK_slash 0x002f /* U+002F SOLIDUS */ -#define XK_0 0x0030 /* U+0030 DIGIT ZERO */ -#define XK_1 0x0031 /* U+0031 DIGIT ONE */ -#define XK_2 0x0032 /* U+0032 DIGIT TWO */ -#define XK_3 0x0033 /* U+0033 DIGIT THREE */ -#define XK_4 0x0034 /* U+0034 DIGIT FOUR */ -#define XK_5 0x0035 /* U+0035 DIGIT FIVE */ -#define XK_6 0x0036 /* U+0036 DIGIT SIX */ -#define XK_7 0x0037 /* U+0037 DIGIT SEVEN */ -#define XK_8 0x0038 /* U+0038 DIGIT EIGHT */ -#define XK_9 0x0039 /* U+0039 DIGIT NINE */ -#define XK_colon 0x003a /* U+003A COLON */ -#define XK_semicolon 0x003b /* U+003B SEMICOLON */ -#define XK_less 0x003c /* U+003C LESS-THAN SIGN */ -#define XK_equal 0x003d /* U+003D EQUALS SIGN */ -#define XK_greater 0x003e /* U+003E GREATER-THAN SIGN */ -#define XK_question 0x003f /* U+003F QUESTION MARK */ -#define XK_at 0x0040 /* U+0040 COMMERCIAL AT */ -#define XK_A 0x0041 /* U+0041 LATIN CAPITAL LETTER A */ -#define XK_B 0x0042 /* U+0042 LATIN CAPITAL LETTER B */ -#define XK_C 0x0043 /* U+0043 LATIN CAPITAL LETTER C */ -#define XK_D 0x0044 /* U+0044 LATIN CAPITAL LETTER D */ -#define XK_E 0x0045 /* U+0045 LATIN CAPITAL LETTER E */ -#define XK_F 0x0046 /* U+0046 LATIN CAPITAL LETTER F */ -#define XK_G 0x0047 /* U+0047 LATIN CAPITAL LETTER G */ -#define XK_H 0x0048 /* U+0048 LATIN CAPITAL LETTER H */ -#define XK_I 0x0049 /* U+0049 LATIN CAPITAL LETTER I */ -#define XK_J 0x004a /* U+004A LATIN CAPITAL LETTER J */ -#define XK_K 0x004b /* U+004B LATIN CAPITAL LETTER K */ -#define XK_L 0x004c /* U+004C LATIN CAPITAL LETTER L */ -#define XK_M 0x004d /* U+004D LATIN CAPITAL LETTER M */ -#define XK_N 0x004e /* U+004E LATIN CAPITAL LETTER N */ -#define XK_O 0x004f /* U+004F LATIN CAPITAL LETTER O */ -#define XK_P 0x0050 /* U+0050 LATIN CAPITAL LETTER P */ -#define XK_Q 0x0051 /* U+0051 LATIN CAPITAL LETTER Q */ -#define XK_R 0x0052 /* U+0052 LATIN CAPITAL LETTER R */ -#define XK_S 0x0053 /* U+0053 LATIN CAPITAL LETTER S */ -#define XK_T 0x0054 /* U+0054 LATIN CAPITAL LETTER T */ -#define XK_U 0x0055 /* U+0055 LATIN CAPITAL LETTER U */ -#define XK_V 0x0056 /* U+0056 LATIN CAPITAL LETTER V */ -#define XK_W 0x0057 /* U+0057 LATIN CAPITAL LETTER W */ -#define XK_X 0x0058 /* U+0058 LATIN CAPITAL LETTER X */ -#define XK_Y 0x0059 /* U+0059 LATIN CAPITAL LETTER Y */ -#define XK_Z 0x005a /* U+005A LATIN CAPITAL LETTER Z */ -#define XK_bracketleft 0x005b /* U+005B LEFT SQUARE BRACKET */ -#define XK_backslash 0x005c /* U+005C REVERSE SOLIDUS */ -#define XK_bracketright 0x005d /* U+005D RIGHT SQUARE BRACKET */ -#define XK_asciicircum 0x005e /* U+005E CIRCUMFLEX ACCENT */ -#define XK_underscore 0x005f /* U+005F LOW LINE */ -#define XK_grave 0x0060 /* U+0060 GRAVE ACCENT */ -#define XK_quoteleft 0x0060 /* deprecated */ -#define XK_a 0x0061 /* U+0061 LATIN SMALL LETTER A */ -#define XK_b 0x0062 /* U+0062 LATIN SMALL LETTER B */ -#define XK_c 0x0063 /* U+0063 LATIN SMALL LETTER C */ -#define XK_d 0x0064 /* U+0064 LATIN SMALL LETTER D */ -#define XK_e 0x0065 /* U+0065 LATIN SMALL LETTER E */ -#define XK_f 0x0066 /* U+0066 LATIN SMALL LETTER F */ -#define XK_g 0x0067 /* U+0067 LATIN SMALL LETTER G */ -#define XK_h 0x0068 /* U+0068 LATIN SMALL LETTER H */ -#define XK_i 0x0069 /* U+0069 LATIN SMALL LETTER I */ -#define XK_j 0x006a /* U+006A LATIN SMALL LETTER J */ -#define XK_k 0x006b /* U+006B LATIN SMALL LETTER K */ -#define XK_l 0x006c /* U+006C LATIN SMALL LETTER L */ -#define XK_m 0x006d /* U+006D LATIN SMALL LETTER M */ -#define XK_n 0x006e /* U+006E LATIN SMALL LETTER N */ -#define XK_o 0x006f /* U+006F LATIN SMALL LETTER O */ -#define XK_p 0x0070 /* U+0070 LATIN SMALL LETTER P */ -#define XK_q 0x0071 /* U+0071 LATIN SMALL LETTER Q */ -#define XK_r 0x0072 /* U+0072 LATIN SMALL LETTER R */ -#define XK_s 0x0073 /* U+0073 LATIN SMALL LETTER S */ -#define XK_t 0x0074 /* U+0074 LATIN SMALL LETTER T */ -#define XK_u 0x0075 /* U+0075 LATIN SMALL LETTER U */ -#define XK_v 0x0076 /* U+0076 LATIN SMALL LETTER V */ -#define XK_w 0x0077 /* U+0077 LATIN SMALL LETTER W */ -#define XK_x 0x0078 /* U+0078 LATIN SMALL LETTER X */ -#define XK_y 0x0079 /* U+0079 LATIN SMALL LETTER Y */ -#define XK_z 0x007a /* U+007A LATIN SMALL LETTER Z */ -#define XK_braceleft 0x007b /* U+007B LEFT CURLY BRACKET */ -#define XK_bar 0x007c /* U+007C VERTICAL LINE */ -#define XK_braceright 0x007d /* U+007D RIGHT CURLY BRACKET */ -#define XK_asciitilde 0x007e /* U+007E TILDE */ - -#define XK_nobreakspace 0x00a0 /* U+00A0 NO-BREAK SPACE */ -#define XK_exclamdown 0x00a1 /* U+00A1 INVERTED EXCLAMATION MARK */ -#define XK_cent 0x00a2 /* U+00A2 CENT SIGN */ -#define XK_sterling 0x00a3 /* U+00A3 POUND SIGN */ -#define XK_currency 0x00a4 /* U+00A4 CURRENCY SIGN */ -#define XK_yen 0x00a5 /* U+00A5 YEN SIGN */ -#define XK_brokenbar 0x00a6 /* U+00A6 BROKEN BAR */ -#define XK_section 0x00a7 /* U+00A7 SECTION SIGN */ -#define XK_diaeresis 0x00a8 /* U+00A8 DIAERESIS */ -#define XK_copyright 0x00a9 /* U+00A9 COPYRIGHT SIGN */ -#define XK_ordfeminine 0x00aa /* U+00AA FEMININE ORDINAL INDICATOR */ -#define XK_guillemotleft 0x00ab /* U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ -#define XK_notsign 0x00ac /* U+00AC NOT SIGN */ -#define XK_hyphen 0x00ad /* U+00AD SOFT HYPHEN */ -#define XK_registered 0x00ae /* U+00AE REGISTERED SIGN */ -#define XK_macron 0x00af /* U+00AF MACRON */ -#define XK_degree 0x00b0 /* U+00B0 DEGREE SIGN */ -#define XK_plusminus 0x00b1 /* U+00B1 PLUS-MINUS SIGN */ -#define XK_twosuperior 0x00b2 /* U+00B2 SUPERSCRIPT TWO */ -#define XK_threesuperior 0x00b3 /* U+00B3 SUPERSCRIPT THREE */ -#define XK_acute 0x00b4 /* U+00B4 ACUTE ACCENT */ -#define XK_mu 0x00b5 /* U+00B5 MICRO SIGN */ -#define XK_paragraph 0x00b6 /* U+00B6 PILCROW SIGN */ -#define XK_periodcentered 0x00b7 /* U+00B7 MIDDLE DOT */ -#define XK_cedilla 0x00b8 /* U+00B8 CEDILLA */ -#define XK_onesuperior 0x00b9 /* U+00B9 SUPERSCRIPT ONE */ -#define XK_masculine 0x00ba /* U+00BA MASCULINE ORDINAL INDICATOR */ -#define XK_guillemotright 0x00bb /* U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ -#define XK_onequarter 0x00bc /* U+00BC VULGAR FRACTION ONE QUARTER */ -#define XK_onehalf 0x00bd /* U+00BD VULGAR FRACTION ONE HALF */ -#define XK_threequarters 0x00be /* U+00BE VULGAR FRACTION THREE QUARTERS */ -#define XK_questiondown 0x00bf /* U+00BF INVERTED QUESTION MARK */ -#define XK_Agrave 0x00c0 /* U+00C0 LATIN CAPITAL LETTER A WITH GRAVE */ -#define XK_Aacute 0x00c1 /* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE */ -#define XK_Acircumflex 0x00c2 /* U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ -#define XK_Atilde 0x00c3 /* U+00C3 LATIN CAPITAL LETTER A WITH TILDE */ -#define XK_Adiaeresis 0x00c4 /* U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS */ -#define XK_Aring 0x00c5 /* U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE */ -#define XK_AE 0x00c6 /* U+00C6 LATIN CAPITAL LETTER AE */ -#define XK_Ccedilla 0x00c7 /* U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA */ -#define XK_Egrave 0x00c8 /* U+00C8 LATIN CAPITAL LETTER E WITH GRAVE */ -#define XK_Eacute 0x00c9 /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ -#define XK_Ecircumflex 0x00ca /* U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ -#define XK_Ediaeresis 0x00cb /* U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS */ -#define XK_Igrave 0x00cc /* U+00CC LATIN CAPITAL LETTER I WITH GRAVE */ -#define XK_Iacute 0x00cd /* U+00CD LATIN CAPITAL LETTER I WITH ACUTE */ -#define XK_Icircumflex 0x00ce /* U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ -#define XK_Idiaeresis 0x00cf /* U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS */ -#define XK_ETH 0x00d0 /* U+00D0 LATIN CAPITAL LETTER ETH */ -#define XK_Eth 0x00d0 /* deprecated */ -#define XK_Ntilde 0x00d1 /* U+00D1 LATIN CAPITAL LETTER N WITH TILDE */ -#define XK_Ograve 0x00d2 /* U+00D2 LATIN CAPITAL LETTER O WITH GRAVE */ -#define XK_Oacute 0x00d3 /* U+00D3 LATIN CAPITAL LETTER O WITH ACUTE */ -#define XK_Ocircumflex 0x00d4 /* U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ -#define XK_Otilde 0x00d5 /* U+00D5 LATIN CAPITAL LETTER O WITH TILDE */ -#define XK_Odiaeresis 0x00d6 /* U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS */ -#define XK_multiply 0x00d7 /* U+00D7 MULTIPLICATION SIGN */ -#define XK_Oslash 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ -#define XK_Ooblique 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ -#define XK_Ugrave 0x00d9 /* U+00D9 LATIN CAPITAL LETTER U WITH GRAVE */ -#define XK_Uacute 0x00da /* U+00DA LATIN CAPITAL LETTER U WITH ACUTE */ -#define XK_Ucircumflex 0x00db /* U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ -#define XK_Udiaeresis 0x00dc /* U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS */ -#define XK_Yacute 0x00dd /* U+00DD LATIN CAPITAL LETTER Y WITH ACUTE */ -#define XK_THORN 0x00de /* U+00DE LATIN CAPITAL LETTER THORN */ -#define XK_Thorn 0x00de /* deprecated */ -#define XK_ssharp 0x00df /* U+00DF LATIN SMALL LETTER SHARP S */ -#define XK_agrave 0x00e0 /* U+00E0 LATIN SMALL LETTER A WITH GRAVE */ -#define XK_aacute 0x00e1 /* U+00E1 LATIN SMALL LETTER A WITH ACUTE */ -#define XK_acircumflex 0x00e2 /* U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX */ -#define XK_atilde 0x00e3 /* U+00E3 LATIN SMALL LETTER A WITH TILDE */ -#define XK_adiaeresis 0x00e4 /* U+00E4 LATIN SMALL LETTER A WITH DIAERESIS */ -#define XK_aring 0x00e5 /* U+00E5 LATIN SMALL LETTER A WITH RING ABOVE */ -#define XK_ae 0x00e6 /* U+00E6 LATIN SMALL LETTER AE */ -#define XK_ccedilla 0x00e7 /* U+00E7 LATIN SMALL LETTER C WITH CEDILLA */ -#define XK_egrave 0x00e8 /* U+00E8 LATIN SMALL LETTER E WITH GRAVE */ -#define XK_eacute 0x00e9 /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ -#define XK_ecircumflex 0x00ea /* U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX */ -#define XK_ediaeresis 0x00eb /* U+00EB LATIN SMALL LETTER E WITH DIAERESIS */ -#define XK_igrave 0x00ec /* U+00EC LATIN SMALL LETTER I WITH GRAVE */ -#define XK_iacute 0x00ed /* U+00ED LATIN SMALL LETTER I WITH ACUTE */ -#define XK_icircumflex 0x00ee /* U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX */ -#define XK_idiaeresis 0x00ef /* U+00EF LATIN SMALL LETTER I WITH DIAERESIS */ -#define XK_eth 0x00f0 /* U+00F0 LATIN SMALL LETTER ETH */ -#define XK_ntilde 0x00f1 /* U+00F1 LATIN SMALL LETTER N WITH TILDE */ -#define XK_ograve 0x00f2 /* U+00F2 LATIN SMALL LETTER O WITH GRAVE */ -#define XK_oacute 0x00f3 /* U+00F3 LATIN SMALL LETTER O WITH ACUTE */ -#define XK_ocircumflex 0x00f4 /* U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX */ -#define XK_otilde 0x00f5 /* U+00F5 LATIN SMALL LETTER O WITH TILDE */ -#define XK_odiaeresis 0x00f6 /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */ -#define XK_division 0x00f7 /* U+00F7 DIVISION SIGN */ -#define XK_oslash 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ -#define XK_ooblique 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ -#define XK_ugrave 0x00f9 /* U+00F9 LATIN SMALL LETTER U WITH GRAVE */ -#define XK_uacute 0x00fa /* U+00FA LATIN SMALL LETTER U WITH ACUTE */ -#define XK_ucircumflex 0x00fb /* U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX */ -#define XK_udiaeresis 0x00fc /* U+00FC LATIN SMALL LETTER U WITH DIAERESIS */ -#define XK_yacute 0x00fd /* U+00FD LATIN SMALL LETTER Y WITH ACUTE */ -#define XK_thorn 0x00fe /* U+00FE LATIN SMALL LETTER THORN */ -#define XK_ydiaeresis 0x00ff /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ -#endif /* XK_LATIN1 */ - -/* - * Latin 2 - * Byte 3 = 1 - */ - -#ifdef XK_LATIN2 -#define XK_Aogonek 0x01a1 /* U+0104 LATIN CAPITAL LETTER A WITH OGONEK */ -#define XK_breve 0x01a2 /* U+02D8 BREVE */ -#define XK_Lstroke 0x01a3 /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ -#define XK_Lcaron 0x01a5 /* U+013D LATIN CAPITAL LETTER L WITH CARON */ -#define XK_Sacute 0x01a6 /* U+015A LATIN CAPITAL LETTER S WITH ACUTE */ -#define XK_Scaron 0x01a9 /* U+0160 LATIN CAPITAL LETTER S WITH CARON */ -#define XK_Scedilla 0x01aa /* U+015E LATIN CAPITAL LETTER S WITH CEDILLA */ -#define XK_Tcaron 0x01ab /* U+0164 LATIN CAPITAL LETTER T WITH CARON */ -#define XK_Zacute 0x01ac /* U+0179 LATIN CAPITAL LETTER Z WITH ACUTE */ -#define XK_Zcaron 0x01ae /* U+017D LATIN CAPITAL LETTER Z WITH CARON */ -#define XK_Zabovedot 0x01af /* U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE */ -#define XK_aogonek 0x01b1 /* U+0105 LATIN SMALL LETTER A WITH OGONEK */ -#define XK_ogonek 0x01b2 /* U+02DB OGONEK */ -#define XK_lstroke 0x01b3 /* U+0142 LATIN SMALL LETTER L WITH STROKE */ -#define XK_lcaron 0x01b5 /* U+013E LATIN SMALL LETTER L WITH CARON */ -#define XK_sacute 0x01b6 /* U+015B LATIN SMALL LETTER S WITH ACUTE */ -#define XK_caron 0x01b7 /* U+02C7 CARON */ -#define XK_scaron 0x01b9 /* U+0161 LATIN SMALL LETTER S WITH CARON */ -#define XK_scedilla 0x01ba /* U+015F LATIN SMALL LETTER S WITH CEDILLA */ -#define XK_tcaron 0x01bb /* U+0165 LATIN SMALL LETTER T WITH CARON */ -#define XK_zacute 0x01bc /* U+017A LATIN SMALL LETTER Z WITH ACUTE */ -#define XK_doubleacute 0x01bd /* U+02DD DOUBLE ACUTE ACCENT */ -#define XK_zcaron 0x01be /* U+017E LATIN SMALL LETTER Z WITH CARON */ -#define XK_zabovedot 0x01bf /* U+017C LATIN SMALL LETTER Z WITH DOT ABOVE */ -#define XK_Racute 0x01c0 /* U+0154 LATIN CAPITAL LETTER R WITH ACUTE */ -#define XK_Abreve 0x01c3 /* U+0102 LATIN CAPITAL LETTER A WITH BREVE */ -#define XK_Lacute 0x01c5 /* U+0139 LATIN CAPITAL LETTER L WITH ACUTE */ -#define XK_Cacute 0x01c6 /* U+0106 LATIN CAPITAL LETTER C WITH ACUTE */ -#define XK_Ccaron 0x01c8 /* U+010C LATIN CAPITAL LETTER C WITH CARON */ -#define XK_Eogonek 0x01ca /* U+0118 LATIN CAPITAL LETTER E WITH OGONEK */ -#define XK_Ecaron 0x01cc /* U+011A LATIN CAPITAL LETTER E WITH CARON */ -#define XK_Dcaron 0x01cf /* U+010E LATIN CAPITAL LETTER D WITH CARON */ -#define XK_Dstroke 0x01d0 /* U+0110 LATIN CAPITAL LETTER D WITH STROKE */ -#define XK_Nacute 0x01d1 /* U+0143 LATIN CAPITAL LETTER N WITH ACUTE */ -#define XK_Ncaron 0x01d2 /* U+0147 LATIN CAPITAL LETTER N WITH CARON */ -#define XK_Odoubleacute 0x01d5 /* U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */ -#define XK_Rcaron 0x01d8 /* U+0158 LATIN CAPITAL LETTER R WITH CARON */ -#define XK_Uring 0x01d9 /* U+016E LATIN CAPITAL LETTER U WITH RING ABOVE */ -#define XK_Udoubleacute 0x01db /* U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */ -#define XK_Tcedilla 0x01de /* U+0162 LATIN CAPITAL LETTER T WITH CEDILLA */ -#define XK_racute 0x01e0 /* U+0155 LATIN SMALL LETTER R WITH ACUTE */ -#define XK_abreve 0x01e3 /* U+0103 LATIN SMALL LETTER A WITH BREVE */ -#define XK_lacute 0x01e5 /* U+013A LATIN SMALL LETTER L WITH ACUTE */ -#define XK_cacute 0x01e6 /* U+0107 LATIN SMALL LETTER C WITH ACUTE */ -#define XK_ccaron 0x01e8 /* U+010D LATIN SMALL LETTER C WITH CARON */ -#define XK_eogonek 0x01ea /* U+0119 LATIN SMALL LETTER E WITH OGONEK */ -#define XK_ecaron 0x01ec /* U+011B LATIN SMALL LETTER E WITH CARON */ -#define XK_dcaron 0x01ef /* U+010F LATIN SMALL LETTER D WITH CARON */ -#define XK_dstroke 0x01f0 /* U+0111 LATIN SMALL LETTER D WITH STROKE */ -#define XK_nacute 0x01f1 /* U+0144 LATIN SMALL LETTER N WITH ACUTE */ -#define XK_ncaron 0x01f2 /* U+0148 LATIN SMALL LETTER N WITH CARON */ -#define XK_odoubleacute 0x01f5 /* U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE */ -#define XK_rcaron 0x01f8 /* U+0159 LATIN SMALL LETTER R WITH CARON */ -#define XK_uring 0x01f9 /* U+016F LATIN SMALL LETTER U WITH RING ABOVE */ -#define XK_udoubleacute 0x01fb /* U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE */ -#define XK_tcedilla 0x01fe /* U+0163 LATIN SMALL LETTER T WITH CEDILLA */ -#define XK_abovedot 0x01ff /* U+02D9 DOT ABOVE */ -#endif /* XK_LATIN2 */ - -/* - * Latin 3 - * Byte 3 = 2 - */ - -#ifdef XK_LATIN3 -#define XK_Hstroke 0x02a1 /* U+0126 LATIN CAPITAL LETTER H WITH STROKE */ -#define XK_Hcircumflex 0x02a6 /* U+0124 LATIN CAPITAL LETTER H WITH CIRCUMFLEX */ -#define XK_Iabovedot 0x02a9 /* U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE */ -#define XK_Gbreve 0x02ab /* U+011E LATIN CAPITAL LETTER G WITH BREVE */ -#define XK_Jcircumflex 0x02ac /* U+0134 LATIN CAPITAL LETTER J WITH CIRCUMFLEX */ -#define XK_hstroke 0x02b1 /* U+0127 LATIN SMALL LETTER H WITH STROKE */ -#define XK_hcircumflex 0x02b6 /* U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX */ -#define XK_idotless 0x02b9 /* U+0131 LATIN SMALL LETTER DOTLESS I */ -#define XK_gbreve 0x02bb /* U+011F LATIN SMALL LETTER G WITH BREVE */ -#define XK_jcircumflex 0x02bc /* U+0135 LATIN SMALL LETTER J WITH CIRCUMFLEX */ -#define XK_Cabovedot 0x02c5 /* U+010A LATIN CAPITAL LETTER C WITH DOT ABOVE */ -#define XK_Ccircumflex 0x02c6 /* U+0108 LATIN CAPITAL LETTER C WITH CIRCUMFLEX */ -#define XK_Gabovedot 0x02d5 /* U+0120 LATIN CAPITAL LETTER G WITH DOT ABOVE */ -#define XK_Gcircumflex 0x02d8 /* U+011C LATIN CAPITAL LETTER G WITH CIRCUMFLEX */ -#define XK_Ubreve 0x02dd /* U+016C LATIN CAPITAL LETTER U WITH BREVE */ -#define XK_Scircumflex 0x02de /* U+015C LATIN CAPITAL LETTER S WITH CIRCUMFLEX */ -#define XK_cabovedot 0x02e5 /* U+010B LATIN SMALL LETTER C WITH DOT ABOVE */ -#define XK_ccircumflex 0x02e6 /* U+0109 LATIN SMALL LETTER C WITH CIRCUMFLEX */ -#define XK_gabovedot 0x02f5 /* U+0121 LATIN SMALL LETTER G WITH DOT ABOVE */ -#define XK_gcircumflex 0x02f8 /* U+011D LATIN SMALL LETTER G WITH CIRCUMFLEX */ -#define XK_ubreve 0x02fd /* U+016D LATIN SMALL LETTER U WITH BREVE */ -#define XK_scircumflex 0x02fe /* U+015D LATIN SMALL LETTER S WITH CIRCUMFLEX */ -#endif /* XK_LATIN3 */ - - -/* - * Latin 4 - * Byte 3 = 3 - */ - -#ifdef XK_LATIN4 -#define XK_kra 0x03a2 /* U+0138 LATIN SMALL LETTER KRA */ -#define XK_kappa 0x03a2 /* deprecated */ -#define XK_Rcedilla 0x03a3 /* U+0156 LATIN CAPITAL LETTER R WITH CEDILLA */ -#define XK_Itilde 0x03a5 /* U+0128 LATIN CAPITAL LETTER I WITH TILDE */ -#define XK_Lcedilla 0x03a6 /* U+013B LATIN CAPITAL LETTER L WITH CEDILLA */ -#define XK_Emacron 0x03aa /* U+0112 LATIN CAPITAL LETTER E WITH MACRON */ -#define XK_Gcedilla 0x03ab /* U+0122 LATIN CAPITAL LETTER G WITH CEDILLA */ -#define XK_Tslash 0x03ac /* U+0166 LATIN CAPITAL LETTER T WITH STROKE */ -#define XK_rcedilla 0x03b3 /* U+0157 LATIN SMALL LETTER R WITH CEDILLA */ -#define XK_itilde 0x03b5 /* U+0129 LATIN SMALL LETTER I WITH TILDE */ -#define XK_lcedilla 0x03b6 /* U+013C LATIN SMALL LETTER L WITH CEDILLA */ -#define XK_emacron 0x03ba /* U+0113 LATIN SMALL LETTER E WITH MACRON */ -#define XK_gcedilla 0x03bb /* U+0123 LATIN SMALL LETTER G WITH CEDILLA */ -#define XK_tslash 0x03bc /* U+0167 LATIN SMALL LETTER T WITH STROKE */ -#define XK_ENG 0x03bd /* U+014A LATIN CAPITAL LETTER ENG */ -#define XK_eng 0x03bf /* U+014B LATIN SMALL LETTER ENG */ -#define XK_Amacron 0x03c0 /* U+0100 LATIN CAPITAL LETTER A WITH MACRON */ -#define XK_Iogonek 0x03c7 /* U+012E LATIN CAPITAL LETTER I WITH OGONEK */ -#define XK_Eabovedot 0x03cc /* U+0116 LATIN CAPITAL LETTER E WITH DOT ABOVE */ -#define XK_Imacron 0x03cf /* U+012A LATIN CAPITAL LETTER I WITH MACRON */ -#define XK_Ncedilla 0x03d1 /* U+0145 LATIN CAPITAL LETTER N WITH CEDILLA */ -#define XK_Omacron 0x03d2 /* U+014C LATIN CAPITAL LETTER O WITH MACRON */ -#define XK_Kcedilla 0x03d3 /* U+0136 LATIN CAPITAL LETTER K WITH CEDILLA */ -#define XK_Uogonek 0x03d9 /* U+0172 LATIN CAPITAL LETTER U WITH OGONEK */ -#define XK_Utilde 0x03dd /* U+0168 LATIN CAPITAL LETTER U WITH TILDE */ -#define XK_Umacron 0x03de /* U+016A LATIN CAPITAL LETTER U WITH MACRON */ -#define XK_amacron 0x03e0 /* U+0101 LATIN SMALL LETTER A WITH MACRON */ -#define XK_iogonek 0x03e7 /* U+012F LATIN SMALL LETTER I WITH OGONEK */ -#define XK_eabovedot 0x03ec /* U+0117 LATIN SMALL LETTER E WITH DOT ABOVE */ -#define XK_imacron 0x03ef /* U+012B LATIN SMALL LETTER I WITH MACRON */ -#define XK_ncedilla 0x03f1 /* U+0146 LATIN SMALL LETTER N WITH CEDILLA */ -#define XK_omacron 0x03f2 /* U+014D LATIN SMALL LETTER O WITH MACRON */ -#define XK_kcedilla 0x03f3 /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */ -#define XK_uogonek 0x03f9 /* U+0173 LATIN SMALL LETTER U WITH OGONEK */ -#define XK_utilde 0x03fd /* U+0169 LATIN SMALL LETTER U WITH TILDE */ -#define XK_umacron 0x03fe /* U+016B LATIN SMALL LETTER U WITH MACRON */ -#endif /* XK_LATIN4 */ - -/* - * Latin 8 - */ -#ifdef XK_LATIN8 -#define XK_Wcircumflex 0x1000174 /* U+0174 LATIN CAPITAL LETTER W WITH CIRCUMFLEX */ -#define XK_wcircumflex 0x1000175 /* U+0175 LATIN SMALL LETTER W WITH CIRCUMFLEX */ -#define XK_Ycircumflex 0x1000176 /* U+0176 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX */ -#define XK_ycircumflex 0x1000177 /* U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX */ -#define XK_Babovedot 0x1001e02 /* U+1E02 LATIN CAPITAL LETTER B WITH DOT ABOVE */ -#define XK_babovedot 0x1001e03 /* U+1E03 LATIN SMALL LETTER B WITH DOT ABOVE */ -#define XK_Dabovedot 0x1001e0a /* U+1E0A LATIN CAPITAL LETTER D WITH DOT ABOVE */ -#define XK_dabovedot 0x1001e0b /* U+1E0B LATIN SMALL LETTER D WITH DOT ABOVE */ -#define XK_Fabovedot 0x1001e1e /* U+1E1E LATIN CAPITAL LETTER F WITH DOT ABOVE */ -#define XK_fabovedot 0x1001e1f /* U+1E1F LATIN SMALL LETTER F WITH DOT ABOVE */ -#define XK_Mabovedot 0x1001e40 /* U+1E40 LATIN CAPITAL LETTER M WITH DOT ABOVE */ -#define XK_mabovedot 0x1001e41 /* U+1E41 LATIN SMALL LETTER M WITH DOT ABOVE */ -#define XK_Pabovedot 0x1001e56 /* U+1E56 LATIN CAPITAL LETTER P WITH DOT ABOVE */ -#define XK_pabovedot 0x1001e57 /* U+1E57 LATIN SMALL LETTER P WITH DOT ABOVE */ -#define XK_Sabovedot 0x1001e60 /* U+1E60 LATIN CAPITAL LETTER S WITH DOT ABOVE */ -#define XK_sabovedot 0x1001e61 /* U+1E61 LATIN SMALL LETTER S WITH DOT ABOVE */ -#define XK_Tabovedot 0x1001e6a /* U+1E6A LATIN CAPITAL LETTER T WITH DOT ABOVE */ -#define XK_tabovedot 0x1001e6b /* U+1E6B LATIN SMALL LETTER T WITH DOT ABOVE */ -#define XK_Wgrave 0x1001e80 /* U+1E80 LATIN CAPITAL LETTER W WITH GRAVE */ -#define XK_wgrave 0x1001e81 /* U+1E81 LATIN SMALL LETTER W WITH GRAVE */ -#define XK_Wacute 0x1001e82 /* U+1E82 LATIN CAPITAL LETTER W WITH ACUTE */ -#define XK_wacute 0x1001e83 /* U+1E83 LATIN SMALL LETTER W WITH ACUTE */ -#define XK_Wdiaeresis 0x1001e84 /* U+1E84 LATIN CAPITAL LETTER W WITH DIAERESIS */ -#define XK_wdiaeresis 0x1001e85 /* U+1E85 LATIN SMALL LETTER W WITH DIAERESIS */ -#define XK_Ygrave 0x1001ef2 /* U+1EF2 LATIN CAPITAL LETTER Y WITH GRAVE */ -#define XK_ygrave 0x1001ef3 /* U+1EF3 LATIN SMALL LETTER Y WITH GRAVE */ -#endif /* XK_LATIN8 */ - -/* - * Latin 9 - * Byte 3 = 0x13 - */ - -#ifdef XK_LATIN9 -#define XK_OE 0x13bc /* U+0152 LATIN CAPITAL LIGATURE OE */ -#define XK_oe 0x13bd /* U+0153 LATIN SMALL LIGATURE OE */ -#define XK_Ydiaeresis 0x13be /* U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS */ -#endif /* XK_LATIN9 */ - -/* - * Katakana - * Byte 3 = 4 - */ - -#ifdef XK_KATAKANA -#define XK_overline 0x047e /* U+203E OVERLINE */ -#define XK_kana_fullstop 0x04a1 /* U+3002 IDEOGRAPHIC FULL STOP */ -#define XK_kana_openingbracket 0x04a2 /* U+300C LEFT CORNER BRACKET */ -#define XK_kana_closingbracket 0x04a3 /* U+300D RIGHT CORNER BRACKET */ -#define XK_kana_comma 0x04a4 /* U+3001 IDEOGRAPHIC COMMA */ -#define XK_kana_conjunctive 0x04a5 /* U+30FB KATAKANA MIDDLE DOT */ -#define XK_kana_middledot 0x04a5 /* deprecated */ -#define XK_kana_WO 0x04a6 /* U+30F2 KATAKANA LETTER WO */ -#define XK_kana_a 0x04a7 /* U+30A1 KATAKANA LETTER SMALL A */ -#define XK_kana_i 0x04a8 /* U+30A3 KATAKANA LETTER SMALL I */ -#define XK_kana_u 0x04a9 /* U+30A5 KATAKANA LETTER SMALL U */ -#define XK_kana_e 0x04aa /* U+30A7 KATAKANA LETTER SMALL E */ -#define XK_kana_o 0x04ab /* U+30A9 KATAKANA LETTER SMALL O */ -#define XK_kana_ya 0x04ac /* U+30E3 KATAKANA LETTER SMALL YA */ -#define XK_kana_yu 0x04ad /* U+30E5 KATAKANA LETTER SMALL YU */ -#define XK_kana_yo 0x04ae /* U+30E7 KATAKANA LETTER SMALL YO */ -#define XK_kana_tsu 0x04af /* U+30C3 KATAKANA LETTER SMALL TU */ -#define XK_kana_tu 0x04af /* deprecated */ -#define XK_prolongedsound 0x04b0 /* U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK */ -#define XK_kana_A 0x04b1 /* U+30A2 KATAKANA LETTER A */ -#define XK_kana_I 0x04b2 /* U+30A4 KATAKANA LETTER I */ -#define XK_kana_U 0x04b3 /* U+30A6 KATAKANA LETTER U */ -#define XK_kana_E 0x04b4 /* U+30A8 KATAKANA LETTER E */ -#define XK_kana_O 0x04b5 /* U+30AA KATAKANA LETTER O */ -#define XK_kana_KA 0x04b6 /* U+30AB KATAKANA LETTER KA */ -#define XK_kana_KI 0x04b7 /* U+30AD KATAKANA LETTER KI */ -#define XK_kana_KU 0x04b8 /* U+30AF KATAKANA LETTER KU */ -#define XK_kana_KE 0x04b9 /* U+30B1 KATAKANA LETTER KE */ -#define XK_kana_KO 0x04ba /* U+30B3 KATAKANA LETTER KO */ -#define XK_kana_SA 0x04bb /* U+30B5 KATAKANA LETTER SA */ -#define XK_kana_SHI 0x04bc /* U+30B7 KATAKANA LETTER SI */ -#define XK_kana_SU 0x04bd /* U+30B9 KATAKANA LETTER SU */ -#define XK_kana_SE 0x04be /* U+30BB KATAKANA LETTER SE */ -#define XK_kana_SO 0x04bf /* U+30BD KATAKANA LETTER SO */ -#define XK_kana_TA 0x04c0 /* U+30BF KATAKANA LETTER TA */ -#define XK_kana_CHI 0x04c1 /* U+30C1 KATAKANA LETTER TI */ -#define XK_kana_TI 0x04c1 /* deprecated */ -#define XK_kana_TSU 0x04c2 /* U+30C4 KATAKANA LETTER TU */ -#define XK_kana_TU 0x04c2 /* deprecated */ -#define XK_kana_TE 0x04c3 /* U+30C6 KATAKANA LETTER TE */ -#define XK_kana_TO 0x04c4 /* U+30C8 KATAKANA LETTER TO */ -#define XK_kana_NA 0x04c5 /* U+30CA KATAKANA LETTER NA */ -#define XK_kana_NI 0x04c6 /* U+30CB KATAKANA LETTER NI */ -#define XK_kana_NU 0x04c7 /* U+30CC KATAKANA LETTER NU */ -#define XK_kana_NE 0x04c8 /* U+30CD KATAKANA LETTER NE */ -#define XK_kana_NO 0x04c9 /* U+30CE KATAKANA LETTER NO */ -#define XK_kana_HA 0x04ca /* U+30CF KATAKANA LETTER HA */ -#define XK_kana_HI 0x04cb /* U+30D2 KATAKANA LETTER HI */ -#define XK_kana_FU 0x04cc /* U+30D5 KATAKANA LETTER HU */ -#define XK_kana_HU 0x04cc /* deprecated */ -#define XK_kana_HE 0x04cd /* U+30D8 KATAKANA LETTER HE */ -#define XK_kana_HO 0x04ce /* U+30DB KATAKANA LETTER HO */ -#define XK_kana_MA 0x04cf /* U+30DE KATAKANA LETTER MA */ -#define XK_kana_MI 0x04d0 /* U+30DF KATAKANA LETTER MI */ -#define XK_kana_MU 0x04d1 /* U+30E0 KATAKANA LETTER MU */ -#define XK_kana_ME 0x04d2 /* U+30E1 KATAKANA LETTER ME */ -#define XK_kana_MO 0x04d3 /* U+30E2 KATAKANA LETTER MO */ -#define XK_kana_YA 0x04d4 /* U+30E4 KATAKANA LETTER YA */ -#define XK_kana_YU 0x04d5 /* U+30E6 KATAKANA LETTER YU */ -#define XK_kana_YO 0x04d6 /* U+30E8 KATAKANA LETTER YO */ -#define XK_kana_RA 0x04d7 /* U+30E9 KATAKANA LETTER RA */ -#define XK_kana_RI 0x04d8 /* U+30EA KATAKANA LETTER RI */ -#define XK_kana_RU 0x04d9 /* U+30EB KATAKANA LETTER RU */ -#define XK_kana_RE 0x04da /* U+30EC KATAKANA LETTER RE */ -#define XK_kana_RO 0x04db /* U+30ED KATAKANA LETTER RO */ -#define XK_kana_WA 0x04dc /* U+30EF KATAKANA LETTER WA */ -#define XK_kana_N 0x04dd /* U+30F3 KATAKANA LETTER N */ -#define XK_voicedsound 0x04de /* U+309B KATAKANA-HIRAGANA VOICED SOUND MARK */ -#define XK_semivoicedsound 0x04df /* U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */ -#define XK_kana_switch 0xff7e /* Alias for mode_switch */ -#endif /* XK_KATAKANA */ - -/* - * Arabic - * Byte 3 = 5 - */ - -#ifdef XK_ARABIC -#define XK_Farsi_0 0x10006f0 /* U+06F0 EXTENDED ARABIC-INDIC DIGIT ZERO */ -#define XK_Farsi_1 0x10006f1 /* U+06F1 EXTENDED ARABIC-INDIC DIGIT ONE */ -#define XK_Farsi_2 0x10006f2 /* U+06F2 EXTENDED ARABIC-INDIC DIGIT TWO */ -#define XK_Farsi_3 0x10006f3 /* U+06F3 EXTENDED ARABIC-INDIC DIGIT THREE */ -#define XK_Farsi_4 0x10006f4 /* U+06F4 EXTENDED ARABIC-INDIC DIGIT FOUR */ -#define XK_Farsi_5 0x10006f5 /* U+06F5 EXTENDED ARABIC-INDIC DIGIT FIVE */ -#define XK_Farsi_6 0x10006f6 /* U+06F6 EXTENDED ARABIC-INDIC DIGIT SIX */ -#define XK_Farsi_7 0x10006f7 /* U+06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN */ -#define XK_Farsi_8 0x10006f8 /* U+06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT */ -#define XK_Farsi_9 0x10006f9 /* U+06F9 EXTENDED ARABIC-INDIC DIGIT NINE */ -#define XK_Arabic_percent 0x100066a /* U+066A ARABIC PERCENT SIGN */ -#define XK_Arabic_superscript_alef 0x1000670 /* U+0670 ARABIC LETTER SUPERSCRIPT ALEF */ -#define XK_Arabic_tteh 0x1000679 /* U+0679 ARABIC LETTER TTEH */ -#define XK_Arabic_peh 0x100067e /* U+067E ARABIC LETTER PEH */ -#define XK_Arabic_tcheh 0x1000686 /* U+0686 ARABIC LETTER TCHEH */ -#define XK_Arabic_ddal 0x1000688 /* U+0688 ARABIC LETTER DDAL */ -#define XK_Arabic_rreh 0x1000691 /* U+0691 ARABIC LETTER RREH */ -#define XK_Arabic_comma 0x05ac /* U+060C ARABIC COMMA */ -#define XK_Arabic_fullstop 0x10006d4 /* U+06D4 ARABIC FULL STOP */ -#define XK_Arabic_0 0x1000660 /* U+0660 ARABIC-INDIC DIGIT ZERO */ -#define XK_Arabic_1 0x1000661 /* U+0661 ARABIC-INDIC DIGIT ONE */ -#define XK_Arabic_2 0x1000662 /* U+0662 ARABIC-INDIC DIGIT TWO */ -#define XK_Arabic_3 0x1000663 /* U+0663 ARABIC-INDIC DIGIT THREE */ -#define XK_Arabic_4 0x1000664 /* U+0664 ARABIC-INDIC DIGIT FOUR */ -#define XK_Arabic_5 0x1000665 /* U+0665 ARABIC-INDIC DIGIT FIVE */ -#define XK_Arabic_6 0x1000666 /* U+0666 ARABIC-INDIC DIGIT SIX */ -#define XK_Arabic_7 0x1000667 /* U+0667 ARABIC-INDIC DIGIT SEVEN */ -#define XK_Arabic_8 0x1000668 /* U+0668 ARABIC-INDIC DIGIT EIGHT */ -#define XK_Arabic_9 0x1000669 /* U+0669 ARABIC-INDIC DIGIT NINE */ -#define XK_Arabic_semicolon 0x05bb /* U+061B ARABIC SEMICOLON */ -#define XK_Arabic_question_mark 0x05bf /* U+061F ARABIC QUESTION MARK */ -#define XK_Arabic_hamza 0x05c1 /* U+0621 ARABIC LETTER HAMZA */ -#define XK_Arabic_maddaonalef 0x05c2 /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */ -#define XK_Arabic_hamzaonalef 0x05c3 /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */ -#define XK_Arabic_hamzaonwaw 0x05c4 /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */ -#define XK_Arabic_hamzaunderalef 0x05c5 /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */ -#define XK_Arabic_hamzaonyeh 0x05c6 /* U+0626 ARABIC LETTER YEH WITH HAMZA ABOVE */ -#define XK_Arabic_alef 0x05c7 /* U+0627 ARABIC LETTER ALEF */ -#define XK_Arabic_beh 0x05c8 /* U+0628 ARABIC LETTER BEH */ -#define XK_Arabic_tehmarbuta 0x05c9 /* U+0629 ARABIC LETTER TEH MARBUTA */ -#define XK_Arabic_teh 0x05ca /* U+062A ARABIC LETTER TEH */ -#define XK_Arabic_theh 0x05cb /* U+062B ARABIC LETTER THEH */ -#define XK_Arabic_jeem 0x05cc /* U+062C ARABIC LETTER JEEM */ -#define XK_Arabic_hah 0x05cd /* U+062D ARABIC LETTER HAH */ -#define XK_Arabic_khah 0x05ce /* U+062E ARABIC LETTER KHAH */ -#define XK_Arabic_dal 0x05cf /* U+062F ARABIC LETTER DAL */ -#define XK_Arabic_thal 0x05d0 /* U+0630 ARABIC LETTER THAL */ -#define XK_Arabic_ra 0x05d1 /* U+0631 ARABIC LETTER REH */ -#define XK_Arabic_zain 0x05d2 /* U+0632 ARABIC LETTER ZAIN */ -#define XK_Arabic_seen 0x05d3 /* U+0633 ARABIC LETTER SEEN */ -#define XK_Arabic_sheen 0x05d4 /* U+0634 ARABIC LETTER SHEEN */ -#define XK_Arabic_sad 0x05d5 /* U+0635 ARABIC LETTER SAD */ -#define XK_Arabic_dad 0x05d6 /* U+0636 ARABIC LETTER DAD */ -#define XK_Arabic_tah 0x05d7 /* U+0637 ARABIC LETTER TAH */ -#define XK_Arabic_zah 0x05d8 /* U+0638 ARABIC LETTER ZAH */ -#define XK_Arabic_ain 0x05d9 /* U+0639 ARABIC LETTER AIN */ -#define XK_Arabic_ghain 0x05da /* U+063A ARABIC LETTER GHAIN */ -#define XK_Arabic_tatweel 0x05e0 /* U+0640 ARABIC TATWEEL */ -#define XK_Arabic_feh 0x05e1 /* U+0641 ARABIC LETTER FEH */ -#define XK_Arabic_qaf 0x05e2 /* U+0642 ARABIC LETTER QAF */ -#define XK_Arabic_kaf 0x05e3 /* U+0643 ARABIC LETTER KAF */ -#define XK_Arabic_lam 0x05e4 /* U+0644 ARABIC LETTER LAM */ -#define XK_Arabic_meem 0x05e5 /* U+0645 ARABIC LETTER MEEM */ -#define XK_Arabic_noon 0x05e6 /* U+0646 ARABIC LETTER NOON */ -#define XK_Arabic_ha 0x05e7 /* U+0647 ARABIC LETTER HEH */ -#define XK_Arabic_heh 0x05e7 /* deprecated */ -#define XK_Arabic_waw 0x05e8 /* U+0648 ARABIC LETTER WAW */ -#define XK_Arabic_alefmaksura 0x05e9 /* U+0649 ARABIC LETTER ALEF MAKSURA */ -#define XK_Arabic_yeh 0x05ea /* U+064A ARABIC LETTER YEH */ -#define XK_Arabic_fathatan 0x05eb /* U+064B ARABIC FATHATAN */ -#define XK_Arabic_dammatan 0x05ec /* U+064C ARABIC DAMMATAN */ -#define XK_Arabic_kasratan 0x05ed /* U+064D ARABIC KASRATAN */ -#define XK_Arabic_fatha 0x05ee /* U+064E ARABIC FATHA */ -#define XK_Arabic_damma 0x05ef /* U+064F ARABIC DAMMA */ -#define XK_Arabic_kasra 0x05f0 /* U+0650 ARABIC KASRA */ -#define XK_Arabic_shadda 0x05f1 /* U+0651 ARABIC SHADDA */ -#define XK_Arabic_sukun 0x05f2 /* U+0652 ARABIC SUKUN */ -#define XK_Arabic_madda_above 0x1000653 /* U+0653 ARABIC MADDAH ABOVE */ -#define XK_Arabic_hamza_above 0x1000654 /* U+0654 ARABIC HAMZA ABOVE */ -#define XK_Arabic_hamza_below 0x1000655 /* U+0655 ARABIC HAMZA BELOW */ -#define XK_Arabic_jeh 0x1000698 /* U+0698 ARABIC LETTER JEH */ -#define XK_Arabic_veh 0x10006a4 /* U+06A4 ARABIC LETTER VEH */ -#define XK_Arabic_keheh 0x10006a9 /* U+06A9 ARABIC LETTER KEHEH */ -#define XK_Arabic_gaf 0x10006af /* U+06AF ARABIC LETTER GAF */ -#define XK_Arabic_noon_ghunna 0x10006ba /* U+06BA ARABIC LETTER NOON GHUNNA */ -#define XK_Arabic_heh_doachashmee 0x10006be /* U+06BE ARABIC LETTER HEH DOACHASHMEE */ -#define XK_Farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */ -#define XK_Arabic_farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */ -#define XK_Arabic_yeh_baree 0x10006d2 /* U+06D2 ARABIC LETTER YEH BARREE */ -#define XK_Arabic_heh_goal 0x10006c1 /* U+06C1 ARABIC LETTER HEH GOAL */ -#define XK_Arabic_switch 0xff7e /* Alias for mode_switch */ -#endif /* XK_ARABIC */ - -/* - * Cyrillic - * Byte 3 = 6 - */ -#ifdef XK_CYRILLIC -#define XK_Cyrillic_GHE_bar 0x1000492 /* U+0492 CYRILLIC CAPITAL LETTER GHE WITH STROKE */ -#define XK_Cyrillic_ghe_bar 0x1000493 /* U+0493 CYRILLIC SMALL LETTER GHE WITH STROKE */ -#define XK_Cyrillic_ZHE_descender 0x1000496 /* U+0496 CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER */ -#define XK_Cyrillic_zhe_descender 0x1000497 /* U+0497 CYRILLIC SMALL LETTER ZHE WITH DESCENDER */ -#define XK_Cyrillic_KA_descender 0x100049a /* U+049A CYRILLIC CAPITAL LETTER KA WITH DESCENDER */ -#define XK_Cyrillic_ka_descender 0x100049b /* U+049B CYRILLIC SMALL LETTER KA WITH DESCENDER */ -#define XK_Cyrillic_KA_vertstroke 0x100049c /* U+049C CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE */ -#define XK_Cyrillic_ka_vertstroke 0x100049d /* U+049D CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE */ -#define XK_Cyrillic_EN_descender 0x10004a2 /* U+04A2 CYRILLIC CAPITAL LETTER EN WITH DESCENDER */ -#define XK_Cyrillic_en_descender 0x10004a3 /* U+04A3 CYRILLIC SMALL LETTER EN WITH DESCENDER */ -#define XK_Cyrillic_U_straight 0x10004ae /* U+04AE CYRILLIC CAPITAL LETTER STRAIGHT U */ -#define XK_Cyrillic_u_straight 0x10004af /* U+04AF CYRILLIC SMALL LETTER STRAIGHT U */ -#define XK_Cyrillic_U_straight_bar 0x10004b0 /* U+04B0 CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE */ -#define XK_Cyrillic_u_straight_bar 0x10004b1 /* U+04B1 CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE */ -#define XK_Cyrillic_HA_descender 0x10004b2 /* U+04B2 CYRILLIC CAPITAL LETTER HA WITH DESCENDER */ -#define XK_Cyrillic_ha_descender 0x10004b3 /* U+04B3 CYRILLIC SMALL LETTER HA WITH DESCENDER */ -#define XK_Cyrillic_CHE_descender 0x10004b6 /* U+04B6 CYRILLIC CAPITAL LETTER CHE WITH DESCENDER */ -#define XK_Cyrillic_che_descender 0x10004b7 /* U+04B7 CYRILLIC SMALL LETTER CHE WITH DESCENDER */ -#define XK_Cyrillic_CHE_vertstroke 0x10004b8 /* U+04B8 CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE */ -#define XK_Cyrillic_che_vertstroke 0x10004b9 /* U+04B9 CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE */ -#define XK_Cyrillic_SHHA 0x10004ba /* U+04BA CYRILLIC CAPITAL LETTER SHHA */ -#define XK_Cyrillic_shha 0x10004bb /* U+04BB CYRILLIC SMALL LETTER SHHA */ - -#define XK_Cyrillic_SCHWA 0x10004d8 /* U+04D8 CYRILLIC CAPITAL LETTER SCHWA */ -#define XK_Cyrillic_schwa 0x10004d9 /* U+04D9 CYRILLIC SMALL LETTER SCHWA */ -#define XK_Cyrillic_I_macron 0x10004e2 /* U+04E2 CYRILLIC CAPITAL LETTER I WITH MACRON */ -#define XK_Cyrillic_i_macron 0x10004e3 /* U+04E3 CYRILLIC SMALL LETTER I WITH MACRON */ -#define XK_Cyrillic_O_bar 0x10004e8 /* U+04E8 CYRILLIC CAPITAL LETTER BARRED O */ -#define XK_Cyrillic_o_bar 0x10004e9 /* U+04E9 CYRILLIC SMALL LETTER BARRED O */ -#define XK_Cyrillic_U_macron 0x10004ee /* U+04EE CYRILLIC CAPITAL LETTER U WITH MACRON */ -#define XK_Cyrillic_u_macron 0x10004ef /* U+04EF CYRILLIC SMALL LETTER U WITH MACRON */ - -#define XK_Serbian_dje 0x06a1 /* U+0452 CYRILLIC SMALL LETTER DJE */ -#define XK_Macedonia_gje 0x06a2 /* U+0453 CYRILLIC SMALL LETTER GJE */ -#define XK_Cyrillic_io 0x06a3 /* U+0451 CYRILLIC SMALL LETTER IO */ -#define XK_Ukrainian_ie 0x06a4 /* U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE */ -#define XK_Ukranian_je 0x06a4 /* deprecated */ -#define XK_Macedonia_dse 0x06a5 /* U+0455 CYRILLIC SMALL LETTER DZE */ -#define XK_Ukrainian_i 0x06a6 /* U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */ -#define XK_Ukranian_i 0x06a6 /* deprecated */ -#define XK_Ukrainian_yi 0x06a7 /* U+0457 CYRILLIC SMALL LETTER YI */ -#define XK_Ukranian_yi 0x06a7 /* deprecated */ -#define XK_Cyrillic_je 0x06a8 /* U+0458 CYRILLIC SMALL LETTER JE */ -#define XK_Serbian_je 0x06a8 /* deprecated */ -#define XK_Cyrillic_lje 0x06a9 /* U+0459 CYRILLIC SMALL LETTER LJE */ -#define XK_Serbian_lje 0x06a9 /* deprecated */ -#define XK_Cyrillic_nje 0x06aa /* U+045A CYRILLIC SMALL LETTER NJE */ -#define XK_Serbian_nje 0x06aa /* deprecated */ -#define XK_Serbian_tshe 0x06ab /* U+045B CYRILLIC SMALL LETTER TSHE */ -#define XK_Macedonia_kje 0x06ac /* U+045C CYRILLIC SMALL LETTER KJE */ -#define XK_Ukrainian_ghe_with_upturn 0x06ad /* U+0491 CYRILLIC SMALL LETTER GHE WITH UPTURN */ -#define XK_Byelorussian_shortu 0x06ae /* U+045E CYRILLIC SMALL LETTER SHORT U */ -#define XK_Cyrillic_dzhe 0x06af /* U+045F CYRILLIC SMALL LETTER DZHE */ -#define XK_Serbian_dze 0x06af /* deprecated */ -#define XK_numerosign 0x06b0 /* U+2116 NUMERO SIGN */ -#define XK_Serbian_DJE 0x06b1 /* U+0402 CYRILLIC CAPITAL LETTER DJE */ -#define XK_Macedonia_GJE 0x06b2 /* U+0403 CYRILLIC CAPITAL LETTER GJE */ -#define XK_Cyrillic_IO 0x06b3 /* U+0401 CYRILLIC CAPITAL LETTER IO */ -#define XK_Ukrainian_IE 0x06b4 /* U+0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE */ -#define XK_Ukranian_JE 0x06b4 /* deprecated */ -#define XK_Macedonia_DSE 0x06b5 /* U+0405 CYRILLIC CAPITAL LETTER DZE */ -#define XK_Ukrainian_I 0x06b6 /* U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */ -#define XK_Ukranian_I 0x06b6 /* deprecated */ -#define XK_Ukrainian_YI 0x06b7 /* U+0407 CYRILLIC CAPITAL LETTER YI */ -#define XK_Ukranian_YI 0x06b7 /* deprecated */ -#define XK_Cyrillic_JE 0x06b8 /* U+0408 CYRILLIC CAPITAL LETTER JE */ -#define XK_Serbian_JE 0x06b8 /* deprecated */ -#define XK_Cyrillic_LJE 0x06b9 /* U+0409 CYRILLIC CAPITAL LETTER LJE */ -#define XK_Serbian_LJE 0x06b9 /* deprecated */ -#define XK_Cyrillic_NJE 0x06ba /* U+040A CYRILLIC CAPITAL LETTER NJE */ -#define XK_Serbian_NJE 0x06ba /* deprecated */ -#define XK_Serbian_TSHE 0x06bb /* U+040B CYRILLIC CAPITAL LETTER TSHE */ -#define XK_Macedonia_KJE 0x06bc /* U+040C CYRILLIC CAPITAL LETTER KJE */ -#define XK_Ukrainian_GHE_WITH_UPTURN 0x06bd /* U+0490 CYRILLIC CAPITAL LETTER GHE WITH UPTURN */ -#define XK_Byelorussian_SHORTU 0x06be /* U+040E CYRILLIC CAPITAL LETTER SHORT U */ -#define XK_Cyrillic_DZHE 0x06bf /* U+040F CYRILLIC CAPITAL LETTER DZHE */ -#define XK_Serbian_DZE 0x06bf /* deprecated */ -#define XK_Cyrillic_yu 0x06c0 /* U+044E CYRILLIC SMALL LETTER YU */ -#define XK_Cyrillic_a 0x06c1 /* U+0430 CYRILLIC SMALL LETTER A */ -#define XK_Cyrillic_be 0x06c2 /* U+0431 CYRILLIC SMALL LETTER BE */ -#define XK_Cyrillic_tse 0x06c3 /* U+0446 CYRILLIC SMALL LETTER TSE */ -#define XK_Cyrillic_de 0x06c4 /* U+0434 CYRILLIC SMALL LETTER DE */ -#define XK_Cyrillic_ie 0x06c5 /* U+0435 CYRILLIC SMALL LETTER IE */ -#define XK_Cyrillic_ef 0x06c6 /* U+0444 CYRILLIC SMALL LETTER EF */ -#define XK_Cyrillic_ghe 0x06c7 /* U+0433 CYRILLIC SMALL LETTER GHE */ -#define XK_Cyrillic_ha 0x06c8 /* U+0445 CYRILLIC SMALL LETTER HA */ -#define XK_Cyrillic_i 0x06c9 /* U+0438 CYRILLIC SMALL LETTER I */ -#define XK_Cyrillic_shorti 0x06ca /* U+0439 CYRILLIC SMALL LETTER SHORT I */ -#define XK_Cyrillic_ka 0x06cb /* U+043A CYRILLIC SMALL LETTER KA */ -#define XK_Cyrillic_el 0x06cc /* U+043B CYRILLIC SMALL LETTER EL */ -#define XK_Cyrillic_em 0x06cd /* U+043C CYRILLIC SMALL LETTER EM */ -#define XK_Cyrillic_en 0x06ce /* U+043D CYRILLIC SMALL LETTER EN */ -#define XK_Cyrillic_o 0x06cf /* U+043E CYRILLIC SMALL LETTER O */ -#define XK_Cyrillic_pe 0x06d0 /* U+043F CYRILLIC SMALL LETTER PE */ -#define XK_Cyrillic_ya 0x06d1 /* U+044F CYRILLIC SMALL LETTER YA */ -#define XK_Cyrillic_er 0x06d2 /* U+0440 CYRILLIC SMALL LETTER ER */ -#define XK_Cyrillic_es 0x06d3 /* U+0441 CYRILLIC SMALL LETTER ES */ -#define XK_Cyrillic_te 0x06d4 /* U+0442 CYRILLIC SMALL LETTER TE */ -#define XK_Cyrillic_u 0x06d5 /* U+0443 CYRILLIC SMALL LETTER U */ -#define XK_Cyrillic_zhe 0x06d6 /* U+0436 CYRILLIC SMALL LETTER ZHE */ -#define XK_Cyrillic_ve 0x06d7 /* U+0432 CYRILLIC SMALL LETTER VE */ -#define XK_Cyrillic_softsign 0x06d8 /* U+044C CYRILLIC SMALL LETTER SOFT SIGN */ -#define XK_Cyrillic_yeru 0x06d9 /* U+044B CYRILLIC SMALL LETTER YERU */ -#define XK_Cyrillic_ze 0x06da /* U+0437 CYRILLIC SMALL LETTER ZE */ -#define XK_Cyrillic_sha 0x06db /* U+0448 CYRILLIC SMALL LETTER SHA */ -#define XK_Cyrillic_e 0x06dc /* U+044D CYRILLIC SMALL LETTER E */ -#define XK_Cyrillic_shcha 0x06dd /* U+0449 CYRILLIC SMALL LETTER SHCHA */ -#define XK_Cyrillic_che 0x06de /* U+0447 CYRILLIC SMALL LETTER CHE */ -#define XK_Cyrillic_hardsign 0x06df /* U+044A CYRILLIC SMALL LETTER HARD SIGN */ -#define XK_Cyrillic_YU 0x06e0 /* U+042E CYRILLIC CAPITAL LETTER YU */ -#define XK_Cyrillic_A 0x06e1 /* U+0410 CYRILLIC CAPITAL LETTER A */ -#define XK_Cyrillic_BE 0x06e2 /* U+0411 CYRILLIC CAPITAL LETTER BE */ -#define XK_Cyrillic_TSE 0x06e3 /* U+0426 CYRILLIC CAPITAL LETTER TSE */ -#define XK_Cyrillic_DE 0x06e4 /* U+0414 CYRILLIC CAPITAL LETTER DE */ -#define XK_Cyrillic_IE 0x06e5 /* U+0415 CYRILLIC CAPITAL LETTER IE */ -#define XK_Cyrillic_EF 0x06e6 /* U+0424 CYRILLIC CAPITAL LETTER EF */ -#define XK_Cyrillic_GHE 0x06e7 /* U+0413 CYRILLIC CAPITAL LETTER GHE */ -#define XK_Cyrillic_HA 0x06e8 /* U+0425 CYRILLIC CAPITAL LETTER HA */ -#define XK_Cyrillic_I 0x06e9 /* U+0418 CYRILLIC CAPITAL LETTER I */ -#define XK_Cyrillic_SHORTI 0x06ea /* U+0419 CYRILLIC CAPITAL LETTER SHORT I */ -#define XK_Cyrillic_KA 0x06eb /* U+041A CYRILLIC CAPITAL LETTER KA */ -#define XK_Cyrillic_EL 0x06ec /* U+041B CYRILLIC CAPITAL LETTER EL */ -#define XK_Cyrillic_EM 0x06ed /* U+041C CYRILLIC CAPITAL LETTER EM */ -#define XK_Cyrillic_EN 0x06ee /* U+041D CYRILLIC CAPITAL LETTER EN */ -#define XK_Cyrillic_O 0x06ef /* U+041E CYRILLIC CAPITAL LETTER O */ -#define XK_Cyrillic_PE 0x06f0 /* U+041F CYRILLIC CAPITAL LETTER PE */ -#define XK_Cyrillic_YA 0x06f1 /* U+042F CYRILLIC CAPITAL LETTER YA */ -#define XK_Cyrillic_ER 0x06f2 /* U+0420 CYRILLIC CAPITAL LETTER ER */ -#define XK_Cyrillic_ES 0x06f3 /* U+0421 CYRILLIC CAPITAL LETTER ES */ -#define XK_Cyrillic_TE 0x06f4 /* U+0422 CYRILLIC CAPITAL LETTER TE */ -#define XK_Cyrillic_U 0x06f5 /* U+0423 CYRILLIC CAPITAL LETTER U */ -#define XK_Cyrillic_ZHE 0x06f6 /* U+0416 CYRILLIC CAPITAL LETTER ZHE */ -#define XK_Cyrillic_VE 0x06f7 /* U+0412 CYRILLIC CAPITAL LETTER VE */ -#define XK_Cyrillic_SOFTSIGN 0x06f8 /* U+042C CYRILLIC CAPITAL LETTER SOFT SIGN */ -#define XK_Cyrillic_YERU 0x06f9 /* U+042B CYRILLIC CAPITAL LETTER YERU */ -#define XK_Cyrillic_ZE 0x06fa /* U+0417 CYRILLIC CAPITAL LETTER ZE */ -#define XK_Cyrillic_SHA 0x06fb /* U+0428 CYRILLIC CAPITAL LETTER SHA */ -#define XK_Cyrillic_E 0x06fc /* U+042D CYRILLIC CAPITAL LETTER E */ -#define XK_Cyrillic_SHCHA 0x06fd /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ -#define XK_Cyrillic_CHE 0x06fe /* U+0427 CYRILLIC CAPITAL LETTER CHE */ -#define XK_Cyrillic_HARDSIGN 0x06ff /* U+042A CYRILLIC CAPITAL LETTER HARD SIGN */ -#endif /* XK_CYRILLIC */ - -/* - * Greek - * (based on an early draft of, and not quite identical to, ISO/IEC 8859-7) - * Byte 3 = 7 - */ - -#ifdef XK_GREEK -#define XK_Greek_ALPHAaccent 0x07a1 /* U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS */ -#define XK_Greek_EPSILONaccent 0x07a2 /* U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS */ -#define XK_Greek_ETAaccent 0x07a3 /* U+0389 GREEK CAPITAL LETTER ETA WITH TONOS */ -#define XK_Greek_IOTAaccent 0x07a4 /* U+038A GREEK CAPITAL LETTER IOTA WITH TONOS */ -#define XK_Greek_IOTAdieresis 0x07a5 /* U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */ -#define XK_Greek_IOTAdiaeresis 0x07a5 /* old typo */ -#define XK_Greek_OMICRONaccent 0x07a7 /* U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS */ -#define XK_Greek_UPSILONaccent 0x07a8 /* U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS */ -#define XK_Greek_UPSILONdieresis 0x07a9 /* U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */ -#define XK_Greek_OMEGAaccent 0x07ab /* U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS */ -#define XK_Greek_accentdieresis 0x07ae /* U+0385 GREEK DIALYTIKA TONOS */ -#define XK_Greek_horizbar 0x07af /* U+2015 HORIZONTAL BAR */ -#define XK_Greek_alphaaccent 0x07b1 /* U+03AC GREEK SMALL LETTER ALPHA WITH TONOS */ -#define XK_Greek_epsilonaccent 0x07b2 /* U+03AD GREEK SMALL LETTER EPSILON WITH TONOS */ -#define XK_Greek_etaaccent 0x07b3 /* U+03AE GREEK SMALL LETTER ETA WITH TONOS */ -#define XK_Greek_iotaaccent 0x07b4 /* U+03AF GREEK SMALL LETTER IOTA WITH TONOS */ -#define XK_Greek_iotadieresis 0x07b5 /* U+03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA */ -#define XK_Greek_iotaaccentdieresis 0x07b6 /* U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */ -#define XK_Greek_omicronaccent 0x07b7 /* U+03CC GREEK SMALL LETTER OMICRON WITH TONOS */ -#define XK_Greek_upsilonaccent 0x07b8 /* U+03CD GREEK SMALL LETTER UPSILON WITH TONOS */ -#define XK_Greek_upsilondieresis 0x07b9 /* U+03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA */ -#define XK_Greek_upsilonaccentdieresis 0x07ba /* U+03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */ -#define XK_Greek_omegaaccent 0x07bb /* U+03CE GREEK SMALL LETTER OMEGA WITH TONOS */ -#define XK_Greek_ALPHA 0x07c1 /* U+0391 GREEK CAPITAL LETTER ALPHA */ -#define XK_Greek_BETA 0x07c2 /* U+0392 GREEK CAPITAL LETTER BETA */ -#define XK_Greek_GAMMA 0x07c3 /* U+0393 GREEK CAPITAL LETTER GAMMA */ -#define XK_Greek_DELTA 0x07c4 /* U+0394 GREEK CAPITAL LETTER DELTA */ -#define XK_Greek_EPSILON 0x07c5 /* U+0395 GREEK CAPITAL LETTER EPSILON */ -#define XK_Greek_ZETA 0x07c6 /* U+0396 GREEK CAPITAL LETTER ZETA */ -#define XK_Greek_ETA 0x07c7 /* U+0397 GREEK CAPITAL LETTER ETA */ -#define XK_Greek_THETA 0x07c8 /* U+0398 GREEK CAPITAL LETTER THETA */ -#define XK_Greek_IOTA 0x07c9 /* U+0399 GREEK CAPITAL LETTER IOTA */ -#define XK_Greek_KAPPA 0x07ca /* U+039A GREEK CAPITAL LETTER KAPPA */ -#define XK_Greek_LAMDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */ -#define XK_Greek_LAMBDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */ -#define XK_Greek_MU 0x07cc /* U+039C GREEK CAPITAL LETTER MU */ -#define XK_Greek_NU 0x07cd /* U+039D GREEK CAPITAL LETTER NU */ -#define XK_Greek_XI 0x07ce /* U+039E GREEK CAPITAL LETTER XI */ -#define XK_Greek_OMICRON 0x07cf /* U+039F GREEK CAPITAL LETTER OMICRON */ -#define XK_Greek_PI 0x07d0 /* U+03A0 GREEK CAPITAL LETTER PI */ -#define XK_Greek_RHO 0x07d1 /* U+03A1 GREEK CAPITAL LETTER RHO */ -#define XK_Greek_SIGMA 0x07d2 /* U+03A3 GREEK CAPITAL LETTER SIGMA */ -#define XK_Greek_TAU 0x07d4 /* U+03A4 GREEK CAPITAL LETTER TAU */ -#define XK_Greek_UPSILON 0x07d5 /* U+03A5 GREEK CAPITAL LETTER UPSILON */ -#define XK_Greek_PHI 0x07d6 /* U+03A6 GREEK CAPITAL LETTER PHI */ -#define XK_Greek_CHI 0x07d7 /* U+03A7 GREEK CAPITAL LETTER CHI */ -#define XK_Greek_PSI 0x07d8 /* U+03A8 GREEK CAPITAL LETTER PSI */ -#define XK_Greek_OMEGA 0x07d9 /* U+03A9 GREEK CAPITAL LETTER OMEGA */ -#define XK_Greek_alpha 0x07e1 /* U+03B1 GREEK SMALL LETTER ALPHA */ -#define XK_Greek_beta 0x07e2 /* U+03B2 GREEK SMALL LETTER BETA */ -#define XK_Greek_gamma 0x07e3 /* U+03B3 GREEK SMALL LETTER GAMMA */ -#define XK_Greek_delta 0x07e4 /* U+03B4 GREEK SMALL LETTER DELTA */ -#define XK_Greek_epsilon 0x07e5 /* U+03B5 GREEK SMALL LETTER EPSILON */ -#define XK_Greek_zeta 0x07e6 /* U+03B6 GREEK SMALL LETTER ZETA */ -#define XK_Greek_eta 0x07e7 /* U+03B7 GREEK SMALL LETTER ETA */ -#define XK_Greek_theta 0x07e8 /* U+03B8 GREEK SMALL LETTER THETA */ -#define XK_Greek_iota 0x07e9 /* U+03B9 GREEK SMALL LETTER IOTA */ -#define XK_Greek_kappa 0x07ea /* U+03BA GREEK SMALL LETTER KAPPA */ -#define XK_Greek_lamda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */ -#define XK_Greek_lambda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */ -#define XK_Greek_mu 0x07ec /* U+03BC GREEK SMALL LETTER MU */ -#define XK_Greek_nu 0x07ed /* U+03BD GREEK SMALL LETTER NU */ -#define XK_Greek_xi 0x07ee /* U+03BE GREEK SMALL LETTER XI */ -#define XK_Greek_omicron 0x07ef /* U+03BF GREEK SMALL LETTER OMICRON */ -#define XK_Greek_pi 0x07f0 /* U+03C0 GREEK SMALL LETTER PI */ -#define XK_Greek_rho 0x07f1 /* U+03C1 GREEK SMALL LETTER RHO */ -#define XK_Greek_sigma 0x07f2 /* U+03C3 GREEK SMALL LETTER SIGMA */ -#define XK_Greek_finalsmallsigma 0x07f3 /* U+03C2 GREEK SMALL LETTER FINAL SIGMA */ -#define XK_Greek_tau 0x07f4 /* U+03C4 GREEK SMALL LETTER TAU */ -#define XK_Greek_upsilon 0x07f5 /* U+03C5 GREEK SMALL LETTER UPSILON */ -#define XK_Greek_phi 0x07f6 /* U+03C6 GREEK SMALL LETTER PHI */ -#define XK_Greek_chi 0x07f7 /* U+03C7 GREEK SMALL LETTER CHI */ -#define XK_Greek_psi 0x07f8 /* U+03C8 GREEK SMALL LETTER PSI */ -#define XK_Greek_omega 0x07f9 /* U+03C9 GREEK SMALL LETTER OMEGA */ -#define XK_Greek_switch 0xff7e /* Alias for mode_switch */ -#endif /* XK_GREEK */ - -/* - * Technical - * (from the DEC VT330/VT420 Technical Character Set, http://vt100.net/charsets/technical.html) - * Byte 3 = 8 - */ - -#ifdef XK_TECHNICAL -#define XK_leftradical 0x08a1 /* U+23B7 RADICAL SYMBOL BOTTOM */ -#define XK_topleftradical 0x08a2 /*(U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT)*/ -#define XK_horizconnector 0x08a3 /*(U+2500 BOX DRAWINGS LIGHT HORIZONTAL)*/ -#define XK_topintegral 0x08a4 /* U+2320 TOP HALF INTEGRAL */ -#define XK_botintegral 0x08a5 /* U+2321 BOTTOM HALF INTEGRAL */ -#define XK_vertconnector 0x08a6 /*(U+2502 BOX DRAWINGS LIGHT VERTICAL)*/ -#define XK_topleftsqbracket 0x08a7 /* U+23A1 LEFT SQUARE BRACKET UPPER CORNER */ -#define XK_botleftsqbracket 0x08a8 /* U+23A3 LEFT SQUARE BRACKET LOWER CORNER */ -#define XK_toprightsqbracket 0x08a9 /* U+23A4 RIGHT SQUARE BRACKET UPPER CORNER */ -#define XK_botrightsqbracket 0x08aa /* U+23A6 RIGHT SQUARE BRACKET LOWER CORNER */ -#define XK_topleftparens 0x08ab /* U+239B LEFT PARENTHESIS UPPER HOOK */ -#define XK_botleftparens 0x08ac /* U+239D LEFT PARENTHESIS LOWER HOOK */ -#define XK_toprightparens 0x08ad /* U+239E RIGHT PARENTHESIS UPPER HOOK */ -#define XK_botrightparens 0x08ae /* U+23A0 RIGHT PARENTHESIS LOWER HOOK */ -#define XK_leftmiddlecurlybrace 0x08af /* U+23A8 LEFT CURLY BRACKET MIDDLE PIECE */ -#define XK_rightmiddlecurlybrace 0x08b0 /* U+23AC RIGHT CURLY BRACKET MIDDLE PIECE */ -#define XK_topleftsummation 0x08b1 -#define XK_botleftsummation 0x08b2 -#define XK_topvertsummationconnector 0x08b3 -#define XK_botvertsummationconnector 0x08b4 -#define XK_toprightsummation 0x08b5 -#define XK_botrightsummation 0x08b6 -#define XK_rightmiddlesummation 0x08b7 -#define XK_lessthanequal 0x08bc /* U+2264 LESS-THAN OR EQUAL TO */ -#define XK_notequal 0x08bd /* U+2260 NOT EQUAL TO */ -#define XK_greaterthanequal 0x08be /* U+2265 GREATER-THAN OR EQUAL TO */ -#define XK_integral 0x08bf /* U+222B INTEGRAL */ -#define XK_therefore 0x08c0 /* U+2234 THEREFORE */ -#define XK_variation 0x08c1 /* U+221D PROPORTIONAL TO */ -#define XK_infinity 0x08c2 /* U+221E INFINITY */ -#define XK_nabla 0x08c5 /* U+2207 NABLA */ -#define XK_approximate 0x08c8 /* U+223C TILDE OPERATOR */ -#define XK_similarequal 0x08c9 /* U+2243 ASYMPTOTICALLY EQUAL TO */ -#define XK_ifonlyif 0x08cd /* U+21D4 LEFT RIGHT DOUBLE ARROW */ -#define XK_implies 0x08ce /* U+21D2 RIGHTWARDS DOUBLE ARROW */ -#define XK_identical 0x08cf /* U+2261 IDENTICAL TO */ -#define XK_radical 0x08d6 /* U+221A SQUARE ROOT */ -#define XK_includedin 0x08da /* U+2282 SUBSET OF */ -#define XK_includes 0x08db /* U+2283 SUPERSET OF */ -#define XK_intersection 0x08dc /* U+2229 INTERSECTION */ -#define XK_union 0x08dd /* U+222A UNION */ -#define XK_logicaland 0x08de /* U+2227 LOGICAL AND */ -#define XK_logicalor 0x08df /* U+2228 LOGICAL OR */ -#define XK_partialderivative 0x08ef /* U+2202 PARTIAL DIFFERENTIAL */ -#define XK_function 0x08f6 /* U+0192 LATIN SMALL LETTER F WITH HOOK */ -#define XK_leftarrow 0x08fb /* U+2190 LEFTWARDS ARROW */ -#define XK_uparrow 0x08fc /* U+2191 UPWARDS ARROW */ -#define XK_rightarrow 0x08fd /* U+2192 RIGHTWARDS ARROW */ -#define XK_downarrow 0x08fe /* U+2193 DOWNWARDS ARROW */ -#endif /* XK_TECHNICAL */ - -/* - * Special - * (from the DEC VT100 Special Graphics Character Set) - * Byte 3 = 9 - */ - -#ifdef XK_SPECIAL -#define XK_blank 0x09df -#define XK_soliddiamond 0x09e0 /* U+25C6 BLACK DIAMOND */ -#define XK_checkerboard 0x09e1 /* U+2592 MEDIUM SHADE */ -#define XK_ht 0x09e2 /* U+2409 SYMBOL FOR HORIZONTAL TABULATION */ -#define XK_ff 0x09e3 /* U+240C SYMBOL FOR FORM FEED */ -#define XK_cr 0x09e4 /* U+240D SYMBOL FOR CARRIAGE RETURN */ -#define XK_lf 0x09e5 /* U+240A SYMBOL FOR LINE FEED */ -#define XK_nl 0x09e8 /* U+2424 SYMBOL FOR NEWLINE */ -#define XK_vt 0x09e9 /* U+240B SYMBOL FOR VERTICAL TABULATION */ -#define XK_lowrightcorner 0x09ea /* U+2518 BOX DRAWINGS LIGHT UP AND LEFT */ -#define XK_uprightcorner 0x09eb /* U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT */ -#define XK_upleftcorner 0x09ec /* U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT */ -#define XK_lowleftcorner 0x09ed /* U+2514 BOX DRAWINGS LIGHT UP AND RIGHT */ -#define XK_crossinglines 0x09ee /* U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */ -#define XK_horizlinescan1 0x09ef /* U+23BA HORIZONTAL SCAN LINE-1 */ -#define XK_horizlinescan3 0x09f0 /* U+23BB HORIZONTAL SCAN LINE-3 */ -#define XK_horizlinescan5 0x09f1 /* U+2500 BOX DRAWINGS LIGHT HORIZONTAL */ -#define XK_horizlinescan7 0x09f2 /* U+23BC HORIZONTAL SCAN LINE-7 */ -#define XK_horizlinescan9 0x09f3 /* U+23BD HORIZONTAL SCAN LINE-9 */ -#define XK_leftt 0x09f4 /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ -#define XK_rightt 0x09f5 /* U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT */ -#define XK_bott 0x09f6 /* U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL */ -#define XK_topt 0x09f7 /* U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */ -#define XK_vertbar 0x09f8 /* U+2502 BOX DRAWINGS LIGHT VERTICAL */ -#endif /* XK_SPECIAL */ - -/* - * Publishing - * (these are probably from a long forgotten DEC Publishing - * font that once shipped with DECwrite) - * Byte 3 = 0x0a - */ - -#ifdef XK_PUBLISHING -#define XK_emspace 0x0aa1 /* U+2003 EM SPACE */ -#define XK_enspace 0x0aa2 /* U+2002 EN SPACE */ -#define XK_em3space 0x0aa3 /* U+2004 THREE-PER-EM SPACE */ -#define XK_em4space 0x0aa4 /* U+2005 FOUR-PER-EM SPACE */ -#define XK_digitspace 0x0aa5 /* U+2007 FIGURE SPACE */ -#define XK_punctspace 0x0aa6 /* U+2008 PUNCTUATION SPACE */ -#define XK_thinspace 0x0aa7 /* U+2009 THIN SPACE */ -#define XK_hairspace 0x0aa8 /* U+200A HAIR SPACE */ -#define XK_emdash 0x0aa9 /* U+2014 EM DASH */ -#define XK_endash 0x0aaa /* U+2013 EN DASH */ -#define XK_signifblank 0x0aac /*(U+2423 OPEN BOX)*/ -#define XK_ellipsis 0x0aae /* U+2026 HORIZONTAL ELLIPSIS */ -#define XK_doubbaselinedot 0x0aaf /* U+2025 TWO DOT LEADER */ -#define XK_onethird 0x0ab0 /* U+2153 VULGAR FRACTION ONE THIRD */ -#define XK_twothirds 0x0ab1 /* U+2154 VULGAR FRACTION TWO THIRDS */ -#define XK_onefifth 0x0ab2 /* U+2155 VULGAR FRACTION ONE FIFTH */ -#define XK_twofifths 0x0ab3 /* U+2156 VULGAR FRACTION TWO FIFTHS */ -#define XK_threefifths 0x0ab4 /* U+2157 VULGAR FRACTION THREE FIFTHS */ -#define XK_fourfifths 0x0ab5 /* U+2158 VULGAR FRACTION FOUR FIFTHS */ -#define XK_onesixth 0x0ab6 /* U+2159 VULGAR FRACTION ONE SIXTH */ -#define XK_fivesixths 0x0ab7 /* U+215A VULGAR FRACTION FIVE SIXTHS */ -#define XK_careof 0x0ab8 /* U+2105 CARE OF */ -#define XK_figdash 0x0abb /* U+2012 FIGURE DASH */ -#define XK_leftanglebracket 0x0abc /*(U+27E8 MATHEMATICAL LEFT ANGLE BRACKET)*/ -#define XK_decimalpoint 0x0abd /*(U+002E FULL STOP)*/ -#define XK_rightanglebracket 0x0abe /*(U+27E9 MATHEMATICAL RIGHT ANGLE BRACKET)*/ -#define XK_marker 0x0abf -#define XK_oneeighth 0x0ac3 /* U+215B VULGAR FRACTION ONE EIGHTH */ -#define XK_threeeighths 0x0ac4 /* U+215C VULGAR FRACTION THREE EIGHTHS */ -#define XK_fiveeighths 0x0ac5 /* U+215D VULGAR FRACTION FIVE EIGHTHS */ -#define XK_seveneighths 0x0ac6 /* U+215E VULGAR FRACTION SEVEN EIGHTHS */ -#define XK_trademark 0x0ac9 /* U+2122 TRADE MARK SIGN */ -#define XK_signaturemark 0x0aca /*(U+2613 SALTIRE)*/ -#define XK_trademarkincircle 0x0acb -#define XK_leftopentriangle 0x0acc /*(U+25C1 WHITE LEFT-POINTING TRIANGLE)*/ -#define XK_rightopentriangle 0x0acd /*(U+25B7 WHITE RIGHT-POINTING TRIANGLE)*/ -#define XK_emopencircle 0x0ace /*(U+25CB WHITE CIRCLE)*/ -#define XK_emopenrectangle 0x0acf /*(U+25AF WHITE VERTICAL RECTANGLE)*/ -#define XK_leftsinglequotemark 0x0ad0 /* U+2018 LEFT SINGLE QUOTATION MARK */ -#define XK_rightsinglequotemark 0x0ad1 /* U+2019 RIGHT SINGLE QUOTATION MARK */ -#define XK_leftdoublequotemark 0x0ad2 /* U+201C LEFT DOUBLE QUOTATION MARK */ -#define XK_rightdoublequotemark 0x0ad3 /* U+201D RIGHT DOUBLE QUOTATION MARK */ -#define XK_prescription 0x0ad4 /* U+211E PRESCRIPTION TAKE */ -#define XK_permille 0x0ad5 /* U+2030 PER MILLE SIGN */ -#define XK_minutes 0x0ad6 /* U+2032 PRIME */ -#define XK_seconds 0x0ad7 /* U+2033 DOUBLE PRIME */ -#define XK_latincross 0x0ad9 /* U+271D LATIN CROSS */ -#define XK_hexagram 0x0ada -#define XK_filledrectbullet 0x0adb /*(U+25AC BLACK RECTANGLE)*/ -#define XK_filledlefttribullet 0x0adc /*(U+25C0 BLACK LEFT-POINTING TRIANGLE)*/ -#define XK_filledrighttribullet 0x0add /*(U+25B6 BLACK RIGHT-POINTING TRIANGLE)*/ -#define XK_emfilledcircle 0x0ade /*(U+25CF BLACK CIRCLE)*/ -#define XK_emfilledrect 0x0adf /*(U+25AE BLACK VERTICAL RECTANGLE)*/ -#define XK_enopencircbullet 0x0ae0 /*(U+25E6 WHITE BULLET)*/ -#define XK_enopensquarebullet 0x0ae1 /*(U+25AB WHITE SMALL SQUARE)*/ -#define XK_openrectbullet 0x0ae2 /*(U+25AD WHITE RECTANGLE)*/ -#define XK_opentribulletup 0x0ae3 /*(U+25B3 WHITE UP-POINTING TRIANGLE)*/ -#define XK_opentribulletdown 0x0ae4 /*(U+25BD WHITE DOWN-POINTING TRIANGLE)*/ -#define XK_openstar 0x0ae5 /*(U+2606 WHITE STAR)*/ -#define XK_enfilledcircbullet 0x0ae6 /*(U+2022 BULLET)*/ -#define XK_enfilledsqbullet 0x0ae7 /*(U+25AA BLACK SMALL SQUARE)*/ -#define XK_filledtribulletup 0x0ae8 /*(U+25B2 BLACK UP-POINTING TRIANGLE)*/ -#define XK_filledtribulletdown 0x0ae9 /*(U+25BC BLACK DOWN-POINTING TRIANGLE)*/ -#define XK_leftpointer 0x0aea /*(U+261C WHITE LEFT POINTING INDEX)*/ -#define XK_rightpointer 0x0aeb /*(U+261E WHITE RIGHT POINTING INDEX)*/ -#define XK_club 0x0aec /* U+2663 BLACK CLUB SUIT */ -#define XK_diamond 0x0aed /* U+2666 BLACK DIAMOND SUIT */ -#define XK_heart 0x0aee /* U+2665 BLACK HEART SUIT */ -#define XK_maltesecross 0x0af0 /* U+2720 MALTESE CROSS */ -#define XK_dagger 0x0af1 /* U+2020 DAGGER */ -#define XK_doubledagger 0x0af2 /* U+2021 DOUBLE DAGGER */ -#define XK_checkmark 0x0af3 /* U+2713 CHECK MARK */ -#define XK_ballotcross 0x0af4 /* U+2717 BALLOT X */ -#define XK_musicalsharp 0x0af5 /* U+266F MUSIC SHARP SIGN */ -#define XK_musicalflat 0x0af6 /* U+266D MUSIC FLAT SIGN */ -#define XK_malesymbol 0x0af7 /* U+2642 MALE SIGN */ -#define XK_femalesymbol 0x0af8 /* U+2640 FEMALE SIGN */ -#define XK_telephone 0x0af9 /* U+260E BLACK TELEPHONE */ -#define XK_telephonerecorder 0x0afa /* U+2315 TELEPHONE RECORDER */ -#define XK_phonographcopyright 0x0afb /* U+2117 SOUND RECORDING COPYRIGHT */ -#define XK_caret 0x0afc /* U+2038 CARET */ -#define XK_singlelowquotemark 0x0afd /* U+201A SINGLE LOW-9 QUOTATION MARK */ -#define XK_doublelowquotemark 0x0afe /* U+201E DOUBLE LOW-9 QUOTATION MARK */ -#define XK_cursor 0x0aff -#endif /* XK_PUBLISHING */ - -/* - * APL - * Byte 3 = 0x0b - */ - -#ifdef XK_APL -#define XK_leftcaret 0x0ba3 /*(U+003C LESS-THAN SIGN)*/ -#define XK_rightcaret 0x0ba6 /*(U+003E GREATER-THAN SIGN)*/ -#define XK_downcaret 0x0ba8 /*(U+2228 LOGICAL OR)*/ -#define XK_upcaret 0x0ba9 /*(U+2227 LOGICAL AND)*/ -#define XK_overbar 0x0bc0 /*(U+00AF MACRON)*/ -#define XK_downtack 0x0bc2 /* U+22A4 DOWN TACK */ -#define XK_upshoe 0x0bc3 /*(U+2229 INTERSECTION)*/ -#define XK_downstile 0x0bc4 /* U+230A LEFT FLOOR */ -#define XK_underbar 0x0bc6 /*(U+005F LOW LINE)*/ -#define XK_jot 0x0bca /* U+2218 RING OPERATOR */ -#define XK_quad 0x0bcc /* U+2395 APL FUNCTIONAL SYMBOL QUAD */ -#define XK_uptack 0x0bce /* U+22A5 UP TACK */ -#define XK_circle 0x0bcf /* U+25CB WHITE CIRCLE */ -#define XK_upstile 0x0bd3 /* U+2308 LEFT CEILING */ -#define XK_downshoe 0x0bd6 /*(U+222A UNION)*/ -#define XK_rightshoe 0x0bd8 /*(U+2283 SUPERSET OF)*/ -#define XK_leftshoe 0x0bda /*(U+2282 SUBSET OF)*/ -#define XK_lefttack 0x0bdc /* U+22A3 LEFT TACK */ -#define XK_righttack 0x0bfc /* U+22A2 RIGHT TACK */ -#endif /* XK_APL */ - -/* - * Hebrew - * Byte 3 = 0x0c - */ - -#ifdef XK_HEBREW -#define XK_hebrew_doublelowline 0x0cdf /* U+2017 DOUBLE LOW LINE */ -#define XK_hebrew_aleph 0x0ce0 /* U+05D0 HEBREW LETTER ALEF */ -#define XK_hebrew_bet 0x0ce1 /* U+05D1 HEBREW LETTER BET */ -#define XK_hebrew_beth 0x0ce1 /* deprecated */ -#define XK_hebrew_gimel 0x0ce2 /* U+05D2 HEBREW LETTER GIMEL */ -#define XK_hebrew_gimmel 0x0ce2 /* deprecated */ -#define XK_hebrew_dalet 0x0ce3 /* U+05D3 HEBREW LETTER DALET */ -#define XK_hebrew_daleth 0x0ce3 /* deprecated */ -#define XK_hebrew_he 0x0ce4 /* U+05D4 HEBREW LETTER HE */ -#define XK_hebrew_waw 0x0ce5 /* U+05D5 HEBREW LETTER VAV */ -#define XK_hebrew_zain 0x0ce6 /* U+05D6 HEBREW LETTER ZAYIN */ -#define XK_hebrew_zayin 0x0ce6 /* deprecated */ -#define XK_hebrew_chet 0x0ce7 /* U+05D7 HEBREW LETTER HET */ -#define XK_hebrew_het 0x0ce7 /* deprecated */ -#define XK_hebrew_tet 0x0ce8 /* U+05D8 HEBREW LETTER TET */ -#define XK_hebrew_teth 0x0ce8 /* deprecated */ -#define XK_hebrew_yod 0x0ce9 /* U+05D9 HEBREW LETTER YOD */ -#define XK_hebrew_finalkaph 0x0cea /* U+05DA HEBREW LETTER FINAL KAF */ -#define XK_hebrew_kaph 0x0ceb /* U+05DB HEBREW LETTER KAF */ -#define XK_hebrew_lamed 0x0cec /* U+05DC HEBREW LETTER LAMED */ -#define XK_hebrew_finalmem 0x0ced /* U+05DD HEBREW LETTER FINAL MEM */ -#define XK_hebrew_mem 0x0cee /* U+05DE HEBREW LETTER MEM */ -#define XK_hebrew_finalnun 0x0cef /* U+05DF HEBREW LETTER FINAL NUN */ -#define XK_hebrew_nun 0x0cf0 /* U+05E0 HEBREW LETTER NUN */ -#define XK_hebrew_samech 0x0cf1 /* U+05E1 HEBREW LETTER SAMEKH */ -#define XK_hebrew_samekh 0x0cf1 /* deprecated */ -#define XK_hebrew_ayin 0x0cf2 /* U+05E2 HEBREW LETTER AYIN */ -#define XK_hebrew_finalpe 0x0cf3 /* U+05E3 HEBREW LETTER FINAL PE */ -#define XK_hebrew_pe 0x0cf4 /* U+05E4 HEBREW LETTER PE */ -#define XK_hebrew_finalzade 0x0cf5 /* U+05E5 HEBREW LETTER FINAL TSADI */ -#define XK_hebrew_finalzadi 0x0cf5 /* deprecated */ -#define XK_hebrew_zade 0x0cf6 /* U+05E6 HEBREW LETTER TSADI */ -#define XK_hebrew_zadi 0x0cf6 /* deprecated */ -#define XK_hebrew_qoph 0x0cf7 /* U+05E7 HEBREW LETTER QOF */ -#define XK_hebrew_kuf 0x0cf7 /* deprecated */ -#define XK_hebrew_resh 0x0cf8 /* U+05E8 HEBREW LETTER RESH */ -#define XK_hebrew_shin 0x0cf9 /* U+05E9 HEBREW LETTER SHIN */ -#define XK_hebrew_taw 0x0cfa /* U+05EA HEBREW LETTER TAV */ -#define XK_hebrew_taf 0x0cfa /* deprecated */ -#define XK_Hebrew_switch 0xff7e /* Alias for mode_switch */ -#endif /* XK_HEBREW */ - -/* - * Thai - * Byte 3 = 0x0d - */ - -#ifdef XK_THAI -#define XK_Thai_kokai 0x0da1 /* U+0E01 THAI CHARACTER KO KAI */ -#define XK_Thai_khokhai 0x0da2 /* U+0E02 THAI CHARACTER KHO KHAI */ -#define XK_Thai_khokhuat 0x0da3 /* U+0E03 THAI CHARACTER KHO KHUAT */ -#define XK_Thai_khokhwai 0x0da4 /* U+0E04 THAI CHARACTER KHO KHWAI */ -#define XK_Thai_khokhon 0x0da5 /* U+0E05 THAI CHARACTER KHO KHON */ -#define XK_Thai_khorakhang 0x0da6 /* U+0E06 THAI CHARACTER KHO RAKHANG */ -#define XK_Thai_ngongu 0x0da7 /* U+0E07 THAI CHARACTER NGO NGU */ -#define XK_Thai_chochan 0x0da8 /* U+0E08 THAI CHARACTER CHO CHAN */ -#define XK_Thai_choching 0x0da9 /* U+0E09 THAI CHARACTER CHO CHING */ -#define XK_Thai_chochang 0x0daa /* U+0E0A THAI CHARACTER CHO CHANG */ -#define XK_Thai_soso 0x0dab /* U+0E0B THAI CHARACTER SO SO */ -#define XK_Thai_chochoe 0x0dac /* U+0E0C THAI CHARACTER CHO CHOE */ -#define XK_Thai_yoying 0x0dad /* U+0E0D THAI CHARACTER YO YING */ -#define XK_Thai_dochada 0x0dae /* U+0E0E THAI CHARACTER DO CHADA */ -#define XK_Thai_topatak 0x0daf /* U+0E0F THAI CHARACTER TO PATAK */ -#define XK_Thai_thothan 0x0db0 /* U+0E10 THAI CHARACTER THO THAN */ -#define XK_Thai_thonangmontho 0x0db1 /* U+0E11 THAI CHARACTER THO NANGMONTHO */ -#define XK_Thai_thophuthao 0x0db2 /* U+0E12 THAI CHARACTER THO PHUTHAO */ -#define XK_Thai_nonen 0x0db3 /* U+0E13 THAI CHARACTER NO NEN */ -#define XK_Thai_dodek 0x0db4 /* U+0E14 THAI CHARACTER DO DEK */ -#define XK_Thai_totao 0x0db5 /* U+0E15 THAI CHARACTER TO TAO */ -#define XK_Thai_thothung 0x0db6 /* U+0E16 THAI CHARACTER THO THUNG */ -#define XK_Thai_thothahan 0x0db7 /* U+0E17 THAI CHARACTER THO THAHAN */ -#define XK_Thai_thothong 0x0db8 /* U+0E18 THAI CHARACTER THO THONG */ -#define XK_Thai_nonu 0x0db9 /* U+0E19 THAI CHARACTER NO NU */ -#define XK_Thai_bobaimai 0x0dba /* U+0E1A THAI CHARACTER BO BAIMAI */ -#define XK_Thai_popla 0x0dbb /* U+0E1B THAI CHARACTER PO PLA */ -#define XK_Thai_phophung 0x0dbc /* U+0E1C THAI CHARACTER PHO PHUNG */ -#define XK_Thai_fofa 0x0dbd /* U+0E1D THAI CHARACTER FO FA */ -#define XK_Thai_phophan 0x0dbe /* U+0E1E THAI CHARACTER PHO PHAN */ -#define XK_Thai_fofan 0x0dbf /* U+0E1F THAI CHARACTER FO FAN */ -#define XK_Thai_phosamphao 0x0dc0 /* U+0E20 THAI CHARACTER PHO SAMPHAO */ -#define XK_Thai_moma 0x0dc1 /* U+0E21 THAI CHARACTER MO MA */ -#define XK_Thai_yoyak 0x0dc2 /* U+0E22 THAI CHARACTER YO YAK */ -#define XK_Thai_rorua 0x0dc3 /* U+0E23 THAI CHARACTER RO RUA */ -#define XK_Thai_ru 0x0dc4 /* U+0E24 THAI CHARACTER RU */ -#define XK_Thai_loling 0x0dc5 /* U+0E25 THAI CHARACTER LO LING */ -#define XK_Thai_lu 0x0dc6 /* U+0E26 THAI CHARACTER LU */ -#define XK_Thai_wowaen 0x0dc7 /* U+0E27 THAI CHARACTER WO WAEN */ -#define XK_Thai_sosala 0x0dc8 /* U+0E28 THAI CHARACTER SO SALA */ -#define XK_Thai_sorusi 0x0dc9 /* U+0E29 THAI CHARACTER SO RUSI */ -#define XK_Thai_sosua 0x0dca /* U+0E2A THAI CHARACTER SO SUA */ -#define XK_Thai_hohip 0x0dcb /* U+0E2B THAI CHARACTER HO HIP */ -#define XK_Thai_lochula 0x0dcc /* U+0E2C THAI CHARACTER LO CHULA */ -#define XK_Thai_oang 0x0dcd /* U+0E2D THAI CHARACTER O ANG */ -#define XK_Thai_honokhuk 0x0dce /* U+0E2E THAI CHARACTER HO NOKHUK */ -#define XK_Thai_paiyannoi 0x0dcf /* U+0E2F THAI CHARACTER PAIYANNOI */ -#define XK_Thai_saraa 0x0dd0 /* U+0E30 THAI CHARACTER SARA A */ -#define XK_Thai_maihanakat 0x0dd1 /* U+0E31 THAI CHARACTER MAI HAN-AKAT */ -#define XK_Thai_saraaa 0x0dd2 /* U+0E32 THAI CHARACTER SARA AA */ -#define XK_Thai_saraam 0x0dd3 /* U+0E33 THAI CHARACTER SARA AM */ -#define XK_Thai_sarai 0x0dd4 /* U+0E34 THAI CHARACTER SARA I */ -#define XK_Thai_saraii 0x0dd5 /* U+0E35 THAI CHARACTER SARA II */ -#define XK_Thai_saraue 0x0dd6 /* U+0E36 THAI CHARACTER SARA UE */ -#define XK_Thai_sarauee 0x0dd7 /* U+0E37 THAI CHARACTER SARA UEE */ -#define XK_Thai_sarau 0x0dd8 /* U+0E38 THAI CHARACTER SARA U */ -#define XK_Thai_sarauu 0x0dd9 /* U+0E39 THAI CHARACTER SARA UU */ -#define XK_Thai_phinthu 0x0dda /* U+0E3A THAI CHARACTER PHINTHU */ -#define XK_Thai_maihanakat_maitho 0x0dde -#define XK_Thai_baht 0x0ddf /* U+0E3F THAI CURRENCY SYMBOL BAHT */ -#define XK_Thai_sarae 0x0de0 /* U+0E40 THAI CHARACTER SARA E */ -#define XK_Thai_saraae 0x0de1 /* U+0E41 THAI CHARACTER SARA AE */ -#define XK_Thai_sarao 0x0de2 /* U+0E42 THAI CHARACTER SARA O */ -#define XK_Thai_saraaimaimuan 0x0de3 /* U+0E43 THAI CHARACTER SARA AI MAIMUAN */ -#define XK_Thai_saraaimaimalai 0x0de4 /* U+0E44 THAI CHARACTER SARA AI MAIMALAI */ -#define XK_Thai_lakkhangyao 0x0de5 /* U+0E45 THAI CHARACTER LAKKHANGYAO */ -#define XK_Thai_maiyamok 0x0de6 /* U+0E46 THAI CHARACTER MAIYAMOK */ -#define XK_Thai_maitaikhu 0x0de7 /* U+0E47 THAI CHARACTER MAITAIKHU */ -#define XK_Thai_maiek 0x0de8 /* U+0E48 THAI CHARACTER MAI EK */ -#define XK_Thai_maitho 0x0de9 /* U+0E49 THAI CHARACTER MAI THO */ -#define XK_Thai_maitri 0x0dea /* U+0E4A THAI CHARACTER MAI TRI */ -#define XK_Thai_maichattawa 0x0deb /* U+0E4B THAI CHARACTER MAI CHATTAWA */ -#define XK_Thai_thanthakhat 0x0dec /* U+0E4C THAI CHARACTER THANTHAKHAT */ -#define XK_Thai_nikhahit 0x0ded /* U+0E4D THAI CHARACTER NIKHAHIT */ -#define XK_Thai_leksun 0x0df0 /* U+0E50 THAI DIGIT ZERO */ -#define XK_Thai_leknung 0x0df1 /* U+0E51 THAI DIGIT ONE */ -#define XK_Thai_leksong 0x0df2 /* U+0E52 THAI DIGIT TWO */ -#define XK_Thai_leksam 0x0df3 /* U+0E53 THAI DIGIT THREE */ -#define XK_Thai_leksi 0x0df4 /* U+0E54 THAI DIGIT FOUR */ -#define XK_Thai_lekha 0x0df5 /* U+0E55 THAI DIGIT FIVE */ -#define XK_Thai_lekhok 0x0df6 /* U+0E56 THAI DIGIT SIX */ -#define XK_Thai_lekchet 0x0df7 /* U+0E57 THAI DIGIT SEVEN */ -#define XK_Thai_lekpaet 0x0df8 /* U+0E58 THAI DIGIT EIGHT */ -#define XK_Thai_lekkao 0x0df9 /* U+0E59 THAI DIGIT NINE */ -#endif /* XK_THAI */ - -/* - * Korean - * Byte 3 = 0x0e - */ - -#ifdef XK_KOREAN - -#define XK_Hangul 0xff31 /* Hangul start/stop(toggle) */ -#define XK_Hangul_Start 0xff32 /* Hangul start */ -#define XK_Hangul_End 0xff33 /* Hangul end, English start */ -#define XK_Hangul_Hanja 0xff34 /* Start Hangul->Hanja Conversion */ -#define XK_Hangul_Jamo 0xff35 /* Hangul Jamo mode */ -#define XK_Hangul_Romaja 0xff36 /* Hangul Romaja mode */ -#define XK_Hangul_Codeinput 0xff37 /* Hangul code input mode */ -#define XK_Hangul_Jeonja 0xff38 /* Jeonja mode */ -#define XK_Hangul_Banja 0xff39 /* Banja mode */ -#define XK_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */ -#define XK_Hangul_PostHanja 0xff3b /* Post Hanja conversion */ -#define XK_Hangul_SingleCandidate 0xff3c /* Single candidate */ -#define XK_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */ -#define XK_Hangul_PreviousCandidate 0xff3e /* Previous candidate */ -#define XK_Hangul_Special 0xff3f /* Special symbols */ -#define XK_Hangul_switch 0xff7e /* Alias for mode_switch */ - -/* Hangul Consonant Characters */ -#define XK_Hangul_Kiyeog 0x0ea1 -#define XK_Hangul_SsangKiyeog 0x0ea2 -#define XK_Hangul_KiyeogSios 0x0ea3 -#define XK_Hangul_Nieun 0x0ea4 -#define XK_Hangul_NieunJieuj 0x0ea5 -#define XK_Hangul_NieunHieuh 0x0ea6 -#define XK_Hangul_Dikeud 0x0ea7 -#define XK_Hangul_SsangDikeud 0x0ea8 -#define XK_Hangul_Rieul 0x0ea9 -#define XK_Hangul_RieulKiyeog 0x0eaa -#define XK_Hangul_RieulMieum 0x0eab -#define XK_Hangul_RieulPieub 0x0eac -#define XK_Hangul_RieulSios 0x0ead -#define XK_Hangul_RieulTieut 0x0eae -#define XK_Hangul_RieulPhieuf 0x0eaf -#define XK_Hangul_RieulHieuh 0x0eb0 -#define XK_Hangul_Mieum 0x0eb1 -#define XK_Hangul_Pieub 0x0eb2 -#define XK_Hangul_SsangPieub 0x0eb3 -#define XK_Hangul_PieubSios 0x0eb4 -#define XK_Hangul_Sios 0x0eb5 -#define XK_Hangul_SsangSios 0x0eb6 -#define XK_Hangul_Ieung 0x0eb7 -#define XK_Hangul_Jieuj 0x0eb8 -#define XK_Hangul_SsangJieuj 0x0eb9 -#define XK_Hangul_Cieuc 0x0eba -#define XK_Hangul_Khieuq 0x0ebb -#define XK_Hangul_Tieut 0x0ebc -#define XK_Hangul_Phieuf 0x0ebd -#define XK_Hangul_Hieuh 0x0ebe - -/* Hangul Vowel Characters */ -#define XK_Hangul_A 0x0ebf -#define XK_Hangul_AE 0x0ec0 -#define XK_Hangul_YA 0x0ec1 -#define XK_Hangul_YAE 0x0ec2 -#define XK_Hangul_EO 0x0ec3 -#define XK_Hangul_E 0x0ec4 -#define XK_Hangul_YEO 0x0ec5 -#define XK_Hangul_YE 0x0ec6 -#define XK_Hangul_O 0x0ec7 -#define XK_Hangul_WA 0x0ec8 -#define XK_Hangul_WAE 0x0ec9 -#define XK_Hangul_OE 0x0eca -#define XK_Hangul_YO 0x0ecb -#define XK_Hangul_U 0x0ecc -#define XK_Hangul_WEO 0x0ecd -#define XK_Hangul_WE 0x0ece -#define XK_Hangul_WI 0x0ecf -#define XK_Hangul_YU 0x0ed0 -#define XK_Hangul_EU 0x0ed1 -#define XK_Hangul_YI 0x0ed2 -#define XK_Hangul_I 0x0ed3 - -/* Hangul syllable-final (JongSeong) Characters */ -#define XK_Hangul_J_Kiyeog 0x0ed4 -#define XK_Hangul_J_SsangKiyeog 0x0ed5 -#define XK_Hangul_J_KiyeogSios 0x0ed6 -#define XK_Hangul_J_Nieun 0x0ed7 -#define XK_Hangul_J_NieunJieuj 0x0ed8 -#define XK_Hangul_J_NieunHieuh 0x0ed9 -#define XK_Hangul_J_Dikeud 0x0eda -#define XK_Hangul_J_Rieul 0x0edb -#define XK_Hangul_J_RieulKiyeog 0x0edc -#define XK_Hangul_J_RieulMieum 0x0edd -#define XK_Hangul_J_RieulPieub 0x0ede -#define XK_Hangul_J_RieulSios 0x0edf -#define XK_Hangul_J_RieulTieut 0x0ee0 -#define XK_Hangul_J_RieulPhieuf 0x0ee1 -#define XK_Hangul_J_RieulHieuh 0x0ee2 -#define XK_Hangul_J_Mieum 0x0ee3 -#define XK_Hangul_J_Pieub 0x0ee4 -#define XK_Hangul_J_PieubSios 0x0ee5 -#define XK_Hangul_J_Sios 0x0ee6 -#define XK_Hangul_J_SsangSios 0x0ee7 -#define XK_Hangul_J_Ieung 0x0ee8 -#define XK_Hangul_J_Jieuj 0x0ee9 -#define XK_Hangul_J_Cieuc 0x0eea -#define XK_Hangul_J_Khieuq 0x0eeb -#define XK_Hangul_J_Tieut 0x0eec -#define XK_Hangul_J_Phieuf 0x0eed -#define XK_Hangul_J_Hieuh 0x0eee - -/* Ancient Hangul Consonant Characters */ -#define XK_Hangul_RieulYeorinHieuh 0x0eef -#define XK_Hangul_SunkyeongeumMieum 0x0ef0 -#define XK_Hangul_SunkyeongeumPieub 0x0ef1 -#define XK_Hangul_PanSios 0x0ef2 -#define XK_Hangul_KkogjiDalrinIeung 0x0ef3 -#define XK_Hangul_SunkyeongeumPhieuf 0x0ef4 -#define XK_Hangul_YeorinHieuh 0x0ef5 - -/* Ancient Hangul Vowel Characters */ -#define XK_Hangul_AraeA 0x0ef6 -#define XK_Hangul_AraeAE 0x0ef7 - -/* Ancient Hangul syllable-final (JongSeong) Characters */ -#define XK_Hangul_J_PanSios 0x0ef8 -#define XK_Hangul_J_KkogjiDalrinIeung 0x0ef9 -#define XK_Hangul_J_YeorinHieuh 0x0efa - -/* Korean currency symbol */ -#define XK_Korean_Won 0x0eff /*(U+20A9 WON SIGN)*/ - -#endif /* XK_KOREAN */ - -/* - * Armenian - */ - -#ifdef XK_ARMENIAN -#define XK_Armenian_ligature_ew 0x1000587 /* U+0587 ARMENIAN SMALL LIGATURE ECH YIWN */ -#define XK_Armenian_full_stop 0x1000589 /* U+0589 ARMENIAN FULL STOP */ -#define XK_Armenian_verjaket 0x1000589 /* U+0589 ARMENIAN FULL STOP */ -#define XK_Armenian_separation_mark 0x100055d /* U+055D ARMENIAN COMMA */ -#define XK_Armenian_but 0x100055d /* U+055D ARMENIAN COMMA */ -#define XK_Armenian_hyphen 0x100058a /* U+058A ARMENIAN HYPHEN */ -#define XK_Armenian_yentamna 0x100058a /* U+058A ARMENIAN HYPHEN */ -#define XK_Armenian_exclam 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */ -#define XK_Armenian_amanak 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */ -#define XK_Armenian_accent 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */ -#define XK_Armenian_shesht 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */ -#define XK_Armenian_question 0x100055e /* U+055E ARMENIAN QUESTION MARK */ -#define XK_Armenian_paruyk 0x100055e /* U+055E ARMENIAN QUESTION MARK */ -#define XK_Armenian_AYB 0x1000531 /* U+0531 ARMENIAN CAPITAL LETTER AYB */ -#define XK_Armenian_ayb 0x1000561 /* U+0561 ARMENIAN SMALL LETTER AYB */ -#define XK_Armenian_BEN 0x1000532 /* U+0532 ARMENIAN CAPITAL LETTER BEN */ -#define XK_Armenian_ben 0x1000562 /* U+0562 ARMENIAN SMALL LETTER BEN */ -#define XK_Armenian_GIM 0x1000533 /* U+0533 ARMENIAN CAPITAL LETTER GIM */ -#define XK_Armenian_gim 0x1000563 /* U+0563 ARMENIAN SMALL LETTER GIM */ -#define XK_Armenian_DA 0x1000534 /* U+0534 ARMENIAN CAPITAL LETTER DA */ -#define XK_Armenian_da 0x1000564 /* U+0564 ARMENIAN SMALL LETTER DA */ -#define XK_Armenian_YECH 0x1000535 /* U+0535 ARMENIAN CAPITAL LETTER ECH */ -#define XK_Armenian_yech 0x1000565 /* U+0565 ARMENIAN SMALL LETTER ECH */ -#define XK_Armenian_ZA 0x1000536 /* U+0536 ARMENIAN CAPITAL LETTER ZA */ -#define XK_Armenian_za 0x1000566 /* U+0566 ARMENIAN SMALL LETTER ZA */ -#define XK_Armenian_E 0x1000537 /* U+0537 ARMENIAN CAPITAL LETTER EH */ -#define XK_Armenian_e 0x1000567 /* U+0567 ARMENIAN SMALL LETTER EH */ -#define XK_Armenian_AT 0x1000538 /* U+0538 ARMENIAN CAPITAL LETTER ET */ -#define XK_Armenian_at 0x1000568 /* U+0568 ARMENIAN SMALL LETTER ET */ -#define XK_Armenian_TO 0x1000539 /* U+0539 ARMENIAN CAPITAL LETTER TO */ -#define XK_Armenian_to 0x1000569 /* U+0569 ARMENIAN SMALL LETTER TO */ -#define XK_Armenian_ZHE 0x100053a /* U+053A ARMENIAN CAPITAL LETTER ZHE */ -#define XK_Armenian_zhe 0x100056a /* U+056A ARMENIAN SMALL LETTER ZHE */ -#define XK_Armenian_INI 0x100053b /* U+053B ARMENIAN CAPITAL LETTER INI */ -#define XK_Armenian_ini 0x100056b /* U+056B ARMENIAN SMALL LETTER INI */ -#define XK_Armenian_LYUN 0x100053c /* U+053C ARMENIAN CAPITAL LETTER LIWN */ -#define XK_Armenian_lyun 0x100056c /* U+056C ARMENIAN SMALL LETTER LIWN */ -#define XK_Armenian_KHE 0x100053d /* U+053D ARMENIAN CAPITAL LETTER XEH */ -#define XK_Armenian_khe 0x100056d /* U+056D ARMENIAN SMALL LETTER XEH */ -#define XK_Armenian_TSA 0x100053e /* U+053E ARMENIAN CAPITAL LETTER CA */ -#define XK_Armenian_tsa 0x100056e /* U+056E ARMENIAN SMALL LETTER CA */ -#define XK_Armenian_KEN 0x100053f /* U+053F ARMENIAN CAPITAL LETTER KEN */ -#define XK_Armenian_ken 0x100056f /* U+056F ARMENIAN SMALL LETTER KEN */ -#define XK_Armenian_HO 0x1000540 /* U+0540 ARMENIAN CAPITAL LETTER HO */ -#define XK_Armenian_ho 0x1000570 /* U+0570 ARMENIAN SMALL LETTER HO */ -#define XK_Armenian_DZA 0x1000541 /* U+0541 ARMENIAN CAPITAL LETTER JA */ -#define XK_Armenian_dza 0x1000571 /* U+0571 ARMENIAN SMALL LETTER JA */ -#define XK_Armenian_GHAT 0x1000542 /* U+0542 ARMENIAN CAPITAL LETTER GHAD */ -#define XK_Armenian_ghat 0x1000572 /* U+0572 ARMENIAN SMALL LETTER GHAD */ -#define XK_Armenian_TCHE 0x1000543 /* U+0543 ARMENIAN CAPITAL LETTER CHEH */ -#define XK_Armenian_tche 0x1000573 /* U+0573 ARMENIAN SMALL LETTER CHEH */ -#define XK_Armenian_MEN 0x1000544 /* U+0544 ARMENIAN CAPITAL LETTER MEN */ -#define XK_Armenian_men 0x1000574 /* U+0574 ARMENIAN SMALL LETTER MEN */ -#define XK_Armenian_HI 0x1000545 /* U+0545 ARMENIAN CAPITAL LETTER YI */ -#define XK_Armenian_hi 0x1000575 /* U+0575 ARMENIAN SMALL LETTER YI */ -#define XK_Armenian_NU 0x1000546 /* U+0546 ARMENIAN CAPITAL LETTER NOW */ -#define XK_Armenian_nu 0x1000576 /* U+0576 ARMENIAN SMALL LETTER NOW */ -#define XK_Armenian_SHA 0x1000547 /* U+0547 ARMENIAN CAPITAL LETTER SHA */ -#define XK_Armenian_sha 0x1000577 /* U+0577 ARMENIAN SMALL LETTER SHA */ -#define XK_Armenian_VO 0x1000548 /* U+0548 ARMENIAN CAPITAL LETTER VO */ -#define XK_Armenian_vo 0x1000578 /* U+0578 ARMENIAN SMALL LETTER VO */ -#define XK_Armenian_CHA 0x1000549 /* U+0549 ARMENIAN CAPITAL LETTER CHA */ -#define XK_Armenian_cha 0x1000579 /* U+0579 ARMENIAN SMALL LETTER CHA */ -#define XK_Armenian_PE 0x100054a /* U+054A ARMENIAN CAPITAL LETTER PEH */ -#define XK_Armenian_pe 0x100057a /* U+057A ARMENIAN SMALL LETTER PEH */ -#define XK_Armenian_JE 0x100054b /* U+054B ARMENIAN CAPITAL LETTER JHEH */ -#define XK_Armenian_je 0x100057b /* U+057B ARMENIAN SMALL LETTER JHEH */ -#define XK_Armenian_RA 0x100054c /* U+054C ARMENIAN CAPITAL LETTER RA */ -#define XK_Armenian_ra 0x100057c /* U+057C ARMENIAN SMALL LETTER RA */ -#define XK_Armenian_SE 0x100054d /* U+054D ARMENIAN CAPITAL LETTER SEH */ -#define XK_Armenian_se 0x100057d /* U+057D ARMENIAN SMALL LETTER SEH */ -#define XK_Armenian_VEV 0x100054e /* U+054E ARMENIAN CAPITAL LETTER VEW */ -#define XK_Armenian_vev 0x100057e /* U+057E ARMENIAN SMALL LETTER VEW */ -#define XK_Armenian_TYUN 0x100054f /* U+054F ARMENIAN CAPITAL LETTER TIWN */ -#define XK_Armenian_tyun 0x100057f /* U+057F ARMENIAN SMALL LETTER TIWN */ -#define XK_Armenian_RE 0x1000550 /* U+0550 ARMENIAN CAPITAL LETTER REH */ -#define XK_Armenian_re 0x1000580 /* U+0580 ARMENIAN SMALL LETTER REH */ -#define XK_Armenian_TSO 0x1000551 /* U+0551 ARMENIAN CAPITAL LETTER CO */ -#define XK_Armenian_tso 0x1000581 /* U+0581 ARMENIAN SMALL LETTER CO */ -#define XK_Armenian_VYUN 0x1000552 /* U+0552 ARMENIAN CAPITAL LETTER YIWN */ -#define XK_Armenian_vyun 0x1000582 /* U+0582 ARMENIAN SMALL LETTER YIWN */ -#define XK_Armenian_PYUR 0x1000553 /* U+0553 ARMENIAN CAPITAL LETTER PIWR */ -#define XK_Armenian_pyur 0x1000583 /* U+0583 ARMENIAN SMALL LETTER PIWR */ -#define XK_Armenian_KE 0x1000554 /* U+0554 ARMENIAN CAPITAL LETTER KEH */ -#define XK_Armenian_ke 0x1000584 /* U+0584 ARMENIAN SMALL LETTER KEH */ -#define XK_Armenian_O 0x1000555 /* U+0555 ARMENIAN CAPITAL LETTER OH */ -#define XK_Armenian_o 0x1000585 /* U+0585 ARMENIAN SMALL LETTER OH */ -#define XK_Armenian_FE 0x1000556 /* U+0556 ARMENIAN CAPITAL LETTER FEH */ -#define XK_Armenian_fe 0x1000586 /* U+0586 ARMENIAN SMALL LETTER FEH */ -#define XK_Armenian_apostrophe 0x100055a /* U+055A ARMENIAN APOSTROPHE */ -#endif /* XK_ARMENIAN */ - -/* - * Georgian - */ - -#ifdef XK_GEORGIAN -#define XK_Georgian_an 0x10010d0 /* U+10D0 GEORGIAN LETTER AN */ -#define XK_Georgian_ban 0x10010d1 /* U+10D1 GEORGIAN LETTER BAN */ -#define XK_Georgian_gan 0x10010d2 /* U+10D2 GEORGIAN LETTER GAN */ -#define XK_Georgian_don 0x10010d3 /* U+10D3 GEORGIAN LETTER DON */ -#define XK_Georgian_en 0x10010d4 /* U+10D4 GEORGIAN LETTER EN */ -#define XK_Georgian_vin 0x10010d5 /* U+10D5 GEORGIAN LETTER VIN */ -#define XK_Georgian_zen 0x10010d6 /* U+10D6 GEORGIAN LETTER ZEN */ -#define XK_Georgian_tan 0x10010d7 /* U+10D7 GEORGIAN LETTER TAN */ -#define XK_Georgian_in 0x10010d8 /* U+10D8 GEORGIAN LETTER IN */ -#define XK_Georgian_kan 0x10010d9 /* U+10D9 GEORGIAN LETTER KAN */ -#define XK_Georgian_las 0x10010da /* U+10DA GEORGIAN LETTER LAS */ -#define XK_Georgian_man 0x10010db /* U+10DB GEORGIAN LETTER MAN */ -#define XK_Georgian_nar 0x10010dc /* U+10DC GEORGIAN LETTER NAR */ -#define XK_Georgian_on 0x10010dd /* U+10DD GEORGIAN LETTER ON */ -#define XK_Georgian_par 0x10010de /* U+10DE GEORGIAN LETTER PAR */ -#define XK_Georgian_zhar 0x10010df /* U+10DF GEORGIAN LETTER ZHAR */ -#define XK_Georgian_rae 0x10010e0 /* U+10E0 GEORGIAN LETTER RAE */ -#define XK_Georgian_san 0x10010e1 /* U+10E1 GEORGIAN LETTER SAN */ -#define XK_Georgian_tar 0x10010e2 /* U+10E2 GEORGIAN LETTER TAR */ -#define XK_Georgian_un 0x10010e3 /* U+10E3 GEORGIAN LETTER UN */ -#define XK_Georgian_phar 0x10010e4 /* U+10E4 GEORGIAN LETTER PHAR */ -#define XK_Georgian_khar 0x10010e5 /* U+10E5 GEORGIAN LETTER KHAR */ -#define XK_Georgian_ghan 0x10010e6 /* U+10E6 GEORGIAN LETTER GHAN */ -#define XK_Georgian_qar 0x10010e7 /* U+10E7 GEORGIAN LETTER QAR */ -#define XK_Georgian_shin 0x10010e8 /* U+10E8 GEORGIAN LETTER SHIN */ -#define XK_Georgian_chin 0x10010e9 /* U+10E9 GEORGIAN LETTER CHIN */ -#define XK_Georgian_can 0x10010ea /* U+10EA GEORGIAN LETTER CAN */ -#define XK_Georgian_jil 0x10010eb /* U+10EB GEORGIAN LETTER JIL */ -#define XK_Georgian_cil 0x10010ec /* U+10EC GEORGIAN LETTER CIL */ -#define XK_Georgian_char 0x10010ed /* U+10ED GEORGIAN LETTER CHAR */ -#define XK_Georgian_xan 0x10010ee /* U+10EE GEORGIAN LETTER XAN */ -#define XK_Georgian_jhan 0x10010ef /* U+10EF GEORGIAN LETTER JHAN */ -#define XK_Georgian_hae 0x10010f0 /* U+10F0 GEORGIAN LETTER HAE */ -#define XK_Georgian_he 0x10010f1 /* U+10F1 GEORGIAN LETTER HE */ -#define XK_Georgian_hie 0x10010f2 /* U+10F2 GEORGIAN LETTER HIE */ -#define XK_Georgian_we 0x10010f3 /* U+10F3 GEORGIAN LETTER WE */ -#define XK_Georgian_har 0x10010f4 /* U+10F4 GEORGIAN LETTER HAR */ -#define XK_Georgian_hoe 0x10010f5 /* U+10F5 GEORGIAN LETTER HOE */ -#define XK_Georgian_fi 0x10010f6 /* U+10F6 GEORGIAN LETTER FI */ -#endif /* XK_GEORGIAN */ - -/* - * Azeri (and other Turkic or Caucasian languages) - */ - -#ifdef XK_CAUCASUS -/* latin */ -#define XK_Xabovedot 0x1001e8a /* U+1E8A LATIN CAPITAL LETTER X WITH DOT ABOVE */ -#define XK_Ibreve 0x100012c /* U+012C LATIN CAPITAL LETTER I WITH BREVE */ -#define XK_Zstroke 0x10001b5 /* U+01B5 LATIN CAPITAL LETTER Z WITH STROKE */ -#define XK_Gcaron 0x10001e6 /* U+01E6 LATIN CAPITAL LETTER G WITH CARON */ -#define XK_Ocaron 0x10001d1 /* U+01D2 LATIN CAPITAL LETTER O WITH CARON */ -#define XK_Obarred 0x100019f /* U+019F LATIN CAPITAL LETTER O WITH MIDDLE TILDE */ -#define XK_xabovedot 0x1001e8b /* U+1E8B LATIN SMALL LETTER X WITH DOT ABOVE */ -#define XK_ibreve 0x100012d /* U+012D LATIN SMALL LETTER I WITH BREVE */ -#define XK_zstroke 0x10001b6 /* U+01B6 LATIN SMALL LETTER Z WITH STROKE */ -#define XK_gcaron 0x10001e7 /* U+01E7 LATIN SMALL LETTER G WITH CARON */ -#define XK_ocaron 0x10001d2 /* U+01D2 LATIN SMALL LETTER O WITH CARON */ -#define XK_obarred 0x1000275 /* U+0275 LATIN SMALL LETTER BARRED O */ -#define XK_SCHWA 0x100018f /* U+018F LATIN CAPITAL LETTER SCHWA */ -#define XK_schwa 0x1000259 /* U+0259 LATIN SMALL LETTER SCHWA */ -#define XK_EZH 0x10001b7 /* U+01B7 LATIN CAPITAL LETTER EZH */ -#define XK_ezh 0x1000292 /* U+0292 LATIN SMALL LETTER EZH */ -/* those are not really Caucasus */ -/* For Inupiak */ -#define XK_Lbelowdot 0x1001e36 /* U+1E36 LATIN CAPITAL LETTER L WITH DOT BELOW */ -#define XK_lbelowdot 0x1001e37 /* U+1E37 LATIN SMALL LETTER L WITH DOT BELOW */ -#endif /* XK_CAUCASUS */ - -/* - * Vietnamese - */ - -#ifdef XK_VIETNAMESE -#define XK_Abelowdot 0x1001ea0 /* U+1EA0 LATIN CAPITAL LETTER A WITH DOT BELOW */ -#define XK_abelowdot 0x1001ea1 /* U+1EA1 LATIN SMALL LETTER A WITH DOT BELOW */ -#define XK_Ahook 0x1001ea2 /* U+1EA2 LATIN CAPITAL LETTER A WITH HOOK ABOVE */ -#define XK_ahook 0x1001ea3 /* U+1EA3 LATIN SMALL LETTER A WITH HOOK ABOVE */ -#define XK_Acircumflexacute 0x1001ea4 /* U+1EA4 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE */ -#define XK_acircumflexacute 0x1001ea5 /* U+1EA5 LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE */ -#define XK_Acircumflexgrave 0x1001ea6 /* U+1EA6 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE */ -#define XK_acircumflexgrave 0x1001ea7 /* U+1EA7 LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE */ -#define XK_Acircumflexhook 0x1001ea8 /* U+1EA8 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */ -#define XK_acircumflexhook 0x1001ea9 /* U+1EA9 LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */ -#define XK_Acircumflextilde 0x1001eaa /* U+1EAA LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE */ -#define XK_acircumflextilde 0x1001eab /* U+1EAB LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE */ -#define XK_Acircumflexbelowdot 0x1001eac /* U+1EAC LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW */ -#define XK_acircumflexbelowdot 0x1001ead /* U+1EAD LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW */ -#define XK_Abreveacute 0x1001eae /* U+1EAE LATIN CAPITAL LETTER A WITH BREVE AND ACUTE */ -#define XK_abreveacute 0x1001eaf /* U+1EAF LATIN SMALL LETTER A WITH BREVE AND ACUTE */ -#define XK_Abrevegrave 0x1001eb0 /* U+1EB0 LATIN CAPITAL LETTER A WITH BREVE AND GRAVE */ -#define XK_abrevegrave 0x1001eb1 /* U+1EB1 LATIN SMALL LETTER A WITH BREVE AND GRAVE */ -#define XK_Abrevehook 0x1001eb2 /* U+1EB2 LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE */ -#define XK_abrevehook 0x1001eb3 /* U+1EB3 LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE */ -#define XK_Abrevetilde 0x1001eb4 /* U+1EB4 LATIN CAPITAL LETTER A WITH BREVE AND TILDE */ -#define XK_abrevetilde 0x1001eb5 /* U+1EB5 LATIN SMALL LETTER A WITH BREVE AND TILDE */ -#define XK_Abrevebelowdot 0x1001eb6 /* U+1EB6 LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW */ -#define XK_abrevebelowdot 0x1001eb7 /* U+1EB7 LATIN SMALL LETTER A WITH BREVE AND DOT BELOW */ -#define XK_Ebelowdot 0x1001eb8 /* U+1EB8 LATIN CAPITAL LETTER E WITH DOT BELOW */ -#define XK_ebelowdot 0x1001eb9 /* U+1EB9 LATIN SMALL LETTER E WITH DOT BELOW */ -#define XK_Ehook 0x1001eba /* U+1EBA LATIN CAPITAL LETTER E WITH HOOK ABOVE */ -#define XK_ehook 0x1001ebb /* U+1EBB LATIN SMALL LETTER E WITH HOOK ABOVE */ -#define XK_Etilde 0x1001ebc /* U+1EBC LATIN CAPITAL LETTER E WITH TILDE */ -#define XK_etilde 0x1001ebd /* U+1EBD LATIN SMALL LETTER E WITH TILDE */ -#define XK_Ecircumflexacute 0x1001ebe /* U+1EBE LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE */ -#define XK_ecircumflexacute 0x1001ebf /* U+1EBF LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE */ -#define XK_Ecircumflexgrave 0x1001ec0 /* U+1EC0 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE */ -#define XK_ecircumflexgrave 0x1001ec1 /* U+1EC1 LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE */ -#define XK_Ecircumflexhook 0x1001ec2 /* U+1EC2 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */ -#define XK_ecircumflexhook 0x1001ec3 /* U+1EC3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */ -#define XK_Ecircumflextilde 0x1001ec4 /* U+1EC4 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE */ -#define XK_ecircumflextilde 0x1001ec5 /* U+1EC5 LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE */ -#define XK_Ecircumflexbelowdot 0x1001ec6 /* U+1EC6 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW */ -#define XK_ecircumflexbelowdot 0x1001ec7 /* U+1EC7 LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW */ -#define XK_Ihook 0x1001ec8 /* U+1EC8 LATIN CAPITAL LETTER I WITH HOOK ABOVE */ -#define XK_ihook 0x1001ec9 /* U+1EC9 LATIN SMALL LETTER I WITH HOOK ABOVE */ -#define XK_Ibelowdot 0x1001eca /* U+1ECA LATIN CAPITAL LETTER I WITH DOT BELOW */ -#define XK_ibelowdot 0x1001ecb /* U+1ECB LATIN SMALL LETTER I WITH DOT BELOW */ -#define XK_Obelowdot 0x1001ecc /* U+1ECC LATIN CAPITAL LETTER O WITH DOT BELOW */ -#define XK_obelowdot 0x1001ecd /* U+1ECD LATIN SMALL LETTER O WITH DOT BELOW */ -#define XK_Ohook 0x1001ece /* U+1ECE LATIN CAPITAL LETTER O WITH HOOK ABOVE */ -#define XK_ohook 0x1001ecf /* U+1ECF LATIN SMALL LETTER O WITH HOOK ABOVE */ -#define XK_Ocircumflexacute 0x1001ed0 /* U+1ED0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE */ -#define XK_ocircumflexacute 0x1001ed1 /* U+1ED1 LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE */ -#define XK_Ocircumflexgrave 0x1001ed2 /* U+1ED2 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE */ -#define XK_ocircumflexgrave 0x1001ed3 /* U+1ED3 LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE */ -#define XK_Ocircumflexhook 0x1001ed4 /* U+1ED4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */ -#define XK_ocircumflexhook 0x1001ed5 /* U+1ED5 LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */ -#define XK_Ocircumflextilde 0x1001ed6 /* U+1ED6 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE */ -#define XK_ocircumflextilde 0x1001ed7 /* U+1ED7 LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE */ -#define XK_Ocircumflexbelowdot 0x1001ed8 /* U+1ED8 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW */ -#define XK_ocircumflexbelowdot 0x1001ed9 /* U+1ED9 LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW */ -#define XK_Ohornacute 0x1001eda /* U+1EDA LATIN CAPITAL LETTER O WITH HORN AND ACUTE */ -#define XK_ohornacute 0x1001edb /* U+1EDB LATIN SMALL LETTER O WITH HORN AND ACUTE */ -#define XK_Ohorngrave 0x1001edc /* U+1EDC LATIN CAPITAL LETTER O WITH HORN AND GRAVE */ -#define XK_ohorngrave 0x1001edd /* U+1EDD LATIN SMALL LETTER O WITH HORN AND GRAVE */ -#define XK_Ohornhook 0x1001ede /* U+1EDE LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE */ -#define XK_ohornhook 0x1001edf /* U+1EDF LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE */ -#define XK_Ohorntilde 0x1001ee0 /* U+1EE0 LATIN CAPITAL LETTER O WITH HORN AND TILDE */ -#define XK_ohorntilde 0x1001ee1 /* U+1EE1 LATIN SMALL LETTER O WITH HORN AND TILDE */ -#define XK_Ohornbelowdot 0x1001ee2 /* U+1EE2 LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW */ -#define XK_ohornbelowdot 0x1001ee3 /* U+1EE3 LATIN SMALL LETTER O WITH HORN AND DOT BELOW */ -#define XK_Ubelowdot 0x1001ee4 /* U+1EE4 LATIN CAPITAL LETTER U WITH DOT BELOW */ -#define XK_ubelowdot 0x1001ee5 /* U+1EE5 LATIN SMALL LETTER U WITH DOT BELOW */ -#define XK_Uhook 0x1001ee6 /* U+1EE6 LATIN CAPITAL LETTER U WITH HOOK ABOVE */ -#define XK_uhook 0x1001ee7 /* U+1EE7 LATIN SMALL LETTER U WITH HOOK ABOVE */ -#define XK_Uhornacute 0x1001ee8 /* U+1EE8 LATIN CAPITAL LETTER U WITH HORN AND ACUTE */ -#define XK_uhornacute 0x1001ee9 /* U+1EE9 LATIN SMALL LETTER U WITH HORN AND ACUTE */ -#define XK_Uhorngrave 0x1001eea /* U+1EEA LATIN CAPITAL LETTER U WITH HORN AND GRAVE */ -#define XK_uhorngrave 0x1001eeb /* U+1EEB LATIN SMALL LETTER U WITH HORN AND GRAVE */ -#define XK_Uhornhook 0x1001eec /* U+1EEC LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE */ -#define XK_uhornhook 0x1001eed /* U+1EED LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE */ -#define XK_Uhorntilde 0x1001eee /* U+1EEE LATIN CAPITAL LETTER U WITH HORN AND TILDE */ -#define XK_uhorntilde 0x1001eef /* U+1EEF LATIN SMALL LETTER U WITH HORN AND TILDE */ -#define XK_Uhornbelowdot 0x1001ef0 /* U+1EF0 LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW */ -#define XK_uhornbelowdot 0x1001ef1 /* U+1EF1 LATIN SMALL LETTER U WITH HORN AND DOT BELOW */ -#define XK_Ybelowdot 0x1001ef4 /* U+1EF4 LATIN CAPITAL LETTER Y WITH DOT BELOW */ -#define XK_ybelowdot 0x1001ef5 /* U+1EF5 LATIN SMALL LETTER Y WITH DOT BELOW */ -#define XK_Yhook 0x1001ef6 /* U+1EF6 LATIN CAPITAL LETTER Y WITH HOOK ABOVE */ -#define XK_yhook 0x1001ef7 /* U+1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE */ -#define XK_Ytilde 0x1001ef8 /* U+1EF8 LATIN CAPITAL LETTER Y WITH TILDE */ -#define XK_ytilde 0x1001ef9 /* U+1EF9 LATIN SMALL LETTER Y WITH TILDE */ -#define XK_Ohorn 0x10001a0 /* U+01A0 LATIN CAPITAL LETTER O WITH HORN */ -#define XK_ohorn 0x10001a1 /* U+01A1 LATIN SMALL LETTER O WITH HORN */ -#define XK_Uhorn 0x10001af /* U+01AF LATIN CAPITAL LETTER U WITH HORN */ -#define XK_uhorn 0x10001b0 /* U+01B0 LATIN SMALL LETTER U WITH HORN */ - -#endif /* XK_VIETNAMESE */ - -#ifdef XK_CURRENCY -#define XK_EcuSign 0x10020a0 /* U+20A0 EURO-CURRENCY SIGN */ -#define XK_ColonSign 0x10020a1 /* U+20A1 COLON SIGN */ -#define XK_CruzeiroSign 0x10020a2 /* U+20A2 CRUZEIRO SIGN */ -#define XK_FFrancSign 0x10020a3 /* U+20A3 FRENCH FRANC SIGN */ -#define XK_LiraSign 0x10020a4 /* U+20A4 LIRA SIGN */ -#define XK_MillSign 0x10020a5 /* U+20A5 MILL SIGN */ -#define XK_NairaSign 0x10020a6 /* U+20A6 NAIRA SIGN */ -#define XK_PesetaSign 0x10020a7 /* U+20A7 PESETA SIGN */ -#define XK_RupeeSign 0x10020a8 /* U+20A8 RUPEE SIGN */ -#define XK_WonSign 0x10020a9 /* U+20A9 WON SIGN */ -#define XK_NewSheqelSign 0x10020aa /* U+20AA NEW SHEQEL SIGN */ -#define XK_DongSign 0x10020ab /* U+20AB DONG SIGN */ -#define XK_EuroSign 0x20ac /* U+20AC EURO SIGN */ -#endif /* XK_CURRENCY */ - -#ifdef XK_MATHEMATICAL -/* one, two and three are defined above. */ -#define XK_zerosuperior 0x1002070 /* U+2070 SUPERSCRIPT ZERO */ -#define XK_foursuperior 0x1002074 /* U+2074 SUPERSCRIPT FOUR */ -#define XK_fivesuperior 0x1002075 /* U+2075 SUPERSCRIPT FIVE */ -#define XK_sixsuperior 0x1002076 /* U+2076 SUPERSCRIPT SIX */ -#define XK_sevensuperior 0x1002077 /* U+2077 SUPERSCRIPT SEVEN */ -#define XK_eightsuperior 0x1002078 /* U+2078 SUPERSCRIPT EIGHT */ -#define XK_ninesuperior 0x1002079 /* U+2079 SUPERSCRIPT NINE */ -#define XK_zerosubscript 0x1002080 /* U+2080 SUBSCRIPT ZERO */ -#define XK_onesubscript 0x1002081 /* U+2081 SUBSCRIPT ONE */ -#define XK_twosubscript 0x1002082 /* U+2082 SUBSCRIPT TWO */ -#define XK_threesubscript 0x1002083 /* U+2083 SUBSCRIPT THREE */ -#define XK_foursubscript 0x1002084 /* U+2084 SUBSCRIPT FOUR */ -#define XK_fivesubscript 0x1002085 /* U+2085 SUBSCRIPT FIVE */ -#define XK_sixsubscript 0x1002086 /* U+2086 SUBSCRIPT SIX */ -#define XK_sevensubscript 0x1002087 /* U+2087 SUBSCRIPT SEVEN */ -#define XK_eightsubscript 0x1002088 /* U+2088 SUBSCRIPT EIGHT */ -#define XK_ninesubscript 0x1002089 /* U+2089 SUBSCRIPT NINE */ -#define XK_partdifferential 0x1002202 /* U+2202 PARTIAL DIFFERENTIAL */ -#define XK_emptyset 0x1002205 /* U+2205 NULL SET */ -#define XK_elementof 0x1002208 /* U+2208 ELEMENT OF */ -#define XK_notelementof 0x1002209 /* U+2209 NOT AN ELEMENT OF */ -#define XK_containsas 0x100220B /* U+220B CONTAINS AS MEMBER */ -#define XK_squareroot 0x100221A /* U+221A SQUARE ROOT */ -#define XK_cuberoot 0x100221B /* U+221B CUBE ROOT */ -#define XK_fourthroot 0x100221C /* U+221C FOURTH ROOT */ -#define XK_dintegral 0x100222C /* U+222C DOUBLE INTEGRAL */ -#define XK_tintegral 0x100222D /* U+222D TRIPLE INTEGRAL */ -#define XK_because 0x1002235 /* U+2235 BECAUSE */ -#define XK_approxeq 0x1002248 /* U+2245 ALMOST EQUAL TO */ -#define XK_notapproxeq 0x1002247 /* U+2247 NOT ALMOST EQUAL TO */ -#define XK_notidentical 0x1002262 /* U+2262 NOT IDENTICAL TO */ -#define XK_stricteq 0x1002263 /* U+2263 STRICTLY EQUIVALENT TO */ -#endif /* XK_MATHEMATICAL */ - -#ifdef XK_BRAILLE -#define XK_braille_dot_1 0xfff1 -#define XK_braille_dot_2 0xfff2 -#define XK_braille_dot_3 0xfff3 -#define XK_braille_dot_4 0xfff4 -#define XK_braille_dot_5 0xfff5 -#define XK_braille_dot_6 0xfff6 -#define XK_braille_dot_7 0xfff7 -#define XK_braille_dot_8 0xfff8 -#define XK_braille_dot_9 0xfff9 -#define XK_braille_dot_10 0xfffa -#define XK_braille_blank 0x1002800 /* U+2800 BRAILLE PATTERN BLANK */ -#define XK_braille_dots_1 0x1002801 /* U+2801 BRAILLE PATTERN DOTS-1 */ -#define XK_braille_dots_2 0x1002802 /* U+2802 BRAILLE PATTERN DOTS-2 */ -#define XK_braille_dots_12 0x1002803 /* U+2803 BRAILLE PATTERN DOTS-12 */ -#define XK_braille_dots_3 0x1002804 /* U+2804 BRAILLE PATTERN DOTS-3 */ -#define XK_braille_dots_13 0x1002805 /* U+2805 BRAILLE PATTERN DOTS-13 */ -#define XK_braille_dots_23 0x1002806 /* U+2806 BRAILLE PATTERN DOTS-23 */ -#define XK_braille_dots_123 0x1002807 /* U+2807 BRAILLE PATTERN DOTS-123 */ -#define XK_braille_dots_4 0x1002808 /* U+2808 BRAILLE PATTERN DOTS-4 */ -#define XK_braille_dots_14 0x1002809 /* U+2809 BRAILLE PATTERN DOTS-14 */ -#define XK_braille_dots_24 0x100280a /* U+280a BRAILLE PATTERN DOTS-24 */ -#define XK_braille_dots_124 0x100280b /* U+280b BRAILLE PATTERN DOTS-124 */ -#define XK_braille_dots_34 0x100280c /* U+280c BRAILLE PATTERN DOTS-34 */ -#define XK_braille_dots_134 0x100280d /* U+280d BRAILLE PATTERN DOTS-134 */ -#define XK_braille_dots_234 0x100280e /* U+280e BRAILLE PATTERN DOTS-234 */ -#define XK_braille_dots_1234 0x100280f /* U+280f BRAILLE PATTERN DOTS-1234 */ -#define XK_braille_dots_5 0x1002810 /* U+2810 BRAILLE PATTERN DOTS-5 */ -#define XK_braille_dots_15 0x1002811 /* U+2811 BRAILLE PATTERN DOTS-15 */ -#define XK_braille_dots_25 0x1002812 /* U+2812 BRAILLE PATTERN DOTS-25 */ -#define XK_braille_dots_125 0x1002813 /* U+2813 BRAILLE PATTERN DOTS-125 */ -#define XK_braille_dots_35 0x1002814 /* U+2814 BRAILLE PATTERN DOTS-35 */ -#define XK_braille_dots_135 0x1002815 /* U+2815 BRAILLE PATTERN DOTS-135 */ -#define XK_braille_dots_235 0x1002816 /* U+2816 BRAILLE PATTERN DOTS-235 */ -#define XK_braille_dots_1235 0x1002817 /* U+2817 BRAILLE PATTERN DOTS-1235 */ -#define XK_braille_dots_45 0x1002818 /* U+2818 BRAILLE PATTERN DOTS-45 */ -#define XK_braille_dots_145 0x1002819 /* U+2819 BRAILLE PATTERN DOTS-145 */ -#define XK_braille_dots_245 0x100281a /* U+281a BRAILLE PATTERN DOTS-245 */ -#define XK_braille_dots_1245 0x100281b /* U+281b BRAILLE PATTERN DOTS-1245 */ -#define XK_braille_dots_345 0x100281c /* U+281c BRAILLE PATTERN DOTS-345 */ -#define XK_braille_dots_1345 0x100281d /* U+281d BRAILLE PATTERN DOTS-1345 */ -#define XK_braille_dots_2345 0x100281e /* U+281e BRAILLE PATTERN DOTS-2345 */ -#define XK_braille_dots_12345 0x100281f /* U+281f BRAILLE PATTERN DOTS-12345 */ -#define XK_braille_dots_6 0x1002820 /* U+2820 BRAILLE PATTERN DOTS-6 */ -#define XK_braille_dots_16 0x1002821 /* U+2821 BRAILLE PATTERN DOTS-16 */ -#define XK_braille_dots_26 0x1002822 /* U+2822 BRAILLE PATTERN DOTS-26 */ -#define XK_braille_dots_126 0x1002823 /* U+2823 BRAILLE PATTERN DOTS-126 */ -#define XK_braille_dots_36 0x1002824 /* U+2824 BRAILLE PATTERN DOTS-36 */ -#define XK_braille_dots_136 0x1002825 /* U+2825 BRAILLE PATTERN DOTS-136 */ -#define XK_braille_dots_236 0x1002826 /* U+2826 BRAILLE PATTERN DOTS-236 */ -#define XK_braille_dots_1236 0x1002827 /* U+2827 BRAILLE PATTERN DOTS-1236 */ -#define XK_braille_dots_46 0x1002828 /* U+2828 BRAILLE PATTERN DOTS-46 */ -#define XK_braille_dots_146 0x1002829 /* U+2829 BRAILLE PATTERN DOTS-146 */ -#define XK_braille_dots_246 0x100282a /* U+282a BRAILLE PATTERN DOTS-246 */ -#define XK_braille_dots_1246 0x100282b /* U+282b BRAILLE PATTERN DOTS-1246 */ -#define XK_braille_dots_346 0x100282c /* U+282c BRAILLE PATTERN DOTS-346 */ -#define XK_braille_dots_1346 0x100282d /* U+282d BRAILLE PATTERN DOTS-1346 */ -#define XK_braille_dots_2346 0x100282e /* U+282e BRAILLE PATTERN DOTS-2346 */ -#define XK_braille_dots_12346 0x100282f /* U+282f BRAILLE PATTERN DOTS-12346 */ -#define XK_braille_dots_56 0x1002830 /* U+2830 BRAILLE PATTERN DOTS-56 */ -#define XK_braille_dots_156 0x1002831 /* U+2831 BRAILLE PATTERN DOTS-156 */ -#define XK_braille_dots_256 0x1002832 /* U+2832 BRAILLE PATTERN DOTS-256 */ -#define XK_braille_dots_1256 0x1002833 /* U+2833 BRAILLE PATTERN DOTS-1256 */ -#define XK_braille_dots_356 0x1002834 /* U+2834 BRAILLE PATTERN DOTS-356 */ -#define XK_braille_dots_1356 0x1002835 /* U+2835 BRAILLE PATTERN DOTS-1356 */ -#define XK_braille_dots_2356 0x1002836 /* U+2836 BRAILLE PATTERN DOTS-2356 */ -#define XK_braille_dots_12356 0x1002837 /* U+2837 BRAILLE PATTERN DOTS-12356 */ -#define XK_braille_dots_456 0x1002838 /* U+2838 BRAILLE PATTERN DOTS-456 */ -#define XK_braille_dots_1456 0x1002839 /* U+2839 BRAILLE PATTERN DOTS-1456 */ -#define XK_braille_dots_2456 0x100283a /* U+283a BRAILLE PATTERN DOTS-2456 */ -#define XK_braille_dots_12456 0x100283b /* U+283b BRAILLE PATTERN DOTS-12456 */ -#define XK_braille_dots_3456 0x100283c /* U+283c BRAILLE PATTERN DOTS-3456 */ -#define XK_braille_dots_13456 0x100283d /* U+283d BRAILLE PATTERN DOTS-13456 */ -#define XK_braille_dots_23456 0x100283e /* U+283e BRAILLE PATTERN DOTS-23456 */ -#define XK_braille_dots_123456 0x100283f /* U+283f BRAILLE PATTERN DOTS-123456 */ -#define XK_braille_dots_7 0x1002840 /* U+2840 BRAILLE PATTERN DOTS-7 */ -#define XK_braille_dots_17 0x1002841 /* U+2841 BRAILLE PATTERN DOTS-17 */ -#define XK_braille_dots_27 0x1002842 /* U+2842 BRAILLE PATTERN DOTS-27 */ -#define XK_braille_dots_127 0x1002843 /* U+2843 BRAILLE PATTERN DOTS-127 */ -#define XK_braille_dots_37 0x1002844 /* U+2844 BRAILLE PATTERN DOTS-37 */ -#define XK_braille_dots_137 0x1002845 /* U+2845 BRAILLE PATTERN DOTS-137 */ -#define XK_braille_dots_237 0x1002846 /* U+2846 BRAILLE PATTERN DOTS-237 */ -#define XK_braille_dots_1237 0x1002847 /* U+2847 BRAILLE PATTERN DOTS-1237 */ -#define XK_braille_dots_47 0x1002848 /* U+2848 BRAILLE PATTERN DOTS-47 */ -#define XK_braille_dots_147 0x1002849 /* U+2849 BRAILLE PATTERN DOTS-147 */ -#define XK_braille_dots_247 0x100284a /* U+284a BRAILLE PATTERN DOTS-247 */ -#define XK_braille_dots_1247 0x100284b /* U+284b BRAILLE PATTERN DOTS-1247 */ -#define XK_braille_dots_347 0x100284c /* U+284c BRAILLE PATTERN DOTS-347 */ -#define XK_braille_dots_1347 0x100284d /* U+284d BRAILLE PATTERN DOTS-1347 */ -#define XK_braille_dots_2347 0x100284e /* U+284e BRAILLE PATTERN DOTS-2347 */ -#define XK_braille_dots_12347 0x100284f /* U+284f BRAILLE PATTERN DOTS-12347 */ -#define XK_braille_dots_57 0x1002850 /* U+2850 BRAILLE PATTERN DOTS-57 */ -#define XK_braille_dots_157 0x1002851 /* U+2851 BRAILLE PATTERN DOTS-157 */ -#define XK_braille_dots_257 0x1002852 /* U+2852 BRAILLE PATTERN DOTS-257 */ -#define XK_braille_dots_1257 0x1002853 /* U+2853 BRAILLE PATTERN DOTS-1257 */ -#define XK_braille_dots_357 0x1002854 /* U+2854 BRAILLE PATTERN DOTS-357 */ -#define XK_braille_dots_1357 0x1002855 /* U+2855 BRAILLE PATTERN DOTS-1357 */ -#define XK_braille_dots_2357 0x1002856 /* U+2856 BRAILLE PATTERN DOTS-2357 */ -#define XK_braille_dots_12357 0x1002857 /* U+2857 BRAILLE PATTERN DOTS-12357 */ -#define XK_braille_dots_457 0x1002858 /* U+2858 BRAILLE PATTERN DOTS-457 */ -#define XK_braille_dots_1457 0x1002859 /* U+2859 BRAILLE PATTERN DOTS-1457 */ -#define XK_braille_dots_2457 0x100285a /* U+285a BRAILLE PATTERN DOTS-2457 */ -#define XK_braille_dots_12457 0x100285b /* U+285b BRAILLE PATTERN DOTS-12457 */ -#define XK_braille_dots_3457 0x100285c /* U+285c BRAILLE PATTERN DOTS-3457 */ -#define XK_braille_dots_13457 0x100285d /* U+285d BRAILLE PATTERN DOTS-13457 */ -#define XK_braille_dots_23457 0x100285e /* U+285e BRAILLE PATTERN DOTS-23457 */ -#define XK_braille_dots_123457 0x100285f /* U+285f BRAILLE PATTERN DOTS-123457 */ -#define XK_braille_dots_67 0x1002860 /* U+2860 BRAILLE PATTERN DOTS-67 */ -#define XK_braille_dots_167 0x1002861 /* U+2861 BRAILLE PATTERN DOTS-167 */ -#define XK_braille_dots_267 0x1002862 /* U+2862 BRAILLE PATTERN DOTS-267 */ -#define XK_braille_dots_1267 0x1002863 /* U+2863 BRAILLE PATTERN DOTS-1267 */ -#define XK_braille_dots_367 0x1002864 /* U+2864 BRAILLE PATTERN DOTS-367 */ -#define XK_braille_dots_1367 0x1002865 /* U+2865 BRAILLE PATTERN DOTS-1367 */ -#define XK_braille_dots_2367 0x1002866 /* U+2866 BRAILLE PATTERN DOTS-2367 */ -#define XK_braille_dots_12367 0x1002867 /* U+2867 BRAILLE PATTERN DOTS-12367 */ -#define XK_braille_dots_467 0x1002868 /* U+2868 BRAILLE PATTERN DOTS-467 */ -#define XK_braille_dots_1467 0x1002869 /* U+2869 BRAILLE PATTERN DOTS-1467 */ -#define XK_braille_dots_2467 0x100286a /* U+286a BRAILLE PATTERN DOTS-2467 */ -#define XK_braille_dots_12467 0x100286b /* U+286b BRAILLE PATTERN DOTS-12467 */ -#define XK_braille_dots_3467 0x100286c /* U+286c BRAILLE PATTERN DOTS-3467 */ -#define XK_braille_dots_13467 0x100286d /* U+286d BRAILLE PATTERN DOTS-13467 */ -#define XK_braille_dots_23467 0x100286e /* U+286e BRAILLE PATTERN DOTS-23467 */ -#define XK_braille_dots_123467 0x100286f /* U+286f BRAILLE PATTERN DOTS-123467 */ -#define XK_braille_dots_567 0x1002870 /* U+2870 BRAILLE PATTERN DOTS-567 */ -#define XK_braille_dots_1567 0x1002871 /* U+2871 BRAILLE PATTERN DOTS-1567 */ -#define XK_braille_dots_2567 0x1002872 /* U+2872 BRAILLE PATTERN DOTS-2567 */ -#define XK_braille_dots_12567 0x1002873 /* U+2873 BRAILLE PATTERN DOTS-12567 */ -#define XK_braille_dots_3567 0x1002874 /* U+2874 BRAILLE PATTERN DOTS-3567 */ -#define XK_braille_dots_13567 0x1002875 /* U+2875 BRAILLE PATTERN DOTS-13567 */ -#define XK_braille_dots_23567 0x1002876 /* U+2876 BRAILLE PATTERN DOTS-23567 */ -#define XK_braille_dots_123567 0x1002877 /* U+2877 BRAILLE PATTERN DOTS-123567 */ -#define XK_braille_dots_4567 0x1002878 /* U+2878 BRAILLE PATTERN DOTS-4567 */ -#define XK_braille_dots_14567 0x1002879 /* U+2879 BRAILLE PATTERN DOTS-14567 */ -#define XK_braille_dots_24567 0x100287a /* U+287a BRAILLE PATTERN DOTS-24567 */ -#define XK_braille_dots_124567 0x100287b /* U+287b BRAILLE PATTERN DOTS-124567 */ -#define XK_braille_dots_34567 0x100287c /* U+287c BRAILLE PATTERN DOTS-34567 */ -#define XK_braille_dots_134567 0x100287d /* U+287d BRAILLE PATTERN DOTS-134567 */ -#define XK_braille_dots_234567 0x100287e /* U+287e BRAILLE PATTERN DOTS-234567 */ -#define XK_braille_dots_1234567 0x100287f /* U+287f BRAILLE PATTERN DOTS-1234567 */ -#define XK_braille_dots_8 0x1002880 /* U+2880 BRAILLE PATTERN DOTS-8 */ -#define XK_braille_dots_18 0x1002881 /* U+2881 BRAILLE PATTERN DOTS-18 */ -#define XK_braille_dots_28 0x1002882 /* U+2882 BRAILLE PATTERN DOTS-28 */ -#define XK_braille_dots_128 0x1002883 /* U+2883 BRAILLE PATTERN DOTS-128 */ -#define XK_braille_dots_38 0x1002884 /* U+2884 BRAILLE PATTERN DOTS-38 */ -#define XK_braille_dots_138 0x1002885 /* U+2885 BRAILLE PATTERN DOTS-138 */ -#define XK_braille_dots_238 0x1002886 /* U+2886 BRAILLE PATTERN DOTS-238 */ -#define XK_braille_dots_1238 0x1002887 /* U+2887 BRAILLE PATTERN DOTS-1238 */ -#define XK_braille_dots_48 0x1002888 /* U+2888 BRAILLE PATTERN DOTS-48 */ -#define XK_braille_dots_148 0x1002889 /* U+2889 BRAILLE PATTERN DOTS-148 */ -#define XK_braille_dots_248 0x100288a /* U+288a BRAILLE PATTERN DOTS-248 */ -#define XK_braille_dots_1248 0x100288b /* U+288b BRAILLE PATTERN DOTS-1248 */ -#define XK_braille_dots_348 0x100288c /* U+288c BRAILLE PATTERN DOTS-348 */ -#define XK_braille_dots_1348 0x100288d /* U+288d BRAILLE PATTERN DOTS-1348 */ -#define XK_braille_dots_2348 0x100288e /* U+288e BRAILLE PATTERN DOTS-2348 */ -#define XK_braille_dots_12348 0x100288f /* U+288f BRAILLE PATTERN DOTS-12348 */ -#define XK_braille_dots_58 0x1002890 /* U+2890 BRAILLE PATTERN DOTS-58 */ -#define XK_braille_dots_158 0x1002891 /* U+2891 BRAILLE PATTERN DOTS-158 */ -#define XK_braille_dots_258 0x1002892 /* U+2892 BRAILLE PATTERN DOTS-258 */ -#define XK_braille_dots_1258 0x1002893 /* U+2893 BRAILLE PATTERN DOTS-1258 */ -#define XK_braille_dots_358 0x1002894 /* U+2894 BRAILLE PATTERN DOTS-358 */ -#define XK_braille_dots_1358 0x1002895 /* U+2895 BRAILLE PATTERN DOTS-1358 */ -#define XK_braille_dots_2358 0x1002896 /* U+2896 BRAILLE PATTERN DOTS-2358 */ -#define XK_braille_dots_12358 0x1002897 /* U+2897 BRAILLE PATTERN DOTS-12358 */ -#define XK_braille_dots_458 0x1002898 /* U+2898 BRAILLE PATTERN DOTS-458 */ -#define XK_braille_dots_1458 0x1002899 /* U+2899 BRAILLE PATTERN DOTS-1458 */ -#define XK_braille_dots_2458 0x100289a /* U+289a BRAILLE PATTERN DOTS-2458 */ -#define XK_braille_dots_12458 0x100289b /* U+289b BRAILLE PATTERN DOTS-12458 */ -#define XK_braille_dots_3458 0x100289c /* U+289c BRAILLE PATTERN DOTS-3458 */ -#define XK_braille_dots_13458 0x100289d /* U+289d BRAILLE PATTERN DOTS-13458 */ -#define XK_braille_dots_23458 0x100289e /* U+289e BRAILLE PATTERN DOTS-23458 */ -#define XK_braille_dots_123458 0x100289f /* U+289f BRAILLE PATTERN DOTS-123458 */ -#define XK_braille_dots_68 0x10028a0 /* U+28a0 BRAILLE PATTERN DOTS-68 */ -#define XK_braille_dots_168 0x10028a1 /* U+28a1 BRAILLE PATTERN DOTS-168 */ -#define XK_braille_dots_268 0x10028a2 /* U+28a2 BRAILLE PATTERN DOTS-268 */ -#define XK_braille_dots_1268 0x10028a3 /* U+28a3 BRAILLE PATTERN DOTS-1268 */ -#define XK_braille_dots_368 0x10028a4 /* U+28a4 BRAILLE PATTERN DOTS-368 */ -#define XK_braille_dots_1368 0x10028a5 /* U+28a5 BRAILLE PATTERN DOTS-1368 */ -#define XK_braille_dots_2368 0x10028a6 /* U+28a6 BRAILLE PATTERN DOTS-2368 */ -#define XK_braille_dots_12368 0x10028a7 /* U+28a7 BRAILLE PATTERN DOTS-12368 */ -#define XK_braille_dots_468 0x10028a8 /* U+28a8 BRAILLE PATTERN DOTS-468 */ -#define XK_braille_dots_1468 0x10028a9 /* U+28a9 BRAILLE PATTERN DOTS-1468 */ -#define XK_braille_dots_2468 0x10028aa /* U+28aa BRAILLE PATTERN DOTS-2468 */ -#define XK_braille_dots_12468 0x10028ab /* U+28ab BRAILLE PATTERN DOTS-12468 */ -#define XK_braille_dots_3468 0x10028ac /* U+28ac BRAILLE PATTERN DOTS-3468 */ -#define XK_braille_dots_13468 0x10028ad /* U+28ad BRAILLE PATTERN DOTS-13468 */ -#define XK_braille_dots_23468 0x10028ae /* U+28ae BRAILLE PATTERN DOTS-23468 */ -#define XK_braille_dots_123468 0x10028af /* U+28af BRAILLE PATTERN DOTS-123468 */ -#define XK_braille_dots_568 0x10028b0 /* U+28b0 BRAILLE PATTERN DOTS-568 */ -#define XK_braille_dots_1568 0x10028b1 /* U+28b1 BRAILLE PATTERN DOTS-1568 */ -#define XK_braille_dots_2568 0x10028b2 /* U+28b2 BRAILLE PATTERN DOTS-2568 */ -#define XK_braille_dots_12568 0x10028b3 /* U+28b3 BRAILLE PATTERN DOTS-12568 */ -#define XK_braille_dots_3568 0x10028b4 /* U+28b4 BRAILLE PATTERN DOTS-3568 */ -#define XK_braille_dots_13568 0x10028b5 /* U+28b5 BRAILLE PATTERN DOTS-13568 */ -#define XK_braille_dots_23568 0x10028b6 /* U+28b6 BRAILLE PATTERN DOTS-23568 */ -#define XK_braille_dots_123568 0x10028b7 /* U+28b7 BRAILLE PATTERN DOTS-123568 */ -#define XK_braille_dots_4568 0x10028b8 /* U+28b8 BRAILLE PATTERN DOTS-4568 */ -#define XK_braille_dots_14568 0x10028b9 /* U+28b9 BRAILLE PATTERN DOTS-14568 */ -#define XK_braille_dots_24568 0x10028ba /* U+28ba BRAILLE PATTERN DOTS-24568 */ -#define XK_braille_dots_124568 0x10028bb /* U+28bb BRAILLE PATTERN DOTS-124568 */ -#define XK_braille_dots_34568 0x10028bc /* U+28bc BRAILLE PATTERN DOTS-34568 */ -#define XK_braille_dots_134568 0x10028bd /* U+28bd BRAILLE PATTERN DOTS-134568 */ -#define XK_braille_dots_234568 0x10028be /* U+28be BRAILLE PATTERN DOTS-234568 */ -#define XK_braille_dots_1234568 0x10028bf /* U+28bf BRAILLE PATTERN DOTS-1234568 */ -#define XK_braille_dots_78 0x10028c0 /* U+28c0 BRAILLE PATTERN DOTS-78 */ -#define XK_braille_dots_178 0x10028c1 /* U+28c1 BRAILLE PATTERN DOTS-178 */ -#define XK_braille_dots_278 0x10028c2 /* U+28c2 BRAILLE PATTERN DOTS-278 */ -#define XK_braille_dots_1278 0x10028c3 /* U+28c3 BRAILLE PATTERN DOTS-1278 */ -#define XK_braille_dots_378 0x10028c4 /* U+28c4 BRAILLE PATTERN DOTS-378 */ -#define XK_braille_dots_1378 0x10028c5 /* U+28c5 BRAILLE PATTERN DOTS-1378 */ -#define XK_braille_dots_2378 0x10028c6 /* U+28c6 BRAILLE PATTERN DOTS-2378 */ -#define XK_braille_dots_12378 0x10028c7 /* U+28c7 BRAILLE PATTERN DOTS-12378 */ -#define XK_braille_dots_478 0x10028c8 /* U+28c8 BRAILLE PATTERN DOTS-478 */ -#define XK_braille_dots_1478 0x10028c9 /* U+28c9 BRAILLE PATTERN DOTS-1478 */ -#define XK_braille_dots_2478 0x10028ca /* U+28ca BRAILLE PATTERN DOTS-2478 */ -#define XK_braille_dots_12478 0x10028cb /* U+28cb BRAILLE PATTERN DOTS-12478 */ -#define XK_braille_dots_3478 0x10028cc /* U+28cc BRAILLE PATTERN DOTS-3478 */ -#define XK_braille_dots_13478 0x10028cd /* U+28cd BRAILLE PATTERN DOTS-13478 */ -#define XK_braille_dots_23478 0x10028ce /* U+28ce BRAILLE PATTERN DOTS-23478 */ -#define XK_braille_dots_123478 0x10028cf /* U+28cf BRAILLE PATTERN DOTS-123478 */ -#define XK_braille_dots_578 0x10028d0 /* U+28d0 BRAILLE PATTERN DOTS-578 */ -#define XK_braille_dots_1578 0x10028d1 /* U+28d1 BRAILLE PATTERN DOTS-1578 */ -#define XK_braille_dots_2578 0x10028d2 /* U+28d2 BRAILLE PATTERN DOTS-2578 */ -#define XK_braille_dots_12578 0x10028d3 /* U+28d3 BRAILLE PATTERN DOTS-12578 */ -#define XK_braille_dots_3578 0x10028d4 /* U+28d4 BRAILLE PATTERN DOTS-3578 */ -#define XK_braille_dots_13578 0x10028d5 /* U+28d5 BRAILLE PATTERN DOTS-13578 */ -#define XK_braille_dots_23578 0x10028d6 /* U+28d6 BRAILLE PATTERN DOTS-23578 */ -#define XK_braille_dots_123578 0x10028d7 /* U+28d7 BRAILLE PATTERN DOTS-123578 */ -#define XK_braille_dots_4578 0x10028d8 /* U+28d8 BRAILLE PATTERN DOTS-4578 */ -#define XK_braille_dots_14578 0x10028d9 /* U+28d9 BRAILLE PATTERN DOTS-14578 */ -#define XK_braille_dots_24578 0x10028da /* U+28da BRAILLE PATTERN DOTS-24578 */ -#define XK_braille_dots_124578 0x10028db /* U+28db BRAILLE PATTERN DOTS-124578 */ -#define XK_braille_dots_34578 0x10028dc /* U+28dc BRAILLE PATTERN DOTS-34578 */ -#define XK_braille_dots_134578 0x10028dd /* U+28dd BRAILLE PATTERN DOTS-134578 */ -#define XK_braille_dots_234578 0x10028de /* U+28de BRAILLE PATTERN DOTS-234578 */ -#define XK_braille_dots_1234578 0x10028df /* U+28df BRAILLE PATTERN DOTS-1234578 */ -#define XK_braille_dots_678 0x10028e0 /* U+28e0 BRAILLE PATTERN DOTS-678 */ -#define XK_braille_dots_1678 0x10028e1 /* U+28e1 BRAILLE PATTERN DOTS-1678 */ -#define XK_braille_dots_2678 0x10028e2 /* U+28e2 BRAILLE PATTERN DOTS-2678 */ -#define XK_braille_dots_12678 0x10028e3 /* U+28e3 BRAILLE PATTERN DOTS-12678 */ -#define XK_braille_dots_3678 0x10028e4 /* U+28e4 BRAILLE PATTERN DOTS-3678 */ -#define XK_braille_dots_13678 0x10028e5 /* U+28e5 BRAILLE PATTERN DOTS-13678 */ -#define XK_braille_dots_23678 0x10028e6 /* U+28e6 BRAILLE PATTERN DOTS-23678 */ -#define XK_braille_dots_123678 0x10028e7 /* U+28e7 BRAILLE PATTERN DOTS-123678 */ -#define XK_braille_dots_4678 0x10028e8 /* U+28e8 BRAILLE PATTERN DOTS-4678 */ -#define XK_braille_dots_14678 0x10028e9 /* U+28e9 BRAILLE PATTERN DOTS-14678 */ -#define XK_braille_dots_24678 0x10028ea /* U+28ea BRAILLE PATTERN DOTS-24678 */ -#define XK_braille_dots_124678 0x10028eb /* U+28eb BRAILLE PATTERN DOTS-124678 */ -#define XK_braille_dots_34678 0x10028ec /* U+28ec BRAILLE PATTERN DOTS-34678 */ -#define XK_braille_dots_134678 0x10028ed /* U+28ed BRAILLE PATTERN DOTS-134678 */ -#define XK_braille_dots_234678 0x10028ee /* U+28ee BRAILLE PATTERN DOTS-234678 */ -#define XK_braille_dots_1234678 0x10028ef /* U+28ef BRAILLE PATTERN DOTS-1234678 */ -#define XK_braille_dots_5678 0x10028f0 /* U+28f0 BRAILLE PATTERN DOTS-5678 */ -#define XK_braille_dots_15678 0x10028f1 /* U+28f1 BRAILLE PATTERN DOTS-15678 */ -#define XK_braille_dots_25678 0x10028f2 /* U+28f2 BRAILLE PATTERN DOTS-25678 */ -#define XK_braille_dots_125678 0x10028f3 /* U+28f3 BRAILLE PATTERN DOTS-125678 */ -#define XK_braille_dots_35678 0x10028f4 /* U+28f4 BRAILLE PATTERN DOTS-35678 */ -#define XK_braille_dots_135678 0x10028f5 /* U+28f5 BRAILLE PATTERN DOTS-135678 */ -#define XK_braille_dots_235678 0x10028f6 /* U+28f6 BRAILLE PATTERN DOTS-235678 */ -#define XK_braille_dots_1235678 0x10028f7 /* U+28f7 BRAILLE PATTERN DOTS-1235678 */ -#define XK_braille_dots_45678 0x10028f8 /* U+28f8 BRAILLE PATTERN DOTS-45678 */ -#define XK_braille_dots_145678 0x10028f9 /* U+28f9 BRAILLE PATTERN DOTS-145678 */ -#define XK_braille_dots_245678 0x10028fa /* U+28fa BRAILLE PATTERN DOTS-245678 */ -#define XK_braille_dots_1245678 0x10028fb /* U+28fb BRAILLE PATTERN DOTS-1245678 */ -#define XK_braille_dots_345678 0x10028fc /* U+28fc BRAILLE PATTERN DOTS-345678 */ -#define XK_braille_dots_1345678 0x10028fd /* U+28fd BRAILLE PATTERN DOTS-1345678 */ -#define XK_braille_dots_2345678 0x10028fe /* U+28fe BRAILLE PATTERN DOTS-2345678 */ -#define XK_braille_dots_12345678 0x10028ff /* U+28ff BRAILLE PATTERN DOTS-12345678 */ -#endif /* XK_BRAILLE */ - -/* - * Sinhala (http://unicode.org/charts/PDF/U0D80.pdf) - * http://www.nongnu.org/sinhala/doc/transliteration/sinhala-transliteration_6.html - */ - -#ifdef XK_SINHALA -#define XK_Sinh_ng 0x1000d82 /* U+0D82 SINHALA ANUSVARAYA */ -#define XK_Sinh_h2 0x1000d83 /* U+0D83 SINHALA VISARGAYA */ -#define XK_Sinh_a 0x1000d85 /* U+0D85 SINHALA AYANNA */ -#define XK_Sinh_aa 0x1000d86 /* U+0D86 SINHALA AAYANNA */ -#define XK_Sinh_ae 0x1000d87 /* U+0D87 SINHALA AEYANNA */ -#define XK_Sinh_aee 0x1000d88 /* U+0D88 SINHALA AEEYANNA */ -#define XK_Sinh_i 0x1000d89 /* U+0D89 SINHALA IYANNA */ -#define XK_Sinh_ii 0x1000d8a /* U+0D8A SINHALA IIYANNA */ -#define XK_Sinh_u 0x1000d8b /* U+0D8B SINHALA UYANNA */ -#define XK_Sinh_uu 0x1000d8c /* U+0D8C SINHALA UUYANNA */ -#define XK_Sinh_ri 0x1000d8d /* U+0D8D SINHALA IRUYANNA */ -#define XK_Sinh_rii 0x1000d8e /* U+0D8E SINHALA IRUUYANNA */ -#define XK_Sinh_lu 0x1000d8f /* U+0D8F SINHALA ILUYANNA */ -#define XK_Sinh_luu 0x1000d90 /* U+0D90 SINHALA ILUUYANNA */ -#define XK_Sinh_e 0x1000d91 /* U+0D91 SINHALA EYANNA */ -#define XK_Sinh_ee 0x1000d92 /* U+0D92 SINHALA EEYANNA */ -#define XK_Sinh_ai 0x1000d93 /* U+0D93 SINHALA AIYANNA */ -#define XK_Sinh_o 0x1000d94 /* U+0D94 SINHALA OYANNA */ -#define XK_Sinh_oo 0x1000d95 /* U+0D95 SINHALA OOYANNA */ -#define XK_Sinh_au 0x1000d96 /* U+0D96 SINHALA AUYANNA */ -#define XK_Sinh_ka 0x1000d9a /* U+0D9A SINHALA KAYANNA */ -#define XK_Sinh_kha 0x1000d9b /* U+0D9B SINHALA MAHA. KAYANNA */ -#define XK_Sinh_ga 0x1000d9c /* U+0D9C SINHALA GAYANNA */ -#define XK_Sinh_gha 0x1000d9d /* U+0D9D SINHALA MAHA. GAYANNA */ -#define XK_Sinh_ng2 0x1000d9e /* U+0D9E SINHALA KANTAJA NAASIKYAYA */ -#define XK_Sinh_nga 0x1000d9f /* U+0D9F SINHALA SANYAKA GAYANNA */ -#define XK_Sinh_ca 0x1000da0 /* U+0DA0 SINHALA CAYANNA */ -#define XK_Sinh_cha 0x1000da1 /* U+0DA1 SINHALA MAHA. CAYANNA */ -#define XK_Sinh_ja 0x1000da2 /* U+0DA2 SINHALA JAYANNA */ -#define XK_Sinh_jha 0x1000da3 /* U+0DA3 SINHALA MAHA. JAYANNA */ -#define XK_Sinh_nya 0x1000da4 /* U+0DA4 SINHALA TAALUJA NAASIKYAYA */ -#define XK_Sinh_jnya 0x1000da5 /* U+0DA5 SINHALA TAALUJA SANYOOGA NAASIKYAYA */ -#define XK_Sinh_nja 0x1000da6 /* U+0DA6 SINHALA SANYAKA JAYANNA */ -#define XK_Sinh_tta 0x1000da7 /* U+0DA7 SINHALA TTAYANNA */ -#define XK_Sinh_ttha 0x1000da8 /* U+0DA8 SINHALA MAHA. TTAYANNA */ -#define XK_Sinh_dda 0x1000da9 /* U+0DA9 SINHALA DDAYANNA */ -#define XK_Sinh_ddha 0x1000daa /* U+0DAA SINHALA MAHA. DDAYANNA */ -#define XK_Sinh_nna 0x1000dab /* U+0DAB SINHALA MUURDHAJA NAYANNA */ -#define XK_Sinh_ndda 0x1000dac /* U+0DAC SINHALA SANYAKA DDAYANNA */ -#define XK_Sinh_tha 0x1000dad /* U+0DAD SINHALA TAYANNA */ -#define XK_Sinh_thha 0x1000dae /* U+0DAE SINHALA MAHA. TAYANNA */ -#define XK_Sinh_dha 0x1000daf /* U+0DAF SINHALA DAYANNA */ -#define XK_Sinh_dhha 0x1000db0 /* U+0DB0 SINHALA MAHA. DAYANNA */ -#define XK_Sinh_na 0x1000db1 /* U+0DB1 SINHALA DANTAJA NAYANNA */ -#define XK_Sinh_ndha 0x1000db3 /* U+0DB3 SINHALA SANYAKA DAYANNA */ -#define XK_Sinh_pa 0x1000db4 /* U+0DB4 SINHALA PAYANNA */ -#define XK_Sinh_pha 0x1000db5 /* U+0DB5 SINHALA MAHA. PAYANNA */ -#define XK_Sinh_ba 0x1000db6 /* U+0DB6 SINHALA BAYANNA */ -#define XK_Sinh_bha 0x1000db7 /* U+0DB7 SINHALA MAHA. BAYANNA */ -#define XK_Sinh_ma 0x1000db8 /* U+0DB8 SINHALA MAYANNA */ -#define XK_Sinh_mba 0x1000db9 /* U+0DB9 SINHALA AMBA BAYANNA */ -#define XK_Sinh_ya 0x1000dba /* U+0DBA SINHALA YAYANNA */ -#define XK_Sinh_ra 0x1000dbb /* U+0DBB SINHALA RAYANNA */ -#define XK_Sinh_la 0x1000dbd /* U+0DBD SINHALA DANTAJA LAYANNA */ -#define XK_Sinh_va 0x1000dc0 /* U+0DC0 SINHALA VAYANNA */ -#define XK_Sinh_sha 0x1000dc1 /* U+0DC1 SINHALA TAALUJA SAYANNA */ -#define XK_Sinh_ssha 0x1000dc2 /* U+0DC2 SINHALA MUURDHAJA SAYANNA */ -#define XK_Sinh_sa 0x1000dc3 /* U+0DC3 SINHALA DANTAJA SAYANNA */ -#define XK_Sinh_ha 0x1000dc4 /* U+0DC4 SINHALA HAYANNA */ -#define XK_Sinh_lla 0x1000dc5 /* U+0DC5 SINHALA MUURDHAJA LAYANNA */ -#define XK_Sinh_fa 0x1000dc6 /* U+0DC6 SINHALA FAYANNA */ -#define XK_Sinh_al 0x1000dca /* U+0DCA SINHALA AL-LAKUNA */ -#define XK_Sinh_aa2 0x1000dcf /* U+0DCF SINHALA AELA-PILLA */ -#define XK_Sinh_ae2 0x1000dd0 /* U+0DD0 SINHALA AEDA-PILLA */ -#define XK_Sinh_aee2 0x1000dd1 /* U+0DD1 SINHALA DIGA AEDA-PILLA */ -#define XK_Sinh_i2 0x1000dd2 /* U+0DD2 SINHALA IS-PILLA */ -#define XK_Sinh_ii2 0x1000dd3 /* U+0DD3 SINHALA DIGA IS-PILLA */ -#define XK_Sinh_u2 0x1000dd4 /* U+0DD4 SINHALA PAA-PILLA */ -#define XK_Sinh_uu2 0x1000dd6 /* U+0DD6 SINHALA DIGA PAA-PILLA */ -#define XK_Sinh_ru2 0x1000dd8 /* U+0DD8 SINHALA GAETTA-PILLA */ -#define XK_Sinh_e2 0x1000dd9 /* U+0DD9 SINHALA KOMBUVA */ -#define XK_Sinh_ee2 0x1000dda /* U+0DDA SINHALA DIGA KOMBUVA */ -#define XK_Sinh_ai2 0x1000ddb /* U+0DDB SINHALA KOMBU DEKA */ -#define XK_Sinh_o2 0x1000ddc /* U+0DDC SINHALA KOMBUVA HAA AELA-PILLA*/ -#define XK_Sinh_oo2 0x1000ddd /* U+0DDD SINHALA KOMBUVA HAA DIGA AELA-PILLA*/ -#define XK_Sinh_au2 0x1000dde /* U+0DDE SINHALA KOMBUVA HAA GAYANUKITTA */ -#define XK_Sinh_lu2 0x1000ddf /* U+0DDF SINHALA GAYANUKITTA */ -#define XK_Sinh_ruu2 0x1000df2 /* U+0DF2 SINHALA DIGA GAETTA-PILLA */ -#define XK_Sinh_luu2 0x1000df3 /* U+0DF3 SINHALA DIGA GAYANUKITTA */ -#define XK_Sinh_kunddaliya 0x1000df4 /* U+0DF4 SINHALA KUNDDALIYA */ -#endif /* XK_SINHALA */ diff --git a/openflow/usr/include/_G_config.h b/openflow/usr/include/_G_config.h deleted file mode 100644 index abec245..0000000 --- a/openflow/usr/include/_G_config.h +++ /dev/null @@ -1,58 +0,0 @@ -/* This file is needed by libio to define various configuration parameters. - These are always the same in the GNU C library. */ - -#ifndef _G_config_h -#define _G_config_h 1 - -/* Define types for libio in terms of the standard internal type names. */ - -#include -#define __need_size_t -#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T -# define __need_wchar_t -#endif -#define __need_NULL -#include -#define __need_mbstate_t -#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T -# define __need_wint_t -#endif -#include -typedef struct -{ - __off_t __pos; - __mbstate_t __state; -} _G_fpos_t; -typedef struct -{ - __off64_t __pos; - __mbstate_t __state; -} _G_fpos64_t; -#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T -# include -typedef union -{ - struct __gconv_info __cd; - struct - { - struct __gconv_info __cd; - struct __gconv_step_data __data; - } __combined; -} _G_iconv_t; -#endif - - -/* These library features are always available in the GNU C library. */ -#define _G_va_list __gnuc_va_list - -#define _G_HAVE_MMAP 1 -#define _G_HAVE_MREMAP 1 - -#define _G_IO_IO_FILE_VERSION 0x20001 - -/* This is defined by if `st_blksize' exists. */ -#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE) - -#define _G_BUFSIZ 8192 - -#endif /* _G_config.h */ diff --git a/openflow/usr/include/aio.h b/openflow/usr/include/aio.h deleted file mode 100644 index 8cb6a5e..0000000 --- a/openflow/usr/include/aio.h +++ /dev/null @@ -1,246 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * ISO/IEC 9945-1:1996 6.7: Asynchronous Input and Output - */ - -#ifndef _AIO_H -#define _AIO_H 1 - -#include -#include -#define __need_sigevent_t -#include -#define __need_timespec -#include - -__BEGIN_DECLS - -/* Asynchronous I/O control block. */ -struct aiocb -{ - int aio_fildes; /* File desriptor. */ - int aio_lio_opcode; /* Operation to be performed. */ - int aio_reqprio; /* Request priority offset. */ - volatile void *aio_buf; /* Location of buffer. */ - size_t aio_nbytes; /* Length of transfer. */ - struct sigevent aio_sigevent; /* Signal number and value. */ - - /* Internal members. */ - struct aiocb *__next_prio; - int __abs_prio; - int __policy; - int __error_code; - __ssize_t __return_value; - -#ifndef __USE_FILE_OFFSET64 - __off_t aio_offset; /* File offset. */ - char __pad[sizeof (__off64_t) - sizeof (__off_t)]; -#else - __off64_t aio_offset; /* File offset. */ -#endif - char __glibc_reserved[32]; -}; - -/* The same for the 64bit offsets. Please note that the members aio_fildes - to __return_value have to be the same in aiocb and aiocb64. */ -#ifdef __USE_LARGEFILE64 -struct aiocb64 -{ - int aio_fildes; /* File desriptor. */ - int aio_lio_opcode; /* Operation to be performed. */ - int aio_reqprio; /* Request priority offset. */ - volatile void *aio_buf; /* Location of buffer. */ - size_t aio_nbytes; /* Length of transfer. */ - struct sigevent aio_sigevent; /* Signal number and value. */ - - /* Internal members. */ - struct aiocb *__next_prio; - int __abs_prio; - int __policy; - int __error_code; - __ssize_t __return_value; - - __off64_t aio_offset; /* File offset. */ - char __glibc_reserved[32]; -}; -#endif - - -#ifdef __USE_GNU -/* To customize the implementation one can use the following struct. - This implementation follows the one in Irix. */ -struct aioinit - { - int aio_threads; /* Maximal number of threads. */ - int aio_num; /* Number of expected simultanious requests. */ - int aio_locks; /* Not used. */ - int aio_usedba; /* Not used. */ - int aio_debug; /* Not used. */ - int aio_numusers; /* Not used. */ - int aio_idle_time; /* Number of seconds before idle thread - terminates. */ - int aio_reserved; - }; -#endif - - -/* Return values of cancelation function. */ -enum -{ - AIO_CANCELED, -#define AIO_CANCELED AIO_CANCELED - AIO_NOTCANCELED, -#define AIO_NOTCANCELED AIO_NOTCANCELED - AIO_ALLDONE -#define AIO_ALLDONE AIO_ALLDONE -}; - - -/* Operation codes for `aio_lio_opcode'. */ -enum -{ - LIO_READ, -#define LIO_READ LIO_READ - LIO_WRITE, -#define LIO_WRITE LIO_WRITE - LIO_NOP -#define LIO_NOP LIO_NOP -}; - - -/* Synchronization options for `lio_listio' function. */ -enum -{ - LIO_WAIT, -#define LIO_WAIT LIO_WAIT - LIO_NOWAIT -#define LIO_NOWAIT LIO_NOWAIT -}; - - -/* Allow user to specify optimization. */ -#ifdef __USE_GNU -extern void aio_init (const struct aioinit *__init) __THROW __nonnull ((1)); -#endif - - -#ifndef __USE_FILE_OFFSET64 -/* Enqueue read request for given number of bytes and the given priority. */ -extern int aio_read (struct aiocb *__aiocbp) __THROW __nonnull ((1)); -/* Enqueue write request for given number of bytes and the given priority. */ -extern int aio_write (struct aiocb *__aiocbp) __THROW __nonnull ((1)); - -/* Initiate list of I/O requests. */ -extern int lio_listio (int __mode, - struct aiocb *const __list[__restrict_arr], - int __nent, struct sigevent *__restrict __sig) - __THROW __nonnull ((2)); - -/* Retrieve error status associated with AIOCBP. */ -extern int aio_error (const struct aiocb *__aiocbp) __THROW __nonnull ((1)); -/* Return status associated with AIOCBP. */ -extern __ssize_t aio_return (struct aiocb *__aiocbp) __THROW __nonnull ((1)); - -/* Try to cancel asynchronous I/O requests outstanding against file - descriptor FILDES. */ -extern int aio_cancel (int __fildes, struct aiocb *__aiocbp) __THROW; - -/* Suspend calling thread until at least one of the asynchronous I/O - operations referenced by LIST has completed. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int aio_suspend (const struct aiocb *const __list[], int __nent, - const struct timespec *__restrict __timeout) - __nonnull ((1)); - -/* Force all operations associated with file desriptor described by - `aio_fildes' member of AIOCBP. */ -extern int aio_fsync (int __operation, struct aiocb *__aiocbp) - __THROW __nonnull ((2)); -#else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (aio_read, (struct aiocb *__aiocbp), aio_read64) - __nonnull ((1)); -extern int __REDIRECT_NTH (aio_write, (struct aiocb *__aiocbp), aio_write64) - __nonnull ((1)); - -extern int __REDIRECT_NTH (lio_listio, - (int __mode, - struct aiocb *const __list[__restrict_arr], - int __nent, struct sigevent *__restrict __sig), - lio_listio64) __nonnull ((2)); - -extern int __REDIRECT_NTH (aio_error, (const struct aiocb *__aiocbp), - aio_error64) __nonnull ((1)); -extern __ssize_t __REDIRECT_NTH (aio_return, (struct aiocb *__aiocbp), - aio_return64) __nonnull ((1)); - -extern int __REDIRECT_NTH (aio_cancel, - (int __fildes, struct aiocb *__aiocbp), - aio_cancel64); - -extern int __REDIRECT_NTH (aio_suspend, - (const struct aiocb *const __list[], int __nent, - const struct timespec *__restrict __timeout), - aio_suspend64) __nonnull ((1)); - -extern int __REDIRECT_NTH (aio_fsync, - (int __operation, struct aiocb *__aiocbp), - aio_fsync64) __nonnull ((2)); - -# else -# define aio_read aio_read64 -# define aio_write aio_write64 -# define lio_listio lio_listio64 -# define aio_error aio_error64 -# define aio_return aio_return64 -# define aio_cancel aio_cancel64 -# define aio_suspend aio_suspend64 -# define aio_fsync aio_fsync64 -# endif -#endif - -#ifdef __USE_LARGEFILE64 -extern int aio_read64 (struct aiocb64 *__aiocbp) __THROW __nonnull ((1)); -extern int aio_write64 (struct aiocb64 *__aiocbp) __THROW __nonnull ((1)); - -extern int lio_listio64 (int __mode, - struct aiocb64 *const __list[__restrict_arr], - int __nent, struct sigevent *__restrict __sig) - __THROW __nonnull ((2)); - -extern int aio_error64 (const struct aiocb64 *__aiocbp) - __THROW __nonnull ((1)); -extern __ssize_t aio_return64 (struct aiocb64 *__aiocbp) - __THROW __nonnull ((1)); - -extern int aio_cancel64 (int __fildes, struct aiocb64 *__aiocbp) __THROW; - -extern int aio_suspend64 (const struct aiocb64 *const __list[], int __nent, - const struct timespec *__restrict __timeout) - __THROW __nonnull ((1)); - -extern int aio_fsync64 (int __operation, struct aiocb64 *__aiocbp) - __THROW __nonnull ((2)); -#endif - -__END_DECLS - -#endif /* aio.h */ diff --git a/openflow/usr/include/aliases.h b/openflow/usr/include/aliases.h deleted file mode 100644 index 44760d3..0000000 --- a/openflow/usr/include/aliases.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _ALIASES_H -#define _ALIASES_H 1 - -#include - -#include - - -__BEGIN_DECLS - -/* Structure to represent one entry of the alias data base. */ -struct aliasent - { - char *alias_name; - size_t alias_members_len; - char **alias_members; - int alias_local; - }; - - -/* Open alias data base files. */ -extern void setaliasent (void) __THROW; - -/* Close alias data base files. */ -extern void endaliasent (void) __THROW; - -/* Get the next entry from the alias data base. */ -extern struct aliasent *getaliasent (void) __THROW; - -/* Get the next entry from the alias data base and put it in RESULT_BUF. */ -extern int getaliasent_r (struct aliasent *__restrict __result_buf, - char *__restrict __buffer, size_t __buflen, - struct aliasent **__restrict __result) __THROW; - -/* Get alias entry corresponding to NAME. */ -extern struct aliasent *getaliasbyname (const char *__name) __THROW; - -/* Get alias entry corresponding to NAME and put it in RESULT_BUF. */ -extern int getaliasbyname_r (const char *__restrict __name, - struct aliasent *__restrict __result_buf, - char *__restrict __buffer, size_t __buflen, - struct aliasent **__restrict __result) __THROW; - -__END_DECLS - -#endif /* aliases.h */ diff --git a/openflow/usr/include/alloca.h b/openflow/usr/include/alloca.h deleted file mode 100644 index 974d11a..0000000 --- a/openflow/usr/include/alloca.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1992-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _ALLOCA_H -#define _ALLOCA_H 1 - -#include - -#define __need_size_t -#include - -__BEGIN_DECLS - -/* Remove any previous definitions. */ -#undef alloca - -/* Allocate a block that will be freed when the calling function exits. */ -extern void *alloca (size_t __size) __THROW; - -#ifdef __GNUC__ -# define alloca(size) __builtin_alloca (size) -#endif /* GCC. */ - -__END_DECLS - -#endif /* alloca.h */ diff --git a/openflow/usr/include/ar.h b/openflow/usr/include/ar.h deleted file mode 100644 index caa0223..0000000 --- a/openflow/usr/include/ar.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Header describing `ar' archive file format. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _AR_H -#define _AR_H 1 - -#include - -/* Archive files start with the ARMAG identifying string. Then follows a - `struct ar_hdr', and as many bytes of member file data as its `ar_size' - member indicates, for each member file. */ - -#define ARMAG "!\n" /* String that begins an archive file. */ -#define SARMAG 8 /* Size of that string. */ - -#define ARFMAG "`\n" /* String in ar_fmag at end of each header. */ - -__BEGIN_DECLS - -struct ar_hdr - { - char ar_name[16]; /* Member file name, sometimes / terminated. */ - char ar_date[12]; /* File date, decimal seconds since Epoch. */ - char ar_uid[6], ar_gid[6]; /* User and group IDs, in ASCII decimal. */ - char ar_mode[8]; /* File mode, in ASCII octal. */ - char ar_size[10]; /* File size, in ASCII decimal. */ - char ar_fmag[2]; /* Always contains ARFMAG. */ - }; - -__END_DECLS - -#endif /* ar.h */ diff --git a/openflow/usr/include/argp.h b/openflow/usr/include/argp.h deleted file mode 100644 index 7cb5a69..0000000 --- a/openflow/usr/include/argp.h +++ /dev/null @@ -1,559 +0,0 @@ -/* Hierarchial argument parsing, layered over getopt. - Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Miles Bader . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _ARGP_H -#define _ARGP_H - -#include -#include -#include -#include - -#define __need_error_t -#include - -#ifndef __error_t_defined -typedef int error_t; -# define __error_t_defined -#endif - -__BEGIN_DECLS - -/* A description of a particular option. A pointer to an array of - these is passed in the OPTIONS field of an argp structure. Each option - entry can correspond to one long option and/or one short option; more - names for the same option can be added by following an entry in an option - array with options having the OPTION_ALIAS flag set. */ -struct argp_option -{ - /* The long option name. For more than one name for the same option, you - can use following options with the OPTION_ALIAS flag set. */ - const char *name; - - /* What key is returned for this option. If > 0 and printable, then it's - also accepted as a short option. */ - int key; - - /* If non-NULL, this is the name of the argument associated with this - option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */ - const char *arg; - - /* OPTION_ flags. */ - int flags; - - /* The doc string for this option. If both NAME and KEY are 0, This string - will be printed outdented from the normal option column, making it - useful as a group header (it will be the first thing printed in its - group); in this usage, it's conventional to end the string with a `:'. */ - const char *doc; - - /* The group this option is in. In a long help message, options are sorted - alphabetically within each group, and the groups presented in the order - 0, 1, 2, ..., n, -m, ..., -2, -1. Every entry in an options array with - if this field 0 will inherit the group number of the previous entry, or - zero if it's the first one, unless its a group header (NAME and KEY both - 0), in which case, the previous entry + 1 is the default. Automagic - options such as --help are put into group -1. */ - int group; -}; - -/* The argument associated with this option is optional. */ -#define OPTION_ARG_OPTIONAL 0x1 - -/* This option isn't displayed in any help messages. */ -#define OPTION_HIDDEN 0x2 - -/* This option is an alias for the closest previous non-alias option. This - means that it will be displayed in the same help entry, and will inherit - fields other than NAME and KEY from the aliased option. */ -#define OPTION_ALIAS 0x4 - -/* This option isn't actually an option (and so should be ignored by the - actual option parser), but rather an arbitrary piece of documentation that - should be displayed in much the same manner as the options. If this flag - is set, then the option NAME field is displayed unmodified (e.g., no `--' - prefix is added) at the left-margin (where a *short* option would normally - be displayed), and the documentation string in the normal place. For - purposes of sorting, any leading whitespace and punctuation is ignored, - except that if the first non-whitespace character is not `-', this entry - is displayed after all options (and OPTION_DOC entries with a leading `-') - in the same group. */ -#define OPTION_DOC 0x8 - -/* This option shouldn't be included in `long' usage messages (but is still - included in help messages). This is mainly intended for options that are - completely documented in an argp's ARGS_DOC field, in which case including - the option in the generic usage list would be redundant. For instance, - if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to - distinguish these two cases, -x should probably be marked - OPTION_NO_USAGE. */ -#define OPTION_NO_USAGE 0x10 - -struct argp; /* fwd declare this type */ -struct argp_state; /* " */ -struct argp_child; /* " */ - -/* The type of a pointer to an argp parsing function. */ -typedef error_t (*argp_parser_t) (int __key, char *__arg, - struct argp_state *__state); - -/* What to return for unrecognized keys. For special ARGP_KEY_ keys, such - returns will simply be ignored. For user keys, this error will be turned - into EINVAL (if the call to argp_parse is such that errors are propagated - back to the user instead of exiting); returning EINVAL itself would result - in an immediate stop to parsing in *all* cases. */ -#define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */ - -/* Special values for the KEY argument to an argument parsing function. - ARGP_ERR_UNKNOWN should be returned if they aren't understood. - - The sequence of keys to a parsing function is either (where each - uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key): - - INIT opt... NO_ARGS END SUCCESS -- No non-option arguments at all - or INIT (opt | ARG)... END SUCCESS -- All non-option args parsed - or INIT (opt | ARG)... SUCCESS -- Some non-option arg unrecognized - - The third case is where every parser returned ARGP_KEY_UNKNOWN for an - argument, in which case parsing stops at that argument (returning the - unparsed arguments to the caller of argp_parse if requested, or stopping - with an error message if not). - - If an error occurs (either detected by argp, or because the parsing - function returned an error value), then the parser is called with - ARGP_KEY_ERROR, and no further calls are made. */ - -/* This is not an option at all, but rather a command line argument. If a - parser receiving this key returns success, the fact is recorded, and the - ARGP_KEY_NO_ARGS case won't be used. HOWEVER, if while processing the - argument, a parser function decrements the NEXT field of the state it's - passed, the option won't be considered processed; this is to allow you to - actually modify the argument (perhaps into an option), and have it - processed again. */ -#define ARGP_KEY_ARG 0 -/* There are remaining arguments not parsed by any parser, which may be found - starting at (STATE->argv + STATE->next). If success is returned, but - STATE->next left untouched, it's assumed that all arguments were consume, - otherwise, the parser should adjust STATE->next to reflect any arguments - consumed. */ -#define ARGP_KEY_ARGS 0x1000006 -/* There are no more command line arguments at all. */ -#define ARGP_KEY_END 0x1000001 -/* Because it's common to want to do some special processing if there aren't - any non-option args, user parsers are called with this key if they didn't - successfully process any non-option arguments. Called just before - ARGP_KEY_END (where more general validity checks on previously parsed - arguments can take place). */ -#define ARGP_KEY_NO_ARGS 0x1000002 -/* Passed in before any parsing is done. Afterwards, the values of each - element of the CHILD_INPUT field, if any, in the state structure is - copied to each child's state to be the initial value of the INPUT field. */ -#define ARGP_KEY_INIT 0x1000003 -/* Use after all other keys, including SUCCESS & END. */ -#define ARGP_KEY_FINI 0x1000007 -/* Passed in when parsing has successfully been completed (even if there are - still arguments remaining). */ -#define ARGP_KEY_SUCCESS 0x1000004 -/* Passed in if an error occurs. */ -#define ARGP_KEY_ERROR 0x1000005 - -/* An argp structure contains a set of options declarations, a function to - deal with parsing one, documentation string, a possible vector of child - argp's, and perhaps a function to filter help output. When actually - parsing options, getopt is called with the union of all the argp - structures chained together through their CHILD pointers, with conflicts - being resolved in favor of the first occurrence in the chain. */ -struct argp -{ - /* An array of argp_option structures, terminated by an entry with both - NAME and KEY having a value of 0. */ - const struct argp_option *options; - - /* What to do with an option from this structure. KEY is the key - associated with the option, and ARG is any associated argument (NULL if - none was supplied). If KEY isn't understood, ARGP_ERR_UNKNOWN should be - returned. If a non-zero, non-ARGP_ERR_UNKNOWN value is returned, then - parsing is stopped immediately, and that value is returned from - argp_parse(). For special (non-user-supplied) values of KEY, see the - ARGP_KEY_ definitions below. */ - argp_parser_t parser; - - /* A string describing what other arguments are wanted by this program. It - is only used by argp_usage to print the `Usage:' message. If it - contains newlines, the strings separated by them are considered - alternative usage patterns, and printed on separate lines (lines after - the first are prefix by ` or: ' instead of `Usage:'). */ - const char *args_doc; - - /* If non-NULL, a string containing extra text to be printed before and - after the options in a long help message (separated by a vertical tab - `\v' character). */ - const char *doc; - - /* A vector of argp_children structures, terminated by a member with a 0 - argp field, pointing to child argps should be parsed with this one. Any - conflicts are resolved in favor of this argp, or early argps in the - CHILDREN list. This field is useful if you use libraries that supply - their own argp structure, which you want to use in conjunction with your - own. */ - const struct argp_child *children; - - /* If non-zero, this should be a function to filter the output of help - messages. KEY is either a key from an option, in which case TEXT is - that option's help text, or a special key from the ARGP_KEY_HELP_ - defines, below, describing which other help text TEXT is. The function - should return either TEXT, if it should be used as-is, a replacement - string, which should be malloced, and will be freed by argp, or NULL, - meaning `print nothing'. The value for TEXT is *after* any translation - has been done, so if any of the replacement text also needs translation, - that should be done by the filter function. INPUT is either the input - supplied to argp_parse, or NULL, if argp_help was called directly. */ - char *(*help_filter) (int __key, const char *__text, void *__input); - - /* If non-zero the strings used in the argp library are translated using - the domain described by this string. Otherwise the currently installed - default domain is used. */ - const char *argp_domain; -}; - -/* Possible KEY arguments to a help filter function. */ -#define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */ -#define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */ -#define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */ -#define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation; - TEXT is NULL for this key. */ -/* Explanatory note emitted when duplicate option arguments have been - suppressed. */ -#define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005 -#define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */ - -/* When an argp has a non-zero CHILDREN field, it should point to a vector of - argp_child structures, each of which describes a subsidiary argp. */ -struct argp_child -{ - /* The child parser. */ - const struct argp *argp; - - /* Flags for this child. */ - int flags; - - /* If non-zero, an optional header to be printed in help output before the - child options. As a side-effect, a non-zero value forces the child - options to be grouped together; to achieve this effect without actually - printing a header string, use a value of "". */ - const char *header; - - /* Where to group the child options relative to the other (`consolidated') - options in the parent argp; the values are the same as the GROUP field - in argp_option structs, but all child-groupings follow parent options at - a particular group level. If both this field and HEADER are zero, then - they aren't grouped at all, but rather merged with the parent options - (merging the child's grouping levels with the parents). */ - int group; -}; - -/* Parsing state. This is provided to parsing functions called by argp, - which may examine and, as noted, modify fields. */ -struct argp_state -{ - /* The top level ARGP being parsed. */ - const struct argp *root_argp; - - /* The argument vector being parsed. May be modified. */ - int argc; - char **argv; - - /* The index in ARGV of the next arg that to be parsed. May be modified. */ - int next; - - /* The flags supplied to argp_parse. May be modified. */ - unsigned flags; - - /* While calling a parsing function with a key of ARGP_KEY_ARG, this is the - number of the current arg, starting at zero, and incremented after each - such call returns. At all other times, this is the number of such - arguments that have been processed. */ - unsigned arg_num; - - /* If non-zero, the index in ARGV of the first argument following a special - `--' argument (which prevents anything following being interpreted as an - option). Only set once argument parsing has proceeded past this point. */ - int quoted; - - /* An arbitrary pointer passed in from the user. */ - void *input; - /* Values to pass to child parsers. This vector will be the same length as - the number of children for the current parser. */ - void **child_inputs; - - /* For the parser's use. Initialized to 0. */ - void *hook; - - /* The name used when printing messages. This is initialized to ARGV[0], - or PROGRAM_INVOCATION_NAME if that is unavailable. */ - char *name; - - /* Streams used when argp prints something. */ - FILE *err_stream; /* For errors; initialized to stderr. */ - FILE *out_stream; /* For information; initialized to stdout. */ - - void *pstate; /* Private, for use by argp. */ -}; - -/* Flags for argp_parse (note that the defaults are those that are - convenient for program command line parsing): */ - -/* Don't ignore the first element of ARGV. Normally (and always unless - ARGP_NO_ERRS is set) the first element of the argument vector is - skipped for option parsing purposes, as it corresponds to the program name - in a command line. */ -#define ARGP_PARSE_ARGV0 0x01 - -/* Don't print error messages for unknown options to stderr; unless this flag - is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program - name in the error messages. This flag implies ARGP_NO_EXIT (on the - assumption that silent exiting upon errors is bad behaviour). */ -#define ARGP_NO_ERRS 0x02 - -/* Don't parse any non-option args. Normally non-option args are parsed by - calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg - as the value. Since it's impossible to know which parse function wants to - handle it, each one is called in turn, until one returns 0 or an error - other than ARGP_ERR_UNKNOWN; if an argument is handled by no one, the - argp_parse returns prematurely (but with a return value of 0). If all - args have been parsed without error, all parsing functions are called one - last time with a key of ARGP_KEY_END. This flag needn't normally be set, - as the normal behavior is to stop parsing as soon as some argument can't - be handled. */ -#define ARGP_NO_ARGS 0x04 - -/* Parse options and arguments in the same order they occur on the command - line -- normally they're rearranged so that all options come first. */ -#define ARGP_IN_ORDER 0x08 - -/* Don't provide the standard long option --help, which causes usage and - option help information to be output to stdout, and exit (0) called. */ -#define ARGP_NO_HELP 0x10 - -/* Don't exit on errors (they may still result in error messages). */ -#define ARGP_NO_EXIT 0x20 - -/* Use the gnu getopt `long-only' rules for parsing arguments. */ -#define ARGP_LONG_ONLY 0x40 - -/* Turns off any message-printing/exiting options. */ -#define ARGP_SILENT (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP) - -/* Parse the options strings in ARGC & ARGV according to the options in ARGP. - FLAGS is one of the ARGP_ flags above. If ARG_INDEX is non-NULL, the - index in ARGV of the first unparsed option is returned in it. If an - unknown option is present, ARGP_ERR_UNKNOWN is returned; if some parser - routine returned a non-zero value, it is returned; otherwise 0 is - returned. This function may also call exit unless the ARGP_NO_HELP flag - is set. INPUT is a pointer to a value to be passed in to the parser. */ -extern error_t argp_parse (const struct argp *__restrict __argp, - int __argc, char **__restrict __argv, - unsigned __flags, int *__restrict __arg_index, - void *__restrict __input); -extern error_t __argp_parse (const struct argp *__restrict __argp, - int __argc, char **__restrict __argv, - unsigned __flags, int *__restrict __arg_index, - void *__restrict __input); - -/* Global variables. */ - -/* If defined or set by the user program to a non-zero value, then a default - option --version is added (unless the ARGP_NO_HELP flag is used), which - will print this string followed by a newline and exit (unless the - ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ -extern const char *argp_program_version; - -/* If defined or set by the user program to a non-zero value, then a default - option --version is added (unless the ARGP_NO_HELP flag is used), which - calls this function with a stream to print the version to and a pointer to - the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is - used). This variable takes precedent over ARGP_PROGRAM_VERSION. */ -extern void (*argp_program_version_hook) (FILE *__restrict __stream, - struct argp_state *__restrict - __state); - -/* If defined or set by the user program, it should point to string that is - the bug-reporting address for the program. It will be printed by - argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various - standard help messages), embedded in a sentence that says something like - `Report bugs to ADDR.'. */ -extern const char *argp_program_bug_address; - -/* The exit status that argp will use when exiting due to a parsing error. - If not defined or set by the user program, this defaults to EX_USAGE from - . */ -extern error_t argp_err_exit_status; - -/* Flags for argp_help. */ -#define ARGP_HELP_USAGE 0x01 /* a Usage: message. */ -#define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */ -#define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */ -#define ARGP_HELP_LONG 0x08 /* a long help message. */ -#define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */ -#define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */ -#define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC) -#define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */ -#define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to - reflect ARGP_LONG_ONLY mode. */ - -/* These ARGP_HELP flags are only understood by argp_state_help. */ -#define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */ -#define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */ - -/* The standard thing to do after a program command line parsing error, if an - error message has already been printed. */ -#define ARGP_HELP_STD_ERR \ - (ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) -/* The standard thing to do after a program command line parsing error, if no - more specific error message has been printed. */ -#define ARGP_HELP_STD_USAGE \ - (ARGP_HELP_SHORT_USAGE | ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) -/* The standard thing to do in response to a --help option. */ -#define ARGP_HELP_STD_HELP \ - (ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG | ARGP_HELP_EXIT_OK \ - | ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR) - -/* Output a usage message for ARGP to STREAM. FLAGS are from the set - ARGP_HELP_*. */ -extern void argp_help (const struct argp *__restrict __argp, - FILE *__restrict __stream, - unsigned __flags, char *__restrict __name); -extern void __argp_help (const struct argp *__restrict __argp, - FILE *__restrict __stream, unsigned __flags, - char *__name); - -/* The following routines are intended to be called from within an argp - parsing routine (thus taking an argp_state structure as the first - argument). They may or may not print an error message and exit, depending - on the flags in STATE -- in any case, the caller should be prepared for - them *not* to exit, and should return an appropiate error after calling - them. [argp_usage & argp_error should probably be called argp_state_..., - but they're used often enough that they should be short] */ - -/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are - from the set ARGP_HELP_*. */ -extern void argp_state_help (const struct argp_state *__restrict __state, - FILE *__restrict __stream, - unsigned int __flags); -extern void __argp_state_help (const struct argp_state *__restrict __state, - FILE *__restrict __stream, - unsigned int __flags); - -/* Possibly output the standard usage message for ARGP to stderr and exit. */ -extern void argp_usage (const struct argp_state *__state); -extern void __argp_usage (const struct argp_state *__state); - -/* If appropriate, print the printf string FMT and following args, preceded - by the program name and `:', to stderr, and followed by a `Try ... --help' - message, then exit (1). */ -extern void argp_error (const struct argp_state *__restrict __state, - const char *__restrict __fmt, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); -extern void __argp_error (const struct argp_state *__restrict __state, - const char *__restrict __fmt, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); - -/* Similar to the standard gnu error-reporting function error(), but will - respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print - to STATE->err_stream. This is useful for argument parsing code that is - shared between program startup (when exiting is desired) and runtime - option parsing (when typically an error code is returned instead). The - difference between this function and argp_error is that the latter is for - *parsing errors*, and the former is for other problems that occur during - parsing but don't reflect a (syntactic) problem with the input. */ -extern void argp_failure (const struct argp_state *__restrict __state, - int __status, int __errnum, - const char *__restrict __fmt, ...) - __attribute__ ((__format__ (__printf__, 4, 5))); -extern void __argp_failure (const struct argp_state *__restrict __state, - int __status, int __errnum, - const char *__restrict __fmt, ...) - __attribute__ ((__format__ (__printf__, 4, 5))); - -/* Returns true if the option OPT is a valid short option. */ -extern int _option_is_short (const struct argp_option *__opt) __THROW; -extern int __option_is_short (const struct argp_option *__opt) __THROW; - -/* Returns true if the option OPT is in fact the last (unused) entry in an - options array. */ -extern int _option_is_end (const struct argp_option *__opt) __THROW; -extern int __option_is_end (const struct argp_option *__opt) __THROW; - -/* Return the input field for ARGP in the parser corresponding to STATE; used - by the help routines. */ -extern void *_argp_input (const struct argp *__restrict __argp, - const struct argp_state *__restrict __state) - __THROW; -extern void *__argp_input (const struct argp *__restrict __argp, - const struct argp_state *__restrict __state) - __THROW; - -#ifdef __USE_EXTERN_INLINES - -# if !_LIBC -# define __argp_usage argp_usage -# define __argp_state_help argp_state_help -# define __option_is_short _option_is_short -# define __option_is_end _option_is_end -# endif - -# ifndef ARGP_EI -# define ARGP_EI __extern_inline -# endif - -ARGP_EI void -__argp_usage (const struct argp_state *__state) -{ - __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); -} - -ARGP_EI int -__NTH (__option_is_short (const struct argp_option *__opt)) -{ - if (__opt->flags & OPTION_DOC) - return 0; - else - { - int __key = __opt->key; - return __key > 0 && __key <= UCHAR_MAX && isprint (__key); - } -} - -ARGP_EI int -__NTH (__option_is_end (const struct argp_option *__opt)) -{ - return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; -} - -# if !_LIBC -# undef __argp_usage -# undef __argp_state_help -# undef __option_is_short -# undef __option_is_end -# endif -#endif /* Use extern inlines. */ - -__END_DECLS - -#endif /* argp.h */ diff --git a/openflow/usr/include/argz.h b/openflow/usr/include/argz.h deleted file mode 100644 index c1bc5f7..0000000 --- a/openflow/usr/include/argz.h +++ /dev/null @@ -1,182 +0,0 @@ -/* Routines for dealing with '\0' separated arg vectors. - Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _ARGZ_H -#define _ARGZ_H 1 - -#include - -#define __need_error_t -#include -#include /* Need size_t, and strchr is called below. */ - -#ifndef __error_t_defined -typedef int error_t; -#endif - - -__BEGIN_DECLS - -/* Make a '\0' separated arg vector from a unix argv vector, returning it in - ARGZ, and the total length in LEN. If a memory allocation error occurs, - ENOMEM is returned, otherwise 0. The result can be destroyed using free. */ -extern error_t __argz_create (char *const __argv[], char **__restrict __argz, - size_t *__restrict __len) __THROW; -extern error_t argz_create (char *const __argv[], char **__restrict __argz, - size_t *__restrict __len) __THROW; - -/* Make a '\0' separated arg vector from a SEP separated list in - STRING, returning it in ARGZ, and the total length in LEN. If a - memory allocation error occurs, ENOMEM is returned, otherwise 0. - The result can be destroyed using free. */ -extern error_t __argz_create_sep (const char *__restrict __string, - int __sep, char **__restrict __argz, - size_t *__restrict __len) __THROW; -extern error_t argz_create_sep (const char *__restrict __string, - int __sep, char **__restrict __argz, - size_t *__restrict __len) __THROW; - -/* Returns the number of strings in ARGZ. */ -extern size_t __argz_count (const char *__argz, size_t __len) - __THROW __attribute_pure__; -extern size_t argz_count (const char *__argz, size_t __len) - __THROW __attribute_pure__; - -/* Puts pointers to each string in ARGZ into ARGV, which must be large enough - to hold them all. */ -extern void __argz_extract (const char *__restrict __argz, size_t __len, - char **__restrict __argv) __THROW; -extern void argz_extract (const char *__restrict __argz, size_t __len, - char **__restrict __argv) __THROW; - -/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's - except the last into the character SEP. */ -extern void __argz_stringify (char *__argz, size_t __len, int __sep) __THROW; -extern void argz_stringify (char *__argz, size_t __len, int __sep) __THROW; - -/* Append BUF, of length BUF_LEN to the argz vector in ARGZ & ARGZ_LEN. */ -extern error_t __argz_append (char **__restrict __argz, - size_t *__restrict __argz_len, - const char *__restrict __buf, size_t __buf_len) - __THROW; -extern error_t argz_append (char **__restrict __argz, - size_t *__restrict __argz_len, - const char *__restrict __buf, size_t __buf_len) - __THROW; - -/* Append STR to the argz vector in ARGZ & ARGZ_LEN. */ -extern error_t __argz_add (char **__restrict __argz, - size_t *__restrict __argz_len, - const char *__restrict __str) __THROW; -extern error_t argz_add (char **__restrict __argz, - size_t *__restrict __argz_len, - const char *__restrict __str) __THROW; - -/* Append SEP separated list in STRING to the argz vector in ARGZ & - ARGZ_LEN. */ -extern error_t __argz_add_sep (char **__restrict __argz, - size_t *__restrict __argz_len, - const char *__restrict __string, int __delim) - __THROW; -extern error_t argz_add_sep (char **__restrict __argz, - size_t *__restrict __argz_len, - const char *__restrict __string, int __delim) - __THROW; - -/* Delete ENTRY from ARGZ & ARGZ_LEN, if it appears there. */ -extern void __argz_delete (char **__restrict __argz, - size_t *__restrict __argz_len, - char *__restrict __entry) __THROW; -extern void argz_delete (char **__restrict __argz, - size_t *__restrict __argz_len, - char *__restrict __entry) __THROW; - -/* Insert ENTRY into ARGZ & ARGZ_LEN before BEFORE, which should be an - existing entry in ARGZ; if BEFORE is NULL, ENTRY is appended to the end. - Since ARGZ's first entry is the same as ARGZ, argz_insert (ARGZ, ARGZ_LEN, - ARGZ, ENTRY) will insert ENTRY at the beginning of ARGZ. If BEFORE is not - in ARGZ, EINVAL is returned, else if memory can't be allocated for the new - ARGZ, ENOMEM is returned, else 0. */ -extern error_t __argz_insert (char **__restrict __argz, - size_t *__restrict __argz_len, - char *__restrict __before, - const char *__restrict __entry) __THROW; -extern error_t argz_insert (char **__restrict __argz, - size_t *__restrict __argz_len, - char *__restrict __before, - const char *__restrict __entry) __THROW; - -/* Replace any occurrences of the string STR in ARGZ with WITH, reallocating - ARGZ as necessary. If REPLACE_COUNT is non-zero, *REPLACE_COUNT will be - incremented by number of replacements performed. */ -extern error_t __argz_replace (char **__restrict __argz, - size_t *__restrict __argz_len, - const char *__restrict __str, - const char *__restrict __with, - unsigned int *__restrict __replace_count); -extern error_t argz_replace (char **__restrict __argz, - size_t *__restrict __argz_len, - const char *__restrict __str, - const char *__restrict __with, - unsigned int *__restrict __replace_count); - -/* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there - are no more. If entry is NULL, then the first entry is returned. This - behavior allows two convenient iteration styles: - - char *entry = 0; - while ((entry = argz_next (argz, argz_len, entry))) - ...; - - or - - char *entry; - for (entry = argz; entry; entry = argz_next (argz, argz_len, entry)) - ...; -*/ -extern char *__argz_next (const char *__restrict __argz, size_t __argz_len, - const char *__restrict __entry) __THROW; -extern char *argz_next (const char *__restrict __argz, size_t __argz_len, - const char *__restrict __entry) __THROW; - -#ifdef __USE_EXTERN_INLINES -__extern_inline char * -__NTH (__argz_next (const char *__argz, size_t __argz_len, - const char *__entry)) -{ - if (__entry) - { - if (__entry < __argz + __argz_len) - __entry = strchr (__entry, '\0') + 1; - - return __entry >= __argz + __argz_len ? (char *) NULL : (char *) __entry; - } - else - return __argz_len > 0 ? (char *) __argz : 0; -} -__extern_inline char * -__NTH (argz_next (const char *__argz, size_t __argz_len, - const char *__entry)) -{ - return __argz_next (__argz, __argz_len, __entry); -} -#endif /* Use extern inlines. */ - -__END_DECLS - -#endif /* argz.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/a.out.h b/openflow/usr/include/arm-linux-gnueabihf/a.out.h deleted file mode 100644 index e3f4bdd..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/a.out.h +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef __A_OUT_GNU_H__ -#define __A_OUT_GNU_H__ - -#include - -#define __GNU_EXEC_MACROS__ - -struct exec -{ - unsigned long a_info; /* Use macros N_MAGIC, etc for access. */ - unsigned int a_text; /* Length of text, in bytes. */ - unsigned int a_data; /* Length of data, in bytes. */ - unsigned int a_bss; /* Length of uninitialized data area for file, in bytes. */ - unsigned int a_syms; /* Length of symbol table data in file, in bytes. */ - unsigned int a_entry; /* Start address. */ - unsigned int a_trsize;/* Length of relocation info for text, in bytes. */ - unsigned int a_drsize;/* Length of relocation info for data, in bytes. */ -}; - -enum machine_type -{ - M_OLDSUN2 = 0, - M_68010 = 1, - M_68020 = 2, - M_SPARC = 3, - M_386 = 100, - M_MIPS1 = 151, - M_MIPS2 = 152 -}; - -#define N_MAGIC(exec) ((exec).a_info & 0xffff) -#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) -#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) -#define N_SET_INFO(exec, magic, type, flags) \ - ((exec).a_info = ((magic) & 0xffff) \ - | (((int)(type) & 0xff) << 16) \ - | (((flags) & 0xff) << 24)) -#define N_SET_MAGIC(exec, magic) \ - ((exec).a_info = ((exec).a_info & 0xffff0000) | ((magic) & 0xffff)) -#define N_SET_MACHTYPE(exec, machtype) \ - ((exec).a_info = \ - ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) -#define N_SET_FLAGS(exec, flags) \ - ((exec).a_info = \ - ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) - -/* Code indicating object file or impure executable. */ -#define OMAGIC 0407 -/* Code indicating pure executable. */ -#define NMAGIC 0410 -/* Code indicating demand-paged executable. */ -#define ZMAGIC 0413 -/* This indicates a demand-paged executable with the header in the text. - The first page is unmapped to help trap NULL pointer references. */ -#define QMAGIC 0314 -/* Code indicating core file. */ -#define CMAGIC 0421 - -#define N_TRSIZE(a) ((a).a_trsize) -#define N_DRSIZE(a) ((a).a_drsize) -#define N_SYMSIZE(a) ((a).a_syms) -#define N_BADMAG(x) \ - (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \ - && N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC) -#define _N_HDROFF(x) (1024 - sizeof (struct exec)) -#define N_TXTOFF(x) \ - (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \ - (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec))) -#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text) -#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data) -#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x)) -#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x)) -#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x)) - -/* Address of text segment in memory after it is loaded. */ -#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? 4096 : 0) - -/* Address of data segment in memory after it is loaded. */ -#define SEGMENT_SIZE 1024 - -#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1)) -#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text) - -#define N_DATADDR(x) \ - (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \ - : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x)))) -#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) - -#if !defined (N_NLIST_DECLARED) -struct nlist -{ - union - { - char *n_name; - struct nlist *n_next; - long n_strx; - } n_un; - unsigned char n_type; - char n_other; - short n_desc; - unsigned long n_value; -}; -#endif /* no N_NLIST_DECLARED. */ - -#define N_UNDF 0 -#define N_ABS 2 -#define N_TEXT 4 -#define N_DATA 6 -#define N_BSS 8 -#define N_FN 15 -#define N_EXT 1 -#define N_TYPE 036 -#define N_STAB 0340 -#define N_INDR 0xa -#define N_SETA 0x14 /* Absolute set element symbol. */ -#define N_SETT 0x16 /* Text set element symbol. */ -#define N_SETD 0x18 /* Data set element symbol. */ -#define N_SETB 0x1A /* Bss set element symbol. */ -#define N_SETV 0x1C /* Pointer to set vector in data area. */ - -#if !defined (N_RELOCATION_INFO_DECLARED) -/* This structure describes a single relocation to be performed. - The text-relocation section of the file is a vector of these structures, - all of which apply to the text section. - Likewise, the data-relocation section applies to the data section. */ - -struct relocation_info -{ - int r_address; - unsigned int r_symbolnum:24; - unsigned int r_pcrel:1; - unsigned int r_length:2; - unsigned int r_extern:1; - unsigned int r_pad:4; -}; -#endif /* no N_RELOCATION_INFO_DECLARED. */ - -#endif /* __A_OUT_GNU_H__ */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/auxvec.h b/openflow/usr/include/arm-linux-gnueabihf/asm/auxvec.h deleted file mode 100644 index cb02a76..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/auxvec.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __ASM_AUXVEC_H -#define __ASM_AUXVEC_H - -/* VDSO location */ -#define AT_SYSINFO_EHDR 33 - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/bitsperlong.h b/openflow/usr/include/arm-linux-gnueabihf/asm/bitsperlong.h deleted file mode 100644 index 6dc0bb0..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/bitsperlong.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/byteorder.h b/openflow/usr/include/arm-linux-gnueabihf/asm/byteorder.h deleted file mode 100644 index 7737974..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/byteorder.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * arch/arm/include/asm/byteorder.h - * - * ARM Endian-ness. In little endian mode, the data bus is connected such - * that byte accesses appear as: - * 0 = d0...d7, 1 = d8...d15, 2 = d16...d23, 3 = d24...d31 - * and word accesses (data or instruction) appear as: - * d0...d31 - * - * When in big endian mode, byte accesses appear as: - * 0 = d24...d31, 1 = d16...d23, 2 = d8...d15, 3 = d0...d7 - * and word accesses (data or instruction) appear as: - * d0...d31 - */ -#ifndef __ASM_ARM_BYTEORDER_H -#define __ASM_ARM_BYTEORDER_H - -#ifdef __ARMEB__ -#include -#else -#include -#endif - -#endif - diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/errno.h b/openflow/usr/include/arm-linux-gnueabihf/asm/errno.h deleted file mode 100644 index 4c82b50..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/errno.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/fcntl.h b/openflow/usr/include/arm-linux-gnueabihf/asm/fcntl.h deleted file mode 100644 index a80b660..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/fcntl.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _ARM_FCNTL_H -#define _ARM_FCNTL_H - -#define O_DIRECTORY 040000 /* must be a directory */ -#define O_NOFOLLOW 0100000 /* don't follow links */ -#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ -#define O_LARGEFILE 0400000 - -#include - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/hwcap.h b/openflow/usr/include/arm-linux-gnueabihf/asm/hwcap.h deleted file mode 100644 index 7bf3c6e..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/hwcap.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __ASMARM_HWCAP_H -#define __ASMARM_HWCAP_H - -/* - * HWCAP flags - for elf_hwcap (in kernel) and AT_HWCAP - */ -#define HWCAP_SWP (1 << 0) -#define HWCAP_HALF (1 << 1) -#define HWCAP_THUMB (1 << 2) -#define HWCAP_26BIT (1 << 3) /* Play it safe */ -#define HWCAP_FAST_MULT (1 << 4) -#define HWCAP_FPA (1 << 5) -#define HWCAP_VFP (1 << 6) -#define HWCAP_EDSP (1 << 7) -#define HWCAP_JAVA (1 << 8) -#define HWCAP_IWMMXT (1 << 9) -#define HWCAP_CRUNCH (1 << 10) -#define HWCAP_THUMBEE (1 << 11) -#define HWCAP_NEON (1 << 12) -#define HWCAP_VFPv3 (1 << 13) -#define HWCAP_VFPv3D16 (1 << 14) /* also set for VFPv4-D16 */ -#define HWCAP_TLS (1 << 15) -#define HWCAP_VFPv4 (1 << 16) -#define HWCAP_IDIVA (1 << 17) -#define HWCAP_IDIVT (1 << 18) -#define HWCAP_VFPD32 (1 << 19) /* set if VFP has 32 regs (not 16) */ -#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT) -#define HWCAP_LPAE (1 << 20) -#define HWCAP_EVTSTRM (1 << 21) - -/* - * HWCAP2 flags - for elf_hwcap2 (in kernel) and AT_HWCAP2 - */ -#define HWCAP2_AES (1 << 0) -#define HWCAP2_PMULL (1 << 1) -#define HWCAP2_SHA1 (1 << 2) -#define HWCAP2_SHA2 (1 << 3) -#define HWCAP2_CRC32 (1 << 4) - -#endif /* __ASMARM_HWCAP_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/ioctl.h b/openflow/usr/include/arm-linux-gnueabihf/asm/ioctl.h deleted file mode 100644 index b279fe0..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/ioctl.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/ioctls.h b/openflow/usr/include/arm-linux-gnueabihf/asm/ioctls.h deleted file mode 100644 index 9c96298..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/ioctls.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __ASM_ARM_IOCTLS_H -#define __ASM_ARM_IOCTLS_H - -#define FIOQSIZE 0x545E - -#include - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/ipcbuf.h b/openflow/usr/include/arm-linux-gnueabihf/asm/ipcbuf.h deleted file mode 100644 index 84c7e51..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/ipcbuf.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/kvm.h b/openflow/usr/include/arm-linux-gnueabihf/asm/kvm.h deleted file mode 100644 index c98e4dc..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/kvm.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (C) 2012 - Virtual Open Systems and Columbia University - * Author: Christoffer Dall - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __ARM_KVM_H__ -#define __ARM_KVM_H__ - -#include -#include -#include - -#define __KVM_HAVE_GUEST_DEBUG -#define __KVM_HAVE_IRQ_LINE -#define __KVM_HAVE_READONLY_MEM - -#define KVM_REG_SIZE(id) \ - (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) - -/* Valid for svc_regs, abt_regs, und_regs, irq_regs in struct kvm_regs */ -#define KVM_ARM_SVC_sp svc_regs[0] -#define KVM_ARM_SVC_lr svc_regs[1] -#define KVM_ARM_SVC_spsr svc_regs[2] -#define KVM_ARM_ABT_sp abt_regs[0] -#define KVM_ARM_ABT_lr abt_regs[1] -#define KVM_ARM_ABT_spsr abt_regs[2] -#define KVM_ARM_UND_sp und_regs[0] -#define KVM_ARM_UND_lr und_regs[1] -#define KVM_ARM_UND_spsr und_regs[2] -#define KVM_ARM_IRQ_sp irq_regs[0] -#define KVM_ARM_IRQ_lr irq_regs[1] -#define KVM_ARM_IRQ_spsr irq_regs[2] - -/* Valid only for fiq_regs in struct kvm_regs */ -#define KVM_ARM_FIQ_r8 fiq_regs[0] -#define KVM_ARM_FIQ_r9 fiq_regs[1] -#define KVM_ARM_FIQ_r10 fiq_regs[2] -#define KVM_ARM_FIQ_fp fiq_regs[3] -#define KVM_ARM_FIQ_ip fiq_regs[4] -#define KVM_ARM_FIQ_sp fiq_regs[5] -#define KVM_ARM_FIQ_lr fiq_regs[6] -#define KVM_ARM_FIQ_spsr fiq_regs[7] - -struct kvm_regs { - struct pt_regs usr_regs; /* R0_usr - R14_usr, PC, CPSR */ - unsigned long svc_regs[3]; /* SP_svc, LR_svc, SPSR_svc */ - unsigned long abt_regs[3]; /* SP_abt, LR_abt, SPSR_abt */ - unsigned long und_regs[3]; /* SP_und, LR_und, SPSR_und */ - unsigned long irq_regs[3]; /* SP_irq, LR_irq, SPSR_irq */ - unsigned long fiq_regs[8]; /* R8_fiq - R14_fiq, SPSR_fiq */ -}; - -/* Supported Processor Types */ -#define KVM_ARM_TARGET_CORTEX_A15 0 -#define KVM_ARM_TARGET_CORTEX_A7 1 -#define KVM_ARM_NUM_TARGETS 2 - -/* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */ -#define KVM_ARM_DEVICE_TYPE_SHIFT 0 -#define KVM_ARM_DEVICE_TYPE_MASK (0xffff << KVM_ARM_DEVICE_TYPE_SHIFT) -#define KVM_ARM_DEVICE_ID_SHIFT 16 -#define KVM_ARM_DEVICE_ID_MASK (0xffff << KVM_ARM_DEVICE_ID_SHIFT) - -/* Supported device IDs */ -#define KVM_ARM_DEVICE_VGIC_V2 0 - -/* Supported VGIC address types */ -#define KVM_VGIC_V2_ADDR_TYPE_DIST 0 -#define KVM_VGIC_V2_ADDR_TYPE_CPU 1 - -#define KVM_VGIC_V2_DIST_SIZE 0x1000 -#define KVM_VGIC_V2_CPU_SIZE 0x2000 - -#define KVM_ARM_VCPU_POWER_OFF 0 /* CPU is started in OFF state */ -#define KVM_ARM_VCPU_PSCI_0_2 1 /* CPU uses PSCI v0.2 */ - -struct kvm_vcpu_init { - __u32 target; - __u32 features[7]; -}; - -struct kvm_sregs { -}; - -struct kvm_fpu { -}; - -struct kvm_guest_debug_arch { -}; - -struct kvm_debug_exit_arch { -}; - -struct kvm_sync_regs { -}; - -struct kvm_arch_memory_slot { -}; - -/* If you need to interpret the index values, here is the key: */ -#define KVM_REG_ARM_COPROC_MASK 0x000000000FFF0000 -#define KVM_REG_ARM_COPROC_SHIFT 16 -#define KVM_REG_ARM_32_OPC2_MASK 0x0000000000000007 -#define KVM_REG_ARM_32_OPC2_SHIFT 0 -#define KVM_REG_ARM_OPC1_MASK 0x0000000000000078 -#define KVM_REG_ARM_OPC1_SHIFT 3 -#define KVM_REG_ARM_CRM_MASK 0x0000000000000780 -#define KVM_REG_ARM_CRM_SHIFT 7 -#define KVM_REG_ARM_32_CRN_MASK 0x0000000000007800 -#define KVM_REG_ARM_32_CRN_SHIFT 11 - -#define ARM_CP15_REG_SHIFT_MASK(x,n) \ - (((x) << KVM_REG_ARM_ ## n ## _SHIFT) & KVM_REG_ARM_ ## n ## _MASK) - -#define __ARM_CP15_REG(op1,crn,crm,op2) \ - (KVM_REG_ARM | (15 << KVM_REG_ARM_COPROC_SHIFT) | \ - ARM_CP15_REG_SHIFT_MASK(op1, OPC1) | \ - ARM_CP15_REG_SHIFT_MASK(crn, 32_CRN) | \ - ARM_CP15_REG_SHIFT_MASK(crm, CRM) | \ - ARM_CP15_REG_SHIFT_MASK(op2, 32_OPC2)) - -#define ARM_CP15_REG32(...) (__ARM_CP15_REG(__VA_ARGS__) | KVM_REG_SIZE_U32) - -#define __ARM_CP15_REG64(op1,crm) \ - (__ARM_CP15_REG(op1, 0, crm, 0) | KVM_REG_SIZE_U64) -#define ARM_CP15_REG64(...) __ARM_CP15_REG64(__VA_ARGS__) - -#define KVM_REG_ARM_TIMER_CTL ARM_CP15_REG32(0, 14, 3, 1) -#define KVM_REG_ARM_TIMER_CNT ARM_CP15_REG64(1, 14) -#define KVM_REG_ARM_TIMER_CVAL ARM_CP15_REG64(3, 14) - -/* Normal registers are mapped as coprocessor 16. */ -#define KVM_REG_ARM_CORE (0x0010 << KVM_REG_ARM_COPROC_SHIFT) -#define KVM_REG_ARM_CORE_REG(name) (offsetof(struct kvm_regs, name) / 4) - -/* Some registers need more space to represent values. */ -#define KVM_REG_ARM_DEMUX (0x0011 << KVM_REG_ARM_COPROC_SHIFT) -#define KVM_REG_ARM_DEMUX_ID_MASK 0x000000000000FF00 -#define KVM_REG_ARM_DEMUX_ID_SHIFT 8 -#define KVM_REG_ARM_DEMUX_ID_CCSIDR (0x00 << KVM_REG_ARM_DEMUX_ID_SHIFT) -#define KVM_REG_ARM_DEMUX_VAL_MASK 0x00000000000000FF -#define KVM_REG_ARM_DEMUX_VAL_SHIFT 0 - -/* VFP registers: we could overload CP10 like ARM does, but that's ugly. */ -#define KVM_REG_ARM_VFP (0x0012 << KVM_REG_ARM_COPROC_SHIFT) -#define KVM_REG_ARM_VFP_MASK 0x000000000000FFFF -#define KVM_REG_ARM_VFP_BASE_REG 0x0 -#define KVM_REG_ARM_VFP_FPSID 0x1000 -#define KVM_REG_ARM_VFP_FPSCR 0x1001 -#define KVM_REG_ARM_VFP_MVFR1 0x1006 -#define KVM_REG_ARM_VFP_MVFR0 0x1007 -#define KVM_REG_ARM_VFP_FPEXC 0x1008 -#define KVM_REG_ARM_VFP_FPINST 0x1009 -#define KVM_REG_ARM_VFP_FPINST2 0x100A - -/* Device Control API: ARM VGIC */ -#define KVM_DEV_ARM_VGIC_GRP_ADDR 0 -#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 -#define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2 -#define KVM_DEV_ARM_VGIC_CPUID_SHIFT 32 -#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT) -#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0 -#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT) -#define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3 -#define KVM_DEV_ARM_VGIC_GRP_CTRL 4 -#define KVM_DEV_ARM_VGIC_CTRL_INIT 0 - -/* KVM_IRQ_LINE irq field index values */ -#define KVM_ARM_IRQ_TYPE_SHIFT 24 -#define KVM_ARM_IRQ_TYPE_MASK 0xff -#define KVM_ARM_IRQ_VCPU_SHIFT 16 -#define KVM_ARM_IRQ_VCPU_MASK 0xff -#define KVM_ARM_IRQ_NUM_SHIFT 0 -#define KVM_ARM_IRQ_NUM_MASK 0xffff - -/* irq_type field */ -#define KVM_ARM_IRQ_TYPE_CPU 0 -#define KVM_ARM_IRQ_TYPE_SPI 1 -#define KVM_ARM_IRQ_TYPE_PPI 2 - -/* out-of-kernel GIC cpu interrupt injection irq_number field */ -#define KVM_ARM_IRQ_CPU_IRQ 0 -#define KVM_ARM_IRQ_CPU_FIQ 1 - -/* - * This used to hold the highest supported SPI, but it is now obsolete - * and only here to provide source code level compatibility with older - * userland. The highest SPI number can be set via KVM_DEV_ARM_VGIC_GRP_NR_IRQS. - */ -#define KVM_ARM_IRQ_GIC_MAX 127 - -/* One single KVM irqchip, ie. the VGIC */ -#define KVM_NR_IRQCHIPS 1 - -/* PSCI interface */ -#define KVM_PSCI_FN_BASE 0x95c1ba5e -#define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n)) - -#define KVM_PSCI_FN_CPU_SUSPEND KVM_PSCI_FN(0) -#define KVM_PSCI_FN_CPU_OFF KVM_PSCI_FN(1) -#define KVM_PSCI_FN_CPU_ON KVM_PSCI_FN(2) -#define KVM_PSCI_FN_MIGRATE KVM_PSCI_FN(3) - -#define KVM_PSCI_RET_SUCCESS PSCI_RET_SUCCESS -#define KVM_PSCI_RET_NI PSCI_RET_NOT_SUPPORTED -#define KVM_PSCI_RET_INVAL PSCI_RET_INVALID_PARAMS -#define KVM_PSCI_RET_DENIED PSCI_RET_DENIED - -#endif /* __ARM_KVM_H__ */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/kvm_para.h b/openflow/usr/include/arm-linux-gnueabihf/asm/kvm_para.h deleted file mode 100644 index 14fab8f..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/kvm_para.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/mman.h b/openflow/usr/include/arm-linux-gnueabihf/asm/mman.h deleted file mode 100644 index 41f99c5..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/mman.h +++ /dev/null @@ -1,4 +0,0 @@ -#include - -#define arch_mmap_check(addr, len, flags) \ - (((flags) & MAP_FIXED && (addr) < FIRST_USER_ADDRESS) ? -EINVAL : 0) diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/msgbuf.h b/openflow/usr/include/arm-linux-gnueabihf/asm/msgbuf.h deleted file mode 100644 index 809134c..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/msgbuf.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/param.h b/openflow/usr/include/arm-linux-gnueabihf/asm/param.h deleted file mode 100644 index 965d454..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/param.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/perf_regs.h b/openflow/usr/include/arm-linux-gnueabihf/asm/perf_regs.h deleted file mode 100644 index ce59448..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/perf_regs.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _ASM_ARM_PERF_REGS_H -#define _ASM_ARM_PERF_REGS_H - -enum perf_event_arm_regs { - PERF_REG_ARM_R0, - PERF_REG_ARM_R1, - PERF_REG_ARM_R2, - PERF_REG_ARM_R3, - PERF_REG_ARM_R4, - PERF_REG_ARM_R5, - PERF_REG_ARM_R6, - PERF_REG_ARM_R7, - PERF_REG_ARM_R8, - PERF_REG_ARM_R9, - PERF_REG_ARM_R10, - PERF_REG_ARM_FP, - PERF_REG_ARM_IP, - PERF_REG_ARM_SP, - PERF_REG_ARM_LR, - PERF_REG_ARM_PC, - PERF_REG_ARM_MAX, -}; -#endif /* _ASM_ARM_PERF_REGS_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/poll.h b/openflow/usr/include/arm-linux-gnueabihf/asm/poll.h deleted file mode 100644 index c98509d..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/poll.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/posix_types.h b/openflow/usr/include/arm-linux-gnueabihf/asm/posix_types.h deleted file mode 100644 index d2de9cb..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/posix_types.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * arch/arm/include/asm/posix_types.h - * - * Copyright (C) 1996-1998 Russell King. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Changelog: - * 27-06-1996 RMK Created - */ -#ifndef __ARCH_ARM_POSIX_TYPES_H -#define __ARCH_ARM_POSIX_TYPES_H - -/* - * This file is generally used by user-level software, so you need to - * be a little careful about namespace pollution etc. Also, we cannot - * assume GCC is being used. - */ - -typedef unsigned short __kernel_mode_t; -#define __kernel_mode_t __kernel_mode_t - -typedef unsigned short __kernel_ipc_pid_t; -#define __kernel_ipc_pid_t __kernel_ipc_pid_t - -typedef unsigned short __kernel_uid_t; -typedef unsigned short __kernel_gid_t; -#define __kernel_uid_t __kernel_uid_t - -typedef unsigned short __kernel_old_dev_t; -#define __kernel_old_dev_t __kernel_old_dev_t - -#include - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/ptrace.h b/openflow/usr/include/arm-linux-gnueabihf/asm/ptrace.h deleted file mode 100644 index 950ab55..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/ptrace.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * arch/arm/include/asm/ptrace.h - * - * Copyright (C) 1996-2003 Russell King - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#ifndef __ASM_ARM_PTRACE_H -#define __ASM_ARM_PTRACE_H - -#include - -#define PTRACE_GETREGS 12 -#define PTRACE_SETREGS 13 -#define PTRACE_GETFPREGS 14 -#define PTRACE_SETFPREGS 15 -/* PTRACE_ATTACH is 16 */ -/* PTRACE_DETACH is 17 */ -#define PTRACE_GETWMMXREGS 18 -#define PTRACE_SETWMMXREGS 19 -/* 20 is unused */ -#define PTRACE_OLDSETOPTIONS 21 -#define PTRACE_GET_THREAD_AREA 22 -#define PTRACE_SET_SYSCALL 23 -/* PTRACE_SYSCALL is 24 */ -#define PTRACE_GETCRUNCHREGS 25 -#define PTRACE_SETCRUNCHREGS 26 -#define PTRACE_GETVFPREGS 27 -#define PTRACE_SETVFPREGS 28 -#define PTRACE_GETHBPREGS 29 -#define PTRACE_SETHBPREGS 30 - -/* - * PSR bits - * Note on V7M there is no mode contained in the PSR - */ -#define USR26_MODE 0x00000000 -#define FIQ26_MODE 0x00000001 -#define IRQ26_MODE 0x00000002 -#define SVC26_MODE 0x00000003 -#define USR_MODE 0x00000010 -#define SVC_MODE 0x00000013 -#define FIQ_MODE 0x00000011 -#define IRQ_MODE 0x00000012 -#define ABT_MODE 0x00000017 -#define HYP_MODE 0x0000001a -#define UND_MODE 0x0000001b -#define SYSTEM_MODE 0x0000001f -#define MODE32_BIT 0x00000010 -#define MODE_MASK 0x0000001f - -#define V4_PSR_T_BIT 0x00000020 /* >= V4T, but not V7M */ -#define V7M_PSR_T_BIT 0x01000000 -/* for compatibility */ -#define PSR_T_BIT V4_PSR_T_BIT - -#define PSR_F_BIT 0x00000040 /* >= V4, but not V7M */ -#define PSR_I_BIT 0x00000080 /* >= V4, but not V7M */ -#define PSR_A_BIT 0x00000100 /* >= V6, but not V7M */ -#define PSR_E_BIT 0x00000200 /* >= V6, but not V7M */ -#define PSR_J_BIT 0x01000000 /* >= V5J, but not V7M */ -#define PSR_Q_BIT 0x08000000 /* >= V5E, including V7M */ -#define PSR_V_BIT 0x10000000 -#define PSR_C_BIT 0x20000000 -#define PSR_Z_BIT 0x40000000 -#define PSR_N_BIT 0x80000000 - -/* - * Groups of PSR bits - */ -#define PSR_f 0xff000000 /* Flags */ -#define PSR_s 0x00ff0000 /* Status */ -#define PSR_x 0x0000ff00 /* Extension */ -#define PSR_c 0x000000ff /* Control */ - -/* - * ARMv7 groups of PSR bits - */ -#define APSR_MASK 0xf80f0000 /* N, Z, C, V, Q and GE flags */ -#define PSR_ISET_MASK 0x01000010 /* ISA state (J, T) mask */ -#define PSR_IT_MASK 0x0600fc00 /* If-Then execution state mask */ -#define PSR_ENDIAN_MASK 0x00000200 /* Endianness state mask */ - -/* - * Default endianness state - */ -#ifdef CONFIG_CPU_ENDIAN_BE8 -#define PSR_ENDSTATE PSR_E_BIT -#else -#define PSR_ENDSTATE 0 -#endif - -/* - * These are 'magic' values for PTRACE_PEEKUSR that return info about where a - * process is located in memory. - */ -#define PT_TEXT_ADDR 0x10000 -#define PT_DATA_ADDR 0x10004 -#define PT_TEXT_END_ADDR 0x10008 - -#ifndef __ASSEMBLY__ - -/* - * This struct defines the way the registers are stored on the - * stack during a system call. Note that sizeof(struct pt_regs) - * has to be a multiple of 8. - */ -struct pt_regs { - long uregs[18]; -}; - -#define ARM_cpsr uregs[16] -#define ARM_pc uregs[15] -#define ARM_lr uregs[14] -#define ARM_sp uregs[13] -#define ARM_ip uregs[12] -#define ARM_fp uregs[11] -#define ARM_r10 uregs[10] -#define ARM_r9 uregs[9] -#define ARM_r8 uregs[8] -#define ARM_r7 uregs[7] -#define ARM_r6 uregs[6] -#define ARM_r5 uregs[5] -#define ARM_r4 uregs[4] -#define ARM_r3 uregs[3] -#define ARM_r2 uregs[2] -#define ARM_r1 uregs[1] -#define ARM_r0 uregs[0] -#define ARM_ORIG_r0 uregs[17] - -/* - * The size of the user-visible VFP state as seen by PTRACE_GET/SETVFPREGS - * and core dumps. - */ -#define ARM_VFPREGS_SIZE ( 32 * 8 /*fpregs*/ + 4 /*fpscr*/ ) - - -#endif /* __ASSEMBLY__ */ - -#endif /* __ASM_ARM_PTRACE_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/resource.h b/openflow/usr/include/arm-linux-gnueabihf/asm/resource.h deleted file mode 100644 index 04bc4db..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/resource.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/sembuf.h b/openflow/usr/include/arm-linux-gnueabihf/asm/sembuf.h deleted file mode 100644 index 7673b83..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/sembuf.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/setup.h b/openflow/usr/include/arm-linux-gnueabihf/asm/setup.h deleted file mode 100644 index 734ff39..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/setup.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * linux/include/asm/setup.h - * - * Copyright (C) 1997-1999 Russell King - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Structure passed to kernel to tell it about the - * hardware it's running on. See Documentation/arm/Setup - * for more info. - */ -#ifndef __ASMARM_SETUP_H -#define __ASMARM_SETUP_H - -#include - -#define COMMAND_LINE_SIZE 1024 - -/* The list ends with an ATAG_NONE node. */ -#define ATAG_NONE 0x00000000 - -struct tag_header { - __u32 size; - __u32 tag; -}; - -/* The list must start with an ATAG_CORE node */ -#define ATAG_CORE 0x54410001 - -struct tag_core { - __u32 flags; /* bit 0 = read-only */ - __u32 pagesize; - __u32 rootdev; -}; - -/* it is allowed to have multiple ATAG_MEM nodes */ -#define ATAG_MEM 0x54410002 - -struct tag_mem32 { - __u32 size; - __u32 start; /* physical start address */ -}; - -/* VGA text type displays */ -#define ATAG_VIDEOTEXT 0x54410003 - -struct tag_videotext { - __u8 x; - __u8 y; - __u16 video_page; - __u8 video_mode; - __u8 video_cols; - __u16 video_ega_bx; - __u8 video_lines; - __u8 video_isvga; - __u16 video_points; -}; - -/* describes how the ramdisk will be used in kernel */ -#define ATAG_RAMDISK 0x54410004 - -struct tag_ramdisk { - __u32 flags; /* bit 0 = load, bit 1 = prompt */ - __u32 size; /* decompressed ramdisk size in _kilo_ bytes */ - __u32 start; /* starting block of floppy-based RAM disk image */ -}; - -/* describes where the compressed ramdisk image lives (virtual address) */ -/* - * this one accidentally used virtual addresses - as such, - * it's deprecated. - */ -#define ATAG_INITRD 0x54410005 - -/* describes where the compressed ramdisk image lives (physical address) */ -#define ATAG_INITRD2 0x54420005 - -struct tag_initrd { - __u32 start; /* physical start address */ - __u32 size; /* size of compressed ramdisk image in bytes */ -}; - -/* board serial number. "64 bits should be enough for everybody" */ -#define ATAG_SERIAL 0x54410006 - -struct tag_serialnr { - __u32 low; - __u32 high; -}; - -/* board revision */ -#define ATAG_REVISION 0x54410007 - -struct tag_revision { - __u32 rev; -}; - -/* initial values for vesafb-type framebuffers. see struct screen_info - * in include/linux/tty.h - */ -#define ATAG_VIDEOLFB 0x54410008 - -struct tag_videolfb { - __u16 lfb_width; - __u16 lfb_height; - __u16 lfb_depth; - __u16 lfb_linelength; - __u32 lfb_base; - __u32 lfb_size; - __u8 red_size; - __u8 red_pos; - __u8 green_size; - __u8 green_pos; - __u8 blue_size; - __u8 blue_pos; - __u8 rsvd_size; - __u8 rsvd_pos; -}; - -/* command line: \0 terminated string */ -#define ATAG_CMDLINE 0x54410009 - -struct tag_cmdline { - char cmdline[1]; /* this is the minimum size */ -}; - -/* acorn RiscPC specific information */ -#define ATAG_ACORN 0x41000101 - -struct tag_acorn { - __u32 memc_control_reg; - __u32 vram_pages; - __u8 sounddefault; - __u8 adfsdrives; -}; - -/* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */ -#define ATAG_MEMCLK 0x41000402 - -struct tag_memclk { - __u32 fmemclk; -}; - -struct tag { - struct tag_header hdr; - union { - struct tag_core core; - struct tag_mem32 mem; - struct tag_videotext videotext; - struct tag_ramdisk ramdisk; - struct tag_initrd initrd; - struct tag_serialnr serialnr; - struct tag_revision revision; - struct tag_videolfb videolfb; - struct tag_cmdline cmdline; - - /* - * Acorn specific - */ - struct tag_acorn acorn; - - /* - * DC21285 specific - */ - struct tag_memclk memclk; - } u; -}; - -struct tagtable { - __u32 tag; - int (*parse)(const struct tag *); -}; - -#define tag_member_present(tag,member) \ - ((unsigned long)(&((struct tag *)0L)->member + 1) \ - <= (tag)->hdr.size * 4) - -#define tag_next(t) ((struct tag *)((__u32 *)(t) + (t)->hdr.size)) -#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2) - -#define for_each_tag(t,base) \ - for (t = base; t->hdr.size; t = tag_next(t)) - - -#endif /* __ASMARM_SETUP_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/shmbuf.h b/openflow/usr/include/arm-linux-gnueabihf/asm/shmbuf.h deleted file mode 100644 index 83c05fc..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/shmbuf.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/sigcontext.h b/openflow/usr/include/arm-linux-gnueabihf/asm/sigcontext.h deleted file mode 100644 index fc0b80b..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/sigcontext.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef _ASMARM_SIGCONTEXT_H -#define _ASMARM_SIGCONTEXT_H - -/* - * Signal context structure - contains all info to do with the state - * before the signal handler was invoked. Note: only add new entries - * to the end of the structure. - */ -struct sigcontext { - unsigned long trap_no; - unsigned long error_code; - unsigned long oldmask; - unsigned long arm_r0; - unsigned long arm_r1; - unsigned long arm_r2; - unsigned long arm_r3; - unsigned long arm_r4; - unsigned long arm_r5; - unsigned long arm_r6; - unsigned long arm_r7; - unsigned long arm_r8; - unsigned long arm_r9; - unsigned long arm_r10; - unsigned long arm_fp; - unsigned long arm_ip; - unsigned long arm_sp; - unsigned long arm_lr; - unsigned long arm_pc; - unsigned long arm_cpsr; - unsigned long fault_address; -}; - - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/siginfo.h b/openflow/usr/include/arm-linux-gnueabihf/asm/siginfo.h deleted file mode 100644 index 0815d29..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/siginfo.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/signal.h b/openflow/usr/include/arm-linux-gnueabihf/asm/signal.h deleted file mode 100644 index 93a5c18..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/signal.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef _ASMARM_SIGNAL_H -#define _ASMARM_SIGNAL_H - -#include - -/* Avoid too many header ordering problems. */ -struct siginfo; - -/* Here we must cater to libcs that poke about in kernel headers. */ - -#define NSIG 32 -typedef unsigned long sigset_t; - - -#define SIGHUP 1 -#define SIGINT 2 -#define SIGQUIT 3 -#define SIGILL 4 -#define SIGTRAP 5 -#define SIGABRT 6 -#define SIGIOT 6 -#define SIGBUS 7 -#define SIGFPE 8 -#define SIGKILL 9 -#define SIGUSR1 10 -#define SIGSEGV 11 -#define SIGUSR2 12 -#define SIGPIPE 13 -#define SIGALRM 14 -#define SIGTERM 15 -#define SIGSTKFLT 16 -#define SIGCHLD 17 -#define SIGCONT 18 -#define SIGSTOP 19 -#define SIGTSTP 20 -#define SIGTTIN 21 -#define SIGTTOU 22 -#define SIGURG 23 -#define SIGXCPU 24 -#define SIGXFSZ 25 -#define SIGVTALRM 26 -#define SIGPROF 27 -#define SIGWINCH 28 -#define SIGIO 29 -#define SIGPOLL SIGIO -/* -#define SIGLOST 29 -*/ -#define SIGPWR 30 -#define SIGSYS 31 -#define SIGUNUSED 31 - -/* These should not be considered constants from userland. */ -#define SIGRTMIN 32 -#define SIGRTMAX _NSIG - -#define SIGSWI 32 - -/* - * SA_FLAGS values: - * - * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. - * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. - * SA_SIGINFO deliver the signal with SIGINFO structs - * SA_THIRTYTWO delivers the signal in 32-bit mode, even if the task - * is running in 26-bit. - * SA_ONSTACK allows alternate signal stacks (see sigaltstack(2)). - * SA_RESTART flag to get restarting signals (which were the default long ago) - * SA_NODEFER prevents the current signal from being masked in the handler. - * SA_RESETHAND clears the handler when the signal is delivered. - * - * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single - * Unix names RESETHAND and NODEFER respectively. - */ -#define SA_NOCLDSTOP 0x00000001 -#define SA_NOCLDWAIT 0x00000002 -#define SA_SIGINFO 0x00000004 -#define SA_THIRTYTWO 0x02000000 -#define SA_RESTORER 0x04000000 -#define SA_ONSTACK 0x08000000 -#define SA_RESTART 0x10000000 -#define SA_NODEFER 0x40000000 -#define SA_RESETHAND 0x80000000 - -#define SA_NOMASK SA_NODEFER -#define SA_ONESHOT SA_RESETHAND - -#define MINSIGSTKSZ 2048 -#define SIGSTKSZ 8192 - -#include - -/* Here we must cater to libcs that poke about in kernel headers. */ - -struct sigaction { - union { - __sighandler_t _sa_handler; - void (*_sa_sigaction)(int, struct siginfo *, void *); - } _u; - sigset_t sa_mask; - unsigned long sa_flags; - void (*sa_restorer)(void); -}; - -#define sa_handler _u._sa_handler -#define sa_sigaction _u._sa_sigaction - - -typedef struct sigaltstack { - void *ss_sp; - int ss_flags; - size_t ss_size; -} stack_t; - - -#endif /* _ASMARM_SIGNAL_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/socket.h b/openflow/usr/include/arm-linux-gnueabihf/asm/socket.h deleted file mode 100644 index 6b71384..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/socket.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/sockios.h b/openflow/usr/include/arm-linux-gnueabihf/asm/sockios.h deleted file mode 100644 index def6d47..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/sockios.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/stat.h b/openflow/usr/include/arm-linux-gnueabihf/asm/stat.h deleted file mode 100644 index 42c0c13..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/stat.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef _ASMARM_STAT_H -#define _ASMARM_STAT_H - -struct __old_kernel_stat { - unsigned short st_dev; - unsigned short st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned long st_size; - unsigned long st_atime; - unsigned long st_mtime; - unsigned long st_ctime; -}; - -#define STAT_HAVE_NSEC - -struct stat { -#if defined(__ARMEB__) - unsigned short st_dev; - unsigned short __pad1; -#else - unsigned long st_dev; -#endif - unsigned long st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; -#if defined(__ARMEB__) - unsigned short st_rdev; - unsigned short __pad2; -#else - unsigned long st_rdev; -#endif - unsigned long st_size; - unsigned long st_blksize; - unsigned long st_blocks; - unsigned long st_atime; - unsigned long st_atime_nsec; - unsigned long st_mtime; - unsigned long st_mtime_nsec; - unsigned long st_ctime; - unsigned long st_ctime_nsec; - unsigned long __unused4; - unsigned long __unused5; -}; - -/* This matches struct stat64 in glibc2.1, hence the absolutely - * insane amounts of padding around dev_t's. - * Note: The kernel zero's the padded region because glibc might read them - * in the hope that the kernel has stretched to using larger sizes. - */ -struct stat64 { - unsigned long long st_dev; - unsigned char __pad0[4]; - -#define STAT64_HAS_BROKEN_ST_INO 1 - unsigned long __st_ino; - unsigned int st_mode; - unsigned int st_nlink; - - unsigned long st_uid; - unsigned long st_gid; - - unsigned long long st_rdev; - unsigned char __pad3[4]; - - long long st_size; - unsigned long st_blksize; - unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ - - unsigned long st_atime; - unsigned long st_atime_nsec; - - unsigned long st_mtime; - unsigned long st_mtime_nsec; - - unsigned long st_ctime; - unsigned long st_ctime_nsec; - - unsigned long long st_ino; -}; - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/statfs.h b/openflow/usr/include/arm-linux-gnueabihf/asm/statfs.h deleted file mode 100644 index 079447c..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/statfs.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _ASMARM_STATFS_H -#define _ASMARM_STATFS_H - -/* - * With EABI there is 4 bytes of padding added to this structure. - * Let's pack it so the padding goes away to simplify dual ABI support. - * Note that user space does NOT have to pack this structure. - */ -#define ARCH_PACK_STATFS64 __attribute__((packed,aligned(4))) - -#include -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/swab.h b/openflow/usr/include/arm-linux-gnueabihf/asm/swab.h deleted file mode 100644 index 5f621bf..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/swab.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * arch/arm/include/asm/byteorder.h - * - * ARM Endian-ness. In little endian mode, the data bus is connected such - * that byte accesses appear as: - * 0 = d0...d7, 1 = d8...d15, 2 = d16...d23, 3 = d24...d31 - * and word accesses (data or instruction) appear as: - * d0...d31 - * - * When in big endian mode, byte accesses appear as: - * 0 = d24...d31, 1 = d16...d23, 2 = d8...d15, 3 = d0...d7 - * and word accesses (data or instruction) appear as: - * d0...d31 - */ -#ifndef __ASM_ARM_SWAB_H -#define __ASM_ARM_SWAB_H - - -#include - -#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __SWAB_64_THRU_32__ -#endif - - -static __inline__ __u32 __arch_swab32(__u32 x) -{ - __u32 t; - -#ifndef __thumb__ - if (!__builtin_constant_p(x)) { - /* - * The compiler needs a bit of a hint here to always do the - * right thing and not screw it up to different degrees - * depending on the gcc version. - */ - __asm__ ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x)); - } else -#endif - t = x ^ ((x << 16) | (x >> 16)); /* eor r1,r0,r0,ror #16 */ - - x = (x << 24) | (x >> 8); /* mov r0,r0,ror #8 */ - t &= ~0x00FF0000; /* bic r1,r1,#0x00FF0000 */ - x ^= (t >> 8); /* eor r0,r0,r1,lsr #8 */ - - return x; -} -#define __arch_swab32 __arch_swab32 - - -#endif /* __ASM_ARM_SWAB_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/termbits.h b/openflow/usr/include/arm-linux-gnueabihf/asm/termbits.h deleted file mode 100644 index 3935b10..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/termbits.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/termios.h b/openflow/usr/include/arm-linux-gnueabihf/asm/termios.h deleted file mode 100644 index 280d78a..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/termios.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/types.h b/openflow/usr/include/arm-linux-gnueabihf/asm/types.h deleted file mode 100644 index a53cdb8..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/types.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef _ASM_TYPES_H -#define _ASM_TYPES_H - -#include - -/* - * The C99 types uintXX_t that are usually defined in 'stdint.h' are not as - * unambiguous on ARM as you would expect. For the types below, there is a - * difference on ARM between GCC built for bare metal ARM, GCC built for glibc - * and the kernel itself, which results in build errors if you try to build with - * -ffreestanding and include 'stdint.h' (such as when you include 'arm_neon.h' - * in order to use NEON intrinsics) - * - * As the typedefs for these types in 'stdint.h' are based on builtin defines - * supplied by GCC, we can tweak these to align with the kernel's idea of those - * types, so 'linux/types.h' and 'stdint.h' can be safely included from the same - * source file (provided that -ffreestanding is used). - * - * int32_t uint32_t uintptr_t - * bare metal GCC long unsigned long unsigned int - * glibc GCC int unsigned int unsigned int - * kernel int unsigned int unsigned long - */ - -#ifdef __INT32_TYPE__ -#undef __INT32_TYPE__ -#define __INT32_TYPE__ int -#endif - -#ifdef __UINT32_TYPE__ -#undef __UINT32_TYPE__ -#define __UINT32_TYPE__ unsigned int -#endif - -#ifdef __UINTPTR_TYPE__ -#undef __UINTPTR_TYPE__ -#define __UINTPTR_TYPE__ unsigned long -#endif - -#endif /* _ASM_TYPES_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/asm/unistd.h b/openflow/usr/include/arm-linux-gnueabihf/asm/unistd.h deleted file mode 100644 index a72f1a5..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/asm/unistd.h +++ /dev/null @@ -1,449 +0,0 @@ -/* - * arch/arm/include/asm/unistd.h - * - * Copyright (C) 2001-2005 Russell King - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Please forward _all_ changes to this file to rmk@arm.linux.org.uk, - * no matter what the change is. Thanks! - */ -#ifndef __ASM_ARM_UNISTD_H -#define __ASM_ARM_UNISTD_H - -#define __NR_OABI_SYSCALL_BASE 0x900000 - -#if defined(__thumb__) || defined(__ARM_EABI__) -#define __NR_SYSCALL_BASE 0 -#else -#define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE -#endif - -/* - * This file contains the system call numbers. - */ - -#define __NR_restart_syscall (__NR_SYSCALL_BASE+ 0) -#define __NR_exit (__NR_SYSCALL_BASE+ 1) -#define __NR_fork (__NR_SYSCALL_BASE+ 2) -#define __NR_read (__NR_SYSCALL_BASE+ 3) -#define __NR_write (__NR_SYSCALL_BASE+ 4) -#define __NR_open (__NR_SYSCALL_BASE+ 5) -#define __NR_close (__NR_SYSCALL_BASE+ 6) - /* 7 was sys_waitpid */ -#define __NR_creat (__NR_SYSCALL_BASE+ 8) -#define __NR_link (__NR_SYSCALL_BASE+ 9) -#define __NR_unlink (__NR_SYSCALL_BASE+ 10) -#define __NR_execve (__NR_SYSCALL_BASE+ 11) -#define __NR_chdir (__NR_SYSCALL_BASE+ 12) -#define __NR_time (__NR_SYSCALL_BASE+ 13) -#define __NR_mknod (__NR_SYSCALL_BASE+ 14) -#define __NR_chmod (__NR_SYSCALL_BASE+ 15) -#define __NR_lchown (__NR_SYSCALL_BASE+ 16) - /* 17 was sys_break */ - /* 18 was sys_stat */ -#define __NR_lseek (__NR_SYSCALL_BASE+ 19) -#define __NR_getpid (__NR_SYSCALL_BASE+ 20) -#define __NR_mount (__NR_SYSCALL_BASE+ 21) -#define __NR_umount (__NR_SYSCALL_BASE+ 22) -#define __NR_setuid (__NR_SYSCALL_BASE+ 23) -#define __NR_getuid (__NR_SYSCALL_BASE+ 24) -#define __NR_stime (__NR_SYSCALL_BASE+ 25) -#define __NR_ptrace (__NR_SYSCALL_BASE+ 26) -#define __NR_alarm (__NR_SYSCALL_BASE+ 27) - /* 28 was sys_fstat */ -#define __NR_pause (__NR_SYSCALL_BASE+ 29) -#define __NR_utime (__NR_SYSCALL_BASE+ 30) - /* 31 was sys_stty */ - /* 32 was sys_gtty */ -#define __NR_access (__NR_SYSCALL_BASE+ 33) -#define __NR_nice (__NR_SYSCALL_BASE+ 34) - /* 35 was sys_ftime */ -#define __NR_sync (__NR_SYSCALL_BASE+ 36) -#define __NR_kill (__NR_SYSCALL_BASE+ 37) -#define __NR_rename (__NR_SYSCALL_BASE+ 38) -#define __NR_mkdir (__NR_SYSCALL_BASE+ 39) -#define __NR_rmdir (__NR_SYSCALL_BASE+ 40) -#define __NR_dup (__NR_SYSCALL_BASE+ 41) -#define __NR_pipe (__NR_SYSCALL_BASE+ 42) -#define __NR_times (__NR_SYSCALL_BASE+ 43) - /* 44 was sys_prof */ -#define __NR_brk (__NR_SYSCALL_BASE+ 45) -#define __NR_setgid (__NR_SYSCALL_BASE+ 46) -#define __NR_getgid (__NR_SYSCALL_BASE+ 47) - /* 48 was sys_signal */ -#define __NR_geteuid (__NR_SYSCALL_BASE+ 49) -#define __NR_getegid (__NR_SYSCALL_BASE+ 50) -#define __NR_acct (__NR_SYSCALL_BASE+ 51) -#define __NR_umount2 (__NR_SYSCALL_BASE+ 52) - /* 53 was sys_lock */ -#define __NR_ioctl (__NR_SYSCALL_BASE+ 54) -#define __NR_fcntl (__NR_SYSCALL_BASE+ 55) - /* 56 was sys_mpx */ -#define __NR_setpgid (__NR_SYSCALL_BASE+ 57) - /* 58 was sys_ulimit */ - /* 59 was sys_olduname */ -#define __NR_umask (__NR_SYSCALL_BASE+ 60) -#define __NR_chroot (__NR_SYSCALL_BASE+ 61) -#define __NR_ustat (__NR_SYSCALL_BASE+ 62) -#define __NR_dup2 (__NR_SYSCALL_BASE+ 63) -#define __NR_getppid (__NR_SYSCALL_BASE+ 64) -#define __NR_getpgrp (__NR_SYSCALL_BASE+ 65) -#define __NR_setsid (__NR_SYSCALL_BASE+ 66) -#define __NR_sigaction (__NR_SYSCALL_BASE+ 67) - /* 68 was sys_sgetmask */ - /* 69 was sys_ssetmask */ -#define __NR_setreuid (__NR_SYSCALL_BASE+ 70) -#define __NR_setregid (__NR_SYSCALL_BASE+ 71) -#define __NR_sigsuspend (__NR_SYSCALL_BASE+ 72) -#define __NR_sigpending (__NR_SYSCALL_BASE+ 73) -#define __NR_sethostname (__NR_SYSCALL_BASE+ 74) -#define __NR_setrlimit (__NR_SYSCALL_BASE+ 75) -#define __NR_getrlimit (__NR_SYSCALL_BASE+ 76) /* Back compat 2GB limited rlimit */ -#define __NR_getrusage (__NR_SYSCALL_BASE+ 77) -#define __NR_gettimeofday (__NR_SYSCALL_BASE+ 78) -#define __NR_settimeofday (__NR_SYSCALL_BASE+ 79) -#define __NR_getgroups (__NR_SYSCALL_BASE+ 80) -#define __NR_setgroups (__NR_SYSCALL_BASE+ 81) -#define __NR_select (__NR_SYSCALL_BASE+ 82) -#define __NR_symlink (__NR_SYSCALL_BASE+ 83) - /* 84 was sys_lstat */ -#define __NR_readlink (__NR_SYSCALL_BASE+ 85) -#define __NR_uselib (__NR_SYSCALL_BASE+ 86) -#define __NR_swapon (__NR_SYSCALL_BASE+ 87) -#define __NR_reboot (__NR_SYSCALL_BASE+ 88) -#define __NR_readdir (__NR_SYSCALL_BASE+ 89) -#define __NR_mmap (__NR_SYSCALL_BASE+ 90) -#define __NR_munmap (__NR_SYSCALL_BASE+ 91) -#define __NR_truncate (__NR_SYSCALL_BASE+ 92) -#define __NR_ftruncate (__NR_SYSCALL_BASE+ 93) -#define __NR_fchmod (__NR_SYSCALL_BASE+ 94) -#define __NR_fchown (__NR_SYSCALL_BASE+ 95) -#define __NR_getpriority (__NR_SYSCALL_BASE+ 96) -#define __NR_setpriority (__NR_SYSCALL_BASE+ 97) - /* 98 was sys_profil */ -#define __NR_statfs (__NR_SYSCALL_BASE+ 99) -#define __NR_fstatfs (__NR_SYSCALL_BASE+100) - /* 101 was sys_ioperm */ -#define __NR_socketcall (__NR_SYSCALL_BASE+102) -#define __NR_syslog (__NR_SYSCALL_BASE+103) -#define __NR_setitimer (__NR_SYSCALL_BASE+104) -#define __NR_getitimer (__NR_SYSCALL_BASE+105) -#define __NR_stat (__NR_SYSCALL_BASE+106) -#define __NR_lstat (__NR_SYSCALL_BASE+107) -#define __NR_fstat (__NR_SYSCALL_BASE+108) - /* 109 was sys_uname */ - /* 110 was sys_iopl */ -#define __NR_vhangup (__NR_SYSCALL_BASE+111) - /* 112 was sys_idle */ -#define __NR_syscall (__NR_SYSCALL_BASE+113) /* syscall to call a syscall! */ -#define __NR_wait4 (__NR_SYSCALL_BASE+114) -#define __NR_swapoff (__NR_SYSCALL_BASE+115) -#define __NR_sysinfo (__NR_SYSCALL_BASE+116) -#define __NR_ipc (__NR_SYSCALL_BASE+117) -#define __NR_fsync (__NR_SYSCALL_BASE+118) -#define __NR_sigreturn (__NR_SYSCALL_BASE+119) -#define __NR_clone (__NR_SYSCALL_BASE+120) -#define __NR_setdomainname (__NR_SYSCALL_BASE+121) -#define __NR_uname (__NR_SYSCALL_BASE+122) - /* 123 was sys_modify_ldt */ -#define __NR_adjtimex (__NR_SYSCALL_BASE+124) -#define __NR_mprotect (__NR_SYSCALL_BASE+125) -#define __NR_sigprocmask (__NR_SYSCALL_BASE+126) - /* 127 was sys_create_module */ -#define __NR_init_module (__NR_SYSCALL_BASE+128) -#define __NR_delete_module (__NR_SYSCALL_BASE+129) - /* 130 was sys_get_kernel_syms */ -#define __NR_quotactl (__NR_SYSCALL_BASE+131) -#define __NR_getpgid (__NR_SYSCALL_BASE+132) -#define __NR_fchdir (__NR_SYSCALL_BASE+133) -#define __NR_bdflush (__NR_SYSCALL_BASE+134) -#define __NR_sysfs (__NR_SYSCALL_BASE+135) -#define __NR_personality (__NR_SYSCALL_BASE+136) - /* 137 was sys_afs_syscall */ -#define __NR_setfsuid (__NR_SYSCALL_BASE+138) -#define __NR_setfsgid (__NR_SYSCALL_BASE+139) -#define __NR__llseek (__NR_SYSCALL_BASE+140) -#define __NR_getdents (__NR_SYSCALL_BASE+141) -#define __NR__newselect (__NR_SYSCALL_BASE+142) -#define __NR_flock (__NR_SYSCALL_BASE+143) -#define __NR_msync (__NR_SYSCALL_BASE+144) -#define __NR_readv (__NR_SYSCALL_BASE+145) -#define __NR_writev (__NR_SYSCALL_BASE+146) -#define __NR_getsid (__NR_SYSCALL_BASE+147) -#define __NR_fdatasync (__NR_SYSCALL_BASE+148) -#define __NR__sysctl (__NR_SYSCALL_BASE+149) -#define __NR_mlock (__NR_SYSCALL_BASE+150) -#define __NR_munlock (__NR_SYSCALL_BASE+151) -#define __NR_mlockall (__NR_SYSCALL_BASE+152) -#define __NR_munlockall (__NR_SYSCALL_BASE+153) -#define __NR_sched_setparam (__NR_SYSCALL_BASE+154) -#define __NR_sched_getparam (__NR_SYSCALL_BASE+155) -#define __NR_sched_setscheduler (__NR_SYSCALL_BASE+156) -#define __NR_sched_getscheduler (__NR_SYSCALL_BASE+157) -#define __NR_sched_yield (__NR_SYSCALL_BASE+158) -#define __NR_sched_get_priority_max (__NR_SYSCALL_BASE+159) -#define __NR_sched_get_priority_min (__NR_SYSCALL_BASE+160) -#define __NR_sched_rr_get_interval (__NR_SYSCALL_BASE+161) -#define __NR_nanosleep (__NR_SYSCALL_BASE+162) -#define __NR_mremap (__NR_SYSCALL_BASE+163) -#define __NR_setresuid (__NR_SYSCALL_BASE+164) -#define __NR_getresuid (__NR_SYSCALL_BASE+165) - /* 166 was sys_vm86 */ - /* 167 was sys_query_module */ -#define __NR_poll (__NR_SYSCALL_BASE+168) -#define __NR_nfsservctl (__NR_SYSCALL_BASE+169) -#define __NR_setresgid (__NR_SYSCALL_BASE+170) -#define __NR_getresgid (__NR_SYSCALL_BASE+171) -#define __NR_prctl (__NR_SYSCALL_BASE+172) -#define __NR_rt_sigreturn (__NR_SYSCALL_BASE+173) -#define __NR_rt_sigaction (__NR_SYSCALL_BASE+174) -#define __NR_rt_sigprocmask (__NR_SYSCALL_BASE+175) -#define __NR_rt_sigpending (__NR_SYSCALL_BASE+176) -#define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE+177) -#define __NR_rt_sigqueueinfo (__NR_SYSCALL_BASE+178) -#define __NR_rt_sigsuspend (__NR_SYSCALL_BASE+179) -#define __NR_pread64 (__NR_SYSCALL_BASE+180) -#define __NR_pwrite64 (__NR_SYSCALL_BASE+181) -#define __NR_chown (__NR_SYSCALL_BASE+182) -#define __NR_getcwd (__NR_SYSCALL_BASE+183) -#define __NR_capget (__NR_SYSCALL_BASE+184) -#define __NR_capset (__NR_SYSCALL_BASE+185) -#define __NR_sigaltstack (__NR_SYSCALL_BASE+186) -#define __NR_sendfile (__NR_SYSCALL_BASE+187) - /* 188 reserved */ - /* 189 reserved */ -#define __NR_vfork (__NR_SYSCALL_BASE+190) -#define __NR_ugetrlimit (__NR_SYSCALL_BASE+191) /* SuS compliant getrlimit */ -#define __NR_mmap2 (__NR_SYSCALL_BASE+192) -#define __NR_truncate64 (__NR_SYSCALL_BASE+193) -#define __NR_ftruncate64 (__NR_SYSCALL_BASE+194) -#define __NR_stat64 (__NR_SYSCALL_BASE+195) -#define __NR_lstat64 (__NR_SYSCALL_BASE+196) -#define __NR_fstat64 (__NR_SYSCALL_BASE+197) -#define __NR_lchown32 (__NR_SYSCALL_BASE+198) -#define __NR_getuid32 (__NR_SYSCALL_BASE+199) -#define __NR_getgid32 (__NR_SYSCALL_BASE+200) -#define __NR_geteuid32 (__NR_SYSCALL_BASE+201) -#define __NR_getegid32 (__NR_SYSCALL_BASE+202) -#define __NR_setreuid32 (__NR_SYSCALL_BASE+203) -#define __NR_setregid32 (__NR_SYSCALL_BASE+204) -#define __NR_getgroups32 (__NR_SYSCALL_BASE+205) -#define __NR_setgroups32 (__NR_SYSCALL_BASE+206) -#define __NR_fchown32 (__NR_SYSCALL_BASE+207) -#define __NR_setresuid32 (__NR_SYSCALL_BASE+208) -#define __NR_getresuid32 (__NR_SYSCALL_BASE+209) -#define __NR_setresgid32 (__NR_SYSCALL_BASE+210) -#define __NR_getresgid32 (__NR_SYSCALL_BASE+211) -#define __NR_chown32 (__NR_SYSCALL_BASE+212) -#define __NR_setuid32 (__NR_SYSCALL_BASE+213) -#define __NR_setgid32 (__NR_SYSCALL_BASE+214) -#define __NR_setfsuid32 (__NR_SYSCALL_BASE+215) -#define __NR_setfsgid32 (__NR_SYSCALL_BASE+216) -#define __NR_getdents64 (__NR_SYSCALL_BASE+217) -#define __NR_pivot_root (__NR_SYSCALL_BASE+218) -#define __NR_mincore (__NR_SYSCALL_BASE+219) -#define __NR_madvise (__NR_SYSCALL_BASE+220) -#define __NR_fcntl64 (__NR_SYSCALL_BASE+221) - /* 222 for tux */ - /* 223 is unused */ -#define __NR_gettid (__NR_SYSCALL_BASE+224) -#define __NR_readahead (__NR_SYSCALL_BASE+225) -#define __NR_setxattr (__NR_SYSCALL_BASE+226) -#define __NR_lsetxattr (__NR_SYSCALL_BASE+227) -#define __NR_fsetxattr (__NR_SYSCALL_BASE+228) -#define __NR_getxattr (__NR_SYSCALL_BASE+229) -#define __NR_lgetxattr (__NR_SYSCALL_BASE+230) -#define __NR_fgetxattr (__NR_SYSCALL_BASE+231) -#define __NR_listxattr (__NR_SYSCALL_BASE+232) -#define __NR_llistxattr (__NR_SYSCALL_BASE+233) -#define __NR_flistxattr (__NR_SYSCALL_BASE+234) -#define __NR_removexattr (__NR_SYSCALL_BASE+235) -#define __NR_lremovexattr (__NR_SYSCALL_BASE+236) -#define __NR_fremovexattr (__NR_SYSCALL_BASE+237) -#define __NR_tkill (__NR_SYSCALL_BASE+238) -#define __NR_sendfile64 (__NR_SYSCALL_BASE+239) -#define __NR_futex (__NR_SYSCALL_BASE+240) -#define __NR_sched_setaffinity (__NR_SYSCALL_BASE+241) -#define __NR_sched_getaffinity (__NR_SYSCALL_BASE+242) -#define __NR_io_setup (__NR_SYSCALL_BASE+243) -#define __NR_io_destroy (__NR_SYSCALL_BASE+244) -#define __NR_io_getevents (__NR_SYSCALL_BASE+245) -#define __NR_io_submit (__NR_SYSCALL_BASE+246) -#define __NR_io_cancel (__NR_SYSCALL_BASE+247) -#define __NR_exit_group (__NR_SYSCALL_BASE+248) -#define __NR_lookup_dcookie (__NR_SYSCALL_BASE+249) -#define __NR_epoll_create (__NR_SYSCALL_BASE+250) -#define __NR_epoll_ctl (__NR_SYSCALL_BASE+251) -#define __NR_epoll_wait (__NR_SYSCALL_BASE+252) -#define __NR_remap_file_pages (__NR_SYSCALL_BASE+253) - /* 254 for set_thread_area */ - /* 255 for get_thread_area */ -#define __NR_set_tid_address (__NR_SYSCALL_BASE+256) -#define __NR_timer_create (__NR_SYSCALL_BASE+257) -#define __NR_timer_settime (__NR_SYSCALL_BASE+258) -#define __NR_timer_gettime (__NR_SYSCALL_BASE+259) -#define __NR_timer_getoverrun (__NR_SYSCALL_BASE+260) -#define __NR_timer_delete (__NR_SYSCALL_BASE+261) -#define __NR_clock_settime (__NR_SYSCALL_BASE+262) -#define __NR_clock_gettime (__NR_SYSCALL_BASE+263) -#define __NR_clock_getres (__NR_SYSCALL_BASE+264) -#define __NR_clock_nanosleep (__NR_SYSCALL_BASE+265) -#define __NR_statfs64 (__NR_SYSCALL_BASE+266) -#define __NR_fstatfs64 (__NR_SYSCALL_BASE+267) -#define __NR_tgkill (__NR_SYSCALL_BASE+268) -#define __NR_utimes (__NR_SYSCALL_BASE+269) -#define __NR_arm_fadvise64_64 (__NR_SYSCALL_BASE+270) -#define __NR_pciconfig_iobase (__NR_SYSCALL_BASE+271) -#define __NR_pciconfig_read (__NR_SYSCALL_BASE+272) -#define __NR_pciconfig_write (__NR_SYSCALL_BASE+273) -#define __NR_mq_open (__NR_SYSCALL_BASE+274) -#define __NR_mq_unlink (__NR_SYSCALL_BASE+275) -#define __NR_mq_timedsend (__NR_SYSCALL_BASE+276) -#define __NR_mq_timedreceive (__NR_SYSCALL_BASE+277) -#define __NR_mq_notify (__NR_SYSCALL_BASE+278) -#define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279) -#define __NR_waitid (__NR_SYSCALL_BASE+280) -#define __NR_socket (__NR_SYSCALL_BASE+281) -#define __NR_bind (__NR_SYSCALL_BASE+282) -#define __NR_connect (__NR_SYSCALL_BASE+283) -#define __NR_listen (__NR_SYSCALL_BASE+284) -#define __NR_accept (__NR_SYSCALL_BASE+285) -#define __NR_getsockname (__NR_SYSCALL_BASE+286) -#define __NR_getpeername (__NR_SYSCALL_BASE+287) -#define __NR_socketpair (__NR_SYSCALL_BASE+288) -#define __NR_send (__NR_SYSCALL_BASE+289) -#define __NR_sendto (__NR_SYSCALL_BASE+290) -#define __NR_recv (__NR_SYSCALL_BASE+291) -#define __NR_recvfrom (__NR_SYSCALL_BASE+292) -#define __NR_shutdown (__NR_SYSCALL_BASE+293) -#define __NR_setsockopt (__NR_SYSCALL_BASE+294) -#define __NR_getsockopt (__NR_SYSCALL_BASE+295) -#define __NR_sendmsg (__NR_SYSCALL_BASE+296) -#define __NR_recvmsg (__NR_SYSCALL_BASE+297) -#define __NR_semop (__NR_SYSCALL_BASE+298) -#define __NR_semget (__NR_SYSCALL_BASE+299) -#define __NR_semctl (__NR_SYSCALL_BASE+300) -#define __NR_msgsnd (__NR_SYSCALL_BASE+301) -#define __NR_msgrcv (__NR_SYSCALL_BASE+302) -#define __NR_msgget (__NR_SYSCALL_BASE+303) -#define __NR_msgctl (__NR_SYSCALL_BASE+304) -#define __NR_shmat (__NR_SYSCALL_BASE+305) -#define __NR_shmdt (__NR_SYSCALL_BASE+306) -#define __NR_shmget (__NR_SYSCALL_BASE+307) -#define __NR_shmctl (__NR_SYSCALL_BASE+308) -#define __NR_add_key (__NR_SYSCALL_BASE+309) -#define __NR_request_key (__NR_SYSCALL_BASE+310) -#define __NR_keyctl (__NR_SYSCALL_BASE+311) -#define __NR_semtimedop (__NR_SYSCALL_BASE+312) -#define __NR_vserver (__NR_SYSCALL_BASE+313) -#define __NR_ioprio_set (__NR_SYSCALL_BASE+314) -#define __NR_ioprio_get (__NR_SYSCALL_BASE+315) -#define __NR_inotify_init (__NR_SYSCALL_BASE+316) -#define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317) -#define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318) -#define __NR_mbind (__NR_SYSCALL_BASE+319) -#define __NR_get_mempolicy (__NR_SYSCALL_BASE+320) -#define __NR_set_mempolicy (__NR_SYSCALL_BASE+321) -#define __NR_openat (__NR_SYSCALL_BASE+322) -#define __NR_mkdirat (__NR_SYSCALL_BASE+323) -#define __NR_mknodat (__NR_SYSCALL_BASE+324) -#define __NR_fchownat (__NR_SYSCALL_BASE+325) -#define __NR_futimesat (__NR_SYSCALL_BASE+326) -#define __NR_fstatat64 (__NR_SYSCALL_BASE+327) -#define __NR_unlinkat (__NR_SYSCALL_BASE+328) -#define __NR_renameat (__NR_SYSCALL_BASE+329) -#define __NR_linkat (__NR_SYSCALL_BASE+330) -#define __NR_symlinkat (__NR_SYSCALL_BASE+331) -#define __NR_readlinkat (__NR_SYSCALL_BASE+332) -#define __NR_fchmodat (__NR_SYSCALL_BASE+333) -#define __NR_faccessat (__NR_SYSCALL_BASE+334) -#define __NR_pselect6 (__NR_SYSCALL_BASE+335) -#define __NR_ppoll (__NR_SYSCALL_BASE+336) -#define __NR_unshare (__NR_SYSCALL_BASE+337) -#define __NR_set_robust_list (__NR_SYSCALL_BASE+338) -#define __NR_get_robust_list (__NR_SYSCALL_BASE+339) -#define __NR_splice (__NR_SYSCALL_BASE+340) -#define __NR_arm_sync_file_range (__NR_SYSCALL_BASE+341) -#define __NR_sync_file_range2 __NR_arm_sync_file_range -#define __NR_tee (__NR_SYSCALL_BASE+342) -#define __NR_vmsplice (__NR_SYSCALL_BASE+343) -#define __NR_move_pages (__NR_SYSCALL_BASE+344) -#define __NR_getcpu (__NR_SYSCALL_BASE+345) -#define __NR_epoll_pwait (__NR_SYSCALL_BASE+346) -#define __NR_kexec_load (__NR_SYSCALL_BASE+347) -#define __NR_utimensat (__NR_SYSCALL_BASE+348) -#define __NR_signalfd (__NR_SYSCALL_BASE+349) -#define __NR_timerfd_create (__NR_SYSCALL_BASE+350) -#define __NR_eventfd (__NR_SYSCALL_BASE+351) -#define __NR_fallocate (__NR_SYSCALL_BASE+352) -#define __NR_timerfd_settime (__NR_SYSCALL_BASE+353) -#define __NR_timerfd_gettime (__NR_SYSCALL_BASE+354) -#define __NR_signalfd4 (__NR_SYSCALL_BASE+355) -#define __NR_eventfd2 (__NR_SYSCALL_BASE+356) -#define __NR_epoll_create1 (__NR_SYSCALL_BASE+357) -#define __NR_dup3 (__NR_SYSCALL_BASE+358) -#define __NR_pipe2 (__NR_SYSCALL_BASE+359) -#define __NR_inotify_init1 (__NR_SYSCALL_BASE+360) -#define __NR_preadv (__NR_SYSCALL_BASE+361) -#define __NR_pwritev (__NR_SYSCALL_BASE+362) -#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363) -#define __NR_perf_event_open (__NR_SYSCALL_BASE+364) -#define __NR_recvmmsg (__NR_SYSCALL_BASE+365) -#define __NR_accept4 (__NR_SYSCALL_BASE+366) -#define __NR_fanotify_init (__NR_SYSCALL_BASE+367) -#define __NR_fanotify_mark (__NR_SYSCALL_BASE+368) -#define __NR_prlimit64 (__NR_SYSCALL_BASE+369) -#define __NR_name_to_handle_at (__NR_SYSCALL_BASE+370) -#define __NR_open_by_handle_at (__NR_SYSCALL_BASE+371) -#define __NR_clock_adjtime (__NR_SYSCALL_BASE+372) -#define __NR_syncfs (__NR_SYSCALL_BASE+373) -#define __NR_sendmmsg (__NR_SYSCALL_BASE+374) -#define __NR_setns (__NR_SYSCALL_BASE+375) -#define __NR_process_vm_readv (__NR_SYSCALL_BASE+376) -#define __NR_process_vm_writev (__NR_SYSCALL_BASE+377) -#define __NR_kcmp (__NR_SYSCALL_BASE+378) -#define __NR_finit_module (__NR_SYSCALL_BASE+379) -#define __NR_sched_setattr (__NR_SYSCALL_BASE+380) -#define __NR_sched_getattr (__NR_SYSCALL_BASE+381) -#define __NR_renameat2 (__NR_SYSCALL_BASE+382) -#define __NR_seccomp (__NR_SYSCALL_BASE+383) -#define __NR_getrandom (__NR_SYSCALL_BASE+384) -#define __NR_memfd_create (__NR_SYSCALL_BASE+385) -#define __NR_bpf (__NR_SYSCALL_BASE+386) -#define __NR_execveat (__NR_SYSCALL_BASE+387) -#define __NR_userfaultfd (__NR_SYSCALL_BASE+388) -#define __NR_membarrier (__NR_SYSCALL_BASE+389) -#define __NR_mlock2 (__NR_SYSCALL_BASE+390) - -/* - * The following SWIs are ARM private. - */ -#define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000) -#define __ARM_NR_breakpoint (__ARM_NR_BASE+1) -#define __ARM_NR_cacheflush (__ARM_NR_BASE+2) -#define __ARM_NR_usr26 (__ARM_NR_BASE+3) -#define __ARM_NR_usr32 (__ARM_NR_BASE+4) -#define __ARM_NR_set_tls (__ARM_NR_BASE+5) - -/* - * The following syscalls are obsolete and no longer available for EABI. - */ -#if defined(__ARM_EABI__) -#undef __NR_time -#undef __NR_umount -#undef __NR_stime -#undef __NR_alarm -#undef __NR_utime -#undef __NR_getrlimit -#undef __NR_select -#undef __NR_readdir -#undef __NR_mmap -#undef __NR_socketcall -#undef __NR_syscall -#undef __NR_ipc -#endif - -#endif /* __ASM_ARM_UNISTD_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/a.out.h b/openflow/usr/include/arm-linux-gnueabihf/bits/a.out.h deleted file mode 100644 index 0e7fb03..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/a.out.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __A_OUT_GNU_H__ -# error "Never use directly; include instead." -#endif - -/* Signal to users of this header that this architecture really doesn't - support a.out binary format. */ -#define __NO_A_OUT_SUPPORT 1 diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/auxv.h b/openflow/usr/include/arm-linux-gnueabihf/bits/auxv.h deleted file mode 100644 index 76701c3..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/auxv.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 1995-2013 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Legal values for a_type (entry type). */ - -#define AT_NULL 0 /* End of vector */ -#define AT_IGNORE 1 /* Entry should be ignored */ -#define AT_EXECFD 2 /* File descriptor of program */ -#define AT_PHDR 3 /* Program headers for program */ -#define AT_PHENT 4 /* Size of program header entry */ -#define AT_PHNUM 5 /* Number of program headers */ -#define AT_PAGESZ 6 /* System page size */ -#define AT_BASE 7 /* Base address of interpreter */ -#define AT_FLAGS 8 /* Flags */ -#define AT_ENTRY 9 /* Entry point of program */ -#define AT_NOTELF 10 /* Program is not ELF */ -#define AT_UID 11 /* Real uid */ -#define AT_EUID 12 /* Effective uid */ -#define AT_GID 13 /* Real gid */ -#define AT_EGID 14 /* Effective gid */ -#define AT_CLKTCK 17 /* Frequency of times() */ - -/* Some more special a_type values describing the hardware. */ -#define AT_PLATFORM 15 /* String identifying platform. */ -#define AT_HWCAP 16 /* Machine-dependent hints about - processor capabilities. */ - -/* This entry gives some information about the FPU initialization - performed by the kernel. */ -#define AT_FPUCW 18 /* Used FPU control word. */ - -/* Cache block sizes. */ -#define AT_DCACHEBSIZE 19 /* Data cache block size. */ -#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */ -#define AT_UCACHEBSIZE 21 /* Unified cache block size. */ - -/* A special ignored value for PPC, used by the kernel to control the - interpretation of the AUXV. Must be > 16. */ -#define AT_IGNOREPPC 22 /* Entry should be ignored. */ - -#define AT_SECURE 23 /* Boolean, was exec setuid-like? */ - -#define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/ - -#define AT_RANDOM 25 /* Address of 16 random bytes. */ - -#define AT_HWCAP2 26 /* More machine-dependent hints about - processor capabilities. */ - -#define AT_EXECFN 31 /* Filename of executable. */ - -/* Pointer to the global system page used for system calls and other - nice things. */ -#define AT_SYSINFO 32 -#define AT_SYSINFO_EHDR 33 - -/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains - log2 of line size; mask those to get cache size. */ -#define AT_L1I_CACHESHAPE 34 -#define AT_L1D_CACHESHAPE 35 -#define AT_L2_CACHESHAPE 36 -#define AT_L3_CACHESHAPE 37 diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/byteswap-16.h b/openflow/usr/include/arm-linux-gnueabihf/bits/byteswap-16.h deleted file mode 100644 index 8063aa8..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/byteswap-16.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Macros to swap the order of bytes in 16-bit integer values. - Copyright (C) 2012-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_BYTESWAP_H -# error "Never use directly; include instead." -#endif - -#ifdef __GNUC__ -# define __bswap_16(x) \ - (__extension__ \ - ({ unsigned short int __bsx = (unsigned short int) (x); \ - __bswap_constant_16 (__bsx); })) -#else -static __inline unsigned short int -__bswap_16 (unsigned short int __bsx) -{ - return __bswap_constant_16 (__bsx); -} -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/byteswap.h b/openflow/usr/include/arm-linux-gnueabihf/bits/byteswap.h deleted file mode 100644 index 0effea6..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/byteswap.h +++ /dev/null @@ -1,112 +0,0 @@ -/* Macros to swap the order of bytes in integer values. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H -# error "Never use directly; include instead." -#endif - -#ifndef _BITS_BYTESWAP_H -#define _BITS_BYTESWAP_H 1 - -#include -#include - -/* Swap bytes in 16 bit value. */ -#define __bswap_constant_16(x) \ - ((unsigned short int)((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8))) - -/* Get __bswap_16. */ -#include - -/* Swap bytes in 32 bit value. */ -#define __bswap_constant_32(x) \ - ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ - (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) - -#ifdef __GNUC__ -# if __GNUC_PREREQ (4, 3) -static __inline unsigned int -__bswap_32 (unsigned int __bsx) -{ - return __builtin_bswap32 (__bsx); -} -# else -# define __bswap_32(x) \ - (__extension__ \ - ({ unsigned int __bsx = (x); __bswap_constant_32 (__bsx); })) -# endif -#else -static __inline unsigned int -__bswap_32 (unsigned int __bsx) -{ - return __bswap_constant_32 (__bsx); -} -#endif - -/* Swap bytes in 64 bit value. */ -#if __GNUC_PREREQ (2, 0) -# define __bswap_constant_64(x) \ - (__extension__ ((((x) & 0xff00000000000000ull) >> 56) \ - | (((x) & 0x00ff000000000000ull) >> 40) \ - | (((x) & 0x0000ff0000000000ull) >> 24) \ - | (((x) & 0x000000ff00000000ull) >> 8) \ - | (((x) & 0x00000000ff000000ull) << 8) \ - | (((x) & 0x0000000000ff0000ull) << 24) \ - | (((x) & 0x000000000000ff00ull) << 40) \ - | (((x) & 0x00000000000000ffull) << 56))) - -# if __GNUC_PREREQ (4, 3) -static __inline __uint64_t -__bswap_64 (__uint64_t __bsx) -{ - return __builtin_bswap64 (__bsx); -} -# else -# define __bswap_64(x) \ - (__extension__ \ - ({ union { __extension__ __uint64_t __ll; \ - unsigned int __l[2]; } __w, __r; \ - if (__builtin_constant_p (x)) \ - __r.__ll = __bswap_constant_64 (x); \ - else \ - { \ - __w.__ll = (x); \ - __r.__l[0] = __bswap_32 (__w.__l[1]); \ - __r.__l[1] = __bswap_32 (__w.__l[0]); \ - } \ - __r.__ll; })) -# endif -#else -# define __bswap_constant_64(x) \ - ((((x) & 0xff00000000000000ull) >> 56) \ - | (((x) & 0x00ff000000000000ull) >> 40) \ - | (((x) & 0x0000ff0000000000ull) >> 24) \ - | (((x) & 0x000000ff00000000ull) >> 8) \ - | (((x) & 0x00000000ff000000ull) << 8) \ - | (((x) & 0x0000000000ff0000ull) << 24) \ - | (((x) & 0x000000000000ff00ull) << 40) \ - | (((x) & 0x00000000000000ffull) << 56)) - -static __inline __uint64_t -__bswap_64 (__uint64_t __bsx) -{ - return __bswap_constant_64 (__bsx); -} -#endif - -#endif /* _BITS_BYTESWAP_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/cmathcalls.h b/openflow/usr/include/arm-linux-gnueabihf/bits/cmathcalls.h deleted file mode 100644 index e02707e..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/cmathcalls.h +++ /dev/null @@ -1,158 +0,0 @@ -/* Prototype declarations for complex math functions; - helper file for . - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* NOTE: Because of the special way this file is used by , this - file must NOT be protected from multiple inclusion as header files - usually are. - - This file provides prototype declarations for the math functions. - Most functions are declared using the macro: - - __MATHCALL (NAME, (ARGS...)); - - This means there is a function `NAME' returning `double' and a function - `NAMEf' returning `float'. Each place `_Mdouble_' appears in the - prototype, that is actually `double' in the prototype for `NAME' and - `float' in the prototype for `NAMEf'. Reentrant variant functions are - called `NAME_r' and `NAMEf_r'. - - Functions returning other types like `int' are declared using the macro: - - __MATHDECL (TYPE, NAME, (ARGS...)); - - This is just like __MATHCALL but for a function returning `TYPE' - instead of `_Mdouble_'. In all of these cases, there is still - both a `NAME' and a `NAMEf' that takes `float' arguments. */ - -#ifndef _COMPLEX_H -#error "Never use directly; include instead." -#endif - -#define _Mdouble_complex_ _Mdouble_ _Complex - - -/* Trigonometric functions. */ - -/* Arc cosine of Z. */ -__MATHCALL (cacos, (_Mdouble_complex_ __z)); -/* Arc sine of Z. */ -__MATHCALL (casin, (_Mdouble_complex_ __z)); -/* Arc tangent of Z. */ -__MATHCALL (catan, (_Mdouble_complex_ __z)); - -/* Cosine of Z. */ -__MATHCALL (ccos, (_Mdouble_complex_ __z)); -/* Sine of Z. */ -__MATHCALL (csin, (_Mdouble_complex_ __z)); -/* Tangent of Z. */ -__MATHCALL (ctan, (_Mdouble_complex_ __z)); - - -/* Hyperbolic functions. */ - -/* Hyperbolic arc cosine of Z. */ -__MATHCALL (cacosh, (_Mdouble_complex_ __z)); -/* Hyperbolic arc sine of Z. */ -__MATHCALL (casinh, (_Mdouble_complex_ __z)); -/* Hyperbolic arc tangent of Z. */ -__MATHCALL (catanh, (_Mdouble_complex_ __z)); - -/* Hyperbolic cosine of Z. */ -__MATHCALL (ccosh, (_Mdouble_complex_ __z)); -/* Hyperbolic sine of Z. */ -__MATHCALL (csinh, (_Mdouble_complex_ __z)); -/* Hyperbolic tangent of Z. */ -__MATHCALL (ctanh, (_Mdouble_complex_ __z)); - - -/* Exponential and logarithmic functions. */ - -/* Exponential function of Z. */ -__MATHCALL (cexp, (_Mdouble_complex_ __z)); - -/* Natural logarithm of Z. */ -__MATHCALL (clog, (_Mdouble_complex_ __z)); - -#ifdef __USE_GNU -/* The base 10 logarithm is not defined by the standard but to implement - the standard C++ library it is handy. */ -__MATHCALL (clog10, (_Mdouble_complex_ __z)); -#endif - -/* Power functions. */ - -/* Return X to the Y power. */ -__MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y)); - -/* Return the square root of Z. */ -__MATHCALL (csqrt, (_Mdouble_complex_ __z)); - - -/* Absolute value, conjugates, and projection. */ - -/* Absolute value of Z. */ -__MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z)); - -/* Argument value of Z. */ -__MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z)); - -/* Complex conjugate of Z. */ -__MATHCALL (conj, (_Mdouble_complex_ __z)); - -/* Projection of Z onto the Riemann sphere. */ -__MATHCALL (cproj, (_Mdouble_complex_ __z)); - - -/* Decomposing complex values. */ - -/* Imaginary part of Z. */ -__MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z)); - -/* Real part of Z. */ -__MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z)); - - -/* Now some optimized versions. GCC has handy notations for these - functions. Recent GCC handles these as builtin functions so does - not need inlines. */ -#if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__ \ - && defined __extern_inline - -/* Imaginary part of Z. */ -__extern_inline _Mdouble_ -__MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW -{ - return __imag__ __z; -} - -/* Real part of Z. */ -__extern_inline _Mdouble_ -__MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW -{ - return __real__ __z; -} - -/* Complex conjugate of Z. */ -__extern_inline _Mdouble_complex_ -__MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW -{ - return __extension__ ~__z; -} - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/confname.h b/openflow/usr/include/arm-linux-gnueabihf/bits/confname.h deleted file mode 100644 index b635933..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/confname.h +++ /dev/null @@ -1,675 +0,0 @@ -/* `sysconf', `pathconf', and `confstr' NAME values. Generic version. - Copyright (C) 1993-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _UNISTD_H -# error "Never use directly; include instead." -#endif - -/* Values for the NAME argument to `pathconf' and `fpathconf'. */ -enum - { - _PC_LINK_MAX, -#define _PC_LINK_MAX _PC_LINK_MAX - _PC_MAX_CANON, -#define _PC_MAX_CANON _PC_MAX_CANON - _PC_MAX_INPUT, -#define _PC_MAX_INPUT _PC_MAX_INPUT - _PC_NAME_MAX, -#define _PC_NAME_MAX _PC_NAME_MAX - _PC_PATH_MAX, -#define _PC_PATH_MAX _PC_PATH_MAX - _PC_PIPE_BUF, -#define _PC_PIPE_BUF _PC_PIPE_BUF - _PC_CHOWN_RESTRICTED, -#define _PC_CHOWN_RESTRICTED _PC_CHOWN_RESTRICTED - _PC_NO_TRUNC, -#define _PC_NO_TRUNC _PC_NO_TRUNC - _PC_VDISABLE, -#define _PC_VDISABLE _PC_VDISABLE - _PC_SYNC_IO, -#define _PC_SYNC_IO _PC_SYNC_IO - _PC_ASYNC_IO, -#define _PC_ASYNC_IO _PC_ASYNC_IO - _PC_PRIO_IO, -#define _PC_PRIO_IO _PC_PRIO_IO - _PC_SOCK_MAXBUF, -#define _PC_SOCK_MAXBUF _PC_SOCK_MAXBUF - _PC_FILESIZEBITS, -#define _PC_FILESIZEBITS _PC_FILESIZEBITS - _PC_REC_INCR_XFER_SIZE, -#define _PC_REC_INCR_XFER_SIZE _PC_REC_INCR_XFER_SIZE - _PC_REC_MAX_XFER_SIZE, -#define _PC_REC_MAX_XFER_SIZE _PC_REC_MAX_XFER_SIZE - _PC_REC_MIN_XFER_SIZE, -#define _PC_REC_MIN_XFER_SIZE _PC_REC_MIN_XFER_SIZE - _PC_REC_XFER_ALIGN, -#define _PC_REC_XFER_ALIGN _PC_REC_XFER_ALIGN - _PC_ALLOC_SIZE_MIN, -#define _PC_ALLOC_SIZE_MIN _PC_ALLOC_SIZE_MIN - _PC_SYMLINK_MAX, -#define _PC_SYMLINK_MAX _PC_SYMLINK_MAX - _PC_2_SYMLINKS -#define _PC_2_SYMLINKS _PC_2_SYMLINKS - }; - -/* Values for the argument to `sysconf'. */ -enum - { - _SC_ARG_MAX, -#define _SC_ARG_MAX _SC_ARG_MAX - _SC_CHILD_MAX, -#define _SC_CHILD_MAX _SC_CHILD_MAX - _SC_CLK_TCK, -#define _SC_CLK_TCK _SC_CLK_TCK - _SC_NGROUPS_MAX, -#define _SC_NGROUPS_MAX _SC_NGROUPS_MAX - _SC_OPEN_MAX, -#define _SC_OPEN_MAX _SC_OPEN_MAX - _SC_STREAM_MAX, -#define _SC_STREAM_MAX _SC_STREAM_MAX - _SC_TZNAME_MAX, -#define _SC_TZNAME_MAX _SC_TZNAME_MAX - _SC_JOB_CONTROL, -#define _SC_JOB_CONTROL _SC_JOB_CONTROL - _SC_SAVED_IDS, -#define _SC_SAVED_IDS _SC_SAVED_IDS - _SC_REALTIME_SIGNALS, -#define _SC_REALTIME_SIGNALS _SC_REALTIME_SIGNALS - _SC_PRIORITY_SCHEDULING, -#define _SC_PRIORITY_SCHEDULING _SC_PRIORITY_SCHEDULING - _SC_TIMERS, -#define _SC_TIMERS _SC_TIMERS - _SC_ASYNCHRONOUS_IO, -#define _SC_ASYNCHRONOUS_IO _SC_ASYNCHRONOUS_IO - _SC_PRIORITIZED_IO, -#define _SC_PRIORITIZED_IO _SC_PRIORITIZED_IO - _SC_SYNCHRONIZED_IO, -#define _SC_SYNCHRONIZED_IO _SC_SYNCHRONIZED_IO - _SC_FSYNC, -#define _SC_FSYNC _SC_FSYNC - _SC_MAPPED_FILES, -#define _SC_MAPPED_FILES _SC_MAPPED_FILES - _SC_MEMLOCK, -#define _SC_MEMLOCK _SC_MEMLOCK - _SC_MEMLOCK_RANGE, -#define _SC_MEMLOCK_RANGE _SC_MEMLOCK_RANGE - _SC_MEMORY_PROTECTION, -#define _SC_MEMORY_PROTECTION _SC_MEMORY_PROTECTION - _SC_MESSAGE_PASSING, -#define _SC_MESSAGE_PASSING _SC_MESSAGE_PASSING - _SC_SEMAPHORES, -#define _SC_SEMAPHORES _SC_SEMAPHORES - _SC_SHARED_MEMORY_OBJECTS, -#define _SC_SHARED_MEMORY_OBJECTS _SC_SHARED_MEMORY_OBJECTS - _SC_AIO_LISTIO_MAX, -#define _SC_AIO_LISTIO_MAX _SC_AIO_LISTIO_MAX - _SC_AIO_MAX, -#define _SC_AIO_MAX _SC_AIO_MAX - _SC_AIO_PRIO_DELTA_MAX, -#define _SC_AIO_PRIO_DELTA_MAX _SC_AIO_PRIO_DELTA_MAX - _SC_DELAYTIMER_MAX, -#define _SC_DELAYTIMER_MAX _SC_DELAYTIMER_MAX - _SC_MQ_OPEN_MAX, -#define _SC_MQ_OPEN_MAX _SC_MQ_OPEN_MAX - _SC_MQ_PRIO_MAX, -#define _SC_MQ_PRIO_MAX _SC_MQ_PRIO_MAX - _SC_VERSION, -#define _SC_VERSION _SC_VERSION - _SC_PAGESIZE, -#define _SC_PAGESIZE _SC_PAGESIZE -#define _SC_PAGE_SIZE _SC_PAGESIZE - _SC_RTSIG_MAX, -#define _SC_RTSIG_MAX _SC_RTSIG_MAX - _SC_SEM_NSEMS_MAX, -#define _SC_SEM_NSEMS_MAX _SC_SEM_NSEMS_MAX - _SC_SEM_VALUE_MAX, -#define _SC_SEM_VALUE_MAX _SC_SEM_VALUE_MAX - _SC_SIGQUEUE_MAX, -#define _SC_SIGQUEUE_MAX _SC_SIGQUEUE_MAX - _SC_TIMER_MAX, -#define _SC_TIMER_MAX _SC_TIMER_MAX - - /* Values for the argument to `sysconf' - corresponding to _POSIX2_* symbols. */ - _SC_BC_BASE_MAX, -#define _SC_BC_BASE_MAX _SC_BC_BASE_MAX - _SC_BC_DIM_MAX, -#define _SC_BC_DIM_MAX _SC_BC_DIM_MAX - _SC_BC_SCALE_MAX, -#define _SC_BC_SCALE_MAX _SC_BC_SCALE_MAX - _SC_BC_STRING_MAX, -#define _SC_BC_STRING_MAX _SC_BC_STRING_MAX - _SC_COLL_WEIGHTS_MAX, -#define _SC_COLL_WEIGHTS_MAX _SC_COLL_WEIGHTS_MAX - _SC_EQUIV_CLASS_MAX, -#define _SC_EQUIV_CLASS_MAX _SC_EQUIV_CLASS_MAX - _SC_EXPR_NEST_MAX, -#define _SC_EXPR_NEST_MAX _SC_EXPR_NEST_MAX - _SC_LINE_MAX, -#define _SC_LINE_MAX _SC_LINE_MAX - _SC_RE_DUP_MAX, -#define _SC_RE_DUP_MAX _SC_RE_DUP_MAX - _SC_CHARCLASS_NAME_MAX, -#define _SC_CHARCLASS_NAME_MAX _SC_CHARCLASS_NAME_MAX - - _SC_2_VERSION, -#define _SC_2_VERSION _SC_2_VERSION - _SC_2_C_BIND, -#define _SC_2_C_BIND _SC_2_C_BIND - _SC_2_C_DEV, -#define _SC_2_C_DEV _SC_2_C_DEV - _SC_2_FORT_DEV, -#define _SC_2_FORT_DEV _SC_2_FORT_DEV - _SC_2_FORT_RUN, -#define _SC_2_FORT_RUN _SC_2_FORT_RUN - _SC_2_SW_DEV, -#define _SC_2_SW_DEV _SC_2_SW_DEV - _SC_2_LOCALEDEF, -#define _SC_2_LOCALEDEF _SC_2_LOCALEDEF - - _SC_PII, -#define _SC_PII _SC_PII - _SC_PII_XTI, -#define _SC_PII_XTI _SC_PII_XTI - _SC_PII_SOCKET, -#define _SC_PII_SOCKET _SC_PII_SOCKET - _SC_PII_INTERNET, -#define _SC_PII_INTERNET _SC_PII_INTERNET - _SC_PII_OSI, -#define _SC_PII_OSI _SC_PII_OSI - _SC_POLL, -#define _SC_POLL _SC_POLL - _SC_SELECT, -#define _SC_SELECT _SC_SELECT - _SC_UIO_MAXIOV, -#define _SC_UIO_MAXIOV _SC_UIO_MAXIOV - _SC_IOV_MAX = _SC_UIO_MAXIOV, -#define _SC_IOV_MAX _SC_IOV_MAX - _SC_PII_INTERNET_STREAM, -#define _SC_PII_INTERNET_STREAM _SC_PII_INTERNET_STREAM - _SC_PII_INTERNET_DGRAM, -#define _SC_PII_INTERNET_DGRAM _SC_PII_INTERNET_DGRAM - _SC_PII_OSI_COTS, -#define _SC_PII_OSI_COTS _SC_PII_OSI_COTS - _SC_PII_OSI_CLTS, -#define _SC_PII_OSI_CLTS _SC_PII_OSI_CLTS - _SC_PII_OSI_M, -#define _SC_PII_OSI_M _SC_PII_OSI_M - _SC_T_IOV_MAX, -#define _SC_T_IOV_MAX _SC_T_IOV_MAX - - /* Values according to POSIX 1003.1c (POSIX threads). */ - _SC_THREADS, -#define _SC_THREADS _SC_THREADS - _SC_THREAD_SAFE_FUNCTIONS, -#define _SC_THREAD_SAFE_FUNCTIONS _SC_THREAD_SAFE_FUNCTIONS - _SC_GETGR_R_SIZE_MAX, -#define _SC_GETGR_R_SIZE_MAX _SC_GETGR_R_SIZE_MAX - _SC_GETPW_R_SIZE_MAX, -#define _SC_GETPW_R_SIZE_MAX _SC_GETPW_R_SIZE_MAX - _SC_LOGIN_NAME_MAX, -#define _SC_LOGIN_NAME_MAX _SC_LOGIN_NAME_MAX - _SC_TTY_NAME_MAX, -#define _SC_TTY_NAME_MAX _SC_TTY_NAME_MAX - _SC_THREAD_DESTRUCTOR_ITERATIONS, -#define _SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_DESTRUCTOR_ITERATIONS - _SC_THREAD_KEYS_MAX, -#define _SC_THREAD_KEYS_MAX _SC_THREAD_KEYS_MAX - _SC_THREAD_STACK_MIN, -#define _SC_THREAD_STACK_MIN _SC_THREAD_STACK_MIN - _SC_THREAD_THREADS_MAX, -#define _SC_THREAD_THREADS_MAX _SC_THREAD_THREADS_MAX - _SC_THREAD_ATTR_STACKADDR, -#define _SC_THREAD_ATTR_STACKADDR _SC_THREAD_ATTR_STACKADDR - _SC_THREAD_ATTR_STACKSIZE, -#define _SC_THREAD_ATTR_STACKSIZE _SC_THREAD_ATTR_STACKSIZE - _SC_THREAD_PRIORITY_SCHEDULING, -#define _SC_THREAD_PRIORITY_SCHEDULING _SC_THREAD_PRIORITY_SCHEDULING - _SC_THREAD_PRIO_INHERIT, -#define _SC_THREAD_PRIO_INHERIT _SC_THREAD_PRIO_INHERIT - _SC_THREAD_PRIO_PROTECT, -#define _SC_THREAD_PRIO_PROTECT _SC_THREAD_PRIO_PROTECT - _SC_THREAD_PROCESS_SHARED, -#define _SC_THREAD_PROCESS_SHARED _SC_THREAD_PROCESS_SHARED - - _SC_NPROCESSORS_CONF, -#define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_CONF - _SC_NPROCESSORS_ONLN, -#define _SC_NPROCESSORS_ONLN _SC_NPROCESSORS_ONLN - _SC_PHYS_PAGES, -#define _SC_PHYS_PAGES _SC_PHYS_PAGES - _SC_AVPHYS_PAGES, -#define _SC_AVPHYS_PAGES _SC_AVPHYS_PAGES - _SC_ATEXIT_MAX, -#define _SC_ATEXIT_MAX _SC_ATEXIT_MAX - _SC_PASS_MAX, -#define _SC_PASS_MAX _SC_PASS_MAX - - _SC_XOPEN_VERSION, -#define _SC_XOPEN_VERSION _SC_XOPEN_VERSION - _SC_XOPEN_XCU_VERSION, -#define _SC_XOPEN_XCU_VERSION _SC_XOPEN_XCU_VERSION - _SC_XOPEN_UNIX, -#define _SC_XOPEN_UNIX _SC_XOPEN_UNIX - _SC_XOPEN_CRYPT, -#define _SC_XOPEN_CRYPT _SC_XOPEN_CRYPT - _SC_XOPEN_ENH_I18N, -#define _SC_XOPEN_ENH_I18N _SC_XOPEN_ENH_I18N - _SC_XOPEN_SHM, -#define _SC_XOPEN_SHM _SC_XOPEN_SHM - - _SC_2_CHAR_TERM, -#define _SC_2_CHAR_TERM _SC_2_CHAR_TERM - _SC_2_C_VERSION, -#define _SC_2_C_VERSION _SC_2_C_VERSION - _SC_2_UPE, -#define _SC_2_UPE _SC_2_UPE - - _SC_XOPEN_XPG2, -#define _SC_XOPEN_XPG2 _SC_XOPEN_XPG2 - _SC_XOPEN_XPG3, -#define _SC_XOPEN_XPG3 _SC_XOPEN_XPG3 - _SC_XOPEN_XPG4, -#define _SC_XOPEN_XPG4 _SC_XOPEN_XPG4 - - _SC_CHAR_BIT, -#define _SC_CHAR_BIT _SC_CHAR_BIT - _SC_CHAR_MAX, -#define _SC_CHAR_MAX _SC_CHAR_MAX - _SC_CHAR_MIN, -#define _SC_CHAR_MIN _SC_CHAR_MIN - _SC_INT_MAX, -#define _SC_INT_MAX _SC_INT_MAX - _SC_INT_MIN, -#define _SC_INT_MIN _SC_INT_MIN - _SC_LONG_BIT, -#define _SC_LONG_BIT _SC_LONG_BIT - _SC_WORD_BIT, -#define _SC_WORD_BIT _SC_WORD_BIT - _SC_MB_LEN_MAX, -#define _SC_MB_LEN_MAX _SC_MB_LEN_MAX - _SC_NZERO, -#define _SC_NZERO _SC_NZERO - _SC_SSIZE_MAX, -#define _SC_SSIZE_MAX _SC_SSIZE_MAX - _SC_SCHAR_MAX, -#define _SC_SCHAR_MAX _SC_SCHAR_MAX - _SC_SCHAR_MIN, -#define _SC_SCHAR_MIN _SC_SCHAR_MIN - _SC_SHRT_MAX, -#define _SC_SHRT_MAX _SC_SHRT_MAX - _SC_SHRT_MIN, -#define _SC_SHRT_MIN _SC_SHRT_MIN - _SC_UCHAR_MAX, -#define _SC_UCHAR_MAX _SC_UCHAR_MAX - _SC_UINT_MAX, -#define _SC_UINT_MAX _SC_UINT_MAX - _SC_ULONG_MAX, -#define _SC_ULONG_MAX _SC_ULONG_MAX - _SC_USHRT_MAX, -#define _SC_USHRT_MAX _SC_USHRT_MAX - - _SC_NL_ARGMAX, -#define _SC_NL_ARGMAX _SC_NL_ARGMAX - _SC_NL_LANGMAX, -#define _SC_NL_LANGMAX _SC_NL_LANGMAX - _SC_NL_MSGMAX, -#define _SC_NL_MSGMAX _SC_NL_MSGMAX - _SC_NL_NMAX, -#define _SC_NL_NMAX _SC_NL_NMAX - _SC_NL_SETMAX, -#define _SC_NL_SETMAX _SC_NL_SETMAX - _SC_NL_TEXTMAX, -#define _SC_NL_TEXTMAX _SC_NL_TEXTMAX - - _SC_XBS5_ILP32_OFF32, -#define _SC_XBS5_ILP32_OFF32 _SC_XBS5_ILP32_OFF32 - _SC_XBS5_ILP32_OFFBIG, -#define _SC_XBS5_ILP32_OFFBIG _SC_XBS5_ILP32_OFFBIG - _SC_XBS5_LP64_OFF64, -#define _SC_XBS5_LP64_OFF64 _SC_XBS5_LP64_OFF64 - _SC_XBS5_LPBIG_OFFBIG, -#define _SC_XBS5_LPBIG_OFFBIG _SC_XBS5_LPBIG_OFFBIG - - _SC_XOPEN_LEGACY, -#define _SC_XOPEN_LEGACY _SC_XOPEN_LEGACY - _SC_XOPEN_REALTIME, -#define _SC_XOPEN_REALTIME _SC_XOPEN_REALTIME - _SC_XOPEN_REALTIME_THREADS, -#define _SC_XOPEN_REALTIME_THREADS _SC_XOPEN_REALTIME_THREADS - - _SC_ADVISORY_INFO, -#define _SC_ADVISORY_INFO _SC_ADVISORY_INFO - _SC_BARRIERS, -#define _SC_BARRIERS _SC_BARRIERS - _SC_BASE, -#define _SC_BASE _SC_BASE - _SC_C_LANG_SUPPORT, -#define _SC_C_LANG_SUPPORT _SC_C_LANG_SUPPORT - _SC_C_LANG_SUPPORT_R, -#define _SC_C_LANG_SUPPORT_R _SC_C_LANG_SUPPORT_R - _SC_CLOCK_SELECTION, -#define _SC_CLOCK_SELECTION _SC_CLOCK_SELECTION - _SC_CPUTIME, -#define _SC_CPUTIME _SC_CPUTIME - _SC_THREAD_CPUTIME, -#define _SC_THREAD_CPUTIME _SC_THREAD_CPUTIME - _SC_DEVICE_IO, -#define _SC_DEVICE_IO _SC_DEVICE_IO - _SC_DEVICE_SPECIFIC, -#define _SC_DEVICE_SPECIFIC _SC_DEVICE_SPECIFIC - _SC_DEVICE_SPECIFIC_R, -#define _SC_DEVICE_SPECIFIC_R _SC_DEVICE_SPECIFIC_R - _SC_FD_MGMT, -#define _SC_FD_MGMT _SC_FD_MGMT - _SC_FIFO, -#define _SC_FIFO _SC_FIFO - _SC_PIPE, -#define _SC_PIPE _SC_PIPE - _SC_FILE_ATTRIBUTES, -#define _SC_FILE_ATTRIBUTES _SC_FILE_ATTRIBUTES - _SC_FILE_LOCKING, -#define _SC_FILE_LOCKING _SC_FILE_LOCKING - _SC_FILE_SYSTEM, -#define _SC_FILE_SYSTEM _SC_FILE_SYSTEM - _SC_MONOTONIC_CLOCK, -#define _SC_MONOTONIC_CLOCK _SC_MONOTONIC_CLOCK - _SC_MULTI_PROCESS, -#define _SC_MULTI_PROCESS _SC_MULTI_PROCESS - _SC_SINGLE_PROCESS, -#define _SC_SINGLE_PROCESS _SC_SINGLE_PROCESS - _SC_NETWORKING, -#define _SC_NETWORKING _SC_NETWORKING - _SC_READER_WRITER_LOCKS, -#define _SC_READER_WRITER_LOCKS _SC_READER_WRITER_LOCKS - _SC_SPIN_LOCKS, -#define _SC_SPIN_LOCKS _SC_SPIN_LOCKS - _SC_REGEXP, -#define _SC_REGEXP _SC_REGEXP - _SC_REGEX_VERSION, -#define _SC_REGEX_VERSION _SC_REGEX_VERSION - _SC_SHELL, -#define _SC_SHELL _SC_SHELL - _SC_SIGNALS, -#define _SC_SIGNALS _SC_SIGNALS - _SC_SPAWN, -#define _SC_SPAWN _SC_SPAWN - _SC_SPORADIC_SERVER, -#define _SC_SPORADIC_SERVER _SC_SPORADIC_SERVER - _SC_THREAD_SPORADIC_SERVER, -#define _SC_THREAD_SPORADIC_SERVER _SC_THREAD_SPORADIC_SERVER - _SC_SYSTEM_DATABASE, -#define _SC_SYSTEM_DATABASE _SC_SYSTEM_DATABASE - _SC_SYSTEM_DATABASE_R, -#define _SC_SYSTEM_DATABASE_R _SC_SYSTEM_DATABASE_R - _SC_TIMEOUTS, -#define _SC_TIMEOUTS _SC_TIMEOUTS - _SC_TYPED_MEMORY_OBJECTS, -#define _SC_TYPED_MEMORY_OBJECTS _SC_TYPED_MEMORY_OBJECTS - _SC_USER_GROUPS, -#define _SC_USER_GROUPS _SC_USER_GROUPS - _SC_USER_GROUPS_R, -#define _SC_USER_GROUPS_R _SC_USER_GROUPS_R - _SC_2_PBS, -#define _SC_2_PBS _SC_2_PBS - _SC_2_PBS_ACCOUNTING, -#define _SC_2_PBS_ACCOUNTING _SC_2_PBS_ACCOUNTING - _SC_2_PBS_LOCATE, -#define _SC_2_PBS_LOCATE _SC_2_PBS_LOCATE - _SC_2_PBS_MESSAGE, -#define _SC_2_PBS_MESSAGE _SC_2_PBS_MESSAGE - _SC_2_PBS_TRACK, -#define _SC_2_PBS_TRACK _SC_2_PBS_TRACK - _SC_SYMLOOP_MAX, -#define _SC_SYMLOOP_MAX _SC_SYMLOOP_MAX - _SC_STREAMS, -#define _SC_STREAMS _SC_STREAMS - _SC_2_PBS_CHECKPOINT, -#define _SC_2_PBS_CHECKPOINT _SC_2_PBS_CHECKPOINT - - _SC_V6_ILP32_OFF32, -#define _SC_V6_ILP32_OFF32 _SC_V6_ILP32_OFF32 - _SC_V6_ILP32_OFFBIG, -#define _SC_V6_ILP32_OFFBIG _SC_V6_ILP32_OFFBIG - _SC_V6_LP64_OFF64, -#define _SC_V6_LP64_OFF64 _SC_V6_LP64_OFF64 - _SC_V6_LPBIG_OFFBIG, -#define _SC_V6_LPBIG_OFFBIG _SC_V6_LPBIG_OFFBIG - - _SC_HOST_NAME_MAX, -#define _SC_HOST_NAME_MAX _SC_HOST_NAME_MAX - _SC_TRACE, -#define _SC_TRACE _SC_TRACE - _SC_TRACE_EVENT_FILTER, -#define _SC_TRACE_EVENT_FILTER _SC_TRACE_EVENT_FILTER - _SC_TRACE_INHERIT, -#define _SC_TRACE_INHERIT _SC_TRACE_INHERIT - _SC_TRACE_LOG, -#define _SC_TRACE_LOG _SC_TRACE_LOG - - _SC_LEVEL1_ICACHE_SIZE, -#define _SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_SIZE - _SC_LEVEL1_ICACHE_ASSOC, -#define _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_ASSOC - _SC_LEVEL1_ICACHE_LINESIZE, -#define _SC_LEVEL1_ICACHE_LINESIZE _SC_LEVEL1_ICACHE_LINESIZE - _SC_LEVEL1_DCACHE_SIZE, -#define _SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_SIZE - _SC_LEVEL1_DCACHE_ASSOC, -#define _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_ASSOC - _SC_LEVEL1_DCACHE_LINESIZE, -#define _SC_LEVEL1_DCACHE_LINESIZE _SC_LEVEL1_DCACHE_LINESIZE - _SC_LEVEL2_CACHE_SIZE, -#define _SC_LEVEL2_CACHE_SIZE _SC_LEVEL2_CACHE_SIZE - _SC_LEVEL2_CACHE_ASSOC, -#define _SC_LEVEL2_CACHE_ASSOC _SC_LEVEL2_CACHE_ASSOC - _SC_LEVEL2_CACHE_LINESIZE, -#define _SC_LEVEL2_CACHE_LINESIZE _SC_LEVEL2_CACHE_LINESIZE - _SC_LEVEL3_CACHE_SIZE, -#define _SC_LEVEL3_CACHE_SIZE _SC_LEVEL3_CACHE_SIZE - _SC_LEVEL3_CACHE_ASSOC, -#define _SC_LEVEL3_CACHE_ASSOC _SC_LEVEL3_CACHE_ASSOC - _SC_LEVEL3_CACHE_LINESIZE, -#define _SC_LEVEL3_CACHE_LINESIZE _SC_LEVEL3_CACHE_LINESIZE - _SC_LEVEL4_CACHE_SIZE, -#define _SC_LEVEL4_CACHE_SIZE _SC_LEVEL4_CACHE_SIZE - _SC_LEVEL4_CACHE_ASSOC, -#define _SC_LEVEL4_CACHE_ASSOC _SC_LEVEL4_CACHE_ASSOC - _SC_LEVEL4_CACHE_LINESIZE, -#define _SC_LEVEL4_CACHE_LINESIZE _SC_LEVEL4_CACHE_LINESIZE - /* Leave room here, maybe we need a few more cache levels some day. */ - - _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, -#define _SC_IPV6 _SC_IPV6 - _SC_RAW_SOCKETS, -#define _SC_RAW_SOCKETS _SC_RAW_SOCKETS - - _SC_V7_ILP32_OFF32, -#define _SC_V7_ILP32_OFF32 _SC_V7_ILP32_OFF32 - _SC_V7_ILP32_OFFBIG, -#define _SC_V7_ILP32_OFFBIG _SC_V7_ILP32_OFFBIG - _SC_V7_LP64_OFF64, -#define _SC_V7_LP64_OFF64 _SC_V7_LP64_OFF64 - _SC_V7_LPBIG_OFFBIG, -#define _SC_V7_LPBIG_OFFBIG _SC_V7_LPBIG_OFFBIG - - _SC_SS_REPL_MAX, -#define _SC_SS_REPL_MAX _SC_SS_REPL_MAX - - _SC_TRACE_EVENT_NAME_MAX, -#define _SC_TRACE_EVENT_NAME_MAX _SC_TRACE_EVENT_NAME_MAX - _SC_TRACE_NAME_MAX, -#define _SC_TRACE_NAME_MAX _SC_TRACE_NAME_MAX - _SC_TRACE_SYS_MAX, -#define _SC_TRACE_SYS_MAX _SC_TRACE_SYS_MAX - _SC_TRACE_USER_EVENT_MAX, -#define _SC_TRACE_USER_EVENT_MAX _SC_TRACE_USER_EVENT_MAX - - _SC_XOPEN_STREAMS, -#define _SC_XOPEN_STREAMS _SC_XOPEN_STREAMS - - _SC_THREAD_ROBUST_PRIO_INHERIT, -#define _SC_THREAD_ROBUST_PRIO_INHERIT _SC_THREAD_ROBUST_PRIO_INHERIT - _SC_THREAD_ROBUST_PRIO_PROTECT -#define _SC_THREAD_ROBUST_PRIO_PROTECT _SC_THREAD_ROBUST_PRIO_PROTECT - }; - -/* Values for the NAME argument to `confstr'. */ -enum - { - _CS_PATH, /* The default search path. */ -#define _CS_PATH _CS_PATH - - _CS_V6_WIDTH_RESTRICTED_ENVS, -#define _CS_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS -#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS - - _CS_GNU_LIBC_VERSION, -#define _CS_GNU_LIBC_VERSION _CS_GNU_LIBC_VERSION - _CS_GNU_LIBPTHREAD_VERSION, -#define _CS_GNU_LIBPTHREAD_VERSION _CS_GNU_LIBPTHREAD_VERSION - - _CS_V5_WIDTH_RESTRICTED_ENVS, -#define _CS_V5_WIDTH_RESTRICTED_ENVS _CS_V5_WIDTH_RESTRICTED_ENVS -#define _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS _CS_V5_WIDTH_RESTRICTED_ENVS - - _CS_V7_WIDTH_RESTRICTED_ENVS, -#define _CS_V7_WIDTH_RESTRICTED_ENVS _CS_V7_WIDTH_RESTRICTED_ENVS -#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS _CS_V7_WIDTH_RESTRICTED_ENVS - - _CS_LFS_CFLAGS = 1000, -#define _CS_LFS_CFLAGS _CS_LFS_CFLAGS - _CS_LFS_LDFLAGS, -#define _CS_LFS_LDFLAGS _CS_LFS_LDFLAGS - _CS_LFS_LIBS, -#define _CS_LFS_LIBS _CS_LFS_LIBS - _CS_LFS_LINTFLAGS, -#define _CS_LFS_LINTFLAGS _CS_LFS_LINTFLAGS - _CS_LFS64_CFLAGS, -#define _CS_LFS64_CFLAGS _CS_LFS64_CFLAGS - _CS_LFS64_LDFLAGS, -#define _CS_LFS64_LDFLAGS _CS_LFS64_LDFLAGS - _CS_LFS64_LIBS, -#define _CS_LFS64_LIBS _CS_LFS64_LIBS - _CS_LFS64_LINTFLAGS, -#define _CS_LFS64_LINTFLAGS _CS_LFS64_LINTFLAGS - - _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, -#define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS - _CS_XBS5_ILP32_OFF32_LDFLAGS, -#define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS - _CS_XBS5_ILP32_OFF32_LIBS, -#define _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS - _CS_XBS5_ILP32_OFF32_LINTFLAGS, -#define _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS - _CS_XBS5_ILP32_OFFBIG_CFLAGS, -#define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS - _CS_XBS5_ILP32_OFFBIG_LDFLAGS, -#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS - _CS_XBS5_ILP32_OFFBIG_LIBS, -#define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS - _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, -#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS - _CS_XBS5_LP64_OFF64_CFLAGS, -#define _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS - _CS_XBS5_LP64_OFF64_LDFLAGS, -#define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS - _CS_XBS5_LP64_OFF64_LIBS, -#define _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS - _CS_XBS5_LP64_OFF64_LINTFLAGS, -#define _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS - _CS_XBS5_LPBIG_OFFBIG_CFLAGS, -#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS - _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, -#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS - _CS_XBS5_LPBIG_OFFBIG_LIBS, -#define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS - _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, -#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS - - _CS_POSIX_V6_ILP32_OFF32_CFLAGS, -#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS - _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, -#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS - _CS_POSIX_V6_ILP32_OFF32_LIBS, -#define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LIBS - _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, -#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS - _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, -#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS - _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, -#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS - _CS_POSIX_V6_ILP32_OFFBIG_LIBS, -#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LIBS - _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, -#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS - _CS_POSIX_V6_LP64_OFF64_CFLAGS, -#define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS - _CS_POSIX_V6_LP64_OFF64_LDFLAGS, -#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS - _CS_POSIX_V6_LP64_OFF64_LIBS, -#define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LIBS - _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, -#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS _CS_POSIX_V6_LP64_OFF64_LINTFLAGS - _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, -#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS - _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, -#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS - _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, -#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS - _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, -#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS - - _CS_POSIX_V7_ILP32_OFF32_CFLAGS, -#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS - _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, -#define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS - _CS_POSIX_V7_ILP32_OFF32_LIBS, -#define _CS_POSIX_V7_ILP32_OFF32_LIBS _CS_POSIX_V7_ILP32_OFF32_LIBS - _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, -#define _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS - _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, -#define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS - _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, -#define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS - _CS_POSIX_V7_ILP32_OFFBIG_LIBS, -#define _CS_POSIX_V7_ILP32_OFFBIG_LIBS _CS_POSIX_V7_ILP32_OFFBIG_LIBS - _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, -#define _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS - _CS_POSIX_V7_LP64_OFF64_CFLAGS, -#define _CS_POSIX_V7_LP64_OFF64_CFLAGS _CS_POSIX_V7_LP64_OFF64_CFLAGS - _CS_POSIX_V7_LP64_OFF64_LDFLAGS, -#define _CS_POSIX_V7_LP64_OFF64_LDFLAGS _CS_POSIX_V7_LP64_OFF64_LDFLAGS - _CS_POSIX_V7_LP64_OFF64_LIBS, -#define _CS_POSIX_V7_LP64_OFF64_LIBS _CS_POSIX_V7_LP64_OFF64_LIBS - _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, -#define _CS_POSIX_V7_LP64_OFF64_LINTFLAGS _CS_POSIX_V7_LP64_OFF64_LINTFLAGS - _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, -#define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS - _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, -#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS - _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, -#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS - _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, -#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS - - _CS_V6_ENV, -#define _CS_V6_ENV _CS_V6_ENV - _CS_V7_ENV -#define _CS_V7_ENV _CS_V7_ENV - }; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/dirent.h b/openflow/usr/include/arm-linux-gnueabihf/bits/dirent.h deleted file mode 100644 index 31b1961..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/dirent.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _DIRENT_H -# error "Never use directly; include instead." -#endif - -struct dirent - { -#ifndef __USE_FILE_OFFSET64 - __ino_t d_ino; - __off_t d_off; -#else - __ino64_t d_ino; - __off64_t d_off; -#endif - unsigned short int d_reclen; - unsigned char d_type; - char d_name[256]; /* We must not include limits.h! */ - }; - -#ifdef __USE_LARGEFILE64 -struct dirent64 - { - __ino64_t d_ino; - __off64_t d_off; - unsigned short int d_reclen; - unsigned char d_type; - char d_name[256]; /* We must not include limits.h! */ - }; -#endif - -#define d_fileno d_ino /* Backwards compatibility. */ - -#undef _DIRENT_HAVE_D_NAMLEN -#define _DIRENT_HAVE_D_RECLEN -#define _DIRENT_HAVE_D_OFF -#define _DIRENT_HAVE_D_TYPE - -#if defined __OFF_T_MATCHES_OFF64_T && defined __INO_T_MATCHES_INO64_T -/* Inform libc code that these two types are effectively identical. */ -# define _DIRENT_MATCHES_DIRENT64 1 -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/dlfcn.h b/openflow/usr/include/arm-linux-gnueabihf/bits/dlfcn.h deleted file mode 100644 index f4f98a1..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/dlfcn.h +++ /dev/null @@ -1,64 +0,0 @@ -/* System dependent definitions for run-time dynamic loading. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _DLFCN_H -# error "Never use directly; include instead." -#endif - -/* The MODE argument to `dlopen' contains one of the following: */ -#define RTLD_LAZY 0x00001 /* Lazy function call binding. */ -#define RTLD_NOW 0x00002 /* Immediate function call binding. */ -#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */ -#define RTLD_NOLOAD 0x00004 /* Do not load the object. */ -#define RTLD_DEEPBIND 0x00008 /* Use deep binding. */ - -/* If the following bit is set in the MODE argument to `dlopen', - the symbols of the loaded object and its dependencies are made - visible as if the object were linked directly into the program. */ -#define RTLD_GLOBAL 0x00100 - -/* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. - The implementation does this by default and so we can define the - value to zero. */ -#define RTLD_LOCAL 0 - -/* Do not delete object when closed. */ -#define RTLD_NODELETE 0x01000 - -#ifdef __USE_GNU -/* To support profiling of shared objects it is a good idea to call - the function found using `dlsym' using the following macro since - these calls do not use the PLT. But this would mean the dynamic - loader has no chance to find out when the function is called. The - macro applies the necessary magic so that profiling is possible. - Rewrite - foo = (*fctp) (arg1, arg2); - into - foo = DL_CALL_FCT (fctp, (arg1, arg2)); -*/ -# define DL_CALL_FCT(fctp, args) \ - (_dl_mcount_wrapper_check ((void *) (fctp)), (*(fctp)) args) - -__BEGIN_DECLS - -/* This function calls the profiling functions. */ -extern void _dl_mcount_wrapper_check (void *__selfpc) __THROW; - -__END_DECLS - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/elfclass.h b/openflow/usr/include/arm-linux-gnueabihf/bits/elfclass.h deleted file mode 100644 index 180227d..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/elfclass.h +++ /dev/null @@ -1,14 +0,0 @@ -/* This file specifies the native word size of the machine, which indicates - the ELF file class used for executables and shared objects on this - machine. */ - -#ifndef _LINK_H -# error "Never use directly; include instead." -#endif - -#include - -#define __ELF_NATIVE_CLASS __WORDSIZE - -/* The entries in the .hash table always have a size of 32 bits. */ -typedef uint32_t Elf_Symndx; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/endian.h b/openflow/usr/include/arm-linux-gnueabihf/bits/endian.h deleted file mode 100644 index f49f6ab..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/endian.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _ENDIAN_H -# error "Never use directly; include instead." -#endif - -/* ARM can be either big or little endian. */ -#ifdef __ARMEB__ -#define __BYTE_ORDER __BIG_ENDIAN -#else -#define __BYTE_ORDER __LITTLE_ENDIAN -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/environments.h b/openflow/usr/include/arm-linux-gnueabihf/bits/environments.h deleted file mode 100644 index 39d0702..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/environments.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright (C) 1999-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _UNISTD_H -# error "Never include this file directly. Use instead" -#endif - -#include - -/* This header should define the following symbols under the described - situations. A value `1' means that the model is always supported, - `-1' means it is never supported. Undefined means it cannot be - statically decided. - - _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type - _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type - - _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type - _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type - - The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG, - _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32, - _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were - used in previous versions of the Unix standard and are available - only for compatibility. -*/ - -#if __WORDSIZE == 64 - -/* We can never provide environments with 32-bit wide pointers. */ -# define _POSIX_V7_ILP32_OFF32 -1 -# define _POSIX_V7_ILP32_OFFBIG -1 -# define _POSIX_V6_ILP32_OFF32 -1 -# define _POSIX_V6_ILP32_OFFBIG -1 -# define _XBS5_ILP32_OFF32 -1 -# define _XBS5_ILP32_OFFBIG -1 -/* We also have no use (for now) for an environment with bigger pointers - and offsets. */ -# define _POSIX_V7_LPBIG_OFFBIG -1 -# define _POSIX_V6_LPBIG_OFFBIG -1 -# define _XBS5_LPBIG_OFFBIG -1 - -/* By default we have 64-bit wide `long int', pointers and `off_t'. */ -# define _POSIX_V7_LP64_OFF64 1 -# define _POSIX_V6_LP64_OFF64 1 -# define _XBS5_LP64_OFF64 1 - -#else /* __WORDSIZE == 32 */ - -/* By default we have 32-bit wide `int', `long int', pointers and `off_t' - and all platforms support LFS. */ -# define _POSIX_V7_ILP32_OFF32 1 -# define _POSIX_V7_ILP32_OFFBIG 1 -# define _POSIX_V6_ILP32_OFF32 1 -# define _POSIX_V6_ILP32_OFFBIG 1 -# define _XBS5_ILP32_OFF32 1 -# define _XBS5_ILP32_OFFBIG 1 - -/* We optionally provide an environment with the above size but an 64-bit - side `off_t'. Therefore we don't define _POSIX_V7_ILP32_OFFBIG. */ - -/* We can never provide environments with 64-bit wide pointers. */ -# define _POSIX_V7_LP64_OFF64 -1 -# define _POSIX_V7_LPBIG_OFFBIG -1 -# define _POSIX_V6_LP64_OFF64 -1 -# define _POSIX_V6_LPBIG_OFFBIG -1 -# define _XBS5_LP64_OFF64 -1 -# define _XBS5_LPBIG_OFFBIG -1 - -/* CFLAGS. */ -#define __ILP32_OFFBIG_CFLAGS "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" - -#endif /* __WORDSIZE == 32 */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/epoll.h b/openflow/usr/include/arm-linux-gnueabihf/bits/epoll.h deleted file mode 100644 index 9e8c220..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/epoll.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_EPOLL_H -# error "Never use directly; include instead." -#endif - -/* Flags to be passed to epoll_create1. */ -enum - { - EPOLL_CLOEXEC = 02000000 -#define EPOLL_CLOEXEC EPOLL_CLOEXEC - }; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/errno.h b/openflow/usr/include/arm-linux-gnueabihf/bits/errno.h deleted file mode 100644 index 6b5a71e..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/errno.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Error constants. Linux specific version. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifdef _ERRNO_H - -# undef EDOM -# undef EILSEQ -# undef ERANGE -# include - -/* Linux has no ENOTSUP error code. */ -# define ENOTSUP EOPNOTSUPP - -/* Older Linux versions also had no ECANCELED error code. */ -# ifndef ECANCELED -# define ECANCELED 125 -# endif - -/* Support for error codes to support robust mutexes was added later, too. */ -# ifndef EOWNERDEAD -# define EOWNERDEAD 130 -# define ENOTRECOVERABLE 131 -# endif - -# ifndef ERFKILL -# define ERFKILL 132 -# endif - -# ifndef EHWPOISON -# define EHWPOISON 133 -# endif - -# ifndef __ASSEMBLER__ -/* Function to get address of global `errno' variable. */ -extern int *__errno_location (void) __THROW __attribute__ ((__const__)); - -# if !defined _LIBC || defined _LIBC_REENTRANT -/* When using threads, errno is a per-thread value. */ -# define errno (*__errno_location ()) -# endif -# endif /* !__ASSEMBLER__ */ -#endif /* _ERRNO_H */ - -#if !defined _ERRNO_H && defined __need_Emath -/* This is ugly but the kernel header is not clean enough. We must - define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is - defined. */ -# define EDOM 33 /* Math argument out of domain of function. */ -# define EILSEQ 84 /* Illegal byte sequence. */ -# define ERANGE 34 /* Math result not representable. */ -#endif /* !_ERRNO_H && __need_Emath */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/error.h b/openflow/usr/include/arm-linux-gnueabihf/bits/error.h deleted file mode 100644 index 8408289..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/error.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Specializations for error functions. - Copyright (C) 2007-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _ERROR_H -# error "Never include directly; use instead." -#endif - - -extern void __REDIRECT (__error_alias, (int __status, int __errnum, - const char *__format, ...), - error) - __attribute__ ((__format__ (__printf__, 3, 4))); -extern void __REDIRECT (__error_noreturn, (int __status, int __errnum, - const char *__format, ...), - error) - __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4))); - - -/* If we know the function will never return make sure the compiler - realizes that, too. */ -__extern_always_inline void -error (int __status, int __errnum, const char *__format, ...) -{ - if (__builtin_constant_p (__status) && __status != 0) - __error_noreturn (__status, __errnum, __format, __va_arg_pack ()); - else - __error_alias (__status, __errnum, __format, __va_arg_pack ()); -} - - -extern void __REDIRECT (__error_at_line_alias, (int __status, int __errnum, - const char *__fname, - unsigned int __line, - const char *__format, ...), - error_at_line) - __attribute__ ((__format__ (__printf__, 5, 6))); -extern void __REDIRECT (__error_at_line_noreturn, (int __status, int __errnum, - const char *__fname, - unsigned int __line, - const char *__format, - ...), - error_at_line) - __attribute__ ((__noreturn__, __format__ (__printf__, 5, 6))); - - -/* If we know the function will never return make sure the compiler - realizes that, too. */ -__extern_always_inline void -error_at_line (int __status, int __errnum, const char *__fname, - unsigned int __line, const char *__format, ...) -{ - if (__builtin_constant_p (__status) && __status != 0) - __error_at_line_noreturn (__status, __errnum, __fname, __line, __format, - __va_arg_pack ()); - else - __error_at_line_alias (__status, __errnum, __fname, __line, - __format, __va_arg_pack ()); -} diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/eventfd.h b/openflow/usr/include/arm-linux-gnueabihf/bits/eventfd.h deleted file mode 100644 index 63c4944..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/eventfd.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2007-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_EVENTFD_H -# error "Never use directly; include instead." -#endif - -/* Flags for eventfd. */ -enum - { - EFD_SEMAPHORE = 00000001, -#define EFD_SEMAPHORE EFD_SEMAPHORE - EFD_CLOEXEC = 02000000, -#define EFD_CLOEXEC EFD_CLOEXEC - EFD_NONBLOCK = 00004000 -#define EFD_NONBLOCK EFD_NONBLOCK - }; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/fcntl-linux.h b/openflow/usr/include/arm-linux-gnueabihf/bits/fcntl-linux.h deleted file mode 100644 index 1e1ff17..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/fcntl-linux.h +++ /dev/null @@ -1,437 +0,0 @@ -/* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 2001-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _FCNTL_H -# error "Never use directly; include instead." -#endif - -/* This file contains shared definitions between Linux architectures - and is included by to declare them. The various - #ifndef cases allow the architecture specific file to define those - values with different values. - - A minimal contains just: - - struct flock {...} - #ifdef __USE_LARGEFILE64 - struct flock64 {...} - #endif - #include -*/ - -#ifdef __USE_GNU -# include -#endif - -/* open/fcntl. */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#ifndef O_CREAT -# define O_CREAT 0100 /* Not fcntl. */ -#endif -#ifndef O_EXCL -# define O_EXCL 0200 /* Not fcntl. */ -#endif -#ifndef O_NOCTTY -# define O_NOCTTY 0400 /* Not fcntl. */ -#endif -#ifndef O_TRUNC -# define O_TRUNC 01000 /* Not fcntl. */ -#endif -#ifndef O_APPEND -# define O_APPEND 02000 -#endif -#ifndef O_NONBLOCK -# define O_NONBLOCK 04000 -#endif -#ifndef O_NDELAY -# define O_NDELAY O_NONBLOCK -#endif -#ifndef O_SYNC -# define O_SYNC 04010000 -#endif -#define O_FSYNC O_SYNC -#ifndef O_ASYNC -# define O_ASYNC 020000 -#endif -#ifndef __O_LARGEFILE -# define __O_LARGEFILE 0100000 -#endif - -#ifndef __O_DIRECTORY -# define __O_DIRECTORY 0200000 -#endif -#ifndef __O_NOFOLLOW -# define __O_NOFOLLOW 0400000 -#endif -#ifndef __O_CLOEXEC -# define __O_CLOEXEC 02000000 -#endif -#ifndef __O_DIRECT -# define __O_DIRECT 040000 -#endif -#ifndef __O_NOATIME -# define __O_NOATIME 01000000 -#endif -#ifndef __O_PATH -# define __O_PATH 010000000 -#endif -#ifndef __O_DSYNC -# define __O_DSYNC 010000 -#endif -#ifndef __O_TMPFILE -# define __O_TMPFILE (020000000 | __O_DIRECTORY) -#endif - -#ifndef F_GETLK -# ifndef __USE_FILE_OFFSET64 -# define F_GETLK 5 /* Get record locking info. */ -# define F_SETLK 6 /* Set record locking info (non-blocking). */ -# define F_SETLKW 7 /* Set record locking info (blocking). */ -# else -# define F_GETLK F_GETLK64 /* Get record locking info. */ -# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/ -# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */ -# endif -#endif -#ifndef F_GETLK64 -# define F_GETLK64 12 /* Get record locking info. */ -# define F_SETLK64 13 /* Set record locking info (non-blocking). */ -# define F_SETLKW64 14 /* Set record locking info (blocking). */ -#endif - -/* open file description locks. - - Usually record locks held by a process are released on *any* close and are - not inherited across a fork. - - These cmd values will set locks that conflict with process-associated record - locks, but are "owned" by the opened file description, not the process. - This means that they are inherited across fork or clone with CLONE_FILES - like BSD (flock) locks, and they are only released automatically when the - last reference to the the file description against which they were acquired - is put. */ -#ifdef __USE_GNU -# define F_OFD_GETLK 36 -# define F_OFD_SETLK 37 -# define F_OFD_SETLKW 38 -#endif - -#ifdef __USE_LARGEFILE64 -# define O_LARGEFILE __O_LARGEFILE -#endif - -#ifdef __USE_XOPEN2K8 -# define O_DIRECTORY __O_DIRECTORY /* Must be a directory. */ -# define O_NOFOLLOW __O_NOFOLLOW /* Do not follow links. */ -# define O_CLOEXEC __O_CLOEXEC /* Set close_on_exec. */ -#endif - -#ifdef __USE_GNU -# define O_DIRECT __O_DIRECT /* Direct disk access. */ -# define O_NOATIME __O_NOATIME /* Do not set atime. */ -# define O_PATH __O_PATH /* Resolve pathname but do not open file. */ -# define O_TMPFILE __O_TMPFILE /* Atomically create nameless file. */ -#endif - -/* For now, Linux has no separate synchronicitiy options for read - operations. We define O_RSYNC therefore as the same as O_SYNC - since this is a superset. */ -#if defined __USE_POSIX199309 || defined __USE_UNIX98 -# define O_DSYNC __O_DSYNC /* Synchronize data. */ -# if defined __O_RSYNC -# define O_RSYNC __O_RSYNC /* Synchronize read operations. */ -# else -# define O_RSYNC O_SYNC /* Synchronize read operations. */ -# endif -#endif - -/* Values for the second argument to `fcntl'. */ -#define F_DUPFD 0 /* Duplicate file descriptor. */ -#define F_GETFD 1 /* Get file descriptor flags. */ -#define F_SETFD 2 /* Set file descriptor flags. */ -#define F_GETFL 3 /* Get file status flags. */ -#define F_SETFL 4 /* Set file status flags. */ - -#ifndef __F_SETOWN -# define __F_SETOWN 8 -# define __F_GETOWN 9 -#endif - -#if defined __USE_UNIX98 || defined __USE_XOPEN2K8 -# define F_SETOWN __F_SETOWN /* Get owner (process receiving SIGIO). */ -# define F_GETOWN __F_GETOWN /* Set owner (process receiving SIGIO). */ -#endif - -#ifndef __F_SETSIG -# define __F_SETSIG 10 /* Set number of signal to be sent. */ -# define __F_GETSIG 11 /* Get number of signal to be sent. */ -#endif -#ifndef __F_SETOWN_EX -# define __F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */ -# define __F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */ -#endif - -#ifdef __USE_GNU -# define F_SETSIG __F_SETSIG /* Set number of signal to be sent. */ -# define F_GETSIG __F_GETSIG /* Get number of signal to be sent. */ -# define F_SETOWN_EX __F_SETOWN_EX /* Get owner (thread receiving SIGIO). */ -# define F_GETOWN_EX __F_GETOWN_EX /* Set owner (thread receiving SIGIO). */ -#endif - -#ifdef __USE_GNU -# define F_SETLEASE 1024 /* Set a lease. */ -# define F_GETLEASE 1025 /* Enquire what lease is active. */ -# define F_NOTIFY 1026 /* Request notifications on a directory. */ -# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */ -# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */ -#endif -#ifdef __USE_XOPEN2K8 -# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with - close-on-exit set. */ -#endif - -/* For F_[GET|SET]FD. */ -#define FD_CLOEXEC 1 /* Actually anything with low bit set goes */ - -#ifndef F_RDLCK -/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ -# define F_RDLCK 0 /* Read lock. */ -# define F_WRLCK 1 /* Write lock. */ -# define F_UNLCK 2 /* Remove lock. */ -#endif - - -/* For old implementation of BSD flock. */ -#ifndef F_EXLCK -# define F_EXLCK 4 /* or 3 */ -# define F_SHLCK 8 /* or 4 */ -#endif - -#ifdef __USE_MISC -/* Operations for BSD flock, also used by the kernel implementation. */ -# define LOCK_SH 1 /* Shared lock. */ -# define LOCK_EX 2 /* Exclusive lock. */ -# define LOCK_NB 4 /* Or'd with one of the above to prevent - blocking. */ -# define LOCK_UN 8 /* Remove lock. */ -#endif - -#ifdef __USE_GNU -# define LOCK_MAND 32 /* This is a mandatory flock: */ -# define LOCK_READ 64 /* ... which allows concurrent read operations. */ -# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ -# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ -#endif - -#ifdef __USE_GNU -/* Types of directory notifications that may be requested with F_NOTIFY. */ -# define DN_ACCESS 0x00000001 /* File accessed. */ -# define DN_MODIFY 0x00000002 /* File modified. */ -# define DN_CREATE 0x00000004 /* File created. */ -# define DN_DELETE 0x00000008 /* File removed. */ -# define DN_RENAME 0x00000010 /* File renamed. */ -# define DN_ATTRIB 0x00000020 /* File changed attributes. */ -# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ -#endif - - -#ifdef __USE_GNU -/* Owner types. */ -enum __pid_type - { - F_OWNER_TID = 0, /* Kernel thread. */ - F_OWNER_PID, /* Process. */ - F_OWNER_PGRP, /* Process group. */ - F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */ - }; - -/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */ -struct f_owner_ex - { - enum __pid_type type; /* Owner type of ID. */ - __pid_t pid; /* ID of owner. */ - }; -#endif - -/* Define some more compatibility macros to be backward compatible with - BSD systems which did not managed to hide these kernel macros. */ -#ifdef __USE_MISC -# define FAPPEND O_APPEND -# define FFSYNC O_FSYNC -# define FASYNC O_ASYNC -# define FNONBLOCK O_NONBLOCK -# define FNDELAY O_NDELAY -#endif /* Use misc. */ - -#ifndef __POSIX_FADV_DONTNEED -# define __POSIX_FADV_DONTNEED 4 -# define __POSIX_FADV_NOREUSE 5 -#endif -/* Advise to `posix_fadvise'. */ -#ifdef __USE_XOPEN2K -# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ -# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ -# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ -# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ -# define POSIX_FADV_DONTNEED __POSIX_FADV_DONTNEED /* Don't need these pages. */ -# define POSIX_FADV_NOREUSE __POSIX_FADV_NOREUSE /* Data will be accessed once. */ -#endif - - -#ifdef __USE_GNU -/* Flags for SYNC_FILE_RANGE. */ -# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages - in the range before performing the - write. */ -# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those - dirty pages in the range which are - not presently under writeback. */ -# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in - the range after performing the - write. */ - -/* Flags for SPLICE and VMSPLICE. */ -# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */ -# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing - (but we may still block on the fd - we splice from/to). */ -# define SPLICE_F_MORE 4 /* Expect more data. */ -# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ - - -/* Flags for fallocate. */ -# define FALLOC_FL_KEEP_SIZE 1 /* Don't extend size of file - even if offset + len is - greater than file size. */ -# define FALLOC_FL_PUNCH_HOLE 2 /* Create a hole in the file. */ -# define FALLOC_FL_COLLAPSE_RANGE 8 /* Remove a range of a file - without leaving a - hole. */ -# define FALLOC_FL_ZERO_RANGE 16 /* Convert a range of a - file to zeros. */ - - -/* File handle structure. */ -struct file_handle -{ - unsigned int handle_bytes; - int handle_type; - /* File identifier. */ - unsigned char f_handle[0]; -}; - -/* Maximum handle size (for now). */ -# define MAX_HANDLE_SZ 128 -#endif - -/* Values for `*at' functions. */ -#ifdef __USE_ATFILE -# define AT_FDCWD -100 /* Special value used to indicate - the *at functions should use the - current working directory. */ -# define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ -# define AT_REMOVEDIR 0x200 /* Remove directory instead of - unlinking file. */ -# define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ -# ifdef __USE_GNU -# define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount - traversal. */ -# define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname. */ -# endif -# define AT_EACCESS 0x200 /* Test access permitted for - effective IDs, not real IDs. */ -#endif - -__BEGIN_DECLS - -#ifdef __USE_GNU - -/* Provide kernel hint to read ahead. */ -extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) - __THROW; - - -/* Selective file content synch'ing. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count, - unsigned int __flags); - - -/* Splice address range into a pipe. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, - size_t __count, unsigned int __flags); - -/* Splice two files together. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, - __off64_t *__offout, size_t __len, - unsigned int __flags); - -/* In-kernel implementation of tee for pipe buffers. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern ssize_t tee (int __fdin, int __fdout, size_t __len, - unsigned int __flags); - -/* Reserve storage for the data of the file associated with FD. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -# ifndef __USE_FILE_OFFSET64 -extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); -# else -# ifdef __REDIRECT -extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, - __off64_t __len), - fallocate64); -# else -# define fallocate fallocate64 -# endif -# endif -# ifdef __USE_LARGEFILE64 -extern int fallocate64 (int __fd, int __mode, __off64_t __offset, - __off64_t __len); -# endif - - -/* Map file name to file handle. */ -extern int name_to_handle_at (int __dfd, const char *__name, - struct file_handle *__handle, int *__mnt_id, - int __flags) __THROW; - -/* Open file using the file handle. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle, - int __flags); - -#endif /* use GNU */ - -__END_DECLS diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/fcntl.h b/openflow/usr/include/arm-linux-gnueabihf/bits/fcntl.h deleted file mode 100644 index 4fbe30d..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/fcntl.h +++ /dev/null @@ -1,54 +0,0 @@ -/* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _FCNTL_H -# error "Never use directly; include instead." -#endif - -#define __O_DIRECTORY 040000 /* Must be a directory. */ -#define __O_NOFOLLOW 0100000 /* Do not follow links. */ -#define __O_DIRECT 0200000 /* Direct disk access. */ -#define __O_LARGEFILE 0400000 - -struct flock - { - short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ - short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ -#ifndef __USE_FILE_OFFSET64 - __off_t l_start; /* Offset where the lock begins. */ - __off_t l_len; /* Size of the locked area; zero means until EOF. */ -#else - __off64_t l_start; /* Offset where the lock begins. */ - __off64_t l_len; /* Size of the locked area; zero means until EOF. */ -#endif - __pid_t l_pid; /* Process holding the lock. */ - }; - -#ifdef __USE_LARGEFILE64 -struct flock64 - { - short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ - short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ - __off64_t l_start; /* Offset where the lock begins. */ - __off64_t l_len; /* Size of the locked area; zero means until EOF. */ - __pid_t l_pid; /* Process holding the lock. */ - }; -#endif - -/* Include generic Linux declarations. */ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/fcntl2.h b/openflow/usr/include/arm-linux-gnueabihf/bits/fcntl2.h deleted file mode 100644 index c3f267e..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/fcntl2.h +++ /dev/null @@ -1,172 +0,0 @@ -/* Checking macros for fcntl functions. - Copyright (C) 2007-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _FCNTL_H -# error "Never include directly; use instead." -#endif - -/* Check that calls to open and openat with O_CREAT or O_TMPFILE set have an - appropriate third/fourth parameter. */ -#ifndef __USE_FILE_OFFSET64 -extern int __open_2 (const char *__path, int __oflag) __nonnull ((1)); -extern int __REDIRECT (__open_alias, (const char *__path, int __oflag, ...), - open) __nonnull ((1)); -#else -extern int __REDIRECT (__open_2, (const char *__path, int __oflag), - __open64_2) __nonnull ((1)); -extern int __REDIRECT (__open_alias, (const char *__path, int __oflag, ...), - open64) __nonnull ((1)); -#endif -__errordecl (__open_too_many_args, - "open can be called either with 2 or 3 arguments, not more"); -__errordecl (__open_missing_mode, - "open with O_CREAT or O_TMPFILE in second argument needs 3 arguments"); - -__fortify_function int -open (const char *__path, int __oflag, ...) -{ - if (__va_arg_pack_len () > 1) - __open_too_many_args (); - - if (__builtin_constant_p (__oflag)) - { - if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1) - { - __open_missing_mode (); - return __open_2 (__path, __oflag); - } - return __open_alias (__path, __oflag, __va_arg_pack ()); - } - - if (__va_arg_pack_len () < 1) - return __open_2 (__path, __oflag); - - return __open_alias (__path, __oflag, __va_arg_pack ()); -} - - -#ifdef __USE_LARGEFILE64 -extern int __open64_2 (const char *__path, int __oflag) __nonnull ((1)); -extern int __REDIRECT (__open64_alias, (const char *__path, int __oflag, - ...), open64) __nonnull ((1)); -__errordecl (__open64_too_many_args, - "open64 can be called either with 2 or 3 arguments, not more"); -__errordecl (__open64_missing_mode, - "open64 with O_CREAT or O_TMPFILE in second argument needs 3 arguments"); - -__fortify_function int -open64 (const char *__path, int __oflag, ...) -{ - if (__va_arg_pack_len () > 1) - __open64_too_many_args (); - - if (__builtin_constant_p (__oflag)) - { - if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1) - { - __open64_missing_mode (); - return __open64_2 (__path, __oflag); - } - return __open64_alias (__path, __oflag, __va_arg_pack ()); - } - - if (__va_arg_pack_len () < 1) - return __open64_2 (__path, __oflag); - - return __open64_alias (__path, __oflag, __va_arg_pack ()); -} -#endif - - -#ifdef __USE_ATFILE -# ifndef __USE_FILE_OFFSET64 -extern int __openat_2 (int __fd, const char *__path, int __oflag) - __nonnull ((2)); -extern int __REDIRECT (__openat_alias, (int __fd, const char *__path, - int __oflag, ...), openat) - __nonnull ((2)); -# else -extern int __REDIRECT (__openat_2, (int __fd, const char *__path, - int __oflag), __openat64_2) - __nonnull ((2)); -extern int __REDIRECT (__openat_alias, (int __fd, const char *__path, - int __oflag, ...), openat64) - __nonnull ((2)); -# endif -__errordecl (__openat_too_many_args, - "openat can be called either with 3 or 4 arguments, not more"); -__errordecl (__openat_missing_mode, - "openat with O_CREAT or O_TMPFILE in third argument needs 4 arguments"); - -__fortify_function int -openat (int __fd, const char *__path, int __oflag, ...) -{ - if (__va_arg_pack_len () > 1) - __openat_too_many_args (); - - if (__builtin_constant_p (__oflag)) - { - if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1) - { - __openat_missing_mode (); - return __openat_2 (__fd, __path, __oflag); - } - return __openat_alias (__fd, __path, __oflag, __va_arg_pack ()); - } - - if (__va_arg_pack_len () < 1) - return __openat_2 (__fd, __path, __oflag); - - return __openat_alias (__fd, __path, __oflag, __va_arg_pack ()); -} - - -# ifdef __USE_LARGEFILE64 -extern int __openat64_2 (int __fd, const char *__path, int __oflag) - __nonnull ((2)); -extern int __REDIRECT (__openat64_alias, (int __fd, const char *__path, - int __oflag, ...), openat64) - __nonnull ((2)); -__errordecl (__openat64_too_many_args, - "openat64 can be called either with 3 or 4 arguments, not more"); -__errordecl (__openat64_missing_mode, - "openat64 with O_CREAT or O_TMPFILE in third argument needs 4 arguments"); - -__fortify_function int -openat64 (int __fd, const char *__path, int __oflag, ...) -{ - if (__va_arg_pack_len () > 1) - __openat64_too_many_args (); - - if (__builtin_constant_p (__oflag)) - { - if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1) - { - __openat64_missing_mode (); - return __openat64_2 (__fd, __path, __oflag); - } - return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ()); - } - - if (__va_arg_pack_len () < 1) - return __openat64_2 (__fd, __path, __oflag); - - return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ()); -} -# endif -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/fenv.h b/openflow/usr/include/arm-linux-gnueabihf/bits/fenv.h deleted file mode 100644 index 8e89fc1..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/fenv.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _FENV_H -# error "Never use directly; include instead." -#endif - -/* Define bits representing exceptions in the FPU status word. */ -enum - { - FE_INVALID = -#define FE_INVALID 1 - FE_INVALID, - FE_DIVBYZERO = -#define FE_DIVBYZERO 2 - FE_DIVBYZERO, - FE_OVERFLOW = -#define FE_OVERFLOW 4 - FE_OVERFLOW, - FE_UNDERFLOW = -#define FE_UNDERFLOW 8 - FE_UNDERFLOW, - FE_INEXACT = -#define FE_INEXACT 16 - FE_INEXACT, - }; - -/* Amount to shift by to convert an exception to a mask bit. */ -#define FE_EXCEPT_SHIFT 8 - -/* All supported exceptions. */ -#define FE_ALL_EXCEPT \ - (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT) - -/* VFP supports all of the four defined rounding modes. */ -enum - { - FE_TONEAREST = -#define FE_TONEAREST 0 - FE_TONEAREST, - FE_UPWARD = -#define FE_UPWARD 0x400000 - FE_UPWARD, - FE_DOWNWARD = -#define FE_DOWNWARD 0x800000 - FE_DOWNWARD, - FE_TOWARDZERO = -#define FE_TOWARDZERO 0xc00000 - FE_TOWARDZERO - }; - -/* Type representing exception flags. */ -typedef unsigned int fexcept_t; - -/* Type representing floating-point environment. */ -typedef struct - { - unsigned int __cw; - } -fenv_t; - -/* If the default argument is used we use this value. */ -#define FE_DFL_ENV ((const fenv_t *) -1l) - -#ifdef __USE_GNU -/* Floating-point environment where none of the exceptions are masked. */ -# define FE_NOMASK_ENV ((const fenv_t *) -2) -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/fenvinline.h b/openflow/usr/include/arm-linux-gnueabihf/bits/fenvinline.h deleted file mode 100644 index 42f77b5..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/fenvinline.h +++ /dev/null @@ -1,8 +0,0 @@ -/* This file provides inline versions of floating-pint environment - handling functions. If there were any. */ - -#ifndef __NO_MATH_INLINES - -/* Here is where the code would go. */ - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/huge_val.h b/openflow/usr/include/arm-linux-gnueabihf/bits/huge_val.h deleted file mode 100644 index 42d416f..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/huge_val.h +++ /dev/null @@ -1,53 +0,0 @@ -/* `HUGE_VAL' constant for IEEE 754 machines (where it is infinity). - Used by and functions for overflow. - Copyright (C) 1992-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MATH_H -# error "Never use directly; include instead." -#endif - -/* IEEE positive infinity (-HUGE_VAL is negative infinity). */ - -#if __GNUC_PREREQ(3,3) -# define HUGE_VAL (__builtin_huge_val()) -#elif __GNUC_PREREQ(2,96) -# define HUGE_VAL (__extension__ 0x1.0p2047) -#elif defined __GNUC__ - -# define HUGE_VAL \ - (__extension__ \ - ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \ - { __l: 0x7ff0000000000000ULL }).__d) - -#else /* not GCC */ - -# include - -typedef union { unsigned char __c[8]; double __d; } __huge_val_t; - -# if __BYTE_ORDER == __BIG_ENDIAN -# define __HUGE_VAL_bytes { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } -# endif -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define __HUGE_VAL_bytes { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } -# endif - -static __huge_val_t __huge_val = { __HUGE_VAL_bytes }; -# define HUGE_VAL (__huge_val.__d) - -#endif /* GCC. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/huge_valf.h b/openflow/usr/include/arm-linux-gnueabihf/bits/huge_valf.h deleted file mode 100644 index 9d418ba..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/huge_valf.h +++ /dev/null @@ -1,51 +0,0 @@ -/* `HUGE_VALF' constant for IEEE 754 machines (where it is infinity). - Used by and functions for overflow. - Copyright (C) 1992-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MATH_H -# error "Never use directly; include instead." -#endif - -/* IEEE positive infinity (-HUGE_VAL is negative infinity). */ - -#if __GNUC_PREREQ(3,3) -# define HUGE_VALF (__builtin_huge_valf()) -#elif __GNUC_PREREQ(2,96) -# define HUGE_VALF (__extension__ 0x1.0p255f) -#elif defined __GNUC__ - -# define HUGE_VALF \ - (__extension__ \ - ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \ - { __l: 0x7f800000UL }).__d) - -#else /* not GCC */ - -typedef union { unsigned char __c[4]; float __f; } __huge_valf_t; - -# if __BYTE_ORDER == __BIG_ENDIAN -# define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 } -# endif -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f } -# endif - -static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; -# define HUGE_VALF (__huge_valf.__f) - -#endif /* GCC. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/huge_vall.h b/openflow/usr/include/arm-linux-gnueabihf/bits/huge_vall.h deleted file mode 100644 index 1886adf..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/huge_vall.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Default `HUGE_VALL' constant. - Used by and functions for overflow. - Copyright (C) 1992-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MATH_H -# error "Never use directly; include instead." -#endif - -#if __GNUC_PREREQ(3,3) -# define HUGE_VALL (__builtin_huge_vall()) -#else -# define HUGE_VALL ((long double) HUGE_VAL) -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/hwcap.h b/openflow/usr/include/arm-linux-gnueabihf/bits/hwcap.h deleted file mode 100644 index 4e10115..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/hwcap.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Defines for bits in AT_HWCAP. ARM Linux version. - Copyright (C) 2012-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined (_SYS_AUXV_H) && !defined (_LINUX_ARM_SYSDEP_H) -# error "Never include directly; use instead." -#endif - -/* The following must match the kernel's . */ -#define HWCAP_ARM_SWP 1 -#define HWCAP_ARM_HALF 2 -#define HWCAP_ARM_THUMB 4 -#define HWCAP_ARM_26BIT 8 -#define HWCAP_ARM_FAST_MULT 16 -#define HWCAP_ARM_FPA 32 -#define HWCAP_ARM_VFP 64 -#define HWCAP_ARM_EDSP 128 -#define HWCAP_ARM_JAVA 256 -#define HWCAP_ARM_IWMMXT 512 -#define HWCAP_ARM_CRUNCH 1024 -#define HWCAP_ARM_THUMBEE 2048 -#define HWCAP_ARM_NEON 4096 -#define HWCAP_ARM_VFPv3 8192 -#define HWCAP_ARM_VFPv3D16 16384 -#define HWCAP_ARM_TLS 32768 -#define HWCAP_ARM_VFPv4 65536 -#define HWCAP_ARM_IDIVA 131072 -#define HWCAP_ARM_IDIVT 262144 -#define HWCAP_ARM_VFPD32 524288 -#define HWCAP_ARM_LPAE 1048576 -#define HWCAP_ARM_EVTSTRM 2097152 diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/in.h b/openflow/usr/include/arm-linux-gnueabihf/bits/in.h deleted file mode 100644 index 3b01f12..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/in.h +++ /dev/null @@ -1,230 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Linux version. */ - -#ifndef _NETINET_IN_H -# error "Never use directly; include instead." -#endif - -/* If the application has already included linux/in6.h from a linux-based - kernel then we will not define the IPv6 IPPROTO_* defines, in6_addr (nor the - defines), sockaddr_in6, or ipv6_mreq. Same for in6_ptkinfo or ip6_mtuinfo - in linux/ipv6.h. The ABI used by the linux-kernel and glibc match exactly. - Neither the linux kernel nor glibc should break this ABI without coordination. */ -#if defined _UAPI_LINUX_IN6_H || defined _UAPI_IPV6_H -/* This is not quite the same API since the kernel always defines s6_addr16 and - s6_addr32. This is not a violation of POSIX since POSIX says "at least the - following member" and that holds true. */ -# define __USE_KERNEL_IPV6_DEFS -#endif - -/* Options for use with `getsockopt' and `setsockopt' at the IP level. - The first word in the comment at the right is the data type used; - "bool" means a boolean value stored in an `int'. */ -#define IP_OPTIONS 4 /* ip_opts; IP per-packet options. */ -#define IP_HDRINCL 3 /* int; Header is included with data. */ -#define IP_TOS 1 /* int; IP type of service and precedence. */ -#define IP_TTL 2 /* int; IP time to live. */ -#define IP_RECVOPTS 6 /* bool; Receive all IP options w/datagram. */ -/* For BSD compatibility. */ -#define IP_RECVRETOPTS IP_RETOPTS /* bool; Receive IP options for response. */ -#define IP_RETOPTS 7 /* ip_opts; Set/get IP per-packet options. */ -#define IP_MULTICAST_IF 32 /* in_addr; set/get IP multicast i/f */ -#define IP_MULTICAST_TTL 33 /* u_char; set/get IP multicast ttl */ -#define IP_MULTICAST_LOOP 34 /* i_char; set/get IP multicast loopback */ -#define IP_ADD_MEMBERSHIP 35 /* ip_mreq; add an IP group membership */ -#define IP_DROP_MEMBERSHIP 36 /* ip_mreq; drop an IP group membership */ -#define IP_UNBLOCK_SOURCE 37 /* ip_mreq_source: unblock data from source */ -#define IP_BLOCK_SOURCE 38 /* ip_mreq_source: block data from source */ -#define IP_ADD_SOURCE_MEMBERSHIP 39 /* ip_mreq_source: join source group */ -#define IP_DROP_SOURCE_MEMBERSHIP 40 /* ip_mreq_source: leave source group */ -#define IP_MSFILTER 41 -#ifdef __USE_MISC -# define MCAST_JOIN_GROUP 42 /* group_req: join any-source group */ -# define MCAST_BLOCK_SOURCE 43 /* group_source_req: block from given group */ -# define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/ -# define MCAST_LEAVE_GROUP 45 /* group_req: leave any-source group */ -# define MCAST_JOIN_SOURCE_GROUP 46 /* group_source_req: join source-spec gr */ -# define MCAST_LEAVE_SOURCE_GROUP 47 /* group_source_req: leave source-spec gr*/ -# define MCAST_MSFILTER 48 -# define IP_MULTICAST_ALL 49 -# define IP_UNICAST_IF 50 - -# define MCAST_EXCLUDE 0 -# define MCAST_INCLUDE 1 -#endif - -#define IP_ROUTER_ALERT 5 /* bool */ -#define IP_PKTINFO 8 /* bool */ -#define IP_PKTOPTIONS 9 -#define IP_PMTUDISC 10 /* obsolete name? */ -#define IP_MTU_DISCOVER 10 /* int; see below */ -#define IP_RECVERR 11 /* bool */ -#define IP_RECVTTL 12 /* bool */ -#define IP_RECVTOS 13 /* bool */ -#define IP_MTU 14 /* int */ -#define IP_FREEBIND 15 -#define IP_IPSEC_POLICY 16 -#define IP_XFRM_POLICY 17 -#define IP_PASSSEC 18 -#define IP_TRANSPARENT 19 -#define IP_MULTICAST_ALL 49 /* bool */ - -/* TProxy original addresses */ -#define IP_ORIGDSTADDR 20 -#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR - -#define IP_MINTTL 21 -#define IP_NODEFRAG 22 -#define IP_CHECKSUM 23 -#define IP_BIND_ADDRESS_NO_PORT 24 - -/* IP_MTU_DISCOVER arguments. */ -#define IP_PMTUDISC_DONT 0 /* Never send DF frames. */ -#define IP_PMTUDISC_WANT 1 /* Use per route hints. */ -#define IP_PMTUDISC_DO 2 /* Always DF. */ -#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */ -/* Always use interface mtu (ignores dst pmtu) but don't set DF flag. - Also incoming ICMP frag_needed notifications will be ignored on - this socket to prevent accepting spoofed ones. */ -#define IP_PMTUDISC_INTERFACE 4 -/* Like IP_PMTUDISC_INTERFACE but allow packets to be fragmented. */ -#define IP_PMTUDISC_OMIT 5 - -#define IP_MULTICAST_IF 32 -#define IP_MULTICAST_TTL 33 -#define IP_MULTICAST_LOOP 34 -#define IP_ADD_MEMBERSHIP 35 -#define IP_DROP_MEMBERSHIP 36 -#define IP_UNBLOCK_SOURCE 37 -#define IP_BLOCK_SOURCE 38 -#define IP_ADD_SOURCE_MEMBERSHIP 39 -#define IP_DROP_SOURCE_MEMBERSHIP 40 -#define IP_MSFILTER 41 -#define IP_MULTICAST_ALL 49 -#define IP_UNICAST_IF 50 - -/* To select the IP level. */ -#define SOL_IP 0 - -#define IP_DEFAULT_MULTICAST_TTL 1 -#define IP_DEFAULT_MULTICAST_LOOP 1 -#define IP_MAX_MEMBERSHIPS 20 - -#ifdef __USE_MISC -/* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. - The `ip_dst' field is used for the first-hop gateway when using a - source route (this gets put into the header proper). */ -struct ip_opts - { - struct in_addr ip_dst; /* First hop; zero without source route. */ - char ip_opts[40]; /* Actually variable in size. */ - }; - -/* Like `struct ip_mreq' but including interface specification by index. */ -struct ip_mreqn - { - struct in_addr imr_multiaddr; /* IP multicast address of group */ - struct in_addr imr_address; /* local IP address of interface */ - int imr_ifindex; /* Interface index */ - }; - -/* Structure used for IP_PKTINFO. */ -struct in_pktinfo - { - int ipi_ifindex; /* Interface index */ - struct in_addr ipi_spec_dst; /* Routing destination address */ - struct in_addr ipi_addr; /* Header destination address */ - }; -#endif - -/* Options for use with `getsockopt' and `setsockopt' at the IPv6 level. - The first word in the comment at the right is the data type used; - "bool" means a boolean value stored in an `int'. */ -#define IPV6_ADDRFORM 1 -#define IPV6_2292PKTINFO 2 -#define IPV6_2292HOPOPTS 3 -#define IPV6_2292DSTOPTS 4 -#define IPV6_2292RTHDR 5 -#define IPV6_2292PKTOPTIONS 6 -#define IPV6_CHECKSUM 7 -#define IPV6_2292HOPLIMIT 8 - -#define SCM_SRCRT IPV6_RXSRCRT - -#define IPV6_NEXTHOP 9 -#define IPV6_AUTHHDR 10 -#define IPV6_UNICAST_HOPS 16 -#define IPV6_MULTICAST_IF 17 -#define IPV6_MULTICAST_HOPS 18 -#define IPV6_MULTICAST_LOOP 19 -#define IPV6_JOIN_GROUP 20 -#define IPV6_LEAVE_GROUP 21 -#define IPV6_ROUTER_ALERT 22 -#define IPV6_MTU_DISCOVER 23 -#define IPV6_MTU 24 -#define IPV6_RECVERR 25 -#define IPV6_V6ONLY 26 -#define IPV6_JOIN_ANYCAST 27 -#define IPV6_LEAVE_ANYCAST 28 -#define IPV6_IPSEC_POLICY 34 -#define IPV6_XFRM_POLICY 35 - -/* Advanced API (RFC3542) (1). */ -#define IPV6_RECVPKTINFO 49 -#define IPV6_PKTINFO 50 -#define IPV6_RECVHOPLIMIT 51 -#define IPV6_HOPLIMIT 52 -#define IPV6_RECVHOPOPTS 53 -#define IPV6_HOPOPTS 54 -#define IPV6_RTHDRDSTOPTS 55 -#define IPV6_RECVRTHDR 56 -#define IPV6_RTHDR 57 -#define IPV6_RECVDSTOPTS 58 -#define IPV6_DSTOPTS 59 -#define IPV6_RECVPATHMTU 60 -#define IPV6_PATHMTU 61 -#define IPV6_DONTFRAG 62 - -/* Advanced API (RFC3542) (2). */ -#define IPV6_RECVTCLASS 66 -#define IPV6_TCLASS 67 - -/* Obsolete synonyms for the above. */ -#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP -#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP -#define IPV6_RXHOPOPTS IPV6_HOPOPTS -#define IPV6_RXDSTOPTS IPV6_DSTOPTS - -/* IPV6_MTU_DISCOVER values. */ -#define IPV6_PMTUDISC_DONT 0 /* Never send DF frames. */ -#define IPV6_PMTUDISC_WANT 1 /* Use per route hints. */ -#define IPV6_PMTUDISC_DO 2 /* Always DF. */ -#define IPV6_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */ -#define IPV6_PMTUDISC_INTERFACE 4 /* See IP_PMTUDISC_INTERFACE. */ -#define IPV6_PMTUDISC_OMIT 5 /* See IP_PMTUDISC_OMIT. */ - -/* Socket level values for IPv6. */ -#define SOL_IPV6 41 -#define SOL_ICMPV6 58 - -/* Routing header options for IPv6. */ -#define IPV6_RTHDR_LOOSE 0 /* Hop doesn't need to be neighbour. */ -#define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */ - -#define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/inf.h b/openflow/usr/include/arm-linux-gnueabihf/bits/inf.h deleted file mode 100644 index 179bf48..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/inf.h +++ /dev/null @@ -1,29 +0,0 @@ -/* `INFINITY' constant for IEEE 754 machines. - Copyright (C) 2004-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MATH_H -# error "Never use directly; include instead." -#endif - -/* IEEE positive infinity. */ - -#if __GNUC_PREREQ(3,3) -# define INFINITY (__builtin_inff()) -#else -# define INFINITY HUGE_VALF -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/initspin.h b/openflow/usr/include/arm-linux-gnueabihf/bits/initspin.h deleted file mode 100644 index 936f178..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/initspin.h +++ /dev/null @@ -1 +0,0 @@ -/* No thread support. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/inotify.h b/openflow/usr/include/arm-linux-gnueabihf/bits/inotify.h deleted file mode 100644 index dc9f627..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/inotify.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2005-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_INOTIFY_H -# error "Never use directly; include instead." -#endif - -/* Flags for the parameter of inotify_init1. */ -enum - { - IN_CLOEXEC = 02000000, -#define IN_CLOEXEC IN_CLOEXEC - IN_NONBLOCK = 00004000 -#define IN_NONBLOCK IN_NONBLOCK - }; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/ioctl-types.h b/openflow/usr/include/arm-linux-gnueabihf/bits/ioctl-types.h deleted file mode 100644 index b3bfdb1..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/ioctl-types.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Structure types for pre-termios terminal ioctls. Linux version. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_IOCTL_H -# error "Never use directly; include instead." -#endif - -/* Get definition of constants for use with `ioctl'. */ -#include - - -struct winsize - { - unsigned short int ws_row; - unsigned short int ws_col; - unsigned short int ws_xpixel; - unsigned short int ws_ypixel; - }; - -#define NCC 8 -struct termio - { - unsigned short int c_iflag; /* input mode flags */ - unsigned short int c_oflag; /* output mode flags */ - unsigned short int c_cflag; /* control mode flags */ - unsigned short int c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - -/* modem lines */ -#define TIOCM_LE 0x001 -#define TIOCM_DTR 0x002 -#define TIOCM_RTS 0x004 -#define TIOCM_ST 0x008 -#define TIOCM_SR 0x010 -#define TIOCM_CTS 0x020 -#define TIOCM_CAR 0x040 -#define TIOCM_RNG 0x080 -#define TIOCM_DSR 0x100 -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RI TIOCM_RNG - -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ - -/* line disciplines */ -#define N_TTY 0 -#define N_SLIP 1 -#define N_MOUSE 2 -#define N_PPP 3 -#define N_STRIP 4 -#define N_AX25 5 -#define N_X25 6 /* X.25 async */ -#define N_6PACK 7 -#define N_MASC 8 /* Mobitex module */ -#define N_R3964 9 /* Simatic R3964 module */ -#define N_PROFIBUS_FDL 10 /* Profibus */ -#define N_IRDA 11 /* Linux IR */ -#define N_SMSBLOCK 12 /* SMS block mode */ -#define N_HDLC 13 /* synchronous HDLC */ -#define N_SYNC_PPP 14 /* synchronous PPP */ -#define N_HCI 15 /* Bluetooth HCI UART */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/ioctls.h b/openflow/usr/include/arm-linux-gnueabihf/bits/ioctls.h deleted file mode 100644 index cbfedca..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/ioctls.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_IOCTL_H -# error "Never use directly; include instead." -#endif - -/* Use the definitions from the kernel header files. */ -#include - -/* Routing table calls. */ -#define SIOCADDRT 0x890B /* add routing table entry */ -#define SIOCDELRT 0x890C /* delete routing table entry */ -#define SIOCRTMSG 0x890D /* call to routing system */ - -/* Socket configuration controls. */ -#define SIOCGIFNAME 0x8910 /* get iface name */ -#define SIOCSIFLINK 0x8911 /* set iface channel */ -#define SIOCGIFCONF 0x8912 /* get iface list */ -#define SIOCGIFFLAGS 0x8913 /* get flags */ -#define SIOCSIFFLAGS 0x8914 /* set flags */ -#define SIOCGIFADDR 0x8915 /* get PA address */ -#define SIOCSIFADDR 0x8916 /* set PA address */ -#define SIOCGIFDSTADDR 0x8917 /* get remote PA address */ -#define SIOCSIFDSTADDR 0x8918 /* set remote PA address */ -#define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ -#define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ -#define SIOCGIFNETMASK 0x891b /* get network PA mask */ -#define SIOCSIFNETMASK 0x891c /* set network PA mask */ -#define SIOCGIFMETRIC 0x891d /* get metric */ -#define SIOCSIFMETRIC 0x891e /* set metric */ -#define SIOCGIFMEM 0x891f /* get memory address (BSD) */ -#define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ -#define SIOCGIFMTU 0x8921 /* get MTU size */ -#define SIOCSIFMTU 0x8922 /* set MTU size */ -#define SIOCSIFNAME 0x8923 /* set interface name */ -#define SIOCSIFHWADDR 0x8924 /* set hardware address */ -#define SIOCGIFENCAP 0x8925 /* get/set encapsulations */ -#define SIOCSIFENCAP 0x8926 -#define SIOCGIFHWADDR 0x8927 /* Get hardware address */ -#define SIOCGIFSLAVE 0x8929 /* Driver slaving support */ -#define SIOCSIFSLAVE 0x8930 -#define SIOCADDMULTI 0x8931 /* Multicast address lists */ -#define SIOCDELMULTI 0x8932 -#define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */ -#define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */ -#define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */ -#define SIOCGIFPFLAGS 0x8935 -#define SIOCDIFADDR 0x8936 /* delete PA address */ -#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ -#define SIOCGIFCOUNT 0x8938 /* get number of devices */ - -#define SIOCGIFBR 0x8940 /* Bridging support */ -#define SIOCSIFBR 0x8941 /* Set bridging options */ - -#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ -#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ - - -/* ARP cache control calls. */ - /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ -#define SIOCDARP 0x8953 /* delete ARP table entry */ -#define SIOCGARP 0x8954 /* get ARP table entry */ -#define SIOCSARP 0x8955 /* set ARP table entry */ - -/* RARP cache control calls. */ -#define SIOCDRARP 0x8960 /* delete RARP table entry */ -#define SIOCGRARP 0x8961 /* get RARP table entry */ -#define SIOCSRARP 0x8962 /* set RARP table entry */ - -/* Driver configuration calls */ - -#define SIOCGIFMAP 0x8970 /* Get device parameters */ -#define SIOCSIFMAP 0x8971 /* Set device parameters */ - -/* DLCI configuration calls */ - -#define SIOCADDDLCI 0x8980 /* Create new DLCI device */ -#define SIOCDELDLCI 0x8981 /* Delete DLCI device */ - -/* Device private ioctl calls. */ - -/* These 16 ioctls are available to devices via the do_ioctl() device - vector. Each device should include this file and redefine these - names as their own. Because these are device dependent it is a good - idea _NOT_ to issue them to random objects and hope. */ - -#define SIOCDEVPRIVATE 0x89F0 /* to 89FF */ - -/* - * These 16 ioctl calls are protocol private - */ - -#define SIOCPROTOPRIVATE 0x89E0 /* to 89EF */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/ipc.h b/openflow/usr/include/arm-linux-gnueabihf/bits/ipc.h deleted file mode 100644 index f7e4d81..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/ipc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_IPC_H -# error "Never use directly; include instead." -#endif - -#include - -/* Mode bits for `msgget', `semget', and `shmget'. */ -#define IPC_CREAT 01000 /* Create key if key does not exist. */ -#define IPC_EXCL 02000 /* Fail if key exists. */ -#define IPC_NOWAIT 04000 /* Return error on wait. */ - -/* Control commands for `msgctl', `semctl', and `shmctl'. */ -#define IPC_RMID 0 /* Remove identifier. */ -#define IPC_SET 1 /* Set `ipc_perm' options. */ -#define IPC_STAT 2 /* Get `ipc_perm' options. */ -#ifdef __USE_GNU -# define IPC_INFO 3 /* See ipcs. */ -#endif - -/* Special key values. */ -#define IPC_PRIVATE ((__key_t) 0) /* Private key. */ - - -/* Data structure used to pass permission information to IPC operations. */ -struct ipc_perm - { - __key_t __key; /* Key. */ - __uid_t uid; /* Owner's user ID. */ - __gid_t gid; /* Owner's group ID. */ - __uid_t cuid; /* Creator's user ID. */ - __gid_t cgid; /* Creator's group ID. */ - unsigned short int mode; /* Read/write permission. */ - unsigned short int __pad1; - unsigned short int __seq; /* Sequence number. */ - unsigned short int __pad2; - __syscall_ulong_t __glibc_reserved1; - __syscall_ulong_t __glibc_reserved2; - }; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/ipctypes.h b/openflow/usr/include/arm-linux-gnueabihf/bits/ipctypes.h deleted file mode 100644 index bf791ce..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/ipctypes.h +++ /dev/null @@ -1,36 +0,0 @@ -/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. Generic. - Copyright (C) 2002-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * Never include directly. - */ - -#ifndef _BITS_IPCTYPES_H -#define _BITS_IPCTYPES_H 1 - -#include - -/* Used in `struct shmid_ds'. */ -# if __WORDSIZE == 32 -typedef unsigned short int __ipc_pid_t; -# else -typedef int __ipc_pid_t; -# endif - - -#endif /* bits/ipctypes.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/libio-ldbl.h b/openflow/usr/include/arm-linux-gnueabihf/bits/libio-ldbl.h deleted file mode 100644 index 15c5af9..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/libio-ldbl.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -mlong-double-64 compatibility mode for libio functions. - Copyright (C) 2006-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _IO_STDIO_H -# error "Never include directly; use instead." -#endif - -__LDBL_REDIR_DECL (_IO_vfscanf) -__LDBL_REDIR_DECL (_IO_vfprintf) diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/libm-simd-decl-stubs.h b/openflow/usr/include/arm-linux-gnueabihf/bits/libm-simd-decl-stubs.h deleted file mode 100644 index 541cb3f..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/libm-simd-decl-stubs.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Empty definitions required for __MATHCALL_VEC unfolding in mathcalls.h. - Copyright (C) 2014-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MATH_H -# error "Never include directly;\ - include instead." -#endif - -/* Needed definitions could be generated with: - for func in $(grep __MATHCALL_VEC math/bits/mathcalls.h |\ - sed -r "s|__MATHCALL_VEC.?\(||; s|,.*||"); do - echo "#define __DECL_SIMD_${func}"; - echo "#define __DECL_SIMD_${func}f"; - echo "#define __DECL_SIMD_${func}l"; - done - */ - -#ifndef _BITS_LIBM_SIMD_DECL_STUBS_H -#define _BITS_LIBM_SIMD_DECL_STUBS_H 1 - -#define __DECL_SIMD_cos -#define __DECL_SIMD_cosf -#define __DECL_SIMD_cosl - -#define __DECL_SIMD_sin -#define __DECL_SIMD_sinf -#define __DECL_SIMD_sinl - -#define __DECL_SIMD_sincos -#define __DECL_SIMD_sincosf -#define __DECL_SIMD_sincosl - -#define __DECL_SIMD_log -#define __DECL_SIMD_logf -#define __DECL_SIMD_logl - -#define __DECL_SIMD_exp -#define __DECL_SIMD_expf -#define __DECL_SIMD_expl - -#define __DECL_SIMD_pow -#define __DECL_SIMD_powf -#define __DECL_SIMD_powl -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/link.h b/openflow/usr/include/arm-linux-gnueabihf/bits/link.h deleted file mode 100644 index 6446dec..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/link.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (C) 2005-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _LINK_H -# error "Never include directly; use instead." -#endif - - -/* Registers for entry into PLT on ARM. */ -typedef struct La_arm_regs -{ - uint32_t lr_reg[4]; - uint32_t lr_sp; - uint32_t lr_lr; - /* Coprocessor registers used for argument passing. The data - stored here depends on the coprocessors available in the - system which are used for function calls in the current ABI. - VFP uses eight 64-bit registers, and iWMMXt uses ten. */ - uint32_t lr_coproc[42]; -} La_arm_regs; - -/* Return values for calls from PLT on ARM. */ -typedef struct La_arm_retval -{ - /* Up to four integer registers can be used for a return value in - some ABIs (APCS complex long double). */ - uint32_t lrv_reg[4]; - - /* Any coprocessor registers which might be used to return values - in the current ABI. */ - uint32_t lrv_coproc[12]; -} La_arm_retval; - - -__BEGIN_DECLS - -extern Elf32_Addr la_arm_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx, - uintptr_t *__refcook, - uintptr_t *__defcook, - La_arm_regs *__regs, - unsigned int *__flags, - const char *__symname, - long int *__framesizep); -extern unsigned int la_arm_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx, - uintptr_t *__refcook, - uintptr_t *__defcook, - const La_arm_regs *__inregs, - La_arm_retval *__outregs, - const char *__symname); - -__END_DECLS diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/local_lim.h b/openflow/usr/include/arm-linux-gnueabihf/bits/local_lim.h deleted file mode 100644 index 3f353f7..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/local_lim.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. Linux version. - Copyright (C) 1993-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, see . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. We are free to choose a reasonable value. */ -#define PTHREAD_STACK_MIN 16384 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/locale.h b/openflow/usr/include/arm-linux-gnueabihf/bits/locale.h deleted file mode 100644 index d5fb290..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/locale.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Definition of locale category symbol values. - Copyright (C) 2001-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _LOCALE_H && !defined _LANGINFO_H -# error "Never use directly; include instead." -#endif - -#ifndef _BITS_LOCALE_H -#define _BITS_LOCALE_H 1 - -#define __LC_CTYPE 0 -#define __LC_NUMERIC 1 -#define __LC_TIME 2 -#define __LC_COLLATE 3 -#define __LC_MONETARY 4 -#define __LC_MESSAGES 5 -#define __LC_ALL 6 -#define __LC_PAPER 7 -#define __LC_NAME 8 -#define __LC_ADDRESS 9 -#define __LC_TELEPHONE 10 -#define __LC_MEASUREMENT 11 -#define __LC_IDENTIFICATION 12 - -#endif /* bits/locale.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/math-finite.h b/openflow/usr/include/arm-linux-gnueabihf/bits/math-finite.h deleted file mode 100644 index adaad0e..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/math-finite.h +++ /dev/null @@ -1,506 +0,0 @@ -/* Entry points to finite-math-only compiler runs. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MATH_H -# error "Never use directly; include instead." -#endif - -/* acos. */ -extern double __REDIRECT_NTH (acos, (double), __acos_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (acosf, (float), __acosf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (acosl, (long double), __acos_finite); -# else -extern long double __REDIRECT_NTH (acosl, (long double), __acosl_finite); -# endif -# endif -#endif - -#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -/* acosh. */ -extern double __REDIRECT_NTH (acosh, (double), __acosh_finite); -#endif -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (acoshf, (float), __acoshf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (acoshl, (long double), __acosh_finite); -# else -extern long double __REDIRECT_NTH (acoshl, (long double), __acoshl_finite); -# endif -# endif -#endif - -/* asin. */ -extern double __REDIRECT_NTH (asin, (double), __asin_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (asinf, (float), __asinf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (asinl, (long double), __asin_finite); -# else -extern long double __REDIRECT_NTH (asinl, (long double), __asinl_finite); -# endif -# endif -#endif - -/* atan2. */ -extern double __REDIRECT_NTH (atan2, (double, double), __atan2_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (atan2f, (float, float), __atan2f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (atan2l, (long double, long double), - __atan2_finite); -# else -extern long double __REDIRECT_NTH (atan2l, (long double, long double), - __atan2l_finite); -# endif -# endif -#endif - -#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -/* atanh. */ -extern double __REDIRECT_NTH (atanh, (double), __atanh_finite); -#endif -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (atanhf, (float), __atanhf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (atanhl, (long double), __atanh_finite); -# else -extern long double __REDIRECT_NTH (atanhl, (long double), __atanhl_finite); -# endif -# endif -#endif - -/* cosh. */ -extern double __REDIRECT_NTH (cosh, (double), __cosh_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (coshf, (float), __coshf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (coshl, (long double), __cosh_finite); -# else -extern long double __REDIRECT_NTH (coshl, (long double), __coshl_finite); -# endif -# endif -#endif - -/* exp. */ -extern double __REDIRECT_NTH (exp, (double), __exp_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (expf, (float), __expf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (expl, (long double), __exp_finite); -# else -extern long double __REDIRECT_NTH (expl, (long double), __expl_finite); -# endif -# endif -#endif - -#ifdef __USE_GNU -/* exp10. */ -extern double __REDIRECT_NTH (exp10, (double), __exp10_finite); -extern float __REDIRECT_NTH (exp10f, (float), __exp10f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (exp10l, (long double), __exp10_finite); -# else -extern long double __REDIRECT_NTH (exp10l, (long double), __exp10l_finite); -# endif -# endif - -/* pow10. */ -extern double __REDIRECT_NTH (pow10, (double), __exp10_finite); -extern float __REDIRECT_NTH (pow10f, (float), __exp10f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (pow10l, (long double), __exp10_finite); -# else -extern long double __REDIRECT_NTH (pow10l, (long double), __exp10l_finite); -# endif -# endif -#endif - -#ifdef __USE_ISOC99 -/* exp2. */ -extern double __REDIRECT_NTH (exp2, (double), __exp2_finite); -extern float __REDIRECT_NTH (exp2f, (float), __exp2f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (exp2l, (long double), __exp2_finite); -# else -extern long double __REDIRECT_NTH (exp2l, (long double), __exp2l_finite); -# endif -# endif -#endif - -/* fmod. */ -extern double __REDIRECT_NTH (fmod, (double, double), __fmod_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (fmodf, (float, float), __fmodf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (fmodl, (long double, long double), - __fmod_finite); -# else -extern long double __REDIRECT_NTH (fmodl, (long double, long double), - __fmodl_finite); -# endif -# endif -#endif - -#if defined __USE_XOPEN || defined __USE_ISOC99 -/* hypot. */ -extern double __REDIRECT_NTH (hypot, (double, double), __hypot_finite); -#endif -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (hypotf, (float, float), __hypotf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (hypotl, (long double, long double), - __hypot_finite); -# else -extern long double __REDIRECT_NTH (hypotl, (long double, long double), - __hypotl_finite); -# endif -# endif -#endif - -#if defined __USE_MISC || defined __USE_XOPEN -/* j0. */ -extern double __REDIRECT_NTH (j0, (double), __j0_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (j0f, (float), __j0f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (j0l, (long double), __j0_finite); -# else -extern long double __REDIRECT_NTH (j0l, (long double), __j0l_finite); -# endif -# endif -#endif - -#if defined __USE_MISC || defined __USE_XOPEN -/* y0. */ -extern double __REDIRECT_NTH (y0, (double), __y0_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (y0f, (float), __y0f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (y0l, (long double), __y0_finite); -# else -extern long double __REDIRECT_NTH (y0l, (long double), __y0l_finite); -# endif -# endif -#endif - -#if defined __USE_MISC || defined __USE_XOPEN -/* j1. */ -extern double __REDIRECT_NTH (j1, (double), __j1_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (j1f, (float), __j1f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (j1l, (long double), __j1_finite); -# else -extern long double __REDIRECT_NTH (j1l, (long double), __j1l_finite); -# endif -# endif -#endif - -#if defined __USE_MISC || defined __USE_XOPEN -/* y1. */ -extern double __REDIRECT_NTH (y1, (double), __y1_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (y1f, (float), __y1f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (y1l, (long double), __y1_finite); -# else -extern long double __REDIRECT_NTH (y1l, (long double), __y1l_finite); -# endif -# endif -#endif - -#if defined __USE_MISC || defined __USE_XOPEN -/* jn. */ -extern double __REDIRECT_NTH (jn, (int, double), __jn_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (jnf, (int, float), __jnf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (jnl, (int, long double), __jn_finite); -# else -extern long double __REDIRECT_NTH (jnl, (int, long double), __jnl_finite); -# endif -# endif -#endif - -#if defined __USE_MISC || defined __USE_XOPEN -/* yn. */ -extern double __REDIRECT_NTH (yn, (int, double), __yn_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (ynf, (int, float), __ynf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (ynl, (int, long double), __yn_finite); -# else -extern long double __REDIRECT_NTH (ynl, (int, long double), __ynl_finite); -# endif -# endif -#endif - -#ifdef __USE_MISC -/* lgamma_r. */ -extern double __REDIRECT_NTH (lgamma_r, (double, int *), __lgamma_r_finite); -# ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (lgammaf_r, (float, int *), __lgammaf_r_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (lgammal_r, (long double, int *), - __lgamma_r_finite); -# else -extern long double __REDIRECT_NTH (lgammal_r, (long double, int *), - __lgammal_r_finite); -# endif -# endif -# endif -#endif - -extern double __lgamma_r_finite (double, int *); -extern float __lgammaf_r_finite (float, int *); -#ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (__lgammal_r_finite, (long double, int *), - __lgamma_r_finite); -#else -extern long double __lgammal_r_finite (long double, int *); -#endif - -#if ((defined __USE_XOPEN || defined __USE_ISOC99) \ - && defined __extern_always_inline) -/* lgamma. */ -__extern_always_inline double __NTH (lgamma (double __d)) -{ -# if defined __USE_MISC || defined __USE_XOPEN - return __lgamma_r_finite (__d, &signgam); -# else - int __local_signgam = 0; - return __lgamma_r_finite (__d, &__local_signgam); -# endif -} -#endif -#if defined __USE_ISOC99 && defined __extern_always_inline -__extern_always_inline float __NTH (lgammaf (float __d)) -{ -# if defined __USE_MISC || defined __USE_XOPEN - return __lgammaf_r_finite (__d, &signgam); -# else - int __local_signgam = 0; - return __lgammaf_r_finite (__d, &__local_signgam); -# endif -} -# ifdef __MATH_DECLARE_LDOUBLE -__extern_always_inline long double __NTH (lgammal (long double __d)) -{ -# if defined __USE_MISC || defined __USE_XOPEN - return __lgammal_r_finite (__d, &signgam); -# else - int __local_signgam = 0; - return __lgammal_r_finite (__d, &__local_signgam); -# endif -} -# endif -#endif - -#if ((defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)) \ - && defined __extern_always_inline) -/* gamma. */ -__extern_always_inline double __NTH (gamma (double __d)) -{ - return __lgamma_r_finite (__d, &signgam); -} -# ifdef __USE_ISOC99 -__extern_always_inline float __NTH (gammaf (float __d)) -{ - return __lgammaf_r_finite (__d, &signgam); -} -# ifdef __MATH_DECLARE_LDOUBLE -__extern_always_inline long double __NTH (gammal (long double __d)) -{ - return __lgammal_r_finite (__d, &signgam); -} -# endif -# endif -#endif - -/* log. */ -extern double __REDIRECT_NTH (log, (double), __log_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (logf, (float), __logf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (logl, (long double), __log_finite); -# else -extern long double __REDIRECT_NTH (logl, (long double), __logl_finite); -# endif -# endif -#endif - -/* log10. */ -extern double __REDIRECT_NTH (log10, (double), __log10_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (log10f, (float), __log10f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (log10l, (long double), __log10_finite); -# else -extern long double __REDIRECT_NTH (log10l, (long double), __log10l_finite); -# endif -# endif -#endif - -#ifdef __USE_ISOC99 -/* log2. */ -extern double __REDIRECT_NTH (log2, (double), __log2_finite); -extern float __REDIRECT_NTH (log2f, (float), __log2f_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (log2l, (long double), __log2_finite); -# else -extern long double __REDIRECT_NTH (log2l, (long double), __log2l_finite); -# endif -# endif -#endif - -/* pow. */ -extern double __REDIRECT_NTH (pow, (double, double), __pow_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (powf, (float, float), __powf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (powl, (long double, long double), - __pow_finite); -# else -extern long double __REDIRECT_NTH (powl, (long double, long double), - __powl_finite); -# endif -# endif -#endif - -#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -/* remainder. */ -extern double __REDIRECT_NTH (remainder, (double, double), __remainder_finite); -#endif -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (remainderf, (float, float), __remainderf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (remainderl, (long double, long double), - __remainder_finite); -# else -extern long double __REDIRECT_NTH (remainderl, (long double, long double), - __remainderl_finite); -# endif -# endif -#endif - -#if (defined __USE_MISC \ - || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8)) -/* scalb. */ -extern double __REDIRECT_NTH (scalb, (double, double), __scalb_finite); -#endif -#if defined __USE_MISC && defined __USE_ISOC99 -extern float __REDIRECT_NTH (scalbf, (float, float), __scalbf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (scalbl, (long double, long double), - __scalb_finite); -# else -extern long double __REDIRECT_NTH (scalbl, (long double, long double), - __scalbl_finite); -# endif -# endif -#endif - -/* sinh. */ -extern double __REDIRECT_NTH (sinh, (double), __sinh_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (sinhf, (float), __sinhf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (sinhl, (long double), __sinh_finite); -# else -extern long double __REDIRECT_NTH (sinhl, (long double), __sinhl_finite); -# endif -# endif -#endif - -/* sqrt. */ -extern double __REDIRECT_NTH (sqrt, (double), __sqrt_finite); -#ifdef __USE_ISOC99 -extern float __REDIRECT_NTH (sqrtf, (float), __sqrtf_finite); -# ifdef __MATH_DECLARE_LDOUBLE -# ifdef __NO_LONG_DOUBLE_MATH -extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrt_finite); -# else -extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrtl_finite); -# endif -# endif -#endif - -#if defined __USE_ISOC99 && defined __extern_always_inline -/* tgamma. */ -extern double __gamma_r_finite (double, int *); -__extern_always_inline double __NTH (tgamma (double __d)) -{ - int __local_signgam = 0; - double __res = __gamma_r_finite (__d, &__local_signgam); - return __local_signgam < 0 ? -__res : __res; -} -extern float __gammaf_r_finite (float, int *); -__extern_always_inline float __NTH (tgammaf (float __d)) -{ - int __local_signgam = 0; - float __res = __gammaf_r_finite (__d, &__local_signgam); - return __local_signgam < 0 ? -__res : __res; -} -# ifdef __MATH_DECLARE_LDOUBLE -extern long double __gammal_r_finite (long double, int *); -__extern_always_inline long double __NTH (tgammal (long double __d)) -{ - int __local_signgam = 0; -# ifdef __NO_LONG_DOUBLE_MATH - long double __res = __gamma_r_finite (__d, &__local_signgam); -# else - long double __res = __gammal_r_finite (__d, &__local_signgam); -# endif - return __local_signgam < 0 ? -__res : __res; -} -# endif -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/math-vector.h b/openflow/usr/include/arm-linux-gnueabihf/bits/math-vector.h deleted file mode 100644 index 975724a..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/math-vector.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Platform-specific SIMD declarations of math functions. - Copyright (C) 2014-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MATH_H -# error "Never include directly;\ - include instead." -#endif - -/* Get default empty definitions required for __MATHCALL_VEC unfolding. - Plaform-specific analogue of this header should redefine them with specific - SIMD declarations. */ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/mathcalls.h b/openflow/usr/include/arm-linux-gnueabihf/bits/mathcalls.h deleted file mode 100644 index 9a7b3f0..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/mathcalls.h +++ /dev/null @@ -1,384 +0,0 @@ -/* Prototype declarations for math functions; helper file for . - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* NOTE: Because of the special way this file is used by , this - file must NOT be protected from multiple inclusion as header files - usually are. - - This file provides prototype declarations for the math functions. - Most functions are declared using the macro: - - __MATHCALL (NAME,[_r], (ARGS...)); - - This means there is a function `NAME' returning `double' and a function - `NAMEf' returning `float'. Each place `_Mdouble_' appears in the - prototype, that is actually `double' in the prototype for `NAME' and - `float' in the prototype for `NAMEf'. Reentrant variant functions are - called `NAME_r' and `NAMEf_r'. - - Functions returning other types like `int' are declared using the macro: - - __MATHDECL (TYPE, NAME,[_r], (ARGS...)); - - This is just like __MATHCALL but for a function returning `TYPE' - instead of `_Mdouble_'. In all of these cases, there is still - both a `NAME' and a `NAMEf' that takes `float' arguments. - - Note that there must be no whitespace before the argument passed for - NAME, to make token pasting work with -traditional. */ - -#ifndef _MATH_H -# error "Never include directly; include instead." -#endif - - -/* Trigonometric functions. */ - -_Mdouble_BEGIN_NAMESPACE -/* Arc cosine of X. */ -__MATHCALL (acos,, (_Mdouble_ __x)); -/* Arc sine of X. */ -__MATHCALL (asin,, (_Mdouble_ __x)); -/* Arc tangent of X. */ -__MATHCALL (atan,, (_Mdouble_ __x)); -/* Arc tangent of Y/X. */ -__MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x)); - -/* Cosine of X. */ -__MATHCALL_VEC (cos,, (_Mdouble_ __x)); -/* Sine of X. */ -__MATHCALL_VEC (sin,, (_Mdouble_ __x)); -/* Tangent of X. */ -__MATHCALL (tan,, (_Mdouble_ __x)); - -/* Hyperbolic functions. */ - -/* Hyperbolic cosine of X. */ -__MATHCALL (cosh,, (_Mdouble_ __x)); -/* Hyperbolic sine of X. */ -__MATHCALL (sinh,, (_Mdouble_ __x)); -/* Hyperbolic tangent of X. */ -__MATHCALL (tanh,, (_Mdouble_ __x)); -_Mdouble_END_NAMESPACE - -#ifdef __USE_GNU -/* Cosine and sine of X. */ -__MATHDECL_VEC (void,sincos,, - (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx)); -#endif - -#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -__BEGIN_NAMESPACE_C99 -/* Hyperbolic arc cosine of X. */ -__MATHCALL (acosh,, (_Mdouble_ __x)); -/* Hyperbolic arc sine of X. */ -__MATHCALL (asinh,, (_Mdouble_ __x)); -/* Hyperbolic arc tangent of X. */ -__MATHCALL (atanh,, (_Mdouble_ __x)); -__END_NAMESPACE_C99 -#endif - -/* Exponential and logarithmic functions. */ - -_Mdouble_BEGIN_NAMESPACE -/* Exponential function of X. */ -__MATHCALL_VEC (exp,, (_Mdouble_ __x)); - -/* Break VALUE into a normalized fraction and an integral power of 2. */ -__MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent)); - -/* X times (two to the EXP power). */ -__MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent)); - -/* Natural logarithm of X. */ -__MATHCALL_VEC (log,, (_Mdouble_ __x)); - -/* Base-ten logarithm of X. */ -__MATHCALL (log10,, (_Mdouble_ __x)); - -/* Break VALUE into integral and fractional parts. */ -__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __nonnull ((2)); -_Mdouble_END_NAMESPACE - -#ifdef __USE_GNU -/* A function missing in all standards: compute exponent to base ten. */ -__MATHCALL (exp10,, (_Mdouble_ __x)); -/* Another name occasionally used. */ -__MATHCALL (pow10,, (_Mdouble_ __x)); -#endif - -#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -__BEGIN_NAMESPACE_C99 -/* Return exp(X) - 1. */ -__MATHCALL (expm1,, (_Mdouble_ __x)); - -/* Return log(1 + X). */ -__MATHCALL (log1p,, (_Mdouble_ __x)); - -/* Return the base 2 signed integral exponent of X. */ -__MATHCALL (logb,, (_Mdouble_ __x)); -__END_NAMESPACE_C99 -#endif - -#ifdef __USE_ISOC99 -__BEGIN_NAMESPACE_C99 -/* Compute base-2 exponential of X. */ -__MATHCALL (exp2,, (_Mdouble_ __x)); - -/* Compute base-2 logarithm of X. */ -__MATHCALL (log2,, (_Mdouble_ __x)); -__END_NAMESPACE_C99 -#endif - - -/* Power functions. */ - -_Mdouble_BEGIN_NAMESPACE -/* Return X to the Y power. */ -__MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); - -/* Return the square root of X. */ -__MATHCALL (sqrt,, (_Mdouble_ __x)); -_Mdouble_END_NAMESPACE - -#if defined __USE_XOPEN || defined __USE_ISOC99 -__BEGIN_NAMESPACE_C99 -/* Return `sqrt(X*X + Y*Y)'. */ -__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y)); -__END_NAMESPACE_C99 -#endif - -#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -__BEGIN_NAMESPACE_C99 -/* Return the cube root of X. */ -__MATHCALL (cbrt,, (_Mdouble_ __x)); -__END_NAMESPACE_C99 -#endif - - -/* Nearest integer, absolute value, and remainder functions. */ - -_Mdouble_BEGIN_NAMESPACE -/* Smallest integral value not less than X. */ -__MATHCALLX (ceil,, (_Mdouble_ __x), (__const__)); - -/* Absolute value of X. */ -__MATHCALLX (fabs,, (_Mdouble_ __x), (__const__)); - -/* Largest integer not greater than X. */ -__MATHCALLX (floor,, (_Mdouble_ __x), (__const__)); - -/* Floating-point modulo remainder of X/Y. */ -__MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y)); - - -/* Return 0 if VALUE is finite or NaN, +1 if it - is +Infinity, -1 if it is -Infinity. */ -__MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); - -/* Return nonzero if VALUE is finite and not NaN. */ -__MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); -_Mdouble_END_NAMESPACE - -#ifdef __USE_MISC -# if (!defined __cplusplus \ - || __cplusplus < 201103L /* isinf conflicts with C++11. */ \ - || __MATH_DECLARING_DOUBLE == 0) /* isinff or isinfl don't. */ -/* Return 0 if VALUE is finite or NaN, +1 if it - is +Infinity, -1 if it is -Infinity. */ -__MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); -# endif - -/* Return nonzero if VALUE is finite and not NaN. */ -__MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); - -/* Return the remainder of X/Y. */ -__MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y)); - - -/* Return the fractional part of X after dividing out `ilogb (X)'. */ -__MATHCALL (significand,, (_Mdouble_ __x)); -#endif /* Use misc. */ - -#ifdef __USE_ISOC99 -__BEGIN_NAMESPACE_C99 -/* Return X with its signed changed to Y's. */ -__MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); -__END_NAMESPACE_C99 -#endif - -#ifdef __USE_ISOC99 -__BEGIN_NAMESPACE_C99 -/* Return representation of qNaN for double type. */ -__MATHCALLX (nan,, (const char *__tagb), (__const__)); -__END_NAMESPACE_C99 -#endif - - -/* Return nonzero if VALUE is not a number. */ -__MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); - -#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) -# if (!defined __cplusplus \ - || __cplusplus < 201103L /* isnan conflicts with C++11. */ \ - || __MATH_DECLARING_DOUBLE == 0) /* isnanf or isnanl don't. */ -/* Return nonzero if VALUE is not a number. */ -__MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); -# endif -#endif - -#if defined __USE_MISC || (defined __USE_XOPEN && __MATH_DECLARING_DOUBLE) -/* Bessel functions. */ -__MATHCALL (j0,, (_Mdouble_)); -__MATHCALL (j1,, (_Mdouble_)); -__MATHCALL (jn,, (int, _Mdouble_)); -__MATHCALL (y0,, (_Mdouble_)); -__MATHCALL (y1,, (_Mdouble_)); -__MATHCALL (yn,, (int, _Mdouble_)); -#endif - - -#if defined __USE_XOPEN || defined __USE_ISOC99 -__BEGIN_NAMESPACE_C99 -/* Error and gamma functions. */ -__MATHCALL (erf,, (_Mdouble_)); -__MATHCALL (erfc,, (_Mdouble_)); -__MATHCALL (lgamma,, (_Mdouble_)); -__END_NAMESPACE_C99 -#endif - -#ifdef __USE_ISOC99 -__BEGIN_NAMESPACE_C99 -/* True gamma function. */ -__MATHCALL (tgamma,, (_Mdouble_)); -__END_NAMESPACE_C99 -#endif - -#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) -/* Obsolete alias for `lgamma'. */ -__MATHCALL (gamma,, (_Mdouble_)); -#endif - -#ifdef __USE_MISC -/* Reentrant version of lgamma. This function uses the global variable - `signgam'. The reentrant version instead takes a pointer and stores - the value through it. */ -__MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp)); -#endif - - -#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -__BEGIN_NAMESPACE_C99 -/* Return the integer nearest X in the direction of the - prevailing rounding mode. */ -__MATHCALL (rint,, (_Mdouble_ __x)); - -/* Return X + epsilon if X < Y, X - epsilon if X > Y. */ -__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); -# if defined __USE_ISOC99 && !defined __LDBL_COMPAT -__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__)); -# endif - -/* Return the remainder of integer divison X / Y with infinite precision. */ -__MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y)); - -# ifdef __USE_ISOC99 -/* Return X times (2 to the Nth power). */ -__MATHCALL (scalbn,, (_Mdouble_ __x, int __n)); -# endif - -/* Return the binary exponent of X, which must be nonzero. */ -__MATHDECL (int,ilogb,, (_Mdouble_ __x)); -#endif - -#ifdef __USE_ISOC99 -/* Return X times (2 to the Nth power). */ -__MATHCALL (scalbln,, (_Mdouble_ __x, long int __n)); - -/* Round X to integral value in floating-point format using current - rounding direction, but do not raise inexact exception. */ -__MATHCALL (nearbyint,, (_Mdouble_ __x)); - -/* Round X to nearest integral value, rounding halfway cases away from - zero. */ -__MATHCALLX (round,, (_Mdouble_ __x), (__const__)); - -/* Round X to the integral value in floating-point format nearest but - not larger in magnitude. */ -__MATHCALLX (trunc,, (_Mdouble_ __x), (__const__)); - -/* Compute remainder of X and Y and put in *QUO a value with sign of x/y - and magnitude congruent `mod 2^n' to the magnitude of the integral - quotient x/y, with n >= 3. */ -__MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo)); - - -/* Conversion functions. */ - -/* Round X to nearest integral value according to current rounding - direction. */ -__MATHDECL (long int,lrint,, (_Mdouble_ __x)); -__extension__ -__MATHDECL (long long int,llrint,, (_Mdouble_ __x)); - -/* Round X to nearest integral value, rounding halfway cases away from - zero. */ -__MATHDECL (long int,lround,, (_Mdouble_ __x)); -__extension__ -__MATHDECL (long long int,llround,, (_Mdouble_ __x)); - - -/* Return positive difference between X and Y. */ -__MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y)); - -/* Return maximum numeric value from X and Y. */ -__MATHCALLX (fmax,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); - -/* Return minimum numeric value from X and Y. */ -__MATHCALLX (fmin,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); - - -/* Classify given number. */ -__MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value)) - __attribute__ ((__const__)); - -/* Test for negative number. */ -__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value)) - __attribute__ ((__const__)); - - -/* Multiply-add function computed as a ternary operation. */ -__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z)); -#endif /* Use ISO C99. */ - -#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -__END_NAMESPACE_C99 -#endif - -#ifdef __USE_GNU -/* Test for signaling NaN. */ -__MATHDECL_1 (int, __issignaling,, (_Mdouble_ __value)) - __attribute__ ((__const__)); -#endif - -#if defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \ - && __MATH_DECLARING_DOUBLE \ - && !defined __USE_XOPEN2K8) -/* Return X times (2 to the Nth power). */ -__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n)); -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/mathdef.h b/openflow/usr/include/arm-linux-gnueabihf/bits/mathdef.h deleted file mode 100644 index ae0bcb7..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/mathdef.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 1999-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#if !defined _MATH_H && !defined _COMPLEX_H -# error "Never use directly; include instead" -#endif - -#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF -# define _MATH_H_MATHDEF 1 - -/* GCC does not promote `float' values to `double'. */ -typedef float float_t; /* `float' expressions are evaluated as - `float'. */ -typedef double double_t; /* `double' expressions are evaluated as - `double'. */ - -/* The values returned by `ilogb' for 0 and NaN respectively. */ -# define FP_ILOGB0 (-2147483647) -# define FP_ILOGBNAN (2147483647) - -/* The GCC 4.6 compiler will define __FP_FAST_FMA{,F,L} if the fma{,f,l} - builtins are supported. */ -# ifdef __FP_FAST_FMA -# define FP_FAST_FMA 1 -# endif - -# ifdef __FP_FAST_FMAF -# define FP_FAST_FMAF 1 -# endif - -# ifdef __FP_FAST_FMAL -# define FP_FAST_FMAL 1 -# endif - -#endif /* ISO C99 */ - -#ifndef __NO_LONG_DOUBLE_MATH -/* Signal that we do not really have a `long double'. This disables the - declaration of all the `long double' function variants. */ -# define __NO_LONG_DOUBLE_MATH 1 -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/mathinline.h b/openflow/usr/include/arm-linux-gnueabihf/bits/mathinline.h deleted file mode 100644 index 02ec21b..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/mathinline.h +++ /dev/null @@ -1,12 +0,0 @@ -/* This file should provide inline versions of math functions. - - Surround GCC-specific parts with #ifdef __GNUC__, and use `__extern_inline'. - - This file should define __MATH_INLINES if functions are actually defined as - inlines. */ - -#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ - -/* Here goes the real code. */ - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/mman-linux.h b/openflow/usr/include/arm-linux-gnueabihf/bits/mman-linux.h deleted file mode 100644 index dbb994b..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/mman-linux.h +++ /dev/null @@ -1,113 +0,0 @@ -/* Definitions for POSIX memory map interface. Linux generic version. - Copyright (C) 2001-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_MMAN_H -# error "Never use directly; include instead." -#endif - -/* The following definitions basically come from the kernel headers. - But the kernel header is not namespace clean. - - This file is also used by some non-Linux configurations of the - GNU C Library, for other systems that use these same bit values. */ - - -/* Protections are chosen from these bits, OR'd together. The - implementation does not necessarily support PROT_EXEC or PROT_WRITE - without PROT_READ. The only guarantees are that no writing will be - allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ - -#define PROT_READ 0x1 /* Page can be read. */ -#define PROT_WRITE 0x2 /* Page can be written. */ -#define PROT_EXEC 0x4 /* Page can be executed. */ -#define PROT_NONE 0x0 /* Page can not be accessed. */ -#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of - growsdown vma (mprotect only). */ -#define PROT_GROWSUP 0x02000000 /* Extend change to start of - growsup vma (mprotect only). */ - -/* Sharing types (must choose one and only one of these). */ -#define MAP_SHARED 0x01 /* Share changes. */ -#define MAP_PRIVATE 0x02 /* Changes are private. */ -#ifdef __USE_MISC -# define MAP_TYPE 0x0f /* Mask for type of mapping. */ -#endif - -/* Other flags. */ -#define MAP_FIXED 0x10 /* Interpret addr exactly. */ -#ifdef __USE_MISC -# define MAP_FILE 0 -# ifdef __MAP_ANONYMOUS -# define MAP_ANONYMOUS __MAP_ANONYMOUS /* Don't use a file. */ -# else -# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ -# endif -# define MAP_ANON MAP_ANONYMOUS -/* When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. */ -# define MAP_HUGE_SHIFT 26 -# define MAP_HUGE_MASK 0x3f -#endif - -/* Flags to `msync'. */ -#define MS_ASYNC 1 /* Sync memory asynchronously. */ -#define MS_SYNC 4 /* Synchronous memory sync. */ -#define MS_INVALIDATE 2 /* Invalidate the caches. */ - -/* Flags for `mremap'. */ -#ifdef __USE_GNU -# define MREMAP_MAYMOVE 1 -# define MREMAP_FIXED 2 -#endif - -/* Advice to `madvise'. */ -#ifdef __USE_MISC -# define MADV_NORMAL 0 /* No further special treatment. */ -# define MADV_RANDOM 1 /* Expect random page references. */ -# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ -# define MADV_WILLNEED 3 /* Will need these pages. */ -# define MADV_DONTNEED 4 /* Don't need these pages. */ -# define MADV_REMOVE 9 /* Remove these pages and resources. */ -# define MADV_DONTFORK 10 /* Do not inherit across fork. */ -# define MADV_DOFORK 11 /* Do inherit across fork. */ -# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */ -# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */ -# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */ -# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */ -# define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, - overrides the coredump filter bits. */ -# define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */ -# define MADV_HWPOISON 100 /* Poison a page for testing. */ -#endif - -/* The POSIX people had to invent similar names for the same things. */ -#ifdef __USE_XOPEN2K -# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ -# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ -# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ -# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ -# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ -#endif - -/* Flags for `mlockall'. */ -#ifndef MCL_CURRENT -# define MCL_CURRENT 1 /* Lock all currently mapped pages. */ -# define MCL_FUTURE 2 /* Lock all additions to address - space. */ -# define MCL_ONFAULT 4 /* Lock all pages that are - faulted in. */ -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/mman.h b/openflow/usr/include/arm-linux-gnueabihf/bits/mman.h deleted file mode 100644 index 8062651..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/mman.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Definitions for POSIX memory map interface. Linux/ARM version. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _SYS_MMAN_H -# error "Never use directly; include instead." -#endif - -/* The following definitions basically come from the kernel headers. - But the kernel header is not namespace clean. */ - -/* These are Linux-specific. */ -#ifdef __USE_MISC -# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ -# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ -# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ -# define MAP_LOCKED 0x02000 /* Lock the mapping. */ -# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ -# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ -# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ -# define MAP_STACK 0x20000 /* Allocation is for a stack. */ -# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ -#endif - -/* Include generic Linux declarations. */ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/monetary-ldbl.h b/openflow/usr/include/arm-linux-gnueabihf/bits/monetary-ldbl.h deleted file mode 100644 index 3718d10..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/monetary-ldbl.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -mlong-double-64 compatibility mode for monetary functions. - Copyright (C) 2006-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MONETARY_H -# error "Never include directly; use instead." -#endif - -__LDBL_REDIR_DECL (strfmon) - -#ifdef __USE_GNU -__LDBL_REDIR_DECL (strfmon_l) -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/mqueue.h b/openflow/usr/include/arm-linux-gnueabihf/bits/mqueue.h deleted file mode 100644 index abe7b64..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/mqueue.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MQUEUE_H -# error "Never use directly; include instead." -#endif - -#include - -typedef int mqd_t; - -struct mq_attr -{ - __syscall_slong_t mq_flags; /* Message queue flags. */ - __syscall_slong_t mq_maxmsg; /* Maximum number of messages. */ - __syscall_slong_t mq_msgsize; /* Maximum message size. */ - __syscall_slong_t mq_curmsgs; /* Number of messages currently queued. */ - __syscall_slong_t __pad[4]; -}; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/mqueue2.h b/openflow/usr/include/arm-linux-gnueabihf/bits/mqueue2.h deleted file mode 100644 index 712c8e2..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/mqueue2.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Checking macros for mq functions. - Copyright (C) 2007-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _FCNTL_H -# error "Never include directly; use instead." -#endif - -/* Check that calls to mq_open with O_CREAT set have an appropriate third and fourth - parameter. */ -extern mqd_t mq_open (const char *__name, int __oflag, ...) - __THROW __nonnull ((1)); -extern mqd_t __mq_open_2 (const char *__name, int __oflag) - __THROW __nonnull ((1)); -extern mqd_t __REDIRECT_NTH (__mq_open_alias, (const char *__name, - int __oflag, ...), mq_open) - __nonnull ((1)); -__errordecl (__mq_open_wrong_number_of_args, - "mq_open can be called either with 2 or 4 arguments"); -__errordecl (__mq_open_missing_mode_and_attr, - "mq_open with O_CREAT in second argument needs 4 arguments"); - -__fortify_function mqd_t -__NTH (mq_open (const char *__name, int __oflag, ...)) -{ - if (__va_arg_pack_len () != 0 && __va_arg_pack_len () != 2) - __mq_open_wrong_number_of_args (); - - if (__builtin_constant_p (__oflag)) - { - if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () == 0) - { - __mq_open_missing_mode_and_attr (); - return __mq_open_2 (__name, __oflag); - } - return __mq_open_alias (__name, __oflag, __va_arg_pack ()); - } - - if (__va_arg_pack_len () == 0) - return __mq_open_2 (__name, __oflag); - - return __mq_open_alias (__name, __oflag, __va_arg_pack ()); -} diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/msq.h b/openflow/usr/include/arm-linux-gnueabihf/bits/msq.h deleted file mode 100644 index 6fe4e59..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/msq.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_MSG_H -# error "Never use directly; include instead." -#endif - -#include - -/* Define options for message queue functions. */ -#define MSG_NOERROR 010000 /* no error if message is too big */ -#ifdef __USE_GNU -# define MSG_EXCEPT 020000 /* recv any msg except of specified type */ -# define MSG_COPY 040000 /* copy (not remove) all queue messages */ -#endif - -/* Types used in the structure definition. */ -typedef unsigned long int msgqnum_t; -typedef unsigned long int msglen_t; - - -/* Structure of record for one message inside the kernel. - The type `struct msg' is opaque. */ -struct msqid_ds -{ - struct ipc_perm msg_perm; /* structure describing operation permission */ - __time_t msg_stime; /* time of last msgsnd command */ - unsigned long int __glibc_reserved1; - __time_t msg_rtime; /* time of last msgrcv command */ - unsigned long int __glibc_reserved2; - __time_t msg_ctime; /* time of last change */ - unsigned long int __glibc_reserved3; - unsigned long int __msg_cbytes; /* current number of bytes on queue */ - msgqnum_t msg_qnum; /* number of messages currently on queue */ - msglen_t msg_qbytes; /* max number of bytes allowed on queue */ - __pid_t msg_lspid; /* pid of last msgsnd() */ - __pid_t msg_lrpid; /* pid of last msgrcv() */ - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; -}; - -#ifdef __USE_MISC - -# define msg_cbytes __msg_cbytes - -/* ipcs ctl commands */ -# define MSG_STAT 11 -# define MSG_INFO 12 - -/* buffer for msgctl calls IPC_INFO, MSG_INFO */ -struct msginfo - { - int msgpool; - int msgmap; - int msgmax; - int msgmnb; - int msgmni; - int msgssz; - int msgtql; - unsigned short int msgseg; - }; - -#endif /* __USE_MISC */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/nan.h b/openflow/usr/include/arm-linux-gnueabihf/bits/nan.h deleted file mode 100644 index b832724..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/nan.h +++ /dev/null @@ -1,52 +0,0 @@ -/* `NAN' constant for IEEE 754 machines. - Copyright (C) 1992-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MATH_H -# error "Never use directly; include instead." -#endif - - -/* IEEE Not A Number. */ - -#if __GNUC_PREREQ(3,3) - -# define NAN (__builtin_nanf ("")) - -#elif defined __GNUC__ - -# define NAN \ - (__extension__ \ - ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; }) \ - { __l: 0x7fc00000UL }).__d) - -#else - -# include - -# if __BYTE_ORDER == __BIG_ENDIAN -# define __qnan_bytes { 0x7f, 0xc0, 0, 0 } -# endif -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define __qnan_bytes { 0, 0, 0xc0, 0x7f } -# endif - -static union { unsigned char __c[4]; float __d; } __qnan_union - __attribute__ ((__unused__)) = { __qnan_bytes }; -# define NAN (__qnan_union.__d) - -#endif /* GCC. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/netdb.h b/openflow/usr/include/arm-linux-gnueabihf/bits/netdb.h deleted file mode 100644 index 3cd0db3..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/netdb.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _NETDB_H -# error "Never include directly; use instead." -#endif - - -/* Description of data base entry for a single network. NOTE: here a - poor assumption is made. The network number is expected to fit - into an unsigned long int variable. */ -struct netent -{ - char *n_name; /* Official name of network. */ - char **n_aliases; /* Alias list. */ - int n_addrtype; /* Net address type. */ - uint32_t n_net; /* Network number. */ -}; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/param.h b/openflow/usr/include/arm-linux-gnueabihf/bits/param.h deleted file mode 100644 index 45675d1..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/param.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Old-style Unix parameters and limits. Linux version. - Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_PARAM_H -# error "Never use directly; include instead." -#endif - -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -#include -#include - -/* The kernel headers define ARG_MAX. The value is wrong, though. */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -#define MAXSYMLINKS 20 - -/* The following are not really correct but it is a value we used for a - long time and which seems to be usable. People should not use NOFILE - and NCARGS anyway. */ -#define NOFILE 256 -#define NCARGS 131072 diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/poll.h b/openflow/usr/include/arm-linux-gnueabihf/bits/poll.h deleted file mode 100644 index a582118..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/poll.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_POLL_H -# error "Never use directly; include instead." -#endif - -/* Event types that can be polled for. These bits may be set in `events' - to indicate the interesting event types; they will appear in `revents' - to indicate the status of the file descriptor. */ -#define POLLIN 0x001 /* There is data to read. */ -#define POLLPRI 0x002 /* There is urgent data to read. */ -#define POLLOUT 0x004 /* Writing now will not block. */ - -#if defined __USE_XOPEN || defined __USE_XOPEN2K8 -/* These values are defined in XPG4.2. */ -# define POLLRDNORM 0x040 /* Normal data may be read. */ -# define POLLRDBAND 0x080 /* Priority data may be read. */ -# define POLLWRNORM 0x100 /* Writing now will not block. */ -# define POLLWRBAND 0x200 /* Priority data may be written. */ -#endif - -#ifdef __USE_GNU -/* These are extensions for Linux. */ -# define POLLMSG 0x400 -# define POLLREMOVE 0x1000 -# define POLLRDHUP 0x2000 -#endif - -/* Event types always implicitly polled for. These bits need not be set in - `events', but they will appear in `revents' to indicate the status of - the file descriptor. */ -#define POLLERR 0x008 /* Error condition. */ -#define POLLHUP 0x010 /* Hung up. */ -#define POLLNVAL 0x020 /* Invalid polling request. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/poll2.h b/openflow/usr/include/arm-linux-gnueabihf/bits/poll2.h deleted file mode 100644 index 137bfaf..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/poll2.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Checking macros for poll functions. - Copyright (C) 2012-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_POLL_H -# error "Never include directly; use instead." -#endif - - -__BEGIN_DECLS - -extern int __REDIRECT (__poll_alias, (struct pollfd *__fds, nfds_t __nfds, - int __timeout), poll); -extern int __poll_chk (struct pollfd *__fds, nfds_t __nfds, int __timeout, - __SIZE_TYPE__ __fdslen); -extern int __REDIRECT (__poll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, - int __timeout, __SIZE_TYPE__ __fdslen), - __poll_chk) - __warnattr ("poll called with fds buffer too small file nfds entries"); - -__fortify_function int -poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) -{ - if (__bos (__fds) != (__SIZE_TYPE__) -1) - { - if (! __builtin_constant_p (__nfds)) - return __poll_chk (__fds, __nfds, __timeout, __bos (__fds)); - else if (__bos (__fds) / sizeof (*__fds) < __nfds) - return __poll_chk_warn (__fds, __nfds, __timeout, __bos (__fds)); - } - - return __poll_alias (__fds, __nfds, __timeout); -} - - -#ifdef __USE_GNU -extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds, - const struct timespec *__timeout, - const __sigset_t *__ss), ppoll); -extern int __ppoll_chk (struct pollfd *__fds, nfds_t __nfds, - const struct timespec *__timeout, - const __sigset_t *__ss, __SIZE_TYPE__ __fdslen); -extern int __REDIRECT (__ppoll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, - const struct timespec *__timeout, - const __sigset_t *__ss, - __SIZE_TYPE__ __fdslen), - __ppoll_chk) - __warnattr ("ppoll called with fds buffer too small file nfds entries"); - -__fortify_function int -ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, - const __sigset_t *__ss) -{ - if (__bos (__fds) != (__SIZE_TYPE__) -1) - { - if (! __builtin_constant_p (__nfds)) - return __ppoll_chk (__fds, __nfds, __timeout, __ss, __bos (__fds)); - else if (__bos (__fds) / sizeof (*__fds) < __nfds) - return __ppoll_chk_warn (__fds, __nfds, __timeout, __ss, - __bos (__fds)); - } - - return __ppoll_alias (__fds, __nfds, __timeout, __ss); -} -#endif - -__END_DECLS diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/posix1_lim.h b/openflow/usr/include/arm-linux-gnueabihf/bits/posix1_lim.h deleted file mode 100644 index b0a37bd..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/posix1_lim.h +++ /dev/null @@ -1,175 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * POSIX Standard: 2.9.2 Minimum Values Added to - * - * Never include this file directly; use instead. - */ - -#ifndef _BITS_POSIX1_LIM_H -#define _BITS_POSIX1_LIM_H 1 - - -/* These are the standard-mandated minimum values. */ - -/* Minimum number of operations in one list I/O call. */ -#define _POSIX_AIO_LISTIO_MAX 2 - -/* Minimal number of outstanding asynchronous I/O operations. */ -#define _POSIX_AIO_MAX 1 - -/* Maximum length of arguments to `execve', including environment. */ -#define _POSIX_ARG_MAX 4096 - -/* Maximum simultaneous processes per real user ID. */ -#ifdef __USE_XOPEN2K -# define _POSIX_CHILD_MAX 25 -#else -# define _POSIX_CHILD_MAX 6 -#endif - -/* Minimal number of timer expiration overruns. */ -#define _POSIX_DELAYTIMER_MAX 32 - -/* Maximum length of a host name (not including the terminating null) - as returned from the GETHOSTNAME function. */ -#define _POSIX_HOST_NAME_MAX 255 - -/* Maximum link count of a file. */ -#define _POSIX_LINK_MAX 8 - -/* Maximum length of login name. */ -#define _POSIX_LOGIN_NAME_MAX 9 - -/* Number of bytes in a terminal canonical input queue. */ -#define _POSIX_MAX_CANON 255 - -/* Number of bytes for which space will be - available in a terminal input queue. */ -#define _POSIX_MAX_INPUT 255 - -/* Maximum number of message queues open for a process. */ -#define _POSIX_MQ_OPEN_MAX 8 - -/* Maximum number of supported message priorities. */ -#define _POSIX_MQ_PRIO_MAX 32 - -/* Number of bytes in a filename. */ -#define _POSIX_NAME_MAX 14 - -/* Number of simultaneous supplementary group IDs per process. */ -#ifdef __USE_XOPEN2K -# define _POSIX_NGROUPS_MAX 8 -#else -# define _POSIX_NGROUPS_MAX 0 -#endif - -/* Number of files one process can have open at once. */ -#ifdef __USE_XOPEN2K -# define _POSIX_OPEN_MAX 20 -#else -# define _POSIX_OPEN_MAX 16 -#endif - -#if !defined __USE_XOPEN2K || defined __USE_GNU -/* Number of descriptors that a process may examine with `pselect' or - `select'. */ -# define _POSIX_FD_SETSIZE _POSIX_OPEN_MAX -#endif - -/* Number of bytes in a pathname. */ -#define _POSIX_PATH_MAX 256 - -/* Number of bytes than can be written atomically to a pipe. */ -#define _POSIX_PIPE_BUF 512 - -/* The number of repeated occurrences of a BRE permitted by the - REGEXEC and REGCOMP functions when using the interval notation. */ -#define _POSIX_RE_DUP_MAX 255 - -/* Minimal number of realtime signals reserved for the application. */ -#define _POSIX_RTSIG_MAX 8 - -/* Number of semaphores a process can have. */ -#define _POSIX_SEM_NSEMS_MAX 256 - -/* Maximal value of a semaphore. */ -#define _POSIX_SEM_VALUE_MAX 32767 - -/* Number of pending realtime signals. */ -#define _POSIX_SIGQUEUE_MAX 32 - -/* Largest value of a `ssize_t'. */ -#define _POSIX_SSIZE_MAX 32767 - -/* Number of streams a process can have open at once. */ -#define _POSIX_STREAM_MAX 8 - -/* The number of bytes in a symbolic link. */ -#define _POSIX_SYMLINK_MAX 255 - -/* The number of symbolic links that can be traversed in the - resolution of a pathname in the absence of a loop. */ -#define _POSIX_SYMLOOP_MAX 8 - -/* Number of timer for a process. */ -#define _POSIX_TIMER_MAX 32 - -/* Maximum number of characters in a tty name. */ -#define _POSIX_TTY_NAME_MAX 9 - -/* Maximum length of a timezone name (element of `tzname'). */ -#ifdef __USE_XOPEN2K -# define _POSIX_TZNAME_MAX 6 -#else -# define _POSIX_TZNAME_MAX 3 -#endif - -#if !defined __USE_XOPEN2K || defined __USE_GNU -/* Maximum number of connections that can be queued on a socket. */ -# define _POSIX_QLIMIT 1 - -/* Maximum number of bytes that can be buffered on a socket for send - or receive. */ -# define _POSIX_HIWAT _POSIX_PIPE_BUF - -/* Maximum number of elements in an `iovec' array. */ -# define _POSIX_UIO_MAXIOV 16 -#endif - -/* Maximum clock resolution in nanoseconds. */ -#define _POSIX_CLOCKRES_MIN 20000000 - - -/* Get the implementation-specific values for the above. */ -#include - - -#ifndef SSIZE_MAX -# define SSIZE_MAX LONG_MAX -#endif - - -/* This value is a guaranteed minimum maximum. - The current maximum can be got from `sysconf'. */ - -#ifndef NGROUPS_MAX -# define NGROUPS_MAX 8 -#endif - -#endif /* bits/posix1_lim.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/posix2_lim.h b/openflow/usr/include/arm-linux-gnueabihf/bits/posix2_lim.h deleted file mode 100644 index 819af36..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/posix2_lim.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * Never include this file directly; include instead. - */ - -#ifndef _BITS_POSIX2_LIM_H -#define _BITS_POSIX2_LIM_H 1 - - -/* The maximum `ibase' and `obase' values allowed by the `bc' utility. */ -#define _POSIX2_BC_BASE_MAX 99 - -/* The maximum number of elements allowed in an array by the `bc' utility. */ -#define _POSIX2_BC_DIM_MAX 2048 - -/* The maximum `scale' value allowed by the `bc' utility. */ -#define _POSIX2_BC_SCALE_MAX 99 - -/* The maximum length of a string constant accepted by the `bc' utility. */ -#define _POSIX2_BC_STRING_MAX 1000 - -/* The maximum number of weights that can be assigned to an entry of - the LC_COLLATE `order' keyword in the locale definition file. */ -#define _POSIX2_COLL_WEIGHTS_MAX 2 - -/* The maximum number of expressions that can be nested - within parentheses by the `expr' utility. */ -#define _POSIX2_EXPR_NEST_MAX 32 - -/* The maximum length, in bytes, of an input line. */ -#define _POSIX2_LINE_MAX 2048 - -/* The maximum number of repeated occurrences of a regular expression - permitted when using the interval notation `\{M,N\}'. */ -#define _POSIX2_RE_DUP_MAX 255 - -/* The maximum number of bytes in a character class name. We have no - fixed limit, 2048 is a high number. */ -#define _POSIX2_CHARCLASS_NAME_MAX 14 - - -/* These values are implementation-specific, - and may vary within the implementation. - Their precise values can be obtained from sysconf. */ - -#ifndef BC_BASE_MAX -#define BC_BASE_MAX _POSIX2_BC_BASE_MAX -#endif -#ifndef BC_DIM_MAX -#define BC_DIM_MAX _POSIX2_BC_DIM_MAX -#endif -#ifndef BC_SCALE_MAX -#define BC_SCALE_MAX _POSIX2_BC_SCALE_MAX -#endif -#ifndef BC_STRING_MAX -#define BC_STRING_MAX _POSIX2_BC_STRING_MAX -#endif -#ifndef COLL_WEIGHTS_MAX -#define COLL_WEIGHTS_MAX 255 -#endif -#ifndef EXPR_NEST_MAX -#define EXPR_NEST_MAX _POSIX2_EXPR_NEST_MAX -#endif -#ifndef LINE_MAX -#define LINE_MAX _POSIX2_LINE_MAX -#endif -#ifndef CHARCLASS_NAME_MAX -#define CHARCLASS_NAME_MAX 2048 -#endif - -/* This value is defined like this in regex.h. */ -#define RE_DUP_MAX (0x7fff) - -#endif /* bits/posix2_lim.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/posix_opt.h b/openflow/usr/include/arm-linux-gnueabihf/bits/posix_opt.h deleted file mode 100644 index 5fb31b1..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/posix_opt.h +++ /dev/null @@ -1,191 +0,0 @@ -/* Define POSIX options for Linux. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, see . */ - -#ifndef _BITS_POSIX_OPT_H -#define _BITS_POSIX_OPT_H 1 - -/* Job control is supported. */ -#define _POSIX_JOB_CONTROL 1 - -/* Processes have a saved set-user-ID and a saved set-group-ID. */ -#define _POSIX_SAVED_IDS 1 - -/* Priority scheduling is supported. */ -#define _POSIX_PRIORITY_SCHEDULING 200809L - -/* Synchronizing file data is supported. */ -#define _POSIX_SYNCHRONIZED_IO 200809L - -/* The fsync function is present. */ -#define _POSIX_FSYNC 200809L - -/* Mapping of files to memory is supported. */ -#define _POSIX_MAPPED_FILES 200809L - -/* Locking of all memory is supported. */ -#define _POSIX_MEMLOCK 200809L - -/* Locking of ranges of memory is supported. */ -#define _POSIX_MEMLOCK_RANGE 200809L - -/* Setting of memory protections is supported. */ -#define _POSIX_MEMORY_PROTECTION 200809L - -/* Some filesystems allow all users to change file ownership. */ -#define _POSIX_CHOWN_RESTRICTED 0 - -/* `c_cc' member of 'struct termios' structure can be disabled by - using the value _POSIX_VDISABLE. */ -#define _POSIX_VDISABLE '\0' - -/* Filenames are not silently truncated. */ -#define _POSIX_NO_TRUNC 1 - -/* X/Open realtime support is available. */ -#define _XOPEN_REALTIME 1 - -/* X/Open thread realtime support is available. */ -#define _XOPEN_REALTIME_THREADS 1 - -/* XPG4.2 shared memory is supported. */ -#define _XOPEN_SHM 1 - -/* Tell we have POSIX threads. */ -#define _POSIX_THREADS 200809L - -/* We have the reentrant functions described in POSIX. */ -#define _POSIX_REENTRANT_FUNCTIONS 1 -#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L - -/* We provide priority scheduling for threads. */ -#define _POSIX_THREAD_PRIORITY_SCHEDULING 200809L - -/* We support user-defined stack sizes. */ -#define _POSIX_THREAD_ATTR_STACKSIZE 200809L - -/* We support user-defined stacks. */ -#define _POSIX_THREAD_ATTR_STACKADDR 200809L - -/* We support priority inheritence. */ -#define _POSIX_THREAD_PRIO_INHERIT 200809L - -/* We support priority protection, though only for non-robust - mutexes. */ -#define _POSIX_THREAD_PRIO_PROTECT 200809L - -#ifdef __USE_XOPEN2K8 -/* We support priority inheritence for robust mutexes. */ -# define _POSIX_THREAD_ROBUST_PRIO_INHERIT 200809L - -/* We do not support priority protection for robust mutexes. */ -# define _POSIX_THREAD_ROBUST_PRIO_PROTECT -1 -#endif - -/* We support POSIX.1b semaphores. */ -#define _POSIX_SEMAPHORES 200809L - -/* Real-time signals are supported. */ -#define _POSIX_REALTIME_SIGNALS 200809L - -/* We support asynchronous I/O. */ -#define _POSIX_ASYNCHRONOUS_IO 200809L -#define _POSIX_ASYNC_IO 1 -/* Alternative name for Unix98. */ -#define _LFS_ASYNCHRONOUS_IO 1 -/* Support for prioritization is also available. */ -#define _POSIX_PRIORITIZED_IO 200809L - -/* The LFS support in asynchronous I/O is also available. */ -#define _LFS64_ASYNCHRONOUS_IO 1 - -/* The rest of the LFS is also available. */ -#define _LFS_LARGEFILE 1 -#define _LFS64_LARGEFILE 1 -#define _LFS64_STDIO 1 - -/* POSIX shared memory objects are implemented. */ -#define _POSIX_SHARED_MEMORY_OBJECTS 200809L - -/* CPU-time clocks support needs to be checked at runtime. */ -#define _POSIX_CPUTIME 0 - -/* Clock support in threads must be also checked at runtime. */ -#define _POSIX_THREAD_CPUTIME 0 - -/* GNU libc provides regular expression handling. */ -#define _POSIX_REGEXP 1 - -/* Reader/Writer locks are available. */ -#define _POSIX_READER_WRITER_LOCKS 200809L - -/* We have a POSIX shell. */ -#define _POSIX_SHELL 1 - -/* We support the Timeouts option. */ -#define _POSIX_TIMEOUTS 200809L - -/* We support spinlocks. */ -#define _POSIX_SPIN_LOCKS 200809L - -/* The `spawn' function family is supported. */ -#define _POSIX_SPAWN 200809L - -/* We have POSIX timers. */ -#define _POSIX_TIMERS 200809L - -/* The barrier functions are available. */ -#define _POSIX_BARRIERS 200809L - -/* POSIX message queues are available. */ -#define _POSIX_MESSAGE_PASSING 200809L - -/* Thread process-shared synchronization is supported. */ -#define _POSIX_THREAD_PROCESS_SHARED 200809L - -/* The monotonic clock might be available. */ -#define _POSIX_MONOTONIC_CLOCK 0 - -/* The clock selection interfaces are available. */ -#define _POSIX_CLOCK_SELECTION 200809L - -/* Advisory information interfaces are available. */ -#define _POSIX_ADVISORY_INFO 200809L - -/* IPv6 support is available. */ -#define _POSIX_IPV6 200809L - -/* Raw socket support is available. */ -#define _POSIX_RAW_SOCKETS 200809L - -/* We have at least one terminal. */ -#define _POSIX2_CHAR_TERM 200809L - -/* Neither process nor thread sporadic server interfaces is available. */ -#define _POSIX_SPORADIC_SERVER -1 -#define _POSIX_THREAD_SPORADIC_SERVER -1 - -/* trace.h is not available. */ -#define _POSIX_TRACE -1 -#define _POSIX_TRACE_EVENT_FILTER -1 -#define _POSIX_TRACE_INHERIT -1 -#define _POSIX_TRACE_LOG -1 - -/* Typed memory objects are not available. */ -#define _POSIX_TYPED_MEMORY_OBJECTS -1 - -#endif /* bits/posix_opt.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/printf-ldbl.h b/openflow/usr/include/arm-linux-gnueabihf/bits/printf-ldbl.h deleted file mode 100644 index aaa0921..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/printf-ldbl.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -mlong-double-64 compatibility mode for functions. - Copyright (C) 2006-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _PRINTF_H -# error "Never include directly; use instead." -#endif - -__LDBL_REDIR_DECL (printf_size) diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/pthreadtypes.h b/openflow/usr/include/arm-linux-gnueabihf/bits/pthreadtypes.h deleted file mode 100644 index afb5392..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/pthreadtypes.h +++ /dev/null @@ -1,189 +0,0 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _BITS_PTHREADTYPES_H -#define _BITS_PTHREADTYPES_H 1 - -#include - -#define __SIZEOF_PTHREAD_ATTR_T 36 -#define __SIZEOF_PTHREAD_MUTEX_T 24 -#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 -#define __SIZEOF_PTHREAD_COND_T 48 -#define __SIZEOF_PTHREAD_COND_COMPAT_T 12 -#define __SIZEOF_PTHREAD_CONDATTR_T 4 -#define __SIZEOF_PTHREAD_RWLOCK_T 32 -#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 -#define __SIZEOF_PTHREAD_BARRIER_T 20 -#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 - - -/* Thread identifiers. The structure of the attribute type is not - exposed on purpose. */ -typedef unsigned long int pthread_t; - - -union pthread_attr_t -{ - char __size[__SIZEOF_PTHREAD_ATTR_T]; - long int __align; -}; -#ifndef __have_pthread_attr_t -typedef union pthread_attr_t pthread_attr_t; -# define __have_pthread_attr_t 1 -#endif - - -typedef struct __pthread_internal_slist -{ - struct __pthread_internal_slist *__next; -} __pthread_slist_t; - - -/* Data structures for mutex handling. The structure of the attribute - type is not exposed on purpose. */ -typedef union -{ - struct __pthread_mutex_s - { - int __lock; - unsigned int __count; - int __owner; - /* KIND must stay at this position in the structure to maintain - binary compatibility. */ - int __kind; - unsigned int __nusers; - __extension__ union - { - int __spins; - __pthread_slist_t __list; - }; - } __data; - char __size[__SIZEOF_PTHREAD_MUTEX_T]; - long int __align; -} pthread_mutex_t; - -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */ -#define __PTHREAD_SPINS 0 - -typedef union -{ - char __size[__SIZEOF_PTHREAD_MUTEXATTR_T]; - long int __align; -} pthread_mutexattr_t; - - -/* Data structure for conditional variable handling. The structure of - the attribute type is not exposed on purpose. */ -typedef union -{ - struct - { - int __lock; - unsigned int __futex; - __extension__ unsigned long long int __total_seq; - __extension__ unsigned long long int __wakeup_seq; - __extension__ unsigned long long int __woken_seq; - void *__mutex; - unsigned int __nwaiters; - unsigned int __broadcast_seq; - } __data; - char __size[__SIZEOF_PTHREAD_COND_T]; - __extension__ long long int __align; -} pthread_cond_t; - -typedef union -{ - char __size[__SIZEOF_PTHREAD_CONDATTR_T]; - long int __align; -} pthread_condattr_t; - - -/* Keys for thread-specific data */ -typedef unsigned int pthread_key_t; - - -/* Once-only execution */ -typedef int pthread_once_t; - - -#if defined __USE_UNIX98 || defined __USE_XOPEN2K -/* Data structure for read-write lock variable handling. The - structure of the attribute type is not exposed on purpose. */ -typedef union -{ - struct - { - int __lock; - unsigned int __nr_readers; - unsigned int __readers_wakeup; - unsigned int __writer_wakeup; - unsigned int __nr_readers_queued; - unsigned int __nr_writers_queued; -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned char __pad1; - unsigned char __pad2; - unsigned char __shared; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned char __flags; -#else - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned char __flags; - unsigned char __shared; - unsigned char __pad1; - unsigned char __pad2; -#endif - int __writer; - } __data; - char __size[__SIZEOF_PTHREAD_RWLOCK_T]; - long int __align; -} pthread_rwlock_t; - -#define __PTHREAD_RWLOCK_ELISION_EXTRA 0 - -typedef union -{ - char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T]; - long int __align; -} pthread_rwlockattr_t; -#endif - - -#ifdef __USE_XOPEN2K -/* POSIX spinlock data type. */ -typedef volatile int pthread_spinlock_t; - - -/* POSIX barriers data type. The structure of the type is - deliberately not exposed. */ -typedef union -{ - char __size[__SIZEOF_PTHREAD_BARRIER_T]; - long int __align; -} pthread_barrier_t; - -typedef union -{ - char __size[__SIZEOF_PTHREAD_BARRIERATTR_T]; - int __align; -} pthread_barrierattr_t; -#endif - - -#endif /* bits/pthreadtypes.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/resource.h b/openflow/usr/include/arm-linux-gnueabihf/bits/resource.h deleted file mode 100644 index 8af0e0e..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/resource.h +++ /dev/null @@ -1,328 +0,0 @@ -/* Bit values & structures for resource limits. Linux version. - Copyright (C) 1994-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_RESOURCE_H -# error "Never use directly; include instead." -#endif - -#include - -/* Transmute defines to enumerations. The macro re-definitions are - necessary because some programs want to test for operating system - features with #ifdef RUSAGE_SELF. In ISO C the reflexive - definition is a no-op. */ - -/* Kinds of resource limit. */ -enum __rlimit_resource -{ - /* Per-process CPU limit, in seconds. */ - RLIMIT_CPU = 0, -#define RLIMIT_CPU RLIMIT_CPU - - /* Largest file that can be created, in bytes. */ - RLIMIT_FSIZE = 1, -#define RLIMIT_FSIZE RLIMIT_FSIZE - - /* Maximum size of data segment, in bytes. */ - RLIMIT_DATA = 2, -#define RLIMIT_DATA RLIMIT_DATA - - /* Maximum size of stack segment, in bytes. */ - RLIMIT_STACK = 3, -#define RLIMIT_STACK RLIMIT_STACK - - /* Largest core file that can be created, in bytes. */ - RLIMIT_CORE = 4, -#define RLIMIT_CORE RLIMIT_CORE - - /* Largest resident set size, in bytes. - This affects swapping; processes that are exceeding their - resident set size will be more likely to have physical memory - taken from them. */ - __RLIMIT_RSS = 5, -#define RLIMIT_RSS __RLIMIT_RSS - - /* Number of open files. */ - RLIMIT_NOFILE = 7, - __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ -#define RLIMIT_NOFILE RLIMIT_NOFILE -#define RLIMIT_OFILE __RLIMIT_OFILE - - /* Address space limit. */ - RLIMIT_AS = 9, -#define RLIMIT_AS RLIMIT_AS - - /* Number of processes. */ - __RLIMIT_NPROC = 6, -#define RLIMIT_NPROC __RLIMIT_NPROC - - /* Locked-in-memory address space. */ - __RLIMIT_MEMLOCK = 8, -#define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK - - /* Maximum number of file locks. */ - __RLIMIT_LOCKS = 10, -#define RLIMIT_LOCKS __RLIMIT_LOCKS - - /* Maximum number of pending signals. */ - __RLIMIT_SIGPENDING = 11, -#define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING - - /* Maximum bytes in POSIX message queues. */ - __RLIMIT_MSGQUEUE = 12, -#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE - - /* Maximum nice priority allowed to raise to. - Nice levels 19 .. -20 correspond to 0 .. 39 - values of this resource limit. */ - __RLIMIT_NICE = 13, -#define RLIMIT_NICE __RLIMIT_NICE - - /* Maximum realtime priority allowed for non-priviledged - processes. */ - __RLIMIT_RTPRIO = 14, -#define RLIMIT_RTPRIO __RLIMIT_RTPRIO - - /* Maximum CPU time in µs that a process scheduled under a real-time - scheduling policy may consume without making a blocking system - call before being forcibly descheduled. */ - __RLIMIT_RTTIME = 15, -#define RLIMIT_RTTIME __RLIMIT_RTTIME - - __RLIMIT_NLIMITS = 16, - __RLIM_NLIMITS = __RLIMIT_NLIMITS -#define RLIMIT_NLIMITS __RLIMIT_NLIMITS -#define RLIM_NLIMITS __RLIM_NLIMITS -}; - -/* Value to indicate that there is no limit. */ -#ifndef __USE_FILE_OFFSET64 -# define RLIM_INFINITY ((__rlim_t) -1) -#else -# define RLIM_INFINITY 0xffffffffffffffffuLL -#endif - -#ifdef __USE_LARGEFILE64 -# define RLIM64_INFINITY 0xffffffffffffffffuLL -#endif - -/* We can represent all limits. */ -#define RLIM_SAVED_MAX RLIM_INFINITY -#define RLIM_SAVED_CUR RLIM_INFINITY - - -/* Type for resource quantity measurement. */ -#ifndef __USE_FILE_OFFSET64 -typedef __rlim_t rlim_t; -#else -typedef __rlim64_t rlim_t; -#endif -#ifdef __USE_LARGEFILE64 -typedef __rlim64_t rlim64_t; -#endif - -struct rlimit - { - /* The current (soft) limit. */ - rlim_t rlim_cur; - /* The hard limit. */ - rlim_t rlim_max; - }; - -#ifdef __USE_LARGEFILE64 -struct rlimit64 - { - /* The current (soft) limit. */ - rlim64_t rlim_cur; - /* The hard limit. */ - rlim64_t rlim_max; - }; -#endif - -/* Whose usage statistics do you want? */ -enum __rusage_who -{ - /* The calling process. */ - RUSAGE_SELF = 0, -#define RUSAGE_SELF RUSAGE_SELF - - /* All of its terminated child processes. */ - RUSAGE_CHILDREN = -1 -#define RUSAGE_CHILDREN RUSAGE_CHILDREN - -#ifdef __USE_GNU - , - /* The calling thread. */ - RUSAGE_THREAD = 1 -# define RUSAGE_THREAD RUSAGE_THREAD - /* Name for the same functionality on Solaris. */ -# define RUSAGE_LWP RUSAGE_THREAD -#endif -}; - -#define __need_timeval -#include /* For `struct timeval'. */ - -/* Structure which says how much of each resource has been used. */ - -/* The purpose of all the unions is to have the kernel-compatible layout - while keeping the API type as 'long int', and among machines where - __syscall_slong_t is not 'long int', this only does the right thing - for little-endian ones, like x32. */ -struct rusage - { - /* Total amount of user time used. */ - struct timeval ru_utime; - /* Total amount of system time used. */ - struct timeval ru_stime; - /* Maximum resident set size (in kilobytes). */ - __extension__ union - { - long int ru_maxrss; - __syscall_slong_t __ru_maxrss_word; - }; - /* Amount of sharing of text segment memory - with other processes (kilobyte-seconds). */ - /* Maximum resident set size (in kilobytes). */ - __extension__ union - { - long int ru_ixrss; - __syscall_slong_t __ru_ixrss_word; - }; - /* Amount of data segment memory used (kilobyte-seconds). */ - __extension__ union - { - long int ru_idrss; - __syscall_slong_t __ru_idrss_word; - }; - /* Amount of stack memory used (kilobyte-seconds). */ - __extension__ union - { - long int ru_isrss; - __syscall_slong_t __ru_isrss_word; - }; - /* Number of soft page faults (i.e. those serviced by reclaiming - a page from the list of pages awaiting reallocation. */ - __extension__ union - { - long int ru_minflt; - __syscall_slong_t __ru_minflt_word; - }; - /* Number of hard page faults (i.e. those that required I/O). */ - __extension__ union - { - long int ru_majflt; - __syscall_slong_t __ru_majflt_word; - }; - /* Number of times a process was swapped out of physical memory. */ - __extension__ union - { - long int ru_nswap; - __syscall_slong_t __ru_nswap_word; - }; - /* Number of input operations via the file system. Note: This - and `ru_oublock' do not include operations with the cache. */ - __extension__ union - { - long int ru_inblock; - __syscall_slong_t __ru_inblock_word; - }; - /* Number of output operations via the file system. */ - __extension__ union - { - long int ru_oublock; - __syscall_slong_t __ru_oublock_word; - }; - /* Number of IPC messages sent. */ - __extension__ union - { - long int ru_msgsnd; - __syscall_slong_t __ru_msgsnd_word; - }; - /* Number of IPC messages received. */ - __extension__ union - { - long int ru_msgrcv; - __syscall_slong_t __ru_msgrcv_word; - }; - /* Number of signals delivered. */ - __extension__ union - { - long int ru_nsignals; - __syscall_slong_t __ru_nsignals_word; - }; - /* Number of voluntary context switches, i.e. because the process - gave up the process before it had to (usually to wait for some - resource to be available). */ - __extension__ union - { - long int ru_nvcsw; - __syscall_slong_t __ru_nvcsw_word; - }; - /* Number of involuntary context switches, i.e. a higher priority process - became runnable or the current process used up its time slice. */ - __extension__ union - { - long int ru_nivcsw; - __syscall_slong_t __ru_nivcsw_word; - }; - }; - -/* Priority limits. */ -#define PRIO_MIN -20 /* Minimum priority a process can have. */ -#define PRIO_MAX 20 /* Maximum priority a process can have. */ - -/* The type of the WHICH argument to `getpriority' and `setpriority', - indicating what flavor of entity the WHO argument specifies. */ -enum __priority_which -{ - PRIO_PROCESS = 0, /* WHO is a process ID. */ -#define PRIO_PROCESS PRIO_PROCESS - PRIO_PGRP = 1, /* WHO is a process group ID. */ -#define PRIO_PGRP PRIO_PGRP - PRIO_USER = 2 /* WHO is a user ID. */ -#define PRIO_USER PRIO_USER -}; - - -__BEGIN_DECLS - -#ifdef __USE_GNU -/* Modify and return resource limits of a process atomically. */ -# ifndef __USE_FILE_OFFSET64 -extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource, - const struct rlimit *__new_limit, - struct rlimit *__old_limit) __THROW; -# else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (prlimit, (__pid_t __pid, - enum __rlimit_resource __resource, - const struct rlimit *__new_limit, - struct rlimit *__old_limit), prlimit64); -# else -# define prlimit prlimit64 -# endif -# endif -# ifdef __USE_LARGEFILE64 -extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource, - const struct rlimit64 *__new_limit, - struct rlimit64 *__old_limit) __THROW; -# endif -#endif - -__END_DECLS diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/sched.h b/openflow/usr/include/arm-linux-gnueabihf/bits/sched.h deleted file mode 100644 index 4f5305a..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/sched.h +++ /dev/null @@ -1,210 +0,0 @@ -/* Definitions of constants and data structure for POSIX 1003.1b-1993 - scheduling interface. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef __need_schedparam - -#ifndef _SCHED_H -# error "Never include directly; use instead." -#endif - - -/* Scheduling algorithms. */ -#define SCHED_OTHER 0 -#define SCHED_FIFO 1 -#define SCHED_RR 2 -#ifdef __USE_GNU -# define SCHED_BATCH 3 -# define SCHED_IDLE 5 - -# define SCHED_RESET_ON_FORK 0x40000000 -#endif - -#ifdef __USE_GNU -/* Cloning flags. */ -# define CSIGNAL 0x000000ff /* Signal mask to be sent at exit. */ -# define CLONE_VM 0x00000100 /* Set if VM shared between processes. */ -# define CLONE_FS 0x00000200 /* Set if fs info shared between processes. */ -# define CLONE_FILES 0x00000400 /* Set if open files shared between processes. */ -# define CLONE_SIGHAND 0x00000800 /* Set if signal handlers shared. */ -# define CLONE_PTRACE 0x00002000 /* Set if tracing continues on the child. */ -# define CLONE_VFORK 0x00004000 /* Set if the parent wants the child to - wake it up on mm_release. */ -# define CLONE_PARENT 0x00008000 /* Set if we want to have the same - parent as the cloner. */ -# define CLONE_THREAD 0x00010000 /* Set to add to same thread group. */ -# define CLONE_NEWNS 0x00020000 /* Set to create new namespace. */ -# define CLONE_SYSVSEM 0x00040000 /* Set to shared SVID SEM_UNDO semantics. */ -# define CLONE_SETTLS 0x00080000 /* Set TLS info. */ -# define CLONE_PARENT_SETTID 0x00100000 /* Store TID in userlevel buffer - before MM copy. */ -# define CLONE_CHILD_CLEARTID 0x00200000 /* Register exit futex and memory - location to clear. */ -# define CLONE_DETACHED 0x00400000 /* Create clone detached. */ -# define CLONE_UNTRACED 0x00800000 /* Set if the tracing process can't - force CLONE_PTRACE on this clone. */ -# define CLONE_CHILD_SETTID 0x01000000 /* Store TID in userlevel buffer in - the child. */ -# define CLONE_NEWUTS 0x04000000 /* New utsname group. */ -# define CLONE_NEWIPC 0x08000000 /* New ipcs. */ -# define CLONE_NEWUSER 0x10000000 /* New user namespace. */ -# define CLONE_NEWPID 0x20000000 /* New pid namespace. */ -# define CLONE_NEWNET 0x40000000 /* New network namespace. */ -# define CLONE_IO 0x80000000 /* Clone I/O context. */ -#endif - -/* The official definition. */ -struct sched_param - { - int __sched_priority; - }; - -__BEGIN_DECLS - -#ifdef __USE_GNU -/* Clone current process. */ -extern int clone (int (*__fn) (void *__arg), void *__child_stack, - int __flags, void *__arg, ...) __THROW; - -/* Unshare the specified resources. */ -extern int unshare (int __flags) __THROW; - -/* Get index of currently used CPU. */ -extern int sched_getcpu (void) __THROW; - -/* Switch process to namespace of type NSTYPE indicated by FD. */ -extern int setns (int __fd, int __nstype) __THROW; -#endif - - -__END_DECLS - -#endif /* need schedparam */ - -#if !defined __defined_schedparam \ - && (defined __need_schedparam || defined _SCHED_H) -# define __defined_schedparam 1 -/* Data structure to describe a process' schedulability. */ -struct __sched_param - { - int __sched_priority; - }; -# undef __need_schedparam -#endif - - -#if defined _SCHED_H && !defined __cpu_set_t_defined -# define __cpu_set_t_defined -/* Size definition for CPU sets. */ -# define __CPU_SETSIZE 1024 -# define __NCPUBITS (8 * sizeof (__cpu_mask)) - -/* Type for array elements in 'cpu_set_t'. */ -typedef __CPU_MASK_TYPE __cpu_mask; - -/* Basic access functions. */ -# define __CPUELT(cpu) ((cpu) / __NCPUBITS) -# define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS)) - -/* Data structure to describe CPU mask. */ -typedef struct -{ - __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS]; -} cpu_set_t; - -/* Access functions for CPU masks. */ -# if __GNUC_PREREQ (2, 91) -# define __CPU_ZERO_S(setsize, cpusetp) \ - do __builtin_memset (cpusetp, '\0', setsize); while (0) -# else -# define __CPU_ZERO_S(setsize, cpusetp) \ - do { \ - size_t __i; \ - size_t __imax = (setsize) / sizeof (__cpu_mask); \ - __cpu_mask *__bits = (cpusetp)->__bits; \ - for (__i = 0; __i < __imax; ++__i) \ - __bits[__i] = 0; \ - } while (0) -# endif -# define __CPU_SET_S(cpu, setsize, cpusetp) \ - (__extension__ \ - ({ size_t __cpu = (cpu); \ - __cpu / 8 < (setsize) \ - ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ - |= __CPUMASK (__cpu)) \ - : 0; })) -# define __CPU_CLR_S(cpu, setsize, cpusetp) \ - (__extension__ \ - ({ size_t __cpu = (cpu); \ - __cpu / 8 < (setsize) \ - ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ - &= ~__CPUMASK (__cpu)) \ - : 0; })) -# define __CPU_ISSET_S(cpu, setsize, cpusetp) \ - (__extension__ \ - ({ size_t __cpu = (cpu); \ - __cpu / 8 < (setsize) \ - ? ((((const __cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ - & __CPUMASK (__cpu))) != 0 \ - : 0; })) - -# define __CPU_COUNT_S(setsize, cpusetp) \ - __sched_cpucount (setsize, cpusetp) - -# if __GNUC_PREREQ (2, 91) -# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ - (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0) -# else -# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ - (__extension__ \ - ({ const __cpu_mask *__arr1 = (cpusetp1)->__bits; \ - const __cpu_mask *__arr2 = (cpusetp2)->__bits; \ - size_t __imax = (setsize) / sizeof (__cpu_mask); \ - size_t __i; \ - for (__i = 0; __i < __imax; ++__i) \ - if (__arr1[__i] != __arr2[__i]) \ - break; \ - __i == __imax; })) -# endif - -# define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \ - (__extension__ \ - ({ cpu_set_t *__dest = (destset); \ - const __cpu_mask *__arr1 = (srcset1)->__bits; \ - const __cpu_mask *__arr2 = (srcset2)->__bits; \ - size_t __imax = (setsize) / sizeof (__cpu_mask); \ - size_t __i; \ - for (__i = 0; __i < __imax; ++__i) \ - ((__cpu_mask *) __dest->__bits)[__i] = __arr1[__i] op __arr2[__i]; \ - __dest; })) - -# define __CPU_ALLOC_SIZE(count) \ - ((((count) + __NCPUBITS - 1) / __NCPUBITS) * sizeof (__cpu_mask)) -# define __CPU_ALLOC(count) __sched_cpualloc (count) -# define __CPU_FREE(cpuset) __sched_cpufree (cpuset) - -__BEGIN_DECLS - -extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp) - __THROW; -extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur; -extern void __sched_cpufree (cpu_set_t *__set) __THROW; - -__END_DECLS - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/select.h b/openflow/usr/include/arm-linux-gnueabihf/bits/select.h deleted file mode 100644 index 6a93c3d..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/select.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SELECT_H -# error "Never use directly; include instead." -#endif - - -/* We don't use `memset' because this would require a prototype and - the array isn't too big. */ -#define __FD_ZERO(s) \ - do { \ - unsigned int __i; \ - fd_set *__arr = (s); \ - for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \ - __FDS_BITS (__arr)[__i] = 0; \ - } while (0) -#define __FD_SET(d, s) \ - ((void) (__FDS_BITS (s)[__FD_ELT(d)] |= __FD_MASK(d))) -#define __FD_CLR(d, s) \ - ((void) (__FDS_BITS (s)[__FD_ELT(d)] &= ~__FD_MASK(d))) -#define __FD_ISSET(d, s) \ - ((__FDS_BITS (s)[__FD_ELT (d)] & __FD_MASK (d)) != 0) diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/select2.h b/openflow/usr/include/arm-linux-gnueabihf/bits/select2.h deleted file mode 100644 index 56f2205..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/select2.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Checking macros for select functions. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SELECT_H -# error "Never include directly; use instead." -#endif - -/* Helper functions to issue warnings and errors when needed. */ -extern long int __fdelt_chk (long int __d); -extern long int __fdelt_warn (long int __d) - __warnattr ("bit outside of fd_set selected"); -#undef __FD_ELT -#define __FD_ELT(d) \ - __extension__ \ - ({ long int __d = (d); \ - (__builtin_constant_p (__d) \ - ? (0 <= __d && __d < __FD_SETSIZE \ - ? (__d / __NFDBITS) \ - : __fdelt_warn (__d)) \ - : __fdelt_chk (__d)); }) diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/sem.h b/openflow/usr/include/arm-linux-gnueabihf/bits/sem.h deleted file mode 100644 index f7efb3f..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/sem.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SEM_H -# error "Never include directly; use instead." -#endif - -#include - -/* Flags for `semop'. */ -#define SEM_UNDO 0x1000 /* undo the operation on exit */ - -/* Commands for `semctl'. */ -#define GETPID 11 /* get sempid */ -#define GETVAL 12 /* get semval */ -#define GETALL 13 /* get all semval's */ -#define GETNCNT 14 /* get semncnt */ -#define GETZCNT 15 /* get semzcnt */ -#define SETVAL 16 /* set semval */ -#define SETALL 17 /* set all semval's */ - - -/* Data structure describing a set of semaphores. */ -struct semid_ds -{ - struct ipc_perm sem_perm; /* operation permission struct */ - __time_t sem_otime; /* last semop() time */ - unsigned long int __glibc_reserved1; - __time_t sem_ctime; /* last time changed by semctl() */ - unsigned long int __glibc_reserved2; - unsigned long int sem_nsems; /* number of semaphores in set */ - unsigned long int __glibc_reserved3; - unsigned long int __glibc_reserved4; -}; - -/* The user should define a union like the following to use it for arguments - for `semctl'. - - union semun - { - int val; <= value for SETVAL - struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET - unsigned short int *array; <= array for GETALL & SETALL - struct seminfo *__buf; <= buffer for IPC_INFO - }; - - Previous versions of this file used to define this union but this is - incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether - one must define the union or not. */ -#define _SEM_SEMUN_UNDEFINED 1 - -#ifdef __USE_MISC - -/* ipcs ctl cmds */ -# define SEM_STAT 18 -# define SEM_INFO 19 - -struct seminfo -{ - int semmap; - int semmni; - int semmns; - int semmnu; - int semmsl; - int semopm; - int semume; - int semusz; - int semvmx; - int semaem; -}; - -#endif /* __USE_MISC */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/semaphore.h b/openflow/usr/include/arm-linux-gnueabihf/bits/semaphore.h deleted file mode 100644 index f9498c8..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/semaphore.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _SEMAPHORE_H -# error "Never use directly; include instead." -#endif - - -#define __SIZEOF_SEM_T 16 - - -/* Value returned if `sem_open' failed. */ -#define SEM_FAILED ((sem_t *) 0) - - -typedef union -{ - char __size[__SIZEOF_SEM_T]; - long int __align; -} sem_t; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/setjmp.h b/openflow/usr/include/arm-linux-gnueabihf/bits/setjmp.h deleted file mode 100644 index ba0ea92..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/setjmp.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -/* Define the machine-dependent type `jmp_buf'. ARM EABI version. */ - -#ifndef _BITS_SETJMP_H -#define _BITS_SETJMP_H 1 - -#if !defined _SETJMP_H && !defined _PTHREAD_H -# error "Never include directly; use instead." -#endif - -#ifndef __ASSEMBLER__ -/* The exact set of registers saved may depend on the particular core - in use, as some coprocessor registers may need to be saved. The C - Library ABI requires that the buffer be 8-byte aligned, and - recommends that the buffer contain 64 words. The first 26 words - are occupied by sp, lr, v1-v6, sl, fp, and d8-d15. */ -typedef int __jmp_buf[64] __attribute__((__aligned__ (8))); -#endif - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/setjmp2.h b/openflow/usr/include/arm-linux-gnueabihf/bits/setjmp2.h deleted file mode 100644 index dbf3454..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/setjmp2.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Checking macros for setjmp functions. - Copyright (C) 2009-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SETJMP_H -# error "Never include directly; use instead." -#endif - -/* Variant of the longjmp functions which perform some sanity checking. */ -#ifdef __REDIRECT_NTH -extern void __REDIRECT_NTHNL (longjmp, - (struct __jmp_buf_tag __env[1], int __val), - __longjmp_chk) __attribute__ ((__noreturn__)); -extern void __REDIRECT_NTHNL (_longjmp, - (struct __jmp_buf_tag __env[1], int __val), - __longjmp_chk) __attribute__ ((__noreturn__)); -extern void __REDIRECT_NTHNL (siglongjmp, - (struct __jmp_buf_tag __env[1], int __val), - __longjmp_chk) __attribute__ ((__noreturn__)); -#else -extern void __longjmp_chk (struct __jmp_buf_tag __env[1], int __val), - __THROWNL __attribute__ ((__noreturn__)); -# define longjmp __longjmp_chk -# define _longjmp __longjmp_chk -# define siglongjmp __longjmp_chk -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/shm.h b/openflow/usr/include/arm-linux-gnueabihf/bits/shm.h deleted file mode 100644 index 48b05cf..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/shm.h +++ /dev/null @@ -1,103 +0,0 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _SYS_SHM_H -# error "Never include directly; use instead." -#endif - -#include - -/* Permission flag for shmget. */ -#define SHM_R 0400 /* or S_IRUGO from */ -#define SHM_W 0200 /* or S_IWUGO from */ - -/* Flags for `shmat'. */ -#define SHM_RDONLY 010000 /* attach read-only else read-write */ -#define SHM_RND 020000 /* round attach address to SHMLBA */ -#define SHM_REMAP 040000 /* take-over region on attach */ -#define SHM_EXEC 0100000 /* execution access */ - -/* Commands for `shmctl'. */ -#define SHM_LOCK 11 /* lock segment (root only) */ -#define SHM_UNLOCK 12 /* unlock segment (root only) */ - -__BEGIN_DECLS - -/* Segment low boundary address multiple. */ -#define SHMLBA (__getpagesize () << 2) -extern int __getpagesize (void) __THROW __attribute__ ((__const__)); - - -/* Type to count number of attaches. */ -typedef unsigned long int shmatt_t; - -/* Data structure describing a shared memory segment. */ -struct shmid_ds - { - struct ipc_perm shm_perm; /* operation permission struct */ - size_t shm_segsz; /* size of segment in bytes */ - __time_t shm_atime; /* time of last shmat() */ - unsigned long int __glibc_reserved1; - __time_t shm_dtime; /* time of last shmdt() */ - unsigned long int __glibc_reserved2; - __time_t shm_ctime; /* time of last change by shmctl() */ - unsigned long int __glibc_reserved3; - __pid_t shm_cpid; /* pid of creator */ - __pid_t shm_lpid; /* pid of last shmop */ - shmatt_t shm_nattch; /* number of current attaches */ - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; - }; - -#ifdef __USE_MISC - -/* ipcs ctl commands */ -# define SHM_STAT 13 -# define SHM_INFO 14 - -/* shm_mode upper byte flags */ -# define SHM_DEST 01000 /* segment will be destroyed on last detach */ -# define SHM_LOCKED 02000 /* segment will not be swapped */ -# define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ -# define SHM_NORESERVE 010000 /* don't check for reservations */ - -struct shminfo - { - unsigned long int shmmax; - unsigned long int shmmin; - unsigned long int shmmni; - unsigned long int shmseg; - unsigned long int shmall; - unsigned long int __glibc_reserved1; - unsigned long int __glibc_reserved2; - unsigned long int __glibc_reserved3; - unsigned long int __glibc_reserved4; - }; - -struct shm_info - { - int used_ids; - unsigned long int shm_tot; /* total allocated shm */ - unsigned long int shm_rss; /* total resident shm */ - unsigned long int shm_swp; /* total swapped shm */ - unsigned long int swap_attempts; - unsigned long int swap_successes; - }; - -#endif /* __USE_MISC */ - -__END_DECLS diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/sigaction.h b/openflow/usr/include/arm-linux-gnueabihf/bits/sigaction.h deleted file mode 100644 index 8c995fe..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/sigaction.h +++ /dev/null @@ -1,78 +0,0 @@ -/* The proper definitions for Linux's sigaction. - Copyright (C) 1993-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SIGNAL_H -# error "Never include directly; use instead." -#endif - -/* Structure describing the action to be taken when a signal arrives. */ -struct sigaction - { - /* Signal handler. */ -#ifdef __USE_POSIX199309 - union - { - /* Used if SA_SIGINFO is not set. */ - __sighandler_t sa_handler; - /* Used if SA_SIGINFO is set. */ - void (*sa_sigaction) (int, siginfo_t *, void *); - } - __sigaction_handler; -# define sa_handler __sigaction_handler.sa_handler -# define sa_sigaction __sigaction_handler.sa_sigaction -#else - __sighandler_t sa_handler; -#endif - - /* Additional set of signals to be blocked. */ - __sigset_t sa_mask; - - /* Special flags. */ - int sa_flags; - - /* Restore handler. */ - void (*sa_restorer) (void); - }; - -/* Bits in `sa_flags'. */ -#define SA_NOCLDSTOP 1 /* Don't send SIGCHLD when children stop. */ -#define SA_NOCLDWAIT 2 /* Don't create zombie on child death. */ -#define SA_SIGINFO 4 /* Invoke signal-catching function with - three arguments instead of one. */ -#if defined __USE_UNIX98 || defined __USE_MISC -# define SA_ONSTACK 0x08000000 /* Use signal stack by using `sa_restorer'. */ -#endif -#if defined __USE_UNIX98 || defined __USE_XOPEN2K8 -# define SA_RESTART 0x10000000 /* Restart syscall on signal return. */ -# define SA_NODEFER 0x40000000 /* Don't automatically block the signal when - its handler is being executed. */ -# define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler. */ -#endif -#ifdef __USE_MISC -# define SA_INTERRUPT 0x20000000 /* Historical no-op. */ - -/* Some aliases for the SA_ constants. */ -# define SA_NOMASK SA_NODEFER -# define SA_ONESHOT SA_RESETHAND -# define SA_STACK SA_ONSTACK -#endif - -/* Values for the HOW argument to `sigprocmask'. */ -#define SIG_BLOCK 0 /* Block signals. */ -#define SIG_UNBLOCK 1 /* Unblock signals. */ -#define SIG_SETMASK 2 /* Set the set of blocked signals. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/sigcontext.h b/openflow/usr/include/arm-linux-gnueabihf/bits/sigcontext.h deleted file mode 100644 index 46cacb7..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/sigcontext.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H -# error "Never use directly; include instead." -#endif - -#ifndef sigcontext_struct -/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but - we need sigcontext. */ -# define sigcontext_struct sigcontext - -# include - -/* The Linux kernel headers redefine NULL wrongly, so cleanup afterwards. */ -# define __need_NULL -# include -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/siginfo.h b/openflow/usr/include/arm-linux-gnueabihf/bits/siginfo.h deleted file mode 100644 index b8f130b..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/siginfo.h +++ /dev/null @@ -1,341 +0,0 @@ -/* siginfo_t, sigevent and constants. Linux version. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _SIGNAL_H && !defined __need_siginfo_t \ - && !defined __need_sigevent_t -# error "Never include this file directly. Use instead" -#endif - -#include - -#if (!defined __have_sigval_t \ - && (defined _SIGNAL_H || defined __need_siginfo_t \ - || defined __need_sigevent_t)) -# define __have_sigval_t 1 - -/* Type for data associated with a signal. */ -typedef union sigval - { - int sival_int; - void *sival_ptr; - } sigval_t; -#endif - -#if (!defined __have_siginfo_t \ - && (defined _SIGNAL_H || defined __need_siginfo_t)) -# define __have_siginfo_t 1 - -# define __SI_MAX_SIZE 128 -# if __WORDSIZE == 64 -# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) -# else -# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3) -# endif - -typedef struct - { - int si_signo; /* Signal number. */ - int si_errno; /* If non-zero, an errno value associated with - this signal, as defined in . */ - int si_code; /* Signal code. */ - - union - { - int _pad[__SI_PAD_SIZE]; - - /* kill(). */ - struct - { - __pid_t si_pid; /* Sending process ID. */ - __uid_t si_uid; /* Real user ID of sending process. */ - } _kill; - - /* POSIX.1b timers. */ - struct - { - int si_tid; /* Timer ID. */ - int si_overrun; /* Overrun count. */ - sigval_t si_sigval; /* Signal value. */ - } _timer; - - /* POSIX.1b signals. */ - struct - { - __pid_t si_pid; /* Sending process ID. */ - __uid_t si_uid; /* Real user ID of sending process. */ - sigval_t si_sigval; /* Signal value. */ - } _rt; - - /* SIGCHLD. */ - struct - { - __pid_t si_pid; /* Which child. */ - __uid_t si_uid; /* Real user ID of sending process. */ - int si_status; /* Exit value or signal. */ - __clock_t si_utime; - __clock_t si_stime; - } _sigchld; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ - struct - { - void *si_addr; /* Faulting insn/memory ref. */ - short int si_addr_lsb; /* Valid LSB of the reported address. */ - } _sigfault; - - /* SIGPOLL. */ - struct - { - long int si_band; /* Band event for SIGPOLL. */ - int si_fd; - } _sigpoll; - - /* SIGSYS. */ - struct - { - void *_call_addr; /* Calling user insn. */ - int _syscall; /* Triggering system call number. */ - unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ - } _sigsys; - } _sifields; - } siginfo_t; - - -/* X/Open requires some more fields with fixed names. */ -# define si_pid _sifields._kill.si_pid -# define si_uid _sifields._kill.si_uid -# define si_timerid _sifields._timer.si_tid -# define si_overrun _sifields._timer.si_overrun -# define si_status _sifields._sigchld.si_status -# define si_utime _sifields._sigchld.si_utime -# define si_stime _sifields._sigchld.si_stime -# define si_value _sifields._rt.si_sigval -# define si_int _sifields._rt.si_sigval.sival_int -# define si_ptr _sifields._rt.si_sigval.sival_ptr -# define si_addr _sifields._sigfault.si_addr -# define si_addr_lsb _sifields._sigfault.si_addr_lsb -# define si_band _sifields._sigpoll.si_band -# define si_fd _sifields._sigpoll.si_fd -# define si_call_addr _sifields._sigsys._call_addr -# define si_syscall _sifields._sigsys._syscall -# define si_arch _sifields._sigsys._arch - - -/* Values for `si_code'. Positive values are reserved for kernel-generated - signals. */ -enum -{ - SI_ASYNCNL = -60, /* Sent by asynch name lookup completion. */ -# define SI_ASYNCNL SI_ASYNCNL - SI_TKILL = -6, /* Sent by tkill. */ -# define SI_TKILL SI_TKILL - SI_SIGIO, /* Sent by queued SIGIO. */ -# define SI_SIGIO SI_SIGIO - SI_ASYNCIO, /* Sent by AIO completion. */ -# define SI_ASYNCIO SI_ASYNCIO - SI_MESGQ, /* Sent by real time mesq state change. */ -# define SI_MESGQ SI_MESGQ - SI_TIMER, /* Sent by timer expiration. */ -# define SI_TIMER SI_TIMER - SI_QUEUE, /* Sent by sigqueue. */ -# define SI_QUEUE SI_QUEUE - SI_USER, /* Sent by kill, sigsend. */ -# define SI_USER SI_USER - SI_KERNEL = 0x80 /* Send by kernel. */ -#define SI_KERNEL SI_KERNEL -}; - - -# if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 -/* `si_code' values for SIGILL signal. */ -enum -{ - ILL_ILLOPC = 1, /* Illegal opcode. */ -# define ILL_ILLOPC ILL_ILLOPC - ILL_ILLOPN, /* Illegal operand. */ -# define ILL_ILLOPN ILL_ILLOPN - ILL_ILLADR, /* Illegal addressing mode. */ -# define ILL_ILLADR ILL_ILLADR - ILL_ILLTRP, /* Illegal trap. */ -# define ILL_ILLTRP ILL_ILLTRP - ILL_PRVOPC, /* Privileged opcode. */ -# define ILL_PRVOPC ILL_PRVOPC - ILL_PRVREG, /* Privileged register. */ -# define ILL_PRVREG ILL_PRVREG - ILL_COPROC, /* Coprocessor error. */ -# define ILL_COPROC ILL_COPROC - ILL_BADSTK /* Internal stack error. */ -# define ILL_BADSTK ILL_BADSTK -}; - -/* `si_code' values for SIGFPE signal. */ -enum -{ - FPE_INTDIV = 1, /* Integer divide by zero. */ -# define FPE_INTDIV FPE_INTDIV - FPE_INTOVF, /* Integer overflow. */ -# define FPE_INTOVF FPE_INTOVF - FPE_FLTDIV, /* Floating point divide by zero. */ -# define FPE_FLTDIV FPE_FLTDIV - FPE_FLTOVF, /* Floating point overflow. */ -# define FPE_FLTOVF FPE_FLTOVF - FPE_FLTUND, /* Floating point underflow. */ -# define FPE_FLTUND FPE_FLTUND - FPE_FLTRES, /* Floating point inexact result. */ -# define FPE_FLTRES FPE_FLTRES - FPE_FLTINV, /* Floating point invalid operation. */ -# define FPE_FLTINV FPE_FLTINV - FPE_FLTSUB /* Subscript out of range. */ -# define FPE_FLTSUB FPE_FLTSUB -}; - -/* `si_code' values for SIGSEGV signal. */ -enum -{ - SEGV_MAPERR = 1, /* Address not mapped to object. */ -# define SEGV_MAPERR SEGV_MAPERR - SEGV_ACCERR /* Invalid permissions for mapped object. */ -# define SEGV_ACCERR SEGV_ACCERR -}; - -/* `si_code' values for SIGBUS signal. */ -enum -{ - BUS_ADRALN = 1, /* Invalid address alignment. */ -# define BUS_ADRALN BUS_ADRALN - BUS_ADRERR, /* Non-existant physical address. */ -# define BUS_ADRERR BUS_ADRERR - BUS_OBJERR, /* Object specific hardware error. */ -# define BUS_OBJERR BUS_OBJERR - BUS_MCEERR_AR, /* Hardware memory error: action required. */ -# define BUS_MCEERR_AR BUS_MCEERR_AR - BUS_MCEERR_AO /* Hardware memory error: action optional. */ -# define BUS_MCEERR_AO BUS_MCEERR_AO -}; -# endif - -# ifdef __USE_XOPEN_EXTENDED -/* `si_code' values for SIGTRAP signal. */ -enum -{ - TRAP_BRKPT = 1, /* Process breakpoint. */ -# define TRAP_BRKPT TRAP_BRKPT - TRAP_TRACE /* Process trace trap. */ -# define TRAP_TRACE TRAP_TRACE -}; -# endif - -# if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 -/* `si_code' values for SIGCHLD signal. */ -enum -{ - CLD_EXITED = 1, /* Child has exited. */ -# define CLD_EXITED CLD_EXITED - CLD_KILLED, /* Child was killed. */ -# define CLD_KILLED CLD_KILLED - CLD_DUMPED, /* Child terminated abnormally. */ -# define CLD_DUMPED CLD_DUMPED - CLD_TRAPPED, /* Traced child has trapped. */ -# define CLD_TRAPPED CLD_TRAPPED - CLD_STOPPED, /* Child has stopped. */ -# define CLD_STOPPED CLD_STOPPED - CLD_CONTINUED /* Stopped child has continued. */ -# define CLD_CONTINUED CLD_CONTINUED -}; - -/* `si_code' values for SIGPOLL signal. */ -enum -{ - POLL_IN = 1, /* Data input available. */ -# define POLL_IN POLL_IN - POLL_OUT, /* Output buffers available. */ -# define POLL_OUT POLL_OUT - POLL_MSG, /* Input message available. */ -# define POLL_MSG POLL_MSG - POLL_ERR, /* I/O error. */ -# define POLL_ERR POLL_ERR - POLL_PRI, /* High priority input available. */ -# define POLL_PRI POLL_PRI - POLL_HUP /* Device disconnected. */ -# define POLL_HUP POLL_HUP -}; -# endif - -# undef __need_siginfo_t -#endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */ - - -#if (defined _SIGNAL_H || defined __need_sigevent_t) \ - && !defined __have_sigevent_t -# define __have_sigevent_t 1 - -/* Structure to transport application-defined values with signals. */ -# define __SIGEV_MAX_SIZE 64 -# if __WORDSIZE == 64 -# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4) -# else -# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3) -# endif - -/* Forward declaration. */ -# ifndef __have_pthread_attr_t -typedef union pthread_attr_t pthread_attr_t; -# define __have_pthread_attr_t 1 -# endif - -typedef struct sigevent - { - sigval_t sigev_value; - int sigev_signo; - int sigev_notify; - - union - { - int _pad[__SIGEV_PAD_SIZE]; - - /* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the - thread to receive the signal. */ - __pid_t _tid; - - struct - { - void (*_function) (sigval_t); /* Function to start. */ - pthread_attr_t *_attribute; /* Thread attributes. */ - } _sigev_thread; - } _sigev_un; - } sigevent_t; - -/* POSIX names to access some of the members. */ -# define sigev_notify_function _sigev_un._sigev_thread._function -# define sigev_notify_attributes _sigev_un._sigev_thread._attribute - -/* `sigev_notify' values. */ -enum -{ - SIGEV_SIGNAL = 0, /* Notify via signal. */ -# define SIGEV_SIGNAL SIGEV_SIGNAL - SIGEV_NONE, /* Other notification: meaningless. */ -# define SIGEV_NONE SIGEV_NONE - SIGEV_THREAD, /* Deliver via thread creation. */ -# define SIGEV_THREAD SIGEV_THREAD - - SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */ -#define SIGEV_THREAD_ID SIGEV_THREAD_ID -}; - -#endif /* have _SIGNAL_H. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/signalfd.h b/openflow/usr/include/arm-linux-gnueabihf/bits/signalfd.h deleted file mode 100644 index bac90e5..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/signalfd.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2007-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SIGNALFD_H -# error "Never use directly; include instead." -#endif - -/* Flags for signalfd. */ -enum - { - SFD_CLOEXEC = 02000000, -#define SFD_CLOEXEC SFD_CLOEXEC - SFD_NONBLOCK = 00004000 -#define SFD_NONBLOCK SFD_NONBLOCK - }; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/signum.h b/openflow/usr/include/arm-linux-gnueabihf/bits/signum.h deleted file mode 100644 index 0e4eea1..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/signum.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Signal number definitions. Linux version. - Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifdef _SIGNAL_H - -/* Fake signal functions. */ -#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ -#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ -#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ - -#ifdef __USE_UNIX98 -# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ -#endif - - -/* Signals. */ -#define SIGHUP 1 /* Hangup (POSIX). */ -#define SIGINT 2 /* Interrupt (ANSI). */ -#define SIGQUIT 3 /* Quit (POSIX). */ -#define SIGILL 4 /* Illegal instruction (ANSI). */ -#define SIGTRAP 5 /* Trace trap (POSIX). */ -#define SIGABRT 6 /* Abort (ANSI). */ -#define SIGIOT 6 /* IOT trap (4.2 BSD). */ -#define SIGBUS 7 /* BUS error (4.2 BSD). */ -#define SIGFPE 8 /* Floating-point exception (ANSI). */ -#define SIGKILL 9 /* Kill, unblockable (POSIX). */ -#define SIGUSR1 10 /* User-defined signal 1 (POSIX). */ -#define SIGSEGV 11 /* Segmentation violation (ANSI). */ -#define SIGUSR2 12 /* User-defined signal 2 (POSIX). */ -#define SIGPIPE 13 /* Broken pipe (POSIX). */ -#define SIGALRM 14 /* Alarm clock (POSIX). */ -#define SIGTERM 15 /* Termination (ANSI). */ -#define SIGSTKFLT 16 /* Stack fault. */ -#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ -#define SIGCHLD 17 /* Child status has changed (POSIX). */ -#define SIGCONT 18 /* Continue (POSIX). */ -#define SIGSTOP 19 /* Stop, unblockable (POSIX). */ -#define SIGTSTP 20 /* Keyboard stop (POSIX). */ -#define SIGTTIN 21 /* Background read from tty (POSIX). */ -#define SIGTTOU 22 /* Background write to tty (POSIX). */ -#define SIGURG 23 /* Urgent condition on socket (4.2 BSD). */ -#define SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */ -#define SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */ -#define SIGVTALRM 26 /* Virtual alarm clock (4.2 BSD). */ -#define SIGPROF 27 /* Profiling alarm clock (4.2 BSD). */ -#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */ -#define SIGPOLL SIGIO /* Pollable event occurred (System V). */ -#define SIGIO 29 /* I/O now possible (4.2 BSD). */ -#define SIGPWR 30 /* Power failure restart (System V). */ -#define SIGSYS 31 /* Bad system call. */ -#define SIGUNUSED 31 - -#define _NSIG 65 /* Biggest signal number + 1 - (including real-time signals). */ - -#define SIGRTMIN (__libc_current_sigrtmin ()) -#define SIGRTMAX (__libc_current_sigrtmax ()) - -/* These are the hard limits of the kernel. These values should not be - used directly at user level. */ -#define __SIGRTMIN 32 -#define __SIGRTMAX (_NSIG - 1) - -#endif /* included. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/sigset.h b/openflow/usr/include/arm-linux-gnueabihf/bits/sigset.h deleted file mode 100644 index 72de7b5..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/sigset.h +++ /dev/null @@ -1,124 +0,0 @@ -/* __sig_atomic_t, __sigset_t, and related definitions. Linux version. - Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SIGSET_H_types -# define _SIGSET_H_types 1 - -typedef int __sig_atomic_t; - -/* A `sigset_t' has a bit for each signal. */ - -# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) -typedef struct - { - unsigned long int __val[_SIGSET_NWORDS]; - } __sigset_t; - -#endif - - -/* We only want to define these functions if was actually - included; otherwise we were included just to define the types. Since we - are namespace-clean, it wouldn't hurt to define extra macros. But - trouble can be caused by functions being defined (e.g., any global - register vars declared later will cause compilation errors). */ - -#if !defined _SIGSET_H_fns && defined _SIGNAL_H -# define _SIGSET_H_fns 1 - -# ifndef _EXTERN_INLINE -# define _EXTERN_INLINE __extern_inline -# endif - -/* Return a mask that includes the bit for SIG only. */ -# define __sigmask(sig) \ - (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int)))) - -/* Return the word index for SIG. */ -# define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned long int))) - -# if defined __GNUC__ && __GNUC__ >= 2 -# define __sigemptyset(set) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__set = (set); \ - while (--__cnt >= 0) __set->__val[__cnt] = 0; \ - 0; })) -# define __sigfillset(set) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__set = (set); \ - while (--__cnt >= 0) __set->__val[__cnt] = ~0UL; \ - 0; })) - -# ifdef __USE_GNU -/* The POSIX does not specify for handling the whole signal set in one - command. This is often wanted and so we define three more functions - here. */ -# define __sigisemptyset(set) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - const sigset_t *__set = (set); \ - int __ret = __set->__val[--__cnt]; \ - while (!__ret && --__cnt >= 0) \ - __ret = __set->__val[__cnt]; \ - __ret == 0; })) -# define __sigandset(dest, left, right) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__dest = (dest); \ - const sigset_t *__left = (left); \ - const sigset_t *__right = (right); \ - while (--__cnt >= 0) \ - __dest->__val[__cnt] = (__left->__val[__cnt] \ - & __right->__val[__cnt]); \ - 0; })) -# define __sigorset(dest, left, right) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__dest = (dest); \ - const sigset_t *__left = (left); \ - const sigset_t *__right = (right); \ - while (--__cnt >= 0) \ - __dest->__val[__cnt] = (__left->__val[__cnt] \ - | __right->__val[__cnt]); \ - 0; })) -# endif -# endif - -/* These functions needn't check for a bogus signal number -- error - checking is done in the non __ versions. */ - -extern int __sigismember (const __sigset_t *, int); -extern int __sigaddset (__sigset_t *, int); -extern int __sigdelset (__sigset_t *, int); - -# ifdef __USE_EXTERN_INLINES -# define __SIGSETFN(NAME, BODY, CONST) \ - _EXTERN_INLINE int \ - NAME (CONST __sigset_t *__set, int __sig) \ - { \ - unsigned long int __mask = __sigmask (__sig); \ - unsigned long int __word = __sigword (__sig); \ - return BODY; \ - } - -__SIGSETFN (__sigismember, (__set->__val[__word] & __mask) ? 1 : 0, const) -__SIGSETFN (__sigaddset, ((__set->__val[__word] |= __mask), 0), ) -__SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), ) - -# undef __SIGSETFN -# endif - - -#endif /* ! _SIGSET_H_fns. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/sigstack.h b/openflow/usr/include/arm-linux-gnueabihf/bits/sigstack.h deleted file mode 100644 index 115a98e..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/sigstack.h +++ /dev/null @@ -1,54 +0,0 @@ -/* sigstack, sigaltstack definitions. - Copyright (C) 1998-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SIGNAL_H -# error "Never include this file directly. Use instead" -#endif - - -/* Structure describing a signal stack (obsolete). */ -struct sigstack - { - void *ss_sp; /* Signal stack pointer. */ - int ss_onstack; /* Nonzero if executing on this stack. */ - }; - - -/* Possible values for `ss_flags.'. */ -enum -{ - SS_ONSTACK = 1, -#define SS_ONSTACK SS_ONSTACK - SS_DISABLE -#define SS_DISABLE SS_DISABLE -}; - -/* Minimum stack size for a signal handler. */ -#define MINSIGSTKSZ 2048 - -/* System default stack size. */ -#define SIGSTKSZ 8192 - - -/* Alternate, preferred interface. */ -typedef struct sigaltstack - { - void *ss_sp; - int ss_flags; - size_t ss_size; - } stack_t; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/sigthread.h b/openflow/usr/include/arm-linux-gnueabihf/bits/sigthread.h deleted file mode 100644 index 32ef1a9..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/sigthread.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Signal handling function for threaded programs. - Copyright (C) 1998-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, see . */ - -#ifndef _BITS_SIGTHREAD_H -#define _BITS_SIGTHREAD_H 1 - -#if !defined _SIGNAL_H && !defined _PTHREAD_H -# error "Never include this file directly. Use instead" -#endif - -/* Functions for handling signals. */ - -/* Modify the signal mask for the calling thread. The arguments have - the same meaning as for sigprocmask(2). */ -extern int pthread_sigmask (int __how, - const __sigset_t *__restrict __newmask, - __sigset_t *__restrict __oldmask)__THROW; - -/* Send signal SIGNO to the given thread. */ -extern int pthread_kill (pthread_t __threadid, int __signo) __THROW; - -#ifdef __USE_GNU -/* Queue signal and data to a thread. */ -extern int pthread_sigqueue (pthread_t __threadid, int __signo, - const union sigval __value) __THROW; -#endif - -#endif /* bits/sigthread.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/sockaddr.h b/openflow/usr/include/arm-linux-gnueabihf/bits/sockaddr.h deleted file mode 100644 index 0af58c9..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/sockaddr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Definition of struct sockaddr_* common members and sizes, generic version. - Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * Never include this file directly; use instead. - */ - -#ifndef _BITS_SOCKADDR_H -#define _BITS_SOCKADDR_H 1 - - -/* POSIX.1g specifies this type name for the `sa_family' member. */ -typedef unsigned short int sa_family_t; - -/* This macro is used to declare the initial common members - of the data types used for socket addresses, `struct sockaddr', - `struct sockaddr_in', `struct sockaddr_un', etc. */ - -#define __SOCKADDR_COMMON(sa_prefix) \ - sa_family_t sa_prefix##family - -#define __SOCKADDR_COMMON_SIZE (sizeof (unsigned short int)) - -/* Size of struct sockaddr_storage. */ -#define _SS_SIZE 128 - -#endif /* bits/sockaddr.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/socket.h b/openflow/usr/include/arm-linux-gnueabihf/bits/socket.h deleted file mode 100644 index 50bfbc3..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/socket.h +++ /dev/null @@ -1,389 +0,0 @@ -/* System-specific socket constants and types. Linux version. - Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef __BITS_SOCKET_H -#define __BITS_SOCKET_H - -#ifndef _SYS_SOCKET_H -# error "Never include directly; use instead." -#endif - -#define __need_size_t -#include - -#include - -/* Type for length arguments in socket calls. */ -#ifndef __socklen_t_defined -typedef __socklen_t socklen_t; -# define __socklen_t_defined -#endif - -/* Get the architecture-dependent definition of enum __socket_type. */ -#include - -/* Protocol families. */ -#define PF_UNSPEC 0 /* Unspecified. */ -#define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ -#define PF_UNIX PF_LOCAL /* POSIX name for PF_LOCAL. */ -#define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */ -#define PF_INET 2 /* IP protocol family. */ -#define PF_AX25 3 /* Amateur Radio AX.25. */ -#define PF_IPX 4 /* Novell Internet Protocol. */ -#define PF_APPLETALK 5 /* Appletalk DDP. */ -#define PF_NETROM 6 /* Amateur radio NetROM. */ -#define PF_BRIDGE 7 /* Multiprotocol bridge. */ -#define PF_ATMPVC 8 /* ATM PVCs. */ -#define PF_X25 9 /* Reserved for X.25 project. */ -#define PF_INET6 10 /* IP version 6. */ -#define PF_ROSE 11 /* Amateur Radio X.25 PLP. */ -#define PF_DECnet 12 /* Reserved for DECnet project. */ -#define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */ -#define PF_SECURITY 14 /* Security callback pseudo AF. */ -#define PF_KEY 15 /* PF_KEY key management API. */ -#define PF_NETLINK 16 -#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */ -#define PF_PACKET 17 /* Packet family. */ -#define PF_ASH 18 /* Ash. */ -#define PF_ECONET 19 /* Acorn Econet. */ -#define PF_ATMSVC 20 /* ATM SVCs. */ -#define PF_RDS 21 /* RDS sockets. */ -#define PF_SNA 22 /* Linux SNA Project */ -#define PF_IRDA 23 /* IRDA sockets. */ -#define PF_PPPOX 24 /* PPPoX sockets. */ -#define PF_WANPIPE 25 /* Wanpipe API sockets. */ -#define PF_LLC 26 /* Linux LLC. */ -#define PF_IB 27 /* Native InfiniBand address. */ -#define PF_MPLS 28 /* MPLS. */ -#define PF_CAN 29 /* Controller Area Network. */ -#define PF_TIPC 30 /* TIPC sockets. */ -#define PF_BLUETOOTH 31 /* Bluetooth sockets. */ -#define PF_IUCV 32 /* IUCV sockets. */ -#define PF_RXRPC 33 /* RxRPC sockets. */ -#define PF_ISDN 34 /* mISDN sockets. */ -#define PF_PHONET 35 /* Phonet sockets. */ -#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ -#define PF_CAIF 37 /* CAIF sockets. */ -#define PF_ALG 38 /* Algorithm sockets. */ -#define PF_NFC 39 /* NFC sockets. */ -#define PF_VSOCK 40 /* vSockets. */ -#define PF_MAX 41 /* For now.. */ - -/* Address families. */ -#define AF_UNSPEC PF_UNSPEC -#define AF_LOCAL PF_LOCAL -#define AF_UNIX PF_UNIX -#define AF_FILE PF_FILE -#define AF_INET PF_INET -#define AF_AX25 PF_AX25 -#define AF_IPX PF_IPX -#define AF_APPLETALK PF_APPLETALK -#define AF_NETROM PF_NETROM -#define AF_BRIDGE PF_BRIDGE -#define AF_ATMPVC PF_ATMPVC -#define AF_X25 PF_X25 -#define AF_INET6 PF_INET6 -#define AF_ROSE PF_ROSE -#define AF_DECnet PF_DECnet -#define AF_NETBEUI PF_NETBEUI -#define AF_SECURITY PF_SECURITY -#define AF_KEY PF_KEY -#define AF_NETLINK PF_NETLINK -#define AF_ROUTE PF_ROUTE -#define AF_PACKET PF_PACKET -#define AF_ASH PF_ASH -#define AF_ECONET PF_ECONET -#define AF_ATMSVC PF_ATMSVC -#define AF_RDS PF_RDS -#define AF_SNA PF_SNA -#define AF_IRDA PF_IRDA -#define AF_PPPOX PF_PPPOX -#define AF_WANPIPE PF_WANPIPE -#define AF_LLC PF_LLC -#define AF_IB PF_IB -#define AF_MPLS PF_MPLS -#define AF_CAN PF_CAN -#define AF_TIPC PF_TIPC -#define AF_BLUETOOTH PF_BLUETOOTH -#define AF_IUCV PF_IUCV -#define AF_RXRPC PF_RXRPC -#define AF_ISDN PF_ISDN -#define AF_PHONET PF_PHONET -#define AF_IEEE802154 PF_IEEE802154 -#define AF_CAIF PF_CAIF -#define AF_ALG PF_ALG -#define AF_NFC PF_NFC -#define AF_VSOCK PF_VSOCK -#define AF_MAX PF_MAX - -/* Socket level values. Others are defined in the appropriate headers. - - XXX These definitions also should go into the appropriate headers as - far as they are available. */ -#define SOL_RAW 255 -#define SOL_DECNET 261 -#define SOL_X25 262 -#define SOL_PACKET 263 -#define SOL_ATM 264 /* ATM layer (cell level). */ -#define SOL_AAL 265 /* ATM Adaption Layer (packet level). */ -#define SOL_IRDA 266 - -/* Maximum queue length specifiable by listen. */ -#define SOMAXCONN 128 - -/* Get the definition of the macro to define the common sockaddr members. */ -#include - -/* Structure describing a generic socket address. */ -struct sockaddr - { - __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ - char sa_data[14]; /* Address data. */ - }; - - -/* Structure large enough to hold any socket address (with the historical - exception of AF_UNIX). */ -#define __ss_aligntype unsigned long int -#define _SS_PADSIZE \ - (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) - -struct sockaddr_storage - { - __SOCKADDR_COMMON (ss_); /* Address family, etc. */ - char __ss_padding[_SS_PADSIZE]; - __ss_aligntype __ss_align; /* Force desired alignment. */ - }; - - -/* Bits in the FLAGS argument to `send', `recv', et al. */ -enum - { - MSG_OOB = 0x01, /* Process out-of-band data. */ -#define MSG_OOB MSG_OOB - MSG_PEEK = 0x02, /* Peek at incoming messages. */ -#define MSG_PEEK MSG_PEEK - MSG_DONTROUTE = 0x04, /* Don't use local routing. */ -#define MSG_DONTROUTE MSG_DONTROUTE -#ifdef __USE_GNU - /* DECnet uses a different name. */ - MSG_TRYHARD = MSG_DONTROUTE, -# define MSG_TRYHARD MSG_DONTROUTE -#endif - MSG_CTRUNC = 0x08, /* Control data lost before delivery. */ -#define MSG_CTRUNC MSG_CTRUNC - MSG_PROXY = 0x10, /* Supply or ask second address. */ -#define MSG_PROXY MSG_PROXY - MSG_TRUNC = 0x20, -#define MSG_TRUNC MSG_TRUNC - MSG_DONTWAIT = 0x40, /* Nonblocking IO. */ -#define MSG_DONTWAIT MSG_DONTWAIT - MSG_EOR = 0x80, /* End of record. */ -#define MSG_EOR MSG_EOR - MSG_WAITALL = 0x100, /* Wait for a full request. */ -#define MSG_WAITALL MSG_WAITALL - MSG_FIN = 0x200, -#define MSG_FIN MSG_FIN - MSG_SYN = 0x400, -#define MSG_SYN MSG_SYN - MSG_CONFIRM = 0x800, /* Confirm path validity. */ -#define MSG_CONFIRM MSG_CONFIRM - MSG_RST = 0x1000, -#define MSG_RST MSG_RST - MSG_ERRQUEUE = 0x2000, /* Fetch message from error queue. */ -#define MSG_ERRQUEUE MSG_ERRQUEUE - MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */ -#define MSG_NOSIGNAL MSG_NOSIGNAL - MSG_MORE = 0x8000, /* Sender will send more. */ -#define MSG_MORE MSG_MORE - MSG_WAITFORONE = 0x10000, /* Wait for at least one packet to return.*/ -#define MSG_WAITFORONE MSG_WAITFORONE - MSG_FASTOPEN = 0x20000000, /* Send data in TCP SYN. */ -#define MSG_FASTOPEN MSG_FASTOPEN - - MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file - descriptor received through - SCM_RIGHTS. */ -#define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC - }; - - -/* Structure describing messages sent by - `sendmsg' and received by `recvmsg'. */ -struct msghdr - { - void *msg_name; /* Address to send to/receive from. */ - socklen_t msg_namelen; /* Length of address data. */ - - struct iovec *msg_iov; /* Vector of data to send/receive into. */ - size_t msg_iovlen; /* Number of elements in the vector. */ - - void *msg_control; /* Ancillary data (eg BSD filedesc passing). */ - size_t msg_controllen; /* Ancillary data buffer length. - !! The type should be socklen_t but the - definition of the kernel is incompatible - with this. */ - - int msg_flags; /* Flags on received message. */ - }; - -/* Structure used for storage of ancillary data object information. */ -struct cmsghdr - { - size_t cmsg_len; /* Length of data in cmsg_data plus length - of cmsghdr structure. - !! The type should be socklen_t but the - definition of the kernel is incompatible - with this. */ - int cmsg_level; /* Originating protocol. */ - int cmsg_type; /* Protocol specific type. */ -#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L - __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */ -#endif - }; - -/* Ancillary data object manipulation macros. */ -#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L -# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data) -#else -# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1)) -#endif -#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg) -#define CMSG_FIRSTHDR(mhdr) \ - ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \ - ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0) -#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \ - & (size_t) ~(sizeof (size_t) - 1)) -#define CMSG_SPACE(len) (CMSG_ALIGN (len) \ - + CMSG_ALIGN (sizeof (struct cmsghdr))) -#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) - -extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr, - struct cmsghdr *__cmsg) __THROW; -#ifdef __USE_EXTERN_INLINES -# ifndef _EXTERN_INLINE -# define _EXTERN_INLINE __extern_inline -# endif -_EXTERN_INLINE struct cmsghdr * -__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) -{ - if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) - /* The kernel header does this so there may be a reason. */ - return (struct cmsghdr *) 0; - - __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg - + CMSG_ALIGN (__cmsg->cmsg_len)); - if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control - + __mhdr->msg_controllen) - || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len) - > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen))) - /* No more entries. */ - return (struct cmsghdr *) 0; - return __cmsg; -} -#endif /* Use `extern inline'. */ - -/* Socket level message types. This must match the definitions in - . */ -enum - { - SCM_RIGHTS = 0x01 /* Transfer file descriptors. */ -#define SCM_RIGHTS SCM_RIGHTS -#ifdef __USE_GNU - , SCM_CREDENTIALS = 0x02 /* Credentials passing. */ -# define SCM_CREDENTIALS SCM_CREDENTIALS -#endif - }; - -#ifdef __USE_GNU -/* User visible structure for SCM_CREDENTIALS message */ -struct ucred -{ - pid_t pid; /* PID of sending process. */ - uid_t uid; /* UID of sending process. */ - gid_t gid; /* GID of sending process. */ -}; -#endif - -/* Ugly workaround for unclean kernel headers. */ -#ifndef __USE_MISC -# ifndef FIOGETOWN -# define __SYS_SOCKET_H_undef_FIOGETOWN -# endif -# ifndef FIOSETOWN -# define __SYS_SOCKET_H_undef_FIOSETOWN -# endif -# ifndef SIOCATMARK -# define __SYS_SOCKET_H_undef_SIOCATMARK -# endif -# ifndef SIOCGPGRP -# define __SYS_SOCKET_H_undef_SIOCGPGRP -# endif -# ifndef SIOCGSTAMP -# define __SYS_SOCKET_H_undef_SIOCGSTAMP -# endif -# ifndef SIOCGSTAMPNS -# define __SYS_SOCKET_H_undef_SIOCGSTAMPNS -# endif -# ifndef SIOCSPGRP -# define __SYS_SOCKET_H_undef_SIOCSPGRP -# endif -#endif - -/* Get socket manipulation related informations from kernel headers. */ -#include - -#ifndef __USE_MISC -# ifdef __SYS_SOCKET_H_undef_FIOGETOWN -# undef __SYS_SOCKET_H_undef_FIOGETOWN -# undef FIOGETOWN -# endif -# ifdef __SYS_SOCKET_H_undef_FIOSETOWN -# undef __SYS_SOCKET_H_undef_FIOSETOWN -# undef FIOSETOWN -# endif -# ifdef __SYS_SOCKET_H_undef_SIOCATMARK -# undef __SYS_SOCKET_H_undef_SIOCATMARK -# undef SIOCATMARK -# endif -# ifdef __SYS_SOCKET_H_undef_SIOCGPGRP -# undef __SYS_SOCKET_H_undef_SIOCGPGRP -# undef SIOCGPGRP -# endif -# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMP -# undef __SYS_SOCKET_H_undef_SIOCGSTAMP -# undef SIOCGSTAMP -# endif -# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMPNS -# undef __SYS_SOCKET_H_undef_SIOCGSTAMPNS -# undef SIOCGSTAMPNS -# endif -# ifdef __SYS_SOCKET_H_undef_SIOCSPGRP -# undef __SYS_SOCKET_H_undef_SIOCSPGRP -# undef SIOCSPGRP -# endif -#endif - -/* Structure used to manipulate the SO_LINGER option. */ -struct linger - { - int l_onoff; /* Nonzero to linger on close. */ - int l_linger; /* Time to linger. */ - }; - -#endif /* bits/socket.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/socket2.h b/openflow/usr/include/arm-linux-gnueabihf/bits/socket2.h deleted file mode 100644 index f499518..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/socket2.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Checking macros for socket functions. - Copyright (C) 2005-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SOCKET_H -# error "Never include directly; use instead." -#endif - -extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen, - int __flags); -extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n, - int __flags), recv); -extern ssize_t __REDIRECT (__recv_chk_warn, - (int __fd, void *__buf, size_t __n, size_t __buflen, - int __flags), __recv_chk) - __warnattr ("recv called with bigger length than size of destination " - "buffer"); - -__fortify_function ssize_t -recv (int __fd, void *__buf, size_t __n, int __flags) -{ - if (__bos0 (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__n)) - return __recv_chk (__fd, __buf, __n, __bos0 (__buf), __flags); - - if (__n > __bos0 (__buf)) - return __recv_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags); - } - return __recv_alias (__fd, __buf, __n, __flags); -} - -extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n, - size_t __buflen, int __flags, - __SOCKADDR_ARG __addr, - socklen_t *__restrict __addr_len); -extern ssize_t __REDIRECT (__recvfrom_alias, - (int __fd, void *__restrict __buf, size_t __n, - int __flags, __SOCKADDR_ARG __addr, - socklen_t *__restrict __addr_len), recvfrom); -extern ssize_t __REDIRECT (__recvfrom_chk_warn, - (int __fd, void *__restrict __buf, size_t __n, - size_t __buflen, int __flags, - __SOCKADDR_ARG __addr, - socklen_t *__restrict __addr_len), __recvfrom_chk) - __warnattr ("recvfrom called with bigger length than size of " - "destination buffer"); - -__fortify_function ssize_t -recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, - __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) -{ - if (__bos0 (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__n)) - return __recvfrom_chk (__fd, __buf, __n, __bos0 (__buf), __flags, - __addr, __addr_len); - if (__n > __bos0 (__buf)) - return __recvfrom_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags, - __addr, __addr_len); - } - return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len); -} diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/socket_type.h b/openflow/usr/include/arm-linux-gnueabihf/bits/socket_type.h deleted file mode 100644 index 8501efb..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/socket_type.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Define enum __socket_type for generic Linux. - Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SOCKET_H -# error "Never include directly; use instead." -#endif - -/* Types of sockets. */ -enum __socket_type -{ - SOCK_STREAM = 1, /* Sequenced, reliable, connection-based - byte streams. */ -#define SOCK_STREAM SOCK_STREAM - SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams - of fixed maximum length. */ -#define SOCK_DGRAM SOCK_DGRAM - SOCK_RAW = 3, /* Raw protocol interface. */ -#define SOCK_RAW SOCK_RAW - SOCK_RDM = 4, /* Reliably-delivered messages. */ -#define SOCK_RDM SOCK_RDM - SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, - datagrams of fixed maximum length. */ -#define SOCK_SEQPACKET SOCK_SEQPACKET - SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */ -#define SOCK_DCCP SOCK_DCCP - SOCK_PACKET = 10, /* Linux specific way of getting packets - at the dev level. For writing rarp and - other similar things on the user level. */ -#define SOCK_PACKET SOCK_PACKET - - /* Flags to be ORed into the type parameter of socket and socketpair and - used for the flags parameter of paccept. */ - - SOCK_CLOEXEC = 02000000, /* Atomically set close-on-exec flag for the - new descriptor(s). */ -#define SOCK_CLOEXEC SOCK_CLOEXEC - SOCK_NONBLOCK = 00004000 /* Atomically mark descriptor(s) as - non-blocking. */ -#define SOCK_NONBLOCK SOCK_NONBLOCK -}; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/stab.def b/openflow/usr/include/arm-linux-gnueabihf/bits/stab.def deleted file mode 100644 index 2af2ddf..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/stab.def +++ /dev/null @@ -1,233 +0,0 @@ -/* Table of DBX symbol codes for the GNU system. - Copyright (C) 1988, 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* This contains contribution from Cygnus Support. */ - -/* Global variable. Only the name is significant. - To find the address, look in the corresponding external symbol. */ -__define_stab (N_GSYM, 0x20, "GSYM") - -/* Function name for BSD Fortran. Only the name is significant. - To find the address, look in the corresponding external symbol. */ -__define_stab (N_FNAME, 0x22, "FNAME") - -/* Function name or text-segment variable for C. Value is its address. - Desc is supposedly starting line number, but GCC doesn't set it - and DBX seems not to miss it. */ -__define_stab (N_FUN, 0x24, "FUN") - -/* Data-segment variable with internal linkage. Value is its address. - "Static Sym". */ -__define_stab (N_STSYM, 0x26, "STSYM") - -/* BSS-segment variable with internal linkage. Value is its address. */ -__define_stab (N_LCSYM, 0x28, "LCSYM") - -/* Name of main routine. Only the name is significant. - This is not used in C. */ -__define_stab (N_MAIN, 0x2a, "MAIN") - -/* Global symbol in Pascal. - Supposedly the value is its line number; I'm skeptical. */ -__define_stab (N_PC, 0x30, "PC") - -/* Number of symbols: 0, files,,funcs,lines according to Ultrix V4.0. */ -__define_stab (N_NSYMS, 0x32, "NSYMS") - -/* "No DST map for sym: name, ,0,type,ignored" according to Ultrix V4.0. */ -__define_stab (N_NOMAP, 0x34, "NOMAP") - -/* New stab from Solaris. I don't know what it means, but it - don't seem to contain useful information. */ -__define_stab (N_OBJ, 0x38, "OBJ") - -/* New stab from Solaris. I don't know what it means, but it - don't seem to contain useful information. Possibly related to the - optimization flags used in this module. */ -__define_stab (N_OPT, 0x3c, "OPT") - -/* Register variable. Value is number of register. */ -__define_stab (N_RSYM, 0x40, "RSYM") - -/* Modula-2 compilation unit. Can someone say what info it contains? */ -__define_stab (N_M2C, 0x42, "M2C") - -/* Line number in text segment. Desc is the line number; - value is corresponding address. */ -__define_stab (N_SLINE, 0x44, "SLINE") - -/* Similar, for data segment. */ -__define_stab (N_DSLINE, 0x46, "DSLINE") - -/* Similar, for bss segment. */ -__define_stab (N_BSLINE, 0x48, "BSLINE") - -/* Sun's source-code browser stabs. ?? Don't know what the fields are. - Supposedly the field is "path to associated .cb file". THIS VALUE - OVERLAPS WITH N_BSLINE! */ -__define_stab (N_BROWS, 0x48, "BROWS") - -/* GNU Modula-2 definition module dependency. Value is the modification time - of the definition file. Other is non-zero if it is imported with the - GNU M2 keyword %INITIALIZE. Perhaps N_M2C can be used if there - are enough empty fields? */ -__define_stab(N_DEFD, 0x4a, "DEFD") - -/* THE FOLLOWING TWO STAB VALUES CONFLICT. Happily, one is for Modula-2 - and one is for C++. Still,... */ -/* GNU C++ exception variable. Name is variable name. */ -__define_stab (N_EHDECL, 0x50, "EHDECL") -/* Modula2 info "for imc": name,,0,0,0 according to Ultrix V4.0. */ -__define_stab (N_MOD2, 0x50, "MOD2") - -/* GNU C++ `catch' clause. Value is its address. Desc is nonzero if - this entry is immediately followed by a CAUGHT stab saying what exception - was caught. Multiple CAUGHT stabs means that multiple exceptions - can be caught here. If Desc is 0, it means all exceptions are caught - here. */ -__define_stab (N_CATCH, 0x54, "CATCH") - -/* Structure or union element. Value is offset in the structure. */ -__define_stab (N_SSYM, 0x60, "SSYM") - -/* Name of main source file. - Value is starting text address of the compilation. */ -__define_stab (N_SO, 0x64, "SO") - -/* Automatic variable in the stack. Value is offset from frame pointer. - Also used for type descriptions. */ -__define_stab (N_LSYM, 0x80, "LSYM") - -/* Beginning of an include file. Only Sun uses this. - In an object file, only the name is significant. - The Sun linker puts data into some of the other fields. */ -__define_stab (N_BINCL, 0x82, "BINCL") - -/* Name of sub-source file (#include file). - Value is starting text address of the compilation. */ -__define_stab (N_SOL, 0x84, "SOL") - -/* Parameter variable. Value is offset from argument pointer. - (On most machines the argument pointer is the same as the frame pointer. */ -__define_stab (N_PSYM, 0xa0, "PSYM") - -/* End of an include file. No name. - This and N_BINCL act as brackets around the file's output. - In an object file, there is no significant data in this entry. - The Sun linker puts data into some of the fields. */ -__define_stab (N_EINCL, 0xa2, "EINCL") - -/* Alternate entry point. Value is its address. */ -__define_stab (N_ENTRY, 0xa4, "ENTRY") - -/* Beginning of lexical block. - The desc is the nesting level in lexical blocks. - The value is the address of the start of the text for the block. - The variables declared inside the block *precede* the N_LBRAC symbol. */ -__define_stab (N_LBRAC, 0xc0, "LBRAC") - -/* Place holder for deleted include file. Replaces a N_BINCL and everything - up to the corresponding N_EINCL. The Sun linker generates these when - it finds multiple identical copies of the symbols from an include file. - This appears only in output from the Sun linker. */ -__define_stab (N_EXCL, 0xc2, "EXCL") - -/* Modula-2 scope information. Can someone say what info it contains? */ -__define_stab (N_SCOPE, 0xc4, "SCOPE") - -/* End of a lexical block. Desc matches the N_LBRAC's desc. - The value is the address of the end of the text for the block. */ -__define_stab (N_RBRAC, 0xe0, "RBRAC") - -/* Begin named common block. Only the name is significant. */ -__define_stab (N_BCOMM, 0xe2, "BCOMM") - -/* End named common block. Only the name is significant - (and it should match the N_BCOMM). */ -__define_stab (N_ECOMM, 0xe4, "ECOMM") - -/* End common (local name): value is address. - I'm not sure how this is used. */ -__define_stab (N_ECOML, 0xe8, "ECOML") - -/* These STAB's are used on Gould systems for Non-Base register symbols - or something like that. FIXME. I have assigned the values at random - since I don't have a Gould here. Fixups from Gould folk welcome... */ -__define_stab (N_NBTEXT, 0xF0, "NBTEXT") -__define_stab (N_NBDATA, 0xF2, "NBDATA") -__define_stab (N_NBBSS, 0xF4, "NBBSS") -__define_stab (N_NBSTS, 0xF6, "NBSTS") -__define_stab (N_NBLCS, 0xF8, "NBLCS") - -/* Second symbol entry containing a length-value for the preceding entry. - The value is the length. */ -__define_stab (N_LENG, 0xfe, "LENG") - -/* The above information, in matrix format. - - STAB MATRIX - _________________________________________________ - | 00 - 1F are not dbx stab symbols | - | In most cases, the low bit is the EXTernal bit| - - | 00 UNDEF | 02 ABS | 04 TEXT | 06 DATA | - | 01 |EXT | 03 |EXT | 05 |EXT | 07 |EXT | - - | 08 BSS | 0A INDR | 0C FN_SEQ | 0E | - | 09 |EXT | 0B | 0D | 0F | - - | 10 | 12 COMM | 14 SETA | 16 SETT | - | 11 | 13 | 15 | 17 | - - | 18 SETD | 1A SETB | 1C SETV | 1E WARNING| - | 19 | 1B | 1D | 1F FN | - - |_______________________________________________| - | Debug entries with bit 01 set are unused. | - | 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM | - | 28 LCSYM | 2A MAIN | 2C | 2E | - | 30 PC | 32 NSYMS | 34 NOMAP | 36 | - | 38 OBJ | 3A | 3C OPT | 3E | - | 40 RSYM | 42 M2C | 44 SLINE | 46 DSLINE | - | 48 BSLINE*| 4A DEFD | 4C | 4E | - | 50 EHDECL*| 52 | 54 CATCH | 56 | - | 58 | 5A | 5C | 5E | - | 60 SSYM | 62 | 64 SO | 66 | - | 68 | 6A | 6C | 6E | - | 70 | 72 | 74 | 76 | - | 78 | 7A | 7C | 7E | - | 80 LSYM | 82 BINCL | 84 SOL | 86 | - | 88 | 8A | 8C | 8E | - | 90 | 92 | 94 | 96 | - | 98 | 9A | 9C | 9E | - | A0 PSYM | A2 EINCL | A4 ENTRY | A6 | - | A8 | AA | AC | AE | - | B0 | B2 | B4 | B6 | - | B8 | BA | BC | BE | - | C0 LBRAC | C2 EXCL | C4 SCOPE | C6 | - | C8 | CA | CC | CE | - | D0 | D2 | D4 | D6 | - | D8 | DA | DC | DE | - | E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 | - | E8 ECOML | EA | EC | EE | - | F0 | F2 | F4 | F6 | - | F8 | FA | FC | FE LENG | - +-----------------------------------------------+ - * 50 EHDECL is also MOD2. - * 48 BSLINE is also BROWS. - */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/stat.h b/openflow/usr/include/arm-linux-gnueabihf/bits/stat.h deleted file mode 100644 index 30d92f3..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/stat.h +++ /dev/null @@ -1,172 +0,0 @@ -/* Copyright (C) 1992-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - -struct stat - { - __dev_t st_dev; /* Device. */ - unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino_t __st_ino; /* 32bit file serial number. */ -#endif - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifndef __USE_FILE_OFFSET64 - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; -#else - __ino64_t st_ino; /* File serial number. */ -#endif - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - unsigned int __pad1; - - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - __ino64_t st_ino; /* File serial number. */ - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV -/* Nanosecond resolution time values are supported. */ -#define _STATBUF_ST_NSEC - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/statfs.h b/openflow/usr/include/arm-linux-gnueabihf/bits/statfs.h deleted file mode 100644 index 28b5952..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/statfs.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_STATFS_H -# error "Never include directly; use instead." -#endif - -#include - -struct statfs - { - __fsword_t f_type; - __fsword_t f_bsize; -#ifndef __USE_FILE_OFFSET64 - __fsblkcnt_t f_blocks; - __fsblkcnt_t f_bfree; - __fsblkcnt_t f_bavail; - __fsfilcnt_t f_files; - __fsfilcnt_t f_ffree; -#else - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; -#endif - __fsid_t f_fsid; - __fsword_t f_namelen; - __fsword_t f_frsize; - __fsword_t f_flags; - __fsword_t f_spare[4]; - }; - -#ifdef __USE_LARGEFILE64 -struct statfs64 - { - __fsword_t f_type; - __fsword_t f_bsize; - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsid_t f_fsid; - __fsword_t f_namelen; - __fsword_t f_frsize; - __fsword_t f_flags; - __fsword_t f_spare[4]; - }; -#endif - -/* Tell code we have these members. */ -#define _STATFS_F_NAMELEN -#define _STATFS_F_FRSIZE -#define _STATFS_F_FLAGS diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/statvfs.h b/openflow/usr/include/arm-linux-gnueabihf/bits/statvfs.h deleted file mode 100644 index 9244401..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/statvfs.h +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_STATVFS_H -# error "Never include directly; use instead." -#endif - -#include /* For __fsblkcnt_t and __fsfilcnt_t. */ - -#if (__WORDSIZE == 32 \ - && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) -#define _STATVFSBUF_F_UNUSED -#endif - -struct statvfs - { - unsigned long int f_bsize; - unsigned long int f_frsize; -#ifndef __USE_FILE_OFFSET64 - __fsblkcnt_t f_blocks; - __fsblkcnt_t f_bfree; - __fsblkcnt_t f_bavail; - __fsfilcnt_t f_files; - __fsfilcnt_t f_ffree; - __fsfilcnt_t f_favail; -#else - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsfilcnt64_t f_favail; -#endif - unsigned long int f_fsid; -#ifdef _STATVFSBUF_F_UNUSED - int __f_unused; -#endif - unsigned long int f_flag; - unsigned long int f_namemax; - int __f_spare[6]; - }; - -#ifdef __USE_LARGEFILE64 -struct statvfs64 - { - unsigned long int f_bsize; - unsigned long int f_frsize; - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsfilcnt64_t f_favail; - unsigned long int f_fsid; -#ifdef _STATVFSBUF_F_UNUSED - int __f_unused; -#endif - unsigned long int f_flag; - unsigned long int f_namemax; - int __f_spare[6]; - }; -#endif - -/* Definitions for the flag in `f_flag'. These definitions should be - kept in sync with the definitions in . */ -enum -{ - ST_RDONLY = 1, /* Mount read-only. */ -#define ST_RDONLY ST_RDONLY - ST_NOSUID = 2 /* Ignore suid and sgid bits. */ -#define ST_NOSUID ST_NOSUID -#ifdef __USE_GNU - , - ST_NODEV = 4, /* Disallow access to device special files. */ -# define ST_NODEV ST_NODEV - ST_NOEXEC = 8, /* Disallow program execution. */ -# define ST_NOEXEC ST_NOEXEC - ST_SYNCHRONOUS = 16, /* Writes are synced at once. */ -# define ST_SYNCHRONOUS ST_SYNCHRONOUS - ST_MANDLOCK = 64, /* Allow mandatory locks on an FS. */ -# define ST_MANDLOCK ST_MANDLOCK - ST_WRITE = 128, /* Write on file/directory/symlink. */ -# define ST_WRITE ST_WRITE - ST_APPEND = 256, /* Append-only file. */ -# define ST_APPEND ST_APPEND - ST_IMMUTABLE = 512, /* Immutable file. */ -# define ST_IMMUTABLE ST_IMMUTABLE - ST_NOATIME = 1024, /* Do not update access times. */ -# define ST_NOATIME ST_NOATIME - ST_NODIRATIME = 2048, /* Do not update directory access times. */ -# define ST_NODIRATIME ST_NODIRATIME - ST_RELATIME = 4096 /* Update atime relative to mtime/ctime. */ -# define ST_RELATIME ST_RELATIME -#endif /* Use GNU. */ -}; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/stdio-ldbl.h b/openflow/usr/include/arm-linux-gnueabihf/bits/stdio-ldbl.h deleted file mode 100644 index d19415f..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/stdio-ldbl.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -mlong-double-64 compatibility mode for stdio functions. - Copyright (C) 2006-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _STDIO_H -# error "Never include directly; use instead." -#endif - -__BEGIN_NAMESPACE_STD -__LDBL_REDIR_DECL (fprintf) -__LDBL_REDIR_DECL (printf) -__LDBL_REDIR_DECL (sprintf) -__LDBL_REDIR_DECL (vfprintf) -__LDBL_REDIR_DECL (vprintf) -__LDBL_REDIR_DECL (vsprintf) -#if defined __USE_ISOC99 && !defined __USE_GNU \ - && !defined __REDIRECT \ - && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) -__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf) -__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf) -__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf) -#else -__LDBL_REDIR_DECL (fscanf) -__LDBL_REDIR_DECL (scanf) -__LDBL_REDIR_DECL (sscanf) -#endif -__END_NAMESPACE_STD - -#if defined __USE_ISOC99 || defined __USE_UNIX98 -__BEGIN_NAMESPACE_C99 -__LDBL_REDIR_DECL (snprintf) -__LDBL_REDIR_DECL (vsnprintf) -__END_NAMESPACE_C99 -#endif - -#ifdef __USE_ISOC99 -__BEGIN_NAMESPACE_C99 -# if !defined __USE_GNU && !defined __REDIRECT \ - && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) -__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf) -__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf) -__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf) -# else -__LDBL_REDIR_DECL (vfscanf) -__LDBL_REDIR_DECL (vsscanf) -__LDBL_REDIR_DECL (vscanf) -# endif -__END_NAMESPACE_C99 -#endif - -#ifdef __USE_XOPEN2K8 -__LDBL_REDIR_DECL (vdprintf) -__LDBL_REDIR_DECL (dprintf) -#endif - -#ifdef __USE_GNU -__LDBL_REDIR_DECL (vasprintf) -__LDBL_REDIR_DECL (__asprintf) -__LDBL_REDIR_DECL (asprintf) -__LDBL_REDIR_DECL (obstack_printf) -__LDBL_REDIR_DECL (obstack_vprintf) -#endif - -#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function -__LDBL_REDIR_DECL (__sprintf_chk) -__LDBL_REDIR_DECL (__vsprintf_chk) -# if defined __USE_ISOC99 || defined __USE_UNIX98 -__LDBL_REDIR_DECL (__snprintf_chk) -__LDBL_REDIR_DECL (__vsnprintf_chk) -# endif -# if __USE_FORTIFY_LEVEL > 1 -__LDBL_REDIR_DECL (__fprintf_chk) -__LDBL_REDIR_DECL (__printf_chk) -__LDBL_REDIR_DECL (__vfprintf_chk) -__LDBL_REDIR_DECL (__vprintf_chk) -# ifdef __USE_XOPEN2K8 -__LDBL_REDIR_DECL (__dprintf_chk) -__LDBL_REDIR_DECL (__vdprintf_chk) -# endif -# ifdef __USE_GNU -__LDBL_REDIR_DECL (__asprintf_chk) -__LDBL_REDIR_DECL (__vasprintf_chk) -__LDBL_REDIR_DECL (__obstack_printf_chk) -__LDBL_REDIR_DECL (__obstack_vprintf_chk) -# endif -# endif -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/stdio.h b/openflow/usr/include/arm-linux-gnueabihf/bits/stdio.h deleted file mode 100644 index df57e7c..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/stdio.h +++ /dev/null @@ -1,190 +0,0 @@ -/* Optimizing macros and inline functions for stdio functions. - Copyright (C) 1998-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _STDIO_H -# error "Never include directly; use instead." -#endif - -#ifndef __extern_inline -# define __STDIO_INLINE inline -#else -# define __STDIO_INLINE __extern_inline -#endif - - -#ifdef __USE_EXTERN_INLINES -/* For -D_FORTIFY_SOURCE{,=2} bits/stdio2.h will define a different - inline. */ -# if !(__USE_FORTIFY_LEVEL > 0 && defined __fortify_function) -/* Write formatted output to stdout from argument list ARG. */ -__STDIO_INLINE int -vprintf (const char *__restrict __fmt, _G_va_list __arg) -{ - return vfprintf (stdout, __fmt, __arg); -} -# endif - -/* Read a character from stdin. */ -__STDIO_INLINE int -getchar (void) -{ - return _IO_getc (stdin); -} - - -# ifdef __USE_MISC -/* Faster version when locking is not necessary. */ -__STDIO_INLINE int -fgetc_unlocked (FILE *__fp) -{ - return _IO_getc_unlocked (__fp); -} -# endif /* misc */ - - -# ifdef __USE_POSIX -/* This is defined in POSIX.1:1996. */ -__STDIO_INLINE int -getc_unlocked (FILE *__fp) -{ - return _IO_getc_unlocked (__fp); -} - -/* This is defined in POSIX.1:1996. */ -__STDIO_INLINE int -getchar_unlocked (void) -{ - return _IO_getc_unlocked (stdin); -} -# endif /* POSIX */ - - -/* Write a character to stdout. */ -__STDIO_INLINE int -putchar (int __c) -{ - return _IO_putc (__c, stdout); -} - - -# ifdef __USE_MISC -/* Faster version when locking is not necessary. */ -__STDIO_INLINE int -fputc_unlocked (int __c, FILE *__stream) -{ - return _IO_putc_unlocked (__c, __stream); -} -# endif /* misc */ - - -# ifdef __USE_POSIX -/* This is defined in POSIX.1:1996. */ -__STDIO_INLINE int -putc_unlocked (int __c, FILE *__stream) -{ - return _IO_putc_unlocked (__c, __stream); -} - -/* This is defined in POSIX.1:1996. */ -__STDIO_INLINE int -putchar_unlocked (int __c) -{ - return _IO_putc_unlocked (__c, stdout); -} -# endif /* POSIX */ - - -# ifdef __USE_GNU -/* Like `getdelim', but reads up to a newline. */ -__STDIO_INLINE _IO_ssize_t -getline (char **__lineptr, size_t *__n, FILE *__stream) -{ - return __getdelim (__lineptr, __n, '\n', __stream); -} -# endif /* GNU */ - - -# ifdef __USE_MISC -/* Faster versions when locking is not required. */ -__STDIO_INLINE int -__NTH (feof_unlocked (FILE *__stream)) -{ - return _IO_feof_unlocked (__stream); -} - -/* Faster versions when locking is not required. */ -__STDIO_INLINE int -__NTH (ferror_unlocked (FILE *__stream)) -{ - return _IO_ferror_unlocked (__stream); -} -# endif /* misc */ - -#endif /* Use extern inlines. */ - - -#if defined __USE_MISC && defined __GNUC__ && defined __OPTIMIZE__ \ - && !defined __cplusplus -/* Perform some simple optimizations. */ -# define fread_unlocked(ptr, size, n, stream) \ - (__extension__ ((__builtin_constant_p (size) && __builtin_constant_p (n) \ - && (size_t) (size) * (size_t) (n) <= 8 \ - && (size_t) (size) != 0) \ - ? ({ char *__ptr = (char *) (ptr); \ - FILE *__stream = (stream); \ - size_t __cnt; \ - for (__cnt = (size_t) (size) * (size_t) (n); \ - __cnt > 0; --__cnt) \ - { \ - int __c = _IO_getc_unlocked (__stream); \ - if (__c == EOF) \ - break; \ - *__ptr++ = __c; \ - } \ - ((size_t) (size) * (size_t) (n) - __cnt) \ - / (size_t) (size); }) \ - : (((__builtin_constant_p (size) && (size_t) (size) == 0) \ - || (__builtin_constant_p (n) && (size_t) (n) == 0)) \ - /* Evaluate all parameters once. */ \ - ? ((void) (ptr), (void) (stream), (void) (size), \ - (void) (n), (size_t) 0) \ - : fread_unlocked (ptr, size, n, stream)))) - -# define fwrite_unlocked(ptr, size, n, stream) \ - (__extension__ ((__builtin_constant_p (size) && __builtin_constant_p (n) \ - && (size_t) (size) * (size_t) (n) <= 8 \ - && (size_t) (size) != 0) \ - ? ({ const char *__ptr = (const char *) (ptr); \ - FILE *__stream = (stream); \ - size_t __cnt; \ - for (__cnt = (size_t) (size) * (size_t) (n); \ - __cnt > 0; --__cnt) \ - if (_IO_putc_unlocked (*__ptr++, __stream) == EOF) \ - break; \ - ((size_t) (size) * (size_t) (n) - __cnt) \ - / (size_t) (size); }) \ - : (((__builtin_constant_p (size) && (size_t) (size) == 0) \ - || (__builtin_constant_p (n) && (size_t) (n) == 0)) \ - /* Evaluate all parameters once. */ \ - ? ((void) (ptr), (void) (stream), (void) (size), \ - (void) (n), (size_t) 0) \ - : fwrite_unlocked (ptr, size, n, stream)))) -#endif - -/* Define helper macro. */ -#undef __STDIO_INLINE diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/stdio2.h b/openflow/usr/include/arm-linux-gnueabihf/bits/stdio2.h deleted file mode 100644 index fa3be79..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/stdio2.h +++ /dev/null @@ -1,382 +0,0 @@ -/* Checking macros for stdio functions. - Copyright (C) 2004-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _STDIO_H -# error "Never include directly; use instead." -#endif - -extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen, - const char *__restrict __format, ...) __THROW; -extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen, - const char *__restrict __format, - _G_va_list __ap) __THROW; - -#ifdef __va_arg_pack -__fortify_function int -__NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...)) -{ - return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, - __bos (__s), __fmt, __va_arg_pack ()); -} -#elif !defined __cplusplus -# define sprintf(str, ...) \ - __builtin___sprintf_chk (str, __USE_FORTIFY_LEVEL - 1, __bos (str), \ - __VA_ARGS__) -#endif - -__fortify_function int -__NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt, - _G_va_list __ap)) -{ - return __builtin___vsprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, - __bos (__s), __fmt, __ap); -} - -#if defined __USE_ISOC99 || defined __USE_UNIX98 - -extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag, - size_t __slen, const char *__restrict __format, - ...) __THROW; -extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag, - size_t __slen, const char *__restrict __format, - _G_va_list __ap) __THROW; - -# ifdef __va_arg_pack -__fortify_function int -__NTH (snprintf (char *__restrict __s, size_t __n, - const char *__restrict __fmt, ...)) -{ - return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, - __bos (__s), __fmt, __va_arg_pack ()); -} -# elif !defined __cplusplus -# define snprintf(str, len, ...) \ - __builtin___snprintf_chk (str, len, __USE_FORTIFY_LEVEL - 1, __bos (str), \ - __VA_ARGS__) -# endif - -__fortify_function int -__NTH (vsnprintf (char *__restrict __s, size_t __n, - const char *__restrict __fmt, _G_va_list __ap)) -{ - return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, - __bos (__s), __fmt, __ap); -} - -#endif - -#if __USE_FORTIFY_LEVEL > 1 - -extern int __fprintf_chk (FILE *__restrict __stream, int __flag, - const char *__restrict __format, ...); -extern int __printf_chk (int __flag, const char *__restrict __format, ...); -extern int __vfprintf_chk (FILE *__restrict __stream, int __flag, - const char *__restrict __format, _G_va_list __ap); -extern int __vprintf_chk (int __flag, const char *__restrict __format, - _G_va_list __ap); - -# ifdef __va_arg_pack -__fortify_function int -fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) -{ - return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, - __va_arg_pack ()); -} - -__fortify_function int -printf (const char *__restrict __fmt, ...) -{ - return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); -} -# elif !defined __cplusplus -# define printf(...) \ - __printf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__) -# define fprintf(stream, ...) \ - __fprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) -# endif - -__fortify_function int -vprintf (const char *__restrict __fmt, _G_va_list __ap) -{ -#ifdef __USE_EXTERN_INLINES - return __vfprintf_chk (stdout, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); -#else - return __vprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap); -#endif -} - -__fortify_function int -vfprintf (FILE *__restrict __stream, - const char *__restrict __fmt, _G_va_list __ap) -{ - return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); -} - -# ifdef __USE_XOPEN2K8 -extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt, - ...) __attribute__ ((__format__ (__printf__, 3, 4))); -extern int __vdprintf_chk (int __fd, int __flag, - const char *__restrict __fmt, _G_va_list __arg) - __attribute__ ((__format__ (__printf__, 3, 0))); - -# ifdef __va_arg_pack -__fortify_function int -dprintf (int __fd, const char *__restrict __fmt, ...) -{ - return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, - __va_arg_pack ()); -} -# elif !defined __cplusplus -# define dprintf(fd, ...) \ - __dprintf_chk (fd, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) -# endif - -__fortify_function int -vdprintf (int __fd, const char *__restrict __fmt, _G_va_list __ap) -{ - return __vdprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); -} -# endif - -# ifdef __USE_GNU - -extern int __asprintf_chk (char **__restrict __ptr, int __flag, - const char *__restrict __fmt, ...) - __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur; -extern int __vasprintf_chk (char **__restrict __ptr, int __flag, - const char *__restrict __fmt, _G_va_list __arg) - __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur; -extern int __obstack_printf_chk (struct obstack *__restrict __obstack, - int __flag, const char *__restrict __format, - ...) - __THROW __attribute__ ((__format__ (__printf__, 3, 4))); -extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack, - int __flag, - const char *__restrict __format, - _G_va_list __args) - __THROW __attribute__ ((__format__ (__printf__, 3, 0))); - -# ifdef __va_arg_pack -__fortify_function int -__NTH (asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...)) -{ - return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, - __va_arg_pack ()); -} - -__fortify_function int -__NTH (__asprintf (char **__restrict __ptr, const char *__restrict __fmt, - ...)) -{ - return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, - __va_arg_pack ()); -} - -__fortify_function int -__NTH (obstack_printf (struct obstack *__restrict __obstack, - const char *__restrict __fmt, ...)) -{ - return __obstack_printf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt, - __va_arg_pack ()); -} -# elif !defined __cplusplus -# define asprintf(ptr, ...) \ - __asprintf_chk (ptr, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) -# define __asprintf(ptr, ...) \ - __asprintf_chk (ptr, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) -# define obstack_printf(obstack, ...) \ - __obstack_printf_chk (obstack, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) -# endif - -__fortify_function int -__NTH (vasprintf (char **__restrict __ptr, const char *__restrict __fmt, - _G_va_list __ap)) -{ - return __vasprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); -} - -__fortify_function int -__NTH (obstack_vprintf (struct obstack *__restrict __obstack, - const char *__restrict __fmt, _G_va_list __ap)) -{ - return __obstack_vprintf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt, - __ap); -} - -# endif - -#endif - -#if !defined __USE_ISOC11 \ - || (defined __cplusplus && __cplusplus <= 201103L && !defined __USE_GNU) -extern char *__gets_chk (char *__str, size_t) __wur; -extern char *__REDIRECT (__gets_warn, (char *__str), gets) - __wur __warnattr ("please use fgets or getline instead, gets can't " - "specify buffer size"); - -__fortify_function __wur char * -gets (char *__str) -{ - if (__bos (__str) != (size_t) -1) - return __gets_chk (__str, __bos (__str)); - return __gets_warn (__str); -} -#endif - -extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n, - FILE *__restrict __stream) __wur; -extern char *__REDIRECT (__fgets_alias, - (char *__restrict __s, int __n, - FILE *__restrict __stream), fgets) __wur; -extern char *__REDIRECT (__fgets_chk_warn, - (char *__restrict __s, size_t __size, int __n, - FILE *__restrict __stream), __fgets_chk) - __wur __warnattr ("fgets called with bigger size than length " - "of destination buffer"); - -__fortify_function __wur char * -fgets (char *__restrict __s, int __n, FILE *__restrict __stream) -{ - if (__bos (__s) != (size_t) -1) - { - if (!__builtin_constant_p (__n) || __n <= 0) - return __fgets_chk (__s, __bos (__s), __n, __stream); - - if ((size_t) __n > __bos (__s)) - return __fgets_chk_warn (__s, __bos (__s), __n, __stream); - } - return __fgets_alias (__s, __n, __stream); -} - -extern size_t __fread_chk (void *__restrict __ptr, size_t __ptrlen, - size_t __size, size_t __n, - FILE *__restrict __stream) __wur; -extern size_t __REDIRECT (__fread_alias, - (void *__restrict __ptr, size_t __size, - size_t __n, FILE *__restrict __stream), - fread) __wur; -extern size_t __REDIRECT (__fread_chk_warn, - (void *__restrict __ptr, size_t __ptrlen, - size_t __size, size_t __n, - FILE *__restrict __stream), - __fread_chk) - __wur __warnattr ("fread called with bigger size * nmemb than length " - "of destination buffer"); - -__fortify_function __wur size_t -fread (void *__restrict __ptr, size_t __size, size_t __n, - FILE *__restrict __stream) -{ - if (__bos0 (__ptr) != (size_t) -1) - { - if (!__builtin_constant_p (__size) - || !__builtin_constant_p (__n) - || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2))) - return __fread_chk (__ptr, __bos0 (__ptr), __size, __n, __stream); - - if (__size * __n > __bos0 (__ptr)) - return __fread_chk_warn (__ptr, __bos0 (__ptr), __size, __n, __stream); - } - return __fread_alias (__ptr, __size, __n, __stream); -} - -#ifdef __USE_GNU -extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size, - int __n, FILE *__restrict __stream) __wur; -extern char *__REDIRECT (__fgets_unlocked_alias, - (char *__restrict __s, int __n, - FILE *__restrict __stream), fgets_unlocked) __wur; -extern char *__REDIRECT (__fgets_unlocked_chk_warn, - (char *__restrict __s, size_t __size, int __n, - FILE *__restrict __stream), __fgets_unlocked_chk) - __wur __warnattr ("fgets_unlocked called with bigger size than length " - "of destination buffer"); - -__fortify_function __wur char * -fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream) -{ - if (__bos (__s) != (size_t) -1) - { - if (!__builtin_constant_p (__n) || __n <= 0) - return __fgets_unlocked_chk (__s, __bos (__s), __n, __stream); - - if ((size_t) __n > __bos (__s)) - return __fgets_unlocked_chk_warn (__s, __bos (__s), __n, __stream); - } - return __fgets_unlocked_alias (__s, __n, __stream); -} -#endif - -#ifdef __USE_MISC -# undef fread_unlocked -extern size_t __fread_unlocked_chk (void *__restrict __ptr, size_t __ptrlen, - size_t __size, size_t __n, - FILE *__restrict __stream) __wur; -extern size_t __REDIRECT (__fread_unlocked_alias, - (void *__restrict __ptr, size_t __size, - size_t __n, FILE *__restrict __stream), - fread_unlocked) __wur; -extern size_t __REDIRECT (__fread_unlocked_chk_warn, - (void *__restrict __ptr, size_t __ptrlen, - size_t __size, size_t __n, - FILE *__restrict __stream), - __fread_unlocked_chk) - __wur __warnattr ("fread_unlocked called with bigger size * nmemb than " - "length of destination buffer"); - -__fortify_function __wur size_t -fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n, - FILE *__restrict __stream) -{ - if (__bos0 (__ptr) != (size_t) -1) - { - if (!__builtin_constant_p (__size) - || !__builtin_constant_p (__n) - || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2))) - return __fread_unlocked_chk (__ptr, __bos0 (__ptr), __size, __n, - __stream); - - if (__size * __n > __bos0 (__ptr)) - return __fread_unlocked_chk_warn (__ptr, __bos0 (__ptr), __size, __n, - __stream); - } - -# ifdef __USE_EXTERN_INLINES - if (__builtin_constant_p (__size) - && __builtin_constant_p (__n) - && (__size | __n) < (((size_t) 1) << (8 * sizeof (size_t) / 2)) - && __size * __n <= 8) - { - size_t __cnt = __size * __n; - char *__cptr = (char *) __ptr; - if (__cnt == 0) - return 0; - - for (; __cnt > 0; --__cnt) - { - int __c = _IO_getc_unlocked (__stream); - if (__c == EOF) - break; - *__cptr++ = __c; - } - return (__cptr - (char *) __ptr) / __size; - } -# endif - return __fread_unlocked_alias (__ptr, __size, __n, __stream); -} -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/stdio_lim.h b/openflow/usr/include/arm-linux-gnueabihf/bits/stdio_lim.h deleted file mode 100644 index 247d8c6..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/stdio_lim.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 1994-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _STDIO_H && !defined __need_FOPEN_MAX && !defined __need_IOV_MAX -# error "Never include directly; use instead." -#endif - -#ifdef _STDIO_H -# define L_tmpnam 20 -# define TMP_MAX 238328 -# define FILENAME_MAX 4096 - -# ifdef __USE_POSIX -# define L_ctermid 9 -# if !defined __USE_XOPEN2K || defined __USE_GNU -# define L_cuserid 9 -# endif -# endif -#endif - -#if defined __need_FOPEN_MAX || defined _STDIO_H -# undef FOPEN_MAX -# define FOPEN_MAX 16 -#endif - -#if defined __need_IOV_MAX && !defined IOV_MAX -# define IOV_MAX 1024 -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/stdlib-bsearch.h b/openflow/usr/include/arm-linux-gnueabihf/bits/stdlib-bsearch.h deleted file mode 100644 index bbc8f98..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/stdlib-bsearch.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Perform binary search - inline version. - Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -__extern_inline void * -bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size, - __compar_fn_t __compar) -{ - size_t __l, __u, __idx; - const void *__p; - int __comparison; - - __l = 0; - __u = __nmemb; - while (__l < __u) - { - __idx = (__l + __u) / 2; - __p = (void *) (((const char *) __base) + (__idx * __size)); - __comparison = (*__compar) (__key, __p); - if (__comparison < 0) - __u = __idx; - else if (__comparison > 0) - __l = __idx + 1; - else - return (void *) __p; - } - - return NULL; -} diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/stdlib-float.h b/openflow/usr/include/arm-linux-gnueabihf/bits/stdlib-float.h deleted file mode 100644 index c3bbd04..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/stdlib-float.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Floating-point inline functions for stdlib.h. - Copyright (C) 2012-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _STDLIB_H -# error "Never use directly; include instead." -#endif - -#ifdef __USE_EXTERN_INLINES -__BEGIN_NAMESPACE_STD -__extern_inline double -__NTH (atof (const char *__nptr)) -{ - return strtod (__nptr, (char **) NULL); -} -__END_NAMESPACE_STD -#endif /* Optimizing and Inlining. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/stdlib-ldbl.h b/openflow/usr/include/arm-linux-gnueabihf/bits/stdlib-ldbl.h deleted file mode 100644 index acff499..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/stdlib-ldbl.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -mlong-double-64 compatibility mode for functions. - Copyright (C) 2006-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _STDLIB_H -# error "Never include directly; use instead." -#endif - -#ifdef __USE_ISOC99 -__BEGIN_NAMESPACE_C99 -__LDBL_REDIR1_DECL (strtold, strtod) -__END_NAMESPACE_C99 -#endif - -#ifdef __USE_GNU -__LDBL_REDIR1_DECL (strtold_l, strtod_l) -#endif - -#ifdef __USE_MISC -__LDBL_REDIR1_DECL (qecvt, ecvt) -__LDBL_REDIR1_DECL (qfcvt, fcvt) -__LDBL_REDIR1_DECL (qgcvt, gcvt) -__LDBL_REDIR1_DECL (qecvt_r, ecvt_r) -__LDBL_REDIR1_DECL (qfcvt_r, fcvt_r) -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/stdlib.h b/openflow/usr/include/arm-linux-gnueabihf/bits/stdlib.h deleted file mode 100644 index 20fe986..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/stdlib.h +++ /dev/null @@ -1,155 +0,0 @@ -/* Checking macros for stdlib functions. - Copyright (C) 2005-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _STDLIB_H -# error "Never include directly; use instead." -#endif - -extern char *__realpath_chk (const char *__restrict __name, - char *__restrict __resolved, - size_t __resolvedlen) __THROW __wur; -extern char *__REDIRECT_NTH (__realpath_alias, - (const char *__restrict __name, - char *__restrict __resolved), realpath) __wur; -extern char *__REDIRECT_NTH (__realpath_chk_warn, - (const char *__restrict __name, - char *__restrict __resolved, - size_t __resolvedlen), __realpath_chk) __wur - __warnattr ("second argument of realpath must be either NULL or at " - "least PATH_MAX bytes long buffer"); - -__fortify_function __wur char * -__NTH (realpath (const char *__restrict __name, char *__restrict __resolved)) -{ - if (__bos (__resolved) != (size_t) -1) - { -#if defined _LIBC_LIMITS_H_ && defined PATH_MAX - if (__bos (__resolved) < PATH_MAX) - return __realpath_chk_warn (__name, __resolved, __bos (__resolved)); -#endif - return __realpath_chk (__name, __resolved, __bos (__resolved)); - } - - return __realpath_alias (__name, __resolved); -} - - -extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen, - size_t __nreal) __THROW __nonnull ((2)); -extern int __REDIRECT_NTH (__ptsname_r_alias, (int __fd, char *__buf, - size_t __buflen), ptsname_r) - __nonnull ((2)); -extern int __REDIRECT_NTH (__ptsname_r_chk_warn, - (int __fd, char *__buf, size_t __buflen, - size_t __nreal), __ptsname_r_chk) - __nonnull ((2)) __warnattr ("ptsname_r called with buflen bigger than " - "size of buf"); - -__fortify_function int -__NTH (ptsname_r (int __fd, char *__buf, size_t __buflen)) -{ - if (__bos (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__buflen)) - return __ptsname_r_chk (__fd, __buf, __buflen, __bos (__buf)); - if (__buflen > __bos (__buf)) - return __ptsname_r_chk_warn (__fd, __buf, __buflen, __bos (__buf)); - } - return __ptsname_r_alias (__fd, __buf, __buflen); -} - - -extern int __wctomb_chk (char *__s, wchar_t __wchar, size_t __buflen) - __THROW __wur; -extern int __REDIRECT_NTH (__wctomb_alias, (char *__s, wchar_t __wchar), - wctomb) __wur; - -__fortify_function __wur int -__NTH (wctomb (char *__s, wchar_t __wchar)) -{ - /* We would have to include to get a definition of MB_LEN_MAX. - But this would only disturb the namespace. So we define our own - version here. */ -#define __STDLIB_MB_LEN_MAX 16 -#if defined MB_LEN_MAX && MB_LEN_MAX != __STDLIB_MB_LEN_MAX -# error "Assumed value of MB_LEN_MAX wrong" -#endif - if (__bos (__s) != (size_t) -1 && __STDLIB_MB_LEN_MAX > __bos (__s)) - return __wctomb_chk (__s, __wchar, __bos (__s)); - return __wctomb_alias (__s, __wchar); -} - - -extern size_t __mbstowcs_chk (wchar_t *__restrict __dst, - const char *__restrict __src, - size_t __len, size_t __dstlen) __THROW; -extern size_t __REDIRECT_NTH (__mbstowcs_alias, - (wchar_t *__restrict __dst, - const char *__restrict __src, - size_t __len), mbstowcs); -extern size_t __REDIRECT_NTH (__mbstowcs_chk_warn, - (wchar_t *__restrict __dst, - const char *__restrict __src, - size_t __len, size_t __dstlen), __mbstowcs_chk) - __warnattr ("mbstowcs called with dst buffer smaller than len " - "* sizeof (wchar_t)"); - -__fortify_function size_t -__NTH (mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src, - size_t __len)) -{ - if (__bos (__dst) != (size_t) -1) - { - if (!__builtin_constant_p (__len)) - return __mbstowcs_chk (__dst, __src, __len, - __bos (__dst) / sizeof (wchar_t)); - - if (__len > __bos (__dst) / sizeof (wchar_t)) - return __mbstowcs_chk_warn (__dst, __src, __len, - __bos (__dst) / sizeof (wchar_t)); - } - return __mbstowcs_alias (__dst, __src, __len); -} - - -extern size_t __wcstombs_chk (char *__restrict __dst, - const wchar_t *__restrict __src, - size_t __len, size_t __dstlen) __THROW; -extern size_t __REDIRECT_NTH (__wcstombs_alias, - (char *__restrict __dst, - const wchar_t *__restrict __src, - size_t __len), wcstombs); -extern size_t __REDIRECT_NTH (__wcstombs_chk_warn, - (char *__restrict __dst, - const wchar_t *__restrict __src, - size_t __len, size_t __dstlen), __wcstombs_chk) - __warnattr ("wcstombs called with dst buffer smaller than len"); - -__fortify_function size_t -__NTH (wcstombs (char *__restrict __dst, const wchar_t *__restrict __src, - size_t __len)) -{ - if (__bos (__dst) != (size_t) -1) - { - if (!__builtin_constant_p (__len)) - return __wcstombs_chk (__dst, __src, __len, __bos (__dst)); - if (__len > __bos (__dst)) - return __wcstombs_chk_warn (__dst, __src, __len, __bos (__dst)); - } - return __wcstombs_alias (__dst, __src, __len); -} diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/string.h b/openflow/usr/include/arm-linux-gnueabihf/bits/string.h deleted file mode 100644 index 89c627c..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/string.h +++ /dev/null @@ -1,18 +0,0 @@ -/* This file should provide inline versions of string functions. - - Surround GCC-specific parts with #ifdef __GNUC__, and use `__extern_inline'. - - This file should define __STRING_INLINES if functions are actually defined - as inlines. */ - -#ifndef _BITS_STRING_H -#define _BITS_STRING_H 1 - -/* Define whether to use the unaligned string inline ABI. - The string inline functions are an external ABI, thus cannot be changed - after the first release of a new target (unlike _STRING_ARCH_unaligned - which may be changed from release to release). Targets must support - unaligned accesses in hardware if either define is set to true. */ -#define _STRING_INLINE_unaligned 0 - -#endif /* bits/string.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/string2.h b/openflow/usr/include/arm-linux-gnueabihf/bits/string2.h deleted file mode 100644 index 0dc51e5..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/string2.h +++ /dev/null @@ -1,1329 +0,0 @@ -/* Machine-independant string function optimizations. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _STRING_H -# error "Never use directly; include instead." -#endif - -#ifndef __NO_STRING_INLINES - -/* Unlike the definitions in the header the - definitions contained here are not optimized down to assembler - level. Those optimizations are not always a good idea since this - means the code size increases a lot. Instead the definitions here - optimize some functions in a way which do not dramatically - increase the code size and which do not use assembler. The main - trick is to use GCC's `__builtin_constant_p' function. - - Every function XXX which has a defined version in - must be accompanied by a symbol _HAVE_STRING_ARCH_XXX - to make sure we don't get redefinitions. - - We must use here macros instead of inline functions since the - trick won't work with the latter. */ - -#ifndef __STRING_INLINE -# ifdef __cplusplus -# define __STRING_INLINE inline -# else -# define __STRING_INLINE __extern_inline -# endif -#endif - -#if _STRING_INLINE_unaligned -/* If we can do unaligned memory accesses we must know the endianess. */ -# include -# include - -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define __STRING2_SMALL_GET16(src, idx) \ - (((const unsigned char *) (const char *) (src))[idx + 1] << 8 \ - | ((const unsigned char *) (const char *) (src))[idx]) -# define __STRING2_SMALL_GET32(src, idx) \ - (((((const unsigned char *) (const char *) (src))[idx + 3] << 8 \ - | ((const unsigned char *) (const char *) (src))[idx + 2]) << 8 \ - | ((const unsigned char *) (const char *) (src))[idx + 1]) << 8 \ - | ((const unsigned char *) (const char *) (src))[idx]) -# else -# define __STRING2_SMALL_GET16(src, idx) \ - (((const unsigned char *) (const char *) (src))[idx] << 8 \ - | ((const unsigned char *) (const char *) (src))[idx + 1]) -# define __STRING2_SMALL_GET32(src, idx) \ - (((((const unsigned char *) (const char *) (src))[idx] << 8 \ - | ((const unsigned char *) (const char *) (src))[idx + 1]) << 8 \ - | ((const unsigned char *) (const char *) (src))[idx + 2]) << 8 \ - | ((const unsigned char *) (const char *) (src))[idx + 3]) -# endif -#else -/* These are a few types we need for the optimizations if we cannot - use unaligned memory accesses. */ -# define __STRING2_COPY_TYPE(N) \ - typedef struct { unsigned char __arr[N]; } \ - __attribute__ ((__packed__)) __STRING2_COPY_ARR##N -__STRING2_COPY_TYPE (2); -__STRING2_COPY_TYPE (3); -__STRING2_COPY_TYPE (4); -__STRING2_COPY_TYPE (5); -__STRING2_COPY_TYPE (6); -__STRING2_COPY_TYPE (7); -__STRING2_COPY_TYPE (8); -# undef __STRING2_COPY_TYPE -#endif - -/* Dereferencing a pointer arg to run sizeof on it fails for the void - pointer case, so we use this instead. - Note that __x is evaluated twice. */ -#define __string2_1bptr_p(__x) \ - ((size_t)(const void *)((__x) + 1) - (size_t)(const void *)(__x) == 1) - -/* Set N bytes of S to C. */ -#if !defined _HAVE_STRING_ARCH_memset -# if !__GNUC_PREREQ (3, 0) -# if _STRING_INLINE_unaligned -# define memset(s, c, n) \ - (__extension__ (__builtin_constant_p (n) && (n) <= 16 \ - ? ((n) == 1 \ - ? __memset_1 (s, c) \ - : __memset_gc (s, c, n)) \ - : (__builtin_constant_p (c) && (c) == '\0' \ - ? ({ void *__s = (s); __bzero (__s, n); __s; }) \ - : memset (s, c, n)))) - -# define __memset_1(s, c) ({ void *__s = (s); \ - *((__uint8_t *) __s) = (__uint8_t) c; __s; }) - -# define __memset_gc(s, c, n) \ - ({ void *__s = (s); \ - union { \ - unsigned int __ui; \ - unsigned short int __usi; \ - unsigned char __uc; \ - } *__u = __s; \ - __uint8_t __c = (__uint8_t) (c); \ - \ - /* This `switch' statement will be removed at compile-time. */ \ - switch ((unsigned int) (n)) \ - { \ - case 15: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 11: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 7: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 3: \ - __u->__usi = (unsigned short int) __c * 0x0101; \ - __u = __extension__ ((void *) __u + 2); \ - __u->__uc = (unsigned char) __c; \ - break; \ - \ - case 14: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 10: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 6: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 2: \ - __u->__usi = (unsigned short int) __c * 0x0101; \ - break; \ - \ - case 13: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 9: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 5: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 1: \ - __u->__uc = (unsigned char) __c; \ - break; \ - \ - case 16: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 12: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 8: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 4: \ - __u->__ui = __c * 0x01010101; \ - case 0: \ - break; \ - } \ - \ - __s; }) -# else -# define memset(s, c, n) \ - (__extension__ (__builtin_constant_p (c) && (c) == '\0' \ - ? ({ void *__s = (s); __bzero (__s, n); __s; }) \ - : memset (s, c, n))) -# endif -# endif - -/* GCC < 3.0 optimizes memset(s, 0, n) but not bzero(s, n). - The optimization is broken before EGCS 1.1. - GCC 3.0+ has __builtin_bzero as well, but at least till GCC 3.4 - if it decides to call the library function, it calls memset - and not bzero. */ -# if __GNUC_PREREQ (2, 91) -# define __bzero(s, n) __builtin_memset (s, '\0', n) -# endif - -#endif - - -/* Copy N bytes from SRC to DEST, returning pointer to byte following the - last copied. */ -#ifdef __USE_GNU -# if !defined _HAVE_STRING_ARCH_mempcpy || defined _FORCE_INLINES -# ifndef _HAVE_STRING_ARCH_mempcpy -# if __GNUC_PREREQ (3, 4) -# define __mempcpy(dest, src, n) __builtin_mempcpy (dest, src, n) -# elif __GNUC_PREREQ (3, 0) -# define __mempcpy(dest, src, n) \ - (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \ - && __string2_1bptr_p (src) && n <= 8 \ - ? __builtin_memcpy (dest, src, n) + (n) \ - : __mempcpy (dest, src, n))) -# else -# define __mempcpy(dest, src, n) \ - (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \ - && __string2_1bptr_p (src) && n <= 8 \ - ? __mempcpy_small (dest, __mempcpy_args (src), n) \ - : __mempcpy (dest, src, n))) -# endif -/* In glibc we use this function frequently but for namespace reasons - we have to use the name `__mempcpy'. */ -# define mempcpy(dest, src, n) __mempcpy (dest, src, n) -# endif - -# if !__GNUC_PREREQ (3, 0) || defined _FORCE_INLINES -# if _STRING_INLINE_unaligned -# ifndef _FORCE_INLINES -# define __mempcpy_args(src) \ - ((const char *) (src))[0], ((const char *) (src))[2], \ - ((const char *) (src))[4], ((const char *) (src))[6], \ - __extension__ __STRING2_SMALL_GET16 (src, 0), \ - __extension__ __STRING2_SMALL_GET16 (src, 4), \ - __extension__ __STRING2_SMALL_GET32 (src, 0), \ - __extension__ __STRING2_SMALL_GET32 (src, 4) -# endif -__STRING_INLINE void *__mempcpy_small (void *, char, char, char, char, - __uint16_t, __uint16_t, __uint32_t, - __uint32_t, size_t); -__STRING_INLINE void * -__mempcpy_small (void *__dest1, - char __src0_1, char __src2_1, char __src4_1, char __src6_1, - __uint16_t __src0_2, __uint16_t __src4_2, - __uint32_t __src0_4, __uint32_t __src4_4, - size_t __srclen) -{ - union { - __uint32_t __ui; - __uint16_t __usi; - unsigned char __uc; - unsigned char __c; - } *__u = __dest1; - switch ((unsigned int) __srclen) - { - case 1: - __u->__c = __src0_1; - __u = __extension__ ((void *) __u + 1); - break; - case 2: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 2); - break; - case 3: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 2); - __u->__c = __src2_1; - __u = __extension__ ((void *) __u + 1); - break; - case 4: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - break; - case 5: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__c = __src4_1; - __u = __extension__ ((void *) __u + 1); - break; - case 6: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 2); - break; - case 7: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 2); - __u->__c = __src6_1; - __u = __extension__ ((void *) __u + 1); - break; - case 8: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__ui = __src4_4; - __u = __extension__ ((void *) __u + 4); - break; - } - return (void *) __u; -} -# else -# ifndef _FORCE_INLINES -# define __mempcpy_args(src) \ - ((const char *) (src))[0], \ - __extension__ ((__STRING2_COPY_ARR2) \ - { { ((const char *) (src))[0], ((const char *) (src))[1] } }), \ - __extension__ ((__STRING2_COPY_ARR3) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2] } }), \ - __extension__ ((__STRING2_COPY_ARR4) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3] } }), \ - __extension__ ((__STRING2_COPY_ARR5) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4] } }), \ - __extension__ ((__STRING2_COPY_ARR6) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5] } }), \ - __extension__ ((__STRING2_COPY_ARR7) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5], \ - ((const char *) (src))[6] } }), \ - __extension__ ((__STRING2_COPY_ARR8) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5], \ - ((const char *) (src))[6], ((const char *) (src))[7] } }) -# endif -__STRING_INLINE void *__mempcpy_small (void *, char, __STRING2_COPY_ARR2, - __STRING2_COPY_ARR3, - __STRING2_COPY_ARR4, - __STRING2_COPY_ARR5, - __STRING2_COPY_ARR6, - __STRING2_COPY_ARR7, - __STRING2_COPY_ARR8, size_t); -__STRING_INLINE void * -__mempcpy_small (void *__dest, char __src1, - __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3, - __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5, - __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, - __STRING2_COPY_ARR8 __src8, size_t __srclen) -{ - union { - char __c; - __STRING2_COPY_ARR2 __sca2; - __STRING2_COPY_ARR3 __sca3; - __STRING2_COPY_ARR4 __sca4; - __STRING2_COPY_ARR5 __sca5; - __STRING2_COPY_ARR6 __sca6; - __STRING2_COPY_ARR7 __sca7; - __STRING2_COPY_ARR8 __sca8; - } *__u = __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__c = __src1; - break; - case 2: - __extension__ __u->__sca2 = __src2; - break; - case 3: - __extension__ __u->__sca3 = __src3; - break; - case 4: - __extension__ __u->__sca4 = __src4; - break; - case 5: - __extension__ __u->__sca5 = __src5; - break; - case 6: - __extension__ __u->__sca6 = __src6; - break; - case 7: - __extension__ __u->__sca7 = __src7; - break; - case 8: - __extension__ __u->__sca8 = __src8; - break; - } - return __extension__ ((void *) __u + __srclen); -} -# endif -# endif -# endif -#endif - - -/* Return pointer to C in S. */ -#ifndef _HAVE_STRING_ARCH_strchr -extern void *__rawmemchr (const void *__s, int __c); -# if __GNUC_PREREQ (3, 2) -# define strchr(s, c) \ - (__extension__ (__builtin_constant_p (c) && !__builtin_constant_p (s) \ - && (c) == '\0' \ - ? (char *) __rawmemchr (s, c) \ - : __builtin_strchr (s, c))) -# else -# define strchr(s, c) \ - (__extension__ (__builtin_constant_p (c) && (c) == '\0' \ - ? (char *) __rawmemchr (s, c) \ - : strchr (s, c))) -# endif -#endif - - -/* Copy SRC to DEST. */ -#if (!defined _HAVE_STRING_ARCH_strcpy && !__GNUC_PREREQ (3, 0)) \ - || defined _FORCE_INLINES -# if !defined _HAVE_STRING_ARCH_strcpy && !__GNUC_PREREQ (3, 0) -# define strcpy(dest, src) \ - (__extension__ (__builtin_constant_p (src) \ - ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8 \ - ? __strcpy_small (dest, __strcpy_args (src), \ - strlen (src) + 1) \ - : (char *) memcpy (dest, src, strlen (src) + 1)) \ - : strcpy (dest, src))) -# endif - -# if _STRING_INLINE_unaligned -# ifndef _FORCE_INLINES -# define __strcpy_args(src) \ - __extension__ __STRING2_SMALL_GET16 (src, 0), \ - __extension__ __STRING2_SMALL_GET16 (src, 4), \ - __extension__ __STRING2_SMALL_GET32 (src, 0), \ - __extension__ __STRING2_SMALL_GET32 (src, 4) -# endif -__STRING_INLINE char *__strcpy_small (char *, __uint16_t, __uint16_t, - __uint32_t, __uint32_t, size_t); -__STRING_INLINE char * -__strcpy_small (char *__dest, - __uint16_t __src0_2, __uint16_t __src4_2, - __uint32_t __src0_4, __uint32_t __src4_4, - size_t __srclen) -{ - union { - __uint32_t __ui; - __uint16_t __usi; - unsigned char __uc; - } *__u = (void *) __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__uc = '\0'; - break; - case 2: - __u->__usi = __src0_2; - break; - case 3: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 2); - __u->__uc = '\0'; - break; - case 4: - __u->__ui = __src0_4; - break; - case 5: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__uc = '\0'; - break; - case 6: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - break; - case 7: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 2); - __u->__uc = '\0'; - break; - case 8: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__ui = __src4_4; - break; - } - return __dest; -} -# else -# ifndef _FORCE_INLINES -# define __strcpy_args(src) \ - __extension__ ((__STRING2_COPY_ARR2) \ - { { ((const char *) (src))[0], '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR3) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR4) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR5) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR6) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR7) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5], \ - '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR8) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5], \ - ((const char *) (src))[6], '\0' } }) -# endif -__STRING_INLINE char *__strcpy_small (char *, __STRING2_COPY_ARR2, - __STRING2_COPY_ARR3, - __STRING2_COPY_ARR4, - __STRING2_COPY_ARR5, - __STRING2_COPY_ARR6, - __STRING2_COPY_ARR7, - __STRING2_COPY_ARR8, size_t); -__STRING_INLINE char * -__strcpy_small (char *__dest, - __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3, - __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5, - __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, - __STRING2_COPY_ARR8 __src8, size_t __srclen) -{ - union { - char __c; - __STRING2_COPY_ARR2 __sca2; - __STRING2_COPY_ARR3 __sca3; - __STRING2_COPY_ARR4 __sca4; - __STRING2_COPY_ARR5 __sca5; - __STRING2_COPY_ARR6 __sca6; - __STRING2_COPY_ARR7 __sca7; - __STRING2_COPY_ARR8 __sca8; - } *__u = (void *) __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__c = '\0'; - break; - case 2: - __extension__ __u->__sca2 = __src2; - break; - case 3: - __extension__ __u->__sca3 = __src3; - break; - case 4: - __extension__ __u->__sca4 = __src4; - break; - case 5: - __extension__ __u->__sca5 = __src5; - break; - case 6: - __extension__ __u->__sca6 = __src6; - break; - case 7: - __extension__ __u->__sca7 = __src7; - break; - case 8: - __extension__ __u->__sca8 = __src8; - break; - } - return __dest; -} -# endif -#endif - - -/* Copy SRC to DEST, returning pointer to final NUL byte. */ -#ifdef __USE_GNU -# if !defined _HAVE_STRING_ARCH_stpcpy || defined _FORCE_INLINES -# ifndef _HAVE_STRING_ARCH_stpcpy -# if __GNUC_PREREQ (3, 4) -# define __stpcpy(dest, src) __builtin_stpcpy (dest, src) -# elif __GNUC_PREREQ (3, 0) -# define __stpcpy(dest, src) \ - (__extension__ (__builtin_constant_p (src) \ - ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8 \ - ? __builtin_strcpy (dest, src) + strlen (src) \ - : ((char *) (__mempcpy) (dest, src, strlen (src) + 1) \ - - 1)) \ - : __stpcpy (dest, src))) -# else -# define __stpcpy(dest, src) \ - (__extension__ (__builtin_constant_p (src) \ - ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8 \ - ? __stpcpy_small (dest, __stpcpy_args (src), \ - strlen (src) + 1) \ - : ((char *) (__mempcpy) (dest, src, strlen (src) + 1) \ - - 1)) \ - : __stpcpy (dest, src))) -# endif -/* In glibc we use this function frequently but for namespace reasons - we have to use the name `__stpcpy'. */ -# define stpcpy(dest, src) __stpcpy (dest, src) -# endif - -# if !__GNUC_PREREQ (3, 0) || defined _FORCE_INLINES -# if _STRING_INLINE_unaligned -# ifndef _FORCE_INLINES -# define __stpcpy_args(src) \ - __extension__ __STRING2_SMALL_GET16 (src, 0), \ - __extension__ __STRING2_SMALL_GET16 (src, 4), \ - __extension__ __STRING2_SMALL_GET32 (src, 0), \ - __extension__ __STRING2_SMALL_GET32 (src, 4) -# endif -__STRING_INLINE char *__stpcpy_small (char *, __uint16_t, __uint16_t, - __uint32_t, __uint32_t, size_t); -__STRING_INLINE char * -__stpcpy_small (char *__dest, - __uint16_t __src0_2, __uint16_t __src4_2, - __uint32_t __src0_4, __uint32_t __src4_4, - size_t __srclen) -{ - union { - unsigned int __ui; - unsigned short int __usi; - unsigned char __uc; - char __c; - } *__u = (void *) __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__uc = '\0'; - break; - case 2: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 1); - break; - case 3: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 2); - __u->__uc = '\0'; - break; - case 4: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 3); - break; - case 5: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__uc = '\0'; - break; - case 6: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 1); - break; - case 7: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 2); - __u->__uc = '\0'; - break; - case 8: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__ui = __src4_4; - __u = __extension__ ((void *) __u + 3); - break; - } - return &__u->__c; -} -# else -# ifndef _FORCE_INLINES -# define __stpcpy_args(src) \ - __extension__ ((__STRING2_COPY_ARR2) \ - { { ((const char *) (src))[0], '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR3) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR4) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR5) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR6) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR7) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5], \ - '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR8) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5], \ - ((const char *) (src))[6], '\0' } }) -# endif -__STRING_INLINE char *__stpcpy_small (char *, __STRING2_COPY_ARR2, - __STRING2_COPY_ARR3, - __STRING2_COPY_ARR4, - __STRING2_COPY_ARR5, - __STRING2_COPY_ARR6, - __STRING2_COPY_ARR7, - __STRING2_COPY_ARR8, size_t); -__STRING_INLINE char * -__stpcpy_small (char *__dest, - __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3, - __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5, - __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, - __STRING2_COPY_ARR8 __src8, size_t __srclen) -{ - union { - char __c; - __STRING2_COPY_ARR2 __sca2; - __STRING2_COPY_ARR3 __sca3; - __STRING2_COPY_ARR4 __sca4; - __STRING2_COPY_ARR5 __sca5; - __STRING2_COPY_ARR6 __sca6; - __STRING2_COPY_ARR7 __sca7; - __STRING2_COPY_ARR8 __sca8; - } *__u = (void *) __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__c = '\0'; - break; - case 2: - __extension__ __u->__sca2 = __src2; - break; - case 3: - __extension__ __u->__sca3 = __src3; - break; - case 4: - __extension__ __u->__sca4 = __src4; - break; - case 5: - __extension__ __u->__sca5 = __src5; - break; - case 6: - __extension__ __u->__sca6 = __src6; - break; - case 7: - __extension__ __u->__sca7 = __src7; - break; - case 8: - __extension__ __u->__sca8 = __src8; - break; - } - return __dest + __srclen - 1; -} -# endif -# endif -# endif -#endif - - -/* Copy no more than N characters of SRC to DEST. */ -#ifndef _HAVE_STRING_ARCH_strncpy -# if __GNUC_PREREQ (3, 2) -# define strncpy(dest, src, n) __builtin_strncpy (dest, src, n) -# else -# define strncpy(dest, src, n) \ - (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \ - ? (strlen (src) + 1 >= ((size_t) (n)) \ - ? (char *) memcpy (dest, src, n) \ - : strncpy (dest, src, n)) \ - : strncpy (dest, src, n))) -# endif -#endif - - -/* Append no more than N characters from SRC onto DEST. */ -#ifndef _HAVE_STRING_ARCH_strncat -# ifdef _USE_STRING_ARCH_strchr -# define strncat(dest, src, n) \ - (__extension__ ({ char *__dest = (dest); \ - __builtin_constant_p (src) && __builtin_constant_p (n) \ - ? (strlen (src) < ((size_t) (n)) \ - ? strcat (__dest, src) \ - : (*((char *) __mempcpy (strchr (__dest, '\0'), \ - src, n)) = '\0', __dest)) \ - : strncat (dest, src, n); })) -# elif __GNUC_PREREQ (3, 2) -# define strncat(dest, src, n) __builtin_strncat (dest, src, n) -# else -# define strncat(dest, src, n) \ - (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \ - ? (strlen (src) < ((size_t) (n)) \ - ? strcat (dest, src) \ - : strncat (dest, src, n)) \ - : strncat (dest, src, n))) -# endif -#endif - - -/* Compare characters of S1 and S2. */ -#ifndef _HAVE_STRING_ARCH_strcmp -# if __GNUC_PREREQ (3, 2) -# define strcmp(s1, s2) \ - __extension__ \ - ({ size_t __s1_len, __s2_len; \ - (__builtin_constant_p (s1) && __builtin_constant_p (s2) \ - && (__s1_len = __builtin_strlen (s1), __s2_len = __builtin_strlen (s2), \ - (!__string2_1bptr_p (s1) || __s1_len >= 4) \ - && (!__string2_1bptr_p (s2) || __s2_len >= 4)) \ - ? __builtin_strcmp (s1, s2) \ - : (__builtin_constant_p (s1) && __string2_1bptr_p (s1) \ - && (__s1_len = __builtin_strlen (s1), __s1_len < 4) \ - ? (__builtin_constant_p (s2) && __string2_1bptr_p (s2) \ - ? __builtin_strcmp (s1, s2) \ - : __strcmp_cg (s1, s2, __s1_len)) \ - : (__builtin_constant_p (s2) && __string2_1bptr_p (s2) \ - && (__s2_len = __builtin_strlen (s2), __s2_len < 4) \ - ? (__builtin_constant_p (s1) && __string2_1bptr_p (s1) \ - ? __builtin_strcmp (s1, s2) \ - : __strcmp_gc (s1, s2, __s2_len)) \ - : __builtin_strcmp (s1, s2)))); }) -# else -# define strcmp(s1, s2) \ - __extension__ \ - ({ size_t __s1_len, __s2_len; \ - (__builtin_constant_p (s1) && __builtin_constant_p (s2) \ - && (__s1_len = strlen (s1), __s2_len = strlen (s2), \ - (!__string2_1bptr_p (s1) || __s1_len >= 4) \ - && (!__string2_1bptr_p (s2) || __s2_len >= 4)) \ - ? memcmp ((const char *) (s1), (const char *) (s2), \ - (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) \ - : (__builtin_constant_p (s1) && __string2_1bptr_p (s1) \ - && (__s1_len = strlen (s1), __s1_len < 4) \ - ? (__builtin_constant_p (s2) && __string2_1bptr_p (s2) \ - ? __strcmp_cc (s1, s2, __s1_len) \ - : __strcmp_cg (s1, s2, __s1_len)) \ - : (__builtin_constant_p (s2) && __string2_1bptr_p (s2) \ - && (__s2_len = strlen (s2), __s2_len < 4) \ - ? (__builtin_constant_p (s1) && __string2_1bptr_p (s1) \ - ? __strcmp_cc (s1, s2, __s2_len) \ - : __strcmp_gc (s1, s2, __s2_len)) \ - : strcmp (s1, s2)))); }) -# endif - -# define __strcmp_cc(s1, s2, l) \ - (__extension__ ({ int __result = \ - (((const unsigned char *) (const char *) (s1))[0] \ - - ((const unsigned char *) (const char *)(s2))[0]); \ - if (l > 0 && __result == 0) \ - { \ - __result = (((const unsigned char *) \ - (const char *) (s1))[1] \ - - ((const unsigned char *) \ - (const char *) (s2))[1]); \ - if (l > 1 && __result == 0) \ - { \ - __result = \ - (((const unsigned char *) \ - (const char *) (s1))[2] \ - - ((const unsigned char *) \ - (const char *) (s2))[2]); \ - if (l > 2 && __result == 0) \ - __result = \ - (((const unsigned char *) \ - (const char *) (s1))[3] \ - - ((const unsigned char *) \ - (const char *) (s2))[3]); \ - } \ - } \ - __result; })) - -# define __strcmp_cg(s1, s2, l1) \ - (__extension__ ({ const unsigned char *__s2 = \ - (const unsigned char *) (const char *) (s2); \ - int __result = \ - (((const unsigned char *) (const char *) (s1))[0] \ - - __s2[0]); \ - if (l1 > 0 && __result == 0) \ - { \ - __result = (((const unsigned char *) \ - (const char *) (s1))[1] - __s2[1]); \ - if (l1 > 1 && __result == 0) \ - { \ - __result = (((const unsigned char *) \ - (const char *) (s1))[2] - __s2[2]); \ - if (l1 > 2 && __result == 0) \ - __result = (((const unsigned char *) \ - (const char *) (s1))[3] \ - - __s2[3]); \ - } \ - } \ - __result; })) - -# define __strcmp_gc(s1, s2, l2) (- __strcmp_cg (s2, s1, l2)) -#endif - - -/* Compare N characters of S1 and S2. */ -#ifndef _HAVE_STRING_ARCH_strncmp -# define strncmp(s1, s2, n) \ - (__extension__ (__builtin_constant_p (n) \ - && ((__builtin_constant_p (s1) \ - && strlen (s1) < ((size_t) (n))) \ - || (__builtin_constant_p (s2) \ - && strlen (s2) < ((size_t) (n)))) \ - ? strcmp (s1, s2) : strncmp (s1, s2, n))) -#endif - - -/* Return the length of the initial segment of S which - consists entirely of characters not in REJECT. */ -#if !defined _HAVE_STRING_ARCH_strcspn || defined _FORCE_INLINES -# ifndef _HAVE_STRING_ARCH_strcspn -# if __GNUC_PREREQ (3, 2) -# define strcspn(s, reject) \ - __extension__ \ - ({ char __r0, __r1, __r2; \ - (__builtin_constant_p (reject) && __string2_1bptr_p (reject) \ - ? ((__builtin_constant_p (s) && __string2_1bptr_p (s)) \ - ? __builtin_strcspn (s, reject) \ - : ((__r0 = ((const char *) (reject))[0], __r0 == '\0') \ - ? strlen (s) \ - : ((__r1 = ((const char *) (reject))[1], __r1 == '\0') \ - ? __strcspn_c1 (s, __r0) \ - : ((__r2 = ((const char *) (reject))[2], __r2 == '\0') \ - ? __strcspn_c2 (s, __r0, __r1) \ - : (((const char *) (reject))[3] == '\0' \ - ? __strcspn_c3 (s, __r0, __r1, __r2) \ - : __builtin_strcspn (s, reject)))))) \ - : __builtin_strcspn (s, reject)); }) -# else -# define strcspn(s, reject) \ - __extension__ \ - ({ char __r0, __r1, __r2; \ - (__builtin_constant_p (reject) && __string2_1bptr_p (reject) \ - ? ((__r0 = ((const char *) (reject))[0], __r0 == '\0') \ - ? strlen (s) \ - : ((__r1 = ((const char *) (reject))[1], __r1 == '\0') \ - ? __strcspn_c1 (s, __r0) \ - : ((__r2 = ((const char *) (reject))[2], __r2 == '\0') \ - ? __strcspn_c2 (s, __r0, __r1) \ - : (((const char *) (reject))[3] == '\0' \ - ? __strcspn_c3 (s, __r0, __r1, __r2) \ - : strcspn (s, reject))))) \ - : strcspn (s, reject)); }) -# endif -# endif - -__STRING_INLINE size_t __strcspn_c1 (const char *__s, int __reject); -__STRING_INLINE size_t -__strcspn_c1 (const char *__s, int __reject) -{ - size_t __result = 0; - while (__s[__result] != '\0' && __s[__result] != __reject) - ++__result; - return __result; -} - -__STRING_INLINE size_t __strcspn_c2 (const char *__s, int __reject1, - int __reject2); -__STRING_INLINE size_t -__strcspn_c2 (const char *__s, int __reject1, int __reject2) -{ - size_t __result = 0; - while (__s[__result] != '\0' && __s[__result] != __reject1 - && __s[__result] != __reject2) - ++__result; - return __result; -} - -__STRING_INLINE size_t __strcspn_c3 (const char *__s, int __reject1, - int __reject2, int __reject3); -__STRING_INLINE size_t -__strcspn_c3 (const char *__s, int __reject1, int __reject2, - int __reject3) -{ - size_t __result = 0; - while (__s[__result] != '\0' && __s[__result] != __reject1 - && __s[__result] != __reject2 && __s[__result] != __reject3) - ++__result; - return __result; -} -#endif - - -/* Return the length of the initial segment of S which - consists entirely of characters in ACCEPT. */ -#if !defined _HAVE_STRING_ARCH_strspn || defined _FORCE_INLINES -# ifndef _HAVE_STRING_ARCH_strspn -# if __GNUC_PREREQ (3, 2) -# define strspn(s, accept) \ - __extension__ \ - ({ char __a0, __a1, __a2; \ - (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \ - ? ((__builtin_constant_p (s) && __string2_1bptr_p (s)) \ - ? __builtin_strspn (s, accept) \ - : ((__a0 = ((const char *) (accept))[0], __a0 == '\0') \ - ? ((void) (s), (size_t) 0) \ - : ((__a1 = ((const char *) (accept))[1], __a1 == '\0') \ - ? __strspn_c1 (s, __a0) \ - : ((__a2 = ((const char *) (accept))[2], __a2 == '\0') \ - ? __strspn_c2 (s, __a0, __a1) \ - : (((const char *) (accept))[3] == '\0' \ - ? __strspn_c3 (s, __a0, __a1, __a2) \ - : __builtin_strspn (s, accept)))))) \ - : __builtin_strspn (s, accept)); }) -# else -# define strspn(s, accept) \ - __extension__ \ - ({ char __a0, __a1, __a2; \ - (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \ - ? ((__a0 = ((const char *) (accept))[0], __a0 == '\0') \ - ? ((void) (s), (size_t) 0) \ - : ((__a1 = ((const char *) (accept))[1], __a1 == '\0') \ - ? __strspn_c1 (s, __a0) \ - : ((__a2 = ((const char *) (accept))[2], __a2 == '\0') \ - ? __strspn_c2 (s, __a0, __a1) \ - : (((const char *) (accept))[3] == '\0' \ - ? __strspn_c3 (s, __a0, __a1, __a2) \ - : strspn (s, accept))))) \ - : strspn (s, accept)); }) -# endif -# endif - -__STRING_INLINE size_t __strspn_c1 (const char *__s, int __accept); -__STRING_INLINE size_t -__strspn_c1 (const char *__s, int __accept) -{ - size_t __result = 0; - /* Please note that __accept never can be '\0'. */ - while (__s[__result] == __accept) - ++__result; - return __result; -} - -__STRING_INLINE size_t __strspn_c2 (const char *__s, int __accept1, - int __accept2); -__STRING_INLINE size_t -__strspn_c2 (const char *__s, int __accept1, int __accept2) -{ - size_t __result = 0; - /* Please note that __accept1 and __accept2 never can be '\0'. */ - while (__s[__result] == __accept1 || __s[__result] == __accept2) - ++__result; - return __result; -} - -__STRING_INLINE size_t __strspn_c3 (const char *__s, int __accept1, - int __accept2, int __accept3); -__STRING_INLINE size_t -__strspn_c3 (const char *__s, int __accept1, int __accept2, int __accept3) -{ - size_t __result = 0; - /* Please note that __accept1 to __accept3 never can be '\0'. */ - while (__s[__result] == __accept1 || __s[__result] == __accept2 - || __s[__result] == __accept3) - ++__result; - return __result; -} -#endif - - -/* Find the first occurrence in S of any character in ACCEPT. */ -#if !defined _HAVE_STRING_ARCH_strpbrk || defined _FORCE_INLINES -# ifndef _HAVE_STRING_ARCH_strpbrk -# if __GNUC_PREREQ (3, 2) -# define strpbrk(s, accept) \ - __extension__ \ - ({ char __a0, __a1, __a2; \ - (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \ - ? ((__builtin_constant_p (s) && __string2_1bptr_p (s)) \ - ? __builtin_strpbrk (s, accept) \ - : ((__a0 = ((const char *) (accept))[0], __a0 == '\0') \ - ? ((void) (s), (char *) NULL) \ - : ((__a1 = ((const char *) (accept))[1], __a1 == '\0') \ - ? __builtin_strchr (s, __a0) \ - : ((__a2 = ((const char *) (accept))[2], __a2 == '\0') \ - ? __strpbrk_c2 (s, __a0, __a1) \ - : (((const char *) (accept))[3] == '\0' \ - ? __strpbrk_c3 (s, __a0, __a1, __a2) \ - : __builtin_strpbrk (s, accept)))))) \ - : __builtin_strpbrk (s, accept)); }) -# else -# define strpbrk(s, accept) \ - __extension__ \ - ({ char __a0, __a1, __a2; \ - (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \ - ? ((__a0 = ((const char *) (accept))[0], __a0 == '\0') \ - ? ((void) (s), (char *) NULL) \ - : ((__a1 = ((const char *) (accept))[1], __a1 == '\0') \ - ? strchr (s, __a0) \ - : ((__a2 = ((const char *) (accept))[2], __a2 == '\0') \ - ? __strpbrk_c2 (s, __a0, __a1) \ - : (((const char *) (accept))[3] == '\0' \ - ? __strpbrk_c3 (s, __a0, __a1, __a2) \ - : strpbrk (s, accept))))) \ - : strpbrk (s, accept)); }) -# endif -# endif - -__STRING_INLINE char *__strpbrk_c2 (const char *__s, int __accept1, - int __accept2); -__STRING_INLINE char * -__strpbrk_c2 (const char *__s, int __accept1, int __accept2) -{ - /* Please note that __accept1 and __accept2 never can be '\0'. */ - while (*__s != '\0' && *__s != __accept1 && *__s != __accept2) - ++__s; - return *__s == '\0' ? NULL : (char *) (size_t) __s; -} - -__STRING_INLINE char *__strpbrk_c3 (const char *__s, int __accept1, - int __accept2, int __accept3); -__STRING_INLINE char * -__strpbrk_c3 (const char *__s, int __accept1, int __accept2, int __accept3) -{ - /* Please note that __accept1 to __accept3 never can be '\0'. */ - while (*__s != '\0' && *__s != __accept1 && *__s != __accept2 - && *__s != __accept3) - ++__s; - return *__s == '\0' ? NULL : (char *) (size_t) __s; -} -#endif - - -/* Find the first occurrence of NEEDLE in HAYSTACK. Newer gcc versions - do this itself. */ -#if !defined _HAVE_STRING_ARCH_strstr && !__GNUC_PREREQ (2, 97) -# define strstr(haystack, needle) \ - (__extension__ (__builtin_constant_p (needle) && __string2_1bptr_p (needle) \ - ? (((const char *) (needle))[0] == '\0' \ - ? (char *) (size_t) (haystack) \ - : (((const char *) (needle))[1] == '\0' \ - ? strchr (haystack, \ - ((const char *) (needle))[0]) \ - : strstr (haystack, needle))) \ - : strstr (haystack, needle))) -#endif - - -#if !defined _HAVE_STRING_ARCH_strtok_r || defined _FORCE_INLINES -# ifndef _HAVE_STRING_ARCH_strtok_r -# define __strtok_r(s, sep, nextp) \ - (__extension__ (__builtin_constant_p (sep) && __string2_1bptr_p (sep) \ - && ((const char *) (sep))[0] != '\0' \ - && ((const char *) (sep))[1] == '\0' \ - ? __strtok_r_1c (s, ((const char *) (sep))[0], nextp) \ - : __strtok_r (s, sep, nextp))) -# endif - -__STRING_INLINE char *__strtok_r_1c (char *__s, char __sep, char **__nextp); -__STRING_INLINE char * -__strtok_r_1c (char *__s, char __sep, char **__nextp) -{ - char *__result; - if (__s == NULL) - __s = *__nextp; - while (*__s == __sep) - ++__s; - __result = NULL; - if (*__s != '\0') - { - __result = __s++; - while (*__s != '\0') - if (*__s++ == __sep) - { - __s[-1] = '\0'; - break; - } - } - *__nextp = __s; - return __result; -} -# ifdef __USE_POSIX -# define strtok_r(s, sep, nextp) __strtok_r (s, sep, nextp) -# endif -#endif - - -#if !defined _HAVE_STRING_ARCH_strsep || defined _FORCE_INLINES -# ifndef _HAVE_STRING_ARCH_strsep - -extern char *__strsep_g (char **__stringp, const char *__delim); -# define __strsep(s, reject) \ - __extension__ \ - ({ char __r0, __r1, __r2; \ - (__builtin_constant_p (reject) && __string2_1bptr_p (reject) \ - && (__r0 = ((const char *) (reject))[0], \ - ((const char *) (reject))[0] != '\0') \ - ? ((__r1 = ((const char *) (reject))[1], \ - ((const char *) (reject))[1] == '\0') \ - ? __strsep_1c (s, __r0) \ - : ((__r2 = ((const char *) (reject))[2], __r2 == '\0') \ - ? __strsep_2c (s, __r0, __r1) \ - : (((const char *) (reject))[3] == '\0' \ - ? __strsep_3c (s, __r0, __r1, __r2) \ - : __strsep_g (s, reject)))) \ - : __strsep_g (s, reject)); }) -# endif - -__STRING_INLINE char *__strsep_1c (char **__s, char __reject); -__STRING_INLINE char * -__strsep_1c (char **__s, char __reject) -{ - char *__retval = *__s; - if (__retval != NULL && (*__s = strchr (__retval, __reject)) != NULL) - *(*__s)++ = '\0'; - return __retval; -} - -__STRING_INLINE char *__strsep_2c (char **__s, char __reject1, char __reject2); -__STRING_INLINE char * -__strsep_2c (char **__s, char __reject1, char __reject2) -{ - char *__retval = *__s; - if (__retval != NULL) - { - char *__cp = __retval; - while (1) - { - if (*__cp == '\0') - { - __cp = NULL; - break; - } - if (*__cp == __reject1 || *__cp == __reject2) - { - *__cp++ = '\0'; - break; - } - ++__cp; - } - *__s = __cp; - } - return __retval; -} - -__STRING_INLINE char *__strsep_3c (char **__s, char __reject1, char __reject2, - char __reject3); -__STRING_INLINE char * -__strsep_3c (char **__s, char __reject1, char __reject2, char __reject3) -{ - char *__retval = *__s; - if (__retval != NULL) - { - char *__cp = __retval; - while (1) - { - if (*__cp == '\0') - { - __cp = NULL; - break; - } - if (*__cp == __reject1 || *__cp == __reject2 || *__cp == __reject3) - { - *__cp++ = '\0'; - break; - } - ++__cp; - } - *__s = __cp; - } - return __retval; -} -# ifdef __USE_MISC -# define strsep(s, reject) __strsep (s, reject) -# endif -#endif - -/* We need the memory allocation functions for inline strdup(). - Referring to stdlib.h (even minimally) is not allowed - in any of the tight standards compliant modes. */ -#ifdef __USE_MISC - -# if !defined _HAVE_STRING_ARCH_strdup || !defined _HAVE_STRING_ARCH_strndup -# define __need_malloc_and_calloc -# include -# endif - -# ifndef _HAVE_STRING_ARCH_strdup - -extern char *__strdup (const char *__string) __THROW __attribute_malloc__; -# define __strdup(s) \ - (__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s) \ - ? (((const char *) (s))[0] == '\0' \ - ? (char *) calloc ((size_t) 1, (size_t) 1) \ - : ({ size_t __len = strlen (s) + 1; \ - char *__retval = (char *) malloc (__len); \ - if (__retval != NULL) \ - __retval = (char *) memcpy (__retval, s, __len); \ - __retval; })) \ - : __strdup (s))) - -# if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 -# define strdup(s) __strdup (s) -# endif -# endif - -# ifndef _HAVE_STRING_ARCH_strndup - -extern char *__strndup (const char *__string, size_t __n) - __THROW __attribute_malloc__; -# define __strndup(s, n) \ - (__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s) \ - ? (((const char *) (s))[0] == '\0' \ - ? (char *) calloc ((size_t) 1, (size_t) 1) \ - : ({ size_t __len = strlen (s) + 1; \ - size_t __n = (n); \ - char *__retval; \ - if (__n < __len) \ - __len = __n + 1; \ - __retval = (char *) malloc (__len); \ - if (__retval != NULL) \ - { \ - __retval[__len - 1] = '\0'; \ - __retval = (char *) memcpy (__retval, s, \ - __len - 1); \ - } \ - __retval; })) \ - : __strndup (s, n))) - -# ifdef __USE_XOPEN2K8 -# define strndup(s, n) __strndup (s, n) -# endif -# endif - -#endif /* Use misc. or use GNU. */ - -#ifndef _FORCE_INLINES -# undef __STRING_INLINE -#endif - -#endif /* No string inlines. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/string3.h b/openflow/usr/include/arm-linux-gnueabihf/bits/string3.h deleted file mode 100644 index dd8db68..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/string3.h +++ /dev/null @@ -1,157 +0,0 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _STRING_H -# error "Never use directly; include instead." -#endif - -#if !__GNUC_PREREQ (5,0) -__warndecl (__warn_memset_zero_len, - "memset used with constant zero length parameter; this could be due to transposed parameters"); -#endif - -#ifndef __cplusplus -/* XXX This is temporarily. We should not redefine any of the symbols - and instead integrate the error checking into the original - definitions. */ -# undef memcpy -# undef memmove -# undef memset -# undef strcat -# undef strcpy -# undef strncat -# undef strncpy -# ifdef __USE_GNU -# undef mempcpy -# undef stpcpy -# endif -# ifdef __USE_MISC -# undef bcopy -# undef bzero -# endif -#endif - - -__fortify_function void * -__NTH (memcpy (void *__restrict __dest, const void *__restrict __src, - size_t __len)) -{ - return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); -} - -__fortify_function void * -__NTH (memmove (void *__dest, const void *__src, size_t __len)) -{ - return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest)); -} - -#ifdef __USE_GNU -__fortify_function void * -__NTH (mempcpy (void *__restrict __dest, const void *__restrict __src, - size_t __len)) -{ - return __builtin___mempcpy_chk (__dest, __src, __len, __bos0 (__dest)); -} -#endif - - -/* The first two tests here help to catch a somewhat common problem - where the second and third parameter are transposed. This is - especially problematic if the intended fill value is zero. In this - case no work is done at all. We detect these problems by referring - non-existing functions. */ -__fortify_function void * -__NTH (memset (void *__dest, int __ch, size_t __len)) -{ - /* GCC-5.0 and newer implements these checks in the compiler, so we don't - need them here. */ -#if !__GNUC_PREREQ (5,0) - if (__builtin_constant_p (__len) && __len == 0 - && (!__builtin_constant_p (__ch) || __ch != 0)) - { - __warn_memset_zero_len (); - return __dest; - } -#endif - return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest)); -} - -#ifdef __USE_MISC -__fortify_function void -__NTH (bcopy (const void *__src, void *__dest, size_t __len)) -{ - (void) __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest)); -} - -__fortify_function void -__NTH (bzero (void *__dest, size_t __len)) -{ - (void) __builtin___memset_chk (__dest, '\0', __len, __bos0 (__dest)); -} -#endif - -__fortify_function char * -__NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) -{ - return __builtin___strcpy_chk (__dest, __src, __bos (__dest)); -} - -#ifdef __USE_GNU -__fortify_function char * -__NTH (stpcpy (char *__restrict __dest, const char *__restrict __src)) -{ - return __builtin___stpcpy_chk (__dest, __src, __bos (__dest)); -} -#endif - - -__fortify_function char * -__NTH (strncpy (char *__restrict __dest, const char *__restrict __src, - size_t __len)) -{ - return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); -} - -// XXX We have no corresponding builtin yet. -extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n, - size_t __destlen) __THROW; -extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest, const char *__src, - size_t __n), stpncpy); - -__fortify_function char * -__NTH (stpncpy (char *__dest, const char *__src, size_t __n)) -{ - if (__bos (__dest) != (size_t) -1 - && (!__builtin_constant_p (__n) || __n > __bos (__dest))) - return __stpncpy_chk (__dest, __src, __n, __bos (__dest)); - return __stpncpy_alias (__dest, __src, __n); -} - - -__fortify_function char * -__NTH (strcat (char *__restrict __dest, const char *__restrict __src)) -{ - return __builtin___strcat_chk (__dest, __src, __bos (__dest)); -} - - -__fortify_function char * -__NTH (strncat (char *__restrict __dest, const char *__restrict __src, - size_t __len)) -{ - return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest)); -} diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/stropts.h b/openflow/usr/include/arm-linux-gnueabihf/bits/stropts.h deleted file mode 100644 index d419e52..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/stropts.h +++ /dev/null @@ -1,230 +0,0 @@ -/* Copyright (C) 1998-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _STROPTS_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STROPTS_H -#define _BITS_STROPTS_H 1 - -#include - -/* Macros used as `request' argument to `ioctl'. */ -#define __SID ('S' << 8) - -#define I_NREAD (__SID | 1) /* Counts the number of data bytes in the data - block in the first message. */ -#define I_PUSH (__SID | 2) /* Push STREAMS module onto top of the current - STREAM, just below the STREAM head. */ -#define I_POP (__SID | 3) /* Remove STREAMS module from just below the - STREAM head. */ -#define I_LOOK (__SID | 4) /* Retrieve the name of the module just below - the STREAM head and place it in a character - string. */ -#define I_FLUSH (__SID | 5) /* Flush all input and/or output. */ -#define I_SRDOPT (__SID | 6) /* Sets the read mode. */ -#define I_GRDOPT (__SID | 7) /* Returns the current read mode setting. */ -#define I_STR (__SID | 8) /* Construct an internal STREAMS `ioctl' - message and send that message downstream. */ -#define I_SETSIG (__SID | 9) /* Inform the STREAM head that the process - wants the SIGPOLL signal issued. */ -#define I_GETSIG (__SID |10) /* Return the events for which the calling - process is currently registered to be sent - a SIGPOLL signal. */ -#define I_FIND (__SID |11) /* Compares the names of all modules currently - present in the STREAM to the name pointed to - by `arg'. */ -#define I_LINK (__SID |12) /* Connect two STREAMs. */ -#define I_UNLINK (__SID |13) /* Disconnects the two STREAMs. */ -#define I_PEEK (__SID |15) /* Allows a process to retrieve the information - in the first message on the STREAM head read - queue without taking the message off the - queue. */ -#define I_FDINSERT (__SID |16) /* Create a message from the specified - buffer(s), adds information about another - STREAM, and send the message downstream. */ -#define I_SENDFD (__SID |17) /* Requests the STREAM associated with `fildes' - to send a message, containing a file - pointer, to the STREAM head at the other end - of a STREAMS pipe. */ -#define I_RECVFD (__SID |14) /* Non-EFT definition. */ -#define I_SWROPT (__SID |19) /* Set the write mode. */ -#define I_GWROPT (__SID |20) /* Return the current write mode setting. */ -#define I_LIST (__SID |21) /* List all the module names on the STREAM, up - to and including the topmost driver name. */ -#define I_PLINK (__SID |22) /* Connect two STREAMs with a persistent - link. */ -#define I_PUNLINK (__SID |23) /* Disconnect the two STREAMs that were - connected with a persistent link. */ -#define I_FLUSHBAND (__SID |28) /* Flush only band specified. */ -#define I_CKBAND (__SID |29) /* Check if the message of a given priority - band exists on the STREAM head read - queue. */ -#define I_GETBAND (__SID |30) /* Return the priority band of the first - message on the STREAM head read queue. */ -#define I_ATMARK (__SID |31) /* See if the current message on the STREAM - head read queue is "marked" by some module - downstream. */ -#define I_SETCLTIME (__SID |32) /* Set the time the STREAM head will delay when - a STREAM is closing and there is data on - the write queues. */ -#define I_GETCLTIME (__SID |33) /* Get current value for closing timeout. */ -#define I_CANPUT (__SID |34) /* Check if a certain band is writable. */ - - -/* Used in `I_LOOK' request. */ -#define FMNAMESZ 8 /* compatibility w/UnixWare/Solaris. */ - -/* Flush options. */ -#define FLUSHR 0x01 /* Flush read queues. */ -#define FLUSHW 0x02 /* Flush write queues. */ -#define FLUSHRW 0x03 /* Flush read and write queues. */ -#ifdef __USE_GNU -# define FLUSHBAND 0x04 /* Flush only specified band. */ -#endif - -/* Possible arguments for `I_SETSIG'. */ -#define S_INPUT 0x0001 /* A message, other than a high-priority - message, has arrived. */ -#define S_HIPRI 0x0002 /* A high-priority message is present. */ -#define S_OUTPUT 0x0004 /* The write queue for normal data is no longer - full. */ -#define S_MSG 0x0008 /* A STREAMS signal message that contains the - SIGPOLL signal reaches the front of the - STREAM head read queue. */ -#define S_ERROR 0x0010 /* Notification of an error condition. */ -#define S_HANGUP 0x0020 /* Notification of a hangup. */ -#define S_RDNORM 0x0040 /* A normal message has arrived. */ -#define S_WRNORM S_OUTPUT -#define S_RDBAND 0x0080 /* A message with a non-zero priority has - arrived. */ -#define S_WRBAND 0x0100 /* The write queue for a non-zero priority - band is no longer full. */ -#define S_BANDURG 0x0200 /* When used in conjunction with S_RDBAND, - SIGURG is generated instead of SIGPOLL when - a priority message reaches the front of the - STREAM head read queue. */ - -/* Option for `I_PEEK'. */ -#define RS_HIPRI 0x01 /* Only look for high-priority messages. */ - -/* Options for `I_SRDOPT'. */ -#define RNORM 0x0000 /* Byte-STREAM mode, the default. */ -#define RMSGD 0x0001 /* Message-discard mode. */ -#define RMSGN 0x0002 /* Message-nondiscard mode. */ -#define RPROTDAT 0x0004 /* Deliver the control part of a message as - data. */ -#define RPROTDIS 0x0008 /* Discard the control part of a message, - delivering any data part. */ -#define RPROTNORM 0x0010 /* Fail `read' with EBADMSG if a message - containing a control part is at the front - of the STREAM head read queue. */ -#ifdef __USE_GNU -# define RPROTMASK 0x001C /* The RPROT bits */ -#endif - -/* Possible mode for `I_SWROPT'. */ -#define SNDZERO 0x001 /* Send a zero-length message downstream when a - `write' of 0 bytes occurs. */ -#ifdef __USE_GNU -# define SNDPIPE 0x002 /* Send SIGPIPE on write and putmsg if - sd_werror is set. */ -#endif - -/* Arguments for `I_ATMARK'. */ -#define ANYMARK 0x01 /* Check if the message is marked. */ -#define LASTMARK 0x02 /* Check if the message is the last one marked - on the queue. */ - -/* Argument for `I_UNLINK'. */ -#ifdef __USE_GNU -# define MUXID_ALL (-1) /* Unlink all STREAMs linked to the STREAM - associated with `fildes'. */ -#endif - - -/* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'. */ -#define MSG_HIPRI 0x01 /* Send/receive high priority message. */ -#define MSG_ANY 0x02 /* Receive any message. */ -#define MSG_BAND 0x04 /* Receive message from specified band. */ - -/* Values returned by getmsg and getpmsg */ -#define MORECTL 1 /* More control information is left in - message. */ -#define MOREDATA 2 /* More data is left in message. */ - - -/* Structure used for the I_FLUSHBAND ioctl on streams. */ -struct bandinfo - { - unsigned char bi_pri; - int bi_flag; - }; - -struct strbuf - { - int maxlen; /* Maximum buffer length. */ - int len; /* Length of data. */ - char *buf; /* Pointer to buffer. */ - }; - -struct strpeek - { - struct strbuf ctlbuf; - struct strbuf databuf; - t_uscalar_t flags; /* UnixWare/Solaris compatibility. */ - }; - -struct strfdinsert - { - struct strbuf ctlbuf; - struct strbuf databuf; - t_uscalar_t flags; /* UnixWare/Solaris compatibility. */ - int fildes; - int offset; - }; - -struct strioctl - { - int ic_cmd; - int ic_timout; - int ic_len; - char *ic_dp; - }; - -struct strrecvfd - { - int fd; - uid_t uid; - gid_t gid; - char __fill[8]; /* UnixWare/Solaris compatibility */ - }; - - -struct str_mlist - { - char l_name[FMNAMESZ + 1]; - }; - -struct str_list - { - int sl_nmods; - struct str_mlist *sl_modlist; - }; - -#endif /* bits/stropts.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/sys_errlist.h b/openflow/usr/include/arm-linux-gnueabihf/bits/sys_errlist.h deleted file mode 100644 index c6385f1..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/sys_errlist.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Declare sys_errlist and sys_nerr, or don't. Compatibility (do) version. - Copyright (C) 2002-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _STDIO_H -# error "Never include directly; use instead." -#endif - -/* sys_errlist and sys_nerr are deprecated. Use strerror instead. */ - -#ifdef __USE_MISC -extern int sys_nerr; -extern const char *const sys_errlist[]; -#endif -#ifdef __USE_GNU -extern int _sys_nerr; -extern const char *const _sys_errlist[]; -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/syscall.h b/openflow/usr/include/arm-linux-gnueabihf/bits/syscall.h deleted file mode 100644 index 6900f47..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/syscall.h +++ /dev/null @@ -1,709 +0,0 @@ -/* Generated at libc build time from kernel syscall list. */ - -#ifndef _SYSCALL_H -# error "Never use directly; include instead." -#endif - - -#if !defined __ARM_PCS_VFP -#define SYS_OABI_SYSCALL_BASE __NR_OABI_SYSCALL_BASE -#define SYS_SYSCALL_BASE __NR_SYSCALL_BASE -#define SYS__llseek __NR__llseek -#define SYS__newselect __NR__newselect -#define SYS__sysctl __NR__sysctl -#define SYS_accept __NR_accept -#define SYS_accept4 __NR_accept4 -#define SYS_access __NR_access -#define SYS_acct __NR_acct -#define SYS_add_key __NR_add_key -#define SYS_adjtimex __NR_adjtimex -#define SYS_arm_fadvise64_64 __NR_arm_fadvise64_64 -#define SYS_arm_sync_file_range __NR_arm_sync_file_range -#define SYS_bdflush __NR_bdflush -#define SYS_bind __NR_bind -#define SYS_bpf __NR_bpf -#define SYS_brk __NR_brk -#define SYS_capget __NR_capget -#define SYS_capset __NR_capset -#define SYS_chdir __NR_chdir -#define SYS_chmod __NR_chmod -#define SYS_chown __NR_chown -#define SYS_chown32 __NR_chown32 -#define SYS_chroot __NR_chroot -#define SYS_clock_adjtime __NR_clock_adjtime -#define SYS_clock_getres __NR_clock_getres -#define SYS_clock_gettime __NR_clock_gettime -#define SYS_clock_nanosleep __NR_clock_nanosleep -#define SYS_clock_settime __NR_clock_settime -#define SYS_clone __NR_clone -#define SYS_close __NR_close -#define SYS_connect __NR_connect -#define SYS_creat __NR_creat -#define SYS_delete_module __NR_delete_module -#define SYS_dup __NR_dup -#define SYS_dup2 __NR_dup2 -#define SYS_dup3 __NR_dup3 -#define SYS_epoll_create __NR_epoll_create -#define SYS_epoll_create1 __NR_epoll_create1 -#define SYS_epoll_ctl __NR_epoll_ctl -#define SYS_epoll_pwait __NR_epoll_pwait -#define SYS_epoll_wait __NR_epoll_wait -#define SYS_eventfd __NR_eventfd -#define SYS_eventfd2 __NR_eventfd2 -#define SYS_execve __NR_execve -#define SYS_execveat __NR_execveat -#define SYS_exit __NR_exit -#define SYS_exit_group __NR_exit_group -#define SYS_faccessat __NR_faccessat -#define SYS_fallocate __NR_fallocate -#define SYS_fanotify_init __NR_fanotify_init -#define SYS_fanotify_mark __NR_fanotify_mark -#define SYS_fchdir __NR_fchdir -#define SYS_fchmod __NR_fchmod -#define SYS_fchmodat __NR_fchmodat -#define SYS_fchown __NR_fchown -#define SYS_fchown32 __NR_fchown32 -#define SYS_fchownat __NR_fchownat -#define SYS_fcntl __NR_fcntl -#define SYS_fcntl64 __NR_fcntl64 -#define SYS_fdatasync __NR_fdatasync -#define SYS_fgetxattr __NR_fgetxattr -#define SYS_finit_module __NR_finit_module -#define SYS_flistxattr __NR_flistxattr -#define SYS_flock __NR_flock -#define SYS_fork __NR_fork -#define SYS_fremovexattr __NR_fremovexattr -#define SYS_fsetxattr __NR_fsetxattr -#define SYS_fstat __NR_fstat -#define SYS_fstat64 __NR_fstat64 -#define SYS_fstatat64 __NR_fstatat64 -#define SYS_fstatfs __NR_fstatfs -#define SYS_fstatfs64 __NR_fstatfs64 -#define SYS_fsync __NR_fsync -#define SYS_ftruncate __NR_ftruncate -#define SYS_ftruncate64 __NR_ftruncate64 -#define SYS_futex __NR_futex -#define SYS_futimesat __NR_futimesat -#define SYS_get_mempolicy __NR_get_mempolicy -#define SYS_get_robust_list __NR_get_robust_list -#define SYS_getcpu __NR_getcpu -#define SYS_getcwd __NR_getcwd -#define SYS_getdents __NR_getdents -#define SYS_getdents64 __NR_getdents64 -#define SYS_getegid __NR_getegid -#define SYS_getegid32 __NR_getegid32 -#define SYS_geteuid __NR_geteuid -#define SYS_geteuid32 __NR_geteuid32 -#define SYS_getgid __NR_getgid -#define SYS_getgid32 __NR_getgid32 -#define SYS_getgroups __NR_getgroups -#define SYS_getgroups32 __NR_getgroups32 -#define SYS_getitimer __NR_getitimer -#define SYS_getpeername __NR_getpeername -#define SYS_getpgid __NR_getpgid -#define SYS_getpgrp __NR_getpgrp -#define SYS_getpid __NR_getpid -#define SYS_getppid __NR_getppid -#define SYS_getpriority __NR_getpriority -#define SYS_getrandom __NR_getrandom -#define SYS_getresgid __NR_getresgid -#define SYS_getresgid32 __NR_getresgid32 -#define SYS_getresuid __NR_getresuid -#define SYS_getresuid32 __NR_getresuid32 -#define SYS_getrusage __NR_getrusage -#define SYS_getsid __NR_getsid -#define SYS_getsockname __NR_getsockname -#define SYS_getsockopt __NR_getsockopt -#define SYS_gettid __NR_gettid -#define SYS_gettimeofday __NR_gettimeofday -#define SYS_getuid __NR_getuid -#define SYS_getuid32 __NR_getuid32 -#define SYS_getxattr __NR_getxattr -#define SYS_init_module __NR_init_module -#define SYS_inotify_add_watch __NR_inotify_add_watch -#define SYS_inotify_init __NR_inotify_init -#define SYS_inotify_init1 __NR_inotify_init1 -#define SYS_inotify_rm_watch __NR_inotify_rm_watch -#define SYS_io_cancel __NR_io_cancel -#define SYS_io_destroy __NR_io_destroy -#define SYS_io_getevents __NR_io_getevents -#define SYS_io_setup __NR_io_setup -#define SYS_io_submit __NR_io_submit -#define SYS_ioctl __NR_ioctl -#define SYS_ioprio_get __NR_ioprio_get -#define SYS_ioprio_set __NR_ioprio_set -#define SYS_kcmp __NR_kcmp -#define SYS_kexec_load __NR_kexec_load -#define SYS_keyctl __NR_keyctl -#define SYS_kill __NR_kill -#define SYS_lchown __NR_lchown -#define SYS_lchown32 __NR_lchown32 -#define SYS_lgetxattr __NR_lgetxattr -#define SYS_link __NR_link -#define SYS_linkat __NR_linkat -#define SYS_listen __NR_listen -#define SYS_listxattr __NR_listxattr -#define SYS_llistxattr __NR_llistxattr -#define SYS_lookup_dcookie __NR_lookup_dcookie -#define SYS_lremovexattr __NR_lremovexattr -#define SYS_lseek __NR_lseek -#define SYS_lsetxattr __NR_lsetxattr -#define SYS_lstat __NR_lstat -#define SYS_lstat64 __NR_lstat64 -#define SYS_madvise __NR_madvise -#define SYS_mbind __NR_mbind -#define SYS_membarrier __NR_membarrier -#define SYS_memfd_create __NR_memfd_create -#define SYS_mincore __NR_mincore -#define SYS_mkdir __NR_mkdir -#define SYS_mkdirat __NR_mkdirat -#define SYS_mknod __NR_mknod -#define SYS_mknodat __NR_mknodat -#define SYS_mlock __NR_mlock -#define SYS_mlock2 __NR_mlock2 -#define SYS_mlockall __NR_mlockall -#define SYS_mmap2 __NR_mmap2 -#define SYS_mount __NR_mount -#define SYS_move_pages __NR_move_pages -#define SYS_mprotect __NR_mprotect -#define SYS_mq_getsetattr __NR_mq_getsetattr -#define SYS_mq_notify __NR_mq_notify -#define SYS_mq_open __NR_mq_open -#define SYS_mq_timedreceive __NR_mq_timedreceive -#define SYS_mq_timedsend __NR_mq_timedsend -#define SYS_mq_unlink __NR_mq_unlink -#define SYS_mremap __NR_mremap -#define SYS_msgctl __NR_msgctl -#define SYS_msgget __NR_msgget -#define SYS_msgrcv __NR_msgrcv -#define SYS_msgsnd __NR_msgsnd -#define SYS_msync __NR_msync -#define SYS_munlock __NR_munlock -#define SYS_munlockall __NR_munlockall -#define SYS_munmap __NR_munmap -#define SYS_name_to_handle_at __NR_name_to_handle_at -#define SYS_nanosleep __NR_nanosleep -#define SYS_nfsservctl __NR_nfsservctl -#define SYS_nice __NR_nice -#define SYS_open __NR_open -#define SYS_open_by_handle_at __NR_open_by_handle_at -#define SYS_openat __NR_openat -#define SYS_pause __NR_pause -#define SYS_pciconfig_iobase __NR_pciconfig_iobase -#define SYS_pciconfig_read __NR_pciconfig_read -#define SYS_pciconfig_write __NR_pciconfig_write -#define SYS_perf_event_open __NR_perf_event_open -#define SYS_personality __NR_personality -#define SYS_pipe __NR_pipe -#define SYS_pipe2 __NR_pipe2 -#define SYS_pivot_root __NR_pivot_root -#define SYS_poll __NR_poll -#define SYS_ppoll __NR_ppoll -#define SYS_prctl __NR_prctl -#define SYS_pread64 __NR_pread64 -#define SYS_preadv __NR_preadv -#define SYS_prlimit64 __NR_prlimit64 -#define SYS_process_vm_readv __NR_process_vm_readv -#define SYS_process_vm_writev __NR_process_vm_writev -#define SYS_pselect6 __NR_pselect6 -#define SYS_ptrace __NR_ptrace -#define SYS_pwrite64 __NR_pwrite64 -#define SYS_pwritev __NR_pwritev -#define SYS_quotactl __NR_quotactl -#define SYS_read __NR_read -#define SYS_readahead __NR_readahead -#define SYS_readlink __NR_readlink -#define SYS_readlinkat __NR_readlinkat -#define SYS_readv __NR_readv -#define SYS_reboot __NR_reboot -#define SYS_recv __NR_recv -#define SYS_recvfrom __NR_recvfrom -#define SYS_recvmmsg __NR_recvmmsg -#define SYS_recvmsg __NR_recvmsg -#define SYS_remap_file_pages __NR_remap_file_pages -#define SYS_removexattr __NR_removexattr -#define SYS_rename __NR_rename -#define SYS_renameat __NR_renameat -#define SYS_renameat2 __NR_renameat2 -#define SYS_request_key __NR_request_key -#define SYS_restart_syscall __NR_restart_syscall -#define SYS_rmdir __NR_rmdir -#define SYS_rt_sigaction __NR_rt_sigaction -#define SYS_rt_sigpending __NR_rt_sigpending -#define SYS_rt_sigprocmask __NR_rt_sigprocmask -#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo -#define SYS_rt_sigreturn __NR_rt_sigreturn -#define SYS_rt_sigsuspend __NR_rt_sigsuspend -#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait -#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo -#define SYS_sched_get_priority_max __NR_sched_get_priority_max -#define SYS_sched_get_priority_min __NR_sched_get_priority_min -#define SYS_sched_getaffinity __NR_sched_getaffinity -#define SYS_sched_getattr __NR_sched_getattr -#define SYS_sched_getparam __NR_sched_getparam -#define SYS_sched_getscheduler __NR_sched_getscheduler -#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval -#define SYS_sched_setaffinity __NR_sched_setaffinity -#define SYS_sched_setattr __NR_sched_setattr -#define SYS_sched_setparam __NR_sched_setparam -#define SYS_sched_setscheduler __NR_sched_setscheduler -#define SYS_sched_yield __NR_sched_yield -#define SYS_seccomp __NR_seccomp -#define SYS_semctl __NR_semctl -#define SYS_semget __NR_semget -#define SYS_semop __NR_semop -#define SYS_semtimedop __NR_semtimedop -#define SYS_send __NR_send -#define SYS_sendfile __NR_sendfile -#define SYS_sendfile64 __NR_sendfile64 -#define SYS_sendmmsg __NR_sendmmsg -#define SYS_sendmsg __NR_sendmsg -#define SYS_sendto __NR_sendto -#define SYS_set_mempolicy __NR_set_mempolicy -#define SYS_set_robust_list __NR_set_robust_list -#define SYS_set_tid_address __NR_set_tid_address -#define SYS_setdomainname __NR_setdomainname -#define SYS_setfsgid __NR_setfsgid -#define SYS_setfsgid32 __NR_setfsgid32 -#define SYS_setfsuid __NR_setfsuid -#define SYS_setfsuid32 __NR_setfsuid32 -#define SYS_setgid __NR_setgid -#define SYS_setgid32 __NR_setgid32 -#define SYS_setgroups __NR_setgroups -#define SYS_setgroups32 __NR_setgroups32 -#define SYS_sethostname __NR_sethostname -#define SYS_setitimer __NR_setitimer -#define SYS_setns __NR_setns -#define SYS_setpgid __NR_setpgid -#define SYS_setpriority __NR_setpriority -#define SYS_setregid __NR_setregid -#define SYS_setregid32 __NR_setregid32 -#define SYS_setresgid __NR_setresgid -#define SYS_setresgid32 __NR_setresgid32 -#define SYS_setresuid __NR_setresuid -#define SYS_setresuid32 __NR_setresuid32 -#define SYS_setreuid __NR_setreuid -#define SYS_setreuid32 __NR_setreuid32 -#define SYS_setrlimit __NR_setrlimit -#define SYS_setsid __NR_setsid -#define SYS_setsockopt __NR_setsockopt -#define SYS_settimeofday __NR_settimeofday -#define SYS_setuid __NR_setuid -#define SYS_setuid32 __NR_setuid32 -#define SYS_setxattr __NR_setxattr -#define SYS_shmat __NR_shmat -#define SYS_shmctl __NR_shmctl -#define SYS_shmdt __NR_shmdt -#define SYS_shmget __NR_shmget -#define SYS_shutdown __NR_shutdown -#define SYS_sigaction __NR_sigaction -#define SYS_sigaltstack __NR_sigaltstack -#define SYS_signalfd __NR_signalfd -#define SYS_signalfd4 __NR_signalfd4 -#define SYS_sigpending __NR_sigpending -#define SYS_sigprocmask __NR_sigprocmask -#define SYS_sigreturn __NR_sigreturn -#define SYS_sigsuspend __NR_sigsuspend -#define SYS_socket __NR_socket -#define SYS_socketpair __NR_socketpair -#define SYS_splice __NR_splice -#define SYS_stat __NR_stat -#define SYS_stat64 __NR_stat64 -#define SYS_statfs __NR_statfs -#define SYS_statfs64 __NR_statfs64 -#define SYS_swapoff __NR_swapoff -#define SYS_swapon __NR_swapon -#define SYS_symlink __NR_symlink -#define SYS_symlinkat __NR_symlinkat -#define SYS_sync __NR_sync -#define SYS_sync_file_range2 __NR_sync_file_range2 -#define SYS_syncfs __NR_syncfs -#define SYS_sysfs __NR_sysfs -#define SYS_sysinfo __NR_sysinfo -#define SYS_syslog __NR_syslog -#define SYS_tee __NR_tee -#define SYS_tgkill __NR_tgkill -#define SYS_timer_create __NR_timer_create -#define SYS_timer_delete __NR_timer_delete -#define SYS_timer_getoverrun __NR_timer_getoverrun -#define SYS_timer_gettime __NR_timer_gettime -#define SYS_timer_settime __NR_timer_settime -#define SYS_timerfd_create __NR_timerfd_create -#define SYS_timerfd_gettime __NR_timerfd_gettime -#define SYS_timerfd_settime __NR_timerfd_settime -#define SYS_times __NR_times -#define SYS_tkill __NR_tkill -#define SYS_truncate __NR_truncate -#define SYS_truncate64 __NR_truncate64 -#define SYS_ugetrlimit __NR_ugetrlimit -#define SYS_umask __NR_umask -#define SYS_umount2 __NR_umount2 -#define SYS_uname __NR_uname -#define SYS_unlink __NR_unlink -#define SYS_unlinkat __NR_unlinkat -#define SYS_unshare __NR_unshare -#define SYS_uselib __NR_uselib -#define SYS_userfaultfd __NR_userfaultfd -#define SYS_ustat __NR_ustat -#define SYS_utimensat __NR_utimensat -#define SYS_utimes __NR_utimes -#define SYS_vfork __NR_vfork -#define SYS_vhangup __NR_vhangup -#define SYS_vmsplice __NR_vmsplice -#define SYS_vserver __NR_vserver -#define SYS_wait4 __NR_wait4 -#define SYS_waitid __NR_waitid -#define SYS_write __NR_write -#define SYS_writev __NR_writev -#endif -#if defined __ARM_PCS_VFP -#define SYS_OABI_SYSCALL_BASE __NR_OABI_SYSCALL_BASE -#define SYS_SYSCALL_BASE __NR_SYSCALL_BASE -#define SYS__llseek __NR__llseek -#define SYS__newselect __NR__newselect -#define SYS__sysctl __NR__sysctl -#define SYS_accept __NR_accept -#define SYS_accept4 __NR_accept4 -#define SYS_access __NR_access -#define SYS_acct __NR_acct -#define SYS_add_key __NR_add_key -#define SYS_adjtimex __NR_adjtimex -#define SYS_arm_fadvise64_64 __NR_arm_fadvise64_64 -#define SYS_arm_sync_file_range __NR_arm_sync_file_range -#define SYS_bdflush __NR_bdflush -#define SYS_bind __NR_bind -#define SYS_bpf __NR_bpf -#define SYS_brk __NR_brk -#define SYS_capget __NR_capget -#define SYS_capset __NR_capset -#define SYS_chdir __NR_chdir -#define SYS_chmod __NR_chmod -#define SYS_chown __NR_chown -#define SYS_chown32 __NR_chown32 -#define SYS_chroot __NR_chroot -#define SYS_clock_adjtime __NR_clock_adjtime -#define SYS_clock_getres __NR_clock_getres -#define SYS_clock_gettime __NR_clock_gettime -#define SYS_clock_nanosleep __NR_clock_nanosleep -#define SYS_clock_settime __NR_clock_settime -#define SYS_clone __NR_clone -#define SYS_close __NR_close -#define SYS_connect __NR_connect -#define SYS_creat __NR_creat -#define SYS_delete_module __NR_delete_module -#define SYS_dup __NR_dup -#define SYS_dup2 __NR_dup2 -#define SYS_dup3 __NR_dup3 -#define SYS_epoll_create __NR_epoll_create -#define SYS_epoll_create1 __NR_epoll_create1 -#define SYS_epoll_ctl __NR_epoll_ctl -#define SYS_epoll_pwait __NR_epoll_pwait -#define SYS_epoll_wait __NR_epoll_wait -#define SYS_eventfd __NR_eventfd -#define SYS_eventfd2 __NR_eventfd2 -#define SYS_execve __NR_execve -#define SYS_execveat __NR_execveat -#define SYS_exit __NR_exit -#define SYS_exit_group __NR_exit_group -#define SYS_faccessat __NR_faccessat -#define SYS_fallocate __NR_fallocate -#define SYS_fanotify_init __NR_fanotify_init -#define SYS_fanotify_mark __NR_fanotify_mark -#define SYS_fchdir __NR_fchdir -#define SYS_fchmod __NR_fchmod -#define SYS_fchmodat __NR_fchmodat -#define SYS_fchown __NR_fchown -#define SYS_fchown32 __NR_fchown32 -#define SYS_fchownat __NR_fchownat -#define SYS_fcntl __NR_fcntl -#define SYS_fcntl64 __NR_fcntl64 -#define SYS_fdatasync __NR_fdatasync -#define SYS_fgetxattr __NR_fgetxattr -#define SYS_finit_module __NR_finit_module -#define SYS_flistxattr __NR_flistxattr -#define SYS_flock __NR_flock -#define SYS_fork __NR_fork -#define SYS_fremovexattr __NR_fremovexattr -#define SYS_fsetxattr __NR_fsetxattr -#define SYS_fstat __NR_fstat -#define SYS_fstat64 __NR_fstat64 -#define SYS_fstatat64 __NR_fstatat64 -#define SYS_fstatfs __NR_fstatfs -#define SYS_fstatfs64 __NR_fstatfs64 -#define SYS_fsync __NR_fsync -#define SYS_ftruncate __NR_ftruncate -#define SYS_ftruncate64 __NR_ftruncate64 -#define SYS_futex __NR_futex -#define SYS_futimesat __NR_futimesat -#define SYS_get_mempolicy __NR_get_mempolicy -#define SYS_get_robust_list __NR_get_robust_list -#define SYS_getcpu __NR_getcpu -#define SYS_getcwd __NR_getcwd -#define SYS_getdents __NR_getdents -#define SYS_getdents64 __NR_getdents64 -#define SYS_getegid __NR_getegid -#define SYS_getegid32 __NR_getegid32 -#define SYS_geteuid __NR_geteuid -#define SYS_geteuid32 __NR_geteuid32 -#define SYS_getgid __NR_getgid -#define SYS_getgid32 __NR_getgid32 -#define SYS_getgroups __NR_getgroups -#define SYS_getgroups32 __NR_getgroups32 -#define SYS_getitimer __NR_getitimer -#define SYS_getpeername __NR_getpeername -#define SYS_getpgid __NR_getpgid -#define SYS_getpgrp __NR_getpgrp -#define SYS_getpid __NR_getpid -#define SYS_getppid __NR_getppid -#define SYS_getpriority __NR_getpriority -#define SYS_getrandom __NR_getrandom -#define SYS_getresgid __NR_getresgid -#define SYS_getresgid32 __NR_getresgid32 -#define SYS_getresuid __NR_getresuid -#define SYS_getresuid32 __NR_getresuid32 -#define SYS_getrusage __NR_getrusage -#define SYS_getsid __NR_getsid -#define SYS_getsockname __NR_getsockname -#define SYS_getsockopt __NR_getsockopt -#define SYS_gettid __NR_gettid -#define SYS_gettimeofday __NR_gettimeofday -#define SYS_getuid __NR_getuid -#define SYS_getuid32 __NR_getuid32 -#define SYS_getxattr __NR_getxattr -#define SYS_init_module __NR_init_module -#define SYS_inotify_add_watch __NR_inotify_add_watch -#define SYS_inotify_init __NR_inotify_init -#define SYS_inotify_init1 __NR_inotify_init1 -#define SYS_inotify_rm_watch __NR_inotify_rm_watch -#define SYS_io_cancel __NR_io_cancel -#define SYS_io_destroy __NR_io_destroy -#define SYS_io_getevents __NR_io_getevents -#define SYS_io_setup __NR_io_setup -#define SYS_io_submit __NR_io_submit -#define SYS_ioctl __NR_ioctl -#define SYS_ioprio_get __NR_ioprio_get -#define SYS_ioprio_set __NR_ioprio_set -#define SYS_kcmp __NR_kcmp -#define SYS_kexec_load __NR_kexec_load -#define SYS_keyctl __NR_keyctl -#define SYS_kill __NR_kill -#define SYS_lchown __NR_lchown -#define SYS_lchown32 __NR_lchown32 -#define SYS_lgetxattr __NR_lgetxattr -#define SYS_link __NR_link -#define SYS_linkat __NR_linkat -#define SYS_listen __NR_listen -#define SYS_listxattr __NR_listxattr -#define SYS_llistxattr __NR_llistxattr -#define SYS_lookup_dcookie __NR_lookup_dcookie -#define SYS_lremovexattr __NR_lremovexattr -#define SYS_lseek __NR_lseek -#define SYS_lsetxattr __NR_lsetxattr -#define SYS_lstat __NR_lstat -#define SYS_lstat64 __NR_lstat64 -#define SYS_madvise __NR_madvise -#define SYS_mbind __NR_mbind -#define SYS_membarrier __NR_membarrier -#define SYS_memfd_create __NR_memfd_create -#define SYS_mincore __NR_mincore -#define SYS_mkdir __NR_mkdir -#define SYS_mkdirat __NR_mkdirat -#define SYS_mknod __NR_mknod -#define SYS_mknodat __NR_mknodat -#define SYS_mlock __NR_mlock -#define SYS_mlock2 __NR_mlock2 -#define SYS_mlockall __NR_mlockall -#define SYS_mmap2 __NR_mmap2 -#define SYS_mount __NR_mount -#define SYS_move_pages __NR_move_pages -#define SYS_mprotect __NR_mprotect -#define SYS_mq_getsetattr __NR_mq_getsetattr -#define SYS_mq_notify __NR_mq_notify -#define SYS_mq_open __NR_mq_open -#define SYS_mq_timedreceive __NR_mq_timedreceive -#define SYS_mq_timedsend __NR_mq_timedsend -#define SYS_mq_unlink __NR_mq_unlink -#define SYS_mremap __NR_mremap -#define SYS_msgctl __NR_msgctl -#define SYS_msgget __NR_msgget -#define SYS_msgrcv __NR_msgrcv -#define SYS_msgsnd __NR_msgsnd -#define SYS_msync __NR_msync -#define SYS_munlock __NR_munlock -#define SYS_munlockall __NR_munlockall -#define SYS_munmap __NR_munmap -#define SYS_name_to_handle_at __NR_name_to_handle_at -#define SYS_nanosleep __NR_nanosleep -#define SYS_nfsservctl __NR_nfsservctl -#define SYS_nice __NR_nice -#define SYS_open __NR_open -#define SYS_open_by_handle_at __NR_open_by_handle_at -#define SYS_openat __NR_openat -#define SYS_pause __NR_pause -#define SYS_pciconfig_iobase __NR_pciconfig_iobase -#define SYS_pciconfig_read __NR_pciconfig_read -#define SYS_pciconfig_write __NR_pciconfig_write -#define SYS_perf_event_open __NR_perf_event_open -#define SYS_personality __NR_personality -#define SYS_pipe __NR_pipe -#define SYS_pipe2 __NR_pipe2 -#define SYS_pivot_root __NR_pivot_root -#define SYS_poll __NR_poll -#define SYS_ppoll __NR_ppoll -#define SYS_prctl __NR_prctl -#define SYS_pread64 __NR_pread64 -#define SYS_preadv __NR_preadv -#define SYS_prlimit64 __NR_prlimit64 -#define SYS_process_vm_readv __NR_process_vm_readv -#define SYS_process_vm_writev __NR_process_vm_writev -#define SYS_pselect6 __NR_pselect6 -#define SYS_ptrace __NR_ptrace -#define SYS_pwrite64 __NR_pwrite64 -#define SYS_pwritev __NR_pwritev -#define SYS_quotactl __NR_quotactl -#define SYS_read __NR_read -#define SYS_readahead __NR_readahead -#define SYS_readlink __NR_readlink -#define SYS_readlinkat __NR_readlinkat -#define SYS_readv __NR_readv -#define SYS_reboot __NR_reboot -#define SYS_recv __NR_recv -#define SYS_recvfrom __NR_recvfrom -#define SYS_recvmmsg __NR_recvmmsg -#define SYS_recvmsg __NR_recvmsg -#define SYS_remap_file_pages __NR_remap_file_pages -#define SYS_removexattr __NR_removexattr -#define SYS_rename __NR_rename -#define SYS_renameat __NR_renameat -#define SYS_renameat2 __NR_renameat2 -#define SYS_request_key __NR_request_key -#define SYS_restart_syscall __NR_restart_syscall -#define SYS_rmdir __NR_rmdir -#define SYS_rt_sigaction __NR_rt_sigaction -#define SYS_rt_sigpending __NR_rt_sigpending -#define SYS_rt_sigprocmask __NR_rt_sigprocmask -#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo -#define SYS_rt_sigreturn __NR_rt_sigreturn -#define SYS_rt_sigsuspend __NR_rt_sigsuspend -#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait -#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo -#define SYS_sched_get_priority_max __NR_sched_get_priority_max -#define SYS_sched_get_priority_min __NR_sched_get_priority_min -#define SYS_sched_getaffinity __NR_sched_getaffinity -#define SYS_sched_getattr __NR_sched_getattr -#define SYS_sched_getparam __NR_sched_getparam -#define SYS_sched_getscheduler __NR_sched_getscheduler -#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval -#define SYS_sched_setaffinity __NR_sched_setaffinity -#define SYS_sched_setattr __NR_sched_setattr -#define SYS_sched_setparam __NR_sched_setparam -#define SYS_sched_setscheduler __NR_sched_setscheduler -#define SYS_sched_yield __NR_sched_yield -#define SYS_seccomp __NR_seccomp -#define SYS_semctl __NR_semctl -#define SYS_semget __NR_semget -#define SYS_semop __NR_semop -#define SYS_semtimedop __NR_semtimedop -#define SYS_send __NR_send -#define SYS_sendfile __NR_sendfile -#define SYS_sendfile64 __NR_sendfile64 -#define SYS_sendmmsg __NR_sendmmsg -#define SYS_sendmsg __NR_sendmsg -#define SYS_sendto __NR_sendto -#define SYS_set_mempolicy __NR_set_mempolicy -#define SYS_set_robust_list __NR_set_robust_list -#define SYS_set_tid_address __NR_set_tid_address -#define SYS_setdomainname __NR_setdomainname -#define SYS_setfsgid __NR_setfsgid -#define SYS_setfsgid32 __NR_setfsgid32 -#define SYS_setfsuid __NR_setfsuid -#define SYS_setfsuid32 __NR_setfsuid32 -#define SYS_setgid __NR_setgid -#define SYS_setgid32 __NR_setgid32 -#define SYS_setgroups __NR_setgroups -#define SYS_setgroups32 __NR_setgroups32 -#define SYS_sethostname __NR_sethostname -#define SYS_setitimer __NR_setitimer -#define SYS_setns __NR_setns -#define SYS_setpgid __NR_setpgid -#define SYS_setpriority __NR_setpriority -#define SYS_setregid __NR_setregid -#define SYS_setregid32 __NR_setregid32 -#define SYS_setresgid __NR_setresgid -#define SYS_setresgid32 __NR_setresgid32 -#define SYS_setresuid __NR_setresuid -#define SYS_setresuid32 __NR_setresuid32 -#define SYS_setreuid __NR_setreuid -#define SYS_setreuid32 __NR_setreuid32 -#define SYS_setrlimit __NR_setrlimit -#define SYS_setsid __NR_setsid -#define SYS_setsockopt __NR_setsockopt -#define SYS_settimeofday __NR_settimeofday -#define SYS_setuid __NR_setuid -#define SYS_setuid32 __NR_setuid32 -#define SYS_setxattr __NR_setxattr -#define SYS_shmat __NR_shmat -#define SYS_shmctl __NR_shmctl -#define SYS_shmdt __NR_shmdt -#define SYS_shmget __NR_shmget -#define SYS_shutdown __NR_shutdown -#define SYS_sigaction __NR_sigaction -#define SYS_sigaltstack __NR_sigaltstack -#define SYS_signalfd __NR_signalfd -#define SYS_signalfd4 __NR_signalfd4 -#define SYS_sigpending __NR_sigpending -#define SYS_sigprocmask __NR_sigprocmask -#define SYS_sigreturn __NR_sigreturn -#define SYS_sigsuspend __NR_sigsuspend -#define SYS_socket __NR_socket -#define SYS_socketpair __NR_socketpair -#define SYS_splice __NR_splice -#define SYS_stat __NR_stat -#define SYS_stat64 __NR_stat64 -#define SYS_statfs __NR_statfs -#define SYS_statfs64 __NR_statfs64 -#define SYS_swapoff __NR_swapoff -#define SYS_swapon __NR_swapon -#define SYS_symlink __NR_symlink -#define SYS_symlinkat __NR_symlinkat -#define SYS_sync __NR_sync -#define SYS_sync_file_range2 __NR_sync_file_range2 -#define SYS_syncfs __NR_syncfs -#define SYS_sysfs __NR_sysfs -#define SYS_sysinfo __NR_sysinfo -#define SYS_syslog __NR_syslog -#define SYS_tee __NR_tee -#define SYS_tgkill __NR_tgkill -#define SYS_timer_create __NR_timer_create -#define SYS_timer_delete __NR_timer_delete -#define SYS_timer_getoverrun __NR_timer_getoverrun -#define SYS_timer_gettime __NR_timer_gettime -#define SYS_timer_settime __NR_timer_settime -#define SYS_timerfd_create __NR_timerfd_create -#define SYS_timerfd_gettime __NR_timerfd_gettime -#define SYS_timerfd_settime __NR_timerfd_settime -#define SYS_times __NR_times -#define SYS_tkill __NR_tkill -#define SYS_truncate __NR_truncate -#define SYS_truncate64 __NR_truncate64 -#define SYS_ugetrlimit __NR_ugetrlimit -#define SYS_umask __NR_umask -#define SYS_umount2 __NR_umount2 -#define SYS_uname __NR_uname -#define SYS_unlink __NR_unlink -#define SYS_unlinkat __NR_unlinkat -#define SYS_unshare __NR_unshare -#define SYS_uselib __NR_uselib -#define SYS_userfaultfd __NR_userfaultfd -#define SYS_ustat __NR_ustat -#define SYS_utimensat __NR_utimensat -#define SYS_utimes __NR_utimes -#define SYS_vfork __NR_vfork -#define SYS_vhangup __NR_vhangup -#define SYS_vmsplice __NR_vmsplice -#define SYS_vserver __NR_vserver -#define SYS_wait4 __NR_wait4 -#define SYS_waitid __NR_waitid -#define SYS_write __NR_write -#define SYS_writev __NR_writev -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/sysctl.h b/openflow/usr/include/arm-linux-gnueabihf/bits/sysctl.h deleted file mode 100644 index 81447b2..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/sysctl.h +++ /dev/null @@ -1 +0,0 @@ -/* Empty file. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/syslog-ldbl.h b/openflow/usr/include/arm-linux-gnueabihf/bits/syslog-ldbl.h deleted file mode 100644 index 7c1c03d..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/syslog-ldbl.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -mlong-double-64 compatibility mode for syslog functions. - Copyright (C) 2006-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SYSLOG_H -# error "Never include directly; use instead." -#endif - -__LDBL_REDIR_DECL (syslog) - -#ifdef __USE_MISC -__LDBL_REDIR_DECL (vsyslog) -#endif - -#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function -__LDBL_REDIR_DECL (__syslog_chk) - -# ifdef __USE_MISC -__LDBL_REDIR_DECL (__vsyslog_chk) -# endif -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/syslog-path.h b/openflow/usr/include/arm-linux-gnueabihf/bits/syslog-path.h deleted file mode 100644 index 6aab5e0..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/syslog-path.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -- _PATH_LOG definition - Copyright (C) 2006-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SYSLOG_H -# error "Never include this file directly. Use instead" -#endif - -#ifndef _BITS_SYSLOG_PATH_H -#define _BITS_SYSLOG_PATH_H 1 - -#define _PATH_LOG "/dev/log" - -#endif /* bits/syslog-path.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/syslog.h b/openflow/usr/include/arm-linux-gnueabihf/bits/syslog.h deleted file mode 100644 index 31dae38..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/syslog.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Checking macros for syslog functions. - Copyright (C) 2005-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SYSLOG_H -# error "Never include directly; use instead." -#endif - - -extern void __syslog_chk (int __pri, int __flag, const char *__fmt, ...) - __attribute__ ((__format__ (__printf__, 3, 4))); - -#ifdef __va_arg_pack -__fortify_function void -syslog (int __pri, const char *__fmt, ...) -{ - __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); -} -#elif !defined __cplusplus -# define syslog(pri, ...) \ - __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) -#endif - - -#ifdef __USE_MISC -extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt, - __gnuc_va_list __ap) - __attribute__ ((__format__ (__printf__, 3, 0))); - -__fortify_function void -vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) -{ - __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); -} -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/termios.h b/openflow/usr/include/arm-linux-gnueabihf/bits/termios.h deleted file mode 100644 index bbf093d..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/termios.h +++ /dev/null @@ -1,219 +0,0 @@ -/* termios type and macro definitions. Linux version. - Copyright (C) 1993-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _TERMIOS_H -# error "Never include directly; use instead." -#endif - -typedef unsigned char cc_t; -typedef unsigned int speed_t; -typedef unsigned int tcflag_t; - -#define NCCS 32 -struct termios - { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ -#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 -#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 - }; - -/* c_cc characters */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VTIME 5 -#define VMIN 6 -#define VSWTC 7 -#define VSTART 8 -#define VSTOP 9 -#define VSUSP 10 -#define VEOL 11 -#define VREPRINT 12 -#define VDISCARD 13 -#define VWERASE 14 -#define VLNEXT 15 -#define VEOL2 16 - -/* c_iflag bits */ -#define IGNBRK 0000001 -#define BRKINT 0000002 -#define IGNPAR 0000004 -#define PARMRK 0000010 -#define INPCK 0000020 -#define ISTRIP 0000040 -#define INLCR 0000100 -#define IGNCR 0000200 -#define ICRNL 0000400 -#define IUCLC 0001000 -#define IXON 0002000 -#define IXANY 0004000 -#define IXOFF 0010000 -#define IMAXBEL 0020000 -#define IUTF8 0040000 - -/* c_oflag bits */ -#define OPOST 0000001 -#define OLCUC 0000002 -#define ONLCR 0000004 -#define OCRNL 0000010 -#define ONOCR 0000020 -#define ONLRET 0000040 -#define OFILL 0000100 -#define OFDEL 0000200 -#if defined __USE_MISC || defined __USE_XOPEN -# define NLDLY 0000400 -# define NL0 0000000 -# define NL1 0000400 -# define CRDLY 0003000 -# define CR0 0000000 -# define CR1 0001000 -# define CR2 0002000 -# define CR3 0003000 -# define TABDLY 0014000 -# define TAB0 0000000 -# define TAB1 0004000 -# define TAB2 0010000 -# define TAB3 0014000 -# define BSDLY 0020000 -# define BS0 0000000 -# define BS1 0020000 -# define FFDLY 0100000 -# define FF0 0000000 -# define FF1 0100000 -#endif - -#define VTDLY 0040000 -#define VT0 0000000 -#define VT1 0040000 - -#ifdef __USE_MISC -# define XTABS 0014000 -#endif - -/* c_cflag bit meaning */ -#ifdef __USE_MISC -# define CBAUD 0010017 -#endif -#define B0 0000000 /* hang up */ -#define B50 0000001 -#define B75 0000002 -#define B110 0000003 -#define B134 0000004 -#define B150 0000005 -#define B200 0000006 -#define B300 0000007 -#define B600 0000010 -#define B1200 0000011 -#define B1800 0000012 -#define B2400 0000013 -#define B4800 0000014 -#define B9600 0000015 -#define B19200 0000016 -#define B38400 0000017 -#ifdef __USE_MISC -# define EXTA B19200 -# define EXTB B38400 -#endif -#define CSIZE 0000060 -#define CS5 0000000 -#define CS6 0000020 -#define CS7 0000040 -#define CS8 0000060 -#define CSTOPB 0000100 -#define CREAD 0000200 -#define PARENB 0000400 -#define PARODD 0001000 -#define HUPCL 0002000 -#define CLOCAL 0004000 -#ifdef __USE_MISC -# define CBAUDEX 0010000 -#endif -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 -#define B500000 0010005 -#define B576000 0010006 -#define B921600 0010007 -#define B1000000 0010010 -#define B1152000 0010011 -#define B1500000 0010012 -#define B2000000 0010013 -#define B2500000 0010014 -#define B3000000 0010015 -#define B3500000 0010016 -#define B4000000 0010017 -#define __MAX_BAUD B4000000 -#ifdef __USE_MISC -# define CIBAUD 002003600000 /* input baud rate (not used) */ -# define CMSPAR 010000000000 /* mark or space (stick) parity */ -# define CRTSCTS 020000000000 /* flow control */ -#endif - -/* c_lflag bits */ -#define ISIG 0000001 -#define ICANON 0000002 -#if defined __USE_MISC || defined __USE_XOPEN -# define XCASE 0000004 -#endif -#define ECHO 0000010 -#define ECHOE 0000020 -#define ECHOK 0000040 -#define ECHONL 0000100 -#define NOFLSH 0000200 -#define TOSTOP 0000400 -#ifdef __USE_MISC -# define ECHOCTL 0001000 -# define ECHOPRT 0002000 -# define ECHOKE 0004000 -# define FLUSHO 0010000 -# define PENDIN 0040000 -#endif -#define IEXTEN 0100000 -#ifdef __USE_MISC -# define EXTPROC 0200000 -#endif - -/* tcflow() and TCXONC use these */ -#define TCOOFF 0 -#define TCOON 1 -#define TCIOFF 2 -#define TCION 3 - -/* tcflush() and TCFLSH use these */ -#define TCIFLUSH 0 -#define TCOFLUSH 1 -#define TCIOFLUSH 2 - -/* tcsetattr uses these */ -#define TCSANOW 0 -#define TCSADRAIN 1 -#define TCSAFLUSH 2 - - -#define _IOT_termios /* Hurd ioctl type field. */ \ - _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/time.h b/openflow/usr/include/arm-linux-gnueabihf/bits/time.h deleted file mode 100644 index 87eb51f..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/time.h +++ /dev/null @@ -1,101 +0,0 @@ -/* System-dependent timing definitions. Linux version. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * Never include this file directly; use instead. - */ - -#if defined __need_timeval || defined __USE_GNU -# ifndef _STRUCT_TIMEVAL -# define _STRUCT_TIMEVAL 1 -# include - -/* A time value that is accurate to the nearest - microsecond but also has a range of years. */ -struct timeval - { - __time_t tv_sec; /* Seconds. */ - __suseconds_t tv_usec; /* Microseconds. */ - }; -# endif /* struct timeval */ -#endif - -#ifndef __need_timeval -# ifndef _BITS_TIME_H -# define _BITS_TIME_H 1 - -/* ISO/IEC 9899:1999 7.23.1: Components of time - The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is - the number per second of the value returned by the `clock' function. */ -/* CAE XSH, Issue 4, Version 2: - The value of CLOCKS_PER_SEC is required to be 1 million on all - XSI-conformant systems. */ -# define CLOCKS_PER_SEC ((clock_t) 1000000) - -# if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \ - && !defined __USE_XOPEN2K -/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK - presents the real value for clock ticks per second for the system. */ -# include -extern long int __sysconf (int); -# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */ -# endif - -# ifdef __USE_POSIX199309 -/* Identifier for system-wide realtime clock. */ -# define CLOCK_REALTIME 0 -/* Monotonic system-wide clock. */ -# define CLOCK_MONOTONIC 1 -/* High-resolution timer from the CPU. */ -# define CLOCK_PROCESS_CPUTIME_ID 2 -/* Thread-specific CPU-time clock. */ -# define CLOCK_THREAD_CPUTIME_ID 3 -/* Monotonic system-wide clock, not adjusted for frequency scaling. */ -# define CLOCK_MONOTONIC_RAW 4 -/* Identifier for system-wide realtime clock, updated only on ticks. */ -# define CLOCK_REALTIME_COARSE 5 -/* Monotonic system-wide clock, updated only on ticks. */ -# define CLOCK_MONOTONIC_COARSE 6 -/* Monotonic system-wide clock that includes time spent in suspension. */ -# define CLOCK_BOOTTIME 7 -/* Like CLOCK_REALTIME but also wakes suspended system. */ -# define CLOCK_REALTIME_ALARM 8 -/* Like CLOCK_BOOTTIME but also wakes suspended system. */ -# define CLOCK_BOOTTIME_ALARM 9 -/* Like CLOCK_REALTIME but in International Atomic Time. */ -# define CLOCK_TAI 11 - -/* Flag to indicate time is absolute. */ -# define TIMER_ABSTIME 1 -# endif - -# ifdef __USE_GNU -# include - -__BEGIN_DECLS - -/* Tune a POSIX clock. */ -extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW; - -__END_DECLS -# endif /* use GNU */ - -# endif /* bits/time.h */ -#endif - -#undef __need_timeval diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/timerfd.h b/openflow/usr/include/arm-linux-gnueabihf/bits/timerfd.h deleted file mode 100644 index 0ba607e..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/timerfd.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2008-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_TIMERFD_H -# error "Never use directly; include instead." -#endif - -/* Bits to be set in the FLAGS parameter of `timerfd_create'. */ -enum - { - TFD_CLOEXEC = 02000000, -#define TFD_CLOEXEC TFD_CLOEXEC - TFD_NONBLOCK = 00004000 -#define TFD_NONBLOCK TFD_NONBLOCK - }; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/timex.h b/openflow/usr/include/arm-linux-gnueabihf/bits/timex.h deleted file mode 100644 index 5eb7ccb..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/timex.h +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_TIMEX_H -#define _BITS_TIMEX_H 1 - -#include - -/* These definitions from linux/timex.h as of 3.18. */ - -struct timex -{ - unsigned int modes; /* mode selector */ - __syscall_slong_t offset; /* time offset (usec) */ - __syscall_slong_t freq; /* frequency offset (scaled ppm) */ - __syscall_slong_t maxerror; /* maximum error (usec) */ - __syscall_slong_t esterror; /* estimated error (usec) */ - int status; /* clock command/status */ - __syscall_slong_t constant; /* pll time constant */ - __syscall_slong_t precision; /* clock precision (usec) (ro) */ - __syscall_slong_t tolerance; /* clock frequency tolerance (ppm) (ro) */ - struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ - __syscall_slong_t tick; /* (modified) usecs between clock ticks */ - __syscall_slong_t ppsfreq; /* pps frequency (scaled ppm) (ro) */ - __syscall_slong_t jitter; /* pps jitter (us) (ro) */ - int shift; /* interval duration (s) (shift) (ro) */ - __syscall_slong_t stabil; /* pps stability (scaled ppm) (ro) */ - __syscall_slong_t jitcnt; /* jitter limit exceeded (ro) */ - __syscall_slong_t calcnt; /* calibration intervals (ro) */ - __syscall_slong_t errcnt; /* calibration errors (ro) */ - __syscall_slong_t stbcnt; /* stability limit exceeded (ro) */ - - int tai; /* TAI offset (ro) */ - - /* ??? */ - int :32; int :32; int :32; int :32; - int :32; int :32; int :32; int :32; - int :32; int :32; int :32; -}; - -/* Mode codes (timex.mode) */ -#define ADJ_OFFSET 0x0001 /* time offset */ -#define ADJ_FREQUENCY 0x0002 /* frequency offset */ -#define ADJ_MAXERROR 0x0004 /* maximum time error */ -#define ADJ_ESTERROR 0x0008 /* estimated time error */ -#define ADJ_STATUS 0x0010 /* clock status */ -#define ADJ_TIMECONST 0x0020 /* pll time constant */ -#define ADJ_TAI 0x0080 /* set TAI offset */ -#define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */ -#define ADJ_MICRO 0x1000 /* select microsecond resolution */ -#define ADJ_NANO 0x2000 /* select nanosecond resolution */ -#define ADJ_TICK 0x4000 /* tick value */ -#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ -#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ - -/* xntp 3.4 compatibility names */ -#define MOD_OFFSET ADJ_OFFSET -#define MOD_FREQUENCY ADJ_FREQUENCY -#define MOD_MAXERROR ADJ_MAXERROR -#define MOD_ESTERROR ADJ_ESTERROR -#define MOD_STATUS ADJ_STATUS -#define MOD_TIMECONST ADJ_TIMECONST -#define MOD_CLKB ADJ_TICK -#define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */ -#define MOD_TAI ADJ_TAI -#define MOD_MICRO ADJ_MICRO -#define MOD_NANO ADJ_NANO - - -/* Status codes (timex.status) */ -#define STA_PLL 0x0001 /* enable PLL updates (rw) */ -#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ -#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ -#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */ - -#define STA_INS 0x0010 /* insert leap (rw) */ -#define STA_DEL 0x0020 /* delete leap (rw) */ -#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ -#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */ - -#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ -#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ -#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ -#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ - -#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ -#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */ -#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */ -#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */ - -/* Read-only bits */ -#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ - STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) - -#endif /* bits/timex.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/types.h b/openflow/usr/include/arm-linux-gnueabihf/bits/types.h deleted file mode 100644 index 01753bd..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/types.h +++ /dev/null @@ -1,194 +0,0 @@ -/* bits/types.h -- definitions of __*_t types underlying *_t types. - Copyright (C) 2002-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * Never include this file directly; use instead. - */ - -#ifndef _BITS_TYPES_H -#define _BITS_TYPES_H 1 - -#include -#include - -/* Convenience types. */ -typedef unsigned char __u_char; -typedef unsigned short int __u_short; -typedef unsigned int __u_int; -typedef unsigned long int __u_long; - -/* Fixed-size types, underlying types depend on word size and compiler. */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef signed short int __int16_t; -typedef unsigned short int __uint16_t; -typedef signed int __int32_t; -typedef unsigned int __uint32_t; -#if __WORDSIZE == 64 -typedef signed long int __int64_t; -typedef unsigned long int __uint64_t; -#else -__extension__ typedef signed long long int __int64_t; -__extension__ typedef unsigned long long int __uint64_t; -#endif - -/* quad_t is also 64 bits. */ -#if __WORDSIZE == 64 -typedef long int __quad_t; -typedef unsigned long int __u_quad_t; -#else -__extension__ typedef long long int __quad_t; -__extension__ typedef unsigned long long int __u_quad_t; -#endif - - -/* The machine-dependent file defines __*_T_TYPE - macros for each of the OS types we define below. The definitions - of those macros must use the following macros for underlying types. - We define __S_TYPE and __U_TYPE for the signed and unsigned - variants of each of the following integer types on this machine. - - 16 -- "natural" 16-bit type (always short) - 32 -- "natural" 32-bit type (always int) - 64 -- "natural" 64-bit type (long or long long) - LONG32 -- 32-bit type, traditionally long - QUAD -- 64-bit type, always long long - WORD -- natural type of __WORDSIZE bits (int or long) - LONGWORD -- type of __WORDSIZE bits, traditionally long - - We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the - conventional uses of `long' or `long long' type modifiers match the - types we define, even when a less-adorned type would be the same size. - This matters for (somewhat) portably writing printf/scanf formats for - these types, where using the appropriate l or ll format modifiers can - make the typedefs and the formats match up across all GNU platforms. If - we used `long' when it's 64 bits where `long long' is expected, then the - compiler would warn about the formats not matching the argument types, - and the programmer changing them to shut up the compiler would break the - program's portability. - - Here we assume what is presently the case in all the GCC configurations - we support: long long is always 64 bits, long is always word/address size, - and int is always 32 bits. */ - -#define __S16_TYPE short int -#define __U16_TYPE unsigned short int -#define __S32_TYPE int -#define __U32_TYPE unsigned int -#define __SLONGWORD_TYPE long int -#define __ULONGWORD_TYPE unsigned long int -#if __WORDSIZE == 32 -# define __SQUAD_TYPE __quad_t -# define __UQUAD_TYPE __u_quad_t -# define __SWORD_TYPE int -# define __UWORD_TYPE unsigned int -# define __SLONG32_TYPE long int -# define __ULONG32_TYPE unsigned long int -# define __S64_TYPE __quad_t -# define __U64_TYPE __u_quad_t -/* We want __extension__ before typedef's that use nonstandard base types - such as `long long' in C89 mode. */ -# define __STD_TYPE __extension__ typedef -#elif __WORDSIZE == 64 -# define __SQUAD_TYPE long int -# define __UQUAD_TYPE unsigned long int -# define __SWORD_TYPE long int -# define __UWORD_TYPE unsigned long int -# define __SLONG32_TYPE int -# define __ULONG32_TYPE unsigned int -# define __S64_TYPE long int -# define __U64_TYPE unsigned long int -/* No need to mark the typedef with __extension__. */ -# define __STD_TYPE typedef -#else -# error -#endif -#include /* Defines __*_T_TYPE macros. */ - - -__STD_TYPE __DEV_T_TYPE __dev_t; /* Type of device numbers. */ -__STD_TYPE __UID_T_TYPE __uid_t; /* Type of user identifications. */ -__STD_TYPE __GID_T_TYPE __gid_t; /* Type of group identifications. */ -__STD_TYPE __INO_T_TYPE __ino_t; /* Type of file serial numbers. */ -__STD_TYPE __INO64_T_TYPE __ino64_t; /* Type of file serial numbers (LFS).*/ -__STD_TYPE __MODE_T_TYPE __mode_t; /* Type of file attribute bitmasks. */ -__STD_TYPE __NLINK_T_TYPE __nlink_t; /* Type of file link counts. */ -__STD_TYPE __OFF_T_TYPE __off_t; /* Type of file sizes and offsets. */ -__STD_TYPE __OFF64_T_TYPE __off64_t; /* Type of file sizes and offsets (LFS). */ -__STD_TYPE __PID_T_TYPE __pid_t; /* Type of process identifications. */ -__STD_TYPE __FSID_T_TYPE __fsid_t; /* Type of file system IDs. */ -__STD_TYPE __CLOCK_T_TYPE __clock_t; /* Type of CPU usage counts. */ -__STD_TYPE __RLIM_T_TYPE __rlim_t; /* Type for resource measurement. */ -__STD_TYPE __RLIM64_T_TYPE __rlim64_t; /* Type for resource measurement (LFS). */ -__STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */ -__STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */ -__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ -__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ - -__STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */ -__STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */ - -/* Clock ID used in clock and timer functions. */ -__STD_TYPE __CLOCKID_T_TYPE __clockid_t; - -/* Timer ID returned by `timer_create'. */ -__STD_TYPE __TIMER_T_TYPE __timer_t; - -/* Type to represent block size. */ -__STD_TYPE __BLKSIZE_T_TYPE __blksize_t; - -/* Types from the Large File Support interface. */ - -/* Type to count number of disk blocks. */ -__STD_TYPE __BLKCNT_T_TYPE __blkcnt_t; -__STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t; - -/* Type to count file system blocks. */ -__STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t; -__STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t; - -/* Type to count file system nodes. */ -__STD_TYPE __FSFILCNT_T_TYPE __fsfilcnt_t; -__STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t; - -/* Type of miscellaneous file system fields. */ -__STD_TYPE __FSWORD_T_TYPE __fsword_t; - -__STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error. */ - -/* Signed long type used in system calls. */ -__STD_TYPE __SYSCALL_SLONG_TYPE __syscall_slong_t; -/* Unsigned long type used in system calls. */ -__STD_TYPE __SYSCALL_ULONG_TYPE __syscall_ulong_t; - -/* These few don't really vary by system, they always correspond - to one of the other defined types. */ -typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */ -typedef __quad_t *__qaddr_t; -typedef char *__caddr_t; - -/* Duplicates info from stdint.h but this is used in unistd.h. */ -__STD_TYPE __SWORD_TYPE __intptr_t; - -/* Duplicate info from sys/socket.h. */ -__STD_TYPE __U32_TYPE __socklen_t; - - -#undef __STD_TYPE - -#endif /* bits/types.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/typesizes.h b/openflow/usr/include/arm-linux-gnueabihf/bits/typesizes.h deleted file mode 100644 index 53047b8..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/typesizes.h +++ /dev/null @@ -1,78 +0,0 @@ -/* bits/typesizes.h -- underlying types for *_t. Generic version. - Copyright (C) 2002-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_TYPES_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_TYPESIZES_H -#define _BITS_TYPESIZES_H 1 - -/* See for the meaning of these macros. This file exists so - that need not vary across different GNU platforms. */ - -#define __DEV_T_TYPE __UQUAD_TYPE -#define __UID_T_TYPE __U32_TYPE -#define __GID_T_TYPE __U32_TYPE -#define __INO_T_TYPE __ULONGWORD_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE -#define __MODE_T_TYPE __U32_TYPE -#define __NLINK_T_TYPE __UWORD_TYPE -#define __OFF_T_TYPE __SLONGWORD_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE -#define __PID_T_TYPE __S32_TYPE -#define __RLIM_T_TYPE __ULONGWORD_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE -#define __BLKCNT_T_TYPE __SLONGWORD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE -#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE -#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE -#define __FSWORD_T_TYPE __SWORD_TYPE -#define __ID_T_TYPE __U32_TYPE -#define __CLOCK_T_TYPE __SLONGWORD_TYPE -#define __TIME_T_TYPE __SLONGWORD_TYPE -#define __USECONDS_T_TYPE __U32_TYPE -#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE -#define __DADDR_T_TYPE __S32_TYPE -#define __KEY_T_TYPE __S32_TYPE -#define __CLOCKID_T_TYPE __S32_TYPE -#define __TIMER_T_TYPE void * -#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE -#define __FSID_T_TYPE struct { int __val[2]; } -#define __SSIZE_T_TYPE __SWORD_TYPE -#define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE -#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE -#define __CPU_MASK_TYPE __ULONGWORD_TYPE - -#ifdef __LP64__ -/* Tell the libc code that off_t and off64_t are actually the same type - for all ABI purposes, even if possibly expressed as different base types - for C type-checking purposes. */ -# define __OFF_T_MATCHES_OFF64_T 1 - -/* Same for ino_t and ino64_t. */ -# define __INO_T_MATCHES_INO64_T 1 -#endif - -/* Number of descriptors that can fit in an `fd_set'. */ -#define __FD_SETSIZE 1024 - - -#endif /* bits/typesizes.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/uio.h b/openflow/usr/include/arm-linux-gnueabihf/bits/uio.h deleted file mode 100644 index 7684b3e..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/uio.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _SYS_UIO_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_UIO_H -#define _BITS_UIO_H 1 - -#include - - -/* We should normally use the Linux kernel header file to define this - type and macros but this calls for trouble because of the header - includes other kernel headers. */ - -/* Size of object which can be written atomically. - - This macro has different values in different kernel versions. The - latest versions of the kernel use 1024 and this is good choice. Since - the C library implementation of readv/writev is able to emulate the - functionality even if the currently running kernel does not support - this large value the readv/writev call will not fail because of this. */ -#define UIO_MAXIOV 1024 - - -/* Structure for scatter/gather I/O. */ -struct iovec - { - void *iov_base; /* Pointer to data. */ - size_t iov_len; /* Length of data. */ - }; - -#endif - - -#ifdef __USE_GNU -# if defined _SYS_UIO_H && !defined _BITS_UIO_H_FOR_SYS_UIO_H -# define _BITS_UIO_H_FOR_SYS_UIO_H 1 - -__BEGIN_DECLS - -/* Read from another process' address space. */ -extern ssize_t process_vm_readv (pid_t __pid, const struct iovec *__lvec, - unsigned long int __liovcnt, - const struct iovec *__rvec, - unsigned long int __riovcnt, - unsigned long int __flags) - __THROW; - -/* Write to another process' address space. */ -extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec, - unsigned long int __liovcnt, - const struct iovec *__rvec, - unsigned long int __riovcnt, - unsigned long int __flags) - __THROW; - -__END_DECLS - -# endif -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/unistd.h b/openflow/usr/include/arm-linux-gnueabihf/bits/unistd.h deleted file mode 100644 index 0105f04..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/unistd.h +++ /dev/null @@ -1,385 +0,0 @@ -/* Checking macros for unistd functions. - Copyright (C) 2005-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _UNISTD_H -# error "Never include directly; use instead." -#endif - -extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes, - size_t __buflen) __wur; -extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf, - size_t __nbytes), read) __wur; -extern ssize_t __REDIRECT (__read_chk_warn, - (int __fd, void *__buf, size_t __nbytes, - size_t __buflen), __read_chk) - __wur __warnattr ("read called with bigger length than size of " - "the destination buffer"); - -__fortify_function __wur ssize_t -read (int __fd, void *__buf, size_t __nbytes) -{ - if (__bos0 (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__nbytes)) - return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf)); - - if (__nbytes > __bos0 (__buf)) - return __read_chk_warn (__fd, __buf, __nbytes, __bos0 (__buf)); - } - return __read_alias (__fd, __buf, __nbytes); -} - -#ifdef __USE_UNIX98 -extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes, - __off_t __offset, size_t __bufsize) __wur; -extern ssize_t __pread64_chk (int __fd, void *__buf, size_t __nbytes, - __off64_t __offset, size_t __bufsize) __wur; -extern ssize_t __REDIRECT (__pread_alias, - (int __fd, void *__buf, size_t __nbytes, - __off_t __offset), pread) __wur; -extern ssize_t __REDIRECT (__pread64_alias, - (int __fd, void *__buf, size_t __nbytes, - __off64_t __offset), pread64) __wur; -extern ssize_t __REDIRECT (__pread_chk_warn, - (int __fd, void *__buf, size_t __nbytes, - __off_t __offset, size_t __bufsize), __pread_chk) - __wur __warnattr ("pread called with bigger length than size of " - "the destination buffer"); -extern ssize_t __REDIRECT (__pread64_chk_warn, - (int __fd, void *__buf, size_t __nbytes, - __off64_t __offset, size_t __bufsize), - __pread64_chk) - __wur __warnattr ("pread64 called with bigger length than size of " - "the destination buffer"); - -# ifndef __USE_FILE_OFFSET64 -__fortify_function __wur ssize_t -pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) -{ - if (__bos0 (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__nbytes)) - return __pread_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); - - if ( __nbytes > __bos0 (__buf)) - return __pread_chk_warn (__fd, __buf, __nbytes, __offset, - __bos0 (__buf)); - } - return __pread_alias (__fd, __buf, __nbytes, __offset); -} -# else -__fortify_function __wur ssize_t -pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) -{ - if (__bos0 (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__nbytes)) - return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); - - if ( __nbytes > __bos0 (__buf)) - return __pread64_chk_warn (__fd, __buf, __nbytes, __offset, - __bos0 (__buf)); - } - - return __pread64_alias (__fd, __buf, __nbytes, __offset); -} -# endif - -# ifdef __USE_LARGEFILE64 -__fortify_function __wur ssize_t -pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) -{ - if (__bos0 (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__nbytes)) - return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); - - if ( __nbytes > __bos0 (__buf)) - return __pread64_chk_warn (__fd, __buf, __nbytes, __offset, - __bos0 (__buf)); - } - - return __pread64_alias (__fd, __buf, __nbytes, __offset); -} -# endif -#endif - -#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K -extern ssize_t __readlink_chk (const char *__restrict __path, - char *__restrict __buf, size_t __len, - size_t __buflen) - __THROW __nonnull ((1, 2)) __wur; -extern ssize_t __REDIRECT_NTH (__readlink_alias, - (const char *__restrict __path, - char *__restrict __buf, size_t __len), readlink) - __nonnull ((1, 2)) __wur; -extern ssize_t __REDIRECT_NTH (__readlink_chk_warn, - (const char *__restrict __path, - char *__restrict __buf, size_t __len, - size_t __buflen), __readlink_chk) - __nonnull ((1, 2)) __wur __warnattr ("readlink called with bigger length " - "than size of destination buffer"); - -__fortify_function __nonnull ((1, 2)) __wur ssize_t -__NTH (readlink (const char *__restrict __path, char *__restrict __buf, - size_t __len)) -{ - if (__bos (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__len)) - return __readlink_chk (__path, __buf, __len, __bos (__buf)); - - if ( __len > __bos (__buf)) - return __readlink_chk_warn (__path, __buf, __len, __bos (__buf)); - } - return __readlink_alias (__path, __buf, __len); -} -#endif - -#ifdef __USE_ATFILE -extern ssize_t __readlinkat_chk (int __fd, const char *__restrict __path, - char *__restrict __buf, size_t __len, - size_t __buflen) - __THROW __nonnull ((2, 3)) __wur; -extern ssize_t __REDIRECT_NTH (__readlinkat_alias, - (int __fd, const char *__restrict __path, - char *__restrict __buf, size_t __len), - readlinkat) - __nonnull ((2, 3)) __wur; -extern ssize_t __REDIRECT_NTH (__readlinkat_chk_warn, - (int __fd, const char *__restrict __path, - char *__restrict __buf, size_t __len, - size_t __buflen), __readlinkat_chk) - __nonnull ((2, 3)) __wur __warnattr ("readlinkat called with bigger " - "length than size of destination " - "buffer"); - -__fortify_function __nonnull ((2, 3)) __wur ssize_t -__NTH (readlinkat (int __fd, const char *__restrict __path, - char *__restrict __buf, size_t __len)) -{ - if (__bos (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__len)) - return __readlinkat_chk (__fd, __path, __buf, __len, __bos (__buf)); - - if (__len > __bos (__buf)) - return __readlinkat_chk_warn (__fd, __path, __buf, __len, - __bos (__buf)); - } - return __readlinkat_alias (__fd, __path, __buf, __len); -} -#endif - -extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen) - __THROW __wur; -extern char *__REDIRECT_NTH (__getcwd_alias, - (char *__buf, size_t __size), getcwd) __wur; -extern char *__REDIRECT_NTH (__getcwd_chk_warn, - (char *__buf, size_t __size, size_t __buflen), - __getcwd_chk) - __wur __warnattr ("getcwd caller with bigger length than size of " - "destination buffer"); - -__fortify_function __wur char * -__NTH (getcwd (char *__buf, size_t __size)) -{ - if (__bos (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__size)) - return __getcwd_chk (__buf, __size, __bos (__buf)); - - if (__size > __bos (__buf)) - return __getcwd_chk_warn (__buf, __size, __bos (__buf)); - } - return __getcwd_alias (__buf, __size); -} - -#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED -extern char *__getwd_chk (char *__buf, size_t buflen) - __THROW __nonnull ((1)) __wur; -extern char *__REDIRECT_NTH (__getwd_warn, (char *__buf), getwd) - __nonnull ((1)) __wur __warnattr ("please use getcwd instead, as getwd " - "doesn't specify buffer size"); - -__fortify_function __nonnull ((1)) __attribute_deprecated__ __wur char * -__NTH (getwd (char *__buf)) -{ - if (__bos (__buf) != (size_t) -1) - return __getwd_chk (__buf, __bos (__buf)); - return __getwd_warn (__buf); -} -#endif - -extern size_t __confstr_chk (int __name, char *__buf, size_t __len, - size_t __buflen) __THROW; -extern size_t __REDIRECT_NTH (__confstr_alias, (int __name, char *__buf, - size_t __len), confstr); -extern size_t __REDIRECT_NTH (__confstr_chk_warn, - (int __name, char *__buf, size_t __len, - size_t __buflen), __confstr_chk) - __warnattr ("confstr called with bigger length than size of destination " - "buffer"); - -__fortify_function size_t -__NTH (confstr (int __name, char *__buf, size_t __len)) -{ - if (__bos (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__len)) - return __confstr_chk (__name, __buf, __len, __bos (__buf)); - - if (__bos (__buf) < __len) - return __confstr_chk_warn (__name, __buf, __len, __bos (__buf)); - } - return __confstr_alias (__name, __buf, __len); -} - - -extern int __getgroups_chk (int __size, __gid_t __list[], size_t __listlen) - __THROW __wur; -extern int __REDIRECT_NTH (__getgroups_alias, (int __size, __gid_t __list[]), - getgroups) __wur; -extern int __REDIRECT_NTH (__getgroups_chk_warn, - (int __size, __gid_t __list[], size_t __listlen), - __getgroups_chk) - __wur __warnattr ("getgroups called with bigger group count than what " - "can fit into destination buffer"); - -__fortify_function int -__NTH (getgroups (int __size, __gid_t __list[])) -{ - if (__bos (__list) != (size_t) -1) - { - if (!__builtin_constant_p (__size) || __size < 0) - return __getgroups_chk (__size, __list, __bos (__list)); - - if (__size * sizeof (__gid_t) > __bos (__list)) - return __getgroups_chk_warn (__size, __list, __bos (__list)); - } - return __getgroups_alias (__size, __list); -} - - -extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen, - size_t __nreal) __THROW __nonnull ((2)); -extern int __REDIRECT_NTH (__ttyname_r_alias, (int __fd, char *__buf, - size_t __buflen), ttyname_r) - __nonnull ((2)); -extern int __REDIRECT_NTH (__ttyname_r_chk_warn, - (int __fd, char *__buf, size_t __buflen, - size_t __nreal), __ttyname_r_chk) - __nonnull ((2)) __warnattr ("ttyname_r called with bigger buflen than " - "size of destination buffer"); - -__fortify_function int -__NTH (ttyname_r (int __fd, char *__buf, size_t __buflen)) -{ - if (__bos (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__buflen)) - return __ttyname_r_chk (__fd, __buf, __buflen, __bos (__buf)); - - if (__buflen > __bos (__buf)) - return __ttyname_r_chk_warn (__fd, __buf, __buflen, __bos (__buf)); - } - return __ttyname_r_alias (__fd, __buf, __buflen); -} - - -#if defined __USE_REENTRANT || defined __USE_POSIX199506 -extern int __getlogin_r_chk (char *__buf, size_t __buflen, size_t __nreal) - __nonnull ((1)); -extern int __REDIRECT (__getlogin_r_alias, (char *__buf, size_t __buflen), - getlogin_r) __nonnull ((1)); -extern int __REDIRECT (__getlogin_r_chk_warn, - (char *__buf, size_t __buflen, size_t __nreal), - __getlogin_r_chk) - __nonnull ((1)) __warnattr ("getlogin_r called with bigger buflen than " - "size of destination buffer"); - -__fortify_function int -getlogin_r (char *__buf, size_t __buflen) -{ - if (__bos (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__buflen)) - return __getlogin_r_chk (__buf, __buflen, __bos (__buf)); - - if (__buflen > __bos (__buf)) - return __getlogin_r_chk_warn (__buf, __buflen, __bos (__buf)); - } - return __getlogin_r_alias (__buf, __buflen); -} -#endif - - -#if defined __USE_MISC || defined __USE_UNIX98 -extern int __gethostname_chk (char *__buf, size_t __buflen, size_t __nreal) - __THROW __nonnull ((1)); -extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen), - gethostname) __nonnull ((1)); -extern int __REDIRECT_NTH (__gethostname_chk_warn, - (char *__buf, size_t __buflen, size_t __nreal), - __gethostname_chk) - __nonnull ((1)) __warnattr ("gethostname called with bigger buflen than " - "size of destination buffer"); - -__fortify_function int -__NTH (gethostname (char *__buf, size_t __buflen)) -{ - if (__bos (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__buflen)) - return __gethostname_chk (__buf, __buflen, __bos (__buf)); - - if (__buflen > __bos (__buf)) - return __gethostname_chk_warn (__buf, __buflen, __bos (__buf)); - } - return __gethostname_alias (__buf, __buflen); -} -#endif - - -#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_UNIX98) -extern int __getdomainname_chk (char *__buf, size_t __buflen, size_t __nreal) - __THROW __nonnull ((1)) __wur; -extern int __REDIRECT_NTH (__getdomainname_alias, (char *__buf, - size_t __buflen), - getdomainname) __nonnull ((1)) __wur; -extern int __REDIRECT_NTH (__getdomainname_chk_warn, - (char *__buf, size_t __buflen, size_t __nreal), - __getdomainname_chk) - __nonnull ((1)) __wur __warnattr ("getdomainname called with bigger " - "buflen than size of destination " - "buffer"); - -__fortify_function int -__NTH (getdomainname (char *__buf, size_t __buflen)) -{ - if (__bos (__buf) != (size_t) -1) - { - if (!__builtin_constant_p (__buflen)) - return __getdomainname_chk (__buf, __buflen, __bos (__buf)); - - if (__buflen > __bos (__buf)) - return __getdomainname_chk_warn (__buf, __buflen, __bos (__buf)); - } - return __getdomainname_alias (__buf, __buflen); -} -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/ustat.h b/openflow/usr/include/arm-linux-gnueabihf/bits/ustat.h deleted file mode 100644 index 0da6240..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/ustat.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_USTAT_H -# error "Never include directly; use instead." -#endif - -#include - -struct ustat - { - __daddr_t f_tfree; /* Number of free blocks. */ - __ino_t f_tinode; /* Number of free inodes. */ - char f_fname[6]; - char f_fpack[6]; - }; diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/utmp.h b/openflow/usr/include/arm-linux-gnueabihf/bits/utmp.h deleted file mode 100644 index 2a1ffcb..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/utmp.h +++ /dev/null @@ -1,123 +0,0 @@ -/* The `struct utmp' type, describing entries in the utmp file. GNU version. - Copyright (C) 1993-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _UTMP_H -# error "Never include directly; use instead." -#endif - -#include -#include -#include -#include - - -#define UT_LINESIZE 32 -#define UT_NAMESIZE 32 -#define UT_HOSTSIZE 256 - - -/* The structure describing an entry in the database of - previous logins. */ -struct lastlog - { -#ifdef __WORDSIZE_TIME64_COMPAT32 - int32_t ll_time; -#else - __time_t ll_time; -#endif - char ll_line[UT_LINESIZE]; - char ll_host[UT_HOSTSIZE]; - }; - - -/* The structure describing the status of a terminated process. This - type is used in `struct utmp' below. */ -struct exit_status - { - short int e_termination; /* Process termination status. */ - short int e_exit; /* Process exit status. */ - }; - - -/* The structure describing an entry in the user accounting database. */ -struct utmp -{ - short int ut_type; /* Type of login. */ - pid_t ut_pid; /* Process ID of login process. */ - char ut_line[UT_LINESIZE]; /* Devicename. */ - char ut_id[4]; /* Inittab ID. */ - char ut_user[UT_NAMESIZE]; /* Username. */ - char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */ - struct exit_status ut_exit; /* Exit status of a process marked - as DEAD_PROCESS. */ -/* The ut_session and ut_tv fields must be the same size when compiled - 32- and 64-bit. This allows data files and shared memory to be - shared between 32- and 64-bit applications. */ -#ifdef __WORDSIZE_TIME64_COMPAT32 - int32_t ut_session; /* Session ID, used for windowing. */ - struct - { - int32_t tv_sec; /* Seconds. */ - int32_t tv_usec; /* Microseconds. */ - } ut_tv; /* Time entry was made. */ -#else - long int ut_session; /* Session ID, used for windowing. */ - struct timeval ut_tv; /* Time entry was made. */ -#endif - - int32_t ut_addr_v6[4]; /* Internet address of remote host. */ - char __glibc_reserved[20]; /* Reserved for future use. */ -}; - -/* Backwards compatibility hacks. */ -#define ut_name ut_user -#ifndef _NO_UT_TIME -/* We have a problem here: `ut_time' is also used otherwise. Define - _NO_UT_TIME if the compiler complains. */ -# define ut_time ut_tv.tv_sec -#endif -#define ut_xtime ut_tv.tv_sec -#define ut_addr ut_addr_v6[0] - - -/* Values for the `ut_type' field of a `struct utmp'. */ -#define EMPTY 0 /* No valid user accounting information. */ - -#define RUN_LVL 1 /* The system's runlevel. */ -#define BOOT_TIME 2 /* Time of system boot. */ -#define NEW_TIME 3 /* Time after system clock changed. */ -#define OLD_TIME 4 /* Time when system clock changed. */ - -#define INIT_PROCESS 5 /* Process spawned by the init process. */ -#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ -#define USER_PROCESS 7 /* Normal process. */ -#define DEAD_PROCESS 8 /* Terminated process. */ - -#define ACCOUNTING 9 - -/* Old Linux name for the EMPTY type. */ -#define UT_UNKNOWN EMPTY - - -/* Tell the user that we have a modern system with UT_HOST, UT_PID, - UT_TYPE, UT_ID and UT_TV fields. */ -#define _HAVE_UT_TYPE 1 -#define _HAVE_UT_PID 1 -#define _HAVE_UT_ID 1 -#define _HAVE_UT_TV 1 -#define _HAVE_UT_HOST 1 diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/utmpx.h b/openflow/usr/include/arm-linux-gnueabihf/bits/utmpx.h deleted file mode 100644 index b41548b..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/utmpx.h +++ /dev/null @@ -1,102 +0,0 @@ -/* Structures and definitions for the user accounting database. GNU version. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _UTMPX_H -# error "Never include directly; use instead." -#endif - -#include -#include -#include - - -#ifdef __USE_GNU -# include -# define _PATH_UTMPX _PATH_UTMP -# define _PATH_WTMPX _PATH_WTMP -#endif - - -#define __UT_LINESIZE 32 -#define __UT_NAMESIZE 32 -#define __UT_HOSTSIZE 256 - - -/* The structure describing the status of a terminated process. This - type is used in `struct utmpx' below. */ -struct __exit_status - { -#ifdef __USE_GNU - short int e_termination; /* Process termination status. */ - short int e_exit; /* Process exit status. */ -#else - short int __e_termination; /* Process termination status. */ - short int __e_exit; /* Process exit status. */ -#endif - }; - - -/* The structure describing an entry in the user accounting database. */ -struct utmpx -{ - short int ut_type; /* Type of login. */ - __pid_t ut_pid; /* Process ID of login process. */ - char ut_line[__UT_LINESIZE]; /* Devicename. */ - char ut_id[4]; /* Inittab ID. */ - char ut_user[__UT_NAMESIZE]; /* Username. */ - char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */ - struct __exit_status ut_exit; /* Exit status of a process marked - as DEAD_PROCESS. */ - -/* The fields ut_session and ut_tv must be the same size when compiled - 32- and 64-bit. This allows files and shared memory to be shared - between 32- and 64-bit applications. */ -#ifdef __WORDSIZE_TIME64_COMPAT32 - __int32_t ut_session; /* Session ID, used for windowing. */ - struct - { - __int32_t tv_sec; /* Seconds. */ - __int32_t tv_usec; /* Microseconds. */ - } ut_tv; /* Time entry was made. */ -#else - long int ut_session; /* Session ID, used for windowing. */ - struct timeval ut_tv; /* Time entry was made. */ -#endif - __int32_t ut_addr_v6[4]; /* Internet address of remote host. */ - char __glibc_reserved[20]; /* Reserved for future use. */ -}; - - -/* Values for the `ut_type' field of a `struct utmpx'. */ -#define EMPTY 0 /* No valid user accounting information. */ - -#ifdef __USE_GNU -# define RUN_LVL 1 /* The system's runlevel. */ -#endif -#define BOOT_TIME 2 /* Time of system boot. */ -#define NEW_TIME 3 /* Time after system clock changed. */ -#define OLD_TIME 4 /* Time when system clock changed. */ - -#define INIT_PROCESS 5 /* Process spawned by the init process. */ -#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ -#define USER_PROCESS 7 /* Normal process. */ -#define DEAD_PROCESS 8 /* Terminated process. */ - -#ifdef __USE_GNU -# define ACCOUNTING 9 /* System accounting. */ -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/utsname.h b/openflow/usr/include/arm-linux-gnueabihf/bits/utsname.h deleted file mode 100644 index 070795e..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/utsname.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_UTSNAME_H -# error "Never include directly; use instead." -#endif - -/* Length of the entries in `struct utsname' is 65. */ -#define _UTSNAME_LENGTH 65 - -/* Linux provides as additional information in the `struct utsname' - the name of the current domain. Define _UTSNAME_DOMAIN_LENGTH - to a value != 0 to activate this entry. */ -#define _UTSNAME_DOMAIN_LENGTH _UTSNAME_LENGTH diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/waitflags.h b/openflow/usr/include/arm-linux-gnueabihf/bits/waitflags.h deleted file mode 100644 index 6f505e4..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/waitflags.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Definitions of flag bits for `waitpid' et al. - Copyright (C) 1992-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _SYS_WAIT_H && !defined _STDLIB_H -# error "Never include directly; use instead." -#endif - - -/* Bits in the third argument to `waitpid'. */ -#define WNOHANG 1 /* Don't block waiting. */ -#define WUNTRACED 2 /* Report status of stopped children. */ - -/* Bits in the fourth argument to `waitid'. */ -#define WSTOPPED 2 /* Report stopped child (same as WUNTRACED). */ -#define WEXITED 4 /* Report dead child. */ -#define WCONTINUED 8 /* Report continued child. */ -#define WNOWAIT 0x01000000 /* Don't reap, just poll status. */ - -#define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads - in this group */ -#define __WALL 0x40000000 /* Wait for any child. */ -#define __WCLONE 0x80000000 /* Wait for cloned process. */ - -/* The following values are used by the `waitid' function. */ -#if defined __USE_XOPEN || defined __USE_XOPEN2K8 -# ifndef __ENUM_IDTYPE_T -# define __ENUM_IDTYPE_T 1 - -/* The Linux kernel defines these bare, rather than an enum, - which causes a conflict if the include order is reversed. */ -# undef P_ALL -# undef P_PID -# undef P_PGID - -typedef enum -{ - P_ALL, /* Wait for any child. */ - P_PID, /* Wait for specified process. */ - P_PGID /* Wait for members of process group. */ -} idtype_t; -# endif -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/waitstatus.h b/openflow/usr/include/arm-linux-gnueabihf/bits/waitstatus.h deleted file mode 100644 index 38c33bc..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/waitstatus.h +++ /dev/null @@ -1,105 +0,0 @@ -/* Definitions of status bits for `wait' et al. - Copyright (C) 1992-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _SYS_WAIT_H && !defined _STDLIB_H -# error "Never include directly; use instead." -#endif - - -/* Everything extant so far uses these same bits. */ - - -/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */ -#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8) - -/* If WIFSIGNALED(STATUS), the terminating signal. */ -#define __WTERMSIG(status) ((status) & 0x7f) - -/* If WIFSTOPPED(STATUS), the signal that stopped the child. */ -#define __WSTOPSIG(status) __WEXITSTATUS(status) - -/* Nonzero if STATUS indicates normal termination. */ -#define __WIFEXITED(status) (__WTERMSIG(status) == 0) - -/* Nonzero if STATUS indicates termination by a signal. */ -#define __WIFSIGNALED(status) \ - (((signed char) (((status) & 0x7f) + 1) >> 1) > 0) - -/* Nonzero if STATUS indicates the child is stopped. */ -#define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f) - -/* Nonzero if STATUS indicates the child continued after a stop. We only - define this if provides the WCONTINUED flag bit. */ -#ifdef WCONTINUED -# define __WIFCONTINUED(status) ((status) == __W_CONTINUED) -#endif - -/* Nonzero if STATUS indicates the child dumped core. */ -#define __WCOREDUMP(status) ((status) & __WCOREFLAG) - -/* Macros for constructing status values. */ -#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) -#define __W_STOPCODE(sig) ((sig) << 8 | 0x7f) -#define __W_CONTINUED 0xffff -#define __WCOREFLAG 0x80 - - -#ifdef __USE_MISC - -# include - -union wait - { - int w_status; - struct - { -# if __BYTE_ORDER == __LITTLE_ENDIAN - unsigned int __w_termsig:7; /* Terminating signal. */ - unsigned int __w_coredump:1; /* Set if dumped core. */ - unsigned int __w_retcode:8; /* Return code if exited normally. */ - unsigned int:16; -# endif /* Little endian. */ -# if __BYTE_ORDER == __BIG_ENDIAN - unsigned int:16; - unsigned int __w_retcode:8; - unsigned int __w_coredump:1; - unsigned int __w_termsig:7; -# endif /* Big endian. */ - } __wait_terminated; - struct - { -# if __BYTE_ORDER == __LITTLE_ENDIAN - unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ - unsigned int __w_stopsig:8; /* Stopping signal. */ - unsigned int:16; -# endif /* Little endian. */ -# if __BYTE_ORDER == __BIG_ENDIAN - unsigned int:16; - unsigned int __w_stopsig:8; /* Stopping signal. */ - unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ -# endif /* Big endian. */ - } __wait_stopped; - }; - -# define w_termsig __wait_terminated.__w_termsig -# define w_coredump __wait_terminated.__w_coredump -# define w_retcode __wait_terminated.__w_retcode -# define w_stopsig __wait_stopped.__w_stopsig -# define w_stopval __wait_stopped.__w_stopval - -#endif /* Use misc. */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/wchar-ldbl.h b/openflow/usr/include/arm-linux-gnueabihf/bits/wchar-ldbl.h deleted file mode 100644 index d6c28c5..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/wchar-ldbl.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -mlong-double-64 compatibility mode for functions. - Copyright (C) 2006-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _WCHAR_H -# error "Never include directly; use instead." -#endif - -#if defined __USE_ISOC95 || defined __USE_UNIX98 -__BEGIN_NAMESPACE_C99 -__LDBL_REDIR_DECL (fwprintf); -__LDBL_REDIR_DECL (wprintf); -__LDBL_REDIR_DECL (swprintf); -__LDBL_REDIR_DECL (vfwprintf); -__LDBL_REDIR_DECL (vwprintf); -__LDBL_REDIR_DECL (vswprintf); -# if defined __USE_ISOC99 && !defined __USE_GNU \ - && !defined __REDIRECT \ - && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) -__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf) -__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf) -__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf) -# else -__LDBL_REDIR_DECL (fwscanf); -__LDBL_REDIR_DECL (wscanf); -__LDBL_REDIR_DECL (swscanf); -# endif -__END_NAMESPACE_C99 -#endif - -#ifdef __USE_ISOC99 -__BEGIN_NAMESPACE_C99 -__LDBL_REDIR1_DECL (wcstold, wcstod); -# if !defined __USE_GNU && !defined __REDIRECT \ - && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) -__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf) -__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf) -__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf) -# else -__LDBL_REDIR_DECL (vfwscanf); -__LDBL_REDIR_DECL (vwscanf); -__LDBL_REDIR_DECL (vswscanf); -# endif -__END_NAMESPACE_C99 -#endif - -#ifdef __USE_GNU -__LDBL_REDIR1_DECL (wcstold_l, wcstod_l); -#endif - -#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function -__LDBL_REDIR_DECL (__swprintf_chk) -__LDBL_REDIR_DECL (__vswprintf_chk) -# if __USE_FORTIFY_LEVEL > 1 -__LDBL_REDIR_DECL (__fwprintf_chk) -__LDBL_REDIR_DECL (__wprintf_chk) -__LDBL_REDIR_DECL (__vfwprintf_chk) -__LDBL_REDIR_DECL (__vwprintf_chk) -# endif -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/wchar.h b/openflow/usr/include/arm-linux-gnueabihf/bits/wchar.h deleted file mode 100644 index 54f00d5..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/wchar.h +++ /dev/null @@ -1,49 +0,0 @@ -/* wchar_t type related definitions. - Copyright (C) 2000-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_WCHAR_H -#define _BITS_WCHAR_H 1 - -/* The fallback definitions, for when __WCHAR_MAX__ or __WCHAR_MIN__ - are not defined, give the right value and type as long as both int - and wchar_t are 32-bit types. Adding L'\0' to a constant value - ensures that the type is correct; it is necessary to use (L'\0' + - 0) rather than just L'\0' so that the type in C++ is the promoted - version of wchar_t rather than the distinct wchar_t type itself. - Because wchar_t in preprocessor #if expressions is treated as - intmax_t or uintmax_t, the expression (L'\0' - 1) would have the - wrong value for WCHAR_MAX in such expressions and so cannot be used - to define __WCHAR_MAX in the unsigned case. */ - -#ifdef __WCHAR_MAX__ -# define __WCHAR_MAX __WCHAR_MAX__ -#elif L'\0' - 1 > 0 -# define __WCHAR_MAX (0xffffffffu + L'\0') -#else -# define __WCHAR_MAX (0x7fffffff + L'\0') -#endif - -#ifdef __WCHAR_MIN__ -# define __WCHAR_MIN __WCHAR_MIN__ -#elif L'\0' - 1 > 0 -# define __WCHAR_MIN (L'\0' + 0) -#else -# define __WCHAR_MIN (-__WCHAR_MAX - 1) -#endif - -#endif /* bits/wchar.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/wchar2.h b/openflow/usr/include/arm-linux-gnueabihf/bits/wchar2.h deleted file mode 100644 index ccf8dc9..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/wchar2.h +++ /dev/null @@ -1,593 +0,0 @@ -/* Checking macros for wchar functions. - Copyright (C) 2005-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _WCHAR_H -# error "Never include directly; use instead." -#endif - - -extern wchar_t *__wmemcpy_chk (wchar_t *__restrict __s1, - const wchar_t *__restrict __s2, size_t __n, - size_t __ns1) __THROW; -extern wchar_t *__REDIRECT_NTH (__wmemcpy_alias, - (wchar_t *__restrict __s1, - const wchar_t *__restrict __s2, size_t __n), - wmemcpy); -extern wchar_t *__REDIRECT_NTH (__wmemcpy_chk_warn, - (wchar_t *__restrict __s1, - const wchar_t *__restrict __s2, size_t __n, - size_t __ns1), __wmemcpy_chk) - __warnattr ("wmemcpy called with length bigger than size of destination " - "buffer"); - -__fortify_function wchar_t * -__NTH (wmemcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, - size_t __n)) -{ - if (__bos0 (__s1) != (size_t) -1) - { - if (!__builtin_constant_p (__n)) - return __wmemcpy_chk (__s1, __s2, __n, - __bos0 (__s1) / sizeof (wchar_t)); - - if (__n > __bos0 (__s1) / sizeof (wchar_t)) - return __wmemcpy_chk_warn (__s1, __s2, __n, - __bos0 (__s1) / sizeof (wchar_t)); - } - return __wmemcpy_alias (__s1, __s2, __n); -} - - -extern wchar_t *__wmemmove_chk (wchar_t *__s1, const wchar_t *__s2, - size_t __n, size_t __ns1) __THROW; -extern wchar_t *__REDIRECT_NTH (__wmemmove_alias, (wchar_t *__s1, - const wchar_t *__s2, - size_t __n), wmemmove); -extern wchar_t *__REDIRECT_NTH (__wmemmove_chk_warn, - (wchar_t *__s1, const wchar_t *__s2, - size_t __n, size_t __ns1), __wmemmove_chk) - __warnattr ("wmemmove called with length bigger than size of destination " - "buffer"); - -__fortify_function wchar_t * -__NTH (wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)) -{ - if (__bos0 (__s1) != (size_t) -1) - { - if (!__builtin_constant_p (__n)) - return __wmemmove_chk (__s1, __s2, __n, - __bos0 (__s1) / sizeof (wchar_t)); - - if (__n > __bos0 (__s1) / sizeof (wchar_t)) - return __wmemmove_chk_warn (__s1, __s2, __n, - __bos0 (__s1) / sizeof (wchar_t)); - } - return __wmemmove_alias (__s1, __s2, __n); -} - - -#ifdef __USE_GNU -extern wchar_t *__wmempcpy_chk (wchar_t *__restrict __s1, - const wchar_t *__restrict __s2, size_t __n, - size_t __ns1) __THROW; -extern wchar_t *__REDIRECT_NTH (__wmempcpy_alias, - (wchar_t *__restrict __s1, - const wchar_t *__restrict __s2, - size_t __n), wmempcpy); -extern wchar_t *__REDIRECT_NTH (__wmempcpy_chk_warn, - (wchar_t *__restrict __s1, - const wchar_t *__restrict __s2, size_t __n, - size_t __ns1), __wmempcpy_chk) - __warnattr ("wmempcpy called with length bigger than size of destination " - "buffer"); - -__fortify_function wchar_t * -__NTH (wmempcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, - size_t __n)) -{ - if (__bos0 (__s1) != (size_t) -1) - { - if (!__builtin_constant_p (__n)) - return __wmempcpy_chk (__s1, __s2, __n, - __bos0 (__s1) / sizeof (wchar_t)); - - if (__n > __bos0 (__s1) / sizeof (wchar_t)) - return __wmempcpy_chk_warn (__s1, __s2, __n, - __bos0 (__s1) / sizeof (wchar_t)); - } - return __wmempcpy_alias (__s1, __s2, __n); -} -#endif - - -extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n, - size_t __ns) __THROW; -extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c, - size_t __n), wmemset); -extern wchar_t *__REDIRECT_NTH (__wmemset_chk_warn, - (wchar_t *__s, wchar_t __c, size_t __n, - size_t __ns), __wmemset_chk) - __warnattr ("wmemset called with length bigger than size of destination " - "buffer"); - -__fortify_function wchar_t * -__NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n)) -{ - if (__bos0 (__s) != (size_t) -1) - { - if (!__builtin_constant_p (__n)) - return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t)); - - if (__n > __bos0 (__s) / sizeof (wchar_t)) - return __wmemset_chk_warn (__s, __c, __n, - __bos0 (__s) / sizeof (wchar_t)); - } - return __wmemset_alias (__s, __c, __n); -} - - -extern wchar_t *__wcscpy_chk (wchar_t *__restrict __dest, - const wchar_t *__restrict __src, - size_t __n) __THROW; -extern wchar_t *__REDIRECT_NTH (__wcscpy_alias, - (wchar_t *__restrict __dest, - const wchar_t *__restrict __src), wcscpy); - -__fortify_function wchar_t * -__NTH (wcscpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) -{ - if (__bos (__dest) != (size_t) -1) - return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); - return __wcscpy_alias (__dest, __src); -} - - -extern wchar_t *__wcpcpy_chk (wchar_t *__restrict __dest, - const wchar_t *__restrict __src, - size_t __destlen) __THROW; -extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias, - (wchar_t *__restrict __dest, - const wchar_t *__restrict __src), wcpcpy); - -__fortify_function wchar_t * -__NTH (wcpcpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) -{ - if (__bos (__dest) != (size_t) -1) - return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); - return __wcpcpy_alias (__dest, __src); -} - - -extern wchar_t *__wcsncpy_chk (wchar_t *__restrict __dest, - const wchar_t *__restrict __src, size_t __n, - size_t __destlen) __THROW; -extern wchar_t *__REDIRECT_NTH (__wcsncpy_alias, - (wchar_t *__restrict __dest, - const wchar_t *__restrict __src, - size_t __n), wcsncpy); -extern wchar_t *__REDIRECT_NTH (__wcsncpy_chk_warn, - (wchar_t *__restrict __dest, - const wchar_t *__restrict __src, - size_t __n, size_t __destlen), __wcsncpy_chk) - __warnattr ("wcsncpy called with length bigger than size of destination " - "buffer"); - -__fortify_function wchar_t * -__NTH (wcsncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, - size_t __n)) -{ - if (__bos (__dest) != (size_t) -1) - { - if (!__builtin_constant_p (__n)) - return __wcsncpy_chk (__dest, __src, __n, - __bos (__dest) / sizeof (wchar_t)); - if (__n > __bos (__dest) / sizeof (wchar_t)) - return __wcsncpy_chk_warn (__dest, __src, __n, - __bos (__dest) / sizeof (wchar_t)); - } - return __wcsncpy_alias (__dest, __src, __n); -} - - -extern wchar_t *__wcpncpy_chk (wchar_t *__restrict __dest, - const wchar_t *__restrict __src, size_t __n, - size_t __destlen) __THROW; -extern wchar_t *__REDIRECT_NTH (__wcpncpy_alias, - (wchar_t *__restrict __dest, - const wchar_t *__restrict __src, - size_t __n), wcpncpy); -extern wchar_t *__REDIRECT_NTH (__wcpncpy_chk_warn, - (wchar_t *__restrict __dest, - const wchar_t *__restrict __src, - size_t __n, size_t __destlen), __wcpncpy_chk) - __warnattr ("wcpncpy called with length bigger than size of destination " - "buffer"); - -__fortify_function wchar_t * -__NTH (wcpncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, - size_t __n)) -{ - if (__bos (__dest) != (size_t) -1) - { - if (!__builtin_constant_p (__n)) - return __wcpncpy_chk (__dest, __src, __n, - __bos (__dest) / sizeof (wchar_t)); - if (__n > __bos (__dest) / sizeof (wchar_t)) - return __wcpncpy_chk_warn (__dest, __src, __n, - __bos (__dest) / sizeof (wchar_t)); - } - return __wcpncpy_alias (__dest, __src, __n); -} - - -extern wchar_t *__wcscat_chk (wchar_t *__restrict __dest, - const wchar_t *__restrict __src, - size_t __destlen) __THROW; -extern wchar_t *__REDIRECT_NTH (__wcscat_alias, - (wchar_t *__restrict __dest, - const wchar_t *__restrict __src), wcscat); - -__fortify_function wchar_t * -__NTH (wcscat (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) -{ - if (__bos (__dest) != (size_t) -1) - return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); - return __wcscat_alias (__dest, __src); -} - - -extern wchar_t *__wcsncat_chk (wchar_t *__restrict __dest, - const wchar_t *__restrict __src, - size_t __n, size_t __destlen) __THROW; -extern wchar_t *__REDIRECT_NTH (__wcsncat_alias, - (wchar_t *__restrict __dest, - const wchar_t *__restrict __src, - size_t __n), wcsncat); - -__fortify_function wchar_t * -__NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src, - size_t __n)) -{ - if (__bos (__dest) != (size_t) -1) - return __wcsncat_chk (__dest, __src, __n, - __bos (__dest) / sizeof (wchar_t)); - return __wcsncat_alias (__dest, __src, __n); -} - - -extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n, - int __flag, size_t __s_len, - const wchar_t *__restrict __format, ...) - __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */; - -extern int __REDIRECT_NTH_LDBL (__swprintf_alias, - (wchar_t *__restrict __s, size_t __n, - const wchar_t *__restrict __fmt, ...), - swprintf); - -#ifdef __va_arg_pack -__fortify_function int -__NTH (swprintf (wchar_t *__restrict __s, size_t __n, - const wchar_t *__restrict __fmt, ...)) -{ - if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) - return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, - __bos (__s) / sizeof (wchar_t), - __fmt, __va_arg_pack ()); - return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ()); -} -#elif !defined __cplusplus -/* XXX We might want to have support in gcc for swprintf. */ -# define swprintf(s, n, ...) \ - (__bos (s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1 \ - ? __swprintf_chk (s, n, __USE_FORTIFY_LEVEL - 1, \ - __bos (s) / sizeof (wchar_t), __VA_ARGS__) \ - : swprintf (s, n, __VA_ARGS__)) -#endif - -extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n, - int __flag, size_t __s_len, - const wchar_t *__restrict __format, - __gnuc_va_list __arg) - __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */; - -extern int __REDIRECT_NTH_LDBL (__vswprintf_alias, - (wchar_t *__restrict __s, size_t __n, - const wchar_t *__restrict __fmt, - __gnuc_va_list __ap), vswprintf); - -__fortify_function int -__NTH (vswprintf (wchar_t *__restrict __s, size_t __n, - const wchar_t *__restrict __fmt, __gnuc_va_list __ap)) -{ - if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) - return __vswprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, - __bos (__s) / sizeof (wchar_t), __fmt, __ap); - return __vswprintf_alias (__s, __n, __fmt, __ap); -} - - -#if __USE_FORTIFY_LEVEL > 1 - -extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag, - const wchar_t *__restrict __format, ...); -extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format, - ...); -extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag, - const wchar_t *__restrict __format, - __gnuc_va_list __ap); -extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format, - __gnuc_va_list __ap); - -# ifdef __va_arg_pack -__fortify_function int -wprintf (const wchar_t *__restrict __fmt, ...) -{ - return __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); -} - -__fortify_function int -fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...) -{ - return __fwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, - __va_arg_pack ()); -} -# elif !defined __cplusplus -# define wprintf(...) \ - __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__) -# define fwprintf(stream, ...) \ - __fwprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) -# endif - -__fortify_function int -vwprintf (const wchar_t *__restrict __fmt, __gnuc_va_list __ap) -{ - return __vwprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap); -} - -__fortify_function int -vfwprintf (__FILE *__restrict __stream, - const wchar_t *__restrict __fmt, __gnuc_va_list __ap) -{ - return __vfwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); -} - -#endif - -extern wchar_t *__fgetws_chk (wchar_t *__restrict __s, size_t __size, int __n, - __FILE *__restrict __stream) __wur; -extern wchar_t *__REDIRECT (__fgetws_alias, - (wchar_t *__restrict __s, int __n, - __FILE *__restrict __stream), fgetws) __wur; -extern wchar_t *__REDIRECT (__fgetws_chk_warn, - (wchar_t *__restrict __s, size_t __size, int __n, - __FILE *__restrict __stream), __fgetws_chk) - __wur __warnattr ("fgetws called with bigger size than length " - "of destination buffer"); - -__fortify_function __wur wchar_t * -fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) -{ - if (__bos (__s) != (size_t) -1) - { - if (!__builtin_constant_p (__n) || __n <= 0) - return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t), - __n, __stream); - - if ((size_t) __n > __bos (__s) / sizeof (wchar_t)) - return __fgetws_chk_warn (__s, __bos (__s) / sizeof (wchar_t), - __n, __stream); - } - return __fgetws_alias (__s, __n, __stream); -} - -#ifdef __USE_GNU -extern wchar_t *__fgetws_unlocked_chk (wchar_t *__restrict __s, size_t __size, - int __n, __FILE *__restrict __stream) - __wur; -extern wchar_t *__REDIRECT (__fgetws_unlocked_alias, - (wchar_t *__restrict __s, int __n, - __FILE *__restrict __stream), fgetws_unlocked) - __wur; -extern wchar_t *__REDIRECT (__fgetws_unlocked_chk_warn, - (wchar_t *__restrict __s, size_t __size, int __n, - __FILE *__restrict __stream), - __fgetws_unlocked_chk) - __wur __warnattr ("fgetws_unlocked called with bigger size than length " - "of destination buffer"); - -__fortify_function __wur wchar_t * -fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) -{ - if (__bos (__s) != (size_t) -1) - { - if (!__builtin_constant_p (__n) || __n <= 0) - return __fgetws_unlocked_chk (__s, __bos (__s) / sizeof (wchar_t), - __n, __stream); - - if ((size_t) __n > __bos (__s) / sizeof (wchar_t)) - return __fgetws_unlocked_chk_warn (__s, __bos (__s) / sizeof (wchar_t), - __n, __stream); - } - return __fgetws_unlocked_alias (__s, __n, __stream); -} -#endif - - -extern size_t __wcrtomb_chk (char *__restrict __s, wchar_t __wchar, - mbstate_t *__restrict __p, - size_t __buflen) __THROW __wur; -extern size_t __REDIRECT_NTH (__wcrtomb_alias, - (char *__restrict __s, wchar_t __wchar, - mbstate_t *__restrict __ps), wcrtomb) __wur; - -__fortify_function __wur size_t -__NTH (wcrtomb (char *__restrict __s, wchar_t __wchar, - mbstate_t *__restrict __ps)) -{ - /* We would have to include to get a definition of MB_LEN_MAX. - But this would only disturb the namespace. So we define our own - version here. */ -#define __WCHAR_MB_LEN_MAX 16 -#if defined MB_LEN_MAX && MB_LEN_MAX != __WCHAR_MB_LEN_MAX -# error "Assumed value of MB_LEN_MAX wrong" -#endif - if (__bos (__s) != (size_t) -1 && __WCHAR_MB_LEN_MAX > __bos (__s)) - return __wcrtomb_chk (__s, __wchar, __ps, __bos (__s)); - return __wcrtomb_alias (__s, __wchar, __ps); -} - - -extern size_t __mbsrtowcs_chk (wchar_t *__restrict __dst, - const char **__restrict __src, - size_t __len, mbstate_t *__restrict __ps, - size_t __dstlen) __THROW; -extern size_t __REDIRECT_NTH (__mbsrtowcs_alias, - (wchar_t *__restrict __dst, - const char **__restrict __src, - size_t __len, mbstate_t *__restrict __ps), - mbsrtowcs); -extern size_t __REDIRECT_NTH (__mbsrtowcs_chk_warn, - (wchar_t *__restrict __dst, - const char **__restrict __src, - size_t __len, mbstate_t *__restrict __ps, - size_t __dstlen), __mbsrtowcs_chk) - __warnattr ("mbsrtowcs called with dst buffer smaller than len " - "* sizeof (wchar_t)"); - -__fortify_function size_t -__NTH (mbsrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, - size_t __len, mbstate_t *__restrict __ps)) -{ - if (__bos (__dst) != (size_t) -1) - { - if (!__builtin_constant_p (__len)) - return __mbsrtowcs_chk (__dst, __src, __len, __ps, - __bos (__dst) / sizeof (wchar_t)); - - if (__len > __bos (__dst) / sizeof (wchar_t)) - return __mbsrtowcs_chk_warn (__dst, __src, __len, __ps, - __bos (__dst) / sizeof (wchar_t)); - } - return __mbsrtowcs_alias (__dst, __src, __len, __ps); -} - - -extern size_t __wcsrtombs_chk (char *__restrict __dst, - const wchar_t **__restrict __src, - size_t __len, mbstate_t *__restrict __ps, - size_t __dstlen) __THROW; -extern size_t __REDIRECT_NTH (__wcsrtombs_alias, - (char *__restrict __dst, - const wchar_t **__restrict __src, - size_t __len, mbstate_t *__restrict __ps), - wcsrtombs); -extern size_t __REDIRECT_NTH (__wcsrtombs_chk_warn, - (char *__restrict __dst, - const wchar_t **__restrict __src, - size_t __len, mbstate_t *__restrict __ps, - size_t __dstlen), __wcsrtombs_chk) - __warnattr ("wcsrtombs called with dst buffer smaller than len"); - -__fortify_function size_t -__NTH (wcsrtombs (char *__restrict __dst, const wchar_t **__restrict __src, - size_t __len, mbstate_t *__restrict __ps)) -{ - if (__bos (__dst) != (size_t) -1) - { - if (!__builtin_constant_p (__len)) - return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst)); - - if (__len > __bos (__dst)) - return __wcsrtombs_chk_warn (__dst, __src, __len, __ps, __bos (__dst)); - } - return __wcsrtombs_alias (__dst, __src, __len, __ps); -} - - -#ifdef __USE_GNU -extern size_t __mbsnrtowcs_chk (wchar_t *__restrict __dst, - const char **__restrict __src, size_t __nmc, - size_t __len, mbstate_t *__restrict __ps, - size_t __dstlen) __THROW; -extern size_t __REDIRECT_NTH (__mbsnrtowcs_alias, - (wchar_t *__restrict __dst, - const char **__restrict __src, size_t __nmc, - size_t __len, mbstate_t *__restrict __ps), - mbsnrtowcs); -extern size_t __REDIRECT_NTH (__mbsnrtowcs_chk_warn, - (wchar_t *__restrict __dst, - const char **__restrict __src, size_t __nmc, - size_t __len, mbstate_t *__restrict __ps, - size_t __dstlen), __mbsnrtowcs_chk) - __warnattr ("mbsnrtowcs called with dst buffer smaller than len " - "* sizeof (wchar_t)"); - -__fortify_function size_t -__NTH (mbsnrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, - size_t __nmc, size_t __len, mbstate_t *__restrict __ps)) -{ - if (__bos (__dst) != (size_t) -1) - { - if (!__builtin_constant_p (__len)) - return __mbsnrtowcs_chk (__dst, __src, __nmc, __len, __ps, - __bos (__dst) / sizeof (wchar_t)); - - if (__len > __bos (__dst) / sizeof (wchar_t)) - return __mbsnrtowcs_chk_warn (__dst, __src, __nmc, __len, __ps, - __bos (__dst) / sizeof (wchar_t)); - } - return __mbsnrtowcs_alias (__dst, __src, __nmc, __len, __ps); -} - - -extern size_t __wcsnrtombs_chk (char *__restrict __dst, - const wchar_t **__restrict __src, - size_t __nwc, size_t __len, - mbstate_t *__restrict __ps, size_t __dstlen) - __THROW; -extern size_t __REDIRECT_NTH (__wcsnrtombs_alias, - (char *__restrict __dst, - const wchar_t **__restrict __src, - size_t __nwc, size_t __len, - mbstate_t *__restrict __ps), wcsnrtombs); -extern size_t __REDIRECT_NTH (__wcsnrtombs_chk_warn, - (char *__restrict __dst, - const wchar_t **__restrict __src, - size_t __nwc, size_t __len, - mbstate_t *__restrict __ps, - size_t __dstlen), __wcsnrtombs_chk) - __warnattr ("wcsnrtombs called with dst buffer smaller than len"); - -__fortify_function size_t -__NTH (wcsnrtombs (char *__restrict __dst, const wchar_t **__restrict __src, - size_t __nwc, size_t __len, mbstate_t *__restrict __ps)) -{ - if (__bos (__dst) != (size_t) -1) - { - if (!__builtin_constant_p (__len)) - return __wcsnrtombs_chk (__dst, __src, __nwc, __len, __ps, - __bos (__dst)); - - if (__len > __bos (__dst)) - return __wcsnrtombs_chk_warn (__dst, __src, __nwc, __len, __ps, - __bos (__dst)); - } - return __wcsnrtombs_alias (__dst, __src, __nwc, __len, __ps); -} -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/wordsize.h b/openflow/usr/include/arm-linux-gnueabihf/bits/wordsize.h deleted file mode 100644 index 2aa16bc..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/wordsize.h +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright (C) 1999-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define __WORDSIZE 32 diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/xopen_lim.h b/openflow/usr/include/arm-linux-gnueabihf/bits/xopen_lim.h deleted file mode 100644 index 26b4fba..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/xopen_lim.h +++ /dev/null @@ -1,143 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * Never include this file directly; use instead. - */ - -/* Additional definitions from X/Open Portability Guide, Issue 4, Version 2 - System Interfaces and Headers, 4.16 - - Please note only the values which are not greater than the minimum - stated in the standard document are listed. The `sysconf' functions - should be used to obtain the actual value. */ - -#ifndef _XOPEN_LIM_H -#define _XOPEN_LIM_H 1 - -#define __need_IOV_MAX -#include - -/* We do not provide fixed values for - - ARG_MAX Maximum length of argument to the `exec' function - including environment data. - - ATEXIT_MAX Maximum number of functions that may be registered - with `atexit'. - - CHILD_MAX Maximum number of simultaneous processes per real - user ID. - - OPEN_MAX Maximum number of files that one process can have open - at anyone time. - - PAGESIZE - PAGE_SIZE Size of bytes of a page. - - PASS_MAX Maximum number of significant bytes in a password. - - We only provide a fixed limit for - - IOV_MAX Maximum number of `iovec' structures that one process has - available for use with `readv' or writev'. - - if this is indeed fixed by the underlying system. -*/ - - -/* Maximum number of `iovec' structures that one process has available - for use with `readv' or writev'. */ -#define _XOPEN_IOV_MAX _POSIX_UIO_MAXIOV - - -/* Maximum value of `digit' in calls to the `printf' and `scanf' - functions. We have no limit, so return a reasonable value. */ -#define NL_ARGMAX _POSIX_ARG_MAX - -/* Maximum number of bytes in a `LANG' name. We have no limit. */ -#define NL_LANGMAX _POSIX2_LINE_MAX - -/* Maximum message number. We have no limit. */ -#define NL_MSGMAX INT_MAX - -/* Maximum number of bytes in N-to-1 collation mapping. We have no - limit. */ -#define NL_NMAX INT_MAX - -/* Maximum set number. We have no limit. */ -#define NL_SETMAX INT_MAX - -/* Maximum number of bytes in a message. We have no limit. */ -#define NL_TEXTMAX INT_MAX - -/* Default process priority. */ -#define NZERO 20 - - -/* Number of bits in a word of type `int'. */ -#ifdef INT_MAX -# if INT_MAX == 32767 -# define WORD_BIT 16 -# else -# if INT_MAX == 2147483647 -# define WORD_BIT 32 -# else -/* Safe assumption. */ -# define WORD_BIT 64 -# endif -# endif -#elif defined __INT_MAX__ -# if __INT_MAX__ == 32767 -# define WORD_BIT 16 -# else -# if __INT_MAX__ == 2147483647 -# define WORD_BIT 32 -# else -/* Safe assumption. */ -# define WORD_BIT 64 -# endif -# endif -#else -# define WORD_BIT 32 -#endif - -/* Number of bits in a word of type `long int'. */ -#ifdef LONG_MAX -# if LONG_MAX == 2147483647 -# define LONG_BIT 32 -# else -/* Safe assumption. */ -# define LONG_BIT 64 -# endif -#elif defined __LONG_MAX__ -# if __LONG_MAX__ == 2147483647 -# define LONG_BIT 32 -# else -/* Safe assumption. */ -# define LONG_BIT 64 -# endif -#else -# include -# if __WORDSIZE == 64 -# define LONG_BIT 64 -# else -# define LONG_BIT 32 -# endif -#endif - -#endif /* bits/xopen_lim.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/bits/xtitypes.h b/openflow/usr/include/arm-linux-gnueabihf/bits/xtitypes.h deleted file mode 100644 index d794cf4..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/bits/xtitypes.h +++ /dev/null @@ -1,33 +0,0 @@ -/* bits/xtitypes.h -- Define some types used by . Generic. - Copyright (C) 2002-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _STROPTS_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_XTITYPES_H -#define _BITS_XTITYPES_H 1 - -#include - -/* This type is used by some structs in . */ -typedef __SLONGWORD_TYPE __t_scalar_t; -typedef __ULONGWORD_TYPE __t_uscalar_t; - - -#endif /* bits/xtitypes.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5.3.1 b/openflow/usr/include/arm-linux-gnueabihf/c++/5.3.1 deleted file mode 120000 index 7813681..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5.3.1 +++ /dev/null @@ -1 +0,0 @@ -5 \ No newline at end of file diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/atomic_word.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/atomic_word.h deleted file mode 100644 index 19038bb..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/atomic_word.h +++ /dev/null @@ -1,47 +0,0 @@ -// Low-level type for atomic operations -*- C++ -*- - -// Copyright (C) 2004-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file atomic_word.h - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_ATOMIC_WORD_H -#define _GLIBCXX_ATOMIC_WORD_H 1 - -typedef int _Atomic_word; - -// Define these two macros using the appropriate memory barrier for the target. -// The commented out versions below are the defaults. -// See ia64/atomic_word.h for an alternative approach. - -// This one prevents loads from being hoisted across the barrier; -// in other words, this is a Load-Load acquire barrier. -// This is necessary iff TARGET_RELAXED_ORDERING is defined in tm.h. -// #define _GLIBCXX_READ_MEM_BARRIER __asm __volatile ("":::"memory") - -// This one prevents stores from being sunk across the barrier; in other -// words, a Store-Store release barrier. -// #define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("":::"memory") - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/basic_file.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/basic_file.h deleted file mode 100644 index bdd15c1..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/basic_file.h +++ /dev/null @@ -1,130 +0,0 @@ -// Wrapper of C-language FILE struct -*- C++ -*- - -// Copyright (C) 2000-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -// -// ISO C++ 14882: 27.8 File-based streams -// - -/** @file bits/basic_file.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{ios} - */ - -#ifndef _GLIBCXX_BASIC_FILE_STDIO_H -#define _GLIBCXX_BASIC_FILE_STDIO_H 1 - -#pragma GCC system_header - -#include -#include // for __c_lock and __c_file -#include // for swap -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Generic declaration. - template - class __basic_file; - - // Specialization. - template<> - class __basic_file - { - // Underlying data source/sink. - __c_file* _M_cfile; - - // True iff we opened _M_cfile, and thus must close it ourselves. - bool _M_cfile_created; - - public: - __basic_file(__c_lock* __lock = 0) throw (); - -#if __cplusplus >= 201103L - __basic_file(__basic_file&& __rv, __c_lock* __lock = 0) noexcept - : _M_cfile(__rv._M_cfile), _M_cfile_created(__rv._M_cfile_created) - { - __rv._M_cfile = nullptr; - __rv._M_cfile_created = false; - } - - __basic_file& operator=(const __basic_file&) = delete; - __basic_file& operator=(__basic_file&&) = delete; - - void - swap(__basic_file& __f) noexcept - { - std::swap(_M_cfile, __f._M_cfile); - std::swap(_M_cfile_created, __f._M_cfile_created); - } -#endif - - __basic_file* - open(const char* __name, ios_base::openmode __mode, int __prot = 0664); - - __basic_file* - sys_open(__c_file* __file, ios_base::openmode); - - __basic_file* - sys_open(int __fd, ios_base::openmode __mode) throw (); - - __basic_file* - close(); - - _GLIBCXX_PURE bool - is_open() const throw (); - - _GLIBCXX_PURE int - fd() throw (); - - _GLIBCXX_PURE __c_file* - file() throw (); - - ~__basic_file(); - - streamsize - xsputn(const char* __s, streamsize __n); - - streamsize - xsputn_2(const char* __s1, streamsize __n1, - const char* __s2, streamsize __n2); - - streamsize - xsgetn(char* __s, streamsize __n); - - streamoff - seekoff(streamoff __off, ios_base::seekdir __way) throw (); - - int - sync(); - - streamsize - showmanyc(); - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/c++allocator.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/c++allocator.h deleted file mode 100644 index 4dcd1d4..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/c++allocator.h +++ /dev/null @@ -1,55 +0,0 @@ -// Base to std::allocator -*- C++ -*- - -// Copyright (C) 2004-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/c++allocator.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _GLIBCXX_CXX_ALLOCATOR_H -#define _GLIBCXX_CXX_ALLOCATOR_H 1 - -#include - -#if __cplusplus >= 201103L -namespace std -{ - /** - * @brief An alias to the base class for std::allocator. - * @ingroup allocators - * - * Used to set the std::allocator base class to - * __gnu_cxx::new_allocator. - * - * @tparam _Tp Type of allocated object. - */ - template - using __allocator_base = __gnu_cxx::new_allocator<_Tp>; -} -#else -// Define new_allocator as the base class to std::allocator. -# define __allocator_base __gnu_cxx::new_allocator -#endif - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/c++config.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/c++config.h deleted file mode 100644 index 85f6c8a..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/c++config.h +++ /dev/null @@ -1,1768 +0,0 @@ -// Predefined symbols and macros -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/c++config.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iosfwd} - */ - -#ifndef _GLIBCXX_CXX_CONFIG_H -#define _GLIBCXX_CXX_CONFIG_H 1 - -// The current version of the C++ library in compressed ISO date format. -#define __GLIBCXX__ 20160413 - -// Macros for various attributes. -// _GLIBCXX_PURE -// _GLIBCXX_CONST -// _GLIBCXX_NORETURN -// _GLIBCXX_NOTHROW -// _GLIBCXX_VISIBILITY -#ifndef _GLIBCXX_PURE -# define _GLIBCXX_PURE __attribute__ ((__pure__)) -#endif - -#ifndef _GLIBCXX_CONST -# define _GLIBCXX_CONST __attribute__ ((__const__)) -#endif - -#ifndef _GLIBCXX_NORETURN -# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__)) -#endif - -// See below for C++ -#ifndef _GLIBCXX_NOTHROW -# ifndef __cplusplus -# define _GLIBCXX_NOTHROW __attribute__((__nothrow__)) -# endif -#endif - -// Macros for visibility attributes. -// _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY -// _GLIBCXX_VISIBILITY -# define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 1 - -#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY -# define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V))) -#else -// If this is not supplied by the OS-specific or CPU-specific -// headers included below, it will be defined to an empty default. -# define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V) -#endif - -// Macros for deprecated attributes. -// _GLIBCXX_USE_DEPRECATED -// _GLIBCXX_DEPRECATED -#ifndef _GLIBCXX_USE_DEPRECATED -# define _GLIBCXX_USE_DEPRECATED 1 -#endif - -#if defined(__DEPRECATED) && (__cplusplus >= 201103L) -# define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__)) -#else -# define _GLIBCXX_DEPRECATED -#endif - -// Macros for ABI tag attributes. -#ifndef _GLIBCXX_ABI_TAG_CXX11 -# define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11"))) -#endif - - -#if __cplusplus - -// Macro for constexpr, to support in mixed 03/0x mode. -#ifndef _GLIBCXX_CONSTEXPR -# if __cplusplus >= 201103L -# define _GLIBCXX_CONSTEXPR constexpr -# define _GLIBCXX_USE_CONSTEXPR constexpr -# else -# define _GLIBCXX_CONSTEXPR -# define _GLIBCXX_USE_CONSTEXPR const -# endif -#endif - -#ifndef _GLIBCXX14_CONSTEXPR -# if __cplusplus >= 201402L -# define _GLIBCXX14_CONSTEXPR constexpr -# else -# define _GLIBCXX14_CONSTEXPR -# endif -#endif - -// Macro for noexcept, to support in mixed 03/0x mode. -#ifndef _GLIBCXX_NOEXCEPT -# if __cplusplus >= 201103L -# define _GLIBCXX_NOEXCEPT noexcept -# define _GLIBCXX_USE_NOEXCEPT noexcept -# define _GLIBCXX_THROW(_EXC) -# else -# define _GLIBCXX_NOEXCEPT -# define _GLIBCXX_USE_NOEXCEPT throw() -# define _GLIBCXX_THROW(_EXC) throw(_EXC) -# endif -#endif - -#ifndef _GLIBCXX_NOTHROW -# define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT -#endif - -#ifndef _GLIBCXX_THROW_OR_ABORT -# if __cpp_exceptions -# define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC)) -# else -# define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort()) -# endif -#endif - -// Macro for extern template, ie controling template linkage via use -// of extern keyword on template declaration. As documented in the g++ -// manual, it inhibits all implicit instantiations and is used -// throughout the library to avoid multiple weak definitions for -// required types that are already explicitly instantiated in the -// library binary. This substantially reduces the binary size of -// resulting executables. -// Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern -// templates only in basic_string, thus activating its debug-mode -// checks even at -O0. -# define _GLIBCXX_EXTERN_TEMPLATE 1 - -/* - Outline of libstdc++ namespaces. - - namespace std - { - namespace __debug { } - namespace __parallel { } - namespace __profile { } - namespace __cxx1998 { } - - namespace __detail { } - - namespace rel_ops { } - - namespace tr1 - { - namespace placeholders { } - namespace regex_constants { } - namespace __detail { } - } - - namespace tr2 { } - - namespace decimal { } - - namespace chrono { } - namespace placeholders { } - namespace regex_constants { } - namespace this_thread { } - - namespace experimental { } - } - - namespace abi { } - - namespace __gnu_cxx - { - namespace __detail { } - } - - For full details see: - http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html -*/ -namespace std -{ - typedef __SIZE_TYPE__ size_t; - typedef __PTRDIFF_TYPE__ ptrdiff_t; - -#if __cplusplus >= 201103L - typedef decltype(nullptr) nullptr_t; -#endif -} - -# define _GLIBCXX_USE_DUAL_ABI 1 - -#if ! _GLIBCXX_USE_DUAL_ABI -// Ignore any pre-defined value of _GLIBCXX_USE_CXX11_ABI -# undef _GLIBCXX_USE_CXX11_ABI -#endif - -#ifndef _GLIBCXX_USE_CXX11_ABI -# define _GLIBCXX_USE_CXX11_ABI 1 -#endif - -#if _GLIBCXX_USE_CXX11_ABI -namespace std -{ - inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } -} -namespace __gnu_cxx -{ - inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } -} -# define _GLIBCXX_NAMESPACE_CXX11 __cxx11:: -# define _GLIBCXX_BEGIN_NAMESPACE_CXX11 namespace __cxx11 { -# define _GLIBCXX_END_NAMESPACE_CXX11 } -# define _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_ABI_TAG_CXX11 -#else -# define _GLIBCXX_NAMESPACE_CXX11 -# define _GLIBCXX_BEGIN_NAMESPACE_CXX11 -# define _GLIBCXX_END_NAMESPACE_CXX11 -# define _GLIBCXX_DEFAULT_ABI_TAG -#endif - - -// Defined if inline namespaces are used for versioning. -# define _GLIBCXX_INLINE_VERSION 0 - -// Inline namespace for symbol versioning. -#if _GLIBCXX_INLINE_VERSION - -namespace std -{ - inline namespace __7 { } - - namespace rel_ops { inline namespace __7 { } } - - namespace tr1 - { - inline namespace __7 { } - namespace placeholders { inline namespace __7 { } } - namespace regex_constants { inline namespace __7 { } } - namespace __detail { inline namespace __7 { } } - } - - namespace tr2 - { inline namespace __7 { } } - - namespace decimal { inline namespace __7 { } } - - namespace chrono { inline namespace __7 { } } - namespace placeholders { inline namespace __7 { } } - namespace regex_constants { inline namespace __7 { } } - namespace this_thread { inline namespace __7 { } } - - namespace experimental { inline namespace __7 { } } - - namespace __detail { inline namespace __7 { } } -} - -namespace __gnu_cxx -{ - inline namespace __7 { } - namespace __detail { inline namespace __7 { } } -} -# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __7 { -# define _GLIBCXX_END_NAMESPACE_VERSION } -#else -# define _GLIBCXX_BEGIN_NAMESPACE_VERSION -# define _GLIBCXX_END_NAMESPACE_VERSION -#endif - - -// Inline namespaces for special modes: debug, parallel, profile. -#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \ - || defined(_GLIBCXX_PROFILE) -namespace std -{ - // Non-inline namespace for components replaced by alternates in active mode. - namespace __cxx1998 - { -# if _GLIBCXX_INLINE_VERSION - inline namespace __7 { } -# endif - -# if _GLIBCXX_USE_CXX11_ABI - inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } -# endif - } - - // Inline namespace for debug mode. -# ifdef _GLIBCXX_DEBUG - inline namespace __debug { } -# endif - - // Inline namespaces for parallel mode. -# ifdef _GLIBCXX_PARALLEL - inline namespace __parallel { } -# endif - - // Inline namespaces for profile mode -# ifdef _GLIBCXX_PROFILE - inline namespace __profile { } -# endif -} - -// Check for invalid usage and unsupported mixed-mode use. -# if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL) -# error illegal use of multiple inlined namespaces -# endif -# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_DEBUG) -# error illegal use of multiple inlined namespaces -# endif -# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_PARALLEL) -# error illegal use of multiple inlined namespaces -# endif - -// Check for invalid use due to lack for weak symbols. -# if __NO_INLINE__ && !__GXX_WEAK__ -# warning currently using inlined namespace mode which may fail \ - without inlining due to lack of weak symbols -# endif -#endif - -// Macros for namespace scope. Either namespace std:: or the name -// of some nested namespace within it corresponding to the active mode. -// _GLIBCXX_STD_A -// _GLIBCXX_STD_C -// -// Macros for opening/closing conditional namespaces. -// _GLIBCXX_BEGIN_NAMESPACE_ALGO -// _GLIBCXX_END_NAMESPACE_ALGO -// _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -// _GLIBCXX_END_NAMESPACE_CONTAINER -#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE) -# define _GLIBCXX_STD_C __cxx1998 -# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \ - namespace _GLIBCXX_STD_C { _GLIBCXX_BEGIN_NAMESPACE_VERSION -# define _GLIBCXX_END_NAMESPACE_CONTAINER \ - _GLIBCXX_END_NAMESPACE_VERSION } -# undef _GLIBCXX_EXTERN_TEMPLATE -# define _GLIBCXX_EXTERN_TEMPLATE -1 -#endif - -#ifdef _GLIBCXX_PARALLEL -# define _GLIBCXX_STD_A __cxx1998 -# define _GLIBCXX_BEGIN_NAMESPACE_ALGO \ - namespace _GLIBCXX_STD_A { _GLIBCXX_BEGIN_NAMESPACE_VERSION -# define _GLIBCXX_END_NAMESPACE_ALGO \ - _GLIBCXX_END_NAMESPACE_VERSION } -#endif - -#ifndef _GLIBCXX_STD_A -# define _GLIBCXX_STD_A std -#endif - -#ifndef _GLIBCXX_STD_C -# define _GLIBCXX_STD_C std -#endif - -#ifndef _GLIBCXX_BEGIN_NAMESPACE_ALGO -# define _GLIBCXX_BEGIN_NAMESPACE_ALGO -#endif - -#ifndef _GLIBCXX_END_NAMESPACE_ALGO -# define _GLIBCXX_END_NAMESPACE_ALGO -#endif - -#ifndef _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -#endif - -#ifndef _GLIBCXX_END_NAMESPACE_CONTAINER -# define _GLIBCXX_END_NAMESPACE_CONTAINER -#endif - -// GLIBCXX_ABI Deprecated -// Define if compatibility should be provided for -mlong-double-64. -#undef _GLIBCXX_LONG_DOUBLE_COMPAT - -// Inline namespace for long double 128 mode. -#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ -namespace std -{ - inline namespace __gnu_cxx_ldbl128 { } -} -# define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128:: -# define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 { -# define _GLIBCXX_END_NAMESPACE_LDBL } -#else -# define _GLIBCXX_NAMESPACE_LDBL -# define _GLIBCXX_BEGIN_NAMESPACE_LDBL -# define _GLIBCXX_END_NAMESPACE_LDBL -#endif -#if _GLIBCXX_USE_CXX11_ABI -# define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_CXX11 -# define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_CXX11 -# define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_CXX11 -#else -# define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_LDBL -# define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_LDBL -# define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_LDBL -#endif - -// Assert. -#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL) -# define __glibcxx_assert(_Condition) -#else -namespace std -{ - // Avoid the use of assert, because we're trying to keep the - // include out of the mix. - inline void - __replacement_assert(const char* __file, int __line, - const char* __function, const char* __condition) - { - __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line, - __function, __condition); - __builtin_abort(); - } -} -#define __glibcxx_assert(_Condition) \ - do \ - { \ - if (! (_Condition)) \ - std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ - #_Condition); \ - } while (false) -#endif - -// Macros for race detectors. -// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and -// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain -// atomic (lock-free) synchronization to race detectors: -// the race detector will infer a happens-before arc from the former to the -// latter when they share the same argument pointer. -// -// The most frequent use case for these macros (and the only case in the -// current implementation of the library) is atomic reference counting: -// void _M_remove_reference() -// { -// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); -// if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) -// { -// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount); -// _M_destroy(__a); -// } -// } -// The annotations in this example tell the race detector that all memory -// accesses occurred when the refcount was positive do not race with -// memory accesses which occurred after the refcount became zero. -#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE -# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) -#endif -#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER -# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) -#endif - -// Macros for C linkage: define extern "C" linkage only when using C++. -# define _GLIBCXX_BEGIN_EXTERN_C extern "C" { -# define _GLIBCXX_END_EXTERN_C } - -#else // !__cplusplus -# define _GLIBCXX_BEGIN_EXTERN_C -# define _GLIBCXX_END_EXTERN_C -#endif - - -// First includes. - -// Pick up any OS-specific definitions. -#include - -// Pick up any CPU-specific definitions. -#include - -// If platform uses neither visibility nor psuedo-visibility, -// specify empty default for namespace annotation macros. -#ifndef _GLIBCXX_PSEUDO_VISIBILITY -# define _GLIBCXX_PSEUDO_VISIBILITY(V) -#endif - -// Certain function definitions that are meant to be overridable from -// user code are decorated with this macro. For some targets, this -// macro causes these definitions to be weak. -#ifndef _GLIBCXX_WEAK_DEFINITION -# define _GLIBCXX_WEAK_DEFINITION -#endif - - -// The remainder of the prewritten config is automatic; all the -// user hooks are listed above. - -// Create a boolean flag to be used to determine if --fast-math is set. -#ifdef __FAST_MATH__ -# define _GLIBCXX_FAST_MATH 1 -#else -# define _GLIBCXX_FAST_MATH 0 -#endif - -// This marks string literals in header files to be extracted for eventual -// translation. It is primarily used for messages in thrown exceptions; see -// src/functexcept.cc. We use __N because the more traditional _N is used -// for something else under certain OSes (see BADNAMES). -#define __N(msgid) (msgid) - -// For example, is known to #define min and max as macros... -#undef min -#undef max - -// End of prewritten config; the settings discovered at configure time follow. -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the `acosf' function. */ -#define _GLIBCXX_HAVE_ACOSF 1 - -/* Define to 1 if you have the `acosl' function. */ -#define _GLIBCXX_HAVE_ACOSL 1 - -/* Define to 1 if you have the `asinf' function. */ -#define _GLIBCXX_HAVE_ASINF 1 - -/* Define to 1 if you have the `asinl' function. */ -#define _GLIBCXX_HAVE_ASINL 1 - -/* Define to 1 if the target assembler supports .symver directive. */ -#define _GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE 1 - -/* Define to 1 if you have the `atan2f' function. */ -#define _GLIBCXX_HAVE_ATAN2F 1 - -/* Define to 1 if you have the `atan2l' function. */ -#define _GLIBCXX_HAVE_ATAN2L 1 - -/* Define to 1 if you have the `atanf' function. */ -#define _GLIBCXX_HAVE_ATANF 1 - -/* Define to 1 if you have the `atanl' function. */ -#define _GLIBCXX_HAVE_ATANL 1 - -/* Define to 1 if you have the `at_quick_exit' function. */ -#define _GLIBCXX_HAVE_AT_QUICK_EXIT 1 - -/* Define to 1 if the target assembler supports thread-local storage. */ -/* #undef _GLIBCXX_HAVE_CC_TLS */ - -/* Define to 1 if you have the `ceilf' function. */ -#define _GLIBCXX_HAVE_CEILF 1 - -/* Define to 1 if you have the `ceill' function. */ -#define _GLIBCXX_HAVE_CEILL 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_COMPLEX_H 1 - -/* Define to 1 if you have the `cosf' function. */ -#define _GLIBCXX_HAVE_COSF 1 - -/* Define to 1 if you have the `coshf' function. */ -#define _GLIBCXX_HAVE_COSHF 1 - -/* Define to 1 if you have the `coshl' function. */ -#define _GLIBCXX_HAVE_COSHL 1 - -/* Define to 1 if you have the `cosl' function. */ -#define _GLIBCXX_HAVE_COSL 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_DIRENT_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_DLFCN_H 1 - -/* Define if EBADMSG exists. */ -#define _GLIBCXX_HAVE_EBADMSG 1 - -/* Define if ECANCELED exists. */ -#define _GLIBCXX_HAVE_ECANCELED 1 - -/* Define if ECHILD exists. */ -#define _GLIBCXX_HAVE_ECHILD 1 - -/* Define if EIDRM exists. */ -#define _GLIBCXX_HAVE_EIDRM 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_ENDIAN_H 1 - -/* Define if ENODATA exists. */ -#define _GLIBCXX_HAVE_ENODATA 1 - -/* Define if ENOLINK exists. */ -#define _GLIBCXX_HAVE_ENOLINK 1 - -/* Define if ENOSPC exists. */ -#define _GLIBCXX_HAVE_ENOSPC 1 - -/* Define if ENOSR exists. */ -#define _GLIBCXX_HAVE_ENOSR 1 - -/* Define if ENOSTR exists. */ -#define _GLIBCXX_HAVE_ENOSTR 1 - -/* Define if ENOTRECOVERABLE exists. */ -#define _GLIBCXX_HAVE_ENOTRECOVERABLE 1 - -/* Define if ENOTSUP exists. */ -#define _GLIBCXX_HAVE_ENOTSUP 1 - -/* Define if EOVERFLOW exists. */ -#define _GLIBCXX_HAVE_EOVERFLOW 1 - -/* Define if EOWNERDEAD exists. */ -#define _GLIBCXX_HAVE_EOWNERDEAD 1 - -/* Define if EPERM exists. */ -#define _GLIBCXX_HAVE_EPERM 1 - -/* Define if EPROTO exists. */ -#define _GLIBCXX_HAVE_EPROTO 1 - -/* Define if ETIME exists. */ -#define _GLIBCXX_HAVE_ETIME 1 - -/* Define if ETIMEDOUT exists. */ -#define _GLIBCXX_HAVE_ETIMEDOUT 1 - -/* Define if ETXTBSY exists. */ -#define _GLIBCXX_HAVE_ETXTBSY 1 - -/* Define if EWOULDBLOCK exists. */ -#define _GLIBCXX_HAVE_EWOULDBLOCK 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_EXECINFO_H 1 - -/* Define to 1 if you have the `expf' function. */ -#define _GLIBCXX_HAVE_EXPF 1 - -/* Define to 1 if you have the `expl' function. */ -#define _GLIBCXX_HAVE_EXPL 1 - -/* Define to 1 if you have the `fabsf' function. */ -#define _GLIBCXX_HAVE_FABSF 1 - -/* Define to 1 if you have the `fabsl' function. */ -#define _GLIBCXX_HAVE_FABSL 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_FCNTL_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_FENV_H 1 - -/* Define to 1 if you have the `finite' function. */ -#define _GLIBCXX_HAVE_FINITE 1 - -/* Define to 1 if you have the `finitef' function. */ -#define _GLIBCXX_HAVE_FINITEF 1 - -/* Define to 1 if you have the `finitel' function. */ -#define _GLIBCXX_HAVE_FINITEL 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_FLOAT_H 1 - -/* Define to 1 if you have the `floorf' function. */ -#define _GLIBCXX_HAVE_FLOORF 1 - -/* Define to 1 if you have the `floorl' function. */ -#define _GLIBCXX_HAVE_FLOORL 1 - -/* Define to 1 if you have the `fmodf' function. */ -#define _GLIBCXX_HAVE_FMODF 1 - -/* Define to 1 if you have the `fmodl' function. */ -#define _GLIBCXX_HAVE_FMODL 1 - -/* Define to 1 if you have the `fpclass' function. */ -/* #undef _GLIBCXX_HAVE_FPCLASS */ - -/* Define to 1 if you have the header file. */ -/* #undef _GLIBCXX_HAVE_FP_H */ - -/* Define to 1 if you have the `frexpf' function. */ -#define _GLIBCXX_HAVE_FREXPF 1 - -/* Define to 1 if you have the `frexpl' function. */ -#define _GLIBCXX_HAVE_FREXPL 1 - -/* Define if _Unwind_GetIPInfo is available. */ -#define _GLIBCXX_HAVE_GETIPINFO 1 - -/* Define if gets is available in . */ -#define _GLIBCXX_HAVE_GETS 1 - -/* Define to 1 if you have the `hypot' function. */ -#define _GLIBCXX_HAVE_HYPOT 1 - -/* Define to 1 if you have the `hypotf' function. */ -#define _GLIBCXX_HAVE_HYPOTF 1 - -/* Define to 1 if you have the `hypotl' function. */ -#define _GLIBCXX_HAVE_HYPOTL 1 - -/* Define if you have the iconv() function. */ -#define _GLIBCXX_HAVE_ICONV 1 - -/* Define to 1 if you have the header file. */ -/* #undef _GLIBCXX_HAVE_IEEEFP_H */ - -/* Define if int64_t is available in . */ -#define _GLIBCXX_HAVE_INT64_T 1 - -/* Define if int64_t is a long. */ -/* #undef _GLIBCXX_HAVE_INT64_T_LONG */ - -/* Define if int64_t is a long long. */ -#define _GLIBCXX_HAVE_INT64_T_LONG_LONG 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `isinf' function. */ -/* #undef _GLIBCXX_HAVE_ISINF */ - -/* Define to 1 if you have the `isinff' function. */ -#define _GLIBCXX_HAVE_ISINFF 1 - -/* Define to 1 if you have the `isinfl' function. */ -#define _GLIBCXX_HAVE_ISINFL 1 - -/* Define to 1 if you have the `isnan' function. */ -/* #undef _GLIBCXX_HAVE_ISNAN */ - -/* Define to 1 if you have the `isnanf' function. */ -#define _GLIBCXX_HAVE_ISNANF 1 - -/* Define to 1 if you have the `isnanl' function. */ -#define _GLIBCXX_HAVE_ISNANL 1 - -/* Defined if iswblank exists. */ -#define _GLIBCXX_HAVE_ISWBLANK 1 - -/* Define if LC_MESSAGES is available in . */ -#define _GLIBCXX_HAVE_LC_MESSAGES 1 - -/* Define to 1 if you have the `ldexpf' function. */ -#define _GLIBCXX_HAVE_LDEXPF 1 - -/* Define to 1 if you have the `ldexpl' function. */ -#define _GLIBCXX_HAVE_LDEXPL 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_LIBINTL_H 1 - -/* Only used in build directory testsuite_hooks.h. */ -#define _GLIBCXX_HAVE_LIMIT_AS 1 - -/* Only used in build directory testsuite_hooks.h. */ -#define _GLIBCXX_HAVE_LIMIT_DATA 1 - -/* Only used in build directory testsuite_hooks.h. */ -#define _GLIBCXX_HAVE_LIMIT_FSIZE 1 - -/* Only used in build directory testsuite_hooks.h. */ -#define _GLIBCXX_HAVE_LIMIT_RSS 1 - -/* Only used in build directory testsuite_hooks.h. */ -#define _GLIBCXX_HAVE_LIMIT_VMEM 0 - -/* Define if futex syscall is available. */ -#define _GLIBCXX_HAVE_LINUX_FUTEX 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_LOCALE_H 1 - -/* Define to 1 if you have the `log10f' function. */ -#define _GLIBCXX_HAVE_LOG10F 1 - -/* Define to 1 if you have the `log10l' function. */ -#define _GLIBCXX_HAVE_LOG10L 1 - -/* Define to 1 if you have the `logf' function. */ -#define _GLIBCXX_HAVE_LOGF 1 - -/* Define to 1 if you have the `logl' function. */ -#define _GLIBCXX_HAVE_LOGL 1 - -/* Define to 1 if you have the header file. */ -/* #undef _GLIBCXX_HAVE_MACHINE_ENDIAN_H */ - -/* Define to 1 if you have the header file. */ -/* #undef _GLIBCXX_HAVE_MACHINE_PARAM_H */ - -/* Define if mbstate_t exists in wchar.h. */ -#define _GLIBCXX_HAVE_MBSTATE_T 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `modf' function. */ -#define _GLIBCXX_HAVE_MODF 1 - -/* Define to 1 if you have the `modff' function. */ -#define _GLIBCXX_HAVE_MODFF 1 - -/* Define to 1 if you have the `modfl' function. */ -#define _GLIBCXX_HAVE_MODFL 1 - -/* Define to 1 if you have the header file. */ -/* #undef _GLIBCXX_HAVE_NAN_H */ - -/* Define if poll is available in . */ -#define _GLIBCXX_HAVE_POLL 1 - -/* Define to 1 if you have the `powf' function. */ -#define _GLIBCXX_HAVE_POWF 1 - -/* Define to 1 if you have the `powl' function. */ -#define _GLIBCXX_HAVE_POWL 1 - -/* Define to 1 if you have the `qfpclass' function. */ -/* #undef _GLIBCXX_HAVE_QFPCLASS */ - -/* Define to 1 if you have the `quick_exit' function. */ -#define _GLIBCXX_HAVE_QUICK_EXIT 1 - -/* Define to 1 if you have the `setenv' function. */ -#define _GLIBCXX_HAVE_SETENV 1 - -/* Define to 1 if you have the `sincos' function. */ -#define _GLIBCXX_HAVE_SINCOS 1 - -/* Define to 1 if you have the `sincosf' function. */ -#define _GLIBCXX_HAVE_SINCOSF 1 - -/* Define to 1 if you have the `sincosl' function. */ -#define _GLIBCXX_HAVE_SINCOSL 1 - -/* Define to 1 if you have the `sinf' function. */ -#define _GLIBCXX_HAVE_SINF 1 - -/* Define to 1 if you have the `sinhf' function. */ -#define _GLIBCXX_HAVE_SINHF 1 - -/* Define to 1 if you have the `sinhl' function. */ -#define _GLIBCXX_HAVE_SINHL 1 - -/* Define to 1 if you have the `sinl' function. */ -#define _GLIBCXX_HAVE_SINL 1 - -/* Defined if sleep exists. */ -/* #undef _GLIBCXX_HAVE_SLEEP */ - -/* Define to 1 if you have the `sqrtf' function. */ -#define _GLIBCXX_HAVE_SQRTF 1 - -/* Define to 1 if you have the `sqrtl' function. */ -#define _GLIBCXX_HAVE_SQRTL 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_STDALIGN_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_STDBOOL_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_STDLIB_H 1 - -/* Define if strerror_l is available in . */ -#define _GLIBCXX_HAVE_STRERROR_L 1 - -/* Define if strerror_r is available in . */ -#define _GLIBCXX_HAVE_STRERROR_R 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_STRING_H 1 - -/* Define to 1 if you have the `strtof' function. */ -#define _GLIBCXX_HAVE_STRTOF 1 - -/* Define to 1 if you have the `strtold' function. */ -#define _GLIBCXX_HAVE_STRTOLD 1 - -/* Define to 1 if `d_type' is a member of `struct dirent'. */ -#define _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE 1 - -/* Define if strxfrm_l is available in . */ -#define _GLIBCXX_HAVE_STRXFRM_L 1 - -/* Define to 1 if the target runtime linker supports binding the same symbol - to different versions. */ -#define _GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT 1 - -/* Define to 1 if you have the header file. */ -/* #undef _GLIBCXX_HAVE_SYS_FILIO_H */ - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_SYS_IOCTL_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_SYS_IPC_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */ - -/* Define to 1 if you have the header file. */ -/* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */ - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_SYS_RESOURCE_H 1 - -/* Define to 1 if you have a suitable header file */ -#define _GLIBCXX_HAVE_SYS_SDT_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_SYS_SEM_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_SYS_STATVFS_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_SYS_SYSINFO_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_SYS_UIO_H 1 - -/* Define if S_IFREG is available in . */ -/* #undef _GLIBCXX_HAVE_S_IFREG */ - -/* Define if S_IFREG is available in . */ -#define _GLIBCXX_HAVE_S_ISREG 1 - -/* Define to 1 if you have the `tanf' function. */ -#define _GLIBCXX_HAVE_TANF 1 - -/* Define to 1 if you have the `tanhf' function. */ -#define _GLIBCXX_HAVE_TANHF 1 - -/* Define to 1 if you have the `tanhl' function. */ -#define _GLIBCXX_HAVE_TANHL 1 - -/* Define to 1 if you have the `tanl' function. */ -#define _GLIBCXX_HAVE_TANL 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_TGMATH_H 1 - -/* Define to 1 if the target supports thread-local storage. */ -#define _GLIBCXX_HAVE_TLS 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_UNISTD_H 1 - -/* Defined if usleep exists. */ -/* #undef _GLIBCXX_HAVE_USLEEP */ - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_UTIME_H 1 - -/* Defined if vfwscanf exists. */ -#define _GLIBCXX_HAVE_VFWSCANF 1 - -/* Defined if vswscanf exists. */ -#define _GLIBCXX_HAVE_VSWSCANF 1 - -/* Defined if vwscanf exists. */ -#define _GLIBCXX_HAVE_VWSCANF 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_WCHAR_H 1 - -/* Defined if wcstof exists. */ -#define _GLIBCXX_HAVE_WCSTOF 1 - -/* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_WCTYPE_H 1 - -/* Defined if Sleep exists. */ -/* #undef _GLIBCXX_HAVE_WIN32_SLEEP */ - -/* Define if writev is available in . */ -#define _GLIBCXX_HAVE_WRITEV 1 - -/* Define to 1 if you have the `_acosf' function. */ -/* #undef _GLIBCXX_HAVE__ACOSF */ - -/* Define to 1 if you have the `_acosl' function. */ -/* #undef _GLIBCXX_HAVE__ACOSL */ - -/* Define to 1 if you have the `_asinf' function. */ -/* #undef _GLIBCXX_HAVE__ASINF */ - -/* Define to 1 if you have the `_asinl' function. */ -/* #undef _GLIBCXX_HAVE__ASINL */ - -/* Define to 1 if you have the `_atan2f' function. */ -/* #undef _GLIBCXX_HAVE__ATAN2F */ - -/* Define to 1 if you have the `_atan2l' function. */ -/* #undef _GLIBCXX_HAVE__ATAN2L */ - -/* Define to 1 if you have the `_atanf' function. */ -/* #undef _GLIBCXX_HAVE__ATANF */ - -/* Define to 1 if you have the `_atanl' function. */ -/* #undef _GLIBCXX_HAVE__ATANL */ - -/* Define to 1 if you have the `_ceilf' function. */ -/* #undef _GLIBCXX_HAVE__CEILF */ - -/* Define to 1 if you have the `_ceill' function. */ -/* #undef _GLIBCXX_HAVE__CEILL */ - -/* Define to 1 if you have the `_cosf' function. */ -/* #undef _GLIBCXX_HAVE__COSF */ - -/* Define to 1 if you have the `_coshf' function. */ -/* #undef _GLIBCXX_HAVE__COSHF */ - -/* Define to 1 if you have the `_coshl' function. */ -/* #undef _GLIBCXX_HAVE__COSHL */ - -/* Define to 1 if you have the `_cosl' function. */ -/* #undef _GLIBCXX_HAVE__COSL */ - -/* Define to 1 if you have the `_expf' function. */ -/* #undef _GLIBCXX_HAVE__EXPF */ - -/* Define to 1 if you have the `_expl' function. */ -/* #undef _GLIBCXX_HAVE__EXPL */ - -/* Define to 1 if you have the `_fabsf' function. */ -/* #undef _GLIBCXX_HAVE__FABSF */ - -/* Define to 1 if you have the `_fabsl' function. */ -/* #undef _GLIBCXX_HAVE__FABSL */ - -/* Define to 1 if you have the `_finite' function. */ -/* #undef _GLIBCXX_HAVE__FINITE */ - -/* Define to 1 if you have the `_finitef' function. */ -/* #undef _GLIBCXX_HAVE__FINITEF */ - -/* Define to 1 if you have the `_finitel' function. */ -/* #undef _GLIBCXX_HAVE__FINITEL */ - -/* Define to 1 if you have the `_floorf' function. */ -/* #undef _GLIBCXX_HAVE__FLOORF */ - -/* Define to 1 if you have the `_floorl' function. */ -/* #undef _GLIBCXX_HAVE__FLOORL */ - -/* Define to 1 if you have the `_fmodf' function. */ -/* #undef _GLIBCXX_HAVE__FMODF */ - -/* Define to 1 if you have the `_fmodl' function. */ -/* #undef _GLIBCXX_HAVE__FMODL */ - -/* Define to 1 if you have the `_fpclass' function. */ -/* #undef _GLIBCXX_HAVE__FPCLASS */ - -/* Define to 1 if you have the `_frexpf' function. */ -/* #undef _GLIBCXX_HAVE__FREXPF */ - -/* Define to 1 if you have the `_frexpl' function. */ -/* #undef _GLIBCXX_HAVE__FREXPL */ - -/* Define to 1 if you have the `_hypot' function. */ -/* #undef _GLIBCXX_HAVE__HYPOT */ - -/* Define to 1 if you have the `_hypotf' function. */ -/* #undef _GLIBCXX_HAVE__HYPOTF */ - -/* Define to 1 if you have the `_hypotl' function. */ -/* #undef _GLIBCXX_HAVE__HYPOTL */ - -/* Define to 1 if you have the `_isinf' function. */ -/* #undef _GLIBCXX_HAVE__ISINF */ - -/* Define to 1 if you have the `_isinff' function. */ -/* #undef _GLIBCXX_HAVE__ISINFF */ - -/* Define to 1 if you have the `_isinfl' function. */ -/* #undef _GLIBCXX_HAVE__ISINFL */ - -/* Define to 1 if you have the `_isnan' function. */ -/* #undef _GLIBCXX_HAVE__ISNAN */ - -/* Define to 1 if you have the `_isnanf' function. */ -/* #undef _GLIBCXX_HAVE__ISNANF */ - -/* Define to 1 if you have the `_isnanl' function. */ -/* #undef _GLIBCXX_HAVE__ISNANL */ - -/* Define to 1 if you have the `_ldexpf' function. */ -/* #undef _GLIBCXX_HAVE__LDEXPF */ - -/* Define to 1 if you have the `_ldexpl' function. */ -/* #undef _GLIBCXX_HAVE__LDEXPL */ - -/* Define to 1 if you have the `_log10f' function. */ -/* #undef _GLIBCXX_HAVE__LOG10F */ - -/* Define to 1 if you have the `_log10l' function. */ -/* #undef _GLIBCXX_HAVE__LOG10L */ - -/* Define to 1 if you have the `_logf' function. */ -/* #undef _GLIBCXX_HAVE__LOGF */ - -/* Define to 1 if you have the `_logl' function. */ -/* #undef _GLIBCXX_HAVE__LOGL */ - -/* Define to 1 if you have the `_modf' function. */ -/* #undef _GLIBCXX_HAVE__MODF */ - -/* Define to 1 if you have the `_modff' function. */ -/* #undef _GLIBCXX_HAVE__MODFF */ - -/* Define to 1 if you have the `_modfl' function. */ -/* #undef _GLIBCXX_HAVE__MODFL */ - -/* Define to 1 if you have the `_powf' function. */ -/* #undef _GLIBCXX_HAVE__POWF */ - -/* Define to 1 if you have the `_powl' function. */ -/* #undef _GLIBCXX_HAVE__POWL */ - -/* Define to 1 if you have the `_qfpclass' function. */ -/* #undef _GLIBCXX_HAVE__QFPCLASS */ - -/* Define to 1 if you have the `_sincos' function. */ -/* #undef _GLIBCXX_HAVE__SINCOS */ - -/* Define to 1 if you have the `_sincosf' function. */ -/* #undef _GLIBCXX_HAVE__SINCOSF */ - -/* Define to 1 if you have the `_sincosl' function. */ -/* #undef _GLIBCXX_HAVE__SINCOSL */ - -/* Define to 1 if you have the `_sinf' function. */ -/* #undef _GLIBCXX_HAVE__SINF */ - -/* Define to 1 if you have the `_sinhf' function. */ -/* #undef _GLIBCXX_HAVE__SINHF */ - -/* Define to 1 if you have the `_sinhl' function. */ -/* #undef _GLIBCXX_HAVE__SINHL */ - -/* Define to 1 if you have the `_sinl' function. */ -/* #undef _GLIBCXX_HAVE__SINL */ - -/* Define to 1 if you have the `_sqrtf' function. */ -/* #undef _GLIBCXX_HAVE__SQRTF */ - -/* Define to 1 if you have the `_sqrtl' function. */ -/* #undef _GLIBCXX_HAVE__SQRTL */ - -/* Define to 1 if you have the `_tanf' function. */ -/* #undef _GLIBCXX_HAVE__TANF */ - -/* Define to 1 if you have the `_tanhf' function. */ -/* #undef _GLIBCXX_HAVE__TANHF */ - -/* Define to 1 if you have the `_tanhl' function. */ -/* #undef _GLIBCXX_HAVE__TANHL */ - -/* Define to 1 if you have the `_tanl' function. */ -/* #undef _GLIBCXX_HAVE__TANL */ - -/* Define to 1 if you have the `__cxa_thread_atexit_impl' function. */ -#define _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL 1 - -/* Define as const if the declaration of iconv() needs const. */ -#define _GLIBCXX_ICONV_CONST - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Name of package */ -/* #undef _GLIBCXX_PACKAGE */ - -/* Define to the address where bug reports for this package should be sent. */ -#define _GLIBCXX_PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define _GLIBCXX_PACKAGE_NAME "package-unused" - -/* Define to the full name and version of this package. */ -#define _GLIBCXX_PACKAGE_STRING "package-unused version-unused" - -/* Define to the one symbol short name of this package. */ -#define _GLIBCXX_PACKAGE_TARNAME "libstdc++" - -/* Define to the home page for this package. */ -#define _GLIBCXX_PACKAGE_URL "" - -/* Define to the version of this package. */ -#define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused" - -/* The size of `char', as computed by sizeof. */ -/* #undef SIZEOF_CHAR */ - -/* The size of `int', as computed by sizeof. */ -/* #undef SIZEOF_INT */ - -/* The size of `long', as computed by sizeof. */ -/* #undef SIZEOF_LONG */ - -/* The size of `short', as computed by sizeof. */ -/* #undef SIZEOF_SHORT */ - -/* The size of `void *', as computed by sizeof. */ -/* #undef SIZEOF_VOID_P */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -/* #undef _GLIBCXX_VERSION */ - -/* Define if the compiler supports C++11 atomics. */ -#define _GLIBCXX_ATOMIC_BUILTINS 1 - -/* Define to use concept checking code from the boost libraries. */ -/* #undef _GLIBCXX_CONCEPT_CHECKS */ - -/* Define to 1 if a fully dynamic basic_string is wanted, 0 to disable, - undefined for platform defaults */ -#define _GLIBCXX_FULLY_DYNAMIC_STRING 0 - -/* Define if gthreads library is available. */ -#define _GLIBCXX_HAS_GTHREADS 1 - -/* Define to 1 if a full hosted library is built, or 0 if freestanding. */ -#define _GLIBCXX_HOSTED 1 - -/* Define if compatibility should be provided for -mlong-double-64. */ - -/* Define if ptrdiff_t is int. */ -#define _GLIBCXX_PTRDIFF_T_IS_INT 1 - -/* Define if using setrlimit to set resource limits during "make check" */ -#define _GLIBCXX_RES_LIMITS 1 - -/* Define if size_t is unsigned int. */ -#define _GLIBCXX_SIZE_T_IS_UINT 1 - -/* Define if the compiler is configured for setjmp/longjmp exceptions. */ -/* #undef _GLIBCXX_SJLJ_EXCEPTIONS */ - -/* Define to the value of the EOF integer constant. */ -#define _GLIBCXX_STDIO_EOF -1 - -/* Define to the value of the SEEK_CUR integer constant. */ -#define _GLIBCXX_STDIO_SEEK_CUR 1 - -/* Define to the value of the SEEK_END integer constant. */ -#define _GLIBCXX_STDIO_SEEK_END 2 - -/* Define to use symbol versioning in the shared library. */ -#define _GLIBCXX_SYMVER 1 - -/* Define to use darwin versioning in the shared library. */ -/* #undef _GLIBCXX_SYMVER_DARWIN */ - -/* Define to use GNU versioning in the shared library. */ -#define _GLIBCXX_SYMVER_GNU 1 - -/* Define to use GNU namespace versioning in the shared library. */ -/* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */ - -/* Define to use Sun versioning in the shared library. */ -/* #undef _GLIBCXX_SYMVER_SUN */ - -/* Define if C99 functions or macros from , , , - , and can be used or exposed. */ -#define _GLIBCXX_USE_C99 1 - -/* Define if C99 functions in should be used in . Using - compiler builtins for these functions requires corresponding C99 library - functions to be present. */ -#define _GLIBCXX_USE_C99_COMPLEX 1 - -/* Define if C99 functions in should be used in . - Using compiler builtins for these functions requires corresponding C99 - library functions to be present. */ -#define _GLIBCXX_USE_C99_COMPLEX_TR1 1 - -/* Define if C99 functions in should be imported in in - namespace std::tr1. */ -#define _GLIBCXX_USE_C99_CTYPE_TR1 1 - -/* Define if C99 functions in should be imported in in - namespace std::tr1. */ -#define _GLIBCXX_USE_C99_FENV_TR1 1 - -/* Define if C99 functions in should be imported in - in namespace std::tr1. */ -#define _GLIBCXX_USE_C99_INTTYPES_TR1 1 - -/* Define if wchar_t C99 functions in should be imported in - in namespace std::tr1. */ -#define _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 1 - -/* Define if C99 functions or macros in should be imported in - in namespace std. */ -#define _GLIBCXX_USE_C99_MATH 1 - -/* Define if C99 functions or macros in should be imported in - in namespace std::tr1. */ -#define _GLIBCXX_USE_C99_MATH_TR1 1 - -/* Define if C99 types in should be imported in in - namespace std::tr1. */ -#define _GLIBCXX_USE_C99_STDINT_TR1 1 - -/* Defined if clock_gettime syscall has monotonic and realtime clock support. - */ -/* #undef _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL */ - -/* Defined if clock_gettime has monotonic clock support. */ -#define _GLIBCXX_USE_CLOCK_MONOTONIC 1 - -/* Defined if clock_gettime has realtime clock support. */ -#define _GLIBCXX_USE_CLOCK_REALTIME 1 - -/* Define if ISO/IEC TR 24733 decimal floating point types are supported on - this host. */ -/* #undef _GLIBCXX_USE_DECIMAL_FLOAT */ - -/* Define if fchmod is available in . */ -#define _GLIBCXX_USE_FCHMOD 1 - -/* Define if fchmodat is available in . */ -#define _GLIBCXX_USE_FCHMODAT 1 - -/* Define if __float128 is supported on this host. */ -/* #undef _GLIBCXX_USE_FLOAT128 */ - -/* Defined if gettimeofday is available. */ -#define _GLIBCXX_USE_GETTIMEOFDAY 1 - -/* Define if get_nprocs is available in . */ -#define _GLIBCXX_USE_GET_NPROCS 1 - -/* Define if __int128 is supported on this host. */ -/* #undef _GLIBCXX_USE_INT128 */ - -/* Define if LFS support is available. */ -#define _GLIBCXX_USE_LFS 1 - -/* Define if code specialized for long long should be used. */ -#define _GLIBCXX_USE_LONG_LONG 1 - -/* Defined if nanosleep is available. */ -#define _GLIBCXX_USE_NANOSLEEP 1 - -/* Define if NLS translations are to be used. */ -#define _GLIBCXX_USE_NLS 1 - -/* Define if pthreads_num_processors_np is available in . */ -/* #undef _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP */ - -/* Define if POSIX read/write locks are available in . */ -#define _GLIBCXX_USE_PTHREAD_RWLOCK_T 1 - -/* Define if /dev/random and /dev/urandom are available for the random_device - of TR1 (Chapter 5.1). */ -#define _GLIBCXX_USE_RANDOM_TR1 1 - -/* Define if usable realpath is available in . */ -#define _GLIBCXX_USE_REALPATH 1 - -/* Defined if sched_yield is available. */ -#define _GLIBCXX_USE_SCHED_YIELD 1 - -/* Define if _SC_NPROCESSORS_ONLN is available in . */ -#define _GLIBCXX_USE_SC_NPROCESSORS_ONLN 1 - -/* Define if _SC_NPROC_ONLN is available in . */ -/* #undef _GLIBCXX_USE_SC_NPROC_ONLN */ - -/* Define if sendfile is available in . */ -/* #undef _GLIBCXX_USE_SENDFILE */ - -/* Define if struct stat has timespec members. */ -#define _GLIBCXX_USE_ST_MTIM 1 - -/* Define if sysctl(), CTL_HW and HW_NCPU are available in . */ -/* #undef _GLIBCXX_USE_SYSCTL_HW_NCPU */ - -/* Define if obsolescent tmpnam is available in . */ -#define _GLIBCXX_USE_TMPNAM 1 - -/* Define if utimensat and UTIME_OMIT are available in and - AT_FDCWD in . */ -#define _GLIBCXX_USE_UTIMENSAT 1 - -/* Define if code specialized for wchar_t should be used. */ -#define _GLIBCXX_USE_WCHAR_T 1 - -/* Define to 1 if a verbose library is built, or 0 otherwise. */ -#define _GLIBCXX_VERBOSE 1 - -/* Defined if as can handle rdrand. */ -/* #undef _GLIBCXX_X86_RDRAND */ - -/* Define to 1 if mutex_timedlock is available. */ -#define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 - -/* Define if all C++11 overloads are available in . */ -#if __cplusplus >= 201103L -/* #undef __CORRECT_ISO_CPP11_MATH_H_PROTO */ -#endif - -#if defined (_GLIBCXX_HAVE__ACOSF) && ! defined (_GLIBCXX_HAVE_ACOSF) -# define _GLIBCXX_HAVE_ACOSF 1 -# define acosf _acosf -#endif - -#if defined (_GLIBCXX_HAVE__ACOSL) && ! defined (_GLIBCXX_HAVE_ACOSL) -# define _GLIBCXX_HAVE_ACOSL 1 -# define acosl _acosl -#endif - -#if defined (_GLIBCXX_HAVE__ASINF) && ! defined (_GLIBCXX_HAVE_ASINF) -# define _GLIBCXX_HAVE_ASINF 1 -# define asinf _asinf -#endif - -#if defined (_GLIBCXX_HAVE__ASINL) && ! defined (_GLIBCXX_HAVE_ASINL) -# define _GLIBCXX_HAVE_ASINL 1 -# define asinl _asinl -#endif - -#if defined (_GLIBCXX_HAVE__ATAN2F) && ! defined (_GLIBCXX_HAVE_ATAN2F) -# define _GLIBCXX_HAVE_ATAN2F 1 -# define atan2f _atan2f -#endif - -#if defined (_GLIBCXX_HAVE__ATAN2L) && ! defined (_GLIBCXX_HAVE_ATAN2L) -# define _GLIBCXX_HAVE_ATAN2L 1 -# define atan2l _atan2l -#endif - -#if defined (_GLIBCXX_HAVE__ATANF) && ! defined (_GLIBCXX_HAVE_ATANF) -# define _GLIBCXX_HAVE_ATANF 1 -# define atanf _atanf -#endif - -#if defined (_GLIBCXX_HAVE__ATANL) && ! defined (_GLIBCXX_HAVE_ATANL) -# define _GLIBCXX_HAVE_ATANL 1 -# define atanl _atanl -#endif - -#if defined (_GLIBCXX_HAVE__CEILF) && ! defined (_GLIBCXX_HAVE_CEILF) -# define _GLIBCXX_HAVE_CEILF 1 -# define ceilf _ceilf -#endif - -#if defined (_GLIBCXX_HAVE__CEILL) && ! defined (_GLIBCXX_HAVE_CEILL) -# define _GLIBCXX_HAVE_CEILL 1 -# define ceill _ceill -#endif - -#if defined (_GLIBCXX_HAVE__COSF) && ! defined (_GLIBCXX_HAVE_COSF) -# define _GLIBCXX_HAVE_COSF 1 -# define cosf _cosf -#endif - -#if defined (_GLIBCXX_HAVE__COSHF) && ! defined (_GLIBCXX_HAVE_COSHF) -# define _GLIBCXX_HAVE_COSHF 1 -# define coshf _coshf -#endif - -#if defined (_GLIBCXX_HAVE__COSHL) && ! defined (_GLIBCXX_HAVE_COSHL) -# define _GLIBCXX_HAVE_COSHL 1 -# define coshl _coshl -#endif - -#if defined (_GLIBCXX_HAVE__COSL) && ! defined (_GLIBCXX_HAVE_COSL) -# define _GLIBCXX_HAVE_COSL 1 -# define cosl _cosl -#endif - -#if defined (_GLIBCXX_HAVE__EXPF) && ! defined (_GLIBCXX_HAVE_EXPF) -# define _GLIBCXX_HAVE_EXPF 1 -# define expf _expf -#endif - -#if defined (_GLIBCXX_HAVE__EXPL) && ! defined (_GLIBCXX_HAVE_EXPL) -# define _GLIBCXX_HAVE_EXPL 1 -# define expl _expl -#endif - -#if defined (_GLIBCXX_HAVE__FABSF) && ! defined (_GLIBCXX_HAVE_FABSF) -# define _GLIBCXX_HAVE_FABSF 1 -# define fabsf _fabsf -#endif - -#if defined (_GLIBCXX_HAVE__FABSL) && ! defined (_GLIBCXX_HAVE_FABSL) -# define _GLIBCXX_HAVE_FABSL 1 -# define fabsl _fabsl -#endif - -#if defined (_GLIBCXX_HAVE__FINITE) && ! defined (_GLIBCXX_HAVE_FINITE) -# define _GLIBCXX_HAVE_FINITE 1 -# define finite _finite -#endif - -#if defined (_GLIBCXX_HAVE__FINITEF) && ! defined (_GLIBCXX_HAVE_FINITEF) -# define _GLIBCXX_HAVE_FINITEF 1 -# define finitef _finitef -#endif - -#if defined (_GLIBCXX_HAVE__FINITEL) && ! defined (_GLIBCXX_HAVE_FINITEL) -# define _GLIBCXX_HAVE_FINITEL 1 -# define finitel _finitel -#endif - -#if defined (_GLIBCXX_HAVE__FLOORF) && ! defined (_GLIBCXX_HAVE_FLOORF) -# define _GLIBCXX_HAVE_FLOORF 1 -# define floorf _floorf -#endif - -#if defined (_GLIBCXX_HAVE__FLOORL) && ! defined (_GLIBCXX_HAVE_FLOORL) -# define _GLIBCXX_HAVE_FLOORL 1 -# define floorl _floorl -#endif - -#if defined (_GLIBCXX_HAVE__FMODF) && ! defined (_GLIBCXX_HAVE_FMODF) -# define _GLIBCXX_HAVE_FMODF 1 -# define fmodf _fmodf -#endif - -#if defined (_GLIBCXX_HAVE__FMODL) && ! defined (_GLIBCXX_HAVE_FMODL) -# define _GLIBCXX_HAVE_FMODL 1 -# define fmodl _fmodl -#endif - -#if defined (_GLIBCXX_HAVE__FPCLASS) && ! defined (_GLIBCXX_HAVE_FPCLASS) -# define _GLIBCXX_HAVE_FPCLASS 1 -# define fpclass _fpclass -#endif - -#if defined (_GLIBCXX_HAVE__FREXPF) && ! defined (_GLIBCXX_HAVE_FREXPF) -# define _GLIBCXX_HAVE_FREXPF 1 -# define frexpf _frexpf -#endif - -#if defined (_GLIBCXX_HAVE__FREXPL) && ! defined (_GLIBCXX_HAVE_FREXPL) -# define _GLIBCXX_HAVE_FREXPL 1 -# define frexpl _frexpl -#endif - -#if defined (_GLIBCXX_HAVE__HYPOT) && ! defined (_GLIBCXX_HAVE_HYPOT) -# define _GLIBCXX_HAVE_HYPOT 1 -# define hypot _hypot -#endif - -#if defined (_GLIBCXX_HAVE__HYPOTF) && ! defined (_GLIBCXX_HAVE_HYPOTF) -# define _GLIBCXX_HAVE_HYPOTF 1 -# define hypotf _hypotf -#endif - -#if defined (_GLIBCXX_HAVE__HYPOTL) && ! defined (_GLIBCXX_HAVE_HYPOTL) -# define _GLIBCXX_HAVE_HYPOTL 1 -# define hypotl _hypotl -#endif - -#if defined (_GLIBCXX_HAVE__ISINF) && ! defined (_GLIBCXX_HAVE_ISINF) -# define _GLIBCXX_HAVE_ISINF 1 -# define isinf _isinf -#endif - -#if defined (_GLIBCXX_HAVE__ISINFF) && ! defined (_GLIBCXX_HAVE_ISINFF) -# define _GLIBCXX_HAVE_ISINFF 1 -# define isinff _isinff -#endif - -#if defined (_GLIBCXX_HAVE__ISINFL) && ! defined (_GLIBCXX_HAVE_ISINFL) -# define _GLIBCXX_HAVE_ISINFL 1 -# define isinfl _isinfl -#endif - -#if defined (_GLIBCXX_HAVE__ISNAN) && ! defined (_GLIBCXX_HAVE_ISNAN) -# define _GLIBCXX_HAVE_ISNAN 1 -# define isnan _isnan -#endif - -#if defined (_GLIBCXX_HAVE__ISNANF) && ! defined (_GLIBCXX_HAVE_ISNANF) -# define _GLIBCXX_HAVE_ISNANF 1 -# define isnanf _isnanf -#endif - -#if defined (_GLIBCXX_HAVE__ISNANL) && ! defined (_GLIBCXX_HAVE_ISNANL) -# define _GLIBCXX_HAVE_ISNANL 1 -# define isnanl _isnanl -#endif - -#if defined (_GLIBCXX_HAVE__LDEXPF) && ! defined (_GLIBCXX_HAVE_LDEXPF) -# define _GLIBCXX_HAVE_LDEXPF 1 -# define ldexpf _ldexpf -#endif - -#if defined (_GLIBCXX_HAVE__LDEXPL) && ! defined (_GLIBCXX_HAVE_LDEXPL) -# define _GLIBCXX_HAVE_LDEXPL 1 -# define ldexpl _ldexpl -#endif - -#if defined (_GLIBCXX_HAVE__LOG10F) && ! defined (_GLIBCXX_HAVE_LOG10F) -# define _GLIBCXX_HAVE_LOG10F 1 -# define log10f _log10f -#endif - -#if defined (_GLIBCXX_HAVE__LOG10L) && ! defined (_GLIBCXX_HAVE_LOG10L) -# define _GLIBCXX_HAVE_LOG10L 1 -# define log10l _log10l -#endif - -#if defined (_GLIBCXX_HAVE__LOGF) && ! defined (_GLIBCXX_HAVE_LOGF) -# define _GLIBCXX_HAVE_LOGF 1 -# define logf _logf -#endif - -#if defined (_GLIBCXX_HAVE__LOGL) && ! defined (_GLIBCXX_HAVE_LOGL) -# define _GLIBCXX_HAVE_LOGL 1 -# define logl _logl -#endif - -#if defined (_GLIBCXX_HAVE__MODF) && ! defined (_GLIBCXX_HAVE_MODF) -# define _GLIBCXX_HAVE_MODF 1 -# define modf _modf -#endif - -#if defined (_GLIBCXX_HAVE__MODFF) && ! defined (_GLIBCXX_HAVE_MODFF) -# define _GLIBCXX_HAVE_MODFF 1 -# define modff _modff -#endif - -#if defined (_GLIBCXX_HAVE__MODFL) && ! defined (_GLIBCXX_HAVE_MODFL) -# define _GLIBCXX_HAVE_MODFL 1 -# define modfl _modfl -#endif - -#if defined (_GLIBCXX_HAVE__POWF) && ! defined (_GLIBCXX_HAVE_POWF) -# define _GLIBCXX_HAVE_POWF 1 -# define powf _powf -#endif - -#if defined (_GLIBCXX_HAVE__POWL) && ! defined (_GLIBCXX_HAVE_POWL) -# define _GLIBCXX_HAVE_POWL 1 -# define powl _powl -#endif - -#if defined (_GLIBCXX_HAVE__QFPCLASS) && ! defined (_GLIBCXX_HAVE_QFPCLASS) -# define _GLIBCXX_HAVE_QFPCLASS 1 -# define qfpclass _qfpclass -#endif - -#if defined (_GLIBCXX_HAVE__SINCOS) && ! defined (_GLIBCXX_HAVE_SINCOS) -# define _GLIBCXX_HAVE_SINCOS 1 -# define sincos _sincos -#endif - -#if defined (_GLIBCXX_HAVE__SINCOSF) && ! defined (_GLIBCXX_HAVE_SINCOSF) -# define _GLIBCXX_HAVE_SINCOSF 1 -# define sincosf _sincosf -#endif - -#if defined (_GLIBCXX_HAVE__SINCOSL) && ! defined (_GLIBCXX_HAVE_SINCOSL) -# define _GLIBCXX_HAVE_SINCOSL 1 -# define sincosl _sincosl -#endif - -#if defined (_GLIBCXX_HAVE__SINF) && ! defined (_GLIBCXX_HAVE_SINF) -# define _GLIBCXX_HAVE_SINF 1 -# define sinf _sinf -#endif - -#if defined (_GLIBCXX_HAVE__SINHF) && ! defined (_GLIBCXX_HAVE_SINHF) -# define _GLIBCXX_HAVE_SINHF 1 -# define sinhf _sinhf -#endif - -#if defined (_GLIBCXX_HAVE__SINHL) && ! defined (_GLIBCXX_HAVE_SINHL) -# define _GLIBCXX_HAVE_SINHL 1 -# define sinhl _sinhl -#endif - -#if defined (_GLIBCXX_HAVE__SINL) && ! defined (_GLIBCXX_HAVE_SINL) -# define _GLIBCXX_HAVE_SINL 1 -# define sinl _sinl -#endif - -#if defined (_GLIBCXX_HAVE__SQRTF) && ! defined (_GLIBCXX_HAVE_SQRTF) -# define _GLIBCXX_HAVE_SQRTF 1 -# define sqrtf _sqrtf -#endif - -#if defined (_GLIBCXX_HAVE__SQRTL) && ! defined (_GLIBCXX_HAVE_SQRTL) -# define _GLIBCXX_HAVE_SQRTL 1 -# define sqrtl _sqrtl -#endif - -#if defined (_GLIBCXX_HAVE__STRTOF) && ! defined (_GLIBCXX_HAVE_STRTOF) -# define _GLIBCXX_HAVE_STRTOF 1 -# define strtof _strtof -#endif - -#if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD) -# define _GLIBCXX_HAVE_STRTOLD 1 -# define strtold _strtold -#endif - -#if defined (_GLIBCXX_HAVE__TANF) && ! defined (_GLIBCXX_HAVE_TANF) -# define _GLIBCXX_HAVE_TANF 1 -# define tanf _tanf -#endif - -#if defined (_GLIBCXX_HAVE__TANHF) && ! defined (_GLIBCXX_HAVE_TANHF) -# define _GLIBCXX_HAVE_TANHF 1 -# define tanhf _tanhf -#endif - -#if defined (_GLIBCXX_HAVE__TANHL) && ! defined (_GLIBCXX_HAVE_TANHL) -# define _GLIBCXX_HAVE_TANHL 1 -# define tanhl _tanhl -#endif - -#if defined (_GLIBCXX_HAVE__TANL) && ! defined (_GLIBCXX_HAVE_TANL) -# define _GLIBCXX_HAVE_TANL 1 -# define tanl _tanl -#endif - -#endif // _GLIBCXX_CXX_CONFIG_H diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/c++io.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/c++io.h deleted file mode 100644 index 8a4b453..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/c++io.h +++ /dev/null @@ -1,50 +0,0 @@ -// Underlying io library details -*- C++ -*- - -// Copyright (C) 2000-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/c++io.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{ios} - */ - -// c_io_stdio.h - Defines for using "C" stdio.h - -#ifndef _GLIBCXX_CXX_IO_H -#define _GLIBCXX_CXX_IO_H 1 - -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - typedef __gthread_mutex_t __c_lock; - - // for basic_file.h - typedef FILE __c_file; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/c++locale.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/c++locale.h deleted file mode 100644 index a1dc3d2..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/c++locale.h +++ /dev/null @@ -1,114 +0,0 @@ -// Wrapper for underlying C-language localization -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/c++locale.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -// -// ISO C++ 14882: 22.8 Standard locale categories. -// - -// Written by Benjamin Kosnik - -#ifndef _GLIBCXX_CXX_LOCALE_H -#define _GLIBCXX_CXX_LOCALE_H 1 - -#pragma GCC system_header - -#include - -#define _GLIBCXX_C_LOCALE_GNU 1 - -#define _GLIBCXX_NUM_CATEGORIES 6 - -#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - extern "C" __typeof(uselocale) __uselocale; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - typedef __locale_t __c_locale; - - // Convert numeric value of type double and long double to string and - // return length of string. If vsnprintf is available use it, otherwise - // fall back to the unsafe vsprintf which, in general, can be dangerous - // and should be avoided. - inline int - __convert_from_v(const __c_locale& __cloc __attribute__ ((__unused__)), - char* __out, - const int __size __attribute__ ((__unused__)), - const char* __fmt, ...) - { -#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) - __c_locale __old = __gnu_cxx::__uselocale(__cloc); -#else - char* __old = std::setlocale(LC_NUMERIC, 0); - char* __sav = 0; - if (__builtin_strcmp(__old, "C")) - { - const size_t __len = __builtin_strlen(__old) + 1; - __sav = new char[__len]; - __builtin_memcpy(__sav, __old, __len); - std::setlocale(LC_NUMERIC, "C"); - } -#endif - - __builtin_va_list __args; - __builtin_va_start(__args, __fmt); - -#ifdef _GLIBCXX_USE_C99 - const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); -#else - const int __ret = __builtin_vsprintf(__out, __fmt, __args); -#endif - - __builtin_va_end(__args); - -#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) - __gnu_cxx::__uselocale(__old); -#else - if (__sav) - { - std::setlocale(LC_NUMERIC, __sav); - delete [] __sav; - } -#endif - return __ret; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/cpu_defines.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/cpu_defines.h deleted file mode 100644 index a7f5f9a..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/cpu_defines.h +++ /dev/null @@ -1,40 +0,0 @@ -// Specific definitions for generic platforms -*- C++ -*- - -// Copyright (C) 2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/cpu_defines.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iosfwd} - */ - -#ifndef _GLIBCXX_CPU_DEFINES -#define _GLIBCXX_CPU_DEFINES 1 - -// Integer divide instructions don't trap on ARM. -#ifdef __ARM_ARCH_EXT_IDIV__ -#define __glibcxx_integral_traps false -#else -#define __glibcxx_integral_traps true -#endif - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/ctype_base.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/ctype_base.h deleted file mode 100644 index fd52b73..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/ctype_base.h +++ /dev/null @@ -1,66 +0,0 @@ -// Locale support -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/ctype_base.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -// -// ISO C++ 14882: 22.1 Locales -// - -// Information as gleaned from /usr/include/ctype.h - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /// @brief Base class for ctype. - struct ctype_base - { - // Non-standard typedefs. - typedef const int* __to_type; - - // NB: Offsets into ctype::_M_table force a particular size - // on the mask type. Because of this, we don't use an enum. - typedef unsigned short mask; - static const mask upper = _ISupper; - static const mask lower = _ISlower; - static const mask alpha = _ISalpha; - static const mask digit = _ISdigit; - static const mask xdigit = _ISxdigit; - static const mask space = _ISspace; - static const mask print = _ISprint; - static const mask graph = _ISalpha | _ISdigit | _ISpunct; - static const mask cntrl = _IScntrl; - static const mask punct = _ISpunct; - static const mask alnum = _ISalpha | _ISdigit; -#if __cplusplus >= 201103L - static const mask blank = _ISblank; -#endif - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/ctype_inline.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/ctype_inline.h deleted file mode 100644 index 5e20f21..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/ctype_inline.h +++ /dev/null @@ -1,76 +0,0 @@ -// Locale support -*- C++ -*- - -// Copyright (C) 2000-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/ctype_inline.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -// -// ISO C++ 14882: 22.1 Locales -// - -// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) -// functions go in ctype.cc - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - bool - ctype:: - is(mask __m, char __c) const - { return _M_table[static_cast(__c)] & __m; } - - const char* - ctype:: - is(const char* __low, const char* __high, mask* __vec) const - { - while (__low < __high) - *__vec++ = _M_table[static_cast(*__low++)]; - return __high; - } - - const char* - ctype:: - scan_is(mask __m, const char* __low, const char* __high) const - { - while (__low < __high - && !(_M_table[static_cast(*__low)] & __m)) - ++__low; - return __low; - } - - const char* - ctype:: - scan_not(mask __m, const char* __low, const char* __high) const - { - while (__low < __high - && (_M_table[static_cast(*__low)] & __m) != 0) - ++__low; - return __low; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/cxxabi_tweaks.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/cxxabi_tweaks.h deleted file mode 100644 index 05fa83d..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/cxxabi_tweaks.h +++ /dev/null @@ -1,82 +0,0 @@ -// Control various target specific ABI tweaks. ARM version. - -// Copyright (C) 2004-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/cxxabi_tweaks.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{cxxabi.h} - */ - -#ifndef _CXXABI_TWEAKS_H -#define _CXXABI_TWEAKS_H 1 - -#ifdef __cplusplus -namespace __cxxabiv1 -{ - extern "C" - { -#endif - -#ifdef __ARM_EABI__ - // The ARM EABI uses the least significant bit of a 32-bit - // guard variable. */ -#define _GLIBCXX_GUARD_TEST(x) ((*(x) & 1) != 0) -#define _GLIBCXX_GUARD_SET(x) *(x) = 1 -#define _GLIBCXX_GUARD_BIT 1 -#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1) -#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1) - typedef int __guard; - - // We also want the element size in array cookies. -#define _GLIBCXX_ELTSIZE_IN_COOKIE 1 - - // __cxa_vec_ctor should return a pointer to the array. - typedef void * __cxa_vec_ctor_return_type; -#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return x - // Constructors and destructors return the "this" pointer. - typedef void * __cxa_cdtor_return_type; - -#else // __ARM_EABI__ - - // The generic ABI uses the first byte of a 64-bit guard variable. -#define _GLIBCXX_GUARD_TEST(x) (*(char *) (x) != 0) -#define _GLIBCXX_GUARD_SET(x) *(char *) (x) = 1 -#define _GLIBCXX_GUARD_BIT __guard_test_bit (0, 1) -#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1) -#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1) - __extension__ typedef int __guard __attribute__((mode (__DI__))); - - // __cxa_vec_ctor has void return type. - typedef void __cxa_vec_ctor_return_type; -#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return - // Constructors and destructors do not return a value. - typedef void __cxa_cdtor_return_type; - -#endif //!__ARM_EABI__ - -#ifdef __cplusplus - } -} // namespace __cxxabiv1 -#endif - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/error_constants.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/error_constants.h deleted file mode 100644 index 74492cf..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/error_constants.h +++ /dev/null @@ -1,178 +0,0 @@ -// Specific definitions for generic platforms -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/error_constants.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{system_error} - */ - -#ifndef _GLIBCXX_ERROR_CONSTANTS -#define _GLIBCXX_ERROR_CONSTANTS 1 - -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - enum class errc - { - address_family_not_supported = EAFNOSUPPORT, - address_in_use = EADDRINUSE, - address_not_available = EADDRNOTAVAIL, - already_connected = EISCONN, - argument_list_too_long = E2BIG, - argument_out_of_domain = EDOM, - bad_address = EFAULT, - bad_file_descriptor = EBADF, - -#ifdef _GLIBCXX_HAVE_EBADMSG - bad_message = EBADMSG, -#endif - - broken_pipe = EPIPE, - connection_aborted = ECONNABORTED, - connection_already_in_progress = EALREADY, - connection_refused = ECONNREFUSED, - connection_reset = ECONNRESET, - cross_device_link = EXDEV, - destination_address_required = EDESTADDRREQ, - device_or_resource_busy = EBUSY, - directory_not_empty = ENOTEMPTY, - executable_format_error = ENOEXEC, - file_exists = EEXIST, - file_too_large = EFBIG, - filename_too_long = ENAMETOOLONG, - function_not_supported = ENOSYS, - host_unreachable = EHOSTUNREACH, - -#ifdef _GLIBCXX_HAVE_EIDRM - identifier_removed = EIDRM, -#endif - - illegal_byte_sequence = EILSEQ, - inappropriate_io_control_operation = ENOTTY, - interrupted = EINTR, - invalid_argument = EINVAL, - invalid_seek = ESPIPE, - io_error = EIO, - is_a_directory = EISDIR, - message_size = EMSGSIZE, - network_down = ENETDOWN, - network_reset = ENETRESET, - network_unreachable = ENETUNREACH, - no_buffer_space = ENOBUFS, - no_child_process = ECHILD, - -#ifdef _GLIBCXX_HAVE_ENOLINK - no_link = ENOLINK, -#endif - - no_lock_available = ENOLCK, - -#ifdef _GLIBCXX_HAVE_ENODATA - no_message_available = ENODATA, -#endif - - no_message = ENOMSG, - no_protocol_option = ENOPROTOOPT, - no_space_on_device = ENOSPC, - -#ifdef _GLIBCXX_HAVE_ENOSR - no_stream_resources = ENOSR, -#endif - - no_such_device_or_address = ENXIO, - no_such_device = ENODEV, - no_such_file_or_directory = ENOENT, - no_such_process = ESRCH, - not_a_directory = ENOTDIR, - not_a_socket = ENOTSOCK, - -#ifdef _GLIBCXX_HAVE_ENOSTR - not_a_stream = ENOSTR, -#endif - - not_connected = ENOTCONN, - not_enough_memory = ENOMEM, - -#ifdef _GLIBCXX_HAVE_ENOTSUP - not_supported = ENOTSUP, -#endif - -#ifdef _GLIBCXX_HAVE_ECANCELED - operation_canceled = ECANCELED, -#endif - - operation_in_progress = EINPROGRESS, - operation_not_permitted = EPERM, - operation_not_supported = EOPNOTSUPP, - operation_would_block = EWOULDBLOCK, - -#ifdef _GLIBCXX_HAVE_EOWNERDEAD - owner_dead = EOWNERDEAD, -#endif - - permission_denied = EACCES, - -#ifdef _GLIBCXX_HAVE_EPROTO - protocol_error = EPROTO, -#endif - - protocol_not_supported = EPROTONOSUPPORT, - read_only_file_system = EROFS, - resource_deadlock_would_occur = EDEADLK, - resource_unavailable_try_again = EAGAIN, - result_out_of_range = ERANGE, - -#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE - state_not_recoverable = ENOTRECOVERABLE, -#endif - -#ifdef _GLIBCXX_HAVE_ETIME - stream_timeout = ETIME, -#endif - -#ifdef _GLIBCXX_HAVE_ETXTBSY - text_file_busy = ETXTBSY, -#endif - - timed_out = ETIMEDOUT, - too_many_files_open_in_system = ENFILE, - too_many_files_open = EMFILE, - too_many_links = EMLINK, - too_many_symbolic_link_levels = ELOOP, - -#ifdef _GLIBCXX_HAVE_EOVERFLOW - value_too_large = EOVERFLOW, -#endif - - wrong_protocol_type = EPROTOTYPE - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/extc++.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/extc++.h deleted file mode 100644 index de3775b..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/extc++.h +++ /dev/null @@ -1,71 +0,0 @@ -// C++ includes used for precompiling extensions -*- C++ -*- - -// Copyright (C) 2006-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file extc++.h - * This is an implementation file for a precompiled header. - */ - -#if __cplusplus < 201103L -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _GLIBCXX_HAVE_ICONV - #include - #include -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/gthr-default.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/gthr-default.h deleted file mode 100644 index 839915a..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/gthr-default.h +++ /dev/null @@ -1,889 +0,0 @@ -/* Threads compatibility routines for libgcc2 and libobjc. */ -/* Compile this one with gcc. */ -/* Copyright (C) 1997-2015 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 3, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -. */ - -#ifndef _GLIBCXX_GCC_GTHR_POSIX_H -#define _GLIBCXX_GCC_GTHR_POSIX_H - -/* POSIX threads specific definitions. - Easy, since the interface is just one-to-one mapping. */ - -#define __GTHREADS 1 -#define __GTHREADS_CXX0X 1 - -#include - -#if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \ - || !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK)) -# include -# if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0 -# define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 -# else -# define _GTHREAD_USE_MUTEX_TIMEDLOCK 0 -# endif -#endif - -typedef pthread_t __gthread_t; -typedef pthread_key_t __gthread_key_t; -typedef pthread_once_t __gthread_once_t; -typedef pthread_mutex_t __gthread_mutex_t; -typedef pthread_mutex_t __gthread_recursive_mutex_t; -typedef pthread_cond_t __gthread_cond_t; -typedef struct timespec __gthread_time_t; - -/* POSIX like conditional variables are supported. Please look at comments - in gthr.h for details. */ -#define __GTHREAD_HAS_COND 1 - -#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER -#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function -#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT -#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER) -#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER -#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) -#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP -#else -#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function -#endif -#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER -#define __GTHREAD_TIME_INIT {0,0} - -#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC -# undef __GTHREAD_MUTEX_INIT -#endif -#ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC -# undef __GTHREAD_RECURSIVE_MUTEX_INIT -# undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION -# define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function -#endif -#ifdef _GTHREAD_USE_COND_INIT_FUNC -# undef __GTHREAD_COND_INIT -# define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function -#endif - -#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK -# ifndef __gthrw_pragma -# define __gthrw_pragma(pragma) -# endif -# define __gthrw2(name,name2,type) \ - static __typeof(type) name __attribute__ ((__weakref__(#name2))); \ - __gthrw_pragma(weak type) -# define __gthrw_(name) __gthrw_ ## name -#else -# define __gthrw2(name,name2,type) -# define __gthrw_(name) name -#endif - -/* Typically, __gthrw_foo is a weak reference to symbol foo. */ -#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name) - -__gthrw(pthread_once) -__gthrw(pthread_getspecific) -__gthrw(pthread_setspecific) - -__gthrw(pthread_create) -__gthrw(pthread_join) -__gthrw(pthread_equal) -__gthrw(pthread_self) -__gthrw(pthread_detach) -#ifndef __BIONIC__ -__gthrw(pthread_cancel) -#endif -__gthrw(sched_yield) - -__gthrw(pthread_mutex_lock) -__gthrw(pthread_mutex_trylock) -#if _GTHREAD_USE_MUTEX_TIMEDLOCK -__gthrw(pthread_mutex_timedlock) -#endif -__gthrw(pthread_mutex_unlock) -__gthrw(pthread_mutex_init) -__gthrw(pthread_mutex_destroy) - -__gthrw(pthread_cond_init) -__gthrw(pthread_cond_broadcast) -__gthrw(pthread_cond_signal) -__gthrw(pthread_cond_wait) -__gthrw(pthread_cond_timedwait) -__gthrw(pthread_cond_destroy) - -__gthrw(pthread_key_create) -__gthrw(pthread_key_delete) -__gthrw(pthread_mutexattr_init) -__gthrw(pthread_mutexattr_settype) -__gthrw(pthread_mutexattr_destroy) - - -#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK) -/* Objective-C. */ -__gthrw(pthread_exit) -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING -__gthrw(sched_get_priority_max) -__gthrw(sched_get_priority_min) -#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ -#endif /* _POSIX_PRIORITY_SCHEDULING */ -__gthrw(pthread_attr_destroy) -__gthrw(pthread_attr_init) -__gthrw(pthread_attr_setdetachstate) -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING -__gthrw(pthread_getschedparam) -__gthrw(pthread_setschedparam) -#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ -#endif /* _LIBOBJC || _LIBOBJC_WEAK */ - -#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK - -/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if - -pthreads is not specified. The functions are dummies and most return an - error value. However pthread_once returns 0 without invoking the routine - it is passed so we cannot pretend that the interface is active if -pthreads - is not specified. On Solaris 2.5.1, the interface is not exposed at all so - we need to play the usual game with weak symbols. On Solaris 10 and up, a - working interface is always exposed. On FreeBSD 6 and later, libc also - exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up - to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc, - which means the alternate __gthread_active_p below cannot be used there. */ - -#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__)) - -static volatile int __gthread_active = -1; - -static void -__gthread_trigger (void) -{ - __gthread_active = 1; -} - -static inline int -__gthread_active_p (void) -{ - static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER; - static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT; - - /* Avoid reading __gthread_active twice on the main code path. */ - int __gthread_active_latest_value = __gthread_active; - - /* This test is not protected to avoid taking a lock on the main code - path so every update of __gthread_active in a threaded program must - be atomic with regard to the result of the test. */ - if (__builtin_expect (__gthread_active_latest_value < 0, 0)) - { - if (__gthrw_(pthread_once)) - { - /* If this really is a threaded program, then we must ensure that - __gthread_active has been set to 1 before exiting this block. */ - __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex); - __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger); - __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex); - } - - /* Make sure we'll never enter this block again. */ - if (__gthread_active < 0) - __gthread_active = 0; - - __gthread_active_latest_value = __gthread_active; - } - - return __gthread_active_latest_value != 0; -} - -#else /* neither FreeBSD nor Solaris */ - -/* For a program to be multi-threaded the only thing that it certainly must - be using is pthread_create. However, there may be other libraries that - intercept pthread_create with their own definitions to wrap pthreads - functionality for some purpose. In those cases, pthread_create being - defined might not necessarily mean that libpthread is actually linked - in. - - For the GNU C library, we can use a known internal name. This is always - available in the ABI, but no other library would define it. That is - ideal, since any public pthread function might be intercepted just as - pthread_create might be. __pthread_key_create is an "internal" - implementation symbol, but it is part of the public exported ABI. Also, - it's among the symbols that the static libpthread.a always links in - whenever pthread_create is used, so there is no danger of a false - negative result in any statically-linked, multi-threaded program. - - For others, we choose pthread_cancel as a function that seems unlikely - to be redefined by an interceptor library. The bionic (Android) C - library does not provide pthread_cancel, so we do use pthread_create - there (and interceptor libraries lose). */ - -#ifdef __GLIBC__ -__gthrw2(__gthrw_(__pthread_key_create), - __pthread_key_create, - pthread_key_create) -# define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create) -#elif defined (__BIONIC__) -# define GTHR_ACTIVE_PROXY __gthrw_(pthread_create) -#else -# define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel) -#endif - -static inline int -__gthread_active_p (void) -{ - static void *const __gthread_active_ptr - = __extension__ (void *) >HR_ACTIVE_PROXY; - return __gthread_active_ptr != 0; -} - -#endif /* FreeBSD or Solaris */ - -#else /* not __GXX_WEAK__ */ - -/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread - calls in shared flavors of the HP-UX C library. Most of the stubs - have no functionality. The details are described in the "libc cumulative - patch" for each subversion of HP-UX 11. There are two special interfaces - provided for checking whether an application is linked to a shared pthread - library or not. However, these interfaces aren't available in early - libpthread libraries. We also need a test that works for archive - libraries. We can't use pthread_once as some libc versions call the - init function. We also can't use pthread_create or pthread_attr_init - as these create a thread and thereby prevent changing the default stack - size. The function pthread_default_stacksize_np is available in both - the archive and shared versions of libpthread. It can be used to - determine the default pthread stack size. There is a stub in some - shared libc versions which returns a zero size if pthreads are not - active. We provide an equivalent stub to handle cases where libc - doesn't provide one. */ - -#if defined(__hppa__) && defined(__hpux__) - -static volatile int __gthread_active = -1; - -static inline int -__gthread_active_p (void) -{ - /* Avoid reading __gthread_active twice on the main code path. */ - int __gthread_active_latest_value = __gthread_active; - size_t __s; - - if (__builtin_expect (__gthread_active_latest_value < 0, 0)) - { - pthread_default_stacksize_np (0, &__s); - __gthread_active = __s ? 1 : 0; - __gthread_active_latest_value = __gthread_active; - } - - return __gthread_active_latest_value != 0; -} - -#else /* not hppa-hpux */ - -static inline int -__gthread_active_p (void) -{ - return 1; -} - -#endif /* hppa-hpux */ - -#endif /* __GXX_WEAK__ */ - -#ifdef _LIBOBJC - -/* This is the config.h file in libobjc/ */ -#include - -#ifdef HAVE_SCHED_H -# include -#endif - -/* Key structure for maintaining thread specific storage */ -static pthread_key_t _objc_thread_storage; -static pthread_attr_t _objc_thread_attribs; - -/* Thread local storage for a single thread */ -static void *thread_local_storage = NULL; - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -static inline int -__gthread_objc_init_thread_system (void) -{ - if (__gthread_active_p ()) - { - /* Initialize the thread storage key. */ - if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0) - { - /* The normal default detach state for threads is - * PTHREAD_CREATE_JOINABLE which causes threads to not die - * when you think they should. */ - if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0 - && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs, - PTHREAD_CREATE_DETACHED) == 0) - return 0; - } - } - - return -1; -} - -/* Close the threads subsystem. */ -static inline int -__gthread_objc_close_thread_system (void) -{ - if (__gthread_active_p () - && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0 - && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0) - return 0; - - return -1; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -static inline objc_thread_t -__gthread_objc_thread_detach (void (*func)(void *), void *arg) -{ - objc_thread_t thread_id; - pthread_t new_thread_handle; - - if (!__gthread_active_p ()) - return NULL; - - if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs, - (void *) func, arg))) - thread_id = (objc_thread_t) new_thread_handle; - else - thread_id = NULL; - - return thread_id; -} - -/* Set the current thread's priority. */ -static inline int -__gthread_objc_thread_set_priority (int priority) -{ - if (!__gthread_active_p ()) - return -1; - else - { -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING - pthread_t thread_id = __gthrw_(pthread_self) (); - int policy; - struct sched_param params; - int priority_min, priority_max; - - if (__gthrw_(pthread_getschedparam) (thread_id, &policy, ¶ms) == 0) - { - if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1) - return -1; - - if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1) - return -1; - - if (priority > priority_max) - priority = priority_max; - else if (priority < priority_min) - priority = priority_min; - params.sched_priority = priority; - - /* - * The solaris 7 and several other man pages incorrectly state that - * this should be a pointer to policy but pthread.h is universally - * at odds with this. - */ - if (__gthrw_(pthread_setschedparam) (thread_id, policy, ¶ms) == 0) - return 0; - } -#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ -#endif /* _POSIX_PRIORITY_SCHEDULING */ - return -1; - } -} - -/* Return the current thread's priority. */ -static inline int -__gthread_objc_thread_get_priority (void) -{ -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING - if (__gthread_active_p ()) - { - int policy; - struct sched_param params; - - if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, ¶ms) == 0) - return params.sched_priority; - else - return -1; - } - else -#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ -#endif /* _POSIX_PRIORITY_SCHEDULING */ - return OBJC_THREAD_INTERACTIVE_PRIORITY; -} - -/* Yield our process time to another thread. */ -static inline void -__gthread_objc_thread_yield (void) -{ - if (__gthread_active_p ()) - __gthrw_(sched_yield) (); -} - -/* Terminate the current thread. */ -static inline int -__gthread_objc_thread_exit (void) -{ - if (__gthread_active_p ()) - /* exit the thread */ - __gthrw_(pthread_exit) (&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -static inline objc_thread_t -__gthread_objc_thread_id (void) -{ - if (__gthread_active_p ()) - return (objc_thread_t) __gthrw_(pthread_self) (); - else - return (objc_thread_t) 1; -} - -/* Sets the thread's local storage pointer. */ -static inline int -__gthread_objc_thread_set_data (void *value) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_setspecific) (_objc_thread_storage, value); - else - { - thread_local_storage = value; - return 0; - } -} - -/* Returns the thread's local storage pointer. */ -static inline void * -__gthread_objc_thread_get_data (void) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_getspecific) (_objc_thread_storage); - else - return thread_local_storage; -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -static inline int -__gthread_objc_mutex_allocate (objc_mutex_t mutex) -{ - if (__gthread_active_p ()) - { - mutex->backend = objc_malloc (sizeof (pthread_mutex_t)); - - if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL)) - { - objc_free (mutex->backend); - mutex->backend = NULL; - return -1; - } - } - - return 0; -} - -/* Deallocate a mutex. */ -static inline int -__gthread_objc_mutex_deallocate (objc_mutex_t mutex) -{ - if (__gthread_active_p ()) - { - int count; - - /* - * Posix Threads specifically require that the thread be unlocked - * for __gthrw_(pthread_mutex_destroy) to work. - */ - - do - { - count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend); - if (count < 0) - return -1; - } - while (count); - - if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend)) - return -1; - - objc_free (mutex->backend); - mutex->backend = NULL; - } - return 0; -} - -/* Grab a lock on a mutex. */ -static inline int -__gthread_objc_mutex_lock (objc_mutex_t mutex) -{ - if (__gthread_active_p () - && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0) - { - return -1; - } - - return 0; -} - -/* Try to grab a lock on a mutex. */ -static inline int -__gthread_objc_mutex_trylock (objc_mutex_t mutex) -{ - if (__gthread_active_p () - && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0) - { - return -1; - } - - return 0; -} - -/* Unlock the mutex */ -static inline int -__gthread_objc_mutex_unlock (objc_mutex_t mutex) -{ - if (__gthread_active_p () - && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0) - { - return -1; - } - - return 0; -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -static inline int -__gthread_objc_condition_allocate (objc_condition_t condition) -{ - if (__gthread_active_p ()) - { - condition->backend = objc_malloc (sizeof (pthread_cond_t)); - - if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL)) - { - objc_free (condition->backend); - condition->backend = NULL; - return -1; - } - } - - return 0; -} - -/* Deallocate a condition. */ -static inline int -__gthread_objc_condition_deallocate (objc_condition_t condition) -{ - if (__gthread_active_p ()) - { - if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend)) - return -1; - - objc_free (condition->backend); - condition->backend = NULL; - } - return 0; -} - -/* Wait on the condition */ -static inline int -__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend, - (pthread_mutex_t *) mutex->backend); - else - return 0; -} - -/* Wake up all threads waiting on this condition. */ -static inline int -__gthread_objc_condition_broadcast (objc_condition_t condition) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend); - else - return 0; -} - -/* Wake up one thread waiting on this condition. */ -static inline int -__gthread_objc_condition_signal (objc_condition_t condition) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend); - else - return 0; -} - -#else /* _LIBOBJC */ - -static inline int -__gthread_create (__gthread_t *__threadid, void *(*__func) (void*), - void *__args) -{ - return __gthrw_(pthread_create) (__threadid, NULL, __func, __args); -} - -static inline int -__gthread_join (__gthread_t __threadid, void **__value_ptr) -{ - return __gthrw_(pthread_join) (__threadid, __value_ptr); -} - -static inline int -__gthread_detach (__gthread_t __threadid) -{ - return __gthrw_(pthread_detach) (__threadid); -} - -static inline int -__gthread_equal (__gthread_t __t1, __gthread_t __t2) -{ - return __gthrw_(pthread_equal) (__t1, __t2); -} - -static inline __gthread_t -__gthread_self (void) -{ - return __gthrw_(pthread_self) (); -} - -static inline int -__gthread_yield (void) -{ - return __gthrw_(sched_yield) (); -} - -static inline int -__gthread_once (__gthread_once_t *__once, void (*__func) (void)) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_once) (__once, __func); - else - return -1; -} - -static inline int -__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *)) -{ - return __gthrw_(pthread_key_create) (__key, __dtor); -} - -static inline int -__gthread_key_delete (__gthread_key_t __key) -{ - return __gthrw_(pthread_key_delete) (__key); -} - -static inline void * -__gthread_getspecific (__gthread_key_t __key) -{ - return __gthrw_(pthread_getspecific) (__key); -} - -static inline int -__gthread_setspecific (__gthread_key_t __key, const void *__ptr) -{ - return __gthrw_(pthread_setspecific) (__key, __ptr); -} - -static inline void -__gthread_mutex_init_function (__gthread_mutex_t *__mutex) -{ - if (__gthread_active_p ()) - __gthrw_(pthread_mutex_init) (__mutex, NULL); -} - -static inline int -__gthread_mutex_destroy (__gthread_mutex_t *__mutex) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_mutex_destroy) (__mutex); - else - return 0; -} - -static inline int -__gthread_mutex_lock (__gthread_mutex_t *__mutex) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_mutex_lock) (__mutex); - else - return 0; -} - -static inline int -__gthread_mutex_trylock (__gthread_mutex_t *__mutex) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_mutex_trylock) (__mutex); - else - return 0; -} - -#if _GTHREAD_USE_MUTEX_TIMEDLOCK -static inline int -__gthread_mutex_timedlock (__gthread_mutex_t *__mutex, - const __gthread_time_t *__abs_timeout) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout); - else - return 0; -} -#endif - -static inline int -__gthread_mutex_unlock (__gthread_mutex_t *__mutex) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_mutex_unlock) (__mutex); - else - return 0; -} - -#if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \ - || defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC) -static inline int -__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex) -{ - if (__gthread_active_p ()) - { - pthread_mutexattr_t __attr; - int __r; - - __r = __gthrw_(pthread_mutexattr_init) (&__attr); - if (!__r) - __r = __gthrw_(pthread_mutexattr_settype) (&__attr, - PTHREAD_MUTEX_RECURSIVE); - if (!__r) - __r = __gthrw_(pthread_mutex_init) (__mutex, &__attr); - if (!__r) - __r = __gthrw_(pthread_mutexattr_destroy) (&__attr); - return __r; - } - return 0; -} -#endif - -static inline int -__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) -{ - return __gthread_mutex_lock (__mutex); -} - -static inline int -__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) -{ - return __gthread_mutex_trylock (__mutex); -} - -#if _GTHREAD_USE_MUTEX_TIMEDLOCK -static inline int -__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex, - const __gthread_time_t *__abs_timeout) -{ - return __gthread_mutex_timedlock (__mutex, __abs_timeout); -} -#endif - -static inline int -__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) -{ - return __gthread_mutex_unlock (__mutex); -} - -static inline int -__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) -{ - return __gthread_mutex_destroy (__mutex); -} - -#ifdef _GTHREAD_USE_COND_INIT_FUNC -static inline void -__gthread_cond_init_function (__gthread_cond_t *__cond) -{ - if (__gthread_active_p ()) - __gthrw_(pthread_cond_init) (__cond, NULL); -} -#endif - -static inline int -__gthread_cond_broadcast (__gthread_cond_t *__cond) -{ - return __gthrw_(pthread_cond_broadcast) (__cond); -} - -static inline int -__gthread_cond_signal (__gthread_cond_t *__cond) -{ - return __gthrw_(pthread_cond_signal) (__cond); -} - -static inline int -__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex) -{ - return __gthrw_(pthread_cond_wait) (__cond, __mutex); -} - -static inline int -__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex, - const __gthread_time_t *__abs_timeout) -{ - return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout); -} - -static inline int -__gthread_cond_wait_recursive (__gthread_cond_t *__cond, - __gthread_recursive_mutex_t *__mutex) -{ - return __gthread_cond_wait (__cond, __mutex); -} - -static inline int -__gthread_cond_destroy (__gthread_cond_t* __cond) -{ - return __gthrw_(pthread_cond_destroy) (__cond); -} - -#endif /* _LIBOBJC */ - -#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/gthr-posix.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/gthr-posix.h deleted file mode 100644 index 839915a..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/gthr-posix.h +++ /dev/null @@ -1,889 +0,0 @@ -/* Threads compatibility routines for libgcc2 and libobjc. */ -/* Compile this one with gcc. */ -/* Copyright (C) 1997-2015 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 3, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -. */ - -#ifndef _GLIBCXX_GCC_GTHR_POSIX_H -#define _GLIBCXX_GCC_GTHR_POSIX_H - -/* POSIX threads specific definitions. - Easy, since the interface is just one-to-one mapping. */ - -#define __GTHREADS 1 -#define __GTHREADS_CXX0X 1 - -#include - -#if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \ - || !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK)) -# include -# if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0 -# define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 -# else -# define _GTHREAD_USE_MUTEX_TIMEDLOCK 0 -# endif -#endif - -typedef pthread_t __gthread_t; -typedef pthread_key_t __gthread_key_t; -typedef pthread_once_t __gthread_once_t; -typedef pthread_mutex_t __gthread_mutex_t; -typedef pthread_mutex_t __gthread_recursive_mutex_t; -typedef pthread_cond_t __gthread_cond_t; -typedef struct timespec __gthread_time_t; - -/* POSIX like conditional variables are supported. Please look at comments - in gthr.h for details. */ -#define __GTHREAD_HAS_COND 1 - -#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER -#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function -#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT -#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER) -#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER -#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) -#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP -#else -#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function -#endif -#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER -#define __GTHREAD_TIME_INIT {0,0} - -#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC -# undef __GTHREAD_MUTEX_INIT -#endif -#ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC -# undef __GTHREAD_RECURSIVE_MUTEX_INIT -# undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION -# define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function -#endif -#ifdef _GTHREAD_USE_COND_INIT_FUNC -# undef __GTHREAD_COND_INIT -# define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function -#endif - -#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK -# ifndef __gthrw_pragma -# define __gthrw_pragma(pragma) -# endif -# define __gthrw2(name,name2,type) \ - static __typeof(type) name __attribute__ ((__weakref__(#name2))); \ - __gthrw_pragma(weak type) -# define __gthrw_(name) __gthrw_ ## name -#else -# define __gthrw2(name,name2,type) -# define __gthrw_(name) name -#endif - -/* Typically, __gthrw_foo is a weak reference to symbol foo. */ -#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name) - -__gthrw(pthread_once) -__gthrw(pthread_getspecific) -__gthrw(pthread_setspecific) - -__gthrw(pthread_create) -__gthrw(pthread_join) -__gthrw(pthread_equal) -__gthrw(pthread_self) -__gthrw(pthread_detach) -#ifndef __BIONIC__ -__gthrw(pthread_cancel) -#endif -__gthrw(sched_yield) - -__gthrw(pthread_mutex_lock) -__gthrw(pthread_mutex_trylock) -#if _GTHREAD_USE_MUTEX_TIMEDLOCK -__gthrw(pthread_mutex_timedlock) -#endif -__gthrw(pthread_mutex_unlock) -__gthrw(pthread_mutex_init) -__gthrw(pthread_mutex_destroy) - -__gthrw(pthread_cond_init) -__gthrw(pthread_cond_broadcast) -__gthrw(pthread_cond_signal) -__gthrw(pthread_cond_wait) -__gthrw(pthread_cond_timedwait) -__gthrw(pthread_cond_destroy) - -__gthrw(pthread_key_create) -__gthrw(pthread_key_delete) -__gthrw(pthread_mutexattr_init) -__gthrw(pthread_mutexattr_settype) -__gthrw(pthread_mutexattr_destroy) - - -#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK) -/* Objective-C. */ -__gthrw(pthread_exit) -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING -__gthrw(sched_get_priority_max) -__gthrw(sched_get_priority_min) -#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ -#endif /* _POSIX_PRIORITY_SCHEDULING */ -__gthrw(pthread_attr_destroy) -__gthrw(pthread_attr_init) -__gthrw(pthread_attr_setdetachstate) -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING -__gthrw(pthread_getschedparam) -__gthrw(pthread_setschedparam) -#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ -#endif /* _LIBOBJC || _LIBOBJC_WEAK */ - -#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK - -/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if - -pthreads is not specified. The functions are dummies and most return an - error value. However pthread_once returns 0 without invoking the routine - it is passed so we cannot pretend that the interface is active if -pthreads - is not specified. On Solaris 2.5.1, the interface is not exposed at all so - we need to play the usual game with weak symbols. On Solaris 10 and up, a - working interface is always exposed. On FreeBSD 6 and later, libc also - exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up - to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc, - which means the alternate __gthread_active_p below cannot be used there. */ - -#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__)) - -static volatile int __gthread_active = -1; - -static void -__gthread_trigger (void) -{ - __gthread_active = 1; -} - -static inline int -__gthread_active_p (void) -{ - static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER; - static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT; - - /* Avoid reading __gthread_active twice on the main code path. */ - int __gthread_active_latest_value = __gthread_active; - - /* This test is not protected to avoid taking a lock on the main code - path so every update of __gthread_active in a threaded program must - be atomic with regard to the result of the test. */ - if (__builtin_expect (__gthread_active_latest_value < 0, 0)) - { - if (__gthrw_(pthread_once)) - { - /* If this really is a threaded program, then we must ensure that - __gthread_active has been set to 1 before exiting this block. */ - __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex); - __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger); - __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex); - } - - /* Make sure we'll never enter this block again. */ - if (__gthread_active < 0) - __gthread_active = 0; - - __gthread_active_latest_value = __gthread_active; - } - - return __gthread_active_latest_value != 0; -} - -#else /* neither FreeBSD nor Solaris */ - -/* For a program to be multi-threaded the only thing that it certainly must - be using is pthread_create. However, there may be other libraries that - intercept pthread_create with their own definitions to wrap pthreads - functionality for some purpose. In those cases, pthread_create being - defined might not necessarily mean that libpthread is actually linked - in. - - For the GNU C library, we can use a known internal name. This is always - available in the ABI, but no other library would define it. That is - ideal, since any public pthread function might be intercepted just as - pthread_create might be. __pthread_key_create is an "internal" - implementation symbol, but it is part of the public exported ABI. Also, - it's among the symbols that the static libpthread.a always links in - whenever pthread_create is used, so there is no danger of a false - negative result in any statically-linked, multi-threaded program. - - For others, we choose pthread_cancel as a function that seems unlikely - to be redefined by an interceptor library. The bionic (Android) C - library does not provide pthread_cancel, so we do use pthread_create - there (and interceptor libraries lose). */ - -#ifdef __GLIBC__ -__gthrw2(__gthrw_(__pthread_key_create), - __pthread_key_create, - pthread_key_create) -# define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create) -#elif defined (__BIONIC__) -# define GTHR_ACTIVE_PROXY __gthrw_(pthread_create) -#else -# define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel) -#endif - -static inline int -__gthread_active_p (void) -{ - static void *const __gthread_active_ptr - = __extension__ (void *) >HR_ACTIVE_PROXY; - return __gthread_active_ptr != 0; -} - -#endif /* FreeBSD or Solaris */ - -#else /* not __GXX_WEAK__ */ - -/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread - calls in shared flavors of the HP-UX C library. Most of the stubs - have no functionality. The details are described in the "libc cumulative - patch" for each subversion of HP-UX 11. There are two special interfaces - provided for checking whether an application is linked to a shared pthread - library or not. However, these interfaces aren't available in early - libpthread libraries. We also need a test that works for archive - libraries. We can't use pthread_once as some libc versions call the - init function. We also can't use pthread_create or pthread_attr_init - as these create a thread and thereby prevent changing the default stack - size. The function pthread_default_stacksize_np is available in both - the archive and shared versions of libpthread. It can be used to - determine the default pthread stack size. There is a stub in some - shared libc versions which returns a zero size if pthreads are not - active. We provide an equivalent stub to handle cases where libc - doesn't provide one. */ - -#if defined(__hppa__) && defined(__hpux__) - -static volatile int __gthread_active = -1; - -static inline int -__gthread_active_p (void) -{ - /* Avoid reading __gthread_active twice on the main code path. */ - int __gthread_active_latest_value = __gthread_active; - size_t __s; - - if (__builtin_expect (__gthread_active_latest_value < 0, 0)) - { - pthread_default_stacksize_np (0, &__s); - __gthread_active = __s ? 1 : 0; - __gthread_active_latest_value = __gthread_active; - } - - return __gthread_active_latest_value != 0; -} - -#else /* not hppa-hpux */ - -static inline int -__gthread_active_p (void) -{ - return 1; -} - -#endif /* hppa-hpux */ - -#endif /* __GXX_WEAK__ */ - -#ifdef _LIBOBJC - -/* This is the config.h file in libobjc/ */ -#include - -#ifdef HAVE_SCHED_H -# include -#endif - -/* Key structure for maintaining thread specific storage */ -static pthread_key_t _objc_thread_storage; -static pthread_attr_t _objc_thread_attribs; - -/* Thread local storage for a single thread */ -static void *thread_local_storage = NULL; - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -static inline int -__gthread_objc_init_thread_system (void) -{ - if (__gthread_active_p ()) - { - /* Initialize the thread storage key. */ - if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0) - { - /* The normal default detach state for threads is - * PTHREAD_CREATE_JOINABLE which causes threads to not die - * when you think they should. */ - if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0 - && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs, - PTHREAD_CREATE_DETACHED) == 0) - return 0; - } - } - - return -1; -} - -/* Close the threads subsystem. */ -static inline int -__gthread_objc_close_thread_system (void) -{ - if (__gthread_active_p () - && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0 - && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0) - return 0; - - return -1; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -static inline objc_thread_t -__gthread_objc_thread_detach (void (*func)(void *), void *arg) -{ - objc_thread_t thread_id; - pthread_t new_thread_handle; - - if (!__gthread_active_p ()) - return NULL; - - if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs, - (void *) func, arg))) - thread_id = (objc_thread_t) new_thread_handle; - else - thread_id = NULL; - - return thread_id; -} - -/* Set the current thread's priority. */ -static inline int -__gthread_objc_thread_set_priority (int priority) -{ - if (!__gthread_active_p ()) - return -1; - else - { -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING - pthread_t thread_id = __gthrw_(pthread_self) (); - int policy; - struct sched_param params; - int priority_min, priority_max; - - if (__gthrw_(pthread_getschedparam) (thread_id, &policy, ¶ms) == 0) - { - if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1) - return -1; - - if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1) - return -1; - - if (priority > priority_max) - priority = priority_max; - else if (priority < priority_min) - priority = priority_min; - params.sched_priority = priority; - - /* - * The solaris 7 and several other man pages incorrectly state that - * this should be a pointer to policy but pthread.h is universally - * at odds with this. - */ - if (__gthrw_(pthread_setschedparam) (thread_id, policy, ¶ms) == 0) - return 0; - } -#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ -#endif /* _POSIX_PRIORITY_SCHEDULING */ - return -1; - } -} - -/* Return the current thread's priority. */ -static inline int -__gthread_objc_thread_get_priority (void) -{ -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING - if (__gthread_active_p ()) - { - int policy; - struct sched_param params; - - if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, ¶ms) == 0) - return params.sched_priority; - else - return -1; - } - else -#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ -#endif /* _POSIX_PRIORITY_SCHEDULING */ - return OBJC_THREAD_INTERACTIVE_PRIORITY; -} - -/* Yield our process time to another thread. */ -static inline void -__gthread_objc_thread_yield (void) -{ - if (__gthread_active_p ()) - __gthrw_(sched_yield) (); -} - -/* Terminate the current thread. */ -static inline int -__gthread_objc_thread_exit (void) -{ - if (__gthread_active_p ()) - /* exit the thread */ - __gthrw_(pthread_exit) (&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -static inline objc_thread_t -__gthread_objc_thread_id (void) -{ - if (__gthread_active_p ()) - return (objc_thread_t) __gthrw_(pthread_self) (); - else - return (objc_thread_t) 1; -} - -/* Sets the thread's local storage pointer. */ -static inline int -__gthread_objc_thread_set_data (void *value) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_setspecific) (_objc_thread_storage, value); - else - { - thread_local_storage = value; - return 0; - } -} - -/* Returns the thread's local storage pointer. */ -static inline void * -__gthread_objc_thread_get_data (void) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_getspecific) (_objc_thread_storage); - else - return thread_local_storage; -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -static inline int -__gthread_objc_mutex_allocate (objc_mutex_t mutex) -{ - if (__gthread_active_p ()) - { - mutex->backend = objc_malloc (sizeof (pthread_mutex_t)); - - if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL)) - { - objc_free (mutex->backend); - mutex->backend = NULL; - return -1; - } - } - - return 0; -} - -/* Deallocate a mutex. */ -static inline int -__gthread_objc_mutex_deallocate (objc_mutex_t mutex) -{ - if (__gthread_active_p ()) - { - int count; - - /* - * Posix Threads specifically require that the thread be unlocked - * for __gthrw_(pthread_mutex_destroy) to work. - */ - - do - { - count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend); - if (count < 0) - return -1; - } - while (count); - - if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend)) - return -1; - - objc_free (mutex->backend); - mutex->backend = NULL; - } - return 0; -} - -/* Grab a lock on a mutex. */ -static inline int -__gthread_objc_mutex_lock (objc_mutex_t mutex) -{ - if (__gthread_active_p () - && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0) - { - return -1; - } - - return 0; -} - -/* Try to grab a lock on a mutex. */ -static inline int -__gthread_objc_mutex_trylock (objc_mutex_t mutex) -{ - if (__gthread_active_p () - && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0) - { - return -1; - } - - return 0; -} - -/* Unlock the mutex */ -static inline int -__gthread_objc_mutex_unlock (objc_mutex_t mutex) -{ - if (__gthread_active_p () - && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0) - { - return -1; - } - - return 0; -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -static inline int -__gthread_objc_condition_allocate (objc_condition_t condition) -{ - if (__gthread_active_p ()) - { - condition->backend = objc_malloc (sizeof (pthread_cond_t)); - - if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL)) - { - objc_free (condition->backend); - condition->backend = NULL; - return -1; - } - } - - return 0; -} - -/* Deallocate a condition. */ -static inline int -__gthread_objc_condition_deallocate (objc_condition_t condition) -{ - if (__gthread_active_p ()) - { - if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend)) - return -1; - - objc_free (condition->backend); - condition->backend = NULL; - } - return 0; -} - -/* Wait on the condition */ -static inline int -__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend, - (pthread_mutex_t *) mutex->backend); - else - return 0; -} - -/* Wake up all threads waiting on this condition. */ -static inline int -__gthread_objc_condition_broadcast (objc_condition_t condition) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend); - else - return 0; -} - -/* Wake up one thread waiting on this condition. */ -static inline int -__gthread_objc_condition_signal (objc_condition_t condition) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend); - else - return 0; -} - -#else /* _LIBOBJC */ - -static inline int -__gthread_create (__gthread_t *__threadid, void *(*__func) (void*), - void *__args) -{ - return __gthrw_(pthread_create) (__threadid, NULL, __func, __args); -} - -static inline int -__gthread_join (__gthread_t __threadid, void **__value_ptr) -{ - return __gthrw_(pthread_join) (__threadid, __value_ptr); -} - -static inline int -__gthread_detach (__gthread_t __threadid) -{ - return __gthrw_(pthread_detach) (__threadid); -} - -static inline int -__gthread_equal (__gthread_t __t1, __gthread_t __t2) -{ - return __gthrw_(pthread_equal) (__t1, __t2); -} - -static inline __gthread_t -__gthread_self (void) -{ - return __gthrw_(pthread_self) (); -} - -static inline int -__gthread_yield (void) -{ - return __gthrw_(sched_yield) (); -} - -static inline int -__gthread_once (__gthread_once_t *__once, void (*__func) (void)) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_once) (__once, __func); - else - return -1; -} - -static inline int -__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *)) -{ - return __gthrw_(pthread_key_create) (__key, __dtor); -} - -static inline int -__gthread_key_delete (__gthread_key_t __key) -{ - return __gthrw_(pthread_key_delete) (__key); -} - -static inline void * -__gthread_getspecific (__gthread_key_t __key) -{ - return __gthrw_(pthread_getspecific) (__key); -} - -static inline int -__gthread_setspecific (__gthread_key_t __key, const void *__ptr) -{ - return __gthrw_(pthread_setspecific) (__key, __ptr); -} - -static inline void -__gthread_mutex_init_function (__gthread_mutex_t *__mutex) -{ - if (__gthread_active_p ()) - __gthrw_(pthread_mutex_init) (__mutex, NULL); -} - -static inline int -__gthread_mutex_destroy (__gthread_mutex_t *__mutex) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_mutex_destroy) (__mutex); - else - return 0; -} - -static inline int -__gthread_mutex_lock (__gthread_mutex_t *__mutex) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_mutex_lock) (__mutex); - else - return 0; -} - -static inline int -__gthread_mutex_trylock (__gthread_mutex_t *__mutex) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_mutex_trylock) (__mutex); - else - return 0; -} - -#if _GTHREAD_USE_MUTEX_TIMEDLOCK -static inline int -__gthread_mutex_timedlock (__gthread_mutex_t *__mutex, - const __gthread_time_t *__abs_timeout) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout); - else - return 0; -} -#endif - -static inline int -__gthread_mutex_unlock (__gthread_mutex_t *__mutex) -{ - if (__gthread_active_p ()) - return __gthrw_(pthread_mutex_unlock) (__mutex); - else - return 0; -} - -#if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \ - || defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC) -static inline int -__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex) -{ - if (__gthread_active_p ()) - { - pthread_mutexattr_t __attr; - int __r; - - __r = __gthrw_(pthread_mutexattr_init) (&__attr); - if (!__r) - __r = __gthrw_(pthread_mutexattr_settype) (&__attr, - PTHREAD_MUTEX_RECURSIVE); - if (!__r) - __r = __gthrw_(pthread_mutex_init) (__mutex, &__attr); - if (!__r) - __r = __gthrw_(pthread_mutexattr_destroy) (&__attr); - return __r; - } - return 0; -} -#endif - -static inline int -__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) -{ - return __gthread_mutex_lock (__mutex); -} - -static inline int -__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) -{ - return __gthread_mutex_trylock (__mutex); -} - -#if _GTHREAD_USE_MUTEX_TIMEDLOCK -static inline int -__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex, - const __gthread_time_t *__abs_timeout) -{ - return __gthread_mutex_timedlock (__mutex, __abs_timeout); -} -#endif - -static inline int -__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) -{ - return __gthread_mutex_unlock (__mutex); -} - -static inline int -__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) -{ - return __gthread_mutex_destroy (__mutex); -} - -#ifdef _GTHREAD_USE_COND_INIT_FUNC -static inline void -__gthread_cond_init_function (__gthread_cond_t *__cond) -{ - if (__gthread_active_p ()) - __gthrw_(pthread_cond_init) (__cond, NULL); -} -#endif - -static inline int -__gthread_cond_broadcast (__gthread_cond_t *__cond) -{ - return __gthrw_(pthread_cond_broadcast) (__cond); -} - -static inline int -__gthread_cond_signal (__gthread_cond_t *__cond) -{ - return __gthrw_(pthread_cond_signal) (__cond); -} - -static inline int -__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex) -{ - return __gthrw_(pthread_cond_wait) (__cond, __mutex); -} - -static inline int -__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex, - const __gthread_time_t *__abs_timeout) -{ - return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout); -} - -static inline int -__gthread_cond_wait_recursive (__gthread_cond_t *__cond, - __gthread_recursive_mutex_t *__mutex) -{ - return __gthread_cond_wait (__cond, __mutex); -} - -static inline int -__gthread_cond_destroy (__gthread_cond_t* __cond) -{ - return __gthrw_(pthread_cond_destroy) (__cond); -} - -#endif /* _LIBOBJC */ - -#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/gthr-single.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/gthr-single.h deleted file mode 100644 index 5961537..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/gthr-single.h +++ /dev/null @@ -1,298 +0,0 @@ -/* Threads compatibility routines for libgcc2 and libobjc. */ -/* Compile this one with gcc. */ -/* Copyright (C) 1997-2015 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 3, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -. */ - -#ifndef _GLIBCXX_GCC_GTHR_SINGLE_H -#define _GLIBCXX_GCC_GTHR_SINGLE_H - -/* Just provide compatibility for mutex handling. */ - -typedef int __gthread_key_t; -typedef int __gthread_once_t; -typedef int __gthread_mutex_t; -typedef int __gthread_recursive_mutex_t; - -#define __GTHREAD_ONCE_INIT 0 -#define __GTHREAD_MUTEX_INIT 0 -#define __GTHREAD_MUTEX_INIT_FUNCTION(mx) -#define __GTHREAD_RECURSIVE_MUTEX_INIT 0 - -#define _GLIBCXX_UNUSED __attribute__((__unused__)) - -#ifdef _LIBOBJC - -/* Thread local storage for a single thread */ -static void *thread_local_storage = NULL; - -/* Backend initialization functions */ - -/* Initialize the threads subsystem. */ -static inline int -__gthread_objc_init_thread_system (void) -{ - /* No thread support available */ - return -1; -} - -/* Close the threads subsystem. */ -static inline int -__gthread_objc_close_thread_system (void) -{ - /* No thread support available */ - return -1; -} - -/* Backend thread functions */ - -/* Create a new thread of execution. */ -static inline objc_thread_t -__gthread_objc_thread_detach (void (* func)(void *), void * arg _GLIBCXX_UNUSED) -{ - /* No thread support available */ - return NULL; -} - -/* Set the current thread's priority. */ -static inline int -__gthread_objc_thread_set_priority (int priority _GLIBCXX_UNUSED) -{ - /* No thread support available */ - return -1; -} - -/* Return the current thread's priority. */ -static inline int -__gthread_objc_thread_get_priority (void) -{ - return OBJC_THREAD_INTERACTIVE_PRIORITY; -} - -/* Yield our process time to another thread. */ -static inline void -__gthread_objc_thread_yield (void) -{ - return; -} - -/* Terminate the current thread. */ -static inline int -__gthread_objc_thread_exit (void) -{ - /* No thread support available */ - /* Should we really exit the program */ - /* exit (&__objc_thread_exit_status); */ - return -1; -} - -/* Returns an integer value which uniquely describes a thread. */ -static inline objc_thread_t -__gthread_objc_thread_id (void) -{ - /* No thread support, use 1. */ - return (objc_thread_t) 1; -} - -/* Sets the thread's local storage pointer. */ -static inline int -__gthread_objc_thread_set_data (void *value) -{ - thread_local_storage = value; - return 0; -} - -/* Returns the thread's local storage pointer. */ -static inline void * -__gthread_objc_thread_get_data (void) -{ - return thread_local_storage; -} - -/* Backend mutex functions */ - -/* Allocate a mutex. */ -static inline int -__gthread_objc_mutex_allocate (objc_mutex_t mutex _GLIBCXX_UNUSED) -{ - return 0; -} - -/* Deallocate a mutex. */ -static inline int -__gthread_objc_mutex_deallocate (objc_mutex_t mutex _GLIBCXX_UNUSED) -{ - return 0; -} - -/* Grab a lock on a mutex. */ -static inline int -__gthread_objc_mutex_lock (objc_mutex_t mutex _GLIBCXX_UNUSED) -{ - /* There can only be one thread, so we always get the lock */ - return 0; -} - -/* Try to grab a lock on a mutex. */ -static inline int -__gthread_objc_mutex_trylock (objc_mutex_t mutex _GLIBCXX_UNUSED) -{ - /* There can only be one thread, so we always get the lock */ - return 0; -} - -/* Unlock the mutex */ -static inline int -__gthread_objc_mutex_unlock (objc_mutex_t mutex _GLIBCXX_UNUSED) -{ - return 0; -} - -/* Backend condition mutex functions */ - -/* Allocate a condition. */ -static inline int -__gthread_objc_condition_allocate (objc_condition_t condition _GLIBCXX_UNUSED) -{ - return 0; -} - -/* Deallocate a condition. */ -static inline int -__gthread_objc_condition_deallocate (objc_condition_t condition _GLIBCXX_UNUSED) -{ - return 0; -} - -/* Wait on the condition */ -static inline int -__gthread_objc_condition_wait (objc_condition_t condition _GLIBCXX_UNUSED, - objc_mutex_t mutex _GLIBCXX_UNUSED) -{ - return 0; -} - -/* Wake up all threads waiting on this condition. */ -static inline int -__gthread_objc_condition_broadcast (objc_condition_t condition _GLIBCXX_UNUSED) -{ - return 0; -} - -/* Wake up one thread waiting on this condition. */ -static inline int -__gthread_objc_condition_signal (objc_condition_t condition _GLIBCXX_UNUSED) -{ - return 0; -} - -#else /* _LIBOBJC */ - -static inline int -__gthread_active_p (void) -{ - return 0; -} - -static inline int -__gthread_once (__gthread_once_t *__once _GLIBCXX_UNUSED, void (*__func) (void) _GLIBCXX_UNUSED) -{ - return 0; -} - -static inline int _GLIBCXX_UNUSED -__gthread_key_create (__gthread_key_t *__key _GLIBCXX_UNUSED, void (*__func) (void *) _GLIBCXX_UNUSED) -{ - return 0; -} - -static int _GLIBCXX_UNUSED -__gthread_key_delete (__gthread_key_t __key _GLIBCXX_UNUSED) -{ - return 0; -} - -static inline void * -__gthread_getspecific (__gthread_key_t __key _GLIBCXX_UNUSED) -{ - return 0; -} - -static inline int -__gthread_setspecific (__gthread_key_t __key _GLIBCXX_UNUSED, const void *__v _GLIBCXX_UNUSED) -{ - return 0; -} - -static inline int -__gthread_mutex_destroy (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED) -{ - return 0; -} - -static inline int -__gthread_mutex_lock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED) -{ - return 0; -} - -static inline int -__gthread_mutex_trylock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED) -{ - return 0; -} - -static inline int -__gthread_mutex_unlock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED) -{ - return 0; -} - -static inline int -__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) -{ - return __gthread_mutex_lock (__mutex); -} - -static inline int -__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) -{ - return __gthread_mutex_trylock (__mutex); -} - -static inline int -__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) -{ - return __gthread_mutex_unlock (__mutex); -} - -static inline int -__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) -{ - return __gthread_mutex_destroy (__mutex); -} - -#endif /* _LIBOBJC */ - -#undef _GLIBCXX_UNUSED - -#endif /* ! _GLIBCXX_GCC_GTHR_SINGLE_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/gthr.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/gthr.h deleted file mode 100644 index 0732e04..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/gthr.h +++ /dev/null @@ -1,154 +0,0 @@ -/* Threads compatibility routines for libgcc2. */ -/* Compile this one with gcc. */ -/* Copyright (C) 1997-2015 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 3, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -. */ - -#ifndef _GLIBCXX_GCC_GTHR_H -#define _GLIBCXX_GCC_GTHR_H - -#ifndef _GLIBCXX_HIDE_EXPORTS -#pragma GCC visibility push(default) -#endif - -/* If this file is compiled with threads support, it must - #define __GTHREADS 1 - to indicate that threads support is present. Also it has define - function - int __gthread_active_p () - that returns 1 if thread system is active, 0 if not. - - The threads interface must define the following types: - __gthread_key_t - __gthread_once_t - __gthread_mutex_t - __gthread_recursive_mutex_t - - The threads interface must define the following macros: - - __GTHREAD_ONCE_INIT - to initialize __gthread_once_t - __GTHREAD_MUTEX_INIT - to initialize __gthread_mutex_t to get a fast - non-recursive mutex. - __GTHREAD_MUTEX_INIT_FUNCTION - to initialize __gthread_mutex_t to get a fast - non-recursive mutex. - Define this to a function which looks like this: - void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *) - Some systems can't initialize a mutex without a - function call. Don't define __GTHREAD_MUTEX_INIT in this case. - __GTHREAD_RECURSIVE_MUTEX_INIT - __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION - as above, but for a recursive mutex. - - The threads interface must define the following static functions: - - int __gthread_once (__gthread_once_t *once, void (*func) ()) - - int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *)) - int __gthread_key_delete (__gthread_key_t key) - - void *__gthread_getspecific (__gthread_key_t key) - int __gthread_setspecific (__gthread_key_t key, const void *ptr) - - int __gthread_mutex_destroy (__gthread_mutex_t *mutex); - int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex); - - int __gthread_mutex_lock (__gthread_mutex_t *mutex); - int __gthread_mutex_trylock (__gthread_mutex_t *mutex); - int __gthread_mutex_unlock (__gthread_mutex_t *mutex); - - int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex); - int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex); - int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex); - - The following are supported in POSIX threads only. They are required to - fix a deadlock in static initialization inside libsupc++. The header file - gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra - features are supported. - - Types: - __gthread_cond_t - - Macros: - __GTHREAD_COND_INIT - __GTHREAD_COND_INIT_FUNCTION - - Interface: - int __gthread_cond_broadcast (__gthread_cond_t *cond); - int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex); - int __gthread_cond_wait_recursive (__gthread_cond_t *cond, - __gthread_recursive_mutex_t *mutex); - - All functions returning int should return zero on success or the error - number. If the operation is not supported, -1 is returned. - - If the following are also defined, you should - #define __GTHREADS_CXX0X 1 - to enable the c++0x thread library. - - Types: - __gthread_t - __gthread_time_t - - Interface: - int __gthread_create (__gthread_t *thread, void *(*func) (void*), - void *args); - int __gthread_join (__gthread_t thread, void **value_ptr); - int __gthread_detach (__gthread_t thread); - int __gthread_equal (__gthread_t t1, __gthread_t t2); - __gthread_t __gthread_self (void); - int __gthread_yield (void); - - int __gthread_mutex_timedlock (__gthread_mutex_t *m, - const __gthread_time_t *abs_timeout); - int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m, - const __gthread_time_t *abs_time); - - int __gthread_cond_signal (__gthread_cond_t *cond); - int __gthread_cond_timedwait (__gthread_cond_t *cond, - __gthread_mutex_t *mutex, - const __gthread_time_t *abs_timeout); - -*/ - -#if __GXX_WEAK__ -/* The pe-coff weak support isn't fully compatible to ELF's weak. - For static libraries it might would work, but as we need to deal - with shared versions too, we disable it for mingw-targets. */ -#ifdef __MINGW32__ -#undef _GLIBCXX_GTHREAD_USE_WEAK -#define _GLIBCXX_GTHREAD_USE_WEAK 0 -#endif - -#ifndef _GLIBCXX_GTHREAD_USE_WEAK -#define _GLIBCXX_GTHREAD_USE_WEAK 1 -#endif -#endif -#include - -#ifndef _GLIBCXX_HIDE_EXPORTS -#pragma GCC visibility pop -#endif - -#endif /* ! _GLIBCXX_GCC_GTHR_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/messages_members.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/messages_members.h deleted file mode 100644 index a4964de..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/messages_members.h +++ /dev/null @@ -1,151 +0,0 @@ -// std::messages implementation details, GNU version -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/messages_members.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -// -// ISO C++ 14882: 22.2.7.1.2 messages functions -// - -// Written by Benjamin Kosnik - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Non-virtual member functions. - template - messages<_CharT>::messages(size_t __refs) - : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), - _M_name_messages(_S_get_c_name()) - { } - - template - messages<_CharT>::messages(__c_locale __cloc, const char* __s, - size_t __refs) - : facet(__refs), _M_c_locale_messages(0), _M_name_messages(0) - { - if (__builtin_strcmp(__s, _S_get_c_name()) != 0) - { - const size_t __len = __builtin_strlen(__s) + 1; - char* __tmp = new char[__len]; - __builtin_memcpy(__tmp, __s, __len); - _M_name_messages = __tmp; - } - else - _M_name_messages = _S_get_c_name(); - - // Last to avoid leaking memory if new throws. - _M_c_locale_messages = _S_clone_c_locale(__cloc); - } - - template - typename messages<_CharT>::catalog - messages<_CharT>::open(const basic_string& __s, const locale& __loc, - const char* __dir) const - { - bindtextdomain(__s.c_str(), __dir); - return this->do_open(__s, __loc); - } - - // Virtual member functions. - template - messages<_CharT>::~messages() - { - if (_M_name_messages != _S_get_c_name()) - delete [] _M_name_messages; - _S_destroy_c_locale(_M_c_locale_messages); - } - - template - typename messages<_CharT>::catalog - messages<_CharT>::do_open(const basic_string& __s, - const locale&) const - { - // No error checking is done, assume the catalog exists and can - // be used. - textdomain(__s.c_str()); - return 0; - } - - template - void - messages<_CharT>::do_close(catalog) const - { } - - // messages_byname - template - messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) - : messages<_CharT>(__refs) - { - if (this->_M_name_messages != locale::facet::_S_get_c_name()) - { - delete [] this->_M_name_messages; - if (__builtin_strcmp(__s, locale::facet::_S_get_c_name()) != 0) - { - const size_t __len = __builtin_strlen(__s) + 1; - char* __tmp = new char[__len]; - __builtin_memcpy(__tmp, __s, __len); - this->_M_name_messages = __tmp; - } - else - this->_M_name_messages = locale::facet::_S_get_c_name(); - } - - if (__builtin_strcmp(__s, "C") != 0 - && __builtin_strcmp(__s, "POSIX") != 0) - { - this->_S_destroy_c_locale(this->_M_c_locale_messages); - this->_S_create_c_locale(this->_M_c_locale_messages, __s); - } - } - - //Specializations. - template<> - typename messages::catalog - messages::do_open(const basic_string&, - const locale&) const; - - template<> - void - messages::do_close(catalog) const; - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - typename messages::catalog - messages::do_open(const basic_string&, - const locale&) const; - - template<> - void - messages::do_close(catalog) const; -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/opt_random.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/opt_random.h deleted file mode 100644 index 3bf2203..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/opt_random.h +++ /dev/null @@ -1,38 +0,0 @@ -// Optimizations for random number handling, generic version -*- C++ -*- - -// Copyright (C) 2012-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/opt_random.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{random} - */ - -#ifndef _BITS_OPT_RANDOM_H -#define _BITS_OPT_RANDOM_H 1 - -#pragma GCC system_header - - - - -#endif // _BITS_OPT_RANDOM_H diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/os_defines.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/os_defines.h deleted file mode 100644 index 9ac193f..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/os_defines.h +++ /dev/null @@ -1,48 +0,0 @@ -// Specific definitions for GNU/Linux -*- C++ -*- - -// Copyright (C) 2000-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/os_defines.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iosfwd} - */ - -#ifndef _GLIBCXX_OS_DEFINES -#define _GLIBCXX_OS_DEFINES 1 - -// System-specific #define, typedefs, corrections, etc, go here. This -// file will come before all others. - -// This keeps isanum, et al from being propagated as macros. -#define __NO_CTYPE 1 - -#include - -// Provide a declaration for the possibly deprecated gets function, as -// glibc 2.15 and later does not declare gets for ISO C11 when -// __GNU_SOURCE is defined. -#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE) -# undef _GLIBCXX_HAVE_GETS -#endif - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/stdc++.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/stdc++.h deleted file mode 100644 index 8449ec0..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/stdc++.h +++ /dev/null @@ -1,117 +0,0 @@ -// C++ includes used for precompiling -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file stdc++.h - * This is an implementation file for a precompiled header. - */ - -// 17.4.1.2 Headers - -// C -#ifndef _GLIBCXX_NO_ASSERT -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if __cplusplus >= 201103L -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif - -// C++ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if __cplusplus >= 201103L -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/stdtr1c++.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/stdtr1c++.h deleted file mode 100644 index 542059c..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/stdtr1c++.h +++ /dev/null @@ -1,53 +0,0 @@ -// C++ includes used for precompiling TR1 -*- C++ -*- - -// Copyright (C) 2006-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file stdtr1c++.h - * This is an implementation file for a precompiled header. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/time_members.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/time_members.h deleted file mode 100644 index e05db3b..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/bits/time_members.h +++ /dev/null @@ -1,89 +0,0 @@ -// std::time_get, std::time_put implementation, GNU version -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/time_members.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -// -// ISO C++ 14882: 22.2.5.1.2 - time_get functions -// ISO C++ 14882: 22.2.5.3.2 - time_put functions -// - -// Written by Benjamin Kosnik - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - __timepunct<_CharT>::__timepunct(size_t __refs) - : facet(__refs), _M_data(0), _M_c_locale_timepunct(0), - _M_name_timepunct(_S_get_c_name()) - { _M_initialize_timepunct(); } - - template - __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) - : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(0), - _M_name_timepunct(_S_get_c_name()) - { _M_initialize_timepunct(); } - - template - __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, - size_t __refs) - : facet(__refs), _M_data(0), _M_c_locale_timepunct(0), - _M_name_timepunct(0) - { - if (__builtin_strcmp(__s, _S_get_c_name()) != 0) - { - const size_t __len = __builtin_strlen(__s) + 1; - char* __tmp = new char[__len]; - __builtin_memcpy(__tmp, __s, __len); - _M_name_timepunct = __tmp; - } - else - _M_name_timepunct = _S_get_c_name(); - - __try - { _M_initialize_timepunct(__cloc); } - __catch(...) - { - if (_M_name_timepunct != _S_get_c_name()) - delete [] _M_name_timepunct; - __throw_exception_again; - } - } - - template - __timepunct<_CharT>::~__timepunct() - { - if (_M_name_timepunct != _S_get_c_name()) - delete [] _M_name_timepunct; - delete _M_data; - _S_destroy_c_locale(_M_c_locale_timepunct); - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace diff --git a/openflow/usr/include/arm-linux-gnueabihf/c++/5/ext/opt_random.h b/openflow/usr/include/arm-linux-gnueabihf/c++/5/ext/opt_random.h deleted file mode 100644 index f23a1e1..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/c++/5/ext/opt_random.h +++ /dev/null @@ -1,38 +0,0 @@ -// Optimizations for random number extensions, generic version -*- C++ -*- - -// Copyright (C) 2012-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ext/opt_random.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{ext/random} - */ - -#ifndef _EXT_OPT_RANDOM_H -#define _EXT_OPT_RANDOM_H 1 - -#pragma GCC system_header - - - - -#endif // _EXT_OPT_RANDOM_H diff --git a/openflow/usr/include/arm-linux-gnueabihf/expat_config.h b/openflow/usr/include/arm-linux-gnueabihf/expat_config.h deleted file mode 100644 index 70fe044..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/expat_config.h +++ /dev/null @@ -1,102 +0,0 @@ -/* expat_config.h. Generated from expat_config.h.in by configure. */ -/* expat_config.h.in. Generated from configure.in by autoheader. */ - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#define BYTEORDER 1234 - -/* Define to 1 if you have the `bcopy' function. */ -#define HAVE_BCOPY 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `getpagesize' function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have a working `mmap' system call. */ -#define HAVE_MMAP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the sub-directory where libtool stores uninstalled libraries. */ -#define LT_OBJDIR ".libs/" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "expat-bugs@libexpat.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "expat" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "expat 2.1.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "expat" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.1.0" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* whether byteorder is bigendian */ -/* #undef WORDS_BIGENDIAN */ - -/* Define to specify how much context to retain around the current parse - point. */ -#define XML_CONTEXT_BYTES 1024 - -/* Define to make parameter entity parsing functionality available. */ -#define XML_DTD 1 - -/* Define to make XML Namespaces functionality available. */ -#define XML_NS 1 - -/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */ -/* #undef __func__ */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `long int' if does not define. */ -/* #undef off_t */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/ffi.h b/openflow/usr/include/arm-linux-gnueabihf/ffi.h deleted file mode 100644 index b11d96b..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/ffi.h +++ /dev/null @@ -1,487 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - libffi 3.2.1 - Copyright (c) 2011, 2014 Anthony Green - - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the ``Software''), to deal in the Software without - restriction, including without limitation the rights to use, copy, - modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------- - The basic API is described in the README file. - - The raw API is designed to bypass some of the argument packing - and unpacking on architectures for which it can be avoided. - - The closure API allows interpreted functions to be packaged up - inside a C function pointer, so that they can be called as C functions, - with no understanding on the client side that they are interpreted. - It can also be used in other cases in which it is necessary to package - up a user specified parameter and a function pointer as a single - function pointer. - - The closure API must be implemented in order to get its functionality, - e.g. for use by gij. Routines are provided to emulate the raw API - if the underlying platform doesn't allow faster implementation. - - More details on the raw and cloure API can be found in: - - http://gcc.gnu.org/ml/java/1999-q3/msg00138.html - - and - - http://gcc.gnu.org/ml/java/1999-q3/msg00174.html - -------------------------------------------------------------------- */ - -#ifndef LIBFFI_H -#define LIBFFI_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* Specify which architecture libffi is configured for. */ -#ifndef ARM -#define ARM -#endif - -/* ---- System configuration information --------------------------------- */ - -#include - -#ifndef LIBFFI_ASM - -#if defined(_MSC_VER) && !defined(__clang__) -#define __attribute__(X) -#endif - -#include -#include - -/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). - But we can find it either under the correct ANSI name, or under GNU - C's internal name. */ - -#define FFI_64_BIT_MAX 9223372036854775807 - -#ifdef LONG_LONG_MAX -# define FFI_LONG_LONG_MAX LONG_LONG_MAX -#else -# ifdef LLONG_MAX -# define FFI_LONG_LONG_MAX LLONG_MAX -# ifdef _AIX52 /* or newer has C99 LLONG_MAX */ -# undef FFI_64_BIT_MAX -# define FFI_64_BIT_MAX 9223372036854775807LL -# endif /* _AIX52 or newer */ -# else -# ifdef __GNUC__ -# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ -# endif -# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ -# ifndef __PPC64__ -# if defined (__IBMC__) || defined (__IBMCPP__) -# define FFI_LONG_LONG_MAX LONGLONG_MAX -# endif -# endif /* __PPC64__ */ -# undef FFI_64_BIT_MAX -# define FFI_64_BIT_MAX 9223372036854775807LL -# endif -# endif -#endif - -/* The closure code assumes that this works on pointers, i.e. a size_t */ -/* can hold a pointer. */ - -typedef struct _ffi_type -{ - size_t size; - unsigned short alignment; - unsigned short type; - struct _ffi_type **elements; -} ffi_type; - -#ifndef LIBFFI_HIDE_BASIC_TYPES -#if SCHAR_MAX == 127 -# define ffi_type_uchar ffi_type_uint8 -# define ffi_type_schar ffi_type_sint8 -#else - #error "char size not supported" -#endif - -#if SHRT_MAX == 32767 -# define ffi_type_ushort ffi_type_uint16 -# define ffi_type_sshort ffi_type_sint16 -#elif SHRT_MAX == 2147483647 -# define ffi_type_ushort ffi_type_uint32 -# define ffi_type_sshort ffi_type_sint32 -#else - #error "short size not supported" -#endif - -#if INT_MAX == 32767 -# define ffi_type_uint ffi_type_uint16 -# define ffi_type_sint ffi_type_sint16 -#elif INT_MAX == 2147483647 -# define ffi_type_uint ffi_type_uint32 -# define ffi_type_sint ffi_type_sint32 -#elif INT_MAX == 9223372036854775807 -# define ffi_type_uint ffi_type_uint64 -# define ffi_type_sint ffi_type_sint64 -#else - #error "int size not supported" -#endif - -#if LONG_MAX == 2147483647 -# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX - #error "no 64-bit data type supported" -# endif -#elif LONG_MAX != FFI_64_BIT_MAX - #error "long size not supported" -#endif - -#if LONG_MAX == 2147483647 -# define ffi_type_ulong ffi_type_uint32 -# define ffi_type_slong ffi_type_sint32 -#elif LONG_MAX == FFI_64_BIT_MAX -# define ffi_type_ulong ffi_type_uint64 -# define ffi_type_slong ffi_type_sint64 -#else - #error "long size not supported" -#endif - -/* Need minimal decorations for DLLs to works on Windows. */ -/* GCC has autoimport and autoexport. Rely on Libtool to */ -/* help MSVC export from a DLL, but always declare data */ -/* to be imported for MSVC clients. This costs an extra */ -/* indirection for MSVC clients using the static version */ -/* of the library, but don't worry about that. Besides, */ -/* as a workaround, they can define FFI_BUILDING if they */ -/* *know* they are going to link with the static library. */ -#if defined _MSC_VER && !defined FFI_BUILDING -#define FFI_EXTERN extern __declspec(dllimport) -#else -#define FFI_EXTERN extern -#endif - -/* These are defined in types.c */ -FFI_EXTERN ffi_type ffi_type_void; -FFI_EXTERN ffi_type ffi_type_uint8; -FFI_EXTERN ffi_type ffi_type_sint8; -FFI_EXTERN ffi_type ffi_type_uint16; -FFI_EXTERN ffi_type ffi_type_sint16; -FFI_EXTERN ffi_type ffi_type_uint32; -FFI_EXTERN ffi_type ffi_type_sint32; -FFI_EXTERN ffi_type ffi_type_uint64; -FFI_EXTERN ffi_type ffi_type_sint64; -FFI_EXTERN ffi_type ffi_type_float; -FFI_EXTERN ffi_type ffi_type_double; -FFI_EXTERN ffi_type ffi_type_pointer; - -#if 0 -FFI_EXTERN ffi_type ffi_type_longdouble; -#else -#define ffi_type_longdouble ffi_type_double -#endif - -#ifdef FFI_TARGET_HAS_COMPLEX_TYPE -FFI_EXTERN ffi_type ffi_type_complex_float; -FFI_EXTERN ffi_type ffi_type_complex_double; -#if 0 -FFI_EXTERN ffi_type ffi_type_complex_longdouble; -#else -#define ffi_type_complex_longdouble ffi_type_complex_double -#endif -#endif -#endif /* LIBFFI_HIDE_BASIC_TYPES */ - -typedef enum { - FFI_OK = 0, - FFI_BAD_TYPEDEF, - FFI_BAD_ABI -} ffi_status; - -typedef unsigned FFI_TYPE; - -typedef struct { - ffi_abi abi; - unsigned nargs; - ffi_type **arg_types; - ffi_type *rtype; - unsigned bytes; - unsigned flags; -#ifdef FFI_EXTRA_CIF_FIELDS - FFI_EXTRA_CIF_FIELDS; -#endif -} ffi_cif; - -#if 0 -/* Used to adjust size/alignment of ffi types. */ -void ffi_prep_types (ffi_abi abi); -#endif - -/* Used internally, but overridden by some architectures */ -ffi_status ffi_prep_cif_core(ffi_cif *cif, - ffi_abi abi, - unsigned int isvariadic, - unsigned int nfixedargs, - unsigned int ntotalargs, - ffi_type *rtype, - ffi_type **atypes); - -/* ---- Definitions for the raw API -------------------------------------- */ - -#ifndef FFI_SIZEOF_ARG -# if LONG_MAX == 2147483647 -# define FFI_SIZEOF_ARG 4 -# elif LONG_MAX == FFI_64_BIT_MAX -# define FFI_SIZEOF_ARG 8 -# endif -#endif - -#ifndef FFI_SIZEOF_JAVA_RAW -# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG -#endif - -typedef union { - ffi_sarg sint; - ffi_arg uint; - float flt; - char data[FFI_SIZEOF_ARG]; - void* ptr; -} ffi_raw; - -#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 -/* This is a special case for mips64/n32 ABI (and perhaps others) where - sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ -typedef union { - signed int sint; - unsigned int uint; - float flt; - char data[FFI_SIZEOF_JAVA_RAW]; - void* ptr; -} ffi_java_raw; -#else -typedef ffi_raw ffi_java_raw; -#endif - - -void ffi_raw_call (ffi_cif *cif, - void (*fn)(void), - void *rvalue, - ffi_raw *avalue); - -void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); -void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); -size_t ffi_raw_size (ffi_cif *cif); - -/* This is analogous to the raw API, except it uses Java parameter */ -/* packing, even on 64-bit machines. I.e. on 64-bit machines */ -/* longs and doubles are followed by an empty 64-bit word. */ - -void ffi_java_raw_call (ffi_cif *cif, - void (*fn)(void), - void *rvalue, - ffi_java_raw *avalue); - -void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); -void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); -size_t ffi_java_raw_size (ffi_cif *cif); - -/* ---- Definitions for closures ----------------------------------------- */ - -#if FFI_CLOSURES - -#ifdef _MSC_VER -__declspec(align(8)) -#endif -typedef struct { -#if 0 - void *trampoline_table; - void *trampoline_table_entry; -#else - char tramp[FFI_TRAMPOLINE_SIZE]; -#endif - ffi_cif *cif; - void (*fun)(ffi_cif*,void*,void**,void*); - void *user_data; -#ifdef __GNUC__ -} ffi_closure __attribute__((aligned (8))); -#else -} ffi_closure; -# ifdef __sgi -# pragma pack 0 -# endif -#endif - -void *ffi_closure_alloc (size_t size, void **code); -void ffi_closure_free (void *); - -ffi_status -ffi_prep_closure (ffi_closure*, - ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data); - -ffi_status -ffi_prep_closure_loc (ffi_closure*, - ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - void*codeloc); - -#ifdef __sgi -# pragma pack 8 -#endif -typedef struct { -#if 0 - void *trampoline_table; - void *trampoline_table_entry; -#else - char tramp[FFI_TRAMPOLINE_SIZE]; -#endif - ffi_cif *cif; - -#if !FFI_NATIVE_RAW_API - - /* if this is enabled, then a raw closure has the same layout - as a regular closure. We use this to install an intermediate - handler to do the transaltion, void** -> ffi_raw*. */ - - void (*translate_args)(ffi_cif*,void*,void**,void*); - void *this_closure; - -#endif - - void (*fun)(ffi_cif*,void*,ffi_raw*,void*); - void *user_data; - -} ffi_raw_closure; - -typedef struct { -#if 0 - void *trampoline_table; - void *trampoline_table_entry; -#else - char tramp[FFI_TRAMPOLINE_SIZE]; -#endif - - ffi_cif *cif; - -#if !FFI_NATIVE_RAW_API - - /* if this is enabled, then a raw closure has the same layout - as a regular closure. We use this to install an intermediate - handler to do the transaltion, void** -> ffi_raw*. */ - - void (*translate_args)(ffi_cif*,void*,void**,void*); - void *this_closure; - -#endif - - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); - void *user_data; - -} ffi_java_raw_closure; - -ffi_status -ffi_prep_raw_closure (ffi_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data); - -ffi_status -ffi_prep_raw_closure_loc (ffi_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data, - void *codeloc); - -ffi_status -ffi_prep_java_raw_closure (ffi_java_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), - void *user_data); - -ffi_status -ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), - void *user_data, - void *codeloc); - -#endif /* FFI_CLOSURES */ - -/* ---- Public interface definition -------------------------------------- */ - -ffi_status ffi_prep_cif(ffi_cif *cif, - ffi_abi abi, - unsigned int nargs, - ffi_type *rtype, - ffi_type **atypes); - -ffi_status ffi_prep_cif_var(ffi_cif *cif, - ffi_abi abi, - unsigned int nfixedargs, - unsigned int ntotalargs, - ffi_type *rtype, - ffi_type **atypes); - -void ffi_call(ffi_cif *cif, - void (*fn)(void), - void *rvalue, - void **avalue); - -/* Useful for eliminating compiler warnings */ -#define FFI_FN(f) ((void (*)(void))f) - -/* ---- Definitions shared with assembly code ---------------------------- */ - -#endif - -/* If these change, update src/mips/ffitarget.h. */ -#define FFI_TYPE_VOID 0 -#define FFI_TYPE_INT 1 -#define FFI_TYPE_FLOAT 2 -#define FFI_TYPE_DOUBLE 3 -#if 0 -#define FFI_TYPE_LONGDOUBLE 4 -#else -#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE -#endif -#define FFI_TYPE_UINT8 5 -#define FFI_TYPE_SINT8 6 -#define FFI_TYPE_UINT16 7 -#define FFI_TYPE_SINT16 8 -#define FFI_TYPE_UINT32 9 -#define FFI_TYPE_SINT32 10 -#define FFI_TYPE_UINT64 11 -#define FFI_TYPE_SINT64 12 -#define FFI_TYPE_STRUCT 13 -#define FFI_TYPE_POINTER 14 -#define FFI_TYPE_COMPLEX 15 - -/* This should always refer to the last type code (for sanity checks) */ -#define FFI_TYPE_LAST FFI_TYPE_COMPLEX - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/ffitarget.h b/openflow/usr/include/arm-linux-gnueabihf/ffitarget.h deleted file mode 100644 index 26d494d..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/ffitarget.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 2010 CodeSourcery - Copyright (c) 1996-2003 Red Hat, Inc. - - Target configuration macros for ARM. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_VFP, - FFI_LAST_ABI, -#ifdef __ARM_PCS_VFP - FFI_DEFAULT_ABI = FFI_VFP, -#else - FFI_DEFAULT_ABI = FFI_SYSV, -#endif -} ffi_abi; -#endif - -#define FFI_EXTRA_CIF_FIELDS \ - int vfp_used; \ - short vfp_reg_free, vfp_nargs; \ - signed char vfp_args[16] \ - -/* Internally used. */ -#define FFI_TYPE_STRUCT_VFP_FLOAT (FFI_TYPE_LAST + 1) -#define FFI_TYPE_STRUCT_VFP_DOUBLE (FFI_TYPE_LAST + 2) - -#define FFI_TARGET_SPECIFIC_VARIADIC - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 20 -#define FFI_NATIVE_RAW_API 0 - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/fpu_control.h b/openflow/usr/include/arm-linux-gnueabihf/fpu_control.h deleted file mode 100644 index 0fe532a..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/fpu_control.h +++ /dev/null @@ -1,68 +0,0 @@ -/* FPU control word definitions. ARM VFP version. - Copyright (C) 2004-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _FPU_CONTROL_H -#define _FPU_CONTROL_H - -#if !(defined(_LIBC) && !defined(_LIBC_TEST)) && defined(__SOFTFP__) - -#define _FPU_RESERVED 0xffffffff -#define _FPU_DEFAULT 0x00000000 -typedef unsigned int fpu_control_t; -#define _FPU_GETCW(cw) (cw) = 0 -#define _FPU_SETCW(cw) (void) (cw) -extern fpu_control_t __fpu_control; - -#else - -/* masking of interrupts */ -#define _FPU_MASK_IM 0x00000100 /* invalid operation */ -#define _FPU_MASK_ZM 0x00000200 /* divide by zero */ -#define _FPU_MASK_OM 0x00000400 /* overflow */ -#define _FPU_MASK_UM 0x00000800 /* underflow */ -#define _FPU_MASK_PM 0x00001000 /* inexact */ - -#define _FPU_MASK_NZCV 0xf0000000 /* NZCV flags */ -#define _FPU_MASK_RM 0x00c00000 /* rounding mode */ -#define _FPU_MASK_EXCEPT 0x00001f1f /* all exception flags */ - -/* Some bits in the FPSCR are not yet defined. They must be preserved when - modifying the contents. */ -#define _FPU_RESERVED 0x00086060 -#define _FPU_DEFAULT 0x00000000 - -/* Default + exceptions enabled. */ -#define _FPU_IEEE (_FPU_DEFAULT | 0x00001f00) - -/* Type of the control word. */ -typedef unsigned int fpu_control_t; - -/* Macros for accessing the hardware control word. */ -/* This is fmrx %0, fpscr. */ -#define _FPU_GETCW(cw) \ - __asm__ __volatile__ ("mrc p10, 7, %0, cr1, cr0, 0" : "=r" (cw)) -/* This is fmxr fpscr, %0. */ -#define _FPU_SETCW(cw) \ - __asm__ __volatile__ ("mcr p10, 7, %0, cr1, cr0, 0" : : "r" (cw)) - -/* Default control word set at startup. */ -extern fpu_control_t __fpu_control; - -#endif /* __SOFTFP__ */ - -#endif /* _FPU_CONTROL_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/gnu/lib-names-hard.h b/openflow/usr/include/arm-linux-gnueabihf/gnu/lib-names-hard.h deleted file mode 100644 index f85a891..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/gnu/lib-names-hard.h +++ /dev/null @@ -1,31 +0,0 @@ -/* This file is automatically generated. */ -#ifndef __GNU_LIB_NAMES_H -# error "Never use directly; include instead." -#endif - -#define LD_LINUX_ARMHF_SO "ld-linux-armhf.so.3" -#define LD_SO "ld-linux-armhf.so.3" -#define LIBANL_SO "libanl.so.1" -#define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" -#define LIBCIDN_SO "libcidn.so.1" -#define LIBCRYPT_SO "libcrypt.so.1" -#define LIBC_SO "libc.so.6" -#define LIBDL_SO "libdl.so.2" -#define LIBGCC_S_SO "libgcc_s.so.1" -#define LIBMVEC_SO "libmvec.so.1" -#define LIBM_SO "libm.so.6" -#define LIBNSL_SO "libnsl.so.1" -#define LIBNSS_COMPAT_SO "libnss_compat.so.2" -#define LIBNSS_DB_SO "libnss_db.so.2" -#define LIBNSS_DNS_SO "libnss_dns.so.2" -#define LIBNSS_FILES_SO "libnss_files.so.2" -#define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" -#define LIBNSS_LDAP_SO "libnss_ldap.so.2" -#define LIBNSS_NISPLUS_SO "libnss_nisplus.so.2" -#define LIBNSS_NIS_SO "libnss_nis.so.2" -#define LIBNSS_TEST1_SO "libnss_test1.so.2" -#define LIBPTHREAD_SO "libpthread.so.0" -#define LIBRESOLV_SO "libresolv.so.2" -#define LIBRT_SO "librt.so.1" -#define LIBTHREAD_DB_SO "libthread_db.so.1" -#define LIBUTIL_SO "libutil.so.1" diff --git a/openflow/usr/include/arm-linux-gnueabihf/gnu/lib-names.h b/openflow/usr/include/arm-linux-gnueabihf/gnu/lib-names.h deleted file mode 100644 index f7b28af..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/gnu/lib-names.h +++ /dev/null @@ -1,14 +0,0 @@ -/* This file is automatically generated. - It defines macros to allow user program to find the shared - library files which come as part of GNU libc. */ -#ifndef __GNU_LIB_NAMES_H -#define __GNU_LIB_NAMES_H 1 - -#if !defined __ARM_PCS_VFP -# include -#endif -#if defined __ARM_PCS_VFP -# include -#endif - -#endif /* gnu/lib-names.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/gnu/libc-version.h b/openflow/usr/include/arm-linux-gnueabihf/gnu/libc-version.h deleted file mode 100644 index 780612e..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/gnu/libc-version.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Interface to GNU libc specific functions for version information. - Copyright (C) 1998-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _GNU_LIBC_VERSION_H -#define _GNU_LIBC_VERSION_H 1 - -#include - -__BEGIN_DECLS - -/* Return string describing release status of currently running GNU libc. */ -extern const char *gnu_get_libc_release (void) __THROW; - -/* Return string describing version of currently running GNU libc. */ -extern const char *gnu_get_libc_version (void) __THROW; - -__END_DECLS - -#endif /* gnu/libc-version.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/gnu/stubs-hard.h b/openflow/usr/include/arm-linux-gnueabihf/gnu/stubs-hard.h deleted file mode 100644 index 6b82e5e..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/gnu/stubs-hard.h +++ /dev/null @@ -1,27 +0,0 @@ -/* This file is automatically generated. - It defines a symbol `__stub_FUNCTION' for each function - in the C library which is a stub, meaning it will fail - every time called, usually setting errno to ENOSYS. */ - -#ifdef _LIBC -# error Applications may not define the macro _LIBC -#endif - -#define __stub___compat_create_module -#define __stub___compat_get_kernel_syms -#define __stub___compat_query_module -#define __stub_chflags -#define __stub_fattach -#define __stub_fchflags -#define __stub_fdetach -#define __stub_getmsg -#define __stub_getpmsg -#define __stub_gtty -#define __stub_lchmod -#define __stub_putmsg -#define __stub_putpmsg -#define __stub_revoke -#define __stub_setlogin -#define __stub_sigreturn -#define __stub_sstk -#define __stub_stty diff --git a/openflow/usr/include/arm-linux-gnueabihf/gnu/stubs.h b/openflow/usr/include/arm-linux-gnueabihf/gnu/stubs.h deleted file mode 100644 index 33fc077..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/gnu/stubs.h +++ /dev/null @@ -1,11 +0,0 @@ -/* This file is automatically generated. - This file selects the right generated file of `__stub_FUNCTION' macros - based on the architecture being compiled for. */ - - -#if !defined __ARM_PCS_VFP -# include -#endif -#if defined __ARM_PCS_VFP -# include -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/ieee754.h b/openflow/usr/include/arm-linux-gnueabihf/ieee754.h deleted file mode 100644 index e7a5e93..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/ieee754.h +++ /dev/null @@ -1,198 +0,0 @@ -/* Copyright (C) 1992-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _IEEE754_H - -#define _IEEE754_H 1 -#include - -#include - -__BEGIN_DECLS - -union ieee754_float - { - float f; - - /* This is the IEEE 754 single-precision format. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:8; - unsigned int mantissa:23; -#endif /* Big endian. */ -#if __BYTE_ORDER == __LITTLE_ENDIAN - unsigned int mantissa:23; - unsigned int exponent:8; - unsigned int negative:1; -#endif /* Little endian. */ - } ieee; - - /* This format makes it easier to see if a NaN is a signalling NaN. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:8; - unsigned int quiet_nan:1; - unsigned int mantissa:22; -#endif /* Big endian. */ -#if __BYTE_ORDER == __LITTLE_ENDIAN - unsigned int mantissa:22; - unsigned int quiet_nan:1; - unsigned int exponent:8; - unsigned int negative:1; -#endif /* Little endian. */ - } ieee_nan; - }; - -#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ - - -union ieee754_double - { - double d; - - /* This is the IEEE 754 double-precision format. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:11; - /* Together these comprise the mantissa. */ - unsigned int mantissa0:20; - unsigned int mantissa1:32; -#endif /* Big endian. */ -#if __BYTE_ORDER == __LITTLE_ENDIAN -# if __FLOAT_WORD_ORDER == __BIG_ENDIAN - unsigned int mantissa0:20; - unsigned int exponent:11; - unsigned int negative:1; - unsigned int mantissa1:32; -# else - /* Together these comprise the mantissa. */ - unsigned int mantissa1:32; - unsigned int mantissa0:20; - unsigned int exponent:11; - unsigned int negative:1; -# endif -#endif /* Little endian. */ - } ieee; - - /* This format makes it easier to see if a NaN is a signalling NaN. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:11; - unsigned int quiet_nan:1; - /* Together these comprise the mantissa. */ - unsigned int mantissa0:19; - unsigned int mantissa1:32; -#else -# if __FLOAT_WORD_ORDER == __BIG_ENDIAN - unsigned int mantissa0:19; - unsigned int quiet_nan:1; - unsigned int exponent:11; - unsigned int negative:1; - unsigned int mantissa1:32; -# else - /* Together these comprise the mantissa. */ - unsigned int mantissa1:32; - unsigned int mantissa0:19; - unsigned int quiet_nan:1; - unsigned int exponent:11; - unsigned int negative:1; -# endif -#endif - } ieee_nan; - }; - -#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ - - -union ieee854_long_double - { - long double d; - - /* This is the IEEE 854 double-extended-precision format. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:15; - unsigned int empty:16; - unsigned int mantissa0:32; - unsigned int mantissa1:32; -#endif -#if __BYTE_ORDER == __LITTLE_ENDIAN -# if __FLOAT_WORD_ORDER == __BIG_ENDIAN - unsigned int exponent:15; - unsigned int negative:1; - unsigned int empty:16; - unsigned int mantissa0:32; - unsigned int mantissa1:32; -# else - unsigned int mantissa1:32; - unsigned int mantissa0:32; - unsigned int exponent:15; - unsigned int negative:1; - unsigned int empty:16; -# endif -#endif - } ieee; - - /* This is for NaNs in the IEEE 854 double-extended-precision format. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:15; - unsigned int empty:16; - unsigned int one:1; - unsigned int quiet_nan:1; - unsigned int mantissa0:30; - unsigned int mantissa1:32; -#endif -#if __BYTE_ORDER == __LITTLE_ENDIAN -# if __FLOAT_WORD_ORDER == __BIG_ENDIAN - unsigned int exponent:15; - unsigned int negative:1; - unsigned int empty:16; - unsigned int mantissa0:30; - unsigned int quiet_nan:1; - unsigned int one:1; - unsigned int mantissa1:32; -# else - unsigned int mantissa1:32; - unsigned int mantissa0:30; - unsigned int quiet_nan:1; - unsigned int one:1; - unsigned int exponent:15; - unsigned int negative:1; - unsigned int empty:16; -# endif -#endif - } ieee_nan; - }; - -#define IEEE854_LONG_DOUBLE_BIAS 0x3fff - -__END_DECLS - -#endif /* ieee754.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/openssl/opensslconf.h b/openflow/usr/include/arm-linux-gnueabihf/openssl/opensslconf.h deleted file mode 100644 index d90ef36..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/openssl/opensslconf.h +++ /dev/null @@ -1,282 +0,0 @@ -/* opensslconf.h */ -/* WARNING: Generated automatically from opensslconf.h.in by Configure. */ - -#ifdef __cplusplus -extern "C" { -#endif -/* OpenSSL was configured with the following options: */ -#ifndef OPENSSL_DOING_MAKEDEPEND - - -#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 -# define OPENSSL_NO_EC_NISTP_64_GCC_128 -#endif -#ifndef OPENSSL_NO_GMP -# define OPENSSL_NO_GMP -#endif -#ifndef OPENSSL_NO_IDEA -# define OPENSSL_NO_IDEA -#endif -#ifndef OPENSSL_NO_JPAKE -# define OPENSSL_NO_JPAKE -#endif -#ifndef OPENSSL_NO_KRB5 -# define OPENSSL_NO_KRB5 -#endif -#ifndef OPENSSL_NO_LIBUNBOUND -# define OPENSSL_NO_LIBUNBOUND -#endif -#ifndef OPENSSL_NO_MD2 -# define OPENSSL_NO_MD2 -#endif -#ifndef OPENSSL_NO_MDC2 -# define OPENSSL_NO_MDC2 -#endif -#ifndef OPENSSL_NO_RC5 -# define OPENSSL_NO_RC5 -#endif -#ifndef OPENSSL_NO_RFC3779 -# define OPENSSL_NO_RFC3779 -#endif -#ifndef OPENSSL_NO_SCTP -# define OPENSSL_NO_SCTP -#endif -#ifndef OPENSSL_NO_SSL_TRACE -# define OPENSSL_NO_SSL_TRACE -#endif -#ifndef OPENSSL_NO_SSL2 -# define OPENSSL_NO_SSL2 -#endif -#ifndef OPENSSL_NO_SSL3 -# define OPENSSL_NO_SSL3 -#endif -#ifndef OPENSSL_NO_STORE -# define OPENSSL_NO_STORE -#endif -#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS -# define OPENSSL_NO_WEAK_SSL_CIPHERS -#endif - -#endif /* OPENSSL_DOING_MAKEDEPEND */ - -#ifndef OPENSSL_THREADS -# define OPENSSL_THREADS -#endif -#ifndef OPENSSL_NO_STATIC_ENGINE -# define OPENSSL_NO_STATIC_ENGINE -#endif - -/* The OPENSSL_NO_* macros are also defined as NO_* if the application - asks for it. This is a transient feature that is provided for those - who haven't had the time to do the appropriate changes in their - applications. */ -#ifdef OPENSSL_ALGORITHM_DEFINES -# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128) -# define NO_EC_NISTP_64_GCC_128 -# endif -# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) -# define NO_GMP -# endif -# if defined(OPENSSL_NO_IDEA) && !defined(NO_IDEA) -# define NO_IDEA -# endif -# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE) -# define NO_JPAKE -# endif -# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) -# define NO_KRB5 -# endif -# if defined(OPENSSL_NO_LIBUNBOUND) && !defined(NO_LIBUNBOUND) -# define NO_LIBUNBOUND -# endif -# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2) -# define NO_MD2 -# endif -# if defined(OPENSSL_NO_MDC2) && !defined(NO_MDC2) -# define NO_MDC2 -# endif -# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) -# define NO_RC5 -# endif -# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779) -# define NO_RFC3779 -# endif -# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP) -# define NO_SCTP -# endif -# if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) -# define NO_SSL_TRACE -# endif -# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) -# define NO_SSL2 -# endif -# if defined(OPENSSL_NO_SSL3) && !defined(NO_SSL3) -# define NO_SSL3 -# endif -# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) -# define NO_STORE -# endif -# if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) -# define NO_WEAK_SSL_CIPHERS -# endif -#endif - -#define OPENSSL_CPUID_OBJ - -/* crypto/opensslconf.h.in */ - -/* Generate 80386 code? */ -#undef I386_ONLY - -#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ -#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) -#define ENGINESDIR "/usr/lib/arm-linux-gnueabihf/openssl-1.0.0/engines" -#define OPENSSLDIR "/usr/lib/ssl" -#endif -#endif - -#undef OPENSSL_UNISTD -#define OPENSSL_UNISTD - -#undef OPENSSL_EXPORT_VAR_AS_FUNCTION - -#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) -#define IDEA_INT unsigned int -#endif - -#if defined(HEADER_MD2_H) && !defined(MD2_INT) -#define MD2_INT unsigned int -#endif - -#if defined(HEADER_RC2_H) && !defined(RC2_INT) -/* I need to put in a mod for the alpha - eay */ -#define RC2_INT unsigned int -#endif - -#if defined(HEADER_RC4_H) -#if !defined(RC4_INT) -/* using int types make the structure larger but make the code faster - * on most boxes I have tested - up to %20 faster. */ -/* - * I don't know what does "most" mean, but declaring "int" is a must on: - * - Intel P6 because partial register stalls are very expensive; - * - elder Alpha because it lacks byte load/store instructions; - */ -#define RC4_INT unsigned char -#endif -#if !defined(RC4_CHUNK) -/* - * This enables code handling data aligned at natural CPU word - * boundary. See crypto/rc4/rc4_enc.c for further details. - */ -#define RC4_CHUNK unsigned long -#endif -#endif - -#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) -/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a - * %20 speed up (longs are 8 bytes, int's are 4). */ -#ifndef DES_LONG -#define DES_LONG unsigned int -#endif -#endif - -#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) -#define CONFIG_HEADER_BN_H -#define BN_LLONG - -/* Should we define BN_DIV2W here? */ - -/* Only one for the following should be defined */ -#undef SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#define THIRTY_TWO_BIT -#endif - -#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) -#define CONFIG_HEADER_RC4_LOCL_H -/* if this is defined data[i] is used instead of *data, this is a %20 - * speedup on x86 */ -#undef RC4_INDEX -#endif - -#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) -#define CONFIG_HEADER_BF_LOCL_H -#define BF_PTR -#endif /* HEADER_BF_LOCL_H */ - -#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) -#define CONFIG_HEADER_DES_LOCL_H -#ifndef DES_DEFAULT_OPTIONS -/* the following is tweaked from a config script, that is why it is a - * protected undef/define */ -#ifndef DES_PTR -#undef DES_PTR -#endif - -/* This helps C compiler generate the correct code for multiple functional - * units. It reduces register dependancies at the expense of 2 more - * registers */ -#ifndef DES_RISC1 -#undef DES_RISC1 -#endif - -#ifndef DES_RISC2 -#undef DES_RISC2 -#endif - -#if defined(DES_RISC1) && defined(DES_RISC2) -#error YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! -#endif - -/* Unroll the inner loop, this sometimes helps, sometimes hinders. - * Very mucy CPU dependant */ -#ifndef DES_UNROLL -#define DES_UNROLL -#endif - -/* These default values were supplied by - * Peter Gutman - * They are only used if nothing else has been defined */ -#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) -/* Special defines which change the way the code is built depending on the - CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find - even newer MIPS CPU's, but at the moment one size fits all for - optimization options. Older Sparc's work better with only UNROLL, but - there's no way to tell at compile time what it is you're running on */ - -#if defined( __sun ) || defined ( sun ) /* Newer Sparc's */ -# define DES_PTR -# define DES_RISC1 -# define DES_UNROLL -#elif defined( __ultrix ) /* Older MIPS */ -# define DES_PTR -# define DES_RISC2 -# define DES_UNROLL -#elif defined( __osf1__ ) /* Alpha */ -# define DES_PTR -# define DES_RISC2 -#elif defined ( _AIX ) /* RS6000 */ - /* Unknown */ -#elif defined( __hpux ) /* HP-PA */ - /* Unknown */ -#elif defined( __aux ) /* 68K */ - /* Unknown */ -#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ -# define DES_UNROLL -#elif defined( __sgi ) /* Newer MIPS */ -# define DES_PTR -# define DES_RISC2 -# define DES_UNROLL -#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ -# define DES_PTR -# define DES_RISC1 -# define DES_UNROLL -#endif /* Systems-specific speed defines */ -#endif - -#endif /* DES_DEFAULT_OPTIONS */ -#endif /* HEADER_DES_LOCL_H */ -#ifdef __cplusplus -} -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/acct.h b/openflow/usr/include/arm-linux-gnueabihf/sys/acct.h deleted file mode 100644 index ea0e7fd..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/acct.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_ACCT_H -#define _SYS_ACCT_H 1 - -#include - -#include -#define __need_time_t -#include -#include - -__BEGIN_DECLS - -#define ACCT_COMM 16 - -/* - comp_t is a 16-bit "floating" point number with a 3-bit base 8 - exponent and a 13-bit fraction. See linux/kernel/acct.c for the - specific encoding system used. -*/ - -typedef u_int16_t comp_t; - -struct acct -{ - char ac_flag; /* Flags. */ - u_int16_t ac_uid; /* Real user ID. */ - u_int16_t ac_gid; /* Real group ID. */ - u_int16_t ac_tty; /* Controlling terminal. */ - u_int32_t ac_btime; /* Beginning time. */ - comp_t ac_utime; /* User time. */ - comp_t ac_stime; /* System time. */ - comp_t ac_etime; /* Elapsed time. */ - comp_t ac_mem; /* Average memory usage. */ - comp_t ac_io; /* Chars transferred. */ - comp_t ac_rw; /* Blocks read or written. */ - comp_t ac_minflt; /* Minor pagefaults. */ - comp_t ac_majflt; /* Major pagefaults. */ - comp_t ac_swaps; /* Number of swaps. */ - u_int32_t ac_exitcode; /* Process exitcode. */ - char ac_comm[ACCT_COMM+1]; /* Command name. */ - char ac_pad[10]; /* Padding bytes. */ -}; - - -struct acct_v3 -{ - char ac_flag; /* Flags */ - char ac_version; /* Always set to ACCT_VERSION */ - u_int16_t ac_tty; /* Control Terminal */ - u_int32_t ac_exitcode; /* Exitcode */ - u_int32_t ac_uid; /* Real User ID */ - u_int32_t ac_gid; /* Real Group ID */ - u_int32_t ac_pid; /* Process ID */ - u_int32_t ac_ppid; /* Parent Process ID */ - u_int32_t ac_btime; /* Process Creation Time */ - float ac_etime; /* Elapsed Time */ - comp_t ac_utime; /* User Time */ - comp_t ac_stime; /* System Time */ - comp_t ac_mem; /* Average Memory Usage */ - comp_t ac_io; /* Chars Transferred */ - comp_t ac_rw; /* Blocks Read or Written */ - comp_t ac_minflt; /* Minor Pagefaults */ - comp_t ac_majflt; /* Major Pagefaults */ - comp_t ac_swaps; /* Number of Swaps */ - char ac_comm[ACCT_COMM]; /* Command Name */ -}; - - -enum - { - AFORK = 0x01, /* Has executed fork, but no exec. */ - ASU = 0x02, /* Used super-user privileges. */ - ACORE = 0x08, /* Dumped core. */ - AXSIG = 0x10 /* Killed by a signal. */ - }; - -#if __BYTE_ORDER == __BIG_ENDIAN -# define ACCT_BYTEORDER 0x80 /* Accounting file is big endian. */ -#else -# define ACCT_BYTEORDER 0x00 /* Accounting file is little endian. */ -#endif - -#define AHZ 100 - - -/* Switch process accounting on and off. */ -extern int acct (const char *__filename) __THROW; - -__END_DECLS - -#endif /* sys/acct.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/auxv.h b/openflow/usr/include/arm-linux-gnueabihf/sys/auxv.h deleted file mode 100644 index 1b141bb..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/auxv.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Access to the auxiliary vector. - Copyright (C) 2012-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_AUXV_H -#define _SYS_AUXV_H 1 - -#include -#include -#include -#include - -__BEGIN_DECLS - -/* Return the value associated with an Elf*_auxv_t type from the auxv list - passed to the program on startup. If TYPE was not present in the auxv - list, returns zero and sets errno to ENOENT. */ -extern unsigned long int getauxval (unsigned long int __type) - __THROW; - -__END_DECLS - -#endif /* sys/auxv.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/bitypes.h b/openflow/usr/include/arm-linux-gnueabihf/sys/bitypes.h deleted file mode 100644 index 3a9860f..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/bitypes.h +++ /dev/null @@ -1,3 +0,0 @@ -/* The GNU defines all the necessary types. */ - -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/cdefs.h b/openflow/usr/include/arm-linux-gnueabihf/sys/cdefs.h deleted file mode 100644 index 7fd4154..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/cdefs.h +++ /dev/null @@ -1,444 +0,0 @@ -/* Copyright (C) 1992-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_CDEFS_H -#define _SYS_CDEFS_H 1 - -/* We are almost always included from features.h. */ -#ifndef _FEATURES_H -# include -#endif - -/* The GNU libc does not support any K&R compilers or the traditional mode - of ISO C compilers anymore. Check for some of the combinations not - anymore supported. */ -#if defined __GNUC__ && !defined __STDC__ -# error "You need a ISO C conforming compiler to use the glibc headers" -#endif - -/* Some user header file might have defined this before. */ -#undef __P -#undef __PMT - -#ifdef __GNUC__ - -/* All functions, except those with callbacks or those that - synchronize memory, are leaf functions. */ -# if __GNUC_PREREQ (4, 6) && !defined _LIBC -# define __LEAF , __leaf__ -# define __LEAF_ATTR __attribute__ ((__leaf__)) -# else -# define __LEAF -# define __LEAF_ATTR -# endif - -/* GCC can always grok prototypes. For C++ programs we add throw() - to help it optimize the function calls. But this works only with - gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions - as non-throwing using a function attribute since programs can use - the -fexceptions options for C code as well. */ -# if !defined __cplusplus && __GNUC_PREREQ (3, 3) -# define __THROW __attribute__ ((__nothrow__ __LEAF)) -# define __THROWNL __attribute__ ((__nothrow__)) -# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct -# else -# if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () -# define __THROWNL throw () -# define __NTH(fct) __LEAF_ATTR fct throw () -# else -# define __THROW -# define __THROWNL -# define __NTH(fct) fct -# endif -# endif - -#else /* Not GCC. */ - -# define __inline /* No inline functions. */ - -# define __THROW -# define __THROWNL -# define __NTH(fct) fct - -#endif /* GCC. */ - -/* These two macros are not used in glibc anymore. They are kept here - only because some other projects expect the macros to be defined. */ -#define __P(args) args -#define __PMT(args) args - -/* For these things, GCC behaves the ANSI way normally, - and the non-ANSI way under -traditional. */ - -#define __CONCAT(x,y) x ## y -#define __STRING(x) #x - -/* This is not a typedef so `const __ptr_t' does the right thing. */ -#define __ptr_t void * -#define __long_double_t long double - - -/* C++ needs to know that types and declarations are C, not C++. */ -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS -# define __END_DECLS -#endif - - -/* The standard library needs the functions from the ISO C90 standard - in the std namespace. At the same time we want to be safe for - future changes and we include the ISO C99 code in the non-standard - namespace __c99. The C++ wrapper header take case of adding the - definitions to the global namespace. */ -#if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES -# define __BEGIN_NAMESPACE_STD namespace std { -# define __END_NAMESPACE_STD } -# define __USING_NAMESPACE_STD(name) using std::name; -# define __BEGIN_NAMESPACE_C99 namespace __c99 { -# define __END_NAMESPACE_C99 } -# define __USING_NAMESPACE_C99(name) using __c99::name; -#else -/* For compatibility we do not add the declarations into any - namespace. They will end up in the global namespace which is what - old code expects. */ -# define __BEGIN_NAMESPACE_STD -# define __END_NAMESPACE_STD -# define __USING_NAMESPACE_STD(name) -# define __BEGIN_NAMESPACE_C99 -# define __END_NAMESPACE_C99 -# define __USING_NAMESPACE_C99(name) -#endif - - -/* Fortify support. */ -#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) -#define __bos0(ptr) __builtin_object_size (ptr, 0) - -#if __GNUC_PREREQ (4,3) -# define __warndecl(name, msg) \ - extern void name (void) __attribute__((__warning__ (msg))) -# define __warnattr(msg) __attribute__((__warning__ (msg))) -# define __errordecl(name, msg) \ - extern void name (void) __attribute__((__error__ (msg))) -#else -# define __warndecl(name, msg) extern void name (void) -# define __warnattr(msg) -# define __errordecl(name, msg) extern void name (void) -#endif - -/* Support for flexible arrays. */ -#if __GNUC_PREREQ (2,97) -/* GCC 2.97 supports C99 flexible array members. */ -# define __flexarr [] -#else -# ifdef __GNUC__ -# define __flexarr [0] -# else -# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L -# define __flexarr [] -# else -/* Some other non-C99 compiler. Approximate with [1]. */ -# define __flexarr [1] -# endif -# endif -#endif - - -/* __asm__ ("xyz") is used throughout the headers to rename functions - at the assembly language level. This is wrapped by the __REDIRECT - macro, in order to support compilers that can do this some other - way. When compilers don't support asm-names at all, we have to do - preprocessor tricks instead (which don't have exactly the right - semantics, but it's the best we can do). - - Example: - int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ - -#if defined __GNUC__ && __GNUC__ >= 2 - -# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) -# ifdef __cplusplus -# define __REDIRECT_NTH(name, proto, alias) \ - name proto __THROW __asm__ (__ASMNAME (#alias)) -# define __REDIRECT_NTHNL(name, proto, alias) \ - name proto __THROWNL __asm__ (__ASMNAME (#alias)) -# else -# define __REDIRECT_NTH(name, proto, alias) \ - name proto __asm__ (__ASMNAME (#alias)) __THROW -# define __REDIRECT_NTHNL(name, proto, alias) \ - name proto __asm__ (__ASMNAME (#alias)) __THROWNL -# endif -# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) -# define __ASMNAME2(prefix, cname) __STRING (prefix) cname - -/* -#elif __SOME_OTHER_COMPILER__ - -# define __REDIRECT(name, proto, alias) name proto; \ - _Pragma("let " #name " = " #alias) -*/ -#endif - -/* GCC has various useful declarations that can be made with the - `__attribute__' syntax. All of the ways we use this do fine if - they are omitted for compilers that don't understand it. */ -#if !defined __GNUC__ || __GNUC__ < 2 -# define __attribute__(xyz) /* Ignore */ -#endif - -/* At some point during the gcc 2.96 development the `malloc' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (2,96) -# define __attribute_malloc__ __attribute__ ((__malloc__)) -#else -# define __attribute_malloc__ /* Ignore */ -#endif - -/* Tell the compiler which arguments to an allocation function - indicate the size of the allocation. */ -#if __GNUC_PREREQ (4, 3) -# define __attribute_alloc_size__(params) \ - __attribute__ ((__alloc_size__ params)) -#else -# define __attribute_alloc_size__(params) /* Ignore. */ -#endif - -/* At some point during the gcc 2.96 development the `pure' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (2,96) -# define __attribute_pure__ __attribute__ ((__pure__)) -#else -# define __attribute_pure__ /* Ignore */ -#endif - -/* This declaration tells the compiler that the value is constant. */ -#if __GNUC_PREREQ (2,5) -# define __attribute_const__ __attribute__ ((__const__)) -#else -# define __attribute_const__ /* Ignore */ -#endif - -/* At some point during the gcc 3.1 development the `used' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (3,1) -# define __attribute_used__ __attribute__ ((__used__)) -# define __attribute_noinline__ __attribute__ ((__noinline__)) -#else -# define __attribute_used__ __attribute__ ((__unused__)) -# define __attribute_noinline__ /* Ignore */ -#endif - -/* gcc allows marking deprecated functions. */ -#if __GNUC_PREREQ (3,2) -# define __attribute_deprecated__ __attribute__ ((__deprecated__)) -#else -# define __attribute_deprecated__ /* Ignore */ -#endif - -/* At some point during the gcc 2.8 development the `format_arg' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. - If several `format_arg' attributes are given for the same function, in - gcc-3.0 and older, all but the last one are ignored. In newer gccs, - all designated arguments are considered. */ -#if __GNUC_PREREQ (2,8) -# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) -#else -# define __attribute_format_arg__(x) /* Ignore */ -#endif - -/* At some point during the gcc 2.97 development the `strfmon' format - attribute for functions was introduced. We don't want to use it - unconditionally (although this would be possible) since it - generates warnings. */ -#if __GNUC_PREREQ (2,97) -# define __attribute_format_strfmon__(a,b) \ - __attribute__ ((__format__ (__strfmon__, a, b))) -#else -# define __attribute_format_strfmon__(a,b) /* Ignore */ -#endif - -/* The nonull function attribute allows to mark pointer parameters which - must not be NULL. */ -#if __GNUC_PREREQ (3,3) -# define __nonnull(params) __attribute__ ((__nonnull__ params)) -#else -# define __nonnull(params) -#endif - -/* If fortification mode, we warn about unused results of certain - function calls which can lead to problems. */ -#if __GNUC_PREREQ (3,4) -# define __attribute_warn_unused_result__ \ - __attribute__ ((__warn_unused_result__)) -# if __USE_FORTIFY_LEVEL > 0 -# define __wur __attribute_warn_unused_result__ -# endif -#else -# define __attribute_warn_unused_result__ /* empty */ -#endif -#ifndef __wur -# define __wur /* Ignore */ -#endif - -/* Forces a function to be always inlined. */ -#if __GNUC_PREREQ (3,2) -# define __always_inline __inline __attribute__ ((__always_inline__)) -#else -# define __always_inline __inline -#endif - -/* Associate error messages with the source location of the call site rather - than with the source location inside the function. */ -#if __GNUC_PREREQ (4,3) -# define __attribute_artificial__ __attribute__ ((__artificial__)) -#else -# define __attribute_artificial__ /* Ignore */ -#endif - -/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 - inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__ - or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions - older than 4.3 may define these macros and still not guarantee GNU inlining - semantics. - - clang++ identifies itself as gcc-4.2, but has support for GNU inlining - semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and - __GNUC_GNU_INLINE__ macro definitions. */ -#if (!defined __cplusplus || __GNUC_PREREQ (4,3) \ - || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \ - || defined __GNUC_GNU_INLINE__))) -# if defined __GNUC_STDC_INLINE__ || defined __cplusplus -# define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) -# define __extern_always_inline \ - extern __always_inline __attribute__ ((__gnu_inline__)) -# else -# define __extern_inline extern __inline -# define __extern_always_inline extern __always_inline -# endif -#endif - -#ifdef __extern_always_inline -# define __fortify_function __extern_always_inline __attribute_artificial__ -#endif - -/* GCC 4.3 and above allow passing all anonymous arguments of an - __extern_always_inline function to some other vararg function. */ -#if __GNUC_PREREQ (4,3) -# define __va_arg_pack() __builtin_va_arg_pack () -# define __va_arg_pack_len() __builtin_va_arg_pack_len () -#endif - -/* It is possible to compile containing GCC extensions even if GCC is - run in pedantic mode if the uses are carefully marked using the - `__extension__' keyword. But this is not generally available before - version 2.8. */ -#if !__GNUC_PREREQ (2,8) -# define __extension__ /* Ignore */ -#endif - -/* __restrict is known in EGCS 1.2 and above. */ -#if !__GNUC_PREREQ (2,92) -# define __restrict /* Ignore */ -#endif - -/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is - array_name[restrict] - GCC 3.1 supports this. */ -#if __GNUC_PREREQ (3,1) && !defined __GNUG__ -# define __restrict_arr __restrict -#else -# ifdef __GNUC__ -# define __restrict_arr /* Not supported in old GCC. */ -# else -# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L -# define __restrict_arr restrict -# else -/* Some other non-C99 compiler. */ -# define __restrict_arr /* Not supported. */ -# endif -# endif -#endif - -#if __GNUC__ >= 3 -# define __glibc_unlikely(cond) __builtin_expect ((cond), 0) -# define __glibc_likely(cond) __builtin_expect ((cond), 1) -#else -# define __glibc_unlikely(cond) (cond) -# define __glibc_likely(cond) (cond) -#endif - -#if (!defined _Noreturn \ - && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ - && !__GNUC_PREREQ (4,7)) -# if __GNUC_PREREQ (2,8) -# define _Noreturn __attribute__ ((__noreturn__)) -# else -# define _Noreturn -# endif -#endif - -#if (!defined _Static_assert && !defined __cplusplus \ - && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ - && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__)) -# define _Static_assert(expr, diagnostic) \ - extern int (*__Static_assert_function (void)) \ - [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] -#endif - -#include - -#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH -# define __LDBL_COMPAT 1 -# ifdef __REDIRECT -# define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) -# define __LDBL_REDIR(name, proto) \ - __LDBL_REDIR1 (name, proto, __nldbl_##name) -# define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) -# define __LDBL_REDIR_NTH(name, proto) \ - __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) -# define __LDBL_REDIR1_DECL(name, alias) \ - extern __typeof (name) name __asm (__ASMNAME (#alias)); -# define __LDBL_REDIR_DECL(name) \ - extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name)); -# define __REDIRECT_LDBL(name, proto, alias) \ - __LDBL_REDIR1 (name, proto, __nldbl_##alias) -# define __REDIRECT_NTH_LDBL(name, proto, alias) \ - __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) -# endif -#endif -#if !defined __LDBL_COMPAT || !defined __REDIRECT -# define __LDBL_REDIR1(name, proto, alias) name proto -# define __LDBL_REDIR(name, proto) name proto -# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW -# define __LDBL_REDIR_NTH(name, proto) name proto __THROW -# define __LDBL_REDIR_DECL(name) -# ifdef __REDIRECT -# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) -# define __REDIRECT_NTH_LDBL(name, proto, alias) \ - __REDIRECT_NTH (name, proto, alias) -# endif -#endif - -#endif /* sys/cdefs.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/dir.h b/openflow/usr/include/arm-linux-gnueabihf/sys/dir.h deleted file mode 100644 index 73b04bf..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/dir.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_DIR_H -#define _SYS_DIR_H 1 - -#include - -#include - -#define direct dirent - -#endif /* sys/dir.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/elf.h b/openflow/usr/include/arm-linux-gnueabihf/sys/elf.h deleted file mode 100644 index 430bd1c..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/elf.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _SYS_ELF_H -#define _SYS_ELF_H 1 - -#warning "This header is obsolete; use instead." - -#include - -#endif /* sys/elf.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/epoll.h b/openflow/usr/include/arm-linux-gnueabihf/sys/epoll.h deleted file mode 100644 index 72ec211..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/epoll.h +++ /dev/null @@ -1,142 +0,0 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_EPOLL_H -#define _SYS_EPOLL_H 1 - -#include -#include - -/* Get __sigset_t. */ -#include - -#ifndef __sigset_t_defined -# define __sigset_t_defined -typedef __sigset_t sigset_t; -#endif - -/* Get the platform-dependent flags. */ -#include - -#ifndef __EPOLL_PACKED -# define __EPOLL_PACKED -#endif - - -enum EPOLL_EVENTS - { - EPOLLIN = 0x001, -#define EPOLLIN EPOLLIN - EPOLLPRI = 0x002, -#define EPOLLPRI EPOLLPRI - EPOLLOUT = 0x004, -#define EPOLLOUT EPOLLOUT - EPOLLRDNORM = 0x040, -#define EPOLLRDNORM EPOLLRDNORM - EPOLLRDBAND = 0x080, -#define EPOLLRDBAND EPOLLRDBAND - EPOLLWRNORM = 0x100, -#define EPOLLWRNORM EPOLLWRNORM - EPOLLWRBAND = 0x200, -#define EPOLLWRBAND EPOLLWRBAND - EPOLLMSG = 0x400, -#define EPOLLMSG EPOLLMSG - EPOLLERR = 0x008, -#define EPOLLERR EPOLLERR - EPOLLHUP = 0x010, -#define EPOLLHUP EPOLLHUP - EPOLLRDHUP = 0x2000, -#define EPOLLRDHUP EPOLLRDHUP - EPOLLWAKEUP = 1u << 29, -#define EPOLLWAKEUP EPOLLWAKEUP - EPOLLONESHOT = 1u << 30, -#define EPOLLONESHOT EPOLLONESHOT - EPOLLET = 1u << 31 -#define EPOLLET EPOLLET - }; - - -/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */ -#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */ -#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */ -#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */ - - -typedef union epoll_data -{ - void *ptr; - int fd; - uint32_t u32; - uint64_t u64; -} epoll_data_t; - -struct epoll_event -{ - uint32_t events; /* Epoll events */ - epoll_data_t data; /* User data variable */ -} __EPOLL_PACKED; - - -__BEGIN_DECLS - -/* Creates an epoll instance. Returns an fd for the new instance. - The "size" parameter is a hint specifying the number of file - descriptors to be associated with the new instance. The fd - returned by epoll_create() should be closed with close(). */ -extern int epoll_create (int __size) __THROW; - -/* Same as epoll_create but with an FLAGS parameter. The unused SIZE - parameter has been dropped. */ -extern int epoll_create1 (int __flags) __THROW; - - -/* Manipulate an epoll instance "epfd". Returns 0 in case of success, - -1 in case of error ( the "errno" variable will contain the - specific error code ) The "op" parameter is one of the EPOLL_CTL_* - constants defined above. The "fd" parameter is the target of the - operation. The "event" parameter describes which events the caller - is interested in and any associated user data. */ -extern int epoll_ctl (int __epfd, int __op, int __fd, - struct epoll_event *__event) __THROW; - - -/* Wait for events on an epoll instance "epfd". Returns the number of - triggered events returned in "events" buffer. Or -1 in case of - error with the "errno" variable set to the specific error code. The - "events" parameter is a buffer that will contain triggered - events. The "maxevents" is the maximum number of events to be - returned ( usually size of "events" ). The "timeout" parameter - specifies the maximum wait time in milliseconds (-1 == infinite). - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int epoll_wait (int __epfd, struct epoll_event *__events, - int __maxevents, int __timeout); - - -/* Same as epoll_wait, but the thread's signal mask is temporarily - and atomically replaced with the one provided as parameter. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int epoll_pwait (int __epfd, struct epoll_event *__events, - int __maxevents, int __timeout, - const __sigset_t *__ss); - -__END_DECLS - -#endif /* sys/epoll.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/errno.h b/openflow/usr/include/arm-linux-gnueabihf/sys/errno.h deleted file mode 100644 index 339f4fc..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/errno.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/eventfd.h b/openflow/usr/include/arm-linux-gnueabihf/sys/eventfd.h deleted file mode 100644 index 8f8a518..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/eventfd.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2007-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_EVENTFD_H -#define _SYS_EVENTFD_H 1 - -#include - -/* Get the platform-dependent flags. */ -#include - -/* Type for event counter. */ -typedef uint64_t eventfd_t; - - -__BEGIN_DECLS - -/* Return file descriptor for generic event channel. Set initial - value to COUNT. */ -extern int eventfd (unsigned int __count, int __flags) __THROW; - -/* Read event counter and possibly wait for events. */ -extern int eventfd_read (int __fd, eventfd_t *__value); - -/* Increment event counter. */ -extern int eventfd_write (int __fd, eventfd_t __value); - -__END_DECLS - -#endif /* sys/eventfd.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/fanotify.h b/openflow/usr/include/arm-linux-gnueabihf/sys/fanotify.h deleted file mode 100644 index d79ef5e..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/fanotify.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2010-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_FANOTIFY_H -#define _SYS_FANOTIFY_H 1 - -#include -#include - - -__BEGIN_DECLS - -/* Create and initialize fanotify group. */ -extern int fanotify_init (unsigned int __flags, unsigned int __event_f_flags) - __THROW; - -/* Add, remove, or modify an fanotify mark on a filesystem object. */ -extern int fanotify_mark (int __fanotify_fd, unsigned int __flags, - uint64_t __mask, int __dfd, const char *__pathname) - __THROW; - -__END_DECLS - -#endif /* sys/fanotify.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/fcntl.h b/openflow/usr/include/arm-linux-gnueabihf/sys/fcntl.h deleted file mode 100644 index cd30455..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/fcntl.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/file.h b/openflow/usr/include/arm-linux-gnueabihf/sys/file.h deleted file mode 100644 index cd2a641..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/file.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_FILE_H -#define _SYS_FILE_H 1 - -#include - -#ifndef _FCNTL_H -# include -#endif - -__BEGIN_DECLS - - -/* Alternate names for values for the WHENCE argument to `lseek'. - These are the same as SEEK_SET, SEEK_CUR, and SEEK_END, respectively. */ -#ifndef L_SET -# define L_SET 0 /* Seek from beginning of file. */ -# define L_INCR 1 /* Seek from current position. */ -# define L_XTND 2 /* Seek from end of file. */ -#endif - - -/* Operations for the `flock' call. */ -#define LOCK_SH 1 /* Shared lock. */ -#define LOCK_EX 2 /* Exclusive lock. */ -#define LOCK_UN 8 /* Unlock. */ -#define __LOCK_ATOMIC 16 /* Atomic update. */ - -/* Can be OR'd in to one of the above. */ -#define LOCK_NB 4 /* Don't block when locking. */ - - -/* Apply or remove an advisory lock, according to OPERATION, - on the file FD refers to. */ -extern int flock (int __fd, int __operation) __THROW; - - -__END_DECLS - -#endif /* sys/file.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/fsuid.h b/openflow/usr/include/arm-linux-gnueabihf/sys/fsuid.h deleted file mode 100644 index ac7f286..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/fsuid.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_FSUID_H -#define _SYS_FSUID_H 1 - -#include -#include - -__BEGIN_DECLS - -/* Change uid used for file access control to UID, without affecting - other privileges (such as who can send signals at the process). */ -extern int setfsuid (__uid_t __uid) __THROW; - -/* Ditto for group id. */ -extern int setfsgid (__gid_t __gid) __THROW; - -__END_DECLS - -#endif /* fsuid.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/gmon.h b/openflow/usr/include/arm-linux-gnueabihf/sys/gmon.h deleted file mode 100644 index 5b430ab..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/gmon.h +++ /dev/null @@ -1,201 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)gmon.h 8.2 (Berkeley) 1/4/94 - */ - -#ifndef _SYS_GMON_H -#define _SYS_GMON_H 1 - -#include - -#include - -/* - * See gmon_out.h for gmon.out format. - */ - -/* structure emitted by "gcc -a". This must match struct bb in - gcc/libgcc2.c. It is OK for gcc to declare a longer structure as - long as the members below are present. */ -struct __bb -{ - long zero_word; - const char *filename; - long *counts; - long ncounts; - struct __bb *next; - const unsigned long *addresses; -}; - -extern struct __bb *__bb_head; - -/* - * histogram counters are unsigned shorts (according to the kernel). - */ -#define HISTCOUNTER unsigned short - -/* - * fraction of text space to allocate for histogram counters here, 1/2 - */ -#define HISTFRACTION 2 - -/* - * Fraction of text space to allocate for from hash buckets. - * The value of HASHFRACTION is based on the minimum number of bytes - * of separation between two subroutine call points in the object code. - * Given MIN_SUBR_SEPARATION bytes of separation the value of - * HASHFRACTION is calculated as: - * - * HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1); - * - * For example, on the VAX, the shortest two call sequence is: - * - * calls $0,(r0) - * calls $0,(r0) - * - * which is separated by only three bytes, thus HASHFRACTION is - * calculated as: - * - * HASHFRACTION = 3 / (2 * 2 - 1) = 1 - * - * Note that the division above rounds down, thus if MIN_SUBR_FRACTION - * is less than three, this algorithm will not work! - * - * In practice, however, call instructions are rarely at a minimal - * distance. Hence, we will define HASHFRACTION to be 2 across all - * architectures. This saves a reasonable amount of space for - * profiling data structures without (in practice) sacrificing - * any granularity. - */ -#define HASHFRACTION 2 - -/* - * Percent of text space to allocate for tostructs. - * This is a heuristic; we will fail with a warning when profiling programs - * with a very large number of very small functions, but that's - * normally OK. - * 2 is probably still a good value for normal programs. - * Profiling a test case with 64000 small functions will work if - * you raise this value to 3 and link statically (which bloats the - * text size, thus raising the number of arcs expected by the heuristic). - */ -#define ARCDENSITY 3 - -/* - * Always allocate at least this many tostructs. This - * hides the inadequacy of the ARCDENSITY heuristic, at least - * for small programs. - */ -#define MINARCS 50 - -/* - * The type used to represent indices into gmonparam.tos[]. - */ -#define ARCINDEX u_long - -/* - * Maximum number of arcs we want to allow. - * Used to be max representable value of ARCINDEX minus 2, but now - * that ARCINDEX is a long, that's too large; we don't really want - * to allow a 48 gigabyte table. - * The old value of 1<<16 wasn't high enough in practice for large C++ - * programs; will 1<<20 be adequate for long? FIXME - */ -#define MAXARCS (1 << 20) - -struct tostruct { - u_long selfpc; - long count; - ARCINDEX link; -}; - -/* - * a raw arc, with pointers to the calling site and - * the called site and a count. - */ -struct rawarc { - u_long raw_frompc; - u_long raw_selfpc; - long raw_count; -}; - -/* - * general rounding functions. - */ -#define ROUNDDOWN(x,y) (((x)/(y))*(y)) -#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y)) - -/* - * The profiling data structures are housed in this structure. - */ -struct gmonparam { - long int state; - u_short *kcount; - u_long kcountsize; - ARCINDEX *froms; - u_long fromssize; - struct tostruct *tos; - u_long tossize; - long tolimit; - u_long lowpc; - u_long highpc; - u_long textsize; - u_long hashfraction; - long log_hashfraction; -}; - -/* - * Possible states of profiling. - */ -#define GMON_PROF_ON 0 -#define GMON_PROF_BUSY 1 -#define GMON_PROF_ERROR 2 -#define GMON_PROF_OFF 3 - -/* - * Sysctl definitions for extracting profiling information from the kernel. - */ -#define GPROF_STATE 0 /* int: profiling enabling variable */ -#define GPROF_COUNT 1 /* struct: profile tick count buffer */ -#define GPROF_FROMS 2 /* struct: from location hash bucket */ -#define GPROF_TOS 3 /* struct: destination/count structure */ -#define GPROF_GMONPARAM 4 /* struct: profiling parameters (see above) */ - -__BEGIN_DECLS - -/* Set up data structures and start profiling. */ -extern void __monstartup (u_long __lowpc, u_long __highpc) __THROW; -extern void monstartup (u_long __lowpc, u_long __highpc) __THROW; - -/* Clean up profiling and write out gmon.out. */ -extern void _mcleanup (void) __THROW; - -__END_DECLS - -#endif /* sys/gmon.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/gmon_out.h b/openflow/usr/include/arm-linux-gnueabihf/sys/gmon_out.h deleted file mode 100644 index b948799..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/gmon_out.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by David Mosberger . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* This file specifies the format of gmon.out files. It should have - as few external dependencies as possible as it is going to be included - in many different programs. That is, minimize the number of #include's. - - A gmon.out file consists of a header (defined by gmon_hdr) followed by - a sequence of records. Each record starts with a one-byte tag - identifying the type of records, followed by records specific data. */ - -#ifndef _SYS_GMON_OUT_H -#define _SYS_GMON_OUT_H 1 - -#include - -#define GMON_MAGIC "gmon" /* magic cookie */ -#define GMON_VERSION 1 /* version number */ - -/* For profiling shared object we need a new format. */ -#define GMON_SHOBJ_VERSION 0x1ffff - -__BEGIN_DECLS - -/* - * Raw header as it appears on file (without padding). This header - * always comes first in gmon.out and is then followed by a series - * records defined below. - */ -struct gmon_hdr - { - char cookie[4]; - char version[4]; - char spare[3 * 4]; - }; - -/* types of records in this file: */ -typedef enum - { - GMON_TAG_TIME_HIST = 0, - GMON_TAG_CG_ARC = 1, - GMON_TAG_BB_COUNT = 2 - } GMON_Record_Tag; - -struct gmon_hist_hdr - { - char low_pc[sizeof (char *)]; /* base pc address of sample buffer */ - char high_pc[sizeof (char *)]; /* max pc address of sampled buffer */ - char hist_size[4]; /* size of sample buffer */ - char prof_rate[4]; /* profiling clock rate */ - char dimen[15]; /* phys. dim., usually "seconds" */ - char dimen_abbrev; /* usually 's' for "seconds" */ - }; - -struct gmon_cg_arc_record - { - char from_pc[sizeof (char *)]; /* address within caller's body */ - char self_pc[sizeof (char *)]; /* address within callee's body */ - char count[4]; /* number of arc traversals */ - }; - -__END_DECLS - -#endif /* sys/gmon_out.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/inotify.h b/openflow/usr/include/arm-linux-gnueabihf/sys/inotify.h deleted file mode 100644 index e42dba0..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/inotify.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Copyright (C) 2005-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_INOTIFY_H -#define _SYS_INOTIFY_H 1 - -#include - -/* Get the platform-dependent flags. */ -#include - - -/* Structure describing an inotify event. */ -struct inotify_event -{ - int wd; /* Watch descriptor. */ - uint32_t mask; /* Watch mask. */ - uint32_t cookie; /* Cookie to synchronize two events. */ - uint32_t len; /* Length (including NULs) of name. */ - char name __flexarr; /* Name. */ -}; - - -/* Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH. */ -#define IN_ACCESS 0x00000001 /* File was accessed. */ -#define IN_MODIFY 0x00000002 /* File was modified. */ -#define IN_ATTRIB 0x00000004 /* Metadata changed. */ -#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed. */ -#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed. */ -#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */ -#define IN_OPEN 0x00000020 /* File was opened. */ -#define IN_MOVED_FROM 0x00000040 /* File was moved from X. */ -#define IN_MOVED_TO 0x00000080 /* File was moved to Y. */ -#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */ -#define IN_CREATE 0x00000100 /* Subfile was created. */ -#define IN_DELETE 0x00000200 /* Subfile was deleted. */ -#define IN_DELETE_SELF 0x00000400 /* Self was deleted. */ -#define IN_MOVE_SELF 0x00000800 /* Self was moved. */ - -/* Events sent by the kernel. */ -#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted. */ -#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed. */ -#define IN_IGNORED 0x00008000 /* File was ignored. */ - -/* Helper events. */ -#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */ -#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */ - -/* Special flags. */ -#define IN_ONLYDIR 0x01000000 /* Only watch the path if it is a - directory. */ -#define IN_DONT_FOLLOW 0x02000000 /* Do not follow a sym link. */ -#define IN_EXCL_UNLINK 0x04000000 /* Exclude events on unlinked - objects. */ -#define IN_MASK_ADD 0x20000000 /* Add to the mask of an already - existing watch. */ -#define IN_ISDIR 0x40000000 /* Event occurred against dir. */ -#define IN_ONESHOT 0x80000000 /* Only send event once. */ - -/* All events which a program can wait on. */ -#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE \ - | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM \ - | IN_MOVED_TO | IN_CREATE | IN_DELETE \ - | IN_DELETE_SELF | IN_MOVE_SELF) - - -__BEGIN_DECLS - -/* Create and initialize inotify instance. */ -extern int inotify_init (void) __THROW; - -/* Create and initialize inotify instance. */ -extern int inotify_init1 (int __flags) __THROW; - -/* Add watch of object NAME to inotify instance FD. Notify about - events specified by MASK. */ -extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask) - __THROW; - -/* Remove the watch specified by WD from the inotify instance FD. */ -extern int inotify_rm_watch (int __fd, int __wd) __THROW; - -__END_DECLS - -#endif /* sys/inotify.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/io.h b/openflow/usr/include/arm-linux-gnueabihf/sys/io.h deleted file mode 100644 index 9b585b9..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/io.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _SYS_IO_H - -#define _SYS_IO_H 1 -#include - -__BEGIN_DECLS - -/* If TURN_ON is TRUE, request for permission to do direct i/o on the - port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O - permission off for that range. This call requires root privileges. */ -extern int ioperm (unsigned long int __from, unsigned long int __num, - int __turn_on) __THROW; - -/* Set the I/O privilege level to LEVEL. If LEVEL is nonzero, - permission to access any I/O port is granted. This call requires - root privileges. */ -extern int iopl (int __level) __THROW; - -/* The functions that actually perform reads and writes. */ -extern unsigned char inb (unsigned long int __port) __THROW; -extern unsigned short int inw (unsigned long int __port) __THROW; -extern unsigned long int inl (unsigned long int __port) __THROW; - -extern void outb (unsigned char __value, unsigned long int __port) __THROW; -extern void outw (unsigned short __value, unsigned long int __port) __THROW; -extern void outl (unsigned long __value, unsigned long int __port) __THROW; - -__END_DECLS - -#endif /* _SYS_IO_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/ioctl.h b/openflow/usr/include/arm-linux-gnueabihf/sys/ioctl.h deleted file mode 100644 index 4bc5a1a..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/ioctl.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_IOCTL_H -#define _SYS_IOCTL_H 1 - -#include - -__BEGIN_DECLS - -/* Get the list of `ioctl' requests and related constants. */ -#include - -/* Define some types used by `ioctl' requests. */ -#include - -/* On a Unix system, the system probably defines some of - the symbols we define in (usually with the same - values). The code to generate has omitted these - symbols to avoid the conflict, but a Unix program expects - to define them, so we must include here. */ -#include - -/* Perform the I/O control operation specified by REQUEST on FD. - One argument may follow; its presence and type depend on REQUEST. - Return value depends on REQUEST. Usually -1 indicates error. */ -extern int ioctl (int __fd, unsigned long int __request, ...) __THROW; - -__END_DECLS - -#endif /* sys/ioctl.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/ipc.h b/openflow/usr/include/arm-linux-gnueabihf/sys/ipc.h deleted file mode 100644 index 70bd7a6..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/ipc.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_IPC_H -#define _SYS_IPC_H 1 - -#include - -#if !defined __USE_MISC && !defined __USE_XOPEN && __GNUC__ >= 2 -# warning "Files using this header must be compiled with _GNU_SOURCE or _XOPEN_SOURCE" -#endif - -/* Get system dependent definition of `struct ipc_perm' and more. */ -#include -#include - -#ifndef __uid_t_defined -typedef __uid_t uid_t; -# define __uid_t_defined -#endif - -#ifndef __gid_t_defined -typedef __gid_t gid_t; -# define __gid_t_defined -#endif - -#ifndef __mode_t_defined -typedef __mode_t mode_t; -# define __mode_t_defined -#endif - -#ifndef __key_t_defined -typedef __key_t key_t; -# define __key_t_defined -#endif - -__BEGIN_DECLS - -/* Generates key for System V style IPC. */ -extern key_t ftok (const char *__pathname, int __proj_id) __THROW; - -__END_DECLS - -#endif /* sys/ipc.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/kd.h b/openflow/usr/include/arm-linux-gnueabihf/sys/kd.h deleted file mode 100644 index bb20603..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/kd.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_KD_H -#define _SYS_KD_H 1 - -/* Make sure the header is not loaded. */ -#ifndef _LINUX_TYPES_H -# define _LINUX_TYPES_H 1 -# define __undef_LINUX_TYPES_H -#endif - -#include - -#ifdef __undef_LINUX_TYPES_H -# undef _LINUX_TYPES_H -# undef __undef_LINUX_TYPES_H -#endif - -#endif /* sys/kd.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/klog.h b/openflow/usr/include/arm-linux-gnueabihf/sys/klog.h deleted file mode 100644 index 21c3950..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/klog.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_KLOG_H - -#define _SYS_KLOG_H 1 -#include - -__BEGIN_DECLS - -/* Control the kernel's logging facility. This corresponds exactly to - the kernel's syslog system call, but that name is easily confused - with the user-level syslog facility, which is something completely - different. */ -extern int klogctl (int __type, char *__bufp, int __len) __THROW; - -__END_DECLS - -#endif /* _SYS_KLOG_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/mman.h b/openflow/usr/include/arm-linux-gnueabihf/sys/mman.h deleted file mode 100644 index a7879ea..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/mman.h +++ /dev/null @@ -1,151 +0,0 @@ -/* Definitions for BSD-style memory management. - Copyright (C) 1994-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_MMAN_H -#define _SYS_MMAN_H 1 - -#include -#include -#define __need_size_t -#include - -#ifndef __off_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __off_t off_t; -# else -typedef __off64_t off_t; -# endif -# define __off_t_defined -#endif - -#ifndef __mode_t_defined -typedef __mode_t mode_t; -# define __mode_t_defined -#endif - -#include - -/* Return value of `mmap' in case of an error. */ -#define MAP_FAILED ((void *) -1) - -__BEGIN_DECLS -/* Map addresses starting near ADDR and extending for LEN bytes. from - OFFSET into the file FD describes according to PROT and FLAGS. If ADDR - is nonzero, it is the desired mapping address. If the MAP_FIXED bit is - set in FLAGS, the mapping will be at ADDR exactly (which must be - page-aligned); otherwise the system chooses a convenient nearby address. - The return value is the actual mapping address chosen or MAP_FAILED - for errors (in which case `errno' is set). A successful `mmap' call - deallocates any previous mapping for the affected region. */ - -#ifndef __USE_FILE_OFFSET64 -extern void *mmap (void *__addr, size_t __len, int __prot, - int __flags, int __fd, __off_t __offset) __THROW; -#else -# ifdef __REDIRECT_NTH -extern void * __REDIRECT_NTH (mmap, - (void *__addr, size_t __len, int __prot, - int __flags, int __fd, __off64_t __offset), - mmap64); -# else -# define mmap mmap64 -# endif -#endif -#ifdef __USE_LARGEFILE64 -extern void *mmap64 (void *__addr, size_t __len, int __prot, - int __flags, int __fd, __off64_t __offset) __THROW; -#endif - -/* Deallocate any mapping for the region starting at ADDR and extending LEN - bytes. Returns 0 if successful, -1 for errors (and sets errno). */ -extern int munmap (void *__addr, size_t __len) __THROW; - -/* Change the memory protection of the region starting at ADDR and - extending LEN bytes to PROT. Returns 0 if successful, -1 for errors - (and sets errno). */ -extern int mprotect (void *__addr, size_t __len, int __prot) __THROW; - -/* Synchronize the region starting at ADDR and extending LEN bytes with the - file it maps. Filesystem operations on a file being mapped are - unpredictable before this is done. Flags are from the MS_* set. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int msync (void *__addr, size_t __len, int __flags); - -#ifdef __USE_MISC -/* Advise the system about particular usage patterns the program follows - for the region starting at ADDR and extending LEN bytes. */ -extern int madvise (void *__addr, size_t __len, int __advice) __THROW; -#endif -#ifdef __USE_XOPEN2K -/* This is the POSIX name for this function. */ -extern int posix_madvise (void *__addr, size_t __len, int __advice) __THROW; -#endif - -/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to - be memory resident. */ -extern int mlock (const void *__addr, size_t __len) __THROW; - -/* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). */ -extern int munlock (const void *__addr, size_t __len) __THROW; - -/* Cause all currently mapped pages of the process to be memory resident - until unlocked by a call to the `munlockall', until the process exits, - or until the process calls `execve'. */ -extern int mlockall (int __flags) __THROW; - -/* All currently mapped pages of the process' address space become - unlocked. */ -extern int munlockall (void) __THROW; - -#ifdef __USE_MISC -/* mincore returns the memory residency status of the pages in the - current process's address space specified by [start, start + len). - The status is returned in a vector of bytes. The least significant - bit of each byte is 1 if the referenced page is in memory, otherwise - it is zero. */ -extern int mincore (void *__start, size_t __len, unsigned char *__vec) - __THROW; -#endif - -#ifdef __USE_GNU -/* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length - NEW_LEN. If MREMAP_MAYMOVE is set in FLAGS the returned address - may differ from ADDR. If MREMAP_FIXED is set in FLAGS the function - takes another parameter which is a fixed address at which the block - resides after a successful call. */ -extern void *mremap (void *__addr, size_t __old_len, size_t __new_len, - int __flags, ...) __THROW; - -/* Remap arbitrary pages of a shared backing store within an existing - VMA. */ -extern int remap_file_pages (void *__start, size_t __size, int __prot, - size_t __pgoff, int __flags) __THROW; -#endif - - -/* Open shared memory segment. */ -extern int shm_open (const char *__name, int __oflag, mode_t __mode); - -/* Remove shared memory segment. */ -extern int shm_unlink (const char *__name); - -__END_DECLS - -#endif /* sys/mman.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/mount.h b/openflow/usr/include/arm-linux-gnueabihf/sys/mount.h deleted file mode 100644 index 3b667ed..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/mount.h +++ /dev/null @@ -1,150 +0,0 @@ -/* Header file for mounting/unmount Linux filesystems. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* This is taken from /usr/include/linux/fs.h. */ - -#ifndef _SYS_MOUNT_H -#define _SYS_MOUNT_H 1 - -#include -#include - -#define BLOCK_SIZE 1024 -#define BLOCK_SIZE_BITS 10 - - -/* These are the fs-independent mount-flags: up to 16 flags are - supported */ -enum -{ - MS_RDONLY = 1, /* Mount read-only. */ -#define MS_RDONLY MS_RDONLY - MS_NOSUID = 2, /* Ignore suid and sgid bits. */ -#define MS_NOSUID MS_NOSUID - MS_NODEV = 4, /* Disallow access to device special files. */ -#define MS_NODEV MS_NODEV - MS_NOEXEC = 8, /* Disallow program execution. */ -#define MS_NOEXEC MS_NOEXEC - MS_SYNCHRONOUS = 16, /* Writes are synced at once. */ -#define MS_SYNCHRONOUS MS_SYNCHRONOUS - MS_REMOUNT = 32, /* Alter flags of a mounted FS. */ -#define MS_REMOUNT MS_REMOUNT - MS_MANDLOCK = 64, /* Allow mandatory locks on an FS. */ -#define MS_MANDLOCK MS_MANDLOCK - MS_DIRSYNC = 128, /* Directory modifications are synchronous. */ -#define MS_DIRSYNC MS_DIRSYNC - MS_NOATIME = 1024, /* Do not update access times. */ -#define MS_NOATIME MS_NOATIME - MS_NODIRATIME = 2048, /* Do not update directory access times. */ -#define MS_NODIRATIME MS_NODIRATIME - MS_BIND = 4096, /* Bind directory at different place. */ -#define MS_BIND MS_BIND - MS_MOVE = 8192, -#define MS_MOVE MS_MOVE - MS_REC = 16384, -#define MS_REC MS_REC - MS_SILENT = 32768, -#define MS_SILENT MS_SILENT - MS_POSIXACL = 1 << 16, /* VFS does not apply the umask. */ -#define MS_POSIXACL MS_POSIXACL - MS_UNBINDABLE = 1 << 17, /* Change to unbindable. */ -#define MS_UNBINDABLE MS_UNBINDABLE - MS_PRIVATE = 1 << 18, /* Change to private. */ -#define MS_PRIVATE MS_PRIVATE - MS_SLAVE = 1 << 19, /* Change to slave. */ -#define MS_SLAVE MS_SLAVE - MS_SHARED = 1 << 20, /* Change to shared. */ -#define MS_SHARED MS_SHARED - MS_RELATIME = 1 << 21, /* Update atime relative to mtime/ctime. */ -#define MS_RELATIME MS_RELATIME - MS_KERNMOUNT = 1 << 22, /* This is a kern_mount call. */ -#define MS_KERNMOUNT MS_KERNMOUNT - MS_I_VERSION = 1 << 23, /* Update inode I_version field. */ -#define MS_I_VERSION MS_I_VERSION - MS_STRICTATIME = 1 << 24, /* Always perform atime updates. */ -#define MS_STRICTATIME MS_STRICTATIME - MS_LAZYTIME = 1 << 25, /* Update the on-disk [acm]times lazily. */ -#define MS_LAZYTIME MS_LAZYTIME - MS_ACTIVE = 1 << 30, -#define MS_ACTIVE MS_ACTIVE - MS_NOUSER = 1 << 31 -#define MS_NOUSER MS_NOUSER -}; - -/* Flags that can be altered by MS_REMOUNT */ -#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION \ - |MS_LAZYTIME) - - -/* Magic mount flag number. Has to be or-ed to the flag values. */ - -#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number to indicate "new" flags */ -#define MS_MGC_MSK 0xffff0000 /* Magic flag number mask */ - - -/* The read-only stuff doesn't really belong here, but any other place - is probably as bad and I don't want to create yet another include - file. */ - -#define BLKROSET _IO(0x12, 93) /* Set device read-only (0 = read-write). */ -#define BLKROGET _IO(0x12, 94) /* Get read-only status (0 = read_write). */ -#define BLKRRPART _IO(0x12, 95) /* Re-read partition table. */ -#define BLKGETSIZE _IO(0x12, 96) /* Return device size. */ -#define BLKFLSBUF _IO(0x12, 97) /* Flush buffer cache. */ -#define BLKRASET _IO(0x12, 98) /* Set read ahead for block device. */ -#define BLKRAGET _IO(0x12, 99) /* Get current read ahead setting. */ -#define BLKFRASET _IO(0x12,100) /* Set filesystem read-ahead. */ -#define BLKFRAGET _IO(0x12,101) /* Get filesystem read-ahead. */ -#define BLKSECTSET _IO(0x12,102) /* Set max sectors per request. */ -#define BLKSECTGET _IO(0x12,103) /* Get max sectors per request. */ -#define BLKSSZGET _IO(0x12,104) /* Get block device sector size. */ -#define BLKBSZGET _IOR(0x12,112,size_t) -#define BLKBSZSET _IOW(0x12,113,size_t) -#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size. */ - - -/* Possible value for FLAGS parameter of `umount2'. */ -enum -{ - MNT_FORCE = 1, /* Force unmounting. */ -#define MNT_FORCE MNT_FORCE - MNT_DETACH = 2, /* Just detach from the tree. */ -#define MNT_DETACH MNT_DETACH - MNT_EXPIRE = 4, /* Mark for expiry. */ -#define MNT_EXPIRE MNT_EXPIRE - UMOUNT_NOFOLLOW = 8 /* Don't follow symlink on umount. */ -#define UMOUNT_NOFOLLOW UMOUNT_NOFOLLOW -}; - - -__BEGIN_DECLS - -/* Mount a filesystem. */ -extern int mount (const char *__special_file, const char *__dir, - const char *__fstype, unsigned long int __rwflag, - const void *__data) __THROW; - -/* Unmount a filesystem. */ -extern int umount (const char *__special_file) __THROW; - -/* Unmount a filesystem. Force unmounting if FLAGS is set to MNT_FORCE. */ -extern int umount2 (const char *__special_file, int __flags) __THROW; - -__END_DECLS - -#endif /* _SYS_MOUNT_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/msg.h b/openflow/usr/include/arm-linux-gnueabihf/sys/msg.h deleted file mode 100644 index 4dc559f..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/msg.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_MSG_H -#define _SYS_MSG_H - -#include - -#define __need_size_t -#include - -/* Get common definition of System V style IPC. */ -#include - -/* Get system dependent definition of `struct msqid_ds' and more. */ -#include - -/* Define types required by the standard. */ -#define __need_time_t -#include - -#ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -#endif - -#ifndef __ssize_t_defined -typedef __ssize_t ssize_t; -# define __ssize_t_defined -#endif - -/* The following System V style IPC functions implement a message queue - system. The definition is found in XPG2. */ - -#ifdef __USE_GNU -/* Template for struct to be used as argument for `msgsnd' and `msgrcv'. */ -struct msgbuf - { - __syscall_slong_t mtype; /* type of received/sent message */ - char mtext[1]; /* text of the message */ - }; -#endif - - -__BEGIN_DECLS - -/* Message queue control operation. */ -extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW; - -/* Get messages queue. */ -extern int msgget (key_t __key, int __msgflg) __THROW; - -/* Receive message from message queue. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t msgrcv (int __msqid, void *__msgp, size_t __msgsz, - long int __msgtyp, int __msgflg); - -/* Send message to message queue. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int msgsnd (int __msqid, const void *__msgp, size_t __msgsz, - int __msgflg); - -__END_DECLS - -#endif /* sys/msg.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/mtio.h b/openflow/usr/include/arm-linux-gnueabihf/sys/mtio.h deleted file mode 100644 index 3d175ae..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/mtio.h +++ /dev/null @@ -1,276 +0,0 @@ -/* Structures and definitions for magnetic tape I/O control commands. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Written by H. Bergman . */ - -#ifndef _SYS_MTIO_H -#define _SYS_MTIO_H 1 - -/* Get necessary definitions from system and kernel headers. */ -#include -#include - - -/* Structure for MTIOCTOP - magnetic tape operation command. */ -struct mtop - { - short int mt_op; /* Operations defined below. */ - int mt_count; /* How many of them. */ - }; -#define _IOT_mtop /* Hurd ioctl type field. */ \ - _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0) - -/* Magnetic Tape operations [Not all operations supported by all drivers]. */ -#define MTRESET 0 /* +reset drive in case of problems. */ -#define MTFSF 1 /* Forward space over FileMark, - * position at first record of next file. */ -#define MTBSF 2 /* Backward space FileMark (position before FM). */ -#define MTFSR 3 /* Forward space record. */ -#define MTBSR 4 /* Backward space record. */ -#define MTWEOF 5 /* Write an end-of-file record (mark). */ -#define MTREW 6 /* Rewind. */ -#define MTOFFL 7 /* Rewind and put the drive offline (eject?). */ -#define MTNOP 8 /* No op, set status only (read with MTIOCGET). */ -#define MTRETEN 9 /* Retension tape. */ -#define MTBSFM 10 /* +backward space FileMark, position at FM. */ -#define MTFSFM 11 /* +forward space FileMark, position at FM. */ -#define MTEOM 12 /* Goto end of recorded media (for appending files). - MTEOM positions after the last FM, ready for - appending another file. */ -#define MTERASE 13 /* Erase tape -- be careful! */ - -#define MTRAS1 14 /* Run self test 1 (nondestructive). */ -#define MTRAS2 15 /* Run self test 2 (destructive). */ -#define MTRAS3 16 /* Reserved for self test 3. */ - -#define MTSETBLK 20 /* Set block length (SCSI). */ -#define MTSETDENSITY 21 /* Set tape density (SCSI). */ -#define MTSEEK 22 /* Seek to block (Tandberg, etc.). */ -#define MTTELL 23 /* Tell block (Tandberg, etc.). */ -#define MTSETDRVBUFFER 24 /* Set the drive buffering according to SCSI-2. - Ordinary buffered operation with code 1. */ -#define MTFSS 25 /* Space forward over setmarks. */ -#define MTBSS 26 /* Space backward over setmarks. */ -#define MTWSM 27 /* Write setmarks. */ - -#define MTLOCK 28 /* Lock the drive door. */ -#define MTUNLOCK 29 /* Unlock the drive door. */ -#define MTLOAD 30 /* Execute the SCSI load command. */ -#define MTUNLOAD 31 /* Execute the SCSI unload command. */ -#define MTCOMPRESSION 32/* Control compression with SCSI mode page 15. */ -#define MTSETPART 33 /* Change the active tape partition. */ -#define MTMKPART 34 /* Format the tape with one or two partitions. */ - -/* structure for MTIOCGET - mag tape get status command */ - -struct mtget - { - long int mt_type; /* Type of magtape device. */ - long int mt_resid; /* Residual count: (not sure) - number of bytes ignored, or - number of files not skipped, or - number of records not skipped. */ - /* The following registers are device dependent. */ - long int mt_dsreg; /* Status register. */ - long int mt_gstat; /* Generic (device independent) status. */ - long int mt_erreg; /* Error register. */ - /* The next two fields are not always used. */ - __daddr_t mt_fileno; /* Number of current file on tape. */ - __daddr_t mt_blkno; /* Current block number. */ - }; -#define _IOT_mtget /* Hurd ioctl type field. */ \ - _IOT (_IOTS (long), 7, 0, 0, 0, 0) - - -/* Constants for mt_type. Not all of these are supported, and - these are not all of the ones that are supported. */ -#define MT_ISUNKNOWN 0x01 -#define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer. */ -#define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02. */ -#define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02?. */ -#define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?). */ -#define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24. */ -#define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02. */ -#define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L. */ -#define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L. */ -#define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller. */ -#define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features. */ -#define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24. */ -#define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, - Teac DC-1 card (Wangtek type). */ -#define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40). */ -#define MT_ISDDS1 0x51 /* DDS device without partitions. */ -#define MT_ISDDS2 0x52 /* DDS device with partitions. */ -#define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit. */ -#define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit. */ - -/* QIC-40/80/3010/3020 ftape supported drives. - 20bit vendor ID + 0x800000 (see vendors.h in ftape distribution). */ -#define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */ -#define MT_ISFTAPE_FLAG 0x800000 - -struct mt_tape_info - { - long int t_type; /* Device type id (mt_type). */ - char *t_name; /* Descriptive name. */ - }; - -#define MT_TAPE_INFO \ - { \ - {MT_ISUNKNOWN, "Unknown type of tape device"}, \ - {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \ - {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \ - {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \ - {MT_ISCMSJ500, "CMS Jumbo 500"}, \ - {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \ - {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \ - {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \ - {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \ - {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \ - {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \ - {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \ - {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \ - {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \ - {MT_ISSCSI1, "Generic SCSI-1 tape"}, \ - {MT_ISSCSI2, "Generic SCSI-2 tape"}, \ - {0, NULL} \ - } - - -/* Structure for MTIOCPOS - mag tape get position command. */ - -struct mtpos - { - long int mt_blkno; /* Current block number. */ - }; -#define _IOT_mtpos /* Hurd ioctl type field. */ \ - _IOT_SIMPLE (long) - - -/* Structure for MTIOCGETCONFIG/MTIOCSETCONFIG primarily intended - as an interim solution for QIC-02 until DDI is fully implemented. */ -struct mtconfiginfo - { - long int mt_type; /* Drive type. */ - long int ifc_type; /* Interface card type. */ - unsigned short int irqnr; /* IRQ number to use. */ - unsigned short int dmanr; /* DMA channel to use. */ - unsigned short int port; /* IO port base address. */ - - unsigned long int debug; /* Debugging flags. */ - - unsigned have_dens:1; - unsigned have_bsf:1; - unsigned have_fsr:1; - unsigned have_bsr:1; - unsigned have_eod:1; - unsigned have_seek:1; - unsigned have_tell:1; - unsigned have_ras1:1; - unsigned have_ras2:1; - unsigned have_ras3:1; - unsigned have_qfa:1; - - unsigned pad1:5; - char reserved[10]; - }; -#define _IOT_mtconfiginfo /* Hurd ioctl type field. */ \ - _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1) /* XXX wrong */ - - -/* Magnetic tape I/O control commands. */ -#define MTIOCTOP _IOW('m', 1, struct mtop) /* Do a mag tape op. */ -#define MTIOCGET _IOR('m', 2, struct mtget) /* Get tape status. */ -#define MTIOCPOS _IOR('m', 3, struct mtpos) /* Get tape position.*/ - -/* The next two are used by the QIC-02 driver for runtime reconfiguration. - See tpqic02.h for struct mtconfiginfo. */ -#define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) /* Get tape config.*/ -#define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) /* Set tape config.*/ - -/* Generic Mag Tape (device independent) status macros for examining - mt_gstat -- HP-UX compatible. - There is room for more generic status bits here, but I don't - know which of them are reserved. At least three or so should - be added to make this really useful. */ -#define GMT_EOF(x) ((x) & 0x80000000) -#define GMT_BOT(x) ((x) & 0x40000000) -#define GMT_EOT(x) ((x) & 0x20000000) -#define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */ -#define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */ -#define GMT_WR_PROT(x) ((x) & 0x04000000) -/* #define GMT_ ? ((x) & 0x02000000) */ -#define GMT_ONLINE(x) ((x) & 0x01000000) -#define GMT_D_6250(x) ((x) & 0x00800000) -#define GMT_D_1600(x) ((x) & 0x00400000) -#define GMT_D_800(x) ((x) & 0x00200000) -/* #define GMT_ ? ((x) & 0x00100000) */ -/* #define GMT_ ? ((x) & 0x00080000) */ -#define GMT_DR_OPEN(x) ((x) & 0x00040000) /* Door open (no tape). */ -/* #define GMT_ ? ((x) & 0x00020000) */ -#define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* Immediate report mode.*/ -/* 16 generic status bits unused. */ - - -/* SCSI-tape specific definitions. Bitfield shifts in the status */ -#define MT_ST_BLKSIZE_SHIFT 0 -#define MT_ST_BLKSIZE_MASK 0xffffff -#define MT_ST_DENSITY_SHIFT 24 -#define MT_ST_DENSITY_MASK 0xff000000 - -#define MT_ST_SOFTERR_SHIFT 0 -#define MT_ST_SOFTERR_MASK 0xffff - -/* Bitfields for the MTSETDRVBUFFER ioctl. */ -#define MT_ST_OPTIONS 0xf0000000 -#define MT_ST_BOOLEANS 0x10000000 -#define MT_ST_SETBOOLEANS 0x30000000 -#define MT_ST_CLEARBOOLEANS 0x40000000 -#define MT_ST_WRITE_THRESHOLD 0x20000000 -#define MT_ST_DEF_BLKSIZE 0x50000000 -#define MT_ST_DEF_OPTIONS 0x60000000 - -#define MT_ST_BUFFER_WRITES 0x1 -#define MT_ST_ASYNC_WRITES 0x2 -#define MT_ST_READ_AHEAD 0x4 -#define MT_ST_DEBUGGING 0x8 -#define MT_ST_TWO_FM 0x10 -#define MT_ST_FAST_MTEOM 0x20 -#define MT_ST_AUTO_LOCK 0x40 -#define MT_ST_DEF_WRITES 0x80 -#define MT_ST_CAN_BSR 0x100 -#define MT_ST_NO_BLKLIMS 0x200 -#define MT_ST_CAN_PARTITIONS 0x400 -#define MT_ST_SCSI2LOGICAL 0x800 - -/* The mode parameters to be controlled. Parameter chosen with bits 20-28. */ -#define MT_ST_CLEAR_DEFAULT 0xfffff -#define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) -#define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) -#define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) - -/* The offset for the arguments for the special HP changer load command. */ -#define MT_ST_HPLOADER_OFFSET 10000 - - -/* Specify default tape device. */ -#ifndef DEFTAPE -# define DEFTAPE "/dev/tape" -#endif - -#endif /* mtio.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/param.h b/openflow/usr/include/arm-linux-gnueabihf/sys/param.h deleted file mode 100644 index 7e0e331..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/param.h +++ /dev/null @@ -1,106 +0,0 @@ -/* Compatibility header for old-style Unix parameters and limits. - Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_PARAM_H -#define _SYS_PARAM_H 1 - -#define __need_NULL -#include - -#include -#include -#include /* Define BYTE_ORDER et al. */ -#include /* Define NSIG. */ - -/* This file defines some things in system-specific ways. */ -#include - - -/* BSD names for some values. */ - -#define NBBY CHAR_BIT - -#if !defined NGROUPS && defined NGROUPS_MAX -# define NGROUPS NGROUPS_MAX -#endif -#if !defined MAXSYMLINKS && defined SYMLOOP_MAX -# define MAXSYMLINKS SYMLOOP_MAX -#endif -#if !defined CANBSIZ && defined MAX_CANON -# define CANBSIZ MAX_CANON -#endif -#if !defined MAXPATHLEN && defined PATH_MAX -# define MAXPATHLEN PATH_MAX -#endif -#if !defined NOFILE && defined OPEN_MAX -# define NOFILE OPEN_MAX -#endif -#if !defined MAXHOSTNAMELEN && defined HOST_NAME_MAX -# define MAXHOSTNAMELEN HOST_NAME_MAX -#endif -#ifndef NCARGS -# ifdef ARG_MAX -# define NCARGS ARG_MAX -# else -/* ARG_MAX is unlimited, but we define NCARGS for BSD programs that want to - compare against some fixed limit. */ -# define NCARGS INT_MAX -# endif -#endif - - -/* Magical constants. */ -#ifndef NOGROUP -# define NOGROUP 65535 /* Marker for empty group set member. */ -#endif -#ifndef NODEV -# define NODEV ((dev_t) -1) /* Non-existent device. */ -#endif - - -/* Unit of `st_blocks'. */ -#ifndef DEV_BSIZE -# define DEV_BSIZE 512 -#endif - - -/* Bit map related macros. */ -#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) -#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) -#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) -#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) - -/* Macros for counting and rounding. */ -#ifndef howmany -# define howmany(x, y) (((x) + ((y) - 1)) / (y)) -#endif -#ifdef __GNUC__ -# define roundup(x, y) (__builtin_constant_p (y) && powerof2 (y) \ - ? (((x) + (y) - 1) & ~((y) - 1)) \ - : ((((x) + ((y) - 1)) / (y)) * (y))) -#else -# define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) -#endif -#define powerof2(x) ((((x) - 1) & (x)) == 0) - -/* Macros for min/max. */ -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) - - -#endif /* sys/param.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/pci.h b/openflow/usr/include/arm-linux-gnueabihf/sys/pci.h deleted file mode 100644 index 331f2e1..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/pci.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_PCI_H -#define _SYS_PCI_H 1 - -/* We use the constants from the kernel. */ -#include - -#endif /* sys/pci.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/personality.h b/openflow/usr/include/arm-linux-gnueabihf/sys/personality.h deleted file mode 100644 index ad2258f..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/personality.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Taken verbatim from Linux 2.6 (include/linux/personality.h). */ - -#ifndef _SYS_PERSONALITY_H -#define _SYS_PERSONALITY_H 1 - -#include - -/* Flags for bug emulation. - These occupy the top three bytes. */ -enum - { - UNAME26 = 0x0020000, - ADDR_NO_RANDOMIZE = 0x0040000, - FDPIC_FUNCPTRS = 0x0080000, - MMAP_PAGE_ZERO = 0x0100000, - ADDR_COMPAT_LAYOUT = 0x0200000, - READ_IMPLIES_EXEC = 0x0400000, - ADDR_LIMIT_32BIT = 0x0800000, - SHORT_INODE = 0x1000000, - WHOLE_SECONDS = 0x2000000, - STICKY_TIMEOUTS = 0x4000000, - ADDR_LIMIT_3GB = 0x8000000 - }; - -/* Personality types. - - These go in the low byte. Avoid using the top bit, it will - conflict with error returns. */ -enum - { - PER_LINUX = 0x0000, - PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT, - PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS, - PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, - PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE, - PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE, - PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS, - PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE, - PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS, - PER_BSD = 0x0006, - PER_SUNOS = 0x0006 | STICKY_TIMEOUTS, - PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE, - PER_LINUX32 = 0x0008, - PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB, - PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS, /* IRIX5 32-bit */ - PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS, /* IRIX6 new 32-bit */ - PER_IRIX64 = 0x000b | STICKY_TIMEOUTS, /* IRIX6 64-bit */ - PER_RISCOS = 0x000c, - PER_SOLARIS = 0x000d | STICKY_TIMEOUTS, - PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, - PER_OSF4 = 0x000f, - PER_HPUX = 0x0010, - PER_MASK = 0x00ff, - }; - -__BEGIN_DECLS - -/* Set different ABIs (personalities). */ -extern int personality (unsigned long int __persona) __THROW; - -__END_DECLS - -#endif /* sys/personality.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/poll.h b/openflow/usr/include/arm-linux-gnueabihf/sys/poll.h deleted file mode 100644 index e751860..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/poll.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Compatibility definitions for System V `poll' interface. - Copyright (C) 1994-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_POLL_H -#define _SYS_POLL_H 1 - -#include - -/* Get the platform dependent bits of `poll'. */ -#include -#ifdef __USE_GNU -/* Get the __sigset_t definition. */ -# include -/* Get the timespec definition. */ -# define __need_timespec -# include -#endif - - -/* Type used for the number of file descriptors. */ -typedef unsigned long int nfds_t; - -/* Data structure describing a polling request. */ -struct pollfd - { - int fd; /* File descriptor to poll. */ - short int events; /* Types of events poller cares about. */ - short int revents; /* Types of events that actually occurred. */ - }; - - -__BEGIN_DECLS - -/* Poll the file descriptors described by the NFDS structures starting at - FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for - an event to occur; if TIMEOUT is -1, block until an event occurs. - Returns the number of file descriptors with events, zero if timed out, - or -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout); - -#ifdef __USE_GNU -/* Like poll, but before waiting the threads signal mask is replaced - with that specified in the fourth parameter. For better usability, - the timeout value is specified using a TIMESPEC object. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int ppoll (struct pollfd *__fds, nfds_t __nfds, - const struct timespec *__timeout, - const __sigset_t *__ss); -#endif - -__END_DECLS - - -/* Define some inlines helping to catch common problems. */ -#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function -# include -#endif - -#endif /* sys/poll.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/prctl.h b/openflow/usr/include/arm-linux-gnueabihf/sys/prctl.h deleted file mode 100644 index 83049d5..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/prctl.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_PRCTL_H -#define _SYS_PRCTL_H 1 - -#include -#include /* The magic values come from here */ - -__BEGIN_DECLS - -/* Control process execution. */ -extern int prctl (int __option, ...) __THROW; - -__END_DECLS - -#endif /* sys/prctl.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/procfs.h b/openflow/usr/include/arm-linux-gnueabihf/sys/procfs.h deleted file mode 100644 index 73da7f1..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/procfs.h +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _SYS_PROCFS_H -#define _SYS_PROCFS_H 1 - -/* This is somewhat modelled after the file of the same name on SVR4 - systems. It provides a definition of the core file format for ELF - used on Linux. It doesn't have anything to do with the /proc file - system, even though Linux has one. - - Anyway, the whole purpose of this file is for GDB and GDB only. - Don't read too much into it. Don't use it for anything other than - GDB unless you know what you are doing. */ - -#include -#include -#include -#include - -__BEGIN_DECLS - -/* Type for a general-purpose register. */ -typedef unsigned long elf_greg_t; - -/* And the whole bunch of them. We could have used `struct - user_regs' directly in the typedef, but tradition says that - the register set is an array, which does have some peculiar - semantics, so leave it that way. */ -#define ELF_NGREG (sizeof (struct user_regs) / sizeof(elf_greg_t)) -typedef elf_greg_t elf_gregset_t[ELF_NGREG]; - -/* Register set for the floating-point registers. */ -typedef struct user_fpregs elf_fpregset_t; - -/* Signal info. */ -struct elf_siginfo - { - int si_signo; /* Signal number. */ - int si_code; /* Extra code. */ - int si_errno; /* Errno. */ - }; - -/* Definitions to generate Intel SVR4-like core files. These mostly - have the same names as the SVR4 types with "elf_" tacked on the - front to prevent clashes with Linux definitions, and the typedef - forms have been avoided. This is mostly like the SVR4 structure, - but more Linuxy, with things that Linux does not support and which - GDB doesn't really use excluded. */ - -struct elf_prstatus - { - struct elf_siginfo pr_info; /* Info associated with signal. */ - short int pr_cursig; /* Current signal. */ - unsigned long int pr_sigpend; /* Set of pending signals. */ - unsigned long int pr_sighold; /* Set of held signals. */ - __pid_t pr_pid; - __pid_t pr_ppid; - __pid_t pr_pgrp; - __pid_t pr_sid; - struct timeval pr_utime; /* User time. */ - struct timeval pr_stime; /* System time. */ - struct timeval pr_cutime; /* Cumulative user time. */ - struct timeval pr_cstime; /* Cumulative system time. */ - elf_gregset_t pr_reg; /* GP registers. */ - int pr_fpvalid; /* True if math copro being used. */ - }; - - -#define ELF_PRARGSZ (80) /* Number of chars for args. */ - -struct elf_prpsinfo - { - char pr_state; /* Numeric process state. */ - char pr_sname; /* Char for pr_state. */ - char pr_zomb; /* Zombie. */ - char pr_nice; /* Nice val. */ - unsigned long int pr_flag; /* Flags. */ - unsigned short int pr_uid; - unsigned short int pr_gid; - int pr_pid, pr_ppid, pr_pgrp, pr_sid; - /* Lots missing */ - char pr_fname[16]; /* Filename of executable. */ - char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ - }; - -/* The rest of this file provides the types for emulation of the - Solaris interfaces that should be implemented by - users of libthread_db. */ - -/* Addresses. */ -typedef void *psaddr_t; - -/* Register sets. Linux has different names. */ -typedef elf_gregset_t prgregset_t; -typedef elf_fpregset_t prfpregset_t; - -/* We don't have any differences between processes and threads, - therefore have only one PID type. */ -typedef __pid_t lwpid_t; - -/* Process status and info. In the end we do provide typedefs for them. */ -typedef struct elf_prstatus prstatus_t; -typedef struct elf_prpsinfo prpsinfo_t; - -__END_DECLS - -#endif /* sys/procfs.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/profil.h b/openflow/usr/include/arm-linux-gnueabihf/sys/profil.h deleted file mode 100644 index 5790fe0..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/profil.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 2001-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _PROFIL_H -#define _PROFIL_H 1 - -#include - -#include -#include - -/* This interface is intended to follow the sprofil() system calls as - described by the sprofil(2) man page of Irix v6.5, except that: - - - there is no a priori limit on number of text sections - - pr_scale is declared as unsigned long (instead of "unsigned int") - - pr_size is declared as size_t (instead of "unsigned int") - - pr_off is declared as void * (instead of "__psunsigned_t") - - the overflow bin (pr_base==0, pr_scale==2) can appear anywhere - in the profp array - - PROF_FAST has no effect */ - -struct prof - { - void *pr_base; /* buffer base */ - size_t pr_size; /* buffer size */ - size_t pr_off; /* pc offset */ - unsigned long int pr_scale; /* pc scaling (fixed-point number) */ - }; - -enum - { - PROF_USHORT = 0, /* use 16-bit counters (default) */ - PROF_UINT = 1 << 0, /* use 32-bit counters */ - PROF_FAST = 1 << 1 /* profile faster than usual */ - }; - - -__BEGIN_DECLS - -extern int sprofil (struct prof *__profp, int __profcnt, - struct timeval *__tvp, unsigned int __flags) __THROW; - -__END_DECLS - -#endif /* profil.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/ptrace.h b/openflow/usr/include/arm-linux-gnueabihf/sys/ptrace.h deleted file mode 100644 index ee88271..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/ptrace.h +++ /dev/null @@ -1,227 +0,0 @@ -/* `ptrace' debugger support interface. Linux version. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_PTRACE_H -#define _SYS_PTRACE_H 1 - -#include -#include - -__BEGIN_DECLS - -/* Type of the REQUEST argument to `ptrace.' */ -enum __ptrace_request -{ - /* Indicate that the process making this request should be traced. - All signals received by this process can be intercepted by its - parent, and its parent can use the other `ptrace' requests. */ - PTRACE_TRACEME = 0, -#define PT_TRACE_ME PTRACE_TRACEME - - /* Return the word in the process's text space at address ADDR. */ - PTRACE_PEEKTEXT = 1, -#define PT_READ_I PTRACE_PEEKTEXT - - /* Return the word in the process's data space at address ADDR. */ - PTRACE_PEEKDATA = 2, -#define PT_READ_D PTRACE_PEEKDATA - - /* Return the word in the process's user area at offset ADDR. */ - PTRACE_PEEKUSER = 3, -#define PT_READ_U PTRACE_PEEKUSER - - /* Write the word DATA into the process's text space at address ADDR. */ - PTRACE_POKETEXT = 4, -#define PT_WRITE_I PTRACE_POKETEXT - - /* Write the word DATA into the process's data space at address ADDR. */ - PTRACE_POKEDATA = 5, -#define PT_WRITE_D PTRACE_POKEDATA - - /* Write the word DATA into the process's user area at offset ADDR. */ - PTRACE_POKEUSER = 6, -#define PT_WRITE_U PTRACE_POKEUSER - - /* Continue the process. */ - PTRACE_CONT = 7, -#define PT_CONTINUE PTRACE_CONT - - /* Kill the process. */ - PTRACE_KILL = 8, -#define PT_KILL PTRACE_KILL - - /* Single step the process. - This is not supported on all machines. */ - PTRACE_SINGLESTEP = 9, -#define PT_STEP PTRACE_SINGLESTEP - - /* Get all general purpose registers used by a processes. - This is not supported on all machines. */ - PTRACE_GETREGS = 12, -#define PT_GETREGS PTRACE_GETREGS - - /* Set all general purpose registers used by a processes. - This is not supported on all machines. */ - PTRACE_SETREGS = 13, -#define PT_SETREGS PTRACE_SETREGS - - /* Get all floating point registers used by a processes. - This is not supported on all machines. */ - PTRACE_GETFPREGS = 14, -#define PT_GETFPREGS PTRACE_GETFPREGS - - /* Set all floating point registers used by a processes. - This is not supported on all machines. */ - PTRACE_SETFPREGS = 15, -#define PT_SETFPREGS PTRACE_SETFPREGS - - /* Attach to a process that is already running. */ - PTRACE_ATTACH = 16, -#define PT_ATTACH PTRACE_ATTACH - - /* Detach from a process attached to with PTRACE_ATTACH. */ - PTRACE_DETACH = 17, -#define PT_DETACH PTRACE_DETACH - - /* Get all extended floating point registers used by a processes. - This is not supported on all machines. */ - PTRACE_GETFPXREGS = 18, -#define PT_GETFPXREGS PTRACE_GETFPXREGS - - /* Set all extended floating point registers used by a processes. - This is not supported on all machines. */ - PTRACE_SETFPXREGS = 19, -#define PT_SETFPXREGS PTRACE_SETFPXREGS - - /* Continue and stop at the next (return from) syscall. */ - PTRACE_SYSCALL = 24, -#define PT_SYSCALL PTRACE_SYSCALL - - /* Set ptrace filter options. */ - PTRACE_SETOPTIONS = 0x4200, -#define PT_SETOPTIONS PTRACE_SETOPTIONS - - /* Get last ptrace message. */ - PTRACE_GETEVENTMSG = 0x4201, -#define PT_GETEVENTMSG PTRACE_GETEVENTMSG - - /* Get siginfo for process. */ - PTRACE_GETSIGINFO = 0x4202, -#define PT_GETSIGINFO PTRACE_GETSIGINFO - - /* Set new siginfo for process. */ - PTRACE_SETSIGINFO = 0x4203, -#define PT_SETSIGINFO PTRACE_SETSIGINFO - - /* Get register content. */ - PTRACE_GETREGSET = 0x4204, -#define PTRACE_GETREGSET PTRACE_GETREGSET - - /* Set register content. */ - PTRACE_SETREGSET = 0x4205, -#define PTRACE_SETREGSET PTRACE_SETREGSET - - /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect - signal or group stop state. */ - PTRACE_SEIZE = 0x4206, -#define PTRACE_SEIZE PTRACE_SEIZE - - /* Trap seized tracee. */ - PTRACE_INTERRUPT = 0x4207, -#define PTRACE_INTERRUPT PTRACE_INTERRUPT - - /* Wait for next group event. */ - PTRACE_LISTEN = 0x4208, -#define PTRACE_LISTEN PTRACE_LISTEN - - PTRACE_PEEKSIGINFO = 0x4209, -#define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO - - PTRACE_GETSIGMASK = 0x420a, -#define PTRACE_GETSIGMASK PTRACE_GETSIGMASK - - PTRACE_SETSIGMASK = 0x420b, -#define PTRACE_SETSIGMASK PTRACE_SETSIGMASK - - PTRACE_SECCOMP_GET_FILTER = 0x420c -#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER -}; - - -/* Flag for PTRACE_LISTEN. */ -enum __ptrace_flags -{ - PTRACE_SEIZE_DEVEL = 0x80000000 -}; - -/* Options set using PTRACE_SETOPTIONS. */ -enum __ptrace_setoptions -{ - PTRACE_O_TRACESYSGOOD = 0x00000001, - PTRACE_O_TRACEFORK = 0x00000002, - PTRACE_O_TRACEVFORK = 0x00000004, - PTRACE_O_TRACECLONE = 0x00000008, - PTRACE_O_TRACEEXEC = 0x00000010, - PTRACE_O_TRACEVFORKDONE = 0x00000020, - PTRACE_O_TRACEEXIT = 0x00000040, - PTRACE_O_TRACESECCOMP = 0x00000080, - PTRACE_O_EXITKILL = 0x00100000, - PTRACE_O_SUSPEND_SECCOMP = 0x00200000, - PTRACE_O_MASK = 0x003000ff -}; - -/* Wait extended result codes for the above trace options. */ -enum __ptrace_eventcodes -{ - PTRACE_EVENT_FORK = 1, - PTRACE_EVENT_VFORK = 2, - PTRACE_EVENT_CLONE = 3, - PTRACE_EVENT_EXEC = 4, - PTRACE_EVENT_VFORK_DONE = 5, - PTRACE_EVENT_EXIT = 6, - PTRACE_EVENT_SECCOMP = 7 -}; - -/* Arguments for PTRACE_PEEKSIGINFO. */ -struct __ptrace_peeksiginfo_args -{ - __uint64_t off; /* From which siginfo to start. */ - __uint32_t flags; /* Flags for peeksiginfo. */ - __int32_t nr; /* How many siginfos to take. */ -}; - -enum __ptrace_peeksiginfo_flags -{ - /* Read signals from a shared (process wide) queue. */ - PTRACE_PEEKSIGINFO_SHARED = (1 << 0) -}; - -/* Perform process tracing functions. REQUEST is one of the values - above, and determines the action to be taken. - For all requests except PTRACE_TRACEME, PID specifies the process to be - traced. - - PID and the other arguments described above for the various requests should - appear (those that are used for the particular request) as: - pid_t PID, void *ADDR, int DATA, void *ADDR2 - after REQUEST. */ -extern long int ptrace (enum __ptrace_request __request, ...) __THROW; - -__END_DECLS - -#endif /* _SYS_PTRACE_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/queue.h b/openflow/usr/include/arm-linux-gnueabihf/sys/queue.h deleted file mode 100644 index daf4553..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/queue.h +++ /dev/null @@ -1,574 +0,0 @@ -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)queue.h 8.5 (Berkeley) 8/20/94 - */ - -#ifndef _SYS_QUEUE_H_ -#define _SYS_QUEUE_H_ - -/* - * This file defines five types of data structures: singly-linked lists, - * lists, simple queues, tail queues, and circular queues. - * - * A singly-linked list is headed by a single forward pointer. The - * elements are singly linked for minimum space and pointer manipulation - * overhead at the expense of O(n) removal for arbitrary elements. New - * elements can be added to the list after an existing element or at the - * head of the list. Elements being removed from the head of the list - * should use the explicit macro for this purpose for optimum - * efficiency. A singly-linked list may only be traversed in the forward - * direction. Singly-linked lists are ideal for applications with large - * datasets and few or no removals or for implementing a LIFO queue. - * - * A list is headed by a single forward pointer (or an array of forward - * pointers for a hash table header). The elements are doubly linked - * so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before - * or after an existing element or at the head of the list. A list - * may only be traversed in the forward direction. - * - * A simple queue is headed by a pair of pointers, one the head of the - * list and the other to the tail of the list. The elements are singly - * linked to save space, so elements can only be removed from the - * head of the list. New elements can be added to the list after - * an existing element, at the head of the list, or at the end of the - * list. A simple queue may only be traversed in the forward direction. - * - * A tail queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or - * after an existing element, at the head of the list, or at the end of - * the list. A tail queue may be traversed in either direction. - * - * A circle queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or after - * an existing element, at the head of the list, or at the end of the list. - * A circle queue may be traversed in either direction, but has a more - * complex end of list detection. - * - * For details on the use of these macros, see the queue(3) manual page. - */ - -/* - * List definitions. - */ -#define LIST_HEAD(name, type) \ -struct name { \ - struct type *lh_first; /* first element */ \ -} - -#define LIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define LIST_ENTRY(type) \ -struct { \ - struct type *le_next; /* next element */ \ - struct type **le_prev; /* address of previous next element */ \ -} - -/* - * List functions. - */ -#define LIST_INIT(head) do { \ - (head)->lh_first = NULL; \ -} while (/*CONSTCOND*/0) - -#define LIST_INSERT_AFTER(listelm, elm, field) do { \ - if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ - (listelm)->field.le_next->field.le_prev = \ - &(elm)->field.le_next; \ - (listelm)->field.le_next = (elm); \ - (elm)->field.le_prev = &(listelm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.le_prev = (listelm)->field.le_prev; \ - (elm)->field.le_next = (listelm); \ - *(listelm)->field.le_prev = (elm); \ - (listelm)->field.le_prev = &(elm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.le_next = (head)->lh_first) != NULL) \ - (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ - (head)->lh_first = (elm); \ - (elm)->field.le_prev = &(head)->lh_first; \ -} while (/*CONSTCOND*/0) - -#define LIST_REMOVE(elm, field) do { \ - if ((elm)->field.le_next != NULL) \ - (elm)->field.le_next->field.le_prev = \ - (elm)->field.le_prev; \ - *(elm)->field.le_prev = (elm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_FOREACH(var, head, field) \ - for ((var) = ((head)->lh_first); \ - (var); \ - (var) = ((var)->field.le_next)) - -/* - * List access methods. - */ -#define LIST_EMPTY(head) ((head)->lh_first == NULL) -#define LIST_FIRST(head) ((head)->lh_first) -#define LIST_NEXT(elm, field) ((elm)->field.le_next) - - -/* - * Singly-linked List definitions. - */ -#define SLIST_HEAD(name, type) \ -struct name { \ - struct type *slh_first; /* first element */ \ -} - -#define SLIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define SLIST_ENTRY(type) \ -struct { \ - struct type *sle_next; /* next element */ \ -} - -/* - * Singly-linked List functions. - */ -#define SLIST_INIT(head) do { \ - (head)->slh_first = NULL; \ -} while (/*CONSTCOND*/0) - -#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ - (elm)->field.sle_next = (slistelm)->field.sle_next; \ - (slistelm)->field.sle_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define SLIST_INSERT_HEAD(head, elm, field) do { \ - (elm)->field.sle_next = (head)->slh_first; \ - (head)->slh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define SLIST_REMOVE_HEAD(head, field) do { \ - (head)->slh_first = (head)->slh_first->field.sle_next; \ -} while (/*CONSTCOND*/0) - -#define SLIST_REMOVE(head, elm, type, field) do { \ - if ((head)->slh_first == (elm)) { \ - SLIST_REMOVE_HEAD((head), field); \ - } \ - else { \ - struct type *curelm = (head)->slh_first; \ - while(curelm->field.sle_next != (elm)) \ - curelm = curelm->field.sle_next; \ - curelm->field.sle_next = \ - curelm->field.sle_next->field.sle_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define SLIST_FOREACH(var, head, field) \ - for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) - -/* - * Singly-linked List access methods. - */ -#define SLIST_EMPTY(head) ((head)->slh_first == NULL) -#define SLIST_FIRST(head) ((head)->slh_first) -#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) - - -/* - * Singly-linked Tail queue declarations. - */ -#define STAILQ_HEAD(name, type) \ -struct name { \ - struct type *stqh_first; /* first element */ \ - struct type **stqh_last; /* addr of last next element */ \ -} - -#define STAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).stqh_first } - -#define STAILQ_ENTRY(type) \ -struct { \ - struct type *stqe_next; /* next element */ \ -} - -/* - * Singly-linked Tail queue functions. - */ -#define STAILQ_INIT(head) do { \ - (head)->stqh_first = NULL; \ - (head)->stqh_last = &(head)->stqh_first; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ - (head)->stqh_last = &(elm)->field.stqe_next; \ - (head)->stqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.stqe_next = NULL; \ - *(head)->stqh_last = (elm); \ - (head)->stqh_last = &(elm)->field.stqe_next; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ - (head)->stqh_last = &(elm)->field.stqe_next; \ - (listelm)->field.stqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define STAILQ_REMOVE_HEAD(head, field) do { \ - if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ - (head)->stqh_last = &(head)->stqh_first; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_REMOVE(head, elm, type, field) do { \ - if ((head)->stqh_first == (elm)) { \ - STAILQ_REMOVE_HEAD((head), field); \ - } else { \ - struct type *curelm = (head)->stqh_first; \ - while (curelm->field.stqe_next != (elm)) \ - curelm = curelm->field.stqe_next; \ - if ((curelm->field.stqe_next = \ - curelm->field.stqe_next->field.stqe_next) == NULL) \ - (head)->stqh_last = &(curelm)->field.stqe_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define STAILQ_FOREACH(var, head, field) \ - for ((var) = ((head)->stqh_first); \ - (var); \ - (var) = ((var)->field.stqe_next)) - -#define STAILQ_CONCAT(head1, head2) do { \ - if (!STAILQ_EMPTY((head2))) { \ - *(head1)->stqh_last = (head2)->stqh_first; \ - (head1)->stqh_last = (head2)->stqh_last; \ - STAILQ_INIT((head2)); \ - } \ -} while (/*CONSTCOND*/0) - -/* - * Singly-linked Tail queue access methods. - */ -#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) -#define STAILQ_FIRST(head) ((head)->stqh_first) -#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) - - -/* - * Simple queue definitions. - */ -#define SIMPLEQ_HEAD(name, type) \ -struct name { \ - struct type *sqh_first; /* first element */ \ - struct type **sqh_last; /* addr of last next element */ \ -} - -#define SIMPLEQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).sqh_first } - -#define SIMPLEQ_ENTRY(type) \ -struct { \ - struct type *sqe_next; /* next element */ \ -} - -/* - * Simple queue functions. - */ -#define SIMPLEQ_INIT(head) do { \ - (head)->sqh_first = NULL; \ - (head)->sqh_last = &(head)->sqh_first; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ - (head)->sqh_last = &(elm)->field.sqe_next; \ - (head)->sqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.sqe_next = NULL; \ - *(head)->sqh_last = (elm); \ - (head)->sqh_last = &(elm)->field.sqe_next; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ - (head)->sqh_last = &(elm)->field.sqe_next; \ - (listelm)->field.sqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ - if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ - (head)->sqh_last = &(head)->sqh_first; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ - if ((head)->sqh_first == (elm)) { \ - SIMPLEQ_REMOVE_HEAD((head), field); \ - } else { \ - struct type *curelm = (head)->sqh_first; \ - while (curelm->field.sqe_next != (elm)) \ - curelm = curelm->field.sqe_next; \ - if ((curelm->field.sqe_next = \ - curelm->field.sqe_next->field.sqe_next) == NULL) \ - (head)->sqh_last = &(curelm)->field.sqe_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_FOREACH(var, head, field) \ - for ((var) = ((head)->sqh_first); \ - (var); \ - (var) = ((var)->field.sqe_next)) - -/* - * Simple queue access methods. - */ -#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL) -#define SIMPLEQ_FIRST(head) ((head)->sqh_first) -#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) - - -/* - * Tail queue definitions. - */ -#define _TAILQ_HEAD(name, type, qual) \ -struct name { \ - qual type *tqh_first; /* first element */ \ - qual type *qual *tqh_last; /* addr of last next element */ \ -} -#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) - -#define TAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } - -#define _TAILQ_ENTRY(type, qual) \ -struct { \ - qual type *tqe_next; /* next element */ \ - qual type *qual *tqe_prev; /* address of previous next element */\ -} -#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) - -/* - * Tail queue functions. - */ -#define TAILQ_INIT(head) do { \ - (head)->tqh_first = NULL; \ - (head)->tqh_last = &(head)->tqh_first; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (head)->tqh_first = (elm); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ - (elm)->field.tqe_next->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (listelm)->field.tqe_next = (elm); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_REMOVE(head, elm, field) do { \ - if (((elm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = \ - (elm)->field.tqe_prev; \ - else \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_FOREACH(var, head, field) \ - for ((var) = ((head)->tqh_first); \ - (var); \ - (var) = ((var)->field.tqe_next)) - -#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ - (var); \ - (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) - -#define TAILQ_CONCAT(head1, head2, field) do { \ - if (!TAILQ_EMPTY(head2)) { \ - *(head1)->tqh_last = (head2)->tqh_first; \ - (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ - (head1)->tqh_last = (head2)->tqh_last; \ - TAILQ_INIT((head2)); \ - } \ -} while (/*CONSTCOND*/0) - -/* - * Tail queue access methods. - */ -#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) -#define TAILQ_FIRST(head) ((head)->tqh_first) -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) - -#define TAILQ_LAST(head, headname) \ - (*(((struct headname *)((head)->tqh_last))->tqh_last)) -#define TAILQ_PREV(elm, headname, field) \ - (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) - - -/* - * Circular queue definitions. - */ -#define CIRCLEQ_HEAD(name, type) \ -struct name { \ - struct type *cqh_first; /* first element */ \ - struct type *cqh_last; /* last element */ \ -} - -#define CIRCLEQ_HEAD_INITIALIZER(head) \ - { (void *)&head, (void *)&head } - -#define CIRCLEQ_ENTRY(type) \ -struct { \ - struct type *cqe_next; /* next element */ \ - struct type *cqe_prev; /* previous element */ \ -} - -/* - * Circular queue functions. - */ -#define CIRCLEQ_INIT(head) do { \ - (head)->cqh_first = (void *)(head); \ - (head)->cqh_last = (void *)(head); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ - (elm)->field.cqe_next = (listelm)->field.cqe_next; \ - (elm)->field.cqe_prev = (listelm); \ - if ((listelm)->field.cqe_next == (void *)(head)) \ - (head)->cqh_last = (elm); \ - else \ - (listelm)->field.cqe_next->field.cqe_prev = (elm); \ - (listelm)->field.cqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ - (elm)->field.cqe_next = (listelm); \ - (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ - if ((listelm)->field.cqe_prev == (void *)(head)) \ - (head)->cqh_first = (elm); \ - else \ - (listelm)->field.cqe_prev->field.cqe_next = (elm); \ - (listelm)->field.cqe_prev = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ - (elm)->field.cqe_next = (head)->cqh_first; \ - (elm)->field.cqe_prev = (void *)(head); \ - if ((head)->cqh_last == (void *)(head)) \ - (head)->cqh_last = (elm); \ - else \ - (head)->cqh_first->field.cqe_prev = (elm); \ - (head)->cqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.cqe_next = (void *)(head); \ - (elm)->field.cqe_prev = (head)->cqh_last; \ - if ((head)->cqh_first == (void *)(head)) \ - (head)->cqh_first = (elm); \ - else \ - (head)->cqh_last->field.cqe_next = (elm); \ - (head)->cqh_last = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_REMOVE(head, elm, field) do { \ - if ((elm)->field.cqe_next == (void *)(head)) \ - (head)->cqh_last = (elm)->field.cqe_prev; \ - else \ - (elm)->field.cqe_next->field.cqe_prev = \ - (elm)->field.cqe_prev; \ - if ((elm)->field.cqe_prev == (void *)(head)) \ - (head)->cqh_first = (elm)->field.cqe_next; \ - else \ - (elm)->field.cqe_prev->field.cqe_next = \ - (elm)->field.cqe_next; \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_FOREACH(var, head, field) \ - for ((var) = ((head)->cqh_first); \ - (var) != (const void *)(head); \ - (var) = ((var)->field.cqe_next)) - -#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ - for ((var) = ((head)->cqh_last); \ - (var) != (const void *)(head); \ - (var) = ((var)->field.cqe_prev)) - -/* - * Circular queue access methods. - */ -#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) -#define CIRCLEQ_FIRST(head) ((head)->cqh_first) -#define CIRCLEQ_LAST(head) ((head)->cqh_last) -#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) -#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) - -#define CIRCLEQ_LOOP_NEXT(head, elm, field) \ - (((elm)->field.cqe_next == (void *)(head)) \ - ? ((head)->cqh_first) \ - : (elm->field.cqe_next)) -#define CIRCLEQ_LOOP_PREV(head, elm, field) \ - (((elm)->field.cqe_prev == (void *)(head)) \ - ? ((head)->cqh_last) \ - : (elm->field.cqe_prev)) - -#endif /* sys/queue.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/quota.h b/openflow/usr/include/arm-linux-gnueabihf/sys/quota.h deleted file mode 100644 index 5aa0ec0..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/quota.h +++ /dev/null @@ -1,225 +0,0 @@ -/* This just represents the non-kernel parts of . - * - * here's the corresponding copyright: - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Robert Elz at The University of Melbourne. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _SYS_QUOTA_H -#define _SYS_QUOTA_H 1 - -#include -#include - -/* - * Select between different incompatible quota versions. - * Default to the version used by Linux kernel version 2.4.22 - * or later. */ -#ifndef _LINUX_QUOTA_VERSION -# define _LINUX_QUOTA_VERSION 2 -#endif - -/* - * Convert diskblocks to blocks and the other way around. - * currently only to fool the BSD source. :-) - */ -#define dbtob(num) ((num) << 10) -#define btodb(num) ((num) >> 10) - -/* - * Convert count of filesystem blocks to diskquota blocks, meant - * for filesystems where i_blksize != BLOCK_SIZE - */ -#define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / BLOCK_SIZE) - -/* - * Definitions for disk quotas imposed on the average user - * (big brother finally hits Linux). - * - * The following constants define the amount of time given a user - * before the soft limits are treated as hard limits (usually resulting - * in an allocation failure). The timer is started when the user crosses - * their soft limit, it is reset when they go below their soft limit. - */ -#define MAX_IQ_TIME 604800 /* (7*24*60*60) 1 week */ -#define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */ - -#define MAXQUOTAS 2 -#define USRQUOTA 0 /* element used for user quotas */ -#define GRPQUOTA 1 /* element used for group quotas */ - -/* - * Definitions for the default names of the quotas files. - */ -#define INITQFNAMES { \ - "user", /* USRQUOTA */ \ - "group", /* GRPQUOTA */ \ - "undefined", \ -}; - -#define QUOTAFILENAME "quota" -#define QUOTAGROUP "staff" - -#define NR_DQHASH 43 /* Just an arbitrary number any suggestions ? */ -#define NR_DQUOTS 256 /* Number of quotas active at one time */ - -/* - * Command definitions for the 'quotactl' system call. - * The commands are broken into a main command defined below - * and a subcommand that is used to convey the type of - * quota that is being manipulated (see above). - */ -#define SUBCMDMASK 0x00ff -#define SUBCMDSHIFT 8 -#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) - -#if _LINUX_QUOTA_VERSION < 2 -# define Q_QUOTAON 0x0100 /* enable quotas */ -# define Q_QUOTAOFF 0x0200 /* disable quotas */ -# define Q_GETQUOTA 0x0300 /* get limits and usage */ -# define Q_SETQUOTA 0x0400 /* set limits and usage */ -# define Q_SETUSE 0x0500 /* set usage */ -# define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */ -# define Q_SETQLIM 0x0700 /* set limits */ -# define Q_GETSTATS 0x0800 /* get collected stats */ -# define Q_RSQUASH 0x1000 /* set root_squash option */ -#else -# define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */ -# define Q_QUOTAON 0x800002 /* turn quotas on */ -# define Q_QUOTAOFF 0x800003 /* turn quotas off */ -# define Q_GETFMT 0x800004 /* get quota format used on given filesystem */ -# define Q_GETINFO 0x800005 /* get information about quota files */ -# define Q_SETINFO 0x800006 /* set information about quota files */ -# define Q_GETQUOTA 0x800007 /* get user quota structure */ -# define Q_SETQUOTA 0x800008 /* set user quota structure */ -#endif - -/* - * The following structure defines the format of the disk quota file - * (as it appears on disk) - the file is an array of these structures - * indexed by user or group number. - */ -#if _LINUX_QUOTA_VERSION < 2 -struct dqblk - { - u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ - u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */ - u_int32_t dqb_curblocks; /* current block count */ - u_int32_t dqb_ihardlimit; /* maximum # allocated inodes */ - u_int32_t dqb_isoftlimit; /* preferred inode limit */ - u_int32_t dqb_curinodes; /* current # allocated inodes */ - time_t dqb_btime; /* time limit for excessive disk use */ - time_t dqb_itime; /* time limit for excessive files */ - }; -#else - -/* Flags that indicate which fields in dqblk structure are valid. */ -#define QIF_BLIMITS 1 -#define QIF_SPACE 2 -#define QIF_ILIMITS 4 -#define QIF_INODES 8 -#define QIF_BTIME 16 -#define QIF_ITIME 32 -#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) -#define QIF_USAGE (QIF_SPACE | QIF_INODES) -#define QIF_TIMES (QIF_BTIME | QIF_ITIME) -#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) - -struct dqblk - { - u_int64_t dqb_bhardlimit; /* absolute limit on disk quota blocks alloc */ - u_int64_t dqb_bsoftlimit; /* preferred limit on disk quota blocks */ - u_int64_t dqb_curspace; /* current quota block count */ - u_int64_t dqb_ihardlimit; /* maximum # allocated inodes */ - u_int64_t dqb_isoftlimit; /* preferred inode limit */ - u_int64_t dqb_curinodes; /* current # allocated inodes */ - u_int64_t dqb_btime; /* time limit for excessive disk use */ - u_int64_t dqb_itime; /* time limit for excessive files */ - u_int32_t dqb_valid; /* bitmask of QIF_* constants */ - }; -#endif - -/* - * Shorthand notation. - */ -#define dq_bhardlimit dq_dqb.dqb_bhardlimit -#define dq_bsoftlimit dq_dqb.dqb_bsoftlimit -#if _LINUX_QUOTA_VERSION < 2 -# define dq_curblocks dq_dqb.dqb_curblocks -#else -# define dq_curspace dq_dqb.dqb_curspace -# define dq_valid dq_dqb.dqb_valid -#endif -#define dq_ihardlimit dq_dqb.dqb_ihardlimit -#define dq_isoftlimit dq_dqb.dqb_isoftlimit -#define dq_curinodes dq_dqb.dqb_curinodes -#define dq_btime dq_dqb.dqb_btime -#define dq_itime dq_dqb.dqb_itime - -#define dqoff(UID) ((loff_t)((UID) * sizeof (struct dqblk))) - -#if _LINUX_QUOTA_VERSION < 2 -struct dqstats - { - u_int32_t lookups; - u_int32_t drops; - u_int32_t reads; - u_int32_t writes; - u_int32_t cache_hits; - u_int32_t pages_allocated; - u_int32_t allocated_dquots; - u_int32_t free_dquots; - u_int32_t syncs; - }; -#else - -/* Flags that indicate which fields in dqinfo structure are valid. */ -# define IIF_BGRACE 1 -# define IIF_IGRACE 2 -# define IIF_FLAGS 4 -# define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) - -struct dqinfo - { - u_int64_t dqi_bgrace; - u_int64_t dqi_igrace; - u_int32_t dqi_flags; - u_int32_t dqi_valid; - }; -#endif - -__BEGIN_DECLS - -extern int quotactl (int __cmd, const char *__special, int __id, - caddr_t __addr) __THROW; - -__END_DECLS - -#endif /* sys/quota.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/raw.h b/openflow/usr/include/arm-linux-gnueabihf/sys/raw.h deleted file mode 100644 index bd7266d..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/raw.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 1999-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_RAW_H -#define _SYS_RAW_H 1 - -#include -#include - -/* The major device number for raw devices. */ -#define RAW_MAJOR 162 - -/* `ioctl' commands for raw devices. */ -#define RAW_SETBIND _IO(0xac, 0) -#define RAW_GETBIND _IO(0xac, 1) - -struct raw_config_request -{ - int raw_minor; - uint64_t block_major; - uint64_t block_minor; -}; - -#endif /* sys/raw.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/reboot.h b/openflow/usr/include/arm-linux-gnueabihf/sys/reboot.h deleted file mode 100644 index df1076f..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/reboot.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* This file should define RB_* macros to be used as flag - bits in the argument to the `reboot' system call. */ - -#ifndef _SYS_REBOOT_H -#define _SYS_REBOOT_H 1 - -#include - -/* Perform a hard reset now. */ -#define RB_AUTOBOOT 0x01234567 - -/* Halt the system. */ -#define RB_HALT_SYSTEM 0xcdef0123 - -/* Enable reboot using Ctrl-Alt-Delete keystroke. */ -#define RB_ENABLE_CAD 0x89abcdef - -/* Disable reboot using Ctrl-Alt-Delete keystroke. */ -#define RB_DISABLE_CAD 0 - -/* Stop system and switch power off if possible. */ -#define RB_POWER_OFF 0x4321fedc - -/* Suspend system using software suspend. */ -#define RB_SW_SUSPEND 0xd000fce2 - -/* Reboot system into new kernel. */ -#define RB_KEXEC 0x45584543 - -__BEGIN_DECLS - -/* Reboot or halt the system. */ -extern int reboot (int __howto) __THROW; - -__END_DECLS - -#endif /* _SYS_REBOOT_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/resource.h b/openflow/usr/include/arm-linux-gnueabihf/sys/resource.h deleted file mode 100644 index dfef7ac..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/resource.h +++ /dev/null @@ -1,102 +0,0 @@ -/* Copyright (C) 1992-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_RESOURCE_H -#define _SYS_RESOURCE_H 1 - -#include - -/* Get the system-dependent definitions of structures and bit values. */ -#include - -#ifndef __id_t_defined -typedef __id_t id_t; -# define __id_t_defined -#endif - -__BEGIN_DECLS - -/* The X/Open standard defines that all the functions below must use - `int' as the type for the first argument. When we are compiling with - GNU extensions we change this slightly to provide better error - checking. */ -#if defined __USE_GNU && !defined __cplusplus -typedef enum __rlimit_resource __rlimit_resource_t; -typedef enum __rusage_who __rusage_who_t; -typedef enum __priority_which __priority_which_t; -#else -typedef int __rlimit_resource_t; -typedef int __rusage_who_t; -typedef int __priority_which_t; -#endif - -/* Put the soft and hard limits for RESOURCE in *RLIMITS. - Returns 0 if successful, -1 if not (and sets errno). */ -#ifndef __USE_FILE_OFFSET64 -extern int getrlimit (__rlimit_resource_t __resource, - struct rlimit *__rlimits) __THROW; -#else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (getrlimit, (__rlimit_resource_t __resource, - struct rlimit *__rlimits), getrlimit64); -# else -# define getrlimit getrlimit64 -# endif -#endif -#ifdef __USE_LARGEFILE64 -extern int getrlimit64 (__rlimit_resource_t __resource, - struct rlimit64 *__rlimits) __THROW; -#endif - -/* Set the soft and hard limits for RESOURCE to *RLIMITS. - Only the super-user can increase hard limits. - Return 0 if successful, -1 if not (and sets errno). */ -#ifndef __USE_FILE_OFFSET64 -extern int setrlimit (__rlimit_resource_t __resource, - const struct rlimit *__rlimits) __THROW; -#else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (setrlimit, (__rlimit_resource_t __resource, - const struct rlimit *__rlimits), - setrlimit64); -# else -# define setrlimit setrlimit64 -# endif -#endif -#ifdef __USE_LARGEFILE64 -extern int setrlimit64 (__rlimit_resource_t __resource, - const struct rlimit64 *__rlimits) __THROW; -#endif - -/* Return resource usage information on process indicated by WHO - and put it in *USAGE. Returns 0 for success, -1 for failure. */ -extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW; - -/* Return the highest priority of any process specified by WHICH and WHO - (see above); if WHO is zero, the current process, process group, or user - (as specified by WHO) is used. A lower priority number means higher - priority. Priorities range from PRIO_MIN to PRIO_MAX (above). */ -extern int getpriority (__priority_which_t __which, id_t __who) __THROW; - -/* Set the priority of all processes specified by WHICH and WHO (see above) - to PRIO. Returns 0 on success, -1 on errors. */ -extern int setpriority (__priority_which_t __which, id_t __who, int __prio) - __THROW; - -__END_DECLS - -#endif /* sys/resource.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/select.h b/openflow/usr/include/arm-linux-gnueabihf/sys/select.h deleted file mode 100644 index b852dac..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/select.h +++ /dev/null @@ -1,133 +0,0 @@ -/* `fd_set' type and related macros, and `select'/`pselect' declarations. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* POSIX 1003.1g: 6.2 Select from File Descriptor Sets */ - -#ifndef _SYS_SELECT_H -#define _SYS_SELECT_H 1 - -#include - -/* Get definition of needed basic types. */ -#include - -/* Get __FD_* definitions. */ -#include - -/* Get __sigset_t. */ -#include - -#ifndef __sigset_t_defined -# define __sigset_t_defined -typedef __sigset_t sigset_t; -#endif - -/* Get definition of timer specification structures. */ -#define __need_time_t -#define __need_timespec -#include -#define __need_timeval -#include - -#ifndef __suseconds_t_defined -typedef __suseconds_t suseconds_t; -# define __suseconds_t_defined -#endif - - -/* The fd_set member is required to be an array of longs. */ -typedef long int __fd_mask; - -/* Some versions of define this macros. */ -#undef __NFDBITS -/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ -#define __NFDBITS (8 * (int) sizeof (__fd_mask)) -#define __FD_ELT(d) ((d) / __NFDBITS) -#define __FD_MASK(d) ((__fd_mask) (1UL << ((d) % __NFDBITS))) - -/* fd_set for select and pselect. */ -typedef struct - { - /* XPG4.2 requires this member name. Otherwise avoid the name - from the global namespace. */ -#ifdef __USE_XOPEN - __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; -# define __FDS_BITS(set) ((set)->fds_bits) -#else - __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS]; -# define __FDS_BITS(set) ((set)->__fds_bits) -#endif - } fd_set; - -/* Maximum number of file descriptors in `fd_set'. */ -#define FD_SETSIZE __FD_SETSIZE - -#ifdef __USE_MISC -/* Sometimes the fd_set member is assumed to have this type. */ -typedef __fd_mask fd_mask; - -/* Number of bits per word of `fd_set' (some code assumes this is 32). */ -# define NFDBITS __NFDBITS -#endif - - -/* Access macros for `fd_set'. */ -#define FD_SET(fd, fdsetp) __FD_SET (fd, fdsetp) -#define FD_CLR(fd, fdsetp) __FD_CLR (fd, fdsetp) -#define FD_ISSET(fd, fdsetp) __FD_ISSET (fd, fdsetp) -#define FD_ZERO(fdsetp) __FD_ZERO (fdsetp) - - -__BEGIN_DECLS - -/* Check the first NFDS descriptors each in READFDS (if not NULL) for read - readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS - (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out - after waiting the interval specified therein. Returns the number of ready - descriptors, or -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int select (int __nfds, fd_set *__restrict __readfds, - fd_set *__restrict __writefds, - fd_set *__restrict __exceptfds, - struct timeval *__restrict __timeout); - -#ifdef __USE_XOPEN2K -/* Same as above only that the TIMEOUT value is given with higher - resolution and a sigmask which is been set temporarily. This version - should be used. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int pselect (int __nfds, fd_set *__restrict __readfds, - fd_set *__restrict __writefds, - fd_set *__restrict __exceptfds, - const struct timespec *__restrict __timeout, - const __sigset_t *__restrict __sigmask); -#endif - - -/* Define some inlines helping to catch common problems. */ -#if __USE_FORTIFY_LEVEL > 0 && defined __GNUC__ -# include -#endif - -__END_DECLS - -#endif /* sys/select.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/sem.h b/openflow/usr/include/arm-linux-gnueabihf/sys/sem.h deleted file mode 100644 index 1b32092..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/sem.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SEM_H -#define _SYS_SEM_H 1 - -#include - -#define __need_size_t -#include - -/* Get common definition of System V style IPC. */ -#include - -/* Get system dependent definition of `struct semid_ds' and more. */ -#include - -#ifdef __USE_GNU -# define __need_timespec -# include -#endif - -/* The following System V style IPC functions implement a semaphore - handling. The definition is found in XPG2. */ - -/* Structure used for argument to `semop' to describe operations. */ -struct sembuf -{ - unsigned short int sem_num; /* semaphore number */ - short int sem_op; /* semaphore operation */ - short int sem_flg; /* operation flag */ -}; - - -__BEGIN_DECLS - -/* Semaphore control operation. */ -extern int semctl (int __semid, int __semnum, int __cmd, ...) __THROW; - -/* Get semaphore. */ -extern int semget (key_t __key, int __nsems, int __semflg) __THROW; - -/* Operate on semaphore. */ -extern int semop (int __semid, struct sembuf *__sops, size_t __nsops) __THROW; - -#ifdef __USE_GNU -/* Operate on semaphore with timeout. */ -extern int semtimedop (int __semid, struct sembuf *__sops, size_t __nsops, - const struct timespec *__timeout) __THROW; -#endif - -__END_DECLS - -#endif /* sys/sem.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/sendfile.h b/openflow/usr/include/arm-linux-gnueabihf/sys/sendfile.h deleted file mode 100644 index d4c14ba..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/sendfile.h +++ /dev/null @@ -1,51 +0,0 @@ -/* sendfile -- copy data directly from one file descriptor to another - Copyright (C) 1998-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SENDFILE_H -#define _SYS_SENDFILE_H 1 - -#include -#include - -__BEGIN_DECLS - -/* Send up to COUNT bytes from file associated with IN_FD starting at - *OFFSET to descriptor OUT_FD. Set *OFFSET to the IN_FD's file position - following the read bytes. If OFFSET is a null pointer, use the normal - file position instead. Return the number of written bytes, or -1 in - case of error. */ -#ifndef __USE_FILE_OFFSET64 -extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *__offset, - size_t __count) __THROW; -#else -# ifdef __REDIRECT_NTH -extern ssize_t __REDIRECT_NTH (sendfile, - (int __out_fd, int __in_fd, __off64_t *__offset, - size_t __count), sendfile64); -# else -# define sendfile sendfile64 -# endif -#endif -#ifdef __USE_LARGEFILE64 -extern ssize_t sendfile64 (int __out_fd, int __in_fd, __off64_t *__offset, - size_t __count) __THROW; -#endif - -__END_DECLS - -#endif /* sys/sendfile.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/shm.h b/openflow/usr/include/arm-linux-gnueabihf/sys/shm.h deleted file mode 100644 index df263dc..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/shm.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SHM_H -#define _SYS_SHM_H 1 - -#include - -#define __need_size_t -#include - -/* Get common definition of System V style IPC. */ -#include - -/* Get system dependent definition of `struct shmid_ds' and more. */ -#include - -/* Define types required by the standard. */ -#define __need_time_t -#include - -#ifdef __USE_XOPEN -# ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -# endif -#endif /* X/Open */ - - -__BEGIN_DECLS - -/* The following System V style IPC functions implement a shared memory - facility. The definition is found in XPG4.2. */ - -/* Shared memory control operation. */ -extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) __THROW; - -/* Get shared memory segment. */ -extern int shmget (key_t __key, size_t __size, int __shmflg) __THROW; - -/* Attach shared memory segment. */ -extern void *shmat (int __shmid, const void *__shmaddr, int __shmflg) - __THROW; - -/* Detach shared memory segment. */ -extern int shmdt (const void *__shmaddr) __THROW; - -__END_DECLS - -#endif /* sys/shm.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/signal.h b/openflow/usr/include/arm-linux-gnueabihf/sys/signal.h deleted file mode 100644 index 2e602da..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/signal.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/signalfd.h b/openflow/usr/include/arm-linux-gnueabihf/sys/signalfd.h deleted file mode 100644 index 6f75bc0..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/signalfd.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 2007-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SIGNALFD_H -#define _SYS_SIGNALFD_H 1 - -#define __need_sigset_t -#include -#include - -/* Get the platform-dependent flags. */ -#include - -struct signalfd_siginfo -{ - uint32_t ssi_signo; - int32_t ssi_errno; - int32_t ssi_code; - uint32_t ssi_pid; - uint32_t ssi_uid; - int32_t ssi_fd; - uint32_t ssi_tid; - uint32_t ssi_band; - uint32_t ssi_overrun; - uint32_t ssi_trapno; - int32_t ssi_status; - int32_t ssi_int; - uint64_t ssi_ptr; - uint64_t ssi_utime; - uint64_t ssi_stime; - uint64_t ssi_addr; - uint8_t __pad[48]; -}; - -__BEGIN_DECLS - -/* Request notification for delivery of signals in MASK to be - performed using descriptor FD.*/ -extern int signalfd (int __fd, const sigset_t *__mask, int __flags) - __THROW __nonnull ((2)); - -__END_DECLS - -#endif /* sys/signalfd.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/socket.h b/openflow/usr/include/arm-linux-gnueabihf/sys/socket.h deleted file mode 100644 index c9f0f50..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/socket.h +++ /dev/null @@ -1,285 +0,0 @@ -/* Declarations of socket constants, types, and functions. - Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SOCKET_H -#define _SYS_SOCKET_H 1 - -#include - -__BEGIN_DECLS - -#include -#define __need_size_t -#include -#ifdef __USE_GNU -/* Get the __sigset_t definition. */ -# include -#endif - - -/* This operating system-specific header file defines the SOCK_*, PF_*, - AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr', - `struct msghdr', and `struct linger' types. */ -#include - -#ifdef __USE_MISC -/* This is the 4.3 BSD `struct sockaddr' format, which is used as wire - format in the grotty old 4.3 `talk' protocol. */ -struct osockaddr - { - unsigned short int sa_family; - unsigned char sa_data[14]; - }; -#endif - -/* The following constants should be used for the second parameter of - `shutdown'. */ -enum -{ - SHUT_RD = 0, /* No more receptions. */ -#define SHUT_RD SHUT_RD - SHUT_WR, /* No more transmissions. */ -#define SHUT_WR SHUT_WR - SHUT_RDWR /* No more receptions or transmissions. */ -#define SHUT_RDWR SHUT_RDWR -}; - -/* This is the type we use for generic socket address arguments. - - With GCC 2.7 and later, the funky union causes redeclarations or - uses with any of the listed types to be allowed without complaint. - G++ 2.7 does not support transparent unions so there we want the - old-style declaration, too. */ -#if defined __cplusplus || !__GNUC_PREREQ (2, 7) || !defined __USE_GNU -# define __SOCKADDR_ARG struct sockaddr *__restrict -# define __CONST_SOCKADDR_ARG const struct sockaddr * -#else -/* Add more `struct sockaddr_AF' types here as necessary. - These are all the ones I found on NetBSD and Linux. */ -# define __SOCKADDR_ALLTYPES \ - __SOCKADDR_ONETYPE (sockaddr) \ - __SOCKADDR_ONETYPE (sockaddr_at) \ - __SOCKADDR_ONETYPE (sockaddr_ax25) \ - __SOCKADDR_ONETYPE (sockaddr_dl) \ - __SOCKADDR_ONETYPE (sockaddr_eon) \ - __SOCKADDR_ONETYPE (sockaddr_in) \ - __SOCKADDR_ONETYPE (sockaddr_in6) \ - __SOCKADDR_ONETYPE (sockaddr_inarp) \ - __SOCKADDR_ONETYPE (sockaddr_ipx) \ - __SOCKADDR_ONETYPE (sockaddr_iso) \ - __SOCKADDR_ONETYPE (sockaddr_ns) \ - __SOCKADDR_ONETYPE (sockaddr_un) \ - __SOCKADDR_ONETYPE (sockaddr_x25) - -# define __SOCKADDR_ONETYPE(type) struct type *__restrict __##type##__; -typedef union { __SOCKADDR_ALLTYPES - } __SOCKADDR_ARG __attribute__ ((__transparent_union__)); -# undef __SOCKADDR_ONETYPE -# define __SOCKADDR_ONETYPE(type) const struct type *__restrict __##type##__; -typedef union { __SOCKADDR_ALLTYPES - } __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__)); -# undef __SOCKADDR_ONETYPE -#endif - -#ifdef __USE_GNU -/* For `recvmmsg' and `sendmmsg'. */ -struct mmsghdr - { - struct msghdr msg_hdr; /* Actual message header. */ - unsigned int msg_len; /* Number of received or sent bytes for the - entry. */ - }; -#endif - - -/* Create a new socket of type TYPE in domain DOMAIN, using - protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically. - Returns a file descriptor for the new socket, or -1 for errors. */ -extern int socket (int __domain, int __type, int __protocol) __THROW; - -/* Create two new sockets, of type TYPE in domain DOMAIN and using - protocol PROTOCOL, which are connected to each other, and put file - descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero, - one will be chosen automatically. Returns 0 on success, -1 for errors. */ -extern int socketpair (int __domain, int __type, int __protocol, - int __fds[2]) __THROW; - -/* Give the socket FD the local address ADDR (which is LEN bytes long). */ -extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len) - __THROW; - -/* Put the local address of FD into *ADDR and its length in *LEN. */ -extern int getsockname (int __fd, __SOCKADDR_ARG __addr, - socklen_t *__restrict __len) __THROW; - -/* Open a connection on socket FD to peer at ADDR (which LEN bytes long). - For connectionless socket types, just set the default address to send to - and the only address from which to accept transmissions. - Return 0 on success, -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len); - -/* Put the address of the peer connected to socket FD into *ADDR - (which is *LEN bytes long), and its actual length into *LEN. */ -extern int getpeername (int __fd, __SOCKADDR_ARG __addr, - socklen_t *__restrict __len) __THROW; - - -/* Send N bytes of BUF to socket FD. Returns the number sent or -1. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t send (int __fd, const void *__buf, size_t __n, int __flags); - -/* Read N bytes into BUF from socket FD. - Returns the number read or -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags); - -/* Send N bytes of BUF on socket FD to peer at address ADDR (which is - ADDR_LEN bytes long). Returns the number sent, or -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t sendto (int __fd, const void *__buf, size_t __n, - int __flags, __CONST_SOCKADDR_ARG __addr, - socklen_t __addr_len); - -/* Read N bytes into BUF through socket FD. - If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of - the sender, and store the actual size of the address in *ADDR_LEN. - Returns the number of bytes read or -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, - int __flags, __SOCKADDR_ARG __addr, - socklen_t *__restrict __addr_len); - - -/* Send a message described MESSAGE on socket FD. - Returns the number of bytes sent, or -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t sendmsg (int __fd, const struct msghdr *__message, - int __flags); - -#ifdef __USE_GNU -/* Send a VLEN messages as described by VMESSAGES to socket FD. - Returns the number of datagrams successfully written or -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int sendmmsg (int __fd, struct mmsghdr *__vmessages, - unsigned int __vlen, int __flags); -#endif - -/* Receive a message as described by MESSAGE from socket FD. - Returns the number of bytes read or -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags); - -#ifdef __USE_GNU -/* Receive up to VLEN messages as described by VMESSAGES from socket FD. - Returns the number of messages received or -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int recvmmsg (int __fd, struct mmsghdr *__vmessages, - unsigned int __vlen, int __flags, - struct timespec *__tmo); -#endif - - -/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL - into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's - actual length. Returns 0 on success, -1 for errors. */ -extern int getsockopt (int __fd, int __level, int __optname, - void *__restrict __optval, - socklen_t *__restrict __optlen) __THROW; - -/* Set socket FD's option OPTNAME at protocol level LEVEL - to *OPTVAL (which is OPTLEN bytes long). - Returns 0 on success, -1 for errors. */ -extern int setsockopt (int __fd, int __level, int __optname, - const void *__optval, socklen_t __optlen) __THROW; - - -/* Prepare to accept connections on socket FD. - N connection requests will be queued before further requests are refused. - Returns 0 on success, -1 for errors. */ -extern int listen (int __fd, int __n) __THROW; - -/* Await a connection on socket FD. - When a connection arrives, open a new socket to communicate with it, - set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting - peer and *ADDR_LEN to the address's actual length, and return the - new socket's descriptor, or -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int accept (int __fd, __SOCKADDR_ARG __addr, - socklen_t *__restrict __addr_len); - -#ifdef __USE_GNU -/* Similar to 'accept' but takes an additional parameter to specify flags. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int accept4 (int __fd, __SOCKADDR_ARG __addr, - socklen_t *__restrict __addr_len, int __flags); -#endif - -/* Shut down all or part of the connection open on socket FD. - HOW determines what to shut down: - SHUT_RD = No more receptions; - SHUT_WR = No more transmissions; - SHUT_RDWR = No more receptions or transmissions. - Returns 0 on success, -1 for errors. */ -extern int shutdown (int __fd, int __how) __THROW; - - -#ifdef __USE_XOPEN2K -/* Determine wheter socket is at a out-of-band mark. */ -extern int sockatmark (int __fd) __THROW; -#endif - - -#ifdef __USE_MISC -/* FDTYPE is S_IFSOCK or another S_IF* macro defined in ; - returns 1 if FD is open on an object of the indicated type, 0 if not, - or -1 for errors (setting errno). */ -extern int isfdtype (int __fd, int __fdtype) __THROW; -#endif - - -/* Define some macros helping to catch buffer overflows. */ -#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function -# include -#endif - -__END_DECLS - -#endif /* sys/socket.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/socketvar.h b/openflow/usr/include/arm-linux-gnueabihf/sys/socketvar.h deleted file mode 100644 index b177158..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/socketvar.h +++ /dev/null @@ -1,3 +0,0 @@ -/* This header is used on many systems but for GNU we have everything - already defined in the standard header. */ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/soundcard.h b/openflow/usr/include/arm-linux-gnueabihf/sys/soundcard.h deleted file mode 100644 index fade986..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/soundcard.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/stat.h b/openflow/usr/include/arm-linux-gnueabihf/sys/stat.h deleted file mode 100644 index bf63882..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/stat.h +++ /dev/null @@ -1,536 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * POSIX Standard: 5.6 File Characteristics - */ - -#ifndef _SYS_STAT_H -#define _SYS_STAT_H 1 - -#include - -#include /* For __mode_t and __dev_t. */ - -#if defined __USE_XOPEN || defined __USE_XOPEN2K || defined __USE_ATFILE -# if defined __USE_XOPEN || defined __USE_XOPEN2K -# define __need_time_t -# endif -# ifdef __USE_ATFILE -# define __need_timespec -# endif -# include /* For time_t resp. timespec. */ -#endif - -#if defined __USE_XOPEN || defined __USE_XOPEN2K -/* The Single Unix specification says that some more types are - available here. */ -# ifndef __dev_t_defined -typedef __dev_t dev_t; -# define __dev_t_defined -# endif - -# ifndef __gid_t_defined -typedef __gid_t gid_t; -# define __gid_t_defined -# endif - -# ifndef __ino_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __ino_t ino_t; -# else -typedef __ino64_t ino_t; -# endif -# define __ino_t_defined -# endif - -# ifndef __mode_t_defined -typedef __mode_t mode_t; -# define __mode_t_defined -# endif - -# ifndef __nlink_t_defined -typedef __nlink_t nlink_t; -# define __nlink_t_defined -# endif - -# ifndef __off_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __off_t off_t; -# else -typedef __off64_t off_t; -# endif -# define __off_t_defined -# endif - -# ifndef __uid_t_defined -typedef __uid_t uid_t; -# define __uid_t_defined -# endif -#endif /* X/Open */ - -#ifdef __USE_UNIX98 -# ifndef __blkcnt_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __blkcnt_t blkcnt_t; -# else -typedef __blkcnt64_t blkcnt_t; -# endif -# define __blkcnt_t_defined -# endif - -# ifndef __blksize_t_defined -typedef __blksize_t blksize_t; -# define __blksize_t_defined -# endif -#endif /* Unix98 */ - -__BEGIN_DECLS - -#include - -#if defined __USE_MISC || defined __USE_XOPEN -# define S_IFMT __S_IFMT -# define S_IFDIR __S_IFDIR -# define S_IFCHR __S_IFCHR -# define S_IFBLK __S_IFBLK -# define S_IFREG __S_IFREG -# ifdef __S_IFIFO -# define S_IFIFO __S_IFIFO -# endif -# ifdef __S_IFLNK -# define S_IFLNK __S_IFLNK -# endif -# if (defined __USE_MISC || defined __USE_UNIX98) \ - && defined __S_IFSOCK -# define S_IFSOCK __S_IFSOCK -# endif -#endif - -/* Test macros for file types. */ - -#define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask)) - -#define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR) -#define S_ISCHR(mode) __S_ISTYPE((mode), __S_IFCHR) -#define S_ISBLK(mode) __S_ISTYPE((mode), __S_IFBLK) -#define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG) -#ifdef __S_IFIFO -# define S_ISFIFO(mode) __S_ISTYPE((mode), __S_IFIFO) -#endif -#ifdef __S_IFLNK -# define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK) -#endif - -#if defined __USE_MISC && !defined __S_IFLNK -# define S_ISLNK(mode) 0 -#endif - -#if (defined __USE_UNIX98 || defined __USE_XOPEN2K) \ - && defined __S_IFSOCK -# define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK) -#elif defined __USE_XOPEN2K -# define S_ISSOCK(mode) 0 -#endif - -/* These are from POSIX.1b. If the objects are not implemented using separate - distinct file types, the macros always will evaluate to zero. Unlike the - other S_* macros the following three take a pointer to a `struct stat' - object as the argument. */ -#ifdef __USE_POSIX199309 -# define S_TYPEISMQ(buf) __S_TYPEISMQ(buf) -# define S_TYPEISSEM(buf) __S_TYPEISSEM(buf) -# define S_TYPEISSHM(buf) __S_TYPEISSHM(buf) -#endif - - -/* Protection bits. */ - -#define S_ISUID __S_ISUID /* Set user ID on execution. */ -#define S_ISGID __S_ISGID /* Set group ID on execution. */ - -#if defined __USE_MISC || defined __USE_XOPEN -/* Save swapped text after use (sticky bit). This is pretty well obsolete. */ -# define S_ISVTX __S_ISVTX -#endif - -#define S_IRUSR __S_IREAD /* Read by owner. */ -#define S_IWUSR __S_IWRITE /* Write by owner. */ -#define S_IXUSR __S_IEXEC /* Execute by owner. */ -/* Read, write, and execute by owner. */ -#define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC) - -#ifdef __USE_MISC -# define S_IREAD S_IRUSR -# define S_IWRITE S_IWUSR -# define S_IEXEC S_IXUSR -#endif - -#define S_IRGRP (S_IRUSR >> 3) /* Read by group. */ -#define S_IWGRP (S_IWUSR >> 3) /* Write by group. */ -#define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */ -/* Read, write, and execute by group. */ -#define S_IRWXG (S_IRWXU >> 3) - -#define S_IROTH (S_IRGRP >> 3) /* Read by others. */ -#define S_IWOTH (S_IWGRP >> 3) /* Write by others. */ -#define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */ -/* Read, write, and execute by others. */ -#define S_IRWXO (S_IRWXG >> 3) - - -#ifdef __USE_MISC -/* Macros for common mode bit masks. */ -# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ -# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */ -# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/ - -# define S_BLKSIZE 512 /* Block size for `st_blocks'. */ -#endif - - -#ifndef __USE_FILE_OFFSET64 -/* Get file attributes for FILE and put them in BUF. */ -extern int stat (const char *__restrict __file, - struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); - -/* Get file attributes for the file, device, pipe, or socket - that file descriptor FD is open on and put them in BUF. */ -extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2)); -#else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (stat, (const char *__restrict __file, - struct stat *__restrict __buf), stat64) - __nonnull ((1, 2)); -extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64) - __nonnull ((2)); -# else -# define stat stat64 -# define fstat fstat64 -# endif -#endif -#ifdef __USE_LARGEFILE64 -extern int stat64 (const char *__restrict __file, - struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); -extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); -#endif - -#ifdef __USE_ATFILE -/* Similar to stat, get the attributes for FILE and put them in BUF. - Relative path names are interpreted relative to FD unless FD is - AT_FDCWD. */ -# ifndef __USE_FILE_OFFSET64 -extern int fstatat (int __fd, const char *__restrict __file, - struct stat *__restrict __buf, int __flag) - __THROW __nonnull ((2, 3)); -# else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file, - struct stat *__restrict __buf, - int __flag), - fstatat64) __nonnull ((2, 3)); -# else -# define fstatat fstatat64 -# endif -# endif - -# ifdef __USE_LARGEFILE64 -extern int fstatat64 (int __fd, const char *__restrict __file, - struct stat64 *__restrict __buf, int __flag) - __THROW __nonnull ((2, 3)); -# endif -#endif - -#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K -# ifndef __USE_FILE_OFFSET64 -/* Get file attributes about FILE and put them in BUF. - If FILE is a symbolic link, do not follow it. */ -extern int lstat (const char *__restrict __file, - struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); -# else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (lstat, - (const char *__restrict __file, - struct stat *__restrict __buf), lstat64) - __nonnull ((1, 2)); -# else -# define lstat lstat64 -# endif -# endif -# ifdef __USE_LARGEFILE64 -extern int lstat64 (const char *__restrict __file, - struct stat64 *__restrict __buf) - __THROW __nonnull ((1, 2)); -# endif -#endif - -/* Set file access permissions for FILE to MODE. - If FILE is a symbolic link, this affects its target instead. */ -extern int chmod (const char *__file, __mode_t __mode) - __THROW __nonnull ((1)); - -#ifdef __USE_MISC -/* Set file access permissions for FILE to MODE. - If FILE is a symbolic link, this affects the link itself - rather than its target. */ -extern int lchmod (const char *__file, __mode_t __mode) - __THROW __nonnull ((1)); -#endif - -/* Set file access permissions of the file FD is open on to MODE. */ -#ifdef __USE_POSIX -extern int fchmod (int __fd, __mode_t __mode) __THROW; -#endif - -#ifdef __USE_ATFILE -/* Set file access permissions of FILE relative to - the directory FD is open on. */ -extern int fchmodat (int __fd, const char *__file, __mode_t __mode, - int __flag) - __THROW __nonnull ((2)) __wur; -#endif /* Use ATFILE. */ - - - -/* Set the file creation mask of the current process to MASK, - and return the old creation mask. */ -extern __mode_t umask (__mode_t __mask) __THROW; - -#ifdef __USE_GNU -/* Get the current `umask' value without changing it. - This function is only available under the GNU Hurd. */ -extern __mode_t getumask (void) __THROW; -#endif - -/* Create a new directory named PATH, with permission bits MODE. */ -extern int mkdir (const char *__path, __mode_t __mode) - __THROW __nonnull ((1)); - -#ifdef __USE_ATFILE -/* Like mkdir, create a new directory with permission bits MODE. But - interpret relative PATH names relative to the directory associated - with FD. */ -extern int mkdirat (int __fd, const char *__path, __mode_t __mode) - __THROW __nonnull ((2)); -#endif - -/* Create a device file named PATH, with permission and special bits MODE - and device number DEV (which can be constructed from major and minor - device numbers with the `makedev' macro above). */ -#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED -extern int mknod (const char *__path, __mode_t __mode, __dev_t __dev) - __THROW __nonnull ((1)); - -# ifdef __USE_ATFILE -/* Like mknod, create a new device file with permission bits MODE and - device number DEV. But interpret relative PATH names relative to - the directory associated with FD. */ -extern int mknodat (int __fd, const char *__path, __mode_t __mode, - __dev_t __dev) __THROW __nonnull ((2)); -# endif -#endif - - -/* Create a new FIFO named PATH, with permission bits MODE. */ -extern int mkfifo (const char *__path, __mode_t __mode) - __THROW __nonnull ((1)); - -#ifdef __USE_ATFILE -/* Like mkfifo, create a new FIFO with permission bits MODE. But - interpret relative PATH names relative to the directory associated - with FD. */ -extern int mkfifoat (int __fd, const char *__path, __mode_t __mode) - __THROW __nonnull ((2)); -#endif - -#ifdef __USE_ATFILE -/* Set file access and modification times relative to directory file - descriptor. */ -extern int utimensat (int __fd, const char *__path, - const struct timespec __times[2], - int __flags) - __THROW __nonnull ((2)); -#endif - -#ifdef __USE_XOPEN2K8 -/* Set file access and modification times of the file associated with FD. */ -extern int futimens (int __fd, const struct timespec __times[2]) __THROW; -#endif - -/* To allow the `struct stat' structure and the file type `mode_t' - bits to vary without changing shared library major version number, - the `stat' family of functions and `mknod' are in fact inline - wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod', - which all take a leading version-number argument designating the - data structure and bits used. defines _STAT_VER with - the version number corresponding to `struct stat' as defined in - that file; and _MKNOD_VER with the version number corresponding to - the S_IF* macros defined therein. It is arranged that when not - inlined these function are always statically linked; that way a - dynamically-linked executable always encodes the version number - corresponding to the data structures it uses, so the `x' functions - in the shared library can adapt without needing to recompile all - callers. */ - -#ifndef _STAT_VER -# define _STAT_VER 0 -#endif -#ifndef _MKNOD_VER -# define _MKNOD_VER 0 -#endif - -/* Wrappers for stat and mknod system calls. */ -#ifndef __USE_FILE_OFFSET64 -extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf) - __THROW __nonnull ((3)); -extern int __xstat (int __ver, const char *__filename, - struct stat *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __lxstat (int __ver, const char *__filename, - struct stat *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __fxstatat (int __ver, int __fildes, const char *__filename, - struct stat *__stat_buf, int __flag) - __THROW __nonnull ((3, 4)); -#else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes, - struct stat *__stat_buf), __fxstat64) - __nonnull ((3)); -extern int __REDIRECT_NTH (__xstat, (int __ver, const char *__filename, - struct stat *__stat_buf), __xstat64) - __nonnull ((2, 3)); -extern int __REDIRECT_NTH (__lxstat, (int __ver, const char *__filename, - struct stat *__stat_buf), __lxstat64) - __nonnull ((2, 3)); -extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes, - const char *__filename, - struct stat *__stat_buf, int __flag), - __fxstatat64) __nonnull ((3, 4)); - -# else -# define __fxstat __fxstat64 -# define __xstat __xstat64 -# define __lxstat __lxstat64 -# endif -#endif - -#ifdef __USE_LARGEFILE64 -extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf) - __THROW __nonnull ((3)); -extern int __xstat64 (int __ver, const char *__filename, - struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __lxstat64 (int __ver, const char *__filename, - struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __fxstatat64 (int __ver, int __fildes, const char *__filename, - struct stat64 *__stat_buf, int __flag) - __THROW __nonnull ((3, 4)); -#endif -extern int __xmknod (int __ver, const char *__path, __mode_t __mode, - __dev_t *__dev) __THROW __nonnull ((2, 4)); - -extern int __xmknodat (int __ver, int __fd, const char *__path, - __mode_t __mode, __dev_t *__dev) - __THROW __nonnull ((3, 5)); - -#ifdef __USE_EXTERN_INLINES -/* Inlined versions of the real stat and mknod functions. */ - -__extern_inline int -__NTH (stat (const char *__path, struct stat *__statbuf)) -{ - return __xstat (_STAT_VER, __path, __statbuf); -} - -# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED -__extern_inline int -__NTH (lstat (const char *__path, struct stat *__statbuf)) -{ - return __lxstat (_STAT_VER, __path, __statbuf); -} -# endif - -__extern_inline int -__NTH (fstat (int __fd, struct stat *__statbuf)) -{ - return __fxstat (_STAT_VER, __fd, __statbuf); -} - -# ifdef __USE_ATFILE -__extern_inline int -__NTH (fstatat (int __fd, const char *__filename, struct stat *__statbuf, - int __flag)) -{ - return __fxstatat (_STAT_VER, __fd, __filename, __statbuf, __flag); -} -# endif - -# ifdef __USE_MISC -__extern_inline int -__NTH (mknod (const char *__path, __mode_t __mode, __dev_t __dev)) -{ - return __xmknod (_MKNOD_VER, __path, __mode, &__dev); -} -# endif - -# ifdef __USE_ATFILE -__extern_inline int -__NTH (mknodat (int __fd, const char *__path, __mode_t __mode, - __dev_t __dev)) -{ - return __xmknodat (_MKNOD_VER, __fd, __path, __mode, &__dev); -} -# endif - -# if defined __USE_LARGEFILE64 \ - && (! defined __USE_FILE_OFFSET64 \ - || (defined __REDIRECT_NTH && defined __OPTIMIZE__)) -__extern_inline int -__NTH (stat64 (const char *__path, struct stat64 *__statbuf)) -{ - return __xstat64 (_STAT_VER, __path, __statbuf); -} - -# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED -__extern_inline int -__NTH (lstat64 (const char *__path, struct stat64 *__statbuf)) -{ - return __lxstat64 (_STAT_VER, __path, __statbuf); -} -# endif - -__extern_inline int -__NTH (fstat64 (int __fd, struct stat64 *__statbuf)) -{ - return __fxstat64 (_STAT_VER, __fd, __statbuf); -} - -# ifdef __USE_ATFILE -__extern_inline int -__NTH (fstatat64 (int __fd, const char *__filename, struct stat64 *__statbuf, - int __flag)) -{ - return __fxstatat64 (_STAT_VER, __fd, __filename, __statbuf, __flag); -} -# endif - -# endif - -#endif - -__END_DECLS - - -#endif /* sys/stat.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/statfs.h b/openflow/usr/include/arm-linux-gnueabihf/sys/statfs.h deleted file mode 100644 index 69a228d..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/statfs.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Definitions for getting information about a filesystem. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_STATFS_H -#define _SYS_STATFS_H 1 - -#include - -/* Get the system-specific definition of `struct statfs'. */ -#include - -__BEGIN_DECLS - -/* Return information about the filesystem on which FILE resides. */ -#ifndef __USE_FILE_OFFSET64 -extern int statfs (const char *__file, struct statfs *__buf) - __THROW __nonnull ((1, 2)); -#else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (statfs, - (const char *__file, struct statfs *__buf), - statfs64) __nonnull ((1, 2)); -# else -# define statfs statfs64 -# endif -#endif -#ifdef __USE_LARGEFILE64 -extern int statfs64 (const char *__file, struct statfs64 *__buf) - __THROW __nonnull ((1, 2)); -#endif - -/* Return information about the filesystem containing the file FILDES - refers to. */ -#ifndef __USE_FILE_OFFSET64 -extern int fstatfs (int __fildes, struct statfs *__buf) - __THROW __nonnull ((2)); -#else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (fstatfs, (int __fildes, struct statfs *__buf), - fstatfs64) __nonnull ((2)); -# else -# define fstatfs fstatfs64 -# endif -#endif -#ifdef __USE_LARGEFILE64 -extern int fstatfs64 (int __fildes, struct statfs64 *__buf) - __THROW __nonnull ((2)); -#endif - -__END_DECLS - -#endif /* sys/statfs.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/statvfs.h b/openflow/usr/include/arm-linux-gnueabihf/sys/statvfs.h deleted file mode 100644 index 5d96652..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/statvfs.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Definitions for getting information about a filesystem. - Copyright (C) 1998-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_STATVFS_H -#define _SYS_STATVFS_H 1 - -#include - -/* Get the system-specific definition of `struct statfs'. */ -#include - -#ifndef __USE_FILE_OFFSET64 -# ifndef __fsblkcnt_t_defined -typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ -# define __fsblkcnt_t_defined -# endif -# ifndef __fsfilcnt_t_defined -typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ -# define __fsfilcnt_t_defined -# endif -#else -# ifndef __fsblkcnt_t_defined -typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ -# define __fsblkcnt_t_defined -# endif -# ifndef __fsfilcnt_t_defined -typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ -# define __fsfilcnt_t_defined -# endif -#endif - -__BEGIN_DECLS - -/* Return information about the filesystem on which FILE resides. */ -#ifndef __USE_FILE_OFFSET64 -extern int statvfs (const char *__restrict __file, - struct statvfs *__restrict __buf) - __THROW __nonnull ((1, 2)); -#else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (statvfs, - (const char *__restrict __file, - struct statvfs *__restrict __buf), statvfs64) - __nonnull ((1, 2)); -# else -# define statvfs statvfs64 -# endif -#endif -#ifdef __USE_LARGEFILE64 -extern int statvfs64 (const char *__restrict __file, - struct statvfs64 *__restrict __buf) - __THROW __nonnull ((1, 2)); -#endif - -/* Return information about the filesystem containing the file FILDES - refers to. */ -#ifndef __USE_FILE_OFFSET64 -extern int fstatvfs (int __fildes, struct statvfs *__buf) - __THROW __nonnull ((2)); -#else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (fstatvfs, (int __fildes, struct statvfs *__buf), - fstatvfs64) __nonnull ((2)); -# else -# define fstatvfs fstatvfs64 -# endif -#endif -#ifdef __USE_LARGEFILE64 -extern int fstatvfs64 (int __fildes, struct statvfs64 *__buf) - __THROW __nonnull ((2)); -#endif - -__END_DECLS - -#endif /* sys/statvfs.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/stropts.h b/openflow/usr/include/arm-linux-gnueabihf/sys/stropts.h deleted file mode 100644 index 5b5bc02..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/stropts.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/swap.h b/openflow/usr/include/arm-linux-gnueabihf/sys/swap.h deleted file mode 100644 index 469907b..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/swap.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Calls to enable and disable swapping on specified locations. Linux version. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SWAP_H - -#define _SYS_SWAP_H 1 -#include - -/* The swap priority is encoded as: - (prio << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK -*/ -#define SWAP_FLAG_PREFER 0x8000 /* Set if swap priority is specified. */ -#define SWAP_FLAG_PRIO_MASK 0x7fff -#define SWAP_FLAG_PRIO_SHIFT 0 -#define SWAP_FLAG_DISCARD 0x10000 /* Discard swap cluster after use. */ - -__BEGIN_DECLS - -/* Make the block special device PATH available to the system for swapping. - This call is restricted to the super-user. */ -extern int swapon (const char *__path, int __flags) __THROW; - -/* Stop using block special device PATH for swapping. */ -extern int swapoff (const char *__path) __THROW; - -__END_DECLS - -#endif /* _SYS_SWAP_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/syscall.h b/openflow/usr/include/arm-linux-gnueabihf/sys/syscall.h deleted file mode 100644 index d925a1d..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/syscall.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYSCALL_H -#define _SYSCALL_H 1 - -/* This file should list the numbers of the system calls the system knows. - But instead of duplicating this we use the information available - from the kernel sources. */ -#include - -#ifndef _LIBC -/* The Linux kernel header file defines macros `__NR_', but some - programs expect the traditional form `SYS_'. So in building libc - we scan the kernel's list and produce with macros for - all the `SYS_' names. */ -# include -#endif - -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/sysctl.h b/openflow/usr/include/arm-linux-gnueabihf/sys/sysctl.h deleted file mode 100644 index 687d1a2..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/sysctl.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SYSCTL_H -#define _SYS_SYSCTL_H 1 - -#include -#define __need_size_t -#include -/* Prevent more kernel headers than necessary to be included. */ -#ifndef _LINUX_KERNEL_H -# define _LINUX_KERNEL_H 1 -# define __undef_LINUX_KERNEL_H -#endif -#ifndef _LINUX_TYPES_H -# define _LINUX_TYPES_H 1 -# define __undef_LINUX_TYPES_H -#endif -#ifndef _LINUX_LIST_H -# define _LINUX_LIST_H 1 -# define __undef_LINUX_LIST_H -#endif -#ifndef __LINUX_COMPILER_H -# define __LINUX_COMPILER_H 1 -# define __user -# define __undef__LINUX_COMPILER_H -#endif - -#include - -#ifdef __undef_LINUX_KERNEL_H -# undef _LINUX_KERNEL_H -# undef __undef_LINUX_KERNEL_H -#endif -#ifdef __undef_LINUX_TYPES_H -# undef _LINUX_TYPES_H -# undef __undef_LINUX_TYPES_H -#endif -#ifdef __undef_LINUX_LIST_H -# undef _LINUX_LIST_H -# undef __undef_LINUX_LIST_H -#endif -#ifdef __undef__LINUX_COMPILER_H -# undef __LINUX_COMPILER_H -# undef __user -# undef __undef__LINUX_COMPILER_H -#endif - -#include - -__BEGIN_DECLS - -/* Read or write system parameters. */ -extern int sysctl (int *__name, int __nlen, void *__oldval, - size_t *__oldlenp, void *__newval, size_t __newlen) __THROW; - -__END_DECLS - -#endif /* _SYS_SYSCTL_H */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/sysinfo.h b/openflow/usr/include/arm-linux-gnueabihf/sys/sysinfo.h deleted file mode 100644 index 4fc5186..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/sysinfo.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SYSINFO_H -#define _SYS_SYSINFO_H 1 - -#include - -/* Get sysinfo structure from kernel header. */ -#include - -__BEGIN_DECLS - -/* Returns information on overall system statistics. */ -extern int sysinfo (struct sysinfo *__info) __THROW; - - -/* Return number of configured processors. */ -extern int get_nprocs_conf (void) __THROW; - -/* Return number of available processors. */ -extern int get_nprocs (void) __THROW; - - -/* Return number of physical pages of memory in the system. */ -extern long int get_phys_pages (void) __THROW; - -/* Return number of available physical pages of memory in the system. */ -extern long int get_avphys_pages (void) __THROW; - -__END_DECLS - -#endif /* sys/sysinfo.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/syslog.h b/openflow/usr/include/arm-linux-gnueabihf/sys/syslog.h deleted file mode 100644 index ee01478..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/syslog.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)syslog.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _SYS_SYSLOG_H -#define _SYS_SYSLOG_H 1 - -#include -#define __need___va_list -#include - -/* This file defines _PATH_LOG. */ -#include - -/* - * priorities/facilities are encoded into a single 32-bit quantity, where the - * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility - * (0-big number). Both the priorities and the facilities map roughly - * one-to-one to strings in the syslogd(8) source code. This mapping is - * included in this file. - * - * priorities (these are ordered) - */ -#define LOG_EMERG 0 /* system is unusable */ -#define LOG_ALERT 1 /* action must be taken immediately */ -#define LOG_CRIT 2 /* critical conditions */ -#define LOG_ERR 3 /* error conditions */ -#define LOG_WARNING 4 /* warning conditions */ -#define LOG_NOTICE 5 /* normal but significant condition */ -#define LOG_INFO 6 /* informational */ -#define LOG_DEBUG 7 /* debug-level messages */ - -#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ - /* extract priority */ -#define LOG_PRI(p) ((p) & LOG_PRIMASK) -#define LOG_MAKEPRI(fac, pri) ((fac) | (pri)) - -#ifdef SYSLOG_NAMES -#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ - /* mark "facility" */ -#define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES << 3, 0) -typedef struct _code { - char *c_name; - int c_val; -} CODE; - -CODE prioritynames[] = - { - { "alert", LOG_ALERT }, - { "crit", LOG_CRIT }, - { "debug", LOG_DEBUG }, - { "emerg", LOG_EMERG }, - { "err", LOG_ERR }, - { "error", LOG_ERR }, /* DEPRECATED */ - { "info", LOG_INFO }, - { "none", INTERNAL_NOPRI }, /* INTERNAL */ - { "notice", LOG_NOTICE }, - { "panic", LOG_EMERG }, /* DEPRECATED */ - { "warn", LOG_WARNING }, /* DEPRECATED */ - { "warning", LOG_WARNING }, - { NULL, -1 } - }; -#endif - -/* facility codes */ -#define LOG_KERN (0<<3) /* kernel messages */ -#define LOG_USER (1<<3) /* random user-level messages */ -#define LOG_MAIL (2<<3) /* mail system */ -#define LOG_DAEMON (3<<3) /* system daemons */ -#define LOG_AUTH (4<<3) /* security/authorization messages */ -#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ -#define LOG_LPR (6<<3) /* line printer subsystem */ -#define LOG_NEWS (7<<3) /* network news subsystem */ -#define LOG_UUCP (8<<3) /* UUCP subsystem */ -#define LOG_CRON (9<<3) /* clock daemon */ -#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */ -#define LOG_FTP (11<<3) /* ftp daemon */ - - /* other codes through 15 reserved for system use */ -#define LOG_LOCAL0 (16<<3) /* reserved for local use */ -#define LOG_LOCAL1 (17<<3) /* reserved for local use */ -#define LOG_LOCAL2 (18<<3) /* reserved for local use */ -#define LOG_LOCAL3 (19<<3) /* reserved for local use */ -#define LOG_LOCAL4 (20<<3) /* reserved for local use */ -#define LOG_LOCAL5 (21<<3) /* reserved for local use */ -#define LOG_LOCAL6 (22<<3) /* reserved for local use */ -#define LOG_LOCAL7 (23<<3) /* reserved for local use */ - -#define LOG_NFACILITIES 24 /* current number of facilities */ -#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ - /* facility of pri */ -#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) - -#ifdef SYSLOG_NAMES -CODE facilitynames[] = - { - { "auth", LOG_AUTH }, - { "authpriv", LOG_AUTHPRIV }, - { "cron", LOG_CRON }, - { "daemon", LOG_DAEMON }, - { "ftp", LOG_FTP }, - { "kern", LOG_KERN }, - { "lpr", LOG_LPR }, - { "mail", LOG_MAIL }, - { "mark", INTERNAL_MARK }, /* INTERNAL */ - { "news", LOG_NEWS }, - { "security", LOG_AUTH }, /* DEPRECATED */ - { "syslog", LOG_SYSLOG }, - { "user", LOG_USER }, - { "uucp", LOG_UUCP }, - { "local0", LOG_LOCAL0 }, - { "local1", LOG_LOCAL1 }, - { "local2", LOG_LOCAL2 }, - { "local3", LOG_LOCAL3 }, - { "local4", LOG_LOCAL4 }, - { "local5", LOG_LOCAL5 }, - { "local6", LOG_LOCAL6 }, - { "local7", LOG_LOCAL7 }, - { NULL, -1 } - }; -#endif - -/* - * arguments to setlogmask. - */ -#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ -#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ - -/* - * Option flags for openlog. - * - * LOG_ODELAY no longer does anything. - * LOG_NDELAY is the inverse of what it used to be. - */ -#define LOG_PID 0x01 /* log the pid with each message */ -#define LOG_CONS 0x02 /* log on the console if errors in sending */ -#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ -#define LOG_NDELAY 0x08 /* don't delay open */ -#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ -#define LOG_PERROR 0x20 /* log to stderr as well */ - -__BEGIN_DECLS - -/* Close descriptor used to write to system logger. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern void closelog (void); - -/* Open connection to system logger. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern void openlog (const char *__ident, int __option, int __facility); - -/* Set the log mask level. */ -extern int setlogmask (int __mask) __THROW; - -/* Generate a log message using FMT string and option arguments. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern void syslog (int __pri, const char *__fmt, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); - -#ifdef __USE_MISC -/* Generate a log message using FMT and using arguments pointed to by AP. - - This function is not part of POSIX and therefore no official - cancellation point. But due to similarity with an POSIX interface - or due to the implementation it is a cancellation point and - therefore not marked with __THROW. */ -extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) - __attribute__ ((__format__ (__printf__, 2, 0))); -#endif - - -/* Define some macros helping to catch buffer overflows. */ -#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function -# include -#endif -#ifdef __LDBL_COMPAT -# include -#endif - -__END_DECLS - -#endif /* sys/syslog.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/sysmacros.h b/openflow/usr/include/arm-linux-gnueabihf/sys/sysmacros.h deleted file mode 100644 index 4c4a697..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/sysmacros.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Definitions of macros to access `dev_t' values. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SYSMACROS_H -#define _SYS_SYSMACROS_H 1 - -#include - -__BEGIN_DECLS - -__extension__ -extern unsigned int gnu_dev_major (unsigned long long int __dev) - __THROW __attribute_const__; -__extension__ -extern unsigned int gnu_dev_minor (unsigned long long int __dev) - __THROW __attribute_const__; -__extension__ -extern unsigned long long int gnu_dev_makedev (unsigned int __major, - unsigned int __minor) - __THROW __attribute_const__; - -#ifdef __USE_EXTERN_INLINES -__extension__ __extern_inline __attribute_const__ unsigned int -__NTH (gnu_dev_major (unsigned long long int __dev)) -{ - return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff); -} - -__extension__ __extern_inline __attribute_const__ unsigned int -__NTH (gnu_dev_minor (unsigned long long int __dev)) -{ - return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff); -} - -__extension__ __extern_inline __attribute_const__ unsigned long long int -__NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor)) -{ - return ((__minor & 0xff) | ((__major & 0xfff) << 8) - | (((unsigned long long int) (__minor & ~0xff)) << 12) - | (((unsigned long long int) (__major & ~0xfff)) << 32)); -} -#endif -__END_DECLS - -/* Access the functions with their traditional names. */ -#define major(dev) gnu_dev_major (dev) -#define minor(dev) gnu_dev_minor (dev) -#define makedev(maj, min) gnu_dev_makedev (maj, min) - -#endif /* sys/sysmacros.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/termios.h b/openflow/usr/include/arm-linux-gnueabihf/sys/termios.h deleted file mode 100644 index 3e18805..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/termios.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef _SYS_TERMIOS_H -#define _SYS_TERMIOS_H -#include -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/time.h b/openflow/usr/include/arm-linux-gnueabihf/sys/time.h deleted file mode 100644 index 545de6f..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/time.h +++ /dev/null @@ -1,191 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_TIME_H -#define _SYS_TIME_H 1 - -#include - -#include -#define __need_time_t -#include -#define __need_timeval -#include - -#include - -#ifndef __suseconds_t_defined -typedef __suseconds_t suseconds_t; -# define __suseconds_t_defined -#endif - - -__BEGIN_DECLS - -#ifdef __USE_GNU -/* Macros for converting between `struct timeval' and `struct timespec'. */ -# define TIMEVAL_TO_TIMESPEC(tv, ts) { \ - (ts)->tv_sec = (tv)->tv_sec; \ - (ts)->tv_nsec = (tv)->tv_usec * 1000; \ -} -# define TIMESPEC_TO_TIMEVAL(tv, ts) { \ - (tv)->tv_sec = (ts)->tv_sec; \ - (tv)->tv_usec = (ts)->tv_nsec / 1000; \ -} -#endif - - -#ifdef __USE_MISC -/* Structure crudely representing a timezone. - This is obsolete and should never be used. */ -struct timezone - { - int tz_minuteswest; /* Minutes west of GMT. */ - int tz_dsttime; /* Nonzero if DST is ever in effect. */ - }; - -typedef struct timezone *__restrict __timezone_ptr_t; -#else -typedef void *__restrict __timezone_ptr_t; -#endif - -/* Get the current time of day and timezone information, - putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled. - Returns 0 on success, -1 on errors. - NOTE: This form of timezone information is obsolete. - Use the functions and variables declared in instead. */ -extern int gettimeofday (struct timeval *__restrict __tv, - __timezone_ptr_t __tz) __THROW __nonnull ((1)); - -#ifdef __USE_MISC -/* Set the current time of day and timezone information. - This call is restricted to the super-user. */ -extern int settimeofday (const struct timeval *__tv, - const struct timezone *__tz) - __THROW; - -/* Adjust the current time of day by the amount in DELTA. - If OLDDELTA is not NULL, it is filled in with the amount - of time adjustment remaining to be done from the last `adjtime' call. - This call is restricted to the super-user. */ -extern int adjtime (const struct timeval *__delta, - struct timeval *__olddelta) __THROW; -#endif - - -/* Values for the first argument to `getitimer' and `setitimer'. */ -enum __itimer_which - { - /* Timers run in real time. */ - ITIMER_REAL = 0, -#define ITIMER_REAL ITIMER_REAL - /* Timers run only when the process is executing. */ - ITIMER_VIRTUAL = 1, -#define ITIMER_VIRTUAL ITIMER_VIRTUAL - /* Timers run when the process is executing and when - the system is executing on behalf of the process. */ - ITIMER_PROF = 2 -#define ITIMER_PROF ITIMER_PROF - }; - -/* Type of the second argument to `getitimer' and - the second and third arguments `setitimer'. */ -struct itimerval - { - /* Value to put into `it_value' when the timer expires. */ - struct timeval it_interval; - /* Time to the next timer expiration. */ - struct timeval it_value; - }; - -#if defined __USE_GNU && !defined __cplusplus -/* Use the nicer parameter type only in GNU mode and not for C++ since the - strict C++ rules prevent the automatic promotion. */ -typedef enum __itimer_which __itimer_which_t; -#else -typedef int __itimer_which_t; -#endif - -/* Set *VALUE to the current setting of timer WHICH. - Return 0 on success, -1 on errors. */ -extern int getitimer (__itimer_which_t __which, - struct itimerval *__value) __THROW; - -/* Set the timer WHICH to *NEW. If OLD is not NULL, - set *OLD to the old value of timer WHICH. - Returns 0 on success, -1 on errors. */ -extern int setitimer (__itimer_which_t __which, - const struct itimerval *__restrict __new, - struct itimerval *__restrict __old) __THROW; - -/* Change the access time of FILE to TVP[0] and the modification time of - FILE to TVP[1]. If TVP is a null pointer, use the current time instead. - Returns 0 on success, -1 on errors. */ -extern int utimes (const char *__file, const struct timeval __tvp[2]) - __THROW __nonnull ((1)); - -#ifdef __USE_MISC -/* Same as `utimes', but does not follow symbolic links. */ -extern int lutimes (const char *__file, const struct timeval __tvp[2]) - __THROW __nonnull ((1)); - -/* Same as `utimes', but takes an open file descriptor instead of a name. */ -extern int futimes (int __fd, const struct timeval __tvp[2]) __THROW; -#endif - -#ifdef __USE_GNU -/* Change the access time of FILE relative to FD to TVP[0] and the - modification time of FILE to TVP[1]. If TVP is a null pointer, use - the current time instead. Returns 0 on success, -1 on errors. */ -extern int futimesat (int __fd, const char *__file, - const struct timeval __tvp[2]) __THROW; -#endif - - -#ifdef __USE_MISC -/* Convenience macros for operations on timevals. - NOTE: `timercmp' does not work for >= or <=. */ -# define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) -# define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) -# define timercmp(a, b, CMP) \ - (((a)->tv_sec == (b)->tv_sec) ? \ - ((a)->tv_usec CMP (b)->tv_usec) : \ - ((a)->tv_sec CMP (b)->tv_sec)) -# define timeradd(a, b, result) \ - do { \ - (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ - (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ - if ((result)->tv_usec >= 1000000) \ - { \ - ++(result)->tv_sec; \ - (result)->tv_usec -= 1000000; \ - } \ - } while (0) -# define timersub(a, b, result) \ - do { \ - (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ - (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ - if ((result)->tv_usec < 0) { \ - --(result)->tv_sec; \ - (result)->tv_usec += 1000000; \ - } \ - } while (0) -#endif /* Misc. */ - -__END_DECLS - -#endif /* sys/time.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/timeb.h b/openflow/usr/include/arm-linux-gnueabihf/sys/timeb.h deleted file mode 100644 index 41d71bf..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/timeb.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 1994-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_TIMEB_H -#define _SYS_TIMEB_H 1 - -#include - -#define __need_time_t -#include - - -__BEGIN_DECLS - -/* Structure returned by the `ftime' function. */ - -struct timeb - { - time_t time; /* Seconds since epoch, as from `time'. */ - unsigned short int millitm; /* Additional milliseconds. */ - short int timezone; /* Minutes west of GMT. */ - short int dstflag; /* Nonzero if Daylight Savings Time used. */ - }; - -/* Fill in TIMEBUF with information about the current time. */ - -extern int ftime (struct timeb *__timebuf); - -__END_DECLS - -#endif /* sys/timeb.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/timerfd.h b/openflow/usr/include/arm-linux-gnueabihf/sys/timerfd.h deleted file mode 100644 index 3286997..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/timerfd.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 2008-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_TIMERFD_H -#define _SYS_TIMERFD_H 1 - -#include - -/* Get the platform-dependent flags. */ -#include - - -/* Bits to be set in the FLAGS parameter of `timerfd_settime'. */ -enum - { - TFD_TIMER_ABSTIME = 1 << 0 -#define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME - }; - - -__BEGIN_DECLS - -/* Return file descriptor for new interval timer source. */ -extern int timerfd_create (clockid_t __clock_id, int __flags) __THROW; - -/* Set next expiration time of interval timer source UFD to UTMR. If - FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is - absolute. Optionally return the old expiration time in OTMR. */ -extern int timerfd_settime (int __ufd, int __flags, - const struct itimerspec *__utmr, - struct itimerspec *__otmr) __THROW; - -/* Return the next expiration time of UFD. */ -extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW; - -__END_DECLS - -#endif /* sys/timerfd.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/times.h b/openflow/usr/include/arm-linux-gnueabihf/sys/times.h deleted file mode 100644 index a877d14..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/times.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * POSIX Standard: 4.5.2 Process Times - */ - -#ifndef _SYS_TIMES_H -#define _SYS_TIMES_H 1 - -#include - -#define __need_clock_t -#include - - -__BEGIN_DECLS - -/* Structure describing CPU time used by a process and its children. */ -struct tms - { - clock_t tms_utime; /* User CPU time. */ - clock_t tms_stime; /* System CPU time. */ - - clock_t tms_cutime; /* User CPU time of dead children. */ - clock_t tms_cstime; /* System CPU time of dead children. */ - }; - - -/* Store the CPU time used by this process and all its - dead children (and their dead children) in BUFFER. - Return the elapsed real time, or (clock_t) -1 for errors. - All times are in CLK_TCKths of a second. */ -extern clock_t times (struct tms *__buffer) __THROW; - -__END_DECLS - -#endif /* sys/times.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/timex.h b/openflow/usr/include/arm-linux-gnueabihf/sys/timex.h deleted file mode 100644 index 75e86dd..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/timex.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_TIMEX_H -#define _SYS_TIMEX_H 1 - -#include -#include - -/* These definitions from linux/timex.h as of 2.6.30. */ - -#include - -#define NTP_API 4 /* NTP API version */ - -struct ntptimeval -{ - struct timeval time; /* current time (ro) */ - long int maxerror; /* maximum error (us) (ro) */ - long int esterror; /* estimated error (us) (ro) */ - long int tai; /* TAI offset (ro) */ - - long int __glibc_reserved1; - long int __glibc_reserved2; - long int __glibc_reserved3; - long int __glibc_reserved4; -}; - -/* Clock states (time_state) */ -#define TIME_OK 0 /* clock synchronized, no leap second */ -#define TIME_INS 1 /* insert leap second */ -#define TIME_DEL 2 /* delete leap second */ -#define TIME_OOP 3 /* leap second in progress */ -#define TIME_WAIT 4 /* leap second has occurred */ -#define TIME_ERROR 5 /* clock not synchronized */ -#define TIME_BAD TIME_ERROR /* bw compat */ - -/* Maximum time constant of the PLL. */ -#define MAXTC 6 - -__BEGIN_DECLS - -extern int __adjtimex (struct timex *__ntx) __THROW; -extern int adjtimex (struct timex *__ntx) __THROW; - -#ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), - ntp_gettimex); -#else -extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW; -# define ntp_gettime ntp_gettimex -#endif -extern int ntp_adjtime (struct timex *__tntx) __THROW; - -__END_DECLS - -#endif /* sys/timex.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/ttychars.h b/openflow/usr/include/arm-linux-gnueabihf/sys/ttychars.h deleted file mode 100644 index 7043f60..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/ttychars.h +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ttychars.h 8.2 (Berkeley) 1/4/94 - */ - -/* - * 4.3 COMPATIBILITY FILE - * - * User visible structures and constants related to terminal handling. - */ -#ifndef _SYS_TTYCHARS_H -#define _SYS_TTYCHARS_H 1 - -struct ttychars { - char tc_erase; /* erase last character */ - char tc_kill; /* erase entire line */ - char tc_intrc; /* interrupt */ - char tc_quitc; /* quit */ - char tc_startc; /* start output */ - char tc_stopc; /* stop output */ - char tc_eofc; /* end-of-file */ - char tc_brkc; /* input delimiter (like nl) */ - char tc_suspc; /* stop process signal */ - char tc_dsuspc; /* delayed stop process signal */ - char tc_rprntc; /* reprint line */ - char tc_flushc; /* flush output (toggles) */ - char tc_werasc; /* word erase */ - char tc_lnextc; /* literal next character */ -}; - -#ifdef __USE_OLD_TTY -#include /* to pick up character defaults */ -#endif - -#endif /* sys/ttychars.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/ttydefaults.h b/openflow/usr/include/arm-linux-gnueabihf/sys/ttydefaults.h deleted file mode 100644 index 9be168b..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/ttydefaults.h +++ /dev/null @@ -1,100 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94 - */ - -/* - * System wide defaults for terminal state. Linux version. - */ -#ifndef _SYS_TTYDEFAULTS_H_ -#define _SYS_TTYDEFAULTS_H_ - -/* - * Defaults on "first" open. - */ -#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY) -#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS) -#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL) -#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL) -#define TTYDEF_SPEED (B9600) - -/* - * Control Character Defaults - */ -#define CTRL(x) (x&037) -#define CEOF CTRL('d') -#ifdef _POSIX_VDISABLE -# define CEOL _POSIX_VDISABLE -#else -# define CEOL '\0' /* XXX avoid _POSIX_VDISABLE */ -#endif -#define CERASE 0177 -#define CINTR CTRL('c') -#ifdef _POSIX_VDISABLE -# define CSTATUS _POSIX_VDISABLE -#else -# define CSTATUS '\0' /* XXX avoid _POSIX_VDISABLE */ -#endif -#define CKILL CTRL('u') -#define CMIN 1 -#define CQUIT 034 /* FS, ^\ */ -#define CSUSP CTRL('z') -#define CTIME 0 -#define CDSUSP CTRL('y') -#define CSTART CTRL('q') -#define CSTOP CTRL('s') -#define CLNEXT CTRL('v') -#define CDISCARD CTRL('o') -#define CWERASE CTRL('w') -#define CREPRINT CTRL('r') -#define CEOT CEOF -/* compat */ -#define CBRK CEOL -#define CRPRNT CREPRINT -#define CFLUSH CDISCARD - -/* PROTECTED INCLUSION ENDS HERE */ -#endif /* !_SYS_TTYDEFAULTS_H_ */ - -/* - * #define TTYDEFCHARS to include an array of default control characters. - */ -#ifdef TTYDEFCHARS -cc_t ttydefchars[NCCS] = { - CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, - _POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT, - CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE -}; -#undef TTYDEFCHARS -#endif diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/types.h b/openflow/usr/include/arm-linux-gnueabihf/sys/types.h deleted file mode 100644 index a728567..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/types.h +++ /dev/null @@ -1,275 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * POSIX Standard: 2.6 Primitive System Data Types - */ - -#ifndef _SYS_TYPES_H -#define _SYS_TYPES_H 1 - -#include - -__BEGIN_DECLS - -#include - -#ifdef __USE_MISC -# ifndef __u_char_defined -typedef __u_char u_char; -typedef __u_short u_short; -typedef __u_int u_int; -typedef __u_long u_long; -typedef __quad_t quad_t; -typedef __u_quad_t u_quad_t; -typedef __fsid_t fsid_t; -# define __u_char_defined -# endif -#endif - -typedef __loff_t loff_t; - -#ifndef __ino_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __ino_t ino_t; -# else -typedef __ino64_t ino_t; -# endif -# define __ino_t_defined -#endif -#if defined __USE_LARGEFILE64 && !defined __ino64_t_defined -typedef __ino64_t ino64_t; -# define __ino64_t_defined -#endif - -#ifndef __dev_t_defined -typedef __dev_t dev_t; -# define __dev_t_defined -#endif - -#ifndef __gid_t_defined -typedef __gid_t gid_t; -# define __gid_t_defined -#endif - -#ifndef __mode_t_defined -typedef __mode_t mode_t; -# define __mode_t_defined -#endif - -#ifndef __nlink_t_defined -typedef __nlink_t nlink_t; -# define __nlink_t_defined -#endif - -#ifndef __uid_t_defined -typedef __uid_t uid_t; -# define __uid_t_defined -#endif - -#ifndef __off_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __off_t off_t; -# else -typedef __off64_t off_t; -# endif -# define __off_t_defined -#endif -#if defined __USE_LARGEFILE64 && !defined __off64_t_defined -typedef __off64_t off64_t; -# define __off64_t_defined -#endif - -#ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -#endif - -#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) \ - && !defined __id_t_defined -typedef __id_t id_t; -# define __id_t_defined -#endif - -#ifndef __ssize_t_defined -typedef __ssize_t ssize_t; -# define __ssize_t_defined -#endif - -#ifdef __USE_MISC -# ifndef __daddr_t_defined -typedef __daddr_t daddr_t; -typedef __caddr_t caddr_t; -# define __daddr_t_defined -# endif -#endif - -#if (defined __USE_MISC || defined __USE_XOPEN) && !defined __key_t_defined -typedef __key_t key_t; -# define __key_t_defined -#endif - -#if defined __USE_XOPEN || defined __USE_XOPEN2K8 -# define __need_clock_t -#endif -#define __need_time_t -#define __need_timer_t -#define __need_clockid_t -#include - -#ifdef __USE_XOPEN -# ifndef __useconds_t_defined -typedef __useconds_t useconds_t; -# define __useconds_t_defined -# endif -# ifndef __suseconds_t_defined -typedef __suseconds_t suseconds_t; -# define __suseconds_t_defined -# endif -#endif - -#define __need_size_t -#include - -#ifdef __USE_MISC -/* Old compatibility names for C types. */ -typedef unsigned long int ulong; -typedef unsigned short int ushort; -typedef unsigned int uint; -#endif - -/* These size-specific names are used by some of the inet code. */ - -#if !__GNUC_PREREQ (2, 7) - -/* These types are defined by the ISO C99 header . */ -# ifndef __int8_t_defined -# define __int8_t_defined -typedef char int8_t; -typedef short int int16_t; -typedef int int32_t; -# if __WORDSIZE == 64 -typedef long int int64_t; -# else -__extension__ typedef long long int int64_t; -# endif -# endif - -/* But these were defined by ISO C without the first `_'. */ -typedef unsigned char u_int8_t; -typedef unsigned short int u_int16_t; -typedef unsigned int u_int32_t; -# if __WORDSIZE == 64 -typedef unsigned long int u_int64_t; -# else -__extension__ typedef unsigned long long int u_int64_t; -# endif - -typedef int register_t; - -#else - -/* For GCC 2.7 and later, we can use specific type-size attributes. */ -# define __intN_t(N, MODE) \ - typedef int int##N##_t __attribute__ ((__mode__ (MODE))) -# define __u_intN_t(N, MODE) \ - typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE))) - -# ifndef __int8_t_defined -# define __int8_t_defined -__intN_t (8, __QI__); -__intN_t (16, __HI__); -__intN_t (32, __SI__); -__intN_t (64, __DI__); -# endif - -__u_intN_t (8, __QI__); -__u_intN_t (16, __HI__); -__u_intN_t (32, __SI__); -__u_intN_t (64, __DI__); - -typedef int register_t __attribute__ ((__mode__ (__word__))); - - -/* Some code from BIND tests this macro to see if the types above are - defined. */ -#endif -#define __BIT_TYPES_DEFINED__ 1 - - -#ifdef __USE_MISC -/* In BSD is expected to define BYTE_ORDER. */ -# include - -/* It also defines `fd_set' and the FD_* macros for `select'. */ -# include - -/* BSD defines these symbols, so we follow. */ -# include -#endif /* Use misc. */ - - -#if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \ - && !defined __blksize_t_defined -typedef __blksize_t blksize_t; -# define __blksize_t_defined -#endif - -/* Types from the Large File Support interface. */ -#ifndef __USE_FILE_OFFSET64 -# ifndef __blkcnt_t_defined -typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */ -# define __blkcnt_t_defined -# endif -# ifndef __fsblkcnt_t_defined -typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ -# define __fsblkcnt_t_defined -# endif -# ifndef __fsfilcnt_t_defined -typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ -# define __fsfilcnt_t_defined -# endif -#else -# ifndef __blkcnt_t_defined -typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */ -# define __blkcnt_t_defined -# endif -# ifndef __fsblkcnt_t_defined -typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ -# define __fsblkcnt_t_defined -# endif -# ifndef __fsfilcnt_t_defined -typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ -# define __fsfilcnt_t_defined -# endif -#endif - -#ifdef __USE_LARGEFILE64 -typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */ -typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */ -typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */ -#endif - - -/* Now add the thread types. */ -#if defined __USE_POSIX199506 || defined __USE_UNIX98 -# include -#endif - -__END_DECLS - -#endif /* sys/types.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/ucontext.h b/openflow/usr/include/arm-linux-gnueabihf/sys/ucontext.h deleted file mode 100644 index f32eadc..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/ucontext.h +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright (C) 1998-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -/* System V/ARM ABI compliant context switching support. */ - -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 - -#include -#include - -/* We need the signal context definitions even if they are not used - included in . */ -#include - -typedef int greg_t; - -/* Number of general registers. */ -#define NGREG 18 - -/* Container for all general registers. */ -typedef greg_t gregset_t[NGREG]; - -/* Number of each register is the `gregset_t' array. */ -enum -{ - REG_R0 = 0, -#define REG_R0 REG_R0 - REG_R1 = 1, -#define REG_R1 REG_R1 - REG_R2 = 2, -#define REG_R2 REG_R2 - REG_R3 = 3, -#define REG_R3 REG_R3 - REG_R4 = 4, -#define REG_R4 REG_R4 - REG_R5 = 5, -#define REG_R5 REG_R5 - REG_R6 = 6, -#define REG_R6 REG_R6 - REG_R7 = 7, -#define REG_R7 REG_R7 - REG_R8 = 8, -#define REG_R8 REG_R8 - REG_R9 = 9, -#define REG_R9 REG_R9 - REG_R10 = 10, -#define REG_R10 REG_R10 - REG_R11 = 11, -#define REG_R11 REG_R11 - REG_R12 = 12, -#define REG_R12 REG_R12 - REG_R13 = 13, -#define REG_R13 REG_R13 - REG_R14 = 14, -#define REG_R14 REG_R14 - REG_R15 = 15 -#define REG_R15 REG_R15 -}; - -struct _libc_fpstate -{ - struct - { - unsigned int sign1:1; - unsigned int unused:15; - unsigned int sign2:1; - unsigned int exponent:14; - unsigned int j:1; - unsigned int mantissa1:31; - unsigned int mantissa0:32; - } fpregs[8]; - unsigned int fpsr:32; - unsigned int fpcr:32; - unsigned char ftype[8]; - unsigned int init_flag; -}; -/* Structure to describe FPU registers. */ -typedef struct _libc_fpstate fpregset_t; - -/* Context to describe whole processor state. This only describes - the core registers; coprocessor registers get saved elsewhere - (e.g. in uc_regspace, or somewhere unspecified on the stack - during non-RT signal handlers). */ -typedef struct sigcontext mcontext_t; - -/* Userlevel context. */ -typedef struct ucontext - { - unsigned long uc_flags; - struct ucontext *uc_link; - stack_t uc_stack; - mcontext_t uc_mcontext; - __sigset_t uc_sigmask; - unsigned long uc_regspace[128] __attribute__((__aligned__(8))); - } ucontext_t; - -#endif /* sys/ucontext.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/uio.h b/openflow/usr/include/arm-linux-gnueabihf/sys/uio.h deleted file mode 100644 index 2c98077..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/uio.h +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_UIO_H -#define _SYS_UIO_H 1 - -#include - -#include - -__BEGIN_DECLS - -/* This file defines `struct iovec'. */ -#include - - -/* Read data from file descriptor FD, and put the result in the - buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. - The buffers are filled in the order specified. - Operates just like 'read' (see ) except that data are - put in IOVEC instead of a contiguous buffer. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t readv (int __fd, const struct iovec *__iovec, int __count) - __wur; - -/* Write data pointed by the buffers described by IOVEC, which - is a vector of COUNT 'struct iovec's, to file descriptor FD. - The data is written in the order specified. - Operates just like 'write' (see ) except that the data - are taken from IOVEC instead of a contiguous buffer. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t writev (int __fd, const struct iovec *__iovec, int __count) - __wur; - - -#ifdef __USE_MISC -# ifndef __USE_FILE_OFFSET64 -/* Read data from file descriptor FD at the given position OFFSET - without change the file pointer, and put the result in the buffers - described by IOVEC, which is a vector of COUNT 'struct iovec's. - The buffers are filled in the order specified. Operates just like - 'pread' (see ) except that data are put in IOVEC instead - of a contiguous buffer. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count, - __off_t __offset) __wur; - -/* Write data pointed by the buffers described by IOVEC, which is a - vector of COUNT 'struct iovec's, to file descriptor FD at the given - position OFFSET without change the file pointer. The data is - written in the order specified. Operates just like 'pwrite' (see - ) except that the data are taken from IOVEC instead of a - contiguous buffer. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count, - __off_t __offset) __wur; -# else -# ifdef __REDIRECT -extern ssize_t __REDIRECT (preadv, (int __fd, const struct iovec *__iovec, - int __count, __off64_t __offset), - preadv64) __wur; -extern ssize_t __REDIRECT (pwritev, (int __fd, const struct iovec *__iovec, - int __count, __off64_t __offset), - pwritev64) __wur; -# else -# define preadv preadv64 -# define pwritev pwritev64 -# endif -# endif - -# ifdef __USE_LARGEFILE64 -/* Read data from file descriptor FD at the given position OFFSET - without change the file pointer, and put the result in the buffers - described by IOVEC, which is a vector of COUNT 'struct iovec's. - The buffers are filled in the order specified. Operates just like - 'pread' (see ) except that data are put in IOVEC instead - of a contiguous buffer. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t preadv64 (int __fd, const struct iovec *__iovec, int __count, - __off64_t __offset) __wur; - -/* Write data pointed by the buffers described by IOVEC, which is a - vector of COUNT 'struct iovec's, to file descriptor FD at the given - position OFFSET without change the file pointer. The data is - written in the order specified. Operates just like 'pwrite' (see - ) except that the data are taken from IOVEC instead of a - contiguous buffer. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count, - __off64_t __offset) __wur; -# endif -#endif /* Use misc. */ - -__END_DECLS - -#endif /* sys/uio.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/ultrasound.h b/openflow/usr/include/arm-linux-gnueabihf/sys/ultrasound.h deleted file mode 100644 index a65c385..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/ultrasound.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/un.h b/openflow/usr/include/arm-linux-gnueabihf/sys/un.h deleted file mode 100644 index 7a1a67b..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/un.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_UN_H -#define _SYS_UN_H 1 - -#include - -/* Get the definition of the macro to define the common sockaddr members. */ -#include - -__BEGIN_DECLS - -/* Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. */ -struct sockaddr_un - { - __SOCKADDR_COMMON (sun_); - char sun_path[108]; /* Path name. */ - }; - - -#ifdef __USE_MISC -# include /* For prototype of `strlen'. */ - -/* Evaluate to actual length of the `sockaddr_un' structure. */ -# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ - + strlen ((ptr)->sun_path)) -#endif - -__END_DECLS - -#endif /* sys/un.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/unistd.h b/openflow/usr/include/arm-linux-gnueabihf/sys/unistd.h deleted file mode 100644 index 1e823fb..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/unistd.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/user.h b/openflow/usr/include/arm-linux-gnueabihf/sys/user.h deleted file mode 100644 index 8c28608..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/user.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (C) 1998-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _SYS_USER_H -#define _SYS_USER_H 1 - -/* The whole purpose of this file is for GDB and GDB only. Don't read - too much into it. Don't use it for anything other than GDB unless - you know what you are doing. */ - -struct user_fpregs -{ - struct fp_reg - { - unsigned int sign1:1; - unsigned int unused:15; - unsigned int sign2:1; - unsigned int exponent:14; - unsigned int j:1; - unsigned int mantissa1:31; - unsigned int mantissa0:32; - } fpregs[8]; - unsigned int fpsr:32; - unsigned int fpcr:32; - unsigned char ftype[8]; - unsigned int init_flag; -}; - -struct user_regs -{ - unsigned long int uregs[18]; -}; - -struct user -{ - struct user_regs regs; /* General registers */ - int u_fpvalid; /* True if math co-processor being used. */ - - unsigned long int u_tsize; /* Text segment size (pages). */ - unsigned long int u_dsize; /* Data segment size (pages). */ - unsigned long int u_ssize; /* Stack segment size (pages). */ - - unsigned long start_code; /* Starting virtual address of text. */ - unsigned long start_stack; /* Starting virtual address of stack. */ - - long int signal; /* Signal that caused the core dump. */ - int reserved; /* No longer used */ - struct user_regs *u_ar0; /* help gdb to find the general registers. */ - - unsigned long magic; /* uniquely identify a core file */ - char u_comm[32]; /* User command that was responsible */ - int u_debugreg[8]; - struct user_fpregs u_fp; /* Floating point registers */ - struct user_fpregs *u_fp0; /* help gdb to find the FP registers. */ -}; - -#endif /* sys/user.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/ustat.h b/openflow/usr/include/arm-linux-gnueabihf/sys/ustat.h deleted file mode 100644 index b58a1de..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/ustat.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Header describing obsolete `ustat' interface. - Copyright (C) 1996-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * This interface is obsolete. Use instead. - */ - -#ifndef _SYS_USTAT_H -#define _SYS_USTAT_H 1 - -#include - -#include -#include - -__BEGIN_DECLS - -extern int ustat (__dev_t __dev, struct ustat *__ubuf) __THROW; - -__END_DECLS - -#endif /* sys/ustat.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/utsname.h b/openflow/usr/include/arm-linux-gnueabihf/sys/utsname.h deleted file mode 100644 index 05682a1..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/utsname.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * POSIX Standard: 4.4 System Identification - */ - -#ifndef _SYS_UTSNAME_H -#define _SYS_UTSNAME_H 1 - -#include - -__BEGIN_DECLS - -#include - -#ifndef _UTSNAME_SYSNAME_LENGTH -# define _UTSNAME_SYSNAME_LENGTH _UTSNAME_LENGTH -#endif -#ifndef _UTSNAME_NODENAME_LENGTH -# define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH -#endif -#ifndef _UTSNAME_RELEASE_LENGTH -# define _UTSNAME_RELEASE_LENGTH _UTSNAME_LENGTH -#endif -#ifndef _UTSNAME_VERSION_LENGTH -# define _UTSNAME_VERSION_LENGTH _UTSNAME_LENGTH -#endif -#ifndef _UTSNAME_MACHINE_LENGTH -# define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH -#endif - -/* Structure describing the system and machine. */ -struct utsname - { - /* Name of the implementation of the operating system. */ - char sysname[_UTSNAME_SYSNAME_LENGTH]; - - /* Name of this node on the network. */ - char nodename[_UTSNAME_NODENAME_LENGTH]; - - /* Current release level of this implementation. */ - char release[_UTSNAME_RELEASE_LENGTH]; - /* Current version level of this release. */ - char version[_UTSNAME_VERSION_LENGTH]; - - /* Name of the hardware type the system is running on. */ - char machine[_UTSNAME_MACHINE_LENGTH]; - -#if _UTSNAME_DOMAIN_LENGTH - 0 - /* Name of the domain of this node on the network. */ -# ifdef __USE_GNU - char domainname[_UTSNAME_DOMAIN_LENGTH]; -# else - char __domainname[_UTSNAME_DOMAIN_LENGTH]; -# endif -#endif - }; - -#ifdef __USE_MISC -/* Note that SVID assumes all members have the same size. */ -# define SYS_NMLN _UTSNAME_LENGTH -#endif - - -/* Put information about the system in NAME. */ -extern int uname (struct utsname *__name) __THROW; - - -__END_DECLS - -#endif /* sys/utsname.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/vfs.h b/openflow/usr/include/arm-linux-gnueabihf/sys/vfs.h deleted file mode 100644 index fa22d31..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/vfs.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Other systems declare `struct statfs' et al in , - so we have this file to be compatible with programs expecting it. */ - -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/vlimit.h b/openflow/usr/include/arm-linux-gnueabihf/sys/vlimit.h deleted file mode 100644 index d21b42d..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/vlimit.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_VLIMIT_H -#define _SYS_VLIMIT_H 1 - -#include - -__BEGIN_DECLS - -/* This interface is obsolete, and is superseded by . */ - -/* Kinds of resource limit. */ -enum __vlimit_resource -{ - /* Setting this non-zero makes it impossible to raise limits. - Only the super-use can set it to zero. - - This is not implemented in recent versions of BSD, nor by - the GNU C library. */ - LIM_NORAISE, - - /* CPU time available for each process (seconds). */ - LIM_CPU, - - /* Largest file which can be created (bytes). */ - LIM_FSIZE, - - /* Maximum size of the data segment (bytes). */ - LIM_DATA, - - /* Maximum size of the stack segment (bytes). */ - LIM_STACK, - - /* Largest core file that will be created (bytes). */ - LIM_CORE, - - /* Resident set size (bytes). */ - LIM_MAXRSS -}; - -/* This means no limit. */ -#define INFINITY 0x7fffffff - - -/* Set the soft limit for RESOURCE to be VALUE. - Returns 0 for success, -1 for failure. */ -extern int vlimit (enum __vlimit_resource __resource, int __value) __THROW; - - -__END_DECLS - -#endif /* sys/vlimit.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/vt.h b/openflow/usr/include/arm-linux-gnueabihf/sys/vt.h deleted file mode 100644 index 834abfb..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/vt.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/vtimes.h b/openflow/usr/include/arm-linux-gnueabihf/sys/vtimes.h deleted file mode 100644 index c6af2ba..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/vtimes.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_VTIMES_H -#define _SYS_VTIMES_H 1 - -#include - -__BEGIN_DECLS - -/* This interface is obsolete; use `getrusage' instead. */ - -/* Granularity of the `vm_utime' and `vm_stime' fields of a `struct vtimes'. - (This is the frequency of the machine's power supply, in Hz.) */ -#define VTIMES_UNITS_PER_SECOND 60 - -struct vtimes -{ - /* User time used in units of 1/VTIMES_UNITS_PER_SECOND seconds. */ - int vm_utime; - /* System time used in units of 1/VTIMES_UNITS_PER_SECOND seconds. */ - int vm_stime; - - /* Amount of data and stack memory used (kilobyte-seconds). */ - unsigned int vm_idsrss; - /* Amount of text memory used (kilobyte-seconds). */ - unsigned int vm_ixrss; - /* Maximum resident set size (text, data, and stack) (kilobytes). */ - int vm_maxrss; - - /* Number of hard page faults (i.e. those that required I/O). */ - int vm_majflt; - /* Number of soft page faults (i.e. those serviced by reclaiming - a page from the list of pages awaiting reallocation. */ - int vm_minflt; - - /* Number of times a process was swapped out of physical memory. */ - int vm_nswap; - - /* Number of input operations via the file system. Note: This - and `ru_oublock' do not include operations with the cache. */ - int vm_inblk; - /* Number of output operations via the file system. */ - int vm_oublk; -}; - -/* If CURRENT is not NULL, write statistics for the current process into - *CURRENT. If CHILD is not NULL, write statistics for all terminated child - processes into *CHILD. Returns 0 for success, -1 for failure. */ -extern int vtimes (struct vtimes * __current, struct vtimes * __child) __THROW; - -__END_DECLS - -#endif /* sys/vtimes.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/wait.h b/openflow/usr/include/arm-linux-gnueabihf/sys/wait.h deleted file mode 100644 index b983332..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/wait.h +++ /dev/null @@ -1,175 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * POSIX Standard: 3.2.1 Wait for Process Termination - */ - -#ifndef _SYS_WAIT_H -#define _SYS_WAIT_H 1 - -#include - -__BEGIN_DECLS - -#include - -/* These macros could also be defined in . */ -#if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8) -/* This will define the `W*' macros for the flag - bits to `waitpid', `wait3', and `wait4'. */ -# include - -# ifdef __USE_MISC - -/* Lots of hair to allow traditional BSD use of `union wait' - as well as POSIX.1 use of `int' for the status word. */ - -# if defined __GNUC__ && !defined __cplusplus -# define __WAIT_INT(status) \ - (__extension__ (((union { __typeof(status) __in; int __i; }) \ - { .__in = (status) }).__i)) -# else -# define __WAIT_INT(status) (*(const int *) &(status)) -# endif - -/* This is the type of the argument to `wait'. The funky union - causes redeclarations with either `int *' or `union wait *' to be - allowed without complaint. __WAIT_STATUS_DEFN is the type used in - the actual function definitions. */ - -# if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus -# define __WAIT_STATUS void * -# define __WAIT_STATUS_DEFN void * -# else -/* This works in GCC 2.6.1 and later. */ -typedef union - { - union wait *__uptr; - int *__iptr; - } __WAIT_STATUS __attribute__ ((__transparent_union__)); -# define __WAIT_STATUS_DEFN int * -# endif - -# else /* Don't use misc. */ - -# define __WAIT_INT(status) (status) -# define __WAIT_STATUS int * -# define __WAIT_STATUS_DEFN int * - -# endif /* Use misc. */ - -/* This will define all the `__W*' macros. */ -# include - -# define WEXITSTATUS(status) __WEXITSTATUS (__WAIT_INT (status)) -# define WTERMSIG(status) __WTERMSIG (__WAIT_INT (status)) -# define WSTOPSIG(status) __WSTOPSIG (__WAIT_INT (status)) -# define WIFEXITED(status) __WIFEXITED (__WAIT_INT (status)) -# define WIFSIGNALED(status) __WIFSIGNALED (__WAIT_INT (status)) -# define WIFSTOPPED(status) __WIFSTOPPED (__WAIT_INT (status)) -# ifdef __WIFCONTINUED -# define WIFCONTINUED(status) __WIFCONTINUED (__WAIT_INT (status)) -# endif -#endif /* not included. */ - -#ifdef __USE_MISC -# define WCOREFLAG __WCOREFLAG -# define WCOREDUMP(status) __WCOREDUMP (__WAIT_INT (status)) -# define W_EXITCODE(ret, sig) __W_EXITCODE (ret, sig) -# define W_STOPCODE(sig) __W_STOPCODE (sig) -#endif - -/* Wait for a child to die. When one does, put its status in *STAT_LOC - and return its process ID. For errors, return (pid_t) -1. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern __pid_t wait (__WAIT_STATUS __stat_loc); - -#ifdef __USE_MISC -/* Special values for the PID argument to `waitpid' and `wait4'. */ -# define WAIT_ANY (-1) /* Any process. */ -# define WAIT_MYPGRP 0 /* Any process in my process group. */ -#endif - -/* Wait for a child matching PID to die. - If PID is greater than 0, match any process whose process ID is PID. - If PID is (pid_t) -1, match any process. - If PID is (pid_t) 0, match any process with the - same process group as the current process. - If PID is less than -1, match any process whose - process group is the absolute value of PID. - If the WNOHANG bit is set in OPTIONS, and that child - is not already dead, return (pid_t) 0. If successful, - return PID and store the dead child's status in STAT_LOC. - Return (pid_t) -1 for errors. If the WUNTRACED bit is - set in OPTIONS, return status for stopped children; otherwise don't. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options); - -#if defined __USE_XOPEN || defined __USE_XOPEN2K8 -# ifndef __id_t_defined -# include -typedef __id_t id_t; -# define __id_t_defined -# endif - -# define __need_siginfo_t -# include - -/* Wait for a childing matching IDTYPE and ID to change the status and - place appropriate information in *INFOP. - If IDTYPE is P_PID, match any process whose process ID is ID. - If IDTYPE is P_PGID, match any process whose process group is ID. - If IDTYPE is P_ALL, match any process. - If the WNOHANG bit is set in OPTIONS, and that child - is not already dead, clear *INFOP and return 0. If successful, store - exit code and status in *INFOP. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop, - int __options); -#endif - -#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED -/* This being here makes the prototypes valid whether or not - we have already included to define `struct rusage'. */ -struct rusage; - -/* Wait for a child to exit. When one does, put its status in *STAT_LOC and - return its process ID. For errors return (pid_t) -1. If USAGE is not - nil, store information about the child's resource usage there. If the - WUNTRACED bit is set in OPTIONS, return status for stopped children; - otherwise don't. */ -extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options, - struct rusage * __usage) __THROWNL; -#endif - -#ifdef __USE_MISC -/* PID is like waitpid. Other args are like wait3. */ -extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options, - struct rusage *__usage) __THROWNL; -#endif /* Use misc. */ - - -__END_DECLS - -#endif /* sys/wait.h */ diff --git a/openflow/usr/include/arm-linux-gnueabihf/sys/xattr.h b/openflow/usr/include/arm-linux-gnueabihf/sys/xattr.h deleted file mode 100644 index 0bdce57..0000000 --- a/openflow/usr/include/arm-linux-gnueabihf/sys/xattr.h +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_XATTR_H -#define _SYS_XATTR_H 1 - -#include -#include - - -__BEGIN_DECLS - -/* The following constants should be used for the fifth parameter of - `*setxattr'. */ -#ifndef __USE_KERNEL_XATTR_DEFS -enum -{ - XATTR_CREATE = 1, /* set value, fail if attr already exists. */ -#define XATTR_CREATE XATTR_CREATE - XATTR_REPLACE = 2 /* set value, fail if attr does not exist. */ -#define XATTR_REPLACE XATTR_REPLACE -}; -#endif - -/* Set the attribute NAME of the file pointed to by PATH to VALUE (which - is SIZE bytes long). Return 0 on success, -1 for errors. */ -extern int setxattr (const char *__path, const char *__name, - const void *__value, size_t __size, int __flags) - __THROW; - -/* Set the attribute NAME of the file pointed to by PATH to VALUE (which is - SIZE bytes long), not following symlinks for the last pathname component. - Return 0 on success, -1 for errors. */ -extern int lsetxattr (const char *__path, const char *__name, - const void *__value, size_t __size, int __flags) - __THROW; - -/* Set the attribute NAME of the file descriptor FD to VALUE (which is SIZE - bytes long). Return 0 on success, -1 for errors. */ -extern int fsetxattr (int __fd, const char *__name, const void *__value, - size_t __size, int __flags) __THROW; - -/* Get the attribute NAME of the file pointed to by PATH to VALUE (which is - SIZE bytes long). Return 0 on success, -1 for errors. */ -extern ssize_t getxattr (const char *__path, const char *__name, - void *__value, size_t __size) __THROW; - -/* Get the attribute NAME of the file pointed to by PATH to VALUE (which is - SIZE bytes long), not following symlinks for the last pathname component. - Return 0 on success, -1 for errors. */ -extern ssize_t lgetxattr (const char *__path, const char *__name, - void *__value, size_t __size) __THROW; - -/* Get the attribute NAME of the file descriptor FD to VALUE (which is SIZE - bytes long). Return 0 on success, -1 for errors. */ -extern ssize_t fgetxattr (int __fd, const char *__name, void *__value, - size_t __size) __THROW; - -/* List attributes of the file pointed to by PATH into the user-supplied - buffer LIST (which is SIZE bytes big). Return 0 on success, -1 for - errors. */ -extern ssize_t listxattr (const char *__path, char *__list, size_t __size) - __THROW; - -/* List attributes of the file pointed to by PATH into the user-supplied - buffer LIST (which is SIZE bytes big), not following symlinks for the - last pathname component. Return 0 on success, -1 for errors. */ -extern ssize_t llistxattr (const char *__path, char *__list, size_t __size) - __THROW; - -/* List attributes of the file descriptor FD into the user-supplied buffer - LIST (which is SIZE bytes big). Return 0 on success, -1 for errors. */ -extern ssize_t flistxattr (int __fd, char *__list, size_t __size) - __THROW; - -/* Remove the attribute NAME from the file pointed to by PATH. Return 0 - on success, -1 for errors. */ -extern int removexattr (const char *__path, const char *__name) __THROW; - -/* Remove the attribute NAME from the file pointed to by PATH, not - following symlinks for the last pathname component. Return 0 on - success, -1 for errors. */ -extern int lremovexattr (const char *__path, const char *__name) __THROW; - -/* Remove the attribute NAME from the file descriptor FD. Return 0 on - success, -1 for errors. */ -extern int fremovexattr (int __fd, const char *__name) __THROW; - -__END_DECLS - -#endif /* sys/xattr.h */ diff --git a/openflow/usr/include/arpa/ftp.h b/openflow/usr/include/arpa/ftp.h deleted file mode 100644 index e5b340d..0000000 --- a/openflow/usr/include/arpa/ftp.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 1983, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ftp.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _ARPA_FTP_H -#define _ARPA_FTP_H 1 - -/* Definitions for FTP; see RFC-765. */ - -/* - * Reply codes. - */ -#define PRELIM 1 /* positive preliminary */ -#define COMPLETE 2 /* positive completion */ -#define CONTINUE 3 /* positive intermediate */ -#define TRANSIENT 4 /* transient negative completion */ -#define ERROR 5 /* permanent negative completion */ - -/* - * Type codes - */ -#define TYPE_A 1 /* ASCII */ -#define TYPE_E 2 /* EBCDIC */ -#define TYPE_I 3 /* image */ -#define TYPE_L 4 /* local byte size */ - -#ifdef FTP_NAMES -char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; -#endif - -/* - * Form codes - */ -#define FORM_N 1 /* non-print */ -#define FORM_T 2 /* telnet format effectors */ -#define FORM_C 3 /* carriage control (ASA) */ -#ifdef FTP_NAMES -char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; -#endif - -/* - * Structure codes - */ -#define STRU_F 1 /* file (no record structure) */ -#define STRU_R 2 /* record structure */ -#define STRU_P 3 /* page structure */ -#ifdef FTP_NAMES -char *strunames[] = {"0", "File", "Record", "Page" }; -#endif - -/* - * Mode types - */ -#define MODE_S 1 /* stream */ -#define MODE_B 2 /* block */ -#define MODE_C 3 /* compressed */ -#ifdef FTP_NAMES -char *modenames[] = {"0", "Stream", "Block", "Compressed" }; -#endif - -/* - * Record Tokens - */ -#define REC_ESC '\377' /* Record-mode Escape */ -#define REC_EOR '\001' /* Record-mode End-of-Record */ -#define REC_EOF '\002' /* Record-mode End-of-File */ - -/* - * Block Header - */ -#define BLK_EOR 0x80 /* Block is End-of-Record */ -#define BLK_EOF 0x40 /* Block is End-of-File */ -#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ -#define BLK_RESTART 0x10 /* Block is Restart Marker */ - -#define BLK_BYTECOUNT 2 /* Bytes in this block */ - -#endif /* arpa/ftp.h */ diff --git a/openflow/usr/include/arpa/inet.h b/openflow/usr/include/arpa/inet.h deleted file mode 100644 index 94d3330..0000000 --- a/openflow/usr/include/arpa/inet.h +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _ARPA_INET_H -#define _ARPA_INET_H 1 - -#include -#include /* To define `struct in_addr'. */ - -/* Type for length arguments in socket calls. */ -#ifndef __socklen_t_defined -typedef __socklen_t socklen_t; -# define __socklen_t_defined -#endif - -__BEGIN_DECLS - -/* Convert Internet host address from numbers-and-dots notation in CP - into binary data in network byte order. */ -extern in_addr_t inet_addr (const char *__cp) __THROW; - -/* Return the local host address part of the Internet address in IN. */ -extern in_addr_t inet_lnaof (struct in_addr __in) __THROW; - -/* Make Internet host address in network byte order by combining the - network number NET with the local address HOST. */ -extern struct in_addr inet_makeaddr (in_addr_t __net, in_addr_t __host) - __THROW; - -/* Return network number part of the Internet address IN. */ -extern in_addr_t inet_netof (struct in_addr __in) __THROW; - -/* Extract the network number in network byte order from the address - in numbers-and-dots natation starting at CP. */ -extern in_addr_t inet_network (const char *__cp) __THROW; - -/* Convert Internet number in IN to ASCII representation. The return value - is a pointer to an internal array containing the string. */ -extern char *inet_ntoa (struct in_addr __in) __THROW; - -/* Convert from presentation format of an Internet number in buffer - starting at CP to the binary network format and store result for - interface type AF in buffer starting at BUF. */ -extern int inet_pton (int __af, const char *__restrict __cp, - void *__restrict __buf) __THROW; - -/* Convert a Internet address in binary network format for interface - type AF in buffer starting at CP to presentation form and place - result in buffer of length LEN astarting at BUF. */ -extern const char *inet_ntop (int __af, const void *__restrict __cp, - char *__restrict __buf, socklen_t __len) - __THROW; - - -/* The following functions are not part of XNS 5.2. */ -#ifdef __USE_MISC -/* Convert Internet host address from numbers-and-dots notation in CP - into binary data and store the result in the structure INP. */ -extern int inet_aton (const char *__cp, struct in_addr *__inp) __THROW; - -/* Format a network number NET into presentation format and place result - in buffer starting at BUF with length of LEN bytes. */ -extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW; - -/* Convert network number for interface type AF in buffer starting at - CP to presentation format. The result will specifiy BITS bits of - the number. */ -extern char *inet_net_ntop (int __af, const void *__cp, int __bits, - char *__buf, size_t __len) __THROW; - -/* Convert network number for interface type AF from presentation in - buffer starting at CP to network format and store result int - buffer starting at BUF of size LEN. */ -extern int inet_net_pton (int __af, const char *__cp, - void *__buf, size_t __len) __THROW; - -/* Convert ASCII representation in hexadecimal form of the Internet - address to binary form and place result in buffer of length LEN - starting at BUF. */ -extern unsigned int inet_nsap_addr (const char *__cp, - unsigned char *__buf, int __len) __THROW; - -/* Convert internet address in binary form in LEN bytes starting at CP - a presentation form and place result in BUF. */ -extern char *inet_nsap_ntoa (int __len, const unsigned char *__cp, - char *__buf) __THROW; -#endif - -__END_DECLS - -#endif /* arpa/inet.h */ diff --git a/openflow/usr/include/arpa/nameser.h b/openflow/usr/include/arpa/nameser.h deleted file mode 100644 index fb8513b..0000000 --- a/openflow/usr/include/arpa/nameser.h +++ /dev/null @@ -1,535 +0,0 @@ -/* - * Copyright (c) 1983, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") - * Copyright (c) 1996-1999 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* - * $BINDId: nameser.h,v 8.37 2000/03/30 21:16:49 vixie Exp $ - */ - -#ifndef _ARPA_NAMESER_H_ -#define _ARPA_NAMESER_H_ - -/*! \file */ - -#define BIND_4_COMPAT - -#include -#if (!defined(BSD)) || (BSD < 199306) -# include -#else -# include -#endif -#include - -/*% - * Revision information. This is the release date in YYYYMMDD format. - * It can change every day so the right thing to do with it is use it - * in preprocessor commands such as "#if (__NAMESER > 19931104)". Do not - * compare for equality; rather, use it to determine whether your libbind.a - * contains a new enough lib/nameser/ to support the feature you need. - */ - -#define __NAMESER 19991006 /*%< New interface version stamp. */ -/* - * Define constants based on RFC 883, RFC 1034, RFC 1035 - */ -#define NS_PACKETSZ 512 /*%< default UDP packet size */ -#define NS_MAXDNAME 1025 /*%< maximum domain name */ -#define NS_MAXMSG 65535 /*%< maximum message size */ -#define NS_MAXCDNAME 255 /*%< maximum compressed domain name */ -#define NS_MAXLABEL 63 /*%< maximum length of domain label */ -#define NS_HFIXEDSZ 12 /*%< #/bytes of fixed data in header */ -#define NS_QFIXEDSZ 4 /*%< #/bytes of fixed data in query */ -#define NS_RRFIXEDSZ 10 /*%< #/bytes of fixed data in r record */ -#define NS_INT32SZ 4 /*%< #/bytes of data in a u_int32_t */ -#define NS_INT16SZ 2 /*%< #/bytes of data in a u_int16_t */ -#define NS_INT8SZ 1 /*%< #/bytes of data in a u_int8_t */ -#define NS_INADDRSZ 4 /*%< IPv4 T_A */ -#define NS_IN6ADDRSZ 16 /*%< IPv6 T_AAAA */ -#define NS_CMPRSFLGS 0xc0 /*%< Flag bits indicating name compression. */ -#define NS_DEFAULTPORT 53 /*%< For both TCP and UDP. */ -/* - * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord() - * in synch with it. - */ -typedef enum __ns_sect { - ns_s_qd = 0, /*%< Query: Question. */ - ns_s_zn = 0, /*%< Update: Zone. */ - ns_s_an = 1, /*%< Query: Answer. */ - ns_s_pr = 1, /*%< Update: Prerequisites. */ - ns_s_ns = 2, /*%< Query: Name servers. */ - ns_s_ud = 2, /*%< Update: Update. */ - ns_s_ar = 3, /*%< Query|Update: Additional records. */ - ns_s_max = 4 -} ns_sect; - -/*% - * This is a message handle. It is caller allocated and has no dynamic data. - * This structure is intended to be opaque to all but ns_parse.c, thus the - * leading _'s on the member names. Use the accessor functions, not the _'s. - */ -typedef struct __ns_msg { - const u_char *_msg, *_eom; - u_int16_t _id, _flags, _counts[ns_s_max]; - const u_char *_sections[ns_s_max]; - ns_sect _sect; - int _rrnum; - const u_char *_msg_ptr; -} ns_msg; - -/* Private data structure - do not use from outside library. */ -struct _ns_flagdata { int mask, shift; }; -extern const struct _ns_flagdata _ns_flagdata[]; - -/* Accessor macros - this is part of the public interface. */ - -#define ns_msg_id(handle) ((handle)._id + 0) -#define ns_msg_base(handle) ((handle)._msg + 0) -#define ns_msg_end(handle) ((handle)._eom + 0) -#define ns_msg_size(handle) ((handle)._eom - (handle)._msg) -#define ns_msg_count(handle, section) ((handle)._counts[section] + 0) - -/*% - * This is a parsed record. It is caller allocated and has no dynamic data. - */ -typedef struct __ns_rr { - char name[NS_MAXDNAME]; - u_int16_t type; - u_int16_t rr_class; - u_int32_t ttl; - u_int16_t rdlength; - const u_char * rdata; -} ns_rr; - -/* Accessor macros - this is part of the public interface. */ -#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".") -#define ns_rr_type(rr) ((ns_type)((rr).type + 0)) -#define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0)) -#define ns_rr_ttl(rr) ((rr).ttl + 0) -#define ns_rr_rdlen(rr) ((rr).rdlength + 0) -#define ns_rr_rdata(rr) ((rr).rdata + 0) - -/*% - * These don't have to be in the same order as in the packet flags word, - * and they can even overlap in some cases, but they will need to be kept - * in synch with ns_parse.c:ns_flagdata[]. - */ -typedef enum __ns_flag { - ns_f_qr, /*%< Question/Response. */ - ns_f_opcode, /*%< Operation code. */ - ns_f_aa, /*%< Authoritative Answer. */ - ns_f_tc, /*%< Truncation occurred. */ - ns_f_rd, /*%< Recursion Desired. */ - ns_f_ra, /*%< Recursion Available. */ - ns_f_z, /*%< MBZ. */ - ns_f_ad, /*%< Authentic Data (DNSSEC). */ - ns_f_cd, /*%< Checking Disabled (DNSSEC). */ - ns_f_rcode, /*%< Response code. */ - ns_f_max -} ns_flag; - -/*% - * Currently defined opcodes. - */ -typedef enum __ns_opcode { - ns_o_query = 0, /*%< Standard query. */ - ns_o_iquery = 1, /*%< Inverse query (deprecated/unsupported). */ - ns_o_status = 2, /*%< Name server status query (unsupported). */ - /* Opcode 3 is undefined/reserved. */ - ns_o_notify = 4, /*%< Zone change notification. */ - ns_o_update = 5, /*%< Zone update message. */ - ns_o_max = 6 -} ns_opcode; - -/*% - * Currently defined response codes. - */ -typedef enum __ns_rcode { - ns_r_noerror = 0, /*%< No error occurred. */ - ns_r_formerr = 1, /*%< Format error. */ - ns_r_servfail = 2, /*%< Server failure. */ - ns_r_nxdomain = 3, /*%< Name error. */ - ns_r_notimpl = 4, /*%< Unimplemented. */ - ns_r_refused = 5, /*%< Operation refused. */ - /* these are for BIND_UPDATE */ - ns_r_yxdomain = 6, /*%< Name exists */ - ns_r_yxrrset = 7, /*%< RRset exists */ - ns_r_nxrrset = 8, /*%< RRset does not exist */ - ns_r_notauth = 9, /*%< Not authoritative for zone */ - ns_r_notzone = 10, /*%< Zone of record different from zone section */ - ns_r_max = 11, - /* The following are EDNS extended rcodes */ - ns_r_badvers = 16, - /* The following are TSIG errors */ - ns_r_badsig = 16, - ns_r_badkey = 17, - ns_r_badtime = 18 -} ns_rcode; - -/* BIND_UPDATE */ -typedef enum __ns_update_operation { - ns_uop_delete = 0, - ns_uop_add = 1, - ns_uop_max = 2 -} ns_update_operation; - -/*% - * This structure is used for TSIG authenticated messages - */ -struct ns_tsig_key { - char name[NS_MAXDNAME], alg[NS_MAXDNAME]; - unsigned char *data; - int len; -}; -typedef struct ns_tsig_key ns_tsig_key; - -/*% - * This structure is used for TSIG authenticated TCP messages - */ -struct ns_tcp_tsig_state { - int counter; - struct dst_key *key; - void *ctx; - unsigned char sig[NS_PACKETSZ]; - int siglen; -}; -typedef struct ns_tcp_tsig_state ns_tcp_tsig_state; - -#define NS_TSIG_FUDGE 300 -#define NS_TSIG_TCP_COUNT 100 -#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT" - -#define NS_TSIG_ERROR_NO_TSIG -10 -#define NS_TSIG_ERROR_NO_SPACE -11 -#define NS_TSIG_ERROR_FORMERR -12 - -/*% - * Currently defined type values for resources and queries. - */ -typedef enum __ns_type { - ns_t_invalid = 0, /*%< Cookie. */ - ns_t_a = 1, /*%< Host address. */ - ns_t_ns = 2, /*%< Authoritative server. */ - ns_t_md = 3, /*%< Mail destination. */ - ns_t_mf = 4, /*%< Mail forwarder. */ - ns_t_cname = 5, /*%< Canonical name. */ - ns_t_soa = 6, /*%< Start of authority zone. */ - ns_t_mb = 7, /*%< Mailbox domain name. */ - ns_t_mg = 8, /*%< Mail group member. */ - ns_t_mr = 9, /*%< Mail rename name. */ - ns_t_null = 10, /*%< Null resource record. */ - ns_t_wks = 11, /*%< Well known service. */ - ns_t_ptr = 12, /*%< Domain name pointer. */ - ns_t_hinfo = 13, /*%< Host information. */ - ns_t_minfo = 14, /*%< Mailbox information. */ - ns_t_mx = 15, /*%< Mail routing information. */ - ns_t_txt = 16, /*%< Text strings. */ - ns_t_rp = 17, /*%< Responsible person. */ - ns_t_afsdb = 18, /*%< AFS cell database. */ - ns_t_x25 = 19, /*%< X_25 calling address. */ - ns_t_isdn = 20, /*%< ISDN calling address. */ - ns_t_rt = 21, /*%< Router. */ - ns_t_nsap = 22, /*%< NSAP address. */ - ns_t_nsap_ptr = 23, /*%< Reverse NSAP lookup (deprecated). */ - ns_t_sig = 24, /*%< Security signature. */ - ns_t_key = 25, /*%< Security key. */ - ns_t_px = 26, /*%< X.400 mail mapping. */ - ns_t_gpos = 27, /*%< Geographical position (withdrawn). */ - ns_t_aaaa = 28, /*%< Ip6 Address. */ - ns_t_loc = 29, /*%< Location Information. */ - ns_t_nxt = 30, /*%< Next domain (security). */ - ns_t_eid = 31, /*%< Endpoint identifier. */ - ns_t_nimloc = 32, /*%< Nimrod Locator. */ - ns_t_srv = 33, /*%< Server Selection. */ - ns_t_atma = 34, /*%< ATM Address */ - ns_t_naptr = 35, /*%< Naming Authority PoinTeR */ - ns_t_kx = 36, /*%< Key Exchange */ - ns_t_cert = 37, /*%< Certification record */ - ns_t_a6 = 38, /*%< IPv6 address (deprecated, use ns_t_aaaa) */ - ns_t_dname = 39, /*%< Non-terminal DNAME (for IPv6) */ - ns_t_sink = 40, /*%< Kitchen sink (experimentatl) */ - ns_t_opt = 41, /*%< EDNS0 option (meta-RR) */ - ns_t_apl = 42, /*%< Address prefix list (RFC3123) */ - ns_t_tkey = 249, /*%< Transaction key */ - ns_t_tsig = 250, /*%< Transaction signature. */ - ns_t_ixfr = 251, /*%< Incremental zone transfer. */ - ns_t_axfr = 252, /*%< Transfer zone of authority. */ - ns_t_mailb = 253, /*%< Transfer mailbox records. */ - ns_t_maila = 254, /*%< Transfer mail agent records. */ - ns_t_any = 255, /*%< Wildcard match. */ - ns_t_zxfr = 256, /*%< BIND-specific, nonstandard. */ - ns_t_max = 65536 -} ns_type; - -/* Exclusively a QTYPE? (not also an RTYPE) */ -#define ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \ - (t) == ns_t_mailb || (t) == ns_t_maila) -/* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */ -#define ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt) -/* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */ -#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t)) -#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr) -#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \ - (t) == ns_t_zxfr) - -/*% - * Values for class field - */ -typedef enum __ns_class { - ns_c_invalid = 0, /*%< Cookie. */ - ns_c_in = 1, /*%< Internet. */ - ns_c_2 = 2, /*%< unallocated/unsupported. */ - ns_c_chaos = 3, /*%< MIT Chaos-net. */ - ns_c_hs = 4, /*%< MIT Hesiod. */ - /* Query class values which do not appear in resource records */ - ns_c_none = 254, /*%< for prereq. sections in update requests */ - ns_c_any = 255, /*%< Wildcard match. */ - ns_c_max = 65536 -} ns_class; - -/* DNSSEC constants. */ - -typedef enum __ns_key_types { - ns_kt_rsa = 1, /*%< key type RSA/MD5 */ - ns_kt_dh = 2, /*%< Diffie Hellman */ - ns_kt_dsa = 3, /*%< Digital Signature Standard (MANDATORY) */ - ns_kt_private = 254 /*%< Private key type starts with OID */ -} ns_key_types; - -typedef enum __ns_cert_types { - cert_t_pkix = 1, /*%< PKIX (X.509v3) */ - cert_t_spki = 2, /*%< SPKI */ - cert_t_pgp = 3, /*%< PGP */ - cert_t_url = 253, /*%< URL private type */ - cert_t_oid = 254 /*%< OID private type */ -} ns_cert_types; - -/* Flags field of the KEY RR rdata. */ -#define NS_KEY_TYPEMASK 0xC000 /*%< Mask for "type" bits */ -#define NS_KEY_TYPE_AUTH_CONF 0x0000 /*%< Key usable for both */ -#define NS_KEY_TYPE_CONF_ONLY 0x8000 /*%< Key usable for confidentiality */ -#define NS_KEY_TYPE_AUTH_ONLY 0x4000 /*%< Key usable for authentication */ -#define NS_KEY_TYPE_NO_KEY 0xC000 /*%< No key usable for either; no key */ -/* The type bits can also be interpreted independently, as single bits: */ -#define NS_KEY_NO_AUTH 0x8000 /*%< Key unusable for authentication */ -#define NS_KEY_NO_CONF 0x4000 /*%< Key unusable for confidentiality */ -#define NS_KEY_RESERVED2 0x2000 /* Security is *mandatory* if bit=0 */ -#define NS_KEY_EXTENDED_FLAGS 0x1000 /*%< reserved - must be zero */ -#define NS_KEY_RESERVED4 0x0800 /*%< reserved - must be zero */ -#define NS_KEY_RESERVED5 0x0400 /*%< reserved - must be zero */ -#define NS_KEY_NAME_TYPE 0x0300 /*%< these bits determine the type */ -#define NS_KEY_NAME_USER 0x0000 /*%< key is assoc. with user */ -#define NS_KEY_NAME_ENTITY 0x0200 /*%< key is assoc. with entity eg host */ -#define NS_KEY_NAME_ZONE 0x0100 /*%< key is zone key */ -#define NS_KEY_NAME_RESERVED 0x0300 /*%< reserved meaning */ -#define NS_KEY_RESERVED8 0x0080 /*%< reserved - must be zero */ -#define NS_KEY_RESERVED9 0x0040 /*%< reserved - must be zero */ -#define NS_KEY_RESERVED10 0x0020 /*%< reserved - must be zero */ -#define NS_KEY_RESERVED11 0x0010 /*%< reserved - must be zero */ -#define NS_KEY_SIGNATORYMASK 0x000F /*%< key can sign RR's of same name */ -#define NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \ - NS_KEY_RESERVED4 | \ - NS_KEY_RESERVED5 | \ - NS_KEY_RESERVED8 | \ - NS_KEY_RESERVED9 | \ - NS_KEY_RESERVED10 | \ - NS_KEY_RESERVED11 ) -#define NS_KEY_RESERVED_BITMASK2 0xFFFF /*%< no bits defined here */ -/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */ -#define NS_ALG_MD5RSA 1 /*%< MD5 with RSA */ -#define NS_ALG_DH 2 /*%< Diffie Hellman KEY */ -#define NS_ALG_DSA 3 /*%< DSA KEY */ -#define NS_ALG_DSS NS_ALG_DSA -#define NS_ALG_EXPIRE_ONLY 253 /*%< No alg, no security */ -#define NS_ALG_PRIVATE_OID 254 /*%< Key begins with OID giving alg */ -/* Protocol values */ -/* value 0 is reserved */ -#define NS_KEY_PROT_TLS 1 -#define NS_KEY_PROT_EMAIL 2 -#define NS_KEY_PROT_DNSSEC 3 -#define NS_KEY_PROT_IPSEC 4 -#define NS_KEY_PROT_ANY 255 - -/* Signatures */ -#define NS_MD5RSA_MIN_BITS 512 /*%< Size of a mod or exp in bits */ -#define NS_MD5RSA_MAX_BITS 4096 - /* Total of binary mod and exp */ -#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3) - /* Max length of text sig block */ -#define NS_MD5RSA_MAX_BASE64 (((NS_MD5RSA_MAX_BYTES+2)/3)*4) -#define NS_MD5RSA_MIN_SIZE ((NS_MD5RSA_MIN_BITS+7)/8) -#define NS_MD5RSA_MAX_SIZE ((NS_MD5RSA_MAX_BITS+7)/8) - -#define NS_DSA_SIG_SIZE 41 -#define NS_DSA_MIN_SIZE 213 -#define NS_DSA_MAX_BYTES 405 - -/* Offsets into SIG record rdata to find various values */ -#define NS_SIG_TYPE 0 /*%< Type flags */ -#define NS_SIG_ALG 2 /*%< Algorithm */ -#define NS_SIG_LABELS 3 /*%< How many labels in name */ -#define NS_SIG_OTTL 4 /*%< Original TTL */ -#define NS_SIG_EXPIR 8 /*%< Expiration time */ -#define NS_SIG_SIGNED 12 /*%< Signature time */ -#define NS_SIG_FOOT 16 /*%< Key footprint */ -#define NS_SIG_SIGNER 18 /*%< Domain name of who signed it */ -/* How RR types are represented as bit-flags in NXT records */ -#define NS_NXT_BITS 8 -#define NS_NXT_BIT_SET( n,p) (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS))) -#define NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS))) -#define NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS))) -#define NS_NXT_MAX 127 - -/*% - * EDNS0 extended flags and option codes, host order. - */ -#define NS_OPT_DNSSEC_OK 0x8000U -#define NS_OPT_NSID 3 - -/*% - * Inline versions of get/put short/long. Pointer is advanced. - */ -#define NS_GET16(s, cp) do { \ - const u_char *t_cp = (const u_char *)(cp); \ - (s) = ((u_int16_t)t_cp[0] << 8) \ - | ((u_int16_t)t_cp[1]) \ - ; \ - (cp) += NS_INT16SZ; \ -} while (0) - -#define NS_GET32(l, cp) do { \ - const u_char *t_cp = (const u_char *)(cp); \ - (l) = ((u_int32_t)t_cp[0] << 24) \ - | ((u_int32_t)t_cp[1] << 16) \ - | ((u_int32_t)t_cp[2] << 8) \ - | ((u_int32_t)t_cp[3]) \ - ; \ - (cp) += NS_INT32SZ; \ -} while (0) - -#define NS_PUT16(s, cp) do { \ - u_int16_t t_s = (u_int16_t)(s); \ - u_char *t_cp = (u_char *)(cp); \ - *t_cp++ = t_s >> 8; \ - *t_cp = t_s; \ - (cp) += NS_INT16SZ; \ -} while (0) - -#define NS_PUT32(l, cp) do { \ - u_int32_t t_l = (u_int32_t)(l); \ - u_char *t_cp = (u_char *)(cp); \ - *t_cp++ = t_l >> 24; \ - *t_cp++ = t_l >> 16; \ - *t_cp++ = t_l >> 8; \ - *t_cp = t_l; \ - (cp) += NS_INT32SZ; \ -} while (0) - -__BEGIN_DECLS -int ns_msg_getflag (ns_msg, int) __THROW; -u_int ns_get16 (const u_char *) __THROW; -u_long ns_get32 (const u_char *) __THROW; -void ns_put16 (u_int, u_char *) __THROW; -void ns_put32 (u_long, u_char *) __THROW; -int ns_initparse (const u_char *, int, ns_msg *) __THROW; -int ns_skiprr (const u_char *, const u_char *, ns_sect, int) - __THROW; -int ns_parserr (ns_msg *, ns_sect, int, ns_rr *) __THROW; -int ns_sprintrr (const ns_msg *, const ns_rr *, - const char *, const char *, char *, size_t) - __THROW; -int ns_sprintrrf (const u_char *, size_t, const char *, - ns_class, ns_type, u_long, const u_char *, - size_t, const char *, const char *, - char *, size_t) __THROW; -int ns_format_ttl (u_long, char *, size_t) __THROW; -int ns_parse_ttl (const char *, u_long *) __THROW; -u_int32_t ns_datetosecs (const char *, int *) __THROW; -int ns_name_ntol (const u_char *, u_char *, size_t) __THROW; -int ns_name_ntop (const u_char *, char *, size_t) __THROW; -int ns_name_pton (const char *, u_char *, size_t) __THROW; -int ns_name_unpack (const u_char *, const u_char *, - const u_char *, u_char *, size_t) __THROW; -int ns_name_pack (const u_char *, u_char *, int, - const u_char **, const u_char **) __THROW; -int ns_name_uncompress (const u_char *, const u_char *, - const u_char *, char *, size_t) __THROW; -int ns_name_compress (const char *, u_char *, size_t, - const u_char **, const u_char **) __THROW; -int ns_name_skip (const u_char **, const u_char *) __THROW; -void ns_name_rollback (const u_char *, const u_char **, - const u_char **) __THROW; -int ns_sign (u_char *, int *, int, int, void *, - const u_char *, int, u_char *, int *, time_t) __THROW; -int ns_sign2 (u_char *, int *, int, int, void *, - const u_char *, int, u_char *, int *, time_t, - u_char **, u_char **) __THROW; -int ns_sign_tcp (u_char *, int *, int, int, - ns_tcp_tsig_state *, int) __THROW; -int ns_sign_tcp2 (u_char *, int *, int, int, - ns_tcp_tsig_state *, int, - u_char **, u_char **) __THROW; -int ns_sign_tcp_init (void *, const u_char *, int, - ns_tcp_tsig_state *) __THROW; -u_char *ns_find_tsig (u_char *, u_char *) __THROW; -int ns_verify (u_char *, int *, void *, const u_char *, int, - u_char *, int *, time_t *, int) __THROW; -int ns_verify_tcp (u_char *, int *, ns_tcp_tsig_state *, int) - __THROW; -int ns_verify_tcp_init (void *, const u_char *, int, - ns_tcp_tsig_state *) __THROW; -int ns_samedomain (const char *, const char *) __THROW; -int ns_subdomain (const char *, const char *) __THROW; -int ns_makecanon (const char *, char *, size_t) __THROW; -int ns_samename (const char *, const char *) __THROW; -__END_DECLS - -#ifdef BIND_4_COMPAT -#include -#endif - -#endif /* !_ARPA_NAMESER_H_ */ -/*! \file */ diff --git a/openflow/usr/include/arpa/nameser_compat.h b/openflow/usr/include/arpa/nameser_compat.h deleted file mode 100644 index d59c9e4..0000000 --- a/openflow/usr/include/arpa/nameser_compat.h +++ /dev/null @@ -1,187 +0,0 @@ -/* Copyright (c) 1983, 1989 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*% - * from nameser.h 8.1 (Berkeley) 6/2/93 - * $BINDId: nameser_compat.h,v 8.11 1999/01/02 08:00:58 vixie Exp $ - */ - -#ifndef _ARPA_NAMESER_COMPAT_ -#define _ARPA_NAMESER_COMPAT_ - -#define __BIND 19950621 /*%< (DEAD) interface version stamp. */ - -#include - -/*% - * Structure for query header. The order of the fields is machine- and - * compiler-dependent, depending on the byte/bit order and the layout - * of bit fields. We use bit fields only in int variables, as this - * is all ANSI requires. This requires a somewhat confusing rearrangement. - */ - -typedef struct { - unsigned id :16; /*%< query identification number */ -#if BYTE_ORDER == BIG_ENDIAN - /* fields in third byte */ - unsigned qr: 1; /*%< response flag */ - unsigned opcode: 4; /*%< purpose of message */ - unsigned aa: 1; /*%< authoritive answer */ - unsigned tc: 1; /*%< truncated message */ - unsigned rd: 1; /*%< recursion desired */ - /* fields in fourth byte */ - unsigned ra: 1; /*%< recursion available */ - unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */ - unsigned ad: 1; /*%< authentic data from named */ - unsigned cd: 1; /*%< checking disabled by resolver */ - unsigned rcode :4; /*%< response code */ -#endif -#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN - /* fields in third byte */ - unsigned rd :1; /*%< recursion desired */ - unsigned tc :1; /*%< truncated message */ - unsigned aa :1; /*%< authoritive answer */ - unsigned opcode :4; /*%< purpose of message */ - unsigned qr :1; /*%< response flag */ - /* fields in fourth byte */ - unsigned rcode :4; /*%< response code */ - unsigned cd: 1; /*%< checking disabled by resolver */ - unsigned ad: 1; /*%< authentic data from named */ - unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */ - unsigned ra :1; /*%< recursion available */ -#endif - /* remaining bytes */ - unsigned qdcount :16; /*%< number of question entries */ - unsigned ancount :16; /*%< number of answer entries */ - unsigned nscount :16; /*%< number of authority entries */ - unsigned arcount :16; /*%< number of resource entries */ -} HEADER; - -#define PACKETSZ NS_PACKETSZ -#define MAXDNAME NS_MAXDNAME -#define MAXCDNAME NS_MAXCDNAME -#define MAXLABEL NS_MAXLABEL -#define HFIXEDSZ NS_HFIXEDSZ -#define QFIXEDSZ NS_QFIXEDSZ -#define RRFIXEDSZ NS_RRFIXEDSZ -#define INT32SZ NS_INT32SZ -#define INT16SZ NS_INT16SZ -#define INT8SZ NS_INT8SZ -#define INADDRSZ NS_INADDRSZ -#define IN6ADDRSZ NS_IN6ADDRSZ -#define INDIR_MASK NS_CMPRSFLGS -#define NAMESERVER_PORT NS_DEFAULTPORT - -#define S_ZONE ns_s_zn -#define S_PREREQ ns_s_pr -#define S_UPDATE ns_s_ud -#define S_ADDT ns_s_ar - -#define QUERY ns_o_query -#define IQUERY ns_o_iquery -#define STATUS ns_o_status -#define NS_NOTIFY_OP ns_o_notify -#define NS_UPDATE_OP ns_o_update - -#define NOERROR ns_r_noerror -#define FORMERR ns_r_formerr -#define SERVFAIL ns_r_servfail -#define NXDOMAIN ns_r_nxdomain -#define NOTIMP ns_r_notimpl -#define REFUSED ns_r_refused -#define YXDOMAIN ns_r_yxdomain -#define YXRRSET ns_r_yxrrset -#define NXRRSET ns_r_nxrrset -#define NOTAUTH ns_r_notauth -#define NOTZONE ns_r_notzone -/*#define BADSIG ns_r_badsig*/ -/*#define BADKEY ns_r_badkey*/ -/*#define BADTIME ns_r_badtime*/ - - -#define DELETE ns_uop_delete -#define ADD ns_uop_add - -#define T_A ns_t_a -#define T_NS ns_t_ns -#define T_MD ns_t_md -#define T_MF ns_t_mf -#define T_CNAME ns_t_cname -#define T_SOA ns_t_soa -#define T_MB ns_t_mb -#define T_MG ns_t_mg -#define T_MR ns_t_mr -#define T_NULL ns_t_null -#define T_WKS ns_t_wks -#define T_PTR ns_t_ptr -#define T_HINFO ns_t_hinfo -#define T_MINFO ns_t_minfo -#define T_MX ns_t_mx -#define T_TXT ns_t_txt -#define T_RP ns_t_rp -#define T_AFSDB ns_t_afsdb -#define T_X25 ns_t_x25 -#define T_ISDN ns_t_isdn -#define T_RT ns_t_rt -#define T_NSAP ns_t_nsap -#define T_NSAP_PTR ns_t_nsap_ptr -#define T_SIG ns_t_sig -#define T_KEY ns_t_key -#define T_PX ns_t_px -#define T_GPOS ns_t_gpos -#define T_AAAA ns_t_aaaa -#define T_LOC ns_t_loc -#define T_NXT ns_t_nxt -#define T_EID ns_t_eid -#define T_NIMLOC ns_t_nimloc -#define T_SRV ns_t_srv -#define T_ATMA ns_t_atma -#define T_NAPTR ns_t_naptr -#define T_A6 ns_t_a6 -#define T_DNAME ns_t_dname -#define T_TSIG ns_t_tsig -#define T_IXFR ns_t_ixfr -#define T_AXFR ns_t_axfr -#define T_MAILB ns_t_mailb -#define T_MAILA ns_t_maila -#define T_ANY ns_t_any - -#define C_IN ns_c_in -#define C_CHAOS ns_c_chaos -#define C_HS ns_c_hs -/* BIND_UPDATE */ -#define C_NONE ns_c_none -#define C_ANY ns_c_any - -#define GETSHORT NS_GET16 -#define GETLONG NS_GET32 -#define PUTSHORT NS_PUT16 -#define PUTLONG NS_PUT32 - -#endif /* _ARPA_NAMESER_COMPAT_ */ -/*! \file */ diff --git a/openflow/usr/include/arpa/telnet.h b/openflow/usr/include/arpa/telnet.h deleted file mode 100644 index 3774c89..0000000 --- a/openflow/usr/include/arpa/telnet.h +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)telnet.h 8.2 (Berkeley) 12/15/93 - */ - -#ifndef _ARPA_TELNET_H -#define _ARPA_TELNET_H 1 - -/* - * Definitions for the TELNET protocol. - */ -#define IAC 255 /* interpret as command: */ -#define DONT 254 /* you are not to use option */ -#define DO 253 /* please, you use option */ -#define WONT 252 /* I won't use option */ -#define WILL 251 /* I will use option */ -#define SB 250 /* interpret as subnegotiation */ -#define GA 249 /* you may reverse the line */ -#define EL 248 /* erase the current line */ -#define EC 247 /* erase the current character */ -#define AYT 246 /* are you there */ -#define AO 245 /* abort output--but let prog finish */ -#define IP 244 /* interrupt process--permanently */ -#define BREAK 243 /* break */ -#define DM 242 /* data mark--for connect. cleaning */ -#define NOP 241 /* nop */ -#define SE 240 /* end sub negotiation */ -#define EOR 239 /* end of record (transparent mode) */ -#define ABORT 238 /* Abort process */ -#define SUSP 237 /* Suspend process */ -#define xEOF 236 /* End of file: EOF is already used... */ - -#define SYNCH 242 /* for telfunc calls */ - -#ifdef TELCMDS -char *telcmds[] = { - "EOF", "SUSP", "ABORT", "EOR", - "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", - "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, -}; -#else -extern char *telcmds[]; -#endif - -#define TELCMD_FIRST xEOF -#define TELCMD_LAST IAC -#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ - (unsigned int)(x) >= TELCMD_FIRST) -#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] - -/* telnet options */ -#define TELOPT_BINARY 0 /* 8-bit data path */ -#define TELOPT_ECHO 1 /* echo */ -#define TELOPT_RCP 2 /* prepare to reconnect */ -#define TELOPT_SGA 3 /* suppress go ahead */ -#define TELOPT_NAMS 4 /* approximate message size */ -#define TELOPT_STATUS 5 /* give status */ -#define TELOPT_TM 6 /* timing mark */ -#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ -#define TELOPT_NAOL 8 /* negotiate about output line width */ -#define TELOPT_NAOP 9 /* negotiate about output page size */ -#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ -#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ -#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ -#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ -#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ -#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ -#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ -#define TELOPT_XASCII 17 /* extended ascii character set */ -#define TELOPT_LOGOUT 18 /* force logout */ -#define TELOPT_BM 19 /* byte macro */ -#define TELOPT_DET 20 /* data entry terminal */ -#define TELOPT_SUPDUP 21 /* supdup protocol */ -#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ -#define TELOPT_SNDLOC 23 /* send location */ -#define TELOPT_TTYPE 24 /* terminal type */ -#define TELOPT_EOR 25 /* end or record */ -#define TELOPT_TUID 26 /* TACACS user identification */ -#define TELOPT_OUTMRK 27 /* output marking */ -#define TELOPT_TTYLOC 28 /* terminal location number */ -#define TELOPT_3270REGIME 29 /* 3270 regime */ -#define TELOPT_X3PAD 30 /* X.3 PAD */ -#define TELOPT_NAWS 31 /* window size */ -#define TELOPT_TSPEED 32 /* terminal speed */ -#define TELOPT_LFLOW 33 /* remote flow control */ -#define TELOPT_LINEMODE 34 /* Linemode option */ -#define TELOPT_XDISPLOC 35 /* X Display Location */ -#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ -#define TELOPT_AUTHENTICATION 37/* Authenticate */ -#define TELOPT_ENCRYPT 38 /* Encryption option */ -#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ -#define TELOPT_EXOPL 255 /* extended-options-list */ - - -#define NTELOPTS (1+TELOPT_NEW_ENVIRON) -#ifdef TELOPTS -char *telopts[NTELOPTS+1] = { - "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", - "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", - "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", - "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", - "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", - "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", - "TACACS UID", "OUTPUT MARKING", "TTYLOC", - "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", - "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", - "ENCRYPT", "NEW-ENVIRON", - 0, -}; -#define TELOPT_FIRST TELOPT_BINARY -#define TELOPT_LAST TELOPT_NEW_ENVIRON -#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) -#define TELOPT(x) telopts[(x)-TELOPT_FIRST] -#endif - -/* sub-option qualifiers */ -#define TELQUAL_IS 0 /* option is... */ -#define TELQUAL_SEND 1 /* send option */ -#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ -#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ -#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ - -#define LFLOW_OFF 0 /* Disable remote flow control */ -#define LFLOW_ON 1 /* Enable remote flow control */ -#define LFLOW_RESTART_ANY 2 /* Restart output on any char */ -#define LFLOW_RESTART_XON 3 /* Restart output only on XON */ - -/* - * LINEMODE suboptions - */ - -#define LM_MODE 1 -#define LM_FORWARDMASK 2 -#define LM_SLC 3 - -#define MODE_EDIT 0x01 -#define MODE_TRAPSIG 0x02 -#define MODE_ACK 0x04 -#define MODE_SOFT_TAB 0x08 -#define MODE_LIT_ECHO 0x10 - -#define MODE_MASK 0x1f - -/* Not part of protocol, but needed to simplify things... */ -#define MODE_FLOW 0x0100 -#define MODE_ECHO 0x0200 -#define MODE_INBIN 0x0400 -#define MODE_OUTBIN 0x0800 -#define MODE_FORCE 0x1000 - -#define SLC_SYNCH 1 -#define SLC_BRK 2 -#define SLC_IP 3 -#define SLC_AO 4 -#define SLC_AYT 5 -#define SLC_EOR 6 -#define SLC_ABORT 7 -#define SLC_EOF 8 -#define SLC_SUSP 9 -#define SLC_EC 10 -#define SLC_EL 11 -#define SLC_EW 12 -#define SLC_RP 13 -#define SLC_LNEXT 14 -#define SLC_XON 15 -#define SLC_XOFF 16 -#define SLC_FORW1 17 -#define SLC_FORW2 18 - -#define NSLC 18 - -/* - * For backwards compatibility, we define SLC_NAMES to be the - * list of names if SLC_NAMES is not defined. - */ -#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ - "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ - "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, -#ifdef SLC_NAMES -char *slc_names[] = { - SLC_NAMELIST -}; -#else -extern char *slc_names[]; -#define SLC_NAMES SLC_NAMELIST -#endif - -#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) -#define SLC_NAME(x) slc_names[x] - -#define SLC_NOSUPPORT 0 -#define SLC_CANTCHANGE 1 -#define SLC_VARIABLE 2 -#define SLC_DEFAULT 3 -#define SLC_LEVELBITS 0x03 - -#define SLC_FUNC 0 -#define SLC_FLAGS 1 -#define SLC_VALUE 2 - -#define SLC_ACK 0x80 -#define SLC_FLUSHIN 0x40 -#define SLC_FLUSHOUT 0x20 - -#define OLD_ENV_VAR 1 -#define OLD_ENV_VALUE 0 -#define NEW_ENV_VAR 0 -#define NEW_ENV_VALUE 1 -#define ENV_ESC 2 -#define ENV_USERVAR 3 - -/* - * AUTHENTICATION suboptions - */ - -/* - * Who is authenticating who ... - */ -#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ -#define AUTH_WHO_SERVER 1 /* Server authenticating client */ -#define AUTH_WHO_MASK 1 - -/* - * amount of authentication done - */ -#define AUTH_HOW_ONE_WAY 0 -#define AUTH_HOW_MUTUAL 2 -#define AUTH_HOW_MASK 2 - -#define AUTHTYPE_NULL 0 -#define AUTHTYPE_KERBEROS_V4 1 -#define AUTHTYPE_KERBEROS_V5 2 -#define AUTHTYPE_SPX 3 -#define AUTHTYPE_MINK 4 -#define AUTHTYPE_CNT 5 - -#define AUTHTYPE_TEST 99 - -#ifdef AUTH_NAMES -char *authtype_names[] = { - "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, -}; -#else -extern char *authtype_names[]; -#endif - -#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) -#define AUTHTYPE_NAME(x) authtype_names[x] - -/* - * ENCRYPTion suboptions - */ -#define ENCRYPT_IS 0 /* I pick encryption type ... */ -#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ -#define ENCRYPT_REPLY 2 /* Initial setup response */ -#define ENCRYPT_START 3 /* Am starting to send encrypted */ -#define ENCRYPT_END 4 /* Am ending encrypted */ -#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ -#define ENCRYPT_REQEND 6 /* Request you send encrypting */ -#define ENCRYPT_ENC_KEYID 7 -#define ENCRYPT_DEC_KEYID 8 -#define ENCRYPT_CNT 9 - -#define ENCTYPE_ANY 0 -#define ENCTYPE_DES_CFB64 1 -#define ENCTYPE_DES_OFB64 2 -#define ENCTYPE_CNT 3 - -#ifdef ENCRYPT_NAMES -char *encrypt_names[] = { - "IS", "SUPPORT", "REPLY", "START", "END", - "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", - 0, -}; -char *enctype_names[] = { - "ANY", "DES_CFB64", "DES_OFB64", 0, -}; -#else -extern char *encrypt_names[]; -extern char *enctype_names[]; -#endif - - -#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) -#define ENCRYPT_NAME(x) encrypt_names[x] - -#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) -#define ENCTYPE_NAME(x) enctype_names[x] - -#endif /* arpa/telnet.h */ diff --git a/openflow/usr/include/arpa/tftp.h b/openflow/usr/include/arpa/tftp.h deleted file mode 100644 index 86e0b6e..0000000 --- a/openflow/usr/include/arpa/tftp.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tftp.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _ARPA_TFTP_H -#define _ARPA_TFTP_H 1 - -/* - * Trivial File Transfer Protocol (IEN-133) - */ -#define SEGSIZE 512 /* data segment size */ - -/* - * Packet types. - */ -#define RRQ 01 /* read request */ -#define WRQ 02 /* write request */ -#define DATA 03 /* data packet */ -#define ACK 04 /* acknowledgement */ -#define ERROR 05 /* error code */ - -struct tftphdr { - short th_opcode; /* packet type */ - union { - char tu_padding[3]; /* sizeof() compat */ - struct { - union { - unsigned short tu_block; /* block # */ - short tu_code; /* error code */ - } __attribute__ ((__packed__)) th_u3; - char tu_data[0]; /* data or error string */ - } __attribute__ ((__packed__)) th_u2; - char tu_stuff[0]; /* request packet stuff */ - } __attribute__ ((__packed__)) th_u1; -} __attribute__ ((__packed__)); - -#define th_block th_u1.th_u2.th_u3.tu_block -#define th_code th_u1.th_u2.th_u3.tu_code -#define th_stuff th_u1.tu_stuff -#define th_data th_u1.th_u2.tu_data -#define th_msg th_u1.th_u2.tu_data - -/* - * Error codes. - */ -#define EUNDEF 0 /* not defined */ -#define ENOTFOUND 1 /* file not found */ -#define EACCESS 2 /* access violation */ -#define ENOSPACE 3 /* disk full or allocation exceeded */ -#define EBADOP 4 /* illegal TFTP operation */ -#define EBADID 5 /* unknown transfer ID */ -#define EEXISTS 6 /* file already exists */ -#define ENOUSER 7 /* no such user */ - -#endif /* arpa/tftp.h */ diff --git a/openflow/usr/include/asm-generic/auxvec.h b/openflow/usr/include/asm-generic/auxvec.h deleted file mode 100644 index b99573b..0000000 --- a/openflow/usr/include/asm-generic/auxvec.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __ASM_GENERIC_AUXVEC_H -#define __ASM_GENERIC_AUXVEC_H -/* - * Not all architectures need their own auxvec.h, the most - * common definitions are already in linux/auxvec.h. - */ - -#endif /* __ASM_GENERIC_AUXVEC_H */ diff --git a/openflow/usr/include/asm-generic/bitsperlong.h b/openflow/usr/include/asm-generic/bitsperlong.h deleted file mode 100644 index f832c3c..0000000 --- a/openflow/usr/include/asm-generic/bitsperlong.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __ASM_GENERIC_BITS_PER_LONG -#define __ASM_GENERIC_BITS_PER_LONG - -/* - * There seems to be no way of detecting this automatically from user - * space, so 64 bit architectures should override this in their - * bitsperlong.h. In particular, an architecture that supports - * both 32 and 64 bit user space must not rely on CONFIG_64BIT - * to decide it, but rather check a compiler provided macro. - */ -#ifndef __BITS_PER_LONG -#define __BITS_PER_LONG 32 -#endif - -#endif /* __ASM_GENERIC_BITS_PER_LONG */ diff --git a/openflow/usr/include/asm-generic/errno-base.h b/openflow/usr/include/asm-generic/errno-base.h deleted file mode 100644 index 6511597..0000000 --- a/openflow/usr/include/asm-generic/errno-base.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _ASM_GENERIC_ERRNO_BASE_H -#define _ASM_GENERIC_ERRNO_BASE_H - -#define EPERM 1 /* Operation not permitted */ -#define ENOENT 2 /* No such file or directory */ -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted system call */ -#define EIO 5 /* I/O error */ -#define ENXIO 6 /* No such device or address */ -#define E2BIG 7 /* Argument list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file number */ -#define ECHILD 10 /* No child processes */ -#define EAGAIN 11 /* Try again */ -#define ENOMEM 12 /* Out of memory */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -#define ENOTBLK 15 /* Block device required */ -#define EBUSY 16 /* Device or resource busy */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Cross-device link */ -#define ENODEV 19 /* No such device */ -#define ENOTDIR 20 /* Not a directory */ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* File table overflow */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Not a typewriter */ -#define ETXTBSY 26 /* Text file busy */ -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Illegal seek */ -#define EROFS 30 /* Read-only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ -#define EDOM 33 /* Math argument out of domain of func */ -#define ERANGE 34 /* Math result not representable */ - -#endif diff --git a/openflow/usr/include/asm-generic/errno.h b/openflow/usr/include/asm-generic/errno.h deleted file mode 100644 index 88e0914..0000000 --- a/openflow/usr/include/asm-generic/errno.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef _ASM_GENERIC_ERRNO_H -#define _ASM_GENERIC_ERRNO_H - -#include - -#define EDEADLK 35 /* Resource deadlock would occur */ -#define ENAMETOOLONG 36 /* File name too long */ -#define ENOLCK 37 /* No record locks available */ - -/* - * This error code is special: arch syscall entry code will return - * -ENOSYS if users try to call a syscall that doesn't exist. To keep - * failures of syscalls that really do exist distinguishable from - * failures due to attempts to use a nonexistent syscall, syscall - * implementations should refrain from returning -ENOSYS. - */ -#define ENOSYS 38 /* Invalid system call number */ - -#define ENOTEMPTY 39 /* Directory not empty */ -#define ELOOP 40 /* Too many symbolic links encountered */ -#define EWOULDBLOCK EAGAIN /* Operation would block */ -#define ENOMSG 42 /* No message of desired type */ -#define EIDRM 43 /* Identifier removed */ -#define ECHRNG 44 /* Channel number out of range */ -#define EL2NSYNC 45 /* Level 2 not synchronized */ -#define EL3HLT 46 /* Level 3 halted */ -#define EL3RST 47 /* Level 3 reset */ -#define ELNRNG 48 /* Link number out of range */ -#define EUNATCH 49 /* Protocol driver not attached */ -#define ENOCSI 50 /* No CSI structure available */ -#define EL2HLT 51 /* Level 2 halted */ -#define EBADE 52 /* Invalid exchange */ -#define EBADR 53 /* Invalid request descriptor */ -#define EXFULL 54 /* Exchange full */ -#define ENOANO 55 /* No anode */ -#define EBADRQC 56 /* Invalid request code */ -#define EBADSLT 57 /* Invalid slot */ - -#define EDEADLOCK EDEADLK - -#define EBFONT 59 /* Bad font file format */ -#define ENOSTR 60 /* Device not a stream */ -#define ENODATA 61 /* No data available */ -#define ETIME 62 /* Timer expired */ -#define ENOSR 63 /* Out of streams resources */ -#define ENONET 64 /* Machine is not on the network */ -#define ENOPKG 65 /* Package not installed */ -#define EREMOTE 66 /* Object is remote */ -#define ENOLINK 67 /* Link has been severed */ -#define EADV 68 /* Advertise error */ -#define ESRMNT 69 /* Srmount error */ -#define ECOMM 70 /* Communication error on send */ -#define EPROTO 71 /* Protocol error */ -#define EMULTIHOP 72 /* Multihop attempted */ -#define EDOTDOT 73 /* RFS specific error */ -#define EBADMSG 74 /* Not a data message */ -#define EOVERFLOW 75 /* Value too large for defined data type */ -#define ENOTUNIQ 76 /* Name not unique on network */ -#define EBADFD 77 /* File descriptor in bad state */ -#define EREMCHG 78 /* Remote address changed */ -#define ELIBACC 79 /* Can not access a needed shared library */ -#define ELIBBAD 80 /* Accessing a corrupted shared library */ -#define ELIBSCN 81 /* .lib section in a.out corrupted */ -#define ELIBMAX 82 /* Attempting to link in too many shared libraries */ -#define ELIBEXEC 83 /* Cannot exec a shared library directly */ -#define EILSEQ 84 /* Illegal byte sequence */ -#define ERESTART 85 /* Interrupted system call should be restarted */ -#define ESTRPIPE 86 /* Streams pipe error */ -#define EUSERS 87 /* Too many users */ -#define ENOTSOCK 88 /* Socket operation on non-socket */ -#define EDESTADDRREQ 89 /* Destination address required */ -#define EMSGSIZE 90 /* Message too long */ -#define EPROTOTYPE 91 /* Protocol wrong type for socket */ -#define ENOPROTOOPT 92 /* Protocol not available */ -#define EPROTONOSUPPORT 93 /* Protocol not supported */ -#define ESOCKTNOSUPPORT 94 /* Socket type not supported */ -#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ -#define EPFNOSUPPORT 96 /* Protocol family not supported */ -#define EAFNOSUPPORT 97 /* Address family not supported by protocol */ -#define EADDRINUSE 98 /* Address already in use */ -#define EADDRNOTAVAIL 99 /* Cannot assign requested address */ -#define ENETDOWN 100 /* Network is down */ -#define ENETUNREACH 101 /* Network is unreachable */ -#define ENETRESET 102 /* Network dropped connection because of reset */ -#define ECONNABORTED 103 /* Software caused connection abort */ -#define ECONNRESET 104 /* Connection reset by peer */ -#define ENOBUFS 105 /* No buffer space available */ -#define EISCONN 106 /* Transport endpoint is already connected */ -#define ENOTCONN 107 /* Transport endpoint is not connected */ -#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ -#define ETOOMANYREFS 109 /* Too many references: cannot splice */ -#define ETIMEDOUT 110 /* Connection timed out */ -#define ECONNREFUSED 111 /* Connection refused */ -#define EHOSTDOWN 112 /* Host is down */ -#define EHOSTUNREACH 113 /* No route to host */ -#define EALREADY 114 /* Operation already in progress */ -#define EINPROGRESS 115 /* Operation now in progress */ -#define ESTALE 116 /* Stale file handle */ -#define EUCLEAN 117 /* Structure needs cleaning */ -#define ENOTNAM 118 /* Not a XENIX named type file */ -#define ENAVAIL 119 /* No XENIX semaphores available */ -#define EISNAM 120 /* Is a named type file */ -#define EREMOTEIO 121 /* Remote I/O error */ -#define EDQUOT 122 /* Quota exceeded */ - -#define ENOMEDIUM 123 /* No medium found */ -#define EMEDIUMTYPE 124 /* Wrong medium type */ -#define ECANCELED 125 /* Operation Canceled */ -#define ENOKEY 126 /* Required key not available */ -#define EKEYEXPIRED 127 /* Key has expired */ -#define EKEYREVOKED 128 /* Key has been revoked */ -#define EKEYREJECTED 129 /* Key was rejected by service */ - -/* for robust mutexes */ -#define EOWNERDEAD 130 /* Owner died */ -#define ENOTRECOVERABLE 131 /* State not recoverable */ - -#define ERFKILL 132 /* Operation not possible due to RF-kill */ - -#define EHWPOISON 133 /* Memory page has hardware error */ - -#endif diff --git a/openflow/usr/include/asm-generic/fcntl.h b/openflow/usr/include/asm-generic/fcntl.h deleted file mode 100644 index e063eff..0000000 --- a/openflow/usr/include/asm-generic/fcntl.h +++ /dev/null @@ -1,220 +0,0 @@ -#ifndef _ASM_GENERIC_FCNTL_H -#define _ASM_GENERIC_FCNTL_H - -#include - -/* - * FMODE_EXEC is 0x20 - * FMODE_NONOTIFY is 0x4000000 - * These cannot be used by userspace O_* until internal and external open - * flags are split. - * -Eric Paris - */ - -/* - * When introducing new O_* bits, please check its uniqueness in fcntl_init(). - */ - -#define O_ACCMODE 00000003 -#define O_RDONLY 00000000 -#define O_WRONLY 00000001 -#define O_RDWR 00000002 -#ifndef O_CREAT -#define O_CREAT 00000100 /* not fcntl */ -#endif -#ifndef O_EXCL -#define O_EXCL 00000200 /* not fcntl */ -#endif -#ifndef O_NOCTTY -#define O_NOCTTY 00000400 /* not fcntl */ -#endif -#ifndef O_TRUNC -#define O_TRUNC 00001000 /* not fcntl */ -#endif -#ifndef O_APPEND -#define O_APPEND 00002000 -#endif -#ifndef O_NONBLOCK -#define O_NONBLOCK 00004000 -#endif -#ifndef O_DSYNC -#define O_DSYNC 00010000 /* used to be O_SYNC, see below */ -#endif -#ifndef FASYNC -#define FASYNC 00020000 /* fcntl, for BSD compatibility */ -#endif -#ifndef O_DIRECT -#define O_DIRECT 00040000 /* direct disk access hint */ -#endif -#ifndef O_LARGEFILE -#define O_LARGEFILE 00100000 -#endif -#ifndef O_DIRECTORY -#define O_DIRECTORY 00200000 /* must be a directory */ -#endif -#ifndef O_NOFOLLOW -#define O_NOFOLLOW 00400000 /* don't follow links */ -#endif -#ifndef O_NOATIME -#define O_NOATIME 01000000 -#endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 02000000 /* set close_on_exec */ -#endif - -/* - * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using - * the O_SYNC flag. We continue to use the existing numerical value - * for O_DSYNC semantics now, but using the correct symbolic name for it. - * This new value is used to request true Posix O_SYNC semantics. It is - * defined in this strange way to make sure applications compiled against - * new headers get at least O_DSYNC semantics on older kernels. - * - * This has the nice side-effect that we can simply test for O_DSYNC - * wherever we do not care if O_DSYNC or O_SYNC is used. - * - * Note: __O_SYNC must never be used directly. - */ -#ifndef O_SYNC -#define __O_SYNC 04000000 -#define O_SYNC (__O_SYNC|O_DSYNC) -#endif - -#ifndef O_PATH -#define O_PATH 010000000 -#endif - -#ifndef __O_TMPFILE -#define __O_TMPFILE 020000000 -#endif - -/* a horrid kludge trying to make sure that this will fail on old kernels */ -#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY) -#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT) - -#ifndef O_NDELAY -#define O_NDELAY O_NONBLOCK -#endif - -#define F_DUPFD 0 /* dup */ -#define F_GETFD 1 /* get close_on_exec */ -#define F_SETFD 2 /* set/clear close_on_exec */ -#define F_GETFL 3 /* get file->f_flags */ -#define F_SETFL 4 /* set file->f_flags */ -#ifndef F_GETLK -#define F_GETLK 5 -#define F_SETLK 6 -#define F_SETLKW 7 -#endif -#ifndef F_SETOWN -#define F_SETOWN 8 /* for sockets. */ -#define F_GETOWN 9 /* for sockets. */ -#endif -#ifndef F_SETSIG -#define F_SETSIG 10 /* for sockets. */ -#define F_GETSIG 11 /* for sockets. */ -#endif - -#ifndef CONFIG_64BIT -#ifndef F_GETLK64 -#define F_GETLK64 12 /* using 'struct flock64' */ -#define F_SETLK64 13 -#define F_SETLKW64 14 -#endif -#endif - -#ifndef F_SETOWN_EX -#define F_SETOWN_EX 15 -#define F_GETOWN_EX 16 -#endif - -#ifndef F_GETOWNER_UIDS -#define F_GETOWNER_UIDS 17 -#endif - -/* - * Open File Description Locks - * - * Usually record locks held by a process are released on *any* close and are - * not inherited across a fork(). - * - * These cmd values will set locks that conflict with process-associated - * record locks, but are "owned" by the open file description, not the - * process. This means that they are inherited across fork() like BSD (flock) - * locks, and they are only released automatically when the last reference to - * the the open file against which they were acquired is put. - */ -#define F_OFD_GETLK 36 -#define F_OFD_SETLK 37 -#define F_OFD_SETLKW 38 - -#define F_OWNER_TID 0 -#define F_OWNER_PID 1 -#define F_OWNER_PGRP 2 - -struct f_owner_ex { - int type; - __kernel_pid_t pid; -}; - -/* for F_[GET|SET]FL */ -#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ - -/* for posix fcntl() and lockf() */ -#ifndef F_RDLCK -#define F_RDLCK 0 -#define F_WRLCK 1 -#define F_UNLCK 2 -#endif - -/* for old implementation of bsd flock () */ -#ifndef F_EXLCK -#define F_EXLCK 4 /* or 3 */ -#define F_SHLCK 8 /* or 4 */ -#endif - -/* operations for bsd flock(), also used by the kernel implementation */ -#define LOCK_SH 1 /* shared lock */ -#define LOCK_EX 2 /* exclusive lock */ -#define LOCK_NB 4 /* or'd with one of the above to prevent - blocking */ -#define LOCK_UN 8 /* remove lock */ - -#define LOCK_MAND 32 /* This is a mandatory flock ... */ -#define LOCK_READ 64 /* which allows concurrent read operations */ -#define LOCK_WRITE 128 /* which allows concurrent write operations */ -#define LOCK_RW 192 /* which allows concurrent read & write ops */ - -#define F_LINUX_SPECIFIC_BASE 1024 - -#ifndef HAVE_ARCH_STRUCT_FLOCK -#ifndef __ARCH_FLOCK_PAD -#define __ARCH_FLOCK_PAD -#endif - -struct flock { - short l_type; - short l_whence; - __kernel_off_t l_start; - __kernel_off_t l_len; - __kernel_pid_t l_pid; - __ARCH_FLOCK_PAD -}; -#endif - -#ifndef HAVE_ARCH_STRUCT_FLOCK64 -#ifndef __ARCH_FLOCK64_PAD -#define __ARCH_FLOCK64_PAD -#endif - -struct flock64 { - short l_type; - short l_whence; - __kernel_loff_t l_start; - __kernel_loff_t l_len; - __kernel_pid_t l_pid; - __ARCH_FLOCK64_PAD -}; -#endif - -#endif /* _ASM_GENERIC_FCNTL_H */ diff --git a/openflow/usr/include/asm-generic/int-l64.h b/openflow/usr/include/asm-generic/int-l64.h deleted file mode 100644 index e271ae2..0000000 --- a/openflow/usr/include/asm-generic/int-l64.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * asm-generic/int-l64.h - * - * Integer declarations for architectures which use "long" - * for 64-bit types. - */ - -#ifndef _ASM_GENERIC_INT_L64_H -#define _ASM_GENERIC_INT_L64_H - -#include - -#ifndef __ASSEMBLY__ -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -typedef __signed__ long __s64; -typedef unsigned long __u64; - -#endif /* __ASSEMBLY__ */ - - -#endif /* _ASM_GENERIC_INT_L64_H */ diff --git a/openflow/usr/include/asm-generic/int-ll64.h b/openflow/usr/include/asm-generic/int-ll64.h deleted file mode 100644 index 0ede047..0000000 --- a/openflow/usr/include/asm-generic/int-ll64.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * asm-generic/int-ll64.h - * - * Integer declarations for architectures which use "long long" - * for 64-bit types. - */ - -#ifndef _ASM_GENERIC_INT_LL64_H -#define _ASM_GENERIC_INT_LL64_H - -#include - -#ifndef __ASSEMBLY__ -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#ifdef __GNUC__ -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#else -typedef __signed__ long long __s64; -typedef unsigned long long __u64; -#endif - -#endif /* __ASSEMBLY__ */ - - -#endif /* _ASM_GENERIC_INT_LL64_H */ diff --git a/openflow/usr/include/asm-generic/ioctl.h b/openflow/usr/include/asm-generic/ioctl.h deleted file mode 100644 index 0da2c7d..0000000 --- a/openflow/usr/include/asm-generic/ioctl.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef _ASM_GENERIC_IOCTL_H -#define _ASM_GENERIC_IOCTL_H - -/* ioctl command encoding: 32 bits total, command in lower 16 bits, - * size of the parameter structure in the lower 14 bits of the - * upper 16 bits. - * Encoding the size of the parameter structure in the ioctl request - * is useful for catching programs compiled with old versions - * and to avoid overwriting user space outside the user buffer area. - * The highest 2 bits are reserved for indicating the ``access mode''. - * NOTE: This limits the max parameter size to 16kB -1 ! - */ - -/* - * The following is for compatibility across the various Linux - * platforms. The generic ioctl numbering scheme doesn't really enforce - * a type field. De facto, however, the top 8 bits of the lower 16 - * bits are indeed used as a type field, so we might just as well make - * this explicit here. Please be sure to use the decoding macros - * below from now on. - */ -#define _IOC_NRBITS 8 -#define _IOC_TYPEBITS 8 - -/* - * Let any architecture override either of the following before - * including this file. - */ - -#ifndef _IOC_SIZEBITS -# define _IOC_SIZEBITS 14 -#endif - -#ifndef _IOC_DIRBITS -# define _IOC_DIRBITS 2 -#endif - -#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) -#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) -#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) -#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) - -#define _IOC_NRSHIFT 0 -#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) -#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) -#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) - -/* - * Direction bits, which any architecture can choose to override - * before including this file. - */ - -#ifndef _IOC_NONE -# define _IOC_NONE 0U -#endif - -#ifndef _IOC_WRITE -# define _IOC_WRITE 1U -#endif - -#ifndef _IOC_READ -# define _IOC_READ 2U -#endif - -#define _IOC(dir,type,nr,size) \ - (((dir) << _IOC_DIRSHIFT) | \ - ((type) << _IOC_TYPESHIFT) | \ - ((nr) << _IOC_NRSHIFT) | \ - ((size) << _IOC_SIZESHIFT)) - -#define _IOC_TYPECHECK(t) (sizeof(t)) - -/* used to create numbers */ -#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) -#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) -#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) -#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) -#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) -#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) -#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) - -/* used to decode ioctl numbers.. */ -#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) -#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) -#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) -#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) - -/* ...and for the drivers/sound files... */ - -#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) -#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) -#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) -#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) -#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) - -#endif /* _ASM_GENERIC_IOCTL_H */ diff --git a/openflow/usr/include/asm-generic/ioctls.h b/openflow/usr/include/asm-generic/ioctls.h deleted file mode 100644 index 467cdba..0000000 --- a/openflow/usr/include/asm-generic/ioctls.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef __ASM_GENERIC_IOCTLS_H -#define __ASM_GENERIC_IOCTLS_H - -#include - -/* - * These are the most common definitions for tty ioctl numbers. - * Most of them do not use the recommended _IOC(), but there is - * probably some source code out there hardcoding the number, - * so we might as well use them for all new platforms. - * - * The architectures that use different values here typically - * try to be compatible with some Unix variants for the same - * architecture. - */ - -/* 0x54 is just a magic number to make these relatively unique ('T') */ - -#define TCGETS 0x5401 -#define TCSETS 0x5402 -#define TCSETSW 0x5403 -#define TCSETSF 0x5404 -#define TCGETA 0x5405 -#define TCSETA 0x5406 -#define TCSETAW 0x5407 -#define TCSETAF 0x5408 -#define TCSBRK 0x5409 -#define TCXONC 0x540A -#define TCFLSH 0x540B -#define TIOCEXCL 0x540C -#define TIOCNXCL 0x540D -#define TIOCSCTTY 0x540E -#define TIOCGPGRP 0x540F -#define TIOCSPGRP 0x5410 -#define TIOCOUTQ 0x5411 -#define TIOCSTI 0x5412 -#define TIOCGWINSZ 0x5413 -#define TIOCSWINSZ 0x5414 -#define TIOCMGET 0x5415 -#define TIOCMBIS 0x5416 -#define TIOCMBIC 0x5417 -#define TIOCMSET 0x5418 -#define TIOCGSOFTCAR 0x5419 -#define TIOCSSOFTCAR 0x541A -#define FIONREAD 0x541B -#define TIOCINQ FIONREAD -#define TIOCLINUX 0x541C -#define TIOCCONS 0x541D -#define TIOCGSERIAL 0x541E -#define TIOCSSERIAL 0x541F -#define TIOCPKT 0x5420 -#define FIONBIO 0x5421 -#define TIOCNOTTY 0x5422 -#define TIOCSETD 0x5423 -#define TIOCGETD 0x5424 -#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCSBRK 0x5427 /* BSD compatibility */ -#define TIOCCBRK 0x5428 /* BSD compatibility */ -#define TIOCGSID 0x5429 /* Return the session ID of FD */ -#define TCGETS2 _IOR('T', 0x2A, struct termios2) -#define TCSETS2 _IOW('T', 0x2B, struct termios2) -#define TCSETSW2 _IOW('T', 0x2C, struct termios2) -#define TCSETSF2 _IOW('T', 0x2D, struct termios2) -#define TIOCGRS485 0x542E -#ifndef TIOCSRS485 -#define TIOCSRS485 0x542F -#endif -#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ -#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ -#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */ -#define TCGETX 0x5432 /* SYS5 TCGETX compatibility */ -#define TCSETX 0x5433 -#define TCSETXF 0x5434 -#define TCSETXW 0x5435 -#define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */ -#define TIOCVHANGUP 0x5437 -#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */ -#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */ -#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */ - -#define FIONCLEX 0x5450 -#define FIOCLEX 0x5451 -#define FIOASYNC 0x5452 -#define TIOCSERCONFIG 0x5453 -#define TIOCSERGWILD 0x5454 -#define TIOCSERSWILD 0x5455 -#define TIOCGLCKTRMIOS 0x5456 -#define TIOCSLCKTRMIOS 0x5457 -#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ -#define TIOCSERGETLSR 0x5459 /* Get line status register */ -#define TIOCSERGETMULTI 0x545A /* Get multiport config */ -#define TIOCSERSETMULTI 0x545B /* Set multiport config */ - -#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ -#define TIOCGICOUNT 0x545D /* read serial port __inline__ interrupt counts */ - -/* - * Some arches already define FIOQSIZE due to a historical - * conflict with a Hayes modem-specific ioctl value. - */ -#ifndef FIOQSIZE -# define FIOQSIZE 0x5460 -#endif - -/* Used for packet mode */ -#define TIOCPKT_DATA 0 -#define TIOCPKT_FLUSHREAD 1 -#define TIOCPKT_FLUSHWRITE 2 -#define TIOCPKT_STOP 4 -#define TIOCPKT_START 8 -#define TIOCPKT_NOSTOP 16 -#define TIOCPKT_DOSTOP 32 -#define TIOCPKT_IOCTL 64 - -#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ - -#endif /* __ASM_GENERIC_IOCTLS_H */ diff --git a/openflow/usr/include/asm-generic/ipcbuf.h b/openflow/usr/include/asm-generic/ipcbuf.h deleted file mode 100644 index 3dbcc1e..0000000 --- a/openflow/usr/include/asm-generic/ipcbuf.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __ASM_GENERIC_IPCBUF_H -#define __ASM_GENERIC_IPCBUF_H - -/* - * The generic ipc64_perm structure: - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * ipc64_perm was originally meant to be architecture specific, but - * everyone just ended up making identical copies without specific - * optimizations, so we may just as well all use the same one. - * - * Pad space is left for: - * - 32-bit mode_t on architectures that only had 16 bit - * - 32-bit seq - * - 2 miscellaneous 32-bit values - */ - -struct ipc64_perm { - __kernel_key_t key; - __kernel_uid32_t uid; - __kernel_gid32_t gid; - __kernel_uid32_t cuid; - __kernel_gid32_t cgid; - __kernel_mode_t mode; - /* pad if mode_t is u16: */ - unsigned char __pad1[4 - sizeof(__kernel_mode_t)]; - unsigned short seq; - unsigned short __pad2; - __kernel_ulong_t __unused1; - __kernel_ulong_t __unused2; -}; - -#endif /* __ASM_GENERIC_IPCBUF_H */ diff --git a/openflow/usr/include/asm-generic/kvm_para.h b/openflow/usr/include/asm-generic/kvm_para.h deleted file mode 100644 index 486f0af..0000000 --- a/openflow/usr/include/asm-generic/kvm_para.h +++ /dev/null @@ -1,4 +0,0 @@ -/* - * There isn't anything here, but the file must not be empty or patch - * will delete it. - */ diff --git a/openflow/usr/include/asm-generic/mman-common.h b/openflow/usr/include/asm-generic/mman-common.h deleted file mode 100644 index a74dd84..0000000 --- a/openflow/usr/include/asm-generic/mman-common.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef __ASM_GENERIC_MMAN_COMMON_H -#define __ASM_GENERIC_MMAN_COMMON_H - -/* - Author: Michael S. Tsirkin , Mellanox Technologies Ltd. - Based on: asm-xxx/mman.h -*/ - -#define PROT_READ 0x1 /* page can be read */ -#define PROT_WRITE 0x2 /* page can be written */ -#define PROT_EXEC 0x4 /* page can be executed */ -#define PROT_SEM 0x8 /* page may be used for atomic ops */ -#define PROT_NONE 0x0 /* page can not be accessed */ -#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ -#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ - -#define MAP_SHARED 0x01 /* Share changes */ -#define MAP_PRIVATE 0x02 /* Changes are private */ -#define MAP_TYPE 0x0f /* Mask for type of mapping */ -#define MAP_FIXED 0x10 /* Interpret addr exactly */ -#define MAP_ANONYMOUS 0x20 /* don't use a file */ -#ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED -# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */ -#else -# define MAP_UNINITIALIZED 0x0 /* Don't support this flag */ -#endif - -/* - * Flags for mlock - */ -#define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */ - -#define MS_ASYNC 1 /* sync memory asynchronously */ -#define MS_INVALIDATE 2 /* invalidate the caches */ -#define MS_SYNC 4 /* synchronous memory sync */ - -#define MADV_NORMAL 0 /* no further special treatment */ -#define MADV_RANDOM 1 /* expect random page references */ -#define MADV_SEQUENTIAL 2 /* expect sequential page references */ -#define MADV_WILLNEED 3 /* will need these pages */ -#define MADV_DONTNEED 4 /* don't need these pages */ - -/* common parameters: try to keep these consistent across architectures */ -#define MADV_REMOVE 9 /* remove these pages & resources */ -#define MADV_DONTFORK 10 /* don't inherit across fork */ -#define MADV_DOFORK 11 /* do inherit across fork */ -#define MADV_HWPOISON 100 /* poison a page for testing */ -#define MADV_SOFT_OFFLINE 101 /* soft offline page for testing */ - -#define MADV_MERGEABLE 12 /* KSM may merge identical pages */ -#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */ - -#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ -#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ - -#define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, - overrides the coredump filter bits */ -#define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag */ - -/* compatibility flags */ -#define MAP_FILE 0 - -/* - * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. - * This gives us 6 bits, which is enough until someone invents 128 bit address - * spaces. - * - * Assume these are all power of twos. - * When 0 use the default page size. - */ -#define MAP_HUGE_SHIFT 26 -#define MAP_HUGE_MASK 0x3f - -#endif /* __ASM_GENERIC_MMAN_COMMON_H */ diff --git a/openflow/usr/include/asm-generic/mman.h b/openflow/usr/include/asm-generic/mman.h deleted file mode 100644 index 7162cd4..0000000 --- a/openflow/usr/include/asm-generic/mman.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __ASM_GENERIC_MMAN_H -#define __ASM_GENERIC_MMAN_H - -#include - -#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ -#define MAP_LOCKED 0x2000 /* pages are locked */ -#define MAP_NORESERVE 0x4000 /* don't check for reservations */ -#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ -#define MAP_NONBLOCK 0x10000 /* do not block on IO */ -#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ -#define MAP_HUGETLB 0x40000 /* create a huge page mapping */ - -/* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */ - -#define MCL_CURRENT 1 /* lock all current mappings */ -#define MCL_FUTURE 2 /* lock all future mappings */ -#define MCL_ONFAULT 4 /* lock all pages that are faulted in */ - -#endif /* __ASM_GENERIC_MMAN_H */ diff --git a/openflow/usr/include/asm-generic/msgbuf.h b/openflow/usr/include/asm-generic/msgbuf.h deleted file mode 100644 index f55ecc4..0000000 --- a/openflow/usr/include/asm-generic/msgbuf.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef __ASM_GENERIC_MSGBUF_H -#define __ASM_GENERIC_MSGBUF_H - -#include -/* - * generic msqid64_ds structure. - * - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * msqid64_ds was originally meant to be architecture specific, but - * everyone just ended up making identical copies without specific - * optimizations, so we may just as well all use the same one. - * - * 64 bit architectures typically define a 64 bit __kernel_time_t, - * so they do not need the first three padding words. - * On big-endian systems, the padding is in the wrong place. - * - * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values - */ - -struct msqid64_ds { - struct ipc64_perm msg_perm; - __kernel_time_t msg_stime; /* last msgsnd time */ -#if __BITS_PER_LONG != 64 - unsigned long __unused1; -#endif - __kernel_time_t msg_rtime; /* last msgrcv time */ -#if __BITS_PER_LONG != 64 - unsigned long __unused2; -#endif - __kernel_time_t msg_ctime; /* last change time */ -#if __BITS_PER_LONG != 64 - unsigned long __unused3; -#endif - __kernel_ulong_t msg_cbytes; /* current number of bytes on queue */ - __kernel_ulong_t msg_qnum; /* number of messages in queue */ - __kernel_ulong_t msg_qbytes; /* max number of bytes on queue */ - __kernel_pid_t msg_lspid; /* pid of last msgsnd */ - __kernel_pid_t msg_lrpid; /* last receive pid */ - __kernel_ulong_t __unused4; - __kernel_ulong_t __unused5; -}; - -#endif /* __ASM_GENERIC_MSGBUF_H */ diff --git a/openflow/usr/include/asm-generic/param.h b/openflow/usr/include/asm-generic/param.h deleted file mode 100644 index bd69ff3..0000000 --- a/openflow/usr/include/asm-generic/param.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __ASM_GENERIC_PARAM_H -#define __ASM_GENERIC_PARAM_H - -#ifndef HZ -#define HZ 100 -#endif - -#ifndef EXEC_PAGESIZE -#define EXEC_PAGESIZE 4096 -#endif - -#ifndef NOGROUP -#define NOGROUP (-1) -#endif - -#define MAXHOSTNAMELEN 64 /* max length of hostname */ - - -#endif /* __ASM_GENERIC_PARAM_H */ diff --git a/openflow/usr/include/asm-generic/poll.h b/openflow/usr/include/asm-generic/poll.h deleted file mode 100644 index a969498..0000000 --- a/openflow/usr/include/asm-generic/poll.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __ASM_GENERIC_POLL_H -#define __ASM_GENERIC_POLL_H - -/* These are specified by iBCS2 */ -#define POLLIN 0x0001 -#define POLLPRI 0x0002 -#define POLLOUT 0x0004 -#define POLLERR 0x0008 -#define POLLHUP 0x0010 -#define POLLNVAL 0x0020 - -/* The rest seem to be more-or-less nonstandard. Check them! */ -#define POLLRDNORM 0x0040 -#define POLLRDBAND 0x0080 -#ifndef POLLWRNORM -#define POLLWRNORM 0x0100 -#endif -#ifndef POLLWRBAND -#define POLLWRBAND 0x0200 -#endif -#ifndef POLLMSG -#define POLLMSG 0x0400 -#endif -#ifndef POLLREMOVE -#define POLLREMOVE 0x1000 -#endif -#ifndef POLLRDHUP -#define POLLRDHUP 0x2000 -#endif - -#define POLLFREE 0x4000 /* currently only for epoll */ - -#define POLL_BUSY_LOOP 0x8000 - -struct pollfd { - int fd; - short events; - short revents; -}; - -#endif /* __ASM_GENERIC_POLL_H */ diff --git a/openflow/usr/include/asm-generic/posix_types.h b/openflow/usr/include/asm-generic/posix_types.h deleted file mode 100644 index fe74fcc..0000000 --- a/openflow/usr/include/asm-generic/posix_types.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef __ASM_GENERIC_POSIX_TYPES_H -#define __ASM_GENERIC_POSIX_TYPES_H - -#include -/* - * This file is generally used by user-level software, so you need to - * be a little careful about namespace pollution etc. - * - * First the types that are often defined in different ways across - * architectures, so that you can override them. - */ - -#ifndef __kernel_long_t -typedef long __kernel_long_t; -typedef unsigned long __kernel_ulong_t; -#endif - -#ifndef __kernel_ino_t -typedef __kernel_ulong_t __kernel_ino_t; -#endif - -#ifndef __kernel_mode_t -typedef unsigned int __kernel_mode_t; -#endif - -#ifndef __kernel_pid_t -typedef int __kernel_pid_t; -#endif - -#ifndef __kernel_ipc_pid_t -typedef int __kernel_ipc_pid_t; -#endif - -#ifndef __kernel_uid_t -typedef unsigned int __kernel_uid_t; -typedef unsigned int __kernel_gid_t; -#endif - -#ifndef __kernel_suseconds_t -typedef __kernel_long_t __kernel_suseconds_t; -#endif - -#ifndef __kernel_daddr_t -typedef int __kernel_daddr_t; -#endif - -#ifndef __kernel_uid32_t -typedef unsigned int __kernel_uid32_t; -typedef unsigned int __kernel_gid32_t; -#endif - -#ifndef __kernel_old_uid_t -typedef __kernel_uid_t __kernel_old_uid_t; -typedef __kernel_gid_t __kernel_old_gid_t; -#endif - -#ifndef __kernel_old_dev_t -typedef unsigned int __kernel_old_dev_t; -#endif - -/* - * Most 32 bit architectures use "unsigned int" size_t, - * and all 64 bit architectures use "unsigned long" size_t. - */ -#ifndef __kernel_size_t -#if __BITS_PER_LONG != 64 -typedef unsigned int __kernel_size_t; -typedef int __kernel_ssize_t; -typedef int __kernel_ptrdiff_t; -#else -typedef __kernel_ulong_t __kernel_size_t; -typedef __kernel_long_t __kernel_ssize_t; -typedef __kernel_long_t __kernel_ptrdiff_t; -#endif -#endif - -#ifndef __kernel_fsid_t -typedef struct { - int val[2]; -} __kernel_fsid_t; -#endif - -/* - * anything below here should be completely generic - */ -typedef __kernel_long_t __kernel_off_t; -typedef long long __kernel_loff_t; -typedef __kernel_long_t __kernel_time_t; -typedef __kernel_long_t __kernel_clock_t; -typedef int __kernel_timer_t; -typedef int __kernel_clockid_t; -typedef char * __kernel_caddr_t; -typedef unsigned short __kernel_uid16_t; -typedef unsigned short __kernel_gid16_t; - -#endif /* __ASM_GENERIC_POSIX_TYPES_H */ diff --git a/openflow/usr/include/asm-generic/resource.h b/openflow/usr/include/asm-generic/resource.h deleted file mode 100644 index 498fd28..0000000 --- a/openflow/usr/include/asm-generic/resource.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef _ASM_GENERIC_RESOURCE_H -#define _ASM_GENERIC_RESOURCE_H - -/* - * Resource limit IDs - * - * ( Compatibility detail: there are architectures that have - * a different rlimit ID order in the 5-9 range and want - * to keep that order for binary compatibility. The reasons - * are historic and all new rlimits are identical across all - * arches. If an arch has such special order for some rlimits - * then it defines them prior including asm-generic/resource.h. ) - */ - -#define RLIMIT_CPU 0 /* CPU time in sec */ -#define RLIMIT_FSIZE 1 /* Maximum filesize */ -#define RLIMIT_DATA 2 /* max data size */ -#define RLIMIT_STACK 3 /* max stack size */ -#define RLIMIT_CORE 4 /* max core file size */ - -#ifndef RLIMIT_RSS -# define RLIMIT_RSS 5 /* max resident set size */ -#endif - -#ifndef RLIMIT_NPROC -# define RLIMIT_NPROC 6 /* max number of processes */ -#endif - -#ifndef RLIMIT_NOFILE -# define RLIMIT_NOFILE 7 /* max number of open files */ -#endif - -#ifndef RLIMIT_MEMLOCK -# define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */ -#endif - -#ifndef RLIMIT_AS -# define RLIMIT_AS 9 /* address space limit */ -#endif - -#define RLIMIT_LOCKS 10 /* maximum file locks held */ -#define RLIMIT_SIGPENDING 11 /* max number of pending signals */ -#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */ -#define RLIMIT_NICE 13 /* max nice prio allowed to raise to - 0-39 for nice level 19 .. -20 */ -#define RLIMIT_RTPRIO 14 /* maximum realtime priority */ -#define RLIMIT_RTTIME 15 /* timeout for RT tasks in us */ -#define RLIM_NLIMITS 16 - -/* - * SuS says limits have to be unsigned. - * Which makes a ton more sense anyway. - * - * Some architectures override this (for compatibility reasons): - */ -#ifndef RLIM_INFINITY -# define RLIM_INFINITY (~0UL) -#endif - - -#endif /* _ASM_GENERIC_RESOURCE_H */ diff --git a/openflow/usr/include/asm-generic/sembuf.h b/openflow/usr/include/asm-generic/sembuf.h deleted file mode 100644 index 4cb2c13..0000000 --- a/openflow/usr/include/asm-generic/sembuf.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __ASM_GENERIC_SEMBUF_H -#define __ASM_GENERIC_SEMBUF_H - -#include - -/* - * The semid64_ds structure for x86 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * semid64_ds was originally meant to be architecture specific, but - * everyone just ended up making identical copies without specific - * optimizations, so we may just as well all use the same one. - * - * 64 bit architectures typically define a 64 bit __kernel_time_t, - * so they do not need the first two padding words. - * On big-endian systems, the padding is in the wrong place. - * - * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values - */ -struct semid64_ds { - struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ - __kernel_time_t sem_otime; /* last semop time */ -#if __BITS_PER_LONG != 64 - unsigned long __unused1; -#endif - __kernel_time_t sem_ctime; /* last change time */ -#if __BITS_PER_LONG != 64 - unsigned long __unused2; -#endif - unsigned long sem_nsems; /* no. of semaphores in array */ - unsigned long __unused3; - unsigned long __unused4; -}; - -#endif /* __ASM_GENERIC_SEMBUF_H */ diff --git a/openflow/usr/include/asm-generic/setup.h b/openflow/usr/include/asm-generic/setup.h deleted file mode 100644 index 6fc26a5..0000000 --- a/openflow/usr/include/asm-generic/setup.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ASM_GENERIC_SETUP_H -#define __ASM_GENERIC_SETUP_H - -#define COMMAND_LINE_SIZE 512 - -#endif /* __ASM_GENERIC_SETUP_H */ diff --git a/openflow/usr/include/asm-generic/shmbuf.h b/openflow/usr/include/asm-generic/shmbuf.h deleted file mode 100644 index 7e9fb2f..0000000 --- a/openflow/usr/include/asm-generic/shmbuf.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __ASM_GENERIC_SHMBUF_H -#define __ASM_GENERIC_SHMBUF_H - -#include - -/* - * The shmid64_ds structure for x86 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * shmid64_ds was originally meant to be architecture specific, but - * everyone just ended up making identical copies without specific - * optimizations, so we may just as well all use the same one. - * - * 64 bit architectures typically define a 64 bit __kernel_time_t, - * so they do not need the first two padding words. - * On big-endian systems, the padding is in the wrong place. - * - * - * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values - */ - -struct shmid64_ds { - struct ipc64_perm shm_perm; /* operation perms */ - size_t shm_segsz; /* size of segment (bytes) */ - __kernel_time_t shm_atime; /* last attach time */ -#if __BITS_PER_LONG != 64 - unsigned long __unused1; -#endif - __kernel_time_t shm_dtime; /* last detach time */ -#if __BITS_PER_LONG != 64 - unsigned long __unused2; -#endif - __kernel_time_t shm_ctime; /* last change time */ -#if __BITS_PER_LONG != 64 - unsigned long __unused3; -#endif - __kernel_pid_t shm_cpid; /* pid of creator */ - __kernel_pid_t shm_lpid; /* pid of last operator */ - __kernel_ulong_t shm_nattch; /* no. of current attaches */ - __kernel_ulong_t __unused4; - __kernel_ulong_t __unused5; -}; - -struct shminfo64 { - __kernel_ulong_t shmmax; - __kernel_ulong_t shmmin; - __kernel_ulong_t shmmni; - __kernel_ulong_t shmseg; - __kernel_ulong_t shmall; - __kernel_ulong_t __unused1; - __kernel_ulong_t __unused2; - __kernel_ulong_t __unused3; - __kernel_ulong_t __unused4; -}; - -#endif /* __ASM_GENERIC_SHMBUF_H */ diff --git a/openflow/usr/include/asm-generic/shmparam.h b/openflow/usr/include/asm-generic/shmparam.h deleted file mode 100644 index 51a3852..0000000 --- a/openflow/usr/include/asm-generic/shmparam.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ASM_GENERIC_SHMPARAM_H -#define __ASM_GENERIC_SHMPARAM_H - -#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ - -#endif /* _ASM_GENERIC_SHMPARAM_H */ diff --git a/openflow/usr/include/asm-generic/siginfo.h b/openflow/usr/include/asm-generic/siginfo.h deleted file mode 100644 index ac972ad..0000000 --- a/openflow/usr/include/asm-generic/siginfo.h +++ /dev/null @@ -1,303 +0,0 @@ -#ifndef _ASM_GENERIC_SIGINFO_H -#define _ASM_GENERIC_SIGINFO_H - - -#include - -typedef union sigval { - int sival_int; - void *sival_ptr; -} sigval_t; - -/* - * This is the size (including padding) of the part of the - * struct siginfo that is before the union. - */ -#ifndef __ARCH_SI_PREAMBLE_SIZE -#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) -#endif - -#define SI_MAX_SIZE 128 -#ifndef SI_PAD_SIZE -#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int)) -#endif - -#ifndef __ARCH_SI_UID_T -#define __ARCH_SI_UID_T __kernel_uid32_t -#endif - -/* - * The default "si_band" type is "long", as specified by POSIX. - * However, some architectures want to override this to "int" - * for historical compatibility reasons, so we allow that. - */ -#ifndef __ARCH_SI_BAND_T -#define __ARCH_SI_BAND_T long -#endif - -#ifndef __ARCH_SI_CLOCK_T -#define __ARCH_SI_CLOCK_T __kernel_clock_t -#endif - -#ifndef __ARCH_SI_ATTRIBUTES -#define __ARCH_SI_ATTRIBUTES -#endif - -#ifndef HAVE_ARCH_SIGINFO_T - -typedef struct siginfo { - int si_signo; - int si_errno; - int si_code; - - union { - int _pad[SI_PAD_SIZE]; - - /* kill() */ - struct { - __kernel_pid_t _pid; /* sender's pid */ - __ARCH_SI_UID_T _uid; /* sender's uid */ - } _kill; - - /* POSIX.1b timers */ - struct { - __kernel_timer_t _tid; /* timer id */ - int _overrun; /* overrun count */ - char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)]; - sigval_t _sigval; /* same as below */ - int _sys_private; /* not to be passed to user */ - } _timer; - - /* POSIX.1b signals */ - struct { - __kernel_pid_t _pid; /* sender's pid */ - __ARCH_SI_UID_T _uid; /* sender's uid */ - sigval_t _sigval; - } _rt; - - /* SIGCHLD */ - struct { - __kernel_pid_t _pid; /* which child */ - __ARCH_SI_UID_T _uid; /* sender's uid */ - int _status; /* exit code */ - __ARCH_SI_CLOCK_T _utime; - __ARCH_SI_CLOCK_T _stime; - } _sigchld; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ - struct { - void *_addr; /* faulting insn/memory ref. */ -#ifdef __ARCH_SI_TRAPNO - int _trapno; /* TRAP # which caused the signal */ -#endif - short _addr_lsb; /* LSB of the reported address */ - struct { - void *_lower; - void *_upper; - } _addr_bnd; - } _sigfault; - - /* SIGPOLL */ - struct { - __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; - } _sigpoll; - - /* SIGSYS */ - struct { - void *_call_addr; /* calling user insn */ - int _syscall; /* triggering system call number */ - unsigned int _arch; /* AUDIT_ARCH_* of syscall */ - } _sigsys; - } _sifields; -} __ARCH_SI_ATTRIBUTES siginfo_t; - -/* If the arch shares siginfo, then it has SIGSYS. */ -#define __ARCH_SIGSYS -#endif - -/* - * How these fields are to be accessed. - */ -#define si_pid _sifields._kill._pid -#define si_uid _sifields._kill._uid -#define si_tid _sifields._timer._tid -#define si_overrun _sifields._timer._overrun -#define si_sys_private _sifields._timer._sys_private -#define si_status _sifields._sigchld._status -#define si_utime _sifields._sigchld._utime -#define si_stime _sifields._sigchld._stime -#define si_value _sifields._rt._sigval -#define si_int _sifields._rt._sigval.sival_int -#define si_ptr _sifields._rt._sigval.sival_ptr -#define si_addr _sifields._sigfault._addr -#ifdef __ARCH_SI_TRAPNO -#define si_trapno _sifields._sigfault._trapno -#endif -#define si_addr_lsb _sifields._sigfault._addr_lsb -#define si_lower _sifields._sigfault._addr_bnd._lower -#define si_upper _sifields._sigfault._addr_bnd._upper -#define si_band _sifields._sigpoll._band -#define si_fd _sifields._sigpoll._fd -#ifdef __ARCH_SIGSYS -#define si_call_addr _sifields._sigsys._call_addr -#define si_syscall _sifields._sigsys._syscall -#define si_arch _sifields._sigsys._arch -#endif - -#define __SI_KILL 0 -#define __SI_TIMER 0 -#define __SI_POLL 0 -#define __SI_FAULT 0 -#define __SI_CHLD 0 -#define __SI_RT 0 -#define __SI_MESGQ 0 -#define __SI_SYS 0 -#define __SI_CODE(T,N) (N) - -/* - * si_code values - * Digital reserves positive values for kernel-generated signals. - */ -#define SI_USER 0 /* sent by kill, sigsend, raise */ -#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ -#define SI_QUEUE -1 /* sent by sigqueue */ -#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */ -#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3) /* sent by real time mesq state change */ -#define SI_ASYNCIO -4 /* sent by AIO completion */ -#define SI_SIGIO -5 /* sent by queued SIGIO */ -#define SI_TKILL -6 /* sent by tkill system call */ -#define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */ - -#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) -#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) - -/* - * SIGILL si_codes - */ -#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */ -#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */ -#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */ -#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */ -#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */ -#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */ -#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */ -#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */ -#define NSIGILL 8 - -/* - * SIGFPE si_codes - */ -#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */ -#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */ -#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */ -#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */ -#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */ -#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */ -#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */ -#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */ -#define NSIGFPE 8 - -/* - * SIGSEGV si_codes - */ -#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */ -#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */ -#define SEGV_BNDERR (__SI_FAULT|3) /* failed address bound checks */ -#define NSIGSEGV 3 - -/* - * SIGBUS si_codes - */ -#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */ -#define BUS_ADRERR (__SI_FAULT|2) /* non-existent physical address */ -#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */ -/* hardware memory error consumed on a machine check: action required */ -#define BUS_MCEERR_AR (__SI_FAULT|4) -/* hardware memory error detected in process but not consumed: action optional*/ -#define BUS_MCEERR_AO (__SI_FAULT|5) -#define NSIGBUS 5 - -/* - * SIGTRAP si_codes - */ -#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */ -#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */ -#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */ -#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint/watchpoint */ -#define NSIGTRAP 4 - -/* - * SIGCHLD si_codes - */ -#define CLD_EXITED (__SI_CHLD|1) /* child has exited */ -#define CLD_KILLED (__SI_CHLD|2) /* child was killed */ -#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */ -#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */ -#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */ -#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */ -#define NSIGCHLD 6 - -/* - * SIGPOLL si_codes - */ -#define POLL_IN (__SI_POLL|1) /* data input available */ -#define POLL_OUT (__SI_POLL|2) /* output buffers available */ -#define POLL_MSG (__SI_POLL|3) /* input message available */ -#define POLL_ERR (__SI_POLL|4) /* i/o error */ -#define POLL_PRI (__SI_POLL|5) /* high priority input available */ -#define POLL_HUP (__SI_POLL|6) /* device disconnected */ -#define NSIGPOLL 6 - -/* - * SIGSYS si_codes - */ -#define SYS_SECCOMP (__SI_SYS|1) /* seccomp triggered */ -#define NSIGSYS 1 - -/* - * sigevent definitions - * - * It seems likely that SIGEV_THREAD will have to be handled from - * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the - * thread manager then catches and does the appropriate nonsense. - * However, everything is written out here so as to not get lost. - */ -#define SIGEV_SIGNAL 0 /* notify via signal */ -#define SIGEV_NONE 1 /* other notification: meaningless */ -#define SIGEV_THREAD 2 /* deliver via thread creation */ -#define SIGEV_THREAD_ID 4 /* deliver to thread */ - -/* - * This works because the alignment is ok on all current architectures - * but we leave open this being overridden in the future - */ -#ifndef __ARCH_SIGEV_PREAMBLE_SIZE -#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t)) -#endif - -#define SIGEV_MAX_SIZE 64 -#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \ - / sizeof(int)) - -typedef struct sigevent { - sigval_t sigev_value; - int sigev_signo; - int sigev_notify; - union { - int _pad[SIGEV_PAD_SIZE]; - int _tid; - - struct { - void (*_function)(sigval_t); - void *_attribute; /* really pthread_attr_t */ - } _sigev_thread; - } _sigev_un; -} sigevent_t; - -#define sigev_notify_function _sigev_un._sigev_thread._function -#define sigev_notify_attributes _sigev_un._sigev_thread._attribute -#define sigev_notify_thread_id _sigev_un._tid - - -#endif /* _ASM_GENERIC_SIGINFO_H */ diff --git a/openflow/usr/include/asm-generic/signal-defs.h b/openflow/usr/include/asm-generic/signal-defs.h deleted file mode 100644 index 04cfb6d..0000000 --- a/openflow/usr/include/asm-generic/signal-defs.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __ASM_GENERIC_SIGNAL_DEFS_H -#define __ASM_GENERIC_SIGNAL_DEFS_H - - - -#ifndef SIG_BLOCK -#define SIG_BLOCK 0 /* for blocking signals */ -#endif -#ifndef SIG_UNBLOCK -#define SIG_UNBLOCK 1 /* for unblocking signals */ -#endif -#ifndef SIG_SETMASK -#define SIG_SETMASK 2 /* for setting the signal mask */ -#endif - -#ifndef __ASSEMBLY__ -typedef void __signalfn_t(int); -typedef __signalfn_t *__sighandler_t; - -typedef void __restorefn_t(void); -typedef __restorefn_t *__sigrestore_t; - -#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ -#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ -#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ -#endif - -#endif /* __ASM_GENERIC_SIGNAL_DEFS_H */ diff --git a/openflow/usr/include/asm-generic/signal.h b/openflow/usr/include/asm-generic/signal.h deleted file mode 100644 index 08c462c..0000000 --- a/openflow/usr/include/asm-generic/signal.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef __ASM_GENERIC_SIGNAL_H -#define __ASM_GENERIC_SIGNAL_H - -#include - -#define _NSIG 64 -#define _NSIG_BPW __BITS_PER_LONG -#define _NSIG_WORDS (_NSIG / _NSIG_BPW) - -#define SIGHUP 1 -#define SIGINT 2 -#define SIGQUIT 3 -#define SIGILL 4 -#define SIGTRAP 5 -#define SIGABRT 6 -#define SIGIOT 6 -#define SIGBUS 7 -#define SIGFPE 8 -#define SIGKILL 9 -#define SIGUSR1 10 -#define SIGSEGV 11 -#define SIGUSR2 12 -#define SIGPIPE 13 -#define SIGALRM 14 -#define SIGTERM 15 -#define SIGSTKFLT 16 -#define SIGCHLD 17 -#define SIGCONT 18 -#define SIGSTOP 19 -#define SIGTSTP 20 -#define SIGTTIN 21 -#define SIGTTOU 22 -#define SIGURG 23 -#define SIGXCPU 24 -#define SIGXFSZ 25 -#define SIGVTALRM 26 -#define SIGPROF 27 -#define SIGWINCH 28 -#define SIGIO 29 -#define SIGPOLL SIGIO -/* -#define SIGLOST 29 -*/ -#define SIGPWR 30 -#define SIGSYS 31 -#define SIGUNUSED 31 - -/* These should not be considered constants from userland. */ -#define SIGRTMIN 32 -#ifndef SIGRTMAX -#define SIGRTMAX _NSIG -#endif - -/* - * SA_FLAGS values: - * - * SA_ONSTACK indicates that a registered stack_t will be used. - * SA_RESTART flag to get restarting signals (which were the default long ago) - * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. - * SA_RESETHAND clears the handler when the signal is delivered. - * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. - * SA_NODEFER prevents the current signal from being masked in the handler. - * - * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single - * Unix names RESETHAND and NODEFER respectively. - */ -#define SA_NOCLDSTOP 0x00000001 -#define SA_NOCLDWAIT 0x00000002 -#define SA_SIGINFO 0x00000004 -#define SA_ONSTACK 0x08000000 -#define SA_RESTART 0x10000000 -#define SA_NODEFER 0x40000000 -#define SA_RESETHAND 0x80000000 - -#define SA_NOMASK SA_NODEFER -#define SA_ONESHOT SA_RESETHAND - -/* - * New architectures should not define the obsolete - * SA_RESTORER 0x04000000 - */ - -#if !defined MINSIGSTKSZ || !defined SIGSTKSZ -#define MINSIGSTKSZ 2048 -#define SIGSTKSZ 8192 -#endif - -#ifndef __ASSEMBLY__ -typedef struct { - unsigned long sig[_NSIG_WORDS]; -} sigset_t; - -/* not actually used, but required for linux/syscalls.h */ -typedef unsigned long old_sigset_t; - -#include - -#ifdef SA_RESTORER -#define __ARCH_HAS_SA_RESTORER -#endif - -struct sigaction { - __sighandler_t sa_handler; - unsigned long sa_flags; -#ifdef SA_RESTORER - __sigrestore_t sa_restorer; -#endif - sigset_t sa_mask; /* mask last for extensibility */ -}; - -typedef struct sigaltstack { - void *ss_sp; - int ss_flags; - size_t ss_size; -} stack_t; - -#endif /* __ASSEMBLY__ */ - -#endif /* __ASM_GENERIC_SIGNAL_H */ diff --git a/openflow/usr/include/asm-generic/socket.h b/openflow/usr/include/asm-generic/socket.h deleted file mode 100644 index 5c15c2a..0000000 --- a/openflow/usr/include/asm-generic/socket.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef __ASM_GENERIC_SOCKET_H -#define __ASM_GENERIC_SOCKET_H - -#include - -/* For setsockopt(2) */ -#define SOL_SOCKET 1 - -#define SO_DEBUG 1 -#define SO_REUSEADDR 2 -#define SO_TYPE 3 -#define SO_ERROR 4 -#define SO_DONTROUTE 5 -#define SO_BROADCAST 6 -#define SO_SNDBUF 7 -#define SO_RCVBUF 8 -#define SO_SNDBUFFORCE 32 -#define SO_RCVBUFFORCE 33 -#define SO_KEEPALIVE 9 -#define SO_OOBINLINE 10 -#define SO_NO_CHECK 11 -#define SO_PRIORITY 12 -#define SO_LINGER 13 -#define SO_BSDCOMPAT 14 -#define SO_REUSEPORT 15 -#ifndef SO_PASSCRED /* powerpc only differs in these */ -#define SO_PASSCRED 16 -#define SO_PEERCRED 17 -#define SO_RCVLOWAT 18 -#define SO_SNDLOWAT 19 -#define SO_RCVTIMEO 20 -#define SO_SNDTIMEO 21 -#endif - -/* Security levels - as per NRL IPv6 - don't actually do anything */ -#define SO_SECURITY_AUTHENTICATION 22 -#define SO_SECURITY_ENCRYPTION_TRANSPORT 23 -#define SO_SECURITY_ENCRYPTION_NETWORK 24 - -#define SO_BINDTODEVICE 25 - -/* Socket filtering */ -#define SO_ATTACH_FILTER 26 -#define SO_DETACH_FILTER 27 -#define SO_GET_FILTER SO_ATTACH_FILTER - -#define SO_PEERNAME 28 -#define SO_TIMESTAMP 29 -#define SCM_TIMESTAMP SO_TIMESTAMP - -#define SO_ACCEPTCONN 30 - -#define SO_PEERSEC 31 -#define SO_PASSSEC 34 -#define SO_TIMESTAMPNS 35 -#define SCM_TIMESTAMPNS SO_TIMESTAMPNS - -#define SO_MARK 36 - -#define SO_TIMESTAMPING 37 -#define SCM_TIMESTAMPING SO_TIMESTAMPING - -#define SO_PROTOCOL 38 -#define SO_DOMAIN 39 - -#define SO_RXQ_OVFL 40 - -#define SO_WIFI_STATUS 41 -#define SCM_WIFI_STATUS SO_WIFI_STATUS -#define SO_PEEK_OFF 42 - -/* Instruct lower device to use last 4-bytes of skb data as FCS */ -#define SO_NOFCS 43 - -#define SO_LOCK_FILTER 44 - -#define SO_SELECT_ERR_QUEUE 45 - -#define SO_BUSY_POLL 46 - -#define SO_MAX_PACING_RATE 47 - -#define SO_BPF_EXTENSIONS 48 - -#define SO_INCOMING_CPU 49 - -#define SO_ATTACH_BPF 50 -#define SO_DETACH_BPF SO_DETACH_FILTER - -#endif /* __ASM_GENERIC_SOCKET_H */ diff --git a/openflow/usr/include/asm-generic/sockios.h b/openflow/usr/include/asm-generic/sockios.h deleted file mode 100644 index 9a61a36..0000000 --- a/openflow/usr/include/asm-generic/sockios.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __ASM_GENERIC_SOCKIOS_H -#define __ASM_GENERIC_SOCKIOS_H - -/* Socket-level I/O control calls. */ -#define FIOSETOWN 0x8901 -#define SIOCSPGRP 0x8902 -#define FIOGETOWN 0x8903 -#define SIOCGPGRP 0x8904 -#define SIOCATMARK 0x8905 -#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ -#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ - -#endif /* __ASM_GENERIC_SOCKIOS_H */ diff --git a/openflow/usr/include/asm-generic/stat.h b/openflow/usr/include/asm-generic/stat.h deleted file mode 100644 index bd8cad2..0000000 --- a/openflow/usr/include/asm-generic/stat.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef __ASM_GENERIC_STAT_H -#define __ASM_GENERIC_STAT_H - -/* - * Everybody gets this wrong and has to stick with it for all - * eternity. Hopefully, this version gets used by new architectures - * so they don't fall into the same traps. - * - * stat64 is copied from powerpc64, with explicit padding added. - * stat is the same structure layout on 64-bit, without the 'long long' - * types. - * - * By convention, 64 bit architectures use the stat interface, while - * 32 bit architectures use the stat64 interface. Note that we don't - * provide an __old_kernel_stat here, which new architecture should - * not have to start with. - */ - -#include - -#define STAT_HAVE_NSEC 1 - -struct stat { - unsigned long st_dev; /* Device. */ - unsigned long st_ino; /* File serial number. */ - unsigned int st_mode; /* File mode. */ - unsigned int st_nlink; /* Link count. */ - unsigned int st_uid; /* User ID of the file's owner. */ - unsigned int st_gid; /* Group ID of the file's group. */ - unsigned long st_rdev; /* Device number, if device. */ - unsigned long __pad1; - long st_size; /* Size of file, in bytes. */ - int st_blksize; /* Optimal block size for I/O. */ - int __pad2; - long st_blocks; /* Number 512-byte blocks allocated. */ - long st_atime; /* Time of last access. */ - unsigned long st_atime_nsec; - long st_mtime; /* Time of last modification. */ - unsigned long st_mtime_nsec; - long st_ctime; /* Time of last status change. */ - unsigned long st_ctime_nsec; - unsigned int __unused4; - unsigned int __unused5; -}; - -/* This matches struct stat64 in glibc2.1. Only used for 32 bit. */ -#if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64) -struct stat64 { - unsigned long long st_dev; /* Device. */ - unsigned long long st_ino; /* File serial number. */ - unsigned int st_mode; /* File mode. */ - unsigned int st_nlink; /* Link count. */ - unsigned int st_uid; /* User ID of the file's owner. */ - unsigned int st_gid; /* Group ID of the file's group. */ - unsigned long long st_rdev; /* Device number, if device. */ - unsigned long long __pad1; - long long st_size; /* Size of file, in bytes. */ - int st_blksize; /* Optimal block size for I/O. */ - int __pad2; - long long st_blocks; /* Number 512-byte blocks allocated. */ - int st_atime; /* Time of last access. */ - unsigned int st_atime_nsec; - int st_mtime; /* Time of last modification. */ - unsigned int st_mtime_nsec; - int st_ctime; /* Time of last status change. */ - unsigned int st_ctime_nsec; - unsigned int __unused4; - unsigned int __unused5; -}; -#endif - -#endif /* __ASM_GENERIC_STAT_H */ diff --git a/openflow/usr/include/asm-generic/statfs.h b/openflow/usr/include/asm-generic/statfs.h deleted file mode 100644 index 6877912..0000000 --- a/openflow/usr/include/asm-generic/statfs.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef _GENERIC_STATFS_H -#define _GENERIC_STATFS_H - -#include - - -/* - * Most 64-bit platforms use 'long', while most 32-bit platforms use '__u32'. - * Yes, they differ in signedness as well as size. - * Special cases can override it for themselves -- except for S390x, which - * is just a little too special for us. And MIPS, which I'm not touching - * with a 10' pole. - */ -#ifndef __statfs_word -#if __BITS_PER_LONG == 64 -#define __statfs_word __kernel_long_t -#else -#define __statfs_word __u32 -#endif -#endif - -struct statfs { - __statfs_word f_type; - __statfs_word f_bsize; - __statfs_word f_blocks; - __statfs_word f_bfree; - __statfs_word f_bavail; - __statfs_word f_files; - __statfs_word f_ffree; - __kernel_fsid_t f_fsid; - __statfs_word f_namelen; - __statfs_word f_frsize; - __statfs_word f_flags; - __statfs_word f_spare[4]; -}; - -/* - * ARM needs to avoid the 32-bit padding at the end, for consistency - * between EABI and OABI - */ -#ifndef ARCH_PACK_STATFS64 -#define ARCH_PACK_STATFS64 -#endif - -struct statfs64 { - __statfs_word f_type; - __statfs_word f_bsize; - __u64 f_blocks; - __u64 f_bfree; - __u64 f_bavail; - __u64 f_files; - __u64 f_ffree; - __kernel_fsid_t f_fsid; - __statfs_word f_namelen; - __statfs_word f_frsize; - __statfs_word f_flags; - __statfs_word f_spare[4]; -} ARCH_PACK_STATFS64; - -/* - * IA64 and x86_64 need to avoid the 32-bit padding at the end, - * to be compatible with the i386 ABI - */ -#ifndef ARCH_PACK_COMPAT_STATFS64 -#define ARCH_PACK_COMPAT_STATFS64 -#endif - -struct compat_statfs64 { - __u32 f_type; - __u32 f_bsize; - __u64 f_blocks; - __u64 f_bfree; - __u64 f_bavail; - __u64 f_files; - __u64 f_ffree; - __kernel_fsid_t f_fsid; - __u32 f_namelen; - __u32 f_frsize; - __u32 f_flags; - __u32 f_spare[4]; -} ARCH_PACK_COMPAT_STATFS64; - -#endif /* _GENERIC_STATFS_H */ diff --git a/openflow/usr/include/asm-generic/swab.h b/openflow/usr/include/asm-generic/swab.h deleted file mode 100644 index a8e9029..0000000 --- a/openflow/usr/include/asm-generic/swab.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _ASM_GENERIC_SWAB_H -#define _ASM_GENERIC_SWAB_H - -#include - -/* - * 32 bit architectures typically (but not always) want to - * set __SWAB_64_THRU_32__. In user space, this is only - * valid if the compiler supports 64 bit data types. - */ - -#if __BITS_PER_LONG == 32 -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) -#define __SWAB_64_THRU_32__ -#endif -#endif - -#endif /* _ASM_GENERIC_SWAB_H */ diff --git a/openflow/usr/include/asm-generic/termbits.h b/openflow/usr/include/asm-generic/termbits.h deleted file mode 100644 index 232b478..0000000 --- a/openflow/usr/include/asm-generic/termbits.h +++ /dev/null @@ -1,199 +0,0 @@ -#ifndef __ASM_GENERIC_TERMBITS_H -#define __ASM_GENERIC_TERMBITS_H - -#include - -typedef unsigned char cc_t; -typedef unsigned int speed_t; -typedef unsigned int tcflag_t; - -#define NCCS 19 -struct termios { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ -}; - -struct termios2 { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ -}; - -struct ktermios { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ -}; - -/* c_cc characters */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VTIME 5 -#define VMIN 6 -#define VSWTC 7 -#define VSTART 8 -#define VSTOP 9 -#define VSUSP 10 -#define VEOL 11 -#define VREPRINT 12 -#define VDISCARD 13 -#define VWERASE 14 -#define VLNEXT 15 -#define VEOL2 16 - -/* c_iflag bits */ -#define IGNBRK 0000001 -#define BRKINT 0000002 -#define IGNPAR 0000004 -#define PARMRK 0000010 -#define INPCK 0000020 -#define ISTRIP 0000040 -#define INLCR 0000100 -#define IGNCR 0000200 -#define ICRNL 0000400 -#define IUCLC 0001000 -#define IXON 0002000 -#define IXANY 0004000 -#define IXOFF 0010000 -#define IMAXBEL 0020000 -#define IUTF8 0040000 - -/* c_oflag bits */ -#define OPOST 0000001 -#define OLCUC 0000002 -#define ONLCR 0000004 -#define OCRNL 0000010 -#define ONOCR 0000020 -#define ONLRET 0000040 -#define OFILL 0000100 -#define OFDEL 0000200 -#define NLDLY 0000400 -#define NL0 0000000 -#define NL1 0000400 -#define CRDLY 0003000 -#define CR0 0000000 -#define CR1 0001000 -#define CR2 0002000 -#define CR3 0003000 -#define TABDLY 0014000 -#define TAB0 0000000 -#define TAB1 0004000 -#define TAB2 0010000 -#define TAB3 0014000 -#define XTABS 0014000 -#define BSDLY 0020000 -#define BS0 0000000 -#define BS1 0020000 -#define VTDLY 0040000 -#define VT0 0000000 -#define VT1 0040000 -#define FFDLY 0100000 -#define FF0 0000000 -#define FF1 0100000 - -/* c_cflag bit meaning */ -#define CBAUD 0010017 -#define B0 0000000 /* hang up */ -#define B50 0000001 -#define B75 0000002 -#define B110 0000003 -#define B134 0000004 -#define B150 0000005 -#define B200 0000006 -#define B300 0000007 -#define B600 0000010 -#define B1200 0000011 -#define B1800 0000012 -#define B2400 0000013 -#define B4800 0000014 -#define B9600 0000015 -#define B19200 0000016 -#define B38400 0000017 -#define EXTA B19200 -#define EXTB B38400 -#define CSIZE 0000060 -#define CS5 0000000 -#define CS6 0000020 -#define CS7 0000040 -#define CS8 0000060 -#define CSTOPB 0000100 -#define CREAD 0000200 -#define PARENB 0000400 -#define PARODD 0001000 -#define HUPCL 0002000 -#define CLOCAL 0004000 -#define CBAUDEX 0010000 -#define BOTHER 0010000 -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 -#define B500000 0010005 -#define B576000 0010006 -#define B921600 0010007 -#define B1000000 0010010 -#define B1152000 0010011 -#define B1500000 0010012 -#define B2000000 0010013 -#define B2500000 0010014 -#define B3000000 0010015 -#define B3500000 0010016 -#define B4000000 0010017 -#define CIBAUD 002003600000 /* input baud rate */ -#define CMSPAR 010000000000 /* mark or space (stick) parity */ -#define CRTSCTS 020000000000 /* flow control */ - -#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ - -/* c_lflag bits */ -#define ISIG 0000001 -#define ICANON 0000002 -#define XCASE 0000004 -#define ECHO 0000010 -#define ECHOE 0000020 -#define ECHOK 0000040 -#define ECHONL 0000100 -#define NOFLSH 0000200 -#define TOSTOP 0000400 -#define ECHOCTL 0001000 -#define ECHOPRT 0002000 -#define ECHOKE 0004000 -#define FLUSHO 0010000 -#define PENDIN 0040000 -#define IEXTEN 0100000 -#define EXTPROC 0200000 - -/* tcflow() and TCXONC use these */ -#define TCOOFF 0 -#define TCOON 1 -#define TCIOFF 2 -#define TCION 3 - -/* tcflush() and TCFLSH use these */ -#define TCIFLUSH 0 -#define TCOFLUSH 1 -#define TCIOFLUSH 2 - -/* tcsetattr uses these */ -#define TCSANOW 0 -#define TCSADRAIN 1 -#define TCSAFLUSH 2 - -#endif /* __ASM_GENERIC_TERMBITS_H */ diff --git a/openflow/usr/include/asm-generic/termios.h b/openflow/usr/include/asm-generic/termios.h deleted file mode 100644 index 1c1166a..0000000 --- a/openflow/usr/include/asm-generic/termios.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef _ASM_GENERIC_TERMIOS_H -#define _ASM_GENERIC_TERMIOS_H -/* - * Most architectures have straight copies of the x86 code, with - * varying levels of bug fixes on top. Usually it's a good idea - * to use this generic version instead, but be careful to avoid - * ABI changes. - * New architectures should not provide their own version. - */ - -#include -#include - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#define NCC 8 -struct termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - -/* modem lines */ -#define TIOCM_LE 0x001 -#define TIOCM_DTR 0x002 -#define TIOCM_RTS 0x004 -#define TIOCM_ST 0x008 -#define TIOCM_SR 0x010 -#define TIOCM_CTS 0x020 -#define TIOCM_CAR 0x040 -#define TIOCM_RNG 0x080 -#define TIOCM_DSR 0x100 -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RI TIOCM_RNG -#define TIOCM_OUT1 0x2000 -#define TIOCM_OUT2 0x4000 -#define TIOCM_LOOP 0x8000 - -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ - - -#endif /* _ASM_GENERIC_TERMIOS_H */ diff --git a/openflow/usr/include/asm-generic/types.h b/openflow/usr/include/asm-generic/types.h deleted file mode 100644 index a387792..0000000 --- a/openflow/usr/include/asm-generic/types.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _ASM_GENERIC_TYPES_H -#define _ASM_GENERIC_TYPES_H -/* - * int-ll64 is used everywhere now. - */ -#include - -#endif /* _ASM_GENERIC_TYPES_H */ diff --git a/openflow/usr/include/asm-generic/ucontext.h b/openflow/usr/include/asm-generic/ucontext.h deleted file mode 100644 index ad77343..0000000 --- a/openflow/usr/include/asm-generic/ucontext.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __ASM_GENERIC_UCONTEXT_H -#define __ASM_GENERIC_UCONTEXT_H - -struct ucontext { - unsigned long uc_flags; - struct ucontext *uc_link; - stack_t uc_stack; - struct sigcontext uc_mcontext; - sigset_t uc_sigmask; /* mask last for extensibility */ -}; - -#endif /* __ASM_GENERIC_UCONTEXT_H */ diff --git a/openflow/usr/include/asm-generic/unistd.h b/openflow/usr/include/asm-generic/unistd.h deleted file mode 100644 index 1324b02..0000000 --- a/openflow/usr/include/asm-generic/unistd.h +++ /dev/null @@ -1,927 +0,0 @@ -#include - -/* - * This file contains the system call numbers, based on the - * layout of the x86-64 architecture, which embeds the - * pointer to the syscall in the table. - * - * As a basic principle, no duplication of functionality - * should be added, e.g. we don't use lseek when llseek - * is present. New architectures should use this file - * and implement the less feature-full calls in user space. - */ - -#ifndef __SYSCALL -#define __SYSCALL(x, y) -#endif - -#if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT) -#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32) -#else -#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64) -#endif - -#ifdef __SYSCALL_COMPAT -#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _comp) -#define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp) -#else -#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys) -#define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64) -#endif - -#define __NR_io_setup 0 -__SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup) -#define __NR_io_destroy 1 -__SYSCALL(__NR_io_destroy, sys_io_destroy) -#define __NR_io_submit 2 -__SC_COMP(__NR_io_submit, sys_io_submit, compat_sys_io_submit) -#define __NR_io_cancel 3 -__SYSCALL(__NR_io_cancel, sys_io_cancel) -#define __NR_io_getevents 4 -__SC_COMP(__NR_io_getevents, sys_io_getevents, compat_sys_io_getevents) - -/* fs/xattr.c */ -#define __NR_setxattr 5 -__SYSCALL(__NR_setxattr, sys_setxattr) -#define __NR_lsetxattr 6 -__SYSCALL(__NR_lsetxattr, sys_lsetxattr) -#define __NR_fsetxattr 7 -__SYSCALL(__NR_fsetxattr, sys_fsetxattr) -#define __NR_getxattr 8 -__SYSCALL(__NR_getxattr, sys_getxattr) -#define __NR_lgetxattr 9 -__SYSCALL(__NR_lgetxattr, sys_lgetxattr) -#define __NR_fgetxattr 10 -__SYSCALL(__NR_fgetxattr, sys_fgetxattr) -#define __NR_listxattr 11 -__SYSCALL(__NR_listxattr, sys_listxattr) -#define __NR_llistxattr 12 -__SYSCALL(__NR_llistxattr, sys_llistxattr) -#define __NR_flistxattr 13 -__SYSCALL(__NR_flistxattr, sys_flistxattr) -#define __NR_removexattr 14 -__SYSCALL(__NR_removexattr, sys_removexattr) -#define __NR_lremovexattr 15 -__SYSCALL(__NR_lremovexattr, sys_lremovexattr) -#define __NR_fremovexattr 16 -__SYSCALL(__NR_fremovexattr, sys_fremovexattr) - -/* fs/dcache.c */ -#define __NR_getcwd 17 -__SYSCALL(__NR_getcwd, sys_getcwd) - -/* fs/cookies.c */ -#define __NR_lookup_dcookie 18 -__SC_COMP(__NR_lookup_dcookie, sys_lookup_dcookie, compat_sys_lookup_dcookie) - -/* fs/eventfd.c */ -#define __NR_eventfd2 19 -__SYSCALL(__NR_eventfd2, sys_eventfd2) - -/* fs/eventpoll.c */ -#define __NR_epoll_create1 20 -__SYSCALL(__NR_epoll_create1, sys_epoll_create1) -#define __NR_epoll_ctl 21 -__SYSCALL(__NR_epoll_ctl, sys_epoll_ctl) -#define __NR_epoll_pwait 22 -__SC_COMP(__NR_epoll_pwait, sys_epoll_pwait, compat_sys_epoll_pwait) - -/* fs/fcntl.c */ -#define __NR_dup 23 -__SYSCALL(__NR_dup, sys_dup) -#define __NR_dup3 24 -__SYSCALL(__NR_dup3, sys_dup3) -#define __NR3264_fcntl 25 -__SC_COMP_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl, compat_sys_fcntl64) - -/* fs/inotify_user.c */ -#define __NR_inotify_init1 26 -__SYSCALL(__NR_inotify_init1, sys_inotify_init1) -#define __NR_inotify_add_watch 27 -__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch) -#define __NR_inotify_rm_watch 28 -__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch) - -/* fs/ioctl.c */ -#define __NR_ioctl 29 -__SC_COMP(__NR_ioctl, sys_ioctl, compat_sys_ioctl) - -/* fs/ioprio.c */ -#define __NR_ioprio_set 30 -__SYSCALL(__NR_ioprio_set, sys_ioprio_set) -#define __NR_ioprio_get 31 -__SYSCALL(__NR_ioprio_get, sys_ioprio_get) - -/* fs/locks.c */ -#define __NR_flock 32 -__SYSCALL(__NR_flock, sys_flock) - -/* fs/namei.c */ -#define __NR_mknodat 33 -__SYSCALL(__NR_mknodat, sys_mknodat) -#define __NR_mkdirat 34 -__SYSCALL(__NR_mkdirat, sys_mkdirat) -#define __NR_unlinkat 35 -__SYSCALL(__NR_unlinkat, sys_unlinkat) -#define __NR_symlinkat 36 -__SYSCALL(__NR_symlinkat, sys_symlinkat) -#define __NR_linkat 37 -__SYSCALL(__NR_linkat, sys_linkat) -#define __NR_renameat 38 -__SYSCALL(__NR_renameat, sys_renameat) - -/* fs/namespace.c */ -#define __NR_umount2 39 -__SYSCALL(__NR_umount2, sys_umount) -#define __NR_mount 40 -__SC_COMP(__NR_mount, sys_mount, compat_sys_mount) -#define __NR_pivot_root 41 -__SYSCALL(__NR_pivot_root, sys_pivot_root) - -/* fs/nfsctl.c */ -#define __NR_nfsservctl 42 -__SYSCALL(__NR_nfsservctl, sys_ni_syscall) - -/* fs/open.c */ -#define __NR3264_statfs 43 -__SC_COMP_3264(__NR3264_statfs, sys_statfs64, sys_statfs, \ - compat_sys_statfs64) -#define __NR3264_fstatfs 44 -__SC_COMP_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs, \ - compat_sys_fstatfs64) -#define __NR3264_truncate 45 -__SC_COMP_3264(__NR3264_truncate, sys_truncate64, sys_truncate, \ - compat_sys_truncate64) -#define __NR3264_ftruncate 46 -__SC_COMP_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate, \ - compat_sys_ftruncate64) - -#define __NR_fallocate 47 -__SC_COMP(__NR_fallocate, sys_fallocate, compat_sys_fallocate) -#define __NR_faccessat 48 -__SYSCALL(__NR_faccessat, sys_faccessat) -#define __NR_chdir 49 -__SYSCALL(__NR_chdir, sys_chdir) -#define __NR_fchdir 50 -__SYSCALL(__NR_fchdir, sys_fchdir) -#define __NR_chroot 51 -__SYSCALL(__NR_chroot, sys_chroot) -#define __NR_fchmod 52 -__SYSCALL(__NR_fchmod, sys_fchmod) -#define __NR_fchmodat 53 -__SYSCALL(__NR_fchmodat, sys_fchmodat) -#define __NR_fchownat 54 -__SYSCALL(__NR_fchownat, sys_fchownat) -#define __NR_fchown 55 -__SYSCALL(__NR_fchown, sys_fchown) -#define __NR_openat 56 -__SC_COMP(__NR_openat, sys_openat, compat_sys_openat) -#define __NR_close 57 -__SYSCALL(__NR_close, sys_close) -#define __NR_vhangup 58 -__SYSCALL(__NR_vhangup, sys_vhangup) - -/* fs/pipe.c */ -#define __NR_pipe2 59 -__SYSCALL(__NR_pipe2, sys_pipe2) - -/* fs/quota.c */ -#define __NR_quotactl 60 -__SYSCALL(__NR_quotactl, sys_quotactl) - -/* fs/readdir.c */ -#define __NR_getdents64 61 -#define __ARCH_WANT_COMPAT_SYS_GETDENTS64 -__SC_COMP(__NR_getdents64, sys_getdents64, compat_sys_getdents64) - -/* fs/read_write.c */ -#define __NR3264_lseek 62 -__SC_3264(__NR3264_lseek, sys_llseek, sys_lseek) -#define __NR_read 63 -__SYSCALL(__NR_read, sys_read) -#define __NR_write 64 -__SYSCALL(__NR_write, sys_write) -#define __NR_readv 65 -__SC_COMP(__NR_readv, sys_readv, compat_sys_readv) -#define __NR_writev 66 -__SC_COMP(__NR_writev, sys_writev, compat_sys_writev) -#define __NR_pread64 67 -__SC_COMP(__NR_pread64, sys_pread64, compat_sys_pread64) -#define __NR_pwrite64 68 -__SC_COMP(__NR_pwrite64, sys_pwrite64, compat_sys_pwrite64) -#define __NR_preadv 69 -__SC_COMP(__NR_preadv, sys_preadv, compat_sys_preadv) -#define __NR_pwritev 70 -__SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev) - -/* fs/sendfile.c */ -#define __NR3264_sendfile 71 -__SYSCALL(__NR3264_sendfile, sys_sendfile64) - -/* fs/select.c */ -#define __NR_pselect6 72 -__SC_COMP(__NR_pselect6, sys_pselect6, compat_sys_pselect6) -#define __NR_ppoll 73 -__SC_COMP(__NR_ppoll, sys_ppoll, compat_sys_ppoll) - -/* fs/signalfd.c */ -#define __NR_signalfd4 74 -__SC_COMP(__NR_signalfd4, sys_signalfd4, compat_sys_signalfd4) - -/* fs/splice.c */ -#define __NR_vmsplice 75 -__SC_COMP(__NR_vmsplice, sys_vmsplice, compat_sys_vmsplice) -#define __NR_splice 76 -__SYSCALL(__NR_splice, sys_splice) -#define __NR_tee 77 -__SYSCALL(__NR_tee, sys_tee) - -/* fs/stat.c */ -#define __NR_readlinkat 78 -__SYSCALL(__NR_readlinkat, sys_readlinkat) -#define __NR3264_fstatat 79 -__SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat) -#define __NR3264_fstat 80 -__SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat) - -/* fs/sync.c */ -#define __NR_sync 81 -__SYSCALL(__NR_sync, sys_sync) -#define __NR_fsync 82 -__SYSCALL(__NR_fsync, sys_fsync) -#define __NR_fdatasync 83 -__SYSCALL(__NR_fdatasync, sys_fdatasync) -#ifdef __ARCH_WANT_SYNC_FILE_RANGE2 -#define __NR_sync_file_range2 84 -__SC_COMP(__NR_sync_file_range2, sys_sync_file_range2, \ - compat_sys_sync_file_range2) -#else -#define __NR_sync_file_range 84 -__SC_COMP(__NR_sync_file_range, sys_sync_file_range, \ - compat_sys_sync_file_range) -#endif - -/* fs/timerfd.c */ -#define __NR_timerfd_create 85 -__SYSCALL(__NR_timerfd_create, sys_timerfd_create) -#define __NR_timerfd_settime 86 -__SC_COMP(__NR_timerfd_settime, sys_timerfd_settime, \ - compat_sys_timerfd_settime) -#define __NR_timerfd_gettime 87 -__SC_COMP(__NR_timerfd_gettime, sys_timerfd_gettime, \ - compat_sys_timerfd_gettime) - -/* fs/utimes.c */ -#define __NR_utimensat 88 -__SC_COMP(__NR_utimensat, sys_utimensat, compat_sys_utimensat) - -/* kernel/acct.c */ -#define __NR_acct 89 -__SYSCALL(__NR_acct, sys_acct) - -/* kernel/capability.c */ -#define __NR_capget 90 -__SYSCALL(__NR_capget, sys_capget) -#define __NR_capset 91 -__SYSCALL(__NR_capset, sys_capset) - -/* kernel/exec_domain.c */ -#define __NR_personality 92 -__SYSCALL(__NR_personality, sys_personality) - -/* kernel/exit.c */ -#define __NR_exit 93 -__SYSCALL(__NR_exit, sys_exit) -#define __NR_exit_group 94 -__SYSCALL(__NR_exit_group, sys_exit_group) -#define __NR_waitid 95 -__SC_COMP(__NR_waitid, sys_waitid, compat_sys_waitid) - -/* kernel/fork.c */ -#define __NR_set_tid_address 96 -__SYSCALL(__NR_set_tid_address, sys_set_tid_address) -#define __NR_unshare 97 -__SYSCALL(__NR_unshare, sys_unshare) - -/* kernel/futex.c */ -#define __NR_futex 98 -__SC_COMP(__NR_futex, sys_futex, compat_sys_futex) -#define __NR_set_robust_list 99 -__SC_COMP(__NR_set_robust_list, sys_set_robust_list, \ - compat_sys_set_robust_list) -#define __NR_get_robust_list 100 -__SC_COMP(__NR_get_robust_list, sys_get_robust_list, \ - compat_sys_get_robust_list) - -/* kernel/hrtimer.c */ -#define __NR_nanosleep 101 -__SC_COMP(__NR_nanosleep, sys_nanosleep, compat_sys_nanosleep) - -/* kernel/itimer.c */ -#define __NR_getitimer 102 -__SC_COMP(__NR_getitimer, sys_getitimer, compat_sys_getitimer) -#define __NR_setitimer 103 -__SC_COMP(__NR_setitimer, sys_setitimer, compat_sys_setitimer) - -/* kernel/kexec.c */ -#define __NR_kexec_load 104 -__SC_COMP(__NR_kexec_load, sys_kexec_load, compat_sys_kexec_load) - -/* kernel/module.c */ -#define __NR_init_module 105 -__SYSCALL(__NR_init_module, sys_init_module) -#define __NR_delete_module 106 -__SYSCALL(__NR_delete_module, sys_delete_module) - -/* kernel/posix-timers.c */ -#define __NR_timer_create 107 -__SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create) -#define __NR_timer_gettime 108 -__SC_COMP(__NR_timer_gettime, sys_timer_gettime, compat_sys_timer_gettime) -#define __NR_timer_getoverrun 109 -__SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun) -#define __NR_timer_settime 110 -__SC_COMP(__NR_timer_settime, sys_timer_settime, compat_sys_timer_settime) -#define __NR_timer_delete 111 -__SYSCALL(__NR_timer_delete, sys_timer_delete) -#define __NR_clock_settime 112 -__SC_COMP(__NR_clock_settime, sys_clock_settime, compat_sys_clock_settime) -#define __NR_clock_gettime 113 -__SC_COMP(__NR_clock_gettime, sys_clock_gettime, compat_sys_clock_gettime) -#define __NR_clock_getres 114 -__SC_COMP(__NR_clock_getres, sys_clock_getres, compat_sys_clock_getres) -#define __NR_clock_nanosleep 115 -__SC_COMP(__NR_clock_nanosleep, sys_clock_nanosleep, \ - compat_sys_clock_nanosleep) - -/* kernel/printk.c */ -#define __NR_syslog 116 -__SYSCALL(__NR_syslog, sys_syslog) - -/* kernel/ptrace.c */ -#define __NR_ptrace 117 -__SYSCALL(__NR_ptrace, sys_ptrace) - -/* kernel/sched/core.c */ -#define __NR_sched_setparam 118 -__SYSCALL(__NR_sched_setparam, sys_sched_setparam) -#define __NR_sched_setscheduler 119 -__SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler) -#define __NR_sched_getscheduler 120 -__SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler) -#define __NR_sched_getparam 121 -__SYSCALL(__NR_sched_getparam, sys_sched_getparam) -#define __NR_sched_setaffinity 122 -__SC_COMP(__NR_sched_setaffinity, sys_sched_setaffinity, \ - compat_sys_sched_setaffinity) -#define __NR_sched_getaffinity 123 -__SC_COMP(__NR_sched_getaffinity, sys_sched_getaffinity, \ - compat_sys_sched_getaffinity) -#define __NR_sched_yield 124 -__SYSCALL(__NR_sched_yield, sys_sched_yield) -#define __NR_sched_get_priority_max 125 -__SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max) -#define __NR_sched_get_priority_min 126 -__SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min) -#define __NR_sched_rr_get_interval 127 -__SC_COMP(__NR_sched_rr_get_interval, sys_sched_rr_get_interval, \ - compat_sys_sched_rr_get_interval) - -/* kernel/signal.c */ -#define __NR_restart_syscall 128 -__SYSCALL(__NR_restart_syscall, sys_restart_syscall) -#define __NR_kill 129 -__SYSCALL(__NR_kill, sys_kill) -#define __NR_tkill 130 -__SYSCALL(__NR_tkill, sys_tkill) -#define __NR_tgkill 131 -__SYSCALL(__NR_tgkill, sys_tgkill) -#define __NR_sigaltstack 132 -__SC_COMP(__NR_sigaltstack, sys_sigaltstack, compat_sys_sigaltstack) -#define __NR_rt_sigsuspend 133 -__SC_COMP(__NR_rt_sigsuspend, sys_rt_sigsuspend, compat_sys_rt_sigsuspend) -#define __NR_rt_sigaction 134 -__SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction) -#define __NR_rt_sigprocmask 135 -__SC_COMP(__NR_rt_sigprocmask, sys_rt_sigprocmask, compat_sys_rt_sigprocmask) -#define __NR_rt_sigpending 136 -__SC_COMP(__NR_rt_sigpending, sys_rt_sigpending, compat_sys_rt_sigpending) -#define __NR_rt_sigtimedwait 137 -__SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \ - compat_sys_rt_sigtimedwait) -#define __NR_rt_sigqueueinfo 138 -__SC_COMP(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo, \ - compat_sys_rt_sigqueueinfo) -#define __NR_rt_sigreturn 139 -__SC_COMP(__NR_rt_sigreturn, sys_rt_sigreturn, compat_sys_rt_sigreturn) - -/* kernel/sys.c */ -#define __NR_setpriority 140 -__SYSCALL(__NR_setpriority, sys_setpriority) -#define __NR_getpriority 141 -__SYSCALL(__NR_getpriority, sys_getpriority) -#define __NR_reboot 142 -__SYSCALL(__NR_reboot, sys_reboot) -#define __NR_setregid 143 -__SYSCALL(__NR_setregid, sys_setregid) -#define __NR_setgid 144 -__SYSCALL(__NR_setgid, sys_setgid) -#define __NR_setreuid 145 -__SYSCALL(__NR_setreuid, sys_setreuid) -#define __NR_setuid 146 -__SYSCALL(__NR_setuid, sys_setuid) -#define __NR_setresuid 147 -__SYSCALL(__NR_setresuid, sys_setresuid) -#define __NR_getresuid 148 -__SYSCALL(__NR_getresuid, sys_getresuid) -#define __NR_setresgid 149 -__SYSCALL(__NR_setresgid, sys_setresgid) -#define __NR_getresgid 150 -__SYSCALL(__NR_getresgid, sys_getresgid) -#define __NR_setfsuid 151 -__SYSCALL(__NR_setfsuid, sys_setfsuid) -#define __NR_setfsgid 152 -__SYSCALL(__NR_setfsgid, sys_setfsgid) -#define __NR_times 153 -__SC_COMP(__NR_times, sys_times, compat_sys_times) -#define __NR_setpgid 154 -__SYSCALL(__NR_setpgid, sys_setpgid) -#define __NR_getpgid 155 -__SYSCALL(__NR_getpgid, sys_getpgid) -#define __NR_getsid 156 -__SYSCALL(__NR_getsid, sys_getsid) -#define __NR_setsid 157 -__SYSCALL(__NR_setsid, sys_setsid) -#define __NR_getgroups 158 -__SYSCALL(__NR_getgroups, sys_getgroups) -#define __NR_setgroups 159 -__SYSCALL(__NR_setgroups, sys_setgroups) -#define __NR_uname 160 -__SYSCALL(__NR_uname, sys_newuname) -#define __NR_sethostname 161 -__SYSCALL(__NR_sethostname, sys_sethostname) -#define __NR_setdomainname 162 -__SYSCALL(__NR_setdomainname, sys_setdomainname) -#define __NR_getrlimit 163 -__SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit) -#define __NR_setrlimit 164 -__SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit) -#define __NR_getrusage 165 -__SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage) -#define __NR_umask 166 -__SYSCALL(__NR_umask, sys_umask) -#define __NR_prctl 167 -__SYSCALL(__NR_prctl, sys_prctl) -#define __NR_getcpu 168 -__SYSCALL(__NR_getcpu, sys_getcpu) - -/* kernel/time.c */ -#define __NR_gettimeofday 169 -__SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday) -#define __NR_settimeofday 170 -__SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday) -#define __NR_adjtimex 171 -__SC_COMP(__NR_adjtimex, sys_adjtimex, compat_sys_adjtimex) - -/* kernel/timer.c */ -#define __NR_getpid 172 -__SYSCALL(__NR_getpid, sys_getpid) -#define __NR_getppid 173 -__SYSCALL(__NR_getppid, sys_getppid) -#define __NR_getuid 174 -__SYSCALL(__NR_getuid, sys_getuid) -#define __NR_geteuid 175 -__SYSCALL(__NR_geteuid, sys_geteuid) -#define __NR_getgid 176 -__SYSCALL(__NR_getgid, sys_getgid) -#define __NR_getegid 177 -__SYSCALL(__NR_getegid, sys_getegid) -#define __NR_gettid 178 -__SYSCALL(__NR_gettid, sys_gettid) -#define __NR_sysinfo 179 -__SC_COMP(__NR_sysinfo, sys_sysinfo, compat_sys_sysinfo) - -/* ipc/mqueue.c */ -#define __NR_mq_open 180 -__SC_COMP(__NR_mq_open, sys_mq_open, compat_sys_mq_open) -#define __NR_mq_unlink 181 -__SYSCALL(__NR_mq_unlink, sys_mq_unlink) -#define __NR_mq_timedsend 182 -__SC_COMP(__NR_mq_timedsend, sys_mq_timedsend, compat_sys_mq_timedsend) -#define __NR_mq_timedreceive 183 -__SC_COMP(__NR_mq_timedreceive, sys_mq_timedreceive, \ - compat_sys_mq_timedreceive) -#define __NR_mq_notify 184 -__SC_COMP(__NR_mq_notify, sys_mq_notify, compat_sys_mq_notify) -#define __NR_mq_getsetattr 185 -__SC_COMP(__NR_mq_getsetattr, sys_mq_getsetattr, compat_sys_mq_getsetattr) - -/* ipc/msg.c */ -#define __NR_msgget 186 -__SYSCALL(__NR_msgget, sys_msgget) -#define __NR_msgctl 187 -__SC_COMP(__NR_msgctl, sys_msgctl, compat_sys_msgctl) -#define __NR_msgrcv 188 -__SC_COMP(__NR_msgrcv, sys_msgrcv, compat_sys_msgrcv) -#define __NR_msgsnd 189 -__SC_COMP(__NR_msgsnd, sys_msgsnd, compat_sys_msgsnd) - -/* ipc/sem.c */ -#define __NR_semget 190 -__SYSCALL(__NR_semget, sys_semget) -#define __NR_semctl 191 -__SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl) -#define __NR_semtimedop 192 -__SC_COMP(__NR_semtimedop, sys_semtimedop, compat_sys_semtimedop) -#define __NR_semop 193 -__SYSCALL(__NR_semop, sys_semop) - -/* ipc/shm.c */ -#define __NR_shmget 194 -__SYSCALL(__NR_shmget, sys_shmget) -#define __NR_shmctl 195 -__SC_COMP(__NR_shmctl, sys_shmctl, compat_sys_shmctl) -#define __NR_shmat 196 -__SC_COMP(__NR_shmat, sys_shmat, compat_sys_shmat) -#define __NR_shmdt 197 -__SYSCALL(__NR_shmdt, sys_shmdt) - -/* net/socket.c */ -#define __NR_socket 198 -__SYSCALL(__NR_socket, sys_socket) -#define __NR_socketpair 199 -__SYSCALL(__NR_socketpair, sys_socketpair) -#define __NR_bind 200 -__SYSCALL(__NR_bind, sys_bind) -#define __NR_listen 201 -__SYSCALL(__NR_listen, sys_listen) -#define __NR_accept 202 -__SYSCALL(__NR_accept, sys_accept) -#define __NR_connect 203 -__SYSCALL(__NR_connect, sys_connect) -#define __NR_getsockname 204 -__SYSCALL(__NR_getsockname, sys_getsockname) -#define __NR_getpeername 205 -__SYSCALL(__NR_getpeername, sys_getpeername) -#define __NR_sendto 206 -__SYSCALL(__NR_sendto, sys_sendto) -#define __NR_recvfrom 207 -__SC_COMP(__NR_recvfrom, sys_recvfrom, compat_sys_recvfrom) -#define __NR_setsockopt 208 -__SC_COMP(__NR_setsockopt, sys_setsockopt, compat_sys_setsockopt) -#define __NR_getsockopt 209 -__SC_COMP(__NR_getsockopt, sys_getsockopt, compat_sys_getsockopt) -#define __NR_shutdown 210 -__SYSCALL(__NR_shutdown, sys_shutdown) -#define __NR_sendmsg 211 -__SC_COMP(__NR_sendmsg, sys_sendmsg, compat_sys_sendmsg) -#define __NR_recvmsg 212 -__SC_COMP(__NR_recvmsg, sys_recvmsg, compat_sys_recvmsg) - -/* mm/filemap.c */ -#define __NR_readahead 213 -__SC_COMP(__NR_readahead, sys_readahead, compat_sys_readahead) - -/* mm/nommu.c, also with MMU */ -#define __NR_brk 214 -__SYSCALL(__NR_brk, sys_brk) -#define __NR_munmap 215 -__SYSCALL(__NR_munmap, sys_munmap) -#define __NR_mremap 216 -__SYSCALL(__NR_mremap, sys_mremap) - -/* security/keys/keyctl.c */ -#define __NR_add_key 217 -__SYSCALL(__NR_add_key, sys_add_key) -#define __NR_request_key 218 -__SYSCALL(__NR_request_key, sys_request_key) -#define __NR_keyctl 219 -__SC_COMP(__NR_keyctl, sys_keyctl, compat_sys_keyctl) - -/* arch/example/kernel/sys_example.c */ -#define __NR_clone 220 -__SYSCALL(__NR_clone, sys_clone) -#define __NR_execve 221 -__SC_COMP(__NR_execve, sys_execve, compat_sys_execve) - -#define __NR3264_mmap 222 -__SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap) -/* mm/fadvise.c */ -#define __NR3264_fadvise64 223 -__SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64) - -/* mm/, CONFIG_MMU only */ -#ifndef __ARCH_NOMMU -#define __NR_swapon 224 -__SYSCALL(__NR_swapon, sys_swapon) -#define __NR_swapoff 225 -__SYSCALL(__NR_swapoff, sys_swapoff) -#define __NR_mprotect 226 -__SYSCALL(__NR_mprotect, sys_mprotect) -#define __NR_msync 227 -__SYSCALL(__NR_msync, sys_msync) -#define __NR_mlock 228 -__SYSCALL(__NR_mlock, sys_mlock) -#define __NR_munlock 229 -__SYSCALL(__NR_munlock, sys_munlock) -#define __NR_mlockall 230 -__SYSCALL(__NR_mlockall, sys_mlockall) -#define __NR_munlockall 231 -__SYSCALL(__NR_munlockall, sys_munlockall) -#define __NR_mincore 232 -__SYSCALL(__NR_mincore, sys_mincore) -#define __NR_madvise 233 -__SYSCALL(__NR_madvise, sys_madvise) -#define __NR_remap_file_pages 234 -__SYSCALL(__NR_remap_file_pages, sys_remap_file_pages) -#define __NR_mbind 235 -__SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind) -#define __NR_get_mempolicy 236 -__SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy) -#define __NR_set_mempolicy 237 -__SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy) -#define __NR_migrate_pages 238 -__SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages) -#define __NR_move_pages 239 -__SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages) -#endif - -#define __NR_rt_tgsigqueueinfo 240 -__SC_COMP(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo, \ - compat_sys_rt_tgsigqueueinfo) -#define __NR_perf_event_open 241 -__SYSCALL(__NR_perf_event_open, sys_perf_event_open) -#define __NR_accept4 242 -__SYSCALL(__NR_accept4, sys_accept4) -#define __NR_recvmmsg 243 -__SC_COMP(__NR_recvmmsg, sys_recvmmsg, compat_sys_recvmmsg) - -/* - * Architectures may provide up to 16 syscalls of their own - * starting with this value. - */ -#define __NR_arch_specific_syscall 244 - -#define __NR_wait4 260 -__SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4) -#define __NR_prlimit64 261 -__SYSCALL(__NR_prlimit64, sys_prlimit64) -#define __NR_fanotify_init 262 -__SYSCALL(__NR_fanotify_init, sys_fanotify_init) -#define __NR_fanotify_mark 263 -__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) -#define __NR_name_to_handle_at 264 -__SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) -#define __NR_open_by_handle_at 265 -__SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \ - compat_sys_open_by_handle_at) -#define __NR_clock_adjtime 266 -__SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime) -#define __NR_syncfs 267 -__SYSCALL(__NR_syncfs, sys_syncfs) -#define __NR_setns 268 -__SYSCALL(__NR_setns, sys_setns) -#define __NR_sendmmsg 269 -__SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg) -#define __NR_process_vm_readv 270 -__SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \ - compat_sys_process_vm_readv) -#define __NR_process_vm_writev 271 -__SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \ - compat_sys_process_vm_writev) -#define __NR_kcmp 272 -__SYSCALL(__NR_kcmp, sys_kcmp) -#define __NR_finit_module 273 -__SYSCALL(__NR_finit_module, sys_finit_module) -#define __NR_sched_setattr 274 -__SYSCALL(__NR_sched_setattr, sys_sched_setattr) -#define __NR_sched_getattr 275 -__SYSCALL(__NR_sched_getattr, sys_sched_getattr) -#define __NR_renameat2 276 -__SYSCALL(__NR_renameat2, sys_renameat2) -#define __NR_seccomp 277 -__SYSCALL(__NR_seccomp, sys_seccomp) -#define __NR_getrandom 278 -__SYSCALL(__NR_getrandom, sys_getrandom) -#define __NR_memfd_create 279 -__SYSCALL(__NR_memfd_create, sys_memfd_create) -#define __NR_bpf 280 -__SYSCALL(__NR_bpf, sys_bpf) -#define __NR_execveat 281 -__SC_COMP(__NR_execveat, sys_execveat, compat_sys_execveat) -#define __NR_userfaultfd 282 -__SYSCALL(__NR_userfaultfd, sys_userfaultfd) -#define __NR_membarrier 283 -__SYSCALL(__NR_membarrier, sys_membarrier) -#define __NR_mlock2 284 -__SYSCALL(__NR_mlock2, sys_mlock2) - -#undef __NR_syscalls -#define __NR_syscalls 285 - -/* - * All syscalls below here should go away really, - * these are provided for both review and as a porting - * help for the C library version. - * - * Last chance: are any of these important enough to - * enable by default? - */ -#ifdef __ARCH_WANT_SYSCALL_NO_AT -#define __NR_open 1024 -__SYSCALL(__NR_open, sys_open) -#define __NR_link 1025 -__SYSCALL(__NR_link, sys_link) -#define __NR_unlink 1026 -__SYSCALL(__NR_unlink, sys_unlink) -#define __NR_mknod 1027 -__SYSCALL(__NR_mknod, sys_mknod) -#define __NR_chmod 1028 -__SYSCALL(__NR_chmod, sys_chmod) -#define __NR_chown 1029 -__SYSCALL(__NR_chown, sys_chown) -#define __NR_mkdir 1030 -__SYSCALL(__NR_mkdir, sys_mkdir) -#define __NR_rmdir 1031 -__SYSCALL(__NR_rmdir, sys_rmdir) -#define __NR_lchown 1032 -__SYSCALL(__NR_lchown, sys_lchown) -#define __NR_access 1033 -__SYSCALL(__NR_access, sys_access) -#define __NR_rename 1034 -__SYSCALL(__NR_rename, sys_rename) -#define __NR_readlink 1035 -__SYSCALL(__NR_readlink, sys_readlink) -#define __NR_symlink 1036 -__SYSCALL(__NR_symlink, sys_symlink) -#define __NR_utimes 1037 -__SYSCALL(__NR_utimes, sys_utimes) -#define __NR3264_stat 1038 -__SC_3264(__NR3264_stat, sys_stat64, sys_newstat) -#define __NR3264_lstat 1039 -__SC_3264(__NR3264_lstat, sys_lstat64, sys_newlstat) - -#undef __NR_syscalls -#define __NR_syscalls (__NR3264_lstat+1) -#endif /* __ARCH_WANT_SYSCALL_NO_AT */ - -#ifdef __ARCH_WANT_SYSCALL_NO_FLAGS -#define __NR_pipe 1040 -__SYSCALL(__NR_pipe, sys_pipe) -#define __NR_dup2 1041 -__SYSCALL(__NR_dup2, sys_dup2) -#define __NR_epoll_create 1042 -__SYSCALL(__NR_epoll_create, sys_epoll_create) -#define __NR_inotify_init 1043 -__SYSCALL(__NR_inotify_init, sys_inotify_init) -#define __NR_eventfd 1044 -__SYSCALL(__NR_eventfd, sys_eventfd) -#define __NR_signalfd 1045 -__SYSCALL(__NR_signalfd, sys_signalfd) - -#undef __NR_syscalls -#define __NR_syscalls (__NR_signalfd+1) -#endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */ - -#if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && \ - defined(__ARCH_WANT_SYSCALL_OFF_T) -#define __NR_sendfile 1046 -__SYSCALL(__NR_sendfile, sys_sendfile) -#define __NR_ftruncate 1047 -__SYSCALL(__NR_ftruncate, sys_ftruncate) -#define __NR_truncate 1048 -__SYSCALL(__NR_truncate, sys_truncate) -#define __NR_stat 1049 -__SYSCALL(__NR_stat, sys_newstat) -#define __NR_lstat 1050 -__SYSCALL(__NR_lstat, sys_newlstat) -#define __NR_fstat 1051 -__SYSCALL(__NR_fstat, sys_newfstat) -#define __NR_fcntl 1052 -__SYSCALL(__NR_fcntl, sys_fcntl) -#define __NR_fadvise64 1053 -#define __ARCH_WANT_SYS_FADVISE64 -__SYSCALL(__NR_fadvise64, sys_fadvise64) -#define __NR_newfstatat 1054 -#define __ARCH_WANT_SYS_NEWFSTATAT -__SYSCALL(__NR_newfstatat, sys_newfstatat) -#define __NR_fstatfs 1055 -__SYSCALL(__NR_fstatfs, sys_fstatfs) -#define __NR_statfs 1056 -__SYSCALL(__NR_statfs, sys_statfs) -#define __NR_lseek 1057 -__SYSCALL(__NR_lseek, sys_lseek) -#define __NR_mmap 1058 -__SYSCALL(__NR_mmap, sys_mmap) - -#undef __NR_syscalls -#define __NR_syscalls (__NR_mmap+1) -#endif /* 32 bit off_t syscalls */ - -#ifdef __ARCH_WANT_SYSCALL_DEPRECATED -#define __NR_alarm 1059 -#define __ARCH_WANT_SYS_ALARM -__SYSCALL(__NR_alarm, sys_alarm) -#define __NR_getpgrp 1060 -#define __ARCH_WANT_SYS_GETPGRP -__SYSCALL(__NR_getpgrp, sys_getpgrp) -#define __NR_pause 1061 -#define __ARCH_WANT_SYS_PAUSE -__SYSCALL(__NR_pause, sys_pause) -#define __NR_time 1062 -#define __ARCH_WANT_SYS_TIME -#define __ARCH_WANT_COMPAT_SYS_TIME -__SYSCALL(__NR_time, sys_time) -#define __NR_utime 1063 -#define __ARCH_WANT_SYS_UTIME -__SYSCALL(__NR_utime, sys_utime) - -#define __NR_creat 1064 -__SYSCALL(__NR_creat, sys_creat) -#define __NR_getdents 1065 -#define __ARCH_WANT_SYS_GETDENTS -__SYSCALL(__NR_getdents, sys_getdents) -#define __NR_futimesat 1066 -__SYSCALL(__NR_futimesat, sys_futimesat) -#define __NR_select 1067 -#define __ARCH_WANT_SYS_SELECT -__SYSCALL(__NR_select, sys_select) -#define __NR_poll 1068 -__SYSCALL(__NR_poll, sys_poll) -#define __NR_epoll_wait 1069 -__SYSCALL(__NR_epoll_wait, sys_epoll_wait) -#define __NR_ustat 1070 -__SYSCALL(__NR_ustat, sys_ustat) -#define __NR_vfork 1071 -__SYSCALL(__NR_vfork, sys_vfork) -#define __NR_oldwait4 1072 -__SYSCALL(__NR_oldwait4, sys_wait4) -#define __NR_recv 1073 -__SYSCALL(__NR_recv, sys_recv) -#define __NR_send 1074 -__SYSCALL(__NR_send, sys_send) -#define __NR_bdflush 1075 -__SYSCALL(__NR_bdflush, sys_bdflush) -#define __NR_umount 1076 -__SYSCALL(__NR_umount, sys_oldumount) -#define __ARCH_WANT_SYS_OLDUMOUNT -#define __NR_uselib 1077 -__SYSCALL(__NR_uselib, sys_uselib) -#define __NR__sysctl 1078 -__SYSCALL(__NR__sysctl, sys_sysctl) - -#define __NR_fork 1079 -#ifdef CONFIG_MMU -__SYSCALL(__NR_fork, sys_fork) -#else -__SYSCALL(__NR_fork, sys_ni_syscall) -#endif /* CONFIG_MMU */ - -#undef __NR_syscalls -#define __NR_syscalls (__NR_fork+1) - -#endif /* __ARCH_WANT_SYSCALL_DEPRECATED */ - -/* - * 32 bit systems traditionally used different - * syscalls for off_t and loff_t arguments, while - * 64 bit systems only need the off_t version. - * For new 32 bit platforms, there is no need to - * implement the old 32 bit off_t syscalls, so - * they take different names. - * Here we map the numbers so that both versions - * use the same syscall table layout. - */ -#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT) -#define __NR_fcntl __NR3264_fcntl -#define __NR_statfs __NR3264_statfs -#define __NR_fstatfs __NR3264_fstatfs -#define __NR_truncate __NR3264_truncate -#define __NR_ftruncate __NR3264_ftruncate -#define __NR_lseek __NR3264_lseek -#define __NR_sendfile __NR3264_sendfile -#define __NR_newfstatat __NR3264_fstatat -#define __NR_fstat __NR3264_fstat -#define __NR_mmap __NR3264_mmap -#define __NR_fadvise64 __NR3264_fadvise64 -#ifdef __NR3264_stat -#define __NR_stat __NR3264_stat -#define __NR_lstat __NR3264_lstat -#endif -#else -#define __NR_fcntl64 __NR3264_fcntl -#define __NR_statfs64 __NR3264_statfs -#define __NR_fstatfs64 __NR3264_fstatfs -#define __NR_truncate64 __NR3264_truncate -#define __NR_ftruncate64 __NR3264_ftruncate -#define __NR_llseek __NR3264_lseek -#define __NR_sendfile64 __NR3264_sendfile -#define __NR_fstatat64 __NR3264_fstatat -#define __NR_fstat64 __NR3264_fstat -#define __NR_mmap2 __NR3264_mmap -#define __NR_fadvise64_64 __NR3264_fadvise64 -#ifdef __NR3264_stat -#define __NR_stat64 __NR3264_stat -#define __NR_lstat64 __NR3264_lstat -#endif -#endif diff --git a/openflow/usr/include/assert.h b/openflow/usr/include/assert.h deleted file mode 100644 index aa6c503..0000000 --- a/openflow/usr/include/assert.h +++ /dev/null @@ -1,121 +0,0 @@ -/* Copyright (C) 1991-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * ISO C99 Standard: 7.2 Diagnostics - */ - -#ifdef _ASSERT_H - -# undef _ASSERT_H -# undef assert -# undef __ASSERT_VOID_CAST - -# ifdef __USE_GNU -# undef assert_perror -# endif - -#endif /* assert.h */ - -#define _ASSERT_H 1 -#include - -#if defined __cplusplus && __GNUC_PREREQ (2,95) -# define __ASSERT_VOID_CAST static_cast -#else -# define __ASSERT_VOID_CAST (void) -#endif - -/* void assert (int expression); - - If NDEBUG is defined, do nothing. - If not, and EXPRESSION is zero, print an error message and abort. */ - -#ifdef NDEBUG - -# define assert(expr) (__ASSERT_VOID_CAST (0)) - -/* void assert_perror (int errnum); - - If NDEBUG is defined, do nothing. If not, and ERRNUM is not zero, print an - error message with the error text for ERRNUM and abort. - (This is a GNU extension.) */ - -# ifdef __USE_GNU -# define assert_perror(errnum) (__ASSERT_VOID_CAST (0)) -# endif - -#else /* Not NDEBUG. */ - -#ifndef _ASSERT_H_DECLS -#define _ASSERT_H_DECLS -__BEGIN_DECLS - -/* This prints an "Assertion failed" message and aborts. */ -extern void __assert_fail (const char *__assertion, const char *__file, - unsigned int __line, const char *__function) - __THROW __attribute__ ((__noreturn__)); - -/* Likewise, but prints the error text for ERRNUM. */ -extern void __assert_perror_fail (int __errnum, const char *__file, - unsigned int __line, const char *__function) - __THROW __attribute__ ((__noreturn__)); - - -/* The following is not at all used here but needed for standard - compliance. */ -extern void __assert (const char *__assertion, const char *__file, int __line) - __THROW __attribute__ ((__noreturn__)); - - -__END_DECLS -#endif /* Not _ASSERT_H_DECLS */ - -# define assert(expr) \ - ((expr) \ - ? __ASSERT_VOID_CAST (0) \ - : __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION)) - -# ifdef __USE_GNU -# define assert_perror(errnum) \ - (!(errnum) \ - ? __ASSERT_VOID_CAST (0) \ - : __assert_perror_fail ((errnum), __FILE__, __LINE__, __ASSERT_FUNCTION)) -# endif - -/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__' - which contains the name of the function currently being defined. - This is broken in G++ before version 2.6. - C9x has a similar variable called __func__, but prefer the GCC one since - it demangles C++ function names. */ -# if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4) -# define __ASSERT_FUNCTION __PRETTY_FUNCTION__ -# else -# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L -# define __ASSERT_FUNCTION __func__ -# else -# define __ASSERT_FUNCTION ((const char *) 0) -# endif -# endif - -#endif /* NDEBUG. */ - - -#if defined __USE_ISOC11 && !defined __cplusplus -# undef static_assert -# define static_assert _Static_assert -#endif diff --git a/openflow/usr/include/autosprintf.h b/openflow/usr/include/autosprintf.h deleted file mode 100644 index 22e7443..0000000 --- a/openflow/usr/include/autosprintf.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Class autosprintf - formatted output to an ostream. - Copyright (C) 2002, 2012-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - -#ifndef _AUTOSPRINTF_H -#define _AUTOSPRINTF_H - -/* This feature is available in gcc versions 2.5 and later. */ -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ -# define _AUTOSPRINTF_ATTRIBUTE_FORMAT() /* empty */ -#else -/* The __-protected variants of 'format' and 'printf' attributes - are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define _AUTOSPRINTF_ATTRIBUTE_FORMAT() \ - __attribute__ ((__format__ (__printf__, 2, 3))) -# else -# define _AUTOSPRINTF_ATTRIBUTE_FORMAT() \ - __attribute__ ((format (printf, 2, 3))) -# endif -#endif - -#include -#include - -namespace gnu -{ - /* A temporary object, usually allocated on the stack, representing - the result of an asprintf() call. */ - class autosprintf - { - public: - /* Constructor: takes a format string and the printf arguments. */ - autosprintf (const char *format, ...) - _AUTOSPRINTF_ATTRIBUTE_FORMAT(); - /* Copy constructor. */ - autosprintf (const autosprintf& src); - autosprintf& operator = (autosprintf copy); - /* Destructor: frees the temporarily allocated string. */ - ~autosprintf (); - /* Conversion to string. */ - operator char * () const; - operator std::string () const; - /* Output to an ostream. */ - friend inline std::ostream& operator<< (std::ostream& stream, const autosprintf& tmp) - { - stream << (tmp.str ? tmp.str : "(error in autosprintf)"); - return stream; - } - private: - char *str; - }; -} - -#endif /* _AUTOSPRINTF_H */ diff --git a/openflow/usr/include/byteswap.h b/openflow/usr/include/byteswap.h deleted file mode 100644 index d98618c..0000000 --- a/openflow/usr/include/byteswap.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BYTESWAP_H -#define _BYTESWAP_H 1 - -#include - -/* Get the machine specific, optimized definitions. */ -#include - - -/* The following definitions must all be macros since otherwise some - of the possible optimizations are not possible. */ - -/* Return a value with all bytes in the 16 bit argument swapped. */ -#define bswap_16(x) __bswap_16 (x) - -/* Return a value with all bytes in the 32 bit argument swapped. */ -#define bswap_32(x) __bswap_32 (x) - -/* Return a value with all bytes in the 64 bit argument swapped. */ -#define bswap_64(x) __bswap_64 (x) - -#endif /* byteswap.h */ diff --git a/openflow/usr/include/c++/5.3.1 b/openflow/usr/include/c++/5.3.1 deleted file mode 120000 index 7813681..0000000 --- a/openflow/usr/include/c++/5.3.1 +++ /dev/null @@ -1 +0,0 @@ -5 \ No newline at end of file diff --git a/openflow/usr/include/c++/5/algorithm b/openflow/usr/include/c++/5/algorithm deleted file mode 100644 index 699666c..0000000 --- a/openflow/usr/include/c++/5/algorithm +++ /dev/null @@ -1,68 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/algorithm - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_ALGORITHM -#define _GLIBCXX_ALGORITHM 1 - -#pragma GCC system_header - -#include // UK-300. -#include -#include - -#ifdef _GLIBCXX_PARALLEL -# include -#endif - -#endif /* _GLIBCXX_ALGORITHM */ diff --git a/openflow/usr/include/c++/5/array b/openflow/usr/include/c++/5/array deleted file mode 100644 index 24be44f..0000000 --- a/openflow/usr/include/c++/5/array +++ /dev/null @@ -1,347 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/array - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_ARRAY -#define _GLIBCXX_ARRAY 1 - -#pragma GCC system_header - -#if __cplusplus < 201103L -# include -#else - -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - template - struct __array_traits - { - typedef _Tp _Type[_Nm]; - - static constexpr _Tp& - _S_ref(const _Type& __t, std::size_t __n) noexcept - { return const_cast<_Tp&>(__t[__n]); } - - static constexpr _Tp* - _S_ptr(const _Type& __t) noexcept - { return const_cast<_Tp*>(__t); } - }; - - template - struct __array_traits<_Tp, 0> - { - struct _Type { }; - - static constexpr _Tp& - _S_ref(const _Type&, std::size_t) noexcept - { return *static_cast<_Tp*>(nullptr); } - - static constexpr _Tp* - _S_ptr(const _Type&) noexcept - { return nullptr; } - }; - - /** - * @brief A standard container for storing a fixed size sequence of elements. - * - * @ingroup sequences - * - * Meets the requirements of a container, a - * reversible container, and a - * sequence. - * - * Sets support random access iterators. - * - * @tparam Tp Type of element. Required to be a complete type. - * @tparam N Number of elements. - */ - template - struct array - { - typedef _Tp value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef value_type* iterator; - typedef const value_type* const_iterator; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - // Support for zero-sized arrays mandatory. - typedef _GLIBCXX_STD_C::__array_traits<_Tp, _Nm> _AT_Type; - typename _AT_Type::_Type _M_elems; - - // No explicit construct/copy/destroy for aggregate type. - - // DR 776. - void - fill(const value_type& __u) - { std::fill_n(begin(), size(), __u); } - - void - swap(array& __other) - noexcept(noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))) - { std::swap_ranges(begin(), end(), __other.begin()); } - - // Iterators. - iterator - begin() noexcept - { return iterator(data()); } - - const_iterator - begin() const noexcept - { return const_iterator(data()); } - - iterator - end() noexcept - { return iterator(data() + _Nm); } - - const_iterator - end() const noexcept - { return const_iterator(data() + _Nm); } - - reverse_iterator - rbegin() noexcept - { return reverse_iterator(end()); } - - const_reverse_iterator - rbegin() const noexcept - { return const_reverse_iterator(end()); } - - reverse_iterator - rend() noexcept - { return reverse_iterator(begin()); } - - const_reverse_iterator - rend() const noexcept - { return const_reverse_iterator(begin()); } - - const_iterator - cbegin() const noexcept - { return const_iterator(data()); } - - const_iterator - cend() const noexcept - { return const_iterator(data() + _Nm); } - - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(end()); } - - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(begin()); } - - // Capacity. - constexpr size_type - size() const noexcept { return _Nm; } - - constexpr size_type - max_size() const noexcept { return _Nm; } - - constexpr bool - empty() const noexcept { return size() == 0; } - - // Element access. - reference - operator[](size_type __n) noexcept - { return _AT_Type::_S_ref(_M_elems, __n); } - - constexpr const_reference - operator[](size_type __n) const noexcept - { return _AT_Type::_S_ref(_M_elems, __n); } - - reference - at(size_type __n) - { - if (__n >= _Nm) - std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) " - ">= _Nm (which is %zu)"), - __n, _Nm); - return _AT_Type::_S_ref(_M_elems, __n); - } - - constexpr const_reference - at(size_type __n) const - { - // Result of conditional expression must be an lvalue so use - // boolean ? lvalue : (throw-expr, lvalue) - return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n) - : (std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) " - ">= _Nm (which is %zu)"), - __n, _Nm), - _AT_Type::_S_ref(_M_elems, 0)); - } - - reference - front() noexcept - { return *begin(); } - - constexpr const_reference - front() const noexcept - { return _AT_Type::_S_ref(_M_elems, 0); } - - reference - back() noexcept - { return _Nm ? *(end() - 1) : *end(); } - - constexpr const_reference - back() const noexcept - { - return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1) - : _AT_Type::_S_ref(_M_elems, 0); - } - - pointer - data() noexcept - { return _AT_Type::_S_ptr(_M_elems); } - - const_pointer - data() const noexcept - { return _AT_Type::_S_ptr(_M_elems); } - }; - - // Array comparisons. - template - inline bool - operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) - { return std::equal(__one.begin(), __one.end(), __two.begin()); } - - template - inline bool - operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) - { return !(__one == __two); } - - template - inline bool - operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b) - { - return std::lexicographical_compare(__a.begin(), __a.end(), - __b.begin(), __b.end()); - } - - template - inline bool - operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) - { return __two < __one; } - - template - inline bool - operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) - { return !(__one > __two); } - - template - inline bool - operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) - { return !(__one < __two); } - - // Specialized algorithms. - template - inline void - swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two) - noexcept(noexcept(__one.swap(__two))) - { __one.swap(__two); } - - template - constexpr _Tp& - get(array<_Tp, _Nm>& __arr) noexcept - { - static_assert(_Int < _Nm, "index is out of bounds"); - return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: - _S_ref(__arr._M_elems, _Int); - } - - template - constexpr _Tp&& - get(array<_Tp, _Nm>&& __arr) noexcept - { - static_assert(_Int < _Nm, "index is out of bounds"); - return std::move(_GLIBCXX_STD_C::get<_Int>(__arr)); - } - - template - constexpr const _Tp& - get(const array<_Tp, _Nm>& __arr) noexcept - { - static_assert(_Int < _Nm, "index is out of bounds"); - return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: - _S_ref(__arr._M_elems, _Int); - } - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Tuple interface to class template array. - - /// tuple_size - template - class tuple_size; - - /// Partial specialization for std::array - template - struct tuple_size<_GLIBCXX_STD_C::array<_Tp, _Nm>> - : public integral_constant { }; - - /// tuple_element - template - class tuple_element; - - /// Partial specialization for std::array - template - struct tuple_element<_Int, _GLIBCXX_STD_C::array<_Tp, _Nm>> - { - static_assert(_Int < _Nm, "index is out of bounds"); - typedef _Tp type; - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#ifdef _GLIBCXX_DEBUG -# include -#endif - -#ifdef _GLIBCXX_PROFILE -# include -#endif - -#endif // C++11 - -#endif // _GLIBCXX_ARRAY diff --git a/openflow/usr/include/c++/5/atomic b/openflow/usr/include/c++/5/atomic deleted file mode 100644 index cdd1f0b..0000000 --- a/openflow/usr/include/c++/5/atomic +++ /dev/null @@ -1,1252 +0,0 @@ -// -*- C++ -*- header. - -// Copyright (C) 2008-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/atomic - * This is a Standard C++ Library header. - */ - -// Based on "C++ Atomic Types and Operations" by Hans Boehm and Lawrence Crowl. -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html - -#ifndef _GLIBCXX_ATOMIC -#define _GLIBCXX_ATOMIC 1 - -#pragma GCC system_header - -#if __cplusplus < 201103L -# include -#else - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup atomics - * @{ - */ - - template - struct atomic; - - /// atomic - // NB: No operators or fetch-operations for this type. - template<> - struct atomic - { - private: - __atomic_base _M_base; - - public: - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(bool __i) noexcept : _M_base(__i) { } - - bool - operator=(bool __i) noexcept - { return _M_base.operator=(__i); } - - bool - operator=(bool __i) volatile noexcept - { return _M_base.operator=(__i); } - - operator bool() const noexcept - { return _M_base.load(); } - - operator bool() const volatile noexcept - { return _M_base.load(); } - - bool - is_lock_free() const noexcept { return _M_base.is_lock_free(); } - - bool - is_lock_free() const volatile noexcept { return _M_base.is_lock_free(); } - - void - store(bool __i, memory_order __m = memory_order_seq_cst) noexcept - { _M_base.store(__i, __m); } - - void - store(bool __i, memory_order __m = memory_order_seq_cst) volatile noexcept - { _M_base.store(__i, __m); } - - bool - load(memory_order __m = memory_order_seq_cst) const noexcept - { return _M_base.load(__m); } - - bool - load(memory_order __m = memory_order_seq_cst) const volatile noexcept - { return _M_base.load(__m); } - - bool - exchange(bool __i, memory_order __m = memory_order_seq_cst) noexcept - { return _M_base.exchange(__i, __m); } - - bool - exchange(bool __i, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return _M_base.exchange(__i, __m); } - - bool - compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1, - memory_order __m2) noexcept - { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); } - - bool - compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1, - memory_order __m2) volatile noexcept - { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); } - - bool - compare_exchange_weak(bool& __i1, bool __i2, - memory_order __m = memory_order_seq_cst) noexcept - { return _M_base.compare_exchange_weak(__i1, __i2, __m); } - - bool - compare_exchange_weak(bool& __i1, bool __i2, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return _M_base.compare_exchange_weak(__i1, __i2, __m); } - - bool - compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1, - memory_order __m2) noexcept - { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); } - - bool - compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1, - memory_order __m2) volatile noexcept - { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); } - - bool - compare_exchange_strong(bool& __i1, bool __i2, - memory_order __m = memory_order_seq_cst) noexcept - { return _M_base.compare_exchange_strong(__i1, __i2, __m); } - - bool - compare_exchange_strong(bool& __i1, bool __i2, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return _M_base.compare_exchange_strong(__i1, __i2, __m); } - }; - - - /** - * @brief Generic atomic type, primary class template. - * - * @tparam _Tp Type to be made atomic, must be trivally copyable. - */ - template - struct atomic - { - private: - // Align 1/2/4/8/16-byte types to at least their size. - static constexpr int _S_min_alignment - = (sizeof(_Tp) & (sizeof(_Tp) - 1)) || sizeof(_Tp) > 16 - ? 0 : sizeof(_Tp); - - static constexpr int _S_alignment - = _S_min_alignment > alignof(_Tp) ? _S_min_alignment : alignof(_Tp); - - alignas(_S_alignment) _Tp _M_i; - - static_assert(__is_trivially_copyable(_Tp), - "std::atomic requires a trivially copyable type"); - - static_assert(sizeof(_Tp) > 0, - "Incomplete or zero-sized types are not supported"); - - public: - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(_Tp __i) noexcept : _M_i(__i) { } - - operator _Tp() const noexcept - { return load(); } - - operator _Tp() const volatile noexcept - { return load(); } - - _Tp - operator=(_Tp __i) noexcept - { store(__i); return __i; } - - _Tp - operator=(_Tp __i) volatile noexcept - { store(__i); return __i; } - - bool - is_lock_free() const noexcept - { - // Produce a fake, minimally aligned pointer. - return __atomic_is_lock_free(sizeof(_M_i), - reinterpret_cast(-__alignof(_M_i))); - } - - bool - is_lock_free() const volatile noexcept - { - // Produce a fake, minimally aligned pointer. - return __atomic_is_lock_free(sizeof(_M_i), - reinterpret_cast(-__alignof(_M_i))); - } - - void - store(_Tp __i, memory_order __m = memory_order_seq_cst) noexcept - { __atomic_store(&_M_i, &__i, __m); } - - void - store(_Tp __i, memory_order __m = memory_order_seq_cst) volatile noexcept - { __atomic_store(&_M_i, &__i, __m); } - - _Tp - load(memory_order __m = memory_order_seq_cst) const noexcept - { - _Tp tmp; - __atomic_load(&_M_i, &tmp, __m); - return tmp; - } - - _Tp - load(memory_order __m = memory_order_seq_cst) const volatile noexcept - { - _Tp tmp; - __atomic_load(&_M_i, &tmp, __m); - return tmp; - } - - _Tp - exchange(_Tp __i, memory_order __m = memory_order_seq_cst) noexcept - { - _Tp tmp; - __atomic_exchange(&_M_i, &__i, &tmp, __m); - return tmp; - } - - _Tp - exchange(_Tp __i, - memory_order __m = memory_order_seq_cst) volatile noexcept - { - _Tp tmp; - __atomic_exchange(&_M_i, &__i, &tmp, __m); - return tmp; - } - - bool - compare_exchange_weak(_Tp& __e, _Tp __i, memory_order __s, - memory_order __f) noexcept - { - return __atomic_compare_exchange(&_M_i, &__e, &__i, true, __s, __f); - } - - bool - compare_exchange_weak(_Tp& __e, _Tp __i, memory_order __s, - memory_order __f) volatile noexcept - { - return __atomic_compare_exchange(&_M_i, &__e, &__i, true, __s, __f); - } - - bool - compare_exchange_weak(_Tp& __e, _Tp __i, - memory_order __m = memory_order_seq_cst) noexcept - { return compare_exchange_weak(__e, __i, __m, - __cmpexch_failure_order(__m)); } - - bool - compare_exchange_weak(_Tp& __e, _Tp __i, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return compare_exchange_weak(__e, __i, __m, - __cmpexch_failure_order(__m)); } - - bool - compare_exchange_strong(_Tp& __e, _Tp __i, memory_order __s, - memory_order __f) noexcept - { - return __atomic_compare_exchange(&_M_i, &__e, &__i, false, __s, __f); - } - - bool - compare_exchange_strong(_Tp& __e, _Tp __i, memory_order __s, - memory_order __f) volatile noexcept - { - return __atomic_compare_exchange(&_M_i, &__e, &__i, false, __s, __f); - } - - bool - compare_exchange_strong(_Tp& __e, _Tp __i, - memory_order __m = memory_order_seq_cst) noexcept - { return compare_exchange_strong(__e, __i, __m, - __cmpexch_failure_order(__m)); } - - bool - compare_exchange_strong(_Tp& __e, _Tp __i, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return compare_exchange_strong(__e, __i, __m, - __cmpexch_failure_order(__m)); } - }; - - - /// Partial specialization for pointer types. - template - struct atomic<_Tp*> - { - typedef _Tp* __pointer_type; - typedef __atomic_base<_Tp*> __base_type; - __base_type _M_b; - - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__pointer_type __p) noexcept : _M_b(__p) { } - - operator __pointer_type() const noexcept - { return __pointer_type(_M_b); } - - operator __pointer_type() const volatile noexcept - { return __pointer_type(_M_b); } - - __pointer_type - operator=(__pointer_type __p) noexcept - { return _M_b.operator=(__p); } - - __pointer_type - operator=(__pointer_type __p) volatile noexcept - { return _M_b.operator=(__p); } - - __pointer_type - operator++(int) noexcept - { return _M_b++; } - - __pointer_type - operator++(int) volatile noexcept - { return _M_b++; } - - __pointer_type - operator--(int) noexcept - { return _M_b--; } - - __pointer_type - operator--(int) volatile noexcept - { return _M_b--; } - - __pointer_type - operator++() noexcept - { return ++_M_b; } - - __pointer_type - operator++() volatile noexcept - { return ++_M_b; } - - __pointer_type - operator--() noexcept - { return --_M_b; } - - __pointer_type - operator--() volatile noexcept - { return --_M_b; } - - __pointer_type - operator+=(ptrdiff_t __d) noexcept - { return _M_b.operator+=(__d); } - - __pointer_type - operator+=(ptrdiff_t __d) volatile noexcept - { return _M_b.operator+=(__d); } - - __pointer_type - operator-=(ptrdiff_t __d) noexcept - { return _M_b.operator-=(__d); } - - __pointer_type - operator-=(ptrdiff_t __d) volatile noexcept - { return _M_b.operator-=(__d); } - - bool - is_lock_free() const noexcept - { return _M_b.is_lock_free(); } - - bool - is_lock_free() const volatile noexcept - { return _M_b.is_lock_free(); } - - void - store(__pointer_type __p, - memory_order __m = memory_order_seq_cst) noexcept - { return _M_b.store(__p, __m); } - - void - store(__pointer_type __p, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return _M_b.store(__p, __m); } - - __pointer_type - load(memory_order __m = memory_order_seq_cst) const noexcept - { return _M_b.load(__m); } - - __pointer_type - load(memory_order __m = memory_order_seq_cst) const volatile noexcept - { return _M_b.load(__m); } - - __pointer_type - exchange(__pointer_type __p, - memory_order __m = memory_order_seq_cst) noexcept - { return _M_b.exchange(__p, __m); } - - __pointer_type - exchange(__pointer_type __p, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return _M_b.exchange(__p, __m); } - - bool - compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2, - memory_order __m1, memory_order __m2) noexcept - { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); } - - bool - compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2, - memory_order __m1, - memory_order __m2) volatile noexcept - { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); } - - bool - compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2, - memory_order __m = memory_order_seq_cst) noexcept - { - return compare_exchange_weak(__p1, __p2, __m, - __cmpexch_failure_order(__m)); - } - - bool - compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2, - memory_order __m = memory_order_seq_cst) volatile noexcept - { - return compare_exchange_weak(__p1, __p2, __m, - __cmpexch_failure_order(__m)); - } - - bool - compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, - memory_order __m1, memory_order __m2) noexcept - { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); } - - bool - compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, - memory_order __m1, - memory_order __m2) volatile noexcept - { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); } - - bool - compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, - memory_order __m = memory_order_seq_cst) noexcept - { - return _M_b.compare_exchange_strong(__p1, __p2, __m, - __cmpexch_failure_order(__m)); - } - - bool - compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, - memory_order __m = memory_order_seq_cst) volatile noexcept - { - return _M_b.compare_exchange_strong(__p1, __p2, __m, - __cmpexch_failure_order(__m)); - } - - __pointer_type - fetch_add(ptrdiff_t __d, - memory_order __m = memory_order_seq_cst) noexcept - { return _M_b.fetch_add(__d, __m); } - - __pointer_type - fetch_add(ptrdiff_t __d, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return _M_b.fetch_add(__d, __m); } - - __pointer_type - fetch_sub(ptrdiff_t __d, - memory_order __m = memory_order_seq_cst) noexcept - { return _M_b.fetch_sub(__d, __m); } - - __pointer_type - fetch_sub(ptrdiff_t __d, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return _M_b.fetch_sub(__d, __m); } - }; - - - /// Explicit specialization for char. - template<> - struct atomic : __atomic_base - { - typedef char __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - /// Explicit specialization for signed char. - template<> - struct atomic : __atomic_base - { - typedef signed char __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept= default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - /// Explicit specialization for unsigned char. - template<> - struct atomic : __atomic_base - { - typedef unsigned char __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept= default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - /// Explicit specialization for short. - template<> - struct atomic : __atomic_base - { - typedef short __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - /// Explicit specialization for unsigned short. - template<> - struct atomic : __atomic_base - { - typedef unsigned short __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - /// Explicit specialization for int. - template<> - struct atomic : __atomic_base - { - typedef int __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - /// Explicit specialization for unsigned int. - template<> - struct atomic : __atomic_base - { - typedef unsigned int __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - /// Explicit specialization for long. - template<> - struct atomic : __atomic_base - { - typedef long __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - /// Explicit specialization for unsigned long. - template<> - struct atomic : __atomic_base - { - typedef unsigned long __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - /// Explicit specialization for long long. - template<> - struct atomic : __atomic_base - { - typedef long long __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - /// Explicit specialization for unsigned long long. - template<> - struct atomic : __atomic_base - { - typedef unsigned long long __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - /// Explicit specialization for wchar_t. - template<> - struct atomic : __atomic_base - { - typedef wchar_t __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - /// Explicit specialization for char16_t. - template<> - struct atomic : __atomic_base - { - typedef char16_t __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - /// Explicit specialization for char32_t. - template<> - struct atomic : __atomic_base - { - typedef char32_t __integral_type; - typedef __atomic_base __base_type; - - atomic() noexcept = default; - ~atomic() noexcept = default; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } - - using __base_type::operator __integral_type; - using __base_type::operator=; - }; - - - /// atomic_bool - typedef atomic atomic_bool; - - /// atomic_char - typedef atomic atomic_char; - - /// atomic_schar - typedef atomic atomic_schar; - - /// atomic_uchar - typedef atomic atomic_uchar; - - /// atomic_short - typedef atomic atomic_short; - - /// atomic_ushort - typedef atomic atomic_ushort; - - /// atomic_int - typedef atomic atomic_int; - - /// atomic_uint - typedef atomic atomic_uint; - - /// atomic_long - typedef atomic atomic_long; - - /// atomic_ulong - typedef atomic atomic_ulong; - - /// atomic_llong - typedef atomic atomic_llong; - - /// atomic_ullong - typedef atomic atomic_ullong; - - /// atomic_wchar_t - typedef atomic atomic_wchar_t; - - /// atomic_char16_t - typedef atomic atomic_char16_t; - - /// atomic_char32_t - typedef atomic atomic_char32_t; - - - /// atomic_int_least8_t - typedef atomic atomic_int_least8_t; - - /// atomic_uint_least8_t - typedef atomic atomic_uint_least8_t; - - /// atomic_int_least16_t - typedef atomic atomic_int_least16_t; - - /// atomic_uint_least16_t - typedef atomic atomic_uint_least16_t; - - /// atomic_int_least32_t - typedef atomic atomic_int_least32_t; - - /// atomic_uint_least32_t - typedef atomic atomic_uint_least32_t; - - /// atomic_int_least64_t - typedef atomic atomic_int_least64_t; - - /// atomic_uint_least64_t - typedef atomic atomic_uint_least64_t; - - - /// atomic_int_fast8_t - typedef atomic atomic_int_fast8_t; - - /// atomic_uint_fast8_t - typedef atomic atomic_uint_fast8_t; - - /// atomic_int_fast16_t - typedef atomic atomic_int_fast16_t; - - /// atomic_uint_fast16_t - typedef atomic atomic_uint_fast16_t; - - /// atomic_int_fast32_t - typedef atomic atomic_int_fast32_t; - - /// atomic_uint_fast32_t - typedef atomic atomic_uint_fast32_t; - - /// atomic_int_fast64_t - typedef atomic atomic_int_fast64_t; - - /// atomic_uint_fast64_t - typedef atomic atomic_uint_fast64_t; - - - /// atomic_intptr_t - typedef atomic atomic_intptr_t; - - /// atomic_uintptr_t - typedef atomic atomic_uintptr_t; - - /// atomic_size_t - typedef atomic atomic_size_t; - - /// atomic_intmax_t - typedef atomic atomic_intmax_t; - - /// atomic_uintmax_t - typedef atomic atomic_uintmax_t; - - /// atomic_ptrdiff_t - typedef atomic atomic_ptrdiff_t; - - - // Function definitions, atomic_flag operations. - inline bool - atomic_flag_test_and_set_explicit(atomic_flag* __a, - memory_order __m) noexcept - { return __a->test_and_set(__m); } - - inline bool - atomic_flag_test_and_set_explicit(volatile atomic_flag* __a, - memory_order __m) noexcept - { return __a->test_and_set(__m); } - - inline void - atomic_flag_clear_explicit(atomic_flag* __a, memory_order __m) noexcept - { __a->clear(__m); } - - inline void - atomic_flag_clear_explicit(volatile atomic_flag* __a, - memory_order __m) noexcept - { __a->clear(__m); } - - inline bool - atomic_flag_test_and_set(atomic_flag* __a) noexcept - { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); } - - inline bool - atomic_flag_test_and_set(volatile atomic_flag* __a) noexcept - { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); } - - inline void - atomic_flag_clear(atomic_flag* __a) noexcept - { atomic_flag_clear_explicit(__a, memory_order_seq_cst); } - - inline void - atomic_flag_clear(volatile atomic_flag* __a) noexcept - { atomic_flag_clear_explicit(__a, memory_order_seq_cst); } - - - // Function templates generally applicable to atomic types. - template - inline bool - atomic_is_lock_free(const atomic<_ITp>* __a) noexcept - { return __a->is_lock_free(); } - - template - inline bool - atomic_is_lock_free(const volatile atomic<_ITp>* __a) noexcept - { return __a->is_lock_free(); } - - template - inline void - atomic_init(atomic<_ITp>* __a, _ITp __i) noexcept - { __a->store(__i, memory_order_relaxed); } - - template - inline void - atomic_init(volatile atomic<_ITp>* __a, _ITp __i) noexcept - { __a->store(__i, memory_order_relaxed); } - - template - inline void - atomic_store_explicit(atomic<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { __a->store(__i, __m); } - - template - inline void - atomic_store_explicit(volatile atomic<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { __a->store(__i, __m); } - - template - inline _ITp - atomic_load_explicit(const atomic<_ITp>* __a, memory_order __m) noexcept - { return __a->load(__m); } - - template - inline _ITp - atomic_load_explicit(const volatile atomic<_ITp>* __a, - memory_order __m) noexcept - { return __a->load(__m); } - - template - inline _ITp - atomic_exchange_explicit(atomic<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { return __a->exchange(__i, __m); } - - template - inline _ITp - atomic_exchange_explicit(volatile atomic<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { return __a->exchange(__i, __m); } - - template - inline bool - atomic_compare_exchange_weak_explicit(atomic<_ITp>* __a, - _ITp* __i1, _ITp __i2, - memory_order __m1, - memory_order __m2) noexcept - { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); } - - template - inline bool - atomic_compare_exchange_weak_explicit(volatile atomic<_ITp>* __a, - _ITp* __i1, _ITp __i2, - memory_order __m1, - memory_order __m2) noexcept - { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); } - - template - inline bool - atomic_compare_exchange_strong_explicit(atomic<_ITp>* __a, - _ITp* __i1, _ITp __i2, - memory_order __m1, - memory_order __m2) noexcept - { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); } - - template - inline bool - atomic_compare_exchange_strong_explicit(volatile atomic<_ITp>* __a, - _ITp* __i1, _ITp __i2, - memory_order __m1, - memory_order __m2) noexcept - { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); } - - - template - inline void - atomic_store(atomic<_ITp>* __a, _ITp __i) noexcept - { atomic_store_explicit(__a, __i, memory_order_seq_cst); } - - template - inline void - atomic_store(volatile atomic<_ITp>* __a, _ITp __i) noexcept - { atomic_store_explicit(__a, __i, memory_order_seq_cst); } - - template - inline _ITp - atomic_load(const atomic<_ITp>* __a) noexcept - { return atomic_load_explicit(__a, memory_order_seq_cst); } - - template - inline _ITp - atomic_load(const volatile atomic<_ITp>* __a) noexcept - { return atomic_load_explicit(__a, memory_order_seq_cst); } - - template - inline _ITp - atomic_exchange(atomic<_ITp>* __a, _ITp __i) noexcept - { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); } - - template - inline _ITp - atomic_exchange(volatile atomic<_ITp>* __a, _ITp __i) noexcept - { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); } - - template - inline bool - atomic_compare_exchange_weak(atomic<_ITp>* __a, - _ITp* __i1, _ITp __i2) noexcept - { - return atomic_compare_exchange_weak_explicit(__a, __i1, __i2, - memory_order_seq_cst, - memory_order_seq_cst); - } - - template - inline bool - atomic_compare_exchange_weak(volatile atomic<_ITp>* __a, - _ITp* __i1, _ITp __i2) noexcept - { - return atomic_compare_exchange_weak_explicit(__a, __i1, __i2, - memory_order_seq_cst, - memory_order_seq_cst); - } - - template - inline bool - atomic_compare_exchange_strong(atomic<_ITp>* __a, - _ITp* __i1, _ITp __i2) noexcept - { - return atomic_compare_exchange_strong_explicit(__a, __i1, __i2, - memory_order_seq_cst, - memory_order_seq_cst); - } - - template - inline bool - atomic_compare_exchange_strong(volatile atomic<_ITp>* __a, - _ITp* __i1, _ITp __i2) noexcept - { - return atomic_compare_exchange_strong_explicit(__a, __i1, __i2, - memory_order_seq_cst, - memory_order_seq_cst); - } - - // Function templates for atomic_integral operations only, using - // __atomic_base. Template argument should be constricted to - // intergral types as specified in the standard, excluding address - // types. - template - inline _ITp - atomic_fetch_add_explicit(__atomic_base<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { return __a->fetch_add(__i, __m); } - - template - inline _ITp - atomic_fetch_add_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { return __a->fetch_add(__i, __m); } - - template - inline _ITp - atomic_fetch_sub_explicit(__atomic_base<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { return __a->fetch_sub(__i, __m); } - - template - inline _ITp - atomic_fetch_sub_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { return __a->fetch_sub(__i, __m); } - - template - inline _ITp - atomic_fetch_and_explicit(__atomic_base<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { return __a->fetch_and(__i, __m); } - - template - inline _ITp - atomic_fetch_and_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { return __a->fetch_and(__i, __m); } - - template - inline _ITp - atomic_fetch_or_explicit(__atomic_base<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { return __a->fetch_or(__i, __m); } - - template - inline _ITp - atomic_fetch_or_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { return __a->fetch_or(__i, __m); } - - template - inline _ITp - atomic_fetch_xor_explicit(__atomic_base<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { return __a->fetch_xor(__i, __m); } - - template - inline _ITp - atomic_fetch_xor_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, - memory_order __m) noexcept - { return __a->fetch_xor(__i, __m); } - - template - inline _ITp - atomic_fetch_add(__atomic_base<_ITp>* __a, _ITp __i) noexcept - { return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); } - - template - inline _ITp - atomic_fetch_add(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept - { return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); } - - template - inline _ITp - atomic_fetch_sub(__atomic_base<_ITp>* __a, _ITp __i) noexcept - { return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); } - - template - inline _ITp - atomic_fetch_sub(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept - { return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); } - - template - inline _ITp - atomic_fetch_and(__atomic_base<_ITp>* __a, _ITp __i) noexcept - { return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); } - - template - inline _ITp - atomic_fetch_and(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept - { return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); } - - template - inline _ITp - atomic_fetch_or(__atomic_base<_ITp>* __a, _ITp __i) noexcept - { return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); } - - template - inline _ITp - atomic_fetch_or(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept - { return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); } - - template - inline _ITp - atomic_fetch_xor(__atomic_base<_ITp>* __a, _ITp __i) noexcept - { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); } - - template - inline _ITp - atomic_fetch_xor(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept - { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); } - - - // Partial specializations for pointers. - template - inline _ITp* - atomic_fetch_add_explicit(atomic<_ITp*>* __a, ptrdiff_t __d, - memory_order __m) noexcept - { return __a->fetch_add(__d, __m); } - - template - inline _ITp* - atomic_fetch_add_explicit(volatile atomic<_ITp*>* __a, ptrdiff_t __d, - memory_order __m) noexcept - { return __a->fetch_add(__d, __m); } - - template - inline _ITp* - atomic_fetch_add(volatile atomic<_ITp*>* __a, ptrdiff_t __d) noexcept - { return __a->fetch_add(__d); } - - template - inline _ITp* - atomic_fetch_add(atomic<_ITp*>* __a, ptrdiff_t __d) noexcept - { return __a->fetch_add(__d); } - - template - inline _ITp* - atomic_fetch_sub_explicit(volatile atomic<_ITp*>* __a, - ptrdiff_t __d, memory_order __m) noexcept - { return __a->fetch_sub(__d, __m); } - - template - inline _ITp* - atomic_fetch_sub_explicit(atomic<_ITp*>* __a, ptrdiff_t __d, - memory_order __m) noexcept - { return __a->fetch_sub(__d, __m); } - - template - inline _ITp* - atomic_fetch_sub(volatile atomic<_ITp*>* __a, ptrdiff_t __d) noexcept - { return __a->fetch_sub(__d); } - - template - inline _ITp* - atomic_fetch_sub(atomic<_ITp*>* __a, ptrdiff_t __d) noexcept - { return __a->fetch_sub(__d); } - // @} group atomics - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif // C++11 - -#endif // _GLIBCXX_ATOMIC diff --git a/openflow/usr/include/c++/5/backward/auto_ptr.h b/openflow/usr/include/c++/5/backward/auto_ptr.h deleted file mode 100644 index a6aa2eb..0000000 --- a/openflow/usr/include/c++/5/backward/auto_ptr.h +++ /dev/null @@ -1,329 +0,0 @@ -// auto_ptr implementation -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file backward/auto_ptr.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _BACKWARD_AUTO_PTR_H -#define _BACKWARD_AUTO_PTR_H 1 - -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * A wrapper class to provide auto_ptr with reference semantics. - * For example, an auto_ptr can be assigned (or constructed from) - * the result of a function which returns an auto_ptr by value. - * - * All the auto_ptr_ref stuff should happen behind the scenes. - */ - template - struct auto_ptr_ref - { - _Tp1* _M_ptr; - - explicit - auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { } - } _GLIBCXX_DEPRECATED; - - - /** - * @brief A simple smart pointer providing strict ownership semantics. - * - * The Standard says: - *
-   *  An @c auto_ptr owns the object it holds a pointer to.  Copying
-   *  an @c auto_ptr copies the pointer and transfers ownership to the
-   *  destination.  If more than one @c auto_ptr owns the same object
-   *  at the same time the behavior of the program is undefined.
-   *
-   *  The uses of @c auto_ptr include providing temporary
-   *  exception-safety for dynamically allocated memory, passing
-   *  ownership of dynamically allocated memory to a function, and
-   *  returning dynamically allocated memory from a function.  @c
-   *  auto_ptr does not meet the CopyConstructible and Assignable
-   *  requirements for Standard Library container elements and thus
-   *  instantiating a Standard Library container with an @c auto_ptr
-   *  results in undefined behavior.
-   *  
- * Quoted from [20.4.5]/3. - * - * Good examples of what can and cannot be done with auto_ptr can - * be found in the libstdc++ testsuite. - * - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * 127. auto_ptr<> conversion issues - * These resolutions have all been incorporated. - */ - template - class auto_ptr - { - private: - _Tp* _M_ptr; - - public: - /// The pointed-to type. - typedef _Tp element_type; - - /** - * @brief An %auto_ptr is usually constructed from a raw pointer. - * @param __p A pointer (defaults to NULL). - * - * This object now @e owns the object pointed to by @a __p. - */ - explicit - auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { } - - /** - * @brief An %auto_ptr can be constructed from another %auto_ptr. - * @param __a Another %auto_ptr of the same type. - * - * This object now @e owns the object previously owned by @a __a, - * which has given up ownership. - */ - auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { } - - /** - * @brief An %auto_ptr can be constructed from another %auto_ptr. - * @param __a Another %auto_ptr of a different but related type. - * - * A pointer-to-Tp1 must be convertible to a - * pointer-to-Tp/element_type. - * - * This object now @e owns the object previously owned by @a __a, - * which has given up ownership. - */ - template - auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { } - - /** - * @brief %auto_ptr assignment operator. - * @param __a Another %auto_ptr of the same type. - * - * This object now @e owns the object previously owned by @a __a, - * which has given up ownership. The object that this one @e - * used to own and track has been deleted. - */ - auto_ptr& - operator=(auto_ptr& __a) throw() - { - reset(__a.release()); - return *this; - } - - /** - * @brief %auto_ptr assignment operator. - * @param __a Another %auto_ptr of a different but related type. - * - * A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type. - * - * This object now @e owns the object previously owned by @a __a, - * which has given up ownership. The object that this one @e - * used to own and track has been deleted. - */ - template - auto_ptr& - operator=(auto_ptr<_Tp1>& __a) throw() - { - reset(__a.release()); - return *this; - } - - /** - * When the %auto_ptr goes out of scope, the object it owns is - * deleted. If it no longer owns anything (i.e., @c get() is - * @c NULL), then this has no effect. - * - * The C++ standard says there is supposed to be an empty throw - * specification here, but omitting it is standard conforming. Its - * presence can be detected only if _Tp::~_Tp() throws, but this is - * prohibited. [17.4.3.6]/2 - */ - ~auto_ptr() { delete _M_ptr; } - - /** - * @brief Smart pointer dereferencing. - * - * If this %auto_ptr no longer owns anything, then this - * operation will crash. (For a smart pointer, no longer owns - * anything is the same as being a null pointer, and you know - * what happens when you dereference one of those...) - */ - element_type& - operator*() const throw() - { - _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); - return *_M_ptr; - } - - /** - * @brief Smart pointer dereferencing. - * - * This returns the pointer itself, which the language then will - * automatically cause to be dereferenced. - */ - element_type* - operator->() const throw() - { - _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); - return _M_ptr; - } - - /** - * @brief Bypassing the smart pointer. - * @return The raw pointer being managed. - * - * You can get a copy of the pointer that this object owns, for - * situations such as passing to a function which only accepts - * a raw pointer. - * - * @note This %auto_ptr still owns the memory. - */ - element_type* - get() const throw() { return _M_ptr; } - - /** - * @brief Bypassing the smart pointer. - * @return The raw pointer being managed. - * - * You can get a copy of the pointer that this object owns, for - * situations such as passing to a function which only accepts - * a raw pointer. - * - * @note This %auto_ptr no longer owns the memory. When this object - * goes out of scope, nothing will happen. - */ - element_type* - release() throw() - { - element_type* __tmp = _M_ptr; - _M_ptr = 0; - return __tmp; - } - - /** - * @brief Forcibly deletes the managed object. - * @param __p A pointer (defaults to NULL). - * - * This object now @e owns the object pointed to by @a __p. The - * previous object has been deleted. - */ - void - reset(element_type* __p = 0) throw() - { - if (__p != _M_ptr) - { - delete _M_ptr; - _M_ptr = __p; - } - } - - /** - * @brief Automatic conversions - * - * These operations convert an %auto_ptr into and from an auto_ptr_ref - * automatically as needed. This allows constructs such as - * @code - * auto_ptr func_returning_auto_ptr(.....); - * ... - * auto_ptr ptr = func_returning_auto_ptr(.....); - * @endcode - */ - auto_ptr(auto_ptr_ref __ref) throw() - : _M_ptr(__ref._M_ptr) { } - - auto_ptr& - operator=(auto_ptr_ref __ref) throw() - { - if (__ref._M_ptr != this->get()) - { - delete _M_ptr; - _M_ptr = __ref._M_ptr; - } - return *this; - } - - template - operator auto_ptr_ref<_Tp1>() throw() - { return auto_ptr_ref<_Tp1>(this->release()); } - - template - operator auto_ptr<_Tp1>() throw() - { return auto_ptr<_Tp1>(this->release()); } - } _GLIBCXX_DEPRECATED; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 541. shared_ptr template assignment and void - template<> - class auto_ptr - { - public: - typedef void element_type; - } _GLIBCXX_DEPRECATED; - -#if __cplusplus >= 201103L - template<_Lock_policy _Lp> - template - inline - __shared_count<_Lp>::__shared_count(std::auto_ptr<_Tp>&& __r) - : _M_pi(new _Sp_counted_ptr<_Tp*, _Lp>(__r.get())) - { __r.release(); } - - template - template - inline - __shared_ptr<_Tp, _Lp>::__shared_ptr(std::auto_ptr<_Tp1>&& __r) - : _M_ptr(__r.get()), _M_refcount() - { - __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) - static_assert( sizeof(_Tp1) > 0, "incomplete type" ); - _Tp1* __tmp = __r.get(); - _M_refcount = __shared_count<_Lp>(std::move(__r)); - __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp); - } - - template - template - inline - shared_ptr<_Tp>::shared_ptr(std::auto_ptr<_Tp1>&& __r) - : __shared_ptr<_Tp>(std::move(__r)) { } - - template - template - inline - unique_ptr<_Tp, _Dp>::unique_ptr(auto_ptr<_Up>&& __u) noexcept - : _M_t(__u.release(), deleter_type()) { } -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _BACKWARD_AUTO_PTR_H */ diff --git a/openflow/usr/include/c++/5/backward/backward_warning.h b/openflow/usr/include/c++/5/backward/backward_warning.h deleted file mode 100644 index 0b264eb..0000000 --- a/openflow/usr/include/c++/5/backward/backward_warning.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file backward/backward_warning.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iosfwd} - */ - -#ifndef _BACKWARD_BACKWARD_WARNING_H -#define _BACKWARD_BACKWARD_WARNING_H 1 - -#ifdef __DEPRECATED -#warning \ - This file includes at least one deprecated or antiquated header which \ - may be removed without further notice at a future date. Please use a \ - non-deprecated interface with equivalent functionality instead. For a \ - listing of replacement headers and interfaces, consult the file \ - backward_warning.h. To disable this warning use -Wno-deprecated. - -/* - A list of valid replacements is as follows: - - Use: Instead of: - , basic_stringbuf , strstreambuf - , basic_istringstream , istrstream - , basic_ostringstream , ostrstream - , basic_stringstream , strstream - , unordered_set , hash_set - , unordered_multiset , hash_multiset - , unordered_map , hash_map - , unordered_multimap , hash_multimap - , bind , binder1st - , bind , binder2nd - , bind , bind1st - , bind , bind2nd - , unique_ptr , auto_ptr -*/ - -#endif - -#endif diff --git a/openflow/usr/include/c++/5/backward/binders.h b/openflow/usr/include/c++/5/backward/binders.h deleted file mode 100644 index f3e0616..0000000 --- a/openflow/usr/include/c++/5/backward/binders.h +++ /dev/null @@ -1,182 +0,0 @@ -// Functor implementations -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file backward/binders.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{functional} - */ - -#ifndef _BACKWARD_BINDERS_H -#define _BACKWARD_BINDERS_H 1 - -// Suppress deprecated warning for this file. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // 20.3.6 binders - /** @defgroup binders Binder Classes - * @ingroup functors - * - * Binders turn functions/functors with two arguments into functors - * with a single argument, storing an argument to be applied later. - * For example, a variable @c B of type @c binder1st is constructed - * from a functor @c f and an argument @c x. Later, B's @c - * operator() is called with a single argument @c y. The return - * value is the value of @c f(x,y). @c B can be @a called with - * various arguments (y1, y2, ...) and will in turn call @c - * f(x,y1), @c f(x,y2), ... - * - * The function @c bind1st is provided to save some typing. It takes the - * function and an argument as parameters, and returns an instance of - * @c binder1st. - * - * The type @c binder2nd and its creator function @c bind2nd do the same - * thing, but the stored argument is passed as the second parameter instead - * of the first, e.g., @c bind2nd(std::minus(),1.3) will create a - * functor whose @c operator() accepts a floating-point number, subtracts - * 1.3 from it, and returns the result. (If @c bind1st had been used, - * the functor would perform 1.3 - x instead. - * - * Creator-wrapper functions like @c bind1st are intended to be used in - * calling algorithms. Their return values will be temporary objects. - * (The goal is to not require you to type names like - * @c std::binder1st> for declaring a variable to hold the - * return value from @c bind1st(std::plus(),5). - * - * These become more useful when combined with the composition functions. - * - * These functions are deprecated in C++11 and can be replaced by - * @c std::bind (or @c std::tr1::bind) which is more powerful and flexible, - * supporting functions with any number of arguments. Uses of @c bind1st - * can be replaced by @c std::bind(f, x, std::placeholders::_1) and - * @c bind2nd by @c std::bind(f, std::placeholders::_1, x). - * @{ - */ - /// One of the @link binders binder functors@endlink. - template - class binder1st - : public unary_function - { - protected: - _Operation op; - typename _Operation::first_argument_type value; - - public: - binder1st(const _Operation& __x, - const typename _Operation::first_argument_type& __y) - : op(__x), value(__y) { } - - typename _Operation::result_type - operator()(const typename _Operation::second_argument_type& __x) const - { return op(value, __x); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 109. Missing binders for non-const sequence elements - typename _Operation::result_type - operator()(typename _Operation::second_argument_type& __x) const - { return op(value, __x); } - } _GLIBCXX_DEPRECATED; - - /// One of the @link binders binder functors@endlink. - template - inline binder1st<_Operation> - bind1st(const _Operation& __fn, const _Tp& __x) - { - typedef typename _Operation::first_argument_type _Arg1_type; - return binder1st<_Operation>(__fn, _Arg1_type(__x)); - } - - /// One of the @link binders binder functors@endlink. - template - class binder2nd - : public unary_function - { - protected: - _Operation op; - typename _Operation::second_argument_type value; - - public: - binder2nd(const _Operation& __x, - const typename _Operation::second_argument_type& __y) - : op(__x), value(__y) { } - - typename _Operation::result_type - operator()(const typename _Operation::first_argument_type& __x) const - { return op(__x, value); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 109. Missing binders for non-const sequence elements - typename _Operation::result_type - operator()(typename _Operation::first_argument_type& __x) const - { return op(__x, value); } - } _GLIBCXX_DEPRECATED; - - /// One of the @link binders binder functors@endlink. - template - inline binder2nd<_Operation> - bind2nd(const _Operation& __fn, const _Tp& __x) - { - typedef typename _Operation::second_argument_type _Arg2_type; - return binder2nd<_Operation>(__fn, _Arg2_type(__x)); - } - /** @} */ - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#pragma GCC diagnostic pop - -#endif /* _BACKWARD_BINDERS_H */ diff --git a/openflow/usr/include/c++/5/backward/hash_fun.h b/openflow/usr/include/c++/5/backward/hash_fun.h deleted file mode 100644 index 9955112..0000000 --- a/openflow/usr/include/c++/5/backward/hash_fun.h +++ /dev/null @@ -1,170 +0,0 @@ -// 'struct hash' from SGI -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/** @file backward/hash_fun.h - * This file is a GNU extension to the Standard C++ Library (possibly - * containing extensions from the HP/SGI STL subset). - */ - -#ifndef _BACKWARD_HASH_FUN_H -#define _BACKWARD_HASH_FUN_H 1 - -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::size_t; - - template - struct hash { }; - - inline size_t - __stl_hash_string(const char* __s) - { - unsigned long __h = 0; - for ( ; *__s; ++__s) - __h = 5 * __h + *__s; - return size_t(__h); - } - - template<> - struct hash - { - size_t - operator()(const char* __s) const - { return __stl_hash_string(__s); } - }; - - template<> - struct hash - { - size_t - operator()(const char* __s) const - { return __stl_hash_string(__s); } - }; - - template<> - struct hash - { - size_t - operator()(char __x) const - { return __x; } - }; - - template<> - struct hash - { - size_t - operator()(unsigned char __x) const - { return __x; } - }; - - template<> - struct hash - { - size_t - operator()(unsigned char __x) const - { return __x; } - }; - - template<> - struct hash - { - size_t - operator()(short __x) const - { return __x; } - }; - - template<> - struct hash - { - size_t - operator()(unsigned short __x) const - { return __x; } - }; - - template<> - struct hash - { - size_t - operator()(int __x) const - { return __x; } - }; - - template<> - struct hash - { - size_t - operator()(unsigned int __x) const - { return __x; } - }; - - template<> - struct hash - { - size_t - operator()(long __x) const - { return __x; } - }; - - template<> - struct hash - { - size_t - operator()(unsigned long __x) const - { return __x; } - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/backward/hash_map b/openflow/usr/include/c++/5/backward/hash_map deleted file mode 100644 index a9dc9cf..0000000 --- a/openflow/usr/include/c++/5/backward/hash_map +++ /dev/null @@ -1,599 +0,0 @@ -// Hashing map implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/** @file backward/hash_map - * This file is a GNU extension to the Standard C++ Library (possibly - * containing extensions from the HP/SGI STL subset). - */ - -#ifndef _BACKWARD_HASH_MAP -#define _BACKWARD_HASH_MAP 1 - -#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH -#include "backward_warning.h" -#endif - -#include -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::equal_to; - using std::allocator; - using std::pair; - using std::_Select1st; - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template, - class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> > - class hash_map - { - private: - typedef hashtable,_Key, _HashFn, - _Select1st >, - _EqualKey, _Alloc> _Ht; - - _Ht _M_ht; - - public: - typedef typename _Ht::key_type key_type; - typedef _Tp data_type; - typedef _Tp mapped_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher - hash_funct() const - { return _M_ht.hash_funct(); } - - key_equal - key_eq() const - { return _M_ht.key_eq(); } - - allocator_type - get_allocator() const - { return _M_ht.get_allocator(); } - - hash_map() - : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - - explicit - hash_map(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - - hash_map(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} - - hash_map(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - template - hash_map(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - - template - hash_map(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - - template - hash_map(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - - template - hash_map(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } - - size_type - size() const - { return _M_ht.size(); } - - size_type - max_size() const - { return _M_ht.max_size(); } - - bool - empty() const - { return _M_ht.empty(); } - - void - swap(hash_map& __hs) - { _M_ht.swap(__hs._M_ht); } - - template - friend bool - operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&, - const hash_map<_K1, _T1, _HF, _EqK, _Al>&); - - iterator - begin() - { return _M_ht.begin(); } - - iterator - end() - { return _M_ht.end(); } - - const_iterator - begin() const - { return _M_ht.begin(); } - - const_iterator - end() const - { return _M_ht.end(); } - - pair - insert(const value_type& __obj) - { return _M_ht.insert_unique(__obj); } - - template - void - insert(_InputIterator __f, _InputIterator __l) - { _M_ht.insert_unique(__f, __l); } - - pair - insert_noresize(const value_type& __obj) - { return _M_ht.insert_unique_noresize(__obj); } - - iterator - find(const key_type& __key) - { return _M_ht.find(__key); } - - const_iterator - find(const key_type& __key) const - { return _M_ht.find(__key); } - - _Tp& - operator[](const key_type& __key) - { return _M_ht.find_or_insert(value_type(__key, _Tp())).second; } - - size_type - count(const key_type& __key) const - { return _M_ht.count(__key); } - - pair - equal_range(const key_type& __key) - { return _M_ht.equal_range(__key); } - - pair - equal_range(const key_type& __key) const - { return _M_ht.equal_range(__key); } - - size_type - erase(const key_type& __key) - {return _M_ht.erase(__key); } - - void - erase(iterator __it) - { _M_ht.erase(__it); } - - void - erase(iterator __f, iterator __l) - { _M_ht.erase(__f, __l); } - - void - clear() - { _M_ht.clear(); } - - void - resize(size_type __hint) - { _M_ht.resize(__hint); } - - size_type - bucket_count() const - { return _M_ht.bucket_count(); } - - size_type - max_bucket_count() const - { return _M_ht.max_bucket_count(); } - - size_type - elems_in_bucket(size_type __n) const - { return _M_ht.elems_in_bucket(__n); } - }; - - template - inline bool - operator==(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, - const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) - { return __hm1._M_ht == __hm2._M_ht; } - - template - inline bool - operator!=(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, - const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) - { return !(__hm1 == __hm2); } - - template - inline void - swap(hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, - hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) - { __hm1.swap(__hm2); } - - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template, - class _EqualKey = equal_to<_Key>, - class _Alloc = allocator<_Tp> > - class hash_multimap - { - // concept requirements - __glibcxx_class_requires(_Key, _SGIAssignableConcept) - __glibcxx_class_requires(_Tp, _SGIAssignableConcept) - __glibcxx_class_requires3(_HashFn, size_t, _Key, _UnaryFunctionConcept) - __glibcxx_class_requires3(_EqualKey, _Key, _Key, _BinaryPredicateConcept) - - private: - typedef hashtable, _Key, _HashFn, - _Select1st >, _EqualKey, _Alloc> - _Ht; - - _Ht _M_ht; - - public: - typedef typename _Ht::key_type key_type; - typedef _Tp data_type; - typedef _Tp mapped_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher - hash_funct() const - { return _M_ht.hash_funct(); } - - key_equal - key_eq() const - { return _M_ht.key_eq(); } - - allocator_type - get_allocator() const - { return _M_ht.get_allocator(); } - - hash_multimap() - : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - - explicit - hash_multimap(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - - hash_multimap(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} - - hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - template - hash_multimap(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - - template - hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - - template - hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - - template - hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } - - size_type - size() const - { return _M_ht.size(); } - - size_type - max_size() const - { return _M_ht.max_size(); } - - bool - empty() const - { return _M_ht.empty(); } - - void - swap(hash_multimap& __hs) - { _M_ht.swap(__hs._M_ht); } - - template - friend bool - operator==(const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&, - const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&); - - iterator - begin() - { return _M_ht.begin(); } - - iterator - end() - { return _M_ht.end(); } - - const_iterator - begin() const - { return _M_ht.begin(); } - - const_iterator - end() const - { return _M_ht.end(); } - - iterator - insert(const value_type& __obj) - { return _M_ht.insert_equal(__obj); } - - template - void - insert(_InputIterator __f, _InputIterator __l) - { _M_ht.insert_equal(__f,__l); } - - iterator - insert_noresize(const value_type& __obj) - { return _M_ht.insert_equal_noresize(__obj); } - - iterator - find(const key_type& __key) - { return _M_ht.find(__key); } - - const_iterator - find(const key_type& __key) const - { return _M_ht.find(__key); } - - size_type - count(const key_type& __key) const - { return _M_ht.count(__key); } - - pair - equal_range(const key_type& __key) - { return _M_ht.equal_range(__key); } - - pair - equal_range(const key_type& __key) const - { return _M_ht.equal_range(__key); } - - size_type - erase(const key_type& __key) - { return _M_ht.erase(__key); } - - void - erase(iterator __it) - { _M_ht.erase(__it); } - - void - erase(iterator __f, iterator __l) - { _M_ht.erase(__f, __l); } - - void - clear() - { _M_ht.clear(); } - - void - resize(size_type __hint) - { _M_ht.resize(__hint); } - - size_type - bucket_count() const - { return _M_ht.bucket_count(); } - - size_type - max_bucket_count() const - { return _M_ht.max_bucket_count(); } - - size_type - elems_in_bucket(size_type __n) const - { return _M_ht.elems_in_bucket(__n); } - }; - - template - inline bool - operator==(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1, - const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2) - { return __hm1._M_ht == __hm2._M_ht; } - - template - inline bool - operator!=(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1, - const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2) - { return !(__hm1 == __hm2); } - - template - inline void - swap(hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, - hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) - { __hm1.swap(__hm2); } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Specialization of insert_iterator so that it will work for hash_map - // and hash_multimap. - template - class insert_iterator<__gnu_cxx::hash_map<_Key, _Tp, _HashFn, - _EqKey, _Alloc> > - { - protected: - typedef __gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> - _Container; - _Container* container; - - public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) - : container(&__x) {} - - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __value) - { - container->insert(__value); - return *this; - } - - insert_iterator<_Container>& - operator*() - { return *this; } - - insert_iterator<_Container>& - operator++() { return *this; } - - insert_iterator<_Container>& - operator++(int) - { return *this; } - }; - - template - class insert_iterator<__gnu_cxx::hash_multimap<_Key, _Tp, _HashFn, - _EqKey, _Alloc> > - { - protected: - typedef __gnu_cxx::hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> - _Container; - _Container* container; - typename _Container::iterator iter; - - public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) - : container(&__x) {} - - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __value) - { - container->insert(__value); - return *this; - } - - insert_iterator<_Container>& - operator*() - { return *this; } - - insert_iterator<_Container>& - operator++() - { return *this; } - - insert_iterator<_Container>& - operator++(int) - { return *this; } - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/backward/hash_set b/openflow/usr/include/c++/5/backward/hash_set deleted file mode 100644 index 3c9ec70..0000000 --- a/openflow/usr/include/c++/5/backward/hash_set +++ /dev/null @@ -1,567 +0,0 @@ -// Hashing set implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/** @file backward/hash_set - * This file is a GNU extension to the Standard C++ Library (possibly - * containing extensions from the HP/SGI STL subset). - */ - -#ifndef _BACKWARD_HASH_SET -#define _BACKWARD_HASH_SET 1 - -#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH -#include "backward_warning.h" -#endif - -#include -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::equal_to; - using std::allocator; - using std::pair; - using std::_Identity; - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template, - class _EqualKey = equal_to<_Value>, - class _Alloc = allocator<_Value> > - class hash_set - { - // concept requirements - __glibcxx_class_requires(_Value, _SGIAssignableConcept) - __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept) - __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept) - - private: - typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, - _EqualKey, _Alloc> _Ht; - _Ht _M_ht; - - public: - typedef typename _Ht::key_type key_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Alloc::pointer pointer; - typedef typename _Alloc::const_pointer const_pointer; - typedef typename _Alloc::reference reference; - typedef typename _Alloc::const_reference const_reference; - - typedef typename _Ht::const_iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher - hash_funct() const - { return _M_ht.hash_funct(); } - - key_equal - key_eq() const - { return _M_ht.key_eq(); } - - allocator_type - get_allocator() const - { return _M_ht.get_allocator(); } - - hash_set() - : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - - explicit - hash_set(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - - hash_set(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} - - hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - template - hash_set(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - - template - hash_set(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - - template - hash_set(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - - template - hash_set(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } - - size_type - size() const - { return _M_ht.size(); } - - size_type - max_size() const - { return _M_ht.max_size(); } - - bool - empty() const - { return _M_ht.empty(); } - - void - swap(hash_set& __hs) - { _M_ht.swap(__hs._M_ht); } - - template - friend bool - operator==(const hash_set<_Val, _HF, _EqK, _Al>&, - const hash_set<_Val, _HF, _EqK, _Al>&); - - iterator - begin() const - { return _M_ht.begin(); } - - iterator - end() const - { return _M_ht.end(); } - - pair - insert(const value_type& __obj) - { - pair __p = _M_ht.insert_unique(__obj); - return pair(__p.first, __p.second); - } - - template - void - insert(_InputIterator __f, _InputIterator __l) - { _M_ht.insert_unique(__f, __l); } - - pair - insert_noresize(const value_type& __obj) - { - pair __p - = _M_ht.insert_unique_noresize(__obj); - return pair(__p.first, __p.second); - } - - iterator - find(const key_type& __key) const - { return _M_ht.find(__key); } - - size_type - count(const key_type& __key) const - { return _M_ht.count(__key); } - - pair - equal_range(const key_type& __key) const - { return _M_ht.equal_range(__key); } - - size_type - erase(const key_type& __key) - {return _M_ht.erase(__key); } - - void - erase(iterator __it) - { _M_ht.erase(__it); } - - void - erase(iterator __f, iterator __l) - { _M_ht.erase(__f, __l); } - - void - clear() - { _M_ht.clear(); } - - void - resize(size_type __hint) - { _M_ht.resize(__hint); } - - size_type - bucket_count() const - { return _M_ht.bucket_count(); } - - size_type - max_bucket_count() const - { return _M_ht.max_bucket_count(); } - - size_type - elems_in_bucket(size_type __n) const - { return _M_ht.elems_in_bucket(__n); } - }; - - template - inline bool - operator==(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1, - const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2) - { return __hs1._M_ht == __hs2._M_ht; } - - template - inline bool - operator!=(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1, - const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2) - { return !(__hs1 == __hs2); } - - template - inline void - swap(hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, - hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) - { __hs1.swap(__hs2); } - - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template, - class _EqualKey = equal_to<_Value>, - class _Alloc = allocator<_Value> > - class hash_multiset - { - // concept requirements - __glibcxx_class_requires(_Value, _SGIAssignableConcept) - __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept) - __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept) - - private: - typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, - _EqualKey, _Alloc> _Ht; - _Ht _M_ht; - - public: - typedef typename _Ht::key_type key_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Alloc::pointer pointer; - typedef typename _Alloc::const_pointer const_pointer; - typedef typename _Alloc::reference reference; - typedef typename _Alloc::const_reference const_reference; - - typedef typename _Ht::const_iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher - hash_funct() const - { return _M_ht.hash_funct(); } - - key_equal - key_eq() const - { return _M_ht.key_eq(); } - - allocator_type - get_allocator() const - { return _M_ht.get_allocator(); } - - hash_multiset() - : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - - explicit - hash_multiset(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - - hash_multiset(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} - - hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - template - hash_multiset(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - - template - hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - - template - hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - - template - hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } - - size_type - size() const - { return _M_ht.size(); } - - size_type - max_size() const - { return _M_ht.max_size(); } - - bool - empty() const - { return _M_ht.empty(); } - - void - swap(hash_multiset& hs) - { _M_ht.swap(hs._M_ht); } - - template - friend bool - operator==(const hash_multiset<_Val, _HF, _EqK, _Al>&, - const hash_multiset<_Val, _HF, _EqK, _Al>&); - - iterator - begin() const - { return _M_ht.begin(); } - - iterator - end() const - { return _M_ht.end(); } - - iterator - insert(const value_type& __obj) - { return _M_ht.insert_equal(__obj); } - - template - void - insert(_InputIterator __f, _InputIterator __l) - { _M_ht.insert_equal(__f,__l); } - - iterator - insert_noresize(const value_type& __obj) - { return _M_ht.insert_equal_noresize(__obj); } - - iterator - find(const key_type& __key) const - { return _M_ht.find(__key); } - - size_type - count(const key_type& __key) const - { return _M_ht.count(__key); } - - pair - equal_range(const key_type& __key) const - { return _M_ht.equal_range(__key); } - - size_type - erase(const key_type& __key) - { return _M_ht.erase(__key); } - - void - erase(iterator __it) - { _M_ht.erase(__it); } - - void - erase(iterator __f, iterator __l) - { _M_ht.erase(__f, __l); } - - void - clear() - { _M_ht.clear(); } - - void - resize(size_type __hint) - { _M_ht.resize(__hint); } - - size_type - bucket_count() const - { return _M_ht.bucket_count(); } - - size_type - max_bucket_count() const - { return _M_ht.max_bucket_count(); } - - size_type - elems_in_bucket(size_type __n) const - { return _M_ht.elems_in_bucket(__n); } - }; - - template - inline bool - operator==(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, - const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) - { return __hs1._M_ht == __hs2._M_ht; } - - template - inline bool - operator!=(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, - const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) - { return !(__hs1 == __hs2); } - - template - inline void - swap(hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, - hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) - { __hs1.swap(__hs2); } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Specialization of insert_iterator so that it will work for hash_set - // and hash_multiset. - template - class insert_iterator<__gnu_cxx::hash_set<_Value, _HashFcn, - _EqualKey, _Alloc> > - { - protected: - typedef __gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc> - _Container; - _Container* container; - - public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) - : container(&__x) {} - - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __value) - { - container->insert(__value); - return *this; - } - - insert_iterator<_Container>& - operator*() - { return *this; } - - insert_iterator<_Container>& - operator++() - { return *this; } - - insert_iterator<_Container>& - operator++(int) - { return *this; } - }; - - template - class insert_iterator<__gnu_cxx::hash_multiset<_Value, _HashFcn, - _EqualKey, _Alloc> > - { - protected: - typedef __gnu_cxx::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> - _Container; - _Container* container; - typename _Container::iterator iter; - - public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) - : container(&__x) {} - - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __value) - { - container->insert(__value); - return *this; - } - - insert_iterator<_Container>& - operator*() - { return *this; } - - insert_iterator<_Container>& - operator++() - { return *this; } - - insert_iterator<_Container>& - operator++(int) { return *this; } - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/backward/hashtable.h b/openflow/usr/include/c++/5/backward/hashtable.h deleted file mode 100644 index 3f2bb9e..0000000 --- a/openflow/usr/include/c++/5/backward/hashtable.h +++ /dev/null @@ -1,1167 +0,0 @@ -// Hashtable implementation used by containers -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/** @file backward/hashtable.h - * This file is a GNU extension to the Standard C++ Library (possibly - * containing extensions from the HP/SGI STL subset). - */ - -#ifndef _BACKWARD_HASHTABLE_H -#define _BACKWARD_HASHTABLE_H 1 - -// Hashtable class, used to implement the hashed associative containers -// hash_set, hash_map, hash_multiset, and hash_multimap. - -#include -#include -#include -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::size_t; - using std::ptrdiff_t; - using std::forward_iterator_tag; - using std::input_iterator_tag; - using std::_Construct; - using std::_Destroy; - using std::distance; - using std::vector; - using std::pair; - using std::__iterator_category; - - template - struct _Hashtable_node - { - _Hashtable_node* _M_next; - _Val _M_val; - }; - - template > - class hashtable; - - template - struct _Hashtable_iterator; - - template - struct _Hashtable_const_iterator; - - template - struct _Hashtable_iterator - { - typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> - _Hashtable; - typedef _Hashtable_iterator<_Val, _Key, _HashFcn, - _ExtractKey, _EqualKey, _Alloc> - iterator; - typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, - _ExtractKey, _EqualKey, _Alloc> - const_iterator; - typedef _Hashtable_node<_Val> _Node; - typedef forward_iterator_tag iterator_category; - typedef _Val value_type; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - typedef _Val& reference; - typedef _Val* pointer; - - _Node* _M_cur; - _Hashtable* _M_ht; - - _Hashtable_iterator(_Node* __n, _Hashtable* __tab) - : _M_cur(__n), _M_ht(__tab) { } - - _Hashtable_iterator() { } - - reference - operator*() const - { return _M_cur->_M_val; } - - pointer - operator->() const - { return &(operator*()); } - - iterator& - operator++(); - - iterator - operator++(int); - - bool - operator==(const iterator& __it) const - { return _M_cur == __it._M_cur; } - - bool - operator!=(const iterator& __it) const - { return _M_cur != __it._M_cur; } - }; - - template - struct _Hashtable_const_iterator - { - typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> - _Hashtable; - typedef _Hashtable_iterator<_Val,_Key,_HashFcn, - _ExtractKey,_EqualKey,_Alloc> - iterator; - typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, - _ExtractKey, _EqualKey, _Alloc> - const_iterator; - typedef _Hashtable_node<_Val> _Node; - - typedef forward_iterator_tag iterator_category; - typedef _Val value_type; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - typedef const _Val& reference; - typedef const _Val* pointer; - - const _Node* _M_cur; - const _Hashtable* _M_ht; - - _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab) - : _M_cur(__n), _M_ht(__tab) { } - - _Hashtable_const_iterator() { } - - _Hashtable_const_iterator(const iterator& __it) - : _M_cur(__it._M_cur), _M_ht(__it._M_ht) { } - - reference - operator*() const - { return _M_cur->_M_val; } - - pointer - operator->() const - { return &(operator*()); } - - const_iterator& - operator++(); - - const_iterator - operator++(int); - - bool - operator==(const const_iterator& __it) const - { return _M_cur == __it._M_cur; } - - bool - operator!=(const const_iterator& __it) const - { return _M_cur != __it._M_cur; } - }; - - // Note: assumes long is at least 32 bits. - enum { _S_num_primes = 29 }; - - template - struct _Hashtable_prime_list - { - static const _PrimeType __stl_prime_list[_S_num_primes]; - - static const _PrimeType* - _S_get_prime_list(); - }; - - template const _PrimeType - _Hashtable_prime_list<_PrimeType>::__stl_prime_list[_S_num_primes] = - { - 5ul, 53ul, 97ul, 193ul, 389ul, - 769ul, 1543ul, 3079ul, 6151ul, 12289ul, - 24593ul, 49157ul, 98317ul, 196613ul, 393241ul, - 786433ul, 1572869ul, 3145739ul, 6291469ul, 12582917ul, - 25165843ul, 50331653ul, 100663319ul, 201326611ul, 402653189ul, - 805306457ul, 1610612741ul, 3221225473ul, 4294967291ul - }; - - template inline const _PrimeType* - _Hashtable_prime_list<_PrimeType>::_S_get_prime_list() - { - return __stl_prime_list; - } - - inline unsigned long - __stl_next_prime(unsigned long __n) - { - const unsigned long* __first = _Hashtable_prime_list::_S_get_prime_list(); - const unsigned long* __last = __first + (int)_S_num_primes; - const unsigned long* pos = std::lower_bound(__first, __last, __n); - return pos == __last ? *(__last - 1) : *pos; - } - - // Forward declaration of operator==. - template - class hashtable; - - template - bool - operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1, - const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2); - - // Hashtables handle allocators a bit differently than other - // containers do. If we're using standard-conforming allocators, then - // a hashtable unconditionally has a member variable to hold its - // allocator, even if it so happens that all instances of the - // allocator type are identical. This is because, for hashtables, - // this extra storage is negligible. Additionally, a base class - // wouldn't serve any other purposes; it wouldn't, for example, - // simplify the exception-handling code. - template - class hashtable - { - public: - typedef _Key key_type; - typedef _Val value_type; - typedef _HashFcn hasher; - typedef _EqualKey key_equal; - - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - hasher - hash_funct() const - { return _M_hash; } - - key_equal - key_eq() const - { return _M_equals; } - - private: - typedef _Hashtable_node<_Val> _Node; - - public: - typedef typename _Alloc::template rebind::other allocator_type; - allocator_type - get_allocator() const - { return _M_node_allocator; } - - private: - typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc; - typedef typename _Alloc::template rebind<_Node*>::other _Nodeptr_Alloc; - typedef vector<_Node*, _Nodeptr_Alloc> _Vector_type; - - _Node_Alloc _M_node_allocator; - - _Node* - _M_get_node() - { return _M_node_allocator.allocate(1); } - - void - _M_put_node(_Node* __p) - { _M_node_allocator.deallocate(__p, 1); } - - private: - hasher _M_hash; - key_equal _M_equals; - _ExtractKey _M_get_key; - _Vector_type _M_buckets; - size_type _M_num_elements; - - public: - typedef _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, - _EqualKey, _Alloc> - iterator; - typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, - _EqualKey, _Alloc> - const_iterator; - - friend struct - _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>; - - friend struct - _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, - _EqualKey, _Alloc>; - - public: - hashtable(size_type __n, const _HashFcn& __hf, - const _EqualKey& __eql, const _ExtractKey& __ext, - const allocator_type& __a = allocator_type()) - : _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql), - _M_get_key(__ext), _M_buckets(__a), _M_num_elements(0) - { _M_initialize_buckets(__n); } - - hashtable(size_type __n, const _HashFcn& __hf, - const _EqualKey& __eql, - const allocator_type& __a = allocator_type()) - : _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql), - _M_get_key(_ExtractKey()), _M_buckets(__a), _M_num_elements(0) - { _M_initialize_buckets(__n); } - - hashtable(const hashtable& __ht) - : _M_node_allocator(__ht.get_allocator()), _M_hash(__ht._M_hash), - _M_equals(__ht._M_equals), _M_get_key(__ht._M_get_key), - _M_buckets(__ht.get_allocator()), _M_num_elements(0) - { _M_copy_from(__ht); } - - hashtable& - operator= (const hashtable& __ht) - { - if (&__ht != this) - { - clear(); - _M_hash = __ht._M_hash; - _M_equals = __ht._M_equals; - _M_get_key = __ht._M_get_key; - _M_copy_from(__ht); - } - return *this; - } - - ~hashtable() - { clear(); } - - size_type - size() const - { return _M_num_elements; } - - size_type - max_size() const - { return size_type(-1); } - - bool - empty() const - { return size() == 0; } - - void - swap(hashtable& __ht) - { - std::swap(_M_hash, __ht._M_hash); - std::swap(_M_equals, __ht._M_equals); - std::swap(_M_get_key, __ht._M_get_key); - _M_buckets.swap(__ht._M_buckets); - std::swap(_M_num_elements, __ht._M_num_elements); - } - - iterator - begin() - { - for (size_type __n = 0; __n < _M_buckets.size(); ++__n) - if (_M_buckets[__n]) - return iterator(_M_buckets[__n], this); - return end(); - } - - iterator - end() - { return iterator(0, this); } - - const_iterator - begin() const - { - for (size_type __n = 0; __n < _M_buckets.size(); ++__n) - if (_M_buckets[__n]) - return const_iterator(_M_buckets[__n], this); - return end(); - } - - const_iterator - end() const - { return const_iterator(0, this); } - - template - friend bool - operator==(const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&, - const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&); - - public: - size_type - bucket_count() const - { return _M_buckets.size(); } - - size_type - max_bucket_count() const - { return _Hashtable_prime_list:: - _S_get_prime_list()[(int)_S_num_primes - 1]; - } - - size_type - elems_in_bucket(size_type __bucket) const - { - size_type __result = 0; - for (_Node* __n = _M_buckets[__bucket]; __n; __n = __n->_M_next) - __result += 1; - return __result; - } - - pair - insert_unique(const value_type& __obj) - { - resize(_M_num_elements + 1); - return insert_unique_noresize(__obj); - } - - iterator - insert_equal(const value_type& __obj) - { - resize(_M_num_elements + 1); - return insert_equal_noresize(__obj); - } - - pair - insert_unique_noresize(const value_type& __obj); - - iterator - insert_equal_noresize(const value_type& __obj); - - template - void - insert_unique(_InputIterator __f, _InputIterator __l) - { insert_unique(__f, __l, __iterator_category(__f)); } - - template - void - insert_equal(_InputIterator __f, _InputIterator __l) - { insert_equal(__f, __l, __iterator_category(__f)); } - - template - void - insert_unique(_InputIterator __f, _InputIterator __l, - input_iterator_tag) - { - for ( ; __f != __l; ++__f) - insert_unique(*__f); - } - - template - void - insert_equal(_InputIterator __f, _InputIterator __l, - input_iterator_tag) - { - for ( ; __f != __l; ++__f) - insert_equal(*__f); - } - - template - void - insert_unique(_ForwardIterator __f, _ForwardIterator __l, - forward_iterator_tag) - { - size_type __n = distance(__f, __l); - resize(_M_num_elements + __n); - for ( ; __n > 0; --__n, ++__f) - insert_unique_noresize(*__f); - } - - template - void - insert_equal(_ForwardIterator __f, _ForwardIterator __l, - forward_iterator_tag) - { - size_type __n = distance(__f, __l); - resize(_M_num_elements + __n); - for ( ; __n > 0; --__n, ++__f) - insert_equal_noresize(*__f); - } - - reference - find_or_insert(const value_type& __obj); - - iterator - find(const key_type& __key) - { - size_type __n = _M_bkt_num_key(__key); - _Node* __first; - for (__first = _M_buckets[__n]; - __first && !_M_equals(_M_get_key(__first->_M_val), __key); - __first = __first->_M_next) - { } - return iterator(__first, this); - } - - const_iterator - find(const key_type& __key) const - { - size_type __n = _M_bkt_num_key(__key); - const _Node* __first; - for (__first = _M_buckets[__n]; - __first && !_M_equals(_M_get_key(__first->_M_val), __key); - __first = __first->_M_next) - { } - return const_iterator(__first, this); - } - - size_type - count(const key_type& __key) const - { - const size_type __n = _M_bkt_num_key(__key); - size_type __result = 0; - - for (const _Node* __cur = _M_buckets[__n]; __cur; - __cur = __cur->_M_next) - if (_M_equals(_M_get_key(__cur->_M_val), __key)) - ++__result; - return __result; - } - - pair - equal_range(const key_type& __key); - - pair - equal_range(const key_type& __key) const; - - size_type - erase(const key_type& __key); - - void - erase(const iterator& __it); - - void - erase(iterator __first, iterator __last); - - void - erase(const const_iterator& __it); - - void - erase(const_iterator __first, const_iterator __last); - - void - resize(size_type __num_elements_hint); - - void - clear(); - - private: - size_type - _M_next_size(size_type __n) const - { return __stl_next_prime(__n); } - - void - _M_initialize_buckets(size_type __n) - { - const size_type __n_buckets = _M_next_size(__n); - _M_buckets.reserve(__n_buckets); - _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0); - _M_num_elements = 0; - } - - size_type - _M_bkt_num_key(const key_type& __key) const - { return _M_bkt_num_key(__key, _M_buckets.size()); } - - size_type - _M_bkt_num(const value_type& __obj) const - { return _M_bkt_num_key(_M_get_key(__obj)); } - - size_type - _M_bkt_num_key(const key_type& __key, size_t __n) const - { return _M_hash(__key) % __n; } - - size_type - _M_bkt_num(const value_type& __obj, size_t __n) const - { return _M_bkt_num_key(_M_get_key(__obj), __n); } - - _Node* - _M_new_node(const value_type& __obj) - { - _Node* __n = _M_get_node(); - __n->_M_next = 0; - __try - { - this->get_allocator().construct(&__n->_M_val, __obj); - return __n; - } - __catch(...) - { - _M_put_node(__n); - __throw_exception_again; - } - } - - void - _M_delete_node(_Node* __n) - { - this->get_allocator().destroy(&__n->_M_val); - _M_put_node(__n); - } - - void - _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last); - - void - _M_erase_bucket(const size_type __n, _Node* __last); - - void - _M_copy_from(const hashtable& __ht); - }; - - template - _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& - _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>:: - operator++() - { - const _Node* __old = _M_cur; - _M_cur = _M_cur->_M_next; - if (!_M_cur) - { - size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val); - while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size()) - _M_cur = _M_ht->_M_buckets[__bucket]; - } - return *this; - } - - template - inline _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All> - _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>:: - operator++(int) - { - iterator __tmp = *this; - ++*this; - return __tmp; - } - - template - _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& - _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>:: - operator++() - { - const _Node* __old = _M_cur; - _M_cur = _M_cur->_M_next; - if (!_M_cur) - { - size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val); - while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size()) - _M_cur = _M_ht->_M_buckets[__bucket]; - } - return *this; - } - - template - inline _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All> - _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>:: - operator++(int) - { - const_iterator __tmp = *this; - ++*this; - return __tmp; - } - - template - bool - operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1, - const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2) - { - typedef typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::_Node _Node; - - if (__ht1._M_buckets.size() != __ht2._M_buckets.size()) - return false; - - for (size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n) - { - _Node* __cur1 = __ht1._M_buckets[__n]; - _Node* __cur2 = __ht2._M_buckets[__n]; - // Check same length of lists - for (; __cur1 && __cur2; - __cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next) - { } - if (__cur1 || __cur2) - return false; - // Now check one's elements are in the other - for (__cur1 = __ht1._M_buckets[__n] ; __cur1; - __cur1 = __cur1->_M_next) - { - bool _found__cur1 = false; - for (__cur2 = __ht2._M_buckets[__n]; - __cur2; __cur2 = __cur2->_M_next) - { - if (__cur1->_M_val == __cur2->_M_val) - { - _found__cur1 = true; - break; - } - } - if (!_found__cur1) - return false; - } - } - return true; - } - - template - inline bool - operator!=(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1, - const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2) - { return !(__ht1 == __ht2); } - - template - inline void - swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1, - hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2) - { __ht1.swap(__ht2); } - - template - pair::iterator, bool> - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - insert_unique_noresize(const value_type& __obj) - { - const size_type __n = _M_bkt_num(__obj); - _Node* __first = _M_buckets[__n]; - - for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) - if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) - return pair(iterator(__cur, this), false); - - _Node* __tmp = _M_new_node(__obj); - __tmp->_M_next = __first; - _M_buckets[__n] = __tmp; - ++_M_num_elements; - return pair(iterator(__tmp, this), true); - } - - template - typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - insert_equal_noresize(const value_type& __obj) - { - const size_type __n = _M_bkt_num(__obj); - _Node* __first = _M_buckets[__n]; - - for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) - if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) - { - _Node* __tmp = _M_new_node(__obj); - __tmp->_M_next = __cur->_M_next; - __cur->_M_next = __tmp; - ++_M_num_elements; - return iterator(__tmp, this); - } - - _Node* __tmp = _M_new_node(__obj); - __tmp->_M_next = __first; - _M_buckets[__n] = __tmp; - ++_M_num_elements; - return iterator(__tmp, this); - } - - template - typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::reference - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - find_or_insert(const value_type& __obj) - { - resize(_M_num_elements + 1); - - size_type __n = _M_bkt_num(__obj); - _Node* __first = _M_buckets[__n]; - - for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) - if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) - return __cur->_M_val; - - _Node* __tmp = _M_new_node(__obj); - __tmp->_M_next = __first; - _M_buckets[__n] = __tmp; - ++_M_num_elements; - return __tmp->_M_val; - } - - template - pair::iterator, - typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator> - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - equal_range(const key_type& __key) - { - typedef pair _Pii; - const size_type __n = _M_bkt_num_key(__key); - - for (_Node* __first = _M_buckets[__n]; __first; - __first = __first->_M_next) - if (_M_equals(_M_get_key(__first->_M_val), __key)) - { - for (_Node* __cur = __first->_M_next; __cur; - __cur = __cur->_M_next) - if (!_M_equals(_M_get_key(__cur->_M_val), __key)) - return _Pii(iterator(__first, this), iterator(__cur, this)); - for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m) - if (_M_buckets[__m]) - return _Pii(iterator(__first, this), - iterator(_M_buckets[__m], this)); - return _Pii(iterator(__first, this), end()); - } - return _Pii(end(), end()); - } - - template - pair::const_iterator, - typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator> - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - equal_range(const key_type& __key) const - { - typedef pair _Pii; - const size_type __n = _M_bkt_num_key(__key); - - for (const _Node* __first = _M_buckets[__n]; __first; - __first = __first->_M_next) - { - if (_M_equals(_M_get_key(__first->_M_val), __key)) - { - for (const _Node* __cur = __first->_M_next; __cur; - __cur = __cur->_M_next) - if (!_M_equals(_M_get_key(__cur->_M_val), __key)) - return _Pii(const_iterator(__first, this), - const_iterator(__cur, this)); - for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m) - if (_M_buckets[__m]) - return _Pii(const_iterator(__first, this), - const_iterator(_M_buckets[__m], this)); - return _Pii(const_iterator(__first, this), end()); - } - } - return _Pii(end(), end()); - } - - template - typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::size_type - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - erase(const key_type& __key) - { - const size_type __n = _M_bkt_num_key(__key); - _Node* __first = _M_buckets[__n]; - _Node* __saved_slot = 0; - size_type __erased = 0; - - if (__first) - { - _Node* __cur = __first; - _Node* __next = __cur->_M_next; - while (__next) - { - if (_M_equals(_M_get_key(__next->_M_val), __key)) - { - if (&_M_get_key(__next->_M_val) != &__key) - { - __cur->_M_next = __next->_M_next; - _M_delete_node(__next); - __next = __cur->_M_next; - ++__erased; - --_M_num_elements; - } - else - { - __saved_slot = __cur; - __cur = __next; - __next = __cur->_M_next; - } - } - else - { - __cur = __next; - __next = __cur->_M_next; - } - } - bool __delete_first = _M_equals(_M_get_key(__first->_M_val), __key); - if (__saved_slot) - { - __next = __saved_slot->_M_next; - __saved_slot->_M_next = __next->_M_next; - _M_delete_node(__next); - ++__erased; - --_M_num_elements; - } - if (__delete_first) - { - _M_buckets[__n] = __first->_M_next; - _M_delete_node(__first); - ++__erased; - --_M_num_elements; - } - } - return __erased; - } - - template - void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - erase(const iterator& __it) - { - _Node* __p = __it._M_cur; - if (__p) - { - const size_type __n = _M_bkt_num(__p->_M_val); - _Node* __cur = _M_buckets[__n]; - - if (__cur == __p) - { - _M_buckets[__n] = __cur->_M_next; - _M_delete_node(__cur); - --_M_num_elements; - } - else - { - _Node* __next = __cur->_M_next; - while (__next) - { - if (__next == __p) - { - __cur->_M_next = __next->_M_next; - _M_delete_node(__next); - --_M_num_elements; - break; - } - else - { - __cur = __next; - __next = __cur->_M_next; - } - } - } - } - } - - template - void - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - erase(iterator __first, iterator __last) - { - size_type __f_bucket = __first._M_cur ? _M_bkt_num(__first._M_cur->_M_val) - : _M_buckets.size(); - - size_type __l_bucket = __last._M_cur ? _M_bkt_num(__last._M_cur->_M_val) - : _M_buckets.size(); - - if (__first._M_cur == __last._M_cur) - return; - else if (__f_bucket == __l_bucket) - _M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur); - else - { - _M_erase_bucket(__f_bucket, __first._M_cur, 0); - for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n) - _M_erase_bucket(__n, 0); - if (__l_bucket != _M_buckets.size()) - _M_erase_bucket(__l_bucket, __last._M_cur); - } - } - - template - inline void - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - erase(const_iterator __first, const_iterator __last) - { - erase(iterator(const_cast<_Node*>(__first._M_cur), - const_cast(__first._M_ht)), - iterator(const_cast<_Node*>(__last._M_cur), - const_cast(__last._M_ht))); - } - - template - inline void - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - erase(const const_iterator& __it) - { erase(iterator(const_cast<_Node*>(__it._M_cur), - const_cast(__it._M_ht))); } - - template - void - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - resize(size_type __num_elements_hint) - { - const size_type __old_n = _M_buckets.size(); - if (__num_elements_hint > __old_n) - { - const size_type __n = _M_next_size(__num_elements_hint); - if (__n > __old_n) - { - _Vector_type __tmp(__n, (_Node*)(0), _M_buckets.get_allocator()); - __try - { - for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) - { - _Node* __first = _M_buckets[__bucket]; - while (__first) - { - size_type __new_bucket = _M_bkt_num(__first->_M_val, - __n); - _M_buckets[__bucket] = __first->_M_next; - __first->_M_next = __tmp[__new_bucket]; - __tmp[__new_bucket] = __first; - __first = _M_buckets[__bucket]; - } - } - _M_buckets.swap(__tmp); - } - __catch(...) - { - for (size_type __bucket = 0; __bucket < __tmp.size(); - ++__bucket) - { - while (__tmp[__bucket]) - { - _Node* __next = __tmp[__bucket]->_M_next; - _M_delete_node(__tmp[__bucket]); - __tmp[__bucket] = __next; - } - } - __throw_exception_again; - } - } - } - } - - template - void - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last) - { - _Node* __cur = _M_buckets[__n]; - if (__cur == __first) - _M_erase_bucket(__n, __last); - else - { - _Node* __next; - for (__next = __cur->_M_next; - __next != __first; - __cur = __next, __next = __cur->_M_next) - ; - while (__next != __last) - { - __cur->_M_next = __next->_M_next; - _M_delete_node(__next); - __next = __cur->_M_next; - --_M_num_elements; - } - } - } - - template - void - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - _M_erase_bucket(const size_type __n, _Node* __last) - { - _Node* __cur = _M_buckets[__n]; - while (__cur != __last) - { - _Node* __next = __cur->_M_next; - _M_delete_node(__cur); - __cur = __next; - _M_buckets[__n] = __cur; - --_M_num_elements; - } - } - - template - void - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - clear() - { - if (_M_num_elements == 0) - return; - - for (size_type __i = 0; __i < _M_buckets.size(); ++__i) - { - _Node* __cur = _M_buckets[__i]; - while (__cur != 0) - { - _Node* __next = __cur->_M_next; - _M_delete_node(__cur); - __cur = __next; - } - _M_buckets[__i] = 0; - } - _M_num_elements = 0; - } - - template - void - hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: - _M_copy_from(const hashtable& __ht) - { - _M_buckets.clear(); - _M_buckets.reserve(__ht._M_buckets.size()); - _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0); - __try - { - for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) { - const _Node* __cur = __ht._M_buckets[__i]; - if (__cur) - { - _Node* __local_copy = _M_new_node(__cur->_M_val); - _M_buckets[__i] = __local_copy; - - for (_Node* __next = __cur->_M_next; - __next; - __cur = __next, __next = __cur->_M_next) - { - __local_copy->_M_next = _M_new_node(__next->_M_val); - __local_copy = __local_copy->_M_next; - } - } - } - _M_num_elements = __ht._M_num_elements; - } - __catch(...) - { - clear(); - __throw_exception_again; - } - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/backward/strstream b/openflow/usr/include/c++/5/backward/strstream deleted file mode 100644 index 10e2dfe..0000000 --- a/openflow/usr/include/c++/5/backward/strstream +++ /dev/null @@ -1,183 +0,0 @@ -// Backward-compat support -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * Copyright (c) 1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -// WARNING: The classes defined in this header are DEPRECATED. This -// header is defined in section D.7.1 of the C++ standard, and it -// MAY BE REMOVED in a future standard revision. One should use the -// header instead. - -/** @file strstream - * This is a Standard C++ Library header. - */ - -#ifndef _BACKWARD_STRSTREAM -#define _BACKWARD_STRSTREAM - -#include "backward_warning.h" -#include -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Class strstreambuf, a streambuf class that manages an array of char. - // Note that this class is not a template. - class strstreambuf : public basic_streambuf > - { - public: - // Types. - typedef char_traits _Traits; - typedef basic_streambuf _Base; - - public: - // Constructor, destructor - explicit strstreambuf(streamsize __initial_capacity = 0); - strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*)); - - strstreambuf(char* __get, streamsize __n, char* __put = 0) throw (); - strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0) throw (); - strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0) throw (); - - strstreambuf(const char* __get, streamsize __n) throw (); - strstreambuf(const signed char* __get, streamsize __n) throw (); - strstreambuf(const unsigned char* __get, streamsize __n) throw (); - - virtual ~strstreambuf(); - - public: - void freeze(bool = true) throw (); - char* str() throw (); - _GLIBCXX_PURE int pcount() const throw (); - - protected: - virtual int_type overflow(int_type __c = _Traits::eof()); - virtual int_type pbackfail(int_type __c = _Traits::eof()); - virtual int_type underflow(); - virtual _Base* setbuf(char* __buf, streamsize __n); - virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir, - ios_base::openmode __mode - = ios_base::in | ios_base::out); - virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode - = ios_base::in | ios_base::out); - - private: - strstreambuf& - operator=(const strstreambuf&); - - strstreambuf(const strstreambuf&); - - // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun. - char* _M_alloc(size_t); - void _M_free(char*); - - // Helper function used in constructors. - void _M_setup(char* __get, char* __put, streamsize __n) throw (); - - private: - // Data members. - void* (*_M_alloc_fun)(size_t); - void (*_M_free_fun)(void*); - - bool _M_dynamic : 1; - bool _M_frozen : 1; - bool _M_constant : 1; - }; - - // Class istrstream, an istream that manages a strstreambuf. - class istrstream : public basic_istream - { - public: - explicit istrstream(char*); - explicit istrstream(const char*); - istrstream(char* , streamsize); - istrstream(const char*, streamsize); - virtual ~istrstream(); - - _GLIBCXX_CONST strstreambuf* rdbuf() const throw (); - char* str() throw (); - - private: - strstreambuf _M_buf; - }; - - // Class ostrstream - class ostrstream : public basic_ostream - { - public: - ostrstream(); - ostrstream(char*, int, ios_base::openmode = ios_base::out); - virtual ~ostrstream(); - - _GLIBCXX_CONST strstreambuf* rdbuf() const throw (); - void freeze(bool = true) throw(); - char* str() throw (); - _GLIBCXX_PURE int pcount() const throw (); - - private: - strstreambuf _M_buf; - }; - - // Class strstream - class strstream : public basic_iostream - { - public: - typedef char char_type; - typedef char_traits::int_type int_type; - typedef char_traits::pos_type pos_type; - typedef char_traits::off_type off_type; - - strstream(); - strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out); - virtual ~strstream(); - - _GLIBCXX_CONST strstreambuf* rdbuf() const throw (); - void freeze(bool = true) throw (); - _GLIBCXX_PURE int pcount() const throw (); - char* str() throw (); - - private: - strstreambuf _M_buf; - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/bits/algorithmfwd.h b/openflow/usr/include/c++/5/bits/algorithmfwd.h deleted file mode 100644 index 1dfc4ad..0000000 --- a/openflow/usr/include/c++/5/bits/algorithmfwd.h +++ /dev/null @@ -1,847 +0,0 @@ -// Forward declarations -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/algorithmfwd.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{algorithm} - */ - -#ifndef _GLIBCXX_ALGORITHMFWD_H -#define _GLIBCXX_ALGORITHMFWD_H 1 - -#pragma GCC system_header - -#include -#include -#include -#if __cplusplus >= 201103L -#include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /* - adjacent_find - all_of (C++0x) - any_of (C++0x) - binary_search - copy - copy_backward - copy_if (C++0x) - copy_n (C++0x) - count - count_if - equal - equal_range - fill - fill_n - find - find_end - find_first_of - find_if - find_if_not (C++0x) - for_each - generate - generate_n - includes - inplace_merge - is_heap (C++0x) - is_heap_until (C++0x) - is_partitioned (C++0x) - is_sorted (C++0x) - is_sorted_until (C++0x) - iter_swap - lexicographical_compare - lower_bound - make_heap - max - max_element - merge - min - min_element - minmax (C++0x) - minmax_element (C++0x) - mismatch - next_permutation - none_of (C++0x) - nth_element - partial_sort - partial_sort_copy - partition - partition_copy (C++0x) - partition_point (C++0x) - pop_heap - prev_permutation - push_heap - random_shuffle - remove - remove_copy - remove_copy_if - remove_if - replace - replace_copy - replace_copy_if - replace_if - reverse - reverse_copy - rotate - rotate_copy - search - search_n - set_difference - set_intersection - set_symmetric_difference - set_union - shuffle (C++0x) - sort - sort_heap - stable_partition - stable_sort - swap - swap_ranges - transform - unique - unique_copy - upper_bound - */ - - /** - * @defgroup algorithms Algorithms - * - * Components for performing algorithmic operations. Includes - * non-modifying sequence, modifying (mutating) sequence, sorting, - * searching, merge, partition, heap, set, minima, maxima, and - * permutation operations. - */ - - /** - * @defgroup mutating_algorithms Mutating - * @ingroup algorithms - */ - - /** - * @defgroup non_mutating_algorithms Non-Mutating - * @ingroup algorithms - */ - - /** - * @defgroup sorting_algorithms Sorting - * @ingroup algorithms - */ - - /** - * @defgroup set_algorithms Set Operation - * @ingroup sorting_algorithms - * - * These algorithms are common set operations performed on sequences - * that are already sorted. The number of comparisons will be - * linear. - */ - - /** - * @defgroup binary_search_algorithms Binary Search - * @ingroup sorting_algorithms - * - * These algorithms are variations of a classic binary search, and - * all assume that the sequence being searched is already sorted. - * - * The number of comparisons will be logarithmic (and as few as - * possible). The number of steps through the sequence will be - * logarithmic for random-access iterators (e.g., pointers), and - * linear otherwise. - * - * The LWG has passed Defect Report 270, which notes: The - * proposed resolution reinterprets binary search. Instead of - * thinking about searching for a value in a sorted range, we view - * that as an important special case of a more general algorithm: - * searching for the partition point in a partitioned range. We - * also add a guarantee that the old wording did not: we ensure that - * the upper bound is no earlier than the lower bound, that the pair - * returned by equal_range is a valid range, and that the first part - * of that pair is the lower bound. - * - * The actual effect of the first sentence is that a comparison - * functor passed by the user doesn't necessarily need to induce a - * strict weak ordering relation. Rather, it partitions the range. - */ - - // adjacent_find - -#if __cplusplus >= 201103L - template - bool - all_of(_IIter, _IIter, _Predicate); - - template - bool - any_of(_IIter, _IIter, _Predicate); -#endif - - template - bool - binary_search(_FIter, _FIter, const _Tp&); - - template - bool - binary_search(_FIter, _FIter, const _Tp&, _Compare); - - template - _OIter - copy(_IIter, _IIter, _OIter); - - template - _BIter2 - copy_backward(_BIter1, _BIter1, _BIter2); - -#if __cplusplus >= 201103L - template - _OIter - copy_if(_IIter, _IIter, _OIter, _Predicate); - - template - _OIter - copy_n(_IIter, _Size, _OIter); -#endif - - // count - // count_if - - template - pair<_FIter, _FIter> - equal_range(_FIter, _FIter, const _Tp&); - - template - pair<_FIter, _FIter> - equal_range(_FIter, _FIter, const _Tp&, _Compare); - - template - void - fill(_FIter, _FIter, const _Tp&); - - template - _OIter - fill_n(_OIter, _Size, const _Tp&); - - // find - - template - _FIter1 - find_end(_FIter1, _FIter1, _FIter2, _FIter2); - - template - _FIter1 - find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); - - // find_first_of - // find_if - -#if __cplusplus >= 201103L - template - _IIter - find_if_not(_IIter, _IIter, _Predicate); -#endif - - // for_each - // generate - // generate_n - - template - bool - includes(_IIter1, _IIter1, _IIter2, _IIter2); - - template - bool - includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); - - template - void - inplace_merge(_BIter, _BIter, _BIter); - - template - void - inplace_merge(_BIter, _BIter, _BIter, _Compare); - -#if __cplusplus >= 201103L - template - bool - is_heap(_RAIter, _RAIter); - - template - bool - is_heap(_RAIter, _RAIter, _Compare); - - template - _RAIter - is_heap_until(_RAIter, _RAIter); - - template - _RAIter - is_heap_until(_RAIter, _RAIter, _Compare); - - template - bool - is_partitioned(_IIter, _IIter, _Predicate); - - template - bool - is_permutation(_FIter1, _FIter1, _FIter2); - - template - bool - is_permutation(_FIter1, _FIter1, _FIter2, _BinaryPredicate); - - template - bool - is_sorted(_FIter, _FIter); - - template - bool - is_sorted(_FIter, _FIter, _Compare); - - template - _FIter - is_sorted_until(_FIter, _FIter); - - template - _FIter - is_sorted_until(_FIter, _FIter, _Compare); -#endif - - template - void - iter_swap(_FIter1, _FIter2); - - template - _FIter - lower_bound(_FIter, _FIter, const _Tp&); - - template - _FIter - lower_bound(_FIter, _FIter, const _Tp&, _Compare); - - template - void - make_heap(_RAIter, _RAIter); - - template - void - make_heap(_RAIter, _RAIter, _Compare); - - template - _GLIBCXX14_CONSTEXPR - const _Tp& - max(const _Tp&, const _Tp&); - - template - _GLIBCXX14_CONSTEXPR - const _Tp& - max(const _Tp&, const _Tp&, _Compare); - - // max_element - // merge - - template - _GLIBCXX14_CONSTEXPR - const _Tp& - min(const _Tp&, const _Tp&); - - template - _GLIBCXX14_CONSTEXPR - const _Tp& - min(const _Tp&, const _Tp&, _Compare); - - // min_element - -#if __cplusplus >= 201103L - template - _GLIBCXX14_CONSTEXPR - pair - minmax(const _Tp&, const _Tp&); - - template - _GLIBCXX14_CONSTEXPR - pair - minmax(const _Tp&, const _Tp&, _Compare); - - template - _GLIBCXX14_CONSTEXPR - pair<_FIter, _FIter> - minmax_element(_FIter, _FIter); - - template - _GLIBCXX14_CONSTEXPR - pair<_FIter, _FIter> - minmax_element(_FIter, _FIter, _Compare); - - template - _GLIBCXX14_CONSTEXPR - _Tp - min(initializer_list<_Tp>); - - template - _GLIBCXX14_CONSTEXPR - _Tp - min(initializer_list<_Tp>, _Compare); - - template - _GLIBCXX14_CONSTEXPR - _Tp - max(initializer_list<_Tp>); - - template - _GLIBCXX14_CONSTEXPR - _Tp - max(initializer_list<_Tp>, _Compare); - - template - _GLIBCXX14_CONSTEXPR - pair<_Tp, _Tp> - minmax(initializer_list<_Tp>); - - template - _GLIBCXX14_CONSTEXPR - pair<_Tp, _Tp> - minmax(initializer_list<_Tp>, _Compare); -#endif - - // mismatch - - template - bool - next_permutation(_BIter, _BIter); - - template - bool - next_permutation(_BIter, _BIter, _Compare); - -#if __cplusplus >= 201103L - template - bool - none_of(_IIter, _IIter, _Predicate); -#endif - - // nth_element - // partial_sort - - template - _RAIter - partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter); - - template - _RAIter - partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter, _Compare); - - // partition - -#if __cplusplus >= 201103L - template - pair<_OIter1, _OIter2> - partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate); - - template - _FIter - partition_point(_FIter, _FIter, _Predicate); -#endif - - template - void - pop_heap(_RAIter, _RAIter); - - template - void - pop_heap(_RAIter, _RAIter, _Compare); - - template - bool - prev_permutation(_BIter, _BIter); - - template - bool - prev_permutation(_BIter, _BIter, _Compare); - - template - void - push_heap(_RAIter, _RAIter); - - template - void - push_heap(_RAIter, _RAIter, _Compare); - - // random_shuffle - - template - _FIter - remove(_FIter, _FIter, const _Tp&); - - template - _FIter - remove_if(_FIter, _FIter, _Predicate); - - template - _OIter - remove_copy(_IIter, _IIter, _OIter, const _Tp&); - - template - _OIter - remove_copy_if(_IIter, _IIter, _OIter, _Predicate); - - // replace - - template - _OIter - replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&); - - template - _OIter - replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&); - - // replace_if - - template - void - reverse(_BIter, _BIter); - - template - _OIter - reverse_copy(_BIter, _BIter, _OIter); - - inline namespace _V2 - { - template - _FIter - rotate(_FIter, _FIter, _FIter); - } - - template - _OIter - rotate_copy(_FIter, _FIter, _FIter, _OIter); - - // search - // search_n - // set_difference - // set_intersection - // set_symmetric_difference - // set_union - -#if (__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99_STDINT_TR1) - template - void - shuffle(_RAIter, _RAIter, _UGenerator&&); -#endif - - template - void - sort_heap(_RAIter, _RAIter); - - template - void - sort_heap(_RAIter, _RAIter, _Compare); - - template - _BIter - stable_partition(_BIter, _BIter, _Predicate); - - template - void - swap(_Tp&, _Tp&) -#if __cplusplus >= 201103L - noexcept(__and_, - is_nothrow_move_assignable<_Tp>>::value) -#endif - ; - - template - void - swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) -#if __cplusplus >= 201103L - noexcept(noexcept(swap(*__a, *__b))) -#endif - ; - - template - _FIter2 - swap_ranges(_FIter1, _FIter1, _FIter2); - - // transform - - template - _FIter - unique(_FIter, _FIter); - - template - _FIter - unique(_FIter, _FIter, _BinaryPredicate); - - // unique_copy - - template - _FIter - upper_bound(_FIter, _FIter, const _Tp&); - - template - _FIter - upper_bound(_FIter, _FIter, const _Tp&, _Compare); - -_GLIBCXX_END_NAMESPACE_VERSION - -_GLIBCXX_BEGIN_NAMESPACE_ALGO - - template - _FIter - adjacent_find(_FIter, _FIter); - - template - _FIter - adjacent_find(_FIter, _FIter, _BinaryPredicate); - - template - typename iterator_traits<_IIter>::difference_type - count(_IIter, _IIter, const _Tp&); - - template - typename iterator_traits<_IIter>::difference_type - count_if(_IIter, _IIter, _Predicate); - - template - bool - equal(_IIter1, _IIter1, _IIter2); - - template - bool - equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate); - - template - _IIter - find(_IIter, _IIter, const _Tp&); - - template - _FIter1 - find_first_of(_FIter1, _FIter1, _FIter2, _FIter2); - - template - _FIter1 - find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); - - template - _IIter - find_if(_IIter, _IIter, _Predicate); - - template - _Funct - for_each(_IIter, _IIter, _Funct); - - template - void - generate(_FIter, _FIter, _Generator); - - template - _OIter - generate_n(_OIter, _Size, _Generator); - - template - bool - lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2); - - template - bool - lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); - - template - _GLIBCXX14_CONSTEXPR - _FIter - max_element(_FIter, _FIter); - - template - _GLIBCXX14_CONSTEXPR - _FIter - max_element(_FIter, _FIter, _Compare); - - template - _OIter - merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); - - template - _OIter - merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); - - template - _GLIBCXX14_CONSTEXPR - _FIter - min_element(_FIter, _FIter); - - template - _GLIBCXX14_CONSTEXPR - _FIter - min_element(_FIter, _FIter, _Compare); - - template - pair<_IIter1, _IIter2> - mismatch(_IIter1, _IIter1, _IIter2); - - template - pair<_IIter1, _IIter2> - mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate); - - template - void - nth_element(_RAIter, _RAIter, _RAIter); - - template - void - nth_element(_RAIter, _RAIter, _RAIter, _Compare); - - template - void - partial_sort(_RAIter, _RAIter, _RAIter); - - template - void - partial_sort(_RAIter, _RAIter, _RAIter, _Compare); - - template - _BIter - partition(_BIter, _BIter, _Predicate); - - template - void - random_shuffle(_RAIter, _RAIter); - - template - void - random_shuffle(_RAIter, _RAIter, -#if __cplusplus >= 201103L - _Generator&&); -#else - _Generator&); -#endif - - template - void - replace(_FIter, _FIter, const _Tp&, const _Tp&); - - template - void - replace_if(_FIter, _FIter, _Predicate, const _Tp&); - - template - _FIter1 - search(_FIter1, _FIter1, _FIter2, _FIter2); - - template - _FIter1 - search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); - - template - _FIter - search_n(_FIter, _FIter, _Size, const _Tp&); - - template - _FIter - search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate); - - template - _OIter - set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); - - template - _OIter - set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); - - template - _OIter - set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); - - template - _OIter - set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); - - template - _OIter - set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); - - template - _OIter - set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, - _OIter, _Compare); - - template - _OIter - set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); - - template - _OIter - set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); - - template - void - sort(_RAIter, _RAIter); - - template - void - sort(_RAIter, _RAIter, _Compare); - - template - void - stable_sort(_RAIter, _RAIter); - - template - void - stable_sort(_RAIter, _RAIter, _Compare); - - template - _OIter - transform(_IIter, _IIter, _OIter, _UnaryOperation); - - template - _OIter - transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation); - - template - _OIter - unique_copy(_IIter, _IIter, _OIter); - - template - _OIter - unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate); - -_GLIBCXX_END_NAMESPACE_ALGO -} // namespace std - -#ifdef _GLIBCXX_PARALLEL -# include -#endif - -#endif - diff --git a/openflow/usr/include/c++/5/bits/alloc_traits.h b/openflow/usr/include/c++/5/bits/alloc_traits.h deleted file mode 100644 index 615e071..0000000 --- a/openflow/usr/include/c++/5/bits/alloc_traits.h +++ /dev/null @@ -1,660 +0,0 @@ -// Allocator traits -*- C++ -*- - -// Copyright (C) 2011-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/alloc_traits.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _ALLOC_TRAITS_H -#define _ALLOC_TRAITS_H 1 - -#if __cplusplus >= 201103L - -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - class __alloctr_rebind_helper - { - template - static constexpr true_type - _S_chk(typename _Alloc2::template rebind<_Tp2>::other*); - - template - static constexpr false_type - _S_chk(...); - - public: - using __type = decltype(_S_chk<_Alloc, _Tp>(nullptr)); - }; - - template::__type::value> - struct __alloctr_rebind; - - template - struct __alloctr_rebind<_Alloc, _Tp, true> - { - typedef typename _Alloc::template rebind<_Tp>::other __type; - }; - - template class _Alloc, typename _Tp, - typename _Up, typename... _Args> - struct __alloctr_rebind<_Alloc<_Up, _Args...>, _Tp, false> - { - typedef _Alloc<_Tp, _Args...> __type; - }; - - template - using __alloc_rebind = typename __alloctr_rebind<_Alloc, _Tp>::__type; - - /** - * @brief Uniform interface to all allocator types. - * @ingroup allocators - */ - template - struct allocator_traits - { - /// The allocator type - typedef _Alloc allocator_type; - /// The allocated type - typedef typename _Alloc::value_type value_type; - -#define _GLIBCXX_ALLOC_TR_NESTED_TYPE(_NTYPE, _ALT) \ - private: \ - template \ - static typename _Tp::_NTYPE _S_##_NTYPE##_helper(_Tp*); \ - static _ALT _S_##_NTYPE##_helper(...); \ - typedef decltype(_S_##_NTYPE##_helper((_Alloc*)0)) __##_NTYPE; \ - public: - -_GLIBCXX_ALLOC_TR_NESTED_TYPE(pointer, value_type*) - - /** - * @brief The allocator's pointer type. - * - * @c Alloc::pointer if that type exists, otherwise @c value_type* - */ - typedef __pointer pointer; - -_GLIBCXX_ALLOC_TR_NESTED_TYPE(const_pointer, - typename pointer_traits::template rebind) - - /** - * @brief The allocator's const pointer type. - * - * @c Alloc::const_pointer if that type exists, otherwise - * pointer_traits::rebind - */ - typedef __const_pointer const_pointer; - -_GLIBCXX_ALLOC_TR_NESTED_TYPE(void_pointer, - typename pointer_traits::template rebind) - - /** - * @brief The allocator's void pointer type. - * - * @c Alloc::void_pointer if that type exists, otherwise - * pointer_traits::rebind - */ - typedef __void_pointer void_pointer; - -_GLIBCXX_ALLOC_TR_NESTED_TYPE(const_void_pointer, - typename pointer_traits::template rebind) - - /** - * @brief The allocator's const void pointer type. - * - * @c Alloc::const_void_pointer if that type exists, otherwise - * pointer_traits::rebind - */ - typedef __const_void_pointer const_void_pointer; - -_GLIBCXX_ALLOC_TR_NESTED_TYPE(difference_type, - typename pointer_traits::difference_type) - - /** - * @brief The allocator's difference type - * - * @c Alloc::difference_type if that type exists, otherwise - * pointer_traits::difference_type - */ - typedef __difference_type difference_type; - -_GLIBCXX_ALLOC_TR_NESTED_TYPE(size_type, - typename make_unsigned::type) - - /** - * @brief The allocator's size type - * - * @c Alloc::size_type if that type exists, otherwise - * make_unsigned::type - */ - typedef __size_type size_type; - -_GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_copy_assignment, - false_type) - - /** - * @brief How the allocator is propagated on copy assignment - * - * @c Alloc::propagate_on_container_copy_assignment if that type exists, - * otherwise @c false_type - */ - typedef __propagate_on_container_copy_assignment - propagate_on_container_copy_assignment; - -_GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_move_assignment, - false_type) - - /** - * @brief How the allocator is propagated on move assignment - * - * @c Alloc::propagate_on_container_move_assignment if that type exists, - * otherwise @c false_type - */ - typedef __propagate_on_container_move_assignment - propagate_on_container_move_assignment; - -_GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_swap, - false_type) - - /** - * @brief How the allocator is propagated on swap - * - * @c Alloc::propagate_on_container_swap if that type exists, - * otherwise @c false_type - */ - typedef __propagate_on_container_swap propagate_on_container_swap; - -#undef _GLIBCXX_ALLOC_TR_NESTED_TYPE - - template - using rebind_alloc = typename __alloctr_rebind<_Alloc, _Tp>::__type; - template - using rebind_traits = allocator_traits>; - - private: - template - struct __allocate_helper - { - template()->allocate( - std::declval(), - std::declval()))> - static true_type __test(int); - - template - static false_type __test(...); - - using type = decltype(__test<_Alloc>(0)); - }; - - template - using __has_allocate = typename __allocate_helper<_Alloc2>::type; - - template>> - static pointer - _S_allocate(_Alloc2& __a, size_type __n, const_void_pointer __hint) - { return __a.allocate(__n, __hint); } - - template>>> - static pointer - _S_allocate(_Alloc2& __a, size_type __n, _UnusedHint) - { return __a.allocate(__n); } - - template - struct __construct_helper - { - template()->construct( - std::declval<_Tp*>(), std::declval<_Args>()...))> - static true_type __test(int); - - template - static false_type __test(...); - - using type = decltype(__test<_Alloc>(0)); - }; - - template - using __has_construct - = typename __construct_helper<_Tp, _Args...>::type; - - template - static _Require<__has_construct<_Tp, _Args...>> - _S_construct(_Alloc& __a, _Tp* __p, _Args&&... __args) - { __a.construct(__p, std::forward<_Args>(__args)...); } - - template - static - _Require<__and_<__not_<__has_construct<_Tp, _Args...>>, - is_constructible<_Tp, _Args...>>> - _S_construct(_Alloc&, _Tp* __p, _Args&&... __args) - { ::new((void*)__p) _Tp(std::forward<_Args>(__args)...); } - - template - struct __destroy_helper - { - template()->destroy( - std::declval<_Tp*>()))> - static true_type __test(int); - - template - static false_type __test(...); - - using type = decltype(__test<_Alloc>(0)); - }; - - template - using __has_destroy = typename __destroy_helper<_Tp>::type; - - template - static _Require<__has_destroy<_Tp>> - _S_destroy(_Alloc& __a, _Tp* __p) - { __a.destroy(__p); } - - template - static _Require<__not_<__has_destroy<_Tp>>> - _S_destroy(_Alloc&, _Tp* __p) - { __p->~_Tp(); } - - template - struct __maxsize_helper - { - template()->max_size())> - static true_type __test(int); - - template - static false_type __test(...); - - using type = decltype(__test<_Alloc2>(0)); - }; - - template - using __has_max_size = typename __maxsize_helper<_Alloc2>::type; - - template>> - static size_type - _S_max_size(_Alloc2& __a, int) - { return __a.max_size(); } - - template>>> - static size_type - _S_max_size(_Alloc2&, ...) - { return __gnu_cxx::__numeric_traits::__max; } - - template - struct __select_helper - { - template() - ->select_on_container_copy_construction())> - static true_type __test(int); - - template - static false_type __test(...); - - using type = decltype(__test<_Alloc2>(0)); - }; - - template - using __has_soccc = typename __select_helper<_Alloc2>::type; - - template>> - static _Alloc2 - _S_select(_Alloc2& __a, int) - { return __a.select_on_container_copy_construction(); } - - template>>> - static _Alloc2 - _S_select(_Alloc2& __a, ...) - { return __a; } - - public: - - /** - * @brief Allocate memory. - * @param __a An allocator. - * @param __n The number of objects to allocate space for. - * - * Calls @c a.allocate(n) - */ - static pointer - allocate(_Alloc& __a, size_type __n) - { return __a.allocate(__n); } - - /** - * @brief Allocate memory. - * @param __a An allocator. - * @param __n The number of objects to allocate space for. - * @param __hint Aid to locality. - * @return Memory of suitable size and alignment for @a n objects - * of type @c value_type - * - * Returns a.allocate(n, hint) if that expression is - * well-formed, otherwise returns @c a.allocate(n) - */ - static pointer - allocate(_Alloc& __a, size_type __n, const_void_pointer __hint) - { return _S_allocate(__a, __n, __hint); } - - /** - * @brief Deallocate memory. - * @param __a An allocator. - * @param __p Pointer to the memory to deallocate. - * @param __n The number of objects space was allocated for. - * - * Calls a.deallocate(p, n) - */ - static void deallocate(_Alloc& __a, pointer __p, size_type __n) - { __a.deallocate(__p, __n); } - - /** - * @brief Construct an object of type @a _Tp - * @param __a An allocator. - * @param __p Pointer to memory of suitable size and alignment for Tp - * @param __args Constructor arguments. - * - * Calls __a.construct(__p, std::forward(__args)...) - * if that expression is well-formed, otherwise uses placement-new - * to construct an object of type @a _Tp at location @a __p from the - * arguments @a __args... - */ - template - static auto construct(_Alloc& __a, _Tp* __p, _Args&&... __args) - -> decltype(_S_construct(__a, __p, std::forward<_Args>(__args)...)) - { _S_construct(__a, __p, std::forward<_Args>(__args)...); } - - /** - * @brief Destroy an object of type @a _Tp - * @param __a An allocator. - * @param __p Pointer to the object to destroy - * - * Calls @c __a.destroy(__p) if that expression is well-formed, - * otherwise calls @c __p->~_Tp() - */ - template - static void destroy(_Alloc& __a, _Tp* __p) - { _S_destroy(__a, __p); } - - /** - * @brief The maximum supported allocation size - * @param __a An allocator. - * @return @c __a.max_size() or @c numeric_limits::max() - * - * Returns @c __a.max_size() if that expression is well-formed, - * otherwise returns @c numeric_limits::max() - */ - static size_type max_size(const _Alloc& __a) noexcept - { return _S_max_size(__a, 0); } - - /** - * @brief Obtain an allocator to use when copying a container. - * @param __rhs An allocator. - * @return @c __rhs.select_on_container_copy_construction() or @a __rhs - * - * Returns @c __rhs.select_on_container_copy_construction() if that - * expression is well-formed, otherwise returns @a __rhs - */ - static _Alloc - select_on_container_copy_construction(const _Alloc& __rhs) - { return _S_select(__rhs, 0); } - }; - - /// Partial specialization for std::allocator. - template - struct allocator_traits> - { - /// The allocator type - using allocator_type = allocator<_Tp>; - /// The allocated type - using value_type = _Tp; - - /// The allocator's pointer type. - using pointer = _Tp*; - - /// The allocator's const pointer type. - using const_pointer = const _Tp*; - - /// The allocator's void pointer type. - using void_pointer = void*; - - /// The allocator's const void pointer type. - using const_void_pointer = const void*; - - /// The allocator's difference type - using difference_type = std::ptrdiff_t; - - /// The allocator's size type - using size_type = std::size_t; - - /// How the allocator is propagated on copy assignment - using propagate_on_container_copy_assignment = false_type; - - /// How the allocator is propagated on move assignment - using propagate_on_container_move_assignment = true_type; - - /// How the allocator is propagated on swap - using propagate_on_container_swap = false_type; - - template - using rebind_alloc = allocator<_Up>; - - template - using rebind_traits = allocator_traits>; - - /** - * @brief Allocate memory. - * @param __a An allocator. - * @param __n The number of objects to allocate space for. - * - * Calls @c a.allocate(n) - */ - static pointer - allocate(allocator_type& __a, size_type __n) - { return __a.allocate(__n); } - - /** - * @brief Allocate memory. - * @param __a An allocator. - * @param __n The number of objects to allocate space for. - * @param __hint Aid to locality. - * @return Memory of suitable size and alignment for @a n objects - * of type @c value_type - * - * Returns a.allocate(n, hint) - */ - static pointer - allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) - { return __a.allocate(__n, __hint); } - - /** - * @brief Deallocate memory. - * @param __a An allocator. - * @param __p Pointer to the memory to deallocate. - * @param __n The number of objects space was allocated for. - * - * Calls a.deallocate(p, n) - */ - static void - deallocate(allocator_type& __a, pointer __p, size_type __n) - { __a.deallocate(__p, __n); } - - /** - * @brief Construct an object of type @a _Up - * @param __a An allocator. - * @param __p Pointer to memory of suitable size and alignment for Tp - * @param __args Constructor arguments. - * - * Calls __a.construct(__p, std::forward(__args)...) - */ - template - static void - construct(allocator_type& __a, _Up* __p, _Args&&... __args) - { __a.construct(__p, std::forward<_Args>(__args)...); } - - /** - * @brief Destroy an object of type @a _Up - * @param __a An allocator. - * @param __p Pointer to the object to destroy - * - * Calls @c __a.destroy(__p). - */ - template - static void - destroy(allocator_type& __a, _Up* __p) - { __a.destroy(__p); } - - /** - * @brief The maximum supported allocation size - * @param __a An allocator. - * @return @c __a.max_size() - */ - static size_type - max_size(const allocator_type& __a) noexcept - { return __a.max_size(); } - - /** - * @brief Obtain an allocator to use when copying a container. - * @param __rhs An allocator. - * @return @c __rhs - */ - static allocator_type - select_on_container_copy_construction(const allocator_type& __rhs) - { return __rhs; } - }; - - - template - inline void - __do_alloc_on_copy(_Alloc& __one, const _Alloc& __two, true_type) - { __one = __two; } - - template - inline void - __do_alloc_on_copy(_Alloc&, const _Alloc&, false_type) - { } - - template - inline void __alloc_on_copy(_Alloc& __one, const _Alloc& __two) - { - typedef allocator_traits<_Alloc> __traits; - typedef typename __traits::propagate_on_container_copy_assignment __pocca; - __do_alloc_on_copy(__one, __two, __pocca()); - } - - template - inline _Alloc __alloc_on_copy(const _Alloc& __a) - { - typedef allocator_traits<_Alloc> __traits; - return __traits::select_on_container_copy_construction(__a); - } - - template - inline void __do_alloc_on_move(_Alloc& __one, _Alloc& __two, true_type) - { __one = std::move(__two); } - - template - inline void __do_alloc_on_move(_Alloc&, _Alloc&, false_type) - { } - - template - inline void __alloc_on_move(_Alloc& __one, _Alloc& __two) - { - typedef allocator_traits<_Alloc> __traits; - typedef typename __traits::propagate_on_container_move_assignment __pocma; - __do_alloc_on_move(__one, __two, __pocma()); - } - - template - inline void __do_alloc_on_swap(_Alloc& __one, _Alloc& __two, true_type) - { - using std::swap; - swap(__one, __two); - } - - template - inline void __do_alloc_on_swap(_Alloc&, _Alloc&, false_type) - { } - - template - inline void __alloc_on_swap(_Alloc& __one, _Alloc& __two) - { - typedef allocator_traits<_Alloc> __traits; - typedef typename __traits::propagate_on_container_swap __pocs; - __do_alloc_on_swap(__one, __two, __pocs()); - } - - template - class __is_copy_insertable_impl - { - typedef allocator_traits<_Alloc> _Traits; - - template(), - std::declval<_Up*>(), - std::declval()))> - static true_type - _M_select(int); - - template - static false_type - _M_select(...); - - public: - typedef decltype(_M_select(0)) type; - }; - - // true if _Alloc::value_type is CopyInsertable into containers using _Alloc - template - struct __is_copy_insertable - : __is_copy_insertable_impl<_Alloc>::type - { }; - - // std::allocator<_Tp> just requires CopyConstructible - template - struct __is_copy_insertable> - : is_copy_constructible<_Tp> - { }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif -#endif diff --git a/openflow/usr/include/c++/5/bits/allocated_ptr.h b/openflow/usr/include/c++/5/bits/allocated_ptr.h deleted file mode 100644 index 63088c2..0000000 --- a/openflow/usr/include/c++/5/bits/allocated_ptr.h +++ /dev/null @@ -1,109 +0,0 @@ -// Guarded Allocation -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/allocated_ptr.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _ALLOCATED_PTR_H -#define _ALLOCATED_PTR_H 1 - -#if __cplusplus < 201103L -# include -#else -# include -# include -# include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /// Non-standard RAII type for managing pointers obtained from allocators. - template - struct __allocated_ptr - { - using pointer = typename allocator_traits<_Alloc>::pointer; - using value_type = typename allocator_traits<_Alloc>::value_type; - - /// Take ownership of __ptr - __allocated_ptr(_Alloc& __a, pointer __ptr) noexcept - : _M_alloc(&__a), _M_ptr(__ptr) - { } - - /// Convert __ptr to allocator's pointer type and take ownership of it - template>> - __allocated_ptr(_Alloc& __a, _Ptr __ptr) - : _M_alloc(&__a), _M_ptr(pointer_traits::pointer_to(*__ptr)) - { } - - /// Transfer ownership of the owned pointer - __allocated_ptr(__allocated_ptr&& __gd) noexcept - : _M_alloc(__gd._M_alloc), _M_ptr(__gd._M_ptr) - { __gd._M_ptr = nullptr; } - - /// Deallocate the owned pointer - ~__allocated_ptr() - { - if (_M_ptr != nullptr) - std::allocator_traits<_Alloc>::deallocate(*_M_alloc, _M_ptr, 1); - } - - /// Release ownership of the owned pointer - __allocated_ptr& - operator=(std::nullptr_t) noexcept - { - _M_ptr = nullptr; - return *this; - } - - /// Get the address that the owned pointer refers to. - value_type* get() { return _S_raw_ptr(_M_ptr); } - - private: - value_type* _S_raw_ptr(value_type* __ptr) { return __ptr; } - - template - auto _S_raw_ptr(_Ptr __ptr) -> decltype(_S_raw_ptr(__ptr.operator->())) - { return _S_raw_ptr(__ptr.operator->()); } - - _Alloc* _M_alloc; - pointer _M_ptr; - }; - - /// Allocate space for a single object using __a - template - __allocated_ptr<_Alloc> - __allocate_guarded(_Alloc& __a) - { - return { __a, std::allocator_traits<_Alloc>::allocate(__a, 1) }; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif -#endif diff --git a/openflow/usr/include/c++/5/bits/allocator.h b/openflow/usr/include/c++/5/bits/allocator.h deleted file mode 100644 index 6057315..0000000 --- a/openflow/usr/include/c++/5/bits/allocator.h +++ /dev/null @@ -1,229 +0,0 @@ -// Allocators -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * Copyright (c) 1996-1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/allocator.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _ALLOCATOR_H -#define _ALLOCATOR_H 1 - -#include // Define the base class to std::allocator. -#include -#if __cplusplus >= 201103L -#include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup allocators - * @{ - */ - - /// allocator specialization. - template<> - class allocator - { - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; - - template - struct rebind - { typedef allocator<_Tp1> other; }; - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2103. std::allocator propagate_on_container_move_assignment - typedef true_type propagate_on_container_move_assignment; -#endif - }; - - /** - * @brief The @a standard allocator, as per [20.4]. - * - * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/memory.html#std.util.memory.allocator - * for further details. - * - * @tparam _Tp Type of allocated object. - */ - template - class allocator: public __allocator_base<_Tp> - { - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - - template - struct rebind - { typedef allocator<_Tp1> other; }; - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2103. std::allocator propagate_on_container_move_assignment - typedef true_type propagate_on_container_move_assignment; -#endif - - allocator() throw() { } - - allocator(const allocator& __a) throw() - : __allocator_base<_Tp>(__a) { } - - template - allocator(const allocator<_Tp1>&) throw() { } - - ~allocator() throw() { } - - // Inherit everything else. - }; - - template - inline bool - operator==(const allocator<_T1>&, const allocator<_T2>&) - _GLIBCXX_USE_NOEXCEPT - { return true; } - - template - inline bool - operator==(const allocator<_Tp>&, const allocator<_Tp>&) - _GLIBCXX_USE_NOEXCEPT - { return true; } - - template - inline bool - operator!=(const allocator<_T1>&, const allocator<_T2>&) - _GLIBCXX_USE_NOEXCEPT - { return false; } - - template - inline bool - operator!=(const allocator<_Tp>&, const allocator<_Tp>&) - _GLIBCXX_USE_NOEXCEPT - { return false; } - - /// @} group allocator - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template class allocator; - extern template class allocator; -#endif - - // Undefine. -#undef __allocator_base - - // To implement Option 3 of DR 431. - template - struct __alloc_swap - { static void _S_do_it(_Alloc&, _Alloc&) _GLIBCXX_NOEXCEPT { } }; - - template - struct __alloc_swap<_Alloc, false> - { - static void - _S_do_it(_Alloc& __one, _Alloc& __two) _GLIBCXX_NOEXCEPT - { - // Precondition: swappable allocators. - if (__one != __two) - swap(__one, __two); - } - }; - - // Optimize for stateless allocators. - template - struct __alloc_neq - { - static bool - _S_do_it(const _Alloc&, const _Alloc&) - { return false; } - }; - - template - struct __alloc_neq<_Alloc, false> - { - static bool - _S_do_it(const _Alloc& __one, const _Alloc& __two) - { return __one != __two; } - }; - -#if __cplusplus >= 201103L - template, - is_nothrow_move_constructible>::value> - struct __shrink_to_fit_aux - { static bool _S_do_it(_Tp&) noexcept { return false; } }; - - template - struct __shrink_to_fit_aux<_Tp, true> - { - static bool - _S_do_it(_Tp& __c) noexcept - { -#if __cpp_exceptions - try - { - _Tp(__make_move_if_noexcept_iterator(__c.begin()), - __make_move_if_noexcept_iterator(__c.end()), - __c.get_allocator()).swap(__c); - return true; - } - catch(...) - { return false; } -#else - return false; -#endif - } - }; -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/atomic_base.h b/openflow/usr/include/c++/5/bits/atomic_base.h deleted file mode 100644 index 75a7ca7..0000000 --- a/openflow/usr/include/c++/5/bits/atomic_base.h +++ /dev/null @@ -1,796 +0,0 @@ -// -*- C++ -*- header. - -// Copyright (C) 2008-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/atomic_base.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{atomic} - */ - -#ifndef _GLIBCXX_ATOMIC_BASE_H -#define _GLIBCXX_ATOMIC_BASE_H 1 - -#pragma GCC system_header - -#include -#include -#include - -#ifndef _GLIBCXX_ALWAYS_INLINE -#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @defgroup atomics Atomics - * - * Components for performing atomic operations. - * @{ - */ - - /// Enumeration for memory_order - typedef enum memory_order - { - memory_order_relaxed, - memory_order_consume, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst - } memory_order; - - enum __memory_order_modifier - { - __memory_order_mask = 0x0ffff, - __memory_order_modifier_mask = 0xffff0000, - __memory_order_hle_acquire = 0x10000, - __memory_order_hle_release = 0x20000 - }; - - constexpr memory_order - operator|(memory_order __m, __memory_order_modifier __mod) - { - return memory_order(__m | int(__mod)); - } - - constexpr memory_order - operator&(memory_order __m, __memory_order_modifier __mod) - { - return memory_order(__m & int(__mod)); - } - - // Drop release ordering as per [atomics.types.operations.req]/21 - constexpr memory_order - __cmpexch_failure_order2(memory_order __m) noexcept - { - return __m == memory_order_acq_rel ? memory_order_acquire - : __m == memory_order_release ? memory_order_relaxed : __m; - } - - constexpr memory_order - __cmpexch_failure_order(memory_order __m) noexcept - { - return memory_order(__cmpexch_failure_order2(__m & __memory_order_mask) - | (__m & __memory_order_modifier_mask)); - } - - _GLIBCXX_ALWAYS_INLINE void - atomic_thread_fence(memory_order __m) noexcept - { __atomic_thread_fence(__m); } - - _GLIBCXX_ALWAYS_INLINE void - atomic_signal_fence(memory_order __m) noexcept - { __atomic_signal_fence(__m); } - - /// kill_dependency - template - inline _Tp - kill_dependency(_Tp __y) noexcept - { - _Tp __ret(__y); - return __ret; - } - - - // Base types for atomics. - template - struct __atomic_base; - - -#define ATOMIC_VAR_INIT(_VI) { _VI } - - template - struct atomic; - - template - struct atomic<_Tp*>; - - /* The target's "set" value for test-and-set may not be exactly 1. */ -#if __GCC_ATOMIC_TEST_AND_SET_TRUEVAL == 1 - typedef bool __atomic_flag_data_type; -#else - typedef unsigned char __atomic_flag_data_type; -#endif - - /** - * @brief Base type for atomic_flag. - * - * Base type is POD with data, allowing atomic_flag to derive from - * it and meet the standard layout type requirement. In addition to - * compatibility with a C interface, this allows different - * implementations of atomic_flag to use the same atomic operation - * functions, via a standard conversion to the __atomic_flag_base - * argument. - */ - _GLIBCXX_BEGIN_EXTERN_C - - struct __atomic_flag_base - { - __atomic_flag_data_type _M_i; - }; - - _GLIBCXX_END_EXTERN_C - -#define ATOMIC_FLAG_INIT { 0 } - - /// atomic_flag - struct atomic_flag : public __atomic_flag_base - { - atomic_flag() noexcept = default; - ~atomic_flag() noexcept = default; - atomic_flag(const atomic_flag&) = delete; - atomic_flag& operator=(const atomic_flag&) = delete; - atomic_flag& operator=(const atomic_flag&) volatile = delete; - - // Conversion to ATOMIC_FLAG_INIT. - constexpr atomic_flag(bool __i) noexcept - : __atomic_flag_base{ _S_init(__i) } - { } - - _GLIBCXX_ALWAYS_INLINE bool - test_and_set(memory_order __m = memory_order_seq_cst) noexcept - { - return __atomic_test_and_set (&_M_i, __m); - } - - _GLIBCXX_ALWAYS_INLINE bool - test_and_set(memory_order __m = memory_order_seq_cst) volatile noexcept - { - return __atomic_test_and_set (&_M_i, __m); - } - - _GLIBCXX_ALWAYS_INLINE void - clear(memory_order __m = memory_order_seq_cst) noexcept - { - memory_order __b = __m & __memory_order_mask; - __glibcxx_assert(__b != memory_order_consume); - __glibcxx_assert(__b != memory_order_acquire); - __glibcxx_assert(__b != memory_order_acq_rel); - - __atomic_clear (&_M_i, __m); - } - - _GLIBCXX_ALWAYS_INLINE void - clear(memory_order __m = memory_order_seq_cst) volatile noexcept - { - memory_order __b = __m & __memory_order_mask; - __glibcxx_assert(__b != memory_order_consume); - __glibcxx_assert(__b != memory_order_acquire); - __glibcxx_assert(__b != memory_order_acq_rel); - - __atomic_clear (&_M_i, __m); - } - - private: - static constexpr __atomic_flag_data_type - _S_init(bool __i) - { return __i ? __GCC_ATOMIC_TEST_AND_SET_TRUEVAL : 0; } - }; - - - /// Base class for atomic integrals. - // - // For each of the integral types, define atomic_[integral type] struct - // - // atomic_bool bool - // atomic_char char - // atomic_schar signed char - // atomic_uchar unsigned char - // atomic_short short - // atomic_ushort unsigned short - // atomic_int int - // atomic_uint unsigned int - // atomic_long long - // atomic_ulong unsigned long - // atomic_llong long long - // atomic_ullong unsigned long long - // atomic_char16_t char16_t - // atomic_char32_t char32_t - // atomic_wchar_t wchar_t - // - // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or - // 8 bytes, since that is what GCC built-in functions for atomic - // memory access expect. - template - struct __atomic_base - { - private: - typedef _ITp __int_type; - - static constexpr int _S_alignment = - sizeof(_ITp) > alignof(_ITp) ? sizeof(_ITp) : alignof(_ITp); - - alignas(_S_alignment) __int_type _M_i; - - public: - __atomic_base() noexcept = default; - ~__atomic_base() noexcept = default; - __atomic_base(const __atomic_base&) = delete; - __atomic_base& operator=(const __atomic_base&) = delete; - __atomic_base& operator=(const __atomic_base&) volatile = delete; - - // Requires __int_type convertible to _M_i. - constexpr __atomic_base(__int_type __i) noexcept : _M_i (__i) { } - - operator __int_type() const noexcept - { return load(); } - - operator __int_type() const volatile noexcept - { return load(); } - - __int_type - operator=(__int_type __i) noexcept - { - store(__i); - return __i; - } - - __int_type - operator=(__int_type __i) volatile noexcept - { - store(__i); - return __i; - } - - __int_type - operator++(int) noexcept - { return fetch_add(1); } - - __int_type - operator++(int) volatile noexcept - { return fetch_add(1); } - - __int_type - operator--(int) noexcept - { return fetch_sub(1); } - - __int_type - operator--(int) volatile noexcept - { return fetch_sub(1); } - - __int_type - operator++() noexcept - { return __atomic_add_fetch(&_M_i, 1, memory_order_seq_cst); } - - __int_type - operator++() volatile noexcept - { return __atomic_add_fetch(&_M_i, 1, memory_order_seq_cst); } - - __int_type - operator--() noexcept - { return __atomic_sub_fetch(&_M_i, 1, memory_order_seq_cst); } - - __int_type - operator--() volatile noexcept - { return __atomic_sub_fetch(&_M_i, 1, memory_order_seq_cst); } - - __int_type - operator+=(__int_type __i) noexcept - { return __atomic_add_fetch(&_M_i, __i, memory_order_seq_cst); } - - __int_type - operator+=(__int_type __i) volatile noexcept - { return __atomic_add_fetch(&_M_i, __i, memory_order_seq_cst); } - - __int_type - operator-=(__int_type __i) noexcept - { return __atomic_sub_fetch(&_M_i, __i, memory_order_seq_cst); } - - __int_type - operator-=(__int_type __i) volatile noexcept - { return __atomic_sub_fetch(&_M_i, __i, memory_order_seq_cst); } - - __int_type - operator&=(__int_type __i) noexcept - { return __atomic_and_fetch(&_M_i, __i, memory_order_seq_cst); } - - __int_type - operator&=(__int_type __i) volatile noexcept - { return __atomic_and_fetch(&_M_i, __i, memory_order_seq_cst); } - - __int_type - operator|=(__int_type __i) noexcept - { return __atomic_or_fetch(&_M_i, __i, memory_order_seq_cst); } - - __int_type - operator|=(__int_type __i) volatile noexcept - { return __atomic_or_fetch(&_M_i, __i, memory_order_seq_cst); } - - __int_type - operator^=(__int_type __i) noexcept - { return __atomic_xor_fetch(&_M_i, __i, memory_order_seq_cst); } - - __int_type - operator^=(__int_type __i) volatile noexcept - { return __atomic_xor_fetch(&_M_i, __i, memory_order_seq_cst); } - - bool - is_lock_free() const noexcept - { - // Use a fake, minimally aligned pointer. - return __atomic_is_lock_free(sizeof(_M_i), - reinterpret_cast(-__alignof(_M_i))); - } - - bool - is_lock_free() const volatile noexcept - { - // Use a fake, minimally aligned pointer. - return __atomic_is_lock_free(sizeof(_M_i), - reinterpret_cast(-__alignof(_M_i))); - } - - _GLIBCXX_ALWAYS_INLINE void - store(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept - { - memory_order __b = __m & __memory_order_mask; - __glibcxx_assert(__b != memory_order_acquire); - __glibcxx_assert(__b != memory_order_acq_rel); - __glibcxx_assert(__b != memory_order_consume); - - __atomic_store_n(&_M_i, __i, __m); - } - - _GLIBCXX_ALWAYS_INLINE void - store(__int_type __i, - memory_order __m = memory_order_seq_cst) volatile noexcept - { - memory_order __b = __m & __memory_order_mask; - __glibcxx_assert(__b != memory_order_acquire); - __glibcxx_assert(__b != memory_order_acq_rel); - __glibcxx_assert(__b != memory_order_consume); - - __atomic_store_n(&_M_i, __i, __m); - } - - _GLIBCXX_ALWAYS_INLINE __int_type - load(memory_order __m = memory_order_seq_cst) const noexcept - { - memory_order __b = __m & __memory_order_mask; - __glibcxx_assert(__b != memory_order_release); - __glibcxx_assert(__b != memory_order_acq_rel); - - return __atomic_load_n(&_M_i, __m); - } - - _GLIBCXX_ALWAYS_INLINE __int_type - load(memory_order __m = memory_order_seq_cst) const volatile noexcept - { - memory_order __b = __m & __memory_order_mask; - __glibcxx_assert(__b != memory_order_release); - __glibcxx_assert(__b != memory_order_acq_rel); - - return __atomic_load_n(&_M_i, __m); - } - - _GLIBCXX_ALWAYS_INLINE __int_type - exchange(__int_type __i, - memory_order __m = memory_order_seq_cst) noexcept - { - return __atomic_exchange_n(&_M_i, __i, __m); - } - - - _GLIBCXX_ALWAYS_INLINE __int_type - exchange(__int_type __i, - memory_order __m = memory_order_seq_cst) volatile noexcept - { - return __atomic_exchange_n(&_M_i, __i, __m); - } - - _GLIBCXX_ALWAYS_INLINE bool - compare_exchange_weak(__int_type& __i1, __int_type __i2, - memory_order __m1, memory_order __m2) noexcept - { - memory_order __b2 = __m2 & __memory_order_mask; - memory_order __b1 = __m1 & __memory_order_mask; - __glibcxx_assert(__b2 != memory_order_release); - __glibcxx_assert(__b2 != memory_order_acq_rel); - __glibcxx_assert(__b2 <= __b1); - - return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 1, __m1, __m2); - } - - _GLIBCXX_ALWAYS_INLINE bool - compare_exchange_weak(__int_type& __i1, __int_type __i2, - memory_order __m1, - memory_order __m2) volatile noexcept - { - memory_order __b2 = __m2 & __memory_order_mask; - memory_order __b1 = __m1 & __memory_order_mask; - __glibcxx_assert(__b2 != memory_order_release); - __glibcxx_assert(__b2 != memory_order_acq_rel); - __glibcxx_assert(__b2 <= __b1); - - return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 1, __m1, __m2); - } - - _GLIBCXX_ALWAYS_INLINE bool - compare_exchange_weak(__int_type& __i1, __int_type __i2, - memory_order __m = memory_order_seq_cst) noexcept - { - return compare_exchange_weak(__i1, __i2, __m, - __cmpexch_failure_order(__m)); - } - - _GLIBCXX_ALWAYS_INLINE bool - compare_exchange_weak(__int_type& __i1, __int_type __i2, - memory_order __m = memory_order_seq_cst) volatile noexcept - { - return compare_exchange_weak(__i1, __i2, __m, - __cmpexch_failure_order(__m)); - } - - _GLIBCXX_ALWAYS_INLINE bool - compare_exchange_strong(__int_type& __i1, __int_type __i2, - memory_order __m1, memory_order __m2) noexcept - { - memory_order __b2 = __m2 & __memory_order_mask; - memory_order __b1 = __m1 & __memory_order_mask; - __glibcxx_assert(__b2 != memory_order_release); - __glibcxx_assert(__b2 != memory_order_acq_rel); - __glibcxx_assert(__b2 <= __b1); - - return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 0, __m1, __m2); - } - - _GLIBCXX_ALWAYS_INLINE bool - compare_exchange_strong(__int_type& __i1, __int_type __i2, - memory_order __m1, - memory_order __m2) volatile noexcept - { - memory_order __b2 = __m2 & __memory_order_mask; - memory_order __b1 = __m1 & __memory_order_mask; - - __glibcxx_assert(__b2 != memory_order_release); - __glibcxx_assert(__b2 != memory_order_acq_rel); - __glibcxx_assert(__b2 <= __b1); - - return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 0, __m1, __m2); - } - - _GLIBCXX_ALWAYS_INLINE bool - compare_exchange_strong(__int_type& __i1, __int_type __i2, - memory_order __m = memory_order_seq_cst) noexcept - { - return compare_exchange_strong(__i1, __i2, __m, - __cmpexch_failure_order(__m)); - } - - _GLIBCXX_ALWAYS_INLINE bool - compare_exchange_strong(__int_type& __i1, __int_type __i2, - memory_order __m = memory_order_seq_cst) volatile noexcept - { - return compare_exchange_strong(__i1, __i2, __m, - __cmpexch_failure_order(__m)); - } - - _GLIBCXX_ALWAYS_INLINE __int_type - fetch_add(__int_type __i, - memory_order __m = memory_order_seq_cst) noexcept - { return __atomic_fetch_add(&_M_i, __i, __m); } - - _GLIBCXX_ALWAYS_INLINE __int_type - fetch_add(__int_type __i, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return __atomic_fetch_add(&_M_i, __i, __m); } - - _GLIBCXX_ALWAYS_INLINE __int_type - fetch_sub(__int_type __i, - memory_order __m = memory_order_seq_cst) noexcept - { return __atomic_fetch_sub(&_M_i, __i, __m); } - - _GLIBCXX_ALWAYS_INLINE __int_type - fetch_sub(__int_type __i, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return __atomic_fetch_sub(&_M_i, __i, __m); } - - _GLIBCXX_ALWAYS_INLINE __int_type - fetch_and(__int_type __i, - memory_order __m = memory_order_seq_cst) noexcept - { return __atomic_fetch_and(&_M_i, __i, __m); } - - _GLIBCXX_ALWAYS_INLINE __int_type - fetch_and(__int_type __i, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return __atomic_fetch_and(&_M_i, __i, __m); } - - _GLIBCXX_ALWAYS_INLINE __int_type - fetch_or(__int_type __i, - memory_order __m = memory_order_seq_cst) noexcept - { return __atomic_fetch_or(&_M_i, __i, __m); } - - _GLIBCXX_ALWAYS_INLINE __int_type - fetch_or(__int_type __i, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return __atomic_fetch_or(&_M_i, __i, __m); } - - _GLIBCXX_ALWAYS_INLINE __int_type - fetch_xor(__int_type __i, - memory_order __m = memory_order_seq_cst) noexcept - { return __atomic_fetch_xor(&_M_i, __i, __m); } - - _GLIBCXX_ALWAYS_INLINE __int_type - fetch_xor(__int_type __i, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return __atomic_fetch_xor(&_M_i, __i, __m); } - }; - - - /// Partial specialization for pointer types. - template - struct __atomic_base<_PTp*> - { - private: - typedef _PTp* __pointer_type; - - __pointer_type _M_p; - - // Factored out to facilitate explicit specialization. - constexpr ptrdiff_t - _M_type_size(ptrdiff_t __d) const { return __d * sizeof(_PTp); } - - constexpr ptrdiff_t - _M_type_size(ptrdiff_t __d) const volatile { return __d * sizeof(_PTp); } - - public: - __atomic_base() noexcept = default; - ~__atomic_base() noexcept = default; - __atomic_base(const __atomic_base&) = delete; - __atomic_base& operator=(const __atomic_base&) = delete; - __atomic_base& operator=(const __atomic_base&) volatile = delete; - - // Requires __pointer_type convertible to _M_p. - constexpr __atomic_base(__pointer_type __p) noexcept : _M_p (__p) { } - - operator __pointer_type() const noexcept - { return load(); } - - operator __pointer_type() const volatile noexcept - { return load(); } - - __pointer_type - operator=(__pointer_type __p) noexcept - { - store(__p); - return __p; - } - - __pointer_type - operator=(__pointer_type __p) volatile noexcept - { - store(__p); - return __p; - } - - __pointer_type - operator++(int) noexcept - { return fetch_add(1); } - - __pointer_type - operator++(int) volatile noexcept - { return fetch_add(1); } - - __pointer_type - operator--(int) noexcept - { return fetch_sub(1); } - - __pointer_type - operator--(int) volatile noexcept - { return fetch_sub(1); } - - __pointer_type - operator++() noexcept - { return __atomic_add_fetch(&_M_p, _M_type_size(1), - memory_order_seq_cst); } - - __pointer_type - operator++() volatile noexcept - { return __atomic_add_fetch(&_M_p, _M_type_size(1), - memory_order_seq_cst); } - - __pointer_type - operator--() noexcept - { return __atomic_sub_fetch(&_M_p, _M_type_size(1), - memory_order_seq_cst); } - - __pointer_type - operator--() volatile noexcept - { return __atomic_sub_fetch(&_M_p, _M_type_size(1), - memory_order_seq_cst); } - - __pointer_type - operator+=(ptrdiff_t __d) noexcept - { return __atomic_add_fetch(&_M_p, _M_type_size(__d), - memory_order_seq_cst); } - - __pointer_type - operator+=(ptrdiff_t __d) volatile noexcept - { return __atomic_add_fetch(&_M_p, _M_type_size(__d), - memory_order_seq_cst); } - - __pointer_type - operator-=(ptrdiff_t __d) noexcept - { return __atomic_sub_fetch(&_M_p, _M_type_size(__d), - memory_order_seq_cst); } - - __pointer_type - operator-=(ptrdiff_t __d) volatile noexcept - { return __atomic_sub_fetch(&_M_p, _M_type_size(__d), - memory_order_seq_cst); } - - bool - is_lock_free() const noexcept - { - // Produce a fake, minimally aligned pointer. - return __atomic_is_lock_free(sizeof(_M_p), - reinterpret_cast(-__alignof(_M_p))); - } - - bool - is_lock_free() const volatile noexcept - { - // Produce a fake, minimally aligned pointer. - return __atomic_is_lock_free(sizeof(_M_p), - reinterpret_cast(-__alignof(_M_p))); - } - - _GLIBCXX_ALWAYS_INLINE void - store(__pointer_type __p, - memory_order __m = memory_order_seq_cst) noexcept - { - memory_order __b = __m & __memory_order_mask; - - __glibcxx_assert(__b != memory_order_acquire); - __glibcxx_assert(__b != memory_order_acq_rel); - __glibcxx_assert(__b != memory_order_consume); - - __atomic_store_n(&_M_p, __p, __m); - } - - _GLIBCXX_ALWAYS_INLINE void - store(__pointer_type __p, - memory_order __m = memory_order_seq_cst) volatile noexcept - { - memory_order __b = __m & __memory_order_mask; - __glibcxx_assert(__b != memory_order_acquire); - __glibcxx_assert(__b != memory_order_acq_rel); - __glibcxx_assert(__b != memory_order_consume); - - __atomic_store_n(&_M_p, __p, __m); - } - - _GLIBCXX_ALWAYS_INLINE __pointer_type - load(memory_order __m = memory_order_seq_cst) const noexcept - { - memory_order __b = __m & __memory_order_mask; - __glibcxx_assert(__b != memory_order_release); - __glibcxx_assert(__b != memory_order_acq_rel); - - return __atomic_load_n(&_M_p, __m); - } - - _GLIBCXX_ALWAYS_INLINE __pointer_type - load(memory_order __m = memory_order_seq_cst) const volatile noexcept - { - memory_order __b = __m & __memory_order_mask; - __glibcxx_assert(__b != memory_order_release); - __glibcxx_assert(__b != memory_order_acq_rel); - - return __atomic_load_n(&_M_p, __m); - } - - _GLIBCXX_ALWAYS_INLINE __pointer_type - exchange(__pointer_type __p, - memory_order __m = memory_order_seq_cst) noexcept - { - return __atomic_exchange_n(&_M_p, __p, __m); - } - - - _GLIBCXX_ALWAYS_INLINE __pointer_type - exchange(__pointer_type __p, - memory_order __m = memory_order_seq_cst) volatile noexcept - { - return __atomic_exchange_n(&_M_p, __p, __m); - } - - _GLIBCXX_ALWAYS_INLINE bool - compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, - memory_order __m1, - memory_order __m2) noexcept - { - memory_order __b2 = __m2 & __memory_order_mask; - memory_order __b1 = __m1 & __memory_order_mask; - __glibcxx_assert(__b2 != memory_order_release); - __glibcxx_assert(__b2 != memory_order_acq_rel); - __glibcxx_assert(__b2 <= __b1); - - return __atomic_compare_exchange_n(&_M_p, &__p1, __p2, 0, __m1, __m2); - } - - _GLIBCXX_ALWAYS_INLINE bool - compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, - memory_order __m1, - memory_order __m2) volatile noexcept - { - memory_order __b2 = __m2 & __memory_order_mask; - memory_order __b1 = __m1 & __memory_order_mask; - - __glibcxx_assert(__b2 != memory_order_release); - __glibcxx_assert(__b2 != memory_order_acq_rel); - __glibcxx_assert(__b2 <= __b1); - - return __atomic_compare_exchange_n(&_M_p, &__p1, __p2, 0, __m1, __m2); - } - - _GLIBCXX_ALWAYS_INLINE __pointer_type - fetch_add(ptrdiff_t __d, - memory_order __m = memory_order_seq_cst) noexcept - { return __atomic_fetch_add(&_M_p, _M_type_size(__d), __m); } - - _GLIBCXX_ALWAYS_INLINE __pointer_type - fetch_add(ptrdiff_t __d, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return __atomic_fetch_add(&_M_p, _M_type_size(__d), __m); } - - _GLIBCXX_ALWAYS_INLINE __pointer_type - fetch_sub(ptrdiff_t __d, - memory_order __m = memory_order_seq_cst) noexcept - { return __atomic_fetch_sub(&_M_p, _M_type_size(__d), __m); } - - _GLIBCXX_ALWAYS_INLINE __pointer_type - fetch_sub(ptrdiff_t __d, - memory_order __m = memory_order_seq_cst) volatile noexcept - { return __atomic_fetch_sub(&_M_p, _M_type_size(__d), __m); } - }; - - // @} group atomics - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/atomic_futex.h b/openflow/usr/include/c++/5/bits/atomic_futex.h deleted file mode 100644 index 90317f2..0000000 --- a/openflow/usr/include/c++/5/bits/atomic_futex.h +++ /dev/null @@ -1,290 +0,0 @@ -// -*- C++ -*- header. - -// Copyright (C) 2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/atomic_futex.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. - */ - -#ifndef _GLIBCXX_ATOMIC_FUTEX_H -#define _GLIBCXX_ATOMIC_FUTEX_H 1 - -#pragma GCC system_header - -#include -#include -#include -#if ! (defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1) -#include -#include -#endif - -#ifndef _GLIBCXX_ALWAYS_INLINE -#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) -#if defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1 - struct __atomic_futex_unsigned_base - { - // Returns false iff a timeout occurred. - bool - _M_futex_wait_until(unsigned *__addr, unsigned __val, bool __has_timeout, - chrono::seconds __s, chrono::nanoseconds __ns); - - // This can be executed after the object has been destroyed. - static void _M_futex_notify_all(unsigned* __addr); - }; - - template - class __atomic_futex_unsigned : __atomic_futex_unsigned_base - { - typedef chrono::system_clock __clock_t; - - // This must be lock-free and at offset 0. - atomic _M_data; - - public: - explicit - __atomic_futex_unsigned(unsigned __data) : _M_data(__data) - { } - - _GLIBCXX_ALWAYS_INLINE unsigned - _M_load(memory_order __mo) - { - return _M_data.load(__mo) & ~_Waiter_bit; - } - - private: - // If a timeout occurs, returns a current value after the timeout; - // otherwise, returns the operand's value if equal is true or a different - // value if equal is false. - // The assumed value is the caller's assumption about the current value - // when making the call. - unsigned - _M_load_and_test_until(unsigned __assumed, unsigned __operand, - bool __equal, memory_order __mo, bool __has_timeout, - chrono::seconds __s, chrono::nanoseconds __ns) - { - for (;;) - { - // Don't bother checking the value again because we expect the caller - // to have done it recently. - // memory_order_relaxed is sufficient because we can rely on just the - // modification order (store_notify uses an atomic RMW operation too), - // and the futex syscalls synchronize between themselves. - _M_data.fetch_or(_Waiter_bit, memory_order_relaxed); - bool __ret = _M_futex_wait_until((unsigned*)(void*)&_M_data, - __assumed | _Waiter_bit, - __has_timeout, __s, __ns); - // Fetch the current value after waiting (clears _Waiter_bit). - __assumed = _M_load(__mo); - if (!__ret || ((__operand == __assumed) == __equal)) - return __assumed; - // TODO adapt wait time - } - } - - // Returns the operand's value if equal is true or a different value if - // equal is false. - // The assumed value is the caller's assumption about the current value - // when making the call. - unsigned - _M_load_and_test(unsigned __assumed, unsigned __operand, - bool __equal, memory_order __mo) - { - return _M_load_and_test_until(__assumed, __operand, __equal, __mo, - false, {}, {}); - } - - // If a timeout occurs, returns a current value after the timeout; - // otherwise, returns the operand's value if equal is true or a different - // value if equal is false. - // The assumed value is the caller's assumption about the current value - // when making the call. - template - unsigned - _M_load_and_test_until_impl(unsigned __assumed, unsigned __operand, - bool __equal, memory_order __mo, - const chrono::time_point<__clock_t, _Dur>& __atime) - { - auto __s = chrono::time_point_cast(__atime); - auto __ns = chrono::duration_cast(__atime - __s); - // XXX correct? - return _M_load_and_test_until(__assumed, __operand, __equal, __mo, - true, __s.time_since_epoch(), __ns); - } - - public: - - _GLIBCXX_ALWAYS_INLINE unsigned - _M_load_when_not_equal(unsigned __val, memory_order __mo) - { - unsigned __i = _M_load(__mo); - if ((__i & ~_Waiter_bit) != __val) - return (__i & ~_Waiter_bit); - // TODO Spin-wait first. - return _M_load_and_test(__i, __val, false, __mo); - } - - _GLIBCXX_ALWAYS_INLINE void - _M_load_when_equal(unsigned __val, memory_order __mo) - { - unsigned __i = _M_load(__mo); - if ((__i & ~_Waiter_bit) == __val) - return; - // TODO Spin-wait first. - _M_load_and_test(__i, __val, true, __mo); - } - - // Returns false iff a timeout occurred. - template - _GLIBCXX_ALWAYS_INLINE bool - _M_load_when_equal_for(unsigned __val, memory_order __mo, - const chrono::duration<_Rep, _Period>& __rtime) - { - return _M_load_when_equal_until(__val, __mo, - __clock_t::now() + __rtime); - } - - // Returns false iff a timeout occurred. - template - _GLIBCXX_ALWAYS_INLINE bool - _M_load_when_equal_until(unsigned __val, memory_order __mo, - const chrono::time_point<_Clock, _Duration>& __atime) - { - // DR 887 - Sync unknown clock to known clock. - const typename _Clock::time_point __c_entry = _Clock::now(); - const __clock_t::time_point __s_entry = __clock_t::now(); - const auto __delta = __atime - __c_entry; - const auto __s_atime = __s_entry + __delta; - return _M_load_when_equal_until(__val, __mo, __s_atime); - } - - // Returns false iff a timeout occurred. - template - _GLIBCXX_ALWAYS_INLINE bool - _M_load_when_equal_until(unsigned __val, memory_order __mo, - const chrono::time_point<__clock_t, _Duration>& __atime) - { - unsigned __i = _M_load(__mo); - if ((__i & ~_Waiter_bit) == __val) - return true; - // TODO Spin-wait first. Ignore effect on timeout. - __i = _M_load_and_test_until_impl(__i, __val, true, __mo, __atime); - return (__i & ~_Waiter_bit) == __val; - } - - _GLIBCXX_ALWAYS_INLINE void - _M_store_notify_all(unsigned __val, memory_order __mo) - { - unsigned* __futex = (unsigned *)(void *)&_M_data; - if (_M_data.exchange(__val, __mo) & _Waiter_bit) - _M_futex_notify_all(__futex); - } - }; - -#else // ! (_GLIBCXX_HAVE_LINUX_FUTEX && ATOMIC_INT_LOCK_FREE > 1) - - // If futexes are not available, use a mutex and a condvar to wait. - // Because we access the data only within critical sections, all accesses - // are sequentially consistent; thus, we satisfy any provided memory_order. - template - class __atomic_futex_unsigned - { - typedef chrono::system_clock __clock_t; - - unsigned _M_data; - mutex _M_mutex; - condition_variable _M_condvar; - - public: - explicit - __atomic_futex_unsigned(unsigned __data) : _M_data(__data) - { } - - _GLIBCXX_ALWAYS_INLINE unsigned - _M_load(memory_order __mo) - { - unique_lock __lock(_M_mutex); - return _M_data; - } - - _GLIBCXX_ALWAYS_INLINE unsigned - _M_load_when_not_equal(unsigned __val, memory_order __mo) - { - unique_lock __lock(_M_mutex); - while (_M_data == __val) - _M_condvar.wait(__lock); - return _M_data; - } - - _GLIBCXX_ALWAYS_INLINE void - _M_load_when_equal(unsigned __val, memory_order __mo) - { - unique_lock __lock(_M_mutex); - while (_M_data != __val) - _M_condvar.wait(__lock); - } - - template - _GLIBCXX_ALWAYS_INLINE bool - _M_load_when_equal_for(unsigned __val, memory_order __mo, - const chrono::duration<_Rep, _Period>& __rtime) - { - unique_lock __lock(_M_mutex); - return _M_condvar.wait_for(__lock, __rtime, - [&] { return _M_data == __val;}); - } - - template - _GLIBCXX_ALWAYS_INLINE bool - _M_load_when_equal_until(unsigned __val, memory_order __mo, - const chrono::time_point<_Clock, _Duration>& __atime) - { - unique_lock __lock(_M_mutex); - return _M_condvar.wait_until(__lock, __atime, - [&] { return _M_data == __val;}); - } - - _GLIBCXX_ALWAYS_INLINE void - _M_store_notify_all(unsigned __val, memory_order __mo) - { - unique_lock __lock(_M_mutex); - _M_data = __val; - _M_condvar.notify_all(); - } - }; - -#endif // _GLIBCXX_HAVE_LINUX_FUTEX && ATOMIC_INT_LOCK_FREE > 1 -#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1 - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/atomic_lockfree_defines.h b/openflow/usr/include/c++/5/bits/atomic_lockfree_defines.h deleted file mode 100644 index fa84d06..0000000 --- a/openflow/usr/include/c++/5/bits/atomic_lockfree_defines.h +++ /dev/null @@ -1,63 +0,0 @@ -// -*- C++ -*- header. - -// Copyright (C) 2008-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/atomic_lockfree_defines.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{atomic} - */ - -#ifndef _GLIBCXX_ATOMIC_LOCK_FREE_H -#define _GLIBCXX_ATOMIC_LOCK_FREE_H 1 - -#pragma GCC system_header - -/** - * @addtogroup atomics - * @{ - */ - -/** - * Lock-free property. - * - * 0 indicates that the types are never lock-free. - * 1 indicates that the types are sometimes lock-free. - * 2 indicates that the types are always lock-free. - */ - -#if __cplusplus >= 201103L -#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE -#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE -#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE -#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE -#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE -#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE -#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE -#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE -#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE -#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE -#endif - -// @} group atomics - -#endif diff --git a/openflow/usr/include/c++/5/bits/basic_ios.h b/openflow/usr/include/c++/5/bits/basic_ios.h deleted file mode 100644 index 8bea176..0000000 --- a/openflow/usr/include/c++/5/bits/basic_ios.h +++ /dev/null @@ -1,518 +0,0 @@ -// Iostreams base classes -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/basic_ios.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{ios} - */ - -#ifndef _BASIC_IOS_H -#define _BASIC_IOS_H 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - inline const _Facet& - __check_facet(const _Facet* __f) - { - if (!__f) - __throw_bad_cast(); - return *__f; - } - - /** - * @brief Template class basic_ios, virtual base class for all - * stream classes. - * @ingroup io - * - * @tparam _CharT Type of character stream. - * @tparam _Traits Traits for character type, defaults to - * char_traits<_CharT>. - * - * Most of the member functions called dispatched on stream objects - * (e.g., @c std::cout.foo(bar);) are consolidated in this class. - */ - template - class basic_ios : public ios_base - { - public: - //@{ - /** - * These are standard types. They permit a standardized way of - * referring to names of (or names dependent on) the template - * parameters, which are specific to the implementation. - */ - typedef _CharT char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - //@} - - //@{ - /** - * These are non-standard types. - */ - typedef ctype<_CharT> __ctype_type; - typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > - __num_put_type; - typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > - __num_get_type; - //@} - - // Data members: - protected: - basic_ostream<_CharT, _Traits>* _M_tie; - mutable char_type _M_fill; - mutable bool _M_fill_init; - basic_streambuf<_CharT, _Traits>* _M_streambuf; - - // Cached use_facet, which is based on the current locale info. - const __ctype_type* _M_ctype; - // For ostream. - const __num_put_type* _M_num_put; - // For istream. - const __num_get_type* _M_num_get; - - public: - //@{ - /** - * @brief The quick-and-easy status check. - * - * This allows you to write constructs such as - * if (!a_stream) ... and while (a_stream) ... - */ -#if __cplusplus >= 201103L - explicit operator bool() const - { return !this->fail(); } -#else - operator void*() const - { return this->fail() ? 0 : const_cast(this); } -#endif - - bool - operator!() const - { return this->fail(); } - //@} - - /** - * @brief Returns the error state of the stream buffer. - * @return A bit pattern (well, isn't everything?) - * - * See std::ios_base::iostate for the possible bit values. Most - * users will call one of the interpreting wrappers, e.g., good(). - */ - iostate - rdstate() const - { return _M_streambuf_state; } - - /** - * @brief [Re]sets the error state. - * @param __state The new state flag(s) to set. - * - * See std::ios_base::iostate for the possible bit values. Most - * users will not need to pass an argument. - */ - void - clear(iostate __state = goodbit); - - /** - * @brief Sets additional flags in the error state. - * @param __state The additional state flag(s) to set. - * - * See std::ios_base::iostate for the possible bit values. - */ - void - setstate(iostate __state) - { this->clear(this->rdstate() | __state); } - - // Flip the internal state on for the proper state bits, then re - // throws the propagated exception if bit also set in - // exceptions(). - void - _M_setstate(iostate __state) - { - // 27.6.1.2.1 Common requirements. - // Turn this on without causing an ios::failure to be thrown. - _M_streambuf_state |= __state; - if (this->exceptions() & __state) - __throw_exception_again; - } - - /** - * @brief Fast error checking. - * @return True if no error flags are set. - * - * A wrapper around rdstate. - */ - bool - good() const - { return this->rdstate() == 0; } - - /** - * @brief Fast error checking. - * @return True if the eofbit is set. - * - * Note that other iostate flags may also be set. - */ - bool - eof() const - { return (this->rdstate() & eofbit) != 0; } - - /** - * @brief Fast error checking. - * @return True if either the badbit or the failbit is set. - * - * Checking the badbit in fail() is historical practice. - * Note that other iostate flags may also be set. - */ - bool - fail() const - { return (this->rdstate() & (badbit | failbit)) != 0; } - - /** - * @brief Fast error checking. - * @return True if the badbit is set. - * - * Note that other iostate flags may also be set. - */ - bool - bad() const - { return (this->rdstate() & badbit) != 0; } - - /** - * @brief Throwing exceptions on errors. - * @return The current exceptions mask. - * - * This changes nothing in the stream. See the one-argument version - * of exceptions(iostate) for the meaning of the return value. - */ - iostate - exceptions() const - { return _M_exception; } - - /** - * @brief Throwing exceptions on errors. - * @param __except The new exceptions mask. - * - * By default, error flags are set silently. You can set an - * exceptions mask for each stream; if a bit in the mask becomes set - * in the error flags, then an exception of type - * std::ios_base::failure is thrown. - * - * If the error flag is already set when the exceptions mask is - * added, the exception is immediately thrown. Try running the - * following under GCC 3.1 or later: - * @code - * #include - * #include - * #include - * - * int main() - * { - * std::set_terminate (__gnu_cxx::__verbose_terminate_handler); - * - * std::ifstream f ("/etc/motd"); - * - * std::cerr << "Setting badbit\n"; - * f.setstate (std::ios_base::badbit); - * - * std::cerr << "Setting exception mask\n"; - * f.exceptions (std::ios_base::badbit); - * } - * @endcode - */ - void - exceptions(iostate __except) - { - _M_exception = __except; - this->clear(_M_streambuf_state); - } - - // Constructor/destructor: - /** - * @brief Constructor performs initialization. - * - * The parameter is passed by derived streams. - */ - explicit - basic_ios(basic_streambuf<_CharT, _Traits>* __sb) - : ios_base(), _M_tie(0), _M_fill(), _M_fill_init(false), _M_streambuf(0), - _M_ctype(0), _M_num_put(0), _M_num_get(0) - { this->init(__sb); } - - /** - * @brief Empty. - * - * The destructor does nothing. More specifically, it does not - * destroy the streambuf held by rdbuf(). - */ - virtual - ~basic_ios() { } - - // Members: - /** - * @brief Fetches the current @e tied stream. - * @return A pointer to the tied stream, or NULL if the stream is - * not tied. - * - * A stream may be @e tied (or synchronized) to a second output - * stream. When this stream performs any I/O, the tied stream is - * first flushed. For example, @c std::cin is tied to @c std::cout. - */ - basic_ostream<_CharT, _Traits>* - tie() const - { return _M_tie; } - - /** - * @brief Ties this stream to an output stream. - * @param __tiestr The output stream. - * @return The previously tied output stream, or NULL if the stream - * was not tied. - * - * This sets up a new tie; see tie() for more. - */ - basic_ostream<_CharT, _Traits>* - tie(basic_ostream<_CharT, _Traits>* __tiestr) - { - basic_ostream<_CharT, _Traits>* __old = _M_tie; - _M_tie = __tiestr; - return __old; - } - - /** - * @brief Accessing the underlying buffer. - * @return The current stream buffer. - * - * This does not change the state of the stream. - */ - basic_streambuf<_CharT, _Traits>* - rdbuf() const - { return _M_streambuf; } - - /** - * @brief Changing the underlying buffer. - * @param __sb The new stream buffer. - * @return The previous stream buffer. - * - * Associates a new buffer with the current stream, and clears the - * error state. - * - * Due to historical accidents which the LWG refuses to correct, the - * I/O library suffers from a design error: this function is hidden - * in derived classes by overrides of the zero-argument @c rdbuf(), - * which is non-virtual for hysterical raisins. As a result, you - * must use explicit qualifications to access this function via any - * derived class. For example: - * - * @code - * std::fstream foo; // or some other derived type - * std::streambuf* p = .....; - * - * foo.ios::rdbuf(p); // ios == basic_ios - * @endcode - */ - basic_streambuf<_CharT, _Traits>* - rdbuf(basic_streambuf<_CharT, _Traits>* __sb); - - /** - * @brief Copies fields of __rhs into this. - * @param __rhs The source values for the copies. - * @return Reference to this object. - * - * All fields of __rhs are copied into this object except that rdbuf() - * and rdstate() remain unchanged. All values in the pword and iword - * arrays are copied. Before copying, each callback is invoked with - * erase_event. After copying, each (new) callback is invoked with - * copyfmt_event. The final step is to copy exceptions(). - */ - basic_ios& - copyfmt(const basic_ios& __rhs); - - /** - * @brief Retrieves the @a empty character. - * @return The current fill character. - * - * It defaults to a space (' ') in the current locale. - */ - char_type - fill() const - { - if (!_M_fill_init) - { - _M_fill = this->widen(' '); - _M_fill_init = true; - } - return _M_fill; - } - - /** - * @brief Sets a new @a empty character. - * @param __ch The new character. - * @return The previous fill character. - * - * The fill character is used to fill out space when P+ characters - * have been requested (e.g., via setw), Q characters are actually - * used, and Qfill(); - _M_fill = __ch; - return __old; - } - - // Locales: - /** - * @brief Moves to a new locale. - * @param __loc The new locale. - * @return The previous locale. - * - * Calls @c ios_base::imbue(loc), and if a stream buffer is associated - * with this stream, calls that buffer's @c pubimbue(loc). - * - * Additional l10n notes are at - * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html - */ - locale - imbue(const locale& __loc); - - /** - * @brief Squeezes characters. - * @param __c The character to narrow. - * @param __dfault The character to narrow. - * @return The narrowed character. - * - * Maps a character of @c char_type to a character of @c char, - * if possible. - * - * Returns the result of - * @code - * std::use_facet >(getloc()).narrow(c,dfault) - * @endcode - * - * Additional l10n notes are at - * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html - */ - char - narrow(char_type __c, char __dfault) const - { return __check_facet(_M_ctype).narrow(__c, __dfault); } - - /** - * @brief Widens characters. - * @param __c The character to widen. - * @return The widened character. - * - * Maps a character of @c char to a character of @c char_type. - * - * Returns the result of - * @code - * std::use_facet >(getloc()).widen(c) - * @endcode - * - * Additional l10n notes are at - * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html - */ - char_type - widen(char __c) const - { return __check_facet(_M_ctype).widen(__c); } - - protected: - // 27.4.5.1 basic_ios constructors - /** - * @brief Empty. - * - * The default constructor does nothing and is not normally - * accessible to users. - */ - basic_ios() - : ios_base(), _M_tie(0), _M_fill(char_type()), _M_fill_init(false), - _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0) - { } - - /** - * @brief All setup is performed here. - * - * This is called from the public constructor. It is not virtual and - * cannot be redefined. - */ - void - init(basic_streambuf<_CharT, _Traits>* __sb); - -#if __cplusplus >= 201103L - basic_ios(const basic_ios&) = delete; - basic_ios& operator=(const basic_ios&) = delete; - - void - move(basic_ios& __rhs) - { - ios_base::_M_move(__rhs); - _M_cache_locale(_M_ios_locale); - this->tie(__rhs.tie(nullptr)); - _M_fill = __rhs._M_fill; - _M_fill_init = __rhs._M_fill_init; - _M_streambuf = nullptr; - } - - void - move(basic_ios&& __rhs) - { this->move(__rhs); } - - void - swap(basic_ios& __rhs) noexcept - { - ios_base::_M_swap(__rhs); - _M_cache_locale(_M_ios_locale); - __rhs._M_cache_locale(__rhs._M_ios_locale); - std::swap(_M_tie, __rhs._M_tie); - std::swap(_M_fill, __rhs._M_fill); - std::swap(_M_fill_init, __rhs._M_fill_init); - } - - void - set_rdbuf(basic_streambuf<_CharT, _Traits>* __sb) - { _M_streambuf = __sb; } -#endif - - void - _M_cache_locale(const locale& __loc); - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#include - -#endif /* _BASIC_IOS_H */ diff --git a/openflow/usr/include/c++/5/bits/basic_ios.tcc b/openflow/usr/include/c++/5/bits/basic_ios.tcc deleted file mode 100644 index be6b13b..0000000 --- a/openflow/usr/include/c++/5/bits/basic_ios.tcc +++ /dev/null @@ -1,188 +0,0 @@ -// basic_ios member functions -*- C++ -*- - -// Copyright (C) 1999-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/basic_ios.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{ios} - */ - -#ifndef _BASIC_IOS_TCC -#define _BASIC_IOS_TCC 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - void - basic_ios<_CharT, _Traits>::clear(iostate __state) - { - if (this->rdbuf()) - _M_streambuf_state = __state; - else - _M_streambuf_state = __state | badbit; - if (this->exceptions() & this->rdstate()) - __throw_ios_failure(__N("basic_ios::clear")); - } - - template - basic_streambuf<_CharT, _Traits>* - basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb) - { - basic_streambuf<_CharT, _Traits>* __old = _M_streambuf; - _M_streambuf = __sb; - this->clear(); - return __old; - } - - template - basic_ios<_CharT, _Traits>& - basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 292. effects of a.copyfmt (a) - if (this != &__rhs) - { - // Per 27.1.1, do not call imbue, yet must trash all caches - // associated with imbue() - - // Alloc any new word array first, so if it fails we have "rollback". - _Words* __words = (__rhs._M_word_size <= _S_local_word_size) ? - _M_local_word : new _Words[__rhs._M_word_size]; - - // Bump refs before doing callbacks, for safety. - _Callback_list* __cb = __rhs._M_callbacks; - if (__cb) - __cb->_M_add_reference(); - _M_call_callbacks(erase_event); - if (_M_word != _M_local_word) - { - delete [] _M_word; - _M_word = 0; - } - _M_dispose_callbacks(); - - // NB: Don't want any added during above. - _M_callbacks = __cb; - for (int __i = 0; __i < __rhs._M_word_size; ++__i) - __words[__i] = __rhs._M_word[__i]; - _M_word = __words; - _M_word_size = __rhs._M_word_size; - - this->flags(__rhs.flags()); - this->width(__rhs.width()); - this->precision(__rhs.precision()); - this->tie(__rhs.tie()); - this->fill(__rhs.fill()); - _M_ios_locale = __rhs.getloc(); - _M_cache_locale(_M_ios_locale); - - _M_call_callbacks(copyfmt_event); - - // The next is required to be the last assignment. - this->exceptions(__rhs.exceptions()); - } - return *this; - } - - // Locales: - template - locale - basic_ios<_CharT, _Traits>::imbue(const locale& __loc) - { - locale __old(this->getloc()); - ios_base::imbue(__loc); - _M_cache_locale(__loc); - if (this->rdbuf() != 0) - this->rdbuf()->pubimbue(__loc); - return __old; - } - - template - void - basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb) - { - // NB: This may be called more than once on the same object. - ios_base::_M_init(); - - // Cache locale data and specific facets used by iostreams. - _M_cache_locale(_M_ios_locale); - - // NB: The 27.4.4.1 Postconditions Table specifies requirements - // after basic_ios::init() has been called. As part of this, - // fill() must return widen(' ') any time after init() has been - // called, which needs an imbued ctype facet of char_type to - // return without throwing an exception. Unfortunately, - // ctype is not necessarily a required facet, so - // streams with char_type != [char, wchar_t] will not have it by - // default. Because of this, the correct value for _M_fill is - // constructed on the first call of fill(). That way, - // unformatted input and output with non-required basic_ios - // instantiations is possible even without imbuing the expected - // ctype facet. - _M_fill = _CharT(); - _M_fill_init = false; - - _M_tie = 0; - _M_exception = goodbit; - _M_streambuf = __sb; - _M_streambuf_state = __sb ? goodbit : badbit; - } - - template - void - basic_ios<_CharT, _Traits>::_M_cache_locale(const locale& __loc) - { - if (__builtin_expect(has_facet<__ctype_type>(__loc), true)) - _M_ctype = &use_facet<__ctype_type>(__loc); - else - _M_ctype = 0; - - if (__builtin_expect(has_facet<__num_put_type>(__loc), true)) - _M_num_put = &use_facet<__num_put_type>(__loc); - else - _M_num_put = 0; - - if (__builtin_expect(has_facet<__num_get_type>(__loc), true)) - _M_num_get = &use_facet<__num_get_type>(__loc); - else - _M_num_get = 0; - } - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template class basic_ios; - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template class basic_ios; -#endif -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/basic_string.h b/openflow/usr/include/c++/5/bits/basic_string.h deleted file mode 100644 index 9ef5be9..0000000 --- a/openflow/usr/include/c++/5/bits/basic_string.h +++ /dev/null @@ -1,5587 +0,0 @@ -// Components for manipulating sequences of characters -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/basic_string.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{string} - */ - -// -// ISO C++ 14882: 21 Strings library -// - -#ifndef _BASIC_STRING_H -#define _BASIC_STRING_H 1 - -#pragma GCC system_header - -#include -#include -#include -#if __cplusplus >= 201103L -#include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#if _GLIBCXX_USE_CXX11_ABI -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - /** - * @class basic_string basic_string.h - * @brief Managing sequences of characters and character-like objects. - * - * @ingroup strings - * @ingroup sequences - * - * @tparam _CharT Type of character - * @tparam _Traits Traits for character type, defaults to - * char_traits<_CharT>. - * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. - * - * Meets the requirements of a container, a - * reversible container, and a - * sequence. Of the - * optional sequence requirements, only - * @c push_back, @c at, and @c %array access are supported. - */ - template - class basic_string - { - typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template - rebind<_CharT>::other _Char_alloc_type; - typedef __gnu_cxx::__alloc_traits<_Char_alloc_type> _Alloc_traits; - - // Types: - public: - typedef _Traits traits_type; - typedef typename _Traits::char_type value_type; - typedef _Char_alloc_type allocator_type; - typedef typename _Alloc_traits::size_type size_type; - typedef typename _Alloc_traits::difference_type difference_type; - typedef typename _Alloc_traits::reference reference; - typedef typename _Alloc_traits::const_reference const_reference; - typedef typename _Alloc_traits::pointer pointer; - typedef typename _Alloc_traits::const_pointer const_pointer; - typedef __gnu_cxx::__normal_iterator iterator; - typedef __gnu_cxx::__normal_iterator - const_iterator; - typedef std::reverse_iterator const_reverse_iterator; - typedef std::reverse_iterator reverse_iterator; - - /// Value returned by various member functions when they fail. - static const size_type npos = static_cast(-1); - - private: - // type used for positions in insert, erase etc. -#if __cplusplus < 201103L - typedef iterator __const_iterator; -#else - typedef const_iterator __const_iterator; -#endif - - // Use empty-base optimization: http://www.cantrip.org/emptyopt.html - struct _Alloc_hider : allocator_type // TODO check __is_final - { - _Alloc_hider(pointer __dat, const _Alloc& __a = _Alloc()) - : allocator_type(__a), _M_p(__dat) { } - - pointer _M_p; // The actual data. - }; - - _Alloc_hider _M_dataplus; - size_type _M_string_length; - - enum { _S_local_capacity = 15 / sizeof(_CharT) }; - - union - { - _CharT _M_local_buf[_S_local_capacity + 1]; - size_type _M_allocated_capacity; - }; - - void - _M_data(pointer __p) - { _M_dataplus._M_p = __p; } - - void - _M_length(size_type __length) - { _M_string_length = __length; } - - pointer - _M_data() const - { return _M_dataplus._M_p; } - - pointer - _M_local_data() - { -#if __cplusplus >= 201103L - return std::pointer_traits::pointer_to(*_M_local_buf); -#else - return pointer(_M_local_buf); -#endif - } - - const_pointer - _M_local_data() const - { -#if __cplusplus >= 201103L - return std::pointer_traits::pointer_to(*_M_local_buf); -#else - return const_pointer(_M_local_buf); -#endif - } - - void - _M_capacity(size_type __capacity) - { _M_allocated_capacity = __capacity; } - - void - _M_set_length(size_type __n) - { - _M_length(__n); - traits_type::assign(_M_data()[__n], _CharT()); - } - - bool - _M_is_local() const - { return _M_data() == _M_local_data(); } - - // Create & Destroy - pointer - _M_create(size_type&, size_type); - - void - _M_dispose() - { - if (!_M_is_local()) - _M_destroy(_M_allocated_capacity); - } - - void - _M_destroy(size_type __size) throw() - { _Alloc_traits::deallocate(_M_get_allocator(), _M_data(), __size + 1); } - - // _M_construct_aux is used to implement the 21.3.1 para 15 which - // requires special behaviour if _InIterator is an integral type - template - void - _M_construct_aux(_InIterator __beg, _InIterator __end, - std::__false_type) - { - typedef typename iterator_traits<_InIterator>::iterator_category _Tag; - _M_construct(__beg, __end, _Tag()); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 438. Ambiguity in the "do the right thing" clause - template - void - _M_construct_aux(_Integer __beg, _Integer __end, std::__true_type) - { _M_construct_aux_2(static_cast(__beg), __end); } - - void - _M_construct_aux_2(size_type __req, _CharT __c) - { _M_construct(__req, __c); } - - template - void - _M_construct(_InIterator __beg, _InIterator __end) - { - typedef typename std::__is_integer<_InIterator>::__type _Integral; - _M_construct_aux(__beg, __end, _Integral()); - } - - // For Input Iterators, used in istreambuf_iterators, etc. - template - void - _M_construct(_InIterator __beg, _InIterator __end, - std::input_iterator_tag); - - // For forward_iterators up to random_access_iterators, used for - // string::iterator, _CharT*, etc. - template - void - _M_construct(_FwdIterator __beg, _FwdIterator __end, - std::forward_iterator_tag); - - void - _M_construct(size_type __req, _CharT __c); - - allocator_type& - _M_get_allocator() - { return _M_dataplus; } - - const allocator_type& - _M_get_allocator() const - { return _M_dataplus; } - - private: - -#ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST - // The explicit instantiations in misc-inst.cc require this due to - // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64063 - template::__value - && !__are_same<_Tp, const _CharT*>::__value - && !__are_same<_Tp, iterator>::__value - && !__are_same<_Tp, const_iterator>::__value> - struct __enable_if_not_native_iterator - { typedef basic_string& __type; }; - template - struct __enable_if_not_native_iterator<_Tp, false> { }; -#endif - - size_type - _M_check(size_type __pos, const char* __s) const - { - if (__pos > this->size()) - __throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > " - "this->size() (which is %zu)"), - __s, __pos, this->size()); - return __pos; - } - - void - _M_check_length(size_type __n1, size_type __n2, const char* __s) const - { - if (this->max_size() - (this->size() - __n1) < __n2) - __throw_length_error(__N(__s)); - } - - - // NB: _M_limit doesn't check for a bad __pos value. - size_type - _M_limit(size_type __pos, size_type __off) const _GLIBCXX_NOEXCEPT - { - const bool __testoff = __off < this->size() - __pos; - return __testoff ? __off : this->size() - __pos; - } - - // True if _Rep and source do not overlap. - bool - _M_disjunct(const _CharT* __s) const _GLIBCXX_NOEXCEPT - { - return (less()(__s, _M_data()) - || less()(_M_data() + this->size(), __s)); - } - - // When __n = 1 way faster than the general multichar - // traits_type::copy/move/assign. - static void - _S_copy(_CharT* __d, const _CharT* __s, size_type __n) - { - if (__n == 1) - traits_type::assign(*__d, *__s); - else - traits_type::copy(__d, __s, __n); - } - - static void - _S_move(_CharT* __d, const _CharT* __s, size_type __n) - { - if (__n == 1) - traits_type::assign(*__d, *__s); - else - traits_type::move(__d, __s, __n); - } - - static void - _S_assign(_CharT* __d, size_type __n, _CharT __c) - { - if (__n == 1) - traits_type::assign(*__d, __c); - else - traits_type::assign(__d, __n, __c); - } - - // _S_copy_chars is a separate template to permit specialization - // to optimize for the common case of pointers as iterators. - template - static void - _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2) - { - for (; __k1 != __k2; ++__k1, ++__p) - traits_type::assign(*__p, *__k1); // These types are off. - } - - static void - _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT - { _S_copy_chars(__p, __k1.base(), __k2.base()); } - - static void - _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2) - _GLIBCXX_NOEXCEPT - { _S_copy_chars(__p, __k1.base(), __k2.base()); } - - static void - _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT - { _S_copy(__p, __k1, __k2 - __k1); } - - static void - _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2) - _GLIBCXX_NOEXCEPT - { _S_copy(__p, __k1, __k2 - __k1); } - - static int - _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT - { - const difference_type __d = difference_type(__n1 - __n2); - - if (__d > __gnu_cxx::__numeric_traits::__max) - return __gnu_cxx::__numeric_traits::__max; - else if (__d < __gnu_cxx::__numeric_traits::__min) - return __gnu_cxx::__numeric_traits::__min; - else - return int(__d); - } - - void - _M_assign(const basic_string& __rcs); - - void - _M_mutate(size_type __pos, size_type __len1, const _CharT* __s, - size_type __len2); - - void - _M_erase(size_type __pos, size_type __n); - - public: - // Construct/copy/destroy: - // NB: We overload ctors in some cases instead of using default - // arguments, per 17.4.4.4 para. 2 item 2. - - /** - * @brief Default constructor creates an empty string. - */ - basic_string() -#if __cplusplus >= 201103L - noexcept(is_nothrow_default_constructible<_Alloc>::value) -#endif - : _M_dataplus(_M_local_data()) - { _M_set_length(0); } - - /** - * @brief Construct an empty string using allocator @a a. - */ - explicit - basic_string(const _Alloc& __a) - : _M_dataplus(_M_local_data(), __a) - { _M_set_length(0); } - - /** - * @brief Construct string with copy of value of @a __str. - * @param __str Source string. - */ - basic_string(const basic_string& __str) - : _M_dataplus(_M_local_data(), __str._M_get_allocator()) // TODO A traits - { _M_construct(__str._M_data(), __str._M_data() + __str.length()); } - - /** - * @brief Construct string as copy of a substring. - * @param __str Source string. - * @param __pos Index of first character to copy from. - * @param __n Number of characters to copy (default remainder). - */ - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2402. [this constructor] shouldn't use Allocator() - basic_string(const basic_string& __str, size_type __pos, - size_type __n = npos) - : _M_dataplus(_M_local_data()) - { - const _CharT* __start = __str._M_data() - + __str._M_check(__pos, "basic_string::basic_string"); - _M_construct(__start, __start + __str._M_limit(__pos, __n)); - } - - /** - * @brief Construct string as copy of a substring. - * @param __str Source string. - * @param __pos Index of first character to copy from. - * @param __n Number of characters to copy (default remainder). - * @param __a Allocator to use. - */ - basic_string(const basic_string& __str, size_type __pos, - size_type __n, const _Alloc& __a) - : _M_dataplus(_M_local_data(), __a) - { - const _CharT* __start - = __str._M_data() + __str._M_check(__pos, "string::string"); - _M_construct(__start, __start + __str._M_limit(__pos, __n)); - } - - /** - * @brief Construct string initialized by a character %array. - * @param __s Source character %array. - * @param __n Number of characters to copy. - * @param __a Allocator to use (default is default allocator). - * - * NB: @a __s must have at least @a __n characters, '\\0' - * has no special meaning. - */ - basic_string(const _CharT* __s, size_type __n, - const _Alloc& __a = _Alloc()) - : _M_dataplus(_M_local_data(), __a) - { _M_construct(__s, __s + __n); } - - /** - * @brief Construct string as copy of a C string. - * @param __s Source C string. - * @param __a Allocator to use (default is default allocator). - */ - basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) - : _M_dataplus(_M_local_data(), __a) - { _M_construct(__s, __s ? __s + traits_type::length(__s) : __s+npos); } - - /** - * @brief Construct string as multiple characters. - * @param __n Number of characters. - * @param __c Character to use. - * @param __a Allocator to use (default is default allocator). - */ - basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) - : _M_dataplus(_M_local_data(), __a) - { _M_construct(__n, __c); } - -#if __cplusplus >= 201103L - /** - * @brief Move construct string. - * @param __str Source string. - * - * The newly-created string contains the exact contents of @a __str. - * @a __str is a valid, but unspecified string. - **/ - basic_string(basic_string&& __str) noexcept - : _M_dataplus(_M_local_data(), std::move(__str._M_get_allocator())) - { - if (__str._M_is_local()) - { - traits_type::copy(_M_local_buf, __str._M_local_buf, - _S_local_capacity + 1); - } - else - { - _M_data(__str._M_data()); - _M_capacity(__str._M_allocated_capacity); - } - - // Must use _M_length() here not _M_set_length() because - // basic_stringbuf relies on writing into unallocated capacity so - // we mess up the contents if we put a '\0' in the string. - _M_length(__str.length()); - __str._M_data(__str._M_local_data()); - __str._M_set_length(0); - } - - /** - * @brief Construct string from an initializer %list. - * @param __l std::initializer_list of characters. - * @param __a Allocator to use (default is default allocator). - */ - basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) - : _M_dataplus(_M_local_data(), __a) - { _M_construct(__l.begin(), __l.end()); } - - basic_string(const basic_string& __str, const _Alloc& __a) - : _M_dataplus(_M_local_data(), __a) - { _M_construct(__str.begin(), __str.end()); } - - basic_string(basic_string&& __str, const _Alloc& __a) - : _M_dataplus(_M_local_data(), __a) - { - if (__str.get_allocator() == __a) - *this = std::move(__str); - else - _M_construct(__str.begin(), __str.end()); - } - -#endif // C++11 - - /** - * @brief Construct string as copy of a range. - * @param __beg Start of range. - * @param __end End of range. - * @param __a Allocator to use (default is default allocator). - */ -#if __cplusplus >= 201103L - template> -#else - template -#endif - basic_string(_InputIterator __beg, _InputIterator __end, - const _Alloc& __a = _Alloc()) - : _M_dataplus(_M_local_data(), __a) - { _M_construct(__beg, __end); } - - /** - * @brief Destroy the string instance. - */ - ~basic_string() - { _M_dispose(); } - - /** - * @brief Assign the value of @a str to this string. - * @param __str Source string. - */ - basic_string& - operator=(const basic_string& __str) - { return this->assign(__str); } - - /** - * @brief Copy contents of @a s into this string. - * @param __s Source null-terminated string. - */ - basic_string& - operator=(const _CharT* __s) - { return this->assign(__s); } - - /** - * @brief Set value to string of length 1. - * @param __c Source character. - * - * Assigning to a character makes this string length 1 and - * (*this)[0] == @a c. - */ - basic_string& - operator=(_CharT __c) - { - this->assign(1, __c); - return *this; - } - -#if __cplusplus >= 201103L - /** - * @brief Move assign the value of @a str to this string. - * @param __str Source string. - * - * The contents of @a str are moved into this string (without copying). - * @a str is a valid, but unspecified string. - **/ - // PR 58265, this should be noexcept. - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2063. Contradictory requirements for string move assignment - basic_string& - operator=(basic_string&& __str) - { - this->swap(__str); - return *this; - } - - /** - * @brief Set value to string constructed from initializer %list. - * @param __l std::initializer_list. - */ - basic_string& - operator=(initializer_list<_CharT> __l) - { - this->assign(__l.begin(), __l.size()); - return *this; - } -#endif // C++11 - - // Iterators: - /** - * Returns a read/write iterator that points to the first character in - * the %string. - */ - iterator - begin() _GLIBCXX_NOEXCEPT - { return iterator(_M_data()); } - - /** - * Returns a read-only (constant) iterator that points to the first - * character in the %string. - */ - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(_M_data()); } - - /** - * Returns a read/write iterator that points one past the last - * character in the %string. - */ - iterator - end() _GLIBCXX_NOEXCEPT - { return iterator(_M_data() + this->size()); } - - /** - * Returns a read-only (constant) iterator that points one past the - * last character in the %string. - */ - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return const_iterator(_M_data() + this->size()); } - - /** - * Returns a read/write reverse iterator that points to the last - * character in the %string. Iteration is done in reverse element - * order. - */ - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return reverse_iterator(this->end()); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to the last character in the %string. Iteration is done in - * reverse element order. - */ - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(this->end()); } - - /** - * Returns a read/write reverse iterator that points to one before the - * first character in the %string. Iteration is done in reverse - * element order. - */ - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return reverse_iterator(this->begin()); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to one before the first character in the %string. Iteration - * is done in reverse element order. - */ - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(this->begin()); } - -#if __cplusplus >= 201103L - /** - * Returns a read-only (constant) iterator that points to the first - * character in the %string. - */ - const_iterator - cbegin() const noexcept - { return const_iterator(this->_M_data()); } - - /** - * Returns a read-only (constant) iterator that points one past the - * last character in the %string. - */ - const_iterator - cend() const noexcept - { return const_iterator(this->_M_data() + this->size()); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to the last character in the %string. Iteration is done in - * reverse element order. - */ - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(this->end()); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to one before the first character in the %string. Iteration - * is done in reverse element order. - */ - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(this->begin()); } -#endif - - public: - // Capacity: - /// Returns the number of characters in the string, not including any - /// null-termination. - size_type - size() const _GLIBCXX_NOEXCEPT - { return _M_string_length; } - - /// Returns the number of characters in the string, not including any - /// null-termination. - size_type - length() const _GLIBCXX_NOEXCEPT - { return _M_string_length; } - - /// Returns the size() of the largest possible %string. - size_type - max_size() const _GLIBCXX_NOEXCEPT - { return (_Alloc_traits::max_size(_M_get_allocator()) - 1) / 2; } - - /** - * @brief Resizes the %string to the specified number of characters. - * @param __n Number of characters the %string should contain. - * @param __c Character to fill any new elements. - * - * This function will %resize the %string to the specified - * number of characters. If the number is smaller than the - * %string's current size the %string is truncated, otherwise - * the %string is extended and new elements are %set to @a __c. - */ - void - resize(size_type __n, _CharT __c); - - /** - * @brief Resizes the %string to the specified number of characters. - * @param __n Number of characters the %string should contain. - * - * This function will resize the %string to the specified length. If - * the new size is smaller than the %string's current size the %string - * is truncated, otherwise the %string is extended and new characters - * are default-constructed. For basic types such as char, this means - * setting them to 0. - */ - void - resize(size_type __n) - { this->resize(__n, _CharT()); } - -#if __cplusplus >= 201103L - /// A non-binding request to reduce capacity() to size(). - void - shrink_to_fit() noexcept - { -#if __cpp_exceptions - if (capacity() > size()) - { - try - { reserve(0); } - catch(...) - { } - } -#endif - } -#endif - - /** - * Returns the total number of characters that the %string can hold - * before needing to allocate more memory. - */ - size_type - capacity() const _GLIBCXX_NOEXCEPT - { - return _M_is_local() ? size_type(_S_local_capacity) - : _M_allocated_capacity; - } - - /** - * @brief Attempt to preallocate enough memory for specified number of - * characters. - * @param __res_arg Number of characters required. - * @throw std::length_error If @a __res_arg exceeds @c max_size(). - * - * This function attempts to reserve enough memory for the - * %string to hold the specified number of characters. If the - * number requested is more than max_size(), length_error is - * thrown. - * - * The advantage of this function is that if optimal code is a - * necessity and the user can determine the string length that will be - * required, the user can reserve the memory in %advance, and thus - * prevent a possible reallocation of memory and copying of %string - * data. - */ - void - reserve(size_type __res_arg = 0); - - /** - * Erases the string, making it empty. - */ - void - clear() _GLIBCXX_NOEXCEPT - { _M_set_length(0); } - - /** - * Returns true if the %string is empty. Equivalent to - * *this == "". - */ - bool - empty() const _GLIBCXX_NOEXCEPT - { return this->size() == 0; } - - // Element access: - /** - * @brief Subscript access to the data contained in the %string. - * @param __pos The index of the character to access. - * @return Read-only (constant) reference to the character. - * - * This operator allows for easy, array-style, data access. - * Note that data access with this operator is unchecked and - * out_of_range lookups are not defined. (For checked lookups - * see at().) - */ - const_reference - operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_ASSERT(__pos <= size()); - return _M_data()[__pos]; - } - - /** - * @brief Subscript access to the data contained in the %string. - * @param __pos The index of the character to access. - * @return Read/write reference to the character. - * - * This operator allows for easy, array-style, data access. - * Note that data access with this operator is unchecked and - * out_of_range lookups are not defined. (For checked lookups - * see at().) - */ - reference - operator[](size_type __pos) - { - // Allow pos == size() both in C++98 mode, as v3 extension, - // and in C++11 mode. - _GLIBCXX_DEBUG_ASSERT(__pos <= size()); - // In pedantic mode be strict in C++98 mode. - _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos < size()); - return _M_data()[__pos]; - } - - /** - * @brief Provides access to the data contained in the %string. - * @param __n The index of the character to access. - * @return Read-only (const) reference to the character. - * @throw std::out_of_range If @a n is an invalid index. - * - * This function provides for safer data access. The parameter is - * first checked that it is in the range of the string. The function - * throws out_of_range if the check fails. - */ - const_reference - at(size_type __n) const - { - if (__n >= this->size()) - __throw_out_of_range_fmt(__N("basic_string::at: __n " - "(which is %zu) >= this->size() " - "(which is %zu)"), - __n, this->size()); - return _M_data()[__n]; - } - - /** - * @brief Provides access to the data contained in the %string. - * @param __n The index of the character to access. - * @return Read/write reference to the character. - * @throw std::out_of_range If @a n is an invalid index. - * - * This function provides for safer data access. The parameter is - * first checked that it is in the range of the string. The function - * throws out_of_range if the check fails. - */ - reference - at(size_type __n) - { - if (__n >= size()) - __throw_out_of_range_fmt(__N("basic_string::at: __n " - "(which is %zu) >= this->size() " - "(which is %zu)"), - __n, this->size()); - return _M_data()[__n]; - } - -#if __cplusplus >= 201103L - /** - * Returns a read/write reference to the data at the first - * element of the %string. - */ - reference - front() noexcept - { return operator[](0); } - - /** - * Returns a read-only (constant) reference to the data at the first - * element of the %string. - */ - const_reference - front() const noexcept - { return operator[](0); } - - /** - * Returns a read/write reference to the data at the last - * element of the %string. - */ - reference - back() noexcept - { return operator[](this->size() - 1); } - - /** - * Returns a read-only (constant) reference to the data at the - * last element of the %string. - */ - const_reference - back() const noexcept - { return operator[](this->size() - 1); } -#endif - - // Modifiers: - /** - * @brief Append a string to this string. - * @param __str The string to append. - * @return Reference to this string. - */ - basic_string& - operator+=(const basic_string& __str) - { return this->append(__str); } - - /** - * @brief Append a C string. - * @param __s The C string to append. - * @return Reference to this string. - */ - basic_string& - operator+=(const _CharT* __s) - { return this->append(__s); } - - /** - * @brief Append a character. - * @param __c The character to append. - * @return Reference to this string. - */ - basic_string& - operator+=(_CharT __c) - { - this->push_back(__c); - return *this; - } - -#if __cplusplus >= 201103L - /** - * @brief Append an initializer_list of characters. - * @param __l The initializer_list of characters to be appended. - * @return Reference to this string. - */ - basic_string& - operator+=(initializer_list<_CharT> __l) - { return this->append(__l.begin(), __l.size()); } -#endif // C++11 - - /** - * @brief Append a string to this string. - * @param __str The string to append. - * @return Reference to this string. - */ - basic_string& - append(const basic_string& __str) - { return _M_append(__str._M_data(), __str.size()); } - - /** - * @brief Append a substring. - * @param __str The string to append. - * @param __pos Index of the first character of str to append. - * @param __n The number of characters to append. - * @return Reference to this string. - * @throw std::out_of_range if @a __pos is not a valid index. - * - * This function appends @a __n characters from @a __str - * starting at @a __pos to this string. If @a __n is is larger - * than the number of available characters in @a __str, the - * remainder of @a __str is appended. - */ - basic_string& - append(const basic_string& __str, size_type __pos, size_type __n) - { return _M_append(__str._M_data() - + __str._M_check(__pos, "basic_string::append"), - __str._M_limit(__pos, __n)); } - - /** - * @brief Append a C substring. - * @param __s The C string to append. - * @param __n The number of characters to append. - * @return Reference to this string. - */ - basic_string& - append(const _CharT* __s, size_type __n) - { - __glibcxx_requires_string_len(__s, __n); - _M_check_length(size_type(0), __n, "basic_string::append"); - return _M_append(__s, __n); - } - - /** - * @brief Append a C string. - * @param __s The C string to append. - * @return Reference to this string. - */ - basic_string& - append(const _CharT* __s) - { - __glibcxx_requires_string(__s); - const size_type __n = traits_type::length(__s); - _M_check_length(size_type(0), __n, "basic_string::append"); - return _M_append(__s, __n); - } - - /** - * @brief Append multiple characters. - * @param __n The number of characters to append. - * @param __c The character to use. - * @return Reference to this string. - * - * Appends __n copies of __c to this string. - */ - basic_string& - append(size_type __n, _CharT __c) - { return _M_replace_aux(this->size(), size_type(0), __n, __c); } - -#if __cplusplus >= 201103L - /** - * @brief Append an initializer_list of characters. - * @param __l The initializer_list of characters to append. - * @return Reference to this string. - */ - basic_string& - append(initializer_list<_CharT> __l) - { return this->append(__l.begin(), __l.size()); } -#endif // C++11 - - /** - * @brief Append a range of characters. - * @param __first Iterator referencing the first character to append. - * @param __last Iterator marking the end of the range. - * @return Reference to this string. - * - * Appends characters in the range [__first,__last) to this string. - */ -#if __cplusplus >= 201103L - template> -#else - template -#endif - basic_string& - append(_InputIterator __first, _InputIterator __last) - { return this->replace(end(), end(), __first, __last); } - - /** - * @brief Append a single character. - * @param __c Character to append. - */ - void - push_back(_CharT __c) - { - const size_type __size = this->size(); - if (__size + 1 > this->capacity()) - this->_M_mutate(__size, size_type(0), 0, size_type(1)); - traits_type::assign(this->_M_data()[__size], __c); - this->_M_set_length(__size + 1); - } - - /** - * @brief Set value to contents of another string. - * @param __str Source string to use. - * @return Reference to this string. - */ - basic_string& - assign(const basic_string& __str) - { - this->_M_assign(__str); - return *this; - } - -#if __cplusplus >= 201103L - /** - * @brief Set value to contents of another string. - * @param __str Source string to use. - * @return Reference to this string. - * - * This function sets this string to the exact contents of @a __str. - * @a __str is a valid, but unspecified string. - */ - basic_string& - assign(basic_string&& __str) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2063. Contradictory requirements for string move assignment - return *this = std::move(__str); - } -#endif // C++11 - - /** - * @brief Set value to a substring of a string. - * @param __str The string to use. - * @param __pos Index of the first character of str. - * @param __n Number of characters to use. - * @return Reference to this string. - * @throw std::out_of_range if @a pos is not a valid index. - * - * This function sets this string to the substring of @a __str - * consisting of @a __n characters at @a __pos. If @a __n is - * is larger than the number of available characters in @a - * __str, the remainder of @a __str is used. - */ - basic_string& - assign(const basic_string& __str, size_type __pos, size_type __n) - { return _M_replace(size_type(0), this->size(), __str._M_data() - + __str._M_check(__pos, "basic_string::assign"), - __str._M_limit(__pos, __n)); } - - /** - * @brief Set value to a C substring. - * @param __s The C string to use. - * @param __n Number of characters to use. - * @return Reference to this string. - * - * This function sets the value of this string to the first @a __n - * characters of @a __s. If @a __n is is larger than the number of - * available characters in @a __s, the remainder of @a __s is used. - */ - basic_string& - assign(const _CharT* __s, size_type __n) - { - __glibcxx_requires_string_len(__s, __n); - return _M_replace(size_type(0), this->size(), __s, __n); - } - - /** - * @brief Set value to contents of a C string. - * @param __s The C string to use. - * @return Reference to this string. - * - * This function sets the value of this string to the value of @a __s. - * The data is copied, so there is no dependence on @a __s once the - * function returns. - */ - basic_string& - assign(const _CharT* __s) - { - __glibcxx_requires_string(__s); - return _M_replace(size_type(0), this->size(), __s, - traits_type::length(__s)); - } - - /** - * @brief Set value to multiple characters. - * @param __n Length of the resulting string. - * @param __c The character to use. - * @return Reference to this string. - * - * This function sets the value of this string to @a __n copies of - * character @a __c. - */ - basic_string& - assign(size_type __n, _CharT __c) - { return _M_replace_aux(size_type(0), this->size(), __n, __c); } - - /** - * @brief Set value to a range of characters. - * @param __first Iterator referencing the first character to append. - * @param __last Iterator marking the end of the range. - * @return Reference to this string. - * - * Sets value of string to characters in the range [__first,__last). - */ -#if __cplusplus >= 201103L - template> -#else - template -#endif - basic_string& - assign(_InputIterator __first, _InputIterator __last) - { return this->replace(begin(), end(), __first, __last); } - -#if __cplusplus >= 201103L - /** - * @brief Set value to an initializer_list of characters. - * @param __l The initializer_list of characters to assign. - * @return Reference to this string. - */ - basic_string& - assign(initializer_list<_CharT> __l) - { return this->assign(__l.begin(), __l.size()); } -#endif // C++11 - -#if __cplusplus >= 201103L - /** - * @brief Insert multiple characters. - * @param __p Const_iterator referencing location in string to - * insert at. - * @param __n Number of characters to insert - * @param __c The character to insert. - * @return Iterator referencing the first inserted char. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Inserts @a __n copies of character @a __c starting at the - * position referenced by iterator @a __p. If adding - * characters causes the length to exceed max_size(), - * length_error is thrown. The value of the string doesn't - * change if an error is thrown. - */ - iterator - insert(const_iterator __p, size_type __n, _CharT __c) - { - _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); - const size_type __pos = __p - begin(); - this->replace(__p, __p, __n, __c); - return iterator(this->_M_data() + __pos); - } -#else - /** - * @brief Insert multiple characters. - * @param __p Iterator referencing location in string to insert at. - * @param __n Number of characters to insert - * @param __c The character to insert. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Inserts @a __n copies of character @a __c starting at the - * position referenced by iterator @a __p. If adding - * characters causes the length to exceed max_size(), - * length_error is thrown. The value of the string doesn't - * change if an error is thrown. - */ - void - insert(iterator __p, size_type __n, _CharT __c) - { this->replace(__p, __p, __n, __c); } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Insert a range of characters. - * @param __p Const_iterator referencing location in string to - * insert at. - * @param __beg Start of range. - * @param __end End of range. - * @return Iterator referencing the first inserted char. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Inserts characters in range [beg,end). If adding characters - * causes the length to exceed max_size(), length_error is - * thrown. The value of the string doesn't change if an error - * is thrown. - */ - template> - iterator - insert(const_iterator __p, _InputIterator __beg, _InputIterator __end) - { - _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); - const size_type __pos = __p - begin(); - this->replace(__p, __p, __beg, __end); - return iterator(this->_M_data() + __pos); - } -#else - /** - * @brief Insert a range of characters. - * @param __p Iterator referencing location in string to insert at. - * @param __beg Start of range. - * @param __end End of range. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Inserts characters in range [__beg,__end). If adding - * characters causes the length to exceed max_size(), - * length_error is thrown. The value of the string doesn't - * change if an error is thrown. - */ - template - void - insert(iterator __p, _InputIterator __beg, _InputIterator __end) - { this->replace(__p, __p, __beg, __end); } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Insert an initializer_list of characters. - * @param __p Iterator referencing location in string to insert at. - * @param __l The initializer_list of characters to insert. - * @throw std::length_error If new length exceeds @c max_size(). - */ - void - insert(iterator __p, initializer_list<_CharT> __l) - { - _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); - this->insert(__p - begin(), __l.begin(), __l.size()); - } -#endif // C++11 - - /** - * @brief Insert value of a string. - * @param __pos1 Iterator referencing location in string to insert at. - * @param __str The string to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Inserts value of @a __str starting at @a __pos1. If adding - * characters causes the length to exceed max_size(), - * length_error is thrown. The value of the string doesn't - * change if an error is thrown. - */ - basic_string& - insert(size_type __pos1, const basic_string& __str) - { return this->replace(__pos1, size_type(0), - __str._M_data(), __str.size()); } - - /** - * @brief Insert a substring. - * @param __pos1 Iterator referencing location in string to insert at. - * @param __str The string to insert. - * @param __pos2 Start of characters in str to insert. - * @param __n Number of characters to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * @throw std::out_of_range If @a pos1 > size() or - * @a __pos2 > @a str.size(). - * - * Starting at @a pos1, insert @a __n character of @a __str - * beginning with @a __pos2. If adding characters causes the - * length to exceed max_size(), length_error is thrown. If @a - * __pos1 is beyond the end of this string or @a __pos2 is - * beyond the end of @a __str, out_of_range is thrown. The - * value of the string doesn't change if an error is thrown. - */ - basic_string& - insert(size_type __pos1, const basic_string& __str, - size_type __pos2, size_type __n) - { return this->replace(__pos1, size_type(0), __str._M_data() - + __str._M_check(__pos2, "basic_string::insert"), - __str._M_limit(__pos2, __n)); } - - /** - * @brief Insert a C substring. - * @param __pos Iterator referencing location in string to insert at. - * @param __s The C string to insert. - * @param __n The number of characters to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * @throw std::out_of_range If @a __pos is beyond the end of this - * string. - * - * Inserts the first @a __n characters of @a __s starting at @a - * __pos. If adding characters causes the length to exceed - * max_size(), length_error is thrown. If @a __pos is beyond - * end(), out_of_range is thrown. The value of the string - * doesn't change if an error is thrown. - */ - basic_string& - insert(size_type __pos, const _CharT* __s, size_type __n) - { return this->replace(__pos, size_type(0), __s, __n); } - - /** - * @brief Insert a C string. - * @param __pos Iterator referencing location in string to insert at. - * @param __s The C string to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * @throw std::out_of_range If @a pos is beyond the end of this - * string. - * - * Inserts the first @a n characters of @a __s starting at @a __pos. If - * adding characters causes the length to exceed max_size(), - * length_error is thrown. If @a __pos is beyond end(), out_of_range is - * thrown. The value of the string doesn't change if an error is - * thrown. - */ - basic_string& - insert(size_type __pos, const _CharT* __s) - { - __glibcxx_requires_string(__s); - return this->replace(__pos, size_type(0), __s, - traits_type::length(__s)); - } - - /** - * @brief Insert multiple characters. - * @param __pos Index in string to insert at. - * @param __n Number of characters to insert - * @param __c The character to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * @throw std::out_of_range If @a __pos is beyond the end of this - * string. - * - * Inserts @a __n copies of character @a __c starting at index - * @a __pos. If adding characters causes the length to exceed - * max_size(), length_error is thrown. If @a __pos > length(), - * out_of_range is thrown. The value of the string doesn't - * change if an error is thrown. - */ - basic_string& - insert(size_type __pos, size_type __n, _CharT __c) - { return _M_replace_aux(_M_check(__pos, "basic_string::insert"), - size_type(0), __n, __c); } - - /** - * @brief Insert one character. - * @param __p Iterator referencing position in string to insert at. - * @param __c The character to insert. - * @return Iterator referencing newly inserted char. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Inserts character @a __c at position referenced by @a __p. - * If adding character causes the length to exceed max_size(), - * length_error is thrown. If @a __p is beyond end of string, - * out_of_range is thrown. The value of the string doesn't - * change if an error is thrown. - */ - iterator - insert(__const_iterator __p, _CharT __c) - { - _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); - const size_type __pos = __p - begin(); - _M_replace_aux(__pos, size_type(0), size_type(1), __c); - return iterator(_M_data() + __pos); - } - - /** - * @brief Remove characters. - * @param __pos Index of first character to remove (default 0). - * @param __n Number of characters to remove (default remainder). - * @return Reference to this string. - * @throw std::out_of_range If @a pos is beyond the end of this - * string. - * - * Removes @a __n characters from this string starting at @a - * __pos. The length of the string is reduced by @a __n. If - * there are < @a __n characters to remove, the remainder of - * the string is truncated. If @a __p is beyond end of string, - * out_of_range is thrown. The value of the string doesn't - * change if an error is thrown. - */ - basic_string& - erase(size_type __pos = 0, size_type __n = npos) - { - this->_M_erase(_M_check(__pos, "basic_string::erase"), - _M_limit(__pos, __n)); - return *this; - } - - /** - * @brief Remove one character. - * @param __position Iterator referencing the character to remove. - * @return iterator referencing same location after removal. - * - * Removes the character at @a __position from this string. The value - * of the string doesn't change if an error is thrown. - */ - iterator - erase(__const_iterator __position) - { - _GLIBCXX_DEBUG_PEDASSERT(__position >= begin() - && __position < end()); - const size_type __pos = __position - begin(); - this->_M_erase(__pos, size_type(1)); - return iterator(_M_data() + __pos); - } - - /** - * @brief Remove a range of characters. - * @param __first Iterator referencing the first character to remove. - * @param __last Iterator referencing the end of the range. - * @return Iterator referencing location of first after removal. - * - * Removes the characters in the range [first,last) from this string. - * The value of the string doesn't change if an error is thrown. - */ - iterator - erase(__const_iterator __first, __const_iterator __last) - { - _GLIBCXX_DEBUG_PEDASSERT(__first >= begin() && __first <= __last - && __last <= end()); - const size_type __pos = __first - begin(); - this->_M_erase(__pos, __last - __first); - return iterator(this->_M_data() + __pos); - } - -#if __cplusplus >= 201103L - /** - * @brief Remove the last character. - * - * The string must be non-empty. - */ - void - pop_back() noexcept - { _M_erase(size()-1, 1); } -#endif // C++11 - - /** - * @brief Replace characters with value from another string. - * @param __pos Index of first character to replace. - * @param __n Number of characters to be replaced. - * @param __str String to insert. - * @return Reference to this string. - * @throw std::out_of_range If @a pos is beyond the end of this - * string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__pos,__pos+__n) from - * this string. In place, the value of @a __str is inserted. - * If @a __pos is beyond end of string, out_of_range is thrown. - * If the length of the result exceeds max_size(), length_error - * is thrown. The value of the string doesn't change if an - * error is thrown. - */ - basic_string& - replace(size_type __pos, size_type __n, const basic_string& __str) - { return this->replace(__pos, __n, __str._M_data(), __str.size()); } - - /** - * @brief Replace characters with value from another string. - * @param __pos1 Index of first character to replace. - * @param __n1 Number of characters to be replaced. - * @param __str String to insert. - * @param __pos2 Index of first character of str to use. - * @param __n2 Number of characters from str to use. - * @return Reference to this string. - * @throw std::out_of_range If @a __pos1 > size() or @a __pos2 > - * __str.size(). - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__pos1,__pos1 + n) from this - * string. In place, the value of @a __str is inserted. If @a __pos is - * beyond end of string, out_of_range is thrown. If the length of the - * result exceeds max_size(), length_error is thrown. The value of the - * string doesn't change if an error is thrown. - */ - basic_string& - replace(size_type __pos1, size_type __n1, const basic_string& __str, - size_type __pos2, size_type __n2) - { return this->replace(__pos1, __n1, __str._M_data() - + __str._M_check(__pos2, "basic_string::replace"), - __str._M_limit(__pos2, __n2)); } - - /** - * @brief Replace characters with value of a C substring. - * @param __pos Index of first character to replace. - * @param __n1 Number of characters to be replaced. - * @param __s C string to insert. - * @param __n2 Number of characters from @a s to use. - * @return Reference to this string. - * @throw std::out_of_range If @a pos1 > size(). - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__pos,__pos + __n1) - * from this string. In place, the first @a __n2 characters of - * @a __s are inserted, or all of @a __s if @a __n2 is too large. If - * @a __pos is beyond end of string, out_of_range is thrown. If - * the length of result exceeds max_size(), length_error is - * thrown. The value of the string doesn't change if an error - * is thrown. - */ - basic_string& - replace(size_type __pos, size_type __n1, const _CharT* __s, - size_type __n2) - { - __glibcxx_requires_string_len(__s, __n2); - return _M_replace(_M_check(__pos, "basic_string::replace"), - _M_limit(__pos, __n1), __s, __n2); - } - - /** - * @brief Replace characters with value of a C string. - * @param __pos Index of first character to replace. - * @param __n1 Number of characters to be replaced. - * @param __s C string to insert. - * @return Reference to this string. - * @throw std::out_of_range If @a pos > size(). - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__pos,__pos + __n1) - * from this string. In place, the characters of @a __s are - * inserted. If @a __pos is beyond end of string, out_of_range - * is thrown. If the length of result exceeds max_size(), - * length_error is thrown. The value of the string doesn't - * change if an error is thrown. - */ - basic_string& - replace(size_type __pos, size_type __n1, const _CharT* __s) - { - __glibcxx_requires_string(__s); - return this->replace(__pos, __n1, __s, traits_type::length(__s)); - } - - /** - * @brief Replace characters with multiple characters. - * @param __pos Index of first character to replace. - * @param __n1 Number of characters to be replaced. - * @param __n2 Number of characters to insert. - * @param __c Character to insert. - * @return Reference to this string. - * @throw std::out_of_range If @a __pos > size(). - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [pos,pos + n1) from this - * string. In place, @a __n2 copies of @a __c are inserted. - * If @a __pos is beyond end of string, out_of_range is thrown. - * If the length of result exceeds max_size(), length_error is - * thrown. The value of the string doesn't change if an error - * is thrown. - */ - basic_string& - replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) - { return _M_replace_aux(_M_check(__pos, "basic_string::replace"), - _M_limit(__pos, __n1), __n2, __c); } - - /** - * @brief Replace range of characters with string. - * @param __i1 Iterator referencing start of range to replace. - * @param __i2 Iterator referencing end of range to replace. - * @param __str String value to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__i1,__i2). In place, - * the value of @a __str is inserted. If the length of result - * exceeds max_size(), length_error is thrown. The value of - * the string doesn't change if an error is thrown. - */ - basic_string& - replace(__const_iterator __i1, __const_iterator __i2, - const basic_string& __str) - { return this->replace(__i1, __i2, __str._M_data(), __str.size()); } - - /** - * @brief Replace range of characters with C substring. - * @param __i1 Iterator referencing start of range to replace. - * @param __i2 Iterator referencing end of range to replace. - * @param __s C string value to insert. - * @param __n Number of characters from s to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__i1,__i2). In place, - * the first @a __n characters of @a __s are inserted. If the - * length of result exceeds max_size(), length_error is thrown. - * The value of the string doesn't change if an error is - * thrown. - */ - basic_string& - replace(__const_iterator __i1, __const_iterator __i2, - const _CharT* __s, size_type __n) - { - _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 - && __i2 <= end()); - return this->replace(__i1 - begin(), __i2 - __i1, __s, __n); - } - - /** - * @brief Replace range of characters with C string. - * @param __i1 Iterator referencing start of range to replace. - * @param __i2 Iterator referencing end of range to replace. - * @param __s C string value to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__i1,__i2). In place, - * the characters of @a __s are inserted. If the length of - * result exceeds max_size(), length_error is thrown. The - * value of the string doesn't change if an error is thrown. - */ - basic_string& - replace(__const_iterator __i1, __const_iterator __i2, const _CharT* __s) - { - __glibcxx_requires_string(__s); - return this->replace(__i1, __i2, __s, traits_type::length(__s)); - } - - /** - * @brief Replace range of characters with multiple characters - * @param __i1 Iterator referencing start of range to replace. - * @param __i2 Iterator referencing end of range to replace. - * @param __n Number of characters to insert. - * @param __c Character to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__i1,__i2). In place, - * @a __n copies of @a __c are inserted. If the length of - * result exceeds max_size(), length_error is thrown. The - * value of the string doesn't change if an error is thrown. - */ - basic_string& - replace(__const_iterator __i1, __const_iterator __i2, size_type __n, - _CharT __c) - { - _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 - && __i2 <= end()); - return _M_replace_aux(__i1 - begin(), __i2 - __i1, __n, __c); - } - - /** - * @brief Replace range of characters with range. - * @param __i1 Iterator referencing start of range to replace. - * @param __i2 Iterator referencing end of range to replace. - * @param __k1 Iterator referencing start of range to insert. - * @param __k2 Iterator referencing end of range to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__i1,__i2). In place, - * characters in the range [__k1,__k2) are inserted. If the - * length of result exceeds max_size(), length_error is thrown. - * The value of the string doesn't change if an error is - * thrown. - */ -#if __cplusplus >= 201103L - template> - basic_string& - replace(const_iterator __i1, const_iterator __i2, - _InputIterator __k1, _InputIterator __k2) - { - _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 - && __i2 <= end()); - __glibcxx_requires_valid_range(__k1, __k2); - return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, - std::__false_type()); - } -#else - template -#ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST - typename __enable_if_not_native_iterator<_InputIterator>::__type -#else - basic_string& -#endif - replace(iterator __i1, iterator __i2, - _InputIterator __k1, _InputIterator __k2) - { - _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 - && __i2 <= end()); - __glibcxx_requires_valid_range(__k1, __k2); - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral()); - } -#endif - - // Specializations for the common case of pointer and iterator: - // useful to avoid the overhead of temporary buffering in _M_replace. - basic_string& - replace(__const_iterator __i1, __const_iterator __i2, - _CharT* __k1, _CharT* __k2) - { - _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 - && __i2 <= end()); - __glibcxx_requires_valid_range(__k1, __k2); - return this->replace(__i1 - begin(), __i2 - __i1, - __k1, __k2 - __k1); - } - - basic_string& - replace(__const_iterator __i1, __const_iterator __i2, - const _CharT* __k1, const _CharT* __k2) - { - _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 - && __i2 <= end()); - __glibcxx_requires_valid_range(__k1, __k2); - return this->replace(__i1 - begin(), __i2 - __i1, - __k1, __k2 - __k1); - } - - basic_string& - replace(__const_iterator __i1, __const_iterator __i2, - iterator __k1, iterator __k2) - { - _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 - && __i2 <= end()); - __glibcxx_requires_valid_range(__k1, __k2); - return this->replace(__i1 - begin(), __i2 - __i1, - __k1.base(), __k2 - __k1); - } - - basic_string& - replace(__const_iterator __i1, __const_iterator __i2, - const_iterator __k1, const_iterator __k2) - { - _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 - && __i2 <= end()); - __glibcxx_requires_valid_range(__k1, __k2); - return this->replace(__i1 - begin(), __i2 - __i1, - __k1.base(), __k2 - __k1); - } - -#if __cplusplus >= 201103L - /** - * @brief Replace range of characters with initializer_list. - * @param __i1 Iterator referencing start of range to replace. - * @param __i2 Iterator referencing end of range to replace. - * @param __l The initializer_list of characters to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__i1,__i2). In place, - * characters in the range [__k1,__k2) are inserted. If the - * length of result exceeds max_size(), length_error is thrown. - * The value of the string doesn't change if an error is - * thrown. - */ - basic_string& replace(const_iterator __i1, const_iterator __i2, - initializer_list<_CharT> __l) - { return this->replace(__i1, __i2, __l.begin(), __l.end()); } -#endif // C++11 - - private: - template - basic_string& - _M_replace_dispatch(const_iterator __i1, const_iterator __i2, - _Integer __n, _Integer __val, __true_type) - { return _M_replace_aux(__i1 - begin(), __i2 - __i1, __n, __val); } - - template - basic_string& - _M_replace_dispatch(const_iterator __i1, const_iterator __i2, - _InputIterator __k1, _InputIterator __k2, - __false_type); - - basic_string& - _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, - _CharT __c); - - basic_string& - _M_replace(size_type __pos, size_type __len1, const _CharT* __s, - const size_type __len2); - - basic_string& - _M_append(const _CharT* __s, size_type __n); - - public: - - /** - * @brief Copy substring into C string. - * @param __s C string to copy value into. - * @param __n Number of characters to copy. - * @param __pos Index of first character to copy. - * @return Number of characters actually copied - * @throw std::out_of_range If __pos > size(). - * - * Copies up to @a __n characters starting at @a __pos into the - * C string @a __s. If @a __pos is %greater than size(), - * out_of_range is thrown. - */ - size_type - copy(_CharT* __s, size_type __n, size_type __pos = 0) const; - - /** - * @brief Swap contents with another string. - * @param __s String to swap with. - * - * Exchanges the contents of this string with that of @a __s in constant - * time. - */ - void - swap(basic_string& __s) _GLIBCXX_NOEXCEPT; - - // String operations: - /** - * @brief Return const pointer to null-terminated contents. - * - * This is a handle to internal data. Do not modify or dire things may - * happen. - */ - const _CharT* - c_str() const _GLIBCXX_NOEXCEPT - { return _M_data(); } - - /** - * @brief Return const pointer to contents. - * - * This is a handle to internal data. Do not modify or dire things may - * happen. - */ - const _CharT* - data() const _GLIBCXX_NOEXCEPT - { return _M_data(); } - - /** - * @brief Return copy of allocator used to construct this string. - */ - allocator_type - get_allocator() const _GLIBCXX_NOEXCEPT - { return _M_get_allocator(); } - - /** - * @brief Find position of a C substring. - * @param __s C string to locate. - * @param __pos Index of character to search from. - * @param __n Number of characters from @a s to search for. - * @return Index of start of first occurrence. - * - * Starting from @a __pos, searches forward for the first @a - * __n characters in @a __s within this string. If found, - * returns the index where it begins. If not found, returns - * npos. - */ - size_type - find(const _CharT* __s, size_type __pos, size_type __n) const; - - /** - * @brief Find position of a string. - * @param __str String to locate. - * @param __pos Index of character to search from (default 0). - * @return Index of start of first occurrence. - * - * Starting from @a __pos, searches forward for value of @a __str within - * this string. If found, returns the index where it begins. If not - * found, returns npos. - */ - size_type - find(const basic_string& __str, size_type __pos = 0) const - _GLIBCXX_NOEXCEPT - { return this->find(__str.data(), __pos, __str.size()); } - - /** - * @brief Find position of a C string. - * @param __s C string to locate. - * @param __pos Index of character to search from (default 0). - * @return Index of start of first occurrence. - * - * Starting from @a __pos, searches forward for the value of @a - * __s within this string. If found, returns the index where - * it begins. If not found, returns npos. - */ - size_type - find(const _CharT* __s, size_type __pos = 0) const - { - __glibcxx_requires_string(__s); - return this->find(__s, __pos, traits_type::length(__s)); - } - - /** - * @brief Find position of a character. - * @param __c Character to locate. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for @a __c within - * this string. If found, returns the index where it was - * found. If not found, returns npos. - */ - size_type - find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT; - - /** - * @brief Find last position of a string. - * @param __str String to locate. - * @param __pos Index of character to search back from (default end). - * @return Index of start of last occurrence. - * - * Starting from @a __pos, searches backward for value of @a - * __str within this string. If found, returns the index where - * it begins. If not found, returns npos. - */ - size_type - rfind(const basic_string& __str, size_type __pos = npos) const - _GLIBCXX_NOEXCEPT - { return this->rfind(__str.data(), __pos, __str.size()); } - - /** - * @brief Find last position of a C substring. - * @param __s C string to locate. - * @param __pos Index of character to search back from. - * @param __n Number of characters from s to search for. - * @return Index of start of last occurrence. - * - * Starting from @a __pos, searches backward for the first @a - * __n characters in @a __s within this string. If found, - * returns the index where it begins. If not found, returns - * npos. - */ - size_type - rfind(const _CharT* __s, size_type __pos, size_type __n) const; - - /** - * @brief Find last position of a C string. - * @param __s C string to locate. - * @param __pos Index of character to start search at (default end). - * @return Index of start of last occurrence. - * - * Starting from @a __pos, searches backward for the value of - * @a __s within this string. If found, returns the index - * where it begins. If not found, returns npos. - */ - size_type - rfind(const _CharT* __s, size_type __pos = npos) const - { - __glibcxx_requires_string(__s); - return this->rfind(__s, __pos, traits_type::length(__s)); - } - - /** - * @brief Find last position of a character. - * @param __c Character to locate. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for @a __c within - * this string. If found, returns the index where it was - * found. If not found, returns npos. - */ - size_type - rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT; - - /** - * @brief Find position of a character of string. - * @param __str String containing characters to locate. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for one of the - * characters of @a __str within this string. If found, - * returns the index where it was found. If not found, returns - * npos. - */ - size_type - find_first_of(const basic_string& __str, size_type __pos = 0) const - _GLIBCXX_NOEXCEPT - { return this->find_first_of(__str.data(), __pos, __str.size()); } - - /** - * @brief Find position of a character of C substring. - * @param __s String containing characters to locate. - * @param __pos Index of character to search from. - * @param __n Number of characters from s to search for. - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for one of the - * first @a __n characters of @a __s within this string. If - * found, returns the index where it was found. If not found, - * returns npos. - */ - size_type - find_first_of(const _CharT* __s, size_type __pos, size_type __n) const; - - /** - * @brief Find position of a character of C string. - * @param __s String containing characters to locate. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for one of the - * characters of @a __s within this string. If found, returns - * the index where it was found. If not found, returns npos. - */ - size_type - find_first_of(const _CharT* __s, size_type __pos = 0) const - { - __glibcxx_requires_string(__s); - return this->find_first_of(__s, __pos, traits_type::length(__s)); - } - - /** - * @brief Find position of a character. - * @param __c Character to locate. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for the character - * @a __c within this string. If found, returns the index - * where it was found. If not found, returns npos. - * - * Note: equivalent to find(__c, __pos). - */ - size_type - find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT - { return this->find(__c, __pos); } - - /** - * @brief Find last position of a character of string. - * @param __str String containing characters to locate. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for one of the - * characters of @a __str within this string. If found, - * returns the index where it was found. If not found, returns - * npos. - */ - size_type - find_last_of(const basic_string& __str, size_type __pos = npos) const - _GLIBCXX_NOEXCEPT - { return this->find_last_of(__str.data(), __pos, __str.size()); } - - /** - * @brief Find last position of a character of C substring. - * @param __s C string containing characters to locate. - * @param __pos Index of character to search back from. - * @param __n Number of characters from s to search for. - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for one of the - * first @a __n characters of @a __s within this string. If - * found, returns the index where it was found. If not found, - * returns npos. - */ - size_type - find_last_of(const _CharT* __s, size_type __pos, size_type __n) const; - - /** - * @brief Find last position of a character of C string. - * @param __s C string containing characters to locate. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for one of the - * characters of @a __s within this string. If found, returns - * the index where it was found. If not found, returns npos. - */ - size_type - find_last_of(const _CharT* __s, size_type __pos = npos) const - { - __glibcxx_requires_string(__s); - return this->find_last_of(__s, __pos, traits_type::length(__s)); - } - - /** - * @brief Find last position of a character. - * @param __c Character to locate. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for @a __c within - * this string. If found, returns the index where it was - * found. If not found, returns npos. - * - * Note: equivalent to rfind(__c, __pos). - */ - size_type - find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT - { return this->rfind(__c, __pos); } - - /** - * @brief Find position of a character not in string. - * @param __str String containing characters to avoid. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for a character not contained - * in @a __str within this string. If found, returns the index where it - * was found. If not found, returns npos. - */ - size_type - find_first_not_of(const basic_string& __str, size_type __pos = 0) const - _GLIBCXX_NOEXCEPT - { return this->find_first_not_of(__str.data(), __pos, __str.size()); } - - /** - * @brief Find position of a character not in C substring. - * @param __s C string containing characters to avoid. - * @param __pos Index of character to search from. - * @param __n Number of characters from __s to consider. - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for a character not - * contained in the first @a __n characters of @a __s within - * this string. If found, returns the index where it was - * found. If not found, returns npos. - */ - size_type - find_first_not_of(const _CharT* __s, size_type __pos, - size_type __n) const; - - /** - * @brief Find position of a character not in C string. - * @param __s C string containing characters to avoid. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for a character not - * contained in @a __s within this string. If found, returns - * the index where it was found. If not found, returns npos. - */ - size_type - find_first_not_of(const _CharT* __s, size_type __pos = 0) const - { - __glibcxx_requires_string(__s); - return this->find_first_not_of(__s, __pos, traits_type::length(__s)); - } - - /** - * @brief Find position of a different character. - * @param __c Character to avoid. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for a character - * other than @a __c within this string. If found, returns the - * index where it was found. If not found, returns npos. - */ - size_type - find_first_not_of(_CharT __c, size_type __pos = 0) const - _GLIBCXX_NOEXCEPT; - - /** - * @brief Find last position of a character not in string. - * @param __str String containing characters to avoid. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for a character - * not contained in @a __str within this string. If found, - * returns the index where it was found. If not found, returns - * npos. - */ - size_type - find_last_not_of(const basic_string& __str, size_type __pos = npos) const - _GLIBCXX_NOEXCEPT - { return this->find_last_not_of(__str.data(), __pos, __str.size()); } - - /** - * @brief Find last position of a character not in C substring. - * @param __s C string containing characters to avoid. - * @param __pos Index of character to search back from. - * @param __n Number of characters from s to consider. - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for a character not - * contained in the first @a __n characters of @a __s within this string. - * If found, returns the index where it was found. If not found, - * returns npos. - */ - size_type - find_last_not_of(const _CharT* __s, size_type __pos, - size_type __n) const; - /** - * @brief Find last position of a character not in C string. - * @param __s C string containing characters to avoid. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for a character - * not contained in @a __s within this string. If found, - * returns the index where it was found. If not found, returns - * npos. - */ - size_type - find_last_not_of(const _CharT* __s, size_type __pos = npos) const - { - __glibcxx_requires_string(__s); - return this->find_last_not_of(__s, __pos, traits_type::length(__s)); - } - - /** - * @brief Find last position of a different character. - * @param __c Character to avoid. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for a character other than - * @a __c within this string. If found, returns the index where it was - * found. If not found, returns npos. - */ - size_type - find_last_not_of(_CharT __c, size_type __pos = npos) const - _GLIBCXX_NOEXCEPT; - - /** - * @brief Get a substring. - * @param __pos Index of first character (default 0). - * @param __n Number of characters in substring (default remainder). - * @return The new string. - * @throw std::out_of_range If __pos > size(). - * - * Construct and return a new string using the @a __n - * characters starting at @a __pos. If the string is too - * short, use the remainder of the characters. If @a __pos is - * beyond the end of the string, out_of_range is thrown. - */ - basic_string - substr(size_type __pos = 0, size_type __n = npos) const - { return basic_string(*this, - _M_check(__pos, "basic_string::substr"), __n); } - - /** - * @brief Compare to a string. - * @param __str String to compare against. - * @return Integer < 0, 0, or > 0. - * - * Returns an integer < 0 if this string is ordered before @a - * __str, 0 if their values are equivalent, or > 0 if this - * string is ordered after @a __str. Determines the effective - * length rlen of the strings to compare as the smallest of - * size() and str.size(). The function then compares the two - * strings by calling traits::compare(data(), str.data(),rlen). - * If the result of the comparison is nonzero returns it, - * otherwise the shorter one is ordered first. - */ - int - compare(const basic_string& __str) const - { - const size_type __size = this->size(); - const size_type __osize = __str.size(); - const size_type __len = std::min(__size, __osize); - - int __r = traits_type::compare(_M_data(), __str.data(), __len); - if (!__r) - __r = _S_compare(__size, __osize); - return __r; - } - - /** - * @brief Compare substring to a string. - * @param __pos Index of first character of substring. - * @param __n Number of characters in substring. - * @param __str String to compare against. - * @return Integer < 0, 0, or > 0. - * - * Form the substring of this string from the @a __n characters - * starting at @a __pos. Returns an integer < 0 if the - * substring is ordered before @a __str, 0 if their values are - * equivalent, or > 0 if the substring is ordered after @a - * __str. Determines the effective length rlen of the strings - * to compare as the smallest of the length of the substring - * and @a __str.size(). The function then compares the two - * strings by calling - * traits::compare(substring.data(),str.data(),rlen). If the - * result of the comparison is nonzero returns it, otherwise - * the shorter one is ordered first. - */ - int - compare(size_type __pos, size_type __n, const basic_string& __str) const; - - /** - * @brief Compare substring to a substring. - * @param __pos1 Index of first character of substring. - * @param __n1 Number of characters in substring. - * @param __str String to compare against. - * @param __pos2 Index of first character of substring of str. - * @param __n2 Number of characters in substring of str. - * @return Integer < 0, 0, or > 0. - * - * Form the substring of this string from the @a __n1 - * characters starting at @a __pos1. Form the substring of @a - * __str from the @a __n2 characters starting at @a __pos2. - * Returns an integer < 0 if this substring is ordered before - * the substring of @a __str, 0 if their values are equivalent, - * or > 0 if this substring is ordered after the substring of - * @a __str. Determines the effective length rlen of the - * strings to compare as the smallest of the lengths of the - * substrings. The function then compares the two strings by - * calling - * traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen). - * If the result of the comparison is nonzero returns it, - * otherwise the shorter one is ordered first. - */ - int - compare(size_type __pos1, size_type __n1, const basic_string& __str, - size_type __pos2, size_type __n2) const; - - /** - * @brief Compare to a C string. - * @param __s C string to compare against. - * @return Integer < 0, 0, or > 0. - * - * Returns an integer < 0 if this string is ordered before @a __s, 0 if - * their values are equivalent, or > 0 if this string is ordered after - * @a __s. Determines the effective length rlen of the strings to - * compare as the smallest of size() and the length of a string - * constructed from @a __s. The function then compares the two strings - * by calling traits::compare(data(),s,rlen). If the result of the - * comparison is nonzero returns it, otherwise the shorter one is - * ordered first. - */ - int - compare(const _CharT* __s) const; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 5 String::compare specification questionable - /** - * @brief Compare substring to a C string. - * @param __pos Index of first character of substring. - * @param __n1 Number of characters in substring. - * @param __s C string to compare against. - * @return Integer < 0, 0, or > 0. - * - * Form the substring of this string from the @a __n1 - * characters starting at @a pos. Returns an integer < 0 if - * the substring is ordered before @a __s, 0 if their values - * are equivalent, or > 0 if the substring is ordered after @a - * __s. Determines the effective length rlen of the strings to - * compare as the smallest of the length of the substring and - * the length of a string constructed from @a __s. The - * function then compares the two string by calling - * traits::compare(substring.data(),__s,rlen). If the result of - * the comparison is nonzero returns it, otherwise the shorter - * one is ordered first. - */ - int - compare(size_type __pos, size_type __n1, const _CharT* __s) const; - - /** - * @brief Compare substring against a character %array. - * @param __pos Index of first character of substring. - * @param __n1 Number of characters in substring. - * @param __s character %array to compare against. - * @param __n2 Number of characters of s. - * @return Integer < 0, 0, or > 0. - * - * Form the substring of this string from the @a __n1 - * characters starting at @a __pos. Form a string from the - * first @a __n2 characters of @a __s. Returns an integer < 0 - * if this substring is ordered before the string from @a __s, - * 0 if their values are equivalent, or > 0 if this substring - * is ordered after the string from @a __s. Determines the - * effective length rlen of the strings to compare as the - * smallest of the length of the substring and @a __n2. The - * function then compares the two strings by calling - * traits::compare(substring.data(),s,rlen). If the result of - * the comparison is nonzero returns it, otherwise the shorter - * one is ordered first. - * - * NB: s must have at least n2 characters, '\\0' has - * no special meaning. - */ - int - compare(size_type __pos, size_type __n1, const _CharT* __s, - size_type __n2) const; - }; -_GLIBCXX_END_NAMESPACE_CXX11 -#else // !_GLIBCXX_USE_CXX11_ABI - // Reference-counted COW string implentation - - /** - * @class basic_string basic_string.h - * @brief Managing sequences of characters and character-like objects. - * - * @ingroup strings - * @ingroup sequences - * - * @tparam _CharT Type of character - * @tparam _Traits Traits for character type, defaults to - * char_traits<_CharT>. - * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. - * - * Meets the requirements of a container, a - * reversible container, and a - * sequence. Of the - * optional sequence requirements, only - * @c push_back, @c at, and @c %array access are supported. - * - * @doctodo - * - * - * Documentation? What's that? - * Nathan Myers . - * - * A string looks like this: - * - * @code - * [_Rep] - * _M_length - * [basic_string] _M_capacity - * _M_dataplus _M_refcount - * _M_p ----------------> unnamed array of char_type - * @endcode - * - * Where the _M_p points to the first character in the string, and - * you cast it to a pointer-to-_Rep and subtract 1 to get a - * pointer to the header. - * - * This approach has the enormous advantage that a string object - * requires only one allocation. All the ugliness is confined - * within a single %pair of inline functions, which each compile to - * a single @a add instruction: _Rep::_M_data(), and - * string::_M_rep(); and the allocation function which gets a - * block of raw bytes and with room enough and constructs a _Rep - * object at the front. - * - * The reason you want _M_data pointing to the character %array and - * not the _Rep is so that the debugger can see the string - * contents. (Probably we should add a non-inline member to get - * the _Rep for the debugger to use, so users can check the actual - * string length.) - * - * Note that the _Rep object is a POD so that you can have a - * static empty string _Rep object already @a constructed before - * static constructors have run. The reference-count encoding is - * chosen so that a 0 indicates one reference, so you never try to - * destroy the empty-string _Rep object. - * - * All but the last paragraph is considered pretty conventional - * for a C++ string implementation. - */ - // 21.3 Template class basic_string - template - class basic_string - { - typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type; - - // Types: - public: - typedef _Traits traits_type; - typedef typename _Traits::char_type value_type; - typedef _Alloc allocator_type; - typedef typename _CharT_alloc_type::size_type size_type; - typedef typename _CharT_alloc_type::difference_type difference_type; - typedef typename _CharT_alloc_type::reference reference; - typedef typename _CharT_alloc_type::const_reference const_reference; - typedef typename _CharT_alloc_type::pointer pointer; - typedef typename _CharT_alloc_type::const_pointer const_pointer; - typedef __gnu_cxx::__normal_iterator iterator; - typedef __gnu_cxx::__normal_iterator - const_iterator; - typedef std::reverse_iterator const_reverse_iterator; - typedef std::reverse_iterator reverse_iterator; - - private: - // _Rep: string representation - // Invariants: - // 1. String really contains _M_length + 1 characters: due to 21.3.4 - // must be kept null-terminated. - // 2. _M_capacity >= _M_length - // Allocated memory is always (_M_capacity + 1) * sizeof(_CharT). - // 3. _M_refcount has three states: - // -1: leaked, one reference, no ref-copies allowed, non-const. - // 0: one reference, non-const. - // n>0: n + 1 references, operations require a lock, const. - // 4. All fields==0 is an empty string, given the extra storage - // beyond-the-end for a null terminator; thus, the shared - // empty string representation needs no constructor. - - struct _Rep_base - { - size_type _M_length; - size_type _M_capacity; - _Atomic_word _M_refcount; - }; - - struct _Rep : _Rep_base - { - // Types: - typedef typename _Alloc::template rebind::other _Raw_bytes_alloc; - - // (Public) Data members: - - // The maximum number of individual char_type elements of an - // individual string is determined by _S_max_size. This is the - // value that will be returned by max_size(). (Whereas npos - // is the maximum number of bytes the allocator can allocate.) - // If one was to divvy up the theoretical largest size string, - // with a terminating character and m _CharT elements, it'd - // look like this: - // npos = sizeof(_Rep) + (m * sizeof(_CharT)) + sizeof(_CharT) - // Solving for m: - // m = ((npos - sizeof(_Rep))/sizeof(CharT)) - 1 - // In addition, this implementation quarters this amount. - static const size_type _S_max_size; - static const _CharT _S_terminal; - - // The following storage is init'd to 0 by the linker, resulting - // (carefully) in an empty string with one reference. - static size_type _S_empty_rep_storage[]; - - static _Rep& - _S_empty_rep() _GLIBCXX_NOEXCEPT - { - // NB: Mild hack to avoid strict-aliasing warnings. Note that - // _S_empty_rep_storage is never modified and the punning should - // be reasonably safe in this case. - void* __p = reinterpret_cast(&_S_empty_rep_storage); - return *reinterpret_cast<_Rep*>(__p); - } - - bool - _M_is_leaked() const _GLIBCXX_NOEXCEPT - { return this->_M_refcount < 0; } - - bool - _M_is_shared() const _GLIBCXX_NOEXCEPT - { return this->_M_refcount > 0; } - - void - _M_set_leaked() _GLIBCXX_NOEXCEPT - { this->_M_refcount = -1; } - - void - _M_set_sharable() _GLIBCXX_NOEXCEPT - { this->_M_refcount = 0; } - - void - _M_set_length_and_sharable(size_type __n) _GLIBCXX_NOEXCEPT - { -#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 - if (__builtin_expect(this != &_S_empty_rep(), false)) -#endif - { - this->_M_set_sharable(); // One reference. - this->_M_length = __n; - traits_type::assign(this->_M_refdata()[__n], _S_terminal); - // grrr. (per 21.3.4) - // You cannot leave those LWG people alone for a second. - } - } - - _CharT* - _M_refdata() throw() - { return reinterpret_cast<_CharT*>(this + 1); } - - _CharT* - _M_grab(const _Alloc& __alloc1, const _Alloc& __alloc2) - { - return (!_M_is_leaked() && __alloc1 == __alloc2) - ? _M_refcopy() : _M_clone(__alloc1); - } - - // Create & Destroy - static _Rep* - _S_create(size_type, size_type, const _Alloc&); - - void - _M_dispose(const _Alloc& __a) _GLIBCXX_NOEXCEPT - { -#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 - if (__builtin_expect(this != &_S_empty_rep(), false)) -#endif - { - // Be race-detector-friendly. For more info see bits/c++config. - _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); - if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, - -1) <= 0) - { - _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount); - _M_destroy(__a); - } - } - } // XXX MT - - void - _M_destroy(const _Alloc&) throw(); - - _CharT* - _M_refcopy() throw() - { -#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 - if (__builtin_expect(this != &_S_empty_rep(), false)) -#endif - __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1); - return _M_refdata(); - } // XXX MT - - _CharT* - _M_clone(const _Alloc&, size_type __res = 0); - }; - - // Use empty-base optimization: http://www.cantrip.org/emptyopt.html - struct _Alloc_hider : _Alloc - { - _Alloc_hider(_CharT* __dat, const _Alloc& __a) _GLIBCXX_NOEXCEPT - : _Alloc(__a), _M_p(__dat) { } - - _CharT* _M_p; // The actual data. - }; - - public: - // Data Members (public): - // NB: This is an unsigned type, and thus represents the maximum - // size that the allocator can hold. - /// Value returned by various member functions when they fail. - static const size_type npos = static_cast(-1); - - private: - // Data Members (private): - mutable _Alloc_hider _M_dataplus; - - _CharT* - _M_data() const _GLIBCXX_NOEXCEPT - { return _M_dataplus._M_p; } - - _CharT* - _M_data(_CharT* __p) _GLIBCXX_NOEXCEPT - { return (_M_dataplus._M_p = __p); } - - _Rep* - _M_rep() const _GLIBCXX_NOEXCEPT - { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); } - - // For the internal use we have functions similar to `begin'/`end' - // but they do not call _M_leak. - iterator - _M_ibegin() const _GLIBCXX_NOEXCEPT - { return iterator(_M_data()); } - - iterator - _M_iend() const _GLIBCXX_NOEXCEPT - { return iterator(_M_data() + this->size()); } - - void - _M_leak() // for use in begin() & non-const op[] - { - if (!_M_rep()->_M_is_leaked()) - _M_leak_hard(); - } - - size_type - _M_check(size_type __pos, const char* __s) const - { - if (__pos > this->size()) - __throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > " - "this->size() (which is %zu)"), - __s, __pos, this->size()); - return __pos; - } - - void - _M_check_length(size_type __n1, size_type __n2, const char* __s) const - { - if (this->max_size() - (this->size() - __n1) < __n2) - __throw_length_error(__N(__s)); - } - - // NB: _M_limit doesn't check for a bad __pos value. - size_type - _M_limit(size_type __pos, size_type __off) const _GLIBCXX_NOEXCEPT - { - const bool __testoff = __off < this->size() - __pos; - return __testoff ? __off : this->size() - __pos; - } - - // True if _Rep and source do not overlap. - bool - _M_disjunct(const _CharT* __s) const _GLIBCXX_NOEXCEPT - { - return (less()(__s, _M_data()) - || less()(_M_data() + this->size(), __s)); - } - - // When __n = 1 way faster than the general multichar - // traits_type::copy/move/assign. - static void - _M_copy(_CharT* __d, const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT - { - if (__n == 1) - traits_type::assign(*__d, *__s); - else - traits_type::copy(__d, __s, __n); - } - - static void - _M_move(_CharT* __d, const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT - { - if (__n == 1) - traits_type::assign(*__d, *__s); - else - traits_type::move(__d, __s, __n); - } - - static void - _M_assign(_CharT* __d, size_type __n, _CharT __c) _GLIBCXX_NOEXCEPT - { - if (__n == 1) - traits_type::assign(*__d, __c); - else - traits_type::assign(__d, __n, __c); - } - - // _S_copy_chars is a separate template to permit specialization - // to optimize for the common case of pointers as iterators. - template - static void - _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2) - { - for (; __k1 != __k2; ++__k1, ++__p) - traits_type::assign(*__p, *__k1); // These types are off. - } - - static void - _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT - { _S_copy_chars(__p, __k1.base(), __k2.base()); } - - static void - _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2) - _GLIBCXX_NOEXCEPT - { _S_copy_chars(__p, __k1.base(), __k2.base()); } - - static void - _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT - { _M_copy(__p, __k1, __k2 - __k1); } - - static void - _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2) - _GLIBCXX_NOEXCEPT - { _M_copy(__p, __k1, __k2 - __k1); } - - static int - _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT - { - const difference_type __d = difference_type(__n1 - __n2); - - if (__d > __gnu_cxx::__numeric_traits::__max) - return __gnu_cxx::__numeric_traits::__max; - else if (__d < __gnu_cxx::__numeric_traits::__min) - return __gnu_cxx::__numeric_traits::__min; - else - return int(__d); - } - - void - _M_mutate(size_type __pos, size_type __len1, size_type __len2); - - void - _M_leak_hard(); - - static _Rep& - _S_empty_rep() _GLIBCXX_NOEXCEPT - { return _Rep::_S_empty_rep(); } - - public: - // Construct/copy/destroy: - // NB: We overload ctors in some cases instead of using default - // arguments, per 17.4.4.4 para. 2 item 2. - - /** - * @brief Default constructor creates an empty string. - */ - basic_string() -#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 - : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { } -#else - : _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()){ } -#endif - - /** - * @brief Construct an empty string using allocator @a a. - */ - explicit - basic_string(const _Alloc& __a); - - // NB: per LWG issue 42, semantics different from IS: - /** - * @brief Construct string with copy of value of @a str. - * @param __str Source string. - */ - basic_string(const basic_string& __str); - /** - * @brief Construct string as copy of a substring. - * @param __str Source string. - * @param __pos Index of first character to copy from. - * @param __n Number of characters to copy (default remainder). - */ - basic_string(const basic_string& __str, size_type __pos, - size_type __n = npos); - /** - * @brief Construct string as copy of a substring. - * @param __str Source string. - * @param __pos Index of first character to copy from. - * @param __n Number of characters to copy. - * @param __a Allocator to use. - */ - basic_string(const basic_string& __str, size_type __pos, - size_type __n, const _Alloc& __a); - - /** - * @brief Construct string initialized by a character %array. - * @param __s Source character %array. - * @param __n Number of characters to copy. - * @param __a Allocator to use (default is default allocator). - * - * NB: @a __s must have at least @a __n characters, '\\0' - * has no special meaning. - */ - basic_string(const _CharT* __s, size_type __n, - const _Alloc& __a = _Alloc()); - /** - * @brief Construct string as copy of a C string. - * @param __s Source C string. - * @param __a Allocator to use (default is default allocator). - */ - basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()); - /** - * @brief Construct string as multiple characters. - * @param __n Number of characters. - * @param __c Character to use. - * @param __a Allocator to use (default is default allocator). - */ - basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()); - -#if __cplusplus >= 201103L - /** - * @brief Move construct string. - * @param __str Source string. - * - * The newly-created string contains the exact contents of @a __str. - * @a __str is a valid, but unspecified string. - **/ - basic_string(basic_string&& __str) -#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 - noexcept // FIXME C++11: should always be noexcept. -#endif - : _M_dataplus(__str._M_dataplus) - { -#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 - __str._M_data(_S_empty_rep()._M_refdata()); -#else - __str._M_data(_S_construct(size_type(), _CharT(), get_allocator())); -#endif - } - - /** - * @brief Construct string from an initializer %list. - * @param __l std::initializer_list of characters. - * @param __a Allocator to use (default is default allocator). - */ - basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()); -#endif // C++11 - - /** - * @brief Construct string as copy of a range. - * @param __beg Start of range. - * @param __end End of range. - * @param __a Allocator to use (default is default allocator). - */ - template - basic_string(_InputIterator __beg, _InputIterator __end, - const _Alloc& __a = _Alloc()); - - /** - * @brief Destroy the string instance. - */ - ~basic_string() _GLIBCXX_NOEXCEPT - { _M_rep()->_M_dispose(this->get_allocator()); } - - /** - * @brief Assign the value of @a str to this string. - * @param __str Source string. - */ - basic_string& - operator=(const basic_string& __str) - { return this->assign(__str); } - - /** - * @brief Copy contents of @a s into this string. - * @param __s Source null-terminated string. - */ - basic_string& - operator=(const _CharT* __s) - { return this->assign(__s); } - - /** - * @brief Set value to string of length 1. - * @param __c Source character. - * - * Assigning to a character makes this string length 1 and - * (*this)[0] == @a c. - */ - basic_string& - operator=(_CharT __c) - { - this->assign(1, __c); - return *this; - } - -#if __cplusplus >= 201103L - /** - * @brief Move assign the value of @a str to this string. - * @param __str Source string. - * - * The contents of @a str are moved into this string (without copying). - * @a str is a valid, but unspecified string. - **/ - // PR 58265, this should be noexcept. - basic_string& - operator=(basic_string&& __str) - { - // NB: DR 1204. - this->swap(__str); - return *this; - } - - /** - * @brief Set value to string constructed from initializer %list. - * @param __l std::initializer_list. - */ - basic_string& - operator=(initializer_list<_CharT> __l) - { - this->assign(__l.begin(), __l.size()); - return *this; - } -#endif // C++11 - - // Iterators: - /** - * Returns a read/write iterator that points to the first character in - * the %string. Unshares the string. - */ - iterator - begin() // FIXME C++11: should be noexcept. - { - _M_leak(); - return iterator(_M_data()); - } - - /** - * Returns a read-only (constant) iterator that points to the first - * character in the %string. - */ - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(_M_data()); } - - /** - * Returns a read/write iterator that points one past the last - * character in the %string. Unshares the string. - */ - iterator - end() // FIXME C++11: should be noexcept. - { - _M_leak(); - return iterator(_M_data() + this->size()); - } - - /** - * Returns a read-only (constant) iterator that points one past the - * last character in the %string. - */ - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return const_iterator(_M_data() + this->size()); } - - /** - * Returns a read/write reverse iterator that points to the last - * character in the %string. Iteration is done in reverse element - * order. Unshares the string. - */ - reverse_iterator - rbegin() // FIXME C++11: should be noexcept. - { return reverse_iterator(this->end()); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to the last character in the %string. Iteration is done in - * reverse element order. - */ - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(this->end()); } - - /** - * Returns a read/write reverse iterator that points to one before the - * first character in the %string. Iteration is done in reverse - * element order. Unshares the string. - */ - reverse_iterator - rend() // FIXME C++11: should be noexcept. - { return reverse_iterator(this->begin()); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to one before the first character in the %string. Iteration - * is done in reverse element order. - */ - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(this->begin()); } - -#if __cplusplus >= 201103L - /** - * Returns a read-only (constant) iterator that points to the first - * character in the %string. - */ - const_iterator - cbegin() const noexcept - { return const_iterator(this->_M_data()); } - - /** - * Returns a read-only (constant) iterator that points one past the - * last character in the %string. - */ - const_iterator - cend() const noexcept - { return const_iterator(this->_M_data() + this->size()); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to the last character in the %string. Iteration is done in - * reverse element order. - */ - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(this->end()); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to one before the first character in the %string. Iteration - * is done in reverse element order. - */ - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(this->begin()); } -#endif - - public: - // Capacity: - /// Returns the number of characters in the string, not including any - /// null-termination. - size_type - size() const _GLIBCXX_NOEXCEPT - { return _M_rep()->_M_length; } - - /// Returns the number of characters in the string, not including any - /// null-termination. - size_type - length() const _GLIBCXX_NOEXCEPT - { return _M_rep()->_M_length; } - - /// Returns the size() of the largest possible %string. - size_type - max_size() const _GLIBCXX_NOEXCEPT - { return _Rep::_S_max_size; } - - /** - * @brief Resizes the %string to the specified number of characters. - * @param __n Number of characters the %string should contain. - * @param __c Character to fill any new elements. - * - * This function will %resize the %string to the specified - * number of characters. If the number is smaller than the - * %string's current size the %string is truncated, otherwise - * the %string is extended and new elements are %set to @a __c. - */ - void - resize(size_type __n, _CharT __c); - - /** - * @brief Resizes the %string to the specified number of characters. - * @param __n Number of characters the %string should contain. - * - * This function will resize the %string to the specified length. If - * the new size is smaller than the %string's current size the %string - * is truncated, otherwise the %string is extended and new characters - * are default-constructed. For basic types such as char, this means - * setting them to 0. - */ - void - resize(size_type __n) - { this->resize(__n, _CharT()); } - -#if __cplusplus >= 201103L - /// A non-binding request to reduce capacity() to size(). - void - shrink_to_fit() _GLIBCXX_NOEXCEPT - { -#if __cpp_exceptions - if (capacity() > size()) - { - try - { reserve(0); } - catch(...) - { } - } -#endif - } -#endif - - /** - * Returns the total number of characters that the %string can hold - * before needing to allocate more memory. - */ - size_type - capacity() const _GLIBCXX_NOEXCEPT - { return _M_rep()->_M_capacity; } - - /** - * @brief Attempt to preallocate enough memory for specified number of - * characters. - * @param __res_arg Number of characters required. - * @throw std::length_error If @a __res_arg exceeds @c max_size(). - * - * This function attempts to reserve enough memory for the - * %string to hold the specified number of characters. If the - * number requested is more than max_size(), length_error is - * thrown. - * - * The advantage of this function is that if optimal code is a - * necessity and the user can determine the string length that will be - * required, the user can reserve the memory in %advance, and thus - * prevent a possible reallocation of memory and copying of %string - * data. - */ - void - reserve(size_type __res_arg = 0); - - /** - * Erases the string, making it empty. - */ - // PR 56166: this should not throw. - void - clear() - { _M_mutate(0, this->size(), 0); } - - /** - * Returns true if the %string is empty. Equivalent to - * *this == "". - */ - bool - empty() const _GLIBCXX_NOEXCEPT - { return this->size() == 0; } - - // Element access: - /** - * @brief Subscript access to the data contained in the %string. - * @param __pos The index of the character to access. - * @return Read-only (constant) reference to the character. - * - * This operator allows for easy, array-style, data access. - * Note that data access with this operator is unchecked and - * out_of_range lookups are not defined. (For checked lookups - * see at().) - */ - const_reference - operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_ASSERT(__pos <= size()); - return _M_data()[__pos]; - } - - /** - * @brief Subscript access to the data contained in the %string. - * @param __pos The index of the character to access. - * @return Read/write reference to the character. - * - * This operator allows for easy, array-style, data access. - * Note that data access with this operator is unchecked and - * out_of_range lookups are not defined. (For checked lookups - * see at().) Unshares the string. - */ - reference - operator[](size_type __pos) - { - // Allow pos == size() both in C++98 mode, as v3 extension, - // and in C++11 mode. - _GLIBCXX_DEBUG_ASSERT(__pos <= size()); - // In pedantic mode be strict in C++98 mode. - _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos < size()); - _M_leak(); - return _M_data()[__pos]; - } - - /** - * @brief Provides access to the data contained in the %string. - * @param __n The index of the character to access. - * @return Read-only (const) reference to the character. - * @throw std::out_of_range If @a n is an invalid index. - * - * This function provides for safer data access. The parameter is - * first checked that it is in the range of the string. The function - * throws out_of_range if the check fails. - */ - const_reference - at(size_type __n) const - { - if (__n >= this->size()) - __throw_out_of_range_fmt(__N("basic_string::at: __n " - "(which is %zu) >= this->size() " - "(which is %zu)"), - __n, this->size()); - return _M_data()[__n]; - } - - /** - * @brief Provides access to the data contained in the %string. - * @param __n The index of the character to access. - * @return Read/write reference to the character. - * @throw std::out_of_range If @a n is an invalid index. - * - * This function provides for safer data access. The parameter is - * first checked that it is in the range of the string. The function - * throws out_of_range if the check fails. Success results in - * unsharing the string. - */ - reference - at(size_type __n) - { - if (__n >= size()) - __throw_out_of_range_fmt(__N("basic_string::at: __n " - "(which is %zu) >= this->size() " - "(which is %zu)"), - __n, this->size()); - _M_leak(); - return _M_data()[__n]; - } - -#if __cplusplus >= 201103L - /** - * Returns a read/write reference to the data at the first - * element of the %string. - */ - reference - front() - { return operator[](0); } - - /** - * Returns a read-only (constant) reference to the data at the first - * element of the %string. - */ - const_reference - front() const _GLIBCXX_NOEXCEPT - { return operator[](0); } - - /** - * Returns a read/write reference to the data at the last - * element of the %string. - */ - reference - back() - { return operator[](this->size() - 1); } - - /** - * Returns a read-only (constant) reference to the data at the - * last element of the %string. - */ - const_reference - back() const _GLIBCXX_NOEXCEPT - { return operator[](this->size() - 1); } -#endif - - // Modifiers: - /** - * @brief Append a string to this string. - * @param __str The string to append. - * @return Reference to this string. - */ - basic_string& - operator+=(const basic_string& __str) - { return this->append(__str); } - - /** - * @brief Append a C string. - * @param __s The C string to append. - * @return Reference to this string. - */ - basic_string& - operator+=(const _CharT* __s) - { return this->append(__s); } - - /** - * @brief Append a character. - * @param __c The character to append. - * @return Reference to this string. - */ - basic_string& - operator+=(_CharT __c) - { - this->push_back(__c); - return *this; - } - -#if __cplusplus >= 201103L - /** - * @brief Append an initializer_list of characters. - * @param __l The initializer_list of characters to be appended. - * @return Reference to this string. - */ - basic_string& - operator+=(initializer_list<_CharT> __l) - { return this->append(__l.begin(), __l.size()); } -#endif // C++11 - - /** - * @brief Append a string to this string. - * @param __str The string to append. - * @return Reference to this string. - */ - basic_string& - append(const basic_string& __str); - - /** - * @brief Append a substring. - * @param __str The string to append. - * @param __pos Index of the first character of str to append. - * @param __n The number of characters to append. - * @return Reference to this string. - * @throw std::out_of_range if @a __pos is not a valid index. - * - * This function appends @a __n characters from @a __str - * starting at @a __pos to this string. If @a __n is is larger - * than the number of available characters in @a __str, the - * remainder of @a __str is appended. - */ - basic_string& - append(const basic_string& __str, size_type __pos, size_type __n); - - /** - * @brief Append a C substring. - * @param __s The C string to append. - * @param __n The number of characters to append. - * @return Reference to this string. - */ - basic_string& - append(const _CharT* __s, size_type __n); - - /** - * @brief Append a C string. - * @param __s The C string to append. - * @return Reference to this string. - */ - basic_string& - append(const _CharT* __s) - { - __glibcxx_requires_string(__s); - return this->append(__s, traits_type::length(__s)); - } - - /** - * @brief Append multiple characters. - * @param __n The number of characters to append. - * @param __c The character to use. - * @return Reference to this string. - * - * Appends __n copies of __c to this string. - */ - basic_string& - append(size_type __n, _CharT __c); - -#if __cplusplus >= 201103L - /** - * @brief Append an initializer_list of characters. - * @param __l The initializer_list of characters to append. - * @return Reference to this string. - */ - basic_string& - append(initializer_list<_CharT> __l) - { return this->append(__l.begin(), __l.size()); } -#endif // C++11 - - /** - * @brief Append a range of characters. - * @param __first Iterator referencing the first character to append. - * @param __last Iterator marking the end of the range. - * @return Reference to this string. - * - * Appends characters in the range [__first,__last) to this string. - */ - template - basic_string& - append(_InputIterator __first, _InputIterator __last) - { return this->replace(_M_iend(), _M_iend(), __first, __last); } - - /** - * @brief Append a single character. - * @param __c Character to append. - */ - void - push_back(_CharT __c) - { - const size_type __len = 1 + this->size(); - if (__len > this->capacity() || _M_rep()->_M_is_shared()) - this->reserve(__len); - traits_type::assign(_M_data()[this->size()], __c); - _M_rep()->_M_set_length_and_sharable(__len); - } - - /** - * @brief Set value to contents of another string. - * @param __str Source string to use. - * @return Reference to this string. - */ - basic_string& - assign(const basic_string& __str); - -#if __cplusplus >= 201103L - /** - * @brief Set value to contents of another string. - * @param __str Source string to use. - * @return Reference to this string. - * - * This function sets this string to the exact contents of @a __str. - * @a __str is a valid, but unspecified string. - */ - // PR 58265, this should be noexcept. - basic_string& - assign(basic_string&& __str) - { - this->swap(__str); - return *this; - } -#endif // C++11 - - /** - * @brief Set value to a substring of a string. - * @param __str The string to use. - * @param __pos Index of the first character of str. - * @param __n Number of characters to use. - * @return Reference to this string. - * @throw std::out_of_range if @a pos is not a valid index. - * - * This function sets this string to the substring of @a __str - * consisting of @a __n characters at @a __pos. If @a __n is - * is larger than the number of available characters in @a - * __str, the remainder of @a __str is used. - */ - basic_string& - assign(const basic_string& __str, size_type __pos, size_type __n) - { return this->assign(__str._M_data() - + __str._M_check(__pos, "basic_string::assign"), - __str._M_limit(__pos, __n)); } - - /** - * @brief Set value to a C substring. - * @param __s The C string to use. - * @param __n Number of characters to use. - * @return Reference to this string. - * - * This function sets the value of this string to the first @a __n - * characters of @a __s. If @a __n is is larger than the number of - * available characters in @a __s, the remainder of @a __s is used. - */ - basic_string& - assign(const _CharT* __s, size_type __n); - - /** - * @brief Set value to contents of a C string. - * @param __s The C string to use. - * @return Reference to this string. - * - * This function sets the value of this string to the value of @a __s. - * The data is copied, so there is no dependence on @a __s once the - * function returns. - */ - basic_string& - assign(const _CharT* __s) - { - __glibcxx_requires_string(__s); - return this->assign(__s, traits_type::length(__s)); - } - - /** - * @brief Set value to multiple characters. - * @param __n Length of the resulting string. - * @param __c The character to use. - * @return Reference to this string. - * - * This function sets the value of this string to @a __n copies of - * character @a __c. - */ - basic_string& - assign(size_type __n, _CharT __c) - { return _M_replace_aux(size_type(0), this->size(), __n, __c); } - - /** - * @brief Set value to a range of characters. - * @param __first Iterator referencing the first character to append. - * @param __last Iterator marking the end of the range. - * @return Reference to this string. - * - * Sets value of string to characters in the range [__first,__last). - */ - template - basic_string& - assign(_InputIterator __first, _InputIterator __last) - { return this->replace(_M_ibegin(), _M_iend(), __first, __last); } - -#if __cplusplus >= 201103L - /** - * @brief Set value to an initializer_list of characters. - * @param __l The initializer_list of characters to assign. - * @return Reference to this string. - */ - basic_string& - assign(initializer_list<_CharT> __l) - { return this->assign(__l.begin(), __l.size()); } -#endif // C++11 - - /** - * @brief Insert multiple characters. - * @param __p Iterator referencing location in string to insert at. - * @param __n Number of characters to insert - * @param __c The character to insert. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Inserts @a __n copies of character @a __c starting at the - * position referenced by iterator @a __p. If adding - * characters causes the length to exceed max_size(), - * length_error is thrown. The value of the string doesn't - * change if an error is thrown. - */ - void - insert(iterator __p, size_type __n, _CharT __c) - { this->replace(__p, __p, __n, __c); } - - /** - * @brief Insert a range of characters. - * @param __p Iterator referencing location in string to insert at. - * @param __beg Start of range. - * @param __end End of range. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Inserts characters in range [__beg,__end). If adding - * characters causes the length to exceed max_size(), - * length_error is thrown. The value of the string doesn't - * change if an error is thrown. - */ - template - void - insert(iterator __p, _InputIterator __beg, _InputIterator __end) - { this->replace(__p, __p, __beg, __end); } - -#if __cplusplus >= 201103L - /** - * @brief Insert an initializer_list of characters. - * @param __p Iterator referencing location in string to insert at. - * @param __l The initializer_list of characters to insert. - * @throw std::length_error If new length exceeds @c max_size(). - */ - void - insert(iterator __p, initializer_list<_CharT> __l) - { - _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend()); - this->insert(__p - _M_ibegin(), __l.begin(), __l.size()); - } -#endif // C++11 - - /** - * @brief Insert value of a string. - * @param __pos1 Iterator referencing location in string to insert at. - * @param __str The string to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Inserts value of @a __str starting at @a __pos1. If adding - * characters causes the length to exceed max_size(), - * length_error is thrown. The value of the string doesn't - * change if an error is thrown. - */ - basic_string& - insert(size_type __pos1, const basic_string& __str) - { return this->insert(__pos1, __str, size_type(0), __str.size()); } - - /** - * @brief Insert a substring. - * @param __pos1 Iterator referencing location in string to insert at. - * @param __str The string to insert. - * @param __pos2 Start of characters in str to insert. - * @param __n Number of characters to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * @throw std::out_of_range If @a pos1 > size() or - * @a __pos2 > @a str.size(). - * - * Starting at @a pos1, insert @a __n character of @a __str - * beginning with @a __pos2. If adding characters causes the - * length to exceed max_size(), length_error is thrown. If @a - * __pos1 is beyond the end of this string or @a __pos2 is - * beyond the end of @a __str, out_of_range is thrown. The - * value of the string doesn't change if an error is thrown. - */ - basic_string& - insert(size_type __pos1, const basic_string& __str, - size_type __pos2, size_type __n) - { return this->insert(__pos1, __str._M_data() - + __str._M_check(__pos2, "basic_string::insert"), - __str._M_limit(__pos2, __n)); } - - /** - * @brief Insert a C substring. - * @param __pos Iterator referencing location in string to insert at. - * @param __s The C string to insert. - * @param __n The number of characters to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * @throw std::out_of_range If @a __pos is beyond the end of this - * string. - * - * Inserts the first @a __n characters of @a __s starting at @a - * __pos. If adding characters causes the length to exceed - * max_size(), length_error is thrown. If @a __pos is beyond - * end(), out_of_range is thrown. The value of the string - * doesn't change if an error is thrown. - */ - basic_string& - insert(size_type __pos, const _CharT* __s, size_type __n); - - /** - * @brief Insert a C string. - * @param __pos Iterator referencing location in string to insert at. - * @param __s The C string to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * @throw std::out_of_range If @a pos is beyond the end of this - * string. - * - * Inserts the first @a n characters of @a __s starting at @a __pos. If - * adding characters causes the length to exceed max_size(), - * length_error is thrown. If @a __pos is beyond end(), out_of_range is - * thrown. The value of the string doesn't change if an error is - * thrown. - */ - basic_string& - insert(size_type __pos, const _CharT* __s) - { - __glibcxx_requires_string(__s); - return this->insert(__pos, __s, traits_type::length(__s)); - } - - /** - * @brief Insert multiple characters. - * @param __pos Index in string to insert at. - * @param __n Number of characters to insert - * @param __c The character to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * @throw std::out_of_range If @a __pos is beyond the end of this - * string. - * - * Inserts @a __n copies of character @a __c starting at index - * @a __pos. If adding characters causes the length to exceed - * max_size(), length_error is thrown. If @a __pos > length(), - * out_of_range is thrown. The value of the string doesn't - * change if an error is thrown. - */ - basic_string& - insert(size_type __pos, size_type __n, _CharT __c) - { return _M_replace_aux(_M_check(__pos, "basic_string::insert"), - size_type(0), __n, __c); } - - /** - * @brief Insert one character. - * @param __p Iterator referencing position in string to insert at. - * @param __c The character to insert. - * @return Iterator referencing newly inserted char. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Inserts character @a __c at position referenced by @a __p. - * If adding character causes the length to exceed max_size(), - * length_error is thrown. If @a __p is beyond end of string, - * out_of_range is thrown. The value of the string doesn't - * change if an error is thrown. - */ - iterator - insert(iterator __p, _CharT __c) - { - _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend()); - const size_type __pos = __p - _M_ibegin(); - _M_replace_aux(__pos, size_type(0), size_type(1), __c); - _M_rep()->_M_set_leaked(); - return iterator(_M_data() + __pos); - } - - /** - * @brief Remove characters. - * @param __pos Index of first character to remove (default 0). - * @param __n Number of characters to remove (default remainder). - * @return Reference to this string. - * @throw std::out_of_range If @a pos is beyond the end of this - * string. - * - * Removes @a __n characters from this string starting at @a - * __pos. The length of the string is reduced by @a __n. If - * there are < @a __n characters to remove, the remainder of - * the string is truncated. If @a __p is beyond end of string, - * out_of_range is thrown. The value of the string doesn't - * change if an error is thrown. - */ - basic_string& - erase(size_type __pos = 0, size_type __n = npos) - { - _M_mutate(_M_check(__pos, "basic_string::erase"), - _M_limit(__pos, __n), size_type(0)); - return *this; - } - - /** - * @brief Remove one character. - * @param __position Iterator referencing the character to remove. - * @return iterator referencing same location after removal. - * - * Removes the character at @a __position from this string. The value - * of the string doesn't change if an error is thrown. - */ - iterator - erase(iterator __position) - { - _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin() - && __position < _M_iend()); - const size_type __pos = __position - _M_ibegin(); - _M_mutate(__pos, size_type(1), size_type(0)); - _M_rep()->_M_set_leaked(); - return iterator(_M_data() + __pos); - } - - /** - * @brief Remove a range of characters. - * @param __first Iterator referencing the first character to remove. - * @param __last Iterator referencing the end of the range. - * @return Iterator referencing location of first after removal. - * - * Removes the characters in the range [first,last) from this string. - * The value of the string doesn't change if an error is thrown. - */ - iterator - erase(iterator __first, iterator __last); - -#if __cplusplus >= 201103L - /** - * @brief Remove the last character. - * - * The string must be non-empty. - */ - void - pop_back() // FIXME C++11: should be noexcept. - { erase(size()-1, 1); } -#endif // C++11 - - /** - * @brief Replace characters with value from another string. - * @param __pos Index of first character to replace. - * @param __n Number of characters to be replaced. - * @param __str String to insert. - * @return Reference to this string. - * @throw std::out_of_range If @a pos is beyond the end of this - * string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__pos,__pos+__n) from - * this string. In place, the value of @a __str is inserted. - * If @a __pos is beyond end of string, out_of_range is thrown. - * If the length of the result exceeds max_size(), length_error - * is thrown. The value of the string doesn't change if an - * error is thrown. - */ - basic_string& - replace(size_type __pos, size_type __n, const basic_string& __str) - { return this->replace(__pos, __n, __str._M_data(), __str.size()); } - - /** - * @brief Replace characters with value from another string. - * @param __pos1 Index of first character to replace. - * @param __n1 Number of characters to be replaced. - * @param __str String to insert. - * @param __pos2 Index of first character of str to use. - * @param __n2 Number of characters from str to use. - * @return Reference to this string. - * @throw std::out_of_range If @a __pos1 > size() or @a __pos2 > - * __str.size(). - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__pos1,__pos1 + n) from this - * string. In place, the value of @a __str is inserted. If @a __pos is - * beyond end of string, out_of_range is thrown. If the length of the - * result exceeds max_size(), length_error is thrown. The value of the - * string doesn't change if an error is thrown. - */ - basic_string& - replace(size_type __pos1, size_type __n1, const basic_string& __str, - size_type __pos2, size_type __n2) - { return this->replace(__pos1, __n1, __str._M_data() - + __str._M_check(__pos2, "basic_string::replace"), - __str._M_limit(__pos2, __n2)); } - - /** - * @brief Replace characters with value of a C substring. - * @param __pos Index of first character to replace. - * @param __n1 Number of characters to be replaced. - * @param __s C string to insert. - * @param __n2 Number of characters from @a s to use. - * @return Reference to this string. - * @throw std::out_of_range If @a pos1 > size(). - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__pos,__pos + __n1) - * from this string. In place, the first @a __n2 characters of - * @a __s are inserted, or all of @a __s if @a __n2 is too large. If - * @a __pos is beyond end of string, out_of_range is thrown. If - * the length of result exceeds max_size(), length_error is - * thrown. The value of the string doesn't change if an error - * is thrown. - */ - basic_string& - replace(size_type __pos, size_type __n1, const _CharT* __s, - size_type __n2); - - /** - * @brief Replace characters with value of a C string. - * @param __pos Index of first character to replace. - * @param __n1 Number of characters to be replaced. - * @param __s C string to insert. - * @return Reference to this string. - * @throw std::out_of_range If @a pos > size(). - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__pos,__pos + __n1) - * from this string. In place, the characters of @a __s are - * inserted. If @a __pos is beyond end of string, out_of_range - * is thrown. If the length of result exceeds max_size(), - * length_error is thrown. The value of the string doesn't - * change if an error is thrown. - */ - basic_string& - replace(size_type __pos, size_type __n1, const _CharT* __s) - { - __glibcxx_requires_string(__s); - return this->replace(__pos, __n1, __s, traits_type::length(__s)); - } - - /** - * @brief Replace characters with multiple characters. - * @param __pos Index of first character to replace. - * @param __n1 Number of characters to be replaced. - * @param __n2 Number of characters to insert. - * @param __c Character to insert. - * @return Reference to this string. - * @throw std::out_of_range If @a __pos > size(). - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [pos,pos + n1) from this - * string. In place, @a __n2 copies of @a __c are inserted. - * If @a __pos is beyond end of string, out_of_range is thrown. - * If the length of result exceeds max_size(), length_error is - * thrown. The value of the string doesn't change if an error - * is thrown. - */ - basic_string& - replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) - { return _M_replace_aux(_M_check(__pos, "basic_string::replace"), - _M_limit(__pos, __n1), __n2, __c); } - - /** - * @brief Replace range of characters with string. - * @param __i1 Iterator referencing start of range to replace. - * @param __i2 Iterator referencing end of range to replace. - * @param __str String value to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__i1,__i2). In place, - * the value of @a __str is inserted. If the length of result - * exceeds max_size(), length_error is thrown. The value of - * the string doesn't change if an error is thrown. - */ - basic_string& - replace(iterator __i1, iterator __i2, const basic_string& __str) - { return this->replace(__i1, __i2, __str._M_data(), __str.size()); } - - /** - * @brief Replace range of characters with C substring. - * @param __i1 Iterator referencing start of range to replace. - * @param __i2 Iterator referencing end of range to replace. - * @param __s C string value to insert. - * @param __n Number of characters from s to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__i1,__i2). In place, - * the first @a __n characters of @a __s are inserted. If the - * length of result exceeds max_size(), length_error is thrown. - * The value of the string doesn't change if an error is - * thrown. - */ - basic_string& - replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n) - { - _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 - && __i2 <= _M_iend()); - return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n); - } - - /** - * @brief Replace range of characters with C string. - * @param __i1 Iterator referencing start of range to replace. - * @param __i2 Iterator referencing end of range to replace. - * @param __s C string value to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__i1,__i2). In place, - * the characters of @a __s are inserted. If the length of - * result exceeds max_size(), length_error is thrown. The - * value of the string doesn't change if an error is thrown. - */ - basic_string& - replace(iterator __i1, iterator __i2, const _CharT* __s) - { - __glibcxx_requires_string(__s); - return this->replace(__i1, __i2, __s, traits_type::length(__s)); - } - - /** - * @brief Replace range of characters with multiple characters - * @param __i1 Iterator referencing start of range to replace. - * @param __i2 Iterator referencing end of range to replace. - * @param __n Number of characters to insert. - * @param __c Character to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__i1,__i2). In place, - * @a __n copies of @a __c are inserted. If the length of - * result exceeds max_size(), length_error is thrown. The - * value of the string doesn't change if an error is thrown. - */ - basic_string& - replace(iterator __i1, iterator __i2, size_type __n, _CharT __c) - { - _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 - && __i2 <= _M_iend()); - return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c); - } - - /** - * @brief Replace range of characters with range. - * @param __i1 Iterator referencing start of range to replace. - * @param __i2 Iterator referencing end of range to replace. - * @param __k1 Iterator referencing start of range to insert. - * @param __k2 Iterator referencing end of range to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__i1,__i2). In place, - * characters in the range [__k1,__k2) are inserted. If the - * length of result exceeds max_size(), length_error is thrown. - * The value of the string doesn't change if an error is - * thrown. - */ - template - basic_string& - replace(iterator __i1, iterator __i2, - _InputIterator __k1, _InputIterator __k2) - { - _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 - && __i2 <= _M_iend()); - __glibcxx_requires_valid_range(__k1, __k2); - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral()); - } - - // Specializations for the common case of pointer and iterator: - // useful to avoid the overhead of temporary buffering in _M_replace. - basic_string& - replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2) - { - _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 - && __i2 <= _M_iend()); - __glibcxx_requires_valid_range(__k1, __k2); - return this->replace(__i1 - _M_ibegin(), __i2 - __i1, - __k1, __k2 - __k1); - } - - basic_string& - replace(iterator __i1, iterator __i2, - const _CharT* __k1, const _CharT* __k2) - { - _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 - && __i2 <= _M_iend()); - __glibcxx_requires_valid_range(__k1, __k2); - return this->replace(__i1 - _M_ibegin(), __i2 - __i1, - __k1, __k2 - __k1); - } - - basic_string& - replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2) - { - _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 - && __i2 <= _M_iend()); - __glibcxx_requires_valid_range(__k1, __k2); - return this->replace(__i1 - _M_ibegin(), __i2 - __i1, - __k1.base(), __k2 - __k1); - } - - basic_string& - replace(iterator __i1, iterator __i2, - const_iterator __k1, const_iterator __k2) - { - _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 - && __i2 <= _M_iend()); - __glibcxx_requires_valid_range(__k1, __k2); - return this->replace(__i1 - _M_ibegin(), __i2 - __i1, - __k1.base(), __k2 - __k1); - } - -#if __cplusplus >= 201103L - /** - * @brief Replace range of characters with initializer_list. - * @param __i1 Iterator referencing start of range to replace. - * @param __i2 Iterator referencing end of range to replace. - * @param __l The initializer_list of characters to insert. - * @return Reference to this string. - * @throw std::length_error If new length exceeds @c max_size(). - * - * Removes the characters in the range [__i1,__i2). In place, - * characters in the range [__k1,__k2) are inserted. If the - * length of result exceeds max_size(), length_error is thrown. - * The value of the string doesn't change if an error is - * thrown. - */ - basic_string& replace(iterator __i1, iterator __i2, - initializer_list<_CharT> __l) - { return this->replace(__i1, __i2, __l.begin(), __l.end()); } -#endif // C++11 - - private: - template - basic_string& - _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n, - _Integer __val, __true_type) - { return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); } - - template - basic_string& - _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1, - _InputIterator __k2, __false_type); - - basic_string& - _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, - _CharT __c); - - basic_string& - _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s, - size_type __n2); - - // _S_construct_aux is used to implement the 21.3.1 para 15 which - // requires special behaviour if _InIter is an integral type - template - static _CharT* - _S_construct_aux(_InIterator __beg, _InIterator __end, - const _Alloc& __a, __false_type) - { - typedef typename iterator_traits<_InIterator>::iterator_category _Tag; - return _S_construct(__beg, __end, __a, _Tag()); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 438. Ambiguity in the "do the right thing" clause - template - static _CharT* - _S_construct_aux(_Integer __beg, _Integer __end, - const _Alloc& __a, __true_type) - { return _S_construct_aux_2(static_cast(__beg), - __end, __a); } - - static _CharT* - _S_construct_aux_2(size_type __req, _CharT __c, const _Alloc& __a) - { return _S_construct(__req, __c, __a); } - - template - static _CharT* - _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a) - { - typedef typename std::__is_integer<_InIterator>::__type _Integral; - return _S_construct_aux(__beg, __end, __a, _Integral()); - } - - // For Input Iterators, used in istreambuf_iterators, etc. - template - static _CharT* - _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, - input_iterator_tag); - - // For forward_iterators up to random_access_iterators, used for - // string::iterator, _CharT*, etc. - template - static _CharT* - _S_construct(_FwdIterator __beg, _FwdIterator __end, const _Alloc& __a, - forward_iterator_tag); - - static _CharT* - _S_construct(size_type __req, _CharT __c, const _Alloc& __a); - - public: - - /** - * @brief Copy substring into C string. - * @param __s C string to copy value into. - * @param __n Number of characters to copy. - * @param __pos Index of first character to copy. - * @return Number of characters actually copied - * @throw std::out_of_range If __pos > size(). - * - * Copies up to @a __n characters starting at @a __pos into the - * C string @a __s. If @a __pos is %greater than size(), - * out_of_range is thrown. - */ - size_type - copy(_CharT* __s, size_type __n, size_type __pos = 0) const; - - /** - * @brief Swap contents with another string. - * @param __s String to swap with. - * - * Exchanges the contents of this string with that of @a __s in constant - * time. - */ - // PR 58265, this should be noexcept. - void - swap(basic_string& __s); - - // String operations: - /** - * @brief Return const pointer to null-terminated contents. - * - * This is a handle to internal data. Do not modify or dire things may - * happen. - */ - const _CharT* - c_str() const _GLIBCXX_NOEXCEPT - { return _M_data(); } - - /** - * @brief Return const pointer to contents. - * - * This is a handle to internal data. Do not modify or dire things may - * happen. - */ - const _CharT* - data() const _GLIBCXX_NOEXCEPT - { return _M_data(); } - - /** - * @brief Return copy of allocator used to construct this string. - */ - allocator_type - get_allocator() const _GLIBCXX_NOEXCEPT - { return _M_dataplus; } - - /** - * @brief Find position of a C substring. - * @param __s C string to locate. - * @param __pos Index of character to search from. - * @param __n Number of characters from @a s to search for. - * @return Index of start of first occurrence. - * - * Starting from @a __pos, searches forward for the first @a - * __n characters in @a __s within this string. If found, - * returns the index where it begins. If not found, returns - * npos. - */ - size_type - find(const _CharT* __s, size_type __pos, size_type __n) const; - - /** - * @brief Find position of a string. - * @param __str String to locate. - * @param __pos Index of character to search from (default 0). - * @return Index of start of first occurrence. - * - * Starting from @a __pos, searches forward for value of @a __str within - * this string. If found, returns the index where it begins. If not - * found, returns npos. - */ - size_type - find(const basic_string& __str, size_type __pos = 0) const - _GLIBCXX_NOEXCEPT - { return this->find(__str.data(), __pos, __str.size()); } - - /** - * @brief Find position of a C string. - * @param __s C string to locate. - * @param __pos Index of character to search from (default 0). - * @return Index of start of first occurrence. - * - * Starting from @a __pos, searches forward for the value of @a - * __s within this string. If found, returns the index where - * it begins. If not found, returns npos. - */ - size_type - find(const _CharT* __s, size_type __pos = 0) const - { - __glibcxx_requires_string(__s); - return this->find(__s, __pos, traits_type::length(__s)); - } - - /** - * @brief Find position of a character. - * @param __c Character to locate. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for @a __c within - * this string. If found, returns the index where it was - * found. If not found, returns npos. - */ - size_type - find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT; - - /** - * @brief Find last position of a string. - * @param __str String to locate. - * @param __pos Index of character to search back from (default end). - * @return Index of start of last occurrence. - * - * Starting from @a __pos, searches backward for value of @a - * __str within this string. If found, returns the index where - * it begins. If not found, returns npos. - */ - size_type - rfind(const basic_string& __str, size_type __pos = npos) const - _GLIBCXX_NOEXCEPT - { return this->rfind(__str.data(), __pos, __str.size()); } - - /** - * @brief Find last position of a C substring. - * @param __s C string to locate. - * @param __pos Index of character to search back from. - * @param __n Number of characters from s to search for. - * @return Index of start of last occurrence. - * - * Starting from @a __pos, searches backward for the first @a - * __n characters in @a __s within this string. If found, - * returns the index where it begins. If not found, returns - * npos. - */ - size_type - rfind(const _CharT* __s, size_type __pos, size_type __n) const; - - /** - * @brief Find last position of a C string. - * @param __s C string to locate. - * @param __pos Index of character to start search at (default end). - * @return Index of start of last occurrence. - * - * Starting from @a __pos, searches backward for the value of - * @a __s within this string. If found, returns the index - * where it begins. If not found, returns npos. - */ - size_type - rfind(const _CharT* __s, size_type __pos = npos) const - { - __glibcxx_requires_string(__s); - return this->rfind(__s, __pos, traits_type::length(__s)); - } - - /** - * @brief Find last position of a character. - * @param __c Character to locate. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for @a __c within - * this string. If found, returns the index where it was - * found. If not found, returns npos. - */ - size_type - rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT; - - /** - * @brief Find position of a character of string. - * @param __str String containing characters to locate. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for one of the - * characters of @a __str within this string. If found, - * returns the index where it was found. If not found, returns - * npos. - */ - size_type - find_first_of(const basic_string& __str, size_type __pos = 0) const - _GLIBCXX_NOEXCEPT - { return this->find_first_of(__str.data(), __pos, __str.size()); } - - /** - * @brief Find position of a character of C substring. - * @param __s String containing characters to locate. - * @param __pos Index of character to search from. - * @param __n Number of characters from s to search for. - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for one of the - * first @a __n characters of @a __s within this string. If - * found, returns the index where it was found. If not found, - * returns npos. - */ - size_type - find_first_of(const _CharT* __s, size_type __pos, size_type __n) const; - - /** - * @brief Find position of a character of C string. - * @param __s String containing characters to locate. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for one of the - * characters of @a __s within this string. If found, returns - * the index where it was found. If not found, returns npos. - */ - size_type - find_first_of(const _CharT* __s, size_type __pos = 0) const - { - __glibcxx_requires_string(__s); - return this->find_first_of(__s, __pos, traits_type::length(__s)); - } - - /** - * @brief Find position of a character. - * @param __c Character to locate. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for the character - * @a __c within this string. If found, returns the index - * where it was found. If not found, returns npos. - * - * Note: equivalent to find(__c, __pos). - */ - size_type - find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT - { return this->find(__c, __pos); } - - /** - * @brief Find last position of a character of string. - * @param __str String containing characters to locate. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for one of the - * characters of @a __str within this string. If found, - * returns the index where it was found. If not found, returns - * npos. - */ - size_type - find_last_of(const basic_string& __str, size_type __pos = npos) const - _GLIBCXX_NOEXCEPT - { return this->find_last_of(__str.data(), __pos, __str.size()); } - - /** - * @brief Find last position of a character of C substring. - * @param __s C string containing characters to locate. - * @param __pos Index of character to search back from. - * @param __n Number of characters from s to search for. - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for one of the - * first @a __n characters of @a __s within this string. If - * found, returns the index where it was found. If not found, - * returns npos. - */ - size_type - find_last_of(const _CharT* __s, size_type __pos, size_type __n) const; - - /** - * @brief Find last position of a character of C string. - * @param __s C string containing characters to locate. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for one of the - * characters of @a __s within this string. If found, returns - * the index where it was found. If not found, returns npos. - */ - size_type - find_last_of(const _CharT* __s, size_type __pos = npos) const - { - __glibcxx_requires_string(__s); - return this->find_last_of(__s, __pos, traits_type::length(__s)); - } - - /** - * @brief Find last position of a character. - * @param __c Character to locate. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for @a __c within - * this string. If found, returns the index where it was - * found. If not found, returns npos. - * - * Note: equivalent to rfind(__c, __pos). - */ - size_type - find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT - { return this->rfind(__c, __pos); } - - /** - * @brief Find position of a character not in string. - * @param __str String containing characters to avoid. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for a character not contained - * in @a __str within this string. If found, returns the index where it - * was found. If not found, returns npos. - */ - size_type - find_first_not_of(const basic_string& __str, size_type __pos = 0) const - _GLIBCXX_NOEXCEPT - { return this->find_first_not_of(__str.data(), __pos, __str.size()); } - - /** - * @brief Find position of a character not in C substring. - * @param __s C string containing characters to avoid. - * @param __pos Index of character to search from. - * @param __n Number of characters from __s to consider. - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for a character not - * contained in the first @a __n characters of @a __s within - * this string. If found, returns the index where it was - * found. If not found, returns npos. - */ - size_type - find_first_not_of(const _CharT* __s, size_type __pos, - size_type __n) const; - - /** - * @brief Find position of a character not in C string. - * @param __s C string containing characters to avoid. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for a character not - * contained in @a __s within this string. If found, returns - * the index where it was found. If not found, returns npos. - */ - size_type - find_first_not_of(const _CharT* __s, size_type __pos = 0) const - { - __glibcxx_requires_string(__s); - return this->find_first_not_of(__s, __pos, traits_type::length(__s)); - } - - /** - * @brief Find position of a different character. - * @param __c Character to avoid. - * @param __pos Index of character to search from (default 0). - * @return Index of first occurrence. - * - * Starting from @a __pos, searches forward for a character - * other than @a __c within this string. If found, returns the - * index where it was found. If not found, returns npos. - */ - size_type - find_first_not_of(_CharT __c, size_type __pos = 0) const - _GLIBCXX_NOEXCEPT; - - /** - * @brief Find last position of a character not in string. - * @param __str String containing characters to avoid. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for a character - * not contained in @a __str within this string. If found, - * returns the index where it was found. If not found, returns - * npos. - */ - size_type - find_last_not_of(const basic_string& __str, size_type __pos = npos) const - _GLIBCXX_NOEXCEPT - { return this->find_last_not_of(__str.data(), __pos, __str.size()); } - - /** - * @brief Find last position of a character not in C substring. - * @param __s C string containing characters to avoid. - * @param __pos Index of character to search back from. - * @param __n Number of characters from s to consider. - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for a character not - * contained in the first @a __n characters of @a __s within this string. - * If found, returns the index where it was found. If not found, - * returns npos. - */ - size_type - find_last_not_of(const _CharT* __s, size_type __pos, - size_type __n) const; - /** - * @brief Find last position of a character not in C string. - * @param __s C string containing characters to avoid. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for a character - * not contained in @a __s within this string. If found, - * returns the index where it was found. If not found, returns - * npos. - */ - size_type - find_last_not_of(const _CharT* __s, size_type __pos = npos) const - { - __glibcxx_requires_string(__s); - return this->find_last_not_of(__s, __pos, traits_type::length(__s)); - } - - /** - * @brief Find last position of a different character. - * @param __c Character to avoid. - * @param __pos Index of character to search back from (default end). - * @return Index of last occurrence. - * - * Starting from @a __pos, searches backward for a character other than - * @a __c within this string. If found, returns the index where it was - * found. If not found, returns npos. - */ - size_type - find_last_not_of(_CharT __c, size_type __pos = npos) const - _GLIBCXX_NOEXCEPT; - - /** - * @brief Get a substring. - * @param __pos Index of first character (default 0). - * @param __n Number of characters in substring (default remainder). - * @return The new string. - * @throw std::out_of_range If __pos > size(). - * - * Construct and return a new string using the @a __n - * characters starting at @a __pos. If the string is too - * short, use the remainder of the characters. If @a __pos is - * beyond the end of the string, out_of_range is thrown. - */ - basic_string - substr(size_type __pos = 0, size_type __n = npos) const - { return basic_string(*this, - _M_check(__pos, "basic_string::substr"), __n); } - - /** - * @brief Compare to a string. - * @param __str String to compare against. - * @return Integer < 0, 0, or > 0. - * - * Returns an integer < 0 if this string is ordered before @a - * __str, 0 if their values are equivalent, or > 0 if this - * string is ordered after @a __str. Determines the effective - * length rlen of the strings to compare as the smallest of - * size() and str.size(). The function then compares the two - * strings by calling traits::compare(data(), str.data(),rlen). - * If the result of the comparison is nonzero returns it, - * otherwise the shorter one is ordered first. - */ - int - compare(const basic_string& __str) const - { - const size_type __size = this->size(); - const size_type __osize = __str.size(); - const size_type __len = std::min(__size, __osize); - - int __r = traits_type::compare(_M_data(), __str.data(), __len); - if (!__r) - __r = _S_compare(__size, __osize); - return __r; - } - - /** - * @brief Compare substring to a string. - * @param __pos Index of first character of substring. - * @param __n Number of characters in substring. - * @param __str String to compare against. - * @return Integer < 0, 0, or > 0. - * - * Form the substring of this string from the @a __n characters - * starting at @a __pos. Returns an integer < 0 if the - * substring is ordered before @a __str, 0 if their values are - * equivalent, or > 0 if the substring is ordered after @a - * __str. Determines the effective length rlen of the strings - * to compare as the smallest of the length of the substring - * and @a __str.size(). The function then compares the two - * strings by calling - * traits::compare(substring.data(),str.data(),rlen). If the - * result of the comparison is nonzero returns it, otherwise - * the shorter one is ordered first. - */ - int - compare(size_type __pos, size_type __n, const basic_string& __str) const; - - /** - * @brief Compare substring to a substring. - * @param __pos1 Index of first character of substring. - * @param __n1 Number of characters in substring. - * @param __str String to compare against. - * @param __pos2 Index of first character of substring of str. - * @param __n2 Number of characters in substring of str. - * @return Integer < 0, 0, or > 0. - * - * Form the substring of this string from the @a __n1 - * characters starting at @a __pos1. Form the substring of @a - * __str from the @a __n2 characters starting at @a __pos2. - * Returns an integer < 0 if this substring is ordered before - * the substring of @a __str, 0 if their values are equivalent, - * or > 0 if this substring is ordered after the substring of - * @a __str. Determines the effective length rlen of the - * strings to compare as the smallest of the lengths of the - * substrings. The function then compares the two strings by - * calling - * traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen). - * If the result of the comparison is nonzero returns it, - * otherwise the shorter one is ordered first. - */ - int - compare(size_type __pos1, size_type __n1, const basic_string& __str, - size_type __pos2, size_type __n2) const; - - /** - * @brief Compare to a C string. - * @param __s C string to compare against. - * @return Integer < 0, 0, or > 0. - * - * Returns an integer < 0 if this string is ordered before @a __s, 0 if - * their values are equivalent, or > 0 if this string is ordered after - * @a __s. Determines the effective length rlen of the strings to - * compare as the smallest of size() and the length of a string - * constructed from @a __s. The function then compares the two strings - * by calling traits::compare(data(),s,rlen). If the result of the - * comparison is nonzero returns it, otherwise the shorter one is - * ordered first. - */ - int - compare(const _CharT* __s) const; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 5 String::compare specification questionable - /** - * @brief Compare substring to a C string. - * @param __pos Index of first character of substring. - * @param __n1 Number of characters in substring. - * @param __s C string to compare against. - * @return Integer < 0, 0, or > 0. - * - * Form the substring of this string from the @a __n1 - * characters starting at @a pos. Returns an integer < 0 if - * the substring is ordered before @a __s, 0 if their values - * are equivalent, or > 0 if the substring is ordered after @a - * __s. Determines the effective length rlen of the strings to - * compare as the smallest of the length of the substring and - * the length of a string constructed from @a __s. The - * function then compares the two string by calling - * traits::compare(substring.data(),__s,rlen). If the result of - * the comparison is nonzero returns it, otherwise the shorter - * one is ordered first. - */ - int - compare(size_type __pos, size_type __n1, const _CharT* __s) const; - - /** - * @brief Compare substring against a character %array. - * @param __pos Index of first character of substring. - * @param __n1 Number of characters in substring. - * @param __s character %array to compare against. - * @param __n2 Number of characters of s. - * @return Integer < 0, 0, or > 0. - * - * Form the substring of this string from the @a __n1 - * characters starting at @a __pos. Form a string from the - * first @a __n2 characters of @a __s. Returns an integer < 0 - * if this substring is ordered before the string from @a __s, - * 0 if their values are equivalent, or > 0 if this substring - * is ordered after the string from @a __s. Determines the - * effective length rlen of the strings to compare as the - * smallest of the length of the substring and @a __n2. The - * function then compares the two strings by calling - * traits::compare(substring.data(),s,rlen). If the result of - * the comparison is nonzero returns it, otherwise the shorter - * one is ordered first. - * - * NB: s must have at least n2 characters, '\\0' has - * no special meaning. - */ - int - compare(size_type __pos, size_type __n1, const _CharT* __s, - size_type __n2) const; - }; -#endif // !_GLIBCXX_USE_CXX11_ABI - - // operator+ - /** - * @brief Concatenate two strings. - * @param __lhs First string. - * @param __rhs Last string. - * @return New string with value of @a __lhs followed by @a __rhs. - */ - template - basic_string<_CharT, _Traits, _Alloc> - operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { - basic_string<_CharT, _Traits, _Alloc> __str(__lhs); - __str.append(__rhs); - return __str; - } - - /** - * @brief Concatenate C string and string. - * @param __lhs First string. - * @param __rhs Last string. - * @return New string with value of @a __lhs followed by @a __rhs. - */ - template - basic_string<_CharT,_Traits,_Alloc> - operator+(const _CharT* __lhs, - const basic_string<_CharT,_Traits,_Alloc>& __rhs); - - /** - * @brief Concatenate character and string. - * @param __lhs First string. - * @param __rhs Last string. - * @return New string with @a __lhs followed by @a __rhs. - */ - template - basic_string<_CharT,_Traits,_Alloc> - operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs); - - /** - * @brief Concatenate string and C string. - * @param __lhs First string. - * @param __rhs Last string. - * @return New string with @a __lhs followed by @a __rhs. - */ - template - inline basic_string<_CharT, _Traits, _Alloc> - operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const _CharT* __rhs) - { - basic_string<_CharT, _Traits, _Alloc> __str(__lhs); - __str.append(__rhs); - return __str; - } - - /** - * @brief Concatenate string and character. - * @param __lhs First string. - * @param __rhs Last string. - * @return New string with @a __lhs followed by @a __rhs. - */ - template - inline basic_string<_CharT, _Traits, _Alloc> - operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) - { - typedef basic_string<_CharT, _Traits, _Alloc> __string_type; - typedef typename __string_type::size_type __size_type; - __string_type __str(__lhs); - __str.append(__size_type(1), __rhs); - return __str; - } - -#if __cplusplus >= 201103L - template - inline basic_string<_CharT, _Traits, _Alloc> - operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { return std::move(__lhs.append(__rhs)); } - - template - inline basic_string<_CharT, _Traits, _Alloc> - operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - basic_string<_CharT, _Traits, _Alloc>&& __rhs) - { return std::move(__rhs.insert(0, __lhs)); } - - template - inline basic_string<_CharT, _Traits, _Alloc> - operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, - basic_string<_CharT, _Traits, _Alloc>&& __rhs) - { - const auto __size = __lhs.size() + __rhs.size(); - const bool __cond = (__size > __lhs.capacity() - && __size <= __rhs.capacity()); - return __cond ? std::move(__rhs.insert(0, __lhs)) - : std::move(__lhs.append(__rhs)); - } - - template - inline basic_string<_CharT, _Traits, _Alloc> - operator+(const _CharT* __lhs, - basic_string<_CharT, _Traits, _Alloc>&& __rhs) - { return std::move(__rhs.insert(0, __lhs)); } - - template - inline basic_string<_CharT, _Traits, _Alloc> - operator+(_CharT __lhs, - basic_string<_CharT, _Traits, _Alloc>&& __rhs) - { return std::move(__rhs.insert(0, 1, __lhs)); } - - template - inline basic_string<_CharT, _Traits, _Alloc> - operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, - const _CharT* __rhs) - { return std::move(__lhs.append(__rhs)); } - - template - inline basic_string<_CharT, _Traits, _Alloc> - operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, - _CharT __rhs) - { return std::move(__lhs.append(1, __rhs)); } -#endif - - // operator == - /** - * @brief Test equivalence of two strings. - * @param __lhs First string. - * @param __rhs Second string. - * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise. - */ - template - inline bool - operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { return __lhs.compare(__rhs) == 0; } - - template - inline - typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, bool>::__type - operator==(const basic_string<_CharT>& __lhs, - const basic_string<_CharT>& __rhs) - { return (__lhs.size() == __rhs.size() - && !std::char_traits<_CharT>::compare(__lhs.data(), __rhs.data(), - __lhs.size())); } - - /** - * @brief Test equivalence of C string and string. - * @param __lhs C string. - * @param __rhs String. - * @return True if @a __rhs.compare(@a __lhs) == 0. False otherwise. - */ - template - inline bool - operator==(const _CharT* __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { return __rhs.compare(__lhs) == 0; } - - /** - * @brief Test equivalence of string and C string. - * @param __lhs String. - * @param __rhs C string. - * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise. - */ - template - inline bool - operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const _CharT* __rhs) - { return __lhs.compare(__rhs) == 0; } - - // operator != - /** - * @brief Test difference of two strings. - * @param __lhs First string. - * @param __rhs Second string. - * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise. - */ - template - inline bool - operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { return !(__lhs == __rhs); } - - /** - * @brief Test difference of C string and string. - * @param __lhs C string. - * @param __rhs String. - * @return True if @a __rhs.compare(@a __lhs) != 0. False otherwise. - */ - template - inline bool - operator!=(const _CharT* __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { return !(__lhs == __rhs); } - - /** - * @brief Test difference of string and C string. - * @param __lhs String. - * @param __rhs C string. - * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise. - */ - template - inline bool - operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const _CharT* __rhs) - { return !(__lhs == __rhs); } - - // operator < - /** - * @brief Test if string precedes string. - * @param __lhs First string. - * @param __rhs Second string. - * @return True if @a __lhs precedes @a __rhs. False otherwise. - */ - template - inline bool - operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { return __lhs.compare(__rhs) < 0; } - - /** - * @brief Test if string precedes C string. - * @param __lhs String. - * @param __rhs C string. - * @return True if @a __lhs precedes @a __rhs. False otherwise. - */ - template - inline bool - operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const _CharT* __rhs) - { return __lhs.compare(__rhs) < 0; } - - /** - * @brief Test if C string precedes string. - * @param __lhs C string. - * @param __rhs String. - * @return True if @a __lhs precedes @a __rhs. False otherwise. - */ - template - inline bool - operator<(const _CharT* __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { return __rhs.compare(__lhs) > 0; } - - // operator > - /** - * @brief Test if string follows string. - * @param __lhs First string. - * @param __rhs Second string. - * @return True if @a __lhs follows @a __rhs. False otherwise. - */ - template - inline bool - operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { return __lhs.compare(__rhs) > 0; } - - /** - * @brief Test if string follows C string. - * @param __lhs String. - * @param __rhs C string. - * @return True if @a __lhs follows @a __rhs. False otherwise. - */ - template - inline bool - operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const _CharT* __rhs) - { return __lhs.compare(__rhs) > 0; } - - /** - * @brief Test if C string follows string. - * @param __lhs C string. - * @param __rhs String. - * @return True if @a __lhs follows @a __rhs. False otherwise. - */ - template - inline bool - operator>(const _CharT* __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { return __rhs.compare(__lhs) < 0; } - - // operator <= - /** - * @brief Test if string doesn't follow string. - * @param __lhs First string. - * @param __rhs Second string. - * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. - */ - template - inline bool - operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { return __lhs.compare(__rhs) <= 0; } - - /** - * @brief Test if string doesn't follow C string. - * @param __lhs String. - * @param __rhs C string. - * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. - */ - template - inline bool - operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const _CharT* __rhs) - { return __lhs.compare(__rhs) <= 0; } - - /** - * @brief Test if C string doesn't follow string. - * @param __lhs C string. - * @param __rhs String. - * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. - */ - template - inline bool - operator<=(const _CharT* __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { return __rhs.compare(__lhs) >= 0; } - - // operator >= - /** - * @brief Test if string doesn't precede string. - * @param __lhs First string. - * @param __rhs Second string. - * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. - */ - template - inline bool - operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { return __lhs.compare(__rhs) >= 0; } - - /** - * @brief Test if string doesn't precede C string. - * @param __lhs String. - * @param __rhs C string. - * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. - */ - template - inline bool - operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const _CharT* __rhs) - { return __lhs.compare(__rhs) >= 0; } - - /** - * @brief Test if C string doesn't precede string. - * @param __lhs C string. - * @param __rhs String. - * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. - */ - template - inline bool - operator>=(const _CharT* __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { return __rhs.compare(__lhs) <= 0; } - - /** - * @brief Swap contents of two strings. - * @param __lhs First string. - * @param __rhs Second string. - * - * Exchanges the contents of @a __lhs and @a __rhs in constant time. - */ - template - inline void - swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, - basic_string<_CharT, _Traits, _Alloc>& __rhs) - { __lhs.swap(__rhs); } - - - /** - * @brief Read stream into a string. - * @param __is Input stream. - * @param __str Buffer to store into. - * @return Reference to the input stream. - * - * Stores characters from @a __is into @a __str until whitespace is - * found, the end of the stream is encountered, or str.max_size() - * is reached. If is.width() is non-zero, that is the limit on the - * number of characters stored into @a __str. Any previous - * contents of @a __str are erased. - */ - template - basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>& __is, - basic_string<_CharT, _Traits, _Alloc>& __str); - - template<> - basic_istream& - operator>>(basic_istream& __is, basic_string& __str); - - /** - * @brief Write string to a stream. - * @param __os Output stream. - * @param __str String to write out. - * @return Reference to the output stream. - * - * Output characters of @a __str into os following the same rules as for - * writing a C string. - */ - template - inline basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __os, - const basic_string<_CharT, _Traits, _Alloc>& __str) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 586. string inserter not a formatted function - return __ostream_insert(__os, __str.data(), __str.size()); - } - - /** - * @brief Read a line from stream into a string. - * @param __is Input stream. - * @param __str Buffer to store into. - * @param __delim Character marking end of line. - * @return Reference to the input stream. - * - * Stores characters from @a __is into @a __str until @a __delim is - * found, the end of the stream is encountered, or str.max_size() - * is reached. Any previous contents of @a __str are erased. If - * @a __delim is encountered, it is extracted but not stored into - * @a __str. - */ - template - basic_istream<_CharT, _Traits>& - getline(basic_istream<_CharT, _Traits>& __is, - basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim); - - /** - * @brief Read a line from stream into a string. - * @param __is Input stream. - * @param __str Buffer to store into. - * @return Reference to the input stream. - * - * Stores characters from is into @a __str until '\n' is - * found, the end of the stream is encountered, or str.max_size() - * is reached. Any previous contents of @a __str are erased. If - * end of line is encountered, it is extracted but not stored into - * @a __str. - */ - template - inline basic_istream<_CharT, _Traits>& - getline(basic_istream<_CharT, _Traits>& __is, - basic_string<_CharT, _Traits, _Alloc>& __str) - { return std::getline(__is, __str, __is.widen('\n')); } - -#if __cplusplus >= 201103L - /// Read a line from an rvalue stream into a string. - template - inline basic_istream<_CharT, _Traits>& - getline(basic_istream<_CharT, _Traits>&& __is, - basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim) - { return std::getline(__is, __str, __delim); } - - /// Read a line from an rvalue stream into a string. - template - inline basic_istream<_CharT, _Traits>& - getline(basic_istream<_CharT, _Traits>&& __is, - basic_string<_CharT, _Traits, _Alloc>& __str) - { return std::getline(__is, __str); } -#endif - - template<> - basic_istream& - getline(basic_istream& __in, basic_string& __str, - char __delim); - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - basic_istream& - getline(basic_istream& __in, basic_string& __str, - wchar_t __delim); -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99) - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - - // 21.4 Numeric Conversions [string.conversions]. - inline int - stoi(const string& __str, size_t* __idx = 0, int __base = 10) - { return __gnu_cxx::__stoa(&std::strtol, "stoi", __str.c_str(), - __idx, __base); } - - inline long - stol(const string& __str, size_t* __idx = 0, int __base = 10) - { return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(), - __idx, __base); } - - inline unsigned long - stoul(const string& __str, size_t* __idx = 0, int __base = 10) - { return __gnu_cxx::__stoa(&std::strtoul, "stoul", __str.c_str(), - __idx, __base); } - - inline long long - stoll(const string& __str, size_t* __idx = 0, int __base = 10) - { return __gnu_cxx::__stoa(&std::strtoll, "stoll", __str.c_str(), - __idx, __base); } - - inline unsigned long long - stoull(const string& __str, size_t* __idx = 0, int __base = 10) - { return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(), - __idx, __base); } - - // NB: strtof vs strtod. - inline float - stof(const string& __str, size_t* __idx = 0) - { return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); } - - inline double - stod(const string& __str, size_t* __idx = 0) - { return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); } - - inline long double - stold(const string& __str, size_t* __idx = 0) - { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); } - - // NB: (v)snprintf vs sprintf. - - // DR 1261. - inline string - to_string(int __val) - { return __gnu_cxx::__to_xstring(&std::vsnprintf, 4 * sizeof(int), - "%d", __val); } - - inline string - to_string(unsigned __val) - { return __gnu_cxx::__to_xstring(&std::vsnprintf, - 4 * sizeof(unsigned), - "%u", __val); } - - inline string - to_string(long __val) - { return __gnu_cxx::__to_xstring(&std::vsnprintf, 4 * sizeof(long), - "%ld", __val); } - - inline string - to_string(unsigned long __val) - { return __gnu_cxx::__to_xstring(&std::vsnprintf, - 4 * sizeof(unsigned long), - "%lu", __val); } - - inline string - to_string(long long __val) - { return __gnu_cxx::__to_xstring(&std::vsnprintf, - 4 * sizeof(long long), - "%lld", __val); } - - inline string - to_string(unsigned long long __val) - { return __gnu_cxx::__to_xstring(&std::vsnprintf, - 4 * sizeof(unsigned long long), - "%llu", __val); } - - inline string - to_string(float __val) - { - const int __n = - __gnu_cxx::__numeric_traits::__max_exponent10 + 20; - return __gnu_cxx::__to_xstring(&std::vsnprintf, __n, - "%f", __val); - } - - inline string - to_string(double __val) - { - const int __n = - __gnu_cxx::__numeric_traits::__max_exponent10 + 20; - return __gnu_cxx::__to_xstring(&std::vsnprintf, __n, - "%f", __val); - } - - inline string - to_string(long double __val) - { - const int __n = - __gnu_cxx::__numeric_traits::__max_exponent10 + 20; - return __gnu_cxx::__to_xstring(&std::vsnprintf, __n, - "%Lf", __val); - } - -#ifdef _GLIBCXX_USE_WCHAR_T - inline int - stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) - { return __gnu_cxx::__stoa(&std::wcstol, "stoi", __str.c_str(), - __idx, __base); } - - inline long - stol(const wstring& __str, size_t* __idx = 0, int __base = 10) - { return __gnu_cxx::__stoa(&std::wcstol, "stol", __str.c_str(), - __idx, __base); } - - inline unsigned long - stoul(const wstring& __str, size_t* __idx = 0, int __base = 10) - { return __gnu_cxx::__stoa(&std::wcstoul, "stoul", __str.c_str(), - __idx, __base); } - - inline long long - stoll(const wstring& __str, size_t* __idx = 0, int __base = 10) - { return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(), - __idx, __base); } - - inline unsigned long long - stoull(const wstring& __str, size_t* __idx = 0, int __base = 10) - { return __gnu_cxx::__stoa(&std::wcstoull, "stoull", __str.c_str(), - __idx, __base); } - - // NB: wcstof vs wcstod. - inline float - stof(const wstring& __str, size_t* __idx = 0) - { return __gnu_cxx::__stoa(&std::wcstof, "stof", __str.c_str(), __idx); } - - inline double - stod(const wstring& __str, size_t* __idx = 0) - { return __gnu_cxx::__stoa(&std::wcstod, "stod", __str.c_str(), __idx); } - - inline long double - stold(const wstring& __str, size_t* __idx = 0) - { return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); } - -#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF - // DR 1261. - inline wstring - to_wstring(int __val) - { return __gnu_cxx::__to_xstring(&std::vswprintf, 4 * sizeof(int), - L"%d", __val); } - - inline wstring - to_wstring(unsigned __val) - { return __gnu_cxx::__to_xstring(&std::vswprintf, - 4 * sizeof(unsigned), - L"%u", __val); } - - inline wstring - to_wstring(long __val) - { return __gnu_cxx::__to_xstring(&std::vswprintf, 4 * sizeof(long), - L"%ld", __val); } - - inline wstring - to_wstring(unsigned long __val) - { return __gnu_cxx::__to_xstring(&std::vswprintf, - 4 * sizeof(unsigned long), - L"%lu", __val); } - - inline wstring - to_wstring(long long __val) - { return __gnu_cxx::__to_xstring(&std::vswprintf, - 4 * sizeof(long long), - L"%lld", __val); } - - inline wstring - to_wstring(unsigned long long __val) - { return __gnu_cxx::__to_xstring(&std::vswprintf, - 4 * sizeof(unsigned long long), - L"%llu", __val); } - - inline wstring - to_wstring(float __val) - { - const int __n = - __gnu_cxx::__numeric_traits::__max_exponent10 + 20; - return __gnu_cxx::__to_xstring(&std::vswprintf, __n, - L"%f", __val); - } - - inline wstring - to_wstring(double __val) - { - const int __n = - __gnu_cxx::__numeric_traits::__max_exponent10 + 20; - return __gnu_cxx::__to_xstring(&std::vswprintf, __n, - L"%f", __val); - } - - inline wstring - to_wstring(long double __val) - { - const int __n = - __gnu_cxx::__numeric_traits::__max_exponent10 + 20; - return __gnu_cxx::__to_xstring(&std::vswprintf, __n, - L"%Lf", __val); - } -#endif // _GLIBCXX_HAVE_BROKEN_VSWPRINTF -#endif - -_GLIBCXX_END_NAMESPACE_CXX11 -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* C++11 && _GLIBCXX_USE_C99 ... */ - -#if __cplusplus >= 201103L - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // DR 1182. - -#ifndef _GLIBCXX_COMPATIBILITY_CXX0X - /// std::hash specialization for string. - template<> - struct hash - : public __hash_base - { - size_t - operator()(const string& __s) const noexcept - { return std::_Hash_impl::hash(__s.data(), __s.length()); } - }; - - template<> - struct __is_fast_hash> : std::false_type - { }; - -#ifdef _GLIBCXX_USE_WCHAR_T - /// std::hash specialization for wstring. - template<> - struct hash - : public __hash_base - { - size_t - operator()(const wstring& __s) const noexcept - { return std::_Hash_impl::hash(__s.data(), - __s.length() * sizeof(wchar_t)); } - }; - - template<> - struct __is_fast_hash> : std::false_type - { }; -#endif -#endif /* _GLIBCXX_COMPATIBILITY_CXX0X */ - -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - /// std::hash specialization for u16string. - template<> - struct hash - : public __hash_base - { - size_t - operator()(const u16string& __s) const noexcept - { return std::_Hash_impl::hash(__s.data(), - __s.length() * sizeof(char16_t)); } - }; - - template<> - struct __is_fast_hash> : std::false_type - { }; - - /// std::hash specialization for u32string. - template<> - struct hash - : public __hash_base - { - size_t - operator()(const u32string& __s) const noexcept - { return std::_Hash_impl::hash(__s.data(), - __s.length() * sizeof(char32_t)); } - }; - - template<> - struct __is_fast_hash> : std::false_type - { }; -#endif - -#if __cplusplus > 201103L - -#define __cpp_lib_string_udls 201304 - - inline namespace literals - { - inline namespace string_literals - { - - _GLIBCXX_DEFAULT_ABI_TAG - inline basic_string - operator""s(const char* __str, size_t __len) - { return basic_string{__str, __len}; } - -#ifdef _GLIBCXX_USE_WCHAR_T - _GLIBCXX_DEFAULT_ABI_TAG - inline basic_string - operator""s(const wchar_t* __str, size_t __len) - { return basic_string{__str, __len}; } -#endif - -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - _GLIBCXX_DEFAULT_ABI_TAG - inline basic_string - operator""s(const char16_t* __str, size_t __len) - { return basic_string{__str, __len}; } - - _GLIBCXX_DEFAULT_ABI_TAG - inline basic_string - operator""s(const char32_t* __str, size_t __len) - { return basic_string{__str, __len}; } -#endif - - } // inline namespace string_literals - } // inline namespace literals - -#endif // __cplusplus > 201103L - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif // C++11 - -#endif /* _BASIC_STRING_H */ diff --git a/openflow/usr/include/c++/5/bits/basic_string.tcc b/openflow/usr/include/c++/5/bits/basic_string.tcc deleted file mode 100644 index b9da93b..0000000 --- a/openflow/usr/include/c++/5/bits/basic_string.tcc +++ /dev/null @@ -1,1611 +0,0 @@ -// Components for manipulating sequences of characters -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/basic_string.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{string} - */ - -// -// ISO C++ 14882: 21 Strings library -// - -// Written by Jason Merrill based upon the specification by Takanori Adachi -// in ANSI X3J16/94-0013R2. Rewritten by Nathan Myers to ISO-14882. -// Non-reference-counted implementation written by Paolo Carlini and -// updated by Jonathan Wakely for ISO-14882-2011. - -#ifndef _BASIC_STRING_TCC -#define _BASIC_STRING_TCC 1 - -#pragma GCC system_header - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#if _GLIBCXX_USE_CXX11_ABI - - template - const typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>::npos; - - template - void - basic_string<_CharT, _Traits, _Alloc>:: - swap(basic_string& __s) _GLIBCXX_NOEXCEPT - { - if (this == &__s) - return; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 431. Swapping containers with unequal allocators. - // TODO propagation traits - std::__alloc_swap::_S_do_it(_M_get_allocator(), - __s._M_get_allocator()); - - if (_M_is_local()) - if (__s._M_is_local()) - { - if (length() && __s.length()) - { - _CharT __tmp_data[_S_local_capacity + 1]; - traits_type::copy(__tmp_data, __s._M_local_buf, - _S_local_capacity + 1); - traits_type::copy(__s._M_local_buf, _M_local_buf, - _S_local_capacity + 1); - traits_type::copy(_M_local_buf, __tmp_data, - _S_local_capacity + 1); - } - else if (__s.length()) - { - traits_type::copy(_M_local_buf, __s._M_local_buf, - _S_local_capacity + 1); - _M_length(__s.length()); - __s._M_set_length(0); - return; - } - else if (length()) - { - traits_type::copy(__s._M_local_buf, _M_local_buf, - _S_local_capacity + 1); - __s._M_length(length()); - _M_set_length(0); - return; - } - } - else - { - const size_type __tmp_capacity = __s._M_allocated_capacity; - traits_type::copy(__s._M_local_buf, _M_local_buf, - _S_local_capacity + 1); - _M_data(__s._M_data()); - __s._M_data(__s._M_local_buf); - _M_capacity(__tmp_capacity); - } - else - { - const size_type __tmp_capacity = _M_allocated_capacity; - if (__s._M_is_local()) - { - traits_type::copy(_M_local_buf, __s._M_local_buf, - _S_local_capacity + 1); - __s._M_data(_M_data()); - _M_data(_M_local_buf); - } - else - { - pointer __tmp_ptr = _M_data(); - _M_data(__s._M_data()); - __s._M_data(__tmp_ptr); - _M_capacity(__s._M_allocated_capacity); - } - __s._M_capacity(__tmp_capacity); - } - - const size_type __tmp_length = length(); - _M_length(__s.length()); - __s._M_length(__tmp_length); - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::pointer - basic_string<_CharT, _Traits, _Alloc>:: - _M_create(size_type& __capacity, size_type __old_capacity) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 83. String::npos vs. string::max_size() - if (__capacity > max_size()) - std::__throw_length_error(__N("basic_string::_M_create")); - - // The below implements an exponential growth policy, necessary to - // meet amortized linear time requirements of the library: see - // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html. - if (__capacity > __old_capacity && __capacity < 2 * __old_capacity) - { - __capacity = 2 * __old_capacity; - // Never allocate a string bigger than max_size. - if (__capacity > max_size()) - __capacity = max_size(); - } - - // NB: Need an array of char_type[__capacity], plus a terminating - // null char_type() element. - return _Alloc_traits::allocate(_M_get_allocator(), __capacity + 1); - } - - // NB: This is the special case for Input Iterators, used in - // istreambuf_iterators, etc. - // Input Iterators have a cost structure very different from - // pointers, calling for a different coding style. - template - template - void - basic_string<_CharT, _Traits, _Alloc>:: - _M_construct(_InIterator __beg, _InIterator __end, - std::input_iterator_tag) - { - size_type __len = 0; - size_type __capacity = size_type(_S_local_capacity); - - while (__beg != __end && __len < __capacity) - { - _M_data()[__len++] = *__beg; - ++__beg; - } - - __try - { - while (__beg != __end) - { - if (__len == __capacity) - { - // Allocate more space. - __capacity = __len + 1; - pointer __another = _M_create(__capacity, __len); - this->_S_copy(__another, _M_data(), __len); - _M_dispose(); - _M_data(__another); - _M_capacity(__capacity); - } - _M_data()[__len++] = *__beg; - ++__beg; - } - } - __catch(...) - { - _M_dispose(); - __throw_exception_again; - } - - _M_set_length(__len); - } - - template - template - void - basic_string<_CharT, _Traits, _Alloc>:: - _M_construct(_InIterator __beg, _InIterator __end, - std::forward_iterator_tag) - { - // NB: Not required, but considered best practice. - if (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end) - std::__throw_logic_error(__N("basic_string::" - "_M_construct null not valid")); - - size_type __dnew = static_cast(std::distance(__beg, __end)); - - if (__dnew > size_type(_S_local_capacity)) - { - _M_data(_M_create(__dnew, size_type(0))); - _M_capacity(__dnew); - } - - // Check for out_of_range and length_error exceptions. - __try - { this->_S_copy_chars(_M_data(), __beg, __end); } - __catch(...) - { - _M_dispose(); - __throw_exception_again; - } - - _M_set_length(__dnew); - } - - template - void - basic_string<_CharT, _Traits, _Alloc>:: - _M_construct(size_type __n, _CharT __c) - { - if (__n > size_type(_S_local_capacity)) - { - _M_data(_M_create(__n, size_type(0))); - _M_capacity(__n); - } - - if (__n) - this->_S_assign(_M_data(), __n, __c); - - _M_set_length(__n); - } - - template - void - basic_string<_CharT, _Traits, _Alloc>:: - _M_assign(const basic_string& __str) - { - if (this != &__str) - { - const size_type __rsize = __str.length(); - const size_type __capacity = capacity(); - - if (__rsize > __capacity) - { - size_type __new_capacity = __rsize; - pointer __tmp = _M_create(__new_capacity, __capacity); - _M_dispose(); - _M_data(__tmp); - _M_capacity(__new_capacity); - } - - if (__rsize) - this->_S_copy(_M_data(), __str._M_data(), __rsize); - - _M_set_length(__rsize); - } - } - - template - void - basic_string<_CharT, _Traits, _Alloc>:: - reserve(size_type __res) - { - // Make sure we don't shrink below the current size. - if (__res < length()) - __res = length(); - - const size_type __capacity = capacity(); - if (__res != __capacity) - { - if (__res > __capacity - || __res > size_type(_S_local_capacity)) - { - pointer __tmp = _M_create(__res, __capacity); - this->_S_copy(__tmp, _M_data(), length() + 1); - _M_dispose(); - _M_data(__tmp); - _M_capacity(__res); - } - else if (!_M_is_local()) - { - this->_S_copy(_M_local_data(), _M_data(), length() + 1); - _M_destroy(__capacity); - _M_data(_M_local_data()); - } - } - } - - template - void - basic_string<_CharT, _Traits, _Alloc>:: - _M_mutate(size_type __pos, size_type __len1, const _CharT* __s, - size_type __len2) - { - const size_type __how_much = length() - __pos - __len1; - - size_type __new_capacity = length() + __len2 - __len1; - pointer __r = _M_create(__new_capacity, capacity()); - - if (__pos) - this->_S_copy(__r, _M_data(), __pos); - if (__s && __len2) - this->_S_copy(__r + __pos, __s, __len2); - if (__how_much) - this->_S_copy(__r + __pos + __len2, - _M_data() + __pos + __len1, __how_much); - - _M_dispose(); - _M_data(__r); - _M_capacity(__new_capacity); - } - - template - void - basic_string<_CharT, _Traits, _Alloc>:: - _M_erase(size_type __pos, size_type __n) - { - const size_type __how_much = length() - __pos - __n; - - if (__how_much && __n) - this->_S_move(_M_data() + __pos, _M_data() + __pos + __n, __how_much); - - _M_set_length(length() - __n); - } - - template - void - basic_string<_CharT, _Traits, _Alloc>:: - resize(size_type __n, _CharT __c) - { - const size_type __size = this->size(); - if (__size < __n) - this->append(__n - __size, __c); - else if (__n < __size) - this->_M_erase(__n, __size - __n); - } - - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - _M_append(const _CharT* __s, size_type __n) - { - const size_type __len = __n + this->size(); - - if (__len <= this->capacity()) - { - if (__n) - this->_S_copy(this->_M_data() + this->size(), __s, __n); - } - else - this->_M_mutate(this->size(), size_type(0), __s, __n); - - this->_M_set_length(__len); - return *this; - } - - template - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - _M_replace_dispatch(const_iterator __i1, const_iterator __i2, - _InputIterator __k1, _InputIterator __k2, - std::__false_type) - { - const basic_string __s(__k1, __k2); - const size_type __n1 = __i2 - __i1; - return _M_replace(__i1 - begin(), __n1, __s._M_data(), - __s.size()); - } - - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, - _CharT __c) - { - _M_check_length(__n1, __n2, "basic_string::_M_replace_aux"); - - const size_type __old_size = this->size(); - const size_type __new_size = __old_size + __n2 - __n1; - - if (__new_size <= this->capacity()) - { - _CharT* __p = this->_M_data() + __pos1; - - const size_type __how_much = __old_size - __pos1 - __n1; - if (__how_much && __n1 != __n2) - this->_S_move(__p + __n2, __p + __n1, __how_much); - } - else - this->_M_mutate(__pos1, __n1, 0, __n2); - - if (__n2) - this->_S_assign(this->_M_data() + __pos1, __n2, __c); - - this->_M_set_length(__new_size); - return *this; - } - - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - _M_replace(size_type __pos, size_type __len1, const _CharT* __s, - const size_type __len2) - { - _M_check_length(__len1, __len2, "basic_string::_M_replace"); - - const size_type __old_size = this->size(); - const size_type __new_size = __old_size + __len2 - __len1; - - if (__new_size <= this->capacity()) - { - _CharT* __p = this->_M_data() + __pos; - - const size_type __how_much = __old_size - __pos - __len1; - if (_M_disjunct(__s)) - { - if (__how_much && __len1 != __len2) - this->_S_move(__p + __len2, __p + __len1, __how_much); - if (__len2) - this->_S_copy(__p, __s, __len2); - } - else - { - // Work in-place. - if (__len2 && __len2 <= __len1) - this->_S_move(__p, __s, __len2); - if (__how_much && __len1 != __len2) - this->_S_move(__p + __len2, __p + __len1, __how_much); - if (__len2 > __len1) - { - if (__s + __len2 <= __p + __len1) - this->_S_move(__p, __s, __len2); - else if (__s >= __p + __len1) - this->_S_copy(__p, __s + __len2 - __len1, __len2); - else - { - const size_type __nleft = (__p + __len1) - __s; - this->_S_move(__p, __s, __nleft); - this->_S_copy(__p + __nleft, __p + __len2, - __len2 - __nleft); - } - } - } - } - else - this->_M_mutate(__pos, __len1, __s, __len2); - - this->_M_set_length(__new_size); - return *this; - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>:: - copy(_CharT* __s, size_type __n, size_type __pos) const - { - _M_check(__pos, "basic_string::copy"); - __n = _M_limit(__pos, __n); - __glibcxx_requires_string_len(__s, __n); - if (__n) - _S_copy(__s, _M_data() + __pos, __n); - // 21.3.5.7 par 3: do not append null. (good.) - return __n; - } - -#else // !_GLIBCXX_USE_CXX11_ABI - - template - const typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>:: - _Rep::_S_max_size = (((npos - sizeof(_Rep_base))/sizeof(_CharT)) - 1) / 4; - - template - const _CharT - basic_string<_CharT, _Traits, _Alloc>:: - _Rep::_S_terminal = _CharT(); - - template - const typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>::npos; - - // Linker sets _S_empty_rep_storage to all 0s (one reference, empty string) - // at static init time (before static ctors are run). - template - typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_empty_rep_storage[ - (sizeof(_Rep_base) + sizeof(_CharT) + sizeof(size_type) - 1) / - sizeof(size_type)]; - - // NB: This is the special case for Input Iterators, used in - // istreambuf_iterators, etc. - // Input Iterators have a cost structure very different from - // pointers, calling for a different coding style. - template - template - _CharT* - basic_string<_CharT, _Traits, _Alloc>:: - _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, - input_iterator_tag) - { -#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 - if (__beg == __end && __a == _Alloc()) - return _S_empty_rep()._M_refdata(); -#endif - // Avoid reallocation for common case. - _CharT __buf[128]; - size_type __len = 0; - while (__beg != __end && __len < sizeof(__buf) / sizeof(_CharT)) - { - __buf[__len++] = *__beg; - ++__beg; - } - _Rep* __r = _Rep::_S_create(__len, size_type(0), __a); - _M_copy(__r->_M_refdata(), __buf, __len); - __try - { - while (__beg != __end) - { - if (__len == __r->_M_capacity) - { - // Allocate more space. - _Rep* __another = _Rep::_S_create(__len + 1, __len, __a); - _M_copy(__another->_M_refdata(), __r->_M_refdata(), __len); - __r->_M_destroy(__a); - __r = __another; - } - __r->_M_refdata()[__len++] = *__beg; - ++__beg; - } - } - __catch(...) - { - __r->_M_destroy(__a); - __throw_exception_again; - } - __r->_M_set_length_and_sharable(__len); - return __r->_M_refdata(); - } - - template - template - _CharT* - basic_string<_CharT, _Traits, _Alloc>:: - _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, - forward_iterator_tag) - { -#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 - if (__beg == __end && __a == _Alloc()) - return _S_empty_rep()._M_refdata(); -#endif - // NB: Not required, but considered best practice. - if (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end) - __throw_logic_error(__N("basic_string::_S_construct null not valid")); - - const size_type __dnew = static_cast(std::distance(__beg, - __end)); - // Check for out_of_range and length_error exceptions. - _Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a); - __try - { _S_copy_chars(__r->_M_refdata(), __beg, __end); } - __catch(...) - { - __r->_M_destroy(__a); - __throw_exception_again; - } - __r->_M_set_length_and_sharable(__dnew); - return __r->_M_refdata(); - } - - template - _CharT* - basic_string<_CharT, _Traits, _Alloc>:: - _S_construct(size_type __n, _CharT __c, const _Alloc& __a) - { -#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 - if (__n == 0 && __a == _Alloc()) - return _S_empty_rep()._M_refdata(); -#endif - // Check for out_of_range and length_error exceptions. - _Rep* __r = _Rep::_S_create(__n, size_type(0), __a); - if (__n) - _M_assign(__r->_M_refdata(), __n, __c); - - __r->_M_set_length_and_sharable(__n); - return __r->_M_refdata(); - } - - template - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(const basic_string& __str) - : _M_dataplus(__str._M_rep()->_M_grab(_Alloc(__str.get_allocator()), - __str.get_allocator()), - __str.get_allocator()) - { } - - template - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(const _Alloc& __a) - : _M_dataplus(_S_construct(size_type(), _CharT(), __a), __a) - { } - - template - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(const basic_string& __str, size_type __pos, size_type __n) - : _M_dataplus(_S_construct(__str._M_data() - + __str._M_check(__pos, - "basic_string::basic_string"), - __str._M_data() + __str._M_limit(__pos, __n) - + __pos, _Alloc()), _Alloc()) - { } - - template - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(const basic_string& __str, size_type __pos, - size_type __n, const _Alloc& __a) - : _M_dataplus(_S_construct(__str._M_data() - + __str._M_check(__pos, - "basic_string::basic_string"), - __str._M_data() + __str._M_limit(__pos, __n) - + __pos, __a), __a) - { } - - // TBD: DPG annotate - template - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(const _CharT* __s, size_type __n, const _Alloc& __a) - : _M_dataplus(_S_construct(__s, __s + __n, __a), __a) - { } - - // TBD: DPG annotate - template - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(const _CharT* __s, const _Alloc& __a) - : _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) : - __s + npos, __a), __a) - { } - - template - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(size_type __n, _CharT __c, const _Alloc& __a) - : _M_dataplus(_S_construct(__n, __c, __a), __a) - { } - - // TBD: DPG annotate - template - template - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a) - : _M_dataplus(_S_construct(__beg, __end, __a), __a) - { } - -#if __cplusplus >= 201103L - template - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(initializer_list<_CharT> __l, const _Alloc& __a) - : _M_dataplus(_S_construct(__l.begin(), __l.end(), __a), __a) - { } -#endif - - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - assign(const basic_string& __str) - { - if (_M_rep() != __str._M_rep()) - { - // XXX MT - const allocator_type __a = this->get_allocator(); - _CharT* __tmp = __str._M_rep()->_M_grab(__a, __str.get_allocator()); - _M_rep()->_M_dispose(__a); - _M_data(__tmp); - } - return *this; - } - - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - assign(const _CharT* __s, size_type __n) - { - __glibcxx_requires_string_len(__s, __n); - _M_check_length(this->size(), __n, "basic_string::assign"); - if (_M_disjunct(__s) || _M_rep()->_M_is_shared()) - return _M_replace_safe(size_type(0), this->size(), __s, __n); - else - { - // Work in-place. - const size_type __pos = __s - _M_data(); - if (__pos >= __n) - _M_copy(_M_data(), __s, __n); - else if (__pos) - _M_move(_M_data(), __s, __n); - _M_rep()->_M_set_length_and_sharable(__n); - return *this; - } - } - - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - append(size_type __n, _CharT __c) - { - if (__n) - { - _M_check_length(size_type(0), __n, "basic_string::append"); - const size_type __len = __n + this->size(); - if (__len > this->capacity() || _M_rep()->_M_is_shared()) - this->reserve(__len); - _M_assign(_M_data() + this->size(), __n, __c); - _M_rep()->_M_set_length_and_sharable(__len); - } - return *this; - } - - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - append(const _CharT* __s, size_type __n) - { - __glibcxx_requires_string_len(__s, __n); - if (__n) - { - _M_check_length(size_type(0), __n, "basic_string::append"); - const size_type __len = __n + this->size(); - if (__len > this->capacity() || _M_rep()->_M_is_shared()) - { - if (_M_disjunct(__s)) - this->reserve(__len); - else - { - const size_type __off = __s - _M_data(); - this->reserve(__len); - __s = _M_data() + __off; - } - } - _M_copy(_M_data() + this->size(), __s, __n); - _M_rep()->_M_set_length_and_sharable(__len); - } - return *this; - } - - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - append(const basic_string& __str) - { - const size_type __size = __str.size(); - if (__size) - { - const size_type __len = __size + this->size(); - if (__len > this->capacity() || _M_rep()->_M_is_shared()) - this->reserve(__len); - _M_copy(_M_data() + this->size(), __str._M_data(), __size); - _M_rep()->_M_set_length_and_sharable(__len); - } - return *this; - } - - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - append(const basic_string& __str, size_type __pos, size_type __n) - { - __str._M_check(__pos, "basic_string::append"); - __n = __str._M_limit(__pos, __n); - if (__n) - { - const size_type __len = __n + this->size(); - if (__len > this->capacity() || _M_rep()->_M_is_shared()) - this->reserve(__len); - _M_copy(_M_data() + this->size(), __str._M_data() + __pos, __n); - _M_rep()->_M_set_length_and_sharable(__len); - } - return *this; - } - - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - insert(size_type __pos, const _CharT* __s, size_type __n) - { - __glibcxx_requires_string_len(__s, __n); - _M_check(__pos, "basic_string::insert"); - _M_check_length(size_type(0), __n, "basic_string::insert"); - if (_M_disjunct(__s) || _M_rep()->_M_is_shared()) - return _M_replace_safe(__pos, size_type(0), __s, __n); - else - { - // Work in-place. - const size_type __off = __s - _M_data(); - _M_mutate(__pos, 0, __n); - __s = _M_data() + __off; - _CharT* __p = _M_data() + __pos; - if (__s + __n <= __p) - _M_copy(__p, __s, __n); - else if (__s >= __p) - _M_copy(__p, __s + __n, __n); - else - { - const size_type __nleft = __p - __s; - _M_copy(__p, __s, __nleft); - _M_copy(__p + __nleft, __p + __n, __n - __nleft); - } - return *this; - } - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::iterator - basic_string<_CharT, _Traits, _Alloc>:: - erase(iterator __first, iterator __last) - { - _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last - && __last <= _M_iend()); - - // NB: This isn't just an optimization (bail out early when - // there is nothing to do, really), it's also a correctness - // issue vs MT, see libstdc++/40518. - const size_type __size = __last - __first; - if (__size) - { - const size_type __pos = __first - _M_ibegin(); - _M_mutate(__pos, __size, size_type(0)); - _M_rep()->_M_set_leaked(); - return iterator(_M_data() + __pos); - } - else - return __first; - } - - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - replace(size_type __pos, size_type __n1, const _CharT* __s, - size_type __n2) - { - __glibcxx_requires_string_len(__s, __n2); - _M_check(__pos, "basic_string::replace"); - __n1 = _M_limit(__pos, __n1); - _M_check_length(__n1, __n2, "basic_string::replace"); - bool __left; - if (_M_disjunct(__s) || _M_rep()->_M_is_shared()) - return _M_replace_safe(__pos, __n1, __s, __n2); - else if ((__left = __s + __n2 <= _M_data() + __pos) - || _M_data() + __pos + __n1 <= __s) - { - // Work in-place: non-overlapping case. - size_type __off = __s - _M_data(); - __left ? __off : (__off += __n2 - __n1); - _M_mutate(__pos, __n1, __n2); - _M_copy(_M_data() + __pos, _M_data() + __off, __n2); - return *this; - } - else - { - // Todo: overlapping case. - const basic_string __tmp(__s, __n2); - return _M_replace_safe(__pos, __n1, __tmp._M_data(), __n2); - } - } - - template - void - basic_string<_CharT, _Traits, _Alloc>::_Rep:: - _M_destroy(const _Alloc& __a) throw () - { - const size_type __size = sizeof(_Rep_base) + - (this->_M_capacity + 1) * sizeof(_CharT); - _Raw_bytes_alloc(__a).deallocate(reinterpret_cast(this), __size); - } - - template - void - basic_string<_CharT, _Traits, _Alloc>:: - _M_leak_hard() - { -#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 - if (_M_rep() == &_S_empty_rep()) - return; -#endif - if (_M_rep()->_M_is_shared()) - _M_mutate(0, 0, 0); - _M_rep()->_M_set_leaked(); - } - - template - void - basic_string<_CharT, _Traits, _Alloc>:: - _M_mutate(size_type __pos, size_type __len1, size_type __len2) - { - const size_type __old_size = this->size(); - const size_type __new_size = __old_size + __len2 - __len1; - const size_type __how_much = __old_size - __pos - __len1; - - if (__new_size > this->capacity() || _M_rep()->_M_is_shared()) - { - // Must reallocate. - const allocator_type __a = get_allocator(); - _Rep* __r = _Rep::_S_create(__new_size, this->capacity(), __a); - - if (__pos) - _M_copy(__r->_M_refdata(), _M_data(), __pos); - if (__how_much) - _M_copy(__r->_M_refdata() + __pos + __len2, - _M_data() + __pos + __len1, __how_much); - - _M_rep()->_M_dispose(__a); - _M_data(__r->_M_refdata()); - } - else if (__how_much && __len1 != __len2) - { - // Work in-place. - _M_move(_M_data() + __pos + __len2, - _M_data() + __pos + __len1, __how_much); - } - _M_rep()->_M_set_length_and_sharable(__new_size); - } - - template - void - basic_string<_CharT, _Traits, _Alloc>:: - reserve(size_type __res) - { - if (__res != this->capacity() || _M_rep()->_M_is_shared()) - { - // Make sure we don't shrink below the current size - if (__res < this->size()) - __res = this->size(); - const allocator_type __a = get_allocator(); - _CharT* __tmp = _M_rep()->_M_clone(__a, __res - this->size()); - _M_rep()->_M_dispose(__a); - _M_data(__tmp); - } - } - - template - void - basic_string<_CharT, _Traits, _Alloc>:: - swap(basic_string& __s) - { - if (_M_rep()->_M_is_leaked()) - _M_rep()->_M_set_sharable(); - if (__s._M_rep()->_M_is_leaked()) - __s._M_rep()->_M_set_sharable(); - if (this->get_allocator() == __s.get_allocator()) - { - _CharT* __tmp = _M_data(); - _M_data(__s._M_data()); - __s._M_data(__tmp); - } - // The code below can usually be optimized away. - else - { - const basic_string __tmp1(_M_ibegin(), _M_iend(), - __s.get_allocator()); - const basic_string __tmp2(__s._M_ibegin(), __s._M_iend(), - this->get_allocator()); - *this = __tmp2; - __s = __tmp1; - } - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::_Rep* - basic_string<_CharT, _Traits, _Alloc>::_Rep:: - _S_create(size_type __capacity, size_type __old_capacity, - const _Alloc& __alloc) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 83. String::npos vs. string::max_size() - if (__capacity > _S_max_size) - __throw_length_error(__N("basic_string::_S_create")); - - // The standard places no restriction on allocating more memory - // than is strictly needed within this layer at the moment or as - // requested by an explicit application call to reserve(). - - // Many malloc implementations perform quite poorly when an - // application attempts to allocate memory in a stepwise fashion - // growing each allocation size by only 1 char. Additionally, - // it makes little sense to allocate less linear memory than the - // natural blocking size of the malloc implementation. - // Unfortunately, we would need a somewhat low-level calculation - // with tuned parameters to get this perfect for any particular - // malloc implementation. Fortunately, generalizations about - // common features seen among implementations seems to suffice. - - // __pagesize need not match the actual VM page size for good - // results in practice, thus we pick a common value on the low - // side. __malloc_header_size is an estimate of the amount of - // overhead per memory allocation (in practice seen N * sizeof - // (void*) where N is 0, 2 or 4). According to folklore, - // picking this value on the high side is better than - // low-balling it (especially when this algorithm is used with - // malloc implementations that allocate memory blocks rounded up - // to a size which is a power of 2). - const size_type __pagesize = 4096; - const size_type __malloc_header_size = 4 * sizeof(void*); - - // The below implements an exponential growth policy, necessary to - // meet amortized linear time requirements of the library: see - // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html. - // It's active for allocations requiring an amount of memory above - // system pagesize. This is consistent with the requirements of the - // standard: http://gcc.gnu.org/ml/libstdc++/2001-07/msg00130.html - if (__capacity > __old_capacity && __capacity < 2 * __old_capacity) - __capacity = 2 * __old_capacity; - - // NB: Need an array of char_type[__capacity], plus a terminating - // null char_type() element, plus enough for the _Rep data structure. - // Whew. Seemingly so needy, yet so elemental. - size_type __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep); - - const size_type __adj_size = __size + __malloc_header_size; - if (__adj_size > __pagesize && __capacity > __old_capacity) - { - const size_type __extra = __pagesize - __adj_size % __pagesize; - __capacity += __extra / sizeof(_CharT); - // Never allocate a string bigger than _S_max_size. - if (__capacity > _S_max_size) - __capacity = _S_max_size; - __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep); - } - - // NB: Might throw, but no worries about a leak, mate: _Rep() - // does not throw. - void* __place = _Raw_bytes_alloc(__alloc).allocate(__size); - _Rep *__p = new (__place) _Rep; - __p->_M_capacity = __capacity; - // ABI compatibility - 3.4.x set in _S_create both - // _M_refcount and _M_length. All callers of _S_create - // in basic_string.tcc then set just _M_length. - // In 4.0.x and later both _M_refcount and _M_length - // are initialized in the callers, unfortunately we can - // have 3.4.x compiled code with _S_create callers inlined - // calling 4.0.x+ _S_create. - __p->_M_set_sharable(); - return __p; - } - - template - _CharT* - basic_string<_CharT, _Traits, _Alloc>::_Rep:: - _M_clone(const _Alloc& __alloc, size_type __res) - { - // Requested capacity of the clone. - const size_type __requested_cap = this->_M_length + __res; - _Rep* __r = _Rep::_S_create(__requested_cap, this->_M_capacity, - __alloc); - if (this->_M_length) - _M_copy(__r->_M_refdata(), _M_refdata(), this->_M_length); - - __r->_M_set_length_and_sharable(this->_M_length); - return __r->_M_refdata(); - } - - template - void - basic_string<_CharT, _Traits, _Alloc>:: - resize(size_type __n, _CharT __c) - { - const size_type __size = this->size(); - _M_check_length(__size, __n, "basic_string::resize"); - if (__size < __n) - this->append(__n - __size, __c); - else if (__n < __size) - this->erase(__n); - // else nothing (in particular, avoid calling _M_mutate() unnecessarily.) - } - - template - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1, - _InputIterator __k2, __false_type) - { - const basic_string __s(__k1, __k2); - const size_type __n1 = __i2 - __i1; - _M_check_length(__n1, __s.size(), "basic_string::_M_replace_dispatch"); - return _M_replace_safe(__i1 - _M_ibegin(), __n1, __s._M_data(), - __s.size()); - } - - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, - _CharT __c) - { - _M_check_length(__n1, __n2, "basic_string::_M_replace_aux"); - _M_mutate(__pos1, __n1, __n2); - if (__n2) - _M_assign(_M_data() + __pos1, __n2, __c); - return *this; - } - - template - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s, - size_type __n2) - { - _M_mutate(__pos1, __n1, __n2); - if (__n2) - _M_copy(_M_data() + __pos1, __s, __n2); - return *this; - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>:: - copy(_CharT* __s, size_type __n, size_type __pos) const - { - _M_check(__pos, "basic_string::copy"); - __n = _M_limit(__pos, __n); - __glibcxx_requires_string_len(__s, __n); - if (__n) - _M_copy(__s, _M_data() + __pos, __n); - // 21.3.5.7 par 3: do not append null. (good.) - return __n; - } -#endif // !_GLIBCXX_USE_CXX11_ABI - - template - basic_string<_CharT, _Traits, _Alloc> - operator+(const _CharT* __lhs, - const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { - __glibcxx_requires_string(__lhs); - typedef basic_string<_CharT, _Traits, _Alloc> __string_type; - typedef typename __string_type::size_type __size_type; - const __size_type __len = _Traits::length(__lhs); - __string_type __str; - __str.reserve(__len + __rhs.size()); - __str.append(__lhs, __len); - __str.append(__rhs); - return __str; - } - - template - basic_string<_CharT, _Traits, _Alloc> - operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) - { - typedef basic_string<_CharT, _Traits, _Alloc> __string_type; - typedef typename __string_type::size_type __size_type; - __string_type __str; - const __size_type __len = __rhs.size(); - __str.reserve(__len + 1); - __str.append(__size_type(1), __lhs); - __str.append(__rhs); - return __str; - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>:: - find(const _CharT* __s, size_type __pos, size_type __n) const - { - __glibcxx_requires_string_len(__s, __n); - const size_type __size = this->size(); - const _CharT* __data = _M_data(); - - if (__n == 0) - return __pos <= __size ? __pos : npos; - - if (__n <= __size) - { - for (; __pos <= __size - __n; ++__pos) - if (traits_type::eq(__data[__pos], __s[0]) - && traits_type::compare(__data + __pos + 1, - __s + 1, __n - 1) == 0) - return __pos; - } - return npos; - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>:: - find(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT - { - size_type __ret = npos; - const size_type __size = this->size(); - if (__pos < __size) - { - const _CharT* __data = _M_data(); - const size_type __n = __size - __pos; - const _CharT* __p = traits_type::find(__data + __pos, __n, __c); - if (__p) - __ret = __p - __data; - } - return __ret; - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>:: - rfind(const _CharT* __s, size_type __pos, size_type __n) const - { - __glibcxx_requires_string_len(__s, __n); - const size_type __size = this->size(); - if (__n <= __size) - { - __pos = std::min(size_type(__size - __n), __pos); - const _CharT* __data = _M_data(); - do - { - if (traits_type::compare(__data + __pos, __s, __n) == 0) - return __pos; - } - while (__pos-- > 0); - } - return npos; - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>:: - rfind(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT - { - size_type __size = this->size(); - if (__size) - { - if (--__size > __pos) - __size = __pos; - for (++__size; __size-- > 0; ) - if (traits_type::eq(_M_data()[__size], __c)) - return __size; - } - return npos; - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>:: - find_first_of(const _CharT* __s, size_type __pos, size_type __n) const - { - __glibcxx_requires_string_len(__s, __n); - for (; __n && __pos < this->size(); ++__pos) - { - const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]); - if (__p) - return __pos; - } - return npos; - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>:: - find_last_of(const _CharT* __s, size_type __pos, size_type __n) const - { - __glibcxx_requires_string_len(__s, __n); - size_type __size = this->size(); - if (__size && __n) - { - if (--__size > __pos) - __size = __pos; - do - { - if (traits_type::find(__s, __n, _M_data()[__size])) - return __size; - } - while (__size-- != 0); - } - return npos; - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>:: - find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const - { - __glibcxx_requires_string_len(__s, __n); - for (; __pos < this->size(); ++__pos) - if (!traits_type::find(__s, __n, _M_data()[__pos])) - return __pos; - return npos; - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>:: - find_first_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT - { - for (; __pos < this->size(); ++__pos) - if (!traits_type::eq(_M_data()[__pos], __c)) - return __pos; - return npos; - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>:: - find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const - { - __glibcxx_requires_string_len(__s, __n); - size_type __size = this->size(); - if (__size) - { - if (--__size > __pos) - __size = __pos; - do - { - if (!traits_type::find(__s, __n, _M_data()[__size])) - return __size; - } - while (__size--); - } - return npos; - } - - template - typename basic_string<_CharT, _Traits, _Alloc>::size_type - basic_string<_CharT, _Traits, _Alloc>:: - find_last_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT - { - size_type __size = this->size(); - if (__size) - { - if (--__size > __pos) - __size = __pos; - do - { - if (!traits_type::eq(_M_data()[__size], __c)) - return __size; - } - while (__size--); - } - return npos; - } - - template - int - basic_string<_CharT, _Traits, _Alloc>:: - compare(size_type __pos, size_type __n, const basic_string& __str) const - { - _M_check(__pos, "basic_string::compare"); - __n = _M_limit(__pos, __n); - const size_type __osize = __str.size(); - const size_type __len = std::min(__n, __osize); - int __r = traits_type::compare(_M_data() + __pos, __str.data(), __len); - if (!__r) - __r = _S_compare(__n, __osize); - return __r; - } - - template - int - basic_string<_CharT, _Traits, _Alloc>:: - compare(size_type __pos1, size_type __n1, const basic_string& __str, - size_type __pos2, size_type __n2) const - { - _M_check(__pos1, "basic_string::compare"); - __str._M_check(__pos2, "basic_string::compare"); - __n1 = _M_limit(__pos1, __n1); - __n2 = __str._M_limit(__pos2, __n2); - const size_type __len = std::min(__n1, __n2); - int __r = traits_type::compare(_M_data() + __pos1, - __str.data() + __pos2, __len); - if (!__r) - __r = _S_compare(__n1, __n2); - return __r; - } - - template - int - basic_string<_CharT, _Traits, _Alloc>:: - compare(const _CharT* __s) const - { - __glibcxx_requires_string(__s); - const size_type __size = this->size(); - const size_type __osize = traits_type::length(__s); - const size_type __len = std::min(__size, __osize); - int __r = traits_type::compare(_M_data(), __s, __len); - if (!__r) - __r = _S_compare(__size, __osize); - return __r; - } - - template - int - basic_string <_CharT, _Traits, _Alloc>:: - compare(size_type __pos, size_type __n1, const _CharT* __s) const - { - __glibcxx_requires_string(__s); - _M_check(__pos, "basic_string::compare"); - __n1 = _M_limit(__pos, __n1); - const size_type __osize = traits_type::length(__s); - const size_type __len = std::min(__n1, __osize); - int __r = traits_type::compare(_M_data() + __pos, __s, __len); - if (!__r) - __r = _S_compare(__n1, __osize); - return __r; - } - - template - int - basic_string <_CharT, _Traits, _Alloc>:: - compare(size_type __pos, size_type __n1, const _CharT* __s, - size_type __n2) const - { - __glibcxx_requires_string_len(__s, __n2); - _M_check(__pos, "basic_string::compare"); - __n1 = _M_limit(__pos, __n1); - const size_type __len = std::min(__n1, __n2); - int __r = traits_type::compare(_M_data() + __pos, __s, __len); - if (!__r) - __r = _S_compare(__n1, __n2); - return __r; - } - - // 21.3.7.9 basic_string::getline and operators - template - basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>& __in, - basic_string<_CharT, _Traits, _Alloc>& __str) - { - typedef basic_istream<_CharT, _Traits> __istream_type; - typedef basic_string<_CharT, _Traits, _Alloc> __string_type; - typedef typename __istream_type::ios_base __ios_base; - typedef typename __istream_type::int_type __int_type; - typedef typename __string_type::size_type __size_type; - typedef ctype<_CharT> __ctype_type; - typedef typename __ctype_type::ctype_base __ctype_base; - - __size_type __extracted = 0; - typename __ios_base::iostate __err = __ios_base::goodbit; - typename __istream_type::sentry __cerb(__in, false); - if (__cerb) - { - __try - { - // Avoid reallocation for common case. - __str.erase(); - _CharT __buf[128]; - __size_type __len = 0; - const streamsize __w = __in.width(); - const __size_type __n = __w > 0 ? static_cast<__size_type>(__w) - : __str.max_size(); - const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); - const __int_type __eof = _Traits::eof(); - __int_type __c = __in.rdbuf()->sgetc(); - - while (__extracted < __n - && !_Traits::eq_int_type(__c, __eof) - && !__ct.is(__ctype_base::space, - _Traits::to_char_type(__c))) - { - if (__len == sizeof(__buf) / sizeof(_CharT)) - { - __str.append(__buf, sizeof(__buf) / sizeof(_CharT)); - __len = 0; - } - __buf[__len++] = _Traits::to_char_type(__c); - ++__extracted; - __c = __in.rdbuf()->snextc(); - } - __str.append(__buf, __len); - - if (_Traits::eq_int_type(__c, __eof)) - __err |= __ios_base::eofbit; - __in.width(0); - } - __catch(__cxxabiv1::__forced_unwind&) - { - __in._M_setstate(__ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 91. Description of operator>> and getline() for string<> - // might cause endless loop - __in._M_setstate(__ios_base::badbit); - } - } - // 211. operator>>(istream&, string&) doesn't set failbit - if (!__extracted) - __err |= __ios_base::failbit; - if (__err) - __in.setstate(__err); - return __in; - } - - template - basic_istream<_CharT, _Traits>& - getline(basic_istream<_CharT, _Traits>& __in, - basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim) - { - typedef basic_istream<_CharT, _Traits> __istream_type; - typedef basic_string<_CharT, _Traits, _Alloc> __string_type; - typedef typename __istream_type::ios_base __ios_base; - typedef typename __istream_type::int_type __int_type; - typedef typename __string_type::size_type __size_type; - - __size_type __extracted = 0; - const __size_type __n = __str.max_size(); - typename __ios_base::iostate __err = __ios_base::goodbit; - typename __istream_type::sentry __cerb(__in, true); - if (__cerb) - { - __try - { - __str.erase(); - const __int_type __idelim = _Traits::to_int_type(__delim); - const __int_type __eof = _Traits::eof(); - __int_type __c = __in.rdbuf()->sgetc(); - - while (__extracted < __n - && !_Traits::eq_int_type(__c, __eof) - && !_Traits::eq_int_type(__c, __idelim)) - { - __str += _Traits::to_char_type(__c); - ++__extracted; - __c = __in.rdbuf()->snextc(); - } - - if (_Traits::eq_int_type(__c, __eof)) - __err |= __ios_base::eofbit; - else if (_Traits::eq_int_type(__c, __idelim)) - { - ++__extracted; - __in.rdbuf()->sbumpc(); - } - else - __err |= __ios_base::failbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - __in._M_setstate(__ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 91. Description of operator>> and getline() for string<> - // might cause endless loop - __in._M_setstate(__ios_base::badbit); - } - } - if (!__extracted) - __err |= __ios_base::failbit; - if (__err) - __in.setstate(__err); - return __in; - } - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE > 0 - extern template class basic_string; - extern template - basic_istream& - operator>>(basic_istream&, string&); - extern template - basic_ostream& - operator<<(basic_ostream&, const string&); - extern template - basic_istream& - getline(basic_istream&, string&, char); - extern template - basic_istream& - getline(basic_istream&, string&); - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template class basic_string; - extern template - basic_istream& - operator>>(basic_istream&, wstring&); - extern template - basic_ostream& - operator<<(basic_ostream&, const wstring&); - extern template - basic_istream& - getline(basic_istream&, wstring&, wchar_t); - extern template - basic_istream& - getline(basic_istream&, wstring&); -#endif -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/boost_concept_check.h b/openflow/usr/include/c++/5/bits/boost_concept_check.h deleted file mode 100644 index 89e3ec7..0000000 --- a/openflow/usr/include/c++/5/bits/boost_concept_check.h +++ /dev/null @@ -1,790 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2004-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, -// sell and distribute this software is granted provided this -// copyright notice appears in all copies. This software is provided -// "as is" without express or implied warranty, and with no claim as -// to its suitability for any purpose. -// - -/** @file bits/boost_concept_check.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iterator} - */ - -// GCC Note: based on version 1.12.0 of the Boost library. - -#ifndef _BOOST_CONCEPT_CHECK_H -#define _BOOST_CONCEPT_CHECK_H 1 - -#pragma GCC system_header - -#include -#include // for traits and tags - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#define _IsUnused __attribute__ ((__unused__)) - -// When the C-C code is in use, we would like this function to do as little -// as possible at runtime, use as few resources as possible, and hopefully -// be elided out of existence... hmmm. -template -inline void __function_requires() -{ - void (_Concept::*__x)() _IsUnused = &_Concept::__constraints; -} - -// No definition: if this is referenced, there's a problem with -// the instantiating type not being one of the required integer types. -// Unfortunately, this results in a link-time error, not a compile-time error. -void __error_type_must_be_an_integer_type(); -void __error_type_must_be_an_unsigned_integer_type(); -void __error_type_must_be_a_signed_integer_type(); - -// ??? Should the "concept_checking*" structs begin with more than _ ? -#define _GLIBCXX_CLASS_REQUIRES(_type_var, _ns, _concept) \ - typedef void (_ns::_concept <_type_var>::* _func##_type_var##_concept)(); \ - template <_func##_type_var##_concept _Tp1> \ - struct _concept_checking##_type_var##_concept { }; \ - typedef _concept_checking##_type_var##_concept< \ - &_ns::_concept <_type_var>::__constraints> \ - _concept_checking_typedef##_type_var##_concept - -#define _GLIBCXX_CLASS_REQUIRES2(_type_var1, _type_var2, _ns, _concept) \ - typedef void (_ns::_concept <_type_var1,_type_var2>::* _func##_type_var1##_type_var2##_concept)(); \ - template <_func##_type_var1##_type_var2##_concept _Tp1> \ - struct _concept_checking##_type_var1##_type_var2##_concept { }; \ - typedef _concept_checking##_type_var1##_type_var2##_concept< \ - &_ns::_concept <_type_var1,_type_var2>::__constraints> \ - _concept_checking_typedef##_type_var1##_type_var2##_concept - -#define _GLIBCXX_CLASS_REQUIRES3(_type_var1, _type_var2, _type_var3, _ns, _concept) \ - typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3>::* _func##_type_var1##_type_var2##_type_var3##_concept)(); \ - template <_func##_type_var1##_type_var2##_type_var3##_concept _Tp1> \ - struct _concept_checking##_type_var1##_type_var2##_type_var3##_concept { }; \ - typedef _concept_checking##_type_var1##_type_var2##_type_var3##_concept< \ - &_ns::_concept <_type_var1,_type_var2,_type_var3>::__constraints> \ - _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_concept - -#define _GLIBCXX_CLASS_REQUIRES4(_type_var1, _type_var2, _type_var3, _type_var4, _ns, _concept) \ - typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::* _func##_type_var1##_type_var2##_type_var3##_type_var4##_concept)(); \ - template <_func##_type_var1##_type_var2##_type_var3##_type_var4##_concept _Tp1> \ - struct _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept { }; \ - typedef _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept< \ - &_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::__constraints> \ - _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_type_var4##_concept - - -template -struct _Aux_require_same { }; - -template -struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; }; - - template - struct _SameTypeConcept - { - void __constraints() { - typedef typename _Aux_require_same<_Tp1, _Tp2>::_Type _Required; - } - }; - - template - struct _IntegerConcept { - void __constraints() { - __error_type_must_be_an_integer_type(); - } - }; - template <> struct _IntegerConcept { void __constraints() {} }; - template <> struct _IntegerConcept { void __constraints(){} }; - template <> struct _IntegerConcept { void __constraints() {} }; - template <> struct _IntegerConcept { void __constraints() {} }; - template <> struct _IntegerConcept { void __constraints() {} }; - template <> struct _IntegerConcept { void __constraints() {} }; - template <> struct _IntegerConcept { void __constraints() {} }; - template <> struct _IntegerConcept - { void __constraints() {} }; - - template - struct _SignedIntegerConcept { - void __constraints() { - __error_type_must_be_a_signed_integer_type(); - } - }; - template <> struct _SignedIntegerConcept { void __constraints() {} }; - template <> struct _SignedIntegerConcept { void __constraints() {} }; - template <> struct _SignedIntegerConcept { void __constraints() {} }; - template <> struct _SignedIntegerConcept { void __constraints(){}}; - - template - struct _UnsignedIntegerConcept { - void __constraints() { - __error_type_must_be_an_unsigned_integer_type(); - } - }; - template <> struct _UnsignedIntegerConcept - { void __constraints() {} }; - template <> struct _UnsignedIntegerConcept - { void __constraints() {} }; - template <> struct _UnsignedIntegerConcept - { void __constraints() {} }; - template <> struct _UnsignedIntegerConcept - { void __constraints() {} }; - - //=========================================================================== - // Basic Concepts - - template - struct _DefaultConstructibleConcept - { - void __constraints() { - _Tp __a _IsUnused; // require default constructor - } - }; - - template - struct _AssignableConcept - { - void __constraints() { - __a = __a; // require assignment operator - __const_constraints(__a); - } - void __const_constraints(const _Tp& __b) { - __a = __b; // const required for argument to assignment - } - _Tp __a; - // possibly should be "Tp* a;" and then dereference "a" in constraint - // functions? present way would require a default ctor, i think... - }; - - template - struct _CopyConstructibleConcept - { - void __constraints() { - _Tp __a(__b); // require copy constructor - _Tp* __ptr _IsUnused = &__a; // require address of operator - __const_constraints(__a); - } - void __const_constraints(const _Tp& __a) { - _Tp __c _IsUnused(__a); // require const copy constructor - const _Tp* __ptr _IsUnused = &__a; // require const address of operator - } - _Tp __b; - }; - - // The SGI STL version of Assignable requires copy constructor and operator= - template - struct _SGIAssignableConcept - { - void __constraints() { - _Tp __b _IsUnused(__a); - __a = __a; // require assignment operator - __const_constraints(__a); - } - void __const_constraints(const _Tp& __b) { - _Tp __c _IsUnused(__b); - __a = __b; // const required for argument to assignment - } - _Tp __a; - }; - - template - struct _ConvertibleConcept - { - void __constraints() { - _To __y _IsUnused = __x; - } - _From __x; - }; - - // The C++ standard requirements for many concepts talk about return - // types that must be "convertible to bool". The problem with this - // requirement is that it leaves the door open for evil proxies that - // define things like operator|| with strange return types. Two - // possible solutions are: - // 1) require the return type to be exactly bool - // 2) stay with convertible to bool, and also - // specify stuff about all the logical operators. - // For now we just test for convertible to bool. - template - void __aux_require_boolean_expr(const _Tp& __t) { - bool __x _IsUnused = __t; - } - -// FIXME - template - struct _EqualityComparableConcept - { - void __constraints() { - __aux_require_boolean_expr(__a == __b); - } - _Tp __a, __b; - }; - - template - struct _LessThanComparableConcept - { - void __constraints() { - __aux_require_boolean_expr(__a < __b); - } - _Tp __a, __b; - }; - - // This is equivalent to SGI STL's LessThanComparable. - template - struct _ComparableConcept - { - void __constraints() { - __aux_require_boolean_expr(__a < __b); - __aux_require_boolean_expr(__a > __b); - __aux_require_boolean_expr(__a <= __b); - __aux_require_boolean_expr(__a >= __b); - } - _Tp __a, __b; - }; - -#define _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(_OP,_NAME) \ - template \ - struct _NAME { \ - void __constraints() { (void)__constraints_(); } \ - bool __constraints_() { \ - return __a _OP __b; \ - } \ - _First __a; \ - _Second __b; \ - } - -#define _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \ - template \ - struct _NAME { \ - void __constraints() { (void)__constraints_(); } \ - _Ret __constraints_() { \ - return __a _OP __b; \ - } \ - _First __a; \ - _Second __b; \ - } - - _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, _EqualOpConcept); - _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, _NotEqualOpConcept); - _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, _LessThanOpConcept); - _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, _LessEqualOpConcept); - _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, _GreaterThanOpConcept); - _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, _GreaterEqualOpConcept); - - _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, _PlusOpConcept); - _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, _TimesOpConcept); - _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, _DivideOpConcept); - _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, _SubtractOpConcept); - _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, _ModOpConcept); - -#undef _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT -#undef _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT - - //=========================================================================== - // Function Object Concepts - - template - struct _GeneratorConcept - { - void __constraints() { - const _Return& __r _IsUnused = __f();// require operator() member function - } - _Func __f; - }; - - - template - struct _GeneratorConcept<_Func,void> - { - void __constraints() { - __f(); // require operator() member function - } - _Func __f; - }; - - template - struct _UnaryFunctionConcept - { - void __constraints() { - __r = __f(__arg); // require operator() - } - _Func __f; - _Arg __arg; - _Return __r; - }; - - template - struct _UnaryFunctionConcept<_Func, void, _Arg> { - void __constraints() { - __f(__arg); // require operator() - } - _Func __f; - _Arg __arg; - }; - - template - struct _BinaryFunctionConcept - { - void __constraints() { - __r = __f(__first, __second); // require operator() - } - _Func __f; - _First __first; - _Second __second; - _Return __r; - }; - - template - struct _BinaryFunctionConcept<_Func, void, _First, _Second> - { - void __constraints() { - __f(__first, __second); // require operator() - } - _Func __f; - _First __first; - _Second __second; - }; - - template - struct _UnaryPredicateConcept - { - void __constraints() { - __aux_require_boolean_expr(__f(__arg)); // require op() returning bool - } - _Func __f; - _Arg __arg; - }; - - template - struct _BinaryPredicateConcept - { - void __constraints() { - __aux_require_boolean_expr(__f(__a, __b)); // require op() returning bool - } - _Func __f; - _First __a; - _Second __b; - }; - - // use this when functor is used inside a container class like std::set - template - struct _Const_BinaryPredicateConcept { - void __constraints() { - __const_constraints(__f); - } - void __const_constraints(const _Func& __fun) { - __function_requires<_BinaryPredicateConcept<_Func, _First, _Second> >(); - // operator() must be a const member function - __aux_require_boolean_expr(__fun(__a, __b)); - } - _Func __f; - _First __a; - _Second __b; - }; - - //=========================================================================== - // Iterator Concepts - - template - struct _TrivialIteratorConcept - { - void __constraints() { -// __function_requires< _DefaultConstructibleConcept<_Tp> >(); - __function_requires< _AssignableConcept<_Tp> >(); - __function_requires< _EqualityComparableConcept<_Tp> >(); -// typedef typename std::iterator_traits<_Tp>::value_type _V; - (void)*__i; // require dereference operator - } - _Tp __i; - }; - - template - struct _Mutable_TrivialIteratorConcept - { - void __constraints() { - __function_requires< _TrivialIteratorConcept<_Tp> >(); - *__i = *__j; // require dereference and assignment - } - _Tp __i, __j; - }; - - template - struct _InputIteratorConcept - { - void __constraints() { - __function_requires< _TrivialIteratorConcept<_Tp> >(); - // require iterator_traits typedef's - typedef typename std::iterator_traits<_Tp>::difference_type _Diff; -// __function_requires< _SignedIntegerConcept<_Diff> >(); - typedef typename std::iterator_traits<_Tp>::reference _Ref; - typedef typename std::iterator_traits<_Tp>::pointer _Pt; - typedef typename std::iterator_traits<_Tp>::iterator_category _Cat; - __function_requires< _ConvertibleConcept< - typename std::iterator_traits<_Tp>::iterator_category, - std::input_iterator_tag> >(); - ++__i; // require preincrement operator - __i++; // require postincrement operator - } - _Tp __i; - }; - - template - struct _OutputIteratorConcept - { - void __constraints() { - __function_requires< _AssignableConcept<_Tp> >(); - ++__i; // require preincrement operator - __i++; // require postincrement operator - *__i++ = __t; // require postincrement and assignment - } - _Tp __i; - _ValueT __t; - }; - - template - struct _ForwardIteratorConcept - { - void __constraints() { - __function_requires< _InputIteratorConcept<_Tp> >(); - __function_requires< _DefaultConstructibleConcept<_Tp> >(); - __function_requires< _ConvertibleConcept< - typename std::iterator_traits<_Tp>::iterator_category, - std::forward_iterator_tag> >(); - typedef typename std::iterator_traits<_Tp>::reference _Ref; - _Ref __r _IsUnused = *__i; - } - _Tp __i; - }; - - template - struct _Mutable_ForwardIteratorConcept - { - void __constraints() { - __function_requires< _ForwardIteratorConcept<_Tp> >(); - *__i++ = *__i; // require postincrement and assignment - } - _Tp __i; - }; - - template - struct _BidirectionalIteratorConcept - { - void __constraints() { - __function_requires< _ForwardIteratorConcept<_Tp> >(); - __function_requires< _ConvertibleConcept< - typename std::iterator_traits<_Tp>::iterator_category, - std::bidirectional_iterator_tag> >(); - --__i; // require predecrement operator - __i--; // require postdecrement operator - } - _Tp __i; - }; - - template - struct _Mutable_BidirectionalIteratorConcept - { - void __constraints() { - __function_requires< _BidirectionalIteratorConcept<_Tp> >(); - __function_requires< _Mutable_ForwardIteratorConcept<_Tp> >(); - *__i-- = *__i; // require postdecrement and assignment - } - _Tp __i; - }; - - - template - struct _RandomAccessIteratorConcept - { - void __constraints() { - __function_requires< _BidirectionalIteratorConcept<_Tp> >(); - __function_requires< _ComparableConcept<_Tp> >(); - __function_requires< _ConvertibleConcept< - typename std::iterator_traits<_Tp>::iterator_category, - std::random_access_iterator_tag> >(); - // ??? We don't use _Ref, are we just checking for "referenceability"? - typedef typename std::iterator_traits<_Tp>::reference _Ref; - - __i += __n; // require assignment addition operator - __i = __i + __n; __i = __n + __i; // require addition with difference type - __i -= __n; // require assignment subtraction op - __i = __i - __n; // require subtraction with - // difference type - __n = __i - __j; // require difference operator - (void)__i[__n]; // require element access operator - } - _Tp __a, __b; - _Tp __i, __j; - typename std::iterator_traits<_Tp>::difference_type __n; - }; - - template - struct _Mutable_RandomAccessIteratorConcept - { - void __constraints() { - __function_requires< _RandomAccessIteratorConcept<_Tp> >(); - __function_requires< _Mutable_BidirectionalIteratorConcept<_Tp> >(); - __i[__n] = *__i; // require element access and assignment - } - _Tp __i; - typename std::iterator_traits<_Tp>::difference_type __n; - }; - - //=========================================================================== - // Container Concepts - - template - struct _ContainerConcept - { - typedef typename _Container::value_type _Value_type; - typedef typename _Container::difference_type _Difference_type; - typedef typename _Container::size_type _Size_type; - typedef typename _Container::const_reference _Const_reference; - typedef typename _Container::const_pointer _Const_pointer; - typedef typename _Container::const_iterator _Const_iterator; - - void __constraints() { - __function_requires< _InputIteratorConcept<_Const_iterator> >(); - __function_requires< _AssignableConcept<_Container> >(); - const _Container __c; - __i = __c.begin(); - __i = __c.end(); - __n = __c.size(); - __n = __c.max_size(); - __b = __c.empty(); - } - bool __b; - _Const_iterator __i; - _Size_type __n; - }; - - template - struct _Mutable_ContainerConcept - { - typedef typename _Container::value_type _Value_type; - typedef typename _Container::reference _Reference; - typedef typename _Container::iterator _Iterator; - typedef typename _Container::pointer _Pointer; - - void __constraints() { - __function_requires< _ContainerConcept<_Container> >(); - __function_requires< _AssignableConcept<_Value_type> >(); - __function_requires< _InputIteratorConcept<_Iterator> >(); - - __i = __c.begin(); - __i = __c.end(); - __c.swap(__c2); - } - _Iterator __i; - _Container __c, __c2; - }; - - template - struct _ForwardContainerConcept - { - void __constraints() { - __function_requires< _ContainerConcept<_ForwardContainer> >(); - typedef typename _ForwardContainer::const_iterator _Const_iterator; - __function_requires< _ForwardIteratorConcept<_Const_iterator> >(); - } - }; - - template - struct _Mutable_ForwardContainerConcept - { - void __constraints() { - __function_requires< _ForwardContainerConcept<_ForwardContainer> >(); - __function_requires< _Mutable_ContainerConcept<_ForwardContainer> >(); - typedef typename _ForwardContainer::iterator _Iterator; - __function_requires< _Mutable_ForwardIteratorConcept<_Iterator> >(); - } - }; - - template - struct _ReversibleContainerConcept - { - typedef typename _ReversibleContainer::const_iterator _Const_iterator; - typedef typename _ReversibleContainer::const_reverse_iterator - _Const_reverse_iterator; - - void __constraints() { - __function_requires< _ForwardContainerConcept<_ReversibleContainer> >(); - __function_requires< _BidirectionalIteratorConcept<_Const_iterator> >(); - __function_requires< - _BidirectionalIteratorConcept<_Const_reverse_iterator> >(); - - const _ReversibleContainer __c; - _Const_reverse_iterator __i = __c.rbegin(); - __i = __c.rend(); - } - }; - - template - struct _Mutable_ReversibleContainerConcept - { - typedef typename _ReversibleContainer::iterator _Iterator; - typedef typename _ReversibleContainer::reverse_iterator _Reverse_iterator; - - void __constraints() { - __function_requires<_ReversibleContainerConcept<_ReversibleContainer> >(); - __function_requires< - _Mutable_ForwardContainerConcept<_ReversibleContainer> >(); - __function_requires<_Mutable_BidirectionalIteratorConcept<_Iterator> >(); - __function_requires< - _Mutable_BidirectionalIteratorConcept<_Reverse_iterator> >(); - - _Reverse_iterator __i = __c.rbegin(); - __i = __c.rend(); - } - _ReversibleContainer __c; - }; - - template - struct _RandomAccessContainerConcept - { - typedef typename _RandomAccessContainer::size_type _Size_type; - typedef typename _RandomAccessContainer::const_reference _Const_reference; - typedef typename _RandomAccessContainer::const_iterator _Const_iterator; - typedef typename _RandomAccessContainer::const_reverse_iterator - _Const_reverse_iterator; - - void __constraints() { - __function_requires< - _ReversibleContainerConcept<_RandomAccessContainer> >(); - __function_requires< _RandomAccessIteratorConcept<_Const_iterator> >(); - __function_requires< - _RandomAccessIteratorConcept<_Const_reverse_iterator> >(); - - const _RandomAccessContainer __c; - _Const_reference __r _IsUnused = __c[__n]; - } - _Size_type __n; - }; - - template - struct _Mutable_RandomAccessContainerConcept - { - typedef typename _RandomAccessContainer::size_type _Size_type; - typedef typename _RandomAccessContainer::reference _Reference; - typedef typename _RandomAccessContainer::iterator _Iterator; - typedef typename _RandomAccessContainer::reverse_iterator _Reverse_iterator; - - void __constraints() { - __function_requires< - _RandomAccessContainerConcept<_RandomAccessContainer> >(); - __function_requires< - _Mutable_ReversibleContainerConcept<_RandomAccessContainer> >(); - __function_requires< _Mutable_RandomAccessIteratorConcept<_Iterator> >(); - __function_requires< - _Mutable_RandomAccessIteratorConcept<_Reverse_iterator> >(); - - _Reference __r _IsUnused = __c[__i]; - } - _Size_type __i; - _RandomAccessContainer __c; - }; - - // A Sequence is inherently mutable - template - struct _SequenceConcept - { - typedef typename _Sequence::reference _Reference; - typedef typename _Sequence::const_reference _Const_reference; - - void __constraints() { - // Matt Austern's book puts DefaultConstructible here, the C++ - // standard places it in Container - // function_requires< DefaultConstructible >(); - __function_requires< _Mutable_ForwardContainerConcept<_Sequence> >(); - __function_requires< _DefaultConstructibleConcept<_Sequence> >(); - - _Sequence - __c _IsUnused(__n, __t), - __c2 _IsUnused(__first, __last); - - __c.insert(__p, __t); - __c.insert(__p, __n, __t); - __c.insert(__p, __first, __last); - - __c.erase(__p); - __c.erase(__p, __q); - - _Reference __r _IsUnused = __c.front(); - - __const_constraints(__c); - } - void __const_constraints(const _Sequence& __c) { - _Const_reference __r _IsUnused = __c.front(); - } - typename _Sequence::value_type __t; - typename _Sequence::size_type __n; - typename _Sequence::value_type *__first, *__last; - typename _Sequence::iterator __p, __q; - }; - - template - struct _FrontInsertionSequenceConcept - { - void __constraints() { - __function_requires< _SequenceConcept<_FrontInsertionSequence> >(); - - __c.push_front(__t); - __c.pop_front(); - } - _FrontInsertionSequence __c; - typename _FrontInsertionSequence::value_type __t; - }; - - template - struct _BackInsertionSequenceConcept - { - typedef typename _BackInsertionSequence::reference _Reference; - typedef typename _BackInsertionSequence::const_reference _Const_reference; - - void __constraints() { - __function_requires< _SequenceConcept<_BackInsertionSequence> >(); - - __c.push_back(__t); - __c.pop_back(); - _Reference __r _IsUnused = __c.back(); - } - void __const_constraints(const _BackInsertionSequence& __c) { - _Const_reference __r _IsUnused = __c.back(); - }; - _BackInsertionSequence __c; - typename _BackInsertionSequence::value_type __t; - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#undef _IsUnused - -#endif // _GLIBCXX_BOOST_CONCEPT_CHECK - - diff --git a/openflow/usr/include/c++/5/bits/c++0x_warning.h b/openflow/usr/include/c++/5/bits/c++0x_warning.h deleted file mode 100644 index dabc2c4..0000000 --- a/openflow/usr/include/c++/5/bits/c++0x_warning.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/c++0x_warning.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iosfwd} - */ - -#ifndef _CXX0X_WARNING_H -#define _CXX0X_WARNING_H 1 - -#if __cplusplus < 201103L -#error This file requires compiler and library support \ -for the ISO C++ 2011 standard. This support must be enabled \ -with the -std=c++11 or -std=gnu++11 compiler options. -#endif - -#endif diff --git a/openflow/usr/include/c++/5/bits/c++14_warning.h b/openflow/usr/include/c++/5/bits/c++14_warning.h deleted file mode 100644 index 295794f..0000000 --- a/openflow/usr/include/c++/5/bits/c++14_warning.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/c++14_warning.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iosfwd} - */ - -#ifndef _CXX14_WARNING_H -#define _CXX14_WARNING_H 1 - -#if __cplusplus <= 201103L -#error This file requires compiler and library support for the forthcoming \ -ISO C++ 2014 standard. This support is currently experimental, and must be \ -enabled with the -std=c++1y or -std=gnu++1y compiler options. -#endif - -#endif diff --git a/openflow/usr/include/c++/5/bits/char_traits.h b/openflow/usr/include/c++/5/bits/char_traits.h deleted file mode 100644 index 0d0063b..0000000 --- a/openflow/usr/include/c++/5/bits/char_traits.h +++ /dev/null @@ -1,625 +0,0 @@ -// Character Traits for use by standard string and iostream -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/char_traits.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{string} - */ - -// -// ISO C++ 14882: 21 Strings library -// - -#ifndef _CHAR_TRAITS_H -#define _CHAR_TRAITS_H 1 - -#pragma GCC system_header - -#include // std::copy, std::fill_n -#include // For streampos -#include // For WEOF, wmemmove, wmemset, etc. - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @brief Mapping from character type to associated types. - * - * @note This is an implementation class for the generic version - * of char_traits. It defines int_type, off_type, pos_type, and - * state_type. By default these are unsigned long, streamoff, - * streampos, and mbstate_t. Users who need a different set of - * types, but who don't need to change the definitions of any function - * defined in char_traits, can specialize __gnu_cxx::_Char_types - * while leaving __gnu_cxx::char_traits alone. */ - template - struct _Char_types - { - typedef unsigned long int_type; - typedef std::streampos pos_type; - typedef std::streamoff off_type; - typedef std::mbstate_t state_type; - }; - - - /** - * @brief Base class used to implement std::char_traits. - * - * @note For any given actual character type, this definition is - * probably wrong. (Most of the member functions are likely to be - * right, but the int_type and state_type typedefs, and the eof() - * member function, are likely to be wrong.) The reason this class - * exists is so users can specialize it. Classes in namespace std - * may not be specialized for fundamental types, but classes in - * namespace __gnu_cxx may be. - * - * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/strings.html#strings.string.character_types - * for advice on how to make use of this class for @a unusual character - * types. Also, check out include/ext/pod_char_traits.h. - */ - template - struct char_traits - { - typedef _CharT char_type; - typedef typename _Char_types<_CharT>::int_type int_type; - typedef typename _Char_types<_CharT>::pos_type pos_type; - typedef typename _Char_types<_CharT>::off_type off_type; - typedef typename _Char_types<_CharT>::state_type state_type; - - static void - assign(char_type& __c1, const char_type& __c2) - { __c1 = __c2; } - - static _GLIBCXX_CONSTEXPR bool - eq(const char_type& __c1, const char_type& __c2) - { return __c1 == __c2; } - - static _GLIBCXX_CONSTEXPR bool - lt(const char_type& __c1, const char_type& __c2) - { return __c1 < __c2; } - - static int - compare(const char_type* __s1, const char_type* __s2, std::size_t __n); - - static std::size_t - length(const char_type* __s); - - static const char_type* - find(const char_type* __s, std::size_t __n, const char_type& __a); - - static char_type* - move(char_type* __s1, const char_type* __s2, std::size_t __n); - - static char_type* - copy(char_type* __s1, const char_type* __s2, std::size_t __n); - - static char_type* - assign(char_type* __s, std::size_t __n, char_type __a); - - static _GLIBCXX_CONSTEXPR char_type - to_char_type(const int_type& __c) - { return static_cast(__c); } - - static _GLIBCXX_CONSTEXPR int_type - to_int_type(const char_type& __c) - { return static_cast(__c); } - - static _GLIBCXX_CONSTEXPR bool - eq_int_type(const int_type& __c1, const int_type& __c2) - { return __c1 == __c2; } - - static _GLIBCXX_CONSTEXPR int_type - eof() - { return static_cast(_GLIBCXX_STDIO_EOF); } - - static _GLIBCXX_CONSTEXPR int_type - not_eof(const int_type& __c) - { return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); } - }; - - template - int - char_traits<_CharT>:: - compare(const char_type* __s1, const char_type* __s2, std::size_t __n) - { - for (std::size_t __i = 0; __i < __n; ++__i) - if (lt(__s1[__i], __s2[__i])) - return -1; - else if (lt(__s2[__i], __s1[__i])) - return 1; - return 0; - } - - template - std::size_t - char_traits<_CharT>:: - length(const char_type* __p) - { - std::size_t __i = 0; - while (!eq(__p[__i], char_type())) - ++__i; - return __i; - } - - template - const typename char_traits<_CharT>::char_type* - char_traits<_CharT>:: - find(const char_type* __s, std::size_t __n, const char_type& __a) - { - for (std::size_t __i = 0; __i < __n; ++__i) - if (eq(__s[__i], __a)) - return __s + __i; - return 0; - } - - template - typename char_traits<_CharT>::char_type* - char_traits<_CharT>:: - move(char_type* __s1, const char_type* __s2, std::size_t __n) - { - return static_cast<_CharT*>(__builtin_memmove(__s1, __s2, - __n * sizeof(char_type))); - } - - template - typename char_traits<_CharT>::char_type* - char_traits<_CharT>:: - copy(char_type* __s1, const char_type* __s2, std::size_t __n) - { - // NB: Inline std::copy so no recursive dependencies. - std::copy(__s2, __s2 + __n, __s1); - return __s1; - } - - template - typename char_traits<_CharT>::char_type* - char_traits<_CharT>:: - assign(char_type* __s, std::size_t __n, char_type __a) - { - // NB: Inline std::fill_n so no recursive dependencies. - std::fill_n(__s, __n, __a); - return __s; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // 21.1 - /** - * @brief Basis for explicit traits specializations. - * - * @note For any given actual character type, this definition is - * probably wrong. Since this is just a thin wrapper around - * __gnu_cxx::char_traits, it is possible to achieve a more - * appropriate definition by specializing __gnu_cxx::char_traits. - * - * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/strings.html#strings.string.character_types - * for advice on how to make use of this class for @a unusual character - * types. Also, check out include/ext/pod_char_traits.h. - */ - template - struct char_traits : public __gnu_cxx::char_traits<_CharT> - { }; - - - /// 21.1.3.1 char_traits specializations - template<> - struct char_traits - { - typedef char char_type; - typedef int int_type; - typedef streampos pos_type; - typedef streamoff off_type; - typedef mbstate_t state_type; - - static void - assign(char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT - { __c1 = __c2; } - - static _GLIBCXX_CONSTEXPR bool - eq(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT - { return __c1 == __c2; } - - static _GLIBCXX_CONSTEXPR bool - lt(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT - { - // LWG 467. - return (static_cast(__c1) - < static_cast(__c2)); - } - - static int - compare(const char_type* __s1, const char_type* __s2, size_t __n) - { - if (__n == 0) - return 0; - return __builtin_memcmp(__s1, __s2, __n); - } - - static size_t - length(const char_type* __s) - { return __builtin_strlen(__s); } - - static const char_type* - find(const char_type* __s, size_t __n, const char_type& __a) - { - if (__n == 0) - return 0; - return static_cast(__builtin_memchr(__s, __a, __n)); - } - - static char_type* - move(char_type* __s1, const char_type* __s2, size_t __n) - { - if (__n == 0) - return __s1; - return static_cast(__builtin_memmove(__s1, __s2, __n)); - } - - static char_type* - copy(char_type* __s1, const char_type* __s2, size_t __n) - { - if (__n == 0) - return __s1; - return static_cast(__builtin_memcpy(__s1, __s2, __n)); - } - - static char_type* - assign(char_type* __s, size_t __n, char_type __a) - { - if (__n == 0) - return __s; - return static_cast(__builtin_memset(__s, __a, __n)); - } - - static _GLIBCXX_CONSTEXPR char_type - to_char_type(const int_type& __c) _GLIBCXX_NOEXCEPT - { return static_cast(__c); } - - // To keep both the byte 0xff and the eof symbol 0xffffffff - // from ending up as 0xffffffff. - static _GLIBCXX_CONSTEXPR int_type - to_int_type(const char_type& __c) _GLIBCXX_NOEXCEPT - { return static_cast(static_cast(__c)); } - - static _GLIBCXX_CONSTEXPR bool - eq_int_type(const int_type& __c1, const int_type& __c2) _GLIBCXX_NOEXCEPT - { return __c1 == __c2; } - - static _GLIBCXX_CONSTEXPR int_type - eof() _GLIBCXX_NOEXCEPT - { return static_cast(_GLIBCXX_STDIO_EOF); } - - static _GLIBCXX_CONSTEXPR int_type - not_eof(const int_type& __c) _GLIBCXX_NOEXCEPT - { return (__c == eof()) ? 0 : __c; } - }; - - -#ifdef _GLIBCXX_USE_WCHAR_T - /// 21.1.3.2 char_traits specializations - template<> - struct char_traits - { - typedef wchar_t char_type; - typedef wint_t int_type; - typedef streamoff off_type; - typedef wstreampos pos_type; - typedef mbstate_t state_type; - - static void - assign(char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT - { __c1 = __c2; } - - static _GLIBCXX_CONSTEXPR bool - eq(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT - { return __c1 == __c2; } - - static _GLIBCXX_CONSTEXPR bool - lt(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT - { return __c1 < __c2; } - - static int - compare(const char_type* __s1, const char_type* __s2, size_t __n) - { - if (__n == 0) - return 0; - return wmemcmp(__s1, __s2, __n); - } - - static size_t - length(const char_type* __s) - { return wcslen(__s); } - - static const char_type* - find(const char_type* __s, size_t __n, const char_type& __a) - { - if (__n == 0) - return 0; - return wmemchr(__s, __a, __n); - } - - static char_type* - move(char_type* __s1, const char_type* __s2, size_t __n) - { - if (__n == 0) - return __s1; - return wmemmove(__s1, __s2, __n); - } - - static char_type* - copy(char_type* __s1, const char_type* __s2, size_t __n) - { - if (__n == 0) - return __s1; - return wmemcpy(__s1, __s2, __n); - } - - static char_type* - assign(char_type* __s, size_t __n, char_type __a) - { - if (__n == 0) - return __s; - return wmemset(__s, __a, __n); - } - - static _GLIBCXX_CONSTEXPR char_type - to_char_type(const int_type& __c) _GLIBCXX_NOEXCEPT - { return char_type(__c); } - - static _GLIBCXX_CONSTEXPR int_type - to_int_type(const char_type& __c) _GLIBCXX_NOEXCEPT - { return int_type(__c); } - - static _GLIBCXX_CONSTEXPR bool - eq_int_type(const int_type& __c1, const int_type& __c2) _GLIBCXX_NOEXCEPT - { return __c1 == __c2; } - - static _GLIBCXX_CONSTEXPR int_type - eof() _GLIBCXX_NOEXCEPT - { return static_cast(WEOF); } - - static _GLIBCXX_CONSTEXPR int_type - not_eof(const int_type& __c) _GLIBCXX_NOEXCEPT - { return eq_int_type(__c, eof()) ? 0 : __c; } - }; -#endif //_GLIBCXX_USE_WCHAR_T - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#if ((__cplusplus >= 201103L) \ - && defined(_GLIBCXX_USE_C99_STDINT_TR1)) - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template<> - struct char_traits - { - typedef char16_t char_type; - typedef uint_least16_t int_type; - typedef streamoff off_type; - typedef u16streampos pos_type; - typedef mbstate_t state_type; - - static void - assign(char_type& __c1, const char_type& __c2) noexcept - { __c1 = __c2; } - - static constexpr bool - eq(const char_type& __c1, const char_type& __c2) noexcept - { return __c1 == __c2; } - - static constexpr bool - lt(const char_type& __c1, const char_type& __c2) noexcept - { return __c1 < __c2; } - - static int - compare(const char_type* __s1, const char_type* __s2, size_t __n) - { - for (size_t __i = 0; __i < __n; ++__i) - if (lt(__s1[__i], __s2[__i])) - return -1; - else if (lt(__s2[__i], __s1[__i])) - return 1; - return 0; - } - - static size_t - length(const char_type* __s) - { - size_t __i = 0; - while (!eq(__s[__i], char_type())) - ++__i; - return __i; - } - - static const char_type* - find(const char_type* __s, size_t __n, const char_type& __a) - { - for (size_t __i = 0; __i < __n; ++__i) - if (eq(__s[__i], __a)) - return __s + __i; - return 0; - } - - static char_type* - move(char_type* __s1, const char_type* __s2, size_t __n) - { - if (__n == 0) - return __s1; - return (static_cast - (__builtin_memmove(__s1, __s2, __n * sizeof(char_type)))); - } - - static char_type* - copy(char_type* __s1, const char_type* __s2, size_t __n) - { - if (__n == 0) - return __s1; - return (static_cast - (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type)))); - } - - static char_type* - assign(char_type* __s, size_t __n, char_type __a) - { - for (size_t __i = 0; __i < __n; ++__i) - assign(__s[__i], __a); - return __s; - } - - static constexpr char_type - to_char_type(const int_type& __c) noexcept - { return char_type(__c); } - - static constexpr int_type - to_int_type(const char_type& __c) noexcept - { return int_type(__c); } - - static constexpr bool - eq_int_type(const int_type& __c1, const int_type& __c2) noexcept - { return __c1 == __c2; } - - static constexpr int_type - eof() noexcept - { return static_cast(-1); } - - static constexpr int_type - not_eof(const int_type& __c) noexcept - { return eq_int_type(__c, eof()) ? 0 : __c; } - }; - - template<> - struct char_traits - { - typedef char32_t char_type; - typedef uint_least32_t int_type; - typedef streamoff off_type; - typedef u32streampos pos_type; - typedef mbstate_t state_type; - - static void - assign(char_type& __c1, const char_type& __c2) noexcept - { __c1 = __c2; } - - static constexpr bool - eq(const char_type& __c1, const char_type& __c2) noexcept - { return __c1 == __c2; } - - static constexpr bool - lt(const char_type& __c1, const char_type& __c2) noexcept - { return __c1 < __c2; } - - static int - compare(const char_type* __s1, const char_type* __s2, size_t __n) - { - for (size_t __i = 0; __i < __n; ++__i) - if (lt(__s1[__i], __s2[__i])) - return -1; - else if (lt(__s2[__i], __s1[__i])) - return 1; - return 0; - } - - static size_t - length(const char_type* __s) - { - size_t __i = 0; - while (!eq(__s[__i], char_type())) - ++__i; - return __i; - } - - static const char_type* - find(const char_type* __s, size_t __n, const char_type& __a) - { - for (size_t __i = 0; __i < __n; ++__i) - if (eq(__s[__i], __a)) - return __s + __i; - return 0; - } - - static char_type* - move(char_type* __s1, const char_type* __s2, size_t __n) - { - if (__n == 0) - return __s1; - return (static_cast - (__builtin_memmove(__s1, __s2, __n * sizeof(char_type)))); - } - - static char_type* - copy(char_type* __s1, const char_type* __s2, size_t __n) - { - if (__n == 0) - return __s1; - return (static_cast - (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type)))); - } - - static char_type* - assign(char_type* __s, size_t __n, char_type __a) - { - for (size_t __i = 0; __i < __n; ++__i) - assign(__s[__i], __a); - return __s; - } - - static constexpr char_type - to_char_type(const int_type& __c) noexcept - { return char_type(__c); } - - static constexpr int_type - to_int_type(const char_type& __c) noexcept - { return int_type(__c); } - - static constexpr bool - eq_int_type(const int_type& __c1, const int_type& __c2) noexcept - { return __c1 == __c2; } - - static constexpr int_type - eof() noexcept - { return static_cast(-1); } - - static constexpr int_type - not_eof(const int_type& __c) noexcept - { return eq_int_type(__c, eof()) ? 0 : __c; } - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif - -#endif // _CHAR_TRAITS_H diff --git a/openflow/usr/include/c++/5/bits/codecvt.h b/openflow/usr/include/c++/5/bits/codecvt.h deleted file mode 100644 index c76215f..0000000 --- a/openflow/usr/include/c++/5/bits/codecvt.h +++ /dev/null @@ -1,681 +0,0 @@ -// Locale support (codecvt) -*- C++ -*- - -// Copyright (C) 2000-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/codecvt.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -// -// ISO C++ 14882: 22.2.1.5 Template class codecvt -// - -// Written by Benjamin Kosnik - -#ifndef _CODECVT_H -#define _CODECVT_H 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /// Empty base class for codecvt facet [22.2.1.5]. - class codecvt_base - { - public: - enum result - { - ok, - partial, - error, - noconv - }; - }; - - /** - * @brief Common base for codecvt functions. - * - * This template class provides implementations of the public functions - * that forward to the protected virtual functions. - * - * This template also provides abstract stubs for the protected virtual - * functions. - */ - template - class __codecvt_abstract_base - : public locale::facet, public codecvt_base - { - public: - // Types: - typedef codecvt_base::result result; - typedef _InternT intern_type; - typedef _ExternT extern_type; - typedef _StateT state_type; - - // 22.2.1.5.1 codecvt members - /** - * @brief Convert from internal to external character set. - * - * Converts input string of intern_type to output string of - * extern_type. This is analogous to wcsrtombs. It does this by - * calling codecvt::do_out. - * - * The source and destination character sets are determined by the - * facet's locale, internal and external types. - * - * The characters in [from,from_end) are converted and written to - * [to,to_end). from_next and to_next are set to point to the - * character following the last successfully converted character, - * respectively. If the result needed no conversion, from_next and - * to_next are not affected. - * - * The @a state argument should be initialized if the input is at the - * beginning and carried from a previous call if continuing - * conversion. There are no guarantees about how @a state is used. - * - * The result returned is a member of codecvt_base::result. If - * all the input is converted, returns codecvt_base::ok. If no - * conversion is necessary, returns codecvt_base::noconv. If - * the input ends early or there is insufficient space in the - * output, returns codecvt_base::partial. Otherwise the - * conversion failed and codecvt_base::error is returned. - * - * @param __state Persistent conversion state data. - * @param __from Start of input. - * @param __from_end End of input. - * @param __from_next Returns start of unconverted data. - * @param __to Start of output buffer. - * @param __to_end End of output buffer. - * @param __to_next Returns start of unused output area. - * @return codecvt_base::result. - */ - result - out(state_type& __state, const intern_type* __from, - const intern_type* __from_end, const intern_type*& __from_next, - extern_type* __to, extern_type* __to_end, - extern_type*& __to_next) const - { - return this->do_out(__state, __from, __from_end, __from_next, - __to, __to_end, __to_next); - } - - /** - * @brief Reset conversion state. - * - * Writes characters to output that would restore @a state to initial - * conditions. The idea is that if a partial conversion occurs, then - * the converting the characters written by this function would leave - * the state in initial conditions, rather than partial conversion - * state. It does this by calling codecvt::do_unshift(). - * - * For example, if 4 external characters always converted to 1 internal - * character, and input to in() had 6 external characters with state - * saved, this function would write two characters to the output and - * set the state to initialized conditions. - * - * The source and destination character sets are determined by the - * facet's locale, internal and external types. - * - * The result returned is a member of codecvt_base::result. If the - * state could be reset and data written, returns codecvt_base::ok. If - * no conversion is necessary, returns codecvt_base::noconv. If the - * output has insufficient space, returns codecvt_base::partial. - * Otherwise the reset failed and codecvt_base::error is returned. - * - * @param __state Persistent conversion state data. - * @param __to Start of output buffer. - * @param __to_end End of output buffer. - * @param __to_next Returns start of unused output area. - * @return codecvt_base::result. - */ - result - unshift(state_type& __state, extern_type* __to, extern_type* __to_end, - extern_type*& __to_next) const - { return this->do_unshift(__state, __to,__to_end,__to_next); } - - /** - * @brief Convert from external to internal character set. - * - * Converts input string of extern_type to output string of - * intern_type. This is analogous to mbsrtowcs. It does this by - * calling codecvt::do_in. - * - * The source and destination character sets are determined by the - * facet's locale, internal and external types. - * - * The characters in [from,from_end) are converted and written to - * [to,to_end). from_next and to_next are set to point to the - * character following the last successfully converted character, - * respectively. If the result needed no conversion, from_next and - * to_next are not affected. - * - * The @a state argument should be initialized if the input is at the - * beginning and carried from a previous call if continuing - * conversion. There are no guarantees about how @a state is used. - * - * The result returned is a member of codecvt_base::result. If - * all the input is converted, returns codecvt_base::ok. If no - * conversion is necessary, returns codecvt_base::noconv. If - * the input ends early or there is insufficient space in the - * output, returns codecvt_base::partial. Otherwise the - * conversion failed and codecvt_base::error is returned. - * - * @param __state Persistent conversion state data. - * @param __from Start of input. - * @param __from_end End of input. - * @param __from_next Returns start of unconverted data. - * @param __to Start of output buffer. - * @param __to_end End of output buffer. - * @param __to_next Returns start of unused output area. - * @return codecvt_base::result. - */ - result - in(state_type& __state, const extern_type* __from, - const extern_type* __from_end, const extern_type*& __from_next, - intern_type* __to, intern_type* __to_end, - intern_type*& __to_next) const - { - return this->do_in(__state, __from, __from_end, __from_next, - __to, __to_end, __to_next); - } - - int - encoding() const throw() - { return this->do_encoding(); } - - bool - always_noconv() const throw() - { return this->do_always_noconv(); } - - int - length(state_type& __state, const extern_type* __from, - const extern_type* __end, size_t __max) const - { return this->do_length(__state, __from, __end, __max); } - - int - max_length() const throw() - { return this->do_max_length(); } - - protected: - explicit - __codecvt_abstract_base(size_t __refs = 0) : locale::facet(__refs) { } - - virtual - ~__codecvt_abstract_base() { } - - /** - * @brief Convert from internal to external character set. - * - * Converts input string of intern_type to output string of - * extern_type. This function is a hook for derived classes to change - * the value returned. @see out for more information. - */ - virtual result - do_out(state_type& __state, const intern_type* __from, - const intern_type* __from_end, const intern_type*& __from_next, - extern_type* __to, extern_type* __to_end, - extern_type*& __to_next) const = 0; - - virtual result - do_unshift(state_type& __state, extern_type* __to, - extern_type* __to_end, extern_type*& __to_next) const = 0; - - virtual result - do_in(state_type& __state, const extern_type* __from, - const extern_type* __from_end, const extern_type*& __from_next, - intern_type* __to, intern_type* __to_end, - intern_type*& __to_next) const = 0; - - virtual int - do_encoding() const throw() = 0; - - virtual bool - do_always_noconv() const throw() = 0; - - virtual int - do_length(state_type&, const extern_type* __from, - const extern_type* __end, size_t __max) const = 0; - - virtual int - do_max_length() const throw() = 0; - }; - - /** - * @brief Primary class template codecvt. - * @ingroup locales - * - * NB: Generic, mostly useless implementation. - * - */ - template - class codecvt - : public __codecvt_abstract_base<_InternT, _ExternT, _StateT> - { - public: - // Types: - typedef codecvt_base::result result; - typedef _InternT intern_type; - typedef _ExternT extern_type; - typedef _StateT state_type; - - protected: - __c_locale _M_c_locale_codecvt; - - public: - static locale::id id; - - explicit - codecvt(size_t __refs = 0) - : __codecvt_abstract_base<_InternT, _ExternT, _StateT> (__refs), - _M_c_locale_codecvt(0) - { } - - explicit - codecvt(__c_locale __cloc, size_t __refs = 0); - - protected: - virtual - ~codecvt() { } - - virtual result - do_out(state_type& __state, const intern_type* __from, - const intern_type* __from_end, const intern_type*& __from_next, - extern_type* __to, extern_type* __to_end, - extern_type*& __to_next) const; - - virtual result - do_unshift(state_type& __state, extern_type* __to, - extern_type* __to_end, extern_type*& __to_next) const; - - virtual result - do_in(state_type& __state, const extern_type* __from, - const extern_type* __from_end, const extern_type*& __from_next, - intern_type* __to, intern_type* __to_end, - intern_type*& __to_next) const; - - virtual int - do_encoding() const throw(); - - virtual bool - do_always_noconv() const throw(); - - virtual int - do_length(state_type&, const extern_type* __from, - const extern_type* __end, size_t __max) const; - - virtual int - do_max_length() const throw(); - }; - - template - locale::id codecvt<_InternT, _ExternT, _StateT>::id; - - /// class codecvt specialization. - template<> - class codecvt - : public __codecvt_abstract_base - { - friend class messages; - - public: - // Types: - typedef char intern_type; - typedef char extern_type; - typedef mbstate_t state_type; - - protected: - __c_locale _M_c_locale_codecvt; - - public: - static locale::id id; - - explicit - codecvt(size_t __refs = 0); - - explicit - codecvt(__c_locale __cloc, size_t __refs = 0); - - protected: - virtual - ~codecvt(); - - virtual result - do_out(state_type& __state, const intern_type* __from, - const intern_type* __from_end, const intern_type*& __from_next, - extern_type* __to, extern_type* __to_end, - extern_type*& __to_next) const; - - virtual result - do_unshift(state_type& __state, extern_type* __to, - extern_type* __to_end, extern_type*& __to_next) const; - - virtual result - do_in(state_type& __state, const extern_type* __from, - const extern_type* __from_end, const extern_type*& __from_next, - intern_type* __to, intern_type* __to_end, - intern_type*& __to_next) const; - - virtual int - do_encoding() const throw(); - - virtual bool - do_always_noconv() const throw(); - - virtual int - do_length(state_type&, const extern_type* __from, - const extern_type* __end, size_t __max) const; - - virtual int - do_max_length() const throw(); - }; - -#ifdef _GLIBCXX_USE_WCHAR_T - /** @brief Class codecvt specialization. - * - * Converts between narrow and wide characters in the native character set - */ - template<> - class codecvt - : public __codecvt_abstract_base - { - friend class messages; - - public: - // Types: - typedef wchar_t intern_type; - typedef char extern_type; - typedef mbstate_t state_type; - - protected: - __c_locale _M_c_locale_codecvt; - - public: - static locale::id id; - - explicit - codecvt(size_t __refs = 0); - - explicit - codecvt(__c_locale __cloc, size_t __refs = 0); - - protected: - virtual - ~codecvt(); - - virtual result - do_out(state_type& __state, const intern_type* __from, - const intern_type* __from_end, const intern_type*& __from_next, - extern_type* __to, extern_type* __to_end, - extern_type*& __to_next) const; - - virtual result - do_unshift(state_type& __state, - extern_type* __to, extern_type* __to_end, - extern_type*& __to_next) const; - - virtual result - do_in(state_type& __state, - const extern_type* __from, const extern_type* __from_end, - const extern_type*& __from_next, - intern_type* __to, intern_type* __to_end, - intern_type*& __to_next) const; - - virtual - int do_encoding() const throw(); - - virtual - bool do_always_noconv() const throw(); - - virtual - int do_length(state_type&, const extern_type* __from, - const extern_type* __end, size_t __max) const; - - virtual int - do_max_length() const throw(); - }; -#endif //_GLIBCXX_USE_WCHAR_T - -#if __cplusplus >= 201103L -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - /** @brief Class codecvt specialization. - * - * Converts between UTF-16 and UTF-8. - */ - template<> - class codecvt - : public __codecvt_abstract_base - { - public: - // Types: - typedef char16_t intern_type; - typedef char extern_type; - typedef mbstate_t state_type; - - public: - static locale::id id; - - explicit - codecvt(size_t __refs = 0) - : __codecvt_abstract_base(__refs) { } - - protected: - virtual - ~codecvt(); - - virtual result - do_out(state_type& __state, const intern_type* __from, - const intern_type* __from_end, const intern_type*& __from_next, - extern_type* __to, extern_type* __to_end, - extern_type*& __to_next) const; - - virtual result - do_unshift(state_type& __state, - extern_type* __to, extern_type* __to_end, - extern_type*& __to_next) const; - - virtual result - do_in(state_type& __state, - const extern_type* __from, const extern_type* __from_end, - const extern_type*& __from_next, - intern_type* __to, intern_type* __to_end, - intern_type*& __to_next) const; - - virtual - int do_encoding() const throw(); - - virtual - bool do_always_noconv() const throw(); - - virtual - int do_length(state_type&, const extern_type* __from, - const extern_type* __end, size_t __max) const; - - virtual int - do_max_length() const throw(); - }; - - /** @brief Class codecvt specialization. - * - * Converts between UTF-32 and UTF-8. - */ - template<> - class codecvt - : public __codecvt_abstract_base - { - public: - // Types: - typedef char32_t intern_type; - typedef char extern_type; - typedef mbstate_t state_type; - - public: - static locale::id id; - - explicit - codecvt(size_t __refs = 0) - : __codecvt_abstract_base(__refs) { } - - protected: - virtual - ~codecvt(); - - virtual result - do_out(state_type& __state, const intern_type* __from, - const intern_type* __from_end, const intern_type*& __from_next, - extern_type* __to, extern_type* __to_end, - extern_type*& __to_next) const; - - virtual result - do_unshift(state_type& __state, - extern_type* __to, extern_type* __to_end, - extern_type*& __to_next) const; - - virtual result - do_in(state_type& __state, - const extern_type* __from, const extern_type* __from_end, - const extern_type*& __from_next, - intern_type* __to, intern_type* __to_end, - intern_type*& __to_next) const; - - virtual - int do_encoding() const throw(); - - virtual - bool do_always_noconv() const throw(); - - virtual - int do_length(state_type&, const extern_type* __from, - const extern_type* __end, size_t __max) const; - - virtual int - do_max_length() const throw(); - }; - -#endif // _GLIBCXX_USE_C99_STDINT_TR1 -#endif // C++11 - - /// class codecvt_byname [22.2.1.6]. - template - class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> - { - public: - explicit - codecvt_byname(const char* __s, size_t __refs = 0) - : codecvt<_InternT, _ExternT, _StateT>(__refs) - { - if (__builtin_strcmp(__s, "C") != 0 - && __builtin_strcmp(__s, "POSIX") != 0) - { - this->_S_destroy_c_locale(this->_M_c_locale_codecvt); - this->_S_create_c_locale(this->_M_c_locale_codecvt, __s); - } - } - -#if __cplusplus >= 201103L - explicit - codecvt_byname(const string& __s, size_t __refs = 0) - : codecvt_byname(__s.c_str(), __refs) { } -#endif - - protected: - virtual - ~codecvt_byname() { } - }; - -#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_STDINT_TR1) - template<> - class codecvt_byname - : public codecvt - { - public: - explicit - codecvt_byname(const char* __s, size_t __refs = 0) - : codecvt(__refs) { } - - explicit - codecvt_byname(const string& __s, size_t __refs = 0) - : codecvt_byname(__s.c_str(), __refs) { } - - protected: - virtual - ~codecvt_byname() { } - }; - - template<> - class codecvt_byname - : public codecvt - { - public: - explicit - codecvt_byname(const char* __s, size_t __refs = 0) - : codecvt(__refs) { } - - explicit - codecvt_byname(const string& __s, size_t __refs = 0) - : codecvt_byname(__s.c_str(), __refs) { } - - protected: - virtual - ~codecvt_byname() { } - }; -#endif - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template class codecvt_byname; - - extern template - const codecvt& - use_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template class codecvt_byname; - - extern template - const codecvt& - use_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); -#endif - -#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_STDINT_TR1) - extern template class codecvt_byname; - extern template class codecvt_byname; -#endif - -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif // _CODECVT_H diff --git a/openflow/usr/include/c++/5/bits/concept_check.h b/openflow/usr/include/c++/5/bits/concept_check.h deleted file mode 100644 index e1a5c9c..0000000 --- a/openflow/usr/include/c++/5/bits/concept_check.h +++ /dev/null @@ -1,80 +0,0 @@ -// Concept-checking control -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/concept_check.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iterator} - */ - -#ifndef _CONCEPT_CHECK_H -#define _CONCEPT_CHECK_H 1 - -#pragma GCC system_header - -#include - -// All places in libstdc++-v3 where these are used, or /might/ be used, or -// don't need to be used, or perhaps /should/ be used, are commented with -// "concept requirements" (and maybe some more text). So grep like crazy -// if you're looking for additional places to use these. - -// Concept-checking code is off by default unless users turn it on via -// configure options or editing c++config.h. - -#ifndef _GLIBCXX_CONCEPT_CHECKS - -#define __glibcxx_function_requires(...) -#define __glibcxx_class_requires(_a,_b) -#define __glibcxx_class_requires2(_a,_b,_c) -#define __glibcxx_class_requires3(_a,_b,_c,_d) -#define __glibcxx_class_requires4(_a,_b,_c,_d,_e) - -#else // the checks are on - -#include - -// Note that the obvious and elegant approach of -// -//#define glibcxx_function_requires(C) debug::function_requires< debug::C >() -// -// won't work due to concept templates with more than one parameter, e.g., -// BinaryPredicateConcept. The preprocessor tries to split things up on -// the commas in the template argument list. We can't use an inner pair of -// parenthesis to hide the commas, because "debug::(Temp)" isn't -// a valid instantiation pattern. Thus, we steal a feature from C99. - -#define __glibcxx_function_requires(...) \ - __gnu_cxx::__function_requires< __gnu_cxx::__VA_ARGS__ >(); -#define __glibcxx_class_requires(_a,_C) \ - _GLIBCXX_CLASS_REQUIRES(_a, __gnu_cxx, _C); -#define __glibcxx_class_requires2(_a,_b,_C) \ - _GLIBCXX_CLASS_REQUIRES2(_a, _b, __gnu_cxx, _C); -#define __glibcxx_class_requires3(_a,_b,_c,_C) \ - _GLIBCXX_CLASS_REQUIRES3(_a, _b, _c, __gnu_cxx, _C); -#define __glibcxx_class_requires4(_a,_b,_c,_d,_C) \ - _GLIBCXX_CLASS_REQUIRES4(_a, _b, _c, _d, __gnu_cxx, _C); - -#endif // enable/disable - -#endif // _GLIBCXX_CONCEPT_CHECK diff --git a/openflow/usr/include/c++/5/bits/cpp_type_traits.h b/openflow/usr/include/c++/5/bits/cpp_type_traits.h deleted file mode 100644 index 8c6bb7f..0000000 --- a/openflow/usr/include/c++/5/bits/cpp_type_traits.h +++ /dev/null @@ -1,446 +0,0 @@ -// The -*- C++ -*- type traits classes for internal use in libstdc++ - -// Copyright (C) 2000-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/cpp_type_traits.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{ext/type_traits} - */ - -// Written by Gabriel Dos Reis - -#ifndef _CPP_TYPE_TRAITS_H -#define _CPP_TYPE_TRAITS_H 1 - -#pragma GCC system_header - -#include - -// -// This file provides some compile-time information about various types. -// These representations were designed, on purpose, to be constant-expressions -// and not types as found in . In particular, they -// can be used in control structures and the optimizer hopefully will do -// the obvious thing. -// -// Why integral expressions, and not functions nor types? -// Firstly, these compile-time entities are used as template-arguments -// so function return values won't work: We need compile-time entities. -// We're left with types and constant integral expressions. -// Secondly, from the point of view of ease of use, type-based compile-time -// information is -not- *that* convenient. On has to write lots of -// overloaded functions and to hope that the compiler will select the right -// one. As a net effect, the overall structure isn't very clear at first -// glance. -// Thirdly, partial ordering and overload resolution (of function templates) -// is highly costly in terms of compiler-resource. It is a Good Thing to -// keep these resource consumption as least as possible. -// -// See valarray_array.h for a case use. -// -// -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06. -// -// Update 2005: types are also provided and has been -// removed. -// - -// Forward declaration hack, should really include this from somewhere. -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - class __normal_iterator; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - struct __true_type { }; - struct __false_type { }; - - template - struct __truth_type - { typedef __false_type __type; }; - - template<> - struct __truth_type - { typedef __true_type __type; }; - - // N.B. The conversions to bool are needed due to the issue - // explained in c++/19404. - template - struct __traitor - { - enum { __value = bool(_Sp::__value) || bool(_Tp::__value) }; - typedef typename __truth_type<__value>::__type __type; - }; - - // Compare for equality of types. - template - struct __are_same - { - enum { __value = 0 }; - typedef __false_type __type; - }; - - template - struct __are_same<_Tp, _Tp> - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - // Holds if the template-argument is a void type. - template - struct __is_void - { - enum { __value = 0 }; - typedef __false_type __type; - }; - - template<> - struct __is_void - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - // - // Integer types - // - template - struct __is_integer - { - enum { __value = 0 }; - typedef __false_type __type; - }; - - // Thirteen specializations (yes there are eleven standard integer - // types; long long and unsigned long long are - // supported as extensions). Up to four target-specific __int - // types are supported as well. - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; - -# ifdef _GLIBCXX_USE_WCHAR_T - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; -# endif - -#if __cplusplus >= 201103L - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; -#endif - - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_integer - { - enum { __value = 1 }; - typedef __true_type __type; - }; - -#define __INT_N(TYPE) \ - template<> \ - struct __is_integer \ - { \ - enum { __value = 1 }; \ - typedef __true_type __type; \ - }; \ - template<> \ - struct __is_integer \ - { \ - enum { __value = 1 }; \ - typedef __true_type __type; \ - }; - -#ifdef __GLIBCXX_TYPE_INT_N_0 -__INT_N(__GLIBCXX_TYPE_INT_N_0) -#endif -#ifdef __GLIBCXX_TYPE_INT_N_1 -__INT_N(__GLIBCXX_TYPE_INT_N_1) -#endif -#ifdef __GLIBCXX_TYPE_INT_N_2 -__INT_N(__GLIBCXX_TYPE_INT_N_2) -#endif -#ifdef __GLIBCXX_TYPE_INT_N_3 -__INT_N(__GLIBCXX_TYPE_INT_N_3) -#endif - -#undef __INT_N - - // - // Floating point types - // - template - struct __is_floating - { - enum { __value = 0 }; - typedef __false_type __type; - }; - - // three specializations (float, double and 'long double') - template<> - struct __is_floating - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_floating - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_floating - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - // - // Pointer types - // - template - struct __is_pointer - { - enum { __value = 0 }; - typedef __false_type __type; - }; - - template - struct __is_pointer<_Tp*> - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - // - // Normal iterator type - // - template - struct __is_normal_iterator - { - enum { __value = 0 }; - typedef __false_type __type; - }; - - template - struct __is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator, - _Container> > - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - // - // An arithmetic type is an integer type or a floating point type - // - template - struct __is_arithmetic - : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> > - { }; - - // - // A scalar type is an arithmetic type or a pointer type - // - template - struct __is_scalar - : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> > - { }; - - // - // For use in std::copy and std::find overloads for streambuf iterators. - // - template - struct __is_char - { - enum { __value = 0 }; - typedef __false_type __type; - }; - - template<> - struct __is_char - { - enum { __value = 1 }; - typedef __true_type __type; - }; - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - struct __is_char - { - enum { __value = 1 }; - typedef __true_type __type; - }; -#endif - - template - struct __is_byte - { - enum { __value = 0 }; - typedef __false_type __type; - }; - - template<> - struct __is_byte - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_byte - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - template<> - struct __is_byte - { - enum { __value = 1 }; - typedef __true_type __type; - }; - - // - // Move iterator type - // - template - struct __is_move_iterator - { - enum { __value = 0 }; - typedef __false_type __type; - }; - -#if __cplusplus >= 201103L - template - class move_iterator; - - template - struct __is_move_iterator< move_iterator<_Iterator> > - { - enum { __value = 1 }; - typedef __true_type __type; - }; -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif //_CPP_TYPE_TRAITS_H diff --git a/openflow/usr/include/c++/5/bits/cxxabi_forced.h b/openflow/usr/include/c++/5/bits/cxxabi_forced.h deleted file mode 100644 index e5ae028..0000000 --- a/openflow/usr/include/c++/5/bits/cxxabi_forced.h +++ /dev/null @@ -1,60 +0,0 @@ -// cxxabi.h subset for cancellation -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of GCC. -// -// GCC is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// GCC is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/cxxabi_forced.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{cxxabi.h} - */ - -#ifndef _CXXABI_FORCED_H -#define _CXXABI_FORCED_H 1 - -#pragma GCC system_header - -#pragma GCC visibility push(default) - -#ifdef __cplusplus -namespace __cxxabiv1 -{ - /** - * @brief Thrown as part of forced unwinding. - * @ingroup exceptions - * - * A magic placeholder class that can be caught by reference to - * recognize forced unwinding. - */ - class __forced_unwind - { - virtual ~__forced_unwind() throw(); - - // Prevent catch by value. - virtual void __pure_dummy() = 0; - }; -} -#endif // __cplusplus - -#pragma GCC visibility pop - -#endif // __CXXABI_FORCED_H diff --git a/openflow/usr/include/c++/5/bits/deque.tcc b/openflow/usr/include/c++/5/bits/deque.tcc deleted file mode 100644 index f7c2c79..0000000 --- a/openflow/usr/include/c++/5/bits/deque.tcc +++ /dev/null @@ -1,1096 +0,0 @@ -// Deque implementation (out of line) -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/deque.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{deque} - */ - -#ifndef _DEQUE_TCC -#define _DEQUE_TCC 1 - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - -#if __cplusplus >= 201103L - template - void - deque<_Tp, _Alloc>:: - _M_default_initialize() - { - _Map_pointer __cur; - __try - { - for (__cur = this->_M_impl._M_start._M_node; - __cur < this->_M_impl._M_finish._M_node; - ++__cur) - std::__uninitialized_default_a(*__cur, *__cur + _S_buffer_size(), - _M_get_Tp_allocator()); - std::__uninitialized_default_a(this->_M_impl._M_finish._M_first, - this->_M_impl._M_finish._M_cur, - _M_get_Tp_allocator()); - } - __catch(...) - { - std::_Destroy(this->_M_impl._M_start, iterator(*__cur, __cur), - _M_get_Tp_allocator()); - __throw_exception_again; - } - } -#endif - - template - deque<_Tp, _Alloc>& - deque<_Tp, _Alloc>:: - operator=(const deque& __x) - { - if (&__x != this) - { -#if __cplusplus >= 201103L - if (_Alloc_traits::_S_propagate_on_copy_assign()) - { - if (!_Alloc_traits::_S_always_equal() - && _M_get_Tp_allocator() != __x._M_get_Tp_allocator()) - { - // Replacement allocator cannot free existing storage, - // so deallocate everything and take copy of __x's data. - _M_replace_map(__x, __x.get_allocator()); - std::__alloc_on_copy(_M_get_Tp_allocator(), - __x._M_get_Tp_allocator()); - return *this; - } - std::__alloc_on_copy(_M_get_Tp_allocator(), - __x._M_get_Tp_allocator()); - } -#endif - const size_type __len = size(); - if (__len >= __x.size()) - _M_erase_at_end(std::copy(__x.begin(), __x.end(), - this->_M_impl._M_start)); - else - { - const_iterator __mid = __x.begin() + difference_type(__len); - std::copy(__x.begin(), __mid, this->_M_impl._M_start); - insert(this->_M_impl._M_finish, __mid, __x.end()); - } - } - return *this; - } - -#if __cplusplus >= 201103L - template - template - void - deque<_Tp, _Alloc>:: - emplace_front(_Args&&... __args) - { - if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first) - { - _Alloc_traits::construct(this->_M_impl, - this->_M_impl._M_start._M_cur - 1, - std::forward<_Args>(__args)...); - --this->_M_impl._M_start._M_cur; - } - else - _M_push_front_aux(std::forward<_Args>(__args)...); - } - - template - template - void - deque<_Tp, _Alloc>:: - emplace_back(_Args&&... __args) - { - if (this->_M_impl._M_finish._M_cur - != this->_M_impl._M_finish._M_last - 1) - { - _Alloc_traits::construct(this->_M_impl, - this->_M_impl._M_finish._M_cur, - std::forward<_Args>(__args)...); - ++this->_M_impl._M_finish._M_cur; - } - else - _M_push_back_aux(std::forward<_Args>(__args)...); - } -#endif - -#if __cplusplus >= 201103L - template - template - typename deque<_Tp, _Alloc>::iterator - deque<_Tp, _Alloc>:: - emplace(const_iterator __position, _Args&&... __args) - { - if (__position._M_cur == this->_M_impl._M_start._M_cur) - { - emplace_front(std::forward<_Args>(__args)...); - return this->_M_impl._M_start; - } - else if (__position._M_cur == this->_M_impl._M_finish._M_cur) - { - emplace_back(std::forward<_Args>(__args)...); - iterator __tmp = this->_M_impl._M_finish; - --__tmp; - return __tmp; - } - else - return _M_insert_aux(__position._M_const_cast(), - std::forward<_Args>(__args)...); - } -#endif - - template - typename deque<_Tp, _Alloc>::iterator - deque<_Tp, _Alloc>:: -#if __cplusplus >= 201103L - insert(const_iterator __position, const value_type& __x) -#else - insert(iterator __position, const value_type& __x) -#endif - { - if (__position._M_cur == this->_M_impl._M_start._M_cur) - { - push_front(__x); - return this->_M_impl._M_start; - } - else if (__position._M_cur == this->_M_impl._M_finish._M_cur) - { - push_back(__x); - iterator __tmp = this->_M_impl._M_finish; - --__tmp; - return __tmp; - } - else - return _M_insert_aux(__position._M_const_cast(), __x); - } - - template - typename deque<_Tp, _Alloc>::iterator - deque<_Tp, _Alloc>:: - _M_erase(iterator __position) - { - iterator __next = __position; - ++__next; - const difference_type __index = __position - begin(); - if (static_cast(__index) < (size() >> 1)) - { - if (__position != begin()) - _GLIBCXX_MOVE_BACKWARD3(begin(), __position, __next); - pop_front(); - } - else - { - if (__next != end()) - _GLIBCXX_MOVE3(__next, end(), __position); - pop_back(); - } - return begin() + __index; - } - - template - typename deque<_Tp, _Alloc>::iterator - deque<_Tp, _Alloc>:: - _M_erase(iterator __first, iterator __last) - { - if (__first == __last) - return __first; - else if (__first == begin() && __last == end()) - { - clear(); - return end(); - } - else - { - const difference_type __n = __last - __first; - const difference_type __elems_before = __first - begin(); - if (static_cast(__elems_before) <= (size() - __n) / 2) - { - if (__first != begin()) - _GLIBCXX_MOVE_BACKWARD3(begin(), __first, __last); - _M_erase_at_begin(begin() + __n); - } - else - { - if (__last != end()) - _GLIBCXX_MOVE3(__last, end(), __first); - _M_erase_at_end(end() - __n); - } - return begin() + __elems_before; - } - } - - template - template - void - deque<_Tp, _Alloc>:: - _M_assign_aux(_InputIterator __first, _InputIterator __last, - std::input_iterator_tag) - { - iterator __cur = begin(); - for (; __first != __last && __cur != end(); ++__cur, ++__first) - *__cur = *__first; - if (__first == __last) - _M_erase_at_end(__cur); - else - insert(end(), __first, __last); - } - - template - void - deque<_Tp, _Alloc>:: - _M_fill_insert(iterator __pos, size_type __n, const value_type& __x) - { - if (__pos._M_cur == this->_M_impl._M_start._M_cur) - { - iterator __new_start = _M_reserve_elements_at_front(__n); - __try - { - std::__uninitialized_fill_a(__new_start, this->_M_impl._M_start, - __x, _M_get_Tp_allocator()); - this->_M_impl._M_start = __new_start; - } - __catch(...) - { - _M_destroy_nodes(__new_start._M_node, - this->_M_impl._M_start._M_node); - __throw_exception_again; - } - } - else if (__pos._M_cur == this->_M_impl._M_finish._M_cur) - { - iterator __new_finish = _M_reserve_elements_at_back(__n); - __try - { - std::__uninitialized_fill_a(this->_M_impl._M_finish, - __new_finish, __x, - _M_get_Tp_allocator()); - this->_M_impl._M_finish = __new_finish; - } - __catch(...) - { - _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1, - __new_finish._M_node + 1); - __throw_exception_again; - } - } - else - _M_insert_aux(__pos, __n, __x); - } - -#if __cplusplus >= 201103L - template - void - deque<_Tp, _Alloc>:: - _M_default_append(size_type __n) - { - if (__n) - { - iterator __new_finish = _M_reserve_elements_at_back(__n); - __try - { - std::__uninitialized_default_a(this->_M_impl._M_finish, - __new_finish, - _M_get_Tp_allocator()); - this->_M_impl._M_finish = __new_finish; - } - __catch(...) - { - _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1, - __new_finish._M_node + 1); - __throw_exception_again; - } - } - } - - template - bool - deque<_Tp, _Alloc>:: - _M_shrink_to_fit() - { - const difference_type __front_capacity - = (this->_M_impl._M_start._M_cur - this->_M_impl._M_start._M_first); - if (__front_capacity == 0) - return false; - - const difference_type __back_capacity - = (this->_M_impl._M_finish._M_last - this->_M_impl._M_finish._M_cur); - if (__front_capacity + __back_capacity < _S_buffer_size()) - return false; - - return std::__shrink_to_fit_aux::_S_do_it(*this); - } -#endif - - template - void - deque<_Tp, _Alloc>:: - _M_fill_initialize(const value_type& __value) - { - _Map_pointer __cur; - __try - { - for (__cur = this->_M_impl._M_start._M_node; - __cur < this->_M_impl._M_finish._M_node; - ++__cur) - std::__uninitialized_fill_a(*__cur, *__cur + _S_buffer_size(), - __value, _M_get_Tp_allocator()); - std::__uninitialized_fill_a(this->_M_impl._M_finish._M_first, - this->_M_impl._M_finish._M_cur, - __value, _M_get_Tp_allocator()); - } - __catch(...) - { - std::_Destroy(this->_M_impl._M_start, iterator(*__cur, __cur), - _M_get_Tp_allocator()); - __throw_exception_again; - } - } - - template - template - void - deque<_Tp, _Alloc>:: - _M_range_initialize(_InputIterator __first, _InputIterator __last, - std::input_iterator_tag) - { - this->_M_initialize_map(0); - __try - { - for (; __first != __last; ++__first) -#if __cplusplus >= 201103L - emplace_back(*__first); -#else - push_back(*__first); -#endif - } - __catch(...) - { - clear(); - __throw_exception_again; - } - } - - template - template - void - deque<_Tp, _Alloc>:: - _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, - std::forward_iterator_tag) - { - const size_type __n = std::distance(__first, __last); - this->_M_initialize_map(__n); - - _Map_pointer __cur_node; - __try - { - for (__cur_node = this->_M_impl._M_start._M_node; - __cur_node < this->_M_impl._M_finish._M_node; - ++__cur_node) - { - _ForwardIterator __mid = __first; - std::advance(__mid, _S_buffer_size()); - std::__uninitialized_copy_a(__first, __mid, *__cur_node, - _M_get_Tp_allocator()); - __first = __mid; - } - std::__uninitialized_copy_a(__first, __last, - this->_M_impl._M_finish._M_first, - _M_get_Tp_allocator()); - } - __catch(...) - { - std::_Destroy(this->_M_impl._M_start, - iterator(*__cur_node, __cur_node), - _M_get_Tp_allocator()); - __throw_exception_again; - } - } - - // Called only if _M_impl._M_finish._M_cur == _M_impl._M_finish._M_last - 1. - template -#if __cplusplus >= 201103L - template - void - deque<_Tp, _Alloc>:: - _M_push_back_aux(_Args&&... __args) -#else - void - deque<_Tp, _Alloc>:: - _M_push_back_aux(const value_type& __t) -#endif - { - _M_reserve_map_at_back(); - *(this->_M_impl._M_finish._M_node + 1) = this->_M_allocate_node(); - __try - { -#if __cplusplus >= 201103L - _Alloc_traits::construct(this->_M_impl, - this->_M_impl._M_finish._M_cur, - std::forward<_Args>(__args)...); -#else - this->_M_impl.construct(this->_M_impl._M_finish._M_cur, __t); -#endif - this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node - + 1); - this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_first; - } - __catch(...) - { - _M_deallocate_node(*(this->_M_impl._M_finish._M_node + 1)); - __throw_exception_again; - } - } - - // Called only if _M_impl._M_start._M_cur == _M_impl._M_start._M_first. - template -#if __cplusplus >= 201103L - template - void - deque<_Tp, _Alloc>:: - _M_push_front_aux(_Args&&... __args) -#else - void - deque<_Tp, _Alloc>:: - _M_push_front_aux(const value_type& __t) -#endif - { - _M_reserve_map_at_front(); - *(this->_M_impl._M_start._M_node - 1) = this->_M_allocate_node(); - __try - { - this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node - - 1); - this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_last - 1; -#if __cplusplus >= 201103L - _Alloc_traits::construct(this->_M_impl, - this->_M_impl._M_start._M_cur, - std::forward<_Args>(__args)...); -#else - this->_M_impl.construct(this->_M_impl._M_start._M_cur, __t); -#endif - } - __catch(...) - { - ++this->_M_impl._M_start; - _M_deallocate_node(*(this->_M_impl._M_start._M_node - 1)); - __throw_exception_again; - } - } - - // Called only if _M_impl._M_finish._M_cur == _M_impl._M_finish._M_first. - template - void deque<_Tp, _Alloc>:: - _M_pop_back_aux() - { - _M_deallocate_node(this->_M_impl._M_finish._M_first); - this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node - 1); - this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_last - 1; - _Alloc_traits::destroy(_M_get_Tp_allocator(), - this->_M_impl._M_finish._M_cur); - } - - // Called only if _M_impl._M_start._M_cur == _M_impl._M_start._M_last - 1. - // Note that if the deque has at least one element (a precondition for this - // member function), and if - // _M_impl._M_start._M_cur == _M_impl._M_start._M_last, - // then the deque must have at least two nodes. - template - void deque<_Tp, _Alloc>:: - _M_pop_front_aux() - { - _Alloc_traits::destroy(_M_get_Tp_allocator(), - this->_M_impl._M_start._M_cur); - _M_deallocate_node(this->_M_impl._M_start._M_first); - this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node + 1); - this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_first; - } - - template - template - void - deque<_Tp, _Alloc>:: - _M_range_insert_aux(iterator __pos, - _InputIterator __first, _InputIterator __last, - std::input_iterator_tag) - { std::copy(__first, __last, std::inserter(*this, __pos)); } - - template - template - void - deque<_Tp, _Alloc>:: - _M_range_insert_aux(iterator __pos, - _ForwardIterator __first, _ForwardIterator __last, - std::forward_iterator_tag) - { - const size_type __n = std::distance(__first, __last); - if (__pos._M_cur == this->_M_impl._M_start._M_cur) - { - iterator __new_start = _M_reserve_elements_at_front(__n); - __try - { - std::__uninitialized_copy_a(__first, __last, __new_start, - _M_get_Tp_allocator()); - this->_M_impl._M_start = __new_start; - } - __catch(...) - { - _M_destroy_nodes(__new_start._M_node, - this->_M_impl._M_start._M_node); - __throw_exception_again; - } - } - else if (__pos._M_cur == this->_M_impl._M_finish._M_cur) - { - iterator __new_finish = _M_reserve_elements_at_back(__n); - __try - { - std::__uninitialized_copy_a(__first, __last, - this->_M_impl._M_finish, - _M_get_Tp_allocator()); - this->_M_impl._M_finish = __new_finish; - } - __catch(...) - { - _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1, - __new_finish._M_node + 1); - __throw_exception_again; - } - } - else - _M_insert_aux(__pos, __first, __last, __n); - } - - template -#if __cplusplus >= 201103L - template - typename deque<_Tp, _Alloc>::iterator - deque<_Tp, _Alloc>:: - _M_insert_aux(iterator __pos, _Args&&... __args) - { - value_type __x_copy(std::forward<_Args>(__args)...); // XXX copy -#else - typename deque<_Tp, _Alloc>::iterator - deque<_Tp, _Alloc>:: - _M_insert_aux(iterator __pos, const value_type& __x) - { - value_type __x_copy = __x; // XXX copy -#endif - difference_type __index = __pos - this->_M_impl._M_start; - if (static_cast(__index) < size() / 2) - { - push_front(_GLIBCXX_MOVE(front())); - iterator __front1 = this->_M_impl._M_start; - ++__front1; - iterator __front2 = __front1; - ++__front2; - __pos = this->_M_impl._M_start + __index; - iterator __pos1 = __pos; - ++__pos1; - _GLIBCXX_MOVE3(__front2, __pos1, __front1); - } - else - { - push_back(_GLIBCXX_MOVE(back())); - iterator __back1 = this->_M_impl._M_finish; - --__back1; - iterator __back2 = __back1; - --__back2; - __pos = this->_M_impl._M_start + __index; - _GLIBCXX_MOVE_BACKWARD3(__pos, __back2, __back1); - } - *__pos = _GLIBCXX_MOVE(__x_copy); - return __pos; - } - - template - void - deque<_Tp, _Alloc>:: - _M_insert_aux(iterator __pos, size_type __n, const value_type& __x) - { - const difference_type __elems_before = __pos - this->_M_impl._M_start; - const size_type __length = this->size(); - value_type __x_copy = __x; - if (__elems_before < difference_type(__length / 2)) - { - iterator __new_start = _M_reserve_elements_at_front(__n); - iterator __old_start = this->_M_impl._M_start; - __pos = this->_M_impl._M_start + __elems_before; - __try - { - if (__elems_before >= difference_type(__n)) - { - iterator __start_n = (this->_M_impl._M_start - + difference_type(__n)); - std::__uninitialized_move_a(this->_M_impl._M_start, - __start_n, __new_start, - _M_get_Tp_allocator()); - this->_M_impl._M_start = __new_start; - _GLIBCXX_MOVE3(__start_n, __pos, __old_start); - std::fill(__pos - difference_type(__n), __pos, __x_copy); - } - else - { - std::__uninitialized_move_fill(this->_M_impl._M_start, - __pos, __new_start, - this->_M_impl._M_start, - __x_copy, - _M_get_Tp_allocator()); - this->_M_impl._M_start = __new_start; - std::fill(__old_start, __pos, __x_copy); - } - } - __catch(...) - { - _M_destroy_nodes(__new_start._M_node, - this->_M_impl._M_start._M_node); - __throw_exception_again; - } - } - else - { - iterator __new_finish = _M_reserve_elements_at_back(__n); - iterator __old_finish = this->_M_impl._M_finish; - const difference_type __elems_after = - difference_type(__length) - __elems_before; - __pos = this->_M_impl._M_finish - __elems_after; - __try - { - if (__elems_after > difference_type(__n)) - { - iterator __finish_n = (this->_M_impl._M_finish - - difference_type(__n)); - std::__uninitialized_move_a(__finish_n, - this->_M_impl._M_finish, - this->_M_impl._M_finish, - _M_get_Tp_allocator()); - this->_M_impl._M_finish = __new_finish; - _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish); - std::fill(__pos, __pos + difference_type(__n), __x_copy); - } - else - { - std::__uninitialized_fill_move(this->_M_impl._M_finish, - __pos + difference_type(__n), - __x_copy, __pos, - this->_M_impl._M_finish, - _M_get_Tp_allocator()); - this->_M_impl._M_finish = __new_finish; - std::fill(__pos, __old_finish, __x_copy); - } - } - __catch(...) - { - _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1, - __new_finish._M_node + 1); - __throw_exception_again; - } - } - } - - template - template - void - deque<_Tp, _Alloc>:: - _M_insert_aux(iterator __pos, - _ForwardIterator __first, _ForwardIterator __last, - size_type __n) - { - const difference_type __elemsbefore = __pos - this->_M_impl._M_start; - const size_type __length = size(); - if (static_cast(__elemsbefore) < __length / 2) - { - iterator __new_start = _M_reserve_elements_at_front(__n); - iterator __old_start = this->_M_impl._M_start; - __pos = this->_M_impl._M_start + __elemsbefore; - __try - { - if (__elemsbefore >= difference_type(__n)) - { - iterator __start_n = (this->_M_impl._M_start - + difference_type(__n)); - std::__uninitialized_move_a(this->_M_impl._M_start, - __start_n, __new_start, - _M_get_Tp_allocator()); - this->_M_impl._M_start = __new_start; - _GLIBCXX_MOVE3(__start_n, __pos, __old_start); - std::copy(__first, __last, __pos - difference_type(__n)); - } - else - { - _ForwardIterator __mid = __first; - std::advance(__mid, difference_type(__n) - __elemsbefore); - std::__uninitialized_move_copy(this->_M_impl._M_start, - __pos, __first, __mid, - __new_start, - _M_get_Tp_allocator()); - this->_M_impl._M_start = __new_start; - std::copy(__mid, __last, __old_start); - } - } - __catch(...) - { - _M_destroy_nodes(__new_start._M_node, - this->_M_impl._M_start._M_node); - __throw_exception_again; - } - } - else - { - iterator __new_finish = _M_reserve_elements_at_back(__n); - iterator __old_finish = this->_M_impl._M_finish; - const difference_type __elemsafter = - difference_type(__length) - __elemsbefore; - __pos = this->_M_impl._M_finish - __elemsafter; - __try - { - if (__elemsafter > difference_type(__n)) - { - iterator __finish_n = (this->_M_impl._M_finish - - difference_type(__n)); - std::__uninitialized_move_a(__finish_n, - this->_M_impl._M_finish, - this->_M_impl._M_finish, - _M_get_Tp_allocator()); - this->_M_impl._M_finish = __new_finish; - _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish); - std::copy(__first, __last, __pos); - } - else - { - _ForwardIterator __mid = __first; - std::advance(__mid, __elemsafter); - std::__uninitialized_copy_move(__mid, __last, __pos, - this->_M_impl._M_finish, - this->_M_impl._M_finish, - _M_get_Tp_allocator()); - this->_M_impl._M_finish = __new_finish; - std::copy(__first, __mid, __pos); - } - } - __catch(...) - { - _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1, - __new_finish._M_node + 1); - __throw_exception_again; - } - } - } - - template - void - deque<_Tp, _Alloc>:: - _M_destroy_data_aux(iterator __first, iterator __last) - { - for (_Map_pointer __node = __first._M_node + 1; - __node < __last._M_node; ++__node) - std::_Destroy(*__node, *__node + _S_buffer_size(), - _M_get_Tp_allocator()); - - if (__first._M_node != __last._M_node) - { - std::_Destroy(__first._M_cur, __first._M_last, - _M_get_Tp_allocator()); - std::_Destroy(__last._M_first, __last._M_cur, - _M_get_Tp_allocator()); - } - else - std::_Destroy(__first._M_cur, __last._M_cur, - _M_get_Tp_allocator()); - } - - template - void - deque<_Tp, _Alloc>:: - _M_new_elements_at_front(size_type __new_elems) - { - if (this->max_size() - this->size() < __new_elems) - __throw_length_error(__N("deque::_M_new_elements_at_front")); - - const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1) - / _S_buffer_size()); - _M_reserve_map_at_front(__new_nodes); - size_type __i; - __try - { - for (__i = 1; __i <= __new_nodes; ++__i) - *(this->_M_impl._M_start._M_node - __i) = this->_M_allocate_node(); - } - __catch(...) - { - for (size_type __j = 1; __j < __i; ++__j) - _M_deallocate_node(*(this->_M_impl._M_start._M_node - __j)); - __throw_exception_again; - } - } - - template - void - deque<_Tp, _Alloc>:: - _M_new_elements_at_back(size_type __new_elems) - { - if (this->max_size() - this->size() < __new_elems) - __throw_length_error(__N("deque::_M_new_elements_at_back")); - - const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1) - / _S_buffer_size()); - _M_reserve_map_at_back(__new_nodes); - size_type __i; - __try - { - for (__i = 1; __i <= __new_nodes; ++__i) - *(this->_M_impl._M_finish._M_node + __i) = this->_M_allocate_node(); - } - __catch(...) - { - for (size_type __j = 1; __j < __i; ++__j) - _M_deallocate_node(*(this->_M_impl._M_finish._M_node + __j)); - __throw_exception_again; - } - } - - template - void - deque<_Tp, _Alloc>:: - _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front) - { - const size_type __old_num_nodes - = this->_M_impl._M_finish._M_node - this->_M_impl._M_start._M_node + 1; - const size_type __new_num_nodes = __old_num_nodes + __nodes_to_add; - - _Map_pointer __new_nstart; - if (this->_M_impl._M_map_size > 2 * __new_num_nodes) - { - __new_nstart = this->_M_impl._M_map + (this->_M_impl._M_map_size - - __new_num_nodes) / 2 - + (__add_at_front ? __nodes_to_add : 0); - if (__new_nstart < this->_M_impl._M_start._M_node) - std::copy(this->_M_impl._M_start._M_node, - this->_M_impl._M_finish._M_node + 1, - __new_nstart); - else - std::copy_backward(this->_M_impl._M_start._M_node, - this->_M_impl._M_finish._M_node + 1, - __new_nstart + __old_num_nodes); - } - else - { - size_type __new_map_size = this->_M_impl._M_map_size - + std::max(this->_M_impl._M_map_size, - __nodes_to_add) + 2; - - _Map_pointer __new_map = this->_M_allocate_map(__new_map_size); - __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2 - + (__add_at_front ? __nodes_to_add : 0); - std::copy(this->_M_impl._M_start._M_node, - this->_M_impl._M_finish._M_node + 1, - __new_nstart); - _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size); - - this->_M_impl._M_map = __new_map; - this->_M_impl._M_map_size = __new_map_size; - } - - this->_M_impl._M_start._M_set_node(__new_nstart); - this->_M_impl._M_finish._M_set_node(__new_nstart + __old_num_nodes - 1); - } - - // Overload for deque::iterators, exploiting the "segmented-iterator - // optimization". - template - void - fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first, - const _Deque_iterator<_Tp, _Tp&, _Tp*>& __last, const _Tp& __value) - { - typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self; - - for (typename _Self::_Map_pointer __node = __first._M_node + 1; - __node < __last._M_node; ++__node) - std::fill(*__node, *__node + _Self::_S_buffer_size(), __value); - - if (__first._M_node != __last._M_node) - { - std::fill(__first._M_cur, __first._M_last, __value); - std::fill(__last._M_first, __last._M_cur, __value); - } - else - std::fill(__first._M_cur, __last._M_cur, __value); - } - - template - _Deque_iterator<_Tp, _Tp&, _Tp*> - copy(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first, - _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last, - _Deque_iterator<_Tp, _Tp&, _Tp*> __result) - { - typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self; - typedef typename _Self::difference_type difference_type; - - difference_type __len = __last - __first; - while (__len > 0) - { - const difference_type __clen - = std::min(__len, std::min(__first._M_last - __first._M_cur, - __result._M_last - __result._M_cur)); - std::copy(__first._M_cur, __first._M_cur + __clen, __result._M_cur); - __first += __clen; - __result += __clen; - __len -= __clen; - } - return __result; - } - - template - _Deque_iterator<_Tp, _Tp&, _Tp*> - copy_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first, - _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last, - _Deque_iterator<_Tp, _Tp&, _Tp*> __result) - { - typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self; - typedef typename _Self::difference_type difference_type; - - difference_type __len = __last - __first; - while (__len > 0) - { - difference_type __llen = __last._M_cur - __last._M_first; - _Tp* __lend = __last._M_cur; - - difference_type __rlen = __result._M_cur - __result._M_first; - _Tp* __rend = __result._M_cur; - - if (!__llen) - { - __llen = _Self::_S_buffer_size(); - __lend = *(__last._M_node - 1) + __llen; - } - if (!__rlen) - { - __rlen = _Self::_S_buffer_size(); - __rend = *(__result._M_node - 1) + __rlen; - } - - const difference_type __clen = std::min(__len, - std::min(__llen, __rlen)); - std::copy_backward(__lend - __clen, __lend, __rend); - __last -= __clen; - __result -= __clen; - __len -= __clen; - } - return __result; - } - -#if __cplusplus >= 201103L - template - _Deque_iterator<_Tp, _Tp&, _Tp*> - move(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first, - _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last, - _Deque_iterator<_Tp, _Tp&, _Tp*> __result) - { - typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self; - typedef typename _Self::difference_type difference_type; - - difference_type __len = __last - __first; - while (__len > 0) - { - const difference_type __clen - = std::min(__len, std::min(__first._M_last - __first._M_cur, - __result._M_last - __result._M_cur)); - std::move(__first._M_cur, __first._M_cur + __clen, __result._M_cur); - __first += __clen; - __result += __clen; - __len -= __clen; - } - return __result; - } - - template - _Deque_iterator<_Tp, _Tp&, _Tp*> - move_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first, - _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last, - _Deque_iterator<_Tp, _Tp&, _Tp*> __result) - { - typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self; - typedef typename _Self::difference_type difference_type; - - difference_type __len = __last - __first; - while (__len > 0) - { - difference_type __llen = __last._M_cur - __last._M_first; - _Tp* __lend = __last._M_cur; - - difference_type __rlen = __result._M_cur - __result._M_first; - _Tp* __rend = __result._M_cur; - - if (!__llen) - { - __llen = _Self::_S_buffer_size(); - __lend = *(__last._M_node - 1) + __llen; - } - if (!__rlen) - { - __rlen = _Self::_S_buffer_size(); - __rend = *(__result._M_node - 1) + __rlen; - } - - const difference_type __clen = std::min(__len, - std::min(__llen, __rlen)); - std::move_backward(__lend - __clen, __lend, __rend); - __last -= __clen; - __result -= __clen; - __len -= __clen; - } - return __result; - } -#endif - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/enable_special_members.h b/openflow/usr/include/c++/5/bits/enable_special_members.h deleted file mode 100644 index 1a1264e..0000000 --- a/openflow/usr/include/c++/5/bits/enable_special_members.h +++ /dev/null @@ -1,278 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/enable_special_members.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. - */ - -#ifndef _ENABLE_SPECIAL_MEMBERS_H -#define _ENABLE_SPECIAL_MEMBERS_H 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -/** - * @brief A mixin helper to conditionally enable or disable the default - * constructor. - * @sa _Enable_special_members - */ -template - struct _Enable_default_constructor { }; - - -/** - * @brief A mixin helper to conditionally enable or disable the default - * destructor. - * @sa _Enable_special_members - */ -template - struct _Enable_destructor { }; - -/** - * @brief A mixin helper to conditionally enable or disable the copy/move - * special members. - * @sa _Enable_special_members - */ -template - struct _Enable_copy_move { }; - -/** - * @brief A mixin helper to conditionally enable or disable the special - * members. - * - * The @c _Tag type parameter is to make mixin bases unique and thus avoid - * ambiguities. - */ -template - struct _Enable_special_members - : private _Enable_default_constructor<_Default, _Tag>, - private _Enable_destructor<_Destructor, _Tag>, - private _Enable_copy_move<_Copy, _CopyAssignment, - _Move, _MoveAssignment, - _Tag> - { }; - -// Boilerplate follows. - -template - struct _Enable_default_constructor - { constexpr _Enable_default_constructor() noexcept = delete; }; - -template - struct _Enable_destructor - { ~_Enable_destructor() noexcept = delete; }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = default; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = default; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = default; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = default; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = default; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = default; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = default; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = delete; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = delete; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = delete; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = delete; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = delete; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = default; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = delete; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = delete; - }; - -template - struct _Enable_copy_move - { - constexpr _Enable_copy_move() noexcept = default; - constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; - constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move const&) noexcept = delete; - _Enable_copy_move& - operator=(_Enable_copy_move&&) noexcept = delete; - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif // _ENABLE_SPECIAL_MEMBERS_H diff --git a/openflow/usr/include/c++/5/bits/exception_defines.h b/openflow/usr/include/c++/5/bits/exception_defines.h deleted file mode 100644 index 8b2137f..0000000 --- a/openflow/usr/include/c++/5/bits/exception_defines.h +++ /dev/null @@ -1,45 +0,0 @@ -// -fno-exceptions Support -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/exception_defines.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{exception} - */ - -#ifndef _EXCEPTION_DEFINES_H -#define _EXCEPTION_DEFINES_H 1 - -#if ! __cpp_exceptions -// Iff -fno-exceptions, transform error handling code to work without it. -# define __try if (true) -# define __catch(X) if (false) -# define __throw_exception_again -#else -// Else proceed normally. -# define __try try -# define __catch(X) catch(X) -# define __throw_exception_again throw -#endif - -#endif diff --git a/openflow/usr/include/c++/5/bits/exception_ptr.h b/openflow/usr/include/c++/5/bits/exception_ptr.h deleted file mode 100644 index 8fbad1c..0000000 --- a/openflow/usr/include/c++/5/bits/exception_ptr.h +++ /dev/null @@ -1,205 +0,0 @@ -// Exception Handling support header (exception_ptr class) for -*- C++ -*- - -// Copyright (C) 2008-2015 Free Software Foundation, Inc. -// -// This file is part of GCC. -// -// GCC is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// GCC is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/exception_ptr.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{exception} - */ - -#ifndef _EXCEPTION_PTR_H -#define _EXCEPTION_PTR_H - -#pragma GCC visibility push(default) - -#include -#include - -#if ATOMIC_INT_LOCK_FREE < 2 -# error This platform does not support exception propagation. -#endif - -extern "C++" { - -namespace std -{ - class type_info; - - /** - * @addtogroup exceptions - * @{ - */ - namespace __exception_ptr - { - class exception_ptr; - } - - using __exception_ptr::exception_ptr; - - /** Obtain an exception_ptr to the currently handled exception. If there - * is none, or the currently handled exception is foreign, return the null - * value. - */ - exception_ptr current_exception() _GLIBCXX_USE_NOEXCEPT; - - /// Throw the object pointed to by the exception_ptr. - void rethrow_exception(exception_ptr) __attribute__ ((__noreturn__)); - - namespace __exception_ptr - { - /** - * @brief An opaque pointer to an arbitrary exception. - * @ingroup exceptions - */ - class exception_ptr - { - void* _M_exception_object; - - explicit exception_ptr(void* __e) _GLIBCXX_USE_NOEXCEPT; - - void _M_addref() _GLIBCXX_USE_NOEXCEPT; - void _M_release() _GLIBCXX_USE_NOEXCEPT; - - void *_M_get() const _GLIBCXX_NOEXCEPT __attribute__ ((__pure__)); - - friend exception_ptr std::current_exception() _GLIBCXX_USE_NOEXCEPT; - friend void std::rethrow_exception(exception_ptr); - - public: - exception_ptr() _GLIBCXX_USE_NOEXCEPT; - - exception_ptr(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT; - -#if __cplusplus >= 201103L - exception_ptr(nullptr_t) noexcept - : _M_exception_object(0) - { } - - exception_ptr(exception_ptr&& __o) noexcept - : _M_exception_object(__o._M_exception_object) - { __o._M_exception_object = 0; } -#endif - -#if (__cplusplus < 201103L) || defined (_GLIBCXX_EH_PTR_COMPAT) - typedef void (exception_ptr::*__safe_bool)(); - - // For construction from nullptr or 0. - exception_ptr(__safe_bool) _GLIBCXX_USE_NOEXCEPT; -#endif - - exception_ptr& - operator=(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT; - -#if __cplusplus >= 201103L - exception_ptr& - operator=(exception_ptr&& __o) noexcept - { - exception_ptr(static_cast(__o)).swap(*this); - return *this; - } -#endif - - ~exception_ptr() _GLIBCXX_USE_NOEXCEPT; - - void - swap(exception_ptr&) _GLIBCXX_USE_NOEXCEPT; - -#ifdef _GLIBCXX_EH_PTR_COMPAT - // Retained for compatibility with CXXABI_1.3. - void _M_safe_bool_dummy() _GLIBCXX_USE_NOEXCEPT - __attribute__ ((__const__)); - bool operator!() const _GLIBCXX_USE_NOEXCEPT - __attribute__ ((__pure__)); - operator __safe_bool() const _GLIBCXX_USE_NOEXCEPT; -#endif - -#if __cplusplus >= 201103L - explicit operator bool() const - { return _M_exception_object; } -#endif - - friend bool - operator==(const exception_ptr&, const exception_ptr&) - _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); - - const class std::type_info* - __cxa_exception_type() const _GLIBCXX_USE_NOEXCEPT - __attribute__ ((__pure__)); - }; - - bool - operator==(const exception_ptr&, const exception_ptr&) - _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); - - bool - operator!=(const exception_ptr&, const exception_ptr&) - _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); - - inline void - swap(exception_ptr& __lhs, exception_ptr& __rhs) - { __lhs.swap(__rhs); } - - } // namespace __exception_ptr - - - /// Obtain an exception_ptr pointing to a copy of the supplied object. - template - exception_ptr - make_exception_ptr(_Ex __ex) _GLIBCXX_USE_NOEXCEPT - { -#if __cpp_exceptions - try - { - throw __ex; - } - catch(...) - { - return current_exception(); - } -#else - return exception_ptr(); -#endif - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 1130. copy_exception name misleading - /// Obtain an exception_ptr pointing to a copy of the supplied object. - /// This function is deprecated, use std::make_exception_ptr instead. - template - exception_ptr - copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT _GLIBCXX_DEPRECATED; - - template - exception_ptr - copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT - { return std::make_exception_ptr<_Ex>(__ex); } - - // @} group exceptions -} // namespace std - -} // extern "C++" - -#pragma GCC visibility pop - -#endif diff --git a/openflow/usr/include/c++/5/bits/forward_list.h b/openflow/usr/include/c++/5/bits/forward_list.h deleted file mode 100644 index 0cdd75b..0000000 --- a/openflow/usr/include/c++/5/bits/forward_list.h +++ /dev/null @@ -1,1406 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2008-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/forward_list.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{forward_list} - */ - -#ifndef _FORWARD_LIST_H -#define _FORWARD_LIST_H 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - /** - * @brief A helper basic node class for %forward_list. - * This is just a linked list with nothing inside it. - * There are purely list shuffling utility methods here. - */ - struct _Fwd_list_node_base - { - _Fwd_list_node_base() = default; - - _Fwd_list_node_base* _M_next = nullptr; - - _Fwd_list_node_base* - _M_transfer_after(_Fwd_list_node_base* __begin, - _Fwd_list_node_base* __end) noexcept - { - _Fwd_list_node_base* __keep = __begin->_M_next; - if (__end) - { - __begin->_M_next = __end->_M_next; - __end->_M_next = _M_next; - } - else - __begin->_M_next = 0; - _M_next = __keep; - return __end; - } - - void - _M_reverse_after() noexcept - { - _Fwd_list_node_base* __tail = _M_next; - if (!__tail) - return; - while (_Fwd_list_node_base* __temp = __tail->_M_next) - { - _Fwd_list_node_base* __keep = _M_next; - _M_next = __temp; - __tail->_M_next = __temp->_M_next; - _M_next->_M_next = __keep; - } - } - }; - - /** - * @brief A helper node class for %forward_list. - * This is just a linked list with uninitialized storage for a - * data value in each node. - * There is a sorting utility method. - */ - template - struct _Fwd_list_node - : public _Fwd_list_node_base - { - _Fwd_list_node() = default; - - __gnu_cxx::__aligned_buffer<_Tp> _M_storage; - - _Tp* - _M_valptr() noexcept - { return _M_storage._M_ptr(); } - - const _Tp* - _M_valptr() const noexcept - { return _M_storage._M_ptr(); } - }; - - /** - * @brief A forward_list::iterator. - * - * All the functions are op overloads. - */ - template - struct _Fwd_list_iterator - { - typedef _Fwd_list_iterator<_Tp> _Self; - typedef _Fwd_list_node<_Tp> _Node; - - typedef _Tp value_type; - typedef _Tp* pointer; - typedef _Tp& reference; - typedef ptrdiff_t difference_type; - typedef std::forward_iterator_tag iterator_category; - - _Fwd_list_iterator() noexcept - : _M_node() { } - - explicit - _Fwd_list_iterator(_Fwd_list_node_base* __n) noexcept - : _M_node(__n) { } - - reference - operator*() const noexcept - { return *static_cast<_Node*>(this->_M_node)->_M_valptr(); } - - pointer - operator->() const noexcept - { return static_cast<_Node*>(this->_M_node)->_M_valptr(); } - - _Self& - operator++() noexcept - { - _M_node = _M_node->_M_next; - return *this; - } - - _Self - operator++(int) noexcept - { - _Self __tmp(*this); - _M_node = _M_node->_M_next; - return __tmp; - } - - bool - operator==(const _Self& __x) const noexcept - { return _M_node == __x._M_node; } - - bool - operator!=(const _Self& __x) const noexcept - { return _M_node != __x._M_node; } - - _Self - _M_next() const noexcept - { - if (_M_node) - return _Fwd_list_iterator(_M_node->_M_next); - else - return _Fwd_list_iterator(0); - } - - _Fwd_list_node_base* _M_node; - }; - - /** - * @brief A forward_list::const_iterator. - * - * All the functions are op overloads. - */ - template - struct _Fwd_list_const_iterator - { - typedef _Fwd_list_const_iterator<_Tp> _Self; - typedef const _Fwd_list_node<_Tp> _Node; - typedef _Fwd_list_iterator<_Tp> iterator; - - typedef _Tp value_type; - typedef const _Tp* pointer; - typedef const _Tp& reference; - typedef ptrdiff_t difference_type; - typedef std::forward_iterator_tag iterator_category; - - _Fwd_list_const_iterator() noexcept - : _M_node() { } - - explicit - _Fwd_list_const_iterator(const _Fwd_list_node_base* __n) noexcept - : _M_node(__n) { } - - _Fwd_list_const_iterator(const iterator& __iter) noexcept - : _M_node(__iter._M_node) { } - - reference - operator*() const noexcept - { return *static_cast<_Node*>(this->_M_node)->_M_valptr(); } - - pointer - operator->() const noexcept - { return static_cast<_Node*>(this->_M_node)->_M_valptr(); } - - _Self& - operator++() noexcept - { - _M_node = _M_node->_M_next; - return *this; - } - - _Self - operator++(int) noexcept - { - _Self __tmp(*this); - _M_node = _M_node->_M_next; - return __tmp; - } - - bool - operator==(const _Self& __x) const noexcept - { return _M_node == __x._M_node; } - - bool - operator!=(const _Self& __x) const noexcept - { return _M_node != __x._M_node; } - - _Self - _M_next() const noexcept - { - if (this->_M_node) - return _Fwd_list_const_iterator(_M_node->_M_next); - else - return _Fwd_list_const_iterator(0); - } - - const _Fwd_list_node_base* _M_node; - }; - - /** - * @brief Forward list iterator equality comparison. - */ - template - inline bool - operator==(const _Fwd_list_iterator<_Tp>& __x, - const _Fwd_list_const_iterator<_Tp>& __y) noexcept - { return __x._M_node == __y._M_node; } - - /** - * @brief Forward list iterator inequality comparison. - */ - template - inline bool - operator!=(const _Fwd_list_iterator<_Tp>& __x, - const _Fwd_list_const_iterator<_Tp>& __y) noexcept - { return __x._M_node != __y._M_node; } - - /** - * @brief Base class for %forward_list. - */ - template - struct _Fwd_list_base - { - protected: - typedef __alloc_rebind<_Alloc, _Tp> _Tp_alloc_type; - typedef __alloc_rebind<_Alloc, _Fwd_list_node<_Tp>> _Node_alloc_type; - typedef __gnu_cxx::__alloc_traits<_Node_alloc_type> _Node_alloc_traits; - - struct _Fwd_list_impl - : public _Node_alloc_type - { - _Fwd_list_node_base _M_head; - - _Fwd_list_impl() - : _Node_alloc_type(), _M_head() - { } - - _Fwd_list_impl(const _Node_alloc_type& __a) - : _Node_alloc_type(__a), _M_head() - { } - - _Fwd_list_impl(_Node_alloc_type&& __a) - : _Node_alloc_type(std::move(__a)), _M_head() - { } - }; - - _Fwd_list_impl _M_impl; - - public: - typedef _Fwd_list_iterator<_Tp> iterator; - typedef _Fwd_list_const_iterator<_Tp> const_iterator; - typedef _Fwd_list_node<_Tp> _Node; - - _Node_alloc_type& - _M_get_Node_allocator() noexcept - { return *static_cast<_Node_alloc_type*>(&this->_M_impl); } - - const _Node_alloc_type& - _M_get_Node_allocator() const noexcept - { return *static_cast(&this->_M_impl); } - - _Fwd_list_base() - : _M_impl() { } - - _Fwd_list_base(const _Node_alloc_type& __a) - : _M_impl(__a) { } - - _Fwd_list_base(_Fwd_list_base&& __lst, const _Node_alloc_type& __a); - - _Fwd_list_base(_Fwd_list_base&& __lst) - : _M_impl(std::move(__lst._M_get_Node_allocator())) - { - this->_M_impl._M_head._M_next = __lst._M_impl._M_head._M_next; - __lst._M_impl._M_head._M_next = 0; - } - - ~_Fwd_list_base() - { _M_erase_after(&_M_impl._M_head, 0); } - - protected: - - _Node* - _M_get_node() - { - auto __ptr = _Node_alloc_traits::allocate(_M_get_Node_allocator(), 1); - return std::__addressof(*__ptr); - } - - template - _Node* - _M_create_node(_Args&&... __args) - { - _Node* __node = this->_M_get_node(); - __try - { - _Tp_alloc_type __a(_M_get_Node_allocator()); - typedef allocator_traits<_Tp_alloc_type> _Alloc_traits; - ::new ((void*)__node) _Node; - _Alloc_traits::construct(__a, __node->_M_valptr(), - std::forward<_Args>(__args)...); - } - __catch(...) - { - this->_M_put_node(__node); - __throw_exception_again; - } - return __node; - } - - template - _Fwd_list_node_base* - _M_insert_after(const_iterator __pos, _Args&&... __args); - - void - _M_put_node(_Node* __p) - { - typedef typename _Node_alloc_traits::pointer _Ptr; - auto __ptr = std::pointer_traits<_Ptr>::pointer_to(*__p); - _Node_alloc_traits::deallocate(_M_get_Node_allocator(), __ptr, 1); - } - - _Fwd_list_node_base* - _M_erase_after(_Fwd_list_node_base* __pos); - - _Fwd_list_node_base* - _M_erase_after(_Fwd_list_node_base* __pos, - _Fwd_list_node_base* __last); - }; - - /** - * @brief A standard container with linear time access to elements, - * and fixed time insertion/deletion at any point in the sequence. - * - * @ingroup sequences - * - * @tparam _Tp Type of element. - * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. - * - * Meets the requirements of a container, a - * sequence, including the - * optional sequence requirements with the - * %exception of @c at and @c operator[]. - * - * This is a @e singly @e linked %list. Traversal up the - * %list requires linear time, but adding and removing elements (or - * @e nodes) is done in constant time, regardless of where the - * change takes place. Unlike std::vector and std::deque, - * random-access iterators are not provided, so subscripting ( @c - * [] ) access is not allowed. For algorithms which only need - * sequential access, this lack makes no difference. - * - * Also unlike the other standard containers, std::forward_list provides - * specialized algorithms %unique to linked lists, such as - * splicing, sorting, and in-place reversal. - */ - template > - class forward_list : private _Fwd_list_base<_Tp, _Alloc> - { - private: - typedef _Fwd_list_base<_Tp, _Alloc> _Base; - typedef _Fwd_list_node<_Tp> _Node; - typedef _Fwd_list_node_base _Node_base; - typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; - typedef typename _Base::_Node_alloc_type _Node_alloc_type; - typedef typename _Base::_Node_alloc_traits _Node_alloc_traits; - typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits; - - public: - // types: - typedef _Tp value_type; - typedef typename _Alloc_traits::pointer pointer; - typedef typename _Alloc_traits::const_pointer const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - typedef _Fwd_list_iterator<_Tp> iterator; - typedef _Fwd_list_const_iterator<_Tp> const_iterator; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef _Alloc allocator_type; - - // 23.3.4.2 construct/copy/destroy: - - /** - * @brief Creates a %forward_list with no elements. - * @param __al An allocator object. - */ - explicit - forward_list(const _Alloc& __al = _Alloc()) - : _Base(_Node_alloc_type(__al)) - { } - - /** - * @brief Copy constructor with allocator argument. - * @param __list Input list to copy. - * @param __al An allocator object. - */ - forward_list(const forward_list& __list, const _Alloc& __al) - : _Base(_Node_alloc_type(__al)) - { _M_range_initialize(__list.begin(), __list.end()); } - - /** - * @brief Move constructor with allocator argument. - * @param __list Input list to move. - * @param __al An allocator object. - */ - forward_list(forward_list&& __list, const _Alloc& __al) - noexcept(_Node_alloc_traits::_S_always_equal()) - : _Base(std::move(__list), _Node_alloc_type(__al)) - { } - - /** - * @brief Creates a %forward_list with default constructed elements. - * @param __n The number of elements to initially create. - * @param __al An allocator object. - * - * This constructor creates the %forward_list with @a __n default - * constructed elements. - */ - explicit - forward_list(size_type __n, const _Alloc& __al = _Alloc()) - : _Base(_Node_alloc_type(__al)) - { _M_default_initialize(__n); } - - /** - * @brief Creates a %forward_list with copies of an exemplar element. - * @param __n The number of elements to initially create. - * @param __value An element to copy. - * @param __al An allocator object. - * - * This constructor fills the %forward_list with @a __n copies of - * @a __value. - */ - forward_list(size_type __n, const _Tp& __value, - const _Alloc& __al = _Alloc()) - : _Base(_Node_alloc_type(__al)) - { _M_fill_initialize(__n, __value); } - - /** - * @brief Builds a %forward_list from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __al An allocator object. - * - * Create a %forward_list consisting of copies of the elements from - * [@a __first,@a __last). This is linear in N (where N is - * distance(@a __first,@a __last)). - */ - template> - forward_list(_InputIterator __first, _InputIterator __last, - const _Alloc& __al = _Alloc()) - : _Base(_Node_alloc_type(__al)) - { _M_range_initialize(__first, __last); } - - /** - * @brief The %forward_list copy constructor. - * @param __list A %forward_list of identical element and allocator - * types. - */ - forward_list(const forward_list& __list) - : _Base(_Node_alloc_traits::_S_select_on_copy( - __list._M_get_Node_allocator())) - { _M_range_initialize(__list.begin(), __list.end()); } - - /** - * @brief The %forward_list move constructor. - * @param __list A %forward_list of identical element and allocator - * types. - * - * The newly-created %forward_list contains the exact contents of @a - * __list. The contents of @a __list are a valid, but unspecified - * %forward_list. - */ - forward_list(forward_list&& __list) noexcept - : _Base(std::move(__list)) { } - - /** - * @brief Builds a %forward_list from an initializer_list - * @param __il An initializer_list of value_type. - * @param __al An allocator object. - * - * Create a %forward_list consisting of copies of the elements - * in the initializer_list @a __il. This is linear in __il.size(). - */ - forward_list(std::initializer_list<_Tp> __il, - const _Alloc& __al = _Alloc()) - : _Base(_Node_alloc_type(__al)) - { _M_range_initialize(__il.begin(), __il.end()); } - - /** - * @brief The forward_list dtor. - */ - ~forward_list() noexcept - { } - - /** - * @brief The %forward_list assignment operator. - * @param __list A %forward_list of identical element and allocator - * types. - * - * All the elements of @a __list are copied, but unlike the copy - * constructor, the allocator object is not copied. - */ - forward_list& - operator=(const forward_list& __list); - - /** - * @brief The %forward_list move assignment operator. - * @param __list A %forward_list of identical element and allocator - * types. - * - * The contents of @a __list are moved into this %forward_list - * (without copying, if the allocators permit it). - * @a __list is a valid, but unspecified %forward_list - */ - forward_list& - operator=(forward_list&& __list) - noexcept(_Node_alloc_traits::_S_nothrow_move()) - { - constexpr bool __move_storage = - _Node_alloc_traits::_S_propagate_on_move_assign() - || _Node_alloc_traits::_S_always_equal(); - _M_move_assign(std::move(__list), - integral_constant()); - return *this; - } - - /** - * @brief The %forward_list initializer list assignment operator. - * @param __il An initializer_list of value_type. - * - * Replace the contents of the %forward_list with copies of the - * elements in the initializer_list @a __il. This is linear in - * __il.size(). - */ - forward_list& - operator=(std::initializer_list<_Tp> __il) - { - assign(__il); - return *this; - } - - /** - * @brief Assigns a range to a %forward_list. - * @param __first An input iterator. - * @param __last An input iterator. - * - * This function fills a %forward_list with copies of the elements - * in the range [@a __first,@a __last). - * - * Note that the assignment completely changes the %forward_list and - * that the number of elements of the resulting %forward_list is the - * same as the number of elements assigned. Old data is lost. - */ - template> - void - assign(_InputIterator __first, _InputIterator __last) - { - typedef is_assignable<_Tp, decltype(*__first)> __assignable; - _M_assign(__first, __last, __assignable()); - } - - /** - * @brief Assigns a given value to a %forward_list. - * @param __n Number of elements to be assigned. - * @param __val Value to be assigned. - * - * This function fills a %forward_list with @a __n copies of the - * given value. Note that the assignment completely changes the - * %forward_list, and that the resulting %forward_list has __n - * elements. Old data is lost. - */ - void - assign(size_type __n, const _Tp& __val) - { _M_assign_n(__n, __val, is_copy_assignable<_Tp>()); } - - /** - * @brief Assigns an initializer_list to a %forward_list. - * @param __il An initializer_list of value_type. - * - * Replace the contents of the %forward_list with copies of the - * elements in the initializer_list @a __il. This is linear in - * il.size(). - */ - void - assign(std::initializer_list<_Tp> __il) - { assign(__il.begin(), __il.end()); } - - /// Get a copy of the memory allocation object. - allocator_type - get_allocator() const noexcept - { return allocator_type(this->_M_get_Node_allocator()); } - - // 23.3.4.3 iterators: - - /** - * Returns a read/write iterator that points before the first element - * in the %forward_list. Iteration is done in ordinary element order. - */ - iterator - before_begin() noexcept - { return iterator(&this->_M_impl._M_head); } - - /** - * Returns a read-only (constant) iterator that points before the - * first element in the %forward_list. Iteration is done in ordinary - * element order. - */ - const_iterator - before_begin() const noexcept - { return const_iterator(&this->_M_impl._M_head); } - - /** - * Returns a read/write iterator that points to the first element - * in the %forward_list. Iteration is done in ordinary element order. - */ - iterator - begin() noexcept - { return iterator(this->_M_impl._M_head._M_next); } - - /** - * Returns a read-only (constant) iterator that points to the first - * element in the %forward_list. Iteration is done in ordinary - * element order. - */ - const_iterator - begin() const noexcept - { return const_iterator(this->_M_impl._M_head._M_next); } - - /** - * Returns a read/write iterator that points one past the last - * element in the %forward_list. Iteration is done in ordinary - * element order. - */ - iterator - end() noexcept - { return iterator(0); } - - /** - * Returns a read-only iterator that points one past the last - * element in the %forward_list. Iteration is done in ordinary - * element order. - */ - const_iterator - end() const noexcept - { return const_iterator(0); } - - /** - * Returns a read-only (constant) iterator that points to the - * first element in the %forward_list. Iteration is done in ordinary - * element order. - */ - const_iterator - cbegin() const noexcept - { return const_iterator(this->_M_impl._M_head._M_next); } - - /** - * Returns a read-only (constant) iterator that points before the - * first element in the %forward_list. Iteration is done in ordinary - * element order. - */ - const_iterator - cbefore_begin() const noexcept - { return const_iterator(&this->_M_impl._M_head); } - - /** - * Returns a read-only (constant) iterator that points one past - * the last element in the %forward_list. Iteration is done in - * ordinary element order. - */ - const_iterator - cend() const noexcept - { return const_iterator(0); } - - /** - * Returns true if the %forward_list is empty. (Thus begin() would - * equal end().) - */ - bool - empty() const noexcept - { return this->_M_impl._M_head._M_next == 0; } - - /** - * Returns the largest possible number of elements of %forward_list. - */ - size_type - max_size() const noexcept - { return _Node_alloc_traits::max_size(this->_M_get_Node_allocator()); } - - // 23.3.4.4 element access: - - /** - * Returns a read/write reference to the data at the first - * element of the %forward_list. - */ - reference - front() - { - _Node* __front = static_cast<_Node*>(this->_M_impl._M_head._M_next); - return *__front->_M_valptr(); - } - - /** - * Returns a read-only (constant) reference to the data at the first - * element of the %forward_list. - */ - const_reference - front() const - { - _Node* __front = static_cast<_Node*>(this->_M_impl._M_head._M_next); - return *__front->_M_valptr(); - } - - // 23.3.4.5 modifiers: - - /** - * @brief Constructs object in %forward_list at the front of the - * list. - * @param __args Arguments. - * - * This function will insert an object of type Tp constructed - * with Tp(std::forward(args)...) at the front of the list - * Due to the nature of a %forward_list this operation can - * be done in constant time, and does not invalidate iterators - * and references. - */ - template - void - emplace_front(_Args&&... __args) - { this->_M_insert_after(cbefore_begin(), - std::forward<_Args>(__args)...); } - - /** - * @brief Add data to the front of the %forward_list. - * @param __val Data to be added. - * - * This is a typical stack operation. The function creates an - * element at the front of the %forward_list and assigns the given - * data to it. Due to the nature of a %forward_list this operation - * can be done in constant time, and does not invalidate iterators - * and references. - */ - void - push_front(const _Tp& __val) - { this->_M_insert_after(cbefore_begin(), __val); } - - /** - * - */ - void - push_front(_Tp&& __val) - { this->_M_insert_after(cbefore_begin(), std::move(__val)); } - - /** - * @brief Removes first element. - * - * This is a typical stack operation. It shrinks the %forward_list - * by one. Due to the nature of a %forward_list this operation can - * be done in constant time, and only invalidates iterators/references - * to the element being removed. - * - * Note that no data is returned, and if the first element's data - * is needed, it should be retrieved before pop_front() is - * called. - */ - void - pop_front() - { this->_M_erase_after(&this->_M_impl._M_head); } - - /** - * @brief Constructs object in %forward_list after the specified - * iterator. - * @param __pos A const_iterator into the %forward_list. - * @param __args Arguments. - * @return An iterator that points to the inserted data. - * - * This function will insert an object of type T constructed - * with T(std::forward(args)...) after the specified - * location. Due to the nature of a %forward_list this operation can - * be done in constant time, and does not invalidate iterators - * and references. - */ - template - iterator - emplace_after(const_iterator __pos, _Args&&... __args) - { return iterator(this->_M_insert_after(__pos, - std::forward<_Args>(__args)...)); } - - /** - * @brief Inserts given value into %forward_list after specified - * iterator. - * @param __pos An iterator into the %forward_list. - * @param __val Data to be inserted. - * @return An iterator that points to the inserted data. - * - * This function will insert a copy of the given value after - * the specified location. Due to the nature of a %forward_list this - * operation can be done in constant time, and does not - * invalidate iterators and references. - */ - iterator - insert_after(const_iterator __pos, const _Tp& __val) - { return iterator(this->_M_insert_after(__pos, __val)); } - - /** - * - */ - iterator - insert_after(const_iterator __pos, _Tp&& __val) - { return iterator(this->_M_insert_after(__pos, std::move(__val))); } - - /** - * @brief Inserts a number of copies of given data into the - * %forward_list. - * @param __pos An iterator into the %forward_list. - * @param __n Number of elements to be inserted. - * @param __val Data to be inserted. - * @return An iterator pointing to the last inserted copy of - * @a val or @a pos if @a n == 0. - * - * This function will insert a specified number of copies of the - * given data after the location specified by @a pos. - * - * This operation is linear in the number of elements inserted and - * does not invalidate iterators and references. - */ - iterator - insert_after(const_iterator __pos, size_type __n, const _Tp& __val); - - /** - * @brief Inserts a range into the %forward_list. - * @param __pos An iterator into the %forward_list. - * @param __first An input iterator. - * @param __last An input iterator. - * @return An iterator pointing to the last inserted element or - * @a __pos if @a __first == @a __last. - * - * This function will insert copies of the data in the range - * [@a __first,@a __last) into the %forward_list after the - * location specified by @a __pos. - * - * This operation is linear in the number of elements inserted and - * does not invalidate iterators and references. - */ - template> - iterator - insert_after(const_iterator __pos, - _InputIterator __first, _InputIterator __last); - - /** - * @brief Inserts the contents of an initializer_list into - * %forward_list after the specified iterator. - * @param __pos An iterator into the %forward_list. - * @param __il An initializer_list of value_type. - * @return An iterator pointing to the last inserted element - * or @a __pos if @a __il is empty. - * - * This function will insert copies of the data in the - * initializer_list @a __il into the %forward_list before the location - * specified by @a __pos. - * - * This operation is linear in the number of elements inserted and - * does not invalidate iterators and references. - */ - iterator - insert_after(const_iterator __pos, std::initializer_list<_Tp> __il) - { return insert_after(__pos, __il.begin(), __il.end()); } - - /** - * @brief Removes the element pointed to by the iterator following - * @c pos. - * @param __pos Iterator pointing before element to be erased. - * @return An iterator pointing to the element following the one - * that was erased, or end() if no such element exists. - * - * This function will erase the element at the given position and - * thus shorten the %forward_list by one. - * - * Due to the nature of a %forward_list this operation can be done - * in constant time, and only invalidates iterators/references to - * the element being removed. The user is also cautioned that - * this function only erases the element, and that if the element - * is itself a pointer, the pointed-to memory is not touched in - * any way. Managing the pointer is the user's responsibility. - */ - iterator - erase_after(const_iterator __pos) - { return iterator(this->_M_erase_after(const_cast<_Node_base*> - (__pos._M_node))); } - - /** - * @brief Remove a range of elements. - * @param __pos Iterator pointing before the first element to be - * erased. - * @param __last Iterator pointing to one past the last element to be - * erased. - * @return @ __last. - * - * This function will erase the elements in the range - * @a (__pos,__last) and shorten the %forward_list accordingly. - * - * This operation is linear time in the size of the range and only - * invalidates iterators/references to the element being removed. - * The user is also cautioned that this function only erases the - * elements, and that if the elements themselves are pointers, the - * pointed-to memory is not touched in any way. Managing the pointer - * is the user's responsibility. - */ - iterator - erase_after(const_iterator __pos, const_iterator __last) - { return iterator(this->_M_erase_after(const_cast<_Node_base*> - (__pos._M_node), - const_cast<_Node_base*> - (__last._M_node))); } - - /** - * @brief Swaps data with another %forward_list. - * @param __list A %forward_list of the same element and allocator - * types. - * - * This exchanges the elements between two lists in constant - * time. Note that the global std::swap() function is - * specialized such that std::swap(l1,l2) will feed to this - * function. - */ - void - swap(forward_list& __list) - noexcept(_Node_alloc_traits::_S_nothrow_swap()) - { - std::swap(this->_M_impl._M_head._M_next, - __list._M_impl._M_head._M_next); - _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(), - __list._M_get_Node_allocator()); - } - - /** - * @brief Resizes the %forward_list to the specified number of - * elements. - * @param __sz Number of elements the %forward_list should contain. - * - * This function will %resize the %forward_list to the specified - * number of elements. If the number is smaller than the - * %forward_list's current number of elements the %forward_list - * is truncated, otherwise the %forward_list is extended and the - * new elements are default constructed. - */ - void - resize(size_type __sz); - - /** - * @brief Resizes the %forward_list to the specified number of - * elements. - * @param __sz Number of elements the %forward_list should contain. - * @param __val Data with which new elements should be populated. - * - * This function will %resize the %forward_list to the specified - * number of elements. If the number is smaller than the - * %forward_list's current number of elements the %forward_list - * is truncated, otherwise the %forward_list is extended and new - * elements are populated with given data. - */ - void - resize(size_type __sz, const value_type& __val); - - /** - * @brief Erases all the elements. - * - * Note that this function only erases - * the elements, and that if the elements themselves are - * pointers, the pointed-to memory is not touched in any way. - * Managing the pointer is the user's responsibility. - */ - void - clear() noexcept - { this->_M_erase_after(&this->_M_impl._M_head, 0); } - - // 23.3.4.6 forward_list operations: - - /** - * @brief Insert contents of another %forward_list. - * @param __pos Iterator referencing the element to insert after. - * @param __list Source list. - * - * The elements of @a list are inserted in constant time after - * the element referenced by @a pos. @a list becomes an empty - * list. - * - * Requires this != @a x. - */ - void - splice_after(const_iterator __pos, forward_list&& __list) - { - if (!__list.empty()) - _M_splice_after(__pos, __list.before_begin(), __list.end()); - } - - void - splice_after(const_iterator __pos, forward_list& __list) - { splice_after(__pos, std::move(__list)); } - - /** - * @brief Insert element from another %forward_list. - * @param __pos Iterator referencing the element to insert after. - * @param __list Source list. - * @param __i Iterator referencing the element before the element - * to move. - * - * Removes the element in list @a list referenced by @a i and - * inserts it into the current list after @a pos. - */ - void - splice_after(const_iterator __pos, forward_list&& __list, - const_iterator __i); - - void - splice_after(const_iterator __pos, forward_list& __list, - const_iterator __i) - { splice_after(__pos, std::move(__list), __i); } - - /** - * @brief Insert range from another %forward_list. - * @param __pos Iterator referencing the element to insert after. - * @param __list Source list. - * @param __before Iterator referencing before the start of range - * in list. - * @param __last Iterator referencing the end of range in list. - * - * Removes elements in the range (__before,__last) and inserts them - * after @a __pos in constant time. - * - * Undefined if @a __pos is in (__before,__last). - * @{ - */ - void - splice_after(const_iterator __pos, forward_list&&, - const_iterator __before, const_iterator __last) - { _M_splice_after(__pos, __before, __last); } - - void - splice_after(const_iterator __pos, forward_list&, - const_iterator __before, const_iterator __last) - { _M_splice_after(__pos, __before, __last); } - // @} - - /** - * @brief Remove all elements equal to value. - * @param __val The value to remove. - * - * Removes every element in the list equal to @a __val. - * Remaining elements stay in list order. Note that this - * function only erases the elements, and that if the elements - * themselves are pointers, the pointed-to memory is not - * touched in any way. Managing the pointer is the user's - * responsibility. - */ - void - remove(const _Tp& __val); - - /** - * @brief Remove all elements satisfying a predicate. - * @param __pred Unary predicate function or object. - * - * Removes every element in the list for which the predicate - * returns true. Remaining elements stay in list order. Note - * that this function only erases the elements, and that if the - * elements themselves are pointers, the pointed-to memory is - * not touched in any way. Managing the pointer is the user's - * responsibility. - */ - template - void - remove_if(_Pred __pred); - - /** - * @brief Remove consecutive duplicate elements. - * - * For each consecutive set of elements with the same value, - * remove all but the first one. Remaining elements stay in - * list order. Note that this function only erases the - * elements, and that if the elements themselves are pointers, - * the pointed-to memory is not touched in any way. Managing - * the pointer is the user's responsibility. - */ - void - unique() - { unique(std::equal_to<_Tp>()); } - - /** - * @brief Remove consecutive elements satisfying a predicate. - * @param __binary_pred Binary predicate function or object. - * - * For each consecutive set of elements [first,last) that - * satisfy predicate(first,i) where i is an iterator in - * [first,last), remove all but the first one. Remaining - * elements stay in list order. Note that this function only - * erases the elements, and that if the elements themselves are - * pointers, the pointed-to memory is not touched in any way. - * Managing the pointer is the user's responsibility. - */ - template - void - unique(_BinPred __binary_pred); - - /** - * @brief Merge sorted lists. - * @param __list Sorted list to merge. - * - * Assumes that both @a list and this list are sorted according to - * operator<(). Merges elements of @a __list into this list in - * sorted order, leaving @a __list empty when complete. Elements in - * this list precede elements in @a __list that are equal. - */ - void - merge(forward_list&& __list) - { merge(std::move(__list), std::less<_Tp>()); } - - void - merge(forward_list& __list) - { merge(std::move(__list)); } - - /** - * @brief Merge sorted lists according to comparison function. - * @param __list Sorted list to merge. - * @param __comp Comparison function defining sort order. - * - * Assumes that both @a __list and this list are sorted according to - * comp. Merges elements of @a __list into this list - * in sorted order, leaving @a __list empty when complete. Elements - * in this list precede elements in @a __list that are equivalent - * according to comp(). - */ - template - void - merge(forward_list&& __list, _Comp __comp); - - template - void - merge(forward_list& __list, _Comp __comp) - { merge(std::move(__list), __comp); } - - /** - * @brief Sort the elements of the list. - * - * Sorts the elements of this list in NlogN time. Equivalent - * elements remain in list order. - */ - void - sort() - { sort(std::less<_Tp>()); } - - /** - * @brief Sort the forward_list using a comparison function. - * - * Sorts the elements of this list in NlogN time. Equivalent - * elements remain in list order. - */ - template - void - sort(_Comp __comp); - - /** - * @brief Reverse the elements in list. - * - * Reverse the order of elements in the list in linear time. - */ - void - reverse() noexcept - { this->_M_impl._M_head._M_reverse_after(); } - - private: - // Called by the range constructor to implement [23.3.4.2]/9 - template - void - _M_range_initialize(_InputIterator __first, _InputIterator __last); - - // Called by forward_list(n,v,a), and the range constructor when it - // turns out to be the same thing. - void - _M_fill_initialize(size_type __n, const value_type& __value); - - // Called by splice_after and insert_after. - iterator - _M_splice_after(const_iterator __pos, const_iterator __before, - const_iterator __last); - - // Called by forward_list(n). - void - _M_default_initialize(size_type __n); - - // Called by resize(sz). - void - _M_default_insert_after(const_iterator __pos, size_type __n); - - // Called by operator=(forward_list&&) - void - _M_move_assign(forward_list&& __list, std::true_type) noexcept - { - clear(); - std::swap(this->_M_impl._M_head._M_next, - __list._M_impl._M_head._M_next); - std::__alloc_on_move(this->_M_get_Node_allocator(), - __list._M_get_Node_allocator()); - } - - // Called by operator=(forward_list&&) - void - _M_move_assign(forward_list&& __list, std::false_type) - { - if (__list._M_get_Node_allocator() == this->_M_get_Node_allocator()) - _M_move_assign(std::move(__list), std::true_type()); - else - // The rvalue's allocator cannot be moved, or is not equal, - // so we need to individually move each element. - this->assign(std::__make_move_if_noexcept_iterator(__list.begin()), - std::__make_move_if_noexcept_iterator(__list.end())); - } - - // Called by assign(_InputIterator, _InputIterator) if _Tp is - // CopyAssignable. - template - void - _M_assign(_InputIterator __first, _InputIterator __last, true_type) - { - auto __prev = before_begin(); - auto __curr = begin(); - auto __end = end(); - while (__curr != __end && __first != __last) - { - *__curr = *__first; - ++__prev; - ++__curr; - ++__first; - } - if (__first != __last) - insert_after(__prev, __first, __last); - else if (__curr != __end) - erase_after(__prev, __end); - } - - // Called by assign(_InputIterator, _InputIterator) if _Tp is not - // CopyAssignable. - template - void - _M_assign(_InputIterator __first, _InputIterator __last, false_type) - { - clear(); - insert_after(cbefore_begin(), __first, __last); - } - - // Called by assign(size_type, const _Tp&) if Tp is CopyAssignable - void - _M_assign_n(size_type __n, const _Tp& __val, true_type) - { - auto __prev = before_begin(); - auto __curr = begin(); - auto __end = end(); - while (__curr != __end && __n > 0) - { - *__curr = __val; - ++__prev; - ++__curr; - --__n; - } - if (__n > 0) - insert_after(__prev, __n, __val); - else if (__curr != __end) - erase_after(__prev, __end); - } - - // Called by assign(size_type, const _Tp&) if Tp is non-CopyAssignable - void - _M_assign_n(size_type __n, const _Tp& __val, false_type) - { - clear(); - insert_after(cbefore_begin(), __n, __val); - } - }; - - /** - * @brief Forward list equality comparison. - * @param __lx A %forward_list - * @param __ly A %forward_list of the same type as @a __lx. - * @return True iff the elements of the forward lists are equal. - * - * This is an equivalence relation. It is linear in the number of - * elements of the forward lists. Deques are considered equivalent - * if corresponding elements compare equal. - */ - template - bool - operator==(const forward_list<_Tp, _Alloc>& __lx, - const forward_list<_Tp, _Alloc>& __ly); - - /** - * @brief Forward list ordering relation. - * @param __lx A %forward_list. - * @param __ly A %forward_list of the same type as @a __lx. - * @return True iff @a __lx is lexicographically less than @a __ly. - * - * This is a total ordering relation. It is linear in the number of - * elements of the forward lists. The elements must be comparable - * with @c <. - * - * See std::lexicographical_compare() for how the determination is made. - */ - template - inline bool - operator<(const forward_list<_Tp, _Alloc>& __lx, - const forward_list<_Tp, _Alloc>& __ly) - { return std::lexicographical_compare(__lx.cbegin(), __lx.cend(), - __ly.cbegin(), __ly.cend()); } - - /// Based on operator== - template - inline bool - operator!=(const forward_list<_Tp, _Alloc>& __lx, - const forward_list<_Tp, _Alloc>& __ly) - { return !(__lx == __ly); } - - /// Based on operator< - template - inline bool - operator>(const forward_list<_Tp, _Alloc>& __lx, - const forward_list<_Tp, _Alloc>& __ly) - { return (__ly < __lx); } - - /// Based on operator< - template - inline bool - operator>=(const forward_list<_Tp, _Alloc>& __lx, - const forward_list<_Tp, _Alloc>& __ly) - { return !(__lx < __ly); } - - /// Based on operator< - template - inline bool - operator<=(const forward_list<_Tp, _Alloc>& __lx, - const forward_list<_Tp, _Alloc>& __ly) - { return !(__ly < __lx); } - - /// See std::forward_list::swap(). - template - inline void - swap(forward_list<_Tp, _Alloc>& __lx, - forward_list<_Tp, _Alloc>& __ly) - { __lx.swap(__ly); } - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#endif // _FORWARD_LIST_H diff --git a/openflow/usr/include/c++/5/bits/forward_list.tcc b/openflow/usr/include/c++/5/bits/forward_list.tcc deleted file mode 100644 index 00a26ed..0000000 --- a/openflow/usr/include/c++/5/bits/forward_list.tcc +++ /dev/null @@ -1,511 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2008-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/forward_list.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{forward_list} - */ - -#ifndef _FORWARD_LIST_TCC -#define _FORWARD_LIST_TCC 1 - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - template - _Fwd_list_base<_Tp, _Alloc>:: - _Fwd_list_base(_Fwd_list_base&& __lst, const _Node_alloc_type& __a) - : _M_impl(__a) - { - if (__lst._M_get_Node_allocator() == __a) - { - this->_M_impl._M_head._M_next = __lst._M_impl._M_head._M_next; - __lst._M_impl._M_head._M_next = 0; - } - else - { - this->_M_impl._M_head._M_next = 0; - _Fwd_list_node_base* __to = &this->_M_impl._M_head; - _Node* __curr = static_cast<_Node*>(__lst._M_impl._M_head._M_next); - - while (__curr) - { - __to->_M_next = - _M_create_node(std::move_if_noexcept(*__curr->_M_valptr())); - __to = __to->_M_next; - __curr = static_cast<_Node*>(__curr->_M_next); - } - } - } - - template - template - _Fwd_list_node_base* - _Fwd_list_base<_Tp, _Alloc>:: - _M_insert_after(const_iterator __pos, _Args&&... __args) - { - _Fwd_list_node_base* __to - = const_cast<_Fwd_list_node_base*>(__pos._M_node); - _Node* __thing = _M_create_node(std::forward<_Args>(__args)...); - __thing->_M_next = __to->_M_next; - __to->_M_next = __thing; - return __to->_M_next; - } - - template - _Fwd_list_node_base* - _Fwd_list_base<_Tp, _Alloc>:: - _M_erase_after(_Fwd_list_node_base* __pos) - { - _Node* __curr = static_cast<_Node*>(__pos->_M_next); - __pos->_M_next = __curr->_M_next; - _Tp_alloc_type __a(_M_get_Node_allocator()); - allocator_traits<_Tp_alloc_type>::destroy(__a, __curr->_M_valptr()); - __curr->~_Node(); - _M_put_node(__curr); - return __pos->_M_next; - } - - template - _Fwd_list_node_base* - _Fwd_list_base<_Tp, _Alloc>:: - _M_erase_after(_Fwd_list_node_base* __pos, - _Fwd_list_node_base* __last) - { - _Node* __curr = static_cast<_Node*>(__pos->_M_next); - while (__curr != __last) - { - _Node* __temp = __curr; - __curr = static_cast<_Node*>(__curr->_M_next); - _Tp_alloc_type __a(_M_get_Node_allocator()); - allocator_traits<_Tp_alloc_type>::destroy(__a, __temp->_M_valptr()); - __temp->~_Node(); - _M_put_node(__temp); - } - __pos->_M_next = __last; - return __last; - } - - // Called by the range constructor to implement [23.3.4.2]/9 - template - template - void - forward_list<_Tp, _Alloc>:: - _M_range_initialize(_InputIterator __first, _InputIterator __last) - { - _Node_base* __to = &this->_M_impl._M_head; - for (; __first != __last; ++__first) - { - __to->_M_next = this->_M_create_node(*__first); - __to = __to->_M_next; - } - } - - // Called by forward_list(n,v,a). - template - void - forward_list<_Tp, _Alloc>:: - _M_fill_initialize(size_type __n, const value_type& __value) - { - _Node_base* __to = &this->_M_impl._M_head; - for (; __n; --__n) - { - __to->_M_next = this->_M_create_node(__value); - __to = __to->_M_next; - } - } - - template - void - forward_list<_Tp, _Alloc>:: - _M_default_initialize(size_type __n) - { - _Node_base* __to = &this->_M_impl._M_head; - for (; __n; --__n) - { - __to->_M_next = this->_M_create_node(); - __to = __to->_M_next; - } - } - - template - forward_list<_Tp, _Alloc>& - forward_list<_Tp, _Alloc>:: - operator=(const forward_list& __list) - { - if (&__list != this) - { - if (_Node_alloc_traits::_S_propagate_on_copy_assign()) - { - auto& __this_alloc = this->_M_get_Node_allocator(); - auto& __that_alloc = __list._M_get_Node_allocator(); - if (!_Node_alloc_traits::_S_always_equal() - && __this_alloc != __that_alloc) - { - // replacement allocator cannot free existing storage - clear(); - } - std::__alloc_on_copy(__this_alloc, __that_alloc); - } - assign(__list.cbegin(), __list.cend()); - } - return *this; - } - - template - void - forward_list<_Tp, _Alloc>:: - _M_default_insert_after(const_iterator __pos, size_type __n) - { - const_iterator __saved_pos = __pos; - __try - { - for (; __n; --__n) - __pos = emplace_after(__pos); - } - __catch(...) - { - erase_after(__saved_pos, ++__pos); - __throw_exception_again; - } - } - - template - void - forward_list<_Tp, _Alloc>:: - resize(size_type __sz) - { - iterator __k = before_begin(); - - size_type __len = 0; - while (__k._M_next() != end() && __len < __sz) - { - ++__k; - ++__len; - } - if (__len == __sz) - erase_after(__k, end()); - else - _M_default_insert_after(__k, __sz - __len); - } - - template - void - forward_list<_Tp, _Alloc>:: - resize(size_type __sz, const value_type& __val) - { - iterator __k = before_begin(); - - size_type __len = 0; - while (__k._M_next() != end() && __len < __sz) - { - ++__k; - ++__len; - } - if (__len == __sz) - erase_after(__k, end()); - else - insert_after(__k, __sz - __len, __val); - } - - template - typename forward_list<_Tp, _Alloc>::iterator - forward_list<_Tp, _Alloc>:: - _M_splice_after(const_iterator __pos, - const_iterator __before, const_iterator __last) - { - _Node_base* __tmp = const_cast<_Node_base*>(__pos._M_node); - _Node_base* __b = const_cast<_Node_base*>(__before._M_node); - _Node_base* __end = __b; - - while (__end && __end->_M_next != __last._M_node) - __end = __end->_M_next; - - if (__b != __end) - return iterator(__tmp->_M_transfer_after(__b, __end)); - else - return iterator(__tmp); - } - - template - void - forward_list<_Tp, _Alloc>:: - splice_after(const_iterator __pos, forward_list&&, - const_iterator __i) - { - const_iterator __j = __i; - ++__j; - - if (__pos == __i || __pos == __j) - return; - - _Node_base* __tmp = const_cast<_Node_base*>(__pos._M_node); - __tmp->_M_transfer_after(const_cast<_Node_base*>(__i._M_node), - const_cast<_Node_base*>(__j._M_node)); - } - - template - typename forward_list<_Tp, _Alloc>::iterator - forward_list<_Tp, _Alloc>:: - insert_after(const_iterator __pos, size_type __n, const _Tp& __val) - { - if (__n) - { - forward_list __tmp(__n, __val, get_allocator()); - return _M_splice_after(__pos, __tmp.before_begin(), __tmp.end()); - } - else - return iterator(const_cast<_Node_base*>(__pos._M_node)); - } - - template - template - typename forward_list<_Tp, _Alloc>::iterator - forward_list<_Tp, _Alloc>:: - insert_after(const_iterator __pos, - _InputIterator __first, _InputIterator __last) - { - forward_list __tmp(__first, __last, get_allocator()); - if (!__tmp.empty()) - return _M_splice_after(__pos, __tmp.before_begin(), __tmp.end()); - else - return iterator(const_cast<_Node_base*>(__pos._M_node)); - } - - template - void - forward_list<_Tp, _Alloc>:: - remove(const _Tp& __val) - { - _Node* __curr = static_cast<_Node*>(&this->_M_impl._M_head); - _Node* __extra = 0; - - while (_Node* __tmp = static_cast<_Node*>(__curr->_M_next)) - { - if (*__tmp->_M_valptr() == __val) - { - if (__tmp->_M_valptr() != std::__addressof(__val)) - { - this->_M_erase_after(__curr); - continue; - } - else - __extra = __curr; - } - __curr = static_cast<_Node*>(__curr->_M_next); - } - - if (__extra) - this->_M_erase_after(__extra); - } - - template - template - void - forward_list<_Tp, _Alloc>:: - remove_if(_Pred __pred) - { - _Node* __curr = static_cast<_Node*>(&this->_M_impl._M_head); - while (_Node* __tmp = static_cast<_Node*>(__curr->_M_next)) - { - if (__pred(*__tmp->_M_valptr())) - this->_M_erase_after(__curr); - else - __curr = static_cast<_Node*>(__curr->_M_next); - } - } - - template - template - void - forward_list<_Tp, _Alloc>:: - unique(_BinPred __binary_pred) - { - iterator __first = begin(); - iterator __last = end(); - if (__first == __last) - return; - iterator __next = __first; - while (++__next != __last) - { - if (__binary_pred(*__first, *__next)) - erase_after(__first); - else - __first = __next; - __next = __first; - } - } - - template - template - void - forward_list<_Tp, _Alloc>:: - merge(forward_list&& __list, _Comp __comp) - { - _Node_base* __node = &this->_M_impl._M_head; - while (__node->_M_next && __list._M_impl._M_head._M_next) - { - if (__comp(*static_cast<_Node*> - (__list._M_impl._M_head._M_next)->_M_valptr(), - *static_cast<_Node*> - (__node->_M_next)->_M_valptr())) - __node->_M_transfer_after(&__list._M_impl._M_head, - __list._M_impl._M_head._M_next); - __node = __node->_M_next; - } - if (__list._M_impl._M_head._M_next) - { - __node->_M_next = __list._M_impl._M_head._M_next; - __list._M_impl._M_head._M_next = 0; - } - } - - template - bool - operator==(const forward_list<_Tp, _Alloc>& __lx, - const forward_list<_Tp, _Alloc>& __ly) - { - // We don't have size() so we need to walk through both lists - // making sure both iterators are valid. - auto __ix = __lx.cbegin(); - auto __iy = __ly.cbegin(); - while (__ix != __lx.cend() && __iy != __ly.cend()) - { - if (*__ix != *__iy) - return false; - ++__ix; - ++__iy; - } - if (__ix == __lx.cend() && __iy == __ly.cend()) - return true; - else - return false; - } - - template - template - void - forward_list<_Tp, _Alloc>:: - sort(_Comp __comp) - { - // If `next' is 0, return immediately. - _Node* __list = static_cast<_Node*>(this->_M_impl._M_head._M_next); - if (!__list) - return; - - unsigned long __insize = 1; - - while (1) - { - _Node* __p = __list; - __list = 0; - _Node* __tail = 0; - - // Count number of merges we do in this pass. - unsigned long __nmerges = 0; - - while (__p) - { - ++__nmerges; - // There exists a merge to be done. - // Step `insize' places along from p. - _Node* __q = __p; - unsigned long __psize = 0; - for (unsigned long __i = 0; __i < __insize; ++__i) - { - ++__psize; - __q = static_cast<_Node*>(__q->_M_next); - if (!__q) - break; - } - - // If q hasn't fallen off end, we have two lists to merge. - unsigned long __qsize = __insize; - - // Now we have two lists; merge them. - while (__psize > 0 || (__qsize > 0 && __q)) - { - // Decide whether next node of merge comes from p or q. - _Node* __e; - if (__psize == 0) - { - // p is empty; e must come from q. - __e = __q; - __q = static_cast<_Node*>(__q->_M_next); - --__qsize; - } - else if (__qsize == 0 || !__q) - { - // q is empty; e must come from p. - __e = __p; - __p = static_cast<_Node*>(__p->_M_next); - --__psize; - } - else if (__comp(*__p->_M_valptr(), *__q->_M_valptr())) - { - // First node of p is lower; e must come from p. - __e = __p; - __p = static_cast<_Node*>(__p->_M_next); - --__psize; - } - else - { - // First node of q is lower; e must come from q. - __e = __q; - __q = static_cast<_Node*>(__q->_M_next); - --__qsize; - } - - // Add the next node to the merged list. - if (__tail) - __tail->_M_next = __e; - else - __list = __e; - __tail = __e; - } - - // Now p has stepped `insize' places along, and q has too. - __p = __q; - } - __tail->_M_next = 0; - - // If we have done only one merge, we're finished. - // Allow for nmerges == 0, the empty list case. - if (__nmerges <= 1) - { - this->_M_impl._M_head._M_next = __list; - return; - } - - // Otherwise repeat, merging lists twice the size. - __insize *= 2; - } - } - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#endif /* _FORWARD_LIST_TCC */ - diff --git a/openflow/usr/include/c++/5/bits/fstream.tcc b/openflow/usr/include/c++/5/bits/fstream.tcc deleted file mode 100644 index d5fc8bb..0000000 --- a/openflow/usr/include/c++/5/bits/fstream.tcc +++ /dev/null @@ -1,1069 +0,0 @@ -// File based streams -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/fstream.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{fstream} - */ - -// -// ISO C++ 14882: 27.8 File-based streams -// - -#ifndef _FSTREAM_TCC -#define _FSTREAM_TCC 1 - -#pragma GCC system_header - -#include -#include // for swap - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - void - basic_filebuf<_CharT, _Traits>:: - _M_allocate_internal_buffer() - { - // Allocate internal buffer only if one doesn't already exist - // (either allocated or provided by the user via setbuf). - if (!_M_buf_allocated && !_M_buf) - { - _M_buf = new char_type[_M_buf_size]; - _M_buf_allocated = true; - } - } - - template - void - basic_filebuf<_CharT, _Traits>:: - _M_destroy_internal_buffer() throw() - { - if (_M_buf_allocated) - { - delete [] _M_buf; - _M_buf = 0; - _M_buf_allocated = false; - } - delete [] _M_ext_buf; - _M_ext_buf = 0; - _M_ext_buf_size = 0; - _M_ext_next = 0; - _M_ext_end = 0; - } - - template - basic_filebuf<_CharT, _Traits>:: - basic_filebuf() : __streambuf_type(), _M_lock(), _M_file(&_M_lock), - _M_mode(ios_base::openmode(0)), _M_state_beg(), _M_state_cur(), - _M_state_last(), _M_buf(0), _M_buf_size(BUFSIZ), - _M_buf_allocated(false), _M_reading(false), _M_writing(false), _M_pback(), - _M_pback_cur_save(0), _M_pback_end_save(0), _M_pback_init(false), - _M_codecvt(0), _M_ext_buf(0), _M_ext_buf_size(0), _M_ext_next(0), - _M_ext_end(0) - { - if (has_facet<__codecvt_type>(this->_M_buf_locale)) - _M_codecvt = &use_facet<__codecvt_type>(this->_M_buf_locale); - } - -#if __cplusplus >= 201103L - template - basic_filebuf<_CharT, _Traits>:: - basic_filebuf(basic_filebuf&& __rhs) - : __streambuf_type(__rhs), - _M_lock(), _M_file(std::move(__rhs._M_file), &_M_lock), - _M_mode(std::__exchange(__rhs._M_mode, ios_base::openmode(0))), - _M_state_beg(std::move(__rhs._M_state_beg)), - _M_state_cur(std::move(__rhs._M_state_cur)), - _M_state_last(std::move(__rhs._M_state_last)), - _M_buf(std::__exchange(__rhs._M_buf, nullptr)), - _M_buf_size(std::__exchange(__rhs._M_buf_size, 1)), - _M_buf_allocated(std::__exchange(__rhs._M_buf_allocated, false)), - _M_reading(std::__exchange(__rhs._M_reading, false)), - _M_writing(std::__exchange(__rhs._M_writing, false)), - _M_pback(__rhs._M_pback), - _M_pback_cur_save(std::__exchange(__rhs._M_pback_cur_save, nullptr)), - _M_pback_end_save(std::__exchange(__rhs._M_pback_end_save, nullptr)), - _M_pback_init(std::__exchange(__rhs._M_pback_init, false)), - _M_codecvt(__rhs._M_codecvt), - _M_ext_buf(std::__exchange(__rhs._M_ext_buf, nullptr)), - _M_ext_buf_size(std::__exchange(__rhs._M_ext_buf_size, 0)), - _M_ext_next(std::__exchange(__rhs._M_ext_next, nullptr)), - _M_ext_end(std::__exchange(__rhs._M_ext_end, nullptr)) - { - __rhs._M_set_buffer(-1); - __rhs._M_state_last = __rhs._M_state_cur = __rhs._M_state_beg; - } - - template - basic_filebuf<_CharT, _Traits>& - basic_filebuf<_CharT, _Traits>:: - operator=(basic_filebuf&& __rhs) - { - this->close(); - __streambuf_type::operator=(__rhs); - _M_file.swap(__rhs._M_file); - _M_mode = std::__exchange(__rhs._M_mode, ios_base::openmode(0)); - _M_state_beg = std::move(__rhs._M_state_beg); - _M_state_cur = std::move(__rhs._M_state_cur); - _M_state_last = std::move(__rhs._M_state_last); - _M_buf = std::__exchange(__rhs._M_buf, nullptr); - _M_buf_size = std::__exchange(__rhs._M_buf_size, 1); - _M_buf_allocated = std::__exchange(__rhs._M_buf_allocated, false); - _M_ext_buf = std::__exchange(__rhs._M_ext_buf, nullptr); - _M_ext_buf_size = std::__exchange(__rhs._M_ext_buf_size, 0); - _M_ext_next = std::__exchange(__rhs._M_ext_next, nullptr); - _M_ext_end = std::__exchange(__rhs._M_ext_end, nullptr); - _M_reading = std::__exchange(__rhs._M_reading, false); - _M_writing = std::__exchange(__rhs._M_writing, false); - _M_pback_cur_save = std::__exchange(__rhs._M_pback_cur_save, nullptr); - _M_pback_end_save = std::__exchange(__rhs._M_pback_end_save, nullptr); - _M_pback_init = std::__exchange(__rhs._M_pback_init, false); - __rhs._M_set_buffer(-1); - __rhs._M_state_last = __rhs._M_state_cur = __rhs._M_state_beg; - return *this; - } - - template - void - basic_filebuf<_CharT, _Traits>:: - swap(basic_filebuf& __rhs) - { - __streambuf_type::swap(__rhs); - _M_file.swap(__rhs._M_file); - std::swap(_M_mode, __rhs._M_mode); - std::swap(_M_state_beg, __rhs._M_state_beg); - std::swap(_M_state_cur, __rhs._M_state_cur); - std::swap(_M_state_last, __rhs._M_state_last); - std::swap(_M_buf, __rhs._M_buf); - std::swap(_M_buf_size, __rhs._M_buf_size); - std::swap(_M_buf_allocated, __rhs._M_buf_allocated); - std::swap(_M_ext_buf, __rhs._M_ext_buf); - std::swap(_M_ext_buf_size, __rhs._M_ext_buf_size); - std::swap(_M_ext_next, __rhs._M_ext_next); - std::swap(_M_ext_end, __rhs._M_ext_end); - std::swap(_M_reading, __rhs._M_reading); - std::swap(_M_writing, __rhs._M_writing); - std::swap(_M_pback_cur_save, __rhs._M_pback_cur_save); - std::swap(_M_pback_end_save, __rhs._M_pback_end_save); - std::swap(_M_pback_init, __rhs._M_pback_init); - } -#endif - - template - typename basic_filebuf<_CharT, _Traits>::__filebuf_type* - basic_filebuf<_CharT, _Traits>:: - open(const char* __s, ios_base::openmode __mode) - { - __filebuf_type *__ret = 0; - if (!this->is_open()) - { - _M_file.open(__s, __mode); - if (this->is_open()) - { - _M_allocate_internal_buffer(); - _M_mode = __mode; - - // Setup initial buffer to 'uncommitted' mode. - _M_reading = false; - _M_writing = false; - _M_set_buffer(-1); - - // Reset to initial state. - _M_state_last = _M_state_cur = _M_state_beg; - - // 27.8.1.3,4 - if ((__mode & ios_base::ate) - && this->seekoff(0, ios_base::end, __mode) - == pos_type(off_type(-1))) - this->close(); - else - __ret = this; - } - } - return __ret; - } - - template - typename basic_filebuf<_CharT, _Traits>::__filebuf_type* - basic_filebuf<_CharT, _Traits>:: - close() - { - if (!this->is_open()) - return 0; - - bool __testfail = false; - { - // NB: Do this here so that re-opened filebufs will be cool... - struct __close_sentry - { - basic_filebuf *__fb; - __close_sentry (basic_filebuf *__fbi): __fb(__fbi) { } - ~__close_sentry () - { - __fb->_M_mode = ios_base::openmode(0); - __fb->_M_pback_init = false; - __fb->_M_destroy_internal_buffer(); - __fb->_M_reading = false; - __fb->_M_writing = false; - __fb->_M_set_buffer(-1); - __fb->_M_state_last = __fb->_M_state_cur = __fb->_M_state_beg; - } - } __cs (this); - - __try - { - if (!_M_terminate_output()) - __testfail = true; - } - __catch(__cxxabiv1::__forced_unwind&) - { - _M_file.close(); - __throw_exception_again; - } - __catch(...) - { __testfail = true; } - } - - if (!_M_file.close()) - __testfail = true; - - if (__testfail) - return 0; - else - return this; - } - - template - streamsize - basic_filebuf<_CharT, _Traits>:: - showmanyc() - { - streamsize __ret = -1; - const bool __testin = _M_mode & ios_base::in; - if (__testin && this->is_open()) - { - // For a stateful encoding (-1) the pending sequence might be just - // shift and unshift prefixes with no actual character. - __ret = this->egptr() - this->gptr(); - -#if _GLIBCXX_HAVE_DOS_BASED_FILESYSTEM - // About this workaround, see libstdc++/20806. - const bool __testbinary = _M_mode & ios_base::binary; - if (__check_facet(_M_codecvt).encoding() >= 0 - && __testbinary) -#else - if (__check_facet(_M_codecvt).encoding() >= 0) -#endif - __ret += _M_file.showmanyc() / _M_codecvt->max_length(); - } - return __ret; - } - - template - typename basic_filebuf<_CharT, _Traits>::int_type - basic_filebuf<_CharT, _Traits>:: - underflow() - { - int_type __ret = traits_type::eof(); - const bool __testin = _M_mode & ios_base::in; - if (__testin) - { - if (_M_writing) - { - if (overflow() == traits_type::eof()) - return __ret; - _M_set_buffer(-1); - _M_writing = false; - } - // Check for pback madness, and if so switch back to the - // normal buffers and jet outta here before expensive - // fileops happen... - _M_destroy_pback(); - - if (this->gptr() < this->egptr()) - return traits_type::to_int_type(*this->gptr()); - - // Get and convert input sequence. - const size_t __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1; - - // Will be set to true if ::read() returns 0 indicating EOF. - bool __got_eof = false; - // Number of internal characters produced. - streamsize __ilen = 0; - codecvt_base::result __r = codecvt_base::ok; - if (__check_facet(_M_codecvt).always_noconv()) - { - __ilen = _M_file.xsgetn(reinterpret_cast(this->eback()), - __buflen); - if (__ilen == 0) - __got_eof = true; - } - else - { - // Worst-case number of external bytes. - // XXX Not done encoding() == -1. - const int __enc = _M_codecvt->encoding(); - streamsize __blen; // Minimum buffer size. - streamsize __rlen; // Number of chars to read. - if (__enc > 0) - __blen = __rlen = __buflen * __enc; - else - { - __blen = __buflen + _M_codecvt->max_length() - 1; - __rlen = __buflen; - } - const streamsize __remainder = _M_ext_end - _M_ext_next; - __rlen = __rlen > __remainder ? __rlen - __remainder : 0; - - // An imbue in 'read' mode implies first converting the external - // chars already present. - if (_M_reading && this->egptr() == this->eback() && __remainder) - __rlen = 0; - - // Allocate buffer if necessary and move unconverted - // bytes to front. - if (_M_ext_buf_size < __blen) - { - char* __buf = new char[__blen]; - if (__remainder) - __builtin_memcpy(__buf, _M_ext_next, __remainder); - - delete [] _M_ext_buf; - _M_ext_buf = __buf; - _M_ext_buf_size = __blen; - } - else if (__remainder) - __builtin_memmove(_M_ext_buf, _M_ext_next, __remainder); - - _M_ext_next = _M_ext_buf; - _M_ext_end = _M_ext_buf + __remainder; - _M_state_last = _M_state_cur; - - do - { - if (__rlen > 0) - { - // Sanity check! - // This may fail if the return value of - // codecvt::max_length() is bogus. - if (_M_ext_end - _M_ext_buf + __rlen > _M_ext_buf_size) - { - __throw_ios_failure(__N("basic_filebuf::underflow " - "codecvt::max_length() " - "is not valid")); - } - streamsize __elen = _M_file.xsgetn(_M_ext_end, __rlen); - if (__elen == 0) - __got_eof = true; - else if (__elen == -1) - break; - _M_ext_end += __elen; - } - - char_type* __iend = this->eback(); - if (_M_ext_next < _M_ext_end) - __r = _M_codecvt->in(_M_state_cur, _M_ext_next, - _M_ext_end, _M_ext_next, - this->eback(), - this->eback() + __buflen, __iend); - if (__r == codecvt_base::noconv) - { - size_t __avail = _M_ext_end - _M_ext_buf; - __ilen = std::min(__avail, __buflen); - traits_type::copy(this->eback(), - reinterpret_cast - (_M_ext_buf), __ilen); - _M_ext_next = _M_ext_buf + __ilen; - } - else - __ilen = __iend - this->eback(); - - // _M_codecvt->in may return error while __ilen > 0: this is - // ok, and actually occurs in case of mixed encodings (e.g., - // XML files). - if (__r == codecvt_base::error) - break; - - __rlen = 1; - } - while (__ilen == 0 && !__got_eof); - } - - if (__ilen > 0) - { - _M_set_buffer(__ilen); - _M_reading = true; - __ret = traits_type::to_int_type(*this->gptr()); - } - else if (__got_eof) - { - // If the actual end of file is reached, set 'uncommitted' - // mode, thus allowing an immediate write without an - // intervening seek. - _M_set_buffer(-1); - _M_reading = false; - // However, reaching it while looping on partial means that - // the file has got an incomplete character. - if (__r == codecvt_base::partial) - __throw_ios_failure(__N("basic_filebuf::underflow " - "incomplete character in file")); - } - else if (__r == codecvt_base::error) - __throw_ios_failure(__N("basic_filebuf::underflow " - "invalid byte sequence in file")); - else - __throw_ios_failure(__N("basic_filebuf::underflow " - "error reading the file")); - } - return __ret; - } - - template - typename basic_filebuf<_CharT, _Traits>::int_type - basic_filebuf<_CharT, _Traits>:: - pbackfail(int_type __i) - { - int_type __ret = traits_type::eof(); - const bool __testin = _M_mode & ios_base::in; - if (__testin) - { - if (_M_writing) - { - if (overflow() == traits_type::eof()) - return __ret; - _M_set_buffer(-1); - _M_writing = false; - } - // Remember whether the pback buffer is active, otherwise below - // we may try to store in it a second char (libstdc++/9761). - const bool __testpb = _M_pback_init; - const bool __testeof = traits_type::eq_int_type(__i, __ret); - int_type __tmp; - if (this->eback() < this->gptr()) - { - this->gbump(-1); - __tmp = traits_type::to_int_type(*this->gptr()); - } - else if (this->seekoff(-1, ios_base::cur) != pos_type(off_type(-1))) - { - __tmp = this->underflow(); - if (traits_type::eq_int_type(__tmp, __ret)) - return __ret; - } - else - { - // At the beginning of the buffer, need to make a - // putback position available. But the seek may fail - // (f.i., at the beginning of a file, see - // libstdc++/9439) and in that case we return - // traits_type::eof(). - return __ret; - } - - // Try to put back __i into input sequence in one of three ways. - // Order these tests done in is unspecified by the standard. - if (!__testeof && traits_type::eq_int_type(__i, __tmp)) - __ret = __i; - else if (__testeof) - __ret = traits_type::not_eof(__i); - else if (!__testpb) - { - _M_create_pback(); - _M_reading = true; - *this->gptr() = traits_type::to_char_type(__i); - __ret = __i; - } - } - return __ret; - } - - template - typename basic_filebuf<_CharT, _Traits>::int_type - basic_filebuf<_CharT, _Traits>:: - overflow(int_type __c) - { - int_type __ret = traits_type::eof(); - const bool __testeof = traits_type::eq_int_type(__c, __ret); - const bool __testout = (_M_mode & ios_base::out - || _M_mode & ios_base::app); - if (__testout) - { - if (_M_reading) - { - _M_destroy_pback(); - const int __gptr_off = _M_get_ext_pos(_M_state_last); - if (_M_seek(__gptr_off, ios_base::cur, _M_state_last) - == pos_type(off_type(-1))) - return __ret; - } - if (this->pbase() < this->pptr()) - { - // If appropriate, append the overflow char. - if (!__testeof) - { - *this->pptr() = traits_type::to_char_type(__c); - this->pbump(1); - } - - // Convert pending sequence to external representation, - // and output. - if (_M_convert_to_external(this->pbase(), - this->pptr() - this->pbase())) - { - _M_set_buffer(0); - __ret = traits_type::not_eof(__c); - } - } - else if (_M_buf_size > 1) - { - // Overflow in 'uncommitted' mode: set _M_writing, set - // the buffer to the initial 'write' mode, and put __c - // into the buffer. - _M_set_buffer(0); - _M_writing = true; - if (!__testeof) - { - *this->pptr() = traits_type::to_char_type(__c); - this->pbump(1); - } - __ret = traits_type::not_eof(__c); - } - else - { - // Unbuffered. - char_type __conv = traits_type::to_char_type(__c); - if (__testeof || _M_convert_to_external(&__conv, 1)) - { - _M_writing = true; - __ret = traits_type::not_eof(__c); - } - } - } - return __ret; - } - - template - bool - basic_filebuf<_CharT, _Traits>:: - _M_convert_to_external(_CharT* __ibuf, streamsize __ilen) - { - // Sizes of external and pending output. - streamsize __elen; - streamsize __plen; - if (__check_facet(_M_codecvt).always_noconv()) - { - __elen = _M_file.xsputn(reinterpret_cast(__ibuf), __ilen); - __plen = __ilen; - } - else - { - // Worst-case number of external bytes needed. - // XXX Not done encoding() == -1. - streamsize __blen = __ilen * _M_codecvt->max_length(); - char* __buf = static_cast(__builtin_alloca(__blen)); - - char* __bend; - const char_type* __iend; - codecvt_base::result __r; - __r = _M_codecvt->out(_M_state_cur, __ibuf, __ibuf + __ilen, - __iend, __buf, __buf + __blen, __bend); - - if (__r == codecvt_base::ok || __r == codecvt_base::partial) - __blen = __bend - __buf; - else if (__r == codecvt_base::noconv) - { - // Same as the always_noconv case above. - __buf = reinterpret_cast(__ibuf); - __blen = __ilen; - } - else - __throw_ios_failure(__N("basic_filebuf::_M_convert_to_external " - "conversion error")); - - __elen = _M_file.xsputn(__buf, __blen); - __plen = __blen; - - // Try once more for partial conversions. - if (__r == codecvt_base::partial && __elen == __plen) - { - const char_type* __iresume = __iend; - streamsize __rlen = this->pptr() - __iend; - __r = _M_codecvt->out(_M_state_cur, __iresume, - __iresume + __rlen, __iend, __buf, - __buf + __blen, __bend); - if (__r != codecvt_base::error) - { - __rlen = __bend - __buf; - __elen = _M_file.xsputn(__buf, __rlen); - __plen = __rlen; - } - else - __throw_ios_failure(__N("basic_filebuf::_M_convert_to_external " - "conversion error")); - } - } - return __elen == __plen; - } - - template - streamsize - basic_filebuf<_CharT, _Traits>:: - xsgetn(_CharT* __s, streamsize __n) - { - // Clear out pback buffer before going on to the real deal... - streamsize __ret = 0; - if (_M_pback_init) - { - if (__n > 0 && this->gptr() == this->eback()) - { - *__s++ = *this->gptr(); // emulate non-underflowing sbumpc - this->gbump(1); - __ret = 1; - --__n; - } - _M_destroy_pback(); - } - else if (_M_writing) - { - if (overflow() == traits_type::eof()) - return __ret; - _M_set_buffer(-1); - _M_writing = false; - } - - // Optimization in the always_noconv() case, to be generalized in the - // future: when __n > __buflen we read directly instead of using the - // buffer repeatedly. - const bool __testin = _M_mode & ios_base::in; - const streamsize __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1; - - if (__n > __buflen && __check_facet(_M_codecvt).always_noconv() - && __testin) - { - // First, copy the chars already present in the buffer. - const streamsize __avail = this->egptr() - this->gptr(); - if (__avail != 0) - { - traits_type::copy(__s, this->gptr(), __avail); - __s += __avail; - this->setg(this->eback(), this->gptr() + __avail, - this->egptr()); - __ret += __avail; - __n -= __avail; - } - - // Need to loop in case of short reads (relatively common - // with pipes). - streamsize __len; - for (;;) - { - __len = _M_file.xsgetn(reinterpret_cast(__s), - __n); - if (__len == -1) - __throw_ios_failure(__N("basic_filebuf::xsgetn " - "error reading the file")); - if (__len == 0) - break; - - __n -= __len; - __ret += __len; - if (__n == 0) - break; - - __s += __len; - } - - if (__n == 0) - { - _M_set_buffer(0); - _M_reading = true; - } - else if (__len == 0) - { - // If end of file is reached, set 'uncommitted' - // mode, thus allowing an immediate write without - // an intervening seek. - _M_set_buffer(-1); - _M_reading = false; - } - } - else - __ret += __streambuf_type::xsgetn(__s, __n); - - return __ret; - } - - template - streamsize - basic_filebuf<_CharT, _Traits>:: - xsputn(const _CharT* __s, streamsize __n) - { - streamsize __ret = 0; - // Optimization in the always_noconv() case, to be generalized in the - // future: when __n is sufficiently large we write directly instead of - // using the buffer. - const bool __testout = (_M_mode & ios_base::out - || _M_mode & ios_base::app); - if (__check_facet(_M_codecvt).always_noconv() - && __testout && !_M_reading) - { - // Measurement would reveal the best choice. - const streamsize __chunk = 1ul << 10; - streamsize __bufavail = this->epptr() - this->pptr(); - - // Don't mistake 'uncommitted' mode buffered with unbuffered. - if (!_M_writing && _M_buf_size > 1) - __bufavail = _M_buf_size - 1; - - const streamsize __limit = std::min(__chunk, __bufavail); - if (__n >= __limit) - { - const streamsize __buffill = this->pptr() - this->pbase(); - const char* __buf = reinterpret_cast(this->pbase()); - __ret = _M_file.xsputn_2(__buf, __buffill, - reinterpret_cast(__s), - __n); - if (__ret == __buffill + __n) - { - _M_set_buffer(0); - _M_writing = true; - } - if (__ret > __buffill) - __ret -= __buffill; - else - __ret = 0; - } - else - __ret = __streambuf_type::xsputn(__s, __n); - } - else - __ret = __streambuf_type::xsputn(__s, __n); - return __ret; - } - - template - typename basic_filebuf<_CharT, _Traits>::__streambuf_type* - basic_filebuf<_CharT, _Traits>:: - setbuf(char_type* __s, streamsize __n) - { - if (!this->is_open()) - { - if (__s == 0 && __n == 0) - _M_buf_size = 1; - else if (__s && __n > 0) - { - // This is implementation-defined behavior, and assumes that - // an external char_type array of length __n exists and has - // been pre-allocated. If this is not the case, things will - // quickly blow up. When __n > 1, __n - 1 positions will be - // used for the get area, __n - 1 for the put area and 1 - // position to host the overflow char of a full put area. - // When __n == 1, 1 position will be used for the get area - // and 0 for the put area, as in the unbuffered case above. - _M_buf = __s; - _M_buf_size = __n; - } - } - return this; - } - - - // According to 27.8.1.4 p11 - 13, seekoff should ignore the last - // argument (of type openmode). - template - typename basic_filebuf<_CharT, _Traits>::pos_type - basic_filebuf<_CharT, _Traits>:: - seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode) - { - int __width = 0; - if (_M_codecvt) - __width = _M_codecvt->encoding(); - if (__width < 0) - __width = 0; - - pos_type __ret = pos_type(off_type(-1)); - const bool __testfail = __off != 0 && __width <= 0; - if (this->is_open() && !__testfail) - { - // tellg and tellp queries do not affect any state, unless - // ! always_noconv and the put sequence is not empty. - // In that case, determining the position requires converting the - // put sequence. That doesn't use ext_buf, so requires a flush. - bool __no_movement = __way == ios_base::cur && __off == 0 - && (!_M_writing || _M_codecvt->always_noconv()); - - // Ditch any pback buffers to avoid confusion. - if (!__no_movement) - _M_destroy_pback(); - - // Correct state at destination. Note that this is the correct - // state for the current position during output, because - // codecvt::unshift() returns the state to the initial state. - // This is also the correct state at the end of the file because - // an unshift sequence should have been written at the end. - __state_type __state = _M_state_beg; - off_type __computed_off = __off * __width; - if (_M_reading && __way == ios_base::cur) - { - __state = _M_state_last; - __computed_off += _M_get_ext_pos(__state); - } - if (!__no_movement) - __ret = _M_seek(__computed_off, __way, __state); - else - { - if (_M_writing) - __computed_off = this->pptr() - this->pbase(); - - off_type __file_off = _M_file.seekoff(0, ios_base::cur); - if (__file_off != off_type(-1)) - { - __ret = __file_off + __computed_off; - __ret.state(__state); - } - } - } - return __ret; - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 171. Strange seekpos() semantics due to joint position - // According to the resolution of DR 171, seekpos should ignore the last - // argument (of type openmode). - template - typename basic_filebuf<_CharT, _Traits>::pos_type - basic_filebuf<_CharT, _Traits>:: - seekpos(pos_type __pos, ios_base::openmode) - { - pos_type __ret = pos_type(off_type(-1)); - if (this->is_open()) - { - // Ditch any pback buffers to avoid confusion. - _M_destroy_pback(); - __ret = _M_seek(off_type(__pos), ios_base::beg, __pos.state()); - } - return __ret; - } - - template - typename basic_filebuf<_CharT, _Traits>::pos_type - basic_filebuf<_CharT, _Traits>:: - _M_seek(off_type __off, ios_base::seekdir __way, __state_type __state) - { - pos_type __ret = pos_type(off_type(-1)); - if (_M_terminate_output()) - { - off_type __file_off = _M_file.seekoff(__off, __way); - if (__file_off != off_type(-1)) - { - _M_reading = false; - _M_writing = false; - _M_ext_next = _M_ext_end = _M_ext_buf; - _M_set_buffer(-1); - _M_state_cur = __state; - __ret = __file_off; - __ret.state(_M_state_cur); - } - } - return __ret; - } - - // Returns the distance from the end of the ext buffer to the point - // corresponding to gptr(). This is a negative value. Updates __state - // from eback() correspondence to gptr(). - template - int basic_filebuf<_CharT, _Traits>:: - _M_get_ext_pos(__state_type& __state) - { - if (_M_codecvt->always_noconv()) - return this->gptr() - this->egptr(); - else - { - // Calculate offset from _M_ext_buf that corresponds to - // gptr(). Precondition: __state == _M_state_last, which - // corresponds to eback(). - const int __gptr_off = - _M_codecvt->length(__state, _M_ext_buf, _M_ext_next, - this->gptr() - this->eback()); - return _M_ext_buf + __gptr_off - _M_ext_end; - } - } - - template - bool - basic_filebuf<_CharT, _Traits>:: - _M_terminate_output() - { - // Part one: update the output sequence. - bool __testvalid = true; - if (this->pbase() < this->pptr()) - { - const int_type __tmp = this->overflow(); - if (traits_type::eq_int_type(__tmp, traits_type::eof())) - __testvalid = false; - } - - // Part two: output unshift sequence. - if (_M_writing && !__check_facet(_M_codecvt).always_noconv() - && __testvalid) - { - // Note: this value is arbitrary, since there is no way to - // get the length of the unshift sequence from codecvt, - // without calling unshift. - const size_t __blen = 128; - char __buf[__blen]; - codecvt_base::result __r; - streamsize __ilen = 0; - - do - { - char* __next; - __r = _M_codecvt->unshift(_M_state_cur, __buf, - __buf + __blen, __next); - if (__r == codecvt_base::error) - __testvalid = false; - else if (__r == codecvt_base::ok || - __r == codecvt_base::partial) - { - __ilen = __next - __buf; - if (__ilen > 0) - { - const streamsize __elen = _M_file.xsputn(__buf, __ilen); - if (__elen != __ilen) - __testvalid = false; - } - } - } - while (__r == codecvt_base::partial && __ilen > 0 && __testvalid); - - if (__testvalid) - { - // This second call to overflow() is required by the standard, - // but it's not clear why it's needed, since the output buffer - // should be empty by this point (it should have been emptied - // in the first call to overflow()). - const int_type __tmp = this->overflow(); - if (traits_type::eq_int_type(__tmp, traits_type::eof())) - __testvalid = false; - } - } - return __testvalid; - } - - template - int - basic_filebuf<_CharT, _Traits>:: - sync() - { - // Make sure that the internal buffer resyncs its idea of - // the file position with the external file. - int __ret = 0; - if (this->pbase() < this->pptr()) - { - const int_type __tmp = this->overflow(); - if (traits_type::eq_int_type(__tmp, traits_type::eof())) - __ret = -1; - } - return __ret; - } - - template - void - basic_filebuf<_CharT, _Traits>:: - imbue(const locale& __loc) - { - bool __testvalid = true; - - const __codecvt_type* _M_codecvt_tmp = 0; - if (__builtin_expect(has_facet<__codecvt_type>(__loc), true)) - _M_codecvt_tmp = &use_facet<__codecvt_type>(__loc); - - if (this->is_open()) - { - // encoding() == -1 is ok only at the beginning. - if ((_M_reading || _M_writing) - && __check_facet(_M_codecvt).encoding() == -1) - __testvalid = false; - else - { - if (_M_reading) - { - if (__check_facet(_M_codecvt).always_noconv()) - { - if (_M_codecvt_tmp - && !__check_facet(_M_codecvt_tmp).always_noconv()) - __testvalid = this->seekoff(0, ios_base::cur, _M_mode) - != pos_type(off_type(-1)); - } - else - { - // External position corresponding to gptr(). - _M_ext_next = _M_ext_buf - + _M_codecvt->length(_M_state_last, _M_ext_buf, - _M_ext_next, - this->gptr() - this->eback()); - const streamsize __remainder = _M_ext_end - _M_ext_next; - if (__remainder) - __builtin_memmove(_M_ext_buf, _M_ext_next, __remainder); - - _M_ext_next = _M_ext_buf; - _M_ext_end = _M_ext_buf + __remainder; - _M_set_buffer(-1); - _M_state_last = _M_state_cur = _M_state_beg; - } - } - else if (_M_writing && (__testvalid = _M_terminate_output())) - _M_set_buffer(-1); - } - } - - if (__testvalid) - _M_codecvt = _M_codecvt_tmp; - else - _M_codecvt = 0; - } - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template class basic_filebuf; - extern template class basic_ifstream; - extern template class basic_ofstream; - extern template class basic_fstream; - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template class basic_filebuf; - extern template class basic_ifstream; - extern template class basic_ofstream; - extern template class basic_fstream; -#endif -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/functexcept.h b/openflow/usr/include/c++/5/bits/functexcept.h deleted file mode 100644 index 355275d..0000000 --- a/openflow/usr/include/c++/5/bits/functexcept.h +++ /dev/null @@ -1,110 +0,0 @@ -// Function-Based Exception Support -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/functexcept.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{exception} - * - * This header provides support for -fno-exceptions. - */ - -// -// ISO C++ 14882: 19.1 Exception classes -// - -#ifndef _FUNCTEXCEPT_H -#define _FUNCTEXCEPT_H 1 - -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Helper for exception objects in - void - __throw_bad_exception(void) __attribute__((__noreturn__)); - - // Helper for exception objects in - void - __throw_bad_alloc(void) __attribute__((__noreturn__)); - - // Helper for exception objects in - void - __throw_bad_cast(void) __attribute__((__noreturn__)); - - void - __throw_bad_typeid(void) __attribute__((__noreturn__)); - - // Helpers for exception objects in - void - __throw_logic_error(const char*) __attribute__((__noreturn__)); - - void - __throw_domain_error(const char*) __attribute__((__noreturn__)); - - void - __throw_invalid_argument(const char*) __attribute__((__noreturn__)); - - void - __throw_length_error(const char*) __attribute__((__noreturn__)); - - void - __throw_out_of_range(const char*) __attribute__((__noreturn__)); - - void - __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__)) - __attribute__((__format__(__gnu_printf__, 1, 2))); - - void - __throw_runtime_error(const char*) __attribute__((__noreturn__)); - - void - __throw_range_error(const char*) __attribute__((__noreturn__)); - - void - __throw_overflow_error(const char*) __attribute__((__noreturn__)); - - void - __throw_underflow_error(const char*) __attribute__((__noreturn__)); - - // Helpers for exception objects in - void - __throw_ios_failure(const char*) __attribute__((__noreturn__)); - - void - __throw_system_error(int) __attribute__((__noreturn__)); - - void - __throw_future_error(int) __attribute__((__noreturn__)); - - // Helpers for exception objects in - void - __throw_bad_function_call() __attribute__((__noreturn__)); - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/bits/functional_hash.h b/openflow/usr/include/c++/5/bits/functional_hash.h deleted file mode 100644 index d94843f..0000000 --- a/openflow/usr/include/c++/5/bits/functional_hash.h +++ /dev/null @@ -1,212 +0,0 @@ -// functional_hash.h header -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/functional_hash.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{functional} - */ - -#ifndef _FUNCTIONAL_HASH_H -#define _FUNCTIONAL_HASH_H 1 - -#pragma GCC system_header - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** @defgroup hashes Hashes - * @ingroup functors - * - * Hashing functors taking a variable type and returning a @c std::size_t. - * - * @{ - */ - - template - struct __hash_base - { - typedef _Result result_type; - typedef _Arg argument_type; - }; - - /// Primary class template hash. - template - struct hash; - - /// Partial specializations for pointer types. - template - struct hash<_Tp*> : public __hash_base - { - size_t - operator()(_Tp* __p) const noexcept - { return reinterpret_cast(__p); } - }; - - // Explicit specializations for integer types. -#define _Cxx_hashtable_define_trivial_hash(_Tp) \ - template<> \ - struct hash<_Tp> : public __hash_base \ - { \ - size_t \ - operator()(_Tp __val) const noexcept \ - { return static_cast(__val); } \ - }; - - /// Explicit specialization for bool. - _Cxx_hashtable_define_trivial_hash(bool) - - /// Explicit specialization for char. - _Cxx_hashtable_define_trivial_hash(char) - - /// Explicit specialization for signed char. - _Cxx_hashtable_define_trivial_hash(signed char) - - /// Explicit specialization for unsigned char. - _Cxx_hashtable_define_trivial_hash(unsigned char) - - /// Explicit specialization for wchar_t. - _Cxx_hashtable_define_trivial_hash(wchar_t) - - /// Explicit specialization for char16_t. - _Cxx_hashtable_define_trivial_hash(char16_t) - - /// Explicit specialization for char32_t. - _Cxx_hashtable_define_trivial_hash(char32_t) - - /// Explicit specialization for short. - _Cxx_hashtable_define_trivial_hash(short) - - /// Explicit specialization for int. - _Cxx_hashtable_define_trivial_hash(int) - - /// Explicit specialization for long. - _Cxx_hashtable_define_trivial_hash(long) - - /// Explicit specialization for long long. - _Cxx_hashtable_define_trivial_hash(long long) - - /// Explicit specialization for unsigned short. - _Cxx_hashtable_define_trivial_hash(unsigned short) - - /// Explicit specialization for unsigned int. - _Cxx_hashtable_define_trivial_hash(unsigned int) - - /// Explicit specialization for unsigned long. - _Cxx_hashtable_define_trivial_hash(unsigned long) - - /// Explicit specialization for unsigned long long. - _Cxx_hashtable_define_trivial_hash(unsigned long long) - -#undef _Cxx_hashtable_define_trivial_hash - - struct _Hash_impl - { - static size_t - hash(const void* __ptr, size_t __clength, - size_t __seed = static_cast(0xc70f6907UL)) - { return _Hash_bytes(__ptr, __clength, __seed); } - - template - static size_t - hash(const _Tp& __val) - { return hash(&__val, sizeof(__val)); } - - template - static size_t - __hash_combine(const _Tp& __val, size_t __hash) - { return hash(&__val, sizeof(__val), __hash); } - }; - - struct _Fnv_hash_impl - { - static size_t - hash(const void* __ptr, size_t __clength, - size_t __seed = static_cast(2166136261UL)) - { return _Fnv_hash_bytes(__ptr, __clength, __seed); } - - template - static size_t - hash(const _Tp& __val) - { return hash(&__val, sizeof(__val)); } - - template - static size_t - __hash_combine(const _Tp& __val, size_t __hash) - { return hash(&__val, sizeof(__val), __hash); } - }; - - /// Specialization for float. - template<> - struct hash : public __hash_base - { - size_t - operator()(float __val) const noexcept - { - // 0 and -0 both hash to zero. - return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0; - } - }; - - /// Specialization for double. - template<> - struct hash : public __hash_base - { - size_t - operator()(double __val) const noexcept - { - // 0 and -0 both hash to zero. - return __val != 0.0 ? std::_Hash_impl::hash(__val) : 0; - } - }; - - /// Specialization for long double. - template<> - struct hash - : public __hash_base - { - _GLIBCXX_PURE size_t - operator()(long double __val) const noexcept; - }; - - // @} group hashes - - // Hint about performance of hash functor. If not fast the hash based - // containers will cache the hash code. - // Default behavior is to consider that hasher are fast unless specified - // otherwise. - template - struct __is_fast_hash : public std::true_type - { }; - - template<> - struct __is_fast_hash> : public std::false_type - { }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif // _FUNCTIONAL_HASH_H diff --git a/openflow/usr/include/c++/5/bits/gslice.h b/openflow/usr/include/c++/5/bits/gslice.h deleted file mode 100644 index 93e96eb..0000000 --- a/openflow/usr/include/c++/5/bits/gslice.h +++ /dev/null @@ -1,185 +0,0 @@ -// The template and inlines for the -*- C++ -*- gslice class. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/gslice.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{valarray} - */ - -// Written by Gabriel Dos Reis - -#ifndef _GSLICE_H -#define _GSLICE_H 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup numeric_arrays - * @{ - */ - - /** - * @brief Class defining multi-dimensional subset of an array. - * - * The slice class represents a multi-dimensional subset of an array, - * specified by three parameter sets: start offset, size array, and stride - * array. The start offset is the index of the first element of the array - * that is part of the subset. The size and stride array describe each - * dimension of the slice. Size is the number of elements in that - * dimension, and stride is the distance in the array between successive - * elements in that dimension. Each dimension's size and stride is taken - * to begin at an array element described by the previous dimension. The - * size array and stride array must be the same size. - * - * For example, if you have offset==3, stride[0]==11, size[1]==3, - * stride[1]==3, then slice[0,0]==array[3], slice[0,1]==array[6], - * slice[0,2]==array[9], slice[1,0]==array[14], slice[1,1]==array[17], - * slice[1,2]==array[20]. - */ - class gslice - { - public: - /// Construct an empty slice. - gslice(); - - /** - * @brief Construct a slice. - * - * Constructs a slice with as many dimensions as the length of the @a l - * and @a s arrays. - * - * @param __o Offset in array of first element. - * @param __l Array of dimension lengths. - * @param __s Array of dimension strides between array elements. - */ - gslice(size_t __o, const valarray& __l, - const valarray& __s); - - // XXX: the IS says the copy-ctor and copy-assignment operators are - // synthesized by the compiler but they are just unsuitable - // for a ref-counted semantic - /// Copy constructor. - gslice(const gslice&); - - /// Destructor. - ~gslice(); - - // XXX: See the note above. - /// Assignment operator. - gslice& operator=(const gslice&); - - /// Return array offset of first slice element. - size_t start() const; - - /// Return array of sizes of slice dimensions. - valarray size() const; - - /// Return array of array strides for each dimension. - valarray stride() const; - - private: - struct _Indexer - { - size_t _M_count; - size_t _M_start; - valarray _M_size; - valarray _M_stride; - valarray _M_index; // Linear array of referenced indices - - _Indexer() - : _M_count(1), _M_start(0), _M_size(), _M_stride(), _M_index() {} - - _Indexer(size_t, const valarray&, - const valarray&); - - void - _M_increment_use() - { ++_M_count; } - - size_t - _M_decrement_use() - { return --_M_count; } - }; - - _Indexer* _M_index; - - template friend class valarray; - }; - - inline size_t - gslice::start() const - { return _M_index ? _M_index->_M_start : 0; } - - inline valarray - gslice::size() const - { return _M_index ? _M_index->_M_size : valarray(); } - - inline valarray - gslice::stride() const - { return _M_index ? _M_index->_M_stride : valarray(); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 543. valarray slice default constructor - inline - gslice::gslice() - : _M_index(new gslice::_Indexer()) {} - - inline - gslice::gslice(size_t __o, const valarray& __l, - const valarray& __s) - : _M_index(new gslice::_Indexer(__o, __l, __s)) {} - - inline - gslice::gslice(const gslice& __g) - : _M_index(__g._M_index) - { if (_M_index) _M_index->_M_increment_use(); } - - inline - gslice::~gslice() - { - if (_M_index && _M_index->_M_decrement_use() == 0) - delete _M_index; - } - - inline gslice& - gslice::operator=(const gslice& __g) - { - if (__g._M_index) - __g._M_index->_M_increment_use(); - if (_M_index && _M_index->_M_decrement_use() == 0) - delete _M_index; - _M_index = __g._M_index; - return *this; - } - - // @} group numeric_arrays - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _GSLICE_H */ diff --git a/openflow/usr/include/c++/5/bits/gslice_array.h b/openflow/usr/include/c++/5/bits/gslice_array.h deleted file mode 100644 index e5df385..0000000 --- a/openflow/usr/include/c++/5/bits/gslice_array.h +++ /dev/null @@ -1,218 +0,0 @@ -// The template and inlines for the -*- C++ -*- gslice_array class. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/gslice_array.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{valarray} - */ - -// Written by Gabriel Dos Reis - -#ifndef _GSLICE_ARRAY_H -#define _GSLICE_ARRAY_H 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup numeric_arrays - * @{ - */ - - /** - * @brief Reference to multi-dimensional subset of an array. - * - * A gslice_array is a reference to the actual elements of an array - * specified by a gslice. The way to get a gslice_array is to call - * operator[](gslice) on a valarray. The returned gslice_array then - * permits carrying operations out on the referenced subset of elements in - * the original valarray. For example, operator+=(valarray) will add - * values to the subset of elements in the underlying valarray this - * gslice_array refers to. - * - * @param Tp Element type. - */ - template - class gslice_array - { - public: - typedef _Tp value_type; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 253. valarray helper functions are almost entirely useless - - /// Copy constructor. Both slices refer to the same underlying array. - gslice_array(const gslice_array&); - - /// Assignment operator. Assigns slice elements to corresponding - /// elements of @a a. - gslice_array& operator=(const gslice_array&); - - /// Assign slice elements to corresponding elements of @a v. - void operator=(const valarray<_Tp>&) const; - /// Multiply slice elements by corresponding elements of @a v. - void operator*=(const valarray<_Tp>&) const; - /// Divide slice elements by corresponding elements of @a v. - void operator/=(const valarray<_Tp>&) const; - /// Modulo slice elements by corresponding elements of @a v. - void operator%=(const valarray<_Tp>&) const; - /// Add corresponding elements of @a v to slice elements. - void operator+=(const valarray<_Tp>&) const; - /// Subtract corresponding elements of @a v from slice elements. - void operator-=(const valarray<_Tp>&) const; - /// Logical xor slice elements with corresponding elements of @a v. - void operator^=(const valarray<_Tp>&) const; - /// Logical and slice elements with corresponding elements of @a v. - void operator&=(const valarray<_Tp>&) const; - /// Logical or slice elements with corresponding elements of @a v. - void operator|=(const valarray<_Tp>&) const; - /// Left shift slice elements by corresponding elements of @a v. - void operator<<=(const valarray<_Tp>&) const; - /// Right shift slice elements by corresponding elements of @a v. - void operator>>=(const valarray<_Tp>&) const; - /// Assign all slice elements to @a t. - void operator=(const _Tp&) const; - - template - void operator=(const _Expr<_Dom, _Tp>&) const; - template - void operator*=(const _Expr<_Dom, _Tp>&) const; - template - void operator/=(const _Expr<_Dom, _Tp>&) const; - template - void operator%=(const _Expr<_Dom, _Tp>&) const; - template - void operator+=(const _Expr<_Dom, _Tp>&) const; - template - void operator-=(const _Expr<_Dom, _Tp>&) const; - template - void operator^=(const _Expr<_Dom, _Tp>&) const; - template - void operator&=(const _Expr<_Dom, _Tp>&) const; - template - void operator|=(const _Expr<_Dom, _Tp>&) const; - template - void operator<<=(const _Expr<_Dom, _Tp>&) const; - template - void operator>>=(const _Expr<_Dom, _Tp>&) const; - - private: - _Array<_Tp> _M_array; - const valarray& _M_index; - - friend class valarray<_Tp>; - - gslice_array(_Array<_Tp>, const valarray&); - - // not implemented - gslice_array(); - }; - - template - inline - gslice_array<_Tp>::gslice_array(_Array<_Tp> __a, - const valarray& __i) - : _M_array(__a), _M_index(__i) {} - - template - inline - gslice_array<_Tp>::gslice_array(const gslice_array<_Tp>& __a) - : _M_array(__a._M_array), _M_index(__a._M_index) {} - - template - inline gslice_array<_Tp>& - gslice_array<_Tp>::operator=(const gslice_array<_Tp>& __a) - { - std::__valarray_copy(_Array<_Tp>(__a._M_array), - _Array(__a._M_index), _M_index.size(), - _M_array, _Array(_M_index)); - return *this; - } - - template - inline void - gslice_array<_Tp>::operator=(const _Tp& __t) const - { - std::__valarray_fill(_M_array, _Array(_M_index), - _M_index.size(), __t); - } - - template - inline void - gslice_array<_Tp>::operator=(const valarray<_Tp>& __v) const - { - std::__valarray_copy(_Array<_Tp>(__v), __v.size(), - _M_array, _Array(_M_index)); - } - - template - template - inline void - gslice_array<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) const - { - std::__valarray_copy (__e, _M_index.size(), _M_array, - _Array(_M_index)); - } - -#undef _DEFINE_VALARRAY_OPERATOR -#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \ - template \ - inline void \ - gslice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \ - { \ - _Array_augmented_##_Name(_M_array, _Array(_M_index), \ - _Array<_Tp>(__v), __v.size()); \ - } \ - \ - template \ - template \ - inline void \ - gslice_array<_Tp>::operator _Op##= (const _Expr<_Dom, _Tp>& __e) const\ - { \ - _Array_augmented_##_Name(_M_array, _Array(_M_index), __e,\ - _M_index.size()); \ - } - -_DEFINE_VALARRAY_OPERATOR(*, __multiplies) -_DEFINE_VALARRAY_OPERATOR(/, __divides) -_DEFINE_VALARRAY_OPERATOR(%, __modulus) -_DEFINE_VALARRAY_OPERATOR(+, __plus) -_DEFINE_VALARRAY_OPERATOR(-, __minus) -_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor) -_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and) -_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or) -_DEFINE_VALARRAY_OPERATOR(<<, __shift_left) -_DEFINE_VALARRAY_OPERATOR(>>, __shift_right) - -#undef _DEFINE_VALARRAY_OPERATOR - - // @} group numeric_arrays - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _GSLICE_ARRAY_H */ diff --git a/openflow/usr/include/c++/5/bits/hash_bytes.h b/openflow/usr/include/c++/5/bits/hash_bytes.h deleted file mode 100644 index 91214c0..0000000 --- a/openflow/usr/include/c++/5/bits/hash_bytes.h +++ /dev/null @@ -1,59 +0,0 @@ -// Declarations for hash functions. -*- C++ -*- - -// Copyright (C) 2010-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/hash_bytes.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{functional} - */ - -#ifndef _HASH_BYTES_H -#define _HASH_BYTES_H 1 - -#pragma GCC system_header - -#include - -namespace std -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Hash function implementation for the nontrivial specialization. - // All of them are based on a primitive that hashes a pointer to a - // byte array. The actual hash algorithm is not guaranteed to stay - // the same from release to release -- it may be updated or tuned to - // improve hash quality or speed. - size_t - _Hash_bytes(const void* __ptr, size_t __len, size_t __seed); - - // A similar hash primitive, using the FNV hash algorithm. This - // algorithm is guaranteed to stay the same from release to release. - // (although it might not produce the same values on different - // machines.) - size_t - _Fnv_hash_bytes(const void* __ptr, size_t __len, size_t __seed); - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/bits/hashtable.h b/openflow/usr/include/c++/5/bits/hashtable.h deleted file mode 100644 index f5f298e..0000000 --- a/openflow/usr/include/c++/5/bits/hashtable.h +++ /dev/null @@ -1,2097 +0,0 @@ -// hashtable.h header -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/hashtable.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{unordered_map, unordered_set} - */ - -#ifndef _HASHTABLE_H -#define _HASHTABLE_H 1 - -#pragma GCC system_header - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - using __cache_default - = __not_<__and_, - // Mandatory to have erase not throwing. - __detail::__is_noexcept_hash<_Tp, _Hash>>>; - - /** - * Primary class template _Hashtable. - * - * @ingroup hashtable-detail - * - * @tparam _Value CopyConstructible type. - * - * @tparam _Key CopyConstructible type. - * - * @tparam _Alloc An allocator type - * ([lib.allocator.requirements]) whose _Alloc::value_type is - * _Value. As a conforming extension, we allow for - * _Alloc::value_type != _Value. - * - * @tparam _ExtractKey Function object that takes an object of type - * _Value and returns a value of type _Key. - * - * @tparam _Equal Function object that takes two objects of type k - * and returns a bool-like value that is true if the two objects - * are considered equal. - * - * @tparam _H1 The hash function. A unary function object with - * argument type _Key and result type size_t. Return values should - * be distributed over the entire range [0, numeric_limits:::max()]. - * - * @tparam _H2 The range-hashing function (in the terminology of - * Tavori and Dreizin). A binary function object whose argument - * types and result type are all size_t. Given arguments r and N, - * the return value is in the range [0, N). - * - * @tparam _Hash The ranged hash function (Tavori and Dreizin). A - * binary function whose argument types are _Key and size_t and - * whose result type is size_t. Given arguments k and N, the - * return value is in the range [0, N). Default: hash(k, N) = - * h2(h1(k), N). If _Hash is anything other than the default, _H1 - * and _H2 are ignored. - * - * @tparam _RehashPolicy Policy class with three members, all of - * which govern the bucket count. _M_next_bkt(n) returns a bucket - * count no smaller than n. _M_bkt_for_elements(n) returns a - * bucket count appropriate for an element count of n. - * _M_need_rehash(n_bkt, n_elt, n_ins) determines whether, if the - * current bucket count is n_bkt and the current element count is - * n_elt, we need to increase the bucket count. If so, returns - * make_pair(true, n), where n is the new bucket count. If not, - * returns make_pair(false, ) - * - * @tparam _Traits Compile-time class with three boolean - * std::integral_constant members: __cache_hash_code, __constant_iterators, - * __unique_keys. - * - * Each _Hashtable data structure has: - * - * - _Bucket[] _M_buckets - * - _Hash_node_base _M_before_begin - * - size_type _M_bucket_count - * - size_type _M_element_count - * - * with _Bucket being _Hash_node* and _Hash_node containing: - * - * - _Hash_node* _M_next - * - Tp _M_value - * - size_t _M_hash_code if cache_hash_code is true - * - * In terms of Standard containers the hashtable is like the aggregation of: - * - * - std::forward_list<_Node> containing the elements - * - std::vector::iterator> representing the buckets - * - * The non-empty buckets contain the node before the first node in the - * bucket. This design makes it possible to implement something like a - * std::forward_list::insert_after on container insertion and - * std::forward_list::erase_after on container erase - * calls. _M_before_begin is equivalent to - * std::forward_list::before_begin. Empty buckets contain - * nullptr. Note that one of the non-empty buckets contains - * &_M_before_begin which is not a dereferenceable node so the - * node pointer in a bucket shall never be dereferenced, only its - * next node can be. - * - * Walking through a bucket's nodes requires a check on the hash code to - * see if each node is still in the bucket. Such a design assumes a - * quite efficient hash functor and is one of the reasons it is - * highly advisable to set __cache_hash_code to true. - * - * The container iterators are simply built from nodes. This way - * incrementing the iterator is perfectly efficient independent of - * how many empty buckets there are in the container. - * - * On insert we compute the element's hash code and use it to find the - * bucket index. If the element must be inserted in an empty bucket - * we add it at the beginning of the singly linked list and make the - * bucket point to _M_before_begin. The bucket that used to point to - * _M_before_begin, if any, is updated to point to its new before - * begin node. - * - * On erase, the simple iterator design requires using the hash - * functor to get the index of the bucket to update. For this - * reason, when __cache_hash_code is set to false the hash functor must - * not throw and this is enforced by a static assertion. - * - * Functionality is implemented by decomposition into base classes, - * where the derived _Hashtable class is used in _Map_base, - * _Insert, _Rehash_base, and _Equality base classes to access the - * "this" pointer. _Hashtable_base is used in the base classes as a - * non-recursive, fully-completed-type so that detailed nested type - * information, such as iterator type and node type, can be - * used. This is similar to the "Curiously Recurring Template - * Pattern" (CRTP) technique, but uses a reconstructed, not - * explicitly passed, template pattern. - * - * Base class templates are: - * - __detail::_Hashtable_base - * - __detail::_Map_base - * - __detail::_Insert - * - __detail::_Rehash_base - * - __detail::_Equality - */ - template - class _Hashtable - : public __detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, - _H1, _H2, _Hash, _Traits>, - public __detail::_Map_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>, - public __detail::_Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>, - public __detail::_Rehash_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>, - public __detail::_Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>, - private __detail::_Hashtable_alloc< - typename __alloctr_rebind<_Alloc, - __detail::_Hash_node<_Value, - _Traits::__hash_cached::value> >::__type> - { - using __traits_type = _Traits; - using __hash_cached = typename __traits_type::__hash_cached; - using __node_type = __detail::_Hash_node<_Value, __hash_cached::value>; - using __node_alloc_type = - typename __alloctr_rebind<_Alloc, __node_type>::__type; - - using __hashtable_alloc = __detail::_Hashtable_alloc<__node_alloc_type>; - - using __value_alloc_traits = - typename __hashtable_alloc::__value_alloc_traits; - using __node_alloc_traits = - typename __hashtable_alloc::__node_alloc_traits; - using __node_base = typename __hashtable_alloc::__node_base; - using __bucket_type = typename __hashtable_alloc::__bucket_type; - - public: - typedef _Key key_type; - typedef _Value value_type; - typedef _Alloc allocator_type; - typedef _Equal key_equal; - - // mapped_type, if present, comes from _Map_base. - // hasher, if present, comes from _Hash_code_base/_Hashtable_base. - typedef typename __value_alloc_traits::pointer pointer; - typedef typename __value_alloc_traits::const_pointer const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - private: - using __rehash_type = _RehashPolicy; - using __rehash_state = typename __rehash_type::_State; - - using __constant_iterators = typename __traits_type::__constant_iterators; - using __unique_keys = typename __traits_type::__unique_keys; - - using __key_extract = typename std::conditional< - __constant_iterators::value, - __detail::_Identity, - __detail::_Select1st>::type; - - using __hashtable_base = __detail:: - _Hashtable_base<_Key, _Value, _ExtractKey, - _Equal, _H1, _H2, _Hash, _Traits>; - - using __hash_code_base = typename __hashtable_base::__hash_code_base; - using __hash_code = typename __hashtable_base::__hash_code; - using __ireturn_type = typename __hashtable_base::__ireturn_type; - - using __map_base = __detail::_Map_base<_Key, _Value, _Alloc, _ExtractKey, - _Equal, _H1, _H2, _Hash, - _RehashPolicy, _Traits>; - - using __rehash_base = __detail::_Rehash_base<_Key, _Value, _Alloc, - _ExtractKey, _Equal, - _H1, _H2, _Hash, - _RehashPolicy, _Traits>; - - using __eq_base = __detail::_Equality<_Key, _Value, _Alloc, _ExtractKey, - _Equal, _H1, _H2, _Hash, - _RehashPolicy, _Traits>; - - using __reuse_or_alloc_node_type = - __detail::_ReuseOrAllocNode<__node_alloc_type>; - - // Metaprogramming for picking apart hash caching. - template - using __if_hash_cached = __or_<__not_<__hash_cached>, _Cond>; - - template - using __if_hash_not_cached = __or_<__hash_cached, _Cond>; - - // Compile-time diagnostics. - - // _Hash_code_base has everything protected, so use this derived type to - // access it. - struct __hash_code_base_access : __hash_code_base - { using __hash_code_base::_M_bucket_index; }; - - // Getting a bucket index from a node shall not throw because it is used - // in methods (erase, swap...) that shall not throw. - static_assert(noexcept(declval() - ._M_bucket_index((const __node_type*)nullptr, - (std::size_t)0)), - "Cache the hash code or qualify your functors involved" - " in hash code and bucket index computation with noexcept"); - - // Following two static assertions are necessary to guarantee - // that local_iterator will be default constructible. - - // When hash codes are cached local iterator inherits from H2 functor - // which must then be default constructible. - static_assert(__if_hash_cached>::value, - "Functor used to map hash code to bucket index" - " must be default constructible"); - - template - friend struct __detail::_Map_base; - - template - friend struct __detail::_Insert_base; - - template - friend struct __detail::_Insert; - - public: - using size_type = typename __hashtable_base::size_type; - using difference_type = typename __hashtable_base::difference_type; - - using iterator = typename __hashtable_base::iterator; - using const_iterator = typename __hashtable_base::const_iterator; - - using local_iterator = typename __hashtable_base::local_iterator; - using const_local_iterator = typename __hashtable_base:: - const_local_iterator; - - private: - __bucket_type* _M_buckets = &_M_single_bucket; - size_type _M_bucket_count = 1; - __node_base _M_before_begin; - size_type _M_element_count = 0; - _RehashPolicy _M_rehash_policy; - - // A single bucket used when only need for 1 bucket. Especially - // interesting in move semantic to leave hashtable with only 1 buckets - // which is not allocated so that we can have those operations noexcept - // qualified. - // Note that we can't leave hashtable with 0 bucket without adding - // numerous checks in the code to avoid 0 modulus. - __bucket_type _M_single_bucket = nullptr; - - bool - _M_uses_single_bucket(__bucket_type* __bkts) const - { return __builtin_expect(__bkts == &_M_single_bucket, false); } - - bool - _M_uses_single_bucket() const - { return _M_uses_single_bucket(_M_buckets); } - - __hashtable_alloc& - _M_base_alloc() { return *this; } - - __bucket_type* - _M_allocate_buckets(size_type __n) - { - if (__builtin_expect(__n == 1, false)) - { - _M_single_bucket = nullptr; - return &_M_single_bucket; - } - - return __hashtable_alloc::_M_allocate_buckets(__n); - } - - void - _M_deallocate_buckets(__bucket_type* __bkts, size_type __n) - { - if (_M_uses_single_bucket(__bkts)) - return; - - __hashtable_alloc::_M_deallocate_buckets(__bkts, __n); - } - - void - _M_deallocate_buckets() - { _M_deallocate_buckets(_M_buckets, _M_bucket_count); } - - // Gets bucket begin, deals with the fact that non-empty buckets contain - // their before begin node. - __node_type* - _M_bucket_begin(size_type __bkt) const; - - __node_type* - _M_begin() const - { return static_cast<__node_type*>(_M_before_begin._M_nxt); } - - template - void - _M_assign(const _Hashtable&, const _NodeGenerator&); - - void - _M_move_assign(_Hashtable&&, std::true_type); - - void - _M_move_assign(_Hashtable&&, std::false_type); - - void - _M_reset() noexcept; - - _Hashtable(const _H1& __h1, const _H2& __h2, const _Hash& __h, - const _Equal& __eq, const _ExtractKey& __exk, - const allocator_type& __a) - : __hashtable_base(__exk, __h1, __h2, __h, __eq), - __hashtable_alloc(__node_alloc_type(__a)) - { } - - public: - // Constructor, destructor, assignment, swap - _Hashtable() = default; - _Hashtable(size_type __bucket_hint, - const _H1&, const _H2&, const _Hash&, - const _Equal&, const _ExtractKey&, - const allocator_type&); - - template - _Hashtable(_InputIterator __first, _InputIterator __last, - size_type __bucket_hint, - const _H1&, const _H2&, const _Hash&, - const _Equal&, const _ExtractKey&, - const allocator_type&); - - _Hashtable(const _Hashtable&); - - _Hashtable(_Hashtable&&) noexcept; - - _Hashtable(const _Hashtable&, const allocator_type&); - - _Hashtable(_Hashtable&&, const allocator_type&); - - // Use delegating constructors. - explicit - _Hashtable(const allocator_type& __a) - : __hashtable_alloc(__node_alloc_type(__a)) - { } - - explicit - _Hashtable(size_type __n, - const _H1& __hf = _H1(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Hashtable(__n, __hf, _H2(), _Hash(), __eql, - __key_extract(), __a) - { } - - template - _Hashtable(_InputIterator __f, _InputIterator __l, - size_type __n = 0, - const _H1& __hf = _H1(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Hashtable(__f, __l, __n, __hf, _H2(), _Hash(), __eql, - __key_extract(), __a) - { } - - _Hashtable(initializer_list __l, - size_type __n = 0, - const _H1& __hf = _H1(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Hashtable(__l.begin(), __l.end(), __n, __hf, _H2(), _Hash(), __eql, - __key_extract(), __a) - { } - - _Hashtable& - operator=(const _Hashtable& __ht); - - _Hashtable& - operator=(_Hashtable&& __ht) - noexcept(__node_alloc_traits::_S_nothrow_move()) - { - constexpr bool __move_storage = - __node_alloc_traits::_S_propagate_on_move_assign() - || __node_alloc_traits::_S_always_equal(); - _M_move_assign(std::move(__ht), - integral_constant()); - return *this; - } - - _Hashtable& - operator=(initializer_list __l) - { - __reuse_or_alloc_node_type __roan(_M_begin(), *this); - _M_before_begin._M_nxt = nullptr; - clear(); - this->_M_insert_range(__l.begin(), __l.end(), __roan); - return *this; - } - - ~_Hashtable() noexcept; - - void - swap(_Hashtable&) - noexcept(__node_alloc_traits::_S_nothrow_swap()); - - // Basic container operations - iterator - begin() noexcept - { return iterator(_M_begin()); } - - const_iterator - begin() const noexcept - { return const_iterator(_M_begin()); } - - iterator - end() noexcept - { return iterator(nullptr); } - - const_iterator - end() const noexcept - { return const_iterator(nullptr); } - - const_iterator - cbegin() const noexcept - { return const_iterator(_M_begin()); } - - const_iterator - cend() const noexcept - { return const_iterator(nullptr); } - - size_type - size() const noexcept - { return _M_element_count; } - - bool - empty() const noexcept - { return size() == 0; } - - allocator_type - get_allocator() const noexcept - { return allocator_type(this->_M_node_allocator()); } - - size_type - max_size() const noexcept - { return __node_alloc_traits::max_size(this->_M_node_allocator()); } - - // Observers - key_equal - key_eq() const - { return this->_M_eq(); } - - // hash_function, if present, comes from _Hash_code_base. - - // Bucket operations - size_type - bucket_count() const noexcept - { return _M_bucket_count; } - - size_type - max_bucket_count() const noexcept - { return max_size(); } - - size_type - bucket_size(size_type __n) const - { return std::distance(begin(__n), end(__n)); } - - size_type - bucket(const key_type& __k) const - { return _M_bucket_index(__k, this->_M_hash_code(__k)); } - - local_iterator - begin(size_type __n) - { - return local_iterator(*this, _M_bucket_begin(__n), - __n, _M_bucket_count); - } - - local_iterator - end(size_type __n) - { return local_iterator(*this, nullptr, __n, _M_bucket_count); } - - const_local_iterator - begin(size_type __n) const - { - return const_local_iterator(*this, _M_bucket_begin(__n), - __n, _M_bucket_count); - } - - const_local_iterator - end(size_type __n) const - { return const_local_iterator(*this, nullptr, __n, _M_bucket_count); } - - // DR 691. - const_local_iterator - cbegin(size_type __n) const - { - return const_local_iterator(*this, _M_bucket_begin(__n), - __n, _M_bucket_count); - } - - const_local_iterator - cend(size_type __n) const - { return const_local_iterator(*this, nullptr, __n, _M_bucket_count); } - - float - load_factor() const noexcept - { - return static_cast(size()) / static_cast(bucket_count()); - } - - // max_load_factor, if present, comes from _Rehash_base. - - // Generalization of max_load_factor. Extension, not found in - // TR1. Only useful if _RehashPolicy is something other than - // the default. - const _RehashPolicy& - __rehash_policy() const - { return _M_rehash_policy; } - - void - __rehash_policy(const _RehashPolicy&); - - // Lookup. - iterator - find(const key_type& __k); - - const_iterator - find(const key_type& __k) const; - - size_type - count(const key_type& __k) const; - - std::pair - equal_range(const key_type& __k); - - std::pair - equal_range(const key_type& __k) const; - - protected: - // Bucket index computation helpers. - size_type - _M_bucket_index(__node_type* __n) const noexcept - { return __hash_code_base::_M_bucket_index(__n, _M_bucket_count); } - - size_type - _M_bucket_index(const key_type& __k, __hash_code __c) const - { return __hash_code_base::_M_bucket_index(__k, __c, _M_bucket_count); } - - // Find and insert helper functions and types - // Find the node before the one matching the criteria. - __node_base* - _M_find_before_node(size_type, const key_type&, __hash_code) const; - - __node_type* - _M_find_node(size_type __bkt, const key_type& __key, - __hash_code __c) const - { - __node_base* __before_n = _M_find_before_node(__bkt, __key, __c); - if (__before_n) - return static_cast<__node_type*>(__before_n->_M_nxt); - return nullptr; - } - - // Insert a node at the beginning of a bucket. - void - _M_insert_bucket_begin(size_type, __node_type*); - - // Remove the bucket first node - void - _M_remove_bucket_begin(size_type __bkt, __node_type* __next_n, - size_type __next_bkt); - - // Get the node before __n in the bucket __bkt - __node_base* - _M_get_previous_node(size_type __bkt, __node_base* __n); - - // Insert node with hash code __code, in bucket bkt if no rehash (assumes - // no element with its key already present). Take ownership of the node, - // deallocate it on exception. - iterator - _M_insert_unique_node(size_type __bkt, __hash_code __code, - __node_type* __n); - - // Insert node with hash code __code. Take ownership of the node, - // deallocate it on exception. - iterator - _M_insert_multi_node(__node_type* __hint, - __hash_code __code, __node_type* __n); - - template - std::pair - _M_emplace(std::true_type, _Args&&... __args); - - template - iterator - _M_emplace(std::false_type __uk, _Args&&... __args) - { return _M_emplace(cend(), __uk, std::forward<_Args>(__args)...); } - - // Emplace with hint, useless when keys are unique. - template - iterator - _M_emplace(const_iterator, std::true_type __uk, _Args&&... __args) - { return _M_emplace(__uk, std::forward<_Args>(__args)...).first; } - - template - iterator - _M_emplace(const_iterator, std::false_type, _Args&&... __args); - - template - std::pair - _M_insert(_Arg&&, const _NodeGenerator&, std::true_type); - - template - iterator - _M_insert(_Arg&& __arg, const _NodeGenerator& __node_gen, - std::false_type __uk) - { - return _M_insert(cend(), std::forward<_Arg>(__arg), __node_gen, - __uk); - } - - // Insert with hint, not used when keys are unique. - template - iterator - _M_insert(const_iterator, _Arg&& __arg, - const _NodeGenerator& __node_gen, std::true_type __uk) - { - return - _M_insert(std::forward<_Arg>(__arg), __node_gen, __uk).first; - } - - // Insert with hint when keys are not unique. - template - iterator - _M_insert(const_iterator, _Arg&&, - const _NodeGenerator&, std::false_type); - - size_type - _M_erase(std::true_type, const key_type&); - - size_type - _M_erase(std::false_type, const key_type&); - - iterator - _M_erase(size_type __bkt, __node_base* __prev_n, __node_type* __n); - - public: - // Emplace - template - __ireturn_type - emplace(_Args&&... __args) - { return _M_emplace(__unique_keys(), std::forward<_Args>(__args)...); } - - template - iterator - emplace_hint(const_iterator __hint, _Args&&... __args) - { - return _M_emplace(__hint, __unique_keys(), - std::forward<_Args>(__args)...); - } - - // Insert member functions via inheritance. - - // Erase - iterator - erase(const_iterator); - - // LWG 2059. - iterator - erase(iterator __it) - { return erase(const_iterator(__it)); } - - size_type - erase(const key_type& __k) - { return _M_erase(__unique_keys(), __k); } - - iterator - erase(const_iterator, const_iterator); - - void - clear() noexcept; - - // Set number of buckets to be appropriate for container of n element. - void rehash(size_type __n); - - // DR 1189. - // reserve, if present, comes from _Rehash_base. - - private: - // Helper rehash method used when keys are unique. - void _M_rehash_aux(size_type __n, std::true_type); - - // Helper rehash method used when keys can be non-unique. - void _M_rehash_aux(size_type __n, std::false_type); - - // Unconditionally change size of bucket array to n, restore - // hash policy state to __state on exception. - void _M_rehash(size_type __n, const __rehash_state& __state); - }; - - - // Definitions of class template _Hashtable's out-of-line member functions. - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_bucket_begin(size_type __bkt) const - -> __node_type* - { - __node_base* __n = _M_buckets[__bkt]; - return __n ? static_cast<__node_type*>(__n->_M_nxt) : nullptr; - } - - template - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _Hashtable(size_type __bucket_hint, - const _H1& __h1, const _H2& __h2, const _Hash& __h, - const _Equal& __eq, const _ExtractKey& __exk, - const allocator_type& __a) - : _Hashtable(__h1, __h2, __h, __eq, __exk, __a) - { - auto __bkt = _M_rehash_policy._M_next_bkt(__bucket_hint); - if (__bkt > _M_bucket_count) - { - _M_buckets = _M_allocate_buckets(__bkt); - _M_bucket_count = __bkt; - } - } - - template - template - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _Hashtable(_InputIterator __f, _InputIterator __l, - size_type __bucket_hint, - const _H1& __h1, const _H2& __h2, const _Hash& __h, - const _Equal& __eq, const _ExtractKey& __exk, - const allocator_type& __a) - : _Hashtable(__h1, __h2, __h, __eq, __exk, __a) - { - auto __nb_elems = __detail::__distance_fw(__f, __l); - auto __bkt_count = - _M_rehash_policy._M_next_bkt( - std::max(_M_rehash_policy._M_bkt_for_elements(__nb_elems), - __bucket_hint)); - - if (__bkt_count > _M_bucket_count) - { - _M_buckets = _M_allocate_buckets(__bkt_count); - _M_bucket_count = __bkt_count; - } - - __try - { - for (; __f != __l; ++__f) - this->insert(*__f); - } - __catch(...) - { - clear(); - _M_deallocate_buckets(); - __throw_exception_again; - } - } - - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - operator=(const _Hashtable& __ht) - -> _Hashtable& - { - if (&__ht == this) - return *this; - - if (__node_alloc_traits::_S_propagate_on_copy_assign()) - { - auto& __this_alloc = this->_M_node_allocator(); - auto& __that_alloc = __ht._M_node_allocator(); - if (!__node_alloc_traits::_S_always_equal() - && __this_alloc != __that_alloc) - { - // Replacement allocator cannot free existing storage. - this->_M_deallocate_nodes(_M_begin()); - _M_before_begin._M_nxt = nullptr; - _M_deallocate_buckets(); - _M_buckets = nullptr; - std::__alloc_on_copy(__this_alloc, __that_alloc); - __hashtable_base::operator=(__ht); - _M_bucket_count = __ht._M_bucket_count; - _M_element_count = __ht._M_element_count; - _M_rehash_policy = __ht._M_rehash_policy; - __try - { - _M_assign(__ht, - [this](const __node_type* __n) - { return this->_M_allocate_node(__n->_M_v()); }); - } - __catch(...) - { - // _M_assign took care of deallocating all memory. Now we - // must make sure this instance remains in a usable state. - _M_reset(); - __throw_exception_again; - } - return *this; - } - std::__alloc_on_copy(__this_alloc, __that_alloc); - } - - // Reuse allocated buckets and nodes. - __bucket_type* __former_buckets = nullptr; - std::size_t __former_bucket_count = _M_bucket_count; - const __rehash_state& __former_state = _M_rehash_policy._M_state(); - - if (_M_bucket_count != __ht._M_bucket_count) - { - __former_buckets = _M_buckets; - _M_buckets = _M_allocate_buckets(__ht._M_bucket_count); - _M_bucket_count = __ht._M_bucket_count; - } - else - __builtin_memset(_M_buckets, 0, - _M_bucket_count * sizeof(__bucket_type)); - - __try - { - __hashtable_base::operator=(__ht); - _M_element_count = __ht._M_element_count; - _M_rehash_policy = __ht._M_rehash_policy; - __reuse_or_alloc_node_type __roan(_M_begin(), *this); - _M_before_begin._M_nxt = nullptr; - _M_assign(__ht, - [&__roan](const __node_type* __n) - { return __roan(__n->_M_v()); }); - if (__former_buckets) - _M_deallocate_buckets(__former_buckets, __former_bucket_count); - } - __catch(...) - { - if (__former_buckets) - { - // Restore previous buckets. - _M_deallocate_buckets(); - _M_rehash_policy._M_reset(__former_state); - _M_buckets = __former_buckets; - _M_bucket_count = __former_bucket_count; - } - __builtin_memset(_M_buckets, 0, - _M_bucket_count * sizeof(__bucket_type)); - __throw_exception_again; - } - return *this; - } - - template - template - void - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_assign(const _Hashtable& __ht, const _NodeGenerator& __node_gen) - { - __bucket_type* __buckets = nullptr; - if (!_M_buckets) - _M_buckets = __buckets = _M_allocate_buckets(_M_bucket_count); - - __try - { - if (!__ht._M_before_begin._M_nxt) - return; - - // First deal with the special first node pointed to by - // _M_before_begin. - __node_type* __ht_n = __ht._M_begin(); - __node_type* __this_n = __node_gen(__ht_n); - this->_M_copy_code(__this_n, __ht_n); - _M_before_begin._M_nxt = __this_n; - _M_buckets[_M_bucket_index(__this_n)] = &_M_before_begin; - - // Then deal with other nodes. - __node_base* __prev_n = __this_n; - for (__ht_n = __ht_n->_M_next(); __ht_n; __ht_n = __ht_n->_M_next()) - { - __this_n = __node_gen(__ht_n); - __prev_n->_M_nxt = __this_n; - this->_M_copy_code(__this_n, __ht_n); - size_type __bkt = _M_bucket_index(__this_n); - if (!_M_buckets[__bkt]) - _M_buckets[__bkt] = __prev_n; - __prev_n = __this_n; - } - } - __catch(...) - { - clear(); - if (__buckets) - _M_deallocate_buckets(); - __throw_exception_again; - } - } - - template - void - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_reset() noexcept - { - _M_rehash_policy._M_reset(); - _M_bucket_count = 1; - _M_single_bucket = nullptr; - _M_buckets = &_M_single_bucket; - _M_before_begin._M_nxt = nullptr; - _M_element_count = 0; - } - - template - void - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_move_assign(_Hashtable&& __ht, std::true_type) - { - this->_M_deallocate_nodes(_M_begin()); - _M_deallocate_buckets(); - __hashtable_base::operator=(std::move(__ht)); - _M_rehash_policy = __ht._M_rehash_policy; - if (!__ht._M_uses_single_bucket()) - _M_buckets = __ht._M_buckets; - else - { - _M_buckets = &_M_single_bucket; - _M_single_bucket = __ht._M_single_bucket; - } - _M_bucket_count = __ht._M_bucket_count; - _M_before_begin._M_nxt = __ht._M_before_begin._M_nxt; - _M_element_count = __ht._M_element_count; - std::__alloc_on_move(this->_M_node_allocator(), __ht._M_node_allocator()); - - // Fix buckets containing the _M_before_begin pointers that can't be - // moved. - if (_M_begin()) - _M_buckets[_M_bucket_index(_M_begin())] = &_M_before_begin; - __ht._M_reset(); - } - - template - void - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_move_assign(_Hashtable&& __ht, std::false_type) - { - if (__ht._M_node_allocator() == this->_M_node_allocator()) - _M_move_assign(std::move(__ht), std::true_type()); - else - { - // Can't move memory, move elements then. - __bucket_type* __former_buckets = nullptr; - size_type __former_bucket_count = _M_bucket_count; - const __rehash_state& __former_state = _M_rehash_policy._M_state(); - - if (_M_bucket_count != __ht._M_bucket_count) - { - __former_buckets = _M_buckets; - _M_buckets = _M_allocate_buckets(__ht._M_bucket_count); - _M_bucket_count = __ht._M_bucket_count; - } - else - __builtin_memset(_M_buckets, 0, - _M_bucket_count * sizeof(__bucket_type)); - - __try - { - __hashtable_base::operator=(std::move(__ht)); - _M_element_count = __ht._M_element_count; - _M_rehash_policy = __ht._M_rehash_policy; - __reuse_or_alloc_node_type __roan(_M_begin(), *this); - _M_before_begin._M_nxt = nullptr; - _M_assign(__ht, - [&__roan](__node_type* __n) - { return __roan(std::move_if_noexcept(__n->_M_v())); }); - __ht.clear(); - } - __catch(...) - { - if (__former_buckets) - { - _M_deallocate_buckets(); - _M_rehash_policy._M_reset(__former_state); - _M_buckets = __former_buckets; - _M_bucket_count = __former_bucket_count; - } - __builtin_memset(_M_buckets, 0, - _M_bucket_count * sizeof(__bucket_type)); - __throw_exception_again; - } - } - } - - template - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _Hashtable(const _Hashtable& __ht) - : __hashtable_base(__ht), - __map_base(__ht), - __rehash_base(__ht), - __hashtable_alloc( - __node_alloc_traits::_S_select_on_copy(__ht._M_node_allocator())), - _M_buckets(nullptr), - _M_bucket_count(__ht._M_bucket_count), - _M_element_count(__ht._M_element_count), - _M_rehash_policy(__ht._M_rehash_policy) - { - _M_assign(__ht, - [this](const __node_type* __n) - { return this->_M_allocate_node(__n->_M_v()); }); - } - - template - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _Hashtable(_Hashtable&& __ht) noexcept - : __hashtable_base(__ht), - __map_base(__ht), - __rehash_base(__ht), - __hashtable_alloc(std::move(__ht._M_base_alloc())), - _M_buckets(__ht._M_buckets), - _M_bucket_count(__ht._M_bucket_count), - _M_before_begin(__ht._M_before_begin._M_nxt), - _M_element_count(__ht._M_element_count), - _M_rehash_policy(__ht._M_rehash_policy) - { - // Update, if necessary, buckets if __ht is using its single bucket. - if (__ht._M_uses_single_bucket()) - { - _M_buckets = &_M_single_bucket; - _M_single_bucket = __ht._M_single_bucket; - } - - // Update, if necessary, bucket pointing to before begin that hasn't - // moved. - if (_M_begin()) - _M_buckets[_M_bucket_index(_M_begin())] = &_M_before_begin; - - __ht._M_reset(); - } - - template - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _Hashtable(const _Hashtable& __ht, const allocator_type& __a) - : __hashtable_base(__ht), - __map_base(__ht), - __rehash_base(__ht), - __hashtable_alloc(__node_alloc_type(__a)), - _M_buckets(), - _M_bucket_count(__ht._M_bucket_count), - _M_element_count(__ht._M_element_count), - _M_rehash_policy(__ht._M_rehash_policy) - { - _M_assign(__ht, - [this](const __node_type* __n) - { return this->_M_allocate_node(__n->_M_v()); }); - } - - template - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _Hashtable(_Hashtable&& __ht, const allocator_type& __a) - : __hashtable_base(__ht), - __map_base(__ht), - __rehash_base(__ht), - __hashtable_alloc(__node_alloc_type(__a)), - _M_buckets(nullptr), - _M_bucket_count(__ht._M_bucket_count), - _M_element_count(__ht._M_element_count), - _M_rehash_policy(__ht._M_rehash_policy) - { - if (__ht._M_node_allocator() == this->_M_node_allocator()) - { - if (__ht._M_uses_single_bucket()) - { - _M_buckets = &_M_single_bucket; - _M_single_bucket = __ht._M_single_bucket; - } - else - _M_buckets = __ht._M_buckets; - - _M_before_begin._M_nxt = __ht._M_before_begin._M_nxt; - // Update, if necessary, bucket pointing to before begin that hasn't - // moved. - if (_M_begin()) - _M_buckets[_M_bucket_index(_M_begin())] = &_M_before_begin; - __ht._M_reset(); - } - else - { - _M_assign(__ht, - [this](__node_type* __n) - { - return this->_M_allocate_node( - std::move_if_noexcept(__n->_M_v())); - }); - __ht.clear(); - } - } - - template - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - ~_Hashtable() noexcept - { - clear(); - _M_deallocate_buckets(); - } - - template - void - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - swap(_Hashtable& __x) - noexcept(__node_alloc_traits::_S_nothrow_swap()) - { - // The only base class with member variables is hash_code_base. - // We define _Hash_code_base::_M_swap because different - // specializations have different members. - this->_M_swap(__x); - - std::__alloc_on_swap(this->_M_node_allocator(), __x._M_node_allocator()); - std::swap(_M_rehash_policy, __x._M_rehash_policy); - - // Deal properly with potentially moved instances. - if (this->_M_uses_single_bucket()) - { - if (!__x._M_uses_single_bucket()) - { - _M_buckets = __x._M_buckets; - __x._M_buckets = &__x._M_single_bucket; - } - } - else if (__x._M_uses_single_bucket()) - { - __x._M_buckets = _M_buckets; - _M_buckets = &_M_single_bucket; - } - else - std::swap(_M_buckets, __x._M_buckets); - - std::swap(_M_bucket_count, __x._M_bucket_count); - std::swap(_M_before_begin._M_nxt, __x._M_before_begin._M_nxt); - std::swap(_M_element_count, __x._M_element_count); - std::swap(_M_single_bucket, __x._M_single_bucket); - - // Fix buckets containing the _M_before_begin pointers that can't be - // swapped. - if (_M_begin()) - _M_buckets[_M_bucket_index(_M_begin())] = &_M_before_begin; - - if (__x._M_begin()) - __x._M_buckets[__x._M_bucket_index(__x._M_begin())] - = &__x._M_before_begin; - } - - template - void - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - __rehash_policy(const _RehashPolicy& __pol) - { - auto __do_rehash = - __pol._M_need_rehash(_M_bucket_count, _M_element_count, 0); - if (__do_rehash.first) - _M_rehash(__do_rehash.second, _M_rehash_policy._M_state()); - _M_rehash_policy = __pol; - } - - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - find(const key_type& __k) - -> iterator - { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __n = _M_bucket_index(__k, __code); - __node_type* __p = _M_find_node(__n, __k, __code); - return __p ? iterator(__p) : end(); - } - - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - find(const key_type& __k) const - -> const_iterator - { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __n = _M_bucket_index(__k, __code); - __node_type* __p = _M_find_node(__n, __k, __code); - return __p ? const_iterator(__p) : end(); - } - - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - count(const key_type& __k) const - -> size_type - { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __n = _M_bucket_index(__k, __code); - __node_type* __p = _M_bucket_begin(__n); - if (!__p) - return 0; - - std::size_t __result = 0; - for (;; __p = __p->_M_next()) - { - if (this->_M_equals(__k, __code, __p)) - ++__result; - else if (__result) - // All equivalent values are next to each other, if we - // found a non-equivalent value after an equivalent one it - // means that we won't find any new equivalent value. - break; - if (!__p->_M_nxt || _M_bucket_index(__p->_M_next()) != __n) - break; - } - return __result; - } - - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - equal_range(const key_type& __k) - -> pair - { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __n = _M_bucket_index(__k, __code); - __node_type* __p = _M_find_node(__n, __k, __code); - - if (__p) - { - __node_type* __p1 = __p->_M_next(); - while (__p1 && _M_bucket_index(__p1) == __n - && this->_M_equals(__k, __code, __p1)) - __p1 = __p1->_M_next(); - - return std::make_pair(iterator(__p), iterator(__p1)); - } - else - return std::make_pair(end(), end()); - } - - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - equal_range(const key_type& __k) const - -> pair - { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __n = _M_bucket_index(__k, __code); - __node_type* __p = _M_find_node(__n, __k, __code); - - if (__p) - { - __node_type* __p1 = __p->_M_next(); - while (__p1 && _M_bucket_index(__p1) == __n - && this->_M_equals(__k, __code, __p1)) - __p1 = __p1->_M_next(); - - return std::make_pair(const_iterator(__p), const_iterator(__p1)); - } - else - return std::make_pair(end(), end()); - } - - // Find the node whose key compares equal to k in the bucket n. - // Return nullptr if no node is found. - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_find_before_node(size_type __n, const key_type& __k, - __hash_code __code) const - -> __node_base* - { - __node_base* __prev_p = _M_buckets[__n]; - if (!__prev_p) - return nullptr; - - for (__node_type* __p = static_cast<__node_type*>(__prev_p->_M_nxt);; - __p = __p->_M_next()) - { - if (this->_M_equals(__k, __code, __p)) - return __prev_p; - - if (!__p->_M_nxt || _M_bucket_index(__p->_M_next()) != __n) - break; - __prev_p = __p; - } - return nullptr; - } - - template - void - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_insert_bucket_begin(size_type __bkt, __node_type* __node) - { - if (_M_buckets[__bkt]) - { - // Bucket is not empty, we just need to insert the new node - // after the bucket before begin. - __node->_M_nxt = _M_buckets[__bkt]->_M_nxt; - _M_buckets[__bkt]->_M_nxt = __node; - } - else - { - // The bucket is empty, the new node is inserted at the - // beginning of the singly-linked list and the bucket will - // contain _M_before_begin pointer. - __node->_M_nxt = _M_before_begin._M_nxt; - _M_before_begin._M_nxt = __node; - if (__node->_M_nxt) - // We must update former begin bucket that is pointing to - // _M_before_begin. - _M_buckets[_M_bucket_index(__node->_M_next())] = __node; - _M_buckets[__bkt] = &_M_before_begin; - } - } - - template - void - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_remove_bucket_begin(size_type __bkt, __node_type* __next, - size_type __next_bkt) - { - if (!__next || __next_bkt != __bkt) - { - // Bucket is now empty - // First update next bucket if any - if (__next) - _M_buckets[__next_bkt] = _M_buckets[__bkt]; - - // Second update before begin node if necessary - if (&_M_before_begin == _M_buckets[__bkt]) - _M_before_begin._M_nxt = __next; - _M_buckets[__bkt] = nullptr; - } - } - - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_get_previous_node(size_type __bkt, __node_base* __n) - -> __node_base* - { - __node_base* __prev_n = _M_buckets[__bkt]; - while (__prev_n->_M_nxt != __n) - __prev_n = __prev_n->_M_nxt; - return __prev_n; - } - - template - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_emplace(std::true_type, _Args&&... __args) - -> pair - { - // First build the node to get access to the hash code - __node_type* __node = this->_M_allocate_node(std::forward<_Args>(__args)...); - const key_type& __k = this->_M_extract()(__node->_M_v()); - __hash_code __code; - __try - { - __code = this->_M_hash_code(__k); - } - __catch(...) - { - this->_M_deallocate_node(__node); - __throw_exception_again; - } - - size_type __bkt = _M_bucket_index(__k, __code); - if (__node_type* __p = _M_find_node(__bkt, __k, __code)) - { - // There is already an equivalent node, no insertion - this->_M_deallocate_node(__node); - return std::make_pair(iterator(__p), false); - } - - // Insert the node - return std::make_pair(_M_insert_unique_node(__bkt, __code, __node), - true); - } - - template - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_emplace(const_iterator __hint, std::false_type, _Args&&... __args) - -> iterator - { - // First build the node to get its hash code. - __node_type* __node = - this->_M_allocate_node(std::forward<_Args>(__args)...); - - __hash_code __code; - __try - { - __code = this->_M_hash_code(this->_M_extract()(__node->_M_v())); - } - __catch(...) - { - this->_M_deallocate_node(__node); - __throw_exception_again; - } - - return _M_insert_multi_node(__hint._M_cur, __code, __node); - } - - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_insert_unique_node(size_type __bkt, __hash_code __code, - __node_type* __node) - -> iterator - { - const __rehash_state& __saved_state = _M_rehash_policy._M_state(); - std::pair __do_rehash - = _M_rehash_policy._M_need_rehash(_M_bucket_count, _M_element_count, 1); - - __try - { - if (__do_rehash.first) - { - _M_rehash(__do_rehash.second, __saved_state); - __bkt = _M_bucket_index(this->_M_extract()(__node->_M_v()), __code); - } - - this->_M_store_code(__node, __code); - - // Always insert at the beginning of the bucket. - _M_insert_bucket_begin(__bkt, __node); - ++_M_element_count; - return iterator(__node); - } - __catch(...) - { - this->_M_deallocate_node(__node); - __throw_exception_again; - } - } - - // Insert node, in bucket bkt if no rehash (assumes no element with its key - // already present). Take ownership of the node, deallocate it on exception. - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_insert_multi_node(__node_type* __hint, __hash_code __code, - __node_type* __node) - -> iterator - { - const __rehash_state& __saved_state = _M_rehash_policy._M_state(); - std::pair __do_rehash - = _M_rehash_policy._M_need_rehash(_M_bucket_count, _M_element_count, 1); - - __try - { - if (__do_rehash.first) - _M_rehash(__do_rehash.second, __saved_state); - - this->_M_store_code(__node, __code); - const key_type& __k = this->_M_extract()(__node->_M_v()); - size_type __bkt = _M_bucket_index(__k, __code); - - // Find the node before an equivalent one or use hint if it exists and - // if it is equivalent. - __node_base* __prev - = __builtin_expect(__hint != nullptr, false) - && this->_M_equals(__k, __code, __hint) - ? __hint - : _M_find_before_node(__bkt, __k, __code); - if (__prev) - { - // Insert after the node before the equivalent one. - __node->_M_nxt = __prev->_M_nxt; - __prev->_M_nxt = __node; - if (__builtin_expect(__prev == __hint, false)) - // hint might be the last bucket node, in this case we need to - // update next bucket. - if (__node->_M_nxt - && !this->_M_equals(__k, __code, __node->_M_next())) - { - size_type __next_bkt = _M_bucket_index(__node->_M_next()); - if (__next_bkt != __bkt) - _M_buckets[__next_bkt] = __node; - } - } - else - // The inserted node has no equivalent in the - // hashtable. We must insert the new node at the - // beginning of the bucket to preserve equivalent - // elements' relative positions. - _M_insert_bucket_begin(__bkt, __node); - ++_M_element_count; - return iterator(__node); - } - __catch(...) - { - this->_M_deallocate_node(__node); - __throw_exception_again; - } - } - - // Insert v if no element with its key is already present. - template - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_insert(_Arg&& __v, const _NodeGenerator& __node_gen, std::true_type) - -> pair - { - const key_type& __k = this->_M_extract()(__v); - __hash_code __code = this->_M_hash_code(__k); - size_type __bkt = _M_bucket_index(__k, __code); - - __node_type* __n = _M_find_node(__bkt, __k, __code); - if (__n) - return std::make_pair(iterator(__n), false); - - __n = __node_gen(std::forward<_Arg>(__v)); - return std::make_pair(_M_insert_unique_node(__bkt, __code, __n), true); - } - - // Insert v unconditionally. - template - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_insert(const_iterator __hint, _Arg&& __v, - const _NodeGenerator& __node_gen, std::false_type) - -> iterator - { - // First compute the hash code so that we don't do anything if it - // throws. - __hash_code __code = this->_M_hash_code(this->_M_extract()(__v)); - - // Second allocate new node so that we don't rehash if it throws. - __node_type* __node = __node_gen(std::forward<_Arg>(__v)); - - return _M_insert_multi_node(__hint._M_cur, __code, __node); - } - - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - erase(const_iterator __it) - -> iterator - { - __node_type* __n = __it._M_cur; - std::size_t __bkt = _M_bucket_index(__n); - - // Look for previous node to unlink it from the erased one, this - // is why we need buckets to contain the before begin to make - // this search fast. - __node_base* __prev_n = _M_get_previous_node(__bkt, __n); - return _M_erase(__bkt, __prev_n, __n); - } - - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_erase(size_type __bkt, __node_base* __prev_n, __node_type* __n) - -> iterator - { - if (__prev_n == _M_buckets[__bkt]) - _M_remove_bucket_begin(__bkt, __n->_M_next(), - __n->_M_nxt ? _M_bucket_index(__n->_M_next()) : 0); - else if (__n->_M_nxt) - { - size_type __next_bkt = _M_bucket_index(__n->_M_next()); - if (__next_bkt != __bkt) - _M_buckets[__next_bkt] = __prev_n; - } - - __prev_n->_M_nxt = __n->_M_nxt; - iterator __result(__n->_M_next()); - this->_M_deallocate_node(__n); - --_M_element_count; - - return __result; - } - - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_erase(std::true_type, const key_type& __k) - -> size_type - { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __bkt = _M_bucket_index(__k, __code); - - // Look for the node before the first matching node. - __node_base* __prev_n = _M_find_before_node(__bkt, __k, __code); - if (!__prev_n) - return 0; - - // We found a matching node, erase it. - __node_type* __n = static_cast<__node_type*>(__prev_n->_M_nxt); - _M_erase(__bkt, __prev_n, __n); - return 1; - } - - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_erase(std::false_type, const key_type& __k) - -> size_type - { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __bkt = _M_bucket_index(__k, __code); - - // Look for the node before the first matching node. - __node_base* __prev_n = _M_find_before_node(__bkt, __k, __code); - if (!__prev_n) - return 0; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 526. Is it undefined if a function in the standard changes - // in parameters? - // We use one loop to find all matching nodes and another to deallocate - // them so that the key stays valid during the first loop. It might be - // invalidated indirectly when destroying nodes. - __node_type* __n = static_cast<__node_type*>(__prev_n->_M_nxt); - __node_type* __n_last = __n; - std::size_t __n_last_bkt = __bkt; - do - { - __n_last = __n_last->_M_next(); - if (!__n_last) - break; - __n_last_bkt = _M_bucket_index(__n_last); - } - while (__n_last_bkt == __bkt && this->_M_equals(__k, __code, __n_last)); - - // Deallocate nodes. - size_type __result = 0; - do - { - __node_type* __p = __n->_M_next(); - this->_M_deallocate_node(__n); - __n = __p; - ++__result; - --_M_element_count; - } - while (__n != __n_last); - - if (__prev_n == _M_buckets[__bkt]) - _M_remove_bucket_begin(__bkt, __n_last, __n_last_bkt); - else if (__n_last && __n_last_bkt != __bkt) - _M_buckets[__n_last_bkt] = __prev_n; - __prev_n->_M_nxt = __n_last; - return __result; - } - - template - auto - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - erase(const_iterator __first, const_iterator __last) - -> iterator - { - __node_type* __n = __first._M_cur; - __node_type* __last_n = __last._M_cur; - if (__n == __last_n) - return iterator(__n); - - std::size_t __bkt = _M_bucket_index(__n); - - __node_base* __prev_n = _M_get_previous_node(__bkt, __n); - bool __is_bucket_begin = __n == _M_bucket_begin(__bkt); - std::size_t __n_bkt = __bkt; - for (;;) - { - do - { - __node_type* __tmp = __n; - __n = __n->_M_next(); - this->_M_deallocate_node(__tmp); - --_M_element_count; - if (!__n) - break; - __n_bkt = _M_bucket_index(__n); - } - while (__n != __last_n && __n_bkt == __bkt); - if (__is_bucket_begin) - _M_remove_bucket_begin(__bkt, __n, __n_bkt); - if (__n == __last_n) - break; - __is_bucket_begin = true; - __bkt = __n_bkt; - } - - if (__n && (__n_bkt != __bkt || __is_bucket_begin)) - _M_buckets[__n_bkt] = __prev_n; - __prev_n->_M_nxt = __n; - return iterator(__n); - } - - template - void - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - clear() noexcept - { - this->_M_deallocate_nodes(_M_begin()); - __builtin_memset(_M_buckets, 0, _M_bucket_count * sizeof(__bucket_type)); - _M_element_count = 0; - _M_before_begin._M_nxt = nullptr; - } - - template - void - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - rehash(size_type __n) - { - const __rehash_state& __saved_state = _M_rehash_policy._M_state(); - std::size_t __buckets - = std::max(_M_rehash_policy._M_bkt_for_elements(_M_element_count + 1), - __n); - __buckets = _M_rehash_policy._M_next_bkt(__buckets); - - if (__buckets != _M_bucket_count) - _M_rehash(__buckets, __saved_state); - else - // No rehash, restore previous state to keep a consistent state. - _M_rehash_policy._M_reset(__saved_state); - } - - template - void - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_rehash(size_type __n, const __rehash_state& __state) - { - __try - { - _M_rehash_aux(__n, __unique_keys()); - } - __catch(...) - { - // A failure here means that buckets allocation failed. We only - // have to restore hash policy previous state. - _M_rehash_policy._M_reset(__state); - __throw_exception_again; - } - } - - // Rehash when there is no equivalent elements. - template - void - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_rehash_aux(size_type __n, std::true_type) - { - __bucket_type* __new_buckets = _M_allocate_buckets(__n); - __node_type* __p = _M_begin(); - _M_before_begin._M_nxt = nullptr; - std::size_t __bbegin_bkt = 0; - while (__p) - { - __node_type* __next = __p->_M_next(); - std::size_t __bkt = __hash_code_base::_M_bucket_index(__p, __n); - if (!__new_buckets[__bkt]) - { - __p->_M_nxt = _M_before_begin._M_nxt; - _M_before_begin._M_nxt = __p; - __new_buckets[__bkt] = &_M_before_begin; - if (__p->_M_nxt) - __new_buckets[__bbegin_bkt] = __p; - __bbegin_bkt = __bkt; - } - else - { - __p->_M_nxt = __new_buckets[__bkt]->_M_nxt; - __new_buckets[__bkt]->_M_nxt = __p; - } - __p = __next; - } - - _M_deallocate_buckets(); - _M_bucket_count = __n; - _M_buckets = __new_buckets; - } - - // Rehash when there can be equivalent elements, preserve their relative - // order. - template - void - _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _M_rehash_aux(size_type __n, std::false_type) - { - __bucket_type* __new_buckets = _M_allocate_buckets(__n); - - __node_type* __p = _M_begin(); - _M_before_begin._M_nxt = nullptr; - std::size_t __bbegin_bkt = 0; - std::size_t __prev_bkt = 0; - __node_type* __prev_p = nullptr; - bool __check_bucket = false; - - while (__p) - { - __node_type* __next = __p->_M_next(); - std::size_t __bkt = __hash_code_base::_M_bucket_index(__p, __n); - - if (__prev_p && __prev_bkt == __bkt) - { - // Previous insert was already in this bucket, we insert after - // the previously inserted one to preserve equivalent elements - // relative order. - __p->_M_nxt = __prev_p->_M_nxt; - __prev_p->_M_nxt = __p; - - // Inserting after a node in a bucket require to check that we - // haven't change the bucket last node, in this case next - // bucket containing its before begin node must be updated. We - // schedule a check as soon as we move out of the sequence of - // equivalent nodes to limit the number of checks. - __check_bucket = true; - } - else - { - if (__check_bucket) - { - // Check if we shall update the next bucket because of - // insertions into __prev_bkt bucket. - if (__prev_p->_M_nxt) - { - std::size_t __next_bkt - = __hash_code_base::_M_bucket_index(__prev_p->_M_next(), - __n); - if (__next_bkt != __prev_bkt) - __new_buckets[__next_bkt] = __prev_p; - } - __check_bucket = false; - } - - if (!__new_buckets[__bkt]) - { - __p->_M_nxt = _M_before_begin._M_nxt; - _M_before_begin._M_nxt = __p; - __new_buckets[__bkt] = &_M_before_begin; - if (__p->_M_nxt) - __new_buckets[__bbegin_bkt] = __p; - __bbegin_bkt = __bkt; - } - else - { - __p->_M_nxt = __new_buckets[__bkt]->_M_nxt; - __new_buckets[__bkt]->_M_nxt = __p; - } - } - __prev_p = __p; - __prev_bkt = __bkt; - __p = __next; - } - - if (__check_bucket && __prev_p->_M_nxt) - { - std::size_t __next_bkt - = __hash_code_base::_M_bucket_index(__prev_p->_M_next(), __n); - if (__next_bkt != __prev_bkt) - __new_buckets[__next_bkt] = __prev_p; - } - - _M_deallocate_buckets(); - _M_bucket_count = __n; - _M_buckets = __new_buckets; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif // _HASHTABLE_H diff --git a/openflow/usr/include/c++/5/bits/hashtable_policy.h b/openflow/usr/include/c++/5/bits/hashtable_policy.h deleted file mode 100644 index 14bcca6..0000000 --- a/openflow/usr/include/c++/5/bits/hashtable_policy.h +++ /dev/null @@ -1,2018 +0,0 @@ -// Internal policy header for unordered_set and unordered_map -*- C++ -*- - -// Copyright (C) 2010-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/hashtable_policy.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. - * @headername{unordered_map,unordered_set} - */ - -#ifndef _HASHTABLE_POLICY_H -#define _HASHTABLE_POLICY_H 1 - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - class _Hashtable; - -_GLIBCXX_END_NAMESPACE_VERSION - -namespace __detail -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @defgroup hashtable-detail Base and Implementation Classes - * @ingroup unordered_associative_containers - * @{ - */ - template - struct _Hashtable_base; - - // Helper function: return distance(first, last) for forward - // iterators, or 0 for input iterators. - template - inline typename std::iterator_traits<_Iterator>::difference_type - __distance_fw(_Iterator __first, _Iterator __last, - std::input_iterator_tag) - { return 0; } - - template - inline typename std::iterator_traits<_Iterator>::difference_type - __distance_fw(_Iterator __first, _Iterator __last, - std::forward_iterator_tag) - { return std::distance(__first, __last); } - - template - inline typename std::iterator_traits<_Iterator>::difference_type - __distance_fw(_Iterator __first, _Iterator __last) - { - typedef typename std::iterator_traits<_Iterator>::iterator_category _Tag; - return __distance_fw(__first, __last, _Tag()); - } - - // Helper type used to detect whether the hash functor is noexcept. - template - struct __is_noexcept_hash : std::__bool_constant< - noexcept(declval()(declval()))> - { }; - - struct _Identity - { - template - _Tp&& - operator()(_Tp&& __x) const - { return std::forward<_Tp>(__x); } - }; - - struct _Select1st - { - template - auto - operator()(_Tp&& __x) const - -> decltype(std::get<0>(std::forward<_Tp>(__x))) - { return std::get<0>(std::forward<_Tp>(__x)); } - }; - - template - struct _Hashtable_alloc; - - // Functor recycling a pool of nodes and using allocation once the pool is - // empty. - template - struct _ReuseOrAllocNode - { - private: - using __node_alloc_type = _NodeAlloc; - using __hashtable_alloc = _Hashtable_alloc<__node_alloc_type>; - using __value_alloc_type = typename __hashtable_alloc::__value_alloc_type; - using __value_alloc_traits = - typename __hashtable_alloc::__value_alloc_traits; - using __node_alloc_traits = - typename __hashtable_alloc::__node_alloc_traits; - using __node_type = typename __hashtable_alloc::__node_type; - - public: - _ReuseOrAllocNode(__node_type* __nodes, __hashtable_alloc& __h) - : _M_nodes(__nodes), _M_h(__h) { } - _ReuseOrAllocNode(const _ReuseOrAllocNode&) = delete; - - ~_ReuseOrAllocNode() - { _M_h._M_deallocate_nodes(_M_nodes); } - - template - __node_type* - operator()(_Arg&& __arg) const - { - if (_M_nodes) - { - __node_type* __node = _M_nodes; - _M_nodes = _M_nodes->_M_next(); - __node->_M_nxt = nullptr; - __value_alloc_type __a(_M_h._M_node_allocator()); - __value_alloc_traits::destroy(__a, __node->_M_valptr()); - __try - { - __value_alloc_traits::construct(__a, __node->_M_valptr(), - std::forward<_Arg>(__arg)); - } - __catch(...) - { - __node->~__node_type(); - __node_alloc_traits::deallocate(_M_h._M_node_allocator(), - __node, 1); - __throw_exception_again; - } - return __node; - } - return _M_h._M_allocate_node(std::forward<_Arg>(__arg)); - } - - private: - mutable __node_type* _M_nodes; - __hashtable_alloc& _M_h; - }; - - // Functor similar to the previous one but without any pool of nodes to - // recycle. - template - struct _AllocNode - { - private: - using __hashtable_alloc = _Hashtable_alloc<_NodeAlloc>; - using __node_type = typename __hashtable_alloc::__node_type; - - public: - _AllocNode(__hashtable_alloc& __h) - : _M_h(__h) { } - - template - __node_type* - operator()(_Arg&& __arg) const - { return _M_h._M_allocate_node(std::forward<_Arg>(__arg)); } - - private: - __hashtable_alloc& _M_h; - }; - - // Auxiliary types used for all instantiations of _Hashtable nodes - // and iterators. - - /** - * struct _Hashtable_traits - * - * Important traits for hash tables. - * - * @tparam _Cache_hash_code Boolean value. True if the value of - * the hash function is stored along with the value. This is a - * time-space tradeoff. Storing it may improve lookup speed by - * reducing the number of times we need to call the _Equal - * function. - * - * @tparam _Constant_iterators Boolean value. True if iterator and - * const_iterator are both constant iterator types. This is true - * for unordered_set and unordered_multiset, false for - * unordered_map and unordered_multimap. - * - * @tparam _Unique_keys Boolean value. True if the return value - * of _Hashtable::count(k) is always at most one, false if it may - * be an arbitrary number. This is true for unordered_set and - * unordered_map, false for unordered_multiset and - * unordered_multimap. - */ - template - struct _Hashtable_traits - { - using __hash_cached = __bool_constant<_Cache_hash_code>; - using __constant_iterators = __bool_constant<_Constant_iterators>; - using __unique_keys = __bool_constant<_Unique_keys>; - }; - - /** - * struct _Hash_node_base - * - * Nodes, used to wrap elements stored in the hash table. A policy - * template parameter of class template _Hashtable controls whether - * nodes also store a hash code. In some cases (e.g. strings) this - * may be a performance win. - */ - struct _Hash_node_base - { - _Hash_node_base* _M_nxt; - - _Hash_node_base() noexcept : _M_nxt() { } - - _Hash_node_base(_Hash_node_base* __next) noexcept : _M_nxt(__next) { } - }; - - /** - * struct _Hash_node_value_base - * - * Node type with the value to store. - */ - template - struct _Hash_node_value_base : _Hash_node_base - { - typedef _Value value_type; - - __gnu_cxx::__aligned_buffer<_Value> _M_storage; - - _Value* - _M_valptr() noexcept - { return _M_storage._M_ptr(); } - - const _Value* - _M_valptr() const noexcept - { return _M_storage._M_ptr(); } - - _Value& - _M_v() noexcept - { return *_M_valptr(); } - - const _Value& - _M_v() const noexcept - { return *_M_valptr(); } - }; - - /** - * Primary template struct _Hash_node. - */ - template - struct _Hash_node; - - /** - * Specialization for nodes with caches, struct _Hash_node. - * - * Base class is __detail::_Hash_node_value_base. - */ - template - struct _Hash_node<_Value, true> : _Hash_node_value_base<_Value> - { - std::size_t _M_hash_code; - - _Hash_node* - _M_next() const noexcept - { return static_cast<_Hash_node*>(this->_M_nxt); } - }; - - /** - * Specialization for nodes without caches, struct _Hash_node. - * - * Base class is __detail::_Hash_node_value_base. - */ - template - struct _Hash_node<_Value, false> : _Hash_node_value_base<_Value> - { - _Hash_node* - _M_next() const noexcept - { return static_cast<_Hash_node*>(this->_M_nxt); } - }; - - /// Base class for node iterators. - template - struct _Node_iterator_base - { - using __node_type = _Hash_node<_Value, _Cache_hash_code>; - - __node_type* _M_cur; - - _Node_iterator_base(__node_type* __p) noexcept - : _M_cur(__p) { } - - void - _M_incr() noexcept - { _M_cur = _M_cur->_M_next(); } - }; - - template - inline bool - operator==(const _Node_iterator_base<_Value, _Cache_hash_code>& __x, - const _Node_iterator_base<_Value, _Cache_hash_code >& __y) - noexcept - { return __x._M_cur == __y._M_cur; } - - template - inline bool - operator!=(const _Node_iterator_base<_Value, _Cache_hash_code>& __x, - const _Node_iterator_base<_Value, _Cache_hash_code>& __y) - noexcept - { return __x._M_cur != __y._M_cur; } - - /// Node iterators, used to iterate through all the hashtable. - template - struct _Node_iterator - : public _Node_iterator_base<_Value, __cache> - { - private: - using __base_type = _Node_iterator_base<_Value, __cache>; - using __node_type = typename __base_type::__node_type; - - public: - typedef _Value value_type; - typedef std::ptrdiff_t difference_type; - typedef std::forward_iterator_tag iterator_category; - - using pointer = typename std::conditional<__constant_iterators, - const _Value*, _Value*>::type; - - using reference = typename std::conditional<__constant_iterators, - const _Value&, _Value&>::type; - - _Node_iterator() noexcept - : __base_type(0) { } - - explicit - _Node_iterator(__node_type* __p) noexcept - : __base_type(__p) { } - - reference - operator*() const noexcept - { return this->_M_cur->_M_v(); } - - pointer - operator->() const noexcept - { return this->_M_cur->_M_valptr(); } - - _Node_iterator& - operator++() noexcept - { - this->_M_incr(); - return *this; - } - - _Node_iterator - operator++(int) noexcept - { - _Node_iterator __tmp(*this); - this->_M_incr(); - return __tmp; - } - }; - - /// Node const_iterators, used to iterate through all the hashtable. - template - struct _Node_const_iterator - : public _Node_iterator_base<_Value, __cache> - { - private: - using __base_type = _Node_iterator_base<_Value, __cache>; - using __node_type = typename __base_type::__node_type; - - public: - typedef _Value value_type; - typedef std::ptrdiff_t difference_type; - typedef std::forward_iterator_tag iterator_category; - - typedef const _Value* pointer; - typedef const _Value& reference; - - _Node_const_iterator() noexcept - : __base_type(0) { } - - explicit - _Node_const_iterator(__node_type* __p) noexcept - : __base_type(__p) { } - - _Node_const_iterator(const _Node_iterator<_Value, __constant_iterators, - __cache>& __x) noexcept - : __base_type(__x._M_cur) { } - - reference - operator*() const noexcept - { return this->_M_cur->_M_v(); } - - pointer - operator->() const noexcept - { return this->_M_cur->_M_valptr(); } - - _Node_const_iterator& - operator++() noexcept - { - this->_M_incr(); - return *this; - } - - _Node_const_iterator - operator++(int) noexcept - { - _Node_const_iterator __tmp(*this); - this->_M_incr(); - return __tmp; - } - }; - - // Many of class template _Hashtable's template parameters are policy - // classes. These are defaults for the policies. - - /// Default range hashing function: use division to fold a large number - /// into the range [0, N). - struct _Mod_range_hashing - { - typedef std::size_t first_argument_type; - typedef std::size_t second_argument_type; - typedef std::size_t result_type; - - result_type - operator()(first_argument_type __num, - second_argument_type __den) const noexcept - { return __num % __den; } - }; - - /// Default ranged hash function H. In principle it should be a - /// function object composed from objects of type H1 and H2 such that - /// h(k, N) = h2(h1(k), N), but that would mean making extra copies of - /// h1 and h2. So instead we'll just use a tag to tell class template - /// hashtable to do that composition. - struct _Default_ranged_hash { }; - - /// Default value for rehash policy. Bucket size is (usually) the - /// smallest prime that keeps the load factor small enough. - struct _Prime_rehash_policy - { - _Prime_rehash_policy(float __z = 1.0) noexcept - : _M_max_load_factor(__z), _M_next_resize(0) { } - - float - max_load_factor() const noexcept - { return _M_max_load_factor; } - - // Return a bucket size no smaller than n. - std::size_t - _M_next_bkt(std::size_t __n) const; - - // Return a bucket count appropriate for n elements - std::size_t - _M_bkt_for_elements(std::size_t __n) const - { return __builtin_ceil(__n / (long double)_M_max_load_factor); } - - // __n_bkt is current bucket count, __n_elt is current element count, - // and __n_ins is number of elements to be inserted. Do we need to - // increase bucket count? If so, return make_pair(true, n), where n - // is the new bucket count. If not, return make_pair(false, 0). - std::pair - _M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt, - std::size_t __n_ins) const; - - typedef std::size_t _State; - - _State - _M_state() const - { return _M_next_resize; } - - void - _M_reset() noexcept - { _M_next_resize = 0; } - - void - _M_reset(_State __state) - { _M_next_resize = __state; } - - enum { _S_n_primes = sizeof(unsigned long) != 8 ? 256 : 256 + 48 }; - - static const std::size_t _S_growth_factor = 2; - - float _M_max_load_factor; - mutable std::size_t _M_next_resize; - }; - - // Base classes for std::_Hashtable. We define these base classes - // because in some cases we want to do different things depending on - // the value of a policy class. In some cases the policy class - // affects which member functions and nested typedefs are defined; - // we handle that by specializing base class templates. Several of - // the base class templates need to access other members of class - // template _Hashtable, so we use a variant of the "Curiously - // Recurring Template Pattern" (CRTP) technique. - - /** - * Primary class template _Map_base. - * - * If the hashtable has a value type of the form pair and a - * key extraction policy (_ExtractKey) that returns the first part - * of the pair, the hashtable gets a mapped_type typedef. If it - * satisfies those criteria and also has unique keys, then it also - * gets an operator[]. - */ - template - struct _Map_base { }; - - /// Partial specialization, __unique_keys set to false. - template - struct _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits, false> - { - using mapped_type = typename std::tuple_element<1, _Pair>::type; - }; - - /// Partial specialization, __unique_keys set to true. - template - struct _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits, true> - { - private: - using __hashtable_base = __detail::_Hashtable_base<_Key, _Pair, - _Select1st, - _Equal, _H1, _H2, _Hash, - _Traits>; - - using __hashtable = _Hashtable<_Key, _Pair, _Alloc, - _Select1st, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>; - - using __hash_code = typename __hashtable_base::__hash_code; - using __node_type = typename __hashtable_base::__node_type; - - public: - using key_type = typename __hashtable_base::key_type; - using iterator = typename __hashtable_base::iterator; - using mapped_type = typename std::tuple_element<1, _Pair>::type; - - mapped_type& - operator[](const key_type& __k); - - mapped_type& - operator[](key_type&& __k); - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 761. unordered_map needs an at() member function. - mapped_type& - at(const key_type& __k); - - const mapped_type& - at(const key_type& __k) const; - }; - - template - auto - _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: - operator[](const key_type& __k) - -> mapped_type& - { - __hashtable* __h = static_cast<__hashtable*>(this); - __hash_code __code = __h->_M_hash_code(__k); - std::size_t __n = __h->_M_bucket_index(__k, __code); - __node_type* __p = __h->_M_find_node(__n, __k, __code); - - if (!__p) - { - __p = __h->_M_allocate_node(std::piecewise_construct, - std::tuple(__k), - std::tuple<>()); - return __h->_M_insert_unique_node(__n, __code, __p)->second; - } - - return __p->_M_v().second; - } - - template - auto - _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: - operator[](key_type&& __k) - -> mapped_type& - { - __hashtable* __h = static_cast<__hashtable*>(this); - __hash_code __code = __h->_M_hash_code(__k); - std::size_t __n = __h->_M_bucket_index(__k, __code); - __node_type* __p = __h->_M_find_node(__n, __k, __code); - - if (!__p) - { - __p = __h->_M_allocate_node(std::piecewise_construct, - std::forward_as_tuple(std::move(__k)), - std::tuple<>()); - return __h->_M_insert_unique_node(__n, __code, __p)->second; - } - - return __p->_M_v().second; - } - - template - auto - _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: - at(const key_type& __k) - -> mapped_type& - { - __hashtable* __h = static_cast<__hashtable*>(this); - __hash_code __code = __h->_M_hash_code(__k); - std::size_t __n = __h->_M_bucket_index(__k, __code); - __node_type* __p = __h->_M_find_node(__n, __k, __code); - - if (!__p) - __throw_out_of_range(__N("_Map_base::at")); - return __p->_M_v().second; - } - - template - auto - _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: - at(const key_type& __k) const - -> const mapped_type& - { - const __hashtable* __h = static_cast(this); - __hash_code __code = __h->_M_hash_code(__k); - std::size_t __n = __h->_M_bucket_index(__k, __code); - __node_type* __p = __h->_M_find_node(__n, __k, __code); - - if (!__p) - __throw_out_of_range(__N("_Map_base::at")); - return __p->_M_v().second; - } - - /** - * Primary class template _Insert_base. - * - * insert member functions appropriate to all _Hashtables. - */ - template - struct _Insert_base - { - protected: - using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, - _Equal, _H1, _H2, _Hash, - _RehashPolicy, _Traits>; - - using __hashtable_base = _Hashtable_base<_Key, _Value, _ExtractKey, - _Equal, _H1, _H2, _Hash, - _Traits>; - - using value_type = typename __hashtable_base::value_type; - using iterator = typename __hashtable_base::iterator; - using const_iterator = typename __hashtable_base::const_iterator; - using size_type = typename __hashtable_base::size_type; - - using __unique_keys = typename __hashtable_base::__unique_keys; - using __ireturn_type = typename __hashtable_base::__ireturn_type; - using __node_type = _Hash_node<_Value, _Traits::__hash_cached::value>; - using __node_alloc_type = __alloc_rebind<_Alloc, __node_type>; - using __node_gen_type = _AllocNode<__node_alloc_type>; - - __hashtable& - _M_conjure_hashtable() - { return *(static_cast<__hashtable*>(this)); } - - template - void - _M_insert_range(_InputIterator __first, _InputIterator __last, - const _NodeGetter&); - - public: - __ireturn_type - insert(const value_type& __v) - { - __hashtable& __h = _M_conjure_hashtable(); - __node_gen_type __node_gen(__h); - return __h._M_insert(__v, __node_gen, __unique_keys()); - } - - iterator - insert(const_iterator __hint, const value_type& __v) - { - __hashtable& __h = _M_conjure_hashtable(); - __node_gen_type __node_gen(__h); - return __h._M_insert(__hint, __v, __node_gen, __unique_keys()); - } - - void - insert(initializer_list __l) - { this->insert(__l.begin(), __l.end()); } - - template - void - insert(_InputIterator __first, _InputIterator __last) - { - __hashtable& __h = _M_conjure_hashtable(); - __node_gen_type __node_gen(__h); - return _M_insert_range(__first, __last, __node_gen); - } - }; - - template - template - void - _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, - _RehashPolicy, _Traits>:: - _M_insert_range(_InputIterator __first, _InputIterator __last, - const _NodeGetter& __node_gen) - { - using __rehash_type = typename __hashtable::__rehash_type; - using __rehash_state = typename __hashtable::__rehash_state; - using pair_type = std::pair; - - size_type __n_elt = __detail::__distance_fw(__first, __last); - - __hashtable& __h = _M_conjure_hashtable(); - __rehash_type& __rehash = __h._M_rehash_policy; - const __rehash_state& __saved_state = __rehash._M_state(); - pair_type __do_rehash = __rehash._M_need_rehash(__h._M_bucket_count, - __h._M_element_count, - __n_elt); - - if (__do_rehash.first) - __h._M_rehash(__do_rehash.second, __saved_state); - - for (; __first != __last; ++__first) - __h._M_insert(*__first, __node_gen, __unique_keys()); - } - - /** - * Primary class template _Insert. - * - * Select insert member functions appropriate to _Hashtable policy choices. - */ - template - struct _Insert; - - /// Specialization. - template - struct _Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, - _RehashPolicy, _Traits, true, true> - : public _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits> - { - using __base_type = _Insert_base<_Key, _Value, _Alloc, _ExtractKey, - _Equal, _H1, _H2, _Hash, - _RehashPolicy, _Traits>; - using value_type = typename __base_type::value_type; - using iterator = typename __base_type::iterator; - using const_iterator = typename __base_type::const_iterator; - - using __unique_keys = typename __base_type::__unique_keys; - using __hashtable = typename __base_type::__hashtable; - using __node_gen_type = typename __base_type::__node_gen_type; - - using __base_type::insert; - - std::pair - insert(value_type&& __v) - { - __hashtable& __h = this->_M_conjure_hashtable(); - __node_gen_type __node_gen(__h); - return __h._M_insert(std::move(__v), __node_gen, __unique_keys()); - } - - iterator - insert(const_iterator __hint, value_type&& __v) - { - __hashtable& __h = this->_M_conjure_hashtable(); - __node_gen_type __node_gen(__h); - return __h._M_insert(__hint, std::move(__v), __node_gen, - __unique_keys()); - } - }; - - /// Specialization. - template - struct _Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, - _RehashPolicy, _Traits, true, false> - : public _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits> - { - using __base_type = _Insert_base<_Key, _Value, _Alloc, _ExtractKey, - _Equal, _H1, _H2, _Hash, - _RehashPolicy, _Traits>; - using value_type = typename __base_type::value_type; - using iterator = typename __base_type::iterator; - using const_iterator = typename __base_type::const_iterator; - - using __unique_keys = typename __base_type::__unique_keys; - using __hashtable = typename __base_type::__hashtable; - using __node_gen_type = typename __base_type::__node_gen_type; - - using __base_type::insert; - - iterator - insert(value_type&& __v) - { - __hashtable& __h = this->_M_conjure_hashtable(); - __node_gen_type __node_gen(__h); - return __h._M_insert(std::move(__v), __node_gen, __unique_keys()); - } - - iterator - insert(const_iterator __hint, value_type&& __v) - { - __hashtable& __h = this->_M_conjure_hashtable(); - __node_gen_type __node_gen(__h); - return __h._M_insert(__hint, std::move(__v), __node_gen, - __unique_keys()); - } - }; - - /// Specialization. - template - struct _Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, - _RehashPolicy, _Traits, false, _Unique_keys> - : public _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits> - { - using __base_type = _Insert_base<_Key, _Value, _Alloc, _ExtractKey, - _Equal, _H1, _H2, _Hash, - _RehashPolicy, _Traits>; - using value_type = typename __base_type::value_type; - using iterator = typename __base_type::iterator; - using const_iterator = typename __base_type::const_iterator; - - using __unique_keys = typename __base_type::__unique_keys; - using __hashtable = typename __base_type::__hashtable; - using __ireturn_type = typename __base_type::__ireturn_type; - - using __base_type::insert; - - template - using __is_cons = std::is_constructible; - - template - using _IFcons = std::enable_if<__is_cons<_Pair>::value>; - - template - using _IFconsp = typename _IFcons<_Pair>::type; - - template> - __ireturn_type - insert(_Pair&& __v) - { - __hashtable& __h = this->_M_conjure_hashtable(); - return __h._M_emplace(__unique_keys(), std::forward<_Pair>(__v)); - } - - template> - iterator - insert(const_iterator __hint, _Pair&& __v) - { - __hashtable& __h = this->_M_conjure_hashtable(); - return __h._M_emplace(__hint, __unique_keys(), - std::forward<_Pair>(__v)); - } - }; - - /** - * Primary class template _Rehash_base. - * - * Give hashtable the max_load_factor functions and reserve iff the - * rehash policy is _Prime_rehash_policy. - */ - template - struct _Rehash_base; - - /// Specialization. - template - struct _Rehash_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _Prime_rehash_policy, _Traits> - { - using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, - _Equal, _H1, _H2, _Hash, - _Prime_rehash_policy, _Traits>; - - float - max_load_factor() const noexcept - { - const __hashtable* __this = static_cast(this); - return __this->__rehash_policy().max_load_factor(); - } - - void - max_load_factor(float __z) - { - __hashtable* __this = static_cast<__hashtable*>(this); - __this->__rehash_policy(_Prime_rehash_policy(__z)); - } - - void - reserve(std::size_t __n) - { - __hashtable* __this = static_cast<__hashtable*>(this); - __this->rehash(__builtin_ceil(__n / max_load_factor())); - } - }; - - /** - * Primary class template _Hashtable_ebo_helper. - * - * Helper class using EBO when it is not forbidden (the type is not - * final) and when it is worth it (the type is empty.) - */ - template - struct _Hashtable_ebo_helper; - - /// Specialization using EBO. - template - struct _Hashtable_ebo_helper<_Nm, _Tp, true> - : private _Tp - { - _Hashtable_ebo_helper() = default; - - template - _Hashtable_ebo_helper(_OtherTp&& __tp) - : _Tp(std::forward<_OtherTp>(__tp)) - { } - - static const _Tp& - _S_cget(const _Hashtable_ebo_helper& __eboh) - { return static_cast(__eboh); } - - static _Tp& - _S_get(_Hashtable_ebo_helper& __eboh) - { return static_cast<_Tp&>(__eboh); } - }; - - /// Specialization not using EBO. - template - struct _Hashtable_ebo_helper<_Nm, _Tp, false> - { - _Hashtable_ebo_helper() = default; - - template - _Hashtable_ebo_helper(_OtherTp&& __tp) - : _M_tp(std::forward<_OtherTp>(__tp)) - { } - - static const _Tp& - _S_cget(const _Hashtable_ebo_helper& __eboh) - { return __eboh._M_tp; } - - static _Tp& - _S_get(_Hashtable_ebo_helper& __eboh) - { return __eboh._M_tp; } - - private: - _Tp _M_tp; - }; - - /** - * Primary class template _Local_iterator_base. - * - * Base class for local iterators, used to iterate within a bucket - * but not between buckets. - */ - template - struct _Local_iterator_base; - - /** - * Primary class template _Hash_code_base. - * - * Encapsulates two policy issues that aren't quite orthogonal. - * (1) the difference between using a ranged hash function and using - * the combination of a hash function and a range-hashing function. - * In the former case we don't have such things as hash codes, so - * we have a dummy type as placeholder. - * (2) Whether or not we cache hash codes. Caching hash codes is - * meaningless if we have a ranged hash function. - * - * We also put the key extraction objects here, for convenience. - * Each specialization derives from one or more of the template - * parameters to benefit from Ebo. This is important as this type - * is inherited in some cases by the _Local_iterator_base type used - * to implement local_iterator and const_local_iterator. As with - * any iterator type we prefer to make it as small as possible. - * - * Primary template is unused except as a hook for specializations. - */ - template - struct _Hash_code_base; - - /// Specialization: ranged hash function, no caching hash codes. H1 - /// and H2 are provided but ignored. We define a dummy hash code type. - template - struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false> - : private _Hashtable_ebo_helper<0, _ExtractKey>, - private _Hashtable_ebo_helper<1, _Hash> - { - private: - using __ebo_extract_key = _Hashtable_ebo_helper<0, _ExtractKey>; - using __ebo_hash = _Hashtable_ebo_helper<1, _Hash>; - - protected: - typedef void* __hash_code; - typedef _Hash_node<_Value, false> __node_type; - - // We need the default constructor for the local iterators and _Hashtable - // default constructor. - _Hash_code_base() = default; - - _Hash_code_base(const _ExtractKey& __ex, const _H1&, const _H2&, - const _Hash& __h) - : __ebo_extract_key(__ex), __ebo_hash(__h) { } - - __hash_code - _M_hash_code(const _Key& __key) const - { return 0; } - - std::size_t - _M_bucket_index(const _Key& __k, __hash_code, std::size_t __n) const - { return _M_ranged_hash()(__k, __n); } - - std::size_t - _M_bucket_index(const __node_type* __p, std::size_t __n) const - noexcept( noexcept(declval()(declval(), - (std::size_t)0)) ) - { return _M_ranged_hash()(_M_extract()(__p->_M_v()), __n); } - - void - _M_store_code(__node_type*, __hash_code) const - { } - - void - _M_copy_code(__node_type*, const __node_type*) const - { } - - void - _M_swap(_Hash_code_base& __x) - { - std::swap(_M_extract(), __x._M_extract()); - std::swap(_M_ranged_hash(), __x._M_ranged_hash()); - } - - const _ExtractKey& - _M_extract() const { return __ebo_extract_key::_S_cget(*this); } - - _ExtractKey& - _M_extract() { return __ebo_extract_key::_S_get(*this); } - - const _Hash& - _M_ranged_hash() const { return __ebo_hash::_S_cget(*this); } - - _Hash& - _M_ranged_hash() { return __ebo_hash::_S_get(*this); } - }; - - // No specialization for ranged hash function while caching hash codes. - // That combination is meaningless, and trying to do it is an error. - - /// Specialization: ranged hash function, cache hash codes. This - /// combination is meaningless, so we provide only a declaration - /// and no definition. - template - struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>; - - /// Specialization: hash function and range-hashing function, no - /// caching of hash codes. - /// Provides typedef and accessor required by C++ 11. - template - struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, - _Default_ranged_hash, false> - : private _Hashtable_ebo_helper<0, _ExtractKey>, - private _Hashtable_ebo_helper<1, _H1>, - private _Hashtable_ebo_helper<2, _H2> - { - private: - using __ebo_extract_key = _Hashtable_ebo_helper<0, _ExtractKey>; - using __ebo_h1 = _Hashtable_ebo_helper<1, _H1>; - using __ebo_h2 = _Hashtable_ebo_helper<2, _H2>; - - // Gives the local iterator implementation access to _M_bucket_index(). - friend struct _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, - _Default_ranged_hash, false>; - - public: - typedef _H1 hasher; - - hasher - hash_function() const - { return _M_h1(); } - - protected: - typedef std::size_t __hash_code; - typedef _Hash_node<_Value, false> __node_type; - - // We need the default constructor for the local iterators and _Hashtable - // default constructor. - _Hash_code_base() = default; - - _Hash_code_base(const _ExtractKey& __ex, - const _H1& __h1, const _H2& __h2, - const _Default_ranged_hash&) - : __ebo_extract_key(__ex), __ebo_h1(__h1), __ebo_h2(__h2) { } - - __hash_code - _M_hash_code(const _Key& __k) const - { return _M_h1()(__k); } - - std::size_t - _M_bucket_index(const _Key&, __hash_code __c, std::size_t __n) const - { return _M_h2()(__c, __n); } - - std::size_t - _M_bucket_index(const __node_type* __p, std::size_t __n) const - noexcept( noexcept(declval()(declval())) - && noexcept(declval()((__hash_code)0, - (std::size_t)0)) ) - { return _M_h2()(_M_h1()(_M_extract()(__p->_M_v())), __n); } - - void - _M_store_code(__node_type*, __hash_code) const - { } - - void - _M_copy_code(__node_type*, const __node_type*) const - { } - - void - _M_swap(_Hash_code_base& __x) - { - std::swap(_M_extract(), __x._M_extract()); - std::swap(_M_h1(), __x._M_h1()); - std::swap(_M_h2(), __x._M_h2()); - } - - const _ExtractKey& - _M_extract() const { return __ebo_extract_key::_S_cget(*this); } - - _ExtractKey& - _M_extract() { return __ebo_extract_key::_S_get(*this); } - - const _H1& - _M_h1() const { return __ebo_h1::_S_cget(*this); } - - _H1& - _M_h1() { return __ebo_h1::_S_get(*this); } - - const _H2& - _M_h2() const { return __ebo_h2::_S_cget(*this); } - - _H2& - _M_h2() { return __ebo_h2::_S_get(*this); } - }; - - /// Specialization: hash function and range-hashing function, - /// caching hash codes. H is provided but ignored. Provides - /// typedef and accessor required by C++ 11. - template - struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, - _Default_ranged_hash, true> - : private _Hashtable_ebo_helper<0, _ExtractKey>, - private _Hashtable_ebo_helper<1, _H1>, - private _Hashtable_ebo_helper<2, _H2> - { - private: - // Gives the local iterator implementation access to _M_h2(). - friend struct _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, - _Default_ranged_hash, true>; - - using __ebo_extract_key = _Hashtable_ebo_helper<0, _ExtractKey>; - using __ebo_h1 = _Hashtable_ebo_helper<1, _H1>; - using __ebo_h2 = _Hashtable_ebo_helper<2, _H2>; - - public: - typedef _H1 hasher; - - hasher - hash_function() const - { return _M_h1(); } - - protected: - typedef std::size_t __hash_code; - typedef _Hash_node<_Value, true> __node_type; - - // We need the default constructor for _Hashtable default constructor. - _Hash_code_base() = default; - _Hash_code_base(const _ExtractKey& __ex, - const _H1& __h1, const _H2& __h2, - const _Default_ranged_hash&) - : __ebo_extract_key(__ex), __ebo_h1(__h1), __ebo_h2(__h2) { } - - __hash_code - _M_hash_code(const _Key& __k) const - { return _M_h1()(__k); } - - std::size_t - _M_bucket_index(const _Key&, __hash_code __c, - std::size_t __n) const - { return _M_h2()(__c, __n); } - - std::size_t - _M_bucket_index(const __node_type* __p, std::size_t __n) const - noexcept( noexcept(declval()((__hash_code)0, - (std::size_t)0)) ) - { return _M_h2()(__p->_M_hash_code, __n); } - - void - _M_store_code(__node_type* __n, __hash_code __c) const - { __n->_M_hash_code = __c; } - - void - _M_copy_code(__node_type* __to, const __node_type* __from) const - { __to->_M_hash_code = __from->_M_hash_code; } - - void - _M_swap(_Hash_code_base& __x) - { - std::swap(_M_extract(), __x._M_extract()); - std::swap(_M_h1(), __x._M_h1()); - std::swap(_M_h2(), __x._M_h2()); - } - - const _ExtractKey& - _M_extract() const { return __ebo_extract_key::_S_cget(*this); } - - _ExtractKey& - _M_extract() { return __ebo_extract_key::_S_get(*this); } - - const _H1& - _M_h1() const { return __ebo_h1::_S_cget(*this); } - - _H1& - _M_h1() { return __ebo_h1::_S_get(*this); } - - const _H2& - _M_h2() const { return __ebo_h2::_S_cget(*this); } - - _H2& - _M_h2() { return __ebo_h2::_S_get(*this); } - }; - - /** - * Primary class template _Equal_helper. - * - */ - template - struct _Equal_helper; - - /// Specialization. - template - struct _Equal_helper<_Key, _Value, _ExtractKey, _Equal, _HashCodeType, true> - { - static bool - _S_equals(const _Equal& __eq, const _ExtractKey& __extract, - const _Key& __k, _HashCodeType __c, _Hash_node<_Value, true>* __n) - { return __c == __n->_M_hash_code && __eq(__k, __extract(__n->_M_v())); } - }; - - /// Specialization. - template - struct _Equal_helper<_Key, _Value, _ExtractKey, _Equal, _HashCodeType, false> - { - static bool - _S_equals(const _Equal& __eq, const _ExtractKey& __extract, - const _Key& __k, _HashCodeType, _Hash_node<_Value, false>* __n) - { return __eq(__k, __extract(__n->_M_v())); } - }; - - - /// Partial specialization used when nodes contain a cached hash code. - template - struct _Local_iterator_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, true> - : private _Hashtable_ebo_helper<0, _H2> - { - protected: - using __base_type = _Hashtable_ebo_helper<0, _H2>; - using __hash_code_base = _Hash_code_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, true>; - - _Local_iterator_base() = default; - _Local_iterator_base(const __hash_code_base& __base, - _Hash_node<_Value, true>* __p, - std::size_t __bkt, std::size_t __bkt_count) - : __base_type(__base._M_h2()), - _M_cur(__p), _M_bucket(__bkt), _M_bucket_count(__bkt_count) { } - - void - _M_incr() - { - _M_cur = _M_cur->_M_next(); - if (_M_cur) - { - std::size_t __bkt - = __base_type::_S_get(*this)(_M_cur->_M_hash_code, - _M_bucket_count); - if (__bkt != _M_bucket) - _M_cur = nullptr; - } - } - - _Hash_node<_Value, true>* _M_cur; - std::size_t _M_bucket; - std::size_t _M_bucket_count; - - public: - const void* - _M_curr() const { return _M_cur; } // for equality ops - - std::size_t - _M_get_bucket() const { return _M_bucket; } // for debug mode - }; - - // Uninitialized storage for a _Hash_code_base. - // This type is DefaultConstructible and Assignable even if the - // _Hash_code_base type isn't, so that _Local_iterator_base<..., false> - // can be DefaultConstructible and Assignable. - template::value> - struct _Hash_code_storage - { - __gnu_cxx::__aligned_buffer<_Tp> _M_storage; - - _Tp* - _M_h() { return _M_storage._M_ptr(); } - - const _Tp* - _M_h() const { return _M_storage._M_ptr(); } - }; - - // Empty partial specialization for empty _Hash_code_base types. - template - struct _Hash_code_storage<_Tp, true> - { - static_assert( std::is_empty<_Tp>::value, "Type must be empty" ); - - // As _Tp is an empty type there will be no bytes written/read through - // the cast pointer, so no strict-aliasing violation. - _Tp* - _M_h() { return reinterpret_cast<_Tp*>(this); } - - const _Tp* - _M_h() const { return reinterpret_cast(this); } - }; - - template - using __hash_code_for_local_iter - = _Hash_code_storage<_Hash_code_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, false>>; - - // Partial specialization used when hash codes are not cached - template - struct _Local_iterator_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, false> - : __hash_code_for_local_iter<_Key, _Value, _ExtractKey, _H1, _H2, _Hash> - { - protected: - using __hash_code_base = _Hash_code_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, false>; - - _Local_iterator_base() : _M_bucket_count(-1) { } - - _Local_iterator_base(const __hash_code_base& __base, - _Hash_node<_Value, false>* __p, - std::size_t __bkt, std::size_t __bkt_count) - : _M_cur(__p), _M_bucket(__bkt), _M_bucket_count(__bkt_count) - { _M_init(__base); } - - ~_Local_iterator_base() - { - if (_M_bucket_count != -1) - _M_destroy(); - } - - _Local_iterator_base(const _Local_iterator_base& __iter) - : _M_cur(__iter._M_cur), _M_bucket(__iter._M_bucket), - _M_bucket_count(__iter._M_bucket_count) - { - if (_M_bucket_count != -1) - _M_init(*__iter._M_h()); - } - - _Local_iterator_base& - operator=(const _Local_iterator_base& __iter) - { - if (_M_bucket_count != -1) - _M_destroy(); - _M_cur = __iter._M_cur; - _M_bucket = __iter._M_bucket; - _M_bucket_count = __iter._M_bucket_count; - if (_M_bucket_count != -1) - _M_init(*__iter._M_h()); - return *this; - } - - void - _M_incr() - { - _M_cur = _M_cur->_M_next(); - if (_M_cur) - { - std::size_t __bkt = this->_M_h()->_M_bucket_index(_M_cur, - _M_bucket_count); - if (__bkt != _M_bucket) - _M_cur = nullptr; - } - } - - _Hash_node<_Value, false>* _M_cur; - std::size_t _M_bucket; - std::size_t _M_bucket_count; - - void - _M_init(const __hash_code_base& __base) - { ::new(this->_M_h()) __hash_code_base(__base); } - - void - _M_destroy() { this->_M_h()->~__hash_code_base(); } - - public: - const void* - _M_curr() const { return _M_cur; } // for equality ops and debug mode - - std::size_t - _M_get_bucket() const { return _M_bucket; } // for debug mode - }; - - template - inline bool - operator==(const _Local_iterator_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, __cache>& __x, - const _Local_iterator_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, __cache>& __y) - { return __x._M_curr() == __y._M_curr(); } - - template - inline bool - operator!=(const _Local_iterator_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, __cache>& __x, - const _Local_iterator_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, __cache>& __y) - { return __x._M_curr() != __y._M_curr(); } - - /// local iterators - template - struct _Local_iterator - : public _Local_iterator_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, __cache> - { - private: - using __base_type = _Local_iterator_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, __cache>; - using __hash_code_base = typename __base_type::__hash_code_base; - public: - typedef _Value value_type; - typedef typename std::conditional<__constant_iterators, - const _Value*, _Value*>::type - pointer; - typedef typename std::conditional<__constant_iterators, - const _Value&, _Value&>::type - reference; - typedef std::ptrdiff_t difference_type; - typedef std::forward_iterator_tag iterator_category; - - _Local_iterator() = default; - - _Local_iterator(const __hash_code_base& __base, - _Hash_node<_Value, __cache>* __p, - std::size_t __bkt, std::size_t __bkt_count) - : __base_type(__base, __p, __bkt, __bkt_count) - { } - - reference - operator*() const - { return this->_M_cur->_M_v(); } - - pointer - operator->() const - { return this->_M_cur->_M_valptr(); } - - _Local_iterator& - operator++() - { - this->_M_incr(); - return *this; - } - - _Local_iterator - operator++(int) - { - _Local_iterator __tmp(*this); - this->_M_incr(); - return __tmp; - } - }; - - /// local const_iterators - template - struct _Local_const_iterator - : public _Local_iterator_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, __cache> - { - private: - using __base_type = _Local_iterator_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, __cache>; - using __hash_code_base = typename __base_type::__hash_code_base; - - public: - typedef _Value value_type; - typedef const _Value* pointer; - typedef const _Value& reference; - typedef std::ptrdiff_t difference_type; - typedef std::forward_iterator_tag iterator_category; - - _Local_const_iterator() = default; - - _Local_const_iterator(const __hash_code_base& __base, - _Hash_node<_Value, __cache>* __p, - std::size_t __bkt, std::size_t __bkt_count) - : __base_type(__base, __p, __bkt, __bkt_count) - { } - - _Local_const_iterator(const _Local_iterator<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, - __constant_iterators, - __cache>& __x) - : __base_type(__x) - { } - - reference - operator*() const - { return this->_M_cur->_M_v(); } - - pointer - operator->() const - { return this->_M_cur->_M_valptr(); } - - _Local_const_iterator& - operator++() - { - this->_M_incr(); - return *this; - } - - _Local_const_iterator - operator++(int) - { - _Local_const_iterator __tmp(*this); - this->_M_incr(); - return __tmp; - } - }; - - /** - * Primary class template _Hashtable_base. - * - * Helper class adding management of _Equal functor to - * _Hash_code_base type. - * - * Base class templates are: - * - __detail::_Hash_code_base - * - __detail::_Hashtable_ebo_helper - */ - template - struct _Hashtable_base - : public _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, - _Traits::__hash_cached::value>, - private _Hashtable_ebo_helper<0, _Equal> - { - public: - typedef _Key key_type; - typedef _Value value_type; - typedef _Equal key_equal; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - - using __traits_type = _Traits; - using __hash_cached = typename __traits_type::__hash_cached; - using __constant_iterators = typename __traits_type::__constant_iterators; - using __unique_keys = typename __traits_type::__unique_keys; - - using __hash_code_base = _Hash_code_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, - __hash_cached::value>; - - using __hash_code = typename __hash_code_base::__hash_code; - using __node_type = typename __hash_code_base::__node_type; - - using iterator = __detail::_Node_iterator; - - using const_iterator = __detail::_Node_const_iterator; - - using local_iterator = __detail::_Local_iterator; - - using const_local_iterator = __detail::_Local_const_iterator; - - using __ireturn_type = typename std::conditional<__unique_keys::value, - std::pair, - iterator>::type; - private: - using _EqualEBO = _Hashtable_ebo_helper<0, _Equal>; - using _EqualHelper = _Equal_helper<_Key, _Value, _ExtractKey, _Equal, - __hash_code, __hash_cached::value>; - - protected: - _Hashtable_base() = default; - _Hashtable_base(const _ExtractKey& __ex, const _H1& __h1, const _H2& __h2, - const _Hash& __hash, const _Equal& __eq) - : __hash_code_base(__ex, __h1, __h2, __hash), _EqualEBO(__eq) - { } - - bool - _M_equals(const _Key& __k, __hash_code __c, __node_type* __n) const - { - return _EqualHelper::_S_equals(_M_eq(), this->_M_extract(), - __k, __c, __n); - } - - void - _M_swap(_Hashtable_base& __x) - { - __hash_code_base::_M_swap(__x); - std::swap(_M_eq(), __x._M_eq()); - } - - const _Equal& - _M_eq() const { return _EqualEBO::_S_cget(*this); } - - _Equal& - _M_eq() { return _EqualEBO::_S_get(*this); } - }; - - /** - * struct _Equality_base. - * - * Common types and functions for class _Equality. - */ - struct _Equality_base - { - protected: - template - static bool - _S_is_permutation(_Uiterator, _Uiterator, _Uiterator); - }; - - // See std::is_permutation in N3068. - template - bool - _Equality_base:: - _S_is_permutation(_Uiterator __first1, _Uiterator __last1, - _Uiterator __first2) - { - for (; __first1 != __last1; ++__first1, ++__first2) - if (!(*__first1 == *__first2)) - break; - - if (__first1 == __last1) - return true; - - _Uiterator __last2 = __first2; - std::advance(__last2, std::distance(__first1, __last1)); - - for (_Uiterator __it1 = __first1; __it1 != __last1; ++__it1) - { - _Uiterator __tmp = __first1; - while (__tmp != __it1 && !bool(*__tmp == *__it1)) - ++__tmp; - - // We've seen this one before. - if (__tmp != __it1) - continue; - - std::ptrdiff_t __n2 = 0; - for (__tmp = __first2; __tmp != __last2; ++__tmp) - if (*__tmp == *__it1) - ++__n2; - - if (!__n2) - return false; - - std::ptrdiff_t __n1 = 0; - for (__tmp = __it1; __tmp != __last1; ++__tmp) - if (*__tmp == *__it1) - ++__n1; - - if (__n1 != __n2) - return false; - } - return true; - } - - /** - * Primary class template _Equality. - * - * This is for implementing equality comparison for unordered - * containers, per N3068, by John Lakos and Pablo Halpern. - * Algorithmically, we follow closely the reference implementations - * therein. - */ - template - struct _Equality; - - /// Specialization. - template - struct _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits, true> - { - using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>; - - bool - _M_equal(const __hashtable&) const; - }; - - template - bool - _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: - _M_equal(const __hashtable& __other) const - { - const __hashtable* __this = static_cast(this); - - if (__this->size() != __other.size()) - return false; - - for (auto __itx = __this->begin(); __itx != __this->end(); ++__itx) - { - const auto __ity = __other.find(_ExtractKey()(*__itx)); - if (__ity == __other.end() || !bool(*__ity == *__itx)) - return false; - } - return true; - } - - /// Specialization. - template - struct _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits, false> - : public _Equality_base - { - using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits>; - - bool - _M_equal(const __hashtable&) const; - }; - - template - bool - _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits, false>:: - _M_equal(const __hashtable& __other) const - { - const __hashtable* __this = static_cast(this); - - if (__this->size() != __other.size()) - return false; - - for (auto __itx = __this->begin(); __itx != __this->end();) - { - const auto __xrange = __this->equal_range(_ExtractKey()(*__itx)); - const auto __yrange = __other.equal_range(_ExtractKey()(*__itx)); - - if (std::distance(__xrange.first, __xrange.second) - != std::distance(__yrange.first, __yrange.second)) - return false; - - if (!_S_is_permutation(__xrange.first, __xrange.second, - __yrange.first)) - return false; - - __itx = __xrange.second; - } - return true; - } - - /** - * This type deals with all allocation and keeps an allocator instance through - * inheritance to benefit from EBO when possible. - */ - template - struct _Hashtable_alloc : private _Hashtable_ebo_helper<0, _NodeAlloc> - { - private: - using __ebo_node_alloc = _Hashtable_ebo_helper<0, _NodeAlloc>; - public: - using __node_type = typename _NodeAlloc::value_type; - using __node_alloc_type = _NodeAlloc; - // Use __gnu_cxx to benefit from _S_always_equal and al. - using __node_alloc_traits = __gnu_cxx::__alloc_traits<__node_alloc_type>; - - using __value_type = typename __node_type::value_type; - using __value_alloc_type = - __alloc_rebind<__node_alloc_type, __value_type>; - using __value_alloc_traits = std::allocator_traits<__value_alloc_type>; - - using __node_base = __detail::_Hash_node_base; - using __bucket_type = __node_base*; - using __bucket_alloc_type = - __alloc_rebind<__node_alloc_type, __bucket_type>; - using __bucket_alloc_traits = std::allocator_traits<__bucket_alloc_type>; - - _Hashtable_alloc() = default; - _Hashtable_alloc(const _Hashtable_alloc&) = default; - _Hashtable_alloc(_Hashtable_alloc&&) = default; - - template - _Hashtable_alloc(_Alloc&& __a) - : __ebo_node_alloc(std::forward<_Alloc>(__a)) - { } - - __node_alloc_type& - _M_node_allocator() - { return __ebo_node_alloc::_S_get(*this); } - - const __node_alloc_type& - _M_node_allocator() const - { return __ebo_node_alloc::_S_cget(*this); } - - template - __node_type* - _M_allocate_node(_Args&&... __args); - - void - _M_deallocate_node(__node_type* __n); - - // Deallocate the linked list of nodes pointed to by __n - void - _M_deallocate_nodes(__node_type* __n); - - __bucket_type* - _M_allocate_buckets(std::size_t __n); - - void - _M_deallocate_buckets(__bucket_type*, std::size_t __n); - }; - - // Definitions of class template _Hashtable_alloc's out-of-line member - // functions. - template - template - typename _Hashtable_alloc<_NodeAlloc>::__node_type* - _Hashtable_alloc<_NodeAlloc>::_M_allocate_node(_Args&&... __args) - { - auto __nptr = __node_alloc_traits::allocate(_M_node_allocator(), 1); - __node_type* __n = std::__addressof(*__nptr); - __try - { - __value_alloc_type __a(_M_node_allocator()); - ::new ((void*)__n) __node_type; - __value_alloc_traits::construct(__a, __n->_M_valptr(), - std::forward<_Args>(__args)...); - return __n; - } - __catch(...) - { - __node_alloc_traits::deallocate(_M_node_allocator(), __nptr, 1); - __throw_exception_again; - } - } - - template - void - _Hashtable_alloc<_NodeAlloc>::_M_deallocate_node(__node_type* __n) - { - typedef typename __node_alloc_traits::pointer _Ptr; - auto __ptr = std::pointer_traits<_Ptr>::pointer_to(*__n); - __value_alloc_type __a(_M_node_allocator()); - __value_alloc_traits::destroy(__a, __n->_M_valptr()); - __n->~__node_type(); - __node_alloc_traits::deallocate(_M_node_allocator(), __ptr, 1); - } - - template - void - _Hashtable_alloc<_NodeAlloc>::_M_deallocate_nodes(__node_type* __n) - { - while (__n) - { - __node_type* __tmp = __n; - __n = __n->_M_next(); - _M_deallocate_node(__tmp); - } - } - - template - typename _Hashtable_alloc<_NodeAlloc>::__bucket_type* - _Hashtable_alloc<_NodeAlloc>::_M_allocate_buckets(std::size_t __n) - { - __bucket_alloc_type __alloc(_M_node_allocator()); - - auto __ptr = __bucket_alloc_traits::allocate(__alloc, __n); - __bucket_type* __p = std::__addressof(*__ptr); - __builtin_memset(__p, 0, __n * sizeof(__bucket_type)); - return __p; - } - - template - void - _Hashtable_alloc<_NodeAlloc>::_M_deallocate_buckets(__bucket_type* __bkts, - std::size_t __n) - { - typedef typename __bucket_alloc_traits::pointer _Ptr; - auto __ptr = std::pointer_traits<_Ptr>::pointer_to(*__bkts); - __bucket_alloc_type __alloc(_M_node_allocator()); - __bucket_alloc_traits::deallocate(__alloc, __ptr, __n); - } - - //@} hashtable-detail -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace __detail -} // namespace std - -#endif // _HASHTABLE_POLICY_H diff --git a/openflow/usr/include/c++/5/bits/indirect_array.h b/openflow/usr/include/c++/5/bits/indirect_array.h deleted file mode 100644 index 7228c68..0000000 --- a/openflow/usr/include/c++/5/bits/indirect_array.h +++ /dev/null @@ -1,212 +0,0 @@ -// The template and inlines for the -*- C++ -*- indirect_array class. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/indirect_array.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{valarray} - */ - -// Written by Gabriel Dos Reis - -#ifndef _INDIRECT_ARRAY_H -#define _INDIRECT_ARRAY_H 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup numeric_arrays - * @{ - */ - - /** - * @brief Reference to arbitrary subset of an array. - * - * An indirect_array is a reference to the actual elements of an array - * specified by an ordered array of indices. The way to get an - * indirect_array is to call operator[](valarray) on a valarray. - * The returned indirect_array then permits carrying operations out on the - * referenced subset of elements in the original valarray. - * - * For example, if an indirect_array is obtained using the array (4,2,0) as - * an argument, and then assigned to an array containing (1,2,3), then the - * underlying array will have array[0]==3, array[2]==2, and array[4]==1. - * - * @param Tp Element type. - */ - template - class indirect_array - { - public: - typedef _Tp value_type; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 253. valarray helper functions are almost entirely useless - - /// Copy constructor. Both slices refer to the same underlying array. - indirect_array(const indirect_array&); - - /// Assignment operator. Assigns elements to corresponding elements - /// of @a a. - indirect_array& operator=(const indirect_array&); - - /// Assign slice elements to corresponding elements of @a v. - void operator=(const valarray<_Tp>&) const; - /// Multiply slice elements by corresponding elements of @a v. - void operator*=(const valarray<_Tp>&) const; - /// Divide slice elements by corresponding elements of @a v. - void operator/=(const valarray<_Tp>&) const; - /// Modulo slice elements by corresponding elements of @a v. - void operator%=(const valarray<_Tp>&) const; - /// Add corresponding elements of @a v to slice elements. - void operator+=(const valarray<_Tp>&) const; - /// Subtract corresponding elements of @a v from slice elements. - void operator-=(const valarray<_Tp>&) const; - /// Logical xor slice elements with corresponding elements of @a v. - void operator^=(const valarray<_Tp>&) const; - /// Logical and slice elements with corresponding elements of @a v. - void operator&=(const valarray<_Tp>&) const; - /// Logical or slice elements with corresponding elements of @a v. - void operator|=(const valarray<_Tp>&) const; - /// Left shift slice elements by corresponding elements of @a v. - void operator<<=(const valarray<_Tp>&) const; - /// Right shift slice elements by corresponding elements of @a v. - void operator>>=(const valarray<_Tp>&) const; - /// Assign all slice elements to @a t. - void operator= (const _Tp&) const; - // ~indirect_array(); - - template - void operator=(const _Expr<_Dom, _Tp>&) const; - template - void operator*=(const _Expr<_Dom, _Tp>&) const; - template - void operator/=(const _Expr<_Dom, _Tp>&) const; - template - void operator%=(const _Expr<_Dom, _Tp>&) const; - template - void operator+=(const _Expr<_Dom, _Tp>&) const; - template - void operator-=(const _Expr<_Dom, _Tp>&) const; - template - void operator^=(const _Expr<_Dom, _Tp>&) const; - template - void operator&=(const _Expr<_Dom, _Tp>&) const; - template - void operator|=(const _Expr<_Dom, _Tp>&) const; - template - void operator<<=(const _Expr<_Dom, _Tp>&) const; - template - void operator>>=(const _Expr<_Dom, _Tp>&) const; - - private: - /// Copy constructor. Both slices refer to the same underlying array. - indirect_array(_Array<_Tp>, size_t, _Array); - - friend class valarray<_Tp>; - friend class gslice_array<_Tp>; - - const size_t _M_sz; - const _Array _M_index; - const _Array<_Tp> _M_array; - - // not implemented - indirect_array(); - }; - - template - inline - indirect_array<_Tp>::indirect_array(const indirect_array<_Tp>& __a) - : _M_sz(__a._M_sz), _M_index(__a._M_index), _M_array(__a._M_array) {} - - template - inline - indirect_array<_Tp>::indirect_array(_Array<_Tp> __a, size_t __s, - _Array __i) - : _M_sz(__s), _M_index(__i), _M_array(__a) {} - - template - inline indirect_array<_Tp>& - indirect_array<_Tp>::operator=(const indirect_array<_Tp>& __a) - { - std::__valarray_copy(__a._M_array, _M_sz, __a._M_index, _M_array, - _M_index); - return *this; - } - - template - inline void - indirect_array<_Tp>::operator=(const _Tp& __t) const - { std::__valarray_fill(_M_array, _M_index, _M_sz, __t); } - - template - inline void - indirect_array<_Tp>::operator=(const valarray<_Tp>& __v) const - { std::__valarray_copy(_Array<_Tp>(__v), _M_sz, _M_array, _M_index); } - - template - template - inline void - indirect_array<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) const - { std::__valarray_copy(__e, _M_sz, _M_array, _M_index); } - -#undef _DEFINE_VALARRAY_OPERATOR -#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \ - template \ - inline void \ - indirect_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const\ - { \ - _Array_augmented_##_Name(_M_array, _M_index, _Array<_Tp>(__v), _M_sz); \ - } \ - \ - template \ - template \ - inline void \ - indirect_array<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e) const\ - { \ - _Array_augmented_##_Name(_M_array, _M_index, __e, _M_sz); \ - } - -_DEFINE_VALARRAY_OPERATOR(*, __multiplies) -_DEFINE_VALARRAY_OPERATOR(/, __divides) -_DEFINE_VALARRAY_OPERATOR(%, __modulus) -_DEFINE_VALARRAY_OPERATOR(+, __plus) -_DEFINE_VALARRAY_OPERATOR(-, __minus) -_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor) -_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and) -_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or) -_DEFINE_VALARRAY_OPERATOR(<<, __shift_left) -_DEFINE_VALARRAY_OPERATOR(>>, __shift_right) - -#undef _DEFINE_VALARRAY_OPERATOR - - // @} group numeric_arrays - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _INDIRECT_ARRAY_H */ diff --git a/openflow/usr/include/c++/5/bits/ios_base.h b/openflow/usr/include/c++/5/bits/ios_base.h deleted file mode 100644 index 908ba7c..0000000 --- a/openflow/usr/include/c++/5/bits/ios_base.h +++ /dev/null @@ -1,1079 +0,0 @@ -// Iostreams base classes -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/ios_base.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{ios} - */ - -// -// ISO C++ 14882: 27.4 Iostreams base classes -// - -#ifndef _IOS_BASE_H -#define _IOS_BASE_H 1 - -#pragma GCC system_header - -#include -#include -#include - -#if __cplusplus < 201103L -# include -#else -# include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // The following definitions of bitmask types are enums, not ints, - // as permitted (but not required) in the standard, in order to provide - // better type safety in iostream calls. A side effect is that - // expressions involving them are no longer compile-time constants. - enum _Ios_Fmtflags - { - _S_boolalpha = 1L << 0, - _S_dec = 1L << 1, - _S_fixed = 1L << 2, - _S_hex = 1L << 3, - _S_internal = 1L << 4, - _S_left = 1L << 5, - _S_oct = 1L << 6, - _S_right = 1L << 7, - _S_scientific = 1L << 8, - _S_showbase = 1L << 9, - _S_showpoint = 1L << 10, - _S_showpos = 1L << 11, - _S_skipws = 1L << 12, - _S_unitbuf = 1L << 13, - _S_uppercase = 1L << 14, - _S_adjustfield = _S_left | _S_right | _S_internal, - _S_basefield = _S_dec | _S_oct | _S_hex, - _S_floatfield = _S_scientific | _S_fixed, - _S_ios_fmtflags_end = 1L << 16, - _S_ios_fmtflags_max = __INT_MAX__, - _S_ios_fmtflags_min = ~__INT_MAX__ - }; - - inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags - operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) - { return _Ios_Fmtflags(static_cast(__a) & static_cast(__b)); } - - inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags - operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b) - { return _Ios_Fmtflags(static_cast(__a) | static_cast(__b)); } - - inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags - operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b) - { return _Ios_Fmtflags(static_cast(__a) ^ static_cast(__b)); } - - inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags - operator~(_Ios_Fmtflags __a) - { return _Ios_Fmtflags(~static_cast(__a)); } - - inline const _Ios_Fmtflags& - operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) - { return __a = __a | __b; } - - inline const _Ios_Fmtflags& - operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) - { return __a = __a & __b; } - - inline const _Ios_Fmtflags& - operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) - { return __a = __a ^ __b; } - - - enum _Ios_Openmode - { - _S_app = 1L << 0, - _S_ate = 1L << 1, - _S_bin = 1L << 2, - _S_in = 1L << 3, - _S_out = 1L << 4, - _S_trunc = 1L << 5, - _S_ios_openmode_end = 1L << 16, - _S_ios_openmode_max = __INT_MAX__, - _S_ios_openmode_min = ~__INT_MAX__ - }; - - inline _GLIBCXX_CONSTEXPR _Ios_Openmode - operator&(_Ios_Openmode __a, _Ios_Openmode __b) - { return _Ios_Openmode(static_cast(__a) & static_cast(__b)); } - - inline _GLIBCXX_CONSTEXPR _Ios_Openmode - operator|(_Ios_Openmode __a, _Ios_Openmode __b) - { return _Ios_Openmode(static_cast(__a) | static_cast(__b)); } - - inline _GLIBCXX_CONSTEXPR _Ios_Openmode - operator^(_Ios_Openmode __a, _Ios_Openmode __b) - { return _Ios_Openmode(static_cast(__a) ^ static_cast(__b)); } - - inline _GLIBCXX_CONSTEXPR _Ios_Openmode - operator~(_Ios_Openmode __a) - { return _Ios_Openmode(~static_cast(__a)); } - - inline const _Ios_Openmode& - operator|=(_Ios_Openmode& __a, _Ios_Openmode __b) - { return __a = __a | __b; } - - inline const _Ios_Openmode& - operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) - { return __a = __a & __b; } - - inline const _Ios_Openmode& - operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) - { return __a = __a ^ __b; } - - - enum _Ios_Iostate - { - _S_goodbit = 0, - _S_badbit = 1L << 0, - _S_eofbit = 1L << 1, - _S_failbit = 1L << 2, - _S_ios_iostate_end = 1L << 16, - _S_ios_iostate_max = __INT_MAX__, - _S_ios_iostate_min = ~__INT_MAX__ - }; - - inline _GLIBCXX_CONSTEXPR _Ios_Iostate - operator&(_Ios_Iostate __a, _Ios_Iostate __b) - { return _Ios_Iostate(static_cast(__a) & static_cast(__b)); } - - inline _GLIBCXX_CONSTEXPR _Ios_Iostate - operator|(_Ios_Iostate __a, _Ios_Iostate __b) - { return _Ios_Iostate(static_cast(__a) | static_cast(__b)); } - - inline _GLIBCXX_CONSTEXPR _Ios_Iostate - operator^(_Ios_Iostate __a, _Ios_Iostate __b) - { return _Ios_Iostate(static_cast(__a) ^ static_cast(__b)); } - - inline _GLIBCXX_CONSTEXPR _Ios_Iostate - operator~(_Ios_Iostate __a) - { return _Ios_Iostate(~static_cast(__a)); } - - inline const _Ios_Iostate& - operator|=(_Ios_Iostate& __a, _Ios_Iostate __b) - { return __a = __a | __b; } - - inline const _Ios_Iostate& - operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) - { return __a = __a & __b; } - - inline const _Ios_Iostate& - operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) - { return __a = __a ^ __b; } - - - enum _Ios_Seekdir - { - _S_beg = 0, - _S_cur = _GLIBCXX_STDIO_SEEK_CUR, - _S_end = _GLIBCXX_STDIO_SEEK_END, - _S_ios_seekdir_end = 1L << 16 - }; - -#if __cplusplus >= 201103L - /// I/O error code - enum class io_errc { stream = 1 }; - - template <> struct is_error_code_enum : public true_type { }; - - const error_category& iostream_category() noexcept; - - inline error_code - make_error_code(io_errc e) noexcept - { return error_code(static_cast(e), iostream_category()); } - - inline error_condition - make_error_condition(io_errc e) noexcept - { return error_condition(static_cast(e), iostream_category()); } -#endif - - // 27.4.2 Class ios_base - /** - * @brief The base of the I/O class hierarchy. - * @ingroup io - * - * This class defines everything that can be defined about I/O that does - * not depend on the type of characters being input or output. Most - * people will only see @c ios_base when they need to specify the full - * name of the various I/O flags (e.g., the openmodes). - */ - class ios_base - { -#if _GLIBCXX_USE_CXX11_ABI -#if __cplusplus < 201103L - // Type that is layout-compatible with std::system_error - struct system_error : std::runtime_error - { - // Type that is layout-compatible with std::error_code - struct error_code - { - error_code() { } - private: - int _M_value; - const void* _M_cat; - } _M_code; - }; -#endif -#endif - public: - - /** - * @brief These are thrown to indicate problems with io. - * @ingroup exceptions - * - * 27.4.2.1.1 Class ios_base::failure - */ -#if _GLIBCXX_USE_CXX11_ABI - class _GLIBCXX_ABI_TAG_CXX11 failure : public system_error - { - public: - explicit - failure(const string& __str); - -#if __cplusplus >= 201103L - explicit - failure(const string&, const error_code&); - - explicit - failure(const char*, const error_code& = io_errc::stream); -#endif - - virtual - ~failure() throw(); - - virtual const char* - what() const throw(); - }; -#else - class failure : public exception - { - public: - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 48. Use of non-existent exception constructor - explicit - failure(const string& __str) throw(); - - // This declaration is not useless: - // http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Vague-Linkage.html - virtual - ~failure() throw(); - - virtual const char* - what() const throw(); - - private: - string _M_msg; - }; -#endif - - // 27.4.2.1.2 Type ios_base::fmtflags - /** - * @brief This is a bitmask type. - * - * @c @a _Ios_Fmtflags is implementation-defined, but it is valid to - * perform bitwise operations on these values and expect the Right - * Thing to happen. Defined objects of type fmtflags are: - * - boolalpha - * - dec - * - fixed - * - hex - * - internal - * - left - * - oct - * - right - * - scientific - * - showbase - * - showpoint - * - showpos - * - skipws - * - unitbuf - * - uppercase - * - adjustfield - * - basefield - * - floatfield - */ - typedef _Ios_Fmtflags fmtflags; - - /// Insert/extract @c bool in alphabetic rather than numeric format. - static const fmtflags boolalpha = _S_boolalpha; - - /// Converts integer input or generates integer output in decimal base. - static const fmtflags dec = _S_dec; - - /// Generate floating-point output in fixed-point notation. - static const fmtflags fixed = _S_fixed; - - /// Converts integer input or generates integer output in hexadecimal base. - static const fmtflags hex = _S_hex; - - /// Adds fill characters at a designated internal point in certain - /// generated output, or identical to @c right if no such point is - /// designated. - static const fmtflags internal = _S_internal; - - /// Adds fill characters on the right (final positions) of certain - /// generated output. (I.e., the thing you print is flush left.) - static const fmtflags left = _S_left; - - /// Converts integer input or generates integer output in octal base. - static const fmtflags oct = _S_oct; - - /// Adds fill characters on the left (initial positions) of certain - /// generated output. (I.e., the thing you print is flush right.) - static const fmtflags right = _S_right; - - /// Generates floating-point output in scientific notation. - static const fmtflags scientific = _S_scientific; - - /// Generates a prefix indicating the numeric base of generated integer - /// output. - static const fmtflags showbase = _S_showbase; - - /// Generates a decimal-point character unconditionally in generated - /// floating-point output. - static const fmtflags showpoint = _S_showpoint; - - /// Generates a + sign in non-negative generated numeric output. - static const fmtflags showpos = _S_showpos; - - /// Skips leading white space before certain input operations. - static const fmtflags skipws = _S_skipws; - - /// Flushes output after each output operation. - static const fmtflags unitbuf = _S_unitbuf; - - /// Replaces certain lowercase letters with their uppercase equivalents - /// in generated output. - static const fmtflags uppercase = _S_uppercase; - - /// A mask of left|right|internal. Useful for the 2-arg form of @c setf. - static const fmtflags adjustfield = _S_adjustfield; - - /// A mask of dec|oct|hex. Useful for the 2-arg form of @c setf. - static const fmtflags basefield = _S_basefield; - - /// A mask of scientific|fixed. Useful for the 2-arg form of @c setf. - static const fmtflags floatfield = _S_floatfield; - - // 27.4.2.1.3 Type ios_base::iostate - /** - * @brief This is a bitmask type. - * - * @c @a _Ios_Iostate is implementation-defined, but it is valid to - * perform bitwise operations on these values and expect the Right - * Thing to happen. Defined objects of type iostate are: - * - badbit - * - eofbit - * - failbit - * - goodbit - */ - typedef _Ios_Iostate iostate; - - /// Indicates a loss of integrity in an input or output sequence (such - /// as an irrecoverable read error from a file). - static const iostate badbit = _S_badbit; - - /// Indicates that an input operation reached the end of an input sequence. - static const iostate eofbit = _S_eofbit; - - /// Indicates that an input operation failed to read the expected - /// characters, or that an output operation failed to generate the - /// desired characters. - static const iostate failbit = _S_failbit; - - /// Indicates all is well. - static const iostate goodbit = _S_goodbit; - - // 27.4.2.1.4 Type ios_base::openmode - /** - * @brief This is a bitmask type. - * - * @c @a _Ios_Openmode is implementation-defined, but it is valid to - * perform bitwise operations on these values and expect the Right - * Thing to happen. Defined objects of type openmode are: - * - app - * - ate - * - binary - * - in - * - out - * - trunc - */ - typedef _Ios_Openmode openmode; - - /// Seek to end before each write. - static const openmode app = _S_app; - - /// Open and seek to end immediately after opening. - static const openmode ate = _S_ate; - - /// Perform input and output in binary mode (as opposed to text mode). - /// This is probably not what you think it is; see - /// https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary - static const openmode binary = _S_bin; - - /// Open for input. Default for @c ifstream and fstream. - static const openmode in = _S_in; - - /// Open for output. Default for @c ofstream and fstream. - static const openmode out = _S_out; - - /// Open for input. Default for @c ofstream. - static const openmode trunc = _S_trunc; - - // 27.4.2.1.5 Type ios_base::seekdir - /** - * @brief This is an enumerated type. - * - * @c @a _Ios_Seekdir is implementation-defined. Defined values - * of type seekdir are: - * - beg - * - cur, equivalent to @c SEEK_CUR in the C standard library. - * - end, equivalent to @c SEEK_END in the C standard library. - */ - typedef _Ios_Seekdir seekdir; - - /// Request a seek relative to the beginning of the stream. - static const seekdir beg = _S_beg; - - /// Request a seek relative to the current position within the sequence. - static const seekdir cur = _S_cur; - - /// Request a seek relative to the current end of the sequence. - static const seekdir end = _S_end; - - // Annex D.6 - typedef int io_state; - typedef int open_mode; - typedef int seek_dir; - - typedef std::streampos streampos; - typedef std::streamoff streamoff; - - // Callbacks; - /** - * @brief The set of events that may be passed to an event callback. - * - * erase_event is used during ~ios() and copyfmt(). imbue_event is used - * during imbue(). copyfmt_event is used during copyfmt(). - */ - enum event - { - erase_event, - imbue_event, - copyfmt_event - }; - - /** - * @brief The type of an event callback function. - * @param __e One of the members of the event enum. - * @param __b Reference to the ios_base object. - * @param __i The integer provided when the callback was registered. - * - * Event callbacks are user defined functions that get called during - * several ios_base and basic_ios functions, specifically imbue(), - * copyfmt(), and ~ios(). - */ - typedef void (*event_callback) (event __e, ios_base& __b, int __i); - - /** - * @brief Add the callback __fn with parameter __index. - * @param __fn The function to add. - * @param __index The integer to pass to the function when invoked. - * - * Registers a function as an event callback with an integer parameter to - * be passed to the function when invoked. Multiple copies of the - * function are allowed. If there are multiple callbacks, they are - * invoked in the order they were registered. - */ - void - register_callback(event_callback __fn, int __index); - - protected: - streamsize _M_precision; - streamsize _M_width; - fmtflags _M_flags; - iostate _M_exception; - iostate _M_streambuf_state; - - // 27.4.2.6 Members for callbacks - // 27.4.2.6 ios_base callbacks - struct _Callback_list - { - // Data Members - _Callback_list* _M_next; - ios_base::event_callback _M_fn; - int _M_index; - _Atomic_word _M_refcount; // 0 means one reference. - - _Callback_list(ios_base::event_callback __fn, int __index, - _Callback_list* __cb) - : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { } - - void - _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } - - // 0 => OK to delete. - int - _M_remove_reference() - { - // Be race-detector-friendly. For more info see bits/c++config. - _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); - int __res = __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1); - if (__res == 0) - { - _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); - } - return __res; - } - }; - - _Callback_list* _M_callbacks; - - void - _M_call_callbacks(event __ev) throw(); - - void - _M_dispose_callbacks(void) throw(); - - // 27.4.2.5 Members for iword/pword storage - struct _Words - { - void* _M_pword; - long _M_iword; - _Words() : _M_pword(0), _M_iword(0) { } - }; - - // Only for failed iword/pword calls. - _Words _M_word_zero; - - // Guaranteed storage. - // The first 5 iword and pword slots are reserved for internal use. - enum { _S_local_word_size = 8 }; - _Words _M_local_word[_S_local_word_size]; - - // Allocated storage. - int _M_word_size; - _Words* _M_word; - - _Words& - _M_grow_words(int __index, bool __iword); - - // Members for locale and locale caching. - locale _M_ios_locale; - - void - _M_init() throw(); - - public: - - // 27.4.2.1.6 Class ios_base::Init - // Used to initialize standard streams. In theory, g++ could use - // -finit-priority to order this stuff correctly without going - // through these machinations. - class Init - { - friend class ios_base; - public: - Init(); - ~Init(); - - private: - static _Atomic_word _S_refcount; - static bool _S_synced_with_stdio; - }; - - // [27.4.2.2] fmtflags state functions - /** - * @brief Access to format flags. - * @return The format control flags for both input and output. - */ - fmtflags - flags() const - { return _M_flags; } - - /** - * @brief Setting new format flags all at once. - * @param __fmtfl The new flags to set. - * @return The previous format control flags. - * - * This function overwrites all the format flags with @a __fmtfl. - */ - fmtflags - flags(fmtflags __fmtfl) - { - fmtflags __old = _M_flags; - _M_flags = __fmtfl; - return __old; - } - - /** - * @brief Setting new format flags. - * @param __fmtfl Additional flags to set. - * @return The previous format control flags. - * - * This function sets additional flags in format control. Flags that - * were previously set remain set. - */ - fmtflags - setf(fmtflags __fmtfl) - { - fmtflags __old = _M_flags; - _M_flags |= __fmtfl; - return __old; - } - - /** - * @brief Setting new format flags. - * @param __fmtfl Additional flags to set. - * @param __mask The flags mask for @a fmtfl. - * @return The previous format control flags. - * - * This function clears @a mask in the format flags, then sets - * @a fmtfl @c & @a mask. An example mask is @c ios_base::adjustfield. - */ - fmtflags - setf(fmtflags __fmtfl, fmtflags __mask) - { - fmtflags __old = _M_flags; - _M_flags &= ~__mask; - _M_flags |= (__fmtfl & __mask); - return __old; - } - - /** - * @brief Clearing format flags. - * @param __mask The flags to unset. - * - * This function clears @a __mask in the format flags. - */ - void - unsetf(fmtflags __mask) - { _M_flags &= ~__mask; } - - /** - * @brief Flags access. - * @return The precision to generate on certain output operations. - * - * Be careful if you try to give a definition of @a precision here; see - * DR 189. - */ - streamsize - precision() const - { return _M_precision; } - - /** - * @brief Changing flags. - * @param __prec The new precision value. - * @return The previous value of precision(). - */ - streamsize - precision(streamsize __prec) - { - streamsize __old = _M_precision; - _M_precision = __prec; - return __old; - } - - /** - * @brief Flags access. - * @return The minimum field width to generate on output operations. - * - * Minimum field width refers to the number of characters. - */ - streamsize - width() const - { return _M_width; } - - /** - * @brief Changing flags. - * @param __wide The new width value. - * @return The previous value of width(). - */ - streamsize - width(streamsize __wide) - { - streamsize __old = _M_width; - _M_width = __wide; - return __old; - } - - // [27.4.2.4] ios_base static members - /** - * @brief Interaction with the standard C I/O objects. - * @param __sync Whether to synchronize or not. - * @return True if the standard streams were previously synchronized. - * - * The synchronization referred to is @e only that between the standard - * C facilities (e.g., stdout) and the standard C++ objects (e.g., - * cout). User-declared streams are unaffected. See - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary - */ - static bool - sync_with_stdio(bool __sync = true); - - // [27.4.2.3] ios_base locale functions - /** - * @brief Setting a new locale. - * @param __loc The new locale. - * @return The previous locale. - * - * Sets the new locale for this stream, and then invokes each callback - * with imbue_event. - */ - locale - imbue(const locale& __loc) throw(); - - /** - * @brief Locale access - * @return A copy of the current locale. - * - * If @c imbue(loc) has previously been called, then this function - * returns @c loc. Otherwise, it returns a copy of @c std::locale(), - * the global C++ locale. - */ - locale - getloc() const - { return _M_ios_locale; } - - /** - * @brief Locale access - * @return A reference to the current locale. - * - * Like getloc above, but returns a reference instead of - * generating a copy. - */ - const locale& - _M_getloc() const - { return _M_ios_locale; } - - // [27.4.2.5] ios_base storage functions - /** - * @brief Access to unique indices. - * @return An integer different from all previous calls. - * - * This function returns a unique integer every time it is called. It - * can be used for any purpose, but is primarily intended to be a unique - * index for the iword and pword functions. The expectation is that an - * application calls xalloc in order to obtain an index in the iword and - * pword arrays that can be used without fear of conflict. - * - * The implementation maintains a static variable that is incremented and - * returned on each invocation. xalloc is guaranteed to return an index - * that is safe to use in the iword and pword arrays. - */ - static int - xalloc() throw(); - - /** - * @brief Access to integer array. - * @param __ix Index into the array. - * @return A reference to an integer associated with the index. - * - * The iword function provides access to an array of integers that can be - * used for any purpose. The array grows as required to hold the - * supplied index. All integers in the array are initialized to 0. - * - * The implementation reserves several indices. You should use xalloc to - * obtain an index that is safe to use. Also note that since the array - * can grow dynamically, it is not safe to hold onto the reference. - */ - long& - iword(int __ix) - { - _Words& __word = (__ix < _M_word_size) - ? _M_word[__ix] : _M_grow_words(__ix, true); - return __word._M_iword; - } - - /** - * @brief Access to void pointer array. - * @param __ix Index into the array. - * @return A reference to a void* associated with the index. - * - * The pword function provides access to an array of pointers that can be - * used for any purpose. The array grows as required to hold the - * supplied index. All pointers in the array are initialized to 0. - * - * The implementation reserves several indices. You should use xalloc to - * obtain an index that is safe to use. Also note that since the array - * can grow dynamically, it is not safe to hold onto the reference. - */ - void*& - pword(int __ix) - { - _Words& __word = (__ix < _M_word_size) - ? _M_word[__ix] : _M_grow_words(__ix, false); - return __word._M_pword; - } - - // Destructor - /** - * Invokes each callback with erase_event. Destroys local storage. - * - * Note that the ios_base object for the standard streams never gets - * destroyed. As a result, any callbacks registered with the standard - * streams will not get invoked with erase_event (unless copyfmt is - * used). - */ - virtual ~ios_base(); - - protected: - ios_base() throw (); - -#if __cplusplus < 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 50. Copy constructor and assignment operator of ios_base - private: - ios_base(const ios_base&); - - ios_base& - operator=(const ios_base&); -#else - public: - ios_base(const ios_base&) = delete; - - ios_base& - operator=(const ios_base&) = delete; - - protected: - void - _M_move(ios_base&) noexcept; - - void - _M_swap(ios_base& __rhs) noexcept; -#endif - }; - - // [27.4.5.1] fmtflags manipulators - /// Calls base.setf(ios_base::boolalpha). - inline ios_base& - boolalpha(ios_base& __base) - { - __base.setf(ios_base::boolalpha); - return __base; - } - - /// Calls base.unsetf(ios_base::boolalpha). - inline ios_base& - noboolalpha(ios_base& __base) - { - __base.unsetf(ios_base::boolalpha); - return __base; - } - - /// Calls base.setf(ios_base::showbase). - inline ios_base& - showbase(ios_base& __base) - { - __base.setf(ios_base::showbase); - return __base; - } - - /// Calls base.unsetf(ios_base::showbase). - inline ios_base& - noshowbase(ios_base& __base) - { - __base.unsetf(ios_base::showbase); - return __base; - } - - /// Calls base.setf(ios_base::showpoint). - inline ios_base& - showpoint(ios_base& __base) - { - __base.setf(ios_base::showpoint); - return __base; - } - - /// Calls base.unsetf(ios_base::showpoint). - inline ios_base& - noshowpoint(ios_base& __base) - { - __base.unsetf(ios_base::showpoint); - return __base; - } - - /// Calls base.setf(ios_base::showpos). - inline ios_base& - showpos(ios_base& __base) - { - __base.setf(ios_base::showpos); - return __base; - } - - /// Calls base.unsetf(ios_base::showpos). - inline ios_base& - noshowpos(ios_base& __base) - { - __base.unsetf(ios_base::showpos); - return __base; - } - - /// Calls base.setf(ios_base::skipws). - inline ios_base& - skipws(ios_base& __base) - { - __base.setf(ios_base::skipws); - return __base; - } - - /// Calls base.unsetf(ios_base::skipws). - inline ios_base& - noskipws(ios_base& __base) - { - __base.unsetf(ios_base::skipws); - return __base; - } - - /// Calls base.setf(ios_base::uppercase). - inline ios_base& - uppercase(ios_base& __base) - { - __base.setf(ios_base::uppercase); - return __base; - } - - /// Calls base.unsetf(ios_base::uppercase). - inline ios_base& - nouppercase(ios_base& __base) - { - __base.unsetf(ios_base::uppercase); - return __base; - } - - /// Calls base.setf(ios_base::unitbuf). - inline ios_base& - unitbuf(ios_base& __base) - { - __base.setf(ios_base::unitbuf); - return __base; - } - - /// Calls base.unsetf(ios_base::unitbuf). - inline ios_base& - nounitbuf(ios_base& __base) - { - __base.unsetf(ios_base::unitbuf); - return __base; - } - - // [27.4.5.2] adjustfield manipulators - /// Calls base.setf(ios_base::internal, ios_base::adjustfield). - inline ios_base& - internal(ios_base& __base) - { - __base.setf(ios_base::internal, ios_base::adjustfield); - return __base; - } - - /// Calls base.setf(ios_base::left, ios_base::adjustfield). - inline ios_base& - left(ios_base& __base) - { - __base.setf(ios_base::left, ios_base::adjustfield); - return __base; - } - - /// Calls base.setf(ios_base::right, ios_base::adjustfield). - inline ios_base& - right(ios_base& __base) - { - __base.setf(ios_base::right, ios_base::adjustfield); - return __base; - } - - // [27.4.5.3] basefield manipulators - /// Calls base.setf(ios_base::dec, ios_base::basefield). - inline ios_base& - dec(ios_base& __base) - { - __base.setf(ios_base::dec, ios_base::basefield); - return __base; - } - - /// Calls base.setf(ios_base::hex, ios_base::basefield). - inline ios_base& - hex(ios_base& __base) - { - __base.setf(ios_base::hex, ios_base::basefield); - return __base; - } - - /// Calls base.setf(ios_base::oct, ios_base::basefield). - inline ios_base& - oct(ios_base& __base) - { - __base.setf(ios_base::oct, ios_base::basefield); - return __base; - } - - // [27.4.5.4] floatfield manipulators - /// Calls base.setf(ios_base::fixed, ios_base::floatfield). - inline ios_base& - fixed(ios_base& __base) - { - __base.setf(ios_base::fixed, ios_base::floatfield); - return __base; - } - - /// Calls base.setf(ios_base::scientific, ios_base::floatfield). - inline ios_base& - scientific(ios_base& __base) - { - __base.setf(ios_base::scientific, ios_base::floatfield); - return __base; - } - -#if __cplusplus >= 201103L - // New C++11 floatfield manipulators - - /// Calls - /// base.setf(ios_base::fixed|ios_base::scientific, ios_base::floatfield) - inline ios_base& - hexfloat(ios_base& __base) - { - __base.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield); - return __base; - } - - /// Calls @c base.unsetf(ios_base::floatfield) - inline ios_base& - defaultfloat(ios_base& __base) - { - __base.unsetf(ios_base::floatfield); - return __base; - } -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _IOS_BASE_H */ diff --git a/openflow/usr/include/c++/5/bits/istream.tcc b/openflow/usr/include/c++/5/bits/istream.tcc deleted file mode 100644 index e8cbb26..0000000 --- a/openflow/usr/include/c++/5/bits/istream.tcc +++ /dev/null @@ -1,1092 +0,0 @@ -// istream classes -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/istream.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{istream} - */ - -// -// ISO C++ 14882: 27.6.1 Input streams -// - -#ifndef _ISTREAM_TCC -#define _ISTREAM_TCC 1 - -#pragma GCC system_header - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - basic_istream<_CharT, _Traits>::sentry:: - sentry(basic_istream<_CharT, _Traits>& __in, bool __noskip) : _M_ok(false) - { - ios_base::iostate __err = ios_base::goodbit; - if (__in.good()) - { - if (__in.tie()) - __in.tie()->flush(); - if (!__noskip && bool(__in.flags() & ios_base::skipws)) - { - const __int_type __eof = traits_type::eof(); - __streambuf_type* __sb = __in.rdbuf(); - __int_type __c = __sb->sgetc(); - - const __ctype_type& __ct = __check_facet(__in._M_ctype); - while (!traits_type::eq_int_type(__c, __eof) - && __ct.is(ctype_base::space, - traits_type::to_char_type(__c))) - __c = __sb->snextc(); - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 195. Should basic_istream::sentry's constructor ever - // set eofbit? - if (traits_type::eq_int_type(__c, __eof)) - __err |= ios_base::eofbit; - } - } - - if (__in.good() && __err == ios_base::goodbit) - _M_ok = true; - else - { - __err |= ios_base::failbit; - __in.setstate(__err); - } - } - - template - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - _M_extract(_ValueT& __v) - { - sentry __cerb(*this, false); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - const __num_get_type& __ng = __check_facet(this->_M_num_get); - __ng.get(*this, 0, *this, __err, __v); - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return *this; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - operator>>(short& __n) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 118. basic_istream uses nonexistent num_get member functions. - sentry __cerb(*this, false); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - long __l; - const __num_get_type& __ng = __check_facet(this->_M_num_get); - __ng.get(*this, 0, *this, __err, __l); - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 696. istream::operator>>(int&) broken. - if (__l < __gnu_cxx::__numeric_traits::__min) - { - __err |= ios_base::failbit; - __n = __gnu_cxx::__numeric_traits::__min; - } - else if (__l > __gnu_cxx::__numeric_traits::__max) - { - __err |= ios_base::failbit; - __n = __gnu_cxx::__numeric_traits::__max; - } - else - __n = short(__l); - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return *this; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - operator>>(int& __n) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 118. basic_istream uses nonexistent num_get member functions. - sentry __cerb(*this, false); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - long __l; - const __num_get_type& __ng = __check_facet(this->_M_num_get); - __ng.get(*this, 0, *this, __err, __l); - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 696. istream::operator>>(int&) broken. - if (__l < __gnu_cxx::__numeric_traits::__min) - { - __err |= ios_base::failbit; - __n = __gnu_cxx::__numeric_traits::__min; - } - else if (__l > __gnu_cxx::__numeric_traits::__max) - { - __err |= ios_base::failbit; - __n = __gnu_cxx::__numeric_traits::__max; - } - else - __n = int(__l); - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return *this; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - operator>>(__streambuf_type* __sbout) - { - ios_base::iostate __err = ios_base::goodbit; - sentry __cerb(*this, false); - if (__cerb && __sbout) - { - __try - { - bool __ineof; - if (!__copy_streambufs_eof(this->rdbuf(), __sbout, __ineof)) - __err |= ios_base::failbit; - if (__ineof) - __err |= ios_base::eofbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::failbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::failbit); } - } - else if (!__sbout) - __err |= ios_base::failbit; - if (__err) - this->setstate(__err); - return *this; - } - - template - typename basic_istream<_CharT, _Traits>::int_type - basic_istream<_CharT, _Traits>:: - get(void) - { - const int_type __eof = traits_type::eof(); - int_type __c = __eof; - _M_gcount = 0; - ios_base::iostate __err = ios_base::goodbit; - sentry __cerb(*this, true); - if (__cerb) - { - __try - { - __c = this->rdbuf()->sbumpc(); - // 27.6.1.1 paragraph 3 - if (!traits_type::eq_int_type(__c, __eof)) - _M_gcount = 1; - else - __err |= ios_base::eofbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - } - if (!_M_gcount) - __err |= ios_base::failbit; - if (__err) - this->setstate(__err); - return __c; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - get(char_type& __c) - { - _M_gcount = 0; - ios_base::iostate __err = ios_base::goodbit; - sentry __cerb(*this, true); - if (__cerb) - { - __try - { - const int_type __cb = this->rdbuf()->sbumpc(); - // 27.6.1.1 paragraph 3 - if (!traits_type::eq_int_type(__cb, traits_type::eof())) - { - _M_gcount = 1; - __c = traits_type::to_char_type(__cb); - } - else - __err |= ios_base::eofbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - } - if (!_M_gcount) - __err |= ios_base::failbit; - if (__err) - this->setstate(__err); - return *this; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - get(char_type* __s, streamsize __n, char_type __delim) - { - _M_gcount = 0; - ios_base::iostate __err = ios_base::goodbit; - sentry __cerb(*this, true); - if (__cerb) - { - __try - { - const int_type __idelim = traits_type::to_int_type(__delim); - const int_type __eof = traits_type::eof(); - __streambuf_type* __sb = this->rdbuf(); - int_type __c = __sb->sgetc(); - - while (_M_gcount + 1 < __n - && !traits_type::eq_int_type(__c, __eof) - && !traits_type::eq_int_type(__c, __idelim)) - { - *__s++ = traits_type::to_char_type(__c); - ++_M_gcount; - __c = __sb->snextc(); - } - if (traits_type::eq_int_type(__c, __eof)) - __err |= ios_base::eofbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - } - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 243. get and getline when sentry reports failure. - if (__n > 0) - *__s = char_type(); - if (!_M_gcount) - __err |= ios_base::failbit; - if (__err) - this->setstate(__err); - return *this; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - get(__streambuf_type& __sb, char_type __delim) - { - _M_gcount = 0; - ios_base::iostate __err = ios_base::goodbit; - sentry __cerb(*this, true); - if (__cerb) - { - __try - { - const int_type __idelim = traits_type::to_int_type(__delim); - const int_type __eof = traits_type::eof(); - __streambuf_type* __this_sb = this->rdbuf(); - int_type __c = __this_sb->sgetc(); - char_type __c2 = traits_type::to_char_type(__c); - - while (!traits_type::eq_int_type(__c, __eof) - && !traits_type::eq_int_type(__c, __idelim) - && !traits_type::eq_int_type(__sb.sputc(__c2), __eof)) - { - ++_M_gcount; - __c = __this_sb->snextc(); - __c2 = traits_type::to_char_type(__c); - } - if (traits_type::eq_int_type(__c, __eof)) - __err |= ios_base::eofbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - } - if (!_M_gcount) - __err |= ios_base::failbit; - if (__err) - this->setstate(__err); - return *this; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - getline(char_type* __s, streamsize __n, char_type __delim) - { - _M_gcount = 0; - ios_base::iostate __err = ios_base::goodbit; - sentry __cerb(*this, true); - if (__cerb) - { - __try - { - const int_type __idelim = traits_type::to_int_type(__delim); - const int_type __eof = traits_type::eof(); - __streambuf_type* __sb = this->rdbuf(); - int_type __c = __sb->sgetc(); - - while (_M_gcount + 1 < __n - && !traits_type::eq_int_type(__c, __eof) - && !traits_type::eq_int_type(__c, __idelim)) - { - *__s++ = traits_type::to_char_type(__c); - __c = __sb->snextc(); - ++_M_gcount; - } - if (traits_type::eq_int_type(__c, __eof)) - __err |= ios_base::eofbit; - else - { - if (traits_type::eq_int_type(__c, __idelim)) - { - __sb->sbumpc(); - ++_M_gcount; - } - else - __err |= ios_base::failbit; - } - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - } - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 243. get and getline when sentry reports failure. - if (__n > 0) - *__s = char_type(); - if (!_M_gcount) - __err |= ios_base::failbit; - if (__err) - this->setstate(__err); - return *this; - } - - // We provide three overloads, since the first two are much simpler - // than the general case. Also, the latter two can thus adopt the - // same "batchy" strategy used by getline above. - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - ignore(void) - { - _M_gcount = 0; - sentry __cerb(*this, true); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - const int_type __eof = traits_type::eof(); - __streambuf_type* __sb = this->rdbuf(); - - if (traits_type::eq_int_type(__sb->sbumpc(), __eof)) - __err |= ios_base::eofbit; - else - _M_gcount = 1; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return *this; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - ignore(streamsize __n) - { - _M_gcount = 0; - sentry __cerb(*this, true); - if (__cerb && __n > 0) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - const int_type __eof = traits_type::eof(); - __streambuf_type* __sb = this->rdbuf(); - int_type __c = __sb->sgetc(); - - // N.B. On LFS-enabled platforms streamsize is still 32 bits - // wide: if we want to implement the standard mandated behavior - // for n == max() (see 27.6.1.3/24) we are at risk of signed - // integer overflow: thus these contortions. Also note that, - // by definition, when more than 2G chars are actually ignored, - // _M_gcount (the return value of gcount, that is) cannot be - // really correct, being unavoidably too small. - bool __large_ignore = false; - while (true) - { - while (_M_gcount < __n - && !traits_type::eq_int_type(__c, __eof)) - { - ++_M_gcount; - __c = __sb->snextc(); - } - if (__n == __gnu_cxx::__numeric_traits::__max - && !traits_type::eq_int_type(__c, __eof)) - { - _M_gcount = - __gnu_cxx::__numeric_traits::__min; - __large_ignore = true; - } - else - break; - } - - if (__large_ignore) - _M_gcount = __gnu_cxx::__numeric_traits::__max; - - if (traits_type::eq_int_type(__c, __eof)) - __err |= ios_base::eofbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return *this; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - ignore(streamsize __n, int_type __delim) - { - _M_gcount = 0; - sentry __cerb(*this, true); - if (__cerb && __n > 0) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - const int_type __eof = traits_type::eof(); - __streambuf_type* __sb = this->rdbuf(); - int_type __c = __sb->sgetc(); - - // See comment above. - bool __large_ignore = false; - while (true) - { - while (_M_gcount < __n - && !traits_type::eq_int_type(__c, __eof) - && !traits_type::eq_int_type(__c, __delim)) - { - ++_M_gcount; - __c = __sb->snextc(); - } - if (__n == __gnu_cxx::__numeric_traits::__max - && !traits_type::eq_int_type(__c, __eof) - && !traits_type::eq_int_type(__c, __delim)) - { - _M_gcount = - __gnu_cxx::__numeric_traits::__min; - __large_ignore = true; - } - else - break; - } - - if (__large_ignore) - _M_gcount = __gnu_cxx::__numeric_traits::__max; - - if (traits_type::eq_int_type(__c, __eof)) - __err |= ios_base::eofbit; - else if (traits_type::eq_int_type(__c, __delim)) - { - if (_M_gcount - < __gnu_cxx::__numeric_traits::__max) - ++_M_gcount; - __sb->sbumpc(); - } - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return *this; - } - - template - typename basic_istream<_CharT, _Traits>::int_type - basic_istream<_CharT, _Traits>:: - peek(void) - { - int_type __c = traits_type::eof(); - _M_gcount = 0; - sentry __cerb(*this, true); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - __c = this->rdbuf()->sgetc(); - if (traits_type::eq_int_type(__c, traits_type::eof())) - __err |= ios_base::eofbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return __c; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - read(char_type* __s, streamsize __n) - { - _M_gcount = 0; - sentry __cerb(*this, true); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - _M_gcount = this->rdbuf()->sgetn(__s, __n); - if (_M_gcount != __n) - __err |= (ios_base::eofbit | ios_base::failbit); - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return *this; - } - - template - streamsize - basic_istream<_CharT, _Traits>:: - readsome(char_type* __s, streamsize __n) - { - _M_gcount = 0; - sentry __cerb(*this, true); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - // Cannot compare int_type with streamsize generically. - const streamsize __num = this->rdbuf()->in_avail(); - if (__num > 0) - _M_gcount = this->rdbuf()->sgetn(__s, std::min(__num, __n)); - else if (__num == -1) - __err |= ios_base::eofbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return _M_gcount; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - putback(char_type __c) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 60. What is a formatted input function? - _M_gcount = 0; - // Clear eofbit per N3168. - this->clear(this->rdstate() & ~ios_base::eofbit); - sentry __cerb(*this, true); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - const int_type __eof = traits_type::eof(); - __streambuf_type* __sb = this->rdbuf(); - if (!__sb - || traits_type::eq_int_type(__sb->sputbackc(__c), __eof)) - __err |= ios_base::badbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return *this; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - unget(void) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 60. What is a formatted input function? - _M_gcount = 0; - // Clear eofbit per N3168. - this->clear(this->rdstate() & ~ios_base::eofbit); - sentry __cerb(*this, true); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - const int_type __eof = traits_type::eof(); - __streambuf_type* __sb = this->rdbuf(); - if (!__sb - || traits_type::eq_int_type(__sb->sungetc(), __eof)) - __err |= ios_base::badbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return *this; - } - - template - int - basic_istream<_CharT, _Traits>:: - sync(void) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR60. Do not change _M_gcount. - int __ret = -1; - sentry __cerb(*this, true); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - __streambuf_type* __sb = this->rdbuf(); - if (__sb) - { - if (__sb->pubsync() == -1) - __err |= ios_base::badbit; - else - __ret = 0; - } - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return __ret; - } - - template - typename basic_istream<_CharT, _Traits>::pos_type - basic_istream<_CharT, _Traits>:: - tellg(void) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR60. Do not change _M_gcount. - pos_type __ret = pos_type(-1); - sentry __cerb(*this, true); - if (__cerb) - { - __try - { - if (!this->fail()) - __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, - ios_base::in); - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - } - return __ret; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - seekg(pos_type __pos) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR60. Do not change _M_gcount. - // Clear eofbit per N3168. - this->clear(this->rdstate() & ~ios_base::eofbit); - sentry __cerb(*this, true); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - if (!this->fail()) - { - // 136. seekp, seekg setting wrong streams? - const pos_type __p = this->rdbuf()->pubseekpos(__pos, - ios_base::in); - - // 129. Need error indication from seekp() and seekg() - if (__p == pos_type(off_type(-1))) - __err |= ios_base::failbit; - } - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return *this; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - seekg(off_type __off, ios_base::seekdir __dir) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR60. Do not change _M_gcount. - // Clear eofbit per N3168. - this->clear(this->rdstate() & ~ios_base::eofbit); - sentry __cerb(*this, true); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - if (!this->fail()) - { - // 136. seekp, seekg setting wrong streams? - const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir, - ios_base::in); - - // 129. Need error indication from seekp() and seekg() - if (__p == pos_type(off_type(-1))) - __err |= ios_base::failbit; - } - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return *this; - } - - // 27.6.1.2.3 Character extraction templates - template - basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) - { - typedef basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::int_type __int_type; - - typename __istream_type::sentry __cerb(__in, false); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - const __int_type __cb = __in.rdbuf()->sbumpc(); - if (!_Traits::eq_int_type(__cb, _Traits::eof())) - __c = _Traits::to_char_type(__cb); - else - __err |= (ios_base::eofbit | ios_base::failbit); - } - __catch(__cxxabiv1::__forced_unwind&) - { - __in._M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { __in._M_setstate(ios_base::badbit); } - if (__err) - __in.setstate(__err); - } - return __in; - } - - template - basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) - { - typedef basic_istream<_CharT, _Traits> __istream_type; - typedef basic_streambuf<_CharT, _Traits> __streambuf_type; - typedef typename _Traits::int_type int_type; - typedef _CharT char_type; - typedef ctype<_CharT> __ctype_type; - - streamsize __extracted = 0; - ios_base::iostate __err = ios_base::goodbit; - typename __istream_type::sentry __cerb(__in, false); - if (__cerb) - { - __try - { - // Figure out how many characters to extract. - streamsize __num = __in.width(); - if (__num <= 0) - __num = __gnu_cxx::__numeric_traits::__max; - - const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); - - const int_type __eof = _Traits::eof(); - __streambuf_type* __sb = __in.rdbuf(); - int_type __c = __sb->sgetc(); - - while (__extracted < __num - 1 - && !_Traits::eq_int_type(__c, __eof) - && !__ct.is(ctype_base::space, - _Traits::to_char_type(__c))) - { - *__s++ = _Traits::to_char_type(__c); - ++__extracted; - __c = __sb->snextc(); - } - if (_Traits::eq_int_type(__c, __eof)) - __err |= ios_base::eofbit; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 68. Extractors for char* should store null at end - *__s = char_type(); - __in.width(0); - } - __catch(__cxxabiv1::__forced_unwind&) - { - __in._M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { __in._M_setstate(ios_base::badbit); } - } - if (!__extracted) - __err |= ios_base::failbit; - if (__err) - __in.setstate(__err); - return __in; - } - - // 27.6.1.4 Standard basic_istream manipulators - template - basic_istream<_CharT, _Traits>& - ws(basic_istream<_CharT, _Traits>& __in) - { - typedef basic_istream<_CharT, _Traits> __istream_type; - typedef basic_streambuf<_CharT, _Traits> __streambuf_type; - typedef typename __istream_type::int_type __int_type; - typedef ctype<_CharT> __ctype_type; - - const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); - const __int_type __eof = _Traits::eof(); - __streambuf_type* __sb = __in.rdbuf(); - __int_type __c = __sb->sgetc(); - - while (!_Traits::eq_int_type(__c, __eof) - && __ct.is(ctype_base::space, _Traits::to_char_type(__c))) - __c = __sb->snextc(); - - if (_Traits::eq_int_type(__c, __eof)) - __in.setstate(ios_base::eofbit); - return __in; - } - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template class basic_istream; - extern template istream& ws(istream&); - extern template istream& operator>>(istream&, char&); - extern template istream& operator>>(istream&, char*); - extern template istream& operator>>(istream&, unsigned char&); - extern template istream& operator>>(istream&, signed char&); - extern template istream& operator>>(istream&, unsigned char*); - extern template istream& operator>>(istream&, signed char*); - - extern template istream& istream::_M_extract(unsigned short&); - extern template istream& istream::_M_extract(unsigned int&); - extern template istream& istream::_M_extract(long&); - extern template istream& istream::_M_extract(unsigned long&); - extern template istream& istream::_M_extract(bool&); -#ifdef _GLIBCXX_USE_LONG_LONG - extern template istream& istream::_M_extract(long long&); - extern template istream& istream::_M_extract(unsigned long long&); -#endif - extern template istream& istream::_M_extract(float&); - extern template istream& istream::_M_extract(double&); - extern template istream& istream::_M_extract(long double&); - extern template istream& istream::_M_extract(void*&); - - extern template class basic_iostream; - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template class basic_istream; - extern template wistream& ws(wistream&); - extern template wistream& operator>>(wistream&, wchar_t&); - extern template wistream& operator>>(wistream&, wchar_t*); - - extern template wistream& wistream::_M_extract(unsigned short&); - extern template wistream& wistream::_M_extract(unsigned int&); - extern template wistream& wistream::_M_extract(long&); - extern template wistream& wistream::_M_extract(unsigned long&); - extern template wistream& wistream::_M_extract(bool&); -#ifdef _GLIBCXX_USE_LONG_LONG - extern template wistream& wistream::_M_extract(long long&); - extern template wistream& wistream::_M_extract(unsigned long long&); -#endif - extern template wistream& wistream::_M_extract(float&); - extern template wistream& wistream::_M_extract(double&); - extern template wistream& wistream::_M_extract(long double&); - extern template wistream& wistream::_M_extract(void*&); - - extern template class basic_iostream; -#endif -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/list.tcc b/openflow/usr/include/c++/5/bits/list.tcc deleted file mode 100644 index a9c8a55..0000000 --- a/openflow/usr/include/c++/5/bits/list.tcc +++ /dev/null @@ -1,519 +0,0 @@ -// List implementation (out of line) -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/list.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{list} - */ - -#ifndef _LIST_TCC -#define _LIST_TCC 1 - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - template - void - _List_base<_Tp, _Alloc>:: - _M_clear() _GLIBCXX_NOEXCEPT - { - typedef _List_node<_Tp> _Node; - __detail::_List_node_base* __cur = _M_impl._M_node._M_next; - while (__cur != &_M_impl._M_node) - { - _Node* __tmp = static_cast<_Node*>(__cur); - __cur = __tmp->_M_next; -#if __cplusplus >= 201103L - _M_get_Node_allocator().destroy(__tmp); -#else - _M_get_Tp_allocator().destroy(std::__addressof(__tmp->_M_data)); -#endif - _M_put_node(__tmp); - } - } - -#if __cplusplus >= 201103L - template - template - typename list<_Tp, _Alloc>::iterator - list<_Tp, _Alloc>:: - emplace(const_iterator __position, _Args&&... __args) - { - _Node* __tmp = _M_create_node(std::forward<_Args>(__args)...); - __tmp->_M_hook(__position._M_const_cast()._M_node); - this->_M_inc_size(1); - return iterator(__tmp); - } -#endif - - template - typename list<_Tp, _Alloc>::iterator - list<_Tp, _Alloc>:: -#if __cplusplus >= 201103L - insert(const_iterator __position, const value_type& __x) -#else - insert(iterator __position, const value_type& __x) -#endif - { - _Node* __tmp = _M_create_node(__x); - __tmp->_M_hook(__position._M_const_cast()._M_node); - this->_M_inc_size(1); - return iterator(__tmp); - } - -#if __cplusplus >= 201103L - template - typename list<_Tp, _Alloc>::iterator - list<_Tp, _Alloc>:: - insert(const_iterator __position, size_type __n, const value_type& __x) - { - if (__n) - { - list __tmp(__n, __x, get_allocator()); - iterator __it = __tmp.begin(); - splice(__position, __tmp); - return __it; - } - return __position._M_const_cast(); - } - - template - template - typename list<_Tp, _Alloc>::iterator - list<_Tp, _Alloc>:: - insert(const_iterator __position, _InputIterator __first, - _InputIterator __last) - { - list __tmp(__first, __last, get_allocator()); - if (!__tmp.empty()) - { - iterator __it = __tmp.begin(); - splice(__position, __tmp); - return __it; - } - return __position._M_const_cast(); - } -#endif - - template - typename list<_Tp, _Alloc>::iterator - list<_Tp, _Alloc>:: -#if __cplusplus >= 201103L - erase(const_iterator __position) noexcept -#else - erase(iterator __position) -#endif - { - iterator __ret = iterator(__position._M_node->_M_next); - _M_erase(__position._M_const_cast()); - return __ret; - } - -#if __cplusplus >= 201103L - template - void - list<_Tp, _Alloc>:: - _M_default_append(size_type __n) - { - size_type __i = 0; - __try - { - for (; __i < __n; ++__i) - emplace_back(); - } - __catch(...) - { - for (; __i; --__i) - pop_back(); - __throw_exception_again; - } - } - - template - void - list<_Tp, _Alloc>:: - resize(size_type __new_size) - { - iterator __i = begin(); - size_type __len = 0; - for (; __i != end() && __len < __new_size; ++__i, ++__len) - ; - if (__len == __new_size) - erase(__i, end()); - else // __i == end() - _M_default_append(__new_size - __len); - } - - template - void - list<_Tp, _Alloc>:: - resize(size_type __new_size, const value_type& __x) - { - iterator __i = begin(); - size_type __len = 0; - for (; __i != end() && __len < __new_size; ++__i, ++__len) - ; - if (__len == __new_size) - erase(__i, end()); - else // __i == end() - insert(end(), __new_size - __len, __x); - } -#else - template - void - list<_Tp, _Alloc>:: - resize(size_type __new_size, value_type __x) - { - iterator __i = begin(); - size_type __len = 0; - for (; __i != end() && __len < __new_size; ++__i, ++__len) - ; - if (__len == __new_size) - erase(__i, end()); - else // __i == end() - insert(end(), __new_size - __len, __x); - } -#endif - - template - list<_Tp, _Alloc>& - list<_Tp, _Alloc>:: - operator=(const list& __x) - { - if (this != &__x) - { - iterator __first1 = begin(); - iterator __last1 = end(); - const_iterator __first2 = __x.begin(); - const_iterator __last2 = __x.end(); - for (; __first1 != __last1 && __first2 != __last2; - ++__first1, ++__first2) - *__first1 = *__first2; - if (__first2 == __last2) - erase(__first1, __last1); - else - insert(__last1, __first2, __last2); - } - return *this; - } - - template - void - list<_Tp, _Alloc>:: - _M_fill_assign(size_type __n, const value_type& __val) - { - iterator __i = begin(); - for (; __i != end() && __n > 0; ++__i, --__n) - *__i = __val; - if (__n > 0) - insert(end(), __n, __val); - else - erase(__i, end()); - } - - template - template - void - list<_Tp, _Alloc>:: - _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2, - __false_type) - { - iterator __first1 = begin(); - iterator __last1 = end(); - for (; __first1 != __last1 && __first2 != __last2; - ++__first1, ++__first2) - *__first1 = *__first2; - if (__first2 == __last2) - erase(__first1, __last1); - else - insert(__last1, __first2, __last2); - } - - template - void - list<_Tp, _Alloc>:: - remove(const value_type& __value) - { - iterator __first = begin(); - iterator __last = end(); - iterator __extra = __last; - while (__first != __last) - { - iterator __next = __first; - ++__next; - if (*__first == __value) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 526. Is it undefined if a function in the standard changes - // in parameters? - if (std::__addressof(*__first) != std::__addressof(__value)) - _M_erase(__first); - else - __extra = __first; - } - __first = __next; - } - if (__extra != __last) - _M_erase(__extra); - } - - template - void - list<_Tp, _Alloc>:: - unique() - { - iterator __first = begin(); - iterator __last = end(); - if (__first == __last) - return; - iterator __next = __first; - while (++__next != __last) - { - if (*__first == *__next) - _M_erase(__next); - else - __first = __next; - __next = __first; - } - } - - template - void - list<_Tp, _Alloc>:: -#if __cplusplus >= 201103L - merge(list&& __x) -#else - merge(list& __x) -#endif - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 300. list::merge() specification incomplete - if (this != &__x) - { - _M_check_equal_allocators(__x); - - iterator __first1 = begin(); - iterator __last1 = end(); - iterator __first2 = __x.begin(); - iterator __last2 = __x.end(); - while (__first1 != __last1 && __first2 != __last2) - if (*__first2 < *__first1) - { - iterator __next = __first2; - _M_transfer(__first1, __first2, ++__next); - __first2 = __next; - } - else - ++__first1; - if (__first2 != __last2) - _M_transfer(__last1, __first2, __last2); - - this->_M_inc_size(__x._M_get_size()); - __x._M_set_size(0); - } - } - - template - template - void - list<_Tp, _Alloc>:: -#if __cplusplus >= 201103L - merge(list&& __x, _StrictWeakOrdering __comp) -#else - merge(list& __x, _StrictWeakOrdering __comp) -#endif - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 300. list::merge() specification incomplete - if (this != &__x) - { - _M_check_equal_allocators(__x); - - iterator __first1 = begin(); - iterator __last1 = end(); - iterator __first2 = __x.begin(); - iterator __last2 = __x.end(); - while (__first1 != __last1 && __first2 != __last2) - if (__comp(*__first2, *__first1)) - { - iterator __next = __first2; - _M_transfer(__first1, __first2, ++__next); - __first2 = __next; - } - else - ++__first1; - if (__first2 != __last2) - _M_transfer(__last1, __first2, __last2); - - this->_M_inc_size(__x._M_get_size()); - __x._M_set_size(0); - } - } - - template - void - list<_Tp, _Alloc>:: - sort() - { - // Do nothing if the list has length 0 or 1. - if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node - && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node) - { - list __carry; - list __tmp[64]; - list * __fill = &__tmp[0]; - list * __counter; - - do - { - __carry.splice(__carry.begin(), *this, begin()); - - for(__counter = &__tmp[0]; - __counter != __fill && !__counter->empty(); - ++__counter) - { - __counter->merge(__carry); - __carry.swap(*__counter); - } - __carry.swap(*__counter); - if (__counter == __fill) - ++__fill; - } - while ( !empty() ); - - for (__counter = &__tmp[1]; __counter != __fill; ++__counter) - __counter->merge(*(__counter - 1)); - swap( *(__fill - 1) ); - } - } - - template - template - void - list<_Tp, _Alloc>:: - remove_if(_Predicate __pred) - { - iterator __first = begin(); - iterator __last = end(); - while (__first != __last) - { - iterator __next = __first; - ++__next; - if (__pred(*__first)) - _M_erase(__first); - __first = __next; - } - } - - template - template - void - list<_Tp, _Alloc>:: - unique(_BinaryPredicate __binary_pred) - { - iterator __first = begin(); - iterator __last = end(); - if (__first == __last) - return; - iterator __next = __first; - while (++__next != __last) - { - if (__binary_pred(*__first, *__next)) - _M_erase(__next); - else - __first = __next; - __next = __first; - } - } - - template - template - void - list<_Tp, _Alloc>:: - sort(_StrictWeakOrdering __comp) - { - // Do nothing if the list has length 0 or 1. - if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node - && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node) - { - list __carry; - list __tmp[64]; - list * __fill = &__tmp[0]; - list * __counter; - - do - { - __carry.splice(__carry.begin(), *this, begin()); - - for(__counter = &__tmp[0]; - __counter != __fill && !__counter->empty(); - ++__counter) - { - __counter->merge(__carry, __comp); - __carry.swap(*__counter); - } - __carry.swap(*__counter); - if (__counter == __fill) - ++__fill; - } - while ( !empty() ); - - for (__counter = &__tmp[1]; __counter != __fill; ++__counter) - __counter->merge(*(__counter - 1), __comp); - swap(*(__fill - 1)); - } - } - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#endif /* _LIST_TCC */ - diff --git a/openflow/usr/include/c++/5/bits/locale_classes.h b/openflow/usr/include/c++/5/bits/locale_classes.h deleted file mode 100644 index f3898eb..0000000 --- a/openflow/usr/include/c++/5/bits/locale_classes.h +++ /dev/null @@ -1,844 +0,0 @@ -// Locale support -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/locale_classes.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -// -// ISO C++ 14882: 22.1 Locales -// - -#ifndef _LOCALE_CLASSES_H -#define _LOCALE_CLASSES_H 1 - -#pragma GCC system_header - -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // 22.1.1 Class locale - /** - * @brief Container class for localization functionality. - * @ingroup locales - * - * The locale class is first a class wrapper for C library locales. It is - * also an extensible container for user-defined localization. A locale is - * a collection of facets that implement various localization features such - * as money, time, and number printing. - * - * Constructing C++ locales does not change the C library locale. - * - * This library supports efficient construction and copying of locales - * through a reference counting implementation of the locale class. - */ - class locale - { - public: - // Types: - /// Definition of locale::category. - typedef int category; - - // Forward decls and friends: - class facet; - class id; - class _Impl; - - friend class facet; - friend class _Impl; - - template - friend bool - has_facet(const locale&) throw(); - - template - friend const _Facet& - use_facet(const locale&); - - template - friend struct __use_cache; - - //@{ - /** - * @brief Category values. - * - * The standard category values are none, ctype, numeric, collate, time, - * monetary, and messages. They form a bitmask that supports union and - * intersection. The category all is the union of these values. - * - * NB: Order must match _S_facet_categories definition in locale.cc - */ - static const category none = 0; - static const category ctype = 1L << 0; - static const category numeric = 1L << 1; - static const category collate = 1L << 2; - static const category time = 1L << 3; - static const category monetary = 1L << 4; - static const category messages = 1L << 5; - static const category all = (ctype | numeric | collate | - time | monetary | messages); - //@} - - // Construct/copy/destroy: - - /** - * @brief Default constructor. - * - * Constructs a copy of the global locale. If no locale has been - * explicitly set, this is the C locale. - */ - locale() throw(); - - /** - * @brief Copy constructor. - * - * Constructs a copy of @a other. - * - * @param __other The locale to copy. - */ - locale(const locale& __other) throw(); - - /** - * @brief Named locale constructor. - * - * Constructs a copy of the named C library locale. - * - * @param __s Name of the locale to construct. - * @throw std::runtime_error if __s is null or an undefined locale. - */ - explicit - locale(const char* __s); - - /** - * @brief Construct locale with facets from another locale. - * - * Constructs a copy of the locale @a base. The facets specified by @a - * cat are replaced with those from the locale named by @a s. If base is - * named, this locale instance will also be named. - * - * @param __base The locale to copy. - * @param __s Name of the locale to use facets from. - * @param __cat Set of categories defining the facets to use from __s. - * @throw std::runtime_error if __s is null or an undefined locale. - */ - locale(const locale& __base, const char* __s, category __cat); - -#if __cplusplus >= 201103L - /** - * @brief Named locale constructor. - * - * Constructs a copy of the named C library locale. - * - * @param __s Name of the locale to construct. - * @throw std::runtime_error if __s is an undefined locale. - */ - explicit - locale(const std::string& __s) : locale(__s.c_str()) { } - - /** - * @brief Construct locale with facets from another locale. - * - * Constructs a copy of the locale @a base. The facets specified by @a - * cat are replaced with those from the locale named by @a s. If base is - * named, this locale instance will also be named. - * - * @param __base The locale to copy. - * @param __s Name of the locale to use facets from. - * @param __cat Set of categories defining the facets to use from __s. - * @throw std::runtime_error if __s is an undefined locale. - */ - locale(const locale& __base, const std::string& __s, category __cat) - : locale(__base, __s.c_str(), __cat) { } -#endif - - /** - * @brief Construct locale with facets from another locale. - * - * Constructs a copy of the locale @a base. The facets specified by @a - * cat are replaced with those from the locale @a add. If @a base and @a - * add are named, this locale instance will also be named. - * - * @param __base The locale to copy. - * @param __add The locale to use facets from. - * @param __cat Set of categories defining the facets to use from add. - */ - locale(const locale& __base, const locale& __add, category __cat); - - /** - * @brief Construct locale with another facet. - * - * Constructs a copy of the locale @a __other. The facet @a __f - * is added to @a __other, replacing an existing facet of type - * Facet if there is one. If @a __f is null, this locale is a - * copy of @a __other. - * - * @param __other The locale to copy. - * @param __f The facet to add in. - */ - template - locale(const locale& __other, _Facet* __f); - - /// Locale destructor. - ~locale() throw(); - - /** - * @brief Assignment operator. - * - * Set this locale to be a copy of @a other. - * - * @param __other The locale to copy. - * @return A reference to this locale. - */ - const locale& - operator=(const locale& __other) throw(); - - /** - * @brief Construct locale with another facet. - * - * Constructs and returns a new copy of this locale. Adds or replaces an - * existing facet of type Facet from the locale @a other into the new - * locale. - * - * @tparam _Facet The facet type to copy from other - * @param __other The locale to copy from. - * @return Newly constructed locale. - * @throw std::runtime_error if __other has no facet of type _Facet. - */ - template - locale - combine(const locale& __other) const; - - // Locale operations: - /** - * @brief Return locale name. - * @return Locale name or "*" if unnamed. - */ - _GLIBCXX_DEFAULT_ABI_TAG - string - name() const; - - /** - * @brief Locale equality. - * - * @param __other The locale to compare against. - * @return True if other and this refer to the same locale instance, are - * copies, or have the same name. False otherwise. - */ - bool - operator==(const locale& __other) const throw(); - - /** - * @brief Locale inequality. - * - * @param __other The locale to compare against. - * @return ! (*this == __other) - */ - bool - operator!=(const locale& __other) const throw() - { return !(this->operator==(__other)); } - - /** - * @brief Compare two strings according to collate. - * - * Template operator to compare two strings using the compare function of - * the collate facet in this locale. One use is to provide the locale to - * the sort function. For example, a vector v of strings could be sorted - * according to locale loc by doing: - * @code - * std::sort(v.begin(), v.end(), loc); - * @endcode - * - * @param __s1 First string to compare. - * @param __s2 Second string to compare. - * @return True if collate<_Char> facet compares __s1 < __s2, else false. - */ - template - bool - operator()(const basic_string<_Char, _Traits, _Alloc>& __s1, - const basic_string<_Char, _Traits, _Alloc>& __s2) const; - - // Global locale objects: - /** - * @brief Set global locale - * - * This function sets the global locale to the argument and returns a - * copy of the previous global locale. If the argument has a name, it - * will also call std::setlocale(LC_ALL, loc.name()). - * - * @param __loc The new locale to make global. - * @return Copy of the old global locale. - */ - static locale - global(const locale& __loc); - - /** - * @brief Return reference to the C locale. - */ - static const locale& - classic(); - - private: - // The (shared) implementation - _Impl* _M_impl; - - // The "C" reference locale - static _Impl* _S_classic; - - // Current global locale - static _Impl* _S_global; - - // Names of underlying locale categories. - // NB: locale::global() has to know how to modify all the - // underlying categories, not just the ones required by the C++ - // standard. - static const char* const* const _S_categories; - - // Number of standard categories. For C++, these categories are - // collate, ctype, monetary, numeric, time, and messages. These - // directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE, - // LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE - // 1003.1-2001) specifies LC_MESSAGES. - // In addition to the standard categories, the underlying - // operating system is allowed to define extra LC_* - // macros. For GNU systems, the following are also valid: - // LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT, - // and LC_IDENTIFICATION. - enum { _S_categories_size = 6 + _GLIBCXX_NUM_CATEGORIES }; - -#ifdef __GTHREADS - static __gthread_once_t _S_once; -#endif - - explicit - locale(_Impl*) throw(); - - static void - _S_initialize(); - - static void - _S_initialize_once() throw(); - - static category - _S_normalize_category(category); - - void - _M_coalesce(const locale& __base, const locale& __add, category __cat); - -#if _GLIBCXX_USE_CXX11_ABI - static const id* const _S_twinned_facets[]; -#endif - }; - - - // 22.1.1.1.2 Class locale::facet - /** - * @brief Localization functionality base class. - * @ingroup locales - * - * The facet class is the base class for a localization feature, such as - * money, time, and number printing. It provides common support for facets - * and reference management. - * - * Facets may not be copied or assigned. - */ - class locale::facet - { - private: - friend class locale; - friend class locale::_Impl; - - mutable _Atomic_word _M_refcount; - - // Contains data from the underlying "C" library for the classic locale. - static __c_locale _S_c_locale; - - // String literal for the name of the classic locale. - static const char _S_c_name[2]; - -#ifdef __GTHREADS - static __gthread_once_t _S_once; -#endif - - static void - _S_initialize_once(); - - protected: - /** - * @brief Facet constructor. - * - * This is the constructor provided by the standard. If refs is 0, the - * facet is destroyed when the last referencing locale is destroyed. - * Otherwise the facet will never be destroyed. - * - * @param __refs The initial value for reference count. - */ - explicit - facet(size_t __refs = 0) throw() : _M_refcount(__refs ? 1 : 0) - { } - - /// Facet destructor. - virtual - ~facet(); - - static void - _S_create_c_locale(__c_locale& __cloc, const char* __s, - __c_locale __old = 0); - - static __c_locale - _S_clone_c_locale(__c_locale& __cloc) throw(); - - static void - _S_destroy_c_locale(__c_locale& __cloc); - - static __c_locale - _S_lc_ctype_c_locale(__c_locale __cloc, const char* __s); - - // Returns data from the underlying "C" library data for the - // classic locale. - static __c_locale - _S_get_c_locale(); - - _GLIBCXX_CONST static const char* - _S_get_c_name() throw(); - - private: - void - _M_add_reference() const throw() - { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } - - void - _M_remove_reference() const throw() - { - // Be race-detector-friendly. For more info see bits/c++config. - _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); - if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1) - { - _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); - __try - { delete this; } - __catch(...) - { } - } - } - - facet(const facet&); // Not defined. - - facet& - operator=(const facet&); // Not defined. - - class __shim; - - const facet* _M_sso_shim(const id*) const; - const facet* _M_cow_shim(const id*) const; - }; - - - // 22.1.1.1.3 Class locale::id - /** - * @brief Facet ID class. - * @ingroup locales - * - * The ID class provides facets with an index used to identify them. - * Every facet class must define a public static member locale::id, or be - * derived from a facet that provides this member, otherwise the facet - * cannot be used in a locale. The locale::id ensures that each class - * type gets a unique identifier. - */ - class locale::id - { - private: - friend class locale; - friend class locale::_Impl; - - template - friend const _Facet& - use_facet(const locale&); - - template - friend bool - has_facet(const locale&) throw(); - - // NB: There is no accessor for _M_index because it may be used - // before the constructor is run; the effect of calling a member - // function (even an inline) would be undefined. - mutable size_t _M_index; - - // Last id number assigned. - static _Atomic_word _S_refcount; - - void - operator=(const id&); // Not defined. - - id(const id&); // Not defined. - - public: - // NB: This class is always a static data member, and thus can be - // counted on to be zero-initialized. - /// Constructor. - id() { } - - size_t - _M_id() const throw(); - }; - - - // Implementation object for locale. - class locale::_Impl - { - public: - // Friends. - friend class locale; - friend class locale::facet; - - template - friend bool - has_facet(const locale&) throw(); - - template - friend const _Facet& - use_facet(const locale&); - - template - friend struct __use_cache; - - private: - // Data Members. - _Atomic_word _M_refcount; - const facet** _M_facets; - size_t _M_facets_size; - const facet** _M_caches; - char** _M_names; - static const locale::id* const _S_id_ctype[]; - static const locale::id* const _S_id_numeric[]; - static const locale::id* const _S_id_collate[]; - static const locale::id* const _S_id_time[]; - static const locale::id* const _S_id_monetary[]; - static const locale::id* const _S_id_messages[]; - static const locale::id* const* const _S_facet_categories[]; - - void - _M_add_reference() throw() - { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } - - void - _M_remove_reference() throw() - { - // Be race-detector-friendly. For more info see bits/c++config. - _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); - if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1) - { - _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); - __try - { delete this; } - __catch(...) - { } - } - } - - _Impl(const _Impl&, size_t); - _Impl(const char*, size_t); - _Impl(size_t) throw(); - - ~_Impl() throw(); - - _Impl(const _Impl&); // Not defined. - - void - operator=(const _Impl&); // Not defined. - - bool - _M_check_same_name() - { - bool __ret = true; - if (_M_names[1]) - // We must actually compare all the _M_names: can be all equal! - for (size_t __i = 0; __ret && __i < _S_categories_size - 1; ++__i) - __ret = __builtin_strcmp(_M_names[__i], _M_names[__i + 1]) == 0; - return __ret; - } - - void - _M_replace_categories(const _Impl*, category); - - void - _M_replace_category(const _Impl*, const locale::id* const*); - - void - _M_replace_facet(const _Impl*, const locale::id*); - - void - _M_install_facet(const locale::id*, const facet*); - - template - void - _M_init_facet(_Facet* __facet) - { _M_install_facet(&_Facet::id, __facet); } - - template - void - _M_init_facet_unchecked(_Facet* __facet) - { - __facet->_M_add_reference(); - _M_facets[_Facet::id._M_id()] = __facet; - } - - void - _M_install_cache(const facet*, size_t); - - void _M_init_extra(facet**); - void _M_init_extra(void*, void*, const char*, const char*); - }; - - - /** - * @brief Facet for localized string comparison. - * - * This facet encapsulates the code to compare strings in a localized - * manner. - * - * The collate template uses protected virtual functions to provide - * the actual results. The public accessors forward the call to - * the virtual functions. These virtual functions are hooks for - * developers to implement the behavior they require from the - * collate facet. - */ - template - class _GLIBCXX_NAMESPACE_CXX11 collate : public locale::facet - { - public: - // Types: - //@{ - /// Public typedefs - typedef _CharT char_type; - typedef basic_string<_CharT> string_type; - //@} - - protected: - // Underlying "C" library locale information saved from - // initialization, needed by collate_byname as well. - __c_locale _M_c_locale_collate; - - public: - /// Numpunct facet id. - static locale::id id; - - /** - * @brief Constructor performs initialization. - * - * This is the constructor provided by the standard. - * - * @param __refs Passed to the base facet class. - */ - explicit - collate(size_t __refs = 0) - : facet(__refs), _M_c_locale_collate(_S_get_c_locale()) - { } - - /** - * @brief Internal constructor. Not for general use. - * - * This is a constructor for use by the library itself to set up new - * locales. - * - * @param __cloc The C locale. - * @param __refs Passed to the base facet class. - */ - explicit - collate(__c_locale __cloc, size_t __refs = 0) - : facet(__refs), _M_c_locale_collate(_S_clone_c_locale(__cloc)) - { } - - /** - * @brief Compare two strings. - * - * This function compares two strings and returns the result by calling - * collate::do_compare(). - * - * @param __lo1 Start of string 1. - * @param __hi1 End of string 1. - * @param __lo2 Start of string 2. - * @param __hi2 End of string 2. - * @return 1 if string1 > string2, -1 if string1 < string2, else 0. - */ - int - compare(const _CharT* __lo1, const _CharT* __hi1, - const _CharT* __lo2, const _CharT* __hi2) const - { return this->do_compare(__lo1, __hi1, __lo2, __hi2); } - - /** - * @brief Transform string to comparable form. - * - * This function is a wrapper for strxfrm functionality. It takes the - * input string and returns a modified string that can be directly - * compared to other transformed strings. In the C locale, this - * function just returns a copy of the input string. In some other - * locales, it may replace two chars with one, change a char for - * another, etc. It does so by returning collate::do_transform(). - * - * @param __lo Start of string. - * @param __hi End of string. - * @return Transformed string_type. - */ - string_type - transform(const _CharT* __lo, const _CharT* __hi) const - { return this->do_transform(__lo, __hi); } - - /** - * @brief Return hash of a string. - * - * This function computes and returns a hash on the input string. It - * does so by returning collate::do_hash(). - * - * @param __lo Start of string. - * @param __hi End of string. - * @return Hash value. - */ - long - hash(const _CharT* __lo, const _CharT* __hi) const - { return this->do_hash(__lo, __hi); } - - // Used to abstract out _CharT bits in virtual member functions, below. - int - _M_compare(const _CharT*, const _CharT*) const throw(); - - size_t - _M_transform(_CharT*, const _CharT*, size_t) const throw(); - - protected: - /// Destructor. - virtual - ~collate() - { _S_destroy_c_locale(_M_c_locale_collate); } - - /** - * @brief Compare two strings. - * - * This function is a hook for derived classes to change the value - * returned. @see compare(). - * - * @param __lo1 Start of string 1. - * @param __hi1 End of string 1. - * @param __lo2 Start of string 2. - * @param __hi2 End of string 2. - * @return 1 if string1 > string2, -1 if string1 < string2, else 0. - */ - virtual int - do_compare(const _CharT* __lo1, const _CharT* __hi1, - const _CharT* __lo2, const _CharT* __hi2) const; - - /** - * @brief Transform string to comparable form. - * - * This function is a hook for derived classes to change the value - * returned. - * - * @param __lo Start. - * @param __hi End. - * @return transformed string. - */ - virtual string_type - do_transform(const _CharT* __lo, const _CharT* __hi) const; - - /** - * @brief Return hash of a string. - * - * This function computes and returns a hash on the input string. This - * function is a hook for derived classes to change the value returned. - * - * @param __lo Start of string. - * @param __hi End of string. - * @return Hash value. - */ - virtual long - do_hash(const _CharT* __lo, const _CharT* __hi) const; - }; - - template - locale::id collate<_CharT>::id; - - // Specializations. - template<> - int - collate::_M_compare(const char*, const char*) const throw(); - - template<> - size_t - collate::_M_transform(char*, const char*, size_t) const throw(); - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - int - collate::_M_compare(const wchar_t*, const wchar_t*) const throw(); - - template<> - size_t - collate::_M_transform(wchar_t*, const wchar_t*, size_t) const throw(); -#endif - - /// class collate_byname [22.2.4.2]. - template - class _GLIBCXX_NAMESPACE_CXX11 collate_byname : public collate<_CharT> - { - public: - //@{ - /// Public typedefs - typedef _CharT char_type; - typedef basic_string<_CharT> string_type; - //@} - - explicit - collate_byname(const char* __s, size_t __refs = 0) - : collate<_CharT>(__refs) - { - if (__builtin_strcmp(__s, "C") != 0 - && __builtin_strcmp(__s, "POSIX") != 0) - { - this->_S_destroy_c_locale(this->_M_c_locale_collate); - this->_S_create_c_locale(this->_M_c_locale_collate, __s); - } - } - -#if __cplusplus >= 201103L - explicit - collate_byname(const string& __s, size_t __refs = 0) - : collate_byname(__s.c_str(), __refs) { } -#endif - - protected: - virtual - ~collate_byname() { } - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -# include - -#endif diff --git a/openflow/usr/include/c++/5/bits/locale_classes.tcc b/openflow/usr/include/c++/5/bits/locale_classes.tcc deleted file mode 100644 index dbc8c8e..0000000 --- a/openflow/usr/include/c++/5/bits/locale_classes.tcc +++ /dev/null @@ -1,298 +0,0 @@ -// Locale support -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/locale_classes.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -// -// ISO C++ 14882: 22.1 Locales -// - -#ifndef _LOCALE_CLASSES_TCC -#define _LOCALE_CLASSES_TCC 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - locale:: - locale(const locale& __other, _Facet* __f) - { - _M_impl = new _Impl(*__other._M_impl, 1); - - __try - { _M_impl->_M_install_facet(&_Facet::id, __f); } - __catch(...) - { - _M_impl->_M_remove_reference(); - __throw_exception_again; - } - delete [] _M_impl->_M_names[0]; - _M_impl->_M_names[0] = 0; // Unnamed. - } - - template - locale - locale:: - combine(const locale& __other) const - { - _Impl* __tmp = new _Impl(*_M_impl, 1); - __try - { - __tmp->_M_replace_facet(__other._M_impl, &_Facet::id); - } - __catch(...) - { - __tmp->_M_remove_reference(); - __throw_exception_again; - } - return locale(__tmp); - } - - template - bool - locale:: - operator()(const basic_string<_CharT, _Traits, _Alloc>& __s1, - const basic_string<_CharT, _Traits, _Alloc>& __s2) const - { - typedef std::collate<_CharT> __collate_type; - const __collate_type& __collate = use_facet<__collate_type>(*this); - return (__collate.compare(__s1.data(), __s1.data() + __s1.length(), - __s2.data(), __s2.data() + __s2.length()) < 0); - } - - /** - * @brief Test for the presence of a facet. - * @ingroup locales - * - * has_facet tests the locale argument for the presence of the facet type - * provided as the template parameter. Facets derived from the facet - * parameter will also return true. - * - * @tparam _Facet The facet type to test the presence of. - * @param __loc The locale to test. - * @return true if @p __loc contains a facet of type _Facet, else false. - */ - template - bool - has_facet(const locale& __loc) throw() - { - const size_t __i = _Facet::id._M_id(); - const locale::facet** __facets = __loc._M_impl->_M_facets; - return (__i < __loc._M_impl->_M_facets_size -#if __cpp_rtti - && dynamic_cast(__facets[__i])); -#else - && static_cast(__facets[__i])); -#endif - } - - /** - * @brief Return a facet. - * @ingroup locales - * - * use_facet looks for and returns a reference to a facet of type Facet - * where Facet is the template parameter. If has_facet(locale) is true, - * there is a suitable facet to return. It throws std::bad_cast if the - * locale doesn't contain a facet of type Facet. - * - * @tparam _Facet The facet type to access. - * @param __loc The locale to use. - * @return Reference to facet of type Facet. - * @throw std::bad_cast if @p __loc doesn't contain a facet of type _Facet. - */ - template - const _Facet& - use_facet(const locale& __loc) - { - const size_t __i = _Facet::id._M_id(); - const locale::facet** __facets = __loc._M_impl->_M_facets; - if (__i >= __loc._M_impl->_M_facets_size || !__facets[__i]) - __throw_bad_cast(); -#if __cpp_rtti - return dynamic_cast(*__facets[__i]); -#else - return static_cast(*__facets[__i]); -#endif - } - - - // Generic version does nothing. - template - int - collate<_CharT>::_M_compare(const _CharT*, const _CharT*) const throw () - { return 0; } - - // Generic version does nothing. - template - size_t - collate<_CharT>::_M_transform(_CharT*, const _CharT*, size_t) const throw () - { return 0; } - - template - int - collate<_CharT>:: - do_compare(const _CharT* __lo1, const _CharT* __hi1, - const _CharT* __lo2, const _CharT* __hi2) const - { - // strcoll assumes zero-terminated strings so we make a copy - // and then put a zero at the end. - const string_type __one(__lo1, __hi1); - const string_type __two(__lo2, __hi2); - - const _CharT* __p = __one.c_str(); - const _CharT* __pend = __one.data() + __one.length(); - const _CharT* __q = __two.c_str(); - const _CharT* __qend = __two.data() + __two.length(); - - // strcoll stops when it sees a nul character so we break - // the strings into zero-terminated substrings and pass those - // to strcoll. - for (;;) - { - const int __res = _M_compare(__p, __q); - if (__res) - return __res; - - __p += char_traits<_CharT>::length(__p); - __q += char_traits<_CharT>::length(__q); - if (__p == __pend && __q == __qend) - return 0; - else if (__p == __pend) - return -1; - else if (__q == __qend) - return 1; - - __p++; - __q++; - } - } - - template - typename collate<_CharT>::string_type - collate<_CharT>:: - do_transform(const _CharT* __lo, const _CharT* __hi) const - { - string_type __ret; - - // strxfrm assumes zero-terminated strings so we make a copy - const string_type __str(__lo, __hi); - - const _CharT* __p = __str.c_str(); - const _CharT* __pend = __str.data() + __str.length(); - - size_t __len = (__hi - __lo) * 2; - - _CharT* __c = new _CharT[__len]; - - __try - { - // strxfrm stops when it sees a nul character so we break - // the string into zero-terminated substrings and pass those - // to strxfrm. - for (;;) - { - // First try a buffer perhaps big enough. - size_t __res = _M_transform(__c, __p, __len); - // If the buffer was not large enough, try again with the - // correct size. - if (__res >= __len) - { - __len = __res + 1; - delete [] __c, __c = 0; - __c = new _CharT[__len]; - __res = _M_transform(__c, __p, __len); - } - - __ret.append(__c, __res); - __p += char_traits<_CharT>::length(__p); - if (__p == __pend) - break; - - __p++; - __ret.push_back(_CharT()); - } - } - __catch(...) - { - delete [] __c; - __throw_exception_again; - } - - delete [] __c; - - return __ret; - } - - template - long - collate<_CharT>:: - do_hash(const _CharT* __lo, const _CharT* __hi) const - { - unsigned long __val = 0; - for (; __lo < __hi; ++__lo) - __val = - *__lo + ((__val << 7) - | (__val >> (__gnu_cxx::__numeric_traits:: - __digits - 7))); - return static_cast(__val); - } - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template class collate; - extern template class collate_byname; - - extern template - const collate& - use_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template class collate; - extern template class collate_byname; - - extern template - const collate& - use_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); -#endif -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/locale_conv.h b/openflow/usr/include/c++/5/bits/locale_conv.h deleted file mode 100644 index 16b4875..0000000 --- a/openflow/usr/include/c++/5/bits/locale_conv.h +++ /dev/null @@ -1,545 +0,0 @@ -// wstring_convert implementation -*- C++ -*- - -// Copyright (C) 2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/locale_conv.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -#ifndef _LOCALE_CONV_H -#define _LOCALE_CONV_H 1 - -#if __cplusplus < 201103L -# include -#else - -#include -#include "stringfwd.h" -#include "allocator.h" -#include "codecvt.h" -#include "unique_ptr.h" - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup locales - * @{ - */ - - template - bool - __do_str_codecvt(const _InChar* __first, const _InChar* __last, - _OutStr& __outstr, const _Codecvt& __cvt, _State& __state, - size_t& __count, _Fn __fn) - { - if (__first == __last) - { - __outstr.clear(); - __count = 0; - return true; - } - - size_t __outchars = 0; - auto __next = __first; - const auto __maxlen = __cvt.max_length() + 1; - - codecvt_base::result __result; - do - { - __outstr.resize(__outstr.size() + (__last - __next) * __maxlen); - auto __outnext = &__outstr.front() + __outchars; - auto const __outlast = &__outstr.back() + 1; - __result = (__cvt.*__fn)(__state, __next, __last, __next, - __outnext, __outlast, __outnext); - __outchars = __outnext - &__outstr.front(); - } - while (__result == codecvt_base::partial && __next != __last - && (__outstr.size() - __outchars) < __maxlen); - - if (__result == codecvt_base::error) - return false; - - if (__result == codecvt_base::noconv) - { - __outstr.assign(__first, __last); - __count = __last - __first; - } - else - { - __outstr.resize(__outchars); - __count = __next - __first; - } - - return true; - } - - // Convert narrow character string to wide. - template - inline bool - __str_codecvt_in(const char* __first, const char* __last, - basic_string<_CharT, _Traits, _Alloc>& __outstr, - const codecvt<_CharT, char, _State>& __cvt, - _State& __state, size_t& __count) - { - using _Codecvt = codecvt<_CharT, char, _State>; - using _ConvFn - = codecvt_base::result - (_Codecvt::*)(_State&, const char*, const char*, const char*&, - _CharT*, _CharT*, _CharT*&) const; - _ConvFn __fn = &codecvt<_CharT, char, _State>::in; - return __do_str_codecvt(__first, __last, __outstr, __cvt, __state, - __count, __fn); - } - - template - inline bool - __str_codecvt_in(const char* __first, const char* __last, - basic_string<_CharT, _Traits, _Alloc>& __outstr, - const codecvt<_CharT, char, _State>& __cvt) - { - _State __state = {}; - size_t __n; - return __str_codecvt_in(__first, __last, __outstr, __cvt, __state, __n); - } - - // Convert wide character string to narrow. - template - inline bool - __str_codecvt_out(const _CharT* __first, const _CharT* __last, - basic_string& __outstr, - const codecvt<_CharT, char, _State>& __cvt, - _State& __state, size_t& __count) - { - using _Codecvt = codecvt<_CharT, char, _State>; - using _ConvFn - = codecvt_base::result - (_Codecvt::*)(_State&, const _CharT*, const _CharT*, const _CharT*&, - char*, char*, char*&) const; - _ConvFn __fn = &codecvt<_CharT, char, _State>::out; - return __do_str_codecvt(__first, __last, __outstr, __cvt, __state, - __count, __fn); - } - - template - inline bool - __str_codecvt_out(const _CharT* __first, const _CharT* __last, - basic_string& __outstr, - const codecvt<_CharT, char, _State>& __cvt) - { - _State __state = {}; - size_t __n; - return __str_codecvt_out(__first, __last, __outstr, __cvt, __state, __n); - } - -#ifdef _GLIBCXX_USE_WCHAR_T - -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - - /// String conversions - template, - typename _Byte_alloc = allocator> - class wstring_convert - { - public: - typedef basic_string, _Byte_alloc> byte_string; - typedef basic_string<_Elem, char_traits<_Elem>, _Wide_alloc> wide_string; - typedef typename _Codecvt::state_type state_type; - typedef typename wide_string::traits_type::int_type int_type; - - /** Default constructor. - * - * @param __pcvt The facet to use for conversions. - * - * Takes ownership of @p __pcvt and will delete it in the destructor. - */ - explicit - wstring_convert(_Codecvt* __pcvt = new _Codecvt()) : _M_cvt(__pcvt) - { - if (!_M_cvt) - __throw_logic_error("wstring_convert"); - } - - /** Construct with an initial converstion state. - * - * @param __pcvt The facet to use for conversions. - * @param __state Initial conversion state. - * - * Takes ownership of @p __pcvt and will delete it in the destructor. - * The object's conversion state will persist between conversions. - */ - wstring_convert(_Codecvt* __pcvt, state_type __state) - : _M_cvt(__pcvt), _M_state(__state), _M_with_cvtstate(true) - { - if (!_M_cvt) - __throw_logic_error("wstring_convert"); - } - - /** Construct with error strings. - * - * @param __byte_err A string to return on failed conversions. - * @param __wide_err A wide string to return on failed conversions. - */ - explicit - wstring_convert(const byte_string& __byte_err, - const wide_string& __wide_err = wide_string()) - : _M_cvt(new _Codecvt), - _M_byte_err_string(__byte_err), _M_wide_err_string(__wide_err), - _M_with_strings(true) - { - if (!_M_cvt) - __throw_logic_error("wstring_convert"); - } - - ~wstring_convert() = default; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2176. Special members for wstring_convert and wbuffer_convert - wstring_convert(const wstring_convert&) = delete; - wstring_convert& operator=(const wstring_convert&) = delete; - - /// @{ Convert from bytes. - wide_string - from_bytes(char __byte) - { - char __bytes[2] = { __byte }; - return from_bytes(__bytes, __bytes+1); - } - - wide_string - from_bytes(const char* __ptr) - { return from_bytes(__ptr, __ptr+char_traits::length(__ptr)); } - - wide_string - from_bytes(const byte_string& __str) - { - auto __ptr = __str.data(); - return from_bytes(__ptr, __ptr + __str.size()); - } - - wide_string - from_bytes(const char* __first, const char* __last) - { - if (!_M_with_cvtstate) - _M_state = state_type(); - wide_string __out{ _M_wide_err_string.get_allocator() }; - if (__str_codecvt_in(__first, __last, __out, *_M_cvt, _M_state, - _M_count)) - return __out; - if (_M_with_strings) - return _M_wide_err_string; - __throw_range_error("wstring_convert::from_bytes"); - } - /// @} - - /// @{ Convert to bytes. - byte_string - to_bytes(_Elem __wchar) - { - _Elem __wchars[2] = { __wchar }; - return to_bytes(__wchars, __wchars+1); - } - - byte_string - to_bytes(const _Elem* __ptr) - { - return to_bytes(__ptr, __ptr+wide_string::traits_type::length(__ptr)); - } - - byte_string - to_bytes(const wide_string& __wstr) - { - auto __ptr = __wstr.data(); - return to_bytes(__ptr, __ptr + __wstr.size()); - } - - byte_string - to_bytes(const _Elem* __first, const _Elem* __last) - { - if (!_M_with_cvtstate) - _M_state = state_type(); - byte_string __out{ _M_byte_err_string.get_allocator() }; - if (__str_codecvt_out(__first, __last, __out, *_M_cvt, _M_state, - _M_count)) - return __out; - if (_M_with_strings) - return _M_byte_err_string; - __throw_range_error("wstring_convert::to_bytes"); - } - /// @} - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2174. wstring_convert::converted() should be noexcept - /// The number of elements successfully converted in the last conversion. - size_t converted() const noexcept { return _M_count; } - - /// The final conversion state of the last conversion. - state_type state() const { return _M_state; } - - private: - unique_ptr<_Codecvt> _M_cvt; - byte_string _M_byte_err_string; - wide_string _M_wide_err_string; - state_type _M_state = state_type(); - size_t _M_count = 0; - bool _M_with_cvtstate = false; - bool _M_with_strings = false; - }; - -_GLIBCXX_END_NAMESPACE_CXX11 - - /// Buffer conversions - template> - class wbuffer_convert : public basic_streambuf<_Elem, _Tr> - { - typedef basic_streambuf<_Elem, _Tr> _Wide_streambuf; - - public: - typedef typename _Codecvt::state_type state_type; - - /** Default constructor. - * - * @param __bytebuf The underlying byte stream buffer. - * @param __pcvt The facet to use for conversions. - * @param __state Initial conversion state. - * - * Takes ownership of @p __pcvt and will delete it in the destructor. - */ - explicit - wbuffer_convert(streambuf* __bytebuf = 0, _Codecvt* __pcvt = new _Codecvt, - state_type __state = state_type()) - : _M_buf(__bytebuf), _M_cvt(__pcvt), _M_state(__state) - { - if (!_M_cvt) - __throw_logic_error("wbuffer_convert"); - - _M_always_noconv = _M_cvt->always_noconv(); - - if (_M_buf) - { - this->setp(_M_put_area, _M_put_area + _S_buffer_length); - this->setg(_M_get_area + _S_putback_length, - _M_get_area + _S_putback_length, - _M_get_area + _S_putback_length); - } - } - - ~wbuffer_convert() = default; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2176. Special members for wstring_convert and wbuffer_convert - wbuffer_convert(const wbuffer_convert&) = delete; - wbuffer_convert& operator=(const wbuffer_convert&) = delete; - - streambuf* rdbuf() const noexcept { return _M_buf; } - - streambuf* - rdbuf(streambuf *__bytebuf) noexcept - { - auto __prev = _M_buf; - _M_buf = __bytebuf; - return __prev; - } - - /// The conversion state following the last conversion. - state_type state() const noexcept { return _M_state; } - - protected: - int - sync() - { return _M_buf && _M_conv_put() && _M_buf->pubsync() ? 0 : -1; } - - typename _Wide_streambuf::int_type - overflow(typename _Wide_streambuf::int_type __out) - { - if (!_M_buf || !_M_conv_put()) - return _Tr::eof(); - else if (!_Tr::eq_int_type(__out, _Tr::eof())) - return this->sputc(__out); - return _Tr::not_eof(__out); - } - - typename _Wide_streambuf::int_type - underflow() - { - if (!_M_buf) - return _Tr::eof(); - - if (this->gptr() < this->egptr() || (_M_buf && _M_conv_get())) - return _Tr::to_int_type(*this->gptr()); - else - return _Tr::eof(); - } - - streamsize - xsputn(const typename _Wide_streambuf::char_type* __s, streamsize __n) - { - if (!_M_buf || __n == 0) - return 0; - streamsize __done = 0; - do - { - auto __nn = std::min(this->epptr() - this->pptr(), - __n - __done); - _Tr::copy(this->pptr(), __s + __done, __nn); - this->pbump(__nn); - __done += __nn; - } while (__done < __n && _M_conv_put()); - return __done; - } - - private: - // fill the get area from converted contents of the byte stream buffer - bool - _M_conv_get() - { - const streamsize __pb1 = this->gptr() - this->eback(); - const streamsize __pb2 = _S_putback_length; - const streamsize __npb = std::min(__pb1, __pb2); - - _Tr::move(_M_get_area + _S_putback_length - __npb, - this->gptr() - __npb, __npb); - - streamsize __nbytes = sizeof(_M_get_buf) - _M_unconv; - __nbytes = std::min(__nbytes, _M_buf->in_avail()); - if (__nbytes < 1) - __nbytes == 1; - __nbytes = _M_buf->sgetn(_M_get_buf + _M_unconv, __nbytes); - if (__nbytes < 1) - return false; - __nbytes += _M_unconv; - - // convert _M_get_buf into _M_get_area - - _Elem* __outbuf = _M_get_area + _S_putback_length; - _Elem* __outnext = __outbuf; - const char* __bnext = _M_get_buf; - - codecvt_base::result __result; - if (_M_always_noconv) - __result = codecvt_base::noconv; - else - { - _Elem* __outend = _M_get_area + _S_buffer_length; - - __result = _M_cvt->in(_M_state, - __bnext, __bnext + __nbytes, __bnext, - __outbuf, __outend, __outnext); - } - - if (__result == codecvt_base::noconv) - { - // cast is safe because noconv means _Elem is same type as char - auto __get_buf = reinterpret_cast(_M_get_buf); - _Tr::copy(__outbuf, __get_buf, __nbytes); - _M_unconv = 0; - return true; - } - - if ((_M_unconv = _M_get_buf + __nbytes - __bnext)) - char_traits::move(_M_get_buf, __bnext, _M_unconv); - - this->setg(__outbuf, __outbuf, __outnext); - - return __result != codecvt_base::error; - } - - // unused - bool - _M_put(...) - { return false; } - - bool - _M_put(const char* __p, streamsize __n) - { - if (_M_buf->sputn(__p, __n) < __n) - return false; - } - - // convert the put area and write to the byte stream buffer - bool - _M_conv_put() - { - _Elem* const __first = this->pbase(); - const _Elem* const __last = this->pptr(); - const streamsize __pending = __last - __first; - - if (_M_always_noconv) - return _M_put(__first, __pending); - - char __outbuf[2 * _S_buffer_length]; - - const _Elem* __next = __first; - const _Elem* __start; - do - { - __start = __next; - char* __outnext = __outbuf; - char* const __outlast = __outbuf + sizeof(__outbuf); - auto __result = _M_cvt->out(_M_state, __next, __last, __next, - __outnext, __outlast, __outnext); - if (__result == codecvt_base::error) - return false; - else if (__result == codecvt_base::noconv) - return _M_put(__next, __pending); - - if (!_M_put(__outbuf, __outnext - __outbuf)) - return false; - } - while (__next != __last && __next != __start); - - if (__next != __last) - _Tr::move(__first, __next, __last - __next); - - this->pbump(__first - __next); - return __next != __first; - } - - streambuf* _M_buf; - unique_ptr<_Codecvt> _M_cvt; - state_type _M_state; - - static const streamsize _S_buffer_length = 32; - static const streamsize _S_putback_length = 3; - _Elem _M_put_area[_S_buffer_length]; - _Elem _M_get_area[_S_buffer_length]; - streamsize _M_unconv = 0; - char _M_get_buf[_S_buffer_length-_S_putback_length]; - bool _M_always_noconv; - }; - -#endif // _GLIBCXX_USE_WCHAR_T - - /// @} group locales - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif // __cplusplus - -#endif /* _LOCALE_CONV_H */ diff --git a/openflow/usr/include/c++/5/bits/locale_facets.h b/openflow/usr/include/c++/5/bits/locale_facets.h deleted file mode 100644 index 0226b49..0000000 --- a/openflow/usr/include/c++/5/bits/locale_facets.h +++ /dev/null @@ -1,2653 +0,0 @@ -// Locale support -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/locale_facets.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -// -// ISO C++ 14882: 22.1 Locales -// - -#ifndef _LOCALE_FACETS_H -#define _LOCALE_FACETS_H 1 - -#pragma GCC system_header - -#include // For wctype_t -#include -#include -#include -#include // For ios_base, ios_base::iostate -#include -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // NB: Don't instantiate required wchar_t facets if no wchar_t support. -#ifdef _GLIBCXX_USE_WCHAR_T -# define _GLIBCXX_NUM_FACETS 28 -# define _GLIBCXX_NUM_CXX11_FACETS 16 -#else -# define _GLIBCXX_NUM_FACETS 14 -# define _GLIBCXX_NUM_CXX11_FACETS 8 -#endif -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 -# define _GLIBCXX_NUM_UNICODE_FACETS 2 -#else -# define _GLIBCXX_NUM_UNICODE_FACETS 0 -#endif - - // Convert string to numeric value of type _Tp and store results. - // NB: This is specialized for all required types, there is no - // generic definition. - template - void - __convert_to_v(const char*, _Tp&, ios_base::iostate&, - const __c_locale&) throw(); - - // Explicit specializations for required types. - template<> - void - __convert_to_v(const char*, float&, ios_base::iostate&, - const __c_locale&) throw(); - - template<> - void - __convert_to_v(const char*, double&, ios_base::iostate&, - const __c_locale&) throw(); - - template<> - void - __convert_to_v(const char*, long double&, ios_base::iostate&, - const __c_locale&) throw(); - - // NB: __pad is a struct, rather than a function, so it can be - // partially-specialized. - template - struct __pad - { - static void - _S_pad(ios_base& __io, _CharT __fill, _CharT* __news, - const _CharT* __olds, streamsize __newlen, streamsize __oldlen); - }; - - // Used by both numeric and monetary facets. - // Inserts "group separator" characters into an array of characters. - // It's recursive, one iteration per group. It moves the characters - // in the buffer this way: "xxxx12345" -> "12,345xxx". Call this - // only with __gsize != 0. - template - _CharT* - __add_grouping(_CharT* __s, _CharT __sep, - const char* __gbeg, size_t __gsize, - const _CharT* __first, const _CharT* __last); - - // This template permits specializing facet output code for - // ostreambuf_iterator. For ostreambuf_iterator, sputn is - // significantly more efficient than incrementing iterators. - template - inline - ostreambuf_iterator<_CharT> - __write(ostreambuf_iterator<_CharT> __s, const _CharT* __ws, int __len) - { - __s._M_put(__ws, __len); - return __s; - } - - // This is the unspecialized form of the template. - template - inline - _OutIter - __write(_OutIter __s, const _CharT* __ws, int __len) - { - for (int __j = 0; __j < __len; __j++, ++__s) - *__s = __ws[__j]; - return __s; - } - - - // 22.2.1.1 Template class ctype - // Include host and configuration specific ctype enums for ctype_base. - - /** - * @brief Common base for ctype facet - * - * This template class provides implementations of the public functions - * that forward to the protected virtual functions. - * - * This template also provides abstract stubs for the protected virtual - * functions. - */ - template - class __ctype_abstract_base : public locale::facet, public ctype_base - { - public: - // Types: - /// Typedef for the template parameter - typedef _CharT char_type; - - /** - * @brief Test char_type classification. - * - * This function finds a mask M for @a __c and compares it to - * mask @a __m. It does so by returning the value of - * ctype::do_is(). - * - * @param __c The char_type to compare the mask of. - * @param __m The mask to compare against. - * @return (M & __m) != 0. - */ - bool - is(mask __m, char_type __c) const - { return this->do_is(__m, __c); } - - /** - * @brief Return a mask array. - * - * This function finds the mask for each char_type in the range [lo,hi) - * and successively writes it to vec. vec must have as many elements - * as the char array. It does so by returning the value of - * ctype::do_is(). - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @param __vec Pointer to an array of mask storage. - * @return @a __hi. - */ - const char_type* - is(const char_type *__lo, const char_type *__hi, mask *__vec) const - { return this->do_is(__lo, __hi, __vec); } - - /** - * @brief Find char_type matching a mask - * - * This function searches for and returns the first char_type c in - * [lo,hi) for which is(m,c) is true. It does so by returning - * ctype::do_scan_is(). - * - * @param __m The mask to compare against. - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return Pointer to matching char_type if found, else @a __hi. - */ - const char_type* - scan_is(mask __m, const char_type* __lo, const char_type* __hi) const - { return this->do_scan_is(__m, __lo, __hi); } - - /** - * @brief Find char_type not matching a mask - * - * This function searches for and returns the first char_type c in - * [lo,hi) for which is(m,c) is false. It does so by returning - * ctype::do_scan_not(). - * - * @param __m The mask to compare against. - * @param __lo Pointer to first char in range. - * @param __hi Pointer to end of range. - * @return Pointer to non-matching char if found, else @a __hi. - */ - const char_type* - scan_not(mask __m, const char_type* __lo, const char_type* __hi) const - { return this->do_scan_not(__m, __lo, __hi); } - - /** - * @brief Convert to uppercase. - * - * This function converts the argument to uppercase if possible. - * If not possible (for example, '2'), returns the argument. It does - * so by returning ctype::do_toupper(). - * - * @param __c The char_type to convert. - * @return The uppercase char_type if convertible, else @a __c. - */ - char_type - toupper(char_type __c) const - { return this->do_toupper(__c); } - - /** - * @brief Convert array to uppercase. - * - * This function converts each char_type in the range [lo,hi) to - * uppercase if possible. Other elements remain untouched. It does so - * by returning ctype:: do_toupper(lo, hi). - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return @a __hi. - */ - const char_type* - toupper(char_type *__lo, const char_type* __hi) const - { return this->do_toupper(__lo, __hi); } - - /** - * @brief Convert to lowercase. - * - * This function converts the argument to lowercase if possible. If - * not possible (for example, '2'), returns the argument. It does so - * by returning ctype::do_tolower(c). - * - * @param __c The char_type to convert. - * @return The lowercase char_type if convertible, else @a __c. - */ - char_type - tolower(char_type __c) const - { return this->do_tolower(__c); } - - /** - * @brief Convert array to lowercase. - * - * This function converts each char_type in the range [__lo,__hi) to - * lowercase if possible. Other elements remain untouched. It does so - * by returning ctype:: do_tolower(__lo, __hi). - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return @a __hi. - */ - const char_type* - tolower(char_type* __lo, const char_type* __hi) const - { return this->do_tolower(__lo, __hi); } - - /** - * @brief Widen char to char_type - * - * This function converts the char argument to char_type using the - * simplest reasonable transformation. It does so by returning - * ctype::do_widen(c). - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __c The char to convert. - * @return The converted char_type. - */ - char_type - widen(char __c) const - { return this->do_widen(__c); } - - /** - * @brief Widen array to char_type - * - * This function converts each char in the input to char_type using the - * simplest reasonable transformation. It does so by returning - * ctype::do_widen(c). - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @param __to Pointer to the destination array. - * @return @a __hi. - */ - const char* - widen(const char* __lo, const char* __hi, char_type* __to) const - { return this->do_widen(__lo, __hi, __to); } - - /** - * @brief Narrow char_type to char - * - * This function converts the char_type to char using the simplest - * reasonable transformation. If the conversion fails, dfault is - * returned instead. It does so by returning - * ctype::do_narrow(__c). - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __c The char_type to convert. - * @param __dfault Char to return if conversion fails. - * @return The converted char. - */ - char - narrow(char_type __c, char __dfault) const - { return this->do_narrow(__c, __dfault); } - - /** - * @brief Narrow array to char array - * - * This function converts each char_type in the input to char using the - * simplest reasonable transformation and writes the results to the - * destination array. For any char_type in the input that cannot be - * converted, @a dfault is used instead. It does so by returning - * ctype::do_narrow(__lo, __hi, __dfault, __to). - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @param __dfault Char to use if conversion fails. - * @param __to Pointer to the destination array. - * @return @a __hi. - */ - const char_type* - narrow(const char_type* __lo, const char_type* __hi, - char __dfault, char* __to) const - { return this->do_narrow(__lo, __hi, __dfault, __to); } - - protected: - explicit - __ctype_abstract_base(size_t __refs = 0): facet(__refs) { } - - virtual - ~__ctype_abstract_base() { } - - /** - * @brief Test char_type classification. - * - * This function finds a mask M for @a c and compares it to mask @a m. - * - * do_is() is a hook for a derived facet to change the behavior of - * classifying. do_is() must always return the same result for the - * same input. - * - * @param __c The char_type to find the mask of. - * @param __m The mask to compare against. - * @return (M & __m) != 0. - */ - virtual bool - do_is(mask __m, char_type __c) const = 0; - - /** - * @brief Return a mask array. - * - * This function finds the mask for each char_type in the range [lo,hi) - * and successively writes it to vec. vec must have as many elements - * as the input. - * - * do_is() is a hook for a derived facet to change the behavior of - * classifying. do_is() must always return the same result for the - * same input. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @param __vec Pointer to an array of mask storage. - * @return @a __hi. - */ - virtual const char_type* - do_is(const char_type* __lo, const char_type* __hi, - mask* __vec) const = 0; - - /** - * @brief Find char_type matching mask - * - * This function searches for and returns the first char_type c in - * [__lo,__hi) for which is(__m,c) is true. - * - * do_scan_is() is a hook for a derived facet to change the behavior of - * match searching. do_is() must always return the same result for the - * same input. - * - * @param __m The mask to compare against. - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return Pointer to a matching char_type if found, else @a __hi. - */ - virtual const char_type* - do_scan_is(mask __m, const char_type* __lo, - const char_type* __hi) const = 0; - - /** - * @brief Find char_type not matching mask - * - * This function searches for and returns a pointer to the first - * char_type c of [lo,hi) for which is(m,c) is false. - * - * do_scan_is() is a hook for a derived facet to change the behavior of - * match searching. do_is() must always return the same result for the - * same input. - * - * @param __m The mask to compare against. - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return Pointer to a non-matching char_type if found, else @a __hi. - */ - virtual const char_type* - do_scan_not(mask __m, const char_type* __lo, - const char_type* __hi) const = 0; - - /** - * @brief Convert to uppercase. - * - * This virtual function converts the char_type argument to uppercase - * if possible. If not possible (for example, '2'), returns the - * argument. - * - * do_toupper() is a hook for a derived facet to change the behavior of - * uppercasing. do_toupper() must always return the same result for - * the same input. - * - * @param __c The char_type to convert. - * @return The uppercase char_type if convertible, else @a __c. - */ - virtual char_type - do_toupper(char_type __c) const = 0; - - /** - * @brief Convert array to uppercase. - * - * This virtual function converts each char_type in the range [__lo,__hi) - * to uppercase if possible. Other elements remain untouched. - * - * do_toupper() is a hook for a derived facet to change the behavior of - * uppercasing. do_toupper() must always return the same result for - * the same input. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return @a __hi. - */ - virtual const char_type* - do_toupper(char_type* __lo, const char_type* __hi) const = 0; - - /** - * @brief Convert to lowercase. - * - * This virtual function converts the argument to lowercase if - * possible. If not possible (for example, '2'), returns the argument. - * - * do_tolower() is a hook for a derived facet to change the behavior of - * lowercasing. do_tolower() must always return the same result for - * the same input. - * - * @param __c The char_type to convert. - * @return The lowercase char_type if convertible, else @a __c. - */ - virtual char_type - do_tolower(char_type __c) const = 0; - - /** - * @brief Convert array to lowercase. - * - * This virtual function converts each char_type in the range [__lo,__hi) - * to lowercase if possible. Other elements remain untouched. - * - * do_tolower() is a hook for a derived facet to change the behavior of - * lowercasing. do_tolower() must always return the same result for - * the same input. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return @a __hi. - */ - virtual const char_type* - do_tolower(char_type* __lo, const char_type* __hi) const = 0; - - /** - * @brief Widen char - * - * This virtual function converts the char to char_type using the - * simplest reasonable transformation. - * - * do_widen() is a hook for a derived facet to change the behavior of - * widening. do_widen() must always return the same result for the - * same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __c The char to convert. - * @return The converted char_type - */ - virtual char_type - do_widen(char __c) const = 0; - - /** - * @brief Widen char array - * - * This function converts each char in the input to char_type using the - * simplest reasonable transformation. - * - * do_widen() is a hook for a derived facet to change the behavior of - * widening. do_widen() must always return the same result for the - * same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __lo Pointer to start range. - * @param __hi Pointer to end of range. - * @param __to Pointer to the destination array. - * @return @a __hi. - */ - virtual const char* - do_widen(const char* __lo, const char* __hi, char_type* __to) const = 0; - - /** - * @brief Narrow char_type to char - * - * This virtual function converts the argument to char using the - * simplest reasonable transformation. If the conversion fails, dfault - * is returned instead. - * - * do_narrow() is a hook for a derived facet to change the behavior of - * narrowing. do_narrow() must always return the same result for the - * same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __c The char_type to convert. - * @param __dfault Char to return if conversion fails. - * @return The converted char. - */ - virtual char - do_narrow(char_type __c, char __dfault) const = 0; - - /** - * @brief Narrow char_type array to char - * - * This virtual function converts each char_type in the range - * [__lo,__hi) to char using the simplest reasonable - * transformation and writes the results to the destination - * array. For any element in the input that cannot be - * converted, @a __dfault is used instead. - * - * do_narrow() is a hook for a derived facet to change the behavior of - * narrowing. do_narrow() must always return the same result for the - * same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @param __dfault Char to use if conversion fails. - * @param __to Pointer to the destination array. - * @return @a __hi. - */ - virtual const char_type* - do_narrow(const char_type* __lo, const char_type* __hi, - char __dfault, char* __to) const = 0; - }; - - /** - * @brief Primary class template ctype facet. - * @ingroup locales - * - * This template class defines classification and conversion functions for - * character sets. It wraps cctype functionality. Ctype gets used by - * streams for many I/O operations. - * - * This template provides the protected virtual functions the developer - * will have to replace in a derived class or specialization to make a - * working facet. The public functions that access them are defined in - * __ctype_abstract_base, to allow for implementation flexibility. See - * ctype for an example. The functions are documented in - * __ctype_abstract_base. - * - * Note: implementations are provided for all the protected virtual - * functions, but will likely not be useful. - */ - template - class ctype : public __ctype_abstract_base<_CharT> - { - public: - // Types: - typedef _CharT char_type; - typedef typename __ctype_abstract_base<_CharT>::mask mask; - - /// The facet id for ctype - static locale::id id; - - explicit - ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { } - - protected: - virtual - ~ctype(); - - virtual bool - do_is(mask __m, char_type __c) const; - - virtual const char_type* - do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const; - - virtual const char_type* - do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const; - - virtual const char_type* - do_scan_not(mask __m, const char_type* __lo, - const char_type* __hi) const; - - virtual char_type - do_toupper(char_type __c) const; - - virtual const char_type* - do_toupper(char_type* __lo, const char_type* __hi) const; - - virtual char_type - do_tolower(char_type __c) const; - - virtual const char_type* - do_tolower(char_type* __lo, const char_type* __hi) const; - - virtual char_type - do_widen(char __c) const; - - virtual const char* - do_widen(const char* __lo, const char* __hi, char_type* __dest) const; - - virtual char - do_narrow(char_type, char __dfault) const; - - virtual const char_type* - do_narrow(const char_type* __lo, const char_type* __hi, - char __dfault, char* __to) const; - }; - - template - locale::id ctype<_CharT>::id; - - /** - * @brief The ctype specialization. - * @ingroup locales - * - * This class defines classification and conversion functions for - * the char type. It gets used by char streams for many I/O - * operations. The char specialization provides a number of - * optimizations as well. - */ - template<> - class ctype : public locale::facet, public ctype_base - { - public: - // Types: - /// Typedef for the template parameter char. - typedef char char_type; - - protected: - // Data Members: - __c_locale _M_c_locale_ctype; - bool _M_del; - __to_type _M_toupper; - __to_type _M_tolower; - const mask* _M_table; - mutable char _M_widen_ok; - mutable char _M_widen[1 + static_cast(-1)]; - mutable char _M_narrow[1 + static_cast(-1)]; - mutable char _M_narrow_ok; // 0 uninitialized, 1 init, - // 2 memcpy can't be used - - public: - /// The facet id for ctype - static locale::id id; - /// The size of the mask table. It is SCHAR_MAX + 1. - static const size_t table_size = 1 + static_cast(-1); - - /** - * @brief Constructor performs initialization. - * - * This is the constructor provided by the standard. - * - * @param __table If non-zero, table is used as the per-char mask. - * Else classic_table() is used. - * @param __del If true, passes ownership of table to this facet. - * @param __refs Passed to the base facet class. - */ - explicit - ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0); - - /** - * @brief Constructor performs static initialization. - * - * This constructor is used to construct the initial C locale facet. - * - * @param __cloc Handle to C locale data. - * @param __table If non-zero, table is used as the per-char mask. - * @param __del If true, passes ownership of table to this facet. - * @param __refs Passed to the base facet class. - */ - explicit - ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false, - size_t __refs = 0); - - /** - * @brief Test char classification. - * - * This function compares the mask table[c] to @a __m. - * - * @param __c The char to compare the mask of. - * @param __m The mask to compare against. - * @return True if __m & table[__c] is true, false otherwise. - */ - inline bool - is(mask __m, char __c) const; - - /** - * @brief Return a mask array. - * - * This function finds the mask for each char in the range [lo, hi) and - * successively writes it to vec. vec must have as many elements as - * the char array. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @param __vec Pointer to an array of mask storage. - * @return @a __hi. - */ - inline const char* - is(const char* __lo, const char* __hi, mask* __vec) const; - - /** - * @brief Find char matching a mask - * - * This function searches for and returns the first char in [lo,hi) for - * which is(m,char) is true. - * - * @param __m The mask to compare against. - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return Pointer to a matching char if found, else @a __hi. - */ - inline const char* - scan_is(mask __m, const char* __lo, const char* __hi) const; - - /** - * @brief Find char not matching a mask - * - * This function searches for and returns a pointer to the first char - * in [__lo,__hi) for which is(m,char) is false. - * - * @param __m The mask to compare against. - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return Pointer to a non-matching char if found, else @a __hi. - */ - inline const char* - scan_not(mask __m, const char* __lo, const char* __hi) const; - - /** - * @brief Convert to uppercase. - * - * This function converts the char argument to uppercase if possible. - * If not possible (for example, '2'), returns the argument. - * - * toupper() acts as if it returns ctype::do_toupper(c). - * do_toupper() must always return the same result for the same input. - * - * @param __c The char to convert. - * @return The uppercase char if convertible, else @a __c. - */ - char_type - toupper(char_type __c) const - { return this->do_toupper(__c); } - - /** - * @brief Convert array to uppercase. - * - * This function converts each char in the range [__lo,__hi) to uppercase - * if possible. Other chars remain untouched. - * - * toupper() acts as if it returns ctype:: do_toupper(__lo, __hi). - * do_toupper() must always return the same result for the same input. - * - * @param __lo Pointer to first char in range. - * @param __hi Pointer to end of range. - * @return @a __hi. - */ - const char_type* - toupper(char_type *__lo, const char_type* __hi) const - { return this->do_toupper(__lo, __hi); } - - /** - * @brief Convert to lowercase. - * - * This function converts the char argument to lowercase if possible. - * If not possible (for example, '2'), returns the argument. - * - * tolower() acts as if it returns ctype::do_tolower(__c). - * do_tolower() must always return the same result for the same input. - * - * @param __c The char to convert. - * @return The lowercase char if convertible, else @a __c. - */ - char_type - tolower(char_type __c) const - { return this->do_tolower(__c); } - - /** - * @brief Convert array to lowercase. - * - * This function converts each char in the range [lo,hi) to lowercase - * if possible. Other chars remain untouched. - * - * tolower() acts as if it returns ctype:: do_tolower(__lo, __hi). - * do_tolower() must always return the same result for the same input. - * - * @param __lo Pointer to first char in range. - * @param __hi Pointer to end of range. - * @return @a __hi. - */ - const char_type* - tolower(char_type* __lo, const char_type* __hi) const - { return this->do_tolower(__lo, __hi); } - - /** - * @brief Widen char - * - * This function converts the char to char_type using the simplest - * reasonable transformation. For an underived ctype facet, the - * argument will be returned unchanged. - * - * This function works as if it returns ctype::do_widen(c). - * do_widen() must always return the same result for the same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __c The char to convert. - * @return The converted character. - */ - char_type - widen(char __c) const - { - if (_M_widen_ok) - return _M_widen[static_cast(__c)]; - this->_M_widen_init(); - return this->do_widen(__c); - } - - /** - * @brief Widen char array - * - * This function converts each char in the input to char using the - * simplest reasonable transformation. For an underived ctype - * facet, the argument will be copied unchanged. - * - * This function works as if it returns ctype::do_widen(c). - * do_widen() must always return the same result for the same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __lo Pointer to first char in range. - * @param __hi Pointer to end of range. - * @param __to Pointer to the destination array. - * @return @a __hi. - */ - const char* - widen(const char* __lo, const char* __hi, char_type* __to) const - { - if (_M_widen_ok == 1) - { - __builtin_memcpy(__to, __lo, __hi - __lo); - return __hi; - } - if (!_M_widen_ok) - _M_widen_init(); - return this->do_widen(__lo, __hi, __to); - } - - /** - * @brief Narrow char - * - * This function converts the char to char using the simplest - * reasonable transformation. If the conversion fails, dfault is - * returned instead. For an underived ctype facet, @a c - * will be returned unchanged. - * - * This function works as if it returns ctype::do_narrow(c). - * do_narrow() must always return the same result for the same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __c The char to convert. - * @param __dfault Char to return if conversion fails. - * @return The converted character. - */ - char - narrow(char_type __c, char __dfault) const - { - if (_M_narrow[static_cast(__c)]) - return _M_narrow[static_cast(__c)]; - const char __t = do_narrow(__c, __dfault); - if (__t != __dfault) - _M_narrow[static_cast(__c)] = __t; - return __t; - } - - /** - * @brief Narrow char array - * - * This function converts each char in the input to char using the - * simplest reasonable transformation and writes the results to the - * destination array. For any char in the input that cannot be - * converted, @a dfault is used instead. For an underived ctype - * facet, the argument will be copied unchanged. - * - * This function works as if it returns ctype::do_narrow(lo, hi, - * dfault, to). do_narrow() must always return the same result for the - * same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @param __dfault Char to use if conversion fails. - * @param __to Pointer to the destination array. - * @return @a __hi. - */ - const char_type* - narrow(const char_type* __lo, const char_type* __hi, - char __dfault, char* __to) const - { - if (__builtin_expect(_M_narrow_ok == 1, true)) - { - __builtin_memcpy(__to, __lo, __hi - __lo); - return __hi; - } - if (!_M_narrow_ok) - _M_narrow_init(); - return this->do_narrow(__lo, __hi, __dfault, __to); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 695. ctype::classic_table() not accessible. - /// Returns a pointer to the mask table provided to the constructor, or - /// the default from classic_table() if none was provided. - const mask* - table() const throw() - { return _M_table; } - - /// Returns a pointer to the C locale mask table. - static const mask* - classic_table() throw(); - protected: - - /** - * @brief Destructor. - * - * This function deletes table() if @a del was true in the - * constructor. - */ - virtual - ~ctype(); - - /** - * @brief Convert to uppercase. - * - * This virtual function converts the char argument to uppercase if - * possible. If not possible (for example, '2'), returns the argument. - * - * do_toupper() is a hook for a derived facet to change the behavior of - * uppercasing. do_toupper() must always return the same result for - * the same input. - * - * @param __c The char to convert. - * @return The uppercase char if convertible, else @a __c. - */ - virtual char_type - do_toupper(char_type __c) const; - - /** - * @brief Convert array to uppercase. - * - * This virtual function converts each char in the range [lo,hi) to - * uppercase if possible. Other chars remain untouched. - * - * do_toupper() is a hook for a derived facet to change the behavior of - * uppercasing. do_toupper() must always return the same result for - * the same input. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return @a __hi. - */ - virtual const char_type* - do_toupper(char_type* __lo, const char_type* __hi) const; - - /** - * @brief Convert to lowercase. - * - * This virtual function converts the char argument to lowercase if - * possible. If not possible (for example, '2'), returns the argument. - * - * do_tolower() is a hook for a derived facet to change the behavior of - * lowercasing. do_tolower() must always return the same result for - * the same input. - * - * @param __c The char to convert. - * @return The lowercase char if convertible, else @a __c. - */ - virtual char_type - do_tolower(char_type __c) const; - - /** - * @brief Convert array to lowercase. - * - * This virtual function converts each char in the range [lo,hi) to - * lowercase if possible. Other chars remain untouched. - * - * do_tolower() is a hook for a derived facet to change the behavior of - * lowercasing. do_tolower() must always return the same result for - * the same input. - * - * @param __lo Pointer to first char in range. - * @param __hi Pointer to end of range. - * @return @a __hi. - */ - virtual const char_type* - do_tolower(char_type* __lo, const char_type* __hi) const; - - /** - * @brief Widen char - * - * This virtual function converts the char to char using the simplest - * reasonable transformation. For an underived ctype facet, the - * argument will be returned unchanged. - * - * do_widen() is a hook for a derived facet to change the behavior of - * widening. do_widen() must always return the same result for the - * same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __c The char to convert. - * @return The converted character. - */ - virtual char_type - do_widen(char __c) const - { return __c; } - - /** - * @brief Widen char array - * - * This function converts each char in the range [lo,hi) to char using - * the simplest reasonable transformation. For an underived - * ctype facet, the argument will be copied unchanged. - * - * do_widen() is a hook for a derived facet to change the behavior of - * widening. do_widen() must always return the same result for the - * same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @param __to Pointer to the destination array. - * @return @a __hi. - */ - virtual const char* - do_widen(const char* __lo, const char* __hi, char_type* __to) const - { - __builtin_memcpy(__to, __lo, __hi - __lo); - return __hi; - } - - /** - * @brief Narrow char - * - * This virtual function converts the char to char using the simplest - * reasonable transformation. If the conversion fails, dfault is - * returned instead. For an underived ctype facet, @a c will be - * returned unchanged. - * - * do_narrow() is a hook for a derived facet to change the behavior of - * narrowing. do_narrow() must always return the same result for the - * same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __c The char to convert. - * @param __dfault Char to return if conversion fails. - * @return The converted char. - */ - virtual char - do_narrow(char_type __c, char __dfault) const - { return __c; } - - /** - * @brief Narrow char array to char array - * - * This virtual function converts each char in the range [lo,hi) to - * char using the simplest reasonable transformation and writes the - * results to the destination array. For any char in the input that - * cannot be converted, @a dfault is used instead. For an underived - * ctype facet, the argument will be copied unchanged. - * - * do_narrow() is a hook for a derived facet to change the behavior of - * narrowing. do_narrow() must always return the same result for the - * same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @param __dfault Char to use if conversion fails. - * @param __to Pointer to the destination array. - * @return @a __hi. - */ - virtual const char_type* - do_narrow(const char_type* __lo, const char_type* __hi, - char __dfault, char* __to) const - { - __builtin_memcpy(__to, __lo, __hi - __lo); - return __hi; - } - - private: - void _M_narrow_init() const; - void _M_widen_init() const; - }; - -#ifdef _GLIBCXX_USE_WCHAR_T - /** - * @brief The ctype specialization. - * @ingroup locales - * - * This class defines classification and conversion functions for the - * wchar_t type. It gets used by wchar_t streams for many I/O operations. - * The wchar_t specialization provides a number of optimizations as well. - * - * ctype inherits its public methods from - * __ctype_abstract_base. - */ - template<> - class ctype : public __ctype_abstract_base - { - public: - // Types: - /// Typedef for the template parameter wchar_t. - typedef wchar_t char_type; - typedef wctype_t __wmask_type; - - protected: - __c_locale _M_c_locale_ctype; - - // Pre-computed narrowed and widened chars. - bool _M_narrow_ok; - char _M_narrow[128]; - wint_t _M_widen[1 + static_cast(-1)]; - - // Pre-computed elements for do_is. - mask _M_bit[16]; - __wmask_type _M_wmask[16]; - - public: - // Data Members: - /// The facet id for ctype - static locale::id id; - - /** - * @brief Constructor performs initialization. - * - * This is the constructor provided by the standard. - * - * @param __refs Passed to the base facet class. - */ - explicit - ctype(size_t __refs = 0); - - /** - * @brief Constructor performs static initialization. - * - * This constructor is used to construct the initial C locale facet. - * - * @param __cloc Handle to C locale data. - * @param __refs Passed to the base facet class. - */ - explicit - ctype(__c_locale __cloc, size_t __refs = 0); - - protected: - __wmask_type - _M_convert_to_wmask(const mask __m) const throw(); - - /// Destructor - virtual - ~ctype(); - - /** - * @brief Test wchar_t classification. - * - * This function finds a mask M for @a c and compares it to mask @a m. - * - * do_is() is a hook for a derived facet to change the behavior of - * classifying. do_is() must always return the same result for the - * same input. - * - * @param __c The wchar_t to find the mask of. - * @param __m The mask to compare against. - * @return (M & __m) != 0. - */ - virtual bool - do_is(mask __m, char_type __c) const; - - /** - * @brief Return a mask array. - * - * This function finds the mask for each wchar_t in the range [lo,hi) - * and successively writes it to vec. vec must have as many elements - * as the input. - * - * do_is() is a hook for a derived facet to change the behavior of - * classifying. do_is() must always return the same result for the - * same input. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @param __vec Pointer to an array of mask storage. - * @return @a __hi. - */ - virtual const char_type* - do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const; - - /** - * @brief Find wchar_t matching mask - * - * This function searches for and returns the first wchar_t c in - * [__lo,__hi) for which is(__m,c) is true. - * - * do_scan_is() is a hook for a derived facet to change the behavior of - * match searching. do_is() must always return the same result for the - * same input. - * - * @param __m The mask to compare against. - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return Pointer to a matching wchar_t if found, else @a __hi. - */ - virtual const char_type* - do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const; - - /** - * @brief Find wchar_t not matching mask - * - * This function searches for and returns a pointer to the first - * wchar_t c of [__lo,__hi) for which is(__m,c) is false. - * - * do_scan_is() is a hook for a derived facet to change the behavior of - * match searching. do_is() must always return the same result for the - * same input. - * - * @param __m The mask to compare against. - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return Pointer to a non-matching wchar_t if found, else @a __hi. - */ - virtual const char_type* - do_scan_not(mask __m, const char_type* __lo, - const char_type* __hi) const; - - /** - * @brief Convert to uppercase. - * - * This virtual function converts the wchar_t argument to uppercase if - * possible. If not possible (for example, '2'), returns the argument. - * - * do_toupper() is a hook for a derived facet to change the behavior of - * uppercasing. do_toupper() must always return the same result for - * the same input. - * - * @param __c The wchar_t to convert. - * @return The uppercase wchar_t if convertible, else @a __c. - */ - virtual char_type - do_toupper(char_type __c) const; - - /** - * @brief Convert array to uppercase. - * - * This virtual function converts each wchar_t in the range [lo,hi) to - * uppercase if possible. Other elements remain untouched. - * - * do_toupper() is a hook for a derived facet to change the behavior of - * uppercasing. do_toupper() must always return the same result for - * the same input. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return @a __hi. - */ - virtual const char_type* - do_toupper(char_type* __lo, const char_type* __hi) const; - - /** - * @brief Convert to lowercase. - * - * This virtual function converts the argument to lowercase if - * possible. If not possible (for example, '2'), returns the argument. - * - * do_tolower() is a hook for a derived facet to change the behavior of - * lowercasing. do_tolower() must always return the same result for - * the same input. - * - * @param __c The wchar_t to convert. - * @return The lowercase wchar_t if convertible, else @a __c. - */ - virtual char_type - do_tolower(char_type __c) const; - - /** - * @brief Convert array to lowercase. - * - * This virtual function converts each wchar_t in the range [lo,hi) to - * lowercase if possible. Other elements remain untouched. - * - * do_tolower() is a hook for a derived facet to change the behavior of - * lowercasing. do_tolower() must always return the same result for - * the same input. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @return @a __hi. - */ - virtual const char_type* - do_tolower(char_type* __lo, const char_type* __hi) const; - - /** - * @brief Widen char to wchar_t - * - * This virtual function converts the char to wchar_t using the - * simplest reasonable transformation. For an underived ctype - * facet, the argument will be cast to wchar_t. - * - * do_widen() is a hook for a derived facet to change the behavior of - * widening. do_widen() must always return the same result for the - * same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __c The char to convert. - * @return The converted wchar_t. - */ - virtual char_type - do_widen(char __c) const; - - /** - * @brief Widen char array to wchar_t array - * - * This function converts each char in the input to wchar_t using the - * simplest reasonable transformation. For an underived ctype - * facet, the argument will be copied, casting each element to wchar_t. - * - * do_widen() is a hook for a derived facet to change the behavior of - * widening. do_widen() must always return the same result for the - * same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __lo Pointer to start range. - * @param __hi Pointer to end of range. - * @param __to Pointer to the destination array. - * @return @a __hi. - */ - virtual const char* - do_widen(const char* __lo, const char* __hi, char_type* __to) const; - - /** - * @brief Narrow wchar_t to char - * - * This virtual function converts the argument to char using - * the simplest reasonable transformation. If the conversion - * fails, dfault is returned instead. For an underived - * ctype facet, @a c will be cast to char and - * returned. - * - * do_narrow() is a hook for a derived facet to change the - * behavior of narrowing. do_narrow() must always return the - * same result for the same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __c The wchar_t to convert. - * @param __dfault Char to return if conversion fails. - * @return The converted char. - */ - virtual char - do_narrow(char_type __c, char __dfault) const; - - /** - * @brief Narrow wchar_t array to char array - * - * This virtual function converts each wchar_t in the range [lo,hi) to - * char using the simplest reasonable transformation and writes the - * results to the destination array. For any wchar_t in the input that - * cannot be converted, @a dfault is used instead. For an underived - * ctype facet, the argument will be copied, casting each - * element to char. - * - * do_narrow() is a hook for a derived facet to change the behavior of - * narrowing. do_narrow() must always return the same result for the - * same input. - * - * Note: this is not what you want for codepage conversions. See - * codecvt for that. - * - * @param __lo Pointer to start of range. - * @param __hi Pointer to end of range. - * @param __dfault Char to use if conversion fails. - * @param __to Pointer to the destination array. - * @return @a __hi. - */ - virtual const char_type* - do_narrow(const char_type* __lo, const char_type* __hi, - char __dfault, char* __to) const; - - // For use at construction time only. - void - _M_initialize_ctype() throw(); - }; -#endif //_GLIBCXX_USE_WCHAR_T - - /// class ctype_byname [22.2.1.2]. - template - class ctype_byname : public ctype<_CharT> - { - public: - typedef typename ctype<_CharT>::mask mask; - - explicit - ctype_byname(const char* __s, size_t __refs = 0); - -#if __cplusplus >= 201103L - explicit - ctype_byname(const string& __s, size_t __refs = 0) - : ctype_byname(__s.c_str(), __refs) { } -#endif - - protected: - virtual - ~ctype_byname() { }; - }; - - /// 22.2.1.4 Class ctype_byname specializations. - template<> - class ctype_byname : public ctype - { - public: - explicit - ctype_byname(const char* __s, size_t __refs = 0); - -#if __cplusplus >= 201103L - explicit - ctype_byname(const string& __s, size_t __refs = 0); -#endif - - protected: - virtual - ~ctype_byname(); - }; - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - class ctype_byname : public ctype - { - public: - explicit - ctype_byname(const char* __s, size_t __refs = 0); - -#if __cplusplus >= 201103L - explicit - ctype_byname(const string& __s, size_t __refs = 0); -#endif - - protected: - virtual - ~ctype_byname(); - }; -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -// Include host and configuration specific ctype inlines. -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // 22.2.2 The numeric category. - class __num_base - { - public: - // NB: Code depends on the order of _S_atoms_out elements. - // Below are the indices into _S_atoms_out. - enum - { - _S_ominus, - _S_oplus, - _S_ox, - _S_oX, - _S_odigits, - _S_odigits_end = _S_odigits + 16, - _S_oudigits = _S_odigits_end, - _S_oudigits_end = _S_oudigits + 16, - _S_oe = _S_odigits + 14, // For scientific notation, 'e' - _S_oE = _S_oudigits + 14, // For scientific notation, 'E' - _S_oend = _S_oudigits_end - }; - - // A list of valid numeric literals for output. This array - // contains chars that will be passed through the current locale's - // ctype<_CharT>.widen() and then used to render numbers. - // For the standard "C" locale, this is - // "-+xX0123456789abcdef0123456789ABCDEF". - static const char* _S_atoms_out; - - // String literal of acceptable (narrow) input, for num_get. - // "-+xX0123456789abcdefABCDEF" - static const char* _S_atoms_in; - - enum - { - _S_iminus, - _S_iplus, - _S_ix, - _S_iX, - _S_izero, - _S_ie = _S_izero + 14, - _S_iE = _S_izero + 20, - _S_iend = 26 - }; - - // num_put - // Construct and return valid scanf format for floating point types. - static void - _S_format_float(const ios_base& __io, char* __fptr, char __mod) throw(); - }; - - template - struct __numpunct_cache : public locale::facet - { - const char* _M_grouping; - size_t _M_grouping_size; - bool _M_use_grouping; - const _CharT* _M_truename; - size_t _M_truename_size; - const _CharT* _M_falsename; - size_t _M_falsename_size; - _CharT _M_decimal_point; - _CharT _M_thousands_sep; - - // A list of valid numeric literals for output: in the standard - // "C" locale, this is "-+xX0123456789abcdef0123456789ABCDEF". - // This array contains the chars after having been passed - // through the current locale's ctype<_CharT>.widen(). - _CharT _M_atoms_out[__num_base::_S_oend]; - - // A list of valid numeric literals for input: in the standard - // "C" locale, this is "-+xX0123456789abcdefABCDEF" - // This array contains the chars after having been passed - // through the current locale's ctype<_CharT>.widen(). - _CharT _M_atoms_in[__num_base::_S_iend]; - - bool _M_allocated; - - __numpunct_cache(size_t __refs = 0) - : facet(__refs), _M_grouping(0), _M_grouping_size(0), - _M_use_grouping(false), - _M_truename(0), _M_truename_size(0), _M_falsename(0), - _M_falsename_size(0), _M_decimal_point(_CharT()), - _M_thousands_sep(_CharT()), _M_allocated(false) - { } - - ~__numpunct_cache(); - - void - _M_cache(const locale& __loc); - - private: - __numpunct_cache& - operator=(const __numpunct_cache&); - - explicit - __numpunct_cache(const __numpunct_cache&); - }; - - template - __numpunct_cache<_CharT>::~__numpunct_cache() - { - if (_M_allocated) - { - delete [] _M_grouping; - delete [] _M_truename; - delete [] _M_falsename; - } - } - -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - - /** - * @brief Primary class template numpunct. - * @ingroup locales - * - * This facet stores several pieces of information related to printing and - * scanning numbers, such as the decimal point character. It takes a - * template parameter specifying the char type. The numpunct facet is - * used by streams for many I/O operations involving numbers. - * - * The numpunct template uses protected virtual functions to provide the - * actual results. The public accessors forward the call to the virtual - * functions. These virtual functions are hooks for developers to - * implement the behavior they require from a numpunct facet. - */ - template - class numpunct : public locale::facet - { - public: - // Types: - //@{ - /// Public typedefs - typedef _CharT char_type; - typedef basic_string<_CharT> string_type; - //@} - typedef __numpunct_cache<_CharT> __cache_type; - - protected: - __cache_type* _M_data; - - public: - /// Numpunct facet id. - static locale::id id; - - /** - * @brief Numpunct constructor. - * - * @param __refs Refcount to pass to the base class. - */ - explicit - numpunct(size_t __refs = 0) - : facet(__refs), _M_data(0) - { _M_initialize_numpunct(); } - - /** - * @brief Internal constructor. Not for general use. - * - * This is a constructor for use by the library itself to set up the - * predefined locale facets. - * - * @param __cache __numpunct_cache object. - * @param __refs Refcount to pass to the base class. - */ - explicit - numpunct(__cache_type* __cache, size_t __refs = 0) - : facet(__refs), _M_data(__cache) - { _M_initialize_numpunct(); } - - /** - * @brief Internal constructor. Not for general use. - * - * This is a constructor for use by the library itself to set up new - * locales. - * - * @param __cloc The C locale. - * @param __refs Refcount to pass to the base class. - */ - explicit - numpunct(__c_locale __cloc, size_t __refs = 0) - : facet(__refs), _M_data(0) - { _M_initialize_numpunct(__cloc); } - - /** - * @brief Return decimal point character. - * - * This function returns a char_type to use as a decimal point. It - * does so by returning returning - * numpunct::do_decimal_point(). - * - * @return @a char_type representing a decimal point. - */ - char_type - decimal_point() const - { return this->do_decimal_point(); } - - /** - * @brief Return thousands separator character. - * - * This function returns a char_type to use as a thousands - * separator. It does so by returning returning - * numpunct::do_thousands_sep(). - * - * @return char_type representing a thousands separator. - */ - char_type - thousands_sep() const - { return this->do_thousands_sep(); } - - /** - * @brief Return grouping specification. - * - * This function returns a string representing groupings for the - * integer part of a number. Groupings indicate where thousands - * separators should be inserted in the integer part of a number. - * - * Each char in the return string is interpret as an integer - * rather than a character. These numbers represent the number - * of digits in a group. The first char in the string - * represents the number of digits in the least significant - * group. If a char is negative, it indicates an unlimited - * number of digits for the group. If more chars from the - * string are required to group a number, the last char is used - * repeatedly. - * - * For example, if the grouping() returns "\003\002" and is - * applied to the number 123456789, this corresponds to - * 12,34,56,789. Note that if the string was "32", this would - * put more than 50 digits into the least significant group if - * the character set is ASCII. - * - * The string is returned by calling - * numpunct::do_grouping(). - * - * @return string representing grouping specification. - */ - string - grouping() const - { return this->do_grouping(); } - - /** - * @brief Return string representation of bool true. - * - * This function returns a string_type containing the text - * representation for true bool variables. It does so by calling - * numpunct::do_truename(). - * - * @return string_type representing printed form of true. - */ - string_type - truename() const - { return this->do_truename(); } - - /** - * @brief Return string representation of bool false. - * - * This function returns a string_type containing the text - * representation for false bool variables. It does so by calling - * numpunct::do_falsename(). - * - * @return string_type representing printed form of false. - */ - string_type - falsename() const - { return this->do_falsename(); } - - protected: - /// Destructor. - virtual - ~numpunct(); - - /** - * @brief Return decimal point character. - * - * Returns a char_type to use as a decimal point. This function is a - * hook for derived classes to change the value returned. - * - * @return @a char_type representing a decimal point. - */ - virtual char_type - do_decimal_point() const - { return _M_data->_M_decimal_point; } - - /** - * @brief Return thousands separator character. - * - * Returns a char_type to use as a thousands separator. This function - * is a hook for derived classes to change the value returned. - * - * @return @a char_type representing a thousands separator. - */ - virtual char_type - do_thousands_sep() const - { return _M_data->_M_thousands_sep; } - - /** - * @brief Return grouping specification. - * - * Returns a string representing groupings for the integer part of a - * number. This function is a hook for derived classes to change the - * value returned. @see grouping() for details. - * - * @return String representing grouping specification. - */ - virtual string - do_grouping() const - { return _M_data->_M_grouping; } - - /** - * @brief Return string representation of bool true. - * - * Returns a string_type containing the text representation for true - * bool variables. This function is a hook for derived classes to - * change the value returned. - * - * @return string_type representing printed form of true. - */ - virtual string_type - do_truename() const - { return _M_data->_M_truename; } - - /** - * @brief Return string representation of bool false. - * - * Returns a string_type containing the text representation for false - * bool variables. This function is a hook for derived classes to - * change the value returned. - * - * @return string_type representing printed form of false. - */ - virtual string_type - do_falsename() const - { return _M_data->_M_falsename; } - - // For use at construction time only. - void - _M_initialize_numpunct(__c_locale __cloc = 0); - }; - - template - locale::id numpunct<_CharT>::id; - - template<> - numpunct::~numpunct(); - - template<> - void - numpunct::_M_initialize_numpunct(__c_locale __cloc); - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - numpunct::~numpunct(); - - template<> - void - numpunct::_M_initialize_numpunct(__c_locale __cloc); -#endif - - /// class numpunct_byname [22.2.3.2]. - template - class numpunct_byname : public numpunct<_CharT> - { - public: - typedef _CharT char_type; - typedef basic_string<_CharT> string_type; - - explicit - numpunct_byname(const char* __s, size_t __refs = 0) - : numpunct<_CharT>(__refs) - { - if (__builtin_strcmp(__s, "C") != 0 - && __builtin_strcmp(__s, "POSIX") != 0) - { - __c_locale __tmp; - this->_S_create_c_locale(__tmp, __s); - this->_M_initialize_numpunct(__tmp); - this->_S_destroy_c_locale(__tmp); - } - } - -#if __cplusplus >= 201103L - explicit - numpunct_byname(const string& __s, size_t __refs = 0) - : numpunct_byname(__s.c_str(), __refs) { } -#endif - - protected: - virtual - ~numpunct_byname() { } - }; - -_GLIBCXX_END_NAMESPACE_CXX11 - -_GLIBCXX_BEGIN_NAMESPACE_LDBL - - /** - * @brief Primary class template num_get. - * @ingroup locales - * - * This facet encapsulates the code to parse and return a number - * from a string. It is used by the istream numeric extraction - * operators. - * - * The num_get template uses protected virtual functions to provide the - * actual results. The public accessors forward the call to the virtual - * functions. These virtual functions are hooks for developers to - * implement the behavior they require from the num_get facet. - */ - template - class num_get : public locale::facet - { - public: - // Types: - //@{ - /// Public typedefs - typedef _CharT char_type; - typedef _InIter iter_type; - //@} - - /// Numpunct facet id. - static locale::id id; - - /** - * @brief Constructor performs initialization. - * - * This is the constructor provided by the standard. - * - * @param __refs Passed to the base facet class. - */ - explicit - num_get(size_t __refs = 0) : facet(__refs) { } - - /** - * @brief Numeric parsing. - * - * Parses the input stream into the bool @a v. It does so by calling - * num_get::do_get(). - * - * If ios_base::boolalpha is set, attempts to read - * ctype::truename() or ctype::falsename(). Sets - * @a v to true or false if successful. Sets err to - * ios_base::failbit if reading the string fails. Sets err to - * ios_base::eofbit if the stream is emptied. - * - * If ios_base::boolalpha is not set, proceeds as with reading a long, - * except if the value is 1, sets @a v to true, if the value is 0, sets - * @a v to false, and otherwise set err to ios_base::failbit. - * - * @param __in Start of input stream. - * @param __end End of input stream. - * @param __io Source of locale and flags. - * @param __err Error flags to set. - * @param __v Value to format and insert. - * @return Iterator after reading. - */ - iter_type - get(iter_type __in, iter_type __end, ios_base& __io, - ios_base::iostate& __err, bool& __v) const - { return this->do_get(__in, __end, __io, __err, __v); } - - //@{ - /** - * @brief Numeric parsing. - * - * Parses the input stream into the integral variable @a v. It does so - * by calling num_get::do_get(). - * - * Parsing is affected by the flag settings in @a io. - * - * The basic parse is affected by the value of io.flags() & - * ios_base::basefield. If equal to ios_base::oct, parses like the - * scanf %o specifier. Else if equal to ios_base::hex, parses like %X - * specifier. Else if basefield equal to 0, parses like the %i - * specifier. Otherwise, parses like %d for signed and %u for unsigned - * types. The matching type length modifier is also used. - * - * Digit grouping is interpreted according to - * numpunct::grouping() and numpunct::thousands_sep(). If the - * pattern of digit groups isn't consistent, sets err to - * ios_base::failbit. - * - * If parsing the string yields a valid value for @a v, @a v is set. - * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered. - * Sets err to ios_base::eofbit if the stream is emptied. - * - * @param __in Start of input stream. - * @param __end End of input stream. - * @param __io Source of locale and flags. - * @param __err Error flags to set. - * @param __v Value to format and insert. - * @return Iterator after reading. - */ - iter_type - get(iter_type __in, iter_type __end, ios_base& __io, - ios_base::iostate& __err, long& __v) const - { return this->do_get(__in, __end, __io, __err, __v); } - - iter_type - get(iter_type __in, iter_type __end, ios_base& __io, - ios_base::iostate& __err, unsigned short& __v) const - { return this->do_get(__in, __end, __io, __err, __v); } - - iter_type - get(iter_type __in, iter_type __end, ios_base& __io, - ios_base::iostate& __err, unsigned int& __v) const - { return this->do_get(__in, __end, __io, __err, __v); } - - iter_type - get(iter_type __in, iter_type __end, ios_base& __io, - ios_base::iostate& __err, unsigned long& __v) const - { return this->do_get(__in, __end, __io, __err, __v); } - -#ifdef _GLIBCXX_USE_LONG_LONG - iter_type - get(iter_type __in, iter_type __end, ios_base& __io, - ios_base::iostate& __err, long long& __v) const - { return this->do_get(__in, __end, __io, __err, __v); } - - iter_type - get(iter_type __in, iter_type __end, ios_base& __io, - ios_base::iostate& __err, unsigned long long& __v) const - { return this->do_get(__in, __end, __io, __err, __v); } -#endif - //@} - - //@{ - /** - * @brief Numeric parsing. - * - * Parses the input stream into the integral variable @a v. It does so - * by calling num_get::do_get(). - * - * The input characters are parsed like the scanf %g specifier. The - * matching type length modifier is also used. - * - * The decimal point character used is numpunct::decimal_point(). - * Digit grouping is interpreted according to - * numpunct::grouping() and numpunct::thousands_sep(). If the - * pattern of digit groups isn't consistent, sets err to - * ios_base::failbit. - * - * If parsing the string yields a valid value for @a v, @a v is set. - * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered. - * Sets err to ios_base::eofbit if the stream is emptied. - * - * @param __in Start of input stream. - * @param __end End of input stream. - * @param __io Source of locale and flags. - * @param __err Error flags to set. - * @param __v Value to format and insert. - * @return Iterator after reading. - */ - iter_type - get(iter_type __in, iter_type __end, ios_base& __io, - ios_base::iostate& __err, float& __v) const - { return this->do_get(__in, __end, __io, __err, __v); } - - iter_type - get(iter_type __in, iter_type __end, ios_base& __io, - ios_base::iostate& __err, double& __v) const - { return this->do_get(__in, __end, __io, __err, __v); } - - iter_type - get(iter_type __in, iter_type __end, ios_base& __io, - ios_base::iostate& __err, long double& __v) const - { return this->do_get(__in, __end, __io, __err, __v); } - //@} - - /** - * @brief Numeric parsing. - * - * Parses the input stream into the pointer variable @a v. It does so - * by calling num_get::do_get(). - * - * The input characters are parsed like the scanf %p specifier. - * - * Digit grouping is interpreted according to - * numpunct::grouping() and numpunct::thousands_sep(). If the - * pattern of digit groups isn't consistent, sets err to - * ios_base::failbit. - * - * Note that the digit grouping effect for pointers is a bit ambiguous - * in the standard and shouldn't be relied on. See DR 344. - * - * If parsing the string yields a valid value for @a v, @a v is set. - * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered. - * Sets err to ios_base::eofbit if the stream is emptied. - * - * @param __in Start of input stream. - * @param __end End of input stream. - * @param __io Source of locale and flags. - * @param __err Error flags to set. - * @param __v Value to format and insert. - * @return Iterator after reading. - */ - iter_type - get(iter_type __in, iter_type __end, ios_base& __io, - ios_base::iostate& __err, void*& __v) const - { return this->do_get(__in, __end, __io, __err, __v); } - - protected: - /// Destructor. - virtual ~num_get() { } - - _GLIBCXX_DEFAULT_ABI_TAG - iter_type - _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&, - string&) const; - - template - _GLIBCXX_DEFAULT_ABI_TAG - iter_type - _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&, - _ValueT&) const; - - template - typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, int>::__type - _M_find(const _CharT2*, size_t __len, _CharT2 __c) const - { - int __ret = -1; - if (__len <= 10) - { - if (__c >= _CharT2('0') && __c < _CharT2(_CharT2('0') + __len)) - __ret = __c - _CharT2('0'); - } - else - { - if (__c >= _CharT2('0') && __c <= _CharT2('9')) - __ret = __c - _CharT2('0'); - else if (__c >= _CharT2('a') && __c <= _CharT2('f')) - __ret = 10 + (__c - _CharT2('a')); - else if (__c >= _CharT2('A') && __c <= _CharT2('F')) - __ret = 10 + (__c - _CharT2('A')); - } - return __ret; - } - - template - typename __gnu_cxx::__enable_if::__value, - int>::__type - _M_find(const _CharT2* __zero, size_t __len, _CharT2 __c) const - { - int __ret = -1; - const char_type* __q = char_traits<_CharT2>::find(__zero, __len, __c); - if (__q) - { - __ret = __q - __zero; - if (__ret > 15) - __ret -= 6; - } - return __ret; - } - - //@{ - /** - * @brief Numeric parsing. - * - * Parses the input stream into the variable @a v. This function is a - * hook for derived classes to change the value returned. @see get() - * for more details. - * - * @param __beg Start of input stream. - * @param __end End of input stream. - * @param __io Source of locale and flags. - * @param __err Error flags to set. - * @param __v Value to format and insert. - * @return Iterator after reading. - */ - virtual iter_type - do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const; - - virtual iter_type - do_get(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, long& __v) const - { return _M_extract_int(__beg, __end, __io, __err, __v); } - - virtual iter_type - do_get(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, unsigned short& __v) const - { return _M_extract_int(__beg, __end, __io, __err, __v); } - - virtual iter_type - do_get(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, unsigned int& __v) const - { return _M_extract_int(__beg, __end, __io, __err, __v); } - - virtual iter_type - do_get(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, unsigned long& __v) const - { return _M_extract_int(__beg, __end, __io, __err, __v); } - -#ifdef _GLIBCXX_USE_LONG_LONG - virtual iter_type - do_get(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, long long& __v) const - { return _M_extract_int(__beg, __end, __io, __err, __v); } - - virtual iter_type - do_get(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, unsigned long long& __v) const - { return _M_extract_int(__beg, __end, __io, __err, __v); } -#endif - - virtual iter_type - do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, float&) const; - - virtual iter_type - do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, - double&) const; - - // XXX GLIBCXX_ABI Deprecated -#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ - virtual iter_type - __do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, - double&) const; -#else - virtual iter_type - do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, - long double&) const; -#endif - - virtual iter_type - do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, void*&) const; - - // XXX GLIBCXX_ABI Deprecated -#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ - virtual iter_type - do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, - long double&) const; -#endif - //@} - }; - - template - locale::id num_get<_CharT, _InIter>::id; - - - /** - * @brief Primary class template num_put. - * @ingroup locales - * - * This facet encapsulates the code to convert a number to a string. It is - * used by the ostream numeric insertion operators. - * - * The num_put template uses protected virtual functions to provide the - * actual results. The public accessors forward the call to the virtual - * functions. These virtual functions are hooks for developers to - * implement the behavior they require from the num_put facet. - */ - template - class num_put : public locale::facet - { - public: - // Types: - //@{ - /// Public typedefs - typedef _CharT char_type; - typedef _OutIter iter_type; - //@} - - /// Numpunct facet id. - static locale::id id; - - /** - * @brief Constructor performs initialization. - * - * This is the constructor provided by the standard. - * - * @param __refs Passed to the base facet class. - */ - explicit - num_put(size_t __refs = 0) : facet(__refs) { } - - /** - * @brief Numeric formatting. - * - * Formats the boolean @a v and inserts it into a stream. It does so - * by calling num_put::do_put(). - * - * If ios_base::boolalpha is set, writes ctype::truename() or - * ctype::falsename(). Otherwise formats @a v as an int. - * - * @param __s Stream to write to. - * @param __io Source of locale and flags. - * @param __fill Char_type to use for filling. - * @param __v Value to format and insert. - * @return Iterator after writing. - */ - iter_type - put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const - { return this->do_put(__s, __io, __fill, __v); } - - //@{ - /** - * @brief Numeric formatting. - * - * Formats the integral value @a v and inserts it into a - * stream. It does so by calling num_put::do_put(). - * - * Formatting is affected by the flag settings in @a io. - * - * The basic format is affected by the value of io.flags() & - * ios_base::basefield. If equal to ios_base::oct, formats like the - * printf %o specifier. Else if equal to ios_base::hex, formats like - * %x or %X with ios_base::uppercase unset or set respectively. - * Otherwise, formats like %d, %ld, %lld for signed and %u, %lu, %llu - * for unsigned values. Note that if both oct and hex are set, neither - * will take effect. - * - * If ios_base::showpos is set, '+' is output before positive values. - * If ios_base::showbase is set, '0' precedes octal values (except 0) - * and '0[xX]' precedes hex values. - * - * The decimal point character used is numpunct::decimal_point(). - * Thousands separators are inserted according to - * numpunct::grouping() and numpunct::thousands_sep(). - * - * If io.width() is non-zero, enough @a fill characters are inserted to - * make the result at least that wide. If - * (io.flags() & ios_base::adjustfield) == ios_base::left, result is - * padded at the end. If ios_base::internal, then padding occurs - * immediately after either a '+' or '-' or after '0x' or '0X'. - * Otherwise, padding occurs at the beginning. - * - * @param __s Stream to write to. - * @param __io Source of locale and flags. - * @param __fill Char_type to use for filling. - * @param __v Value to format and insert. - * @return Iterator after writing. - */ - iter_type - put(iter_type __s, ios_base& __io, char_type __fill, long __v) const - { return this->do_put(__s, __io, __fill, __v); } - - iter_type - put(iter_type __s, ios_base& __io, char_type __fill, - unsigned long __v) const - { return this->do_put(__s, __io, __fill, __v); } - -#ifdef _GLIBCXX_USE_LONG_LONG - iter_type - put(iter_type __s, ios_base& __io, char_type __fill, long long __v) const - { return this->do_put(__s, __io, __fill, __v); } - - iter_type - put(iter_type __s, ios_base& __io, char_type __fill, - unsigned long long __v) const - { return this->do_put(__s, __io, __fill, __v); } -#endif - //@} - - //@{ - /** - * @brief Numeric formatting. - * - * Formats the floating point value @a v and inserts it into a stream. - * It does so by calling num_put::do_put(). - * - * Formatting is affected by the flag settings in @a io. - * - * The basic format is affected by the value of io.flags() & - * ios_base::floatfield. If equal to ios_base::fixed, formats like the - * printf %f specifier. Else if equal to ios_base::scientific, formats - * like %e or %E with ios_base::uppercase unset or set respectively. - * Otherwise, formats like %g or %G depending on uppercase. Note that - * if both fixed and scientific are set, the effect will also be like - * %g or %G. - * - * The output precision is given by io.precision(). This precision is - * capped at numeric_limits::digits10 + 2 (different for double and - * long double). The default precision is 6. - * - * If ios_base::showpos is set, '+' is output before positive values. - * If ios_base::showpoint is set, a decimal point will always be - * output. - * - * The decimal point character used is numpunct::decimal_point(). - * Thousands separators are inserted according to - * numpunct::grouping() and numpunct::thousands_sep(). - * - * If io.width() is non-zero, enough @a fill characters are inserted to - * make the result at least that wide. If - * (io.flags() & ios_base::adjustfield) == ios_base::left, result is - * padded at the end. If ios_base::internal, then padding occurs - * immediately after either a '+' or '-' or after '0x' or '0X'. - * Otherwise, padding occurs at the beginning. - * - * @param __s Stream to write to. - * @param __io Source of locale and flags. - * @param __fill Char_type to use for filling. - * @param __v Value to format and insert. - * @return Iterator after writing. - */ - iter_type - put(iter_type __s, ios_base& __io, char_type __fill, double __v) const - { return this->do_put(__s, __io, __fill, __v); } - - iter_type - put(iter_type __s, ios_base& __io, char_type __fill, - long double __v) const - { return this->do_put(__s, __io, __fill, __v); } - //@} - - /** - * @brief Numeric formatting. - * - * Formats the pointer value @a v and inserts it into a stream. It - * does so by calling num_put::do_put(). - * - * This function formats @a v as an unsigned long with ios_base::hex - * and ios_base::showbase set. - * - * @param __s Stream to write to. - * @param __io Source of locale and flags. - * @param __fill Char_type to use for filling. - * @param __v Value to format and insert. - * @return Iterator after writing. - */ - iter_type - put(iter_type __s, ios_base& __io, char_type __fill, - const void* __v) const - { return this->do_put(__s, __io, __fill, __v); } - - protected: - template - iter_type - _M_insert_float(iter_type, ios_base& __io, char_type __fill, - char __mod, _ValueT __v) const; - - void - _M_group_float(const char* __grouping, size_t __grouping_size, - char_type __sep, const char_type* __p, char_type* __new, - char_type* __cs, int& __len) const; - - template - iter_type - _M_insert_int(iter_type, ios_base& __io, char_type __fill, - _ValueT __v) const; - - void - _M_group_int(const char* __grouping, size_t __grouping_size, - char_type __sep, ios_base& __io, char_type* __new, - char_type* __cs, int& __len) const; - - void - _M_pad(char_type __fill, streamsize __w, ios_base& __io, - char_type* __new, const char_type* __cs, int& __len) const; - - /// Destructor. - virtual - ~num_put() { }; - - //@{ - /** - * @brief Numeric formatting. - * - * These functions do the work of formatting numeric values and - * inserting them into a stream. This function is a hook for derived - * classes to change the value returned. - * - * @param __s Stream to write to. - * @param __io Source of locale and flags. - * @param __fill Char_type to use for filling. - * @param __v Value to format and insert. - * @return Iterator after writing. - */ - virtual iter_type - do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const; - - virtual iter_type - do_put(iter_type __s, ios_base& __io, char_type __fill, long __v) const - { return _M_insert_int(__s, __io, __fill, __v); } - - virtual iter_type - do_put(iter_type __s, ios_base& __io, char_type __fill, - unsigned long __v) const - { return _M_insert_int(__s, __io, __fill, __v); } - -#ifdef _GLIBCXX_USE_LONG_LONG - virtual iter_type - do_put(iter_type __s, ios_base& __io, char_type __fill, - long long __v) const - { return _M_insert_int(__s, __io, __fill, __v); } - - virtual iter_type - do_put(iter_type __s, ios_base& __io, char_type __fill, - unsigned long long __v) const - { return _M_insert_int(__s, __io, __fill, __v); } -#endif - - virtual iter_type - do_put(iter_type, ios_base&, char_type, double) const; - - // XXX GLIBCXX_ABI Deprecated -#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ - virtual iter_type - __do_put(iter_type, ios_base&, char_type, double) const; -#else - virtual iter_type - do_put(iter_type, ios_base&, char_type, long double) const; -#endif - - virtual iter_type - do_put(iter_type, ios_base&, char_type, const void*) const; - - // XXX GLIBCXX_ABI Deprecated -#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ - virtual iter_type - do_put(iter_type, ios_base&, char_type, long double) const; -#endif - //@} - }; - - template - locale::id num_put<_CharT, _OutIter>::id; - -_GLIBCXX_END_NAMESPACE_LDBL - - // Subclause convenience interfaces, inlines. - // NB: These are inline because, when used in a loop, some compilers - // can hoist the body out of the loop; then it's just as fast as the - // C is*() function. - - /// Convenience interface to ctype.is(ctype_base::space, __c). - template - inline bool - isspace(_CharT __c, const locale& __loc) - { return use_facet >(__loc).is(ctype_base::space, __c); } - - /// Convenience interface to ctype.is(ctype_base::print, __c). - template - inline bool - isprint(_CharT __c, const locale& __loc) - { return use_facet >(__loc).is(ctype_base::print, __c); } - - /// Convenience interface to ctype.is(ctype_base::cntrl, __c). - template - inline bool - iscntrl(_CharT __c, const locale& __loc) - { return use_facet >(__loc).is(ctype_base::cntrl, __c); } - - /// Convenience interface to ctype.is(ctype_base::upper, __c). - template - inline bool - isupper(_CharT __c, const locale& __loc) - { return use_facet >(__loc).is(ctype_base::upper, __c); } - - /// Convenience interface to ctype.is(ctype_base::lower, __c). - template - inline bool - islower(_CharT __c, const locale& __loc) - { return use_facet >(__loc).is(ctype_base::lower, __c); } - - /// Convenience interface to ctype.is(ctype_base::alpha, __c). - template - inline bool - isalpha(_CharT __c, const locale& __loc) - { return use_facet >(__loc).is(ctype_base::alpha, __c); } - - /// Convenience interface to ctype.is(ctype_base::digit, __c). - template - inline bool - isdigit(_CharT __c, const locale& __loc) - { return use_facet >(__loc).is(ctype_base::digit, __c); } - - /// Convenience interface to ctype.is(ctype_base::punct, __c). - template - inline bool - ispunct(_CharT __c, const locale& __loc) - { return use_facet >(__loc).is(ctype_base::punct, __c); } - - /// Convenience interface to ctype.is(ctype_base::xdigit, __c). - template - inline bool - isxdigit(_CharT __c, const locale& __loc) - { return use_facet >(__loc).is(ctype_base::xdigit, __c); } - - /// Convenience interface to ctype.is(ctype_base::alnum, __c). - template - inline bool - isalnum(_CharT __c, const locale& __loc) - { return use_facet >(__loc).is(ctype_base::alnum, __c); } - - /// Convenience interface to ctype.is(ctype_base::graph, __c). - template - inline bool - isgraph(_CharT __c, const locale& __loc) - { return use_facet >(__loc).is(ctype_base::graph, __c); } - -#if __cplusplus >= 201103L - /// Convenience interface to ctype.is(ctype_base::blank, __c). - template - inline bool - isblank(_CharT __c, const locale& __loc) - { return use_facet >(__loc).is(ctype_base::blank, __c); } -#endif - - /// Convenience interface to ctype.toupper(__c). - template - inline _CharT - toupper(_CharT __c, const locale& __loc) - { return use_facet >(__loc).toupper(__c); } - - /// Convenience interface to ctype.tolower(__c). - template - inline _CharT - tolower(_CharT __c, const locale& __loc) - { return use_facet >(__loc).tolower(__c); } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -# include - -#endif diff --git a/openflow/usr/include/c++/5/bits/locale_facets.tcc b/openflow/usr/include/c++/5/bits/locale_facets.tcc deleted file mode 100644 index bd58771..0000000 --- a/openflow/usr/include/c++/5/bits/locale_facets.tcc +++ /dev/null @@ -1,1377 +0,0 @@ -// Locale support -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/locale_facets.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -#ifndef _LOCALE_FACETS_TCC -#define _LOCALE_FACETS_TCC 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Routine to access a cache for the facet. If the cache didn't - // exist before, it gets constructed on the fly. - template - struct __use_cache - { - const _Facet* - operator() (const locale& __loc) const; - }; - - // Specializations. - template - struct __use_cache<__numpunct_cache<_CharT> > - { - const __numpunct_cache<_CharT>* - operator() (const locale& __loc) const - { - const size_t __i = numpunct<_CharT>::id._M_id(); - const locale::facet** __caches = __loc._M_impl->_M_caches; - if (!__caches[__i]) - { - __numpunct_cache<_CharT>* __tmp = 0; - __try - { - __tmp = new __numpunct_cache<_CharT>; - __tmp->_M_cache(__loc); - } - __catch(...) - { - delete __tmp; - __throw_exception_again; - } - __loc._M_impl->_M_install_cache(__tmp, __i); - } - return static_cast*>(__caches[__i]); - } - }; - - template - void - __numpunct_cache<_CharT>::_M_cache(const locale& __loc) - { - const numpunct<_CharT>& __np = use_facet >(__loc); - - char* __grouping = 0; - _CharT* __truename = 0; - _CharT* __falsename = 0; - __try - { - const string& __g = __np.grouping(); - _M_grouping_size = __g.size(); - __grouping = new char[_M_grouping_size]; - __g.copy(__grouping, _M_grouping_size); - _M_use_grouping = (_M_grouping_size - && static_cast(__grouping[0]) > 0 - && (__grouping[0] - != __gnu_cxx::__numeric_traits::__max)); - - const basic_string<_CharT>& __tn = __np.truename(); - _M_truename_size = __tn.size(); - __truename = new _CharT[_M_truename_size]; - __tn.copy(__truename, _M_truename_size); - - const basic_string<_CharT>& __fn = __np.falsename(); - _M_falsename_size = __fn.size(); - __falsename = new _CharT[_M_falsename_size]; - __fn.copy(__falsename, _M_falsename_size); - - _M_decimal_point = __np.decimal_point(); - _M_thousands_sep = __np.thousands_sep(); - - const ctype<_CharT>& __ct = use_facet >(__loc); - __ct.widen(__num_base::_S_atoms_out, - __num_base::_S_atoms_out - + __num_base::_S_oend, _M_atoms_out); - __ct.widen(__num_base::_S_atoms_in, - __num_base::_S_atoms_in - + __num_base::_S_iend, _M_atoms_in); - - _M_grouping = __grouping; - _M_truename = __truename; - _M_falsename = __falsename; - _M_allocated = true; - } - __catch(...) - { - delete [] __grouping; - delete [] __truename; - delete [] __falsename; - __throw_exception_again; - } - } - - // Used by both numeric and monetary facets. - // Check to make sure that the __grouping_tmp string constructed in - // money_get or num_get matches the canonical grouping for a given - // locale. - // __grouping_tmp is parsed L to R - // 1,222,444 == __grouping_tmp of "\1\3\3" - // __grouping is parsed R to L - // 1,222,444 == __grouping of "\3" == "\3\3\3" - _GLIBCXX_PURE bool - __verify_grouping(const char* __grouping, size_t __grouping_size, - const string& __grouping_tmp) throw (); - -_GLIBCXX_BEGIN_NAMESPACE_LDBL - - template - _GLIBCXX_DEFAULT_ABI_TAG - _InIter - num_get<_CharT, _InIter>:: - _M_extract_float(_InIter __beg, _InIter __end, ios_base& __io, - ios_base::iostate& __err, string& __xtrc) const - { - typedef char_traits<_CharT> __traits_type; - typedef __numpunct_cache<_CharT> __cache_type; - __use_cache<__cache_type> __uc; - const locale& __loc = __io._M_getloc(); - const __cache_type* __lc = __uc(__loc); - const _CharT* __lit = __lc->_M_atoms_in; - char_type __c = char_type(); - - // True if __beg becomes equal to __end. - bool __testeof = __beg == __end; - - // First check for sign. - if (!__testeof) - { - __c = *__beg; - const bool __plus = __c == __lit[__num_base::_S_iplus]; - if ((__plus || __c == __lit[__num_base::_S_iminus]) - && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) - && !(__c == __lc->_M_decimal_point)) - { - __xtrc += __plus ? '+' : '-'; - if (++__beg != __end) - __c = *__beg; - else - __testeof = true; - } - } - - // Next, look for leading zeros. - bool __found_mantissa = false; - int __sep_pos = 0; - while (!__testeof) - { - if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) - || __c == __lc->_M_decimal_point) - break; - else if (__c == __lit[__num_base::_S_izero]) - { - if (!__found_mantissa) - { - __xtrc += '0'; - __found_mantissa = true; - } - ++__sep_pos; - - if (++__beg != __end) - __c = *__beg; - else - __testeof = true; - } - else - break; - } - - // Only need acceptable digits for floating point numbers. - bool __found_dec = false; - bool __found_sci = false; - string __found_grouping; - if (__lc->_M_use_grouping) - __found_grouping.reserve(32); - const char_type* __lit_zero = __lit + __num_base::_S_izero; - - if (!__lc->_M_allocated) - // "C" locale - while (!__testeof) - { - const int __digit = _M_find(__lit_zero, 10, __c); - if (__digit != -1) - { - __xtrc += '0' + __digit; - __found_mantissa = true; - } - else if (__c == __lc->_M_decimal_point - && !__found_dec && !__found_sci) - { - __xtrc += '.'; - __found_dec = true; - } - else if ((__c == __lit[__num_base::_S_ie] - || __c == __lit[__num_base::_S_iE]) - && !__found_sci && __found_mantissa) - { - // Scientific notation. - __xtrc += 'e'; - __found_sci = true; - - // Remove optional plus or minus sign, if they exist. - if (++__beg != __end) - { - __c = *__beg; - const bool __plus = __c == __lit[__num_base::_S_iplus]; - if (__plus || __c == __lit[__num_base::_S_iminus]) - __xtrc += __plus ? '+' : '-'; - else - continue; - } - else - { - __testeof = true; - break; - } - } - else - break; - - if (++__beg != __end) - __c = *__beg; - else - __testeof = true; - } - else - while (!__testeof) - { - // According to 22.2.2.1.2, p8-9, first look for thousands_sep - // and decimal_point. - if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) - { - if (!__found_dec && !__found_sci) - { - // NB: Thousands separator at the beginning of a string - // is a no-no, as is two consecutive thousands separators. - if (__sep_pos) - { - __found_grouping += static_cast(__sep_pos); - __sep_pos = 0; - } - else - { - // NB: __convert_to_v will not assign __v and will - // set the failbit. - __xtrc.clear(); - break; - } - } - else - break; - } - else if (__c == __lc->_M_decimal_point) - { - if (!__found_dec && !__found_sci) - { - // If no grouping chars are seen, no grouping check - // is applied. Therefore __found_grouping is adjusted - // only if decimal_point comes after some thousands_sep. - if (__found_grouping.size()) - __found_grouping += static_cast(__sep_pos); - __xtrc += '.'; - __found_dec = true; - } - else - break; - } - else - { - const char_type* __q = - __traits_type::find(__lit_zero, 10, __c); - if (__q) - { - __xtrc += '0' + (__q - __lit_zero); - __found_mantissa = true; - ++__sep_pos; - } - else if ((__c == __lit[__num_base::_S_ie] - || __c == __lit[__num_base::_S_iE]) - && !__found_sci && __found_mantissa) - { - // Scientific notation. - if (__found_grouping.size() && !__found_dec) - __found_grouping += static_cast(__sep_pos); - __xtrc += 'e'; - __found_sci = true; - - // Remove optional plus or minus sign, if they exist. - if (++__beg != __end) - { - __c = *__beg; - const bool __plus = __c == __lit[__num_base::_S_iplus]; - if ((__plus || __c == __lit[__num_base::_S_iminus]) - && !(__lc->_M_use_grouping - && __c == __lc->_M_thousands_sep) - && !(__c == __lc->_M_decimal_point)) - __xtrc += __plus ? '+' : '-'; - else - continue; - } - else - { - __testeof = true; - break; - } - } - else - break; - } - - if (++__beg != __end) - __c = *__beg; - else - __testeof = true; - } - - // Digit grouping is checked. If grouping and found_grouping don't - // match, then get very very upset, and set failbit. - if (__found_grouping.size()) - { - // Add the ending grouping if a decimal or 'e'/'E' wasn't found. - if (!__found_dec && !__found_sci) - __found_grouping += static_cast(__sep_pos); - - if (!std::__verify_grouping(__lc->_M_grouping, - __lc->_M_grouping_size, - __found_grouping)) - __err = ios_base::failbit; - } - - return __beg; - } - - template - template - _GLIBCXX_DEFAULT_ABI_TAG - _InIter - num_get<_CharT, _InIter>:: - _M_extract_int(_InIter __beg, _InIter __end, ios_base& __io, - ios_base::iostate& __err, _ValueT& __v) const - { - typedef char_traits<_CharT> __traits_type; - using __gnu_cxx::__add_unsigned; - typedef typename __add_unsigned<_ValueT>::__type __unsigned_type; - typedef __numpunct_cache<_CharT> __cache_type; - __use_cache<__cache_type> __uc; - const locale& __loc = __io._M_getloc(); - const __cache_type* __lc = __uc(__loc); - const _CharT* __lit = __lc->_M_atoms_in; - char_type __c = char_type(); - - // NB: Iff __basefield == 0, __base can change based on contents. - const ios_base::fmtflags __basefield = __io.flags() - & ios_base::basefield; - const bool __oct = __basefield == ios_base::oct; - int __base = __oct ? 8 : (__basefield == ios_base::hex ? 16 : 10); - - // True if __beg becomes equal to __end. - bool __testeof = __beg == __end; - - // First check for sign. - bool __negative = false; - if (!__testeof) - { - __c = *__beg; - __negative = __c == __lit[__num_base::_S_iminus]; - if ((__negative || __c == __lit[__num_base::_S_iplus]) - && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) - && !(__c == __lc->_M_decimal_point)) - { - if (++__beg != __end) - __c = *__beg; - else - __testeof = true; - } - } - - // Next, look for leading zeros and check required digits - // for base formats. - bool __found_zero = false; - int __sep_pos = 0; - while (!__testeof) - { - if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) - || __c == __lc->_M_decimal_point) - break; - else if (__c == __lit[__num_base::_S_izero] - && (!__found_zero || __base == 10)) - { - __found_zero = true; - ++__sep_pos; - if (__basefield == 0) - __base = 8; - if (__base == 8) - __sep_pos = 0; - } - else if (__found_zero - && (__c == __lit[__num_base::_S_ix] - || __c == __lit[__num_base::_S_iX])) - { - if (__basefield == 0) - __base = 16; - if (__base == 16) - { - __found_zero = false; - __sep_pos = 0; - } - else - break; - } - else - break; - - if (++__beg != __end) - { - __c = *__beg; - if (!__found_zero) - break; - } - else - __testeof = true; - } - - // At this point, base is determined. If not hex, only allow - // base digits as valid input. - const size_t __len = (__base == 16 ? __num_base::_S_iend - - __num_base::_S_izero : __base); - - // Extract. - string __found_grouping; - if (__lc->_M_use_grouping) - __found_grouping.reserve(32); - bool __testfail = false; - bool __testoverflow = false; - const __unsigned_type __max = - (__negative && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed) - ? -__gnu_cxx::__numeric_traits<_ValueT>::__min - : __gnu_cxx::__numeric_traits<_ValueT>::__max; - const __unsigned_type __smax = __max / __base; - __unsigned_type __result = 0; - int __digit = 0; - const char_type* __lit_zero = __lit + __num_base::_S_izero; - - if (!__lc->_M_allocated) - // "C" locale - while (!__testeof) - { - __digit = _M_find(__lit_zero, __len, __c); - if (__digit == -1) - break; - - if (__result > __smax) - __testoverflow = true; - else - { - __result *= __base; - __testoverflow |= __result > __max - __digit; - __result += __digit; - ++__sep_pos; - } - - if (++__beg != __end) - __c = *__beg; - else - __testeof = true; - } - else - while (!__testeof) - { - // According to 22.2.2.1.2, p8-9, first look for thousands_sep - // and decimal_point. - if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) - { - // NB: Thousands separator at the beginning of a string - // is a no-no, as is two consecutive thousands separators. - if (__sep_pos) - { - __found_grouping += static_cast(__sep_pos); - __sep_pos = 0; - } - else - { - __testfail = true; - break; - } - } - else if (__c == __lc->_M_decimal_point) - break; - else - { - const char_type* __q = - __traits_type::find(__lit_zero, __len, __c); - if (!__q) - break; - - __digit = __q - __lit_zero; - if (__digit > 15) - __digit -= 6; - if (__result > __smax) - __testoverflow = true; - else - { - __result *= __base; - __testoverflow |= __result > __max - __digit; - __result += __digit; - ++__sep_pos; - } - } - - if (++__beg != __end) - __c = *__beg; - else - __testeof = true; - } - - // Digit grouping is checked. If grouping and found_grouping don't - // match, then get very very upset, and set failbit. - if (__found_grouping.size()) - { - // Add the ending grouping. - __found_grouping += static_cast(__sep_pos); - - if (!std::__verify_grouping(__lc->_M_grouping, - __lc->_M_grouping_size, - __found_grouping)) - __err = ios_base::failbit; - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 23. Num_get overflow result. - if ((!__sep_pos && !__found_zero && !__found_grouping.size()) - || __testfail) - { - __v = 0; - __err = ios_base::failbit; - } - else if (__testoverflow) - { - if (__negative - && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed) - __v = __gnu_cxx::__numeric_traits<_ValueT>::__min; - else - __v = __gnu_cxx::__numeric_traits<_ValueT>::__max; - __err = ios_base::failbit; - } - else - __v = __negative ? -__result : __result; - - if (__testeof) - __err |= ios_base::eofbit; - return __beg; - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 17. Bad bool parsing - template - _InIter - num_get<_CharT, _InIter>:: - do_get(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, bool& __v) const - { - if (!(__io.flags() & ios_base::boolalpha)) - { - // Parse bool values as long. - // NB: We can't just call do_get(long) here, as it might - // refer to a derived class. - long __l = -1; - __beg = _M_extract_int(__beg, __end, __io, __err, __l); - if (__l == 0 || __l == 1) - __v = bool(__l); - else - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 23. Num_get overflow result. - __v = true; - __err = ios_base::failbit; - if (__beg == __end) - __err |= ios_base::eofbit; - } - } - else - { - // Parse bool values as alphanumeric. - typedef __numpunct_cache<_CharT> __cache_type; - __use_cache<__cache_type> __uc; - const locale& __loc = __io._M_getloc(); - const __cache_type* __lc = __uc(__loc); - - bool __testf = true; - bool __testt = true; - bool __donef = __lc->_M_falsename_size == 0; - bool __donet = __lc->_M_truename_size == 0; - bool __testeof = false; - size_t __n = 0; - while (!__donef || !__donet) - { - if (__beg == __end) - { - __testeof = true; - break; - } - - const char_type __c = *__beg; - - if (!__donef) - __testf = __c == __lc->_M_falsename[__n]; - - if (!__testf && __donet) - break; - - if (!__donet) - __testt = __c == __lc->_M_truename[__n]; - - if (!__testt && __donef) - break; - - if (!__testt && !__testf) - break; - - ++__n; - ++__beg; - - __donef = !__testf || __n >= __lc->_M_falsename_size; - __donet = !__testt || __n >= __lc->_M_truename_size; - } - if (__testf && __n == __lc->_M_falsename_size && __n) - { - __v = false; - if (__testt && __n == __lc->_M_truename_size) - __err = ios_base::failbit; - else - __err = __testeof ? ios_base::eofbit : ios_base::goodbit; - } - else if (__testt && __n == __lc->_M_truename_size && __n) - { - __v = true; - __err = __testeof ? ios_base::eofbit : ios_base::goodbit; - } - else - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 23. Num_get overflow result. - __v = false; - __err = ios_base::failbit; - if (__testeof) - __err |= ios_base::eofbit; - } - } - return __beg; - } - - template - _InIter - num_get<_CharT, _InIter>:: - do_get(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, float& __v) const - { - string __xtrc; - __xtrc.reserve(32); - __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); - std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); - if (__beg == __end) - __err |= ios_base::eofbit; - return __beg; - } - - template - _InIter - num_get<_CharT, _InIter>:: - do_get(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, double& __v) const - { - string __xtrc; - __xtrc.reserve(32); - __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); - std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); - if (__beg == __end) - __err |= ios_base::eofbit; - return __beg; - } - -#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ - template - _InIter - num_get<_CharT, _InIter>:: - __do_get(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, double& __v) const - { - string __xtrc; - __xtrc.reserve(32); - __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); - std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); - if (__beg == __end) - __err |= ios_base::eofbit; - return __beg; - } -#endif - - template - _InIter - num_get<_CharT, _InIter>:: - do_get(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, long double& __v) const - { - string __xtrc; - __xtrc.reserve(32); - __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); - std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); - if (__beg == __end) - __err |= ios_base::eofbit; - return __beg; - } - - template - _InIter - num_get<_CharT, _InIter>:: - do_get(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, void*& __v) const - { - // Prepare for hex formatted input. - typedef ios_base::fmtflags fmtflags; - const fmtflags __fmt = __io.flags(); - __io.flags((__fmt & ~ios_base::basefield) | ios_base::hex); - - typedef __gnu_cxx::__conditional_type<(sizeof(void*) - <= sizeof(unsigned long)), - unsigned long, unsigned long long>::__type _UIntPtrType; - - _UIntPtrType __ul; - __beg = _M_extract_int(__beg, __end, __io, __err, __ul); - - // Reset from hex formatted input. - __io.flags(__fmt); - - __v = reinterpret_cast(__ul); - return __beg; - } - - // For use by integer and floating-point types after they have been - // converted into a char_type string. - template - void - num_put<_CharT, _OutIter>:: - _M_pad(_CharT __fill, streamsize __w, ios_base& __io, - _CharT* __new, const _CharT* __cs, int& __len) const - { - // [22.2.2.2.2] Stage 3. - // If necessary, pad. - __pad<_CharT, char_traits<_CharT> >::_S_pad(__io, __fill, __new, - __cs, __w, __len); - __len = static_cast(__w); - } - -_GLIBCXX_END_NAMESPACE_LDBL - - template - int - __int_to_char(_CharT* __bufend, _ValueT __v, const _CharT* __lit, - ios_base::fmtflags __flags, bool __dec) - { - _CharT* __buf = __bufend; - if (__builtin_expect(__dec, true)) - { - // Decimal. - do - { - *--__buf = __lit[(__v % 10) + __num_base::_S_odigits]; - __v /= 10; - } - while (__v != 0); - } - else if ((__flags & ios_base::basefield) == ios_base::oct) - { - // Octal. - do - { - *--__buf = __lit[(__v & 0x7) + __num_base::_S_odigits]; - __v >>= 3; - } - while (__v != 0); - } - else - { - // Hex. - const bool __uppercase = __flags & ios_base::uppercase; - const int __case_offset = __uppercase ? __num_base::_S_oudigits - : __num_base::_S_odigits; - do - { - *--__buf = __lit[(__v & 0xf) + __case_offset]; - __v >>= 4; - } - while (__v != 0); - } - return __bufend - __buf; - } - -_GLIBCXX_BEGIN_NAMESPACE_LDBL - - template - void - num_put<_CharT, _OutIter>:: - _M_group_int(const char* __grouping, size_t __grouping_size, _CharT __sep, - ios_base&, _CharT* __new, _CharT* __cs, int& __len) const - { - _CharT* __p = std::__add_grouping(__new, __sep, __grouping, - __grouping_size, __cs, __cs + __len); - __len = __p - __new; - } - - template - template - _OutIter - num_put<_CharT, _OutIter>:: - _M_insert_int(_OutIter __s, ios_base& __io, _CharT __fill, - _ValueT __v) const - { - using __gnu_cxx::__add_unsigned; - typedef typename __add_unsigned<_ValueT>::__type __unsigned_type; - typedef __numpunct_cache<_CharT> __cache_type; - __use_cache<__cache_type> __uc; - const locale& __loc = __io._M_getloc(); - const __cache_type* __lc = __uc(__loc); - const _CharT* __lit = __lc->_M_atoms_out; - const ios_base::fmtflags __flags = __io.flags(); - - // Long enough to hold hex, dec, and octal representations. - const int __ilen = 5 * sizeof(_ValueT); - _CharT* __cs = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) - * __ilen)); - - // [22.2.2.2.2] Stage 1, numeric conversion to character. - // Result is returned right-justified in the buffer. - const ios_base::fmtflags __basefield = __flags & ios_base::basefield; - const bool __dec = (__basefield != ios_base::oct - && __basefield != ios_base::hex); - const __unsigned_type __u = ((__v > 0 || !__dec) - ? __unsigned_type(__v) - : -__unsigned_type(__v)); - int __len = __int_to_char(__cs + __ilen, __u, __lit, __flags, __dec); - __cs += __ilen - __len; - - // Add grouping, if necessary. - if (__lc->_M_use_grouping) - { - // Grouping can add (almost) as many separators as the number - // of digits + space is reserved for numeric base or sign. - _CharT* __cs2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) - * (__len + 1) - * 2)); - _M_group_int(__lc->_M_grouping, __lc->_M_grouping_size, - __lc->_M_thousands_sep, __io, __cs2 + 2, __cs, __len); - __cs = __cs2 + 2; - } - - // Complete Stage 1, prepend numeric base or sign. - if (__builtin_expect(__dec, true)) - { - // Decimal. - if (__v >= 0) - { - if (bool(__flags & ios_base::showpos) - && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed) - *--__cs = __lit[__num_base::_S_oplus], ++__len; - } - else - *--__cs = __lit[__num_base::_S_ominus], ++__len; - } - else if (bool(__flags & ios_base::showbase) && __v) - { - if (__basefield == ios_base::oct) - *--__cs = __lit[__num_base::_S_odigits], ++__len; - else - { - // 'x' or 'X' - const bool __uppercase = __flags & ios_base::uppercase; - *--__cs = __lit[__num_base::_S_ox + __uppercase]; - // '0' - *--__cs = __lit[__num_base::_S_odigits]; - __len += 2; - } - } - - // Pad. - const streamsize __w = __io.width(); - if (__w > static_cast(__len)) - { - _CharT* __cs3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) - * __w)); - _M_pad(__fill, __w, __io, __cs3, __cs, __len); - __cs = __cs3; - } - __io.width(0); - - // [22.2.2.2.2] Stage 4. - // Write resulting, fully-formatted string to output iterator. - return std::__write(__s, __cs, __len); - } - - template - void - num_put<_CharT, _OutIter>:: - _M_group_float(const char* __grouping, size_t __grouping_size, - _CharT __sep, const _CharT* __p, _CharT* __new, - _CharT* __cs, int& __len) const - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 282. What types does numpunct grouping refer to? - // Add grouping, if necessary. - const int __declen = __p ? __p - __cs : __len; - _CharT* __p2 = std::__add_grouping(__new, __sep, __grouping, - __grouping_size, - __cs, __cs + __declen); - - // Tack on decimal part. - int __newlen = __p2 - __new; - if (__p) - { - char_traits<_CharT>::copy(__p2, __p, __len - __declen); - __newlen += __len - __declen; - } - __len = __newlen; - } - - // The following code uses vsnprintf (or vsprintf(), when - // _GLIBCXX_USE_C99 is not defined) to convert floating point values - // for insertion into a stream. An optimization would be to replace - // them with code that works directly on a wide buffer and then use - // __pad to do the padding. It would be good to replace them anyway - // to gain back the efficiency that C++ provides by knowing up front - // the type of the values to insert. Also, sprintf is dangerous - // since may lead to accidental buffer overruns. This - // implementation follows the C++ standard fairly directly as - // outlined in 22.2.2.2 [lib.locale.num.put] - template - template - _OutIter - num_put<_CharT, _OutIter>:: - _M_insert_float(_OutIter __s, ios_base& __io, _CharT __fill, char __mod, - _ValueT __v) const - { - typedef __numpunct_cache<_CharT> __cache_type; - __use_cache<__cache_type> __uc; - const locale& __loc = __io._M_getloc(); - const __cache_type* __lc = __uc(__loc); - - // Use default precision if out of range. - const streamsize __prec = __io.precision() < 0 ? 6 : __io.precision(); - - const int __max_digits = - __gnu_cxx::__numeric_traits<_ValueT>::__digits10; - - // [22.2.2.2.2] Stage 1, numeric conversion to character. - int __len; - // Long enough for the max format spec. - char __fbuf[16]; - __num_base::_S_format_float(__io, __fbuf, __mod); - -#ifdef _GLIBCXX_USE_C99 - // Precision is always used except for hexfloat format. - const bool __use_prec = - (__io.flags() & ios_base::floatfield) != ios_base::floatfield; - - // First try a buffer perhaps big enough (most probably sufficient - // for non-ios_base::fixed outputs) - int __cs_size = __max_digits * 3; - char* __cs = static_cast(__builtin_alloca(__cs_size)); - if (__use_prec) - __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, - __fbuf, __prec, __v); - else - __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, - __fbuf, __v); - - // If the buffer was not large enough, try again with the correct size. - if (__len >= __cs_size) - { - __cs_size = __len + 1; - __cs = static_cast(__builtin_alloca(__cs_size)); - if (__use_prec) - __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, - __fbuf, __prec, __v); - else - __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, - __fbuf, __v); - } -#else - // Consider the possibility of long ios_base::fixed outputs - const bool __fixed = __io.flags() & ios_base::fixed; - const int __max_exp = - __gnu_cxx::__numeric_traits<_ValueT>::__max_exponent10; - - // The size of the output string is computed as follows. - // ios_base::fixed outputs may need up to __max_exp + 1 chars - // for the integer part + __prec chars for the fractional part - // + 3 chars for sign, decimal point, '\0'. On the other hand, - // for non-fixed outputs __max_digits * 2 + __prec chars are - // largely sufficient. - const int __cs_size = __fixed ? __max_exp + __prec + 4 - : __max_digits * 2 + __prec; - char* __cs = static_cast(__builtin_alloca(__cs_size)); - __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf, - __prec, __v); -#endif - - // [22.2.2.2.2] Stage 2, convert to char_type, using correct - // numpunct.decimal_point() values for '.' and adding grouping. - const ctype<_CharT>& __ctype = use_facet >(__loc); - - _CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) - * __len)); - __ctype.widen(__cs, __cs + __len, __ws); - - // Replace decimal point. - _CharT* __wp = 0; - const char* __p = char_traits::find(__cs, __len, '.'); - if (__p) - { - __wp = __ws + (__p - __cs); - *__wp = __lc->_M_decimal_point; - } - - // Add grouping, if necessary. - // N.B. Make sure to not group things like 2e20, i.e., no decimal - // point, scientific notation. - if (__lc->_M_use_grouping - && (__wp || __len < 3 || (__cs[1] <= '9' && __cs[2] <= '9' - && __cs[1] >= '0' && __cs[2] >= '0'))) - { - // Grouping can add (almost) as many separators as the - // number of digits, but no more. - _CharT* __ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) - * __len * 2)); - - streamsize __off = 0; - if (__cs[0] == '-' || __cs[0] == '+') - { - __off = 1; - __ws2[0] = __ws[0]; - __len -= 1; - } - - _M_group_float(__lc->_M_grouping, __lc->_M_grouping_size, - __lc->_M_thousands_sep, __wp, __ws2 + __off, - __ws + __off, __len); - __len += __off; - - __ws = __ws2; - } - - // Pad. - const streamsize __w = __io.width(); - if (__w > static_cast(__len)) - { - _CharT* __ws3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) - * __w)); - _M_pad(__fill, __w, __io, __ws3, __ws, __len); - __ws = __ws3; - } - __io.width(0); - - // [22.2.2.2.2] Stage 4. - // Write resulting, fully-formatted string to output iterator. - return std::__write(__s, __ws, __len); - } - - template - _OutIter - num_put<_CharT, _OutIter>:: - do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const - { - const ios_base::fmtflags __flags = __io.flags(); - if ((__flags & ios_base::boolalpha) == 0) - { - const long __l = __v; - __s = _M_insert_int(__s, __io, __fill, __l); - } - else - { - typedef __numpunct_cache<_CharT> __cache_type; - __use_cache<__cache_type> __uc; - const locale& __loc = __io._M_getloc(); - const __cache_type* __lc = __uc(__loc); - - const _CharT* __name = __v ? __lc->_M_truename - : __lc->_M_falsename; - int __len = __v ? __lc->_M_truename_size - : __lc->_M_falsename_size; - - const streamsize __w = __io.width(); - if (__w > static_cast(__len)) - { - const streamsize __plen = __w - __len; - _CharT* __ps - = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) - * __plen)); - - char_traits<_CharT>::assign(__ps, __plen, __fill); - __io.width(0); - - if ((__flags & ios_base::adjustfield) == ios_base::left) - { - __s = std::__write(__s, __name, __len); - __s = std::__write(__s, __ps, __plen); - } - else - { - __s = std::__write(__s, __ps, __plen); - __s = std::__write(__s, __name, __len); - } - return __s; - } - __io.width(0); - __s = std::__write(__s, __name, __len); - } - return __s; - } - - template - _OutIter - num_put<_CharT, _OutIter>:: - do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const - { return _M_insert_float(__s, __io, __fill, char(), __v); } - -#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ - template - _OutIter - num_put<_CharT, _OutIter>:: - __do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const - { return _M_insert_float(__s, __io, __fill, char(), __v); } -#endif - - template - _OutIter - num_put<_CharT, _OutIter>:: - do_put(iter_type __s, ios_base& __io, char_type __fill, - long double __v) const - { return _M_insert_float(__s, __io, __fill, 'L', __v); } - - template - _OutIter - num_put<_CharT, _OutIter>:: - do_put(iter_type __s, ios_base& __io, char_type __fill, - const void* __v) const - { - const ios_base::fmtflags __flags = __io.flags(); - const ios_base::fmtflags __fmt = ~(ios_base::basefield - | ios_base::uppercase); - __io.flags((__flags & __fmt) | (ios_base::hex | ios_base::showbase)); - - typedef __gnu_cxx::__conditional_type<(sizeof(const void*) - <= sizeof(unsigned long)), - unsigned long, unsigned long long>::__type _UIntPtrType; - - __s = _M_insert_int(__s, __io, __fill, - reinterpret_cast<_UIntPtrType>(__v)); - __io.flags(__flags); - return __s; - } - -_GLIBCXX_END_NAMESPACE_LDBL - - // Construct correctly padded string, as per 22.2.2.2.2 - // Assumes - // __newlen > __oldlen - // __news is allocated for __newlen size - - // NB: Of the two parameters, _CharT can be deduced from the - // function arguments. The other (_Traits) has to be explicitly specified. - template - void - __pad<_CharT, _Traits>::_S_pad(ios_base& __io, _CharT __fill, - _CharT* __news, const _CharT* __olds, - streamsize __newlen, streamsize __oldlen) - { - const size_t __plen = static_cast(__newlen - __oldlen); - const ios_base::fmtflags __adjust = __io.flags() & ios_base::adjustfield; - - // Padding last. - if (__adjust == ios_base::left) - { - _Traits::copy(__news, __olds, __oldlen); - _Traits::assign(__news + __oldlen, __plen, __fill); - return; - } - - size_t __mod = 0; - if (__adjust == ios_base::internal) - { - // Pad after the sign, if there is one. - // Pad after 0[xX], if there is one. - // Who came up with these rules, anyway? Jeeze. - const locale& __loc = __io._M_getloc(); - const ctype<_CharT>& __ctype = use_facet >(__loc); - - if (__ctype.widen('-') == __olds[0] - || __ctype.widen('+') == __olds[0]) - { - __news[0] = __olds[0]; - __mod = 1; - ++__news; - } - else if (__ctype.widen('0') == __olds[0] - && __oldlen > 1 - && (__ctype.widen('x') == __olds[1] - || __ctype.widen('X') == __olds[1])) - { - __news[0] = __olds[0]; - __news[1] = __olds[1]; - __mod = 2; - __news += 2; - } - // else Padding first. - } - _Traits::assign(__news, __plen, __fill); - _Traits::copy(__news + __plen, __olds + __mod, __oldlen - __mod); - } - - template - _CharT* - __add_grouping(_CharT* __s, _CharT __sep, - const char* __gbeg, size_t __gsize, - const _CharT* __first, const _CharT* __last) - { - size_t __idx = 0; - size_t __ctr = 0; - - while (__last - __first > __gbeg[__idx] - && static_cast(__gbeg[__idx]) > 0 - && __gbeg[__idx] != __gnu_cxx::__numeric_traits::__max) - { - __last -= __gbeg[__idx]; - __idx < __gsize - 1 ? ++__idx : ++__ctr; - } - - while (__first != __last) - *__s++ = *__first++; - - while (__ctr--) - { - *__s++ = __sep; - for (char __i = __gbeg[__idx]; __i > 0; --__i) - *__s++ = *__first++; - } - - while (__idx--) - { - *__s++ = __sep; - for (char __i = __gbeg[__idx]; __i > 0; --__i) - *__s++ = *__first++; - } - - return __s; - } - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct; - extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct_byname; - extern template class _GLIBCXX_NAMESPACE_LDBL num_get; - extern template class _GLIBCXX_NAMESPACE_LDBL num_put; - extern template class ctype_byname; - - extern template - const ctype& - use_facet >(const locale&); - - extern template - const numpunct& - use_facet >(const locale&); - - extern template - const num_put& - use_facet >(const locale&); - - extern template - const num_get& - use_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct; - extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct_byname; - extern template class _GLIBCXX_NAMESPACE_LDBL num_get; - extern template class _GLIBCXX_NAMESPACE_LDBL num_put; - extern template class ctype_byname; - - extern template - const ctype& - use_facet >(const locale&); - - extern template - const numpunct& - use_facet >(const locale&); - - extern template - const num_put& - use_facet >(const locale&); - - extern template - const num_get& - use_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); -#endif -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/bits/locale_facets_nonio.h b/openflow/usr/include/c++/5/bits/locale_facets_nonio.h deleted file mode 100644 index 527296b..0000000 --- a/openflow/usr/include/c++/5/bits/locale_facets_nonio.h +++ /dev/null @@ -1,2015 +0,0 @@ -// Locale support -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/locale_facets_nonio.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -// -// ISO C++ 14882: 22.1 Locales -// - -#ifndef _LOCALE_FACETS_NONIO_H -#define _LOCALE_FACETS_NONIO_H 1 - -#pragma GCC system_header - -#include // For struct tm - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @brief Time format ordering data. - * @ingroup locales - * - * This class provides an enum representing different orderings of - * time: day, month, and year. - */ - class time_base - { - public: - enum dateorder { no_order, dmy, mdy, ymd, ydm }; - }; - - template - struct __timepunct_cache : public locale::facet - { - // List of all known timezones, with GMT first. - static const _CharT* _S_timezones[14]; - - const _CharT* _M_date_format; - const _CharT* _M_date_era_format; - const _CharT* _M_time_format; - const _CharT* _M_time_era_format; - const _CharT* _M_date_time_format; - const _CharT* _M_date_time_era_format; - const _CharT* _M_am; - const _CharT* _M_pm; - const _CharT* _M_am_pm_format; - - // Day names, starting with "C"'s Sunday. - const _CharT* _M_day1; - const _CharT* _M_day2; - const _CharT* _M_day3; - const _CharT* _M_day4; - const _CharT* _M_day5; - const _CharT* _M_day6; - const _CharT* _M_day7; - - // Abbreviated day names, starting with "C"'s Sun. - const _CharT* _M_aday1; - const _CharT* _M_aday2; - const _CharT* _M_aday3; - const _CharT* _M_aday4; - const _CharT* _M_aday5; - const _CharT* _M_aday6; - const _CharT* _M_aday7; - - // Month names, starting with "C"'s January. - const _CharT* _M_month01; - const _CharT* _M_month02; - const _CharT* _M_month03; - const _CharT* _M_month04; - const _CharT* _M_month05; - const _CharT* _M_month06; - const _CharT* _M_month07; - const _CharT* _M_month08; - const _CharT* _M_month09; - const _CharT* _M_month10; - const _CharT* _M_month11; - const _CharT* _M_month12; - - // Abbreviated month names, starting with "C"'s Jan. - const _CharT* _M_amonth01; - const _CharT* _M_amonth02; - const _CharT* _M_amonth03; - const _CharT* _M_amonth04; - const _CharT* _M_amonth05; - const _CharT* _M_amonth06; - const _CharT* _M_amonth07; - const _CharT* _M_amonth08; - const _CharT* _M_amonth09; - const _CharT* _M_amonth10; - const _CharT* _M_amonth11; - const _CharT* _M_amonth12; - - bool _M_allocated; - - __timepunct_cache(size_t __refs = 0) : facet(__refs), - _M_date_format(0), _M_date_era_format(0), _M_time_format(0), - _M_time_era_format(0), _M_date_time_format(0), - _M_date_time_era_format(0), _M_am(0), _M_pm(0), - _M_am_pm_format(0), _M_day1(0), _M_day2(0), _M_day3(0), - _M_day4(0), _M_day5(0), _M_day6(0), _M_day7(0), - _M_aday1(0), _M_aday2(0), _M_aday3(0), _M_aday4(0), - _M_aday5(0), _M_aday6(0), _M_aday7(0), _M_month01(0), - _M_month02(0), _M_month03(0), _M_month04(0), _M_month05(0), - _M_month06(0), _M_month07(0), _M_month08(0), _M_month09(0), - _M_month10(0), _M_month11(0), _M_month12(0), _M_amonth01(0), - _M_amonth02(0), _M_amonth03(0), _M_amonth04(0), - _M_amonth05(0), _M_amonth06(0), _M_amonth07(0), - _M_amonth08(0), _M_amonth09(0), _M_amonth10(0), - _M_amonth11(0), _M_amonth12(0), _M_allocated(false) - { } - - ~__timepunct_cache(); - - private: - __timepunct_cache& - operator=(const __timepunct_cache&); - - explicit - __timepunct_cache(const __timepunct_cache&); - }; - - template - __timepunct_cache<_CharT>::~__timepunct_cache() - { - if (_M_allocated) - { - // Unused. - } - } - - // Specializations. - template<> - const char* - __timepunct_cache::_S_timezones[14]; - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - const wchar_t* - __timepunct_cache::_S_timezones[14]; -#endif - - // Generic. - template - const _CharT* __timepunct_cache<_CharT>::_S_timezones[14]; - - template - class __timepunct : public locale::facet - { - public: - // Types: - typedef _CharT __char_type; - typedef __timepunct_cache<_CharT> __cache_type; - - protected: - __cache_type* _M_data; - __c_locale _M_c_locale_timepunct; - const char* _M_name_timepunct; - - public: - /// Numpunct facet id. - static locale::id id; - - explicit - __timepunct(size_t __refs = 0); - - explicit - __timepunct(__cache_type* __cache, size_t __refs = 0); - - /** - * @brief Internal constructor. Not for general use. - * - * This is a constructor for use by the library itself to set up new - * locales. - * - * @param __cloc The C locale. - * @param __s The name of a locale. - * @param refs Passed to the base facet class. - */ - explicit - __timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0); - - // FIXME: for error checking purposes _M_put should return the return - // value of strftime/wcsftime. - void - _M_put(_CharT* __s, size_t __maxlen, const _CharT* __format, - const tm* __tm) const throw (); - - void - _M_date_formats(const _CharT** __date) const - { - // Always have default first. - __date[0] = _M_data->_M_date_format; - __date[1] = _M_data->_M_date_era_format; - } - - void - _M_time_formats(const _CharT** __time) const - { - // Always have default first. - __time[0] = _M_data->_M_time_format; - __time[1] = _M_data->_M_time_era_format; - } - - void - _M_date_time_formats(const _CharT** __dt) const - { - // Always have default first. - __dt[0] = _M_data->_M_date_time_format; - __dt[1] = _M_data->_M_date_time_era_format; - } - - void - _M_am_pm_format(const _CharT* __ampm) const - { __ampm = _M_data->_M_am_pm_format; } - - void - _M_am_pm(const _CharT** __ampm) const - { - __ampm[0] = _M_data->_M_am; - __ampm[1] = _M_data->_M_pm; - } - - void - _M_days(const _CharT** __days) const - { - __days[0] = _M_data->_M_day1; - __days[1] = _M_data->_M_day2; - __days[2] = _M_data->_M_day3; - __days[3] = _M_data->_M_day4; - __days[4] = _M_data->_M_day5; - __days[5] = _M_data->_M_day6; - __days[6] = _M_data->_M_day7; - } - - void - _M_days_abbreviated(const _CharT** __days) const - { - __days[0] = _M_data->_M_aday1; - __days[1] = _M_data->_M_aday2; - __days[2] = _M_data->_M_aday3; - __days[3] = _M_data->_M_aday4; - __days[4] = _M_data->_M_aday5; - __days[5] = _M_data->_M_aday6; - __days[6] = _M_data->_M_aday7; - } - - void - _M_months(const _CharT** __months) const - { - __months[0] = _M_data->_M_month01; - __months[1] = _M_data->_M_month02; - __months[2] = _M_data->_M_month03; - __months[3] = _M_data->_M_month04; - __months[4] = _M_data->_M_month05; - __months[5] = _M_data->_M_month06; - __months[6] = _M_data->_M_month07; - __months[7] = _M_data->_M_month08; - __months[8] = _M_data->_M_month09; - __months[9] = _M_data->_M_month10; - __months[10] = _M_data->_M_month11; - __months[11] = _M_data->_M_month12; - } - - void - _M_months_abbreviated(const _CharT** __months) const - { - __months[0] = _M_data->_M_amonth01; - __months[1] = _M_data->_M_amonth02; - __months[2] = _M_data->_M_amonth03; - __months[3] = _M_data->_M_amonth04; - __months[4] = _M_data->_M_amonth05; - __months[5] = _M_data->_M_amonth06; - __months[6] = _M_data->_M_amonth07; - __months[7] = _M_data->_M_amonth08; - __months[8] = _M_data->_M_amonth09; - __months[9] = _M_data->_M_amonth10; - __months[10] = _M_data->_M_amonth11; - __months[11] = _M_data->_M_amonth12; - } - - protected: - virtual - ~__timepunct(); - - // For use at construction time only. - void - _M_initialize_timepunct(__c_locale __cloc = 0); - }; - - template - locale::id __timepunct<_CharT>::id; - - // Specializations. - template<> - void - __timepunct::_M_initialize_timepunct(__c_locale __cloc); - - template<> - void - __timepunct::_M_put(char*, size_t, const char*, const tm*) const throw (); - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - void - __timepunct::_M_initialize_timepunct(__c_locale __cloc); - - template<> - void - __timepunct::_M_put(wchar_t*, size_t, const wchar_t*, - const tm*) const throw (); -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - - // Include host and configuration specific timepunct functions. - #include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - - /** - * @brief Primary class template time_get. - * @ingroup locales - * - * This facet encapsulates the code to parse and return a date or - * time from a string. It is used by the istream numeric - * extraction operators. - * - * The time_get template uses protected virtual functions to provide the - * actual results. The public accessors forward the call to the virtual - * functions. These virtual functions are hooks for developers to - * implement the behavior they require from the time_get facet. - */ - template - class time_get : public locale::facet, public time_base - { - public: - // Types: - //@{ - /// Public typedefs - typedef _CharT char_type; - typedef _InIter iter_type; - //@} - - /// Numpunct facet id. - static locale::id id; - - /** - * @brief Constructor performs initialization. - * - * This is the constructor provided by the standard. - * - * @param __refs Passed to the base facet class. - */ - explicit - time_get(size_t __refs = 0) - : facet (__refs) { } - - /** - * @brief Return preferred order of month, day, and year. - * - * This function returns an enum from time_base::dateorder giving the - * preferred ordering if the format @a x given to time_put::put() only - * uses month, day, and year. If the format @a x for the associated - * locale uses other fields, this function returns - * time_base::dateorder::noorder. - * - * NOTE: The library always returns noorder at the moment. - * - * @return A member of time_base::dateorder. - */ - dateorder - date_order() const - { return this->do_date_order(); } - - /** - * @brief Parse input time string. - * - * This function parses a time according to the format @a X and puts the - * results into a user-supplied struct tm. The result is returned by - * calling time_get::do_get_time(). - * - * If there is a valid time string according to format @a X, @a tm will - * be filled in accordingly and the returned iterator will point to the - * first character beyond the time string. If an error occurs before - * the end, err |= ios_base::failbit. If parsing reads all the - * characters, err |= ios_base::eofbit. - * - * @param __beg Start of string to parse. - * @param __end End of string to parse. - * @param __io Source of the locale. - * @param __err Error flags to set. - * @param __tm Pointer to struct tm to fill in. - * @return Iterator to first char beyond time string. - */ - iter_type - get_time(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm) const - { return this->do_get_time(__beg, __end, __io, __err, __tm); } - - /** - * @brief Parse input date string. - * - * This function parses a date according to the format @a x and puts the - * results into a user-supplied struct tm. The result is returned by - * calling time_get::do_get_date(). - * - * If there is a valid date string according to format @a x, @a tm will - * be filled in accordingly and the returned iterator will point to the - * first character beyond the date string. If an error occurs before - * the end, err |= ios_base::failbit. If parsing reads all the - * characters, err |= ios_base::eofbit. - * - * @param __beg Start of string to parse. - * @param __end End of string to parse. - * @param __io Source of the locale. - * @param __err Error flags to set. - * @param __tm Pointer to struct tm to fill in. - * @return Iterator to first char beyond date string. - */ - iter_type - get_date(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm) const - { return this->do_get_date(__beg, __end, __io, __err, __tm); } - - /** - * @brief Parse input weekday string. - * - * This function parses a weekday name and puts the results into a - * user-supplied struct tm. The result is returned by calling - * time_get::do_get_weekday(). - * - * Parsing starts by parsing an abbreviated weekday name. If a valid - * abbreviation is followed by a character that would lead to the full - * weekday name, parsing continues until the full name is found or an - * error occurs. Otherwise parsing finishes at the end of the - * abbreviated name. - * - * If an error occurs before the end, err |= ios_base::failbit. If - * parsing reads all the characters, err |= ios_base::eofbit. - * - * @param __beg Start of string to parse. - * @param __end End of string to parse. - * @param __io Source of the locale. - * @param __err Error flags to set. - * @param __tm Pointer to struct tm to fill in. - * @return Iterator to first char beyond weekday name. - */ - iter_type - get_weekday(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm) const - { return this->do_get_weekday(__beg, __end, __io, __err, __tm); } - - /** - * @brief Parse input month string. - * - * This function parses a month name and puts the results into a - * user-supplied struct tm. The result is returned by calling - * time_get::do_get_monthname(). - * - * Parsing starts by parsing an abbreviated month name. If a valid - * abbreviation is followed by a character that would lead to the full - * month name, parsing continues until the full name is found or an - * error occurs. Otherwise parsing finishes at the end of the - * abbreviated name. - * - * If an error occurs before the end, err |= ios_base::failbit. If - * parsing reads all the characters, err |= - * ios_base::eofbit. - * - * @param __beg Start of string to parse. - * @param __end End of string to parse. - * @param __io Source of the locale. - * @param __err Error flags to set. - * @param __tm Pointer to struct tm to fill in. - * @return Iterator to first char beyond month name. - */ - iter_type - get_monthname(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm) const - { return this->do_get_monthname(__beg, __end, __io, __err, __tm); } - - /** - * @brief Parse input year string. - * - * This function reads up to 4 characters to parse a year string and - * puts the results into a user-supplied struct tm. The result is - * returned by calling time_get::do_get_year(). - * - * 4 consecutive digits are interpreted as a full year. If there are - * exactly 2 consecutive digits, the library interprets this as the - * number of years since 1900. - * - * If an error occurs before the end, err |= ios_base::failbit. If - * parsing reads all the characters, err |= ios_base::eofbit. - * - * @param __beg Start of string to parse. - * @param __end End of string to parse. - * @param __io Source of the locale. - * @param __err Error flags to set. - * @param __tm Pointer to struct tm to fill in. - * @return Iterator to first char beyond year. - */ - iter_type - get_year(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm) const - { return this->do_get_year(__beg, __end, __io, __err, __tm); } - -#if __cplusplus >= 201103L - /** - * @brief Parse input string according to format. - * - * This function calls time_get::do_get with the provided - * parameters. @see do_get() and get(). - * - * @param __s Start of string to parse. - * @param __end End of string to parse. - * @param __io Source of the locale. - * @param __err Error flags to set. - * @param __tm Pointer to struct tm to fill in. - * @param __format Format specifier. - * @param __modifier Format modifier. - * @return Iterator to first char not parsed. - */ - inline - iter_type get(iter_type __s, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm, char __format, - char __modifier = 0) const - { - return this->do_get(__s, __end, __io, __err, __tm, __format, - __modifier); - } - - /** - * @brief Parse input string according to format. - * - * This function parses the input string according to a - * provided format string. It does the inverse of - * time_put::put. The format string follows the format - * specified for strftime(3)/strptime(3). The actual parsing - * is done by time_get::do_get. - * - * @param __s Start of string to parse. - * @param __end End of string to parse. - * @param __io Source of the locale. - * @param __err Error flags to set. - * @param __tm Pointer to struct tm to fill in. - * @param __fmt Start of the format string. - * @param __fmtend End of the format string. - * @return Iterator to first char not parsed. - */ - iter_type get(iter_type __s, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm, const char_type* __fmt, - const char_type* __fmtend) const; -#endif // __cplusplus >= 201103L - - protected: - /// Destructor. - virtual - ~time_get() { } - - /** - * @brief Return preferred order of month, day, and year. - * - * This function returns an enum from time_base::dateorder giving the - * preferred ordering if the format @a x given to time_put::put() only - * uses month, day, and year. This function is a hook for derived - * classes to change the value returned. - * - * @return A member of time_base::dateorder. - */ - virtual dateorder - do_date_order() const; - - /** - * @brief Parse input time string. - * - * This function parses a time according to the format @a x and puts the - * results into a user-supplied struct tm. This function is a hook for - * derived classes to change the value returned. @see get_time() for - * details. - * - * @param __beg Start of string to parse. - * @param __end End of string to parse. - * @param __io Source of the locale. - * @param __err Error flags to set. - * @param __tm Pointer to struct tm to fill in. - * @return Iterator to first char beyond time string. - */ - virtual iter_type - do_get_time(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm) const; - - /** - * @brief Parse input date string. - * - * This function parses a date according to the format @a X and puts the - * results into a user-supplied struct tm. This function is a hook for - * derived classes to change the value returned. @see get_date() for - * details. - * - * @param __beg Start of string to parse. - * @param __end End of string to parse. - * @param __io Source of the locale. - * @param __err Error flags to set. - * @param __tm Pointer to struct tm to fill in. - * @return Iterator to first char beyond date string. - */ - virtual iter_type - do_get_date(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm) const; - - /** - * @brief Parse input weekday string. - * - * This function parses a weekday name and puts the results into a - * user-supplied struct tm. This function is a hook for derived - * classes to change the value returned. @see get_weekday() for - * details. - * - * @param __beg Start of string to parse. - * @param __end End of string to parse. - * @param __io Source of the locale. - * @param __err Error flags to set. - * @param __tm Pointer to struct tm to fill in. - * @return Iterator to first char beyond weekday name. - */ - virtual iter_type - do_get_weekday(iter_type __beg, iter_type __end, ios_base&, - ios_base::iostate& __err, tm* __tm) const; - - /** - * @brief Parse input month string. - * - * This function parses a month name and puts the results into a - * user-supplied struct tm. This function is a hook for derived - * classes to change the value returned. @see get_monthname() for - * details. - * - * @param __beg Start of string to parse. - * @param __end End of string to parse. - * @param __io Source of the locale. - * @param __err Error flags to set. - * @param __tm Pointer to struct tm to fill in. - * @return Iterator to first char beyond month name. - */ - virtual iter_type - do_get_monthname(iter_type __beg, iter_type __end, ios_base&, - ios_base::iostate& __err, tm* __tm) const; - - /** - * @brief Parse input year string. - * - * This function reads up to 4 characters to parse a year string and - * puts the results into a user-supplied struct tm. This function is a - * hook for derived classes to change the value returned. @see - * get_year() for details. - * - * @param __beg Start of string to parse. - * @param __end End of string to parse. - * @param __io Source of the locale. - * @param __err Error flags to set. - * @param __tm Pointer to struct tm to fill in. - * @return Iterator to first char beyond year. - */ - virtual iter_type - do_get_year(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm) const; - -#if __cplusplus >= 201103L - /** - * @brief Parse input string according to format. - * - * This function parses the string according to the provided - * format and optional modifier. This function is a hook for - * derived classes to change the value returned. @see get() - * for more details. - * - * @param __s Start of string to parse. - * @param __end End of string to parse. - * @param __f Source of the locale. - * @param __err Error flags to set. - * @param __tm Pointer to struct tm to fill in. - * @param __format Format specifier. - * @param __modifier Format modifier. - * @return Iterator to first char not parsed. - */ -#if _GLIBCXX_USE_CXX11_ABI - virtual -#endif - iter_type - do_get(iter_type __s, iter_type __end, ios_base& __f, - ios_base::iostate& __err, tm* __tm, - char __format, char __modifier) const; -#endif // __cplusplus >= 201103L - - // Extract numeric component of length __len. - iter_type - _M_extract_num(iter_type __beg, iter_type __end, int& __member, - int __min, int __max, size_t __len, - ios_base& __io, ios_base::iostate& __err) const; - - // Extract any unique array of string literals in a const _CharT* array. - iter_type - _M_extract_name(iter_type __beg, iter_type __end, int& __member, - const _CharT** __names, size_t __indexlen, - ios_base& __io, ios_base::iostate& __err) const; - - // Extract day or month name in a const _CharT* array. - iter_type - _M_extract_wday_or_month(iter_type __beg, iter_type __end, int& __member, - const _CharT** __names, size_t __indexlen, - ios_base& __io, ios_base::iostate& __err) const; - - // Extract on a component-by-component basis, via __format argument. - iter_type - _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm, - const _CharT* __format) const; - }; - - template - locale::id time_get<_CharT, _InIter>::id; - - /// class time_get_byname [22.2.5.2]. - template - class time_get_byname : public time_get<_CharT, _InIter> - { - public: - // Types: - typedef _CharT char_type; - typedef _InIter iter_type; - - explicit - time_get_byname(const char*, size_t __refs = 0) - : time_get<_CharT, _InIter>(__refs) { } - -#if __cplusplus >= 201103L - explicit - time_get_byname(const string& __s, size_t __refs = 0) - : time_get_byname(__s.c_str(), __refs) { } -#endif - - protected: - virtual - ~time_get_byname() { } - }; - -_GLIBCXX_END_NAMESPACE_CXX11 - - /** - * @brief Primary class template time_put. - * @ingroup locales - * - * This facet encapsulates the code to format and output dates and times - * according to formats used by strftime(). - * - * The time_put template uses protected virtual functions to provide the - * actual results. The public accessors forward the call to the virtual - * functions. These virtual functions are hooks for developers to - * implement the behavior they require from the time_put facet. - */ - template - class time_put : public locale::facet - { - public: - // Types: - //@{ - /// Public typedefs - typedef _CharT char_type; - typedef _OutIter iter_type; - //@} - - /// Numpunct facet id. - static locale::id id; - - /** - * @brief Constructor performs initialization. - * - * This is the constructor provided by the standard. - * - * @param __refs Passed to the base facet class. - */ - explicit - time_put(size_t __refs = 0) - : facet(__refs) { } - - /** - * @brief Format and output a time or date. - * - * This function formats the data in struct tm according to the - * provided format string. The format string is interpreted as by - * strftime(). - * - * @param __s The stream to write to. - * @param __io Source of locale. - * @param __fill char_type to use for padding. - * @param __tm Struct tm with date and time info to format. - * @param __beg Start of format string. - * @param __end End of format string. - * @return Iterator after writing. - */ - iter_type - put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, - const _CharT* __beg, const _CharT* __end) const; - - /** - * @brief Format and output a time or date. - * - * This function formats the data in struct tm according to the - * provided format char and optional modifier. The format and modifier - * are interpreted as by strftime(). It does so by returning - * time_put::do_put(). - * - * @param __s The stream to write to. - * @param __io Source of locale. - * @param __fill char_type to use for padding. - * @param __tm Struct tm with date and time info to format. - * @param __format Format char. - * @param __mod Optional modifier char. - * @return Iterator after writing. - */ - iter_type - put(iter_type __s, ios_base& __io, char_type __fill, - const tm* __tm, char __format, char __mod = 0) const - { return this->do_put(__s, __io, __fill, __tm, __format, __mod); } - - protected: - /// Destructor. - virtual - ~time_put() - { } - - /** - * @brief Format and output a time or date. - * - * This function formats the data in struct tm according to the - * provided format char and optional modifier. This function is a hook - * for derived classes to change the value returned. @see put() for - * more details. - * - * @param __s The stream to write to. - * @param __io Source of locale. - * @param __fill char_type to use for padding. - * @param __tm Struct tm with date and time info to format. - * @param __format Format char. - * @param __mod Optional modifier char. - * @return Iterator after writing. - */ - virtual iter_type - do_put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, - char __format, char __mod) const; - }; - - template - locale::id time_put<_CharT, _OutIter>::id; - - /// class time_put_byname [22.2.5.4]. - template - class time_put_byname : public time_put<_CharT, _OutIter> - { - public: - // Types: - typedef _CharT char_type; - typedef _OutIter iter_type; - - explicit - time_put_byname(const char*, size_t __refs = 0) - : time_put<_CharT, _OutIter>(__refs) - { }; - -#if __cplusplus >= 201103L - explicit - time_put_byname(const string& __s, size_t __refs = 0) - : time_put_byname(__s.c_str(), __refs) { } -#endif - - protected: - virtual - ~time_put_byname() { } - }; - - - /** - * @brief Money format ordering data. - * @ingroup locales - * - * This class contains an ordered array of 4 fields to represent the - * pattern for formatting a money amount. Each field may contain one entry - * from the part enum. symbol, sign, and value must be present and the - * remaining field must contain either none or space. @see - * moneypunct::pos_format() and moneypunct::neg_format() for details of how - * these fields are interpreted. - */ - class money_base - { - public: - enum part { none, space, symbol, sign, value }; - struct pattern { char field[4]; }; - - static const pattern _S_default_pattern; - - enum - { - _S_minus, - _S_zero, - _S_end = 11 - }; - - // String literal of acceptable (narrow) input/output, for - // money_get/money_put. "-0123456789" - static const char* _S_atoms; - - // Construct and return valid pattern consisting of some combination of: - // space none symbol sign value - _GLIBCXX_CONST static pattern - _S_construct_pattern(char __precedes, char __space, char __posn) throw (); - }; - - template - struct __moneypunct_cache : public locale::facet - { - const char* _M_grouping; - size_t _M_grouping_size; - bool _M_use_grouping; - _CharT _M_decimal_point; - _CharT _M_thousands_sep; - const _CharT* _M_curr_symbol; - size_t _M_curr_symbol_size; - const _CharT* _M_positive_sign; - size_t _M_positive_sign_size; - const _CharT* _M_negative_sign; - size_t _M_negative_sign_size; - int _M_frac_digits; - money_base::pattern _M_pos_format; - money_base::pattern _M_neg_format; - - // A list of valid numeric literals for input and output: in the standard - // "C" locale, this is "-0123456789". This array contains the chars after - // having been passed through the current locale's ctype<_CharT>.widen(). - _CharT _M_atoms[money_base::_S_end]; - - bool _M_allocated; - - __moneypunct_cache(size_t __refs = 0) : facet(__refs), - _M_grouping(0), _M_grouping_size(0), _M_use_grouping(false), - _M_decimal_point(_CharT()), _M_thousands_sep(_CharT()), - _M_curr_symbol(0), _M_curr_symbol_size(0), - _M_positive_sign(0), _M_positive_sign_size(0), - _M_negative_sign(0), _M_negative_sign_size(0), - _M_frac_digits(0), - _M_pos_format(money_base::pattern()), - _M_neg_format(money_base::pattern()), _M_allocated(false) - { } - - ~__moneypunct_cache(); - - void - _M_cache(const locale& __loc); - - private: - __moneypunct_cache& - operator=(const __moneypunct_cache&); - - explicit - __moneypunct_cache(const __moneypunct_cache&); - }; - - template - __moneypunct_cache<_CharT, _Intl>::~__moneypunct_cache() - { - if (_M_allocated) - { - delete [] _M_grouping; - delete [] _M_curr_symbol; - delete [] _M_positive_sign; - delete [] _M_negative_sign; - } - } - -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - - /** - * @brief Primary class template moneypunct. - * @ingroup locales - * - * This facet encapsulates the punctuation, grouping and other formatting - * features of money amount string representations. - */ - template - class moneypunct : public locale::facet, public money_base - { - public: - // Types: - //@{ - /// Public typedefs - typedef _CharT char_type; - typedef basic_string<_CharT> string_type; - //@} - typedef __moneypunct_cache<_CharT, _Intl> __cache_type; - - private: - __cache_type* _M_data; - - public: - /// This value is provided by the standard, but no reason for its - /// existence. - static const bool intl = _Intl; - /// Numpunct facet id. - static locale::id id; - - /** - * @brief Constructor performs initialization. - * - * This is the constructor provided by the standard. - * - * @param __refs Passed to the base facet class. - */ - explicit - moneypunct(size_t __refs = 0) - : facet(__refs), _M_data(0) - { _M_initialize_moneypunct(); } - - /** - * @brief Constructor performs initialization. - * - * This is an internal constructor. - * - * @param __cache Cache for optimization. - * @param __refs Passed to the base facet class. - */ - explicit - moneypunct(__cache_type* __cache, size_t __refs = 0) - : facet(__refs), _M_data(__cache) - { _M_initialize_moneypunct(); } - - /** - * @brief Internal constructor. Not for general use. - * - * This is a constructor for use by the library itself to set up new - * locales. - * - * @param __cloc The C locale. - * @param __s The name of a locale. - * @param __refs Passed to the base facet class. - */ - explicit - moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0) - : facet(__refs), _M_data(0) - { _M_initialize_moneypunct(__cloc, __s); } - - /** - * @brief Return decimal point character. - * - * This function returns a char_type to use as a decimal point. It - * does so by returning returning - * moneypunct::do_decimal_point(). - * - * @return @a char_type representing a decimal point. - */ - char_type - decimal_point() const - { return this->do_decimal_point(); } - - /** - * @brief Return thousands separator character. - * - * This function returns a char_type to use as a thousands - * separator. It does so by returning returning - * moneypunct::do_thousands_sep(). - * - * @return char_type representing a thousands separator. - */ - char_type - thousands_sep() const - { return this->do_thousands_sep(); } - - /** - * @brief Return grouping specification. - * - * This function returns a string representing groupings for the - * integer part of an amount. Groupings indicate where thousands - * separators should be inserted. - * - * Each char in the return string is interpret as an integer rather - * than a character. These numbers represent the number of digits in a - * group. The first char in the string represents the number of digits - * in the least significant group. If a char is negative, it indicates - * an unlimited number of digits for the group. If more chars from the - * string are required to group a number, the last char is used - * repeatedly. - * - * For example, if the grouping() returns \003\002 - * and is applied to the number 123456789, this corresponds to - * 12,34,56,789. Note that if the string was 32, this would - * put more than 50 digits into the least significant group if - * the character set is ASCII. - * - * The string is returned by calling - * moneypunct::do_grouping(). - * - * @return string representing grouping specification. - */ - string - grouping() const - { return this->do_grouping(); } - - /** - * @brief Return currency symbol string. - * - * This function returns a string_type to use as a currency symbol. It - * does so by returning returning - * moneypunct::do_curr_symbol(). - * - * @return @a string_type representing a currency symbol. - */ - string_type - curr_symbol() const - { return this->do_curr_symbol(); } - - /** - * @brief Return positive sign string. - * - * This function returns a string_type to use as a sign for positive - * amounts. It does so by returning returning - * moneypunct::do_positive_sign(). - * - * If the return value contains more than one character, the first - * character appears in the position indicated by pos_format() and the - * remainder appear at the end of the formatted string. - * - * @return @a string_type representing a positive sign. - */ - string_type - positive_sign() const - { return this->do_positive_sign(); } - - /** - * @brief Return negative sign string. - * - * This function returns a string_type to use as a sign for negative - * amounts. It does so by returning returning - * moneypunct::do_negative_sign(). - * - * If the return value contains more than one character, the first - * character appears in the position indicated by neg_format() and the - * remainder appear at the end of the formatted string. - * - * @return @a string_type representing a negative sign. - */ - string_type - negative_sign() const - { return this->do_negative_sign(); } - - /** - * @brief Return number of digits in fraction. - * - * This function returns the exact number of digits that make up the - * fractional part of a money amount. It does so by returning - * returning moneypunct::do_frac_digits(). - * - * The fractional part of a money amount is optional. But if it is - * present, there must be frac_digits() digits. - * - * @return Number of digits in amount fraction. - */ - int - frac_digits() const - { return this->do_frac_digits(); } - - //@{ - /** - * @brief Return pattern for money values. - * - * This function returns a pattern describing the formatting of a - * positive or negative valued money amount. It does so by returning - * returning moneypunct::do_pos_format() or - * moneypunct::do_neg_format(). - * - * The pattern has 4 fields describing the ordering of symbol, sign, - * value, and none or space. There must be one of each in the pattern. - * The none and space enums may not appear in the first field and space - * may not appear in the final field. - * - * The parts of a money string must appear in the order indicated by - * the fields of the pattern. The symbol field indicates that the - * value of curr_symbol() may be present. The sign field indicates - * that the value of positive_sign() or negative_sign() must be - * present. The value field indicates that the absolute value of the - * money amount is present. none indicates 0 or more whitespace - * characters, except at the end, where it permits no whitespace. - * space indicates that 1 or more whitespace characters must be - * present. - * - * For example, for the US locale and pos_format() pattern - * {symbol,sign,value,none}, curr_symbol() == '$' - * positive_sign() == '+', and value 10.01, and - * options set to force the symbol, the corresponding string is - * $+10.01. - * - * @return Pattern for money values. - */ - pattern - pos_format() const - { return this->do_pos_format(); } - - pattern - neg_format() const - { return this->do_neg_format(); } - //@} - - protected: - /// Destructor. - virtual - ~moneypunct(); - - /** - * @brief Return decimal point character. - * - * Returns a char_type to use as a decimal point. This function is a - * hook for derived classes to change the value returned. - * - * @return @a char_type representing a decimal point. - */ - virtual char_type - do_decimal_point() const - { return _M_data->_M_decimal_point; } - - /** - * @brief Return thousands separator character. - * - * Returns a char_type to use as a thousands separator. This function - * is a hook for derived classes to change the value returned. - * - * @return @a char_type representing a thousands separator. - */ - virtual char_type - do_thousands_sep() const - { return _M_data->_M_thousands_sep; } - - /** - * @brief Return grouping specification. - * - * Returns a string representing groupings for the integer part of a - * number. This function is a hook for derived classes to change the - * value returned. @see grouping() for details. - * - * @return String representing grouping specification. - */ - virtual string - do_grouping() const - { return _M_data->_M_grouping; } - - /** - * @brief Return currency symbol string. - * - * This function returns a string_type to use as a currency symbol. - * This function is a hook for derived classes to change the value - * returned. @see curr_symbol() for details. - * - * @return @a string_type representing a currency symbol. - */ - virtual string_type - do_curr_symbol() const - { return _M_data->_M_curr_symbol; } - - /** - * @brief Return positive sign string. - * - * This function returns a string_type to use as a sign for positive - * amounts. This function is a hook for derived classes to change the - * value returned. @see positive_sign() for details. - * - * @return @a string_type representing a positive sign. - */ - virtual string_type - do_positive_sign() const - { return _M_data->_M_positive_sign; } - - /** - * @brief Return negative sign string. - * - * This function returns a string_type to use as a sign for negative - * amounts. This function is a hook for derived classes to change the - * value returned. @see negative_sign() for details. - * - * @return @a string_type representing a negative sign. - */ - virtual string_type - do_negative_sign() const - { return _M_data->_M_negative_sign; } - - /** - * @brief Return number of digits in fraction. - * - * This function returns the exact number of digits that make up the - * fractional part of a money amount. This function is a hook for - * derived classes to change the value returned. @see frac_digits() - * for details. - * - * @return Number of digits in amount fraction. - */ - virtual int - do_frac_digits() const - { return _M_data->_M_frac_digits; } - - /** - * @brief Return pattern for money values. - * - * This function returns a pattern describing the formatting of a - * positive valued money amount. This function is a hook for derived - * classes to change the value returned. @see pos_format() for - * details. - * - * @return Pattern for money values. - */ - virtual pattern - do_pos_format() const - { return _M_data->_M_pos_format; } - - /** - * @brief Return pattern for money values. - * - * This function returns a pattern describing the formatting of a - * negative valued money amount. This function is a hook for derived - * classes to change the value returned. @see neg_format() for - * details. - * - * @return Pattern for money values. - */ - virtual pattern - do_neg_format() const - { return _M_data->_M_neg_format; } - - // For use at construction time only. - void - _M_initialize_moneypunct(__c_locale __cloc = 0, - const char* __name = 0); - }; - - template - locale::id moneypunct<_CharT, _Intl>::id; - - template - const bool moneypunct<_CharT, _Intl>::intl; - - template<> - moneypunct::~moneypunct(); - - template<> - moneypunct::~moneypunct(); - - template<> - void - moneypunct::_M_initialize_moneypunct(__c_locale, const char*); - - template<> - void - moneypunct::_M_initialize_moneypunct(__c_locale, const char*); - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - moneypunct::~moneypunct(); - - template<> - moneypunct::~moneypunct(); - - template<> - void - moneypunct::_M_initialize_moneypunct(__c_locale, - const char*); - - template<> - void - moneypunct::_M_initialize_moneypunct(__c_locale, - const char*); -#endif - - /// class moneypunct_byname [22.2.6.4]. - template - class moneypunct_byname : public moneypunct<_CharT, _Intl> - { - public: - typedef _CharT char_type; - typedef basic_string<_CharT> string_type; - - static const bool intl = _Intl; - - explicit - moneypunct_byname(const char* __s, size_t __refs = 0) - : moneypunct<_CharT, _Intl>(__refs) - { - if (__builtin_strcmp(__s, "C") != 0 - && __builtin_strcmp(__s, "POSIX") != 0) - { - __c_locale __tmp; - this->_S_create_c_locale(__tmp, __s); - this->_M_initialize_moneypunct(__tmp); - this->_S_destroy_c_locale(__tmp); - } - } - -#if __cplusplus >= 201103L - explicit - moneypunct_byname(const string& __s, size_t __refs = 0) - : moneypunct_byname(__s.c_str(), __refs) { } -#endif - - protected: - virtual - ~moneypunct_byname() { } - }; - - template - const bool moneypunct_byname<_CharT, _Intl>::intl; - -_GLIBCXX_END_NAMESPACE_CXX11 - -_GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 - - /** - * @brief Primary class template money_get. - * @ingroup locales - * - * This facet encapsulates the code to parse and return a monetary - * amount from a string. - * - * The money_get template uses protected virtual functions to - * provide the actual results. The public accessors forward the - * call to the virtual functions. These virtual functions are - * hooks for developers to implement the behavior they require from - * the money_get facet. - */ - template - class money_get : public locale::facet - { - public: - // Types: - //@{ - /// Public typedefs - typedef _CharT char_type; - typedef _InIter iter_type; - typedef basic_string<_CharT> string_type; - //@} - - /// Numpunct facet id. - static locale::id id; - - /** - * @brief Constructor performs initialization. - * - * This is the constructor provided by the standard. - * - * @param __refs Passed to the base facet class. - */ - explicit - money_get(size_t __refs = 0) : facet(__refs) { } - - /** - * @brief Read and parse a monetary value. - * - * This function reads characters from @a __s, interprets them as a - * monetary value according to moneypunct and ctype facets retrieved - * from io.getloc(), and returns the result in @a units as an integral - * value moneypunct::frac_digits() * the actual amount. For example, - * the string $10.01 in a US locale would store 1001 in @a units. - * - * Any characters not part of a valid money amount are not consumed. - * - * If a money value cannot be parsed from the input stream, sets - * err=(err|io.failbit). If the stream is consumed before finishing - * parsing, sets err=(err|io.failbit|io.eofbit). @a units is - * unchanged if parsing fails. - * - * This function works by returning the result of do_get(). - * - * @param __s Start of characters to parse. - * @param __end End of characters to parse. - * @param __intl Parameter to use_facet >. - * @param __io Source of facets and io state. - * @param __err Error field to set if parsing fails. - * @param __units Place to store result of parsing. - * @return Iterator referencing first character beyond valid money - * amount. - */ - iter_type - get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, - ios_base::iostate& __err, long double& __units) const - { return this->do_get(__s, __end, __intl, __io, __err, __units); } - - /** - * @brief Read and parse a monetary value. - * - * This function reads characters from @a __s, interprets them as - * a monetary value according to moneypunct and ctype facets - * retrieved from io.getloc(), and returns the result in @a - * digits. For example, the string $10.01 in a US locale would - * store 1001 in @a digits. - * - * Any characters not part of a valid money amount are not consumed. - * - * If a money value cannot be parsed from the input stream, sets - * err=(err|io.failbit). If the stream is consumed before finishing - * parsing, sets err=(err|io.failbit|io.eofbit). - * - * This function works by returning the result of do_get(). - * - * @param __s Start of characters to parse. - * @param __end End of characters to parse. - * @param __intl Parameter to use_facet >. - * @param __io Source of facets and io state. - * @param __err Error field to set if parsing fails. - * @param __digits Place to store result of parsing. - * @return Iterator referencing first character beyond valid money - * amount. - */ - iter_type - get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, - ios_base::iostate& __err, string_type& __digits) const - { return this->do_get(__s, __end, __intl, __io, __err, __digits); } - - protected: - /// Destructor. - virtual - ~money_get() { } - - /** - * @brief Read and parse a monetary value. - * - * This function reads and parses characters representing a monetary - * value. This function is a hook for derived classes to change the - * value returned. @see get() for details. - */ - // XXX GLIBCXX_ABI Deprecated -#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ - && _GLIBCXX_USE_CXX11_ABI == 0 - virtual iter_type - __do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, - ios_base::iostate& __err, double& __units) const; -#else - virtual iter_type - do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, - ios_base::iostate& __err, long double& __units) const; -#endif - - /** - * @brief Read and parse a monetary value. - * - * This function reads and parses characters representing a monetary - * value. This function is a hook for derived classes to change the - * value returned. @see get() for details. - */ - virtual iter_type - do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, - ios_base::iostate& __err, string_type& __digits) const; - - // XXX GLIBCXX_ABI Deprecated -#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ - && _GLIBCXX_USE_CXX11_ABI == 0 - virtual iter_type - do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, - ios_base::iostate& __err, long double& __units) const; -#endif - - template - iter_type - _M_extract(iter_type __s, iter_type __end, ios_base& __io, - ios_base::iostate& __err, string& __digits) const; - }; - - template - locale::id money_get<_CharT, _InIter>::id; - - /** - * @brief Primary class template money_put. - * @ingroup locales - * - * This facet encapsulates the code to format and output a monetary - * amount. - * - * The money_put template uses protected virtual functions to - * provide the actual results. The public accessors forward the - * call to the virtual functions. These virtual functions are - * hooks for developers to implement the behavior they require from - * the money_put facet. - */ - template - class money_put : public locale::facet - { - public: - //@{ - /// Public typedefs - typedef _CharT char_type; - typedef _OutIter iter_type; - typedef basic_string<_CharT> string_type; - //@} - - /// Numpunct facet id. - static locale::id id; - - /** - * @brief Constructor performs initialization. - * - * This is the constructor provided by the standard. - * - * @param __refs Passed to the base facet class. - */ - explicit - money_put(size_t __refs = 0) : facet(__refs) { } - - /** - * @brief Format and output a monetary value. - * - * This function formats @a units as a monetary value according to - * moneypunct and ctype facets retrieved from io.getloc(), and writes - * the resulting characters to @a __s. For example, the value 1001 in a - * US locale would write $10.01 to @a __s. - * - * This function works by returning the result of do_put(). - * - * @param __s The stream to write to. - * @param __intl Parameter to use_facet >. - * @param __io Source of facets and io state. - * @param __fill char_type to use for padding. - * @param __units Place to store result of parsing. - * @return Iterator after writing. - */ - iter_type - put(iter_type __s, bool __intl, ios_base& __io, - char_type __fill, long double __units) const - { return this->do_put(__s, __intl, __io, __fill, __units); } - - /** - * @brief Format and output a monetary value. - * - * This function formats @a digits as a monetary value - * according to moneypunct and ctype facets retrieved from - * io.getloc(), and writes the resulting characters to @a __s. - * For example, the string 1001 in a US locale - * would write $10.01 to @a __s. - * - * This function works by returning the result of do_put(). - * - * @param __s The stream to write to. - * @param __intl Parameter to use_facet >. - * @param __io Source of facets and io state. - * @param __fill char_type to use for padding. - * @param __digits Place to store result of parsing. - * @return Iterator after writing. - */ - iter_type - put(iter_type __s, bool __intl, ios_base& __io, - char_type __fill, const string_type& __digits) const - { return this->do_put(__s, __intl, __io, __fill, __digits); } - - protected: - /// Destructor. - virtual - ~money_put() { } - - /** - * @brief Format and output a monetary value. - * - * This function formats @a units as a monetary value according to - * moneypunct and ctype facets retrieved from io.getloc(), and writes - * the resulting characters to @a __s. For example, the value 1001 in a - * US locale would write $10.01 to @a __s. - * - * This function is a hook for derived classes to change the value - * returned. @see put(). - * - * @param __s The stream to write to. - * @param __intl Parameter to use_facet >. - * @param __io Source of facets and io state. - * @param __fill char_type to use for padding. - * @param __units Place to store result of parsing. - * @return Iterator after writing. - */ - // XXX GLIBCXX_ABI Deprecated -#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ - && _GLIBCXX_USE_CXX11_ABI == 0 - virtual iter_type - __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, - double __units) const; -#else - virtual iter_type - do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, - long double __units) const; -#endif - - /** - * @brief Format and output a monetary value. - * - * This function formats @a digits as a monetary value - * according to moneypunct and ctype facets retrieved from - * io.getloc(), and writes the resulting characters to @a __s. - * For example, the string 1001 in a US locale - * would write $10.01 to @a __s. - * - * This function is a hook for derived classes to change the value - * returned. @see put(). - * - * @param __s The stream to write to. - * @param __intl Parameter to use_facet >. - * @param __io Source of facets and io state. - * @param __fill char_type to use for padding. - * @param __digits Place to store result of parsing. - * @return Iterator after writing. - */ - virtual iter_type - do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, - const string_type& __digits) const; - - // XXX GLIBCXX_ABI Deprecated -#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ - && _GLIBCXX_USE_CXX11_ABI == 0 - virtual iter_type - do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, - long double __units) const; -#endif - - template - iter_type - _M_insert(iter_type __s, ios_base& __io, char_type __fill, - const string_type& __digits) const; - }; - - template - locale::id money_put<_CharT, _OutIter>::id; - -_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 - - /** - * @brief Messages facet base class providing catalog typedef. - * @ingroup locales - */ - struct messages_base - { - typedef int catalog; - }; - -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - - /** - * @brief Primary class template messages. - * @ingroup locales - * - * This facet encapsulates the code to retrieve messages from - * message catalogs. The only thing defined by the standard for this facet - * is the interface. All underlying functionality is - * implementation-defined. - * - * This library currently implements 3 versions of the message facet. The - * first version (gnu) is a wrapper around gettext, provided by libintl. - * The second version (ieee) is a wrapper around catgets. The final - * version (default) does no actual translation. These implementations are - * only provided for char and wchar_t instantiations. - * - * The messages template uses protected virtual functions to - * provide the actual results. The public accessors forward the - * call to the virtual functions. These virtual functions are - * hooks for developers to implement the behavior they require from - * the messages facet. - */ - template - class messages : public locale::facet, public messages_base - { - public: - // Types: - //@{ - /// Public typedefs - typedef _CharT char_type; - typedef basic_string<_CharT> string_type; - //@} - - protected: - // Underlying "C" library locale information saved from - // initialization, needed by messages_byname as well. - __c_locale _M_c_locale_messages; - const char* _M_name_messages; - - public: - /// Numpunct facet id. - static locale::id id; - - /** - * @brief Constructor performs initialization. - * - * This is the constructor provided by the standard. - * - * @param __refs Passed to the base facet class. - */ - explicit - messages(size_t __refs = 0); - - // Non-standard. - /** - * @brief Internal constructor. Not for general use. - * - * This is a constructor for use by the library itself to set up new - * locales. - * - * @param __cloc The C locale. - * @param __s The name of a locale. - * @param __refs Refcount to pass to the base class. - */ - explicit - messages(__c_locale __cloc, const char* __s, size_t __refs = 0); - - /* - * @brief Open a message catalog. - * - * This function opens and returns a handle to a message catalog by - * returning do_open(__s, __loc). - * - * @param __s The catalog to open. - * @param __loc Locale to use for character set conversions. - * @return Handle to the catalog or value < 0 if open fails. - */ - catalog - open(const basic_string& __s, const locale& __loc) const - { return this->do_open(__s, __loc); } - - // Non-standard and unorthodox, yet effective. - /* - * @brief Open a message catalog. - * - * This non-standard function opens and returns a handle to a message - * catalog by returning do_open(s, loc). The third argument provides a - * message catalog root directory for gnu gettext and is ignored - * otherwise. - * - * @param __s The catalog to open. - * @param __loc Locale to use for character set conversions. - * @param __dir Message catalog root directory. - * @return Handle to the catalog or value < 0 if open fails. - */ - catalog - open(const basic_string&, const locale&, const char*) const; - - /* - * @brief Look up a string in a message catalog. - * - * This function retrieves and returns a message from a catalog by - * returning do_get(c, set, msgid, s). - * - * For gnu, @a __set and @a msgid are ignored. Returns gettext(s). - * For default, returns s. For ieee, returns catgets(c,set,msgid,s). - * - * @param __c The catalog to access. - * @param __set Implementation-defined. - * @param __msgid Implementation-defined. - * @param __s Default return value if retrieval fails. - * @return Retrieved message or @a __s if get fails. - */ - string_type - get(catalog __c, int __set, int __msgid, const string_type& __s) const - { return this->do_get(__c, __set, __msgid, __s); } - - /* - * @brief Close a message catalog. - * - * Closes catalog @a c by calling do_close(c). - * - * @param __c The catalog to close. - */ - void - close(catalog __c) const - { return this->do_close(__c); } - - protected: - /// Destructor. - virtual - ~messages(); - - /* - * @brief Open a message catalog. - * - * This function opens and returns a handle to a message catalog in an - * implementation-defined manner. This function is a hook for derived - * classes to change the value returned. - * - * @param __s The catalog to open. - * @param __loc Locale to use for character set conversions. - * @return Handle to the opened catalog, value < 0 if open failed. - */ - virtual catalog - do_open(const basic_string&, const locale&) const; - - /* - * @brief Look up a string in a message catalog. - * - * This function retrieves and returns a message from a catalog in an - * implementation-defined manner. This function is a hook for derived - * classes to change the value returned. - * - * For gnu, @a __set and @a __msgid are ignored. Returns gettext(s). - * For default, returns s. For ieee, returns catgets(c,set,msgid,s). - * - * @param __c The catalog to access. - * @param __set Implementation-defined. - * @param __msgid Implementation-defined. - * @param __s Default return value if retrieval fails. - * @return Retrieved message or @a __s if get fails. - */ - virtual string_type - do_get(catalog, int, int, const string_type& __dfault) const; - - /* - * @brief Close a message catalog. - * - * @param __c The catalog to close. - */ - virtual void - do_close(catalog) const; - - // Returns a locale and codeset-converted string, given a char* message. - char* - _M_convert_to_char(const string_type& __msg) const - { - // XXX - return reinterpret_cast(const_cast<_CharT*>(__msg.c_str())); - } - - // Returns a locale and codeset-converted string, given a char* message. - string_type - _M_convert_from_char(char*) const - { - // XXX - return string_type(); - } - }; - - template - locale::id messages<_CharT>::id; - - /// Specializations for required instantiations. - template<> - string - messages::do_get(catalog, int, int, const string&) const; - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - wstring - messages::do_get(catalog, int, int, const wstring&) const; -#endif - - /// class messages_byname [22.2.7.2]. - template - class messages_byname : public messages<_CharT> - { - public: - typedef _CharT char_type; - typedef basic_string<_CharT> string_type; - - explicit - messages_byname(const char* __s, size_t __refs = 0); - -#if __cplusplus >= 201103L - explicit - messages_byname(const string& __s, size_t __refs = 0) - : messages_byname(__s.c_str(), __refs) { } -#endif - - protected: - virtual - ~messages_byname() - { } - }; - -_GLIBCXX_END_NAMESPACE_CXX11 - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -// Include host and configuration specific messages functions. -#include - -// 22.2.1.5 Template class codecvt -#include - -#include - -#endif diff --git a/openflow/usr/include/c++/5/bits/locale_facets_nonio.tcc b/openflow/usr/include/c++/5/bits/locale_facets_nonio.tcc deleted file mode 100644 index 188d07b..0000000 --- a/openflow/usr/include/c++/5/bits/locale_facets_nonio.tcc +++ /dev/null @@ -1,1484 +0,0 @@ -// Locale support -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/locale_facets_nonio.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -#ifndef _LOCALE_FACETS_NONIO_TCC -#define _LOCALE_FACETS_NONIO_TCC 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - struct __use_cache<__moneypunct_cache<_CharT, _Intl> > - { - const __moneypunct_cache<_CharT, _Intl>* - operator() (const locale& __loc) const - { - const size_t __i = moneypunct<_CharT, _Intl>::id._M_id(); - const locale::facet** __caches = __loc._M_impl->_M_caches; - if (!__caches[__i]) - { - __moneypunct_cache<_CharT, _Intl>* __tmp = 0; - __try - { - __tmp = new __moneypunct_cache<_CharT, _Intl>; - __tmp->_M_cache(__loc); - } - __catch(...) - { - delete __tmp; - __throw_exception_again; - } - __loc._M_impl->_M_install_cache(__tmp, __i); - } - return static_cast< - const __moneypunct_cache<_CharT, _Intl>*>(__caches[__i]); - } - }; - - template - void - __moneypunct_cache<_CharT, _Intl>::_M_cache(const locale& __loc) - { - const moneypunct<_CharT, _Intl>& __mp = - use_facet >(__loc); - - _M_decimal_point = __mp.decimal_point(); - _M_thousands_sep = __mp.thousands_sep(); - _M_frac_digits = __mp.frac_digits(); - - char* __grouping = 0; - _CharT* __curr_symbol = 0; - _CharT* __positive_sign = 0; - _CharT* __negative_sign = 0; - __try - { - const string& __g = __mp.grouping(); - _M_grouping_size = __g.size(); - __grouping = new char[_M_grouping_size]; - __g.copy(__grouping, _M_grouping_size); - _M_use_grouping = (_M_grouping_size - && static_cast(__grouping[0]) > 0 - && (__grouping[0] - != __gnu_cxx::__numeric_traits::__max)); - - const basic_string<_CharT>& __cs = __mp.curr_symbol(); - _M_curr_symbol_size = __cs.size(); - __curr_symbol = new _CharT[_M_curr_symbol_size]; - __cs.copy(__curr_symbol, _M_curr_symbol_size); - - const basic_string<_CharT>& __ps = __mp.positive_sign(); - _M_positive_sign_size = __ps.size(); - __positive_sign = new _CharT[_M_positive_sign_size]; - __ps.copy(__positive_sign, _M_positive_sign_size); - - const basic_string<_CharT>& __ns = __mp.negative_sign(); - _M_negative_sign_size = __ns.size(); - __negative_sign = new _CharT[_M_negative_sign_size]; - __ns.copy(__negative_sign, _M_negative_sign_size); - - _M_pos_format = __mp.pos_format(); - _M_neg_format = __mp.neg_format(); - - const ctype<_CharT>& __ct = use_facet >(__loc); - __ct.widen(money_base::_S_atoms, - money_base::_S_atoms + money_base::_S_end, _M_atoms); - - _M_grouping = __grouping; - _M_curr_symbol = __curr_symbol; - _M_positive_sign = __positive_sign; - _M_negative_sign = __negative_sign; - _M_allocated = true; - } - __catch(...) - { - delete [] __grouping; - delete [] __curr_symbol; - delete [] __positive_sign; - delete [] __negative_sign; - __throw_exception_again; - } - } - -_GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 - - template - template - _InIter - money_get<_CharT, _InIter>:: - _M_extract(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, string& __units) const - { - typedef char_traits<_CharT> __traits_type; - typedef typename string_type::size_type size_type; - typedef money_base::part part; - typedef __moneypunct_cache<_CharT, _Intl> __cache_type; - - const locale& __loc = __io._M_getloc(); - const ctype<_CharT>& __ctype = use_facet >(__loc); - - __use_cache<__cache_type> __uc; - const __cache_type* __lc = __uc(__loc); - const char_type* __lit = __lc->_M_atoms; - - // Deduced sign. - bool __negative = false; - // Sign size. - size_type __sign_size = 0; - // True if sign is mandatory. - const bool __mandatory_sign = (__lc->_M_positive_sign_size - && __lc->_M_negative_sign_size); - // String of grouping info from thousands_sep plucked from __units. - string __grouping_tmp; - if (__lc->_M_use_grouping) - __grouping_tmp.reserve(32); - // Last position before the decimal point. - int __last_pos = 0; - // Separator positions, then, possibly, fractional digits. - int __n = 0; - // If input iterator is in a valid state. - bool __testvalid = true; - // Flag marking when a decimal point is found. - bool __testdecfound = false; - - // The tentative returned string is stored here. - string __res; - __res.reserve(32); - - const char_type* __lit_zero = __lit + money_base::_S_zero; - const money_base::pattern __p = __lc->_M_neg_format; - for (int __i = 0; __i < 4 && __testvalid; ++__i) - { - const part __which = static_cast(__p.field[__i]); - switch (__which) - { - case money_base::symbol: - // According to 22.2.6.1.2, p2, symbol is required - // if (__io.flags() & ios_base::showbase), otherwise - // is optional and consumed only if other characters - // are needed to complete the format. - if (__io.flags() & ios_base::showbase || __sign_size > 1 - || __i == 0 - || (__i == 1 && (__mandatory_sign - || (static_cast(__p.field[0]) - == money_base::sign) - || (static_cast(__p.field[2]) - == money_base::space))) - || (__i == 2 && ((static_cast(__p.field[3]) - == money_base::value) - || (__mandatory_sign - && (static_cast(__p.field[3]) - == money_base::sign))))) - { - const size_type __len = __lc->_M_curr_symbol_size; - size_type __j = 0; - for (; __beg != __end && __j < __len - && *__beg == __lc->_M_curr_symbol[__j]; - ++__beg, ++__j); - if (__j != __len - && (__j || __io.flags() & ios_base::showbase)) - __testvalid = false; - } - break; - case money_base::sign: - // Sign might not exist, or be more than one character long. - if (__lc->_M_positive_sign_size && __beg != __end - && *__beg == __lc->_M_positive_sign[0]) - { - __sign_size = __lc->_M_positive_sign_size; - ++__beg; - } - else if (__lc->_M_negative_sign_size && __beg != __end - && *__beg == __lc->_M_negative_sign[0]) - { - __negative = true; - __sign_size = __lc->_M_negative_sign_size; - ++__beg; - } - else if (__lc->_M_positive_sign_size - && !__lc->_M_negative_sign_size) - // "... if no sign is detected, the result is given the sign - // that corresponds to the source of the empty string" - __negative = true; - else if (__mandatory_sign) - __testvalid = false; - break; - case money_base::value: - // Extract digits, remove and stash away the - // grouping of found thousands separators. - for (; __beg != __end; ++__beg) - { - const char_type __c = *__beg; - const char_type* __q = __traits_type::find(__lit_zero, - 10, __c); - if (__q != 0) - { - __res += money_base::_S_atoms[__q - __lit]; - ++__n; - } - else if (__c == __lc->_M_decimal_point - && !__testdecfound) - { - if (__lc->_M_frac_digits <= 0) - break; - - __last_pos = __n; - __n = 0; - __testdecfound = true; - } - else if (__lc->_M_use_grouping - && __c == __lc->_M_thousands_sep - && !__testdecfound) - { - if (__n) - { - // Mark position for later analysis. - __grouping_tmp += static_cast(__n); - __n = 0; - } - else - { - __testvalid = false; - break; - } - } - else - break; - } - if (__res.empty()) - __testvalid = false; - break; - case money_base::space: - // At least one space is required. - if (__beg != __end && __ctype.is(ctype_base::space, *__beg)) - ++__beg; - else - __testvalid = false; - case money_base::none: - // Only if not at the end of the pattern. - if (__i != 3) - for (; __beg != __end - && __ctype.is(ctype_base::space, *__beg); ++__beg); - break; - } - } - - // Need to get the rest of the sign characters, if they exist. - if (__sign_size > 1 && __testvalid) - { - const char_type* __sign = __negative ? __lc->_M_negative_sign - : __lc->_M_positive_sign; - size_type __i = 1; - for (; __beg != __end && __i < __sign_size - && *__beg == __sign[__i]; ++__beg, ++__i); - - if (__i != __sign_size) - __testvalid = false; - } - - if (__testvalid) - { - // Strip leading zeros. - if (__res.size() > 1) - { - const size_type __first = __res.find_first_not_of('0'); - const bool __only_zeros = __first == string::npos; - if (__first) - __res.erase(0, __only_zeros ? __res.size() - 1 : __first); - } - - // 22.2.6.1.2, p4 - if (__negative && __res[0] != '0') - __res.insert(__res.begin(), '-'); - - // Test for grouping fidelity. - if (__grouping_tmp.size()) - { - // Add the ending grouping. - __grouping_tmp += static_cast(__testdecfound ? __last_pos - : __n); - if (!std::__verify_grouping(__lc->_M_grouping, - __lc->_M_grouping_size, - __grouping_tmp)) - __err |= ios_base::failbit; - } - - // Iff not enough digits were supplied after the decimal-point. - if (__testdecfound && __n != __lc->_M_frac_digits) - __testvalid = false; - } - - // Iff valid sequence is not recognized. - if (!__testvalid) - __err |= ios_base::failbit; - else - __units.swap(__res); - - // Iff no more characters are available. - if (__beg == __end) - __err |= ios_base::eofbit; - return __beg; - } - -#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ - && _GLIBCXX_USE_CXX11_ABI == 0 - template - _InIter - money_get<_CharT, _InIter>:: - __do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io, - ios_base::iostate& __err, double& __units) const - { - string __str; - __beg = __intl ? _M_extract(__beg, __end, __io, __err, __str) - : _M_extract(__beg, __end, __io, __err, __str); - std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale()); - return __beg; - } -#endif - - template - _InIter - money_get<_CharT, _InIter>:: - do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io, - ios_base::iostate& __err, long double& __units) const - { - string __str; - __beg = __intl ? _M_extract(__beg, __end, __io, __err, __str) - : _M_extract(__beg, __end, __io, __err, __str); - std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale()); - return __beg; - } - - template - _InIter - money_get<_CharT, _InIter>:: - do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io, - ios_base::iostate& __err, string_type& __digits) const - { - typedef typename string::size_type size_type; - - const locale& __loc = __io._M_getloc(); - const ctype<_CharT>& __ctype = use_facet >(__loc); - - string __str; - __beg = __intl ? _M_extract(__beg, __end, __io, __err, __str) - : _M_extract(__beg, __end, __io, __err, __str); - const size_type __len = __str.size(); - if (__len) - { - __digits.resize(__len); - __ctype.widen(__str.data(), __str.data() + __len, &__digits[0]); - } - return __beg; - } - - template - template - _OutIter - money_put<_CharT, _OutIter>:: - _M_insert(iter_type __s, ios_base& __io, char_type __fill, - const string_type& __digits) const - { - typedef typename string_type::size_type size_type; - typedef money_base::part part; - typedef __moneypunct_cache<_CharT, _Intl> __cache_type; - - const locale& __loc = __io._M_getloc(); - const ctype<_CharT>& __ctype = use_facet >(__loc); - - __use_cache<__cache_type> __uc; - const __cache_type* __lc = __uc(__loc); - const char_type* __lit = __lc->_M_atoms; - - // Determine if negative or positive formats are to be used, and - // discard leading negative_sign if it is present. - const char_type* __beg = __digits.data(); - - money_base::pattern __p; - const char_type* __sign; - size_type __sign_size; - if (!(*__beg == __lit[money_base::_S_minus])) - { - __p = __lc->_M_pos_format; - __sign = __lc->_M_positive_sign; - __sign_size = __lc->_M_positive_sign_size; - } - else - { - __p = __lc->_M_neg_format; - __sign = __lc->_M_negative_sign; - __sign_size = __lc->_M_negative_sign_size; - if (__digits.size()) - ++__beg; - } - - // Look for valid numbers in the ctype facet within input digits. - size_type __len = __ctype.scan_not(ctype_base::digit, __beg, - __beg + __digits.size()) - __beg; - if (__len) - { - // Assume valid input, and attempt to format. - // Break down input numbers into base components, as follows: - // final_value = grouped units + (decimal point) + (digits) - string_type __value; - __value.reserve(2 * __len); - - // Add thousands separators to non-decimal digits, per - // grouping rules. - long __paddec = __len - __lc->_M_frac_digits; - if (__paddec > 0) - { - if (__lc->_M_frac_digits < 0) - __paddec = __len; - if (__lc->_M_grouping_size) - { - __value.assign(2 * __paddec, char_type()); - _CharT* __vend = - std::__add_grouping(&__value[0], __lc->_M_thousands_sep, - __lc->_M_grouping, - __lc->_M_grouping_size, - __beg, __beg + __paddec); - __value.erase(__vend - &__value[0]); - } - else - __value.assign(__beg, __paddec); - } - - // Deal with decimal point, decimal digits. - if (__lc->_M_frac_digits > 0) - { - __value += __lc->_M_decimal_point; - if (__paddec >= 0) - __value.append(__beg + __paddec, __lc->_M_frac_digits); - else - { - // Have to pad zeros in the decimal position. - __value.append(-__paddec, __lit[money_base::_S_zero]); - __value.append(__beg, __len); - } - } - - // Calculate length of resulting string. - const ios_base::fmtflags __f = __io.flags() - & ios_base::adjustfield; - __len = __value.size() + __sign_size; - __len += ((__io.flags() & ios_base::showbase) - ? __lc->_M_curr_symbol_size : 0); - - string_type __res; - __res.reserve(2 * __len); - - const size_type __width = static_cast(__io.width()); - const bool __testipad = (__f == ios_base::internal - && __len < __width); - // Fit formatted digits into the required pattern. - for (int __i = 0; __i < 4; ++__i) - { - const part __which = static_cast(__p.field[__i]); - switch (__which) - { - case money_base::symbol: - if (__io.flags() & ios_base::showbase) - __res.append(__lc->_M_curr_symbol, - __lc->_M_curr_symbol_size); - break; - case money_base::sign: - // Sign might not exist, or be more than one - // character long. In that case, add in the rest - // below. - if (__sign_size) - __res += __sign[0]; - break; - case money_base::value: - __res += __value; - break; - case money_base::space: - // At least one space is required, but if internal - // formatting is required, an arbitrary number of - // fill spaces will be necessary. - if (__testipad) - __res.append(__width - __len, __fill); - else - __res += __fill; - break; - case money_base::none: - if (__testipad) - __res.append(__width - __len, __fill); - break; - } - } - - // Special case of multi-part sign parts. - if (__sign_size > 1) - __res.append(__sign + 1, __sign_size - 1); - - // Pad, if still necessary. - __len = __res.size(); - if (__width > __len) - { - if (__f == ios_base::left) - // After. - __res.append(__width - __len, __fill); - else - // Before. - __res.insert(0, __width - __len, __fill); - __len = __width; - } - - // Write resulting, fully-formatted string to output iterator. - __s = std::__write(__s, __res.data(), __len); - } - __io.width(0); - return __s; - } - -#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ - && _GLIBCXX_USE_CXX11_ABI == 0 - template - _OutIter - money_put<_CharT, _OutIter>:: - __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, - double __units) const - { return this->do_put(__s, __intl, __io, __fill, (long double) __units); } -#endif - - template - _OutIter - money_put<_CharT, _OutIter>:: - do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, - long double __units) const - { - const locale __loc = __io.getloc(); - const ctype<_CharT>& __ctype = use_facet >(__loc); -#ifdef _GLIBCXX_USE_C99 - // First try a buffer perhaps big enough. - int __cs_size = 64; - char* __cs = static_cast(__builtin_alloca(__cs_size)); - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 328. Bad sprintf format modifier in money_put<>::do_put() - int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, - "%.*Lf", 0, __units); - // If the buffer was not large enough, try again with the correct size. - if (__len >= __cs_size) - { - __cs_size = __len + 1; - __cs = static_cast(__builtin_alloca(__cs_size)); - __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, - "%.*Lf", 0, __units); - } -#else - // max_exponent10 + 1 for the integer part, + 2 for sign and '\0'. - const int __cs_size = - __gnu_cxx::__numeric_traits::__max_exponent10 + 3; - char* __cs = static_cast(__builtin_alloca(__cs_size)); - int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, "%.*Lf", - 0, __units); -#endif - string_type __digits(__len, char_type()); - __ctype.widen(__cs, __cs + __len, &__digits[0]); - return __intl ? _M_insert(__s, __io, __fill, __digits) - : _M_insert(__s, __io, __fill, __digits); - } - - template - _OutIter - money_put<_CharT, _OutIter>:: - do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, - const string_type& __digits) const - { return __intl ? _M_insert(__s, __io, __fill, __digits) - : _M_insert(__s, __io, __fill, __digits); } - -_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 - - // NB: Not especially useful. Without an ios_base object or some - // kind of locale reference, we are left clawing at the air where - // the side of the mountain used to be... - template - time_base::dateorder - time_get<_CharT, _InIter>::do_date_order() const - { return time_base::no_order; } - - // Expand a strftime format string and parse it. E.g., do_get_date() may - // pass %m/%d/%Y => extracted characters. - template - _InIter - time_get<_CharT, _InIter>:: - _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm, - const _CharT* __format) const - { - const locale& __loc = __io._M_getloc(); - const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); - const ctype<_CharT>& __ctype = use_facet >(__loc); - const size_t __len = char_traits<_CharT>::length(__format); - - ios_base::iostate __tmperr = ios_base::goodbit; - size_t __i = 0; - for (; __beg != __end && __i < __len && !__tmperr; ++__i) - { - if (__ctype.narrow(__format[__i], 0) == '%') - { - // Verify valid formatting code, attempt to extract. - char __c = __ctype.narrow(__format[++__i], 0); - int __mem = 0; - if (__c == 'E' || __c == 'O') - __c = __ctype.narrow(__format[++__i], 0); - switch (__c) - { - const char* __cs; - _CharT __wcs[10]; - case 'a': - // Abbreviated weekday name [tm_wday] - const char_type* __days1[7]; - __tp._M_days_abbreviated(__days1); - __beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days1, - 7, __io, __tmperr); - break; - case 'A': - // Weekday name [tm_wday]. - const char_type* __days2[7]; - __tp._M_days(__days2); - __beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days2, - 7, __io, __tmperr); - break; - case 'h': - case 'b': - // Abbreviated month name [tm_mon] - const char_type* __months1[12]; - __tp._M_months_abbreviated(__months1); - __beg = _M_extract_name(__beg, __end, __tm->tm_mon, - __months1, 12, __io, __tmperr); - break; - case 'B': - // Month name [tm_mon]. - const char_type* __months2[12]; - __tp._M_months(__months2); - __beg = _M_extract_name(__beg, __end, __tm->tm_mon, - __months2, 12, __io, __tmperr); - break; - case 'c': - // Default time and date representation. - const char_type* __dt[2]; - __tp._M_date_time_formats(__dt); - __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, - __tm, __dt[0]); - break; - case 'd': - // Day [01, 31]. [tm_mday] - __beg = _M_extract_num(__beg, __end, __tm->tm_mday, 1, 31, 2, - __io, __tmperr); - break; - case 'e': - // Day [1, 31], with single digits preceded by - // space. [tm_mday] - if (__ctype.is(ctype_base::space, *__beg)) - __beg = _M_extract_num(++__beg, __end, __tm->tm_mday, 1, 9, - 1, __io, __tmperr); - else - __beg = _M_extract_num(__beg, __end, __tm->tm_mday, 10, 31, - 2, __io, __tmperr); - break; - case 'D': - // Equivalent to %m/%d/%y.[tm_mon, tm_mday, tm_year] - __cs = "%m/%d/%y"; - __ctype.widen(__cs, __cs + 9, __wcs); - __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, - __tm, __wcs); - break; - case 'H': - // Hour [00, 23]. [tm_hour] - __beg = _M_extract_num(__beg, __end, __tm->tm_hour, 0, 23, 2, - __io, __tmperr); - break; - case 'I': - // Hour [01, 12]. [tm_hour] - __beg = _M_extract_num(__beg, __end, __tm->tm_hour, 1, 12, 2, - __io, __tmperr); - break; - case 'm': - // Month [01, 12]. [tm_mon] - __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2, - __io, __tmperr); - if (!__tmperr) - __tm->tm_mon = __mem - 1; - break; - case 'M': - // Minute [00, 59]. [tm_min] - __beg = _M_extract_num(__beg, __end, __tm->tm_min, 0, 59, 2, - __io, __tmperr); - break; - case 'n': - if (__ctype.narrow(*__beg, 0) == '\n') - ++__beg; - else - __tmperr |= ios_base::failbit; - break; - case 'R': - // Equivalent to (%H:%M). - __cs = "%H:%M"; - __ctype.widen(__cs, __cs + 6, __wcs); - __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, - __tm, __wcs); - break; - case 'S': - // Seconds. [tm_sec] - // [00, 60] in C99 (one leap-second), [00, 61] in C89. -#ifdef _GLIBCXX_USE_C99 - __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 60, 2, -#else - __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 61, 2, -#endif - __io, __tmperr); - break; - case 't': - if (__ctype.narrow(*__beg, 0) == '\t') - ++__beg; - else - __tmperr |= ios_base::failbit; - break; - case 'T': - // Equivalent to (%H:%M:%S). - __cs = "%H:%M:%S"; - __ctype.widen(__cs, __cs + 9, __wcs); - __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, - __tm, __wcs); - break; - case 'x': - // Locale's date. - const char_type* __dates[2]; - __tp._M_date_formats(__dates); - __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, - __tm, __dates[0]); - break; - case 'X': - // Locale's time. - const char_type* __times[2]; - __tp._M_time_formats(__times); - __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, - __tm, __times[0]); - break; - case 'y': - case 'C': // C99 - // Two digit year. - case 'Y': - // Year [1900). - // NB: We parse either two digits, implicitly years since - // 1900, or 4 digits, full year. In both cases we can - // reconstruct [tm_year]. See also libstdc++/26701. - __beg = _M_extract_num(__beg, __end, __mem, 0, 9999, 4, - __io, __tmperr); - if (!__tmperr) - __tm->tm_year = __mem < 0 ? __mem + 100 : __mem - 1900; - break; - case 'Z': - // Timezone info. - if (__ctype.is(ctype_base::upper, *__beg)) - { - int __tmp; - __beg = _M_extract_name(__beg, __end, __tmp, - __timepunct_cache<_CharT>::_S_timezones, - 14, __io, __tmperr); - - // GMT requires special effort. - if (__beg != __end && !__tmperr && __tmp == 0 - && (*__beg == __ctype.widen('-') - || *__beg == __ctype.widen('+'))) - { - __beg = _M_extract_num(__beg, __end, __tmp, 0, 23, 2, - __io, __tmperr); - __beg = _M_extract_num(__beg, __end, __tmp, 0, 59, 2, - __io, __tmperr); - } - } - else - __tmperr |= ios_base::failbit; - break; - default: - // Not recognized. - __tmperr |= ios_base::failbit; - } - } - else - { - // Verify format and input match, extract and discard. - if (__format[__i] == *__beg) - ++__beg; - else - __tmperr |= ios_base::failbit; - } - } - - if (__tmperr || __i != __len) - __err |= ios_base::failbit; - - return __beg; - } - - template - _InIter - time_get<_CharT, _InIter>:: - _M_extract_num(iter_type __beg, iter_type __end, int& __member, - int __min, int __max, size_t __len, - ios_base& __io, ios_base::iostate& __err) const - { - const locale& __loc = __io._M_getloc(); - const ctype<_CharT>& __ctype = use_facet >(__loc); - - // As-is works for __len = 1, 2, 4, the values actually used. - int __mult = __len == 2 ? 10 : (__len == 4 ? 1000 : 1); - - ++__min; - size_t __i = 0; - int __value = 0; - for (; __beg != __end && __i < __len; ++__beg, ++__i) - { - const char __c = __ctype.narrow(*__beg, '*'); - if (__c >= '0' && __c <= '9') - { - __value = __value * 10 + (__c - '0'); - const int __valuec = __value * __mult; - if (__valuec > __max || __valuec + __mult < __min) - break; - __mult /= 10; - } - else - break; - } - if (__i == __len) - __member = __value; - // Special encoding for do_get_year, 'y', and 'Y' above. - else if (__len == 4 && __i == 2) - __member = __value - 100; - else - __err |= ios_base::failbit; - - return __beg; - } - - // Assumptions: - // All elements in __names are unique. - template - _InIter - time_get<_CharT, _InIter>:: - _M_extract_name(iter_type __beg, iter_type __end, int& __member, - const _CharT** __names, size_t __indexlen, - ios_base& __io, ios_base::iostate& __err) const - { - typedef char_traits<_CharT> __traits_type; - const locale& __loc = __io._M_getloc(); - const ctype<_CharT>& __ctype = use_facet >(__loc); - - int* __matches = static_cast(__builtin_alloca(sizeof(int) - * __indexlen)); - size_t __nmatches = 0; - size_t __pos = 0; - bool __testvalid = true; - const char_type* __name; - - // Look for initial matches. - // NB: Some of the locale data is in the form of all lowercase - // names, and some is in the form of initially-capitalized - // names. Look for both. - if (__beg != __end) - { - const char_type __c = *__beg; - for (size_t __i1 = 0; __i1 < __indexlen; ++__i1) - if (__c == __names[__i1][0] - || __c == __ctype.toupper(__names[__i1][0])) - __matches[__nmatches++] = __i1; - } - - while (__nmatches > 1) - { - // Find smallest matching string. - size_t __minlen = __traits_type::length(__names[__matches[0]]); - for (size_t __i2 = 1; __i2 < __nmatches; ++__i2) - __minlen = std::min(__minlen, - __traits_type::length(__names[__matches[__i2]])); - ++__beg, ++__pos; - if (__pos < __minlen && __beg != __end) - for (size_t __i3 = 0; __i3 < __nmatches;) - { - __name = __names[__matches[__i3]]; - if (!(__name[__pos] == *__beg)) - __matches[__i3] = __matches[--__nmatches]; - else - ++__i3; - } - else - break; - } - - if (__nmatches == 1) - { - // Make sure found name is completely extracted. - ++__beg, ++__pos; - __name = __names[__matches[0]]; - const size_t __len = __traits_type::length(__name); - while (__pos < __len && __beg != __end && __name[__pos] == *__beg) - ++__beg, ++__pos; - - if (__len == __pos) - __member = __matches[0]; - else - __testvalid = false; - } - else - __testvalid = false; - if (!__testvalid) - __err |= ios_base::failbit; - - return __beg; - } - - template - _InIter - time_get<_CharT, _InIter>:: - _M_extract_wday_or_month(iter_type __beg, iter_type __end, int& __member, - const _CharT** __names, size_t __indexlen, - ios_base& __io, ios_base::iostate& __err) const - { - typedef char_traits<_CharT> __traits_type; - const locale& __loc = __io._M_getloc(); - const ctype<_CharT>& __ctype = use_facet >(__loc); - - int* __matches = static_cast(__builtin_alloca(2 * sizeof(int) - * __indexlen)); - size_t __nmatches = 0; - size_t* __matches_lengths = 0; - size_t __pos = 0; - - if (__beg != __end) - { - const char_type __c = *__beg; - for (size_t __i = 0; __i < 2 * __indexlen; ++__i) - if (__c == __names[__i][0] - || __c == __ctype.toupper(__names[__i][0])) - __matches[__nmatches++] = __i; - } - - if (__nmatches) - { - ++__beg, ++__pos; - - __matches_lengths - = static_cast(__builtin_alloca(sizeof(size_t) - * __nmatches)); - for (size_t __i = 0; __i < __nmatches; ++__i) - __matches_lengths[__i] - = __traits_type::length(__names[__matches[__i]]); - } - - for (; __beg != __end; ++__beg, ++__pos) - { - size_t __nskipped = 0; - const char_type __c = *__beg; - for (size_t __i = 0; __i < __nmatches;) - { - const char_type* __name = __names[__matches[__i]]; - if (__pos >= __matches_lengths[__i]) - ++__nskipped, ++__i; - else if (!(__name[__pos] == __c)) - { - --__nmatches; - __matches[__i] = __matches[__nmatches]; - __matches_lengths[__i] = __matches_lengths[__nmatches]; - } - else - ++__i; - } - if (__nskipped == __nmatches) - break; - } - - if ((__nmatches == 1 && __matches_lengths[0] == __pos) - || (__nmatches == 2 && (__matches_lengths[0] == __pos - || __matches_lengths[1] == __pos))) - __member = (__matches[0] >= __indexlen - ? __matches[0] - __indexlen : __matches[0]); - else - __err |= ios_base::failbit; - - return __beg; - } - - template - _InIter - time_get<_CharT, _InIter>:: - do_get_time(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm) const - { - const locale& __loc = __io._M_getloc(); - const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); - const char_type* __times[2]; - __tp._M_time_formats(__times); - __beg = _M_extract_via_format(__beg, __end, __io, __err, - __tm, __times[0]); - if (__beg == __end) - __err |= ios_base::eofbit; - return __beg; - } - - template - _InIter - time_get<_CharT, _InIter>:: - do_get_date(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm) const - { - const locale& __loc = __io._M_getloc(); - const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); - const char_type* __dates[2]; - __tp._M_date_formats(__dates); - __beg = _M_extract_via_format(__beg, __end, __io, __err, - __tm, __dates[0]); - if (__beg == __end) - __err |= ios_base::eofbit; - return __beg; - } - - template - _InIter - time_get<_CharT, _InIter>:: - do_get_weekday(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm) const - { - const locale& __loc = __io._M_getloc(); - const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); - const ctype<_CharT>& __ctype = use_facet >(__loc); - const char_type* __days[14]; - __tp._M_days_abbreviated(__days); - __tp._M_days(__days + 7); - int __tmpwday; - ios_base::iostate __tmperr = ios_base::goodbit; - - __beg = _M_extract_wday_or_month(__beg, __end, __tmpwday, __days, 7, - __io, __tmperr); - if (!__tmperr) - __tm->tm_wday = __tmpwday; - else - __err |= ios_base::failbit; - - if (__beg == __end) - __err |= ios_base::eofbit; - return __beg; - } - - template - _InIter - time_get<_CharT, _InIter>:: - do_get_monthname(iter_type __beg, iter_type __end, - ios_base& __io, ios_base::iostate& __err, tm* __tm) const - { - const locale& __loc = __io._M_getloc(); - const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); - const ctype<_CharT>& __ctype = use_facet >(__loc); - const char_type* __months[24]; - __tp._M_months_abbreviated(__months); - __tp._M_months(__months + 12); - int __tmpmon; - ios_base::iostate __tmperr = ios_base::goodbit; - - __beg = _M_extract_wday_or_month(__beg, __end, __tmpmon, __months, 12, - __io, __tmperr); - if (!__tmperr) - __tm->tm_mon = __tmpmon; - else - __err |= ios_base::failbit; - - if (__beg == __end) - __err |= ios_base::eofbit; - return __beg; - } - - template - _InIter - time_get<_CharT, _InIter>:: - do_get_year(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm) const - { - const locale& __loc = __io._M_getloc(); - const ctype<_CharT>& __ctype = use_facet >(__loc); - int __tmpyear; - ios_base::iostate __tmperr = ios_base::goodbit; - - __beg = _M_extract_num(__beg, __end, __tmpyear, 0, 9999, 4, - __io, __tmperr); - if (!__tmperr) - __tm->tm_year = __tmpyear < 0 ? __tmpyear + 100 : __tmpyear - 1900; - else - __err |= ios_base::failbit; - - if (__beg == __end) - __err |= ios_base::eofbit; - return __beg; - } - -#if __cplusplus >= 201103L - template - inline - _InIter - time_get<_CharT, _InIter>:: - get(iter_type __s, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm, const char_type* __fmt, - const char_type* __fmtend) const - { - const locale& __loc = __io._M_getloc(); - ctype<_CharT> const& __ctype = use_facet >(__loc); - __err = ios_base::goodbit; - while (__fmt != __fmtend && - __err == ios_base::goodbit) - { - if (__s == __end) - { - __err = ios_base::eofbit | ios_base::failbit; - break; - } - else if (__ctype.narrow(*__fmt, 0) == '%') - { - char __format; - char __mod = 0; - if (++__fmt == __fmtend) - { - __err = ios_base::failbit; - break; - } - const char __c = __ctype.narrow(*__fmt, 0); - if (__c != 'E' && __c != 'O') - __format = __c; - else if (++__fmt != __fmtend) - { - __mod = __c; - __format = __ctype.narrow(*__fmt, 0); - } - else - { - __err = ios_base::failbit; - break; - } - __s = this->do_get(__s, __end, __io, __err, __tm, __format, - __mod); - ++__fmt; - } - else if (__ctype.is(ctype_base::space, *__fmt)) - { - ++__fmt; - while (__fmt != __fmtend && - __ctype.is(ctype_base::space, *__fmt)) - ++__fmt; - - while (__s != __end && - __ctype.is(ctype_base::space, *__s)) - ++__s; - } - // TODO real case-insensitive comparison - else if (__ctype.tolower(*__s) == __ctype.tolower(*__fmt) || - __ctype.toupper(*__s) == __ctype.toupper(*__fmt)) - { - ++__s; - ++__fmt; - } - else - { - __err = ios_base::failbit; - break; - } - } - return __s; - } - - template - inline - _InIter - time_get<_CharT, _InIter>:: - do_get(iter_type __beg, iter_type __end, ios_base& __io, - ios_base::iostate& __err, tm* __tm, - char __format, char __mod) const - { - const locale& __loc = __io._M_getloc(); - ctype<_CharT> const& __ctype = use_facet >(__loc); - __err = ios_base::goodbit; - - char_type __fmt[4]; - __fmt[0] = __ctype.widen('%'); - if (!__mod) - { - __fmt[1] = __format; - __fmt[2] = char_type(); - } - else - { - __fmt[1] = __mod; - __fmt[2] = __format; - __fmt[3] = char_type(); - } - - __beg = _M_extract_via_format(__beg, __end, __io, __err, __tm, __fmt); - if (__beg == __end) - __err |= ios_base::eofbit; - return __beg; - } - -#endif // __cplusplus >= 201103L - - template - _OutIter - time_put<_CharT, _OutIter>:: - put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, - const _CharT* __beg, const _CharT* __end) const - { - const locale& __loc = __io._M_getloc(); - ctype<_CharT> const& __ctype = use_facet >(__loc); - for (; __beg != __end; ++__beg) - if (__ctype.narrow(*__beg, 0) != '%') - { - *__s = *__beg; - ++__s; - } - else if (++__beg != __end) - { - char __format; - char __mod = 0; - const char __c = __ctype.narrow(*__beg, 0); - if (__c != 'E' && __c != 'O') - __format = __c; - else if (++__beg != __end) - { - __mod = __c; - __format = __ctype.narrow(*__beg, 0); - } - else - break; - __s = this->do_put(__s, __io, __fill, __tm, __format, __mod); - } - else - break; - return __s; - } - - template - _OutIter - time_put<_CharT, _OutIter>:: - do_put(iter_type __s, ios_base& __io, char_type, const tm* __tm, - char __format, char __mod) const - { - const locale& __loc = __io._M_getloc(); - ctype<_CharT> const& __ctype = use_facet >(__loc); - __timepunct<_CharT> const& __tp = use_facet<__timepunct<_CharT> >(__loc); - - // NB: This size is arbitrary. Should this be a data member, - // initialized at construction? - const size_t __maxlen = 128; - char_type __res[__maxlen]; - - // NB: In IEE 1003.1-200x, and perhaps other locale models, it - // is possible that the format character will be longer than one - // character. Possibilities include 'E' or 'O' followed by a - // format character: if __mod is not the default argument, assume - // it's a valid modifier. - char_type __fmt[4]; - __fmt[0] = __ctype.widen('%'); - if (!__mod) - { - __fmt[1] = __format; - __fmt[2] = char_type(); - } - else - { - __fmt[1] = __mod; - __fmt[2] = __format; - __fmt[3] = char_type(); - } - - __tp._M_put(__res, __maxlen, __fmt, __tm); - - // Write resulting, fully-formatted string to output iterator. - return std::__write(__s, __res, char_traits::length(__res)); - } - - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template class moneypunct; - extern template class moneypunct; - extern template class moneypunct_byname; - extern template class moneypunct_byname; - extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_get; - extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_put; - extern template class __timepunct; - extern template class time_put; - extern template class time_put_byname; - extern template class time_get; - extern template class time_get_byname; - extern template class messages; - extern template class messages_byname; - - extern template - const moneypunct& - use_facet >(const locale&); - - extern template - const moneypunct& - use_facet >(const locale&); - - extern template - const money_put& - use_facet >(const locale&); - - extern template - const money_get& - use_facet >(const locale&); - - extern template - const __timepunct& - use_facet<__timepunct >(const locale&); - - extern template - const time_put& - use_facet >(const locale&); - - extern template - const time_get& - use_facet >(const locale&); - - extern template - const messages& - use_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet<__timepunct >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template class moneypunct; - extern template class moneypunct; - extern template class moneypunct_byname; - extern template class moneypunct_byname; - extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_get; - extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_put; - extern template class __timepunct; - extern template class time_put; - extern template class time_put_byname; - extern template class time_get; - extern template class time_get_byname; - extern template class messages; - extern template class messages_byname; - - extern template - const moneypunct& - use_facet >(const locale&); - - extern template - const moneypunct& - use_facet >(const locale&); - - extern template - const money_put& - use_facet >(const locale&); - - extern template - const money_get& - use_facet >(const locale&); - - extern template - const __timepunct& - use_facet<__timepunct >(const locale&); - - extern template - const time_put& - use_facet >(const locale&); - - extern template - const time_get& - use_facet >(const locale&); - - extern template - const messages& - use_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet<__timepunct >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); - - extern template - bool - has_facet >(const locale&); -#endif -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/localefwd.h b/openflow/usr/include/c++/5/bits/localefwd.h deleted file mode 100644 index e9d795f..0000000 --- a/openflow/usr/include/c++/5/bits/localefwd.h +++ /dev/null @@ -1,206 +0,0 @@ -// Forward declarations -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/localefwd.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{locale} - */ - -// -// ISO C++ 14882: 22.1 Locales -// - -#ifndef _LOCALE_FWD_H -#define _LOCALE_FWD_H 1 - -#pragma GCC system_header - -#include -#include // Defines __c_locale, config-specific include -#include // For ostreambuf_iterator, istreambuf_iterator -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @defgroup locales Locales - * - * Classes and functions for internationalization and localization. - */ - - // 22.1.1 Locale - class locale; - - template - bool - has_facet(const locale&) throw(); - - template - const _Facet& - use_facet(const locale&); - - // 22.1.3 Convenience interfaces - template - bool - isspace(_CharT, const locale&); - - template - bool - isprint(_CharT, const locale&); - - template - bool - iscntrl(_CharT, const locale&); - - template - bool - isupper(_CharT, const locale&); - - template - bool - islower(_CharT, const locale&); - - template - bool - isalpha(_CharT, const locale&); - - template - bool - isdigit(_CharT, const locale&); - - template - bool - ispunct(_CharT, const locale&); - - template - bool - isxdigit(_CharT, const locale&); - - template - bool - isalnum(_CharT, const locale&); - - template - bool - isgraph(_CharT, const locale&); - -#if __cplusplus >= 201103L - template - bool - isblank(_CharT, const locale&); -#endif - - template - _CharT - toupper(_CharT, const locale&); - - template - _CharT - tolower(_CharT, const locale&); - - // 22.2.1 and 22.2.1.3 ctype - class ctype_base; - template - class ctype; - template<> class ctype; -#ifdef _GLIBCXX_USE_WCHAR_T - template<> class ctype; -#endif - template - class ctype_byname; - // NB: Specialized for char and wchar_t in locale_facets.h. - - class codecvt_base; - template - class codecvt; - template<> class codecvt; -#ifdef _GLIBCXX_USE_WCHAR_T - template<> class codecvt; -#endif - template - class codecvt_byname; - - // 22.2.2 and 22.2.3 numeric -_GLIBCXX_BEGIN_NAMESPACE_LDBL - template > - class num_get; - template > - class num_put; -_GLIBCXX_END_NAMESPACE_LDBL -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - template class numpunct; - template class numpunct_byname; -_GLIBCXX_END_NAMESPACE_CXX11 - -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - // 22.2.4 collation - template - class collate; - template - class collate_byname; -_GLIBCXX_END_NAMESPACE_CXX11 - - // 22.2.5 date and time - class time_base; -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - template > - class time_get; - template > - class time_get_byname; -_GLIBCXX_END_NAMESPACE_CXX11 - template > - class time_put; - template > - class time_put_byname; - - // 22.2.6 money - class money_base; -_GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 - template > - class money_get; - template > - class money_put; -_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - template - class moneypunct; - template - class moneypunct_byname; -_GLIBCXX_END_NAMESPACE_CXX11 - - // 22.2.7 message retrieval - class messages_base; -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - template - class messages; - template - class messages_byname; -_GLIBCXX_END_NAMESPACE_CXX11 - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/mask_array.h b/openflow/usr/include/c++/5/bits/mask_array.h deleted file mode 100644 index 5078f17..0000000 --- a/openflow/usr/include/c++/5/bits/mask_array.h +++ /dev/null @@ -1,208 +0,0 @@ -// The template and inlines for the -*- C++ -*- mask_array class. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/mask_array.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{valarray} - */ - -// Written by Gabriel Dos Reis - -#ifndef _MASK_ARRAY_H -#define _MASK_ARRAY_H 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup numeric_arrays - * @{ - */ - - /** - * @brief Reference to selected subset of an array. - * - * A mask_array is a reference to the actual elements of an array specified - * by a bitmask in the form of an array of bool. The way to get a - * mask_array is to call operator[](valarray) on a valarray. The - * returned mask_array then permits carrying operations out on the - * referenced subset of elements in the original valarray. - * - * For example, if a mask_array is obtained using the array (false, true, - * false, true) as an argument, the mask array has two elements referring - * to array[1] and array[3] in the underlying array. - * - * @param Tp Element type. - */ - template - class mask_array - { - public: - typedef _Tp value_type; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 253. valarray helper functions are almost entirely useless - - /// Copy constructor. Both slices refer to the same underlying array. - mask_array (const mask_array&); - - /// Assignment operator. Assigns elements to corresponding elements - /// of @a a. - mask_array& operator=(const mask_array&); - - void operator=(const valarray<_Tp>&) const; - /// Multiply slice elements by corresponding elements of @a v. - void operator*=(const valarray<_Tp>&) const; - /// Divide slice elements by corresponding elements of @a v. - void operator/=(const valarray<_Tp>&) const; - /// Modulo slice elements by corresponding elements of @a v. - void operator%=(const valarray<_Tp>&) const; - /// Add corresponding elements of @a v to slice elements. - void operator+=(const valarray<_Tp>&) const; - /// Subtract corresponding elements of @a v from slice elements. - void operator-=(const valarray<_Tp>&) const; - /// Logical xor slice elements with corresponding elements of @a v. - void operator^=(const valarray<_Tp>&) const; - /// Logical and slice elements with corresponding elements of @a v. - void operator&=(const valarray<_Tp>&) const; - /// Logical or slice elements with corresponding elements of @a v. - void operator|=(const valarray<_Tp>&) const; - /// Left shift slice elements by corresponding elements of @a v. - void operator<<=(const valarray<_Tp>&) const; - /// Right shift slice elements by corresponding elements of @a v. - void operator>>=(const valarray<_Tp>&) const; - /// Assign all slice elements to @a t. - void operator=(const _Tp&) const; - - // ~mask_array (); - - template - void operator=(const _Expr<_Dom,_Tp>&) const; - template - void operator*=(const _Expr<_Dom,_Tp>&) const; - template - void operator/=(const _Expr<_Dom,_Tp>&) const; - template - void operator%=(const _Expr<_Dom,_Tp>&) const; - template - void operator+=(const _Expr<_Dom,_Tp>&) const; - template - void operator-=(const _Expr<_Dom,_Tp>&) const; - template - void operator^=(const _Expr<_Dom,_Tp>&) const; - template - void operator&=(const _Expr<_Dom,_Tp>&) const; - template - void operator|=(const _Expr<_Dom,_Tp>&) const; - template - void operator<<=(const _Expr<_Dom,_Tp>&) const; - template - void operator>>=(const _Expr<_Dom,_Tp>&) const; - - private: - mask_array(_Array<_Tp>, size_t, _Array); - friend class valarray<_Tp>; - - const size_t _M_sz; - const _Array _M_mask; - const _Array<_Tp> _M_array; - - // not implemented - mask_array(); - }; - - template - inline mask_array<_Tp>::mask_array(const mask_array<_Tp>& a) - : _M_sz(a._M_sz), _M_mask(a._M_mask), _M_array(a._M_array) {} - - template - inline - mask_array<_Tp>::mask_array(_Array<_Tp> __a, size_t __s, _Array __m) - : _M_sz(__s), _M_mask(__m), _M_array(__a) {} - - template - inline mask_array<_Tp>& - mask_array<_Tp>::operator=(const mask_array<_Tp>& __a) - { - std::__valarray_copy(__a._M_array, __a._M_mask, - _M_sz, _M_array, _M_mask); - return *this; - } - - template - inline void - mask_array<_Tp>::operator=(const _Tp& __t) const - { std::__valarray_fill(_M_array, _M_sz, _M_mask, __t); } - - template - inline void - mask_array<_Tp>::operator=(const valarray<_Tp>& __v) const - { std::__valarray_copy(_Array<_Tp>(__v), __v.size(), _M_array, _M_mask); } - - template - template - inline void - mask_array<_Tp>::operator=(const _Expr<_Ex, _Tp>& __e) const - { std::__valarray_copy(__e, __e.size(), _M_array, _M_mask); } - -#undef _DEFINE_VALARRAY_OPERATOR -#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \ - template \ - inline void \ - mask_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \ - { \ - _Array_augmented_##_Name(_M_array, _M_mask, \ - _Array<_Tp>(__v), __v.size()); \ - } \ - \ - template \ - template \ - inline void \ - mask_array<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) const\ - { \ - _Array_augmented_##_Name(_M_array, _M_mask, __e, __e.size()); \ - } - -_DEFINE_VALARRAY_OPERATOR(*, __multiplies) -_DEFINE_VALARRAY_OPERATOR(/, __divides) -_DEFINE_VALARRAY_OPERATOR(%, __modulus) -_DEFINE_VALARRAY_OPERATOR(+, __plus) -_DEFINE_VALARRAY_OPERATOR(-, __minus) -_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor) -_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and) -_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or) -_DEFINE_VALARRAY_OPERATOR(<<, __shift_left) -_DEFINE_VALARRAY_OPERATOR(>>, __shift_right) - -#undef _DEFINE_VALARRAY_OPERATOR - - // @} group numeric_arrays - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _MASK_ARRAY_H */ diff --git a/openflow/usr/include/c++/5/bits/memoryfwd.h b/openflow/usr/include/c++/5/bits/memoryfwd.h deleted file mode 100644 index bbee8d9..0000000 --- a/openflow/usr/include/c++/5/bits/memoryfwd.h +++ /dev/null @@ -1,78 +0,0 @@ -// Forward declarations -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * Copyright (c) 1996-1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/memoryfwd.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _MEMORYFWD_H -#define _MEMORYFWD_H 1 - -#pragma GCC system_header - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @defgroup allocators Allocators - * @ingroup memory - * - * Classes encapsulating memory operations. - * - * @{ - */ - - template - class allocator; - - template<> - class allocator; - - /// Declare uses_allocator so it can be specialized in \ etc. - template - struct uses_allocator; - - /// @} group memory - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/move.h b/openflow/usr/include/c++/5/bits/move.h deleted file mode 100644 index 1dfd667..0000000 --- a/openflow/usr/include/c++/5/bits/move.h +++ /dev/null @@ -1,208 +0,0 @@ -// Move, forward and identity for C++0x + swap -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/move.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{utility} - */ - -#ifndef _MOVE_H -#define _MOVE_H 1 - -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Used, in C++03 mode too, by allocators, etc. - /** - * @brief Same as C++11 std::addressof - * @ingroup utilities - */ - template - inline _Tp* - __addressof(_Tp& __r) _GLIBCXX_NOEXCEPT - { - return reinterpret_cast<_Tp*> - (&const_cast(reinterpret_cast(__r))); - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#if __cplusplus >= 201103L -#include // Brings in std::declval too. - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup utilities - * @{ - */ - - /** - * @brief Forward an lvalue. - * @return The parameter cast to the specified type. - * - * This function is used to implement "perfect forwarding". - */ - template - constexpr _Tp&& - forward(typename std::remove_reference<_Tp>::type& __t) noexcept - { return static_cast<_Tp&&>(__t); } - - /** - * @brief Forward an rvalue. - * @return The parameter cast to the specified type. - * - * This function is used to implement "perfect forwarding". - */ - template - constexpr _Tp&& - forward(typename std::remove_reference<_Tp>::type&& __t) noexcept - { - static_assert(!std::is_lvalue_reference<_Tp>::value, "template argument" - " substituting _Tp is an lvalue reference type"); - return static_cast<_Tp&&>(__t); - } - - /** - * @brief Convert a value to an rvalue. - * @param __t A thing of arbitrary type. - * @return The parameter cast to an rvalue-reference to allow moving it. - */ - template - constexpr typename std::remove_reference<_Tp>::type&& - move(_Tp&& __t) noexcept - { return static_cast::type&&>(__t); } - - - template - struct __move_if_noexcept_cond - : public __and_<__not_>, - is_copy_constructible<_Tp>>::type { }; - - /** - * @brief Conditionally convert a value to an rvalue. - * @param __x A thing of arbitrary type. - * @return The parameter, possibly cast to an rvalue-reference. - * - * Same as std::move unless the type's move constructor could throw and the - * type is copyable, in which case an lvalue-reference is returned instead. - */ - template - constexpr typename - conditional<__move_if_noexcept_cond<_Tp>::value, const _Tp&, _Tp&&>::type - move_if_noexcept(_Tp& __x) noexcept - { return std::move(__x); } - - // declval, from type_traits. - - /** - * @brief Returns the actual address of the object or function - * referenced by r, even in the presence of an overloaded - * operator&. - * @param __r Reference to an object or function. - * @return The actual address. - */ - template - inline _Tp* - addressof(_Tp& __r) noexcept - { return std::__addressof(__r); } - - // C++11 version of std::exchange for internal use. - template - inline _Tp - __exchange(_Tp& __obj, _Up&& __new_val) - { - _Tp __old_val = std::move(__obj); - __obj = std::forward<_Up>(__new_val); - return __old_val; - } - - /// @} group utilities -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#define _GLIBCXX_MOVE(__val) std::move(__val) -#define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val) -#else -#define _GLIBCXX_MOVE(__val) (__val) -#define _GLIBCXX_FORWARD(_Tp, __val) (__val) -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup utilities - * @{ - */ - - /** - * @brief Swaps two values. - * @param __a A thing of arbitrary type. - * @param __b Another thing of arbitrary type. - * @return Nothing. - */ - template - inline void - swap(_Tp& __a, _Tp& __b) -#if __cplusplus >= 201103L - noexcept(__and_, - is_nothrow_move_assignable<_Tp>>::value) -#endif - { - // concept requirements - __glibcxx_function_requires(_SGIAssignableConcept<_Tp>) - - _Tp __tmp = _GLIBCXX_MOVE(__a); - __a = _GLIBCXX_MOVE(__b); - __b = _GLIBCXX_MOVE(__tmp); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 809. std::swap should be overloaded for array types. - /// Swap the contents of two arrays. - template - inline void - swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) -#if __cplusplus >= 201103L - noexcept(noexcept(swap(*__a, *__b))) -#endif - { - for (size_t __n = 0; __n < _Nm; ++__n) - swap(__a[__n], __b[__n]); - } - - /// @} group utilities -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _MOVE_H */ diff --git a/openflow/usr/include/c++/5/bits/nested_exception.h b/openflow/usr/include/c++/5/bits/nested_exception.h deleted file mode 100644 index a716f75..0000000 --- a/openflow/usr/include/c++/5/bits/nested_exception.h +++ /dev/null @@ -1,173 +0,0 @@ -// Nested Exception support header (nested_exception class) for -*- C++ -*- - -// Copyright (C) 2009-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/nested_exception.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{exception} - */ - -#ifndef _GLIBCXX_NESTED_EXCEPTION_H -#define _GLIBCXX_NESTED_EXCEPTION_H 1 - -#pragma GCC visibility push(default) - -#if __cplusplus < 201103L -# include -#else - -#include - -#if ATOMIC_INT_LOCK_FREE < 2 -# error This platform does not support exception propagation. -#endif - -extern "C++" { - -namespace std -{ - /** - * @addtogroup exceptions - * @{ - */ - - /// Exception class with exception_ptr data member. - class nested_exception - { - exception_ptr _M_ptr; - - public: - nested_exception() noexcept : _M_ptr(current_exception()) { } - - nested_exception(const nested_exception&) noexcept = default; - - nested_exception& operator=(const nested_exception&) noexcept = default; - - virtual ~nested_exception() noexcept; - - [[noreturn]] - void - rethrow_nested() const - { - if (_M_ptr) - rethrow_exception(_M_ptr); - std::terminate(); - } - - exception_ptr - nested_ptr() const noexcept - { return _M_ptr; } - }; - - template - struct _Nested_exception : public _Except, public nested_exception - { - explicit _Nested_exception(const _Except& __ex) - : _Except(__ex) - { } - - explicit _Nested_exception(_Except&& __ex) - : _Except(static_cast<_Except&&>(__ex)) - { } - }; - - template - struct _Throw_with_nested_impl - { - template - static void _S_throw(_Up&& __t) - { throw _Nested_exception<_Tp>{static_cast<_Up&&>(__t)}; } - }; - - template - struct _Throw_with_nested_impl<_Tp, false> - { - template - static void _S_throw(_Up&& __t) - { throw static_cast<_Up&&>(__t); } - }; - - template - struct _Throw_with_nested_helper : _Throw_with_nested_impl<_Tp> - { }; - - template - struct _Throw_with_nested_helper<_Tp, false> - : _Throw_with_nested_impl<_Tp, false> - { }; - - template - struct _Throw_with_nested_helper<_Tp&, false> - : _Throw_with_nested_helper<_Tp> - { }; - - template - struct _Throw_with_nested_helper<_Tp&&, false> - : _Throw_with_nested_helper<_Tp> - { }; - - /// If @p __t is derived from nested_exception, throws @p __t. - /// Else, throws an implementation-defined object derived from both. - template - [[noreturn]] - inline void - throw_with_nested(_Tp&& __t) - { - _Throw_with_nested_helper<_Tp>::_S_throw(static_cast<_Tp&&>(__t)); - } - - template - struct _Rethrow_if_nested_impl - { - static void _S_rethrow(const _Tp& __t) - { - if (auto __tp = dynamic_cast(&__t)) - __tp->rethrow_nested(); - } - }; - - template - struct _Rethrow_if_nested_impl<_Tp, false> - { - static void _S_rethrow(const _Tp&) { } - }; - - /// If @p __ex is derived from nested_exception, @p __ex.rethrow_nested(). - template - inline void - rethrow_if_nested(const _Ex& __ex) - { - _Rethrow_if_nested_impl<_Ex>::_S_rethrow(__ex); - } - - // @} group exceptions -} // namespace std - -} // extern "C++" - -#endif // C++11 - -#pragma GCC visibility pop - -#endif // _GLIBCXX_NESTED_EXCEPTION_H diff --git a/openflow/usr/include/c++/5/bits/ostream.tcc b/openflow/usr/include/c++/5/bits/ostream.tcc deleted file mode 100644 index 50e7619..0000000 --- a/openflow/usr/include/c++/5/bits/ostream.tcc +++ /dev/null @@ -1,407 +0,0 @@ -// ostream classes -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/ostream.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{ostream} - */ - -// -// ISO C++ 14882: 27.6.2 Output streams -// - -#ifndef _OSTREAM_TCC -#define _OSTREAM_TCC 1 - -#pragma GCC system_header - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - basic_ostream<_CharT, _Traits>::sentry:: - sentry(basic_ostream<_CharT, _Traits>& __os) - : _M_ok(false), _M_os(__os) - { - // XXX MT - if (__os.tie() && __os.good()) - __os.tie()->flush(); - - if (__os.good()) - _M_ok = true; - else - __os.setstate(ios_base::failbit); - } - - template - template - basic_ostream<_CharT, _Traits>& - basic_ostream<_CharT, _Traits>:: - _M_insert(_ValueT __v) - { - sentry __cerb(*this); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - const __num_put_type& __np = __check_facet(this->_M_num_put); - if (__np.put(*this, *this, this->fill(), __v).failed()) - __err |= ios_base::badbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return *this; - } - - template - basic_ostream<_CharT, _Traits>& - basic_ostream<_CharT, _Traits>:: - operator<<(short __n) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 117. basic_ostream uses nonexistent num_put member functions. - const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield; - if (__fmt == ios_base::oct || __fmt == ios_base::hex) - return _M_insert(static_cast(static_cast(__n))); - else - return _M_insert(static_cast(__n)); - } - - template - basic_ostream<_CharT, _Traits>& - basic_ostream<_CharT, _Traits>:: - operator<<(int __n) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 117. basic_ostream uses nonexistent num_put member functions. - const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield; - if (__fmt == ios_base::oct || __fmt == ios_base::hex) - return _M_insert(static_cast(static_cast(__n))); - else - return _M_insert(static_cast(__n)); - } - - template - basic_ostream<_CharT, _Traits>& - basic_ostream<_CharT, _Traits>:: - operator<<(__streambuf_type* __sbin) - { - ios_base::iostate __err = ios_base::goodbit; - sentry __cerb(*this); - if (__cerb && __sbin) - { - __try - { - if (!__copy_streambufs(__sbin, this->rdbuf())) - __err |= ios_base::failbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::failbit); } - } - else if (!__sbin) - __err |= ios_base::badbit; - if (__err) - this->setstate(__err); - return *this; - } - - template - basic_ostream<_CharT, _Traits>& - basic_ostream<_CharT, _Traits>:: - put(char_type __c) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 60. What is a formatted input function? - // basic_ostream::put(char_type) is an unformatted output function. - // DR 63. Exception-handling policy for unformatted output. - // Unformatted output functions should catch exceptions thrown - // from streambuf members. - sentry __cerb(*this); - if (__cerb) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - const int_type __put = this->rdbuf()->sputc(__c); - if (traits_type::eq_int_type(__put, traits_type::eof())) - __err |= ios_base::badbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - } - return *this; - } - - template - basic_ostream<_CharT, _Traits>& - basic_ostream<_CharT, _Traits>:: - write(const _CharT* __s, streamsize __n) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 60. What is a formatted input function? - // basic_ostream::write(const char_type*, streamsize) is an - // unformatted output function. - // DR 63. Exception-handling policy for unformatted output. - // Unformatted output functions should catch exceptions thrown - // from streambuf members. - sentry __cerb(*this); - if (__cerb) - { - __try - { _M_write(__s, __n); } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - } - return *this; - } - - template - basic_ostream<_CharT, _Traits>& - basic_ostream<_CharT, _Traits>:: - flush() - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 60. What is a formatted input function? - // basic_ostream::flush() is *not* an unformatted output function. - ios_base::iostate __err = ios_base::goodbit; - __try - { - if (this->rdbuf() && this->rdbuf()->pubsync() == -1) - __err |= ios_base::badbit; - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - return *this; - } - - template - typename basic_ostream<_CharT, _Traits>::pos_type - basic_ostream<_CharT, _Traits>:: - tellp() - { - pos_type __ret = pos_type(-1); - __try - { - if (!this->fail()) - __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out); - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - return __ret; - } - - template - basic_ostream<_CharT, _Traits>& - basic_ostream<_CharT, _Traits>:: - seekp(pos_type __pos) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - if (!this->fail()) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 136. seekp, seekg setting wrong streams? - const pos_type __p = this->rdbuf()->pubseekpos(__pos, - ios_base::out); - - // 129. Need error indication from seekp() and seekg() - if (__p == pos_type(off_type(-1))) - __err |= ios_base::failbit; - } - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - return *this; - } - - template - basic_ostream<_CharT, _Traits>& - basic_ostream<_CharT, _Traits>:: - seekp(off_type __off, ios_base::seekdir __dir) - { - ios_base::iostate __err = ios_base::goodbit; - __try - { - if (!this->fail()) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 136. seekp, seekg setting wrong streams? - const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir, - ios_base::out); - - // 129. Need error indication from seekp() and seekg() - if (__p == pos_type(off_type(-1))) - __err |= ios_base::failbit; - } - } - __catch(__cxxabiv1::__forced_unwind&) - { - this->_M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { this->_M_setstate(ios_base::badbit); } - if (__err) - this->setstate(__err); - return *this; - } - - template - basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) - { - if (!__s) - __out.setstate(ios_base::badbit); - else - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 167. Improper use of traits_type::length() - const size_t __clen = char_traits::length(__s); - __try - { - struct __ptr_guard - { - _CharT *__p; - __ptr_guard (_CharT *__ip): __p(__ip) { } - ~__ptr_guard() { delete[] __p; } - _CharT* __get() { return __p; } - } __pg (new _CharT[__clen]); - - _CharT *__ws = __pg.__get(); - for (size_t __i = 0; __i < __clen; ++__i) - __ws[__i] = __out.widen(__s[__i]); - __ostream_insert(__out, __ws, __clen); - } - __catch(__cxxabiv1::__forced_unwind&) - { - __out._M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { __out._M_setstate(ios_base::badbit); } - } - return __out; - } - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template class basic_ostream; - extern template ostream& endl(ostream&); - extern template ostream& ends(ostream&); - extern template ostream& flush(ostream&); - extern template ostream& operator<<(ostream&, char); - extern template ostream& operator<<(ostream&, unsigned char); - extern template ostream& operator<<(ostream&, signed char); - extern template ostream& operator<<(ostream&, const char*); - extern template ostream& operator<<(ostream&, const unsigned char*); - extern template ostream& operator<<(ostream&, const signed char*); - - extern template ostream& ostream::_M_insert(long); - extern template ostream& ostream::_M_insert(unsigned long); - extern template ostream& ostream::_M_insert(bool); -#ifdef _GLIBCXX_USE_LONG_LONG - extern template ostream& ostream::_M_insert(long long); - extern template ostream& ostream::_M_insert(unsigned long long); -#endif - extern template ostream& ostream::_M_insert(double); - extern template ostream& ostream::_M_insert(long double); - extern template ostream& ostream::_M_insert(const void*); - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template class basic_ostream; - extern template wostream& endl(wostream&); - extern template wostream& ends(wostream&); - extern template wostream& flush(wostream&); - extern template wostream& operator<<(wostream&, wchar_t); - extern template wostream& operator<<(wostream&, char); - extern template wostream& operator<<(wostream&, const wchar_t*); - extern template wostream& operator<<(wostream&, const char*); - - extern template wostream& wostream::_M_insert(long); - extern template wostream& wostream::_M_insert(unsigned long); - extern template wostream& wostream::_M_insert(bool); -#ifdef _GLIBCXX_USE_LONG_LONG - extern template wostream& wostream::_M_insert(long long); - extern template wostream& wostream::_M_insert(unsigned long long); -#endif - extern template wostream& wostream::_M_insert(double); - extern template wostream& wostream::_M_insert(long double); - extern template wostream& wostream::_M_insert(const void*); -#endif -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/ostream_insert.h b/openflow/usr/include/c++/5/bits/ostream_insert.h deleted file mode 100644 index dd60145..0000000 --- a/openflow/usr/include/c++/5/bits/ostream_insert.h +++ /dev/null @@ -1,129 +0,0 @@ -// Helpers for ostream inserters -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/ostream_insert.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{ostream} - */ - -#ifndef _OSTREAM_INSERT_H -#define _OSTREAM_INSERT_H 1 - -#pragma GCC system_header - -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - inline void - __ostream_write(basic_ostream<_CharT, _Traits>& __out, - const _CharT* __s, streamsize __n) - { - typedef basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const streamsize __put = __out.rdbuf()->sputn(__s, __n); - if (__put != __n) - __out.setstate(__ios_base::badbit); - } - - template - inline void - __ostream_fill(basic_ostream<_CharT, _Traits>& __out, streamsize __n) - { - typedef basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const _CharT __c = __out.fill(); - for (; __n > 0; --__n) - { - const typename _Traits::int_type __put = __out.rdbuf()->sputc(__c); - if (_Traits::eq_int_type(__put, _Traits::eof())) - { - __out.setstate(__ios_base::badbit); - break; - } - } - } - - template - basic_ostream<_CharT, _Traits>& - __ostream_insert(basic_ostream<_CharT, _Traits>& __out, - const _CharT* __s, streamsize __n) - { - typedef basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - typename __ostream_type::sentry __cerb(__out); - if (__cerb) - { - __try - { - const streamsize __w = __out.width(); - if (__w > __n) - { - const bool __left = ((__out.flags() - & __ios_base::adjustfield) - == __ios_base::left); - if (!__left) - __ostream_fill(__out, __w - __n); - if (__out.good()) - __ostream_write(__out, __s, __n); - if (__left && __out.good()) - __ostream_fill(__out, __w - __n); - } - else - __ostream_write(__out, __s, __n); - __out.width(0); - } - __catch(__cxxabiv1::__forced_unwind&) - { - __out._M_setstate(__ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { __out._M_setstate(__ios_base::badbit); } - } - return __out; - } - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template ostream& __ostream_insert(ostream&, const char*, streamsize); - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template wostream& __ostream_insert(wostream&, const wchar_t*, - streamsize); -#endif -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif /* _OSTREAM_INSERT_H */ diff --git a/openflow/usr/include/c++/5/bits/parse_numbers.h b/openflow/usr/include/c++/5/bits/parse_numbers.h deleted file mode 100644 index 85ea4db..0000000 --- a/openflow/usr/include/c++/5/bits/parse_numbers.h +++ /dev/null @@ -1,288 +0,0 @@ -// Components for compile-time parsing of numbers -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/parse_numbers.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{chrono} - */ - -#ifndef _GLIBCXX_PARSE_NUMBERS_H -#define _GLIBCXX_PARSE_NUMBERS_H 1 - -#pragma GCC system_header - -// From n3642.pdf except I added binary literals and digit separator '\''. - -#if __cplusplus > 201103L - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -namespace __parse_int -{ - template - struct _Digit; - - template - struct _Digit<_Base, '0'> : integral_constant - { - using __valid = true_type; - }; - - template - struct _Digit<_Base, '1'> : integral_constant - { - using __valid = true_type; - }; - - template - struct _Digit_impl : integral_constant - { - static_assert(_Base > _Val, "invalid digit"); - using __valid = true_type; - }; - - template - struct _Digit<_Base, '2'> : _Digit_impl<_Base, 2> - { }; - - template - struct _Digit<_Base, '3'> : _Digit_impl<_Base, 3> - { }; - - template - struct _Digit<_Base, '4'> : _Digit_impl<_Base, 4> - { }; - - template - struct _Digit<_Base, '5'> : _Digit_impl<_Base, 5> - { }; - - template - struct _Digit<_Base, '6'> : _Digit_impl<_Base, 6> - { }; - - template - struct _Digit<_Base, '7'> : _Digit_impl<_Base, 7> - { }; - - template - struct _Digit<_Base, '8'> : _Digit_impl<_Base, 8> - { }; - - template - struct _Digit<_Base, '9'> : _Digit_impl<_Base, 9> - { }; - - template - struct _Digit<_Base, 'a'> : _Digit_impl<_Base, 0xa> - { }; - - template - struct _Digit<_Base, 'A'> : _Digit_impl<_Base, 0xa> - { }; - - template - struct _Digit<_Base, 'b'> : _Digit_impl<_Base, 0xb> - { }; - - template - struct _Digit<_Base, 'B'> : _Digit_impl<_Base, 0xb> - { }; - - template - struct _Digit<_Base, 'c'> : _Digit_impl<_Base, 0xc> - { }; - - template - struct _Digit<_Base, 'C'> : _Digit_impl<_Base, 0xc> - { }; - - template - struct _Digit<_Base, 'd'> : _Digit_impl<_Base, 0xd> - { }; - - template - struct _Digit<_Base, 'D'> : _Digit_impl<_Base, 0xd> - { }; - - template - struct _Digit<_Base, 'e'> : _Digit_impl<_Base, 0xe> - { }; - - template - struct _Digit<_Base, 'E'> : _Digit_impl<_Base, 0xe> - { }; - - template - struct _Digit<_Base, 'f'> : _Digit_impl<_Base, 0xf> - { }; - - template - struct _Digit<_Base, 'F'> : _Digit_impl<_Base, 0xf> - { }; - - // Digit separator - template - struct _Digit<_Base, '\''> : integral_constant - { - using __valid = false_type; - }; - -//------------------------------------------------------------------------------ - - template - using __ull_constant = integral_constant; - - template - struct _Power_help - { - using __next = typename _Power_help<_Base, _Digs...>::type; - using __valid_digit = typename _Digit<_Base, _Dig>::__valid; - using type - = __ull_constant<__next::value * (__valid_digit{} ? _Base : 1ULL)>; - }; - - template - struct _Power_help<_Base, _Dig> - { - using __valid_digit = typename _Digit<_Base, _Dig>::__valid; - using type = __ull_constant<__valid_digit::value>; - }; - - template - struct _Power : _Power_help<_Base, _Digs...>::type - { }; - - template - struct _Power<_Base> : __ull_constant<0> - { }; - -//------------------------------------------------------------------------------ - - template - struct _Number_help - { - using __digit = _Digit<_Base, _Dig>; - using __valid_digit = typename __digit::__valid; - using __next = _Number_help<_Base, - __valid_digit::value ? _Pow / _Base : _Pow, - _Digs...>; - using type = __ull_constant<_Pow * __digit::value + __next::type::value>; - static_assert((type::value / _Pow) == __digit::value, - "integer literal does not fit in unsigned long long"); - }; - - template - struct _Number_help<_Base, _Pow, _Dig> - { - //static_assert(_Pow == 1U, "power should be one"); - using type = __ull_constant<_Digit<_Base, _Dig>::value>; - }; - - template - struct _Number - : _Number_help<_Base, _Power<_Base, _Digs...>::value, _Digs...>::type - { }; - - template - struct _Number<_Base> - : __ull_constant<0> - { }; - -//------------------------------------------------------------------------------ - - template - struct _Parse_int; - - template - struct _Parse_int<'0', 'b', _Digs...> - : _Number<2U, _Digs...>::type - { }; - - template - struct _Parse_int<'0', 'B', _Digs...> - : _Number<2U, _Digs...>::type - { }; - - template - struct _Parse_int<'0', 'x', _Digs...> - : _Number<16U, _Digs...>::type - { }; - - template - struct _Parse_int<'0', 'X', _Digs...> - : _Number<16U, _Digs...>::type - { }; - - template - struct _Parse_int<'0', _Digs...> - : _Number<8U, _Digs...>::type - { }; - - template - struct _Parse_int - : _Number<10U, _Digs...>::type - { }; - -} // namespace __parse_int - - -namespace __select_int -{ - template - struct _Select_int_base; - - template - struct _Select_int_base<_Val, _IntType, _Ints...> - : conditional_t<(_Val <= std::numeric_limits<_IntType>::max()), - integral_constant<_IntType, _Val>, - _Select_int_base<_Val, _Ints...>> - { }; - - template - struct _Select_int_base<_Val> - { }; - - template - using _Select_int = typename _Select_int_base< - __parse_int::_Parse_int<_Digs...>::value, - unsigned char, - unsigned short, - unsigned int, - unsigned long, - unsigned long long - >::type; - -} // namespace __select_int - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif // __cplusplus > 201103L - -#endif // _GLIBCXX_PARSE_NUMBERS_H diff --git a/openflow/usr/include/c++/5/bits/postypes.h b/openflow/usr/include/c++/5/bits/postypes.h deleted file mode 100644 index 746bcb1..0000000 --- a/openflow/usr/include/c++/5/bits/postypes.h +++ /dev/null @@ -1,242 +0,0 @@ -// Position types -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/postypes.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iosfwd} - */ - -// -// ISO C++ 14882: 27.4.1 - Types -// ISO C++ 14882: 27.4.3 - Template class fpos -// - -#ifndef _GLIBCXX_POSTYPES_H -#define _GLIBCXX_POSTYPES_H 1 - -#pragma GCC system_header - -#include // For mbstate_t - -// XXX If is really needed, make sure to define the macros -// before including it, in order not to break (and -// in C++0x). Reconsider all this as soon as possible... -#if (defined(_GLIBCXX_HAVE_INT64_T) && !defined(_GLIBCXX_HAVE_INT64_T_LONG) \ - && !defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG)) - -#ifndef __STDC_LIMIT_MACROS -# define _UNDEF__STDC_LIMIT_MACROS -# define __STDC_LIMIT_MACROS -#endif -#ifndef __STDC_CONSTANT_MACROS -# define _UNDEF__STDC_CONSTANT_MACROS -# define __STDC_CONSTANT_MACROS -#endif -#include // For int64_t -#ifdef _UNDEF__STDC_LIMIT_MACROS -# undef __STDC_LIMIT_MACROS -# undef _UNDEF__STDC_LIMIT_MACROS -#endif -#ifdef _UNDEF__STDC_CONSTANT_MACROS -# undef __STDC_CONSTANT_MACROS -# undef _UNDEF__STDC_CONSTANT_MACROS -#endif - -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // The types streamoff, streampos and wstreampos and the class - // template fpos<> are described in clauses 21.1.2, 21.1.3, 27.1.2, - // 27.2, 27.4.1, 27.4.3 and D.6. Despite all this verbiage, the - // behaviour of these types is mostly implementation defined or - // unspecified. The behaviour in this implementation is as noted - // below. - - /** - * @brief Type used by fpos, char_traits, and char_traits. - * - * In clauses 21.1.3.1 and 27.4.1 streamoff is described as an - * implementation defined type. - * Note: In versions of GCC up to and including GCC 3.3, streamoff - * was typedef long. - */ -#ifdef _GLIBCXX_HAVE_INT64_T_LONG - typedef long streamoff; -#elif defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG) - typedef long long streamoff; -#elif defined(_GLIBCXX_HAVE_INT64_T) - typedef int64_t streamoff; -#else - typedef long long streamoff; -#endif - - /// Integral type for I/O operation counts and buffer sizes. - typedef ptrdiff_t streamsize; // Signed integral type - - /** - * @brief Class representing stream positions. - * - * The standard places no requirements upon the template parameter StateT. - * In this implementation StateT must be DefaultConstructible, - * CopyConstructible and Assignable. The standard only requires that fpos - * should contain a member of type StateT. In this implementation it also - * contains an offset stored as a signed integer. - * - * @param StateT Type passed to and returned from state(). - */ - template - class fpos - { - private: - streamoff _M_off; - _StateT _M_state; - - public: - // The standard doesn't require that fpos objects can be default - // constructed. This implementation provides a default - // constructor that initializes the offset to 0 and default - // constructs the state. - fpos() - : _M_off(0), _M_state() { } - - // The standard requires that fpos objects can be constructed - // from streamoff objects using the constructor syntax, and - // fails to give any meaningful semantics. In this - // implementation implicit conversion is also allowed, and this - // constructor stores the streamoff as the offset and default - // constructs the state. - /// Construct position from offset. - fpos(streamoff __off) - : _M_off(__off), _M_state() { } - - /// Convert to streamoff. - operator streamoff() const { return _M_off; } - - /// Remember the value of @a st. - void - state(_StateT __st) - { _M_state = __st; } - - /// Return the last set value of @a st. - _StateT - state() const - { return _M_state; } - - // The standard requires that this operator must be defined, but - // gives no semantics. In this implementation it just adds its - // argument to the stored offset and returns *this. - /// Add offset to this position. - fpos& - operator+=(streamoff __off) - { - _M_off += __off; - return *this; - } - - // The standard requires that this operator must be defined, but - // gives no semantics. In this implementation it just subtracts - // its argument from the stored offset and returns *this. - /// Subtract offset from this position. - fpos& - operator-=(streamoff __off) - { - _M_off -= __off; - return *this; - } - - // The standard requires that this operator must be defined, but - // defines its semantics only in terms of operator-. In this - // implementation it constructs a copy of *this, adds the - // argument to that copy using operator+= and then returns the - // copy. - /// Add position and offset. - fpos - operator+(streamoff __off) const - { - fpos __pos(*this); - __pos += __off; - return __pos; - } - - // The standard requires that this operator must be defined, but - // defines its semantics only in terms of operator+. In this - // implementation it constructs a copy of *this, subtracts the - // argument from that copy using operator-= and then returns the - // copy. - /// Subtract offset from position. - fpos - operator-(streamoff __off) const - { - fpos __pos(*this); - __pos -= __off; - return __pos; - } - - // The standard requires that this operator must be defined, but - // defines its semantics only in terms of operator+. In this - // implementation it returns the difference between the offset - // stored in *this and in the argument. - /// Subtract position to return offset. - streamoff - operator-(const fpos& __other) const - { return _M_off - __other._M_off; } - }; - - // The standard only requires that operator== must be an - // equivalence relation. In this implementation two fpos - // objects belong to the same equivalence class if the contained - // offsets compare equal. - /// Test if equivalent to another position. - template - inline bool - operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) - { return streamoff(__lhs) == streamoff(__rhs); } - - template - inline bool - operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) - { return streamoff(__lhs) != streamoff(__rhs); } - - // Clauses 21.1.3.1 and 21.1.3.2 describe streampos and wstreampos - // as implementation defined types, but clause 27.2 requires that - // they must both be typedefs for fpos - /// File position for char streams. - typedef fpos streampos; - /// File position for wchar_t streams. - typedef fpos wstreampos; - -#if __cplusplus >= 201103L - /// File position for char16_t streams. - typedef fpos u16streampos; - /// File position for char32_t streams. - typedef fpos u32streampos; -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/bits/predefined_ops.h b/openflow/usr/include/c++/5/bits/predefined_ops.h deleted file mode 100644 index 7178567..0000000 --- a/openflow/usr/include/c++/5/bits/predefined_ops.h +++ /dev/null @@ -1,307 +0,0 @@ -// Default predicates for internal use -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file predefined_ops.h - * This is an internal header file, included by other library headers. - * You should not attempt to use it directly. - */ - -#ifndef _GLIBCXX_PREDEFINED_OPS_H -#define _GLIBCXX_PREDEFINED_OPS_H 1 - -namespace __gnu_cxx -{ -namespace __ops -{ - struct _Iter_less_iter - { - template - _GLIBCXX14_CONSTEXPR - bool - operator()(_Iterator1 __it1, _Iterator2 __it2) const - { return *__it1 < *__it2; } - }; - _GLIBCXX14_CONSTEXPR - inline _Iter_less_iter - __iter_less_iter() - { return _Iter_less_iter(); } - - struct _Iter_less_val - { - template - bool - operator()(_Iterator __it, _Value& __val) const - { return *__it < __val; } - }; - - inline _Iter_less_val - __iter_less_val() - { return _Iter_less_val(); } - - inline _Iter_less_val - __iter_comp_val(_Iter_less_iter) - { return _Iter_less_val(); } - - struct _Val_less_iter - { - template - bool - operator()(_Value& __val, _Iterator __it) const - { return __val < *__it; } - }; - - inline _Val_less_iter - __val_less_iter() - { return _Val_less_iter(); } - - inline _Val_less_iter - __val_comp_iter(_Iter_less_iter) - { return _Val_less_iter(); } - - struct _Iter_equal_to_iter - { - template - bool - operator()(_Iterator1 __it1, _Iterator2 __it2) const - { return *__it1 == *__it2; } - }; - - inline _Iter_equal_to_iter - __iter_equal_to_iter() - { return _Iter_equal_to_iter(); } - - struct _Iter_equal_to_val - { - template - bool - operator()(_Iterator __it, _Value& __val) const - { return *__it == __val; } - }; - - inline _Iter_equal_to_val - __iter_equal_to_val() - { return _Iter_equal_to_val(); } - - inline _Iter_equal_to_val - __iter_comp_val(_Iter_equal_to_iter) - { return _Iter_equal_to_val(); } - - template - struct _Iter_comp_iter - { - _Compare _M_comp; - _GLIBCXX14_CONSTEXPR - _Iter_comp_iter(_Compare __comp) - : _M_comp(__comp) - { } - - template - _GLIBCXX14_CONSTEXPR - bool - operator()(_Iterator1 __it1, _Iterator2 __it2) - { return bool(_M_comp(*__it1, *__it2)); } - }; - - template - _GLIBCXX14_CONSTEXPR - inline _Iter_comp_iter<_Compare> - __iter_comp_iter(_Compare __comp) - { return _Iter_comp_iter<_Compare>(__comp); } - - template - struct _Iter_comp_val - { - _Compare _M_comp; - - _Iter_comp_val(_Compare __comp) - : _M_comp(__comp) - { } - - template - bool - operator()(_Iterator __it, _Value& __val) - { return bool(_M_comp(*__it, __val)); } - }; - - template - inline _Iter_comp_val<_Compare> - __iter_comp_val(_Compare __comp) - { return _Iter_comp_val<_Compare>(__comp); } - - template - inline _Iter_comp_val<_Compare> - __iter_comp_val(_Iter_comp_iter<_Compare> __comp) - { return _Iter_comp_val<_Compare>(__comp._M_comp); } - - template - struct _Val_comp_iter - { - _Compare _M_comp; - - _Val_comp_iter(_Compare __comp) - : _M_comp(__comp) - { } - - template - bool - operator()(_Value& __val, _Iterator __it) - { return bool(_M_comp(__val, *__it)); } - }; - - template - inline _Val_comp_iter<_Compare> - __val_comp_iter(_Compare __comp) - { return _Val_comp_iter<_Compare>(__comp); } - - template - inline _Val_comp_iter<_Compare> - __val_comp_iter(_Iter_comp_iter<_Compare> __comp) - { return _Val_comp_iter<_Compare>(__comp._M_comp); } - - template - struct _Iter_equals_val - { - _Value& _M_value; - - _Iter_equals_val(_Value& __value) - : _M_value(__value) - { } - - template - bool - operator()(_Iterator __it) - { return *__it == _M_value; } - }; - - template - inline _Iter_equals_val<_Value> - __iter_equals_val(_Value& __val) - { return _Iter_equals_val<_Value>(__val); } - - template - struct _Iter_equals_iter - { - typename std::iterator_traits<_Iterator1>::reference _M_ref; - - _Iter_equals_iter(_Iterator1 __it1) - : _M_ref(*__it1) - { } - - template - bool - operator()(_Iterator2 __it2) - { return *__it2 == _M_ref; } - }; - - template - inline _Iter_equals_iter<_Iterator> - __iter_comp_iter(_Iter_equal_to_iter, _Iterator __it) - { return _Iter_equals_iter<_Iterator>(__it); } - - template - struct _Iter_pred - { - _Predicate _M_pred; - - _Iter_pred(_Predicate __pred) - : _M_pred(__pred) - { } - - template - bool - operator()(_Iterator __it) - { return bool(_M_pred(*__it)); } - }; - - template - inline _Iter_pred<_Predicate> - __pred_iter(_Predicate __pred) - { return _Iter_pred<_Predicate>(__pred); } - - template - struct _Iter_comp_to_val - { - _Compare _M_comp; - _Value& _M_value; - - _Iter_comp_to_val(_Compare __comp, _Value& __value) - : _M_comp(__comp), _M_value(__value) - { } - - template - bool - operator()(_Iterator __it) - { return bool(_M_comp(*__it, _M_value)); } - }; - - template - _Iter_comp_to_val<_Compare, _Value> - __iter_comp_val(_Compare __comp, _Value &__val) - { return _Iter_comp_to_val<_Compare, _Value>(__comp, __val); } - - template - struct _Iter_comp_to_iter - { - _Compare _M_comp; - typename std::iterator_traits<_Iterator1>::reference _M_ref; - - _Iter_comp_to_iter(_Compare __comp, _Iterator1 __it1) - : _M_comp(__comp), _M_ref(*__it1) - { } - - template - bool - operator()(_Iterator2 __it2) - { return bool(_M_comp(*__it2, _M_ref)); } - }; - - template - inline _Iter_comp_to_iter<_Compare, _Iterator> - __iter_comp_iter(_Iter_comp_iter<_Compare> __comp, _Iterator __it) - { return _Iter_comp_to_iter<_Compare, _Iterator>(__comp._M_comp, __it); } - - template - struct _Iter_negate - { - _Predicate _M_pred; - - _Iter_negate(_Predicate __pred) - : _M_pred(__pred) - { } - - template - bool - operator()(_Iterator __it) - { return !bool(_M_pred(*__it)); } - }; - - template - inline _Iter_negate<_Predicate> - __negate(_Iter_pred<_Predicate> __pred) - { return _Iter_negate<_Predicate>(__pred._M_pred); } - -} // namespace __ops -} // namespace __gnu_cxx - -#endif diff --git a/openflow/usr/include/c++/5/bits/ptr_traits.h b/openflow/usr/include/c++/5/bits/ptr_traits.h deleted file mode 100644 index 9fd6bf8..0000000 --- a/openflow/usr/include/c++/5/bits/ptr_traits.h +++ /dev/null @@ -1,177 +0,0 @@ -// Pointer Traits -*- C++ -*- - -// Copyright (C) 2011-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/ptr_traits.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _PTR_TRAITS_H -#define _PTR_TRAITS_H 1 - -#if __cplusplus >= 201103L - -#include // For _GLIBCXX_HAS_NESTED_TYPE - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -_GLIBCXX_HAS_NESTED_TYPE(element_type) -_GLIBCXX_HAS_NESTED_TYPE(difference_type) - - template::value> - struct __ptrtr_elt_type; - - template - struct __ptrtr_elt_type<_Tp, true> - { - typedef typename _Tp::element_type __type; - }; - - template class _SomePtr, typename _Tp, - typename... _Args> - struct __ptrtr_elt_type<_SomePtr<_Tp, _Args...>, false> - { - typedef _Tp __type; - }; - - template::value> - struct __ptrtr_diff_type - { - typedef typename _Tp::difference_type __type; - }; - - template - struct __ptrtr_diff_type<_Tp, false> - { - typedef ptrdiff_t __type; - }; - - template - class __ptrtr_rebind_helper - { - template - static constexpr true_type - _S_chk(typename _Ptr2::template rebind<_Up2>*); - - template - static constexpr false_type - _S_chk(...); - - public: - using __type = decltype(_S_chk<_Ptr, _Up>(nullptr)); - }; - - template::__type::value> - struct __ptrtr_rebind; - - template - struct __ptrtr_rebind<_Tp, _Up, true> - { - typedef typename _Tp::template rebind<_Up> __type; - }; - - template class _SomePtr, typename _Up, - typename _Tp, typename... _Args> - struct __ptrtr_rebind<_SomePtr<_Tp, _Args...>, _Up, false> - { - typedef _SomePtr<_Up, _Args...> __type; - }; - - template::type> - struct __ptrtr_not_void - { - typedef _Tp __type; - }; - - template - struct __ptrtr_not_void<_Tp, void> - { - struct __type { }; - }; - - template - class __ptrtr_pointer_to - { - typedef typename __ptrtr_elt_type<_Ptr>::__type __orig_type; - typedef typename __ptrtr_not_void<__orig_type>::__type __element_type; - - public: - static _Ptr pointer_to(__element_type& __e) - { return _Ptr::pointer_to(__e); } - }; - - /** - * @brief Uniform interface to all pointer-like types - * @ingroup pointer_abstractions - */ - template - struct pointer_traits : __ptrtr_pointer_to<_Ptr> - { - /// The pointer type - typedef _Ptr pointer; - /// The type pointed to - typedef typename __ptrtr_elt_type<_Ptr>::__type element_type; - /// Type used to represent the difference between two pointers - typedef typename __ptrtr_diff_type<_Ptr>::__type difference_type; - - template - using rebind = typename __ptrtr_rebind<_Ptr, _Up>::__type; - }; - - /** - * @brief Partial specialization for built-in pointers. - * @ingroup pointer_abstractions - */ - template - struct pointer_traits<_Tp*> - { - /// The pointer type - typedef _Tp* pointer; - /// The type pointed to - typedef _Tp element_type; - /// Type used to represent the difference between two pointers - typedef ptrdiff_t difference_type; - - template - using rebind = _Up*; - - /** - * @brief Obtain a pointer to an object - * @param __r A reference to an object of type @c element_type - * @return @c addressof(__r) - */ - static pointer - pointer_to(typename __ptrtr_not_void::__type& __r) noexcept - { return std::addressof(__r); } - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif - -#endif diff --git a/openflow/usr/include/c++/5/bits/quoted_string.h b/openflow/usr/include/c++/5/bits/quoted_string.h deleted file mode 100644 index 7e75ce4..0000000 --- a/openflow/usr/include/c++/5/bits/quoted_string.h +++ /dev/null @@ -1,164 +0,0 @@ -// Helpers for quoted stream manipulators -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/quoted_string.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iomanip} - */ - -#ifndef _GLIBCXX_QUOTED_STRING_H -#define _GLIBCXX_QUOTED_STRING_H 1 - -#pragma GCC system_header - -#if __cplusplus < 201103L -# include -#else -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ - namespace __detail { - _GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @brief Struct for delimited strings. - */ - template - struct _Quoted_string - { - static_assert(is_reference<_String>::value - || is_pointer<_String>::value, - "String type must be pointer or reference"); - - _Quoted_string(_String __str, _CharT __del, _CharT __esc) - : _M_string(__str), _M_delim{__del}, _M_escape{__esc} - { } - - _Quoted_string& - operator=(_Quoted_string&) = delete; - - _String _M_string; - _CharT _M_delim; - _CharT _M_escape; - }; - - /** - * @brief Inserter for quoted strings. - * - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * DR 2344 quoted()'s interaction with padding is unclear - */ - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const _Quoted_string& __str) - { - std::basic_ostringstream<_CharT, _Traits> __ostr; - __ostr << __str._M_delim; - for (const _CharT* __c = __str._M_string; *__c; ++__c) - { - if (*__c == __str._M_delim || *__c == __str._M_escape) - __ostr << __str._M_escape; - __ostr << *__c; - } - __ostr << __str._M_delim; - - return __os << __ostr.str(); - } - - /** - * @brief Inserter for quoted strings. - * - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * DR 2344 quoted()'s interaction with padding is unclear - */ - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const _Quoted_string<_String, _CharT>& __str) - { - std::basic_ostringstream<_CharT, _Traits> __ostr; - __ostr << __str._M_delim; - for (auto& __c : __str._M_string) - { - if (__c == __str._M_delim || __c == __str._M_escape) - __ostr << __str._M_escape; - __ostr << __c; - } - __ostr << __str._M_delim; - - return __os << __ostr.str(); - } - - /** - * @brief Extractor for delimited strings. - * The left and right delimiters can be different. - */ - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - const _Quoted_string&, - _CharT>& __str) - { - _CharT __c; - __is >> __c; - if (!__is.good()) - return __is; - if (__c != __str._M_delim) - { - __is.unget(); - __is >> __str._M_string; - return __is; - } - __str._M_string.clear(); - std::ios_base::fmtflags __flags - = __is.flags(__is.flags() & ~std::ios_base::skipws); - do - { - __is >> __c; - if (!__is.good()) - break; - if (__c == __str._M_escape) - { - __is >> __c; - if (!__is.good()) - break; - } - else if (__c == __str._M_delim) - break; - __str._M_string += __c; - } - while (true); - __is.setf(__flags); - - return __is; - } - - _GLIBCXX_END_NAMESPACE_VERSION - } // namespace __detail -} // namespace std - -#endif // C++11 -#endif /* _GLIBCXX_QUOTED_STRING_H */ diff --git a/openflow/usr/include/c++/5/bits/random.h b/openflow/usr/include/c++/5/bits/random.h deleted file mode 100644 index 8caade5..0000000 --- a/openflow/usr/include/c++/5/bits/random.h +++ /dev/null @@ -1,6068 +0,0 @@ -// random number generation -*- C++ -*- - -// Copyright (C) 2009-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file bits/random.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{random} - */ - -#ifndef _RANDOM_H -#define _RANDOM_H 1 - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // [26.4] Random number generation - - /** - * @defgroup random Random Number Generation - * @ingroup numerics - * - * A facility for generating random numbers on selected distributions. - * @{ - */ - - /** - * @brief A function template for converting the output of a (integral) - * uniform random number generator to a floatng point result in the range - * [0-1). - */ - template - _RealType - generate_canonical(_UniformRandomNumberGenerator& __g); - -_GLIBCXX_END_NAMESPACE_VERSION - - /* - * Implementation-space details. - */ - namespace __detail - { - _GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - (std::numeric_limits<_UIntType>::digits)> - struct _Shift - { static const _UIntType __value = 0; }; - - template - struct _Shift<_UIntType, __w, true> - { static const _UIntType __value = _UIntType(1) << __w; }; - - template - struct _Select_uint_least_t - { - static_assert(__which < 0, /* needs to be dependent */ - "sorry, would be too much trouble for a slow result"); - }; - - template - struct _Select_uint_least_t<__s, 4> - { typedef unsigned int type; }; - - template - struct _Select_uint_least_t<__s, 3> - { typedef unsigned long type; }; - - template - struct _Select_uint_least_t<__s, 2> - { typedef unsigned long long type; }; - -#ifdef _GLIBCXX_USE_INT128 - template - struct _Select_uint_least_t<__s, 1> - { typedef unsigned __int128 type; }; -#endif - - // Assume a != 0, a < m, c < m, x < m. - template= __m - 1), - bool __schrage_ok = __m % __a < __m / __a> - struct _Mod - { - typedef typename _Select_uint_least_t::type _Tp2; - static _Tp - __calc(_Tp __x) - { return static_cast<_Tp>((_Tp2(__a) * __x + __c) % __m); } - }; - - // Schrage. - template - struct _Mod<_Tp, __m, __a, __c, false, true> - { - static _Tp - __calc(_Tp __x); - }; - - // Special cases: - // - for m == 2^n or m == 0, unsigned integer overflow is safe. - // - a * (m - 1) + c fits in _Tp, there is no overflow. - template - struct _Mod<_Tp, __m, __a, __c, true, __s> - { - static _Tp - __calc(_Tp __x) - { - _Tp __res = __a * __x + __c; - if (__m) - __res %= __m; - return __res; - } - }; - - template - inline _Tp - __mod(_Tp __x) - { return _Mod<_Tp, __m, __a, __c>::__calc(__x); } - - /* Determine whether number is a power of 2. */ - template - inline bool - _Power_of_2(_Tp __x) - { - return ((__x - 1) & __x) == 0; - }; - - /* - * An adaptor class for converting the output of any Generator into - * the input for a specific Distribution. - */ - template - struct _Adaptor - { - static_assert(std::is_floating_point<_DInputType>::value, - "template argument not a floating point type"); - - public: - _Adaptor(_Engine& __g) - : _M_g(__g) { } - - _DInputType - min() const - { return _DInputType(0); } - - _DInputType - max() const - { return _DInputType(1); } - - /* - * Converts a value generated by the adapted random number generator - * into a value in the input domain for the dependent random number - * distribution. - */ - _DInputType - operator()() - { - return std::generate_canonical<_DInputType, - std::numeric_limits<_DInputType>::digits, - _Engine>(_M_g); - } - - private: - _Engine& _M_g; - }; - - _GLIBCXX_END_NAMESPACE_VERSION - } // namespace __detail - -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup random_generators Random Number Generators - * @ingroup random - * - * These classes define objects which provide random or pseudorandom - * numbers, either from a discrete or a continuous interval. The - * random number generator supplied as a part of this library are - * all uniform random number generators which provide a sequence of - * random number uniformly distributed over their range. - * - * A number generator is a function object with an operator() that - * takes zero arguments and returns a number. - * - * A compliant random number generator must satisfy the following - * requirements. - * - *
Random Number Generator Requirements
To be documented.
- * - * @{ - */ - - /** - * @brief A model of a linear congruential random number generator. - * - * A random number generator that produces pseudorandom numbers via - * linear function: - * @f[ - * x_{i+1}\leftarrow(ax_{i} + c) \bmod m - * @f] - * - * The template parameter @p _UIntType must be an unsigned integral type - * large enough to store values up to (__m-1). If the template parameter - * @p __m is 0, the modulus @p __m used is - * std::numeric_limits<_UIntType>::max() plus 1. Otherwise, the template - * parameters @p __a and @p __c must be less than @p __m. - * - * The size of the state is @f$1@f$. - */ - template - class linear_congruential_engine - { - static_assert(std::is_unsigned<_UIntType>::value, "template argument " - "substituting _UIntType not an unsigned integral type"); - static_assert(__m == 0u || (__a < __m && __c < __m), - "template argument substituting __m out of bounds"); - - public: - /** The type of the generated random value. */ - typedef _UIntType result_type; - - /** The multiplier. */ - static constexpr result_type multiplier = __a; - /** An increment. */ - static constexpr result_type increment = __c; - /** The modulus. */ - static constexpr result_type modulus = __m; - static constexpr result_type default_seed = 1u; - - /** - * @brief Constructs a %linear_congruential_engine random number - * generator engine with seed @p __s. The default seed value - * is 1. - * - * @param __s The initial seed value. - */ - explicit - linear_congruential_engine(result_type __s = default_seed) - { seed(__s); } - - /** - * @brief Constructs a %linear_congruential_engine random number - * generator engine seeded from the seed sequence @p __q. - * - * @param __q the seed sequence. - */ - template::value> - ::type> - explicit - linear_congruential_engine(_Sseq& __q) - { seed(__q); } - - /** - * @brief Reseeds the %linear_congruential_engine random number generator - * engine sequence to the seed @p __s. - * - * @param __s The new seed. - */ - void - seed(result_type __s = default_seed); - - /** - * @brief Reseeds the %linear_congruential_engine random number generator - * engine - * sequence using values from the seed sequence @p __q. - * - * @param __q the seed sequence. - */ - template - typename std::enable_if::value>::type - seed(_Sseq& __q); - - /** - * @brief Gets the smallest possible value in the output range. - * - * The minimum depends on the @p __c parameter: if it is zero, the - * minimum generated must be > 0, otherwise 0 is allowed. - */ - static constexpr result_type - min() - { return __c == 0u ? 1u : 0u; } - - /** - * @brief Gets the largest possible value in the output range. - */ - static constexpr result_type - max() - { return __m - 1u; } - - /** - * @brief Discard a sequence of random numbers. - */ - void - discard(unsigned long long __z) - { - for (; __z != 0ULL; --__z) - (*this)(); - } - - /** - * @brief Gets the next random number in the sequence. - */ - result_type - operator()() - { - _M_x = __detail::__mod<_UIntType, __m, __a, __c>(_M_x); - return _M_x; - } - - /** - * @brief Compares two linear congruential random number generator - * objects of the same type for equality. - * - * @param __lhs A linear congruential random number generator object. - * @param __rhs Another linear congruential random number generator - * object. - * - * @returns true if the infinite sequences of generated values - * would be equal, false otherwise. - */ - friend bool - operator==(const linear_congruential_engine& __lhs, - const linear_congruential_engine& __rhs) - { return __lhs._M_x == __rhs._M_x; } - - /** - * @brief Writes the textual representation of the state x(i) of x to - * @p __os. - * - * @param __os The output stream. - * @param __lcr A % linear_congruential_engine random number generator. - * @returns __os. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::linear_congruential_engine<_UIntType1, - __a1, __c1, __m1>& __lcr); - - /** - * @brief Sets the state of the engine by reading its textual - * representation from @p __is. - * - * The textual representation must have been previously written using - * an output stream whose imbued locale and whose type's template - * specialization arguments _CharT and _Traits were the same as those - * of @p __is. - * - * @param __is The input stream. - * @param __lcr A % linear_congruential_engine random number generator. - * @returns __is. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::linear_congruential_engine<_UIntType1, __a1, - __c1, __m1>& __lcr); - - private: - _UIntType _M_x; - }; - - /** - * @brief Compares two linear congruential random number generator - * objects of the same type for inequality. - * - * @param __lhs A linear congruential random number generator object. - * @param __rhs Another linear congruential random number generator - * object. - * - * @returns true if the infinite sequences of generated values - * would be different, false otherwise. - */ - template - inline bool - operator!=(const std::linear_congruential_engine<_UIntType, __a, - __c, __m>& __lhs, - const std::linear_congruential_engine<_UIntType, __a, - __c, __m>& __rhs) - { return !(__lhs == __rhs); } - - - /** - * A generalized feedback shift register discrete random number generator. - * - * This algorithm avoids multiplication and division and is designed to be - * friendly to a pipelined architecture. If the parameters are chosen - * correctly, this generator will produce numbers with a very long period and - * fairly good apparent entropy, although still not cryptographically strong. - * - * The best way to use this generator is with the predefined mt19937 class. - * - * This algorithm was originally invented by Makoto Matsumoto and - * Takuji Nishimura. - * - * @tparam __w Word size, the number of bits in each element of - * the state vector. - * @tparam __n The degree of recursion. - * @tparam __m The period parameter. - * @tparam __r The separation point bit index. - * @tparam __a The last row of the twist matrix. - * @tparam __u The first right-shift tempering matrix parameter. - * @tparam __d The first right-shift tempering matrix mask. - * @tparam __s The first left-shift tempering matrix parameter. - * @tparam __b The first left-shift tempering matrix mask. - * @tparam __t The second left-shift tempering matrix parameter. - * @tparam __c The second left-shift tempering matrix mask. - * @tparam __l The second right-shift tempering matrix parameter. - * @tparam __f Initialization multiplier. - */ - template - class mersenne_twister_engine - { - static_assert(std::is_unsigned<_UIntType>::value, "template argument " - "substituting _UIntType not an unsigned integral type"); - static_assert(1u <= __m && __m <= __n, - "template argument substituting __m out of bounds"); - static_assert(__r <= __w, "template argument substituting " - "__r out of bound"); - static_assert(__u <= __w, "template argument substituting " - "__u out of bound"); - static_assert(__s <= __w, "template argument substituting " - "__s out of bound"); - static_assert(__t <= __w, "template argument substituting " - "__t out of bound"); - static_assert(__l <= __w, "template argument substituting " - "__l out of bound"); - static_assert(__w <= std::numeric_limits<_UIntType>::digits, - "template argument substituting __w out of bound"); - static_assert(__a <= (__detail::_Shift<_UIntType, __w>::__value - 1), - "template argument substituting __a out of bound"); - static_assert(__b <= (__detail::_Shift<_UIntType, __w>::__value - 1), - "template argument substituting __b out of bound"); - static_assert(__c <= (__detail::_Shift<_UIntType, __w>::__value - 1), - "template argument substituting __c out of bound"); - static_assert(__d <= (__detail::_Shift<_UIntType, __w>::__value - 1), - "template argument substituting __d out of bound"); - static_assert(__f <= (__detail::_Shift<_UIntType, __w>::__value - 1), - "template argument substituting __f out of bound"); - - public: - /** The type of the generated random value. */ - typedef _UIntType result_type; - - // parameter values - static constexpr size_t word_size = __w; - static constexpr size_t state_size = __n; - static constexpr size_t shift_size = __m; - static constexpr size_t mask_bits = __r; - static constexpr result_type xor_mask = __a; - static constexpr size_t tempering_u = __u; - static constexpr result_type tempering_d = __d; - static constexpr size_t tempering_s = __s; - static constexpr result_type tempering_b = __b; - static constexpr size_t tempering_t = __t; - static constexpr result_type tempering_c = __c; - static constexpr size_t tempering_l = __l; - static constexpr result_type initialization_multiplier = __f; - static constexpr result_type default_seed = 5489u; - - // constructors and member function - explicit - mersenne_twister_engine(result_type __sd = default_seed) - { seed(__sd); } - - /** - * @brief Constructs a %mersenne_twister_engine random number generator - * engine seeded from the seed sequence @p __q. - * - * @param __q the seed sequence. - */ - template::value> - ::type> - explicit - mersenne_twister_engine(_Sseq& __q) - { seed(__q); } - - void - seed(result_type __sd = default_seed); - - template - typename std::enable_if::value>::type - seed(_Sseq& __q); - - /** - * @brief Gets the smallest possible value in the output range. - */ - static constexpr result_type - min() - { return 0; }; - - /** - * @brief Gets the largest possible value in the output range. - */ - static constexpr result_type - max() - { return __detail::_Shift<_UIntType, __w>::__value - 1; } - - /** - * @brief Discard a sequence of random numbers. - */ - void - discard(unsigned long long __z); - - result_type - operator()(); - - /** - * @brief Compares two % mersenne_twister_engine random number generator - * objects of the same type for equality. - * - * @param __lhs A % mersenne_twister_engine random number generator - * object. - * @param __rhs Another % mersenne_twister_engine random number - * generator object. - * - * @returns true if the infinite sequences of generated values - * would be equal, false otherwise. - */ - friend bool - operator==(const mersenne_twister_engine& __lhs, - const mersenne_twister_engine& __rhs) - { return (std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x) - && __lhs._M_p == __rhs._M_p); } - - /** - * @brief Inserts the current state of a % mersenne_twister_engine - * random number generator engine @p __x into the output stream - * @p __os. - * - * @param __os An output stream. - * @param __x A % mersenne_twister_engine random number generator - * engine. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::mersenne_twister_engine<_UIntType1, __w1, __n1, - __m1, __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1, - __l1, __f1>& __x); - - /** - * @brief Extracts the current state of a % mersenne_twister_engine - * random number generator engine @p __x from the input stream - * @p __is. - * - * @param __is An input stream. - * @param __x A % mersenne_twister_engine random number generator - * engine. - * - * @returns The input stream with the state of @p __x extracted or in - * an error state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::mersenne_twister_engine<_UIntType1, __w1, __n1, __m1, - __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1, - __l1, __f1>& __x); - - private: - void _M_gen_rand(); - - _UIntType _M_x[state_size]; - size_t _M_p; - }; - - /** - * @brief Compares two % mersenne_twister_engine random number generator - * objects of the same type for inequality. - * - * @param __lhs A % mersenne_twister_engine random number generator - * object. - * @param __rhs Another % mersenne_twister_engine random number - * generator object. - * - * @returns true if the infinite sequences of generated values - * would be different, false otherwise. - */ - template - inline bool - operator!=(const std::mersenne_twister_engine<_UIntType, __w, __n, __m, - __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __lhs, - const std::mersenne_twister_engine<_UIntType, __w, __n, __m, - __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __rhs) - { return !(__lhs == __rhs); } - - - /** - * @brief The Marsaglia-Zaman generator. - * - * This is a model of a Generalized Fibonacci discrete random number - * generator, sometimes referred to as the SWC generator. - * - * A discrete random number generator that produces pseudorandom - * numbers using: - * @f[ - * x_{i}\leftarrow(x_{i - s} - x_{i - r} - carry_{i-1}) \bmod m - * @f] - * - * The size of the state is @f$r@f$ - * and the maximum period of the generator is @f$(m^r - m^s - 1)@f$. - */ - template - class subtract_with_carry_engine - { - static_assert(std::is_unsigned<_UIntType>::value, "template argument " - "substituting _UIntType not an unsigned integral type"); - static_assert(0u < __s && __s < __r, - "template argument substituting __s out of bounds"); - static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits, - "template argument substituting __w out of bounds"); - - public: - /** The type of the generated random value. */ - typedef _UIntType result_type; - - // parameter values - static constexpr size_t word_size = __w; - static constexpr size_t short_lag = __s; - static constexpr size_t long_lag = __r; - static constexpr result_type default_seed = 19780503u; - - /** - * @brief Constructs an explicitly seeded % subtract_with_carry_engine - * random number generator. - */ - explicit - subtract_with_carry_engine(result_type __sd = default_seed) - { seed(__sd); } - - /** - * @brief Constructs a %subtract_with_carry_engine random number engine - * seeded from the seed sequence @p __q. - * - * @param __q the seed sequence. - */ - template::value> - ::type> - explicit - subtract_with_carry_engine(_Sseq& __q) - { seed(__q); } - - /** - * @brief Seeds the initial state @f$x_0@f$ of the random number - * generator. - * - * N1688[4.19] modifies this as follows. If @p __value == 0, - * sets value to 19780503. In any case, with a linear - * congruential generator lcg(i) having parameters @f$ m_{lcg} = - * 2147483563, a_{lcg} = 40014, c_{lcg} = 0, and lcg(0) = value - * @f$, sets @f$ x_{-r} \dots x_{-1} @f$ to @f$ lcg(1) \bmod m - * \dots lcg(r) \bmod m @f$ respectively. If @f$ x_{-1} = 0 @f$ - * set carry to 1, otherwise sets carry to 0. - */ - void - seed(result_type __sd = default_seed); - - /** - * @brief Seeds the initial state @f$x_0@f$ of the - * % subtract_with_carry_engine random number generator. - */ - template - typename std::enable_if::value>::type - seed(_Sseq& __q); - - /** - * @brief Gets the inclusive minimum value of the range of random - * integers returned by this generator. - */ - static constexpr result_type - min() - { return 0; } - - /** - * @brief Gets the inclusive maximum value of the range of random - * integers returned by this generator. - */ - static constexpr result_type - max() - { return __detail::_Shift<_UIntType, __w>::__value - 1; } - - /** - * @brief Discard a sequence of random numbers. - */ - void - discard(unsigned long long __z) - { - for (; __z != 0ULL; --__z) - (*this)(); - } - - /** - * @brief Gets the next random number in the sequence. - */ - result_type - operator()(); - - /** - * @brief Compares two % subtract_with_carry_engine random number - * generator objects of the same type for equality. - * - * @param __lhs A % subtract_with_carry_engine random number generator - * object. - * @param __rhs Another % subtract_with_carry_engine random number - * generator object. - * - * @returns true if the infinite sequences of generated values - * would be equal, false otherwise. - */ - friend bool - operator==(const subtract_with_carry_engine& __lhs, - const subtract_with_carry_engine& __rhs) - { return (std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x) - && __lhs._M_carry == __rhs._M_carry - && __lhs._M_p == __rhs._M_p); } - - /** - * @brief Inserts the current state of a % subtract_with_carry_engine - * random number generator engine @p __x into the output stream - * @p __os. - * - * @param __os An output stream. - * @param __x A % subtract_with_carry_engine random number generator - * engine. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::subtract_with_carry_engine<_UIntType1, __w1, - __s1, __r1>& __x); - - /** - * @brief Extracts the current state of a % subtract_with_carry_engine - * random number generator engine @p __x from the input stream - * @p __is. - * - * @param __is An input stream. - * @param __x A % subtract_with_carry_engine random number generator - * engine. - * - * @returns The input stream with the state of @p __x extracted or in - * an error state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::subtract_with_carry_engine<_UIntType1, __w1, - __s1, __r1>& __x); - - private: - /// The state of the generator. This is a ring buffer. - _UIntType _M_x[long_lag]; - _UIntType _M_carry; ///< The carry - size_t _M_p; ///< Current index of x(i - r). - }; - - /** - * @brief Compares two % subtract_with_carry_engine random number - * generator objects of the same type for inequality. - * - * @param __lhs A % subtract_with_carry_engine random number generator - * object. - * @param __rhs Another % subtract_with_carry_engine random number - * generator object. - * - * @returns true if the infinite sequences of generated values - * would be different, false otherwise. - */ - template - inline bool - operator!=(const std::subtract_with_carry_engine<_UIntType, __w, - __s, __r>& __lhs, - const std::subtract_with_carry_engine<_UIntType, __w, - __s, __r>& __rhs) - { return !(__lhs == __rhs); } - - - /** - * Produces random numbers from some base engine by discarding blocks of - * data. - * - * 0 <= @p __r <= @p __p - */ - template - class discard_block_engine - { - static_assert(1 <= __r && __r <= __p, - "template argument substituting __r out of bounds"); - - public: - /** The type of the generated random value. */ - typedef typename _RandomNumberEngine::result_type result_type; - - // parameter values - static constexpr size_t block_size = __p; - static constexpr size_t used_block = __r; - - /** - * @brief Constructs a default %discard_block_engine engine. - * - * The underlying engine is default constructed as well. - */ - discard_block_engine() - : _M_b(), _M_n(0) { } - - /** - * @brief Copy constructs a %discard_block_engine engine. - * - * Copies an existing base class random number generator. - * @param __rng An existing (base class) engine object. - */ - explicit - discard_block_engine(const _RandomNumberEngine& __rng) - : _M_b(__rng), _M_n(0) { } - - /** - * @brief Move constructs a %discard_block_engine engine. - * - * Copies an existing base class random number generator. - * @param __rng An existing (base class) engine object. - */ - explicit - discard_block_engine(_RandomNumberEngine&& __rng) - : _M_b(std::move(__rng)), _M_n(0) { } - - /** - * @brief Seed constructs a %discard_block_engine engine. - * - * Constructs the underlying generator engine seeded with @p __s. - * @param __s A seed value for the base class engine. - */ - explicit - discard_block_engine(result_type __s) - : _M_b(__s), _M_n(0) { } - - /** - * @brief Generator construct a %discard_block_engine engine. - * - * @param __q A seed sequence. - */ - template::value - && !std::is_same<_Sseq, _RandomNumberEngine>::value> - ::type> - explicit - discard_block_engine(_Sseq& __q) - : _M_b(__q), _M_n(0) - { } - - /** - * @brief Reseeds the %discard_block_engine object with the default - * seed for the underlying base class generator engine. - */ - void - seed() - { - _M_b.seed(); - _M_n = 0; - } - - /** - * @brief Reseeds the %discard_block_engine object with the default - * seed for the underlying base class generator engine. - */ - void - seed(result_type __s) - { - _M_b.seed(__s); - _M_n = 0; - } - - /** - * @brief Reseeds the %discard_block_engine object with the given seed - * sequence. - * @param __q A seed generator function. - */ - template - void - seed(_Sseq& __q) - { - _M_b.seed(__q); - _M_n = 0; - } - - /** - * @brief Gets a const reference to the underlying generator engine - * object. - */ - const _RandomNumberEngine& - base() const noexcept - { return _M_b; } - - /** - * @brief Gets the minimum value in the generated random number range. - */ - static constexpr result_type - min() - { return _RandomNumberEngine::min(); } - - /** - * @brief Gets the maximum value in the generated random number range. - */ - static constexpr result_type - max() - { return _RandomNumberEngine::max(); } - - /** - * @brief Discard a sequence of random numbers. - */ - void - discard(unsigned long long __z) - { - for (; __z != 0ULL; --__z) - (*this)(); - } - - /** - * @brief Gets the next value in the generated random number sequence. - */ - result_type - operator()(); - - /** - * @brief Compares two %discard_block_engine random number generator - * objects of the same type for equality. - * - * @param __lhs A %discard_block_engine random number generator object. - * @param __rhs Another %discard_block_engine random number generator - * object. - * - * @returns true if the infinite sequences of generated values - * would be equal, false otherwise. - */ - friend bool - operator==(const discard_block_engine& __lhs, - const discard_block_engine& __rhs) - { return __lhs._M_b == __rhs._M_b && __lhs._M_n == __rhs._M_n; } - - /** - * @brief Inserts the current state of a %discard_block_engine random - * number generator engine @p __x into the output stream - * @p __os. - * - * @param __os An output stream. - * @param __x A %discard_block_engine random number generator engine. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::discard_block_engine<_RandomNumberEngine1, - __p1, __r1>& __x); - - /** - * @brief Extracts the current state of a % subtract_with_carry_engine - * random number generator engine @p __x from the input stream - * @p __is. - * - * @param __is An input stream. - * @param __x A %discard_block_engine random number generator engine. - * - * @returns The input stream with the state of @p __x extracted or in - * an error state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::discard_block_engine<_RandomNumberEngine1, - __p1, __r1>& __x); - - private: - _RandomNumberEngine _M_b; - size_t _M_n; - }; - - /** - * @brief Compares two %discard_block_engine random number generator - * objects of the same type for inequality. - * - * @param __lhs A %discard_block_engine random number generator object. - * @param __rhs Another %discard_block_engine random number generator - * object. - * - * @returns true if the infinite sequences of generated values - * would be different, false otherwise. - */ - template - inline bool - operator!=(const std::discard_block_engine<_RandomNumberEngine, __p, - __r>& __lhs, - const std::discard_block_engine<_RandomNumberEngine, __p, - __r>& __rhs) - { return !(__lhs == __rhs); } - - - /** - * Produces random numbers by combining random numbers from some base - * engine to produce random numbers with a specifies number of bits @p __w. - */ - template - class independent_bits_engine - { - static_assert(std::is_unsigned<_UIntType>::value, "template argument " - "substituting _UIntType not an unsigned integral type"); - static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits, - "template argument substituting __w out of bounds"); - - public: - /** The type of the generated random value. */ - typedef _UIntType result_type; - - /** - * @brief Constructs a default %independent_bits_engine engine. - * - * The underlying engine is default constructed as well. - */ - independent_bits_engine() - : _M_b() { } - - /** - * @brief Copy constructs a %independent_bits_engine engine. - * - * Copies an existing base class random number generator. - * @param __rng An existing (base class) engine object. - */ - explicit - independent_bits_engine(const _RandomNumberEngine& __rng) - : _M_b(__rng) { } - - /** - * @brief Move constructs a %independent_bits_engine engine. - * - * Copies an existing base class random number generator. - * @param __rng An existing (base class) engine object. - */ - explicit - independent_bits_engine(_RandomNumberEngine&& __rng) - : _M_b(std::move(__rng)) { } - - /** - * @brief Seed constructs a %independent_bits_engine engine. - * - * Constructs the underlying generator engine seeded with @p __s. - * @param __s A seed value for the base class engine. - */ - explicit - independent_bits_engine(result_type __s) - : _M_b(__s) { } - - /** - * @brief Generator construct a %independent_bits_engine engine. - * - * @param __q A seed sequence. - */ - template::value - && !std::is_same<_Sseq, _RandomNumberEngine>::value> - ::type> - explicit - independent_bits_engine(_Sseq& __q) - : _M_b(__q) - { } - - /** - * @brief Reseeds the %independent_bits_engine object with the default - * seed for the underlying base class generator engine. - */ - void - seed() - { _M_b.seed(); } - - /** - * @brief Reseeds the %independent_bits_engine object with the default - * seed for the underlying base class generator engine. - */ - void - seed(result_type __s) - { _M_b.seed(__s); } - - /** - * @brief Reseeds the %independent_bits_engine object with the given - * seed sequence. - * @param __q A seed generator function. - */ - template - void - seed(_Sseq& __q) - { _M_b.seed(__q); } - - /** - * @brief Gets a const reference to the underlying generator engine - * object. - */ - const _RandomNumberEngine& - base() const noexcept - { return _M_b; } - - /** - * @brief Gets the minimum value in the generated random number range. - */ - static constexpr result_type - min() - { return 0U; } - - /** - * @brief Gets the maximum value in the generated random number range. - */ - static constexpr result_type - max() - { return __detail::_Shift<_UIntType, __w>::__value - 1; } - - /** - * @brief Discard a sequence of random numbers. - */ - void - discard(unsigned long long __z) - { - for (; __z != 0ULL; --__z) - (*this)(); - } - - /** - * @brief Gets the next value in the generated random number sequence. - */ - result_type - operator()(); - - /** - * @brief Compares two %independent_bits_engine random number generator - * objects of the same type for equality. - * - * @param __lhs A %independent_bits_engine random number generator - * object. - * @param __rhs Another %independent_bits_engine random number generator - * object. - * - * @returns true if the infinite sequences of generated values - * would be equal, false otherwise. - */ - friend bool - operator==(const independent_bits_engine& __lhs, - const independent_bits_engine& __rhs) - { return __lhs._M_b == __rhs._M_b; } - - /** - * @brief Extracts the current state of a % subtract_with_carry_engine - * random number generator engine @p __x from the input stream - * @p __is. - * - * @param __is An input stream. - * @param __x A %independent_bits_engine random number generator - * engine. - * - * @returns The input stream with the state of @p __x extracted or in - * an error state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::independent_bits_engine<_RandomNumberEngine, - __w, _UIntType>& __x) - { - __is >> __x._M_b; - return __is; - } - - private: - _RandomNumberEngine _M_b; - }; - - /** - * @brief Compares two %independent_bits_engine random number generator - * objects of the same type for inequality. - * - * @param __lhs A %independent_bits_engine random number generator - * object. - * @param __rhs Another %independent_bits_engine random number generator - * object. - * - * @returns true if the infinite sequences of generated values - * would be different, false otherwise. - */ - template - inline bool - operator!=(const std::independent_bits_engine<_RandomNumberEngine, __w, - _UIntType>& __lhs, - const std::independent_bits_engine<_RandomNumberEngine, __w, - _UIntType>& __rhs) - { return !(__lhs == __rhs); } - - /** - * @brief Inserts the current state of a %independent_bits_engine random - * number generator engine @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %independent_bits_engine random number generator engine. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::independent_bits_engine<_RandomNumberEngine, - __w, _UIntType>& __x) - { - __os << __x.base(); - return __os; - } - - - /** - * @brief Produces random numbers by combining random numbers from some - * base engine to produce random numbers with a specifies number of bits - * @p __w. - */ - template - class shuffle_order_engine - { - static_assert(1u <= __k, "template argument substituting " - "__k out of bound"); - - public: - /** The type of the generated random value. */ - typedef typename _RandomNumberEngine::result_type result_type; - - static constexpr size_t table_size = __k; - - /** - * @brief Constructs a default %shuffle_order_engine engine. - * - * The underlying engine is default constructed as well. - */ - shuffle_order_engine() - : _M_b() - { _M_initialize(); } - - /** - * @brief Copy constructs a %shuffle_order_engine engine. - * - * Copies an existing base class random number generator. - * @param __rng An existing (base class) engine object. - */ - explicit - shuffle_order_engine(const _RandomNumberEngine& __rng) - : _M_b(__rng) - { _M_initialize(); } - - /** - * @brief Move constructs a %shuffle_order_engine engine. - * - * Copies an existing base class random number generator. - * @param __rng An existing (base class) engine object. - */ - explicit - shuffle_order_engine(_RandomNumberEngine&& __rng) - : _M_b(std::move(__rng)) - { _M_initialize(); } - - /** - * @brief Seed constructs a %shuffle_order_engine engine. - * - * Constructs the underlying generator engine seeded with @p __s. - * @param __s A seed value for the base class engine. - */ - explicit - shuffle_order_engine(result_type __s) - : _M_b(__s) - { _M_initialize(); } - - /** - * @brief Generator construct a %shuffle_order_engine engine. - * - * @param __q A seed sequence. - */ - template::value - && !std::is_same<_Sseq, _RandomNumberEngine>::value> - ::type> - explicit - shuffle_order_engine(_Sseq& __q) - : _M_b(__q) - { _M_initialize(); } - - /** - * @brief Reseeds the %shuffle_order_engine object with the default seed - for the underlying base class generator engine. - */ - void - seed() - { - _M_b.seed(); - _M_initialize(); - } - - /** - * @brief Reseeds the %shuffle_order_engine object with the default seed - * for the underlying base class generator engine. - */ - void - seed(result_type __s) - { - _M_b.seed(__s); - _M_initialize(); - } - - /** - * @brief Reseeds the %shuffle_order_engine object with the given seed - * sequence. - * @param __q A seed generator function. - */ - template - void - seed(_Sseq& __q) - { - _M_b.seed(__q); - _M_initialize(); - } - - /** - * Gets a const reference to the underlying generator engine object. - */ - const _RandomNumberEngine& - base() const noexcept - { return _M_b; } - - /** - * Gets the minimum value in the generated random number range. - */ - static constexpr result_type - min() - { return _RandomNumberEngine::min(); } - - /** - * Gets the maximum value in the generated random number range. - */ - static constexpr result_type - max() - { return _RandomNumberEngine::max(); } - - /** - * Discard a sequence of random numbers. - */ - void - discard(unsigned long long __z) - { - for (; __z != 0ULL; --__z) - (*this)(); - } - - /** - * Gets the next value in the generated random number sequence. - */ - result_type - operator()(); - - /** - * Compares two %shuffle_order_engine random number generator objects - * of the same type for equality. - * - * @param __lhs A %shuffle_order_engine random number generator object. - * @param __rhs Another %shuffle_order_engine random number generator - * object. - * - * @returns true if the infinite sequences of generated values - * would be equal, false otherwise. - */ - friend bool - operator==(const shuffle_order_engine& __lhs, - const shuffle_order_engine& __rhs) - { return (__lhs._M_b == __rhs._M_b - && std::equal(__lhs._M_v, __lhs._M_v + __k, __rhs._M_v) - && __lhs._M_y == __rhs._M_y); } - - /** - * @brief Inserts the current state of a %shuffle_order_engine random - * number generator engine @p __x into the output stream - @p __os. - * - * @param __os An output stream. - * @param __x A %shuffle_order_engine random number generator engine. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::shuffle_order_engine<_RandomNumberEngine1, - __k1>& __x); - - /** - * @brief Extracts the current state of a % subtract_with_carry_engine - * random number generator engine @p __x from the input stream - * @p __is. - * - * @param __is An input stream. - * @param __x A %shuffle_order_engine random number generator engine. - * - * @returns The input stream with the state of @p __x extracted or in - * an error state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::shuffle_order_engine<_RandomNumberEngine1, __k1>& __x); - - private: - void _M_initialize() - { - for (size_t __i = 0; __i < __k; ++__i) - _M_v[__i] = _M_b(); - _M_y = _M_b(); - } - - _RandomNumberEngine _M_b; - result_type _M_v[__k]; - result_type _M_y; - }; - - /** - * Compares two %shuffle_order_engine random number generator objects - * of the same type for inequality. - * - * @param __lhs A %shuffle_order_engine random number generator object. - * @param __rhs Another %shuffle_order_engine random number generator - * object. - * - * @returns true if the infinite sequences of generated values - * would be different, false otherwise. - */ - template - inline bool - operator!=(const std::shuffle_order_engine<_RandomNumberEngine, - __k>& __lhs, - const std::shuffle_order_engine<_RandomNumberEngine, - __k>& __rhs) - { return !(__lhs == __rhs); } - - - /** - * The classic Minimum Standard rand0 of Lewis, Goodman, and Miller. - */ - typedef linear_congruential_engine - minstd_rand0; - - /** - * An alternative LCR (Lehmer Generator function). - */ - typedef linear_congruential_engine - minstd_rand; - - /** - * The classic Mersenne Twister. - * - * Reference: - * M. Matsumoto and T. Nishimura, Mersenne Twister: A 623-Dimensionally - * Equidistributed Uniform Pseudo-Random Number Generator, ACM Transactions - * on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30. - */ - typedef mersenne_twister_engine< - uint_fast32_t, - 32, 624, 397, 31, - 0x9908b0dfUL, 11, - 0xffffffffUL, 7, - 0x9d2c5680UL, 15, - 0xefc60000UL, 18, 1812433253UL> mt19937; - - /** - * An alternative Mersenne Twister. - */ - typedef mersenne_twister_engine< - uint_fast64_t, - 64, 312, 156, 31, - 0xb5026f5aa96619e9ULL, 29, - 0x5555555555555555ULL, 17, - 0x71d67fffeda60000ULL, 37, - 0xfff7eee000000000ULL, 43, - 6364136223846793005ULL> mt19937_64; - - typedef subtract_with_carry_engine - ranlux24_base; - - typedef subtract_with_carry_engine - ranlux48_base; - - typedef discard_block_engine ranlux24; - - typedef discard_block_engine ranlux48; - - typedef shuffle_order_engine knuth_b; - - typedef minstd_rand0 default_random_engine; - - /** - * A standard interface to a platform-specific non-deterministic - * random number generator (if any are available). - */ - class random_device - { - public: - /** The type of the generated random value. */ - typedef unsigned int result_type; - - // constructors, destructors and member functions - -#ifdef _GLIBCXX_USE_RANDOM_TR1 - - explicit - random_device(const std::string& __token = "default") - { - _M_init(__token); - } - - ~random_device() - { _M_fini(); } - -#else - - explicit - random_device(const std::string& __token = "mt19937") - { _M_init_pretr1(__token); } - - public: - -#endif - - static constexpr result_type - min() - { return std::numeric_limits::min(); } - - static constexpr result_type - max() - { return std::numeric_limits::max(); } - - double - entropy() const noexcept - { return 0.0; } - - result_type - operator()() - { -#ifdef _GLIBCXX_USE_RANDOM_TR1 - return this->_M_getval(); -#else - return this->_M_getval_pretr1(); -#endif - } - - // No copy functions. - random_device(const random_device&) = delete; - void operator=(const random_device&) = delete; - - private: - - void _M_init(const std::string& __token); - void _M_init_pretr1(const std::string& __token); - void _M_fini(); - - result_type _M_getval(); - result_type _M_getval_pretr1(); - - union - { - void* _M_file; - mt19937 _M_mt; - }; - }; - - /* @} */ // group random_generators - - /** - * @addtogroup random_distributions Random Number Distributions - * @ingroup random - * @{ - */ - - /** - * @addtogroup random_distributions_uniform Uniform Distributions - * @ingroup random_distributions - * @{ - */ - - /** - * @brief Uniform discrete distribution for random numbers. - * A discrete random distribution on the range @f$[min, max]@f$ with equal - * probability throughout the range. - */ - template - class uniform_int_distribution - { - static_assert(std::is_integral<_IntType>::value, - "template argument not an integral type"); - - public: - /** The type of the range of the distribution. */ - typedef _IntType result_type; - /** Parameter type. */ - struct param_type - { - typedef uniform_int_distribution<_IntType> distribution_type; - - explicit - param_type(_IntType __a = 0, - _IntType __b = std::numeric_limits<_IntType>::max()) - : _M_a(__a), _M_b(__b) - { - _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b); - } - - result_type - a() const - { return _M_a; } - - result_type - b() const - { return _M_b; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } - - private: - _IntType _M_a; - _IntType _M_b; - }; - - public: - /** - * @brief Constructs a uniform distribution object. - */ - explicit - uniform_int_distribution(_IntType __a = 0, - _IntType __b = std::numeric_limits<_IntType>::max()) - : _M_param(__a, __b) - { } - - explicit - uniform_int_distribution(const param_type& __p) - : _M_param(__p) - { } - - /** - * @brief Resets the distribution state. - * - * Does nothing for the uniform integer distribution. - */ - void - reset() { } - - result_type - a() const - { return _M_param.a(); } - - result_type - b() const - { return _M_param.b(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the inclusive lower bound of the distribution range. - */ - result_type - min() const - { return this->a(); } - - /** - * @brief Returns the inclusive upper bound of the distribution range. - */ - result_type - max() const - { return this->b(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two uniform integer distributions have - * the same parameters. - */ - friend bool - operator==(const uniform_int_distribution& __d1, - const uniform_int_distribution& __d2) - { return __d1._M_param == __d2._M_param; } - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - }; - - /** - * @brief Return true if two uniform integer distributions have - * different parameters. - */ - template - inline bool - operator!=(const std::uniform_int_distribution<_IntType>& __d1, - const std::uniform_int_distribution<_IntType>& __d2) - { return !(__d1 == __d2); } - - /** - * @brief Inserts a %uniform_int_distribution random number - * distribution @p __x into the output stream @p os. - * - * @param __os An output stream. - * @param __x A %uniform_int_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>&, - const std::uniform_int_distribution<_IntType>&); - - /** - * @brief Extracts a %uniform_int_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %uniform_int_distribution random number generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>&, - std::uniform_int_distribution<_IntType>&); - - - /** - * @brief Uniform continuous distribution for random numbers. - * - * A continuous random distribution on the range [min, max) with equal - * probability throughout the range. The URNG should be real-valued and - * deliver number in the range [0, 1). - */ - template - class uniform_real_distribution - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - public: - /** The type of the range of the distribution. */ - typedef _RealType result_type; - /** Parameter type. */ - struct param_type - { - typedef uniform_real_distribution<_RealType> distribution_type; - - explicit - param_type(_RealType __a = _RealType(0), - _RealType __b = _RealType(1)) - : _M_a(__a), _M_b(__b) - { - _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b); - } - - result_type - a() const - { return _M_a; } - - result_type - b() const - { return _M_b; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } - - private: - _RealType _M_a; - _RealType _M_b; - }; - - public: - /** - * @brief Constructs a uniform_real_distribution object. - * - * @param __a [IN] The lower bound of the distribution. - * @param __b [IN] The upper bound of the distribution. - */ - explicit - uniform_real_distribution(_RealType __a = _RealType(0), - _RealType __b = _RealType(1)) - : _M_param(__a, __b) - { } - - explicit - uniform_real_distribution(const param_type& __p) - : _M_param(__p) - { } - - /** - * @brief Resets the distribution state. - * - * Does nothing for the uniform real distribution. - */ - void - reset() { } - - result_type - a() const - { return _M_param.a(); } - - result_type - b() const - { return _M_param.b(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the inclusive lower bound of the distribution range. - */ - result_type - min() const - { return this->a(); } - - /** - * @brief Returns the inclusive upper bound of the distribution range. - */ - result_type - max() const - { return this->b(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - return (__aurng() * (__p.b() - __p.a())) + __p.a(); - } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two uniform real distributions have - * the same parameters. - */ - friend bool - operator==(const uniform_real_distribution& __d1, - const uniform_real_distribution& __d2) - { return __d1._M_param == __d2._M_param; } - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - }; - - /** - * @brief Return true if two uniform real distributions have - * different parameters. - */ - template - inline bool - operator!=(const std::uniform_real_distribution<_IntType>& __d1, - const std::uniform_real_distribution<_IntType>& __d2) - { return !(__d1 == __d2); } - - /** - * @brief Inserts a %uniform_real_distribution random number - * distribution @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %uniform_real_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>&, - const std::uniform_real_distribution<_RealType>&); - - /** - * @brief Extracts a %uniform_real_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %uniform_real_distribution random number generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>&, - std::uniform_real_distribution<_RealType>&); - - /* @} */ // group random_distributions_uniform - - /** - * @addtogroup random_distributions_normal Normal Distributions - * @ingroup random_distributions - * @{ - */ - - /** - * @brief A normal continuous distribution for random numbers. - * - * The formula for the normal probability density function is - * @f[ - * p(x|\mu,\sigma) = \frac{1}{\sigma \sqrt{2 \pi}} - * e^{- \frac{{x - \mu}^ {2}}{2 \sigma ^ {2}} } - * @f] - */ - template - class normal_distribution - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - public: - /** The type of the range of the distribution. */ - typedef _RealType result_type; - /** Parameter type. */ - struct param_type - { - typedef normal_distribution<_RealType> distribution_type; - - explicit - param_type(_RealType __mean = _RealType(0), - _RealType __stddev = _RealType(1)) - : _M_mean(__mean), _M_stddev(__stddev) - { - _GLIBCXX_DEBUG_ASSERT(_M_stddev > _RealType(0)); - } - - _RealType - mean() const - { return _M_mean; } - - _RealType - stddev() const - { return _M_stddev; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return (__p1._M_mean == __p2._M_mean - && __p1._M_stddev == __p2._M_stddev); } - - private: - _RealType _M_mean; - _RealType _M_stddev; - }; - - public: - /** - * Constructs a normal distribution with parameters @f$mean@f$ and - * standard deviation. - */ - explicit - normal_distribution(result_type __mean = result_type(0), - result_type __stddev = result_type(1)) - : _M_param(__mean, __stddev), _M_saved_available(false) - { } - - explicit - normal_distribution(const param_type& __p) - : _M_param(__p), _M_saved_available(false) - { } - - /** - * @brief Resets the distribution state. - */ - void - reset() - { _M_saved_available = false; } - - /** - * @brief Returns the mean of the distribution. - */ - _RealType - mean() const - { return _M_param.mean(); } - - /** - * @brief Returns the standard deviation of the distribution. - */ - _RealType - stddev() const - { return _M_param.stddev(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return std::numeric_limits::lowest(); } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two normal distributions have - * the same parameters and the sequences that would - * be generated are equal. - */ - template - friend bool - operator==(const std::normal_distribution<_RealType1>& __d1, - const std::normal_distribution<_RealType1>& __d2); - - /** - * @brief Inserts a %normal_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %normal_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::normal_distribution<_RealType1>& __x); - - /** - * @brief Extracts a %normal_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %normal_distribution random number generator engine. - * - * @returns The input stream with @p __x extracted or in an error - * state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::normal_distribution<_RealType1>& __x); - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - result_type _M_saved; - bool _M_saved_available; - }; - - /** - * @brief Return true if two normal distributions are different. - */ - template - inline bool - operator!=(const std::normal_distribution<_RealType>& __d1, - const std::normal_distribution<_RealType>& __d2) - { return !(__d1 == __d2); } - - - /** - * @brief A lognormal_distribution random number distribution. - * - * The formula for the normal probability mass function is - * @f[ - * p(x|m,s) = \frac{1}{sx\sqrt{2\pi}} - * \exp{-\frac{(\ln{x} - m)^2}{2s^2}} - * @f] - */ - template - class lognormal_distribution - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - public: - /** The type of the range of the distribution. */ - typedef _RealType result_type; - /** Parameter type. */ - struct param_type - { - typedef lognormal_distribution<_RealType> distribution_type; - - explicit - param_type(_RealType __m = _RealType(0), - _RealType __s = _RealType(1)) - : _M_m(__m), _M_s(__s) - { } - - _RealType - m() const - { return _M_m; } - - _RealType - s() const - { return _M_s; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_m == __p2._M_m && __p1._M_s == __p2._M_s; } - - private: - _RealType _M_m; - _RealType _M_s; - }; - - explicit - lognormal_distribution(_RealType __m = _RealType(0), - _RealType __s = _RealType(1)) - : _M_param(__m, __s), _M_nd() - { } - - explicit - lognormal_distribution(const param_type& __p) - : _M_param(__p), _M_nd() - { } - - /** - * Resets the distribution state. - */ - void - reset() - { _M_nd.reset(); } - - /** - * - */ - _RealType - m() const - { return _M_param.m(); } - - _RealType - s() const - { return _M_param.s(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return result_type(0); } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p) - { return std::exp(__p.s() * _M_nd(__urng) + __p.m()); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two lognormal distributions have - * the same parameters and the sequences that would - * be generated are equal. - */ - friend bool - operator==(const lognormal_distribution& __d1, - const lognormal_distribution& __d2) - { return (__d1._M_param == __d2._M_param - && __d1._M_nd == __d2._M_nd); } - - /** - * @brief Inserts a %lognormal_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %lognormal_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::lognormal_distribution<_RealType1>& __x); - - /** - * @brief Extracts a %lognormal_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %lognormal_distribution random number - * generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::lognormal_distribution<_RealType1>& __x); - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - - std::normal_distribution _M_nd; - }; - - /** - * @brief Return true if two lognormal distributions are different. - */ - template - inline bool - operator!=(const std::lognormal_distribution<_RealType>& __d1, - const std::lognormal_distribution<_RealType>& __d2) - { return !(__d1 == __d2); } - - - /** - * @brief A gamma continuous distribution for random numbers. - * - * The formula for the gamma probability density function is: - * @f[ - * p(x|\alpha,\beta) = \frac{1}{\beta\Gamma(\alpha)} - * (x/\beta)^{\alpha - 1} e^{-x/\beta} - * @f] - */ - template - class gamma_distribution - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - public: - /** The type of the range of the distribution. */ - typedef _RealType result_type; - /** Parameter type. */ - struct param_type - { - typedef gamma_distribution<_RealType> distribution_type; - friend class gamma_distribution<_RealType>; - - explicit - param_type(_RealType __alpha_val = _RealType(1), - _RealType __beta_val = _RealType(1)) - : _M_alpha(__alpha_val), _M_beta(__beta_val) - { - _GLIBCXX_DEBUG_ASSERT(_M_alpha > _RealType(0)); - _M_initialize(); - } - - _RealType - alpha() const - { return _M_alpha; } - - _RealType - beta() const - { return _M_beta; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return (__p1._M_alpha == __p2._M_alpha - && __p1._M_beta == __p2._M_beta); } - - private: - void - _M_initialize(); - - _RealType _M_alpha; - _RealType _M_beta; - - _RealType _M_malpha, _M_a2; - }; - - public: - /** - * @brief Constructs a gamma distribution with parameters - * @f$\alpha@f$ and @f$\beta@f$. - */ - explicit - gamma_distribution(_RealType __alpha_val = _RealType(1), - _RealType __beta_val = _RealType(1)) - : _M_param(__alpha_val, __beta_val), _M_nd() - { } - - explicit - gamma_distribution(const param_type& __p) - : _M_param(__p), _M_nd() - { } - - /** - * @brief Resets the distribution state. - */ - void - reset() - { _M_nd.reset(); } - - /** - * @brief Returns the @f$\alpha@f$ of the distribution. - */ - _RealType - alpha() const - { return _M_param.alpha(); } - - /** - * @brief Returns the @f$\beta@f$ of the distribution. - */ - _RealType - beta() const - { return _M_param.beta(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return result_type(0); } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two gamma distributions have the same - * parameters and the sequences that would be generated - * are equal. - */ - friend bool - operator==(const gamma_distribution& __d1, - const gamma_distribution& __d2) - { return (__d1._M_param == __d2._M_param - && __d1._M_nd == __d2._M_nd); } - - /** - * @brief Inserts a %gamma_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %gamma_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::gamma_distribution<_RealType1>& __x); - - /** - * @brief Extracts a %gamma_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %gamma_distribution random number generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::gamma_distribution<_RealType1>& __x); - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - - std::normal_distribution _M_nd; - }; - - /** - * @brief Return true if two gamma distributions are different. - */ - template - inline bool - operator!=(const std::gamma_distribution<_RealType>& __d1, - const std::gamma_distribution<_RealType>& __d2) - { return !(__d1 == __d2); } - - - /** - * @brief A chi_squared_distribution random number distribution. - * - * The formula for the normal probability mass function is - * @f$p(x|n) = \frac{x^{(n/2) - 1}e^{-x/2}}{\Gamma(n/2) 2^{n/2}}@f$ - */ - template - class chi_squared_distribution - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - public: - /** The type of the range of the distribution. */ - typedef _RealType result_type; - /** Parameter type. */ - struct param_type - { - typedef chi_squared_distribution<_RealType> distribution_type; - - explicit - param_type(_RealType __n = _RealType(1)) - : _M_n(__n) - { } - - _RealType - n() const - { return _M_n; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_n == __p2._M_n; } - - private: - _RealType _M_n; - }; - - explicit - chi_squared_distribution(_RealType __n = _RealType(1)) - : _M_param(__n), _M_gd(__n / 2) - { } - - explicit - chi_squared_distribution(const param_type& __p) - : _M_param(__p), _M_gd(__p.n() / 2) - { } - - /** - * @brief Resets the distribution state. - */ - void - reset() - { _M_gd.reset(); } - - /** - * - */ - _RealType - n() const - { return _M_param.n(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return result_type(0); } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return 2 * _M_gd(__urng); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - typedef typename std::gamma_distribution::param_type - param_type; - return 2 * _M_gd(__urng, param_type(__p.n() / 2)); - } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate_impl(__f, __t, __urng); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { typename std::gamma_distribution::param_type - __p2(__p.n() / 2); - this->__generate_impl(__f, __t, __urng, __p2); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate_impl(__f, __t, __urng); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { typename std::gamma_distribution::param_type - __p2(__p.n() / 2); - this->__generate_impl(__f, __t, __urng, __p2); } - - /** - * @brief Return true if two Chi-squared distributions have - * the same parameters and the sequences that would be - * generated are equal. - */ - friend bool - operator==(const chi_squared_distribution& __d1, - const chi_squared_distribution& __d2) - { return __d1._M_param == __d2._M_param && __d1._M_gd == __d2._M_gd; } - - /** - * @brief Inserts a %chi_squared_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %chi_squared_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::chi_squared_distribution<_RealType1>& __x); - - /** - * @brief Extracts a %chi_squared_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %chi_squared_distribution random number - * generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::chi_squared_distribution<_RealType1>& __x); - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng); - - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const typename - std::gamma_distribution::param_type& __p); - - param_type _M_param; - - std::gamma_distribution _M_gd; - }; - - /** - * @brief Return true if two Chi-squared distributions are different. - */ - template - inline bool - operator!=(const std::chi_squared_distribution<_RealType>& __d1, - const std::chi_squared_distribution<_RealType>& __d2) - { return !(__d1 == __d2); } - - - /** - * @brief A cauchy_distribution random number distribution. - * - * The formula for the normal probability mass function is - * @f$p(x|a,b) = (\pi b (1 + (\frac{x-a}{b})^2))^{-1}@f$ - */ - template - class cauchy_distribution - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - public: - /** The type of the range of the distribution. */ - typedef _RealType result_type; - /** Parameter type. */ - struct param_type - { - typedef cauchy_distribution<_RealType> distribution_type; - - explicit - param_type(_RealType __a = _RealType(0), - _RealType __b = _RealType(1)) - : _M_a(__a), _M_b(__b) - { } - - _RealType - a() const - { return _M_a; } - - _RealType - b() const - { return _M_b; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } - - private: - _RealType _M_a; - _RealType _M_b; - }; - - explicit - cauchy_distribution(_RealType __a = _RealType(0), - _RealType __b = _RealType(1)) - : _M_param(__a, __b) - { } - - explicit - cauchy_distribution(const param_type& __p) - : _M_param(__p) - { } - - /** - * @brief Resets the distribution state. - */ - void - reset() - { } - - /** - * - */ - _RealType - a() const - { return _M_param.a(); } - - _RealType - b() const - { return _M_param.b(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return std::numeric_limits::lowest(); } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two Cauchy distributions have - * the same parameters. - */ - friend bool - operator==(const cauchy_distribution& __d1, - const cauchy_distribution& __d2) - { return __d1._M_param == __d2._M_param; } - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - }; - - /** - * @brief Return true if two Cauchy distributions have - * different parameters. - */ - template - inline bool - operator!=(const std::cauchy_distribution<_RealType>& __d1, - const std::cauchy_distribution<_RealType>& __d2) - { return !(__d1 == __d2); } - - /** - * @brief Inserts a %cauchy_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %cauchy_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::cauchy_distribution<_RealType>& __x); - - /** - * @brief Extracts a %cauchy_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %cauchy_distribution random number - * generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::cauchy_distribution<_RealType>& __x); - - - /** - * @brief A fisher_f_distribution random number distribution. - * - * The formula for the normal probability mass function is - * @f[ - * p(x|m,n) = \frac{\Gamma((m+n)/2)}{\Gamma(m/2)\Gamma(n/2)} - * (\frac{m}{n})^{m/2} x^{(m/2)-1} - * (1 + \frac{mx}{n})^{-(m+n)/2} - * @f] - */ - template - class fisher_f_distribution - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - public: - /** The type of the range of the distribution. */ - typedef _RealType result_type; - /** Parameter type. */ - struct param_type - { - typedef fisher_f_distribution<_RealType> distribution_type; - - explicit - param_type(_RealType __m = _RealType(1), - _RealType __n = _RealType(1)) - : _M_m(__m), _M_n(__n) - { } - - _RealType - m() const - { return _M_m; } - - _RealType - n() const - { return _M_n; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_m == __p2._M_m && __p1._M_n == __p2._M_n; } - - private: - _RealType _M_m; - _RealType _M_n; - }; - - explicit - fisher_f_distribution(_RealType __m = _RealType(1), - _RealType __n = _RealType(1)) - : _M_param(__m, __n), _M_gd_x(__m / 2), _M_gd_y(__n / 2) - { } - - explicit - fisher_f_distribution(const param_type& __p) - : _M_param(__p), _M_gd_x(__p.m() / 2), _M_gd_y(__p.n() / 2) - { } - - /** - * @brief Resets the distribution state. - */ - void - reset() - { - _M_gd_x.reset(); - _M_gd_y.reset(); - } - - /** - * - */ - _RealType - m() const - { return _M_param.m(); } - - _RealType - n() const - { return _M_param.n(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return result_type(0); } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return (_M_gd_x(__urng) * n()) / (_M_gd_y(__urng) * m()); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - typedef typename std::gamma_distribution::param_type - param_type; - return ((_M_gd_x(__urng, param_type(__p.m() / 2)) * n()) - / (_M_gd_y(__urng, param_type(__p.n() / 2)) * m())); - } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate_impl(__f, __t, __urng); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate_impl(__f, __t, __urng); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two Fisher f distributions have - * the same parameters and the sequences that would - * be generated are equal. - */ - friend bool - operator==(const fisher_f_distribution& __d1, - const fisher_f_distribution& __d2) - { return (__d1._M_param == __d2._M_param - && __d1._M_gd_x == __d2._M_gd_x - && __d1._M_gd_y == __d2._M_gd_y); } - - /** - * @brief Inserts a %fisher_f_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %fisher_f_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::fisher_f_distribution<_RealType1>& __x); - - /** - * @brief Extracts a %fisher_f_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %fisher_f_distribution random number - * generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::fisher_f_distribution<_RealType1>& __x); - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng); - - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - - std::gamma_distribution _M_gd_x, _M_gd_y; - }; - - /** - * @brief Return true if two Fisher f distributions are different. - */ - template - inline bool - operator!=(const std::fisher_f_distribution<_RealType>& __d1, - const std::fisher_f_distribution<_RealType>& __d2) - { return !(__d1 == __d2); } - - /** - * @brief A student_t_distribution random number distribution. - * - * The formula for the normal probability mass function is: - * @f[ - * p(x|n) = \frac{1}{\sqrt(n\pi)} \frac{\Gamma((n+1)/2)}{\Gamma(n/2)} - * (1 + \frac{x^2}{n}) ^{-(n+1)/2} - * @f] - */ - template - class student_t_distribution - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - public: - /** The type of the range of the distribution. */ - typedef _RealType result_type; - /** Parameter type. */ - struct param_type - { - typedef student_t_distribution<_RealType> distribution_type; - - explicit - param_type(_RealType __n = _RealType(1)) - : _M_n(__n) - { } - - _RealType - n() const - { return _M_n; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_n == __p2._M_n; } - - private: - _RealType _M_n; - }; - - explicit - student_t_distribution(_RealType __n = _RealType(1)) - : _M_param(__n), _M_nd(), _M_gd(__n / 2, 2) - { } - - explicit - student_t_distribution(const param_type& __p) - : _M_param(__p), _M_nd(), _M_gd(__p.n() / 2, 2) - { } - - /** - * @brief Resets the distribution state. - */ - void - reset() - { - _M_nd.reset(); - _M_gd.reset(); - } - - /** - * - */ - _RealType - n() const - { return _M_param.n(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return std::numeric_limits::lowest(); } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return _M_nd(__urng) * std::sqrt(n() / _M_gd(__urng)); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - typedef typename std::gamma_distribution::param_type - param_type; - - const result_type __g = _M_gd(__urng, param_type(__p.n() / 2, 2)); - return _M_nd(__urng) * std::sqrt(__p.n() / __g); - } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate_impl(__f, __t, __urng); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate_impl(__f, __t, __urng); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two Student t distributions have - * the same parameters and the sequences that would - * be generated are equal. - */ - friend bool - operator==(const student_t_distribution& __d1, - const student_t_distribution& __d2) - { return (__d1._M_param == __d2._M_param - && __d1._M_nd == __d2._M_nd && __d1._M_gd == __d2._M_gd); } - - /** - * @brief Inserts a %student_t_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %student_t_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::student_t_distribution<_RealType1>& __x); - - /** - * @brief Extracts a %student_t_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %student_t_distribution random number - * generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::student_t_distribution<_RealType1>& __x); - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng); - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - - std::normal_distribution _M_nd; - std::gamma_distribution _M_gd; - }; - - /** - * @brief Return true if two Student t distributions are different. - */ - template - inline bool - operator!=(const std::student_t_distribution<_RealType>& __d1, - const std::student_t_distribution<_RealType>& __d2) - { return !(__d1 == __d2); } - - - /* @} */ // group random_distributions_normal - - /** - * @addtogroup random_distributions_bernoulli Bernoulli Distributions - * @ingroup random_distributions - * @{ - */ - - /** - * @brief A Bernoulli random number distribution. - * - * Generates a sequence of true and false values with likelihood @f$p@f$ - * that true will come up and @f$(1 - p)@f$ that false will appear. - */ - class bernoulli_distribution - { - public: - /** The type of the range of the distribution. */ - typedef bool result_type; - /** Parameter type. */ - struct param_type - { - typedef bernoulli_distribution distribution_type; - - explicit - param_type(double __p = 0.5) - : _M_p(__p) - { - _GLIBCXX_DEBUG_ASSERT((_M_p >= 0.0) && (_M_p <= 1.0)); - } - - double - p() const - { return _M_p; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_p == __p2._M_p; } - - private: - double _M_p; - }; - - public: - /** - * @brief Constructs a Bernoulli distribution with likelihood @p p. - * - * @param __p [IN] The likelihood of a true result being returned. - * Must be in the interval @f$[0, 1]@f$. - */ - explicit - bernoulli_distribution(double __p = 0.5) - : _M_param(__p) - { } - - explicit - bernoulli_distribution(const param_type& __p) - : _M_param(__p) - { } - - /** - * @brief Resets the distribution state. - * - * Does nothing for a Bernoulli distribution. - */ - void - reset() { } - - /** - * @brief Returns the @p p parameter of the distribution. - */ - double - p() const - { return _M_param.p(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return std::numeric_limits::min(); } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __detail::_Adaptor<_UniformRandomNumberGenerator, double> - __aurng(__urng); - if ((__aurng() - __aurng.min()) - < __p.p() * (__aurng.max() - __aurng.min())) - return true; - return false; - } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two Bernoulli distributions have - * the same parameters. - */ - friend bool - operator==(const bernoulli_distribution& __d1, - const bernoulli_distribution& __d2) - { return __d1._M_param == __d2._M_param; } - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - }; - - /** - * @brief Return true if two Bernoulli distributions have - * different parameters. - */ - inline bool - operator!=(const std::bernoulli_distribution& __d1, - const std::bernoulli_distribution& __d2) - { return !(__d1 == __d2); } - - /** - * @brief Inserts a %bernoulli_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %bernoulli_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::bernoulli_distribution& __x); - - /** - * @brief Extracts a %bernoulli_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %bernoulli_distribution random number generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::bernoulli_distribution& __x) - { - double __p; - __is >> __p; - __x.param(bernoulli_distribution::param_type(__p)); - return __is; - } - - - /** - * @brief A discrete binomial random number distribution. - * - * The formula for the binomial probability density function is - * @f$p(i|t,p) = \binom{t}{i} p^i (1 - p)^{t - i}@f$ where @f$t@f$ - * and @f$p@f$ are the parameters of the distribution. - */ - template - class binomial_distribution - { - static_assert(std::is_integral<_IntType>::value, - "template argument not an integral type"); - - public: - /** The type of the range of the distribution. */ - typedef _IntType result_type; - /** Parameter type. */ - struct param_type - { - typedef binomial_distribution<_IntType> distribution_type; - friend class binomial_distribution<_IntType>; - - explicit - param_type(_IntType __t = _IntType(1), double __p = 0.5) - : _M_t(__t), _M_p(__p) - { - _GLIBCXX_DEBUG_ASSERT((_M_t >= _IntType(0)) - && (_M_p >= 0.0) - && (_M_p <= 1.0)); - _M_initialize(); - } - - _IntType - t() const - { return _M_t; } - - double - p() const - { return _M_p; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_t == __p2._M_t && __p1._M_p == __p2._M_p; } - - private: - void - _M_initialize(); - - _IntType _M_t; - double _M_p; - - double _M_q; -#if _GLIBCXX_USE_C99_MATH_TR1 - double _M_d1, _M_d2, _M_s1, _M_s2, _M_c, - _M_a1, _M_a123, _M_s, _M_lf, _M_lp1p; -#endif - bool _M_easy; - }; - - // constructors and member function - explicit - binomial_distribution(_IntType __t = _IntType(1), - double __p = 0.5) - : _M_param(__t, __p), _M_nd() - { } - - explicit - binomial_distribution(const param_type& __p) - : _M_param(__p), _M_nd() - { } - - /** - * @brief Resets the distribution state. - */ - void - reset() - { _M_nd.reset(); } - - /** - * @brief Returns the distribution @p t parameter. - */ - _IntType - t() const - { return _M_param.t(); } - - /** - * @brief Returns the distribution @p p parameter. - */ - double - p() const - { return _M_param.p(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return 0; } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return _M_param.t(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two binomial distributions have - * the same parameters and the sequences that would - * be generated are equal. - */ - friend bool - operator==(const binomial_distribution& __d1, - const binomial_distribution& __d2) -#ifdef _GLIBCXX_USE_C99_MATH_TR1 - { return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; } -#else - { return __d1._M_param == __d2._M_param; } -#endif - - /** - * @brief Inserts a %binomial_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %binomial_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::binomial_distribution<_IntType1>& __x); - - /** - * @brief Extracts a %binomial_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %binomial_distribution random number generator engine. - * - * @returns The input stream with @p __x extracted or in an error - * state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::binomial_distribution<_IntType1>& __x); - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - result_type - _M_waiting(_UniformRandomNumberGenerator& __urng, - _IntType __t, double __q); - - param_type _M_param; - - // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined. - std::normal_distribution _M_nd; - }; - - /** - * @brief Return true if two binomial distributions are different. - */ - template - inline bool - operator!=(const std::binomial_distribution<_IntType>& __d1, - const std::binomial_distribution<_IntType>& __d2) - { return !(__d1 == __d2); } - - - /** - * @brief A discrete geometric random number distribution. - * - * The formula for the geometric probability density function is - * @f$p(i|p) = p(1 - p)^{i}@f$ where @f$p@f$ is the parameter of the - * distribution. - */ - template - class geometric_distribution - { - static_assert(std::is_integral<_IntType>::value, - "template argument not an integral type"); - - public: - /** The type of the range of the distribution. */ - typedef _IntType result_type; - /** Parameter type. */ - struct param_type - { - typedef geometric_distribution<_IntType> distribution_type; - friend class geometric_distribution<_IntType>; - - explicit - param_type(double __p = 0.5) - : _M_p(__p) - { - _GLIBCXX_DEBUG_ASSERT((_M_p > 0.0) && (_M_p < 1.0)); - _M_initialize(); - } - - double - p() const - { return _M_p; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_p == __p2._M_p; } - - private: - void - _M_initialize() - { _M_log_1_p = std::log(1.0 - _M_p); } - - double _M_p; - - double _M_log_1_p; - }; - - // constructors and member function - explicit - geometric_distribution(double __p = 0.5) - : _M_param(__p) - { } - - explicit - geometric_distribution(const param_type& __p) - : _M_param(__p) - { } - - /** - * @brief Resets the distribution state. - * - * Does nothing for the geometric distribution. - */ - void - reset() { } - - /** - * @brief Returns the distribution parameter @p p. - */ - double - p() const - { return _M_param.p(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return 0; } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two geometric distributions have - * the same parameters. - */ - friend bool - operator==(const geometric_distribution& __d1, - const geometric_distribution& __d2) - { return __d1._M_param == __d2._M_param; } - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - }; - - /** - * @brief Return true if two geometric distributions have - * different parameters. - */ - template - inline bool - operator!=(const std::geometric_distribution<_IntType>& __d1, - const std::geometric_distribution<_IntType>& __d2) - { return !(__d1 == __d2); } - - /** - * @brief Inserts a %geometric_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %geometric_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::geometric_distribution<_IntType>& __x); - - /** - * @brief Extracts a %geometric_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %geometric_distribution random number generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::geometric_distribution<_IntType>& __x); - - - /** - * @brief A negative_binomial_distribution random number distribution. - * - * The formula for the negative binomial probability mass function is - * @f$p(i) = \binom{n}{i} p^i (1 - p)^{t - i}@f$ where @f$t@f$ - * and @f$p@f$ are the parameters of the distribution. - */ - template - class negative_binomial_distribution - { - static_assert(std::is_integral<_IntType>::value, - "template argument not an integral type"); - - public: - /** The type of the range of the distribution. */ - typedef _IntType result_type; - /** Parameter type. */ - struct param_type - { - typedef negative_binomial_distribution<_IntType> distribution_type; - - explicit - param_type(_IntType __k = 1, double __p = 0.5) - : _M_k(__k), _M_p(__p) - { - _GLIBCXX_DEBUG_ASSERT((_M_k > 0) && (_M_p > 0.0) && (_M_p <= 1.0)); - } - - _IntType - k() const - { return _M_k; } - - double - p() const - { return _M_p; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_k == __p2._M_k && __p1._M_p == __p2._M_p; } - - private: - _IntType _M_k; - double _M_p; - }; - - explicit - negative_binomial_distribution(_IntType __k = 1, double __p = 0.5) - : _M_param(__k, __p), _M_gd(__k, (1.0 - __p) / __p) - { } - - explicit - negative_binomial_distribution(const param_type& __p) - : _M_param(__p), _M_gd(__p.k(), (1.0 - __p.p()) / __p.p()) - { } - - /** - * @brief Resets the distribution state. - */ - void - reset() - { _M_gd.reset(); } - - /** - * @brief Return the @f$k@f$ parameter of the distribution. - */ - _IntType - k() const - { return _M_param.k(); } - - /** - * @brief Return the @f$p@f$ parameter of the distribution. - */ - double - p() const - { return _M_param.p(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return result_type(0); } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng); - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate_impl(__f, __t, __urng); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate_impl(__f, __t, __urng); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two negative binomial distributions have - * the same parameters and the sequences that would be - * generated are equal. - */ - friend bool - operator==(const negative_binomial_distribution& __d1, - const negative_binomial_distribution& __d2) - { return __d1._M_param == __d2._M_param && __d1._M_gd == __d2._M_gd; } - - /** - * @brief Inserts a %negative_binomial_distribution random - * number distribution @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %negative_binomial_distribution random number - * distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::negative_binomial_distribution<_IntType1>& __x); - - /** - * @brief Extracts a %negative_binomial_distribution random number - * distribution @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %negative_binomial_distribution random number - * generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::negative_binomial_distribution<_IntType1>& __x); - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng); - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - - std::gamma_distribution _M_gd; - }; - - /** - * @brief Return true if two negative binomial distributions are different. - */ - template - inline bool - operator!=(const std::negative_binomial_distribution<_IntType>& __d1, - const std::negative_binomial_distribution<_IntType>& __d2) - { return !(__d1 == __d2); } - - - /* @} */ // group random_distributions_bernoulli - - /** - * @addtogroup random_distributions_poisson Poisson Distributions - * @ingroup random_distributions - * @{ - */ - - /** - * @brief A discrete Poisson random number distribution. - * - * The formula for the Poisson probability density function is - * @f$p(i|\mu) = \frac{\mu^i}{i!} e^{-\mu}@f$ where @f$\mu@f$ is the - * parameter of the distribution. - */ - template - class poisson_distribution - { - static_assert(std::is_integral<_IntType>::value, - "template argument not an integral type"); - - public: - /** The type of the range of the distribution. */ - typedef _IntType result_type; - /** Parameter type. */ - struct param_type - { - typedef poisson_distribution<_IntType> distribution_type; - friend class poisson_distribution<_IntType>; - - explicit - param_type(double __mean = 1.0) - : _M_mean(__mean) - { - _GLIBCXX_DEBUG_ASSERT(_M_mean > 0.0); - _M_initialize(); - } - - double - mean() const - { return _M_mean; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_mean == __p2._M_mean; } - - private: - // Hosts either log(mean) or the threshold of the simple method. - void - _M_initialize(); - - double _M_mean; - - double _M_lm_thr; -#if _GLIBCXX_USE_C99_MATH_TR1 - double _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb; -#endif - }; - - // constructors and member function - explicit - poisson_distribution(double __mean = 1.0) - : _M_param(__mean), _M_nd() - { } - - explicit - poisson_distribution(const param_type& __p) - : _M_param(__p), _M_nd() - { } - - /** - * @brief Resets the distribution state. - */ - void - reset() - { _M_nd.reset(); } - - /** - * @brief Returns the distribution parameter @p mean. - */ - double - mean() const - { return _M_param.mean(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return 0; } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two Poisson distributions have the same - * parameters and the sequences that would be generated - * are equal. - */ - friend bool - operator==(const poisson_distribution& __d1, - const poisson_distribution& __d2) -#ifdef _GLIBCXX_USE_C99_MATH_TR1 - { return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; } -#else - { return __d1._M_param == __d2._M_param; } -#endif - - /** - * @brief Inserts a %poisson_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %poisson_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::poisson_distribution<_IntType1>& __x); - - /** - * @brief Extracts a %poisson_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %poisson_distribution random number generator engine. - * - * @returns The input stream with @p __x extracted or in an error - * state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::poisson_distribution<_IntType1>& __x); - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - - // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined. - std::normal_distribution _M_nd; - }; - - /** - * @brief Return true if two Poisson distributions are different. - */ - template - inline bool - operator!=(const std::poisson_distribution<_IntType>& __d1, - const std::poisson_distribution<_IntType>& __d2) - { return !(__d1 == __d2); } - - - /** - * @brief An exponential continuous distribution for random numbers. - * - * The formula for the exponential probability density function is - * @f$p(x|\lambda) = \lambda e^{-\lambda x}@f$. - * - * - * - * - * - * - * - * - *
Distribution Statistics
Mean@f$\frac{1}{\lambda}@f$
Median@f$\frac{\ln 2}{\lambda}@f$
Mode@f$zero@f$
Range@f$[0, \infty]@f$
Standard Deviation@f$\frac{1}{\lambda}@f$
- */ - template - class exponential_distribution - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - public: - /** The type of the range of the distribution. */ - typedef _RealType result_type; - /** Parameter type. */ - struct param_type - { - typedef exponential_distribution<_RealType> distribution_type; - - explicit - param_type(_RealType __lambda = _RealType(1)) - : _M_lambda(__lambda) - { - _GLIBCXX_DEBUG_ASSERT(_M_lambda > _RealType(0)); - } - - _RealType - lambda() const - { return _M_lambda; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_lambda == __p2._M_lambda; } - - private: - _RealType _M_lambda; - }; - - public: - /** - * @brief Constructs an exponential distribution with inverse scale - * parameter @f$\lambda@f$. - */ - explicit - exponential_distribution(const result_type& __lambda = result_type(1)) - : _M_param(__lambda) - { } - - explicit - exponential_distribution(const param_type& __p) - : _M_param(__p) - { } - - /** - * @brief Resets the distribution state. - * - * Has no effect on exponential distributions. - */ - void - reset() { } - - /** - * @brief Returns the inverse scale parameter of the distribution. - */ - _RealType - lambda() const - { return _M_param.lambda(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return result_type(0); } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - return -std::log(result_type(1) - __aurng()) / __p.lambda(); - } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two exponential distributions have the same - * parameters. - */ - friend bool - operator==(const exponential_distribution& __d1, - const exponential_distribution& __d2) - { return __d1._M_param == __d2._M_param; } - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - }; - - /** - * @brief Return true if two exponential distributions have different - * parameters. - */ - template - inline bool - operator!=(const std::exponential_distribution<_RealType>& __d1, - const std::exponential_distribution<_RealType>& __d2) - { return !(__d1 == __d2); } - - /** - * @brief Inserts a %exponential_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %exponential_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::exponential_distribution<_RealType>& __x); - - /** - * @brief Extracts a %exponential_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %exponential_distribution random number - * generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::exponential_distribution<_RealType>& __x); - - - /** - * @brief A weibull_distribution random number distribution. - * - * The formula for the normal probability density function is: - * @f[ - * p(x|\alpha,\beta) = \frac{\alpha}{\beta} (\frac{x}{\beta})^{\alpha-1} - * \exp{(-(\frac{x}{\beta})^\alpha)} - * @f] - */ - template - class weibull_distribution - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - public: - /** The type of the range of the distribution. */ - typedef _RealType result_type; - /** Parameter type. */ - struct param_type - { - typedef weibull_distribution<_RealType> distribution_type; - - explicit - param_type(_RealType __a = _RealType(1), - _RealType __b = _RealType(1)) - : _M_a(__a), _M_b(__b) - { } - - _RealType - a() const - { return _M_a; } - - _RealType - b() const - { return _M_b; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } - - private: - _RealType _M_a; - _RealType _M_b; - }; - - explicit - weibull_distribution(_RealType __a = _RealType(1), - _RealType __b = _RealType(1)) - : _M_param(__a, __b) - { } - - explicit - weibull_distribution(const param_type& __p) - : _M_param(__p) - { } - - /** - * @brief Resets the distribution state. - */ - void - reset() - { } - - /** - * @brief Return the @f$a@f$ parameter of the distribution. - */ - _RealType - a() const - { return _M_param.a(); } - - /** - * @brief Return the @f$b@f$ parameter of the distribution. - */ - _RealType - b() const - { return _M_param.b(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return result_type(0); } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two Weibull distributions have the same - * parameters. - */ - friend bool - operator==(const weibull_distribution& __d1, - const weibull_distribution& __d2) - { return __d1._M_param == __d2._M_param; } - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - }; - - /** - * @brief Return true if two Weibull distributions have different - * parameters. - */ - template - inline bool - operator!=(const std::weibull_distribution<_RealType>& __d1, - const std::weibull_distribution<_RealType>& __d2) - { return !(__d1 == __d2); } - - /** - * @brief Inserts a %weibull_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %weibull_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::weibull_distribution<_RealType>& __x); - - /** - * @brief Extracts a %weibull_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %weibull_distribution random number - * generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::weibull_distribution<_RealType>& __x); - - - /** - * @brief A extreme_value_distribution random number distribution. - * - * The formula for the normal probability mass function is - * @f[ - * p(x|a,b) = \frac{1}{b} - * \exp( \frac{a-x}{b} - \exp(\frac{a-x}{b})) - * @f] - */ - template - class extreme_value_distribution - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - public: - /** The type of the range of the distribution. */ - typedef _RealType result_type; - /** Parameter type. */ - struct param_type - { - typedef extreme_value_distribution<_RealType> distribution_type; - - explicit - param_type(_RealType __a = _RealType(0), - _RealType __b = _RealType(1)) - : _M_a(__a), _M_b(__b) - { } - - _RealType - a() const - { return _M_a; } - - _RealType - b() const - { return _M_b; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } - - private: - _RealType _M_a; - _RealType _M_b; - }; - - explicit - extreme_value_distribution(_RealType __a = _RealType(0), - _RealType __b = _RealType(1)) - : _M_param(__a, __b) - { } - - explicit - extreme_value_distribution(const param_type& __p) - : _M_param(__p) - { } - - /** - * @brief Resets the distribution state. - */ - void - reset() - { } - - /** - * @brief Return the @f$a@f$ parameter of the distribution. - */ - _RealType - a() const - { return _M_param.a(); } - - /** - * @brief Return the @f$b@f$ parameter of the distribution. - */ - _RealType - b() const - { return _M_param.b(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return std::numeric_limits::lowest(); } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { return std::numeric_limits::max(); } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two extreme value distributions have the same - * parameters. - */ - friend bool - operator==(const extreme_value_distribution& __d1, - const extreme_value_distribution& __d2) - { return __d1._M_param == __d2._M_param; } - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - }; - - /** - * @brief Return true if two extreme value distributions have different - * parameters. - */ - template - inline bool - operator!=(const std::extreme_value_distribution<_RealType>& __d1, - const std::extreme_value_distribution<_RealType>& __d2) - { return !(__d1 == __d2); } - - /** - * @brief Inserts a %extreme_value_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %extreme_value_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::extreme_value_distribution<_RealType>& __x); - - /** - * @brief Extracts a %extreme_value_distribution random number - * distribution @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %extreme_value_distribution random number - * generator engine. - * - * @returns The input stream with @p __x extracted or in an error state. - */ - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::extreme_value_distribution<_RealType>& __x); - - - /** - * @brief A discrete_distribution random number distribution. - * - * The formula for the discrete probability mass function is - * - */ - template - class discrete_distribution - { - static_assert(std::is_integral<_IntType>::value, - "template argument not an integral type"); - - public: - /** The type of the range of the distribution. */ - typedef _IntType result_type; - /** Parameter type. */ - struct param_type - { - typedef discrete_distribution<_IntType> distribution_type; - friend class discrete_distribution<_IntType>; - - param_type() - : _M_prob(), _M_cp() - { } - - template - param_type(_InputIterator __wbegin, - _InputIterator __wend) - : _M_prob(__wbegin, __wend), _M_cp() - { _M_initialize(); } - - param_type(initializer_list __wil) - : _M_prob(__wil.begin(), __wil.end()), _M_cp() - { _M_initialize(); } - - template - param_type(size_t __nw, double __xmin, double __xmax, - _Func __fw); - - // See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/ - param_type(const param_type&) = default; - param_type& operator=(const param_type&) = default; - - std::vector - probabilities() const - { return _M_prob.empty() ? std::vector(1, 1.0) : _M_prob; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_prob == __p2._M_prob; } - - private: - void - _M_initialize(); - - std::vector _M_prob; - std::vector _M_cp; - }; - - discrete_distribution() - : _M_param() - { } - - template - discrete_distribution(_InputIterator __wbegin, - _InputIterator __wend) - : _M_param(__wbegin, __wend) - { } - - discrete_distribution(initializer_list __wl) - : _M_param(__wl) - { } - - template - discrete_distribution(size_t __nw, double __xmin, double __xmax, - _Func __fw) - : _M_param(__nw, __xmin, __xmax, __fw) - { } - - explicit - discrete_distribution(const param_type& __p) - : _M_param(__p) - { } - - /** - * @brief Resets the distribution state. - */ - void - reset() - { } - - /** - * @brief Returns the probabilities of the distribution. - */ - std::vector - probabilities() const - { - return _M_param._M_prob.empty() - ? std::vector(1, 1.0) : _M_param._M_prob; - } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { return result_type(0); } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { - return _M_param._M_prob.empty() - ? result_type(0) : result_type(_M_param._M_prob.size() - 1); - } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two discrete distributions have the same - * parameters. - */ - friend bool - operator==(const discrete_distribution& __d1, - const discrete_distribution& __d2) - { return __d1._M_param == __d2._M_param; } - - /** - * @brief Inserts a %discrete_distribution random number distribution - * @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %discrete_distribution random number distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::discrete_distribution<_IntType1>& __x); - - /** - * @brief Extracts a %discrete_distribution random number distribution - * @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %discrete_distribution random number - * generator engine. - * - * @returns The input stream with @p __x extracted or in an error - * state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::discrete_distribution<_IntType1>& __x); - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - }; - - /** - * @brief Return true if two discrete distributions have different - * parameters. - */ - template - inline bool - operator!=(const std::discrete_distribution<_IntType>& __d1, - const std::discrete_distribution<_IntType>& __d2) - { return !(__d1 == __d2); } - - - /** - * @brief A piecewise_constant_distribution random number distribution. - * - * The formula for the piecewise constant probability mass function is - * - */ - template - class piecewise_constant_distribution - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - public: - /** The type of the range of the distribution. */ - typedef _RealType result_type; - /** Parameter type. */ - struct param_type - { - typedef piecewise_constant_distribution<_RealType> distribution_type; - friend class piecewise_constant_distribution<_RealType>; - - param_type() - : _M_int(), _M_den(), _M_cp() - { } - - template - param_type(_InputIteratorB __bfirst, - _InputIteratorB __bend, - _InputIteratorW __wbegin); - - template - param_type(initializer_list<_RealType> __bi, _Func __fw); - - template - param_type(size_t __nw, _RealType __xmin, _RealType __xmax, - _Func __fw); - - // See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/ - param_type(const param_type&) = default; - param_type& operator=(const param_type&) = default; - - std::vector<_RealType> - intervals() const - { - if (_M_int.empty()) - { - std::vector<_RealType> __tmp(2); - __tmp[1] = _RealType(1); - return __tmp; - } - else - return _M_int; - } - - std::vector - densities() const - { return _M_den.empty() ? std::vector(1, 1.0) : _M_den; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; } - - private: - void - _M_initialize(); - - std::vector<_RealType> _M_int; - std::vector _M_den; - std::vector _M_cp; - }; - - explicit - piecewise_constant_distribution() - : _M_param() - { } - - template - piecewise_constant_distribution(_InputIteratorB __bfirst, - _InputIteratorB __bend, - _InputIteratorW __wbegin) - : _M_param(__bfirst, __bend, __wbegin) - { } - - template - piecewise_constant_distribution(initializer_list<_RealType> __bl, - _Func __fw) - : _M_param(__bl, __fw) - { } - - template - piecewise_constant_distribution(size_t __nw, - _RealType __xmin, _RealType __xmax, - _Func __fw) - : _M_param(__nw, __xmin, __xmax, __fw) - { } - - explicit - piecewise_constant_distribution(const param_type& __p) - : _M_param(__p) - { } - - /** - * @brief Resets the distribution state. - */ - void - reset() - { } - - /** - * @brief Returns a vector of the intervals. - */ - std::vector<_RealType> - intervals() const - { - if (_M_param._M_int.empty()) - { - std::vector<_RealType> __tmp(2); - __tmp[1] = _RealType(1); - return __tmp; - } - else - return _M_param._M_int; - } - - /** - * @brief Returns a vector of the probability densities. - */ - std::vector - densities() const - { - return _M_param._M_den.empty() - ? std::vector(1, 1.0) : _M_param._M_den; - } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { - return _M_param._M_int.empty() - ? result_type(0) : _M_param._M_int.front(); - } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { - return _M_param._M_int.empty() - ? result_type(1) : _M_param._M_int.back(); - } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two piecewise constant distributions have the - * same parameters. - */ - friend bool - operator==(const piecewise_constant_distribution& __d1, - const piecewise_constant_distribution& __d2) - { return __d1._M_param == __d2._M_param; } - - /** - * @brief Inserts a %piecewise_constant_distribution random - * number distribution @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %piecewise_constant_distribution random number - * distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::piecewise_constant_distribution<_RealType1>& __x); - - /** - * @brief Extracts a %piecewise_constant_distribution random - * number distribution @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %piecewise_constant_distribution random number - * generator engine. - * - * @returns The input stream with @p __x extracted or in an error - * state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::piecewise_constant_distribution<_RealType1>& __x); - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - }; - - /** - * @brief Return true if two piecewise constant distributions have - * different parameters. - */ - template - inline bool - operator!=(const std::piecewise_constant_distribution<_RealType>& __d1, - const std::piecewise_constant_distribution<_RealType>& __d2) - { return !(__d1 == __d2); } - - - /** - * @brief A piecewise_linear_distribution random number distribution. - * - * The formula for the piecewise linear probability mass function is - * - */ - template - class piecewise_linear_distribution - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - public: - /** The type of the range of the distribution. */ - typedef _RealType result_type; - /** Parameter type. */ - struct param_type - { - typedef piecewise_linear_distribution<_RealType> distribution_type; - friend class piecewise_linear_distribution<_RealType>; - - param_type() - : _M_int(), _M_den(), _M_cp(), _M_m() - { } - - template - param_type(_InputIteratorB __bfirst, - _InputIteratorB __bend, - _InputIteratorW __wbegin); - - template - param_type(initializer_list<_RealType> __bl, _Func __fw); - - template - param_type(size_t __nw, _RealType __xmin, _RealType __xmax, - _Func __fw); - - // See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/ - param_type(const param_type&) = default; - param_type& operator=(const param_type&) = default; - - std::vector<_RealType> - intervals() const - { - if (_M_int.empty()) - { - std::vector<_RealType> __tmp(2); - __tmp[1] = _RealType(1); - return __tmp; - } - else - return _M_int; - } - - std::vector - densities() const - { return _M_den.empty() ? std::vector(2, 1.0) : _M_den; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return (__p1._M_int == __p2._M_int - && __p1._M_den == __p2._M_den); } - - private: - void - _M_initialize(); - - std::vector<_RealType> _M_int; - std::vector _M_den; - std::vector _M_cp; - std::vector _M_m; - }; - - explicit - piecewise_linear_distribution() - : _M_param() - { } - - template - piecewise_linear_distribution(_InputIteratorB __bfirst, - _InputIteratorB __bend, - _InputIteratorW __wbegin) - : _M_param(__bfirst, __bend, __wbegin) - { } - - template - piecewise_linear_distribution(initializer_list<_RealType> __bl, - _Func __fw) - : _M_param(__bl, __fw) - { } - - template - piecewise_linear_distribution(size_t __nw, - _RealType __xmin, _RealType __xmax, - _Func __fw) - : _M_param(__nw, __xmin, __xmax, __fw) - { } - - explicit - piecewise_linear_distribution(const param_type& __p) - : _M_param(__p) - { } - - /** - * Resets the distribution state. - */ - void - reset() - { } - - /** - * @brief Return the intervals of the distribution. - */ - std::vector<_RealType> - intervals() const - { - if (_M_param._M_int.empty()) - { - std::vector<_RealType> __tmp(2); - __tmp[1] = _RealType(1); - return __tmp; - } - else - return _M_param._M_int; - } - - /** - * @brief Return a vector of the probability densities of the - * distribution. - */ - std::vector - densities() const - { - return _M_param._M_den.empty() - ? std::vector(2, 1.0) : _M_param._M_den; - } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the greatest lower bound value of the distribution. - */ - result_type - min() const - { - return _M_param._M_int.empty() - ? result_type(0) : _M_param._M_int.front(); - } - - /** - * @brief Returns the least upper bound value of the distribution. - */ - result_type - max() const - { - return _M_param._M_int.empty() - ? result_type(1) : _M_param._M_int.back(); - } - - /** - * @brief Generating functions. - */ - template - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two piecewise linear distributions have the - * same parameters. - */ - friend bool - operator==(const piecewise_linear_distribution& __d1, - const piecewise_linear_distribution& __d2) - { return __d1._M_param == __d2._M_param; } - - /** - * @brief Inserts a %piecewise_linear_distribution random number - * distribution @p __x into the output stream @p __os. - * - * @param __os An output stream. - * @param __x A %piecewise_linear_distribution random number - * distribution. - * - * @returns The output stream with the state of @p __x inserted or in - * an error state. - */ - template - friend std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const std::piecewise_linear_distribution<_RealType1>& __x); - - /** - * @brief Extracts a %piecewise_linear_distribution random number - * distribution @p __x from the input stream @p __is. - * - * @param __is An input stream. - * @param __x A %piecewise_linear_distribution random number - * generator engine. - * - * @returns The input stream with @p __x extracted or in an error - * state. - */ - template - friend std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - std::piecewise_linear_distribution<_RealType1>& __x); - - private: - template - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - }; - - /** - * @brief Return true if two piecewise linear distributions have - * different parameters. - */ - template - inline bool - operator!=(const std::piecewise_linear_distribution<_RealType>& __d1, - const std::piecewise_linear_distribution<_RealType>& __d2) - { return !(__d1 == __d2); } - - - /* @} */ // group random_distributions_poisson - - /* @} */ // group random_distributions - - /** - * @addtogroup random_utilities Random Number Utilities - * @ingroup random - * @{ - */ - - /** - * @brief The seed_seq class generates sequences of seeds for random - * number generators. - */ - class seed_seq - { - - public: - /** The type of the seed vales. */ - typedef uint_least32_t result_type; - - /** Default constructor. */ - seed_seq() - : _M_v() - { } - - template - seed_seq(std::initializer_list<_IntType> il); - - template - seed_seq(_InputIterator __begin, _InputIterator __end); - - // generating functions - template - void - generate(_RandomAccessIterator __begin, _RandomAccessIterator __end); - - // property functions - size_t size() const - { return _M_v.size(); } - - template - void - param(OutputIterator __dest) const - { std::copy(_M_v.begin(), _M_v.end(), __dest); } - - private: - /// - std::vector _M_v; - }; - - /* @} */ // group random_utilities - - /* @} */ // group random - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/random.tcc b/openflow/usr/include/c++/5/bits/random.tcc deleted file mode 100644 index f10d052..0000000 --- a/openflow/usr/include/c++/5/bits/random.tcc +++ /dev/null @@ -1,3489 +0,0 @@ -// random number generation (out of line) -*- C++ -*- - -// Copyright (C) 2009-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/random.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{random} - */ - -#ifndef _RANDOM_TCC -#define _RANDOM_TCC 1 - -#include // std::accumulate and std::partial_sum - -namespace std _GLIBCXX_VISIBILITY(default) -{ - /* - * (Further) implementation-space details. - */ - namespace __detail - { - _GLIBCXX_BEGIN_NAMESPACE_VERSION - - // General case for x = (ax + c) mod m -- use Schrage's algorithm - // to avoid integer overflow. - // - // Preconditions: a > 0, m > 0. - // - // Note: only works correctly for __m % __a < __m / __a. - template - _Tp - _Mod<_Tp, __m, __a, __c, false, true>:: - __calc(_Tp __x) - { - if (__a == 1) - __x %= __m; - else - { - static const _Tp __q = __m / __a; - static const _Tp __r = __m % __a; - - _Tp __t1 = __a * (__x % __q); - _Tp __t2 = __r * (__x / __q); - if (__t1 >= __t2) - __x = __t1 - __t2; - else - __x = __m - __t2 + __t1; - } - - if (__c != 0) - { - const _Tp __d = __m - __x; - if (__d > __c) - __x += __c; - else - __x = __c - __d; - } - return __x; - } - - template - _OutputIterator - __normalize(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, const _Tp& __factor) - { - for (; __first != __last; ++__first, ++__result) - *__result = *__first / __factor; - return __result; - } - - _GLIBCXX_END_NAMESPACE_VERSION - } // namespace __detail - -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - constexpr _UIntType - linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier; - - template - constexpr _UIntType - linear_congruential_engine<_UIntType, __a, __c, __m>::increment; - - template - constexpr _UIntType - linear_congruential_engine<_UIntType, __a, __c, __m>::modulus; - - template - constexpr _UIntType - linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed; - - /** - * Seeds the LCR with integral value @p __s, adjusted so that the - * ring identity is never a member of the convergence set. - */ - template - void - linear_congruential_engine<_UIntType, __a, __c, __m>:: - seed(result_type __s) - { - if ((__detail::__mod<_UIntType, __m>(__c) == 0) - && (__detail::__mod<_UIntType, __m>(__s) == 0)) - _M_x = 1; - else - _M_x = __detail::__mod<_UIntType, __m>(__s); - } - - /** - * Seeds the LCR engine with a value generated by @p __q. - */ - template - template - typename std::enable_if::value>::type - linear_congruential_engine<_UIntType, __a, __c, __m>:: - seed(_Sseq& __q) - { - const _UIntType __k0 = __m == 0 ? std::numeric_limits<_UIntType>::digits - : std::__lg(__m); - const _UIntType __k = (__k0 + 31) / 32; - uint_least32_t __arr[__k + 3]; - __q.generate(__arr + 0, __arr + __k + 3); - _UIntType __factor = 1u; - _UIntType __sum = 0u; - for (size_t __j = 0; __j < __k; ++__j) - { - __sum += __arr[__j + 3] * __factor; - __factor *= __detail::_Shift<_UIntType, 32>::__value; - } - seed(__sum); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const linear_congruential_engine<_UIntType, - __a, __c, __m>& __lcr) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); - __os.fill(__os.widen(' ')); - - __os << __lcr._M_x; - - __os.flags(__flags); - __os.fill(__fill); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - linear_congruential_engine<_UIntType, __a, __c, __m>& __lcr) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec); - - __is >> __lcr._M_x; - - __is.flags(__flags); - return __is; - } - - - template - constexpr size_t - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::word_size; - - template - constexpr size_t - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::state_size; - - template - constexpr size_t - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::shift_size; - - template - constexpr size_t - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::mask_bits; - - template - constexpr _UIntType - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::xor_mask; - - template - constexpr size_t - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::tempering_u; - - template - constexpr _UIntType - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::tempering_d; - - template - constexpr size_t - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::tempering_s; - - template - constexpr _UIntType - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::tempering_b; - - template - constexpr size_t - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::tempering_t; - - template - constexpr _UIntType - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::tempering_c; - - template - constexpr size_t - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::tempering_l; - - template - constexpr _UIntType - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>:: - initialization_multiplier; - - template - constexpr _UIntType - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::default_seed; - - template - void - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>:: - seed(result_type __sd) - { - _M_x[0] = __detail::__mod<_UIntType, - __detail::_Shift<_UIntType, __w>::__value>(__sd); - - for (size_t __i = 1; __i < state_size; ++__i) - { - _UIntType __x = _M_x[__i - 1]; - __x ^= __x >> (__w - 2); - __x *= __f; - __x += __detail::__mod<_UIntType, __n>(__i); - _M_x[__i] = __detail::__mod<_UIntType, - __detail::_Shift<_UIntType, __w>::__value>(__x); - } - _M_p = state_size; - } - - template - template - typename std::enable_if::value>::type - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>:: - seed(_Sseq& __q) - { - const _UIntType __upper_mask = (~_UIntType()) << __r; - const size_t __k = (__w + 31) / 32; - uint_least32_t __arr[__n * __k]; - __q.generate(__arr + 0, __arr + __n * __k); - - bool __zero = true; - for (size_t __i = 0; __i < state_size; ++__i) - { - _UIntType __factor = 1u; - _UIntType __sum = 0u; - for (size_t __j = 0; __j < __k; ++__j) - { - __sum += __arr[__k * __i + __j] * __factor; - __factor *= __detail::_Shift<_UIntType, 32>::__value; - } - _M_x[__i] = __detail::__mod<_UIntType, - __detail::_Shift<_UIntType, __w>::__value>(__sum); - - if (__zero) - { - if (__i == 0) - { - if ((_M_x[0] & __upper_mask) != 0u) - __zero = false; - } - else if (_M_x[__i] != 0u) - __zero = false; - } - } - if (__zero) - _M_x[0] = __detail::_Shift<_UIntType, __w - 1>::__value; - _M_p = state_size; - } - - template - void - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>:: - _M_gen_rand(void) - { - const _UIntType __upper_mask = (~_UIntType()) << __r; - const _UIntType __lower_mask = ~__upper_mask; - - for (size_t __k = 0; __k < (__n - __m); ++__k) - { - _UIntType __y = ((_M_x[__k] & __upper_mask) - | (_M_x[__k + 1] & __lower_mask)); - _M_x[__k] = (_M_x[__k + __m] ^ (__y >> 1) - ^ ((__y & 0x01) ? __a : 0)); - } - - for (size_t __k = (__n - __m); __k < (__n - 1); ++__k) - { - _UIntType __y = ((_M_x[__k] & __upper_mask) - | (_M_x[__k + 1] & __lower_mask)); - _M_x[__k] = (_M_x[__k + (__m - __n)] ^ (__y >> 1) - ^ ((__y & 0x01) ? __a : 0)); - } - - _UIntType __y = ((_M_x[__n - 1] & __upper_mask) - | (_M_x[0] & __lower_mask)); - _M_x[__n - 1] = (_M_x[__m - 1] ^ (__y >> 1) - ^ ((__y & 0x01) ? __a : 0)); - _M_p = 0; - } - - template - void - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>:: - discard(unsigned long long __z) - { - while (__z > state_size - _M_p) - { - __z -= state_size - _M_p; - _M_gen_rand(); - } - _M_p += __z; - } - - template - typename - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>::result_type - mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, - __s, __b, __t, __c, __l, __f>:: - operator()() - { - // Reload the vector - cost is O(n) amortized over n calls. - if (_M_p >= state_size) - _M_gen_rand(); - - // Calculate o(x(i)). - result_type __z = _M_x[_M_p++]; - __z ^= (__z >> __u) & __d; - __z ^= (__z << __s) & __b; - __z ^= (__z << __t) & __c; - __z ^= (__z >> __l); - - return __z; - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister_engine<_UIntType, __w, __n, __m, - __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); - __os.fill(__space); - - for (size_t __i = 0; __i < __n; ++__i) - __os << __x._M_x[__i] << __space; - __os << __x._M_p; - - __os.flags(__flags); - __os.fill(__fill); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - mersenne_twister_engine<_UIntType, __w, __n, __m, - __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - for (size_t __i = 0; __i < __n; ++__i) - __is >> __x._M_x[__i]; - __is >> __x._M_p; - - __is.flags(__flags); - return __is; - } - - - template - constexpr size_t - subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size; - - template - constexpr size_t - subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag; - - template - constexpr size_t - subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag; - - template - constexpr _UIntType - subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed; - - template - void - subtract_with_carry_engine<_UIntType, __w, __s, __r>:: - seed(result_type __value) - { - std::linear_congruential_engine - __lcg(__value == 0u ? default_seed : __value); - - const size_t __n = (__w + 31) / 32; - - for (size_t __i = 0; __i < long_lag; ++__i) - { - _UIntType __sum = 0u; - _UIntType __factor = 1u; - for (size_t __j = 0; __j < __n; ++__j) - { - __sum += __detail::__mod::__value> - (__lcg()) * __factor; - __factor *= __detail::_Shift<_UIntType, 32>::__value; - } - _M_x[__i] = __detail::__mod<_UIntType, - __detail::_Shift<_UIntType, __w>::__value>(__sum); - } - _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0; - _M_p = 0; - } - - template - template - typename std::enable_if::value>::type - subtract_with_carry_engine<_UIntType, __w, __s, __r>:: - seed(_Sseq& __q) - { - const size_t __k = (__w + 31) / 32; - uint_least32_t __arr[__r * __k]; - __q.generate(__arr + 0, __arr + __r * __k); - - for (size_t __i = 0; __i < long_lag; ++__i) - { - _UIntType __sum = 0u; - _UIntType __factor = 1u; - for (size_t __j = 0; __j < __k; ++__j) - { - __sum += __arr[__k * __i + __j] * __factor; - __factor *= __detail::_Shift<_UIntType, 32>::__value; - } - _M_x[__i] = __detail::__mod<_UIntType, - __detail::_Shift<_UIntType, __w>::__value>(__sum); - } - _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0; - _M_p = 0; - } - - template - typename subtract_with_carry_engine<_UIntType, __w, __s, __r>:: - result_type - subtract_with_carry_engine<_UIntType, __w, __s, __r>:: - operator()() - { - // Derive short lag index from current index. - long __ps = _M_p - short_lag; - if (__ps < 0) - __ps += long_lag; - - // Calculate new x(i) without overflow or division. - // NB: Thanks to the requirements for _UIntType, _M_x[_M_p] + _M_carry - // cannot overflow. - _UIntType __xi; - if (_M_x[__ps] >= _M_x[_M_p] + _M_carry) - { - __xi = _M_x[__ps] - _M_x[_M_p] - _M_carry; - _M_carry = 0; - } - else - { - __xi = (__detail::_Shift<_UIntType, __w>::__value - - _M_x[_M_p] - _M_carry + _M_x[__ps]); - _M_carry = 1; - } - _M_x[_M_p] = __xi; - - // Adjust current index to loop around in ring buffer. - if (++_M_p >= long_lag) - _M_p = 0; - - return __xi; - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_engine<_UIntType, - __w, __s, __r>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); - __os.fill(__space); - - for (size_t __i = 0; __i < __r; ++__i) - __os << __x._M_x[__i] << __space; - __os << __x._M_carry << __space << __x._M_p; - - __os.flags(__flags); - __os.fill(__fill); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_engine<_UIntType, __w, __s, __r>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - for (size_t __i = 0; __i < __r; ++__i) - __is >> __x._M_x[__i]; - __is >> __x._M_carry; - __is >> __x._M_p; - - __is.flags(__flags); - return __is; - } - - - template - constexpr size_t - discard_block_engine<_RandomNumberEngine, __p, __r>::block_size; - - template - constexpr size_t - discard_block_engine<_RandomNumberEngine, __p, __r>::used_block; - - template - typename discard_block_engine<_RandomNumberEngine, - __p, __r>::result_type - discard_block_engine<_RandomNumberEngine, __p, __r>:: - operator()() - { - if (_M_n >= used_block) - { - _M_b.discard(block_size - _M_n); - _M_n = 0; - } - ++_M_n; - return _M_b(); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const discard_block_engine<_RandomNumberEngine, - __p, __r>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); - __os.fill(__space); - - __os << __x.base() << __space << __x._M_n; - - __os.flags(__flags); - __os.fill(__fill); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - discard_block_engine<_RandomNumberEngine, __p, __r>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - __is >> __x._M_b >> __x._M_n; - - __is.flags(__flags); - return __is; - } - - - template - typename independent_bits_engine<_RandomNumberEngine, __w, _UIntType>:: - result_type - independent_bits_engine<_RandomNumberEngine, __w, _UIntType>:: - operator()() - { - typedef typename _RandomNumberEngine::result_type _Eresult_type; - const _Eresult_type __r - = (_M_b.max() - _M_b.min() < std::numeric_limits<_Eresult_type>::max() - ? _M_b.max() - _M_b.min() + 1 : 0); - const unsigned __edig = std::numeric_limits<_Eresult_type>::digits; - const unsigned __m = __r ? std::__lg(__r) : __edig; - - typedef typename std::common_type<_Eresult_type, result_type>::type - __ctype; - const unsigned __cdig = std::numeric_limits<__ctype>::digits; - - unsigned __n, __n0; - __ctype __s0, __s1, __y0, __y1; - - for (size_t __i = 0; __i < 2; ++__i) - { - __n = (__w + __m - 1) / __m + __i; - __n0 = __n - __w % __n; - const unsigned __w0 = __w / __n; // __w0 <= __m - - __s0 = 0; - __s1 = 0; - if (__w0 < __cdig) - { - __s0 = __ctype(1) << __w0; - __s1 = __s0 << 1; - } - - __y0 = 0; - __y1 = 0; - if (__r) - { - __y0 = __s0 * (__r / __s0); - if (__s1) - __y1 = __s1 * (__r / __s1); - - if (__r - __y0 <= __y0 / __n) - break; - } - else - break; - } - - result_type __sum = 0; - for (size_t __k = 0; __k < __n0; ++__k) - { - __ctype __u; - do - __u = _M_b() - _M_b.min(); - while (__y0 && __u >= __y0); - __sum = __s0 * __sum + (__s0 ? __u % __s0 : __u); - } - for (size_t __k = __n0; __k < __n; ++__k) - { - __ctype __u; - do - __u = _M_b() - _M_b.min(); - while (__y1 && __u >= __y1); - __sum = __s1 * __sum + (__s1 ? __u % __s1 : __u); - } - return __sum; - } - - - template - constexpr size_t - shuffle_order_engine<_RandomNumberEngine, __k>::table_size; - - template - typename shuffle_order_engine<_RandomNumberEngine, __k>::result_type - shuffle_order_engine<_RandomNumberEngine, __k>:: - operator()() - { - size_t __j = __k * ((_M_y - _M_b.min()) - / (_M_b.max() - _M_b.min() + 1.0L)); - _M_y = _M_v[__j]; - _M_v[__j] = _M_b(); - - return _M_y; - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const shuffle_order_engine<_RandomNumberEngine, __k>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); - __os.fill(__space); - - __os << __x.base(); - for (size_t __i = 0; __i < __k; ++__i) - __os << __space << __x._M_v[__i]; - __os << __space << __x._M_y; - - __os.flags(__flags); - __os.fill(__fill); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - shuffle_order_engine<_RandomNumberEngine, __k>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - __is >> __x._M_b; - for (size_t __i = 0; __i < __k; ++__i) - __is >> __x._M_v[__i]; - __is >> __x._M_y; - - __is.flags(__flags); - return __is; - } - - - template - template - typename uniform_int_distribution<_IntType>::result_type - uniform_int_distribution<_IntType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - typedef typename _UniformRandomNumberGenerator::result_type - _Gresult_type; - typedef typename std::make_unsigned::type __utype; - typedef typename std::common_type<_Gresult_type, __utype>::type - __uctype; - - const __uctype __urngmin = __urng.min(); - const __uctype __urngmax = __urng.max(); - const __uctype __urngrange = __urngmax - __urngmin; - const __uctype __urange - = __uctype(__param.b()) - __uctype(__param.a()); - - __uctype __ret; - - if (__urngrange > __urange) - { - // downscaling - const __uctype __uerange = __urange + 1; // __urange can be zero - const __uctype __scaling = __urngrange / __uerange; - const __uctype __past = __uerange * __scaling; - do - __ret = __uctype(__urng()) - __urngmin; - while (__ret >= __past); - __ret /= __scaling; - } - else if (__urngrange < __urange) - { - // upscaling - /* - Note that every value in [0, urange] - can be written uniquely as - - (urngrange + 1) * high + low - - where - - high in [0, urange / (urngrange + 1)] - - and - - low in [0, urngrange]. - */ - __uctype __tmp; // wraparound control - do - { - const __uctype __uerngrange = __urngrange + 1; - __tmp = (__uerngrange * operator() - (__urng, param_type(0, __urange / __uerngrange))); - __ret = __tmp + (__uctype(__urng()) - __urngmin); - } - while (__ret > __urange || __ret < __tmp); - } - else - __ret = __uctype(__urng()) - __urngmin; - - return __ret + __param.a(); - } - - - template - template - void - uniform_int_distribution<_IntType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - typedef typename _UniformRandomNumberGenerator::result_type - _Gresult_type; - typedef typename std::make_unsigned::type __utype; - typedef typename std::common_type<_Gresult_type, __utype>::type - __uctype; - - const __uctype __urngmin = __urng.min(); - const __uctype __urngmax = __urng.max(); - const __uctype __urngrange = __urngmax - __urngmin; - const __uctype __urange - = __uctype(__param.b()) - __uctype(__param.a()); - - __uctype __ret; - - if (__urngrange > __urange) - { - if (__detail::_Power_of_2(__urngrange + 1) - && __detail::_Power_of_2(__urange + 1)) - { - while (__f != __t) - { - __ret = __uctype(__urng()) - __urngmin; - *__f++ = (__ret & __urange) + __param.a(); - } - } - else - { - // downscaling - const __uctype __uerange = __urange + 1; // __urange can be zero - const __uctype __scaling = __urngrange / __uerange; - const __uctype __past = __uerange * __scaling; - while (__f != __t) - { - do - __ret = __uctype(__urng()) - __urngmin; - while (__ret >= __past); - *__f++ = __ret / __scaling + __param.a(); - } - } - } - else if (__urngrange < __urange) - { - // upscaling - /* - Note that every value in [0, urange] - can be written uniquely as - - (urngrange + 1) * high + low - - where - - high in [0, urange / (urngrange + 1)] - - and - - low in [0, urngrange]. - */ - __uctype __tmp; // wraparound control - while (__f != __t) - { - do - { - const __uctype __uerngrange = __urngrange + 1; - __tmp = (__uerngrange * operator() - (__urng, param_type(0, __urange / __uerngrange))); - __ret = __tmp + (__uctype(__urng()) - __urngmin); - } - while (__ret > __urange || __ret < __tmp); - *__f++ = __ret; - } - } - else - while (__f != __t) - *__f++ = __uctype(__urng()) - __urngmin + __param.a(); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const uniform_int_distribution<_IntType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - - __os << __x.a() << __space << __x.b(); - - __os.flags(__flags); - __os.fill(__fill); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - uniform_int_distribution<_IntType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - _IntType __a, __b; - __is >> __a >> __b; - __x.param(typename uniform_int_distribution<_IntType>:: - param_type(__a, __b)); - - __is.flags(__flags); - return __is; - } - - - template - template - void - uniform_real_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - auto __range = __p.b() - __p.a(); - while (__f != __t) - *__f++ = __aurng() * __range + __p.a(); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const uniform_real_distribution<_RealType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits<_RealType>::max_digits10); - - __os << __x.a() << __space << __x.b(); - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - uniform_real_distribution<_RealType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::skipws); - - _RealType __a, __b; - __is >> __a >> __b; - __x.param(typename uniform_real_distribution<_RealType>:: - param_type(__a, __b)); - - __is.flags(__flags); - return __is; - } - - - template - void - std::bernoulli_distribution:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __detail::_Adaptor<_UniformRandomNumberGenerator, double> - __aurng(__urng); - auto __limit = __p.p() * (__aurng.max() - __aurng.min()); - - while (__f != __t) - *__f++ = (__aurng() - __aurng.min()) < __limit; - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const bernoulli_distribution& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__os.widen(' ')); - __os.precision(std::numeric_limits::max_digits10); - - __os << __x.p(); - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - - template - template - typename geometric_distribution<_IntType>::result_type - geometric_distribution<_IntType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - // About the epsilon thing see this thread: - // http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00971.html - const double __naf = - (1 - std::numeric_limits::epsilon()) / 2; - // The largest _RealType convertible to _IntType. - const double __thr = - std::numeric_limits<_IntType>::max() + __naf; - __detail::_Adaptor<_UniformRandomNumberGenerator, double> - __aurng(__urng); - - double __cand; - do - __cand = std::floor(std::log(1.0 - __aurng()) / __param._M_log_1_p); - while (__cand >= __thr); - - return result_type(__cand + __naf); - } - - template - template - void - geometric_distribution<_IntType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - // About the epsilon thing see this thread: - // http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00971.html - const double __naf = - (1 - std::numeric_limits::epsilon()) / 2; - // The largest _RealType convertible to _IntType. - const double __thr = - std::numeric_limits<_IntType>::max() + __naf; - __detail::_Adaptor<_UniformRandomNumberGenerator, double> - __aurng(__urng); - - while (__f != __t) - { - double __cand; - do - __cand = std::floor(std::log(1.0 - __aurng()) - / __param._M_log_1_p); - while (__cand >= __thr); - - *__f++ = __cand + __naf; - } - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const geometric_distribution<_IntType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__os.widen(' ')); - __os.precision(std::numeric_limits::max_digits10); - - __os << __x.p(); - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - geometric_distribution<_IntType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::skipws); - - double __p; - __is >> __p; - __x.param(typename geometric_distribution<_IntType>::param_type(__p)); - - __is.flags(__flags); - return __is; - } - - // This is Leger's algorithm, also in Devroye, Ch. X, Example 1.5. - template - template - typename negative_binomial_distribution<_IntType>::result_type - negative_binomial_distribution<_IntType>:: - operator()(_UniformRandomNumberGenerator& __urng) - { - const double __y = _M_gd(__urng); - - // XXX Is the constructor too slow? - std::poisson_distribution __poisson(__y); - return __poisson(__urng); - } - - template - template - typename negative_binomial_distribution<_IntType>::result_type - negative_binomial_distribution<_IntType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - typedef typename std::gamma_distribution::param_type - param_type; - - const double __y = - _M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p())); - - std::poisson_distribution __poisson(__y); - return __poisson(__urng); - } - - template - template - void - negative_binomial_distribution<_IntType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - while (__f != __t) - { - const double __y = _M_gd(__urng); - - // XXX Is the constructor too slow? - std::poisson_distribution __poisson(__y); - *__f++ = __poisson(__urng); - } - } - - template - template - void - negative_binomial_distribution<_IntType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - typename std::gamma_distribution::param_type - __p2(__p.k(), (1.0 - __p.p()) / __p.p()); - - while (__f != __t) - { - const double __y = _M_gd(__urng, __p2); - - std::poisson_distribution __poisson(__y); - *__f++ = __poisson(__urng); - } - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const negative_binomial_distribution<_IntType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__os.widen(' ')); - __os.precision(std::numeric_limits::max_digits10); - - __os << __x.k() << __space << __x.p() - << __space << __x._M_gd; - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - negative_binomial_distribution<_IntType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::skipws); - - _IntType __k; - double __p; - __is >> __k >> __p >> __x._M_gd; - __x.param(typename negative_binomial_distribution<_IntType>:: - param_type(__k, __p)); - - __is.flags(__flags); - return __is; - } - - - template - void - poisson_distribution<_IntType>::param_type:: - _M_initialize() - { -#if _GLIBCXX_USE_C99_MATH_TR1 - if (_M_mean >= 12) - { - const double __m = std::floor(_M_mean); - _M_lm_thr = std::log(_M_mean); - _M_lfm = std::lgamma(__m + 1); - _M_sm = std::sqrt(__m); - - const double __pi_4 = 0.7853981633974483096156608458198757L; - const double __dx = std::sqrt(2 * __m * std::log(32 * __m - / __pi_4)); - _M_d = std::round(std::max(6.0, std::min(__m, __dx))); - const double __cx = 2 * __m + _M_d; - _M_scx = std::sqrt(__cx / 2); - _M_1cx = 1 / __cx; - - _M_c2b = std::sqrt(__pi_4 * __cx) * std::exp(_M_1cx); - _M_cb = 2 * __cx * std::exp(-_M_d * _M_1cx * (1 + _M_d / 2)) - / _M_d; - } - else -#endif - _M_lm_thr = std::exp(-_M_mean); - } - - /** - * A rejection algorithm when mean >= 12 and a simple method based - * upon the multiplication of uniform random variates otherwise. - * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1 - * is defined. - * - * Reference: - * Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag, - * New York, 1986, Ch. X, Sects. 3.3 & 3.4 (+ Errata!). - */ - template - template - typename poisson_distribution<_IntType>::result_type - poisson_distribution<_IntType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __detail::_Adaptor<_UniformRandomNumberGenerator, double> - __aurng(__urng); -#if _GLIBCXX_USE_C99_MATH_TR1 - if (__param.mean() >= 12) - { - double __x; - - // See comments above... - const double __naf = - (1 - std::numeric_limits::epsilon()) / 2; - const double __thr = - std::numeric_limits<_IntType>::max() + __naf; - - const double __m = std::floor(__param.mean()); - // sqrt(pi / 2) - const double __spi_2 = 1.2533141373155002512078826424055226L; - const double __c1 = __param._M_sm * __spi_2; - const double __c2 = __param._M_c2b + __c1; - const double __c3 = __c2 + 1; - const double __c4 = __c3 + 1; - // e^(1 / 78) - const double __e178 = 1.0129030479320018583185514777512983L; - const double __c5 = __c4 + __e178; - const double __c = __param._M_cb + __c5; - const double __2cx = 2 * (2 * __m + __param._M_d); - - bool __reject = true; - do - { - const double __u = __c * __aurng(); - const double __e = -std::log(1.0 - __aurng()); - - double __w = 0.0; - - if (__u <= __c1) - { - const double __n = _M_nd(__urng); - const double __y = -std::abs(__n) * __param._M_sm - 1; - __x = std::floor(__y); - __w = -__n * __n / 2; - if (__x < -__m) - continue; - } - else if (__u <= __c2) - { - const double __n = _M_nd(__urng); - const double __y = 1 + std::abs(__n) * __param._M_scx; - __x = std::ceil(__y); - __w = __y * (2 - __y) * __param._M_1cx; - if (__x > __param._M_d) - continue; - } - else if (__u <= __c3) - // NB: This case not in the book, nor in the Errata, - // but should be ok... - __x = -1; - else if (__u <= __c4) - __x = 0; - else if (__u <= __c5) - __x = 1; - else - { - const double __v = -std::log(1.0 - __aurng()); - const double __y = __param._M_d - + __v * __2cx / __param._M_d; - __x = std::ceil(__y); - __w = -__param._M_d * __param._M_1cx * (1 + __y / 2); - } - - __reject = (__w - __e - __x * __param._M_lm_thr - > __param._M_lfm - std::lgamma(__x + __m + 1)); - - __reject |= __x + __m >= __thr; - - } while (__reject); - - return result_type(__x + __m + __naf); - } - else -#endif - { - _IntType __x = 0; - double __prod = 1.0; - - do - { - __prod *= __aurng(); - __x += 1; - } - while (__prod > __param._M_lm_thr); - - return __x - 1; - } - } - - template - template - void - poisson_distribution<_IntType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - // We could duplicate everything from operator()... - while (__f != __t) - *__f++ = this->operator()(__urng, __param); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const poisson_distribution<_IntType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits::max_digits10); - - __os << __x.mean() << __space << __x._M_nd; - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - poisson_distribution<_IntType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::skipws); - - double __mean; - __is >> __mean >> __x._M_nd; - __x.param(typename poisson_distribution<_IntType>::param_type(__mean)); - - __is.flags(__flags); - return __is; - } - - - template - void - binomial_distribution<_IntType>::param_type:: - _M_initialize() - { - const double __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p; - - _M_easy = true; - -#if _GLIBCXX_USE_C99_MATH_TR1 - if (_M_t * __p12 >= 8) - { - _M_easy = false; - const double __np = std::floor(_M_t * __p12); - const double __pa = __np / _M_t; - const double __1p = 1 - __pa; - - const double __pi_4 = 0.7853981633974483096156608458198757L; - const double __d1x = - std::sqrt(__np * __1p * std::log(32 * __np - / (81 * __pi_4 * __1p))); - _M_d1 = std::round(std::max(1.0, __d1x)); - const double __d2x = - std::sqrt(__np * __1p * std::log(32 * _M_t * __1p - / (__pi_4 * __pa))); - _M_d2 = std::round(std::max(1.0, __d2x)); - - // sqrt(pi / 2) - const double __spi_2 = 1.2533141373155002512078826424055226L; - _M_s1 = std::sqrt(__np * __1p) * (1 + _M_d1 / (4 * __np)); - _M_s2 = std::sqrt(__np * __1p) * (1 + _M_d2 / (4 * _M_t * __1p)); - _M_c = 2 * _M_d1 / __np; - _M_a1 = std::exp(_M_c) * _M_s1 * __spi_2; - const double __a12 = _M_a1 + _M_s2 * __spi_2; - const double __s1s = _M_s1 * _M_s1; - _M_a123 = __a12 + (std::exp(_M_d1 / (_M_t * __1p)) - * 2 * __s1s / _M_d1 - * std::exp(-_M_d1 * _M_d1 / (2 * __s1s))); - const double __s2s = _M_s2 * _M_s2; - _M_s = (_M_a123 + 2 * __s2s / _M_d2 - * std::exp(-_M_d2 * _M_d2 / (2 * __s2s))); - _M_lf = (std::lgamma(__np + 1) - + std::lgamma(_M_t - __np + 1)); - _M_lp1p = std::log(__pa / __1p); - - _M_q = -std::log(1 - (__p12 - __pa) / __1p); - } - else -#endif - _M_q = -std::log(1 - __p12); - } - - template - template - typename binomial_distribution<_IntType>::result_type - binomial_distribution<_IntType>:: - _M_waiting(_UniformRandomNumberGenerator& __urng, - _IntType __t, double __q) - { - _IntType __x = 0; - double __sum = 0.0; - __detail::_Adaptor<_UniformRandomNumberGenerator, double> - __aurng(__urng); - - do - { - if (__t == __x) - return __x; - const double __e = -std::log(1.0 - __aurng()); - __sum += __e / (__t - __x); - __x += 1; - } - while (__sum <= __q); - - return __x - 1; - } - - /** - * A rejection algorithm when t * p >= 8 and a simple waiting time - * method - the second in the referenced book - otherwise. - * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1 - * is defined. - * - * Reference: - * Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag, - * New York, 1986, Ch. X, Sect. 4 (+ Errata!). - */ - template - template - typename binomial_distribution<_IntType>::result_type - binomial_distribution<_IntType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - result_type __ret; - const _IntType __t = __param.t(); - const double __p = __param.p(); - const double __p12 = __p <= 0.5 ? __p : 1.0 - __p; - __detail::_Adaptor<_UniformRandomNumberGenerator, double> - __aurng(__urng); - -#if _GLIBCXX_USE_C99_MATH_TR1 - if (!__param._M_easy) - { - double __x; - - // See comments above... - const double __naf = - (1 - std::numeric_limits::epsilon()) / 2; - const double __thr = - std::numeric_limits<_IntType>::max() + __naf; - - const double __np = std::floor(__t * __p12); - - // sqrt(pi / 2) - const double __spi_2 = 1.2533141373155002512078826424055226L; - const double __a1 = __param._M_a1; - const double __a12 = __a1 + __param._M_s2 * __spi_2; - const double __a123 = __param._M_a123; - const double __s1s = __param._M_s1 * __param._M_s1; - const double __s2s = __param._M_s2 * __param._M_s2; - - bool __reject; - do - { - const double __u = __param._M_s * __aurng(); - - double __v; - - if (__u <= __a1) - { - const double __n = _M_nd(__urng); - const double __y = __param._M_s1 * std::abs(__n); - __reject = __y >= __param._M_d1; - if (!__reject) - { - const double __e = -std::log(1.0 - __aurng()); - __x = std::floor(__y); - __v = -__e - __n * __n / 2 + __param._M_c; - } - } - else if (__u <= __a12) - { - const double __n = _M_nd(__urng); - const double __y = __param._M_s2 * std::abs(__n); - __reject = __y >= __param._M_d2; - if (!__reject) - { - const double __e = -std::log(1.0 - __aurng()); - __x = std::floor(-__y); - __v = -__e - __n * __n / 2; - } - } - else if (__u <= __a123) - { - const double __e1 = -std::log(1.0 - __aurng()); - const double __e2 = -std::log(1.0 - __aurng()); - - const double __y = __param._M_d1 - + 2 * __s1s * __e1 / __param._M_d1; - __x = std::floor(__y); - __v = (-__e2 + __param._M_d1 * (1 / (__t - __np) - -__y / (2 * __s1s))); - __reject = false; - } - else - { - const double __e1 = -std::log(1.0 - __aurng()); - const double __e2 = -std::log(1.0 - __aurng()); - - const double __y = __param._M_d2 - + 2 * __s2s * __e1 / __param._M_d2; - __x = std::floor(-__y); - __v = -__e2 - __param._M_d2 * __y / (2 * __s2s); - __reject = false; - } - - __reject = __reject || __x < -__np || __x > __t - __np; - if (!__reject) - { - const double __lfx = - std::lgamma(__np + __x + 1) - + std::lgamma(__t - (__np + __x) + 1); - __reject = __v > __param._M_lf - __lfx - + __x * __param._M_lp1p; - } - - __reject |= __x + __np >= __thr; - } - while (__reject); - - __x += __np + __naf; - - const _IntType __z = _M_waiting(__urng, __t - _IntType(__x), - __param._M_q); - __ret = _IntType(__x) + __z; - } - else -#endif - __ret = _M_waiting(__urng, __t, __param._M_q); - - if (__p12 != __p) - __ret = __t - __ret; - return __ret; - } - - template - template - void - binomial_distribution<_IntType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - // We could duplicate everything from operator()... - while (__f != __t) - *__f++ = this->operator()(__urng, __param); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const binomial_distribution<_IntType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits::max_digits10); - - __os << __x.t() << __space << __x.p() - << __space << __x._M_nd; - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - binomial_distribution<_IntType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - _IntType __t; - double __p; - __is >> __t >> __p >> __x._M_nd; - __x.param(typename binomial_distribution<_IntType>:: - param_type(__t, __p)); - - __is.flags(__flags); - return __is; - } - - - template - template - void - std::exponential_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - while (__f != __t) - *__f++ = -std::log(result_type(1) - __aurng()) / __p.lambda(); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const exponential_distribution<_RealType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__os.widen(' ')); - __os.precision(std::numeric_limits<_RealType>::max_digits10); - - __os << __x.lambda(); - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - exponential_distribution<_RealType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - _RealType __lambda; - __is >> __lambda; - __x.param(typename exponential_distribution<_RealType>:: - param_type(__lambda)); - - __is.flags(__flags); - return __is; - } - - - /** - * Polar method due to Marsaglia. - * - * Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag, - * New York, 1986, Ch. V, Sect. 4.4. - */ - template - template - typename normal_distribution<_RealType>::result_type - normal_distribution<_RealType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - result_type __ret; - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - - if (_M_saved_available) - { - _M_saved_available = false; - __ret = _M_saved; - } - else - { - result_type __x, __y, __r2; - do - { - __x = result_type(2.0) * __aurng() - 1.0; - __y = result_type(2.0) * __aurng() - 1.0; - __r2 = __x * __x + __y * __y; - } - while (__r2 > 1.0 || __r2 == 0.0); - - const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2); - _M_saved = __x * __mult; - _M_saved_available = true; - __ret = __y * __mult; - } - - __ret = __ret * __param.stddev() + __param.mean(); - return __ret; - } - - template - template - void - normal_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - - if (__f == __t) - return; - - if (_M_saved_available) - { - _M_saved_available = false; - *__f++ = _M_saved * __param.stddev() + __param.mean(); - - if (__f == __t) - return; - } - - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - - while (__f + 1 < __t) - { - result_type __x, __y, __r2; - do - { - __x = result_type(2.0) * __aurng() - 1.0; - __y = result_type(2.0) * __aurng() - 1.0; - __r2 = __x * __x + __y * __y; - } - while (__r2 > 1.0 || __r2 == 0.0); - - const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2); - *__f++ = __y * __mult * __param.stddev() + __param.mean(); - *__f++ = __x * __mult * __param.stddev() + __param.mean(); - } - - if (__f != __t) - { - result_type __x, __y, __r2; - do - { - __x = result_type(2.0) * __aurng() - 1.0; - __y = result_type(2.0) * __aurng() - 1.0; - __r2 = __x * __x + __y * __y; - } - while (__r2 > 1.0 || __r2 == 0.0); - - const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2); - _M_saved = __x * __mult; - _M_saved_available = true; - *__f = __y * __mult * __param.stddev() + __param.mean(); - } - } - - template - bool - operator==(const std::normal_distribution<_RealType>& __d1, - const std::normal_distribution<_RealType>& __d2) - { - if (__d1._M_param == __d2._M_param - && __d1._M_saved_available == __d2._M_saved_available) - { - if (__d1._M_saved_available - && __d1._M_saved == __d2._M_saved) - return true; - else if(!__d1._M_saved_available) - return true; - else - return false; - } - else - return false; - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const normal_distribution<_RealType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits<_RealType>::max_digits10); - - __os << __x.mean() << __space << __x.stddev() - << __space << __x._M_saved_available; - if (__x._M_saved_available) - __os << __space << __x._M_saved; - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - normal_distribution<_RealType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - double __mean, __stddev; - __is >> __mean >> __stddev - >> __x._M_saved_available; - if (__x._M_saved_available) - __is >> __x._M_saved; - __x.param(typename normal_distribution<_RealType>:: - param_type(__mean, __stddev)); - - __is.flags(__flags); - return __is; - } - - - template - template - void - lognormal_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - while (__f != __t) - *__f++ = std::exp(__p.s() * _M_nd(__urng) + __p.m()); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const lognormal_distribution<_RealType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits<_RealType>::max_digits10); - - __os << __x.m() << __space << __x.s() - << __space << __x._M_nd; - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - lognormal_distribution<_RealType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - _RealType __m, __s; - __is >> __m >> __s >> __x._M_nd; - __x.param(typename lognormal_distribution<_RealType>:: - param_type(__m, __s)); - - __is.flags(__flags); - return __is; - } - - template - template - void - std::chi_squared_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - while (__f != __t) - *__f++ = 2 * _M_gd(__urng); - } - - template - template - void - std::chi_squared_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const typename - std::gamma_distribution::param_type& __p) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - while (__f != __t) - *__f++ = 2 * _M_gd(__urng, __p); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const chi_squared_distribution<_RealType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits<_RealType>::max_digits10); - - __os << __x.n() << __space << __x._M_gd; - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - chi_squared_distribution<_RealType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - _RealType __n; - __is >> __n >> __x._M_gd; - __x.param(typename chi_squared_distribution<_RealType>:: - param_type(__n)); - - __is.flags(__flags); - return __is; - } - - - template - template - typename cauchy_distribution<_RealType>::result_type - cauchy_distribution<_RealType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - _RealType __u; - do - __u = __aurng(); - while (__u == 0.5); - - const _RealType __pi = 3.1415926535897932384626433832795029L; - return __p.a() + __p.b() * std::tan(__pi * __u); - } - - template - template - void - cauchy_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - const _RealType __pi = 3.1415926535897932384626433832795029L; - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - while (__f != __t) - { - _RealType __u; - do - __u = __aurng(); - while (__u == 0.5); - - *__f++ = __p.a() + __p.b() * std::tan(__pi * __u); - } - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const cauchy_distribution<_RealType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits<_RealType>::max_digits10); - - __os << __x.a() << __space << __x.b(); - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - cauchy_distribution<_RealType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - _RealType __a, __b; - __is >> __a >> __b; - __x.param(typename cauchy_distribution<_RealType>:: - param_type(__a, __b)); - - __is.flags(__flags); - return __is; - } - - - template - template - void - std::fisher_f_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - while (__f != __t) - *__f++ = ((_M_gd_x(__urng) * n()) / (_M_gd_y(__urng) * m())); - } - - template - template - void - std::fisher_f_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - typedef typename std::gamma_distribution::param_type - param_type; - param_type __p1(__p.m() / 2); - param_type __p2(__p.n() / 2); - while (__f != __t) - *__f++ = ((_M_gd_x(__urng, __p1) * n()) - / (_M_gd_y(__urng, __p2) * m())); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const fisher_f_distribution<_RealType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits<_RealType>::max_digits10); - - __os << __x.m() << __space << __x.n() - << __space << __x._M_gd_x << __space << __x._M_gd_y; - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - fisher_f_distribution<_RealType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - _RealType __m, __n; - __is >> __m >> __n >> __x._M_gd_x >> __x._M_gd_y; - __x.param(typename fisher_f_distribution<_RealType>:: - param_type(__m, __n)); - - __is.flags(__flags); - return __is; - } - - - template - template - void - std::student_t_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - while (__f != __t) - *__f++ = _M_nd(__urng) * std::sqrt(n() / _M_gd(__urng)); - } - - template - template - void - std::student_t_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - typename std::gamma_distribution::param_type - __p2(__p.n() / 2, 2); - while (__f != __t) - *__f++ = _M_nd(__urng) * std::sqrt(__p.n() / _M_gd(__urng, __p2)); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const student_t_distribution<_RealType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits<_RealType>::max_digits10); - - __os << __x.n() << __space << __x._M_nd << __space << __x._M_gd; - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - student_t_distribution<_RealType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - _RealType __n; - __is >> __n >> __x._M_nd >> __x._M_gd; - __x.param(typename student_t_distribution<_RealType>::param_type(__n)); - - __is.flags(__flags); - return __is; - } - - - template - void - gamma_distribution<_RealType>::param_type:: - _M_initialize() - { - _M_malpha = _M_alpha < 1.0 ? _M_alpha + _RealType(1.0) : _M_alpha; - - const _RealType __a1 = _M_malpha - _RealType(1.0) / _RealType(3.0); - _M_a2 = _RealType(1.0) / std::sqrt(_RealType(9.0) * __a1); - } - - /** - * Marsaglia, G. and Tsang, W. W. - * "A Simple Method for Generating Gamma Variables" - * ACM Transactions on Mathematical Software, 26, 3, 363-372, 2000. - */ - template - template - typename gamma_distribution<_RealType>::result_type - gamma_distribution<_RealType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - - result_type __u, __v, __n; - const result_type __a1 = (__param._M_malpha - - _RealType(1.0) / _RealType(3.0)); - - do - { - do - { - __n = _M_nd(__urng); - __v = result_type(1.0) + __param._M_a2 * __n; - } - while (__v <= 0.0); - - __v = __v * __v * __v; - __u = __aurng(); - } - while (__u > result_type(1.0) - 0.331 * __n * __n * __n * __n - && (std::log(__u) > (0.5 * __n * __n + __a1 - * (1.0 - __v + std::log(__v))))); - - if (__param.alpha() == __param._M_malpha) - return __a1 * __v * __param.beta(); - else - { - do - __u = __aurng(); - while (__u == 0.0); - - return (std::pow(__u, result_type(1.0) / __param.alpha()) - * __a1 * __v * __param.beta()); - } - } - - template - template - void - gamma_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - - result_type __u, __v, __n; - const result_type __a1 = (__param._M_malpha - - _RealType(1.0) / _RealType(3.0)); - - if (__param.alpha() == __param._M_malpha) - while (__f != __t) - { - do - { - do - { - __n = _M_nd(__urng); - __v = result_type(1.0) + __param._M_a2 * __n; - } - while (__v <= 0.0); - - __v = __v * __v * __v; - __u = __aurng(); - } - while (__u > result_type(1.0) - 0.331 * __n * __n * __n * __n - && (std::log(__u) > (0.5 * __n * __n + __a1 - * (1.0 - __v + std::log(__v))))); - - *__f++ = __a1 * __v * __param.beta(); - } - else - while (__f != __t) - { - do - { - do - { - __n = _M_nd(__urng); - __v = result_type(1.0) + __param._M_a2 * __n; - } - while (__v <= 0.0); - - __v = __v * __v * __v; - __u = __aurng(); - } - while (__u > result_type(1.0) - 0.331 * __n * __n * __n * __n - && (std::log(__u) > (0.5 * __n * __n + __a1 - * (1.0 - __v + std::log(__v))))); - - do - __u = __aurng(); - while (__u == 0.0); - - *__f++ = (std::pow(__u, result_type(1.0) / __param.alpha()) - * __a1 * __v * __param.beta()); - } - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const gamma_distribution<_RealType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits<_RealType>::max_digits10); - - __os << __x.alpha() << __space << __x.beta() - << __space << __x._M_nd; - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - gamma_distribution<_RealType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - _RealType __alpha_val, __beta_val; - __is >> __alpha_val >> __beta_val >> __x._M_nd; - __x.param(typename gamma_distribution<_RealType>:: - param_type(__alpha_val, __beta_val)); - - __is.flags(__flags); - return __is; - } - - - template - template - typename weibull_distribution<_RealType>::result_type - weibull_distribution<_RealType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - return __p.b() * std::pow(-std::log(result_type(1) - __aurng()), - result_type(1) / __p.a()); - } - - template - template - void - weibull_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - auto __inv_a = result_type(1) / __p.a(); - - while (__f != __t) - *__f++ = __p.b() * std::pow(-std::log(result_type(1) - __aurng()), - __inv_a); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const weibull_distribution<_RealType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits<_RealType>::max_digits10); - - __os << __x.a() << __space << __x.b(); - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - weibull_distribution<_RealType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - _RealType __a, __b; - __is >> __a >> __b; - __x.param(typename weibull_distribution<_RealType>:: - param_type(__a, __b)); - - __is.flags(__flags); - return __is; - } - - - template - template - typename extreme_value_distribution<_RealType>::result_type - extreme_value_distribution<_RealType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - return __p.a() - __p.b() * std::log(-std::log(result_type(1) - - __aurng())); - } - - template - template - void - extreme_value_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> - __aurng(__urng); - - while (__f != __t) - *__f++ = __p.a() - __p.b() * std::log(-std::log(result_type(1) - - __aurng())); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const extreme_value_distribution<_RealType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits<_RealType>::max_digits10); - - __os << __x.a() << __space << __x.b(); - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - extreme_value_distribution<_RealType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - _RealType __a, __b; - __is >> __a >> __b; - __x.param(typename extreme_value_distribution<_RealType>:: - param_type(__a, __b)); - - __is.flags(__flags); - return __is; - } - - - template - void - discrete_distribution<_IntType>::param_type:: - _M_initialize() - { - if (_M_prob.size() < 2) - { - _M_prob.clear(); - return; - } - - const double __sum = std::accumulate(_M_prob.begin(), - _M_prob.end(), 0.0); - // Now normalize the probabilites. - __detail::__normalize(_M_prob.begin(), _M_prob.end(), _M_prob.begin(), - __sum); - // Accumulate partial sums. - _M_cp.reserve(_M_prob.size()); - std::partial_sum(_M_prob.begin(), _M_prob.end(), - std::back_inserter(_M_cp)); - // Make sure the last cumulative probability is one. - _M_cp[_M_cp.size() - 1] = 1.0; - } - - template - template - discrete_distribution<_IntType>::param_type:: - param_type(size_t __nw, double __xmin, double __xmax, _Func __fw) - : _M_prob(), _M_cp() - { - const size_t __n = __nw == 0 ? 1 : __nw; - const double __delta = (__xmax - __xmin) / __n; - - _M_prob.reserve(__n); - for (size_t __k = 0; __k < __nw; ++__k) - _M_prob.push_back(__fw(__xmin + __k * __delta + 0.5 * __delta)); - - _M_initialize(); - } - - template - template - typename discrete_distribution<_IntType>::result_type - discrete_distribution<_IntType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - if (__param._M_cp.empty()) - return result_type(0); - - __detail::_Adaptor<_UniformRandomNumberGenerator, double> - __aurng(__urng); - - const double __p = __aurng(); - auto __pos = std::lower_bound(__param._M_cp.begin(), - __param._M_cp.end(), __p); - - return __pos - __param._M_cp.begin(); - } - - template - template - void - discrete_distribution<_IntType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - - if (__param._M_cp.empty()) - { - while (__f != __t) - *__f++ = result_type(0); - return; - } - - __detail::_Adaptor<_UniformRandomNumberGenerator, double> - __aurng(__urng); - - while (__f != __t) - { - const double __p = __aurng(); - auto __pos = std::lower_bound(__param._M_cp.begin(), - __param._M_cp.end(), __p); - - *__f++ = __pos - __param._M_cp.begin(); - } - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const discrete_distribution<_IntType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits::max_digits10); - - std::vector __prob = __x.probabilities(); - __os << __prob.size(); - for (auto __dit = __prob.begin(); __dit != __prob.end(); ++__dit) - __os << __space << *__dit; - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - discrete_distribution<_IntType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - size_t __n; - __is >> __n; - - std::vector __prob_vec; - __prob_vec.reserve(__n); - for (; __n != 0; --__n) - { - double __prob; - __is >> __prob; - __prob_vec.push_back(__prob); - } - - __x.param(typename discrete_distribution<_IntType>:: - param_type(__prob_vec.begin(), __prob_vec.end())); - - __is.flags(__flags); - return __is; - } - - - template - void - piecewise_constant_distribution<_RealType>::param_type:: - _M_initialize() - { - if (_M_int.size() < 2 - || (_M_int.size() == 2 - && _M_int[0] == _RealType(0) - && _M_int[1] == _RealType(1))) - { - _M_int.clear(); - _M_den.clear(); - return; - } - - const double __sum = std::accumulate(_M_den.begin(), - _M_den.end(), 0.0); - - __detail::__normalize(_M_den.begin(), _M_den.end(), _M_den.begin(), - __sum); - - _M_cp.reserve(_M_den.size()); - std::partial_sum(_M_den.begin(), _M_den.end(), - std::back_inserter(_M_cp)); - - // Make sure the last cumulative probability is one. - _M_cp[_M_cp.size() - 1] = 1.0; - - for (size_t __k = 0; __k < _M_den.size(); ++__k) - _M_den[__k] /= _M_int[__k + 1] - _M_int[__k]; - } - - template - template - piecewise_constant_distribution<_RealType>::param_type:: - param_type(_InputIteratorB __bbegin, - _InputIteratorB __bend, - _InputIteratorW __wbegin) - : _M_int(), _M_den(), _M_cp() - { - if (__bbegin != __bend) - { - for (;;) - { - _M_int.push_back(*__bbegin); - ++__bbegin; - if (__bbegin == __bend) - break; - - _M_den.push_back(*__wbegin); - ++__wbegin; - } - } - - _M_initialize(); - } - - template - template - piecewise_constant_distribution<_RealType>::param_type:: - param_type(initializer_list<_RealType> __bl, _Func __fw) - : _M_int(), _M_den(), _M_cp() - { - _M_int.reserve(__bl.size()); - for (auto __biter = __bl.begin(); __biter != __bl.end(); ++__biter) - _M_int.push_back(*__biter); - - _M_den.reserve(_M_int.size() - 1); - for (size_t __k = 0; __k < _M_int.size() - 1; ++__k) - _M_den.push_back(__fw(0.5 * (_M_int[__k + 1] + _M_int[__k]))); - - _M_initialize(); - } - - template - template - piecewise_constant_distribution<_RealType>::param_type:: - param_type(size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw) - : _M_int(), _M_den(), _M_cp() - { - const size_t __n = __nw == 0 ? 1 : __nw; - const _RealType __delta = (__xmax - __xmin) / __n; - - _M_int.reserve(__n + 1); - for (size_t __k = 0; __k <= __nw; ++__k) - _M_int.push_back(__xmin + __k * __delta); - - _M_den.reserve(__n); - for (size_t __k = 0; __k < __nw; ++__k) - _M_den.push_back(__fw(_M_int[__k] + 0.5 * __delta)); - - _M_initialize(); - } - - template - template - typename piecewise_constant_distribution<_RealType>::result_type - piecewise_constant_distribution<_RealType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __detail::_Adaptor<_UniformRandomNumberGenerator, double> - __aurng(__urng); - - const double __p = __aurng(); - if (__param._M_cp.empty()) - return __p; - - auto __pos = std::lower_bound(__param._M_cp.begin(), - __param._M_cp.end(), __p); - const size_t __i = __pos - __param._M_cp.begin(); - - const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0; - - return __param._M_int[__i] + (__p - __pref) / __param._M_den[__i]; - } - - template - template - void - piecewise_constant_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __detail::_Adaptor<_UniformRandomNumberGenerator, double> - __aurng(__urng); - - if (__param._M_cp.empty()) - { - while (__f != __t) - *__f++ = __aurng(); - return; - } - - while (__f != __t) - { - const double __p = __aurng(); - - auto __pos = std::lower_bound(__param._M_cp.begin(), - __param._M_cp.end(), __p); - const size_t __i = __pos - __param._M_cp.begin(); - - const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0; - - *__f++ = (__param._M_int[__i] - + (__p - __pref) / __param._M_den[__i]); - } - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const piecewise_constant_distribution<_RealType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits<_RealType>::max_digits10); - - std::vector<_RealType> __int = __x.intervals(); - __os << __int.size() - 1; - - for (auto __xit = __int.begin(); __xit != __int.end(); ++__xit) - __os << __space << *__xit; - - std::vector __den = __x.densities(); - for (auto __dit = __den.begin(); __dit != __den.end(); ++__dit) - __os << __space << *__dit; - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - piecewise_constant_distribution<_RealType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - size_t __n; - __is >> __n; - - std::vector<_RealType> __int_vec; - __int_vec.reserve(__n + 1); - for (size_t __i = 0; __i <= __n; ++__i) - { - _RealType __int; - __is >> __int; - __int_vec.push_back(__int); - } - - std::vector __den_vec; - __den_vec.reserve(__n); - for (size_t __i = 0; __i < __n; ++__i) - { - double __den; - __is >> __den; - __den_vec.push_back(__den); - } - - __x.param(typename piecewise_constant_distribution<_RealType>:: - param_type(__int_vec.begin(), __int_vec.end(), __den_vec.begin())); - - __is.flags(__flags); - return __is; - } - - - template - void - piecewise_linear_distribution<_RealType>::param_type:: - _M_initialize() - { - if (_M_int.size() < 2 - || (_M_int.size() == 2 - && _M_int[0] == _RealType(0) - && _M_int[1] == _RealType(1) - && _M_den[0] == _M_den[1])) - { - _M_int.clear(); - _M_den.clear(); - return; - } - - double __sum = 0.0; - _M_cp.reserve(_M_int.size() - 1); - _M_m.reserve(_M_int.size() - 1); - for (size_t __k = 0; __k < _M_int.size() - 1; ++__k) - { - const _RealType __delta = _M_int[__k + 1] - _M_int[__k]; - __sum += 0.5 * (_M_den[__k + 1] + _M_den[__k]) * __delta; - _M_cp.push_back(__sum); - _M_m.push_back((_M_den[__k + 1] - _M_den[__k]) / __delta); - } - - // Now normalize the densities... - __detail::__normalize(_M_den.begin(), _M_den.end(), _M_den.begin(), - __sum); - // ... and partial sums... - __detail::__normalize(_M_cp.begin(), _M_cp.end(), _M_cp.begin(), __sum); - // ... and slopes. - __detail::__normalize(_M_m.begin(), _M_m.end(), _M_m.begin(), __sum); - - // Make sure the last cumulative probablility is one. - _M_cp[_M_cp.size() - 1] = 1.0; - } - - template - template - piecewise_linear_distribution<_RealType>::param_type:: - param_type(_InputIteratorB __bbegin, - _InputIteratorB __bend, - _InputIteratorW __wbegin) - : _M_int(), _M_den(), _M_cp(), _M_m() - { - for (; __bbegin != __bend; ++__bbegin, ++__wbegin) - { - _M_int.push_back(*__bbegin); - _M_den.push_back(*__wbegin); - } - - _M_initialize(); - } - - template - template - piecewise_linear_distribution<_RealType>::param_type:: - param_type(initializer_list<_RealType> __bl, _Func __fw) - : _M_int(), _M_den(), _M_cp(), _M_m() - { - _M_int.reserve(__bl.size()); - _M_den.reserve(__bl.size()); - for (auto __biter = __bl.begin(); __biter != __bl.end(); ++__biter) - { - _M_int.push_back(*__biter); - _M_den.push_back(__fw(*__biter)); - } - - _M_initialize(); - } - - template - template - piecewise_linear_distribution<_RealType>::param_type:: - param_type(size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw) - : _M_int(), _M_den(), _M_cp(), _M_m() - { - const size_t __n = __nw == 0 ? 1 : __nw; - const _RealType __delta = (__xmax - __xmin) / __n; - - _M_int.reserve(__n + 1); - _M_den.reserve(__n + 1); - for (size_t __k = 0; __k <= __nw; ++__k) - { - _M_int.push_back(__xmin + __k * __delta); - _M_den.push_back(__fw(_M_int[__k] + __delta)); - } - - _M_initialize(); - } - - template - template - typename piecewise_linear_distribution<_RealType>::result_type - piecewise_linear_distribution<_RealType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __detail::_Adaptor<_UniformRandomNumberGenerator, double> - __aurng(__urng); - - const double __p = __aurng(); - if (__param._M_cp.empty()) - return __p; - - auto __pos = std::lower_bound(__param._M_cp.begin(), - __param._M_cp.end(), __p); - const size_t __i = __pos - __param._M_cp.begin(); - - const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0; - - const double __a = 0.5 * __param._M_m[__i]; - const double __b = __param._M_den[__i]; - const double __cm = __p - __pref; - - _RealType __x = __param._M_int[__i]; - if (__a == 0) - __x += __cm / __b; - else - { - const double __d = __b * __b + 4.0 * __a * __cm; - __x += 0.5 * (std::sqrt(__d) - __b) / __a; - } - - return __x; - } - - template - template - void - piecewise_linear_distribution<_RealType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - // We could duplicate everything from operator()... - while (__f != __t) - *__f++ = this->operator()(__urng, __param); - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const piecewise_linear_distribution<_RealType>& __x) - { - typedef std::basic_ostream<_CharT, _Traits> __ostream_type; - typedef typename __ostream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __os.flags(); - const _CharT __fill = __os.fill(); - const std::streamsize __precision = __os.precision(); - const _CharT __space = __os.widen(' '); - __os.flags(__ios_base::scientific | __ios_base::left); - __os.fill(__space); - __os.precision(std::numeric_limits<_RealType>::max_digits10); - - std::vector<_RealType> __int = __x.intervals(); - __os << __int.size() - 1; - - for (auto __xit = __int.begin(); __xit != __int.end(); ++__xit) - __os << __space << *__xit; - - std::vector __den = __x.densities(); - for (auto __dit = __den.begin(); __dit != __den.end(); ++__dit) - __os << __space << *__dit; - - __os.flags(__flags); - __os.fill(__fill); - __os.precision(__precision); - return __os; - } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - piecewise_linear_distribution<_RealType>& __x) - { - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - const typename __ios_base::fmtflags __flags = __is.flags(); - __is.flags(__ios_base::dec | __ios_base::skipws); - - size_t __n; - __is >> __n; - - std::vector<_RealType> __int_vec; - __int_vec.reserve(__n + 1); - for (size_t __i = 0; __i <= __n; ++__i) - { - _RealType __int; - __is >> __int; - __int_vec.push_back(__int); - } - - std::vector __den_vec; - __den_vec.reserve(__n + 1); - for (size_t __i = 0; __i <= __n; ++__i) - { - double __den; - __is >> __den; - __den_vec.push_back(__den); - } - - __x.param(typename piecewise_linear_distribution<_RealType>:: - param_type(__int_vec.begin(), __int_vec.end(), __den_vec.begin())); - - __is.flags(__flags); - return __is; - } - - - template - seed_seq::seed_seq(std::initializer_list<_IntType> __il) - { - for (auto __iter = __il.begin(); __iter != __il.end(); ++__iter) - _M_v.push_back(__detail::__mod::__value>(*__iter)); - } - - template - seed_seq::seed_seq(_InputIterator __begin, _InputIterator __end) - { - for (_InputIterator __iter = __begin; __iter != __end; ++__iter) - _M_v.push_back(__detail::__mod::__value>(*__iter)); - } - - template - void - seed_seq::generate(_RandomAccessIterator __begin, - _RandomAccessIterator __end) - { - typedef typename iterator_traits<_RandomAccessIterator>::value_type - _Type; - - if (__begin == __end) - return; - - std::fill(__begin, __end, _Type(0x8b8b8b8bu)); - - const size_t __n = __end - __begin; - const size_t __s = _M_v.size(); - const size_t __t = (__n >= 623) ? 11 - : (__n >= 68) ? 7 - : (__n >= 39) ? 5 - : (__n >= 7) ? 3 - : (__n - 1) / 2; - const size_t __p = (__n - __t) / 2; - const size_t __q = __p + __t; - const size_t __m = std::max(size_t(__s + 1), __n); - - for (size_t __k = 0; __k < __m; ++__k) - { - _Type __arg = (__begin[__k % __n] - ^ __begin[(__k + __p) % __n] - ^ __begin[(__k - 1) % __n]); - _Type __r1 = __arg ^ (__arg >> 27); - __r1 = __detail::__mod<_Type, - __detail::_Shift<_Type, 32>::__value>(1664525u * __r1); - _Type __r2 = __r1; - if (__k == 0) - __r2 += __s; - else if (__k <= __s) - __r2 += __k % __n + _M_v[__k - 1]; - else - __r2 += __k % __n; - __r2 = __detail::__mod<_Type, - __detail::_Shift<_Type, 32>::__value>(__r2); - __begin[(__k + __p) % __n] += __r1; - __begin[(__k + __q) % __n] += __r2; - __begin[__k % __n] = __r2; - } - - for (size_t __k = __m; __k < __m + __n; ++__k) - { - _Type __arg = (__begin[__k % __n] - + __begin[(__k + __p) % __n] - + __begin[(__k - 1) % __n]); - _Type __r3 = __arg ^ (__arg >> 27); - __r3 = __detail::__mod<_Type, - __detail::_Shift<_Type, 32>::__value>(1566083941u * __r3); - _Type __r4 = __r3 - __k % __n; - __r4 = __detail::__mod<_Type, - __detail::_Shift<_Type, 32>::__value>(__r4); - __begin[(__k + __p) % __n] ^= __r3; - __begin[(__k + __q) % __n] ^= __r4; - __begin[__k % __n] = __r4; - } - } - - template - _RealType - generate_canonical(_UniformRandomNumberGenerator& __urng) - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - const size_t __b - = std::min(static_cast(std::numeric_limits<_RealType>::digits), - __bits); - const long double __r = static_cast(__urng.max()) - - static_cast(__urng.min()) + 1.0L; - const size_t __log2r = std::log(__r) / std::log(2.0L); - size_t __k = std::max(1UL, (__b + __log2r - 1UL) / __log2r); - _RealType __sum = _RealType(0); - _RealType __tmp = _RealType(1); - for (; __k != 0; --__k) - { - __sum += _RealType(__urng() - __urng.min()) * __tmp; - __tmp *= __r; - } - return __sum / __tmp; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/bits/range_access.h b/openflow/usr/include/c++/5/bits/range_access.h deleted file mode 100644 index 89dc4d6..0000000 --- a/openflow/usr/include/c++/5/bits/range_access.h +++ /dev/null @@ -1,238 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2010-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/range_access.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iterator} - */ - -#ifndef _GLIBCXX_RANGE_ACCESS_H -#define _GLIBCXX_RANGE_ACCESS_H 1 - -#pragma GCC system_header - -#if __cplusplus >= 201103L -#include -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @brief Return an iterator pointing to the first element of - * the container. - * @param __cont Container. - */ - template - inline auto - begin(_Container& __cont) -> decltype(__cont.begin()) - { return __cont.begin(); } - - /** - * @brief Return an iterator pointing to the first element of - * the const container. - * @param __cont Container. - */ - template - inline auto - begin(const _Container& __cont) -> decltype(__cont.begin()) - { return __cont.begin(); } - - /** - * @brief Return an iterator pointing to one past the last element of - * the container. - * @param __cont Container. - */ - template - inline auto - end(_Container& __cont) -> decltype(__cont.end()) - { return __cont.end(); } - - /** - * @brief Return an iterator pointing to one past the last element of - * the const container. - * @param __cont Container. - */ - template - inline auto - end(const _Container& __cont) -> decltype(__cont.end()) - { return __cont.end(); } - - /** - * @brief Return an iterator pointing to the first element of the array. - * @param __arr Array. - */ - template - inline _GLIBCXX14_CONSTEXPR _Tp* - begin(_Tp (&__arr)[_Nm]) - { return __arr; } - - /** - * @brief Return an iterator pointing to one past the last element - * of the array. - * @param __arr Array. - */ - template - inline _GLIBCXX14_CONSTEXPR _Tp* - end(_Tp (&__arr)[_Nm]) - { return __arr + _Nm; } - -#if __cplusplus >= 201402L - - template class valarray; - // These overloads must be declared for cbegin and cend to use them. - template _Tp* begin(valarray<_Tp>&); - template const _Tp* begin(const valarray<_Tp>&); - template _Tp* end(valarray<_Tp>&); - template const _Tp* end(const valarray<_Tp>&); - - /** - * @brief Return an iterator pointing to the first element of - * the const container. - * @param __cont Container. - */ - template - inline constexpr auto - cbegin(const _Container& __cont) noexcept(noexcept(std::begin(__cont))) - -> decltype(std::begin(__cont)) - { return std::begin(__cont); } - - /** - * @brief Return an iterator pointing to one past the last element of - * the const container. - * @param __cont Container. - */ - template - inline constexpr auto - cend(const _Container& __cont) noexcept(noexcept(std::end(__cont))) - -> decltype(std::end(__cont)) - { return std::end(__cont); } - - /** - * @brief Return a reverse iterator pointing to the last element of - * the container. - * @param __cont Container. - */ - template - inline auto - rbegin(_Container& __cont) -> decltype(__cont.rbegin()) - { return __cont.rbegin(); } - - /** - * @brief Return a reverse iterator pointing to the last element of - * the const container. - * @param __cont Container. - */ - template - inline auto - rbegin(const _Container& __cont) -> decltype(__cont.rbegin()) - { return __cont.rbegin(); } - - /** - * @brief Return a reverse iterator pointing one past the first element of - * the container. - * @param __cont Container. - */ - template - inline auto - rend(_Container& __cont) -> decltype(__cont.rend()) - { return __cont.rend(); } - - /** - * @brief Return a reverse iterator pointing one past the first element of - * the const container. - * @param __cont Container. - */ - template - inline auto - rend(const _Container& __cont) -> decltype(__cont.rend()) - { return __cont.rend(); } - - /** - * @brief Return a reverse iterator pointing to the last element of - * the array. - * @param __arr Array. - */ - template - inline reverse_iterator<_Tp*> - rbegin(_Tp (&__arr)[_Nm]) - { return reverse_iterator<_Tp*>(__arr + _Nm); } - - /** - * @brief Return a reverse iterator pointing one past the first element of - * the array. - * @param __arr Array. - */ - template - inline reverse_iterator<_Tp*> - rend(_Tp (&__arr)[_Nm]) - { return reverse_iterator<_Tp*>(__arr); } - - /** - * @brief Return a reverse iterator pointing to the last element of - * the initializer_list. - * @param __il initializer_list. - */ - template - inline reverse_iterator - rbegin(initializer_list<_Tp> __il) - { return reverse_iterator(__il.end()); } - - /** - * @brief Return a reverse iterator pointing one past the first element of - * the initializer_list. - * @param __il initializer_list. - */ - template - inline reverse_iterator - rend(initializer_list<_Tp> __il) - { return reverse_iterator(__il.begin()); } - - /** - * @brief Return a reverse iterator pointing to the last element of - * the const container. - * @param __cont Container. - */ - template - inline auto - crbegin(const _Container& __cont) -> decltype(std::rbegin(__cont)) - { return std::rbegin(__cont); } - - /** - * @brief Return a reverse iterator pointing one past the first element of - * the const container. - * @param __cont Container. - */ - template - inline auto - crend(const _Container& __cont) -> decltype(std::rend(__cont)) - { return std::rend(__cont); } - -#endif // C++14 - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif // C++11 - -#endif // _GLIBCXX_RANGE_ACCESS_H diff --git a/openflow/usr/include/c++/5/bits/regex.h b/openflow/usr/include/c++/5/bits/regex.h deleted file mode 100644 index a23c2c9..0000000 --- a/openflow/usr/include/c++/5/bits/regex.h +++ /dev/null @@ -1,2796 +0,0 @@ -// class template regex -*- C++ -*- - -// Copyright (C) 2010-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file bits/regex.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{regex} - */ - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - template - class basic_regex; - - template - class match_results; - -_GLIBCXX_END_NAMESPACE_CXX11 -_GLIBCXX_END_NAMESPACE_VERSION - -namespace __detail -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - enum class _RegexExecutorPolicy : int - { _S_auto, _S_alternate }; - - template - bool - __regex_algo_impl(_BiIter __s, - _BiIter __e, - match_results<_BiIter, _Alloc>& __m, - const basic_regex<_CharT, _TraitsT>& __re, - regex_constants::match_flag_type __flags); - - template - class _Executor; - -_GLIBCXX_END_NAMESPACE_VERSION -} - -_GLIBCXX_BEGIN_NAMESPACE_VERSION -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - - /** - * @addtogroup regex - * @{ - */ - - /** - * @brief Describes aspects of a regular expression. - * - * A regular expression traits class that satisfies the requirements of - * section [28.7]. - * - * The class %regex is parameterized around a set of related types and - * functions used to complete the definition of its semantics. This class - * satisfies the requirements of such a traits class. - */ - template - struct regex_traits - { - public: - typedef _Ch_type char_type; - typedef std::basic_string string_type; - typedef std::locale locale_type; - private: - struct _RegexMask - { - typedef std::ctype_base::mask _BaseType; - _BaseType _M_base; - unsigned char _M_extended; - static constexpr unsigned char _S_under = 1 << 0; - static constexpr unsigned char _S_valid_mask = 0x1; - - constexpr _RegexMask(_BaseType __base = 0, - unsigned char __extended = 0) - : _M_base(__base), _M_extended(__extended) - { } - - constexpr _RegexMask - operator&(_RegexMask __other) const - { - return _RegexMask(_M_base & __other._M_base, - _M_extended & __other._M_extended); - } - - constexpr _RegexMask - operator|(_RegexMask __other) const - { - return _RegexMask(_M_base | __other._M_base, - _M_extended | __other._M_extended); - } - - constexpr _RegexMask - operator^(_RegexMask __other) const - { - return _RegexMask(_M_base ^ __other._M_base, - _M_extended ^ __other._M_extended); - } - - constexpr _RegexMask - operator~() const - { return _RegexMask(~_M_base, ~_M_extended); } - - _RegexMask& - operator&=(_RegexMask __other) - { return *this = (*this) & __other; } - - _RegexMask& - operator|=(_RegexMask __other) - { return *this = (*this) | __other; } - - _RegexMask& - operator^=(_RegexMask __other) - { return *this = (*this) ^ __other; } - - constexpr bool - operator==(_RegexMask __other) const - { - return (_M_extended & _S_valid_mask) - == (__other._M_extended & _S_valid_mask) - && _M_base == __other._M_base; - } - - constexpr bool - operator!=(_RegexMask __other) const - { return !((*this) == __other); } - - }; - public: - typedef _RegexMask char_class_type; - - public: - /** - * @brief Constructs a default traits object. - */ - regex_traits() { } - - /** - * @brief Gives the length of a C-style string starting at @p __p. - * - * @param __p a pointer to the start of a character sequence. - * - * @returns the number of characters between @p *__p and the first - * default-initialized value of type @p char_type. In other words, uses - * the C-string algorithm for determining the length of a sequence of - * characters. - */ - static std::size_t - length(const char_type* __p) - { return string_type::traits_type::length(__p); } - - /** - * @brief Performs the identity translation. - * - * @param __c A character to the locale-specific character set. - * - * @returns __c. - */ - char_type - translate(char_type __c) const - { return __c; } - - /** - * @brief Translates a character into a case-insensitive equivalent. - * - * @param __c A character to the locale-specific character set. - * - * @returns the locale-specific lower-case equivalent of __c. - * @throws std::bad_cast if the imbued locale does not support the ctype - * facet. - */ - char_type - translate_nocase(char_type __c) const - { - typedef std::ctype __ctype_type; - const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale)); - return __fctyp.tolower(__c); - } - - /** - * @brief Gets a sort key for a character sequence. - * - * @param __first beginning of the character sequence. - * @param __last one-past-the-end of the character sequence. - * - * Returns a sort key for the character sequence designated by the - * iterator range [F1, F2) such that if the character sequence [G1, G2) - * sorts before the character sequence [H1, H2) then - * v.transform(G1, G2) < v.transform(H1, H2). - * - * What this really does is provide a more efficient way to compare a - * string to multiple other strings in locales with fancy collation - * rules and equivalence classes. - * - * @returns a locale-specific sort key equivalent to the input range. - * - * @throws std::bad_cast if the current locale does not have a collate - * facet. - */ - template - string_type - transform(_Fwd_iter __first, _Fwd_iter __last) const - { - typedef std::collate __collate_type; - const __collate_type& __fclt(use_facet<__collate_type>(_M_locale)); - string_type __s(__first, __last); - return __fclt.transform(__s.data(), __s.data() + __s.size()); - } - - /** - * @brief Gets a sort key for a character sequence, independent of case. - * - * @param __first beginning of the character sequence. - * @param __last one-past-the-end of the character sequence. - * - * Effects: if typeid(use_facet >) == - * typeid(collate_byname<_Ch_type>) and the form of the sort key - * returned by collate_byname<_Ch_type>::transform(__first, __last) - * is known and can be converted into a primary sort key - * then returns that key, otherwise returns an empty string. - * - * @todo Implement this function correctly. - */ - template - string_type - transform_primary(_Fwd_iter __first, _Fwd_iter __last) const - { - // TODO : this is not entirely correct. - // This function requires extra support from the platform. - // - // Read http://gcc.gnu.org/ml/libstdc++/2013-09/msg00117.html and - // http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2003/n1429.htm - // for details. - typedef std::ctype __ctype_type; - const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale)); - std::vector __s(__first, __last); - __fctyp.tolower(__s.data(), __s.data() + __s.size()); - return this->transform(__s.data(), __s.data() + __s.size()); - } - - /** - * @brief Gets a collation element by name. - * - * @param __first beginning of the collation element name. - * @param __last one-past-the-end of the collation element name. - * - * @returns a sequence of one or more characters that represents the - * collating element consisting of the character sequence designated by - * the iterator range [__first, __last). Returns an empty string if the - * character sequence is not a valid collating element. - */ - template - string_type - lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const; - - /** - * @brief Maps one or more characters to a named character - * classification. - * - * @param __first beginning of the character sequence. - * @param __last one-past-the-end of the character sequence. - * @param __icase ignores the case of the classification name. - * - * @returns an unspecified value that represents the character - * classification named by the character sequence designated by - * the iterator range [__first, __last). If @p icase is true, - * the returned mask identifies the classification regardless of - * the case of the characters to be matched (for example, - * [[:lower:]] is the same as [[:alpha:]]), otherwise a - * case-dependent classification is returned. The value - * returned shall be independent of the case of the characters - * in the character sequence. If the name is not recognized then - * returns a value that compares equal to 0. - * - * At least the following names (or their wide-character equivalent) are - * supported. - * - d - * - w - * - s - * - alnum - * - alpha - * - blank - * - cntrl - * - digit - * - graph - * - lower - * - print - * - punct - * - space - * - upper - * - xdigit - */ - template - char_class_type - lookup_classname(_Fwd_iter __first, _Fwd_iter __last, - bool __icase = false) const; - - /** - * @brief Determines if @p c is a member of an identified class. - * - * @param __c a character. - * @param __f a class type (as returned from lookup_classname). - * - * @returns true if the character @p __c is a member of the classification - * represented by @p __f, false otherwise. - * - * @throws std::bad_cast if the current locale does not have a ctype - * facet. - */ - bool - isctype(_Ch_type __c, char_class_type __f) const; - - /** - * @brief Converts a digit to an int. - * - * @param __ch a character representing a digit. - * @param __radix the radix if the numeric conversion (limited to 8, 10, - * or 16). - * - * @returns the value represented by the digit __ch in base radix if the - * character __ch is a valid digit in base radix; otherwise returns -1. - */ - int - value(_Ch_type __ch, int __radix) const; - - /** - * @brief Imbues the regex_traits object with a copy of a new locale. - * - * @param __loc A locale. - * - * @returns a copy of the previous locale in use by the regex_traits - * object. - * - * @note Calling imbue with a different locale than the one currently in - * use invalidates all cached data held by *this. - */ - locale_type - imbue(locale_type __loc) - { - std::swap(_M_locale, __loc); - return __loc; - } - - /** - * @brief Gets a copy of the current locale in use by the regex_traits - * object. - */ - locale_type - getloc() const - { return _M_locale; } - - protected: - locale_type _M_locale; - }; - - // [7.8] Class basic_regex - /** - * Objects of specializations of this class represent regular expressions - * constructed from sequences of character type @p _Ch_type. - * - * Storage for the regular expression is allocated and deallocated as - * necessary by the member functions of this class. - */ - template> - class basic_regex - { - public: - static_assert(is_same<_Ch_type, typename _Rx_traits::char_type>::value, - "regex traits class must have the same char_type"); - - // types: - typedef _Ch_type value_type; - typedef _Rx_traits traits_type; - typedef typename traits_type::string_type string_type; - typedef regex_constants::syntax_option_type flag_type; - typedef typename traits_type::locale_type locale_type; - - /** - * @name Constants - * std [28.8.1](1) - */ - //@{ - static constexpr flag_type icase = regex_constants::icase; - static constexpr flag_type nosubs = regex_constants::nosubs; - static constexpr flag_type optimize = regex_constants::optimize; - static constexpr flag_type collate = regex_constants::collate; - static constexpr flag_type ECMAScript = regex_constants::ECMAScript; - static constexpr flag_type basic = regex_constants::basic; - static constexpr flag_type extended = regex_constants::extended; - static constexpr flag_type awk = regex_constants::awk; - static constexpr flag_type grep = regex_constants::grep; - static constexpr flag_type egrep = regex_constants::egrep; - //@} - - // [7.8.2] construct/copy/destroy - /** - * Constructs a basic regular expression that does not match any - * character sequence. - */ - basic_regex() - : _M_flags(ECMAScript), _M_loc(), _M_automaton(nullptr) - { } - - /** - * @brief Constructs a basic regular expression from the - * sequence [__p, __p + char_traits<_Ch_type>::length(__p)) - * interpreted according to the flags in @p __f. - * - * @param __p A pointer to the start of a C-style null-terminated string - * containing a regular expression. - * @param __f Flags indicating the syntax rules and options. - * - * @throws regex_error if @p __p is not a valid regular expression. - */ - explicit - basic_regex(const _Ch_type* __p, flag_type __f = ECMAScript) - : basic_regex(__p, __p + char_traits<_Ch_type>::length(__p), __f) - { } - - /** - * @brief Constructs a basic regular expression from the sequence - * [p, p + len) interpreted according to the flags in @p f. - * - * @param __p A pointer to the start of a string containing a regular - * expression. - * @param __len The length of the string containing the regular - * expression. - * @param __f Flags indicating the syntax rules and options. - * - * @throws regex_error if @p __p is not a valid regular expression. - */ - basic_regex(const _Ch_type* __p, std::size_t __len, - flag_type __f = ECMAScript) - : basic_regex(__p, __p + __len, __f) - { } - - /** - * @brief Copy-constructs a basic regular expression. - * - * @param __rhs A @p regex object. - */ - basic_regex(const basic_regex& __rhs) = default; - - /** - * @brief Move-constructs a basic regular expression. - * - * @param __rhs A @p regex object. - */ - basic_regex(basic_regex&& __rhs) noexcept = default; - - /** - * @brief Constructs a basic regular expression from the string - * @p s interpreted according to the flags in @p f. - * - * @param __s A string containing a regular expression. - * @param __f Flags indicating the syntax rules and options. - * - * @throws regex_error if @p __s is not a valid regular expression. - */ - template - explicit - basic_regex(const std::basic_string<_Ch_type, _Ch_traits, - _Ch_alloc>& __s, - flag_type __f = ECMAScript) - : basic_regex(__s.data(), __s.data() + __s.size(), __f) - { } - - /** - * @brief Constructs a basic regular expression from the range - * [first, last) interpreted according to the flags in @p f. - * - * @param __first The start of a range containing a valid regular - * expression. - * @param __last The end of a range containing a valid regular - * expression. - * @param __f The format flags of the regular expression. - * - * @throws regex_error if @p [__first, __last) is not a valid regular - * expression. - */ - template - basic_regex(_FwdIter __first, _FwdIter __last, - flag_type __f = ECMAScript) - : basic_regex(std::move(__first), std::move(__last), locale_type(), __f) - { } - - /** - * @brief Constructs a basic regular expression from an initializer list. - * - * @param __l The initializer list. - * @param __f The format flags of the regular expression. - * - * @throws regex_error if @p __l is not a valid regular expression. - */ - basic_regex(initializer_list<_Ch_type> __l, flag_type __f = ECMAScript) - : basic_regex(__l.begin(), __l.end(), __f) - { } - - /** - * @brief Destroys a basic regular expression. - */ - ~basic_regex() - { } - - /** - * @brief Assigns one regular expression to another. - */ - basic_regex& - operator=(const basic_regex& __rhs) - { return this->assign(__rhs); } - - /** - * @brief Move-assigns one regular expression to another. - */ - basic_regex& - operator=(basic_regex&& __rhs) noexcept - { return this->assign(std::move(__rhs)); } - - /** - * @brief Replaces a regular expression with a new one constructed from - * a C-style null-terminated string. - * - * @param __p A pointer to the start of a null-terminated C-style string - * containing a regular expression. - */ - basic_regex& - operator=(const _Ch_type* __p) - { return this->assign(__p); } - - /** - * @brief Replaces a regular expression with a new one constructed from - * an initializer list. - * - * @param __l The initializer list. - * - * @throws regex_error if @p __l is not a valid regular expression. - */ - basic_regex& - operator=(initializer_list<_Ch_type> __l) - { return this->assign(__l.begin(), __l.end()); } - - /** - * @brief Replaces a regular expression with a new one constructed from - * a string. - * - * @param __s A pointer to a string containing a regular expression. - */ - template - basic_regex& - operator=(const basic_string<_Ch_type, _Ch_traits, _Alloc>& __s) - { return this->assign(__s); } - - // [7.8.3] assign - /** - * @brief the real assignment operator. - * - * @param __rhs Another regular expression object. - */ - basic_regex& - assign(const basic_regex& __rhs) - { - basic_regex __tmp(__rhs); - this->swap(__tmp); - return *this; - } - - /** - * @brief The move-assignment operator. - * - * @param __rhs Another regular expression object. - */ - basic_regex& - assign(basic_regex&& __rhs) noexcept - { - basic_regex __tmp(std::move(__rhs)); - this->swap(__tmp); - return *this; - } - - /** - * @brief Assigns a new regular expression to a regex object from a - * C-style null-terminated string containing a regular expression - * pattern. - * - * @param __p A pointer to a C-style null-terminated string containing - * a regular expression pattern. - * @param __flags Syntax option flags. - * - * @throws regex_error if __p does not contain a valid regular - * expression pattern interpreted according to @p __flags. If - * regex_error is thrown, *this remains unchanged. - */ - basic_regex& - assign(const _Ch_type* __p, flag_type __flags = ECMAScript) - { return this->assign(string_type(__p), __flags); } - - /** - * @brief Assigns a new regular expression to a regex object from a - * C-style string containing a regular expression pattern. - * - * @param __p A pointer to a C-style string containing a - * regular expression pattern. - * @param __len The length of the regular expression pattern string. - * @param __flags Syntax option flags. - * - * @throws regex_error if p does not contain a valid regular - * expression pattern interpreted according to @p __flags. If - * regex_error is thrown, *this remains unchanged. - */ - basic_regex& - assign(const _Ch_type* __p, std::size_t __len, flag_type __flags) - { return this->assign(string_type(__p, __len), __flags); } - - /** - * @brief Assigns a new regular expression to a regex object from a - * string containing a regular expression pattern. - * - * @param __s A string containing a regular expression pattern. - * @param __flags Syntax option flags. - * - * @throws regex_error if __s does not contain a valid regular - * expression pattern interpreted according to @p __flags. If - * regex_error is thrown, *this remains unchanged. - */ - template - basic_regex& - assign(const basic_string<_Ch_type, _Ch_traits, _Alloc>& __s, - flag_type __flags = ECMAScript) - { - return this->assign(basic_regex(__s.data(), __s.data() + __s.size(), - _M_loc, __flags)); - } - - /** - * @brief Assigns a new regular expression to a regex object. - * - * @param __first The start of a range containing a valid regular - * expression. - * @param __last The end of a range containing a valid regular - * expression. - * @param __flags Syntax option flags. - * - * @throws regex_error if p does not contain a valid regular - * expression pattern interpreted according to @p __flags. If - * regex_error is thrown, the object remains unchanged. - */ - template - basic_regex& - assign(_InputIterator __first, _InputIterator __last, - flag_type __flags = ECMAScript) - { return this->assign(string_type(__first, __last), __flags); } - - /** - * @brief Assigns a new regular expression to a regex object. - * - * @param __l An initializer list representing a regular expression. - * @param __flags Syntax option flags. - * - * @throws regex_error if @p __l does not contain a valid - * regular expression pattern interpreted according to @p - * __flags. If regex_error is thrown, the object remains - * unchanged. - */ - basic_regex& - assign(initializer_list<_Ch_type> __l, flag_type __flags = ECMAScript) - { return this->assign(__l.begin(), __l.end(), __flags); } - - // [7.8.4] const operations - /** - * @brief Gets the number of marked subexpressions within the regular - * expression. - */ - unsigned int - mark_count() const - { - if (_M_automaton) - return _M_automaton->_M_sub_count() - 1; - return 0; - } - - /** - * @brief Gets the flags used to construct the regular expression - * or in the last call to assign(). - */ - flag_type - flags() const - { return _M_flags; } - - // [7.8.5] locale - /** - * @brief Imbues the regular expression object with the given locale. - * - * @param __loc A locale. - */ - locale_type - imbue(locale_type __loc) - { - std::swap(__loc, _M_loc); - _M_automaton.reset(); - return __loc; - } - - /** - * @brief Gets the locale currently imbued in the regular expression - * object. - */ - locale_type - getloc() const - { return _M_loc; } - - // [7.8.6] swap - /** - * @brief Swaps the contents of two regular expression objects. - * - * @param __rhs Another regular expression object. - */ - void - swap(basic_regex& __rhs) - { - std::swap(_M_flags, __rhs._M_flags); - std::swap(_M_loc, __rhs._M_loc); - std::swap(_M_automaton, __rhs._M_automaton); - } - -#ifdef _GLIBCXX_DEBUG - void - _M_dot(std::ostream& __ostr) - { _M_automaton->_M_dot(__ostr); } -#endif - - private: - typedef std::shared_ptr> _AutomatonPtr; - - template - basic_regex(_FwdIter __first, _FwdIter __last, locale_type __loc, - flag_type __f) - : _M_flags(__f), _M_loc(std::move(__loc)), - _M_automaton(__detail::__compile_nfa<_FwdIter, _Rx_traits>( - std::move(__first), std::move(__last), _M_loc, _M_flags)) - { } - - template - friend bool - __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, - const basic_regex<_Cp, _Rp>&, - regex_constants::match_flag_type); - - template - friend class __detail::_Executor; - - flag_type _M_flags; - locale_type _M_loc; - _AutomatonPtr _M_automaton; - }; - - /** @brief Standard regular expressions. */ - typedef basic_regex regex; - -#ifdef _GLIBCXX_USE_WCHAR_T - /** @brief Standard wide-character regular expressions. */ - typedef basic_regex wregex; -#endif - - - // [7.8.6] basic_regex swap - /** - * @brief Swaps the contents of two regular expression objects. - * @param __lhs First regular expression. - * @param __rhs Second regular expression. - */ - template - inline void - swap(basic_regex<_Ch_type, _Rx_traits>& __lhs, - basic_regex<_Ch_type, _Rx_traits>& __rhs) - { __lhs.swap(__rhs); } - - - // [7.9] Class template sub_match - /** - * A sequence of characters matched by a particular marked sub-expression. - * - * An object of this class is essentially a pair of iterators marking a - * matched subexpression within a regular expression pattern match. Such - * objects can be converted to and compared with std::basic_string objects - * of a similar base character type as the pattern matched by the regular - * expression. - * - * The iterators that make up the pair are the usual half-open interval - * referencing the actual original pattern matched. - */ - template - class sub_match : public std::pair<_BiIter, _BiIter> - { - typedef iterator_traits<_BiIter> __iter_traits; - - public: - typedef typename __iter_traits::value_type value_type; - typedef typename __iter_traits::difference_type difference_type; - typedef _BiIter iterator; - typedef std::basic_string string_type; - - bool matched; - - constexpr sub_match() : matched() { } - - /** - * Gets the length of the matching sequence. - */ - difference_type - length() const - { return this->matched ? std::distance(this->first, this->second) : 0; } - - /** - * @brief Gets the matching sequence as a string. - * - * @returns the matching sequence as a string. - * - * This is the implicit conversion operator. It is identical to the - * str() member function except that it will want to pop up in - * unexpected places and cause a great deal of confusion and cursing - * from the unwary. - */ - operator string_type() const - { - return this->matched - ? string_type(this->first, this->second) - : string_type(); - } - - /** - * @brief Gets the matching sequence as a string. - * - * @returns the matching sequence as a string. - */ - string_type - str() const - { - return this->matched - ? string_type(this->first, this->second) - : string_type(); - } - - /** - * @brief Compares this and another matched sequence. - * - * @param __s Another matched sequence to compare to this one. - * - * @retval <0 this matched sequence will collate before @p __s. - * @retval =0 this matched sequence is equivalent to @p __s. - * @retval <0 this matched sequence will collate after @p __s. - */ - int - compare(const sub_match& __s) const - { return this->str().compare(__s.str()); } - - /** - * @brief Compares this sub_match to a string. - * - * @param __s A string to compare to this sub_match. - * - * @retval <0 this matched sequence will collate before @p __s. - * @retval =0 this matched sequence is equivalent to @p __s. - * @retval <0 this matched sequence will collate after @p __s. - */ - int - compare(const string_type& __s) const - { return this->str().compare(__s); } - - /** - * @brief Compares this sub_match to a C-style string. - * - * @param __s A C-style string to compare to this sub_match. - * - * @retval <0 this matched sequence will collate before @p __s. - * @retval =0 this matched sequence is equivalent to @p __s. - * @retval <0 this matched sequence will collate after @p __s. - */ - int - compare(const value_type* __s) const - { return this->str().compare(__s); } - }; - - - /** @brief Standard regex submatch over a C-style null-terminated string. */ - typedef sub_match csub_match; - - /** @brief Standard regex submatch over a standard string. */ - typedef sub_match ssub_match; - -#ifdef _GLIBCXX_USE_WCHAR_T - /** @brief Regex submatch over a C-style null-terminated wide string. */ - typedef sub_match wcsub_match; - - /** @brief Regex submatch over a standard wide string. */ - typedef sub_match wssub_match; -#endif - - // [7.9.2] sub_match non-member operators - - /** - * @brief Tests the equivalence of two regular expression submatches. - * @param __lhs First regular expression submatch. - * @param __rhs Second regular expression submatch. - * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) - { return __lhs.compare(__rhs) == 0; } - - /** - * @brief Tests the inequivalence of two regular expression submatches. - * @param __lhs First regular expression submatch. - * @param __rhs Second regular expression submatch. - * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) - { return __lhs.compare(__rhs) != 0; } - - /** - * @brief Tests the ordering of two regular expression submatches. - * @param __lhs First regular expression submatch. - * @param __rhs Second regular expression submatch. - * @returns true if @a __lhs precedes @a __rhs, false otherwise. - */ - template - inline bool - operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) - { return __lhs.compare(__rhs) < 0; } - - /** - * @brief Tests the ordering of two regular expression submatches. - * @param __lhs First regular expression submatch. - * @param __rhs Second regular expression submatch. - * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. - */ - template - inline bool - operator<=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) - { return __lhs.compare(__rhs) <= 0; } - - /** - * @brief Tests the ordering of two regular expression submatches. - * @param __lhs First regular expression submatch. - * @param __rhs Second regular expression submatch. - * @returns true if @a __lhs does not precede @a __rhs, false otherwise. - */ - template - inline bool - operator>=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) - { return __lhs.compare(__rhs) >= 0; } - - /** - * @brief Tests the ordering of two regular expression submatches. - * @param __lhs First regular expression submatch. - * @param __rhs Second regular expression submatch. - * @returns true if @a __lhs succeeds @a __rhs, false otherwise. - */ - template - inline bool - operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) - { return __lhs.compare(__rhs) > 0; } - - // Alias for sub_match'd string. - template - using __sub_match_string = basic_string< - typename iterator_traits<_Bi_iter>::value_type, - _Ch_traits, _Ch_alloc>; - - /** - * @brief Tests the equivalence of a string and a regular expression - * submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, - const sub_match<_Bi_iter>& __rhs) - { - typedef typename sub_match<_Bi_iter>::string_type string_type; - return __rhs.compare(string_type(__lhs.data(), __lhs.size())) == 0; - } - - /** - * @brief Tests the inequivalence of a string and a regular expression - * submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, - const sub_match<_Bi_iter>& __rhs) - { return !(__lhs == __rhs); } - - /** - * @brief Tests the ordering of a string and a regular expression submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs precedes @a __rhs, false otherwise. - */ - template - inline bool - operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, - const sub_match<_Bi_iter>& __rhs) - { - typedef typename sub_match<_Bi_iter>::string_type string_type; - return __rhs.compare(string_type(__lhs.data(), __lhs.size())) > 0; - } - - /** - * @brief Tests the ordering of a string and a regular expression submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs succeeds @a __rhs, false otherwise. - */ - template - inline bool - operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, - const sub_match<_Bi_iter>& __rhs) - { return __rhs < __lhs; } - - /** - * @brief Tests the ordering of a string and a regular expression submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs does not precede @a __rhs, false otherwise. - */ - template - inline bool - operator>=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, - const sub_match<_Bi_iter>& __rhs) - { return !(__lhs < __rhs); } - - /** - * @brief Tests the ordering of a string and a regular expression submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. - */ - template - inline bool - operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, - const sub_match<_Bi_iter>& __rhs) - { return !(__rhs < __lhs); } - - /** - * @brief Tests the equivalence of a regular expression submatch and a - * string. - * @param __lhs A regular expression submatch. - * @param __rhs A string. - * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator==(const sub_match<_Bi_iter>& __lhs, - const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) - { - typedef typename sub_match<_Bi_iter>::string_type string_type; - return __lhs.compare(string_type(__rhs.data(), __rhs.size())) == 0; - } - - /** - * @brief Tests the inequivalence of a regular expression submatch and a - * string. - * @param __lhs A regular expression submatch. - * @param __rhs A string. - * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator!=(const sub_match<_Bi_iter>& __lhs, - const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) - { return !(__lhs == __rhs); } - - /** - * @brief Tests the ordering of a regular expression submatch and a string. - * @param __lhs A regular expression submatch. - * @param __rhs A string. - * @returns true if @a __lhs precedes @a __rhs, false otherwise. - */ - template - inline bool - operator<(const sub_match<_Bi_iter>& __lhs, - const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) - { - typedef typename sub_match<_Bi_iter>::string_type string_type; - return __lhs.compare(string_type(__rhs.data(), __rhs.size())) < 0; - } - - /** - * @brief Tests the ordering of a regular expression submatch and a string. - * @param __lhs A regular expression submatch. - * @param __rhs A string. - * @returns true if @a __lhs succeeds @a __rhs, false otherwise. - */ - template - inline bool - operator>(const sub_match<_Bi_iter>& __lhs, - const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) - { return __rhs < __lhs; } - - /** - * @brief Tests the ordering of a regular expression submatch and a string. - * @param __lhs A regular expression submatch. - * @param __rhs A string. - * @returns true if @a __lhs does not precede @a __rhs, false otherwise. - */ - template - inline bool - operator>=(const sub_match<_Bi_iter>& __lhs, - const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) - { return !(__lhs < __rhs); } - - /** - * @brief Tests the ordering of a regular expression submatch and a string. - * @param __lhs A regular expression submatch. - * @param __rhs A string. - * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. - */ - template - inline bool - operator<=(const sub_match<_Bi_iter>& __lhs, - const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) - { return !(__rhs < __lhs); } - - /** - * @brief Tests the equivalence of a C string and a regular expression - * submatch. - * @param __lhs A C string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, - const sub_match<_Bi_iter>& __rhs) - { return __rhs.compare(__lhs) == 0; } - - /** - * @brief Tests the inequivalence of an iterator value and a regular - * expression submatch. - * @param __lhs A regular expression submatch. - * @param __rhs A string. - * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, - const sub_match<_Bi_iter>& __rhs) - { return !(__lhs == __rhs); } - - /** - * @brief Tests the ordering of a string and a regular expression submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs precedes @a __rhs, false otherwise. - */ - template - inline bool - operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, - const sub_match<_Bi_iter>& __rhs) - { return __rhs.compare(__lhs) > 0; } - - /** - * @brief Tests the ordering of a string and a regular expression submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs succeeds @a __rhs, false otherwise. - */ - template - inline bool - operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, - const sub_match<_Bi_iter>& __rhs) - { return __rhs < __lhs; } - - /** - * @brief Tests the ordering of a string and a regular expression submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs does not precede @a __rhs, false otherwise. - */ - template - inline bool - operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, - const sub_match<_Bi_iter>& __rhs) - { return !(__lhs < __rhs); } - - /** - * @brief Tests the ordering of a string and a regular expression submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. - */ - template - inline bool - operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, - const sub_match<_Bi_iter>& __rhs) - { return !(__rhs < __lhs); } - - /** - * @brief Tests the equivalence of a regular expression submatch and a - * string. - * @param __lhs A regular expression submatch. - * @param __rhs A pointer to a string? - * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator==(const sub_match<_Bi_iter>& __lhs, - typename iterator_traits<_Bi_iter>::value_type const* __rhs) - { return __lhs.compare(__rhs) == 0; } - - /** - * @brief Tests the inequivalence of a regular expression submatch and a - * string. - * @param __lhs A regular expression submatch. - * @param __rhs A pointer to a string. - * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator!=(const sub_match<_Bi_iter>& __lhs, - typename iterator_traits<_Bi_iter>::value_type const* __rhs) - { return !(__lhs == __rhs); } - - /** - * @brief Tests the ordering of a regular expression submatch and a string. - * @param __lhs A regular expression submatch. - * @param __rhs A string. - * @returns true if @a __lhs precedes @a __rhs, false otherwise. - */ - template - inline bool - operator<(const sub_match<_Bi_iter>& __lhs, - typename iterator_traits<_Bi_iter>::value_type const* __rhs) - { return __lhs.compare(__rhs) < 0; } - - /** - * @brief Tests the ordering of a regular expression submatch and a string. - * @param __lhs A regular expression submatch. - * @param __rhs A string. - * @returns true if @a __lhs succeeds @a __rhs, false otherwise. - */ - template - inline bool - operator>(const sub_match<_Bi_iter>& __lhs, - typename iterator_traits<_Bi_iter>::value_type const* __rhs) - { return __rhs < __lhs; } - - /** - * @brief Tests the ordering of a regular expression submatch and a string. - * @param __lhs A regular expression submatch. - * @param __rhs A string. - * @returns true if @a __lhs does not precede @a __rhs, false otherwise. - */ - template - inline bool - operator>=(const sub_match<_Bi_iter>& __lhs, - typename iterator_traits<_Bi_iter>::value_type const* __rhs) - { return !(__lhs < __rhs); } - - /** - * @brief Tests the ordering of a regular expression submatch and a string. - * @param __lhs A regular expression submatch. - * @param __rhs A string. - * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. - */ - template - inline bool - operator<=(const sub_match<_Bi_iter>& __lhs, - typename iterator_traits<_Bi_iter>::value_type const* __rhs) - { return !(__rhs < __lhs); } - - /** - * @brief Tests the equivalence of a string and a regular expression - * submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, - const sub_match<_Bi_iter>& __rhs) - { - typedef typename sub_match<_Bi_iter>::string_type string_type; - return __rhs.compare(string_type(1, __lhs)) == 0; - } - - /** - * @brief Tests the inequivalence of a string and a regular expression - * submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, - const sub_match<_Bi_iter>& __rhs) - { return !(__lhs == __rhs); } - - /** - * @brief Tests the ordering of a string and a regular expression submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs precedes @a __rhs, false otherwise. - */ - template - inline bool - operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, - const sub_match<_Bi_iter>& __rhs) - { - typedef typename sub_match<_Bi_iter>::string_type string_type; - return __rhs.compare(string_type(1, __lhs)) > 0; - } - - /** - * @brief Tests the ordering of a string and a regular expression submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs succeeds @a __rhs, false otherwise. - */ - template - inline bool - operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, - const sub_match<_Bi_iter>& __rhs) - { return __rhs < __lhs; } - - /** - * @brief Tests the ordering of a string and a regular expression submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs does not precede @a __rhs, false otherwise. - */ - template - inline bool - operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, - const sub_match<_Bi_iter>& __rhs) - { return !(__lhs < __rhs); } - - /** - * @brief Tests the ordering of a string and a regular expression submatch. - * @param __lhs A string. - * @param __rhs A regular expression submatch. - * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. - */ - template - inline bool - operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, - const sub_match<_Bi_iter>& __rhs) - { return !(__rhs < __lhs); } - - /** - * @brief Tests the equivalence of a regular expression submatch and a - * string. - * @param __lhs A regular expression submatch. - * @param __rhs A const string reference. - * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator==(const sub_match<_Bi_iter>& __lhs, - typename iterator_traits<_Bi_iter>::value_type const& __rhs) - { - typedef typename sub_match<_Bi_iter>::string_type string_type; - return __lhs.compare(string_type(1, __rhs)) == 0; - } - - /** - * @brief Tests the inequivalence of a regular expression submatch and a - * string. - * @param __lhs A regular expression submatch. - * @param __rhs A const string reference. - * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. - */ - template - inline bool - operator!=(const sub_match<_Bi_iter>& __lhs, - typename iterator_traits<_Bi_iter>::value_type const& __rhs) - { return !(__lhs == __rhs); } - - /** - * @brief Tests the ordering of a regular expression submatch and a string. - * @param __lhs A regular expression submatch. - * @param __rhs A const string reference. - * @returns true if @a __lhs precedes @a __rhs, false otherwise. - */ - template - inline bool - operator<(const sub_match<_Bi_iter>& __lhs, - typename iterator_traits<_Bi_iter>::value_type const& __rhs) - { - typedef typename sub_match<_Bi_iter>::string_type string_type; - return __lhs.compare(string_type(1, __rhs)) < 0; - } - - /** - * @brief Tests the ordering of a regular expression submatch and a string. - * @param __lhs A regular expression submatch. - * @param __rhs A const string reference. - * @returns true if @a __lhs succeeds @a __rhs, false otherwise. - */ - template - inline bool - operator>(const sub_match<_Bi_iter>& __lhs, - typename iterator_traits<_Bi_iter>::value_type const& __rhs) - { return __rhs < __lhs; } - - /** - * @brief Tests the ordering of a regular expression submatch and a string. - * @param __lhs A regular expression submatch. - * @param __rhs A const string reference. - * @returns true if @a __lhs does not precede @a __rhs, false otherwise. - */ - template - inline bool - operator>=(const sub_match<_Bi_iter>& __lhs, - typename iterator_traits<_Bi_iter>::value_type const& __rhs) - { return !(__lhs < __rhs); } - - /** - * @brief Tests the ordering of a regular expression submatch and a string. - * @param __lhs A regular expression submatch. - * @param __rhs A const string reference. - * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. - */ - template - inline bool - operator<=(const sub_match<_Bi_iter>& __lhs, - typename iterator_traits<_Bi_iter>::value_type const& __rhs) - { return !(__rhs < __lhs); } - - /** - * @brief Inserts a matched string into an output stream. - * - * @param __os The output stream. - * @param __m A submatch string. - * - * @returns the output stream with the submatch string inserted. - */ - template - inline - basic_ostream<_Ch_type, _Ch_traits>& - operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, - const sub_match<_Bi_iter>& __m) - { return __os << __m.str(); } - - // [7.10] Class template match_results - - /** - * @brief The results of a match or search operation. - * - * A collection of character sequences representing the result of a regular - * expression match. Storage for the collection is allocated and freed as - * necessary by the member functions of class template match_results. - * - * This class satisfies the Sequence requirements, with the exception that - * only the operations defined for a const-qualified Sequence are supported. - * - * The sub_match object stored at index 0 represents sub-expression 0, i.e. - * the whole match. In this case the %sub_match member matched is always true. - * The sub_match object stored at index n denotes what matched the marked - * sub-expression n within the matched expression. If the sub-expression n - * participated in a regular expression match then the %sub_match member - * matched evaluates to true, and members first and second denote the range - * of characters [first, second) which formed that match. Otherwise matched - * is false, and members first and second point to the end of the sequence - * that was searched. - * - * @nosubgrouping - */ - template > > - class match_results - : private std::vector, _Alloc> - { - private: - /* - * The vector base is empty if this does not represent a match (!ready()); - * Otherwise if it's a match failure, it contains 3 elements: - * [0] unmatched - * [1] prefix - * [2] suffix - * Otherwise it contains n+4 elements where n is the number of marked - * sub-expressions: - * [0] entire match - * [1] 1st marked subexpression - * ... - * [n] nth marked subexpression - * [n+1] unmatched - * [n+2] prefix - * [n+3] suffix - */ - typedef std::vector, _Alloc> _Base_type; - typedef std::iterator_traits<_Bi_iter> __iter_traits; - typedef regex_constants::match_flag_type match_flag_type; - - public: - /** - * @name 10.? Public Types - */ - //@{ - typedef sub_match<_Bi_iter> value_type; - typedef const value_type& const_reference; - typedef const_reference reference; - typedef typename _Base_type::const_iterator const_iterator; - typedef const_iterator iterator; - typedef typename __iter_traits::difference_type difference_type; - typedef typename allocator_traits<_Alloc>::size_type size_type; - typedef _Alloc allocator_type; - typedef typename __iter_traits::value_type char_type; - typedef std::basic_string string_type; - //@} - - public: - /** - * @name 28.10.1 Construction, Copying, and Destruction - */ - //@{ - - /** - * @brief Constructs a default %match_results container. - * @post size() returns 0 and str() returns an empty string. - */ - explicit - match_results(const _Alloc& __a = _Alloc()) - : _Base_type(__a) - { } - - /** - * @brief Copy constructs a %match_results. - */ - match_results(const match_results& __rhs) = default; - - /** - * @brief Move constructs a %match_results. - */ - match_results(match_results&& __rhs) noexcept = default; - - /** - * @brief Assigns rhs to *this. - */ - match_results& - operator=(const match_results& __rhs) = default; - - /** - * @brief Move-assigns rhs to *this. - */ - match_results& - operator=(match_results&& __rhs) = default; - - /** - * @brief Destroys a %match_results object. - */ - ~match_results() - { } - - //@} - - // 28.10.2, state: - /** - * @brief Indicates if the %match_results is ready. - * @retval true The object has a fully-established result state. - * @retval false The object is not ready. - */ - bool ready() const { return !_Base_type::empty(); } - - /** - * @name 28.10.2 Size - */ - //@{ - - /** - * @brief Gets the number of matches and submatches. - * - * The number of matches for a given regular expression will be either 0 - * if there was no match or mark_count() + 1 if a match was successful. - * Some matches may be empty. - * - * @returns the number of matches found. - */ - size_type - size() const - { return _Base_type::empty() ? 0 : _Base_type::size() - 3; } - - size_type - max_size() const - { return _Base_type::max_size(); } - - /** - * @brief Indicates if the %match_results contains no results. - * @retval true The %match_results object is empty. - * @retval false The %match_results object is not empty. - */ - bool - empty() const - { return size() == 0; } - - //@} - - /** - * @name 10.3 Element Access - */ - //@{ - - /** - * @brief Gets the length of the indicated submatch. - * @param __sub indicates the submatch. - * @pre ready() == true - * - * This function returns the length of the indicated submatch, or the - * length of the entire match if @p __sub is zero (the default). - */ - difference_type - length(size_type __sub = 0) const - { return (*this)[__sub].length(); } - - /** - * @brief Gets the offset of the beginning of the indicated submatch. - * @param __sub indicates the submatch. - * @pre ready() == true - * - * This function returns the offset from the beginning of the target - * sequence to the beginning of the submatch, unless the value of @p __sub - * is zero (the default), in which case this function returns the offset - * from the beginning of the target sequence to the beginning of the - * match. - */ - difference_type - position(size_type __sub = 0) const - { return std::distance(_M_begin, (*this)[__sub].first); } - - /** - * @brief Gets the match or submatch converted to a string type. - * @param __sub indicates the submatch. - * @pre ready() == true - * - * This function gets the submatch (or match, if @p __sub is - * zero) extracted from the target range and converted to the - * associated string type. - */ - string_type - str(size_type __sub = 0) const - { return string_type((*this)[__sub]); } - - /** - * @brief Gets a %sub_match reference for the match or submatch. - * @param __sub indicates the submatch. - * @pre ready() == true - * - * This function gets a reference to the indicated submatch, or - * the entire match if @p __sub is zero. - * - * If @p __sub >= size() then this function returns a %sub_match with a - * special value indicating no submatch. - */ - const_reference - operator[](size_type __sub) const - { - _GLIBCXX_DEBUG_ASSERT( ready() ); - return __sub < size() - ? _Base_type::operator[](__sub) - : _M_unmatched_sub(); - } - - /** - * @brief Gets a %sub_match representing the match prefix. - * @pre ready() == true - * - * This function gets a reference to a %sub_match object representing the - * part of the target range between the start of the target range and the - * start of the match. - */ - const_reference - prefix() const - { - _GLIBCXX_DEBUG_ASSERT( ready() ); - return !empty() ? _M_prefix() : _M_unmatched_sub(); - } - - /** - * @brief Gets a %sub_match representing the match suffix. - * @pre ready() == true - * - * This function gets a reference to a %sub_match object representing the - * part of the target range between the end of the match and the end of - * the target range. - */ - const_reference - suffix() const - { - _GLIBCXX_DEBUG_ASSERT( ready() ); - return !empty() ? _M_suffix() : _M_unmatched_sub(); - } - - /** - * @brief Gets an iterator to the start of the %sub_match collection. - */ - const_iterator - begin() const - { return _Base_type::begin(); } - - /** - * @brief Gets an iterator to the start of the %sub_match collection. - */ - const_iterator - cbegin() const - { return this->begin(); } - - /** - * @brief Gets an iterator to one-past-the-end of the collection. - */ - const_iterator - end() const - { return _Base_type::end() - 3; } - - /** - * @brief Gets an iterator to one-past-the-end of the collection. - */ - const_iterator - cend() const - { return this->end(); } - - //@} - - /** - * @name 10.4 Formatting - * - * These functions perform formatted substitution of the matched - * character sequences into their target. The format specifiers and - * escape sequences accepted by these functions are determined by - * their @p flags parameter as documented above. - */ - //@{ - - /** - * @pre ready() == true - */ - template - _Out_iter - format(_Out_iter __out, const char_type* __fmt_first, - const char_type* __fmt_last, - match_flag_type __flags = regex_constants::format_default) const; - - /** - * @pre ready() == true - */ - template - _Out_iter - format(_Out_iter __out, const basic_string& __fmt, - match_flag_type __flags = regex_constants::format_default) const - { - return format(__out, __fmt.data(), __fmt.data() + __fmt.size(), - __flags); - } - - /** - * @pre ready() == true - */ - template - basic_string - format(const basic_string& __fmt, - match_flag_type __flags = regex_constants::format_default) const - { - basic_string __result; - format(std::back_inserter(__result), __fmt, __flags); - return __result; - } - - /** - * @pre ready() == true - */ - string_type - format(const char_type* __fmt, - match_flag_type __flags = regex_constants::format_default) const - { - string_type __result; - format(std::back_inserter(__result), - __fmt, - __fmt + char_traits::length(__fmt), - __flags); - return __result; - } - - //@} - - /** - * @name 10.5 Allocator - */ - //@{ - - /** - * @brief Gets a copy of the allocator. - */ - allocator_type - get_allocator() const - { return _Base_type::get_allocator(); } - - //@} - - /** - * @name 10.6 Swap - */ - //@{ - - /** - * @brief Swaps the contents of two match_results. - */ - void - swap(match_results& __that) - { - using std::swap; - _Base_type::swap(__that); - swap(_M_begin, __that._M_begin); - } - //@} - - private: - template - friend class __detail::_Executor; - - template - friend class regex_iterator; - - template - friend bool - __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, - const basic_regex<_Cp, _Rp>&, - regex_constants::match_flag_type); - - void - _M_resize(unsigned int __size) - { _Base_type::resize(__size + 3); } - - const_reference - _M_unmatched_sub() const - { return _Base_type::operator[](_Base_type::size() - 3); } - - sub_match<_Bi_iter>& - _M_unmatched_sub() - { return _Base_type::operator[](_Base_type::size() - 3); } - - const_reference - _M_prefix() const - { return _Base_type::operator[](_Base_type::size() - 2); } - - sub_match<_Bi_iter>& - _M_prefix() - { return _Base_type::operator[](_Base_type::size() - 2); } - - const_reference - _M_suffix() const - { return _Base_type::operator[](_Base_type::size() - 1); } - - sub_match<_Bi_iter>& - _M_suffix() - { return _Base_type::operator[](_Base_type::size() - 1); } - - _Bi_iter _M_begin; - }; - - typedef match_results cmatch; - typedef match_results smatch; -#ifdef _GLIBCXX_USE_WCHAR_T - typedef match_results wcmatch; - typedef match_results wsmatch; -#endif - - // match_results comparisons - /** - * @brief Compares two match_results for equality. - * @returns true if the two objects refer to the same match, - * false otherwise. - */ - template - inline bool - operator==(const match_results<_Bi_iter, _Alloc>& __m1, - const match_results<_Bi_iter, _Alloc>& __m2) - { - if (__m1.ready() != __m2.ready()) - return false; - if (!__m1.ready()) // both are not ready - return true; - if (__m1.empty() != __m2.empty()) - return false; - if (__m1.empty()) // both are empty - return true; - return __m1.prefix() == __m2.prefix() - && __m1.size() == __m2.size() - && std::equal(__m1.begin(), __m1.end(), __m2.begin()) - && __m1.suffix() == __m2.suffix(); - } - - /** - * @brief Compares two match_results for inequality. - * @returns true if the two objects do not refer to the same match, - * false otherwise. - */ - template - inline bool - operator!=(const match_results<_Bi_iter, _Alloc>& __m1, - const match_results<_Bi_iter, _Alloc>& __m2) - { return !(__m1 == __m2); } - - // [7.10.6] match_results swap - /** - * @brief Swaps two match results. - * @param __lhs A match result. - * @param __rhs A match result. - * - * The contents of the two match_results objects are swapped. - */ - template - inline void - swap(match_results<_Bi_iter, _Alloc>& __lhs, - match_results<_Bi_iter, _Alloc>& __rhs) - { __lhs.swap(__rhs); } - -_GLIBCXX_END_NAMESPACE_CXX11 - - // [7.11.2] Function template regex_match - /** - * @name Matching, Searching, and Replacing - */ - //@{ - - /** - * @brief Determines if there is a match between the regular expression @p e - * and all of the character sequence [first, last). - * - * @param __s Start of the character sequence to match. - * @param __e One-past-the-end of the character sequence to match. - * @param __m The match results. - * @param __re The regular expression. - * @param __flags Controls how the regular expression is matched. - * - * @retval true A match exists. - * @retval false Otherwise. - * - * @throws an exception of type regex_error. - */ - template - inline bool - regex_match(_Bi_iter __s, - _Bi_iter __e, - match_results<_Bi_iter, _Alloc>& __m, - const basic_regex<_Ch_type, _Rx_traits>& __re, - regex_constants::match_flag_type __flags - = regex_constants::match_default) - { - return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits, - __detail::_RegexExecutorPolicy::_S_auto, true> - (__s, __e, __m, __re, __flags); - } - - /** - * @brief Indicates if there is a match between the regular expression @p e - * and all of the character sequence [first, last). - * - * @param __first Beginning of the character sequence to match. - * @param __last One-past-the-end of the character sequence to match. - * @param __re The regular expression. - * @param __flags Controls how the regular expression is matched. - * - * @retval true A match exists. - * @retval false Otherwise. - * - * @throws an exception of type regex_error. - */ - template - inline bool - regex_match(_Bi_iter __first, _Bi_iter __last, - const basic_regex<_Ch_type, _Rx_traits>& __re, - regex_constants::match_flag_type __flags - = regex_constants::match_default) - { - match_results<_Bi_iter> __what; - return regex_match(__first, __last, __what, __re, __flags); - } - - /** - * @brief Determines if there is a match between the regular expression @p e - * and a C-style null-terminated string. - * - * @param __s The C-style null-terminated string to match. - * @param __m The match results. - * @param __re The regular expression. - * @param __f Controls how the regular expression is matched. - * - * @retval true A match exists. - * @retval false Otherwise. - * - * @throws an exception of type regex_error. - */ - template - inline bool - regex_match(const _Ch_type* __s, - match_results& __m, - const basic_regex<_Ch_type, _Rx_traits>& __re, - regex_constants::match_flag_type __f - = regex_constants::match_default) - { return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); } - - /** - * @brief Determines if there is a match between the regular expression @p e - * and a string. - * - * @param __s The string to match. - * @param __m The match results. - * @param __re The regular expression. - * @param __flags Controls how the regular expression is matched. - * - * @retval true A match exists. - * @retval false Otherwise. - * - * @throws an exception of type regex_error. - */ - template - inline bool - regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s, - match_results::const_iterator, _Alloc>& __m, - const basic_regex<_Ch_type, _Rx_traits>& __re, - regex_constants::match_flag_type __flags - = regex_constants::match_default) - { return regex_match(__s.begin(), __s.end(), __m, __re, __flags); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2329. regex_match() with match_results should forbid temporary strings - /// Prevent unsafe attempts to get match_results from a temporary string. - template - bool - regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&, - match_results::const_iterator, _Alloc>&, - const basic_regex<_Ch_type, _Rx_traits>&, - regex_constants::match_flag_type - = regex_constants::match_default) = delete; - - /** - * @brief Indicates if there is a match between the regular expression @p e - * and a C-style null-terminated string. - * - * @param __s The C-style null-terminated string to match. - * @param __re The regular expression. - * @param __f Controls how the regular expression is matched. - * - * @retval true A match exists. - * @retval false Otherwise. - * - * @throws an exception of type regex_error. - */ - template - inline bool - regex_match(const _Ch_type* __s, - const basic_regex<_Ch_type, _Rx_traits>& __re, - regex_constants::match_flag_type __f - = regex_constants::match_default) - { return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); } - - /** - * @brief Indicates if there is a match between the regular expression @p e - * and a string. - * - * @param __s [IN] The string to match. - * @param __re [IN] The regular expression. - * @param __flags [IN] Controls how the regular expression is matched. - * - * @retval true A match exists. - * @retval false Otherwise. - * - * @throws an exception of type regex_error. - */ - template - inline bool - regex_match(const basic_string<_Ch_type, _Ch_traits, _Str_allocator>& __s, - const basic_regex<_Ch_type, _Rx_traits>& __re, - regex_constants::match_flag_type __flags - = regex_constants::match_default) - { return regex_match(__s.begin(), __s.end(), __re, __flags); } - - // [7.11.3] Function template regex_search - /** - * Searches for a regular expression within a range. - * @param __s [IN] The start of the string to search. - * @param __e [IN] One-past-the-end of the string to search. - * @param __m [OUT] The match results. - * @param __re [IN] The regular expression to search for. - * @param __flags [IN] Search policy flags. - * @retval true A match was found within the string. - * @retval false No match was found within the string, the content of %m is - * undefined. - * - * @throws an exception of type regex_error. - */ - template - inline bool - regex_search(_Bi_iter __s, _Bi_iter __e, - match_results<_Bi_iter, _Alloc>& __m, - const basic_regex<_Ch_type, _Rx_traits>& __re, - regex_constants::match_flag_type __flags - = regex_constants::match_default) - { - return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits, - __detail::_RegexExecutorPolicy::_S_auto, false> - (__s, __e, __m, __re, __flags); - } - - /** - * Searches for a regular expression within a range. - * @param __first [IN] The start of the string to search. - * @param __last [IN] One-past-the-end of the string to search. - * @param __re [IN] The regular expression to search for. - * @param __flags [IN] Search policy flags. - * @retval true A match was found within the string. - * @retval false No match was found within the string. - * - * @throws an exception of type regex_error. - */ - template - inline bool - regex_search(_Bi_iter __first, _Bi_iter __last, - const basic_regex<_Ch_type, _Rx_traits>& __re, - regex_constants::match_flag_type __flags - = regex_constants::match_default) - { - match_results<_Bi_iter> __what; - return regex_search(__first, __last, __what, __re, __flags); - } - - /** - * @brief Searches for a regular expression within a C-string. - * @param __s [IN] A C-string to search for the regex. - * @param __m [OUT] The set of regex matches. - * @param __e [IN] The regex to search for in @p s. - * @param __f [IN] The search flags. - * @retval true A match was found within the string. - * @retval false No match was found within the string, the content of %m is - * undefined. - * - * @throws an exception of type regex_error. - */ - template - inline bool - regex_search(const _Ch_type* __s, - match_results& __m, - const basic_regex<_Ch_type, _Rx_traits>& __e, - regex_constants::match_flag_type __f - = regex_constants::match_default) - { return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); } - - /** - * @brief Searches for a regular expression within a C-string. - * @param __s [IN] The C-string to search. - * @param __e [IN] The regular expression to search for. - * @param __f [IN] Search policy flags. - * @retval true A match was found within the string. - * @retval false No match was found within the string. - * - * @throws an exception of type regex_error. - */ - template - inline bool - regex_search(const _Ch_type* __s, - const basic_regex<_Ch_type, _Rx_traits>& __e, - regex_constants::match_flag_type __f - = regex_constants::match_default) - { return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); } - - /** - * @brief Searches for a regular expression within a string. - * @param __s [IN] The string to search. - * @param __e [IN] The regular expression to search for. - * @param __flags [IN] Search policy flags. - * @retval true A match was found within the string. - * @retval false No match was found within the string. - * - * @throws an exception of type regex_error. - */ - template - inline bool - regex_search(const basic_string<_Ch_type, _Ch_traits, - _String_allocator>& __s, - const basic_regex<_Ch_type, _Rx_traits>& __e, - regex_constants::match_flag_type __flags - = regex_constants::match_default) - { return regex_search(__s.begin(), __s.end(), __e, __flags); } - - /** - * @brief Searches for a regular expression within a string. - * @param __s [IN] A C++ string to search for the regex. - * @param __m [OUT] The set of regex matches. - * @param __e [IN] The regex to search for in @p s. - * @param __f [IN] The search flags. - * @retval true A match was found within the string. - * @retval false No match was found within the string, the content of %m is - * undefined. - * - * @throws an exception of type regex_error. - */ - template - inline bool - regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s, - match_results::const_iterator, _Alloc>& __m, - const basic_regex<_Ch_type, _Rx_traits>& __e, - regex_constants::match_flag_type __f - = regex_constants::match_default) - { return regex_search(__s.begin(), __s.end(), __m, __e, __f); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2329. regex_search() with match_results should forbid temporary strings - /// Prevent unsafe attempts to get match_results from a temporary string. - template - bool - regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&, - match_results::const_iterator, _Alloc>&, - const basic_regex<_Ch_type, _Rx_traits>&, - regex_constants::match_flag_type - = regex_constants::match_default) = delete; - - // std [28.11.4] Function template regex_replace - /** - * @brief Search for a regular expression within a range for multiple times, - and replace the matched parts through filling a format string. - * @param __out [OUT] The output iterator. - * @param __first [IN] The start of the string to search. - * @param __last [IN] One-past-the-end of the string to search. - * @param __e [IN] The regular expression to search for. - * @param __fmt [IN] The format string. - * @param __flags [IN] Search and replace policy flags. - * - * @returns __out - * @throws an exception of type regex_error. - */ - template - inline _Out_iter - regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, - const basic_regex<_Ch_type, _Rx_traits>& __e, - const basic_string<_Ch_type, _St, _Sa>& __fmt, - regex_constants::match_flag_type __flags - = regex_constants::match_default) - { - return regex_replace(__out, __first, __last, __e, __fmt.c_str(), __flags); - } - - /** - * @brief Search for a regular expression within a range for multiple times, - and replace the matched parts through filling a format C-string. - * @param __out [OUT] The output iterator. - * @param __first [IN] The start of the string to search. - * @param __last [IN] One-past-the-end of the string to search. - * @param __e [IN] The regular expression to search for. - * @param __fmt [IN] The format C-string. - * @param __flags [IN] Search and replace policy flags. - * - * @returns __out - * @throws an exception of type regex_error. - */ - template - _Out_iter - regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, - const basic_regex<_Ch_type, _Rx_traits>& __e, - const _Ch_type* __fmt, - regex_constants::match_flag_type __flags - = regex_constants::match_default); - - /** - * @brief Search for a regular expression within a string for multiple times, - and replace the matched parts through filling a format string. - * @param __s [IN] The string to search and replace. - * @param __e [IN] The regular expression to search for. - * @param __fmt [IN] The format string. - * @param __flags [IN] Search and replace policy flags. - * - * @returns The string after replacing. - * @throws an exception of type regex_error. - */ - template - inline basic_string<_Ch_type, _St, _Sa> - regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, - const basic_regex<_Ch_type, _Rx_traits>& __e, - const basic_string<_Ch_type, _Fst, _Fsa>& __fmt, - regex_constants::match_flag_type __flags - = regex_constants::match_default) - { - basic_string<_Ch_type, _St, _Sa> __result; - regex_replace(std::back_inserter(__result), - __s.begin(), __s.end(), __e, __fmt, __flags); - return __result; - } - - /** - * @brief Search for a regular expression within a string for multiple times, - and replace the matched parts through filling a format C-string. - * @param __s [IN] The string to search and replace. - * @param __e [IN] The regular expression to search for. - * @param __fmt [IN] The format C-string. - * @param __flags [IN] Search and replace policy flags. - * - * @returns The string after replacing. - * @throws an exception of type regex_error. - */ - template - inline basic_string<_Ch_type, _St, _Sa> - regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, - const basic_regex<_Ch_type, _Rx_traits>& __e, - const _Ch_type* __fmt, - regex_constants::match_flag_type __flags - = regex_constants::match_default) - { - basic_string<_Ch_type, _St, _Sa> __result; - regex_replace(std::back_inserter(__result), - __s.begin(), __s.end(), __e, __fmt, __flags); - return __result; - } - - /** - * @brief Search for a regular expression within a C-string for multiple - times, and replace the matched parts through filling a format string. - * @param __s [IN] The C-string to search and replace. - * @param __e [IN] The regular expression to search for. - * @param __fmt [IN] The format string. - * @param __flags [IN] Search and replace policy flags. - * - * @returns The string after replacing. - * @throws an exception of type regex_error. - */ - template - inline basic_string<_Ch_type> - regex_replace(const _Ch_type* __s, - const basic_regex<_Ch_type, _Rx_traits>& __e, - const basic_string<_Ch_type, _St, _Sa>& __fmt, - regex_constants::match_flag_type __flags - = regex_constants::match_default) - { - basic_string<_Ch_type> __result; - regex_replace(std::back_inserter(__result), __s, - __s + char_traits<_Ch_type>::length(__s), - __e, __fmt, __flags); - return __result; - } - - /** - * @brief Search for a regular expression within a C-string for multiple - times, and replace the matched parts through filling a format C-string. - * @param __s [IN] The C-string to search and replace. - * @param __e [IN] The regular expression to search for. - * @param __fmt [IN] The format C-string. - * @param __flags [IN] Search and replace policy flags. - * - * @returns The string after replacing. - * @throws an exception of type regex_error. - */ - template - inline basic_string<_Ch_type> - regex_replace(const _Ch_type* __s, - const basic_regex<_Ch_type, _Rx_traits>& __e, - const _Ch_type* __fmt, - regex_constants::match_flag_type __flags - = regex_constants::match_default) - { - basic_string<_Ch_type> __result; - regex_replace(std::back_inserter(__result), __s, - __s + char_traits<_Ch_type>::length(__s), - __e, __fmt, __flags); - return __result; - } - - //@} - -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - - // std [28.12] Class template regex_iterator - /** - * An iterator adaptor that will provide repeated calls of regex_search over - * a range until no more matches remain. - */ - template::value_type, - typename _Rx_traits = regex_traits<_Ch_type> > - class regex_iterator - { - public: - typedef basic_regex<_Ch_type, _Rx_traits> regex_type; - typedef match_results<_Bi_iter> value_type; - typedef std::ptrdiff_t difference_type; - typedef const value_type* pointer; - typedef const value_type& reference; - typedef std::forward_iterator_tag iterator_category; - - /** - * @brief Provides a singular iterator, useful for indicating - * one-past-the-end of a range. - */ - regex_iterator() - : _M_match() - { } - - /** - * Constructs a %regex_iterator... - * @param __a [IN] The start of a text range to search. - * @param __b [IN] One-past-the-end of the text range to search. - * @param __re [IN] The regular expression to match. - * @param __m [IN] Policy flags for match rules. - */ - regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re, - regex_constants::match_flag_type __m - = regex_constants::match_default) - : _M_begin(__a), _M_end(__b), _M_pregex(&__re), _M_flags(__m), _M_match() - { - if (!regex_search(_M_begin, _M_end, _M_match, *_M_pregex, _M_flags)) - *this = regex_iterator(); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2332. regex_iterator should forbid temporary regexes - regex_iterator(_Bi_iter, _Bi_iter, const regex_type&&, - regex_constants::match_flag_type - = regex_constants::match_default) = delete; - /** - * Copy constructs a %regex_iterator. - */ - regex_iterator(const regex_iterator& __rhs) = default; - - /** - * @brief Assigns one %regex_iterator to another. - */ - regex_iterator& - operator=(const regex_iterator& __rhs) = default; - - /** - * @brief Tests the equivalence of two regex iterators. - */ - bool - operator==(const regex_iterator& __rhs) const; - - /** - * @brief Tests the inequivalence of two regex iterators. - */ - bool - operator!=(const regex_iterator& __rhs) const - { return !(*this == __rhs); } - - /** - * @brief Dereferences a %regex_iterator. - */ - const value_type& - operator*() const - { return _M_match; } - - /** - * @brief Selects a %regex_iterator member. - */ - const value_type* - operator->() const - { return &_M_match; } - - /** - * @brief Increments a %regex_iterator. - */ - regex_iterator& - operator++(); - - /** - * @brief Postincrements a %regex_iterator. - */ - regex_iterator - operator++(int) - { - auto __tmp = *this; - ++(*this); - return __tmp; - } - - private: - _Bi_iter _M_begin; - _Bi_iter _M_end; - const regex_type* _M_pregex; - regex_constants::match_flag_type _M_flags; - match_results<_Bi_iter> _M_match; - }; - - typedef regex_iterator cregex_iterator; - typedef regex_iterator sregex_iterator; -#ifdef _GLIBCXX_USE_WCHAR_T - typedef regex_iterator wcregex_iterator; - typedef regex_iterator wsregex_iterator; -#endif - - // [7.12.2] Class template regex_token_iterator - /** - * Iterates over submatches in a range (or @a splits a text string). - * - * The purpose of this iterator is to enumerate all, or all specified, - * matches of a regular expression within a text range. The dereferenced - * value of an iterator of this class is a std::sub_match object. - */ - template::value_type, - typename _Rx_traits = regex_traits<_Ch_type> > - class regex_token_iterator - { - public: - typedef basic_regex<_Ch_type, _Rx_traits> regex_type; - typedef sub_match<_Bi_iter> value_type; - typedef std::ptrdiff_t difference_type; - typedef const value_type* pointer; - typedef const value_type& reference; - typedef std::forward_iterator_tag iterator_category; - - public: - /** - * @brief Default constructs a %regex_token_iterator. - * - * A default-constructed %regex_token_iterator is a singular iterator - * that will compare equal to the one-past-the-end value for any - * iterator of the same type. - */ - regex_token_iterator() - : _M_position(), _M_subs(), _M_suffix(), _M_n(0), _M_result(nullptr), - _M_has_m1(false) - { } - - /** - * Constructs a %regex_token_iterator... - * @param __a [IN] The start of the text to search. - * @param __b [IN] One-past-the-end of the text to search. - * @param __re [IN] The regular expression to search for. - * @param __submatch [IN] Which submatch to return. There are some - * special values for this parameter: - * - -1 each enumerated subexpression does NOT - * match the regular expression (aka field - * splitting) - * - 0 the entire string matching the - * subexpression is returned for each match - * within the text. - * - >0 enumerates only the indicated - * subexpression from a match within the text. - * @param __m [IN] Policy flags for match rules. - */ - regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re, - int __submatch = 0, - regex_constants::match_flag_type __m - = regex_constants::match_default) - : _M_position(__a, __b, __re, __m), _M_subs(1, __submatch), _M_n(0) - { _M_init(__a, __b); } - - /** - * Constructs a %regex_token_iterator... - * @param __a [IN] The start of the text to search. - * @param __b [IN] One-past-the-end of the text to search. - * @param __re [IN] The regular expression to search for. - * @param __submatches [IN] A list of subexpressions to return for each - * regular expression match within the text. - * @param __m [IN] Policy flags for match rules. - */ - regex_token_iterator(_Bi_iter __a, _Bi_iter __b, - const regex_type& __re, - const std::vector& __submatches, - regex_constants::match_flag_type __m - = regex_constants::match_default) - : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0) - { _M_init(__a, __b); } - - /** - * Constructs a %regex_token_iterator... - * @param __a [IN] The start of the text to search. - * @param __b [IN] One-past-the-end of the text to search. - * @param __re [IN] The regular expression to search for. - * @param __submatches [IN] A list of subexpressions to return for each - * regular expression match within the text. - * @param __m [IN] Policy flags for match rules. - */ - regex_token_iterator(_Bi_iter __a, _Bi_iter __b, - const regex_type& __re, - initializer_list __submatches, - regex_constants::match_flag_type __m - = regex_constants::match_default) - : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0) - { _M_init(__a, __b); } - - /** - * Constructs a %regex_token_iterator... - * @param __a [IN] The start of the text to search. - * @param __b [IN] One-past-the-end of the text to search. - * @param __re [IN] The regular expression to search for. - * @param __submatches [IN] A list of subexpressions to return for each - * regular expression match within the text. - * @param __m [IN] Policy flags for match rules. - */ - template - regex_token_iterator(_Bi_iter __a, _Bi_iter __b, - const regex_type& __re, - const int (&__submatches)[_Nm], - regex_constants::match_flag_type __m - = regex_constants::match_default) - : _M_position(__a, __b, __re, __m), - _M_subs(__submatches, __submatches + _Nm), _M_n(0) - { _M_init(__a, __b); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2332. regex_token_iterator should forbid temporary regexes - regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&, int = 0, - regex_constants::match_flag_type = - regex_constants::match_default) = delete; - regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&, - const std::vector&, - regex_constants::match_flag_type = - regex_constants::match_default) = delete; - regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&, - initializer_list, - regex_constants::match_flag_type = - regex_constants::match_default) = delete; - template - regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&, - const int (&)[N], - regex_constants::match_flag_type = - regex_constants::match_default) = delete; - - /** - * @brief Copy constructs a %regex_token_iterator. - * @param __rhs [IN] A %regex_token_iterator to copy. - */ - regex_token_iterator(const regex_token_iterator& __rhs) - : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs), - _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1) - { _M_normalize_result(); } - - /** - * @brief Assigns a %regex_token_iterator to another. - * @param __rhs [IN] A %regex_token_iterator to copy. - */ - regex_token_iterator& - operator=(const regex_token_iterator& __rhs); - - /** - * @brief Compares a %regex_token_iterator to another for equality. - */ - bool - operator==(const regex_token_iterator& __rhs) const; - - /** - * @brief Compares a %regex_token_iterator to another for inequality. - */ - bool - operator!=(const regex_token_iterator& __rhs) const - { return !(*this == __rhs); } - - /** - * @brief Dereferences a %regex_token_iterator. - */ - const value_type& - operator*() const - { return *_M_result; } - - /** - * @brief Selects a %regex_token_iterator member. - */ - const value_type* - operator->() const - { return _M_result; } - - /** - * @brief Increments a %regex_token_iterator. - */ - regex_token_iterator& - operator++(); - - /** - * @brief Postincrements a %regex_token_iterator. - */ - regex_token_iterator - operator++(int) - { - auto __tmp = *this; - ++(*this); - return __tmp; - } - - private: - typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> _Position; - - void - _M_init(_Bi_iter __a, _Bi_iter __b); - - const value_type& - _M_current_match() const - { - if (_M_subs[_M_n] == -1) - return (*_M_position).prefix(); - else - return (*_M_position)[_M_subs[_M_n]]; - } - - constexpr bool - _M_end_of_seq() const - { return _M_result == nullptr; } - - // [28.12.2.2.4] - void - _M_normalize_result() - { - if (_M_position != _Position()) - _M_result = &_M_current_match(); - else if (_M_has_m1) - _M_result = &_M_suffix; - else - _M_result = nullptr; - } - - _Position _M_position; - std::vector _M_subs; - value_type _M_suffix; - std::size_t _M_n; - const value_type* _M_result; - - // Show whether _M_subs contains -1 - bool _M_has_m1; - }; - - /** @brief Token iterator for C-style NULL-terminated strings. */ - typedef regex_token_iterator cregex_token_iterator; - - /** @brief Token iterator for standard strings. */ - typedef regex_token_iterator sregex_token_iterator; - -#ifdef _GLIBCXX_USE_WCHAR_T - /** @brief Token iterator for C-style NULL-terminated wide strings. */ - typedef regex_token_iterator wcregex_token_iterator; - - /** @brief Token iterator for standard wide-character strings. */ - typedef regex_token_iterator wsregex_token_iterator; -#endif - - //@} // group regex - -_GLIBCXX_END_NAMESPACE_CXX11 -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#include diff --git a/openflow/usr/include/c++/5/bits/regex.tcc b/openflow/usr/include/c++/5/bits/regex.tcc deleted file mode 100644 index 823ad51..0000000 --- a/openflow/usr/include/c++/5/bits/regex.tcc +++ /dev/null @@ -1,678 +0,0 @@ -// class template regex -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file bits/regex.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{regex} - */ - -// A non-standard switch to let the user pick the matching algorithm. -// If _GLIBCXX_REGEX_USE_THOMPSON_NFA is defined, the thompson NFA -// algorithm will be used. This algorithm is not enabled by default, -// and cannot be used if the regex contains back-references, but has better -// (polynomial instead of exponential) worst case performance. -// See __regex_algo_impl below. - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __detail -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Result of merging regex_match and regex_search. - // - // __policy now can be _S_auto (auto dispatch) and _S_alternate (use - // the other one if possible, for test purpose). - // - // That __match_mode is true means regex_match, else regex_search. - template - bool - __regex_algo_impl(_BiIter __s, - _BiIter __e, - match_results<_BiIter, _Alloc>& __m, - const basic_regex<_CharT, _TraitsT>& __re, - regex_constants::match_flag_type __flags) - { - if (__re._M_automaton == nullptr) - return false; - - typename match_results<_BiIter, _Alloc>::_Base_type& __res = __m; - __m._M_begin = __s; - __m._M_resize(__re._M_automaton->_M_sub_count()); - for (auto& __it : __res) - __it.matched = false; - - // __policy is used by testsuites so that they can use Thompson NFA - // without defining a macro. Users should define - // _GLIBCXX_REGEX_USE_THOMPSON_NFA if they need to use this approach. - bool __ret; - if (!__re._M_automaton->_M_has_backref - && !(__re._M_flags & regex_constants::ECMAScript) -#ifndef _GLIBCXX_REGEX_USE_THOMPSON_NFA - && __policy == _RegexExecutorPolicy::_S_alternate -#endif - ) - { - _Executor<_BiIter, _Alloc, _TraitsT, false> - __executor(__s, __e, __m, __re, __flags); - if (__match_mode) - __ret = __executor._M_match(); - else - __ret = __executor._M_search(); - } - else - { - _Executor<_BiIter, _Alloc, _TraitsT, true> - __executor(__s, __e, __m, __re, __flags); - if (__match_mode) - __ret = __executor._M_match(); - else - __ret = __executor._M_search(); - } - if (__ret) - { - for (auto& __it : __res) - if (!__it.matched) - __it.first = __it.second = __e; - auto& __pre = __m._M_prefix(); - auto& __suf = __m._M_suffix(); - if (__match_mode) - { - __pre.matched = false; - __pre.first = __s; - __pre.second = __s; - __suf.matched = false; - __suf.first = __e; - __suf.second = __e; - } - else - { - __pre.first = __s; - __pre.second = __res[0].first; - __pre.matched = (__pre.first != __pre.second); - __suf.first = __res[0].second; - __suf.second = __e; - __suf.matched = (__suf.first != __suf.second); - } - } - else - { - __m._M_resize(0); - for (auto& __it : __res) - { - __it.matched = false; - __it.first = __it.second = __e; - } - } - return __ret; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} - -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - template - typename regex_traits<_Ch_type>::string_type - regex_traits<_Ch_type>:: - lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const - { - typedef std::ctype __ctype_type; - const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale)); - - static const char* __collatenames[] = - { - "NUL", - "SOH", - "STX", - "ETX", - "EOT", - "ENQ", - "ACK", - "alert", - "backspace", - "tab", - "newline", - "vertical-tab", - "form-feed", - "carriage-return", - "SO", - "SI", - "DLE", - "DC1", - "DC2", - "DC3", - "DC4", - "NAK", - "SYN", - "ETB", - "CAN", - "EM", - "SUB", - "ESC", - "IS4", - "IS3", - "IS2", - "IS1", - "space", - "exclamation-mark", - "quotation-mark", - "number-sign", - "dollar-sign", - "percent-sign", - "ampersand", - "apostrophe", - "left-parenthesis", - "right-parenthesis", - "asterisk", - "plus-sign", - "comma", - "hyphen", - "period", - "slash", - "zero", - "one", - "two", - "three", - "four", - "five", - "six", - "seven", - "eight", - "nine", - "colon", - "semicolon", - "less-than-sign", - "equals-sign", - "greater-than-sign", - "question-mark", - "commercial-at", - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z", - "left-square-bracket", - "backslash", - "right-square-bracket", - "circumflex", - "underscore", - "grave-accent", - "a", - "b", - "c", - "d", - "e", - "f", - "g", - "h", - "i", - "j", - "k", - "l", - "m", - "n", - "o", - "p", - "q", - "r", - "s", - "t", - "u", - "v", - "w", - "x", - "y", - "z", - "left-curly-bracket", - "vertical-line", - "right-curly-bracket", - "tilde", - "DEL", - }; - - string __s; - for (; __first != __last; ++__first) - __s += __fctyp.narrow(*__first, 0); - - for (const auto& __it : __collatenames) - if (__s == __it) - return string_type(1, __fctyp.widen( - static_cast(&__it - __collatenames))); - - // TODO Add digraph support: - // http://boost.sourceforge.net/libs/regex/doc/collating_names.html - - return string_type(); - } - - template - template - typename regex_traits<_Ch_type>::char_class_type - regex_traits<_Ch_type>:: - lookup_classname(_Fwd_iter __first, _Fwd_iter __last, bool __icase) const - { - typedef std::ctype __ctype_type; - const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale)); - - // Mappings from class name to class mask. - static const pair __classnames[] = - { - {"d", ctype_base::digit}, - {"w", {ctype_base::alnum, _RegexMask::_S_under}}, - {"s", ctype_base::space}, - {"alnum", ctype_base::alnum}, - {"alpha", ctype_base::alpha}, - {"blank", ctype_base::blank}, - {"cntrl", ctype_base::cntrl}, - {"digit", ctype_base::digit}, - {"graph", ctype_base::graph}, - {"lower", ctype_base::lower}, - {"print", ctype_base::print}, - {"punct", ctype_base::punct}, - {"space", ctype_base::space}, - {"upper", ctype_base::upper}, - {"xdigit", ctype_base::xdigit}, - }; - - string __s; - for (; __first != __last; ++__first) - __s += __fctyp.narrow(__fctyp.tolower(*__first), 0); - - for (const auto& __it : __classnames) - if (__s == __it.first) - { - if (__icase - && ((__it.second - & (ctype_base::lower | ctype_base::upper)) != 0)) - return ctype_base::alpha; - return __it.second; - } - return 0; - } - - template - bool - regex_traits<_Ch_type>:: - isctype(_Ch_type __c, char_class_type __f) const - { - typedef std::ctype __ctype_type; - const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale)); - - return __fctyp.is(__f._M_base, __c) - // [[:w:]] - || ((__f._M_extended & _RegexMask::_S_under) - && __c == __fctyp.widen('_')); - } - - template - int - regex_traits<_Ch_type>:: - value(_Ch_type __ch, int __radix) const - { - std::basic_istringstream __is(string_type(1, __ch)); - long __v; - if (__radix == 8) - __is >> std::oct; - else if (__radix == 16) - __is >> std::hex; - __is >> __v; - return __is.fail() ? -1 : __v; - } - - template - template - _Out_iter match_results<_Bi_iter, _Alloc>:: - format(_Out_iter __out, - const match_results<_Bi_iter, _Alloc>::char_type* __fmt_first, - const match_results<_Bi_iter, _Alloc>::char_type* __fmt_last, - match_flag_type __flags) const - { - _GLIBCXX_DEBUG_ASSERT( ready() ); - regex_traits __traits; - typedef std::ctype __ctype_type; - const __ctype_type& - __fctyp(use_facet<__ctype_type>(__traits.getloc())); - - auto __output = [&](size_t __idx) - { - auto& __sub = (*this)[__idx]; - if (__sub.matched) - __out = std::copy(__sub.first, __sub.second, __out); - }; - - if (__flags & regex_constants::format_sed) - { - for (; __fmt_first != __fmt_last;) - if (*__fmt_first == '&') - { - __output(0); - ++__fmt_first; - } - else if (*__fmt_first == '\\') - { - if (++__fmt_first != __fmt_last - && __fctyp.is(__ctype_type::digit, *__fmt_first)) - __output(__traits.value(*__fmt_first++, 10)); - else - *__out++ = '\\'; - } - else - *__out++ = *__fmt_first++; - } - else - { - while (1) - { - auto __next = std::find(__fmt_first, __fmt_last, '$'); - if (__next == __fmt_last) - break; - - __out = std::copy(__fmt_first, __next, __out); - - auto __eat = [&](char __ch) -> bool - { - if (*__next == __ch) - { - ++__next; - return true; - } - return false; - }; - - if (++__next == __fmt_last) - *__out++ = '$'; - else if (__eat('$')) - *__out++ = '$'; - else if (__eat('&')) - __output(0); - else if (__eat('`')) - { - auto& __sub = _M_prefix(); - if (__sub.matched) - __out = std::copy(__sub.first, __sub.second, __out); - } - else if (__eat('\'')) - { - auto& __sub = _M_suffix(); - if (__sub.matched) - __out = std::copy(__sub.first, __sub.second, __out); - } - else if (__fctyp.is(__ctype_type::digit, *__next)) - { - long __num = __traits.value(*__next, 10); - if (++__next != __fmt_last - && __fctyp.is(__ctype_type::digit, *__next)) - { - __num *= 10; - __num += __traits.value(*__next++, 10); - } - if (0 <= __num && __num < this->size()) - __output(__num); - } - else - *__out++ = '$'; - __fmt_first = __next; - } - __out = std::copy(__fmt_first, __fmt_last, __out); - } - return __out; - } - - template - _Out_iter - regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, - const basic_regex<_Ch_type, _Rx_traits>& __e, - const _Ch_type* __fmt, - regex_constants::match_flag_type __flags) - { - typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> _IterT; - _IterT __i(__first, __last, __e, __flags); - _IterT __end; - if (__i == __end) - { - if (!(__flags & regex_constants::format_no_copy)) - __out = std::copy(__first, __last, __out); - } - else - { - sub_match<_Bi_iter> __last; - auto __len = char_traits<_Ch_type>::length(__fmt); - for (; __i != __end; ++__i) - { - if (!(__flags & regex_constants::format_no_copy)) - __out = std::copy(__i->prefix().first, __i->prefix().second, - __out); - __out = __i->format(__out, __fmt, __fmt + __len, __flags); - __last = __i->suffix(); - if (__flags & regex_constants::format_first_only) - break; - } - if (!(__flags & regex_constants::format_no_copy)) - __out = std::copy(__last.first, __last.second, __out); - } - return __out; - } - - template - bool - regex_iterator<_Bi_iter, _Ch_type, _Rx_traits>:: - operator==(const regex_iterator& __rhs) const - { - return (_M_match.empty() && __rhs._M_match.empty()) - || (_M_begin == __rhs._M_begin - && _M_end == __rhs._M_end - && _M_pregex == __rhs._M_pregex - && _M_flags == __rhs._M_flags - && _M_match[0] == __rhs._M_match[0]); - } - - template - regex_iterator<_Bi_iter, _Ch_type, _Rx_traits>& - regex_iterator<_Bi_iter, _Ch_type, _Rx_traits>:: - operator++() - { - // In all cases in which the call to regex_search returns true, - // match.prefix().first shall be equal to the previous value of - // match[0].second, and for each index i in the half-open range - // [0, match.size()) for which match[i].matched is true, - // match[i].position() shall return distance(begin, match[i].first). - // [28.12.1.4.5] - if (_M_match[0].matched) - { - auto __start = _M_match[0].second; - auto __prefix_first = _M_match[0].second; - if (_M_match[0].first == _M_match[0].second) - { - if (__start == _M_end) - { - _M_match = value_type(); - return *this; - } - else - { - if (regex_search(__start, _M_end, _M_match, *_M_pregex, - _M_flags - | regex_constants::match_not_null - | regex_constants::match_continuous)) - { - _GLIBCXX_DEBUG_ASSERT(_M_match[0].matched); - auto& __prefix = _M_match._M_prefix(); - __prefix.first = __prefix_first; - __prefix.matched = __prefix.first != __prefix.second; - // [28.12.1.4.5] - _M_match._M_begin = _M_begin; - return *this; - } - else - ++__start; - } - } - _M_flags |= regex_constants::match_prev_avail; - if (regex_search(__start, _M_end, _M_match, *_M_pregex, _M_flags)) - { - _GLIBCXX_DEBUG_ASSERT(_M_match[0].matched); - auto& __prefix = _M_match._M_prefix(); - __prefix.first = __prefix_first; - __prefix.matched = __prefix.first != __prefix.second; - // [28.12.1.4.5] - _M_match._M_begin = _M_begin; - } - else - _M_match = value_type(); - } - return *this; - } - - template - regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>& - regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>:: - operator=(const regex_token_iterator& __rhs) - { - _M_position = __rhs._M_position; - _M_subs = __rhs._M_subs; - _M_n = __rhs._M_n; - _M_suffix = __rhs._M_suffix; - _M_has_m1 = __rhs._M_has_m1; - _M_normalize_result(); - return *this; - } - - template - bool - regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>:: - operator==(const regex_token_iterator& __rhs) const - { - if (_M_end_of_seq() && __rhs._M_end_of_seq()) - return true; - if (_M_suffix.matched && __rhs._M_suffix.matched - && _M_suffix == __rhs._M_suffix) - return true; - if (_M_end_of_seq() || _M_suffix.matched - || __rhs._M_end_of_seq() || __rhs._M_suffix.matched) - return false; - return _M_position == __rhs._M_position - && _M_n == __rhs._M_n - && _M_subs == __rhs._M_subs; - } - - template - regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>& - regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>:: - operator++() - { - _Position __prev = _M_position; - if (_M_suffix.matched) - *this = regex_token_iterator(); - else if (_M_n + 1 < _M_subs.size()) - { - _M_n++; - _M_result = &_M_current_match(); - } - else - { - _M_n = 0; - ++_M_position; - if (_M_position != _Position()) - _M_result = &_M_current_match(); - else if (_M_has_m1 && __prev->suffix().length() != 0) - { - _M_suffix.matched = true; - _M_suffix.first = __prev->suffix().first; - _M_suffix.second = __prev->suffix().second; - _M_result = &_M_suffix; - } - else - *this = regex_token_iterator(); - } - return *this; - } - - template - void - regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>:: - _M_init(_Bi_iter __a, _Bi_iter __b) - { - _M_has_m1 = false; - for (auto __it : _M_subs) - if (__it == -1) - { - _M_has_m1 = true; - break; - } - if (_M_position != _Position()) - _M_result = &_M_current_match(); - else if (_M_has_m1) - { - _M_suffix.matched = true; - _M_suffix.first = __a; - _M_suffix.second = __b; - _M_result = &_M_suffix; - } - else - _M_result = nullptr; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - diff --git a/openflow/usr/include/c++/5/bits/regex_automaton.h b/openflow/usr/include/c++/5/bits/regex_automaton.h deleted file mode 100644 index fc0eb41..0000000 --- a/openflow/usr/include/c++/5/bits/regex_automaton.h +++ /dev/null @@ -1,330 +0,0 @@ -// class template regex -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file bits/regex_automaton.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{regex} - */ - -// This macro defines the maximal state number a NFA can have. -#ifndef _GLIBCXX_REGEX_STATE_LIMIT -#define _GLIBCXX_REGEX_STATE_LIMIT 100000 -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __detail -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @defgroup regex-detail Base and Implementation Classes - * @ingroup regex - * @{ - */ - - typedef long _StateIdT; - static const _StateIdT _S_invalid_state_id = -1; - - template - using _Matcher = std::function; - - /// Operation codes that define the type of transitions within the base NFA - /// that represents the regular expression. - enum _Opcode : int - { - _S_opcode_unknown, - _S_opcode_alternative, - _S_opcode_repeat, - _S_opcode_backref, - _S_opcode_line_begin_assertion, - _S_opcode_line_end_assertion, - _S_opcode_word_boundary, - _S_opcode_subexpr_lookahead, - _S_opcode_subexpr_begin, - _S_opcode_subexpr_end, - _S_opcode_dummy, - _S_opcode_match, - _S_opcode_accept, - }; - - struct _State_base - { - _Opcode _M_opcode; // type of outgoing transition - _StateIdT _M_next; // outgoing transition - union // Since they are mutually exclusive. - { - size_t _M_subexpr; // for _S_opcode_subexpr_* - size_t _M_backref_index; // for _S_opcode_backref - struct - { - // for _S_opcode_alternative, _S_opcode_repeat and - // _S_opcode_subexpr_lookahead - _StateIdT _M_alt; - // for _S_opcode_word_boundary or _S_opcode_subexpr_lookahead or - // quantifiers (ungreedy if set true) - bool _M_neg; - }; - }; - - explicit _State_base(_Opcode __opcode) - : _M_opcode(__opcode), _M_next(_S_invalid_state_id) - { } - - protected: - ~_State_base() = default; - - public: -#ifdef _GLIBCXX_DEBUG - std::ostream& - _M_print(std::ostream& ostr) const; - - // Prints graphviz dot commands for state. - std::ostream& - _M_dot(std::ostream& __ostr, _StateIdT __id) const; -#endif - }; - - template - struct _State : _State_base - { - typedef _Matcher _MatcherT; - - _MatcherT _M_matches; // for _S_opcode_match - - explicit _State(_Opcode __opcode) : _State_base(__opcode) { } - }; - - struct _NFA_base - { - typedef size_t _SizeT; - typedef regex_constants::syntax_option_type _FlagT; - - explicit - _NFA_base(_FlagT __f) - : _M_flags(__f), _M_start_state(0), _M_subexpr_count(0), - _M_has_backref(false) - { } - - _NFA_base(_NFA_base&&) = default; - - protected: - ~_NFA_base() = default; - - public: - _FlagT - _M_options() const - { return _M_flags; } - - _StateIdT - _M_start() const - { return _M_start_state; } - - _SizeT - _M_sub_count() const - { return _M_subexpr_count; } - - std::vector _M_paren_stack; - _FlagT _M_flags; - _StateIdT _M_start_state; - _SizeT _M_subexpr_count; - bool _M_has_backref; - }; - - template - struct _NFA - : _NFA_base, std::vector<_State<_TraitsT>> - { - typedef _State<_TraitsT> _StateT; - typedef _Matcher _MatcherT; - - _NFA(const typename _TraitsT::locale_type& __loc, _FlagT __flags) - : _NFA_base(__flags) - { _M_traits.imbue(__loc); } - - // for performance reasons _NFA objects should only be moved not copied - _NFA(const _NFA&) = delete; - _NFA(_NFA&&) = default; - - _StateIdT - _M_insert_accept() - { - auto __ret = _M_insert_state(_StateT(_S_opcode_accept)); - return __ret; - } - - _StateIdT - _M_insert_alt(_StateIdT __next, _StateIdT __alt, bool __neg) - { - _StateT __tmp(_S_opcode_alternative); - // It labels every quantifier to make greedy comparison easier in BFS - // approach. - __tmp._M_next = __next; - __tmp._M_alt = __alt; - return _M_insert_state(std::move(__tmp)); - } - - _StateIdT - _M_insert_repeat(_StateIdT __next, _StateIdT __alt, bool __neg) - { - _StateT __tmp(_S_opcode_repeat); - // It labels every quantifier to make greedy comparison easier in BFS - // approach. - __tmp._M_next = __next; - __tmp._M_alt = __alt; - __tmp._M_neg = __neg; - return _M_insert_state(std::move(__tmp)); - } - - _StateIdT - _M_insert_matcher(_MatcherT __m) - { - _StateT __tmp(_S_opcode_match); - __tmp._M_matches = std::move(__m); - return _M_insert_state(std::move(__tmp)); - } - - _StateIdT - _M_insert_subexpr_begin() - { - auto __id = this->_M_subexpr_count++; - this->_M_paren_stack.push_back(__id); - _StateT __tmp(_S_opcode_subexpr_begin); - __tmp._M_subexpr = __id; - return _M_insert_state(std::move(__tmp)); - } - - _StateIdT - _M_insert_subexpr_end() - { - _StateT __tmp(_S_opcode_subexpr_end); - __tmp._M_subexpr = this->_M_paren_stack.back(); - this->_M_paren_stack.pop_back(); - return _M_insert_state(std::move(__tmp)); - } - - _StateIdT - _M_insert_backref(size_t __index); - - _StateIdT - _M_insert_line_begin() - { return _M_insert_state(_StateT(_S_opcode_line_begin_assertion)); } - - _StateIdT - _M_insert_line_end() - { return _M_insert_state(_StateT(_S_opcode_line_end_assertion)); } - - _StateIdT - _M_insert_word_bound(bool __neg) - { - _StateT __tmp(_S_opcode_word_boundary); - __tmp._M_neg = __neg; - return _M_insert_state(std::move(__tmp)); - } - - _StateIdT - _M_insert_lookahead(_StateIdT __alt, bool __neg) - { - _StateT __tmp(_S_opcode_subexpr_lookahead); - __tmp._M_alt = __alt; - __tmp._M_neg = __neg; - return _M_insert_state(std::move(__tmp)); - } - - _StateIdT - _M_insert_dummy() - { return _M_insert_state(_StateT(_S_opcode_dummy)); } - - _StateIdT - _M_insert_state(_StateT __s) - { - this->push_back(std::move(__s)); - if (this->size() > _GLIBCXX_REGEX_STATE_LIMIT) - __throw_regex_error(regex_constants::error_space); - return this->size()-1; - } - - // Eliminate dummy node in this NFA to make it compact. - void - _M_eliminate_dummy(); - -#ifdef _GLIBCXX_DEBUG - std::ostream& - _M_dot(std::ostream& __ostr) const; -#endif - public: - _TraitsT _M_traits; - }; - - /// Describes a sequence of one or more %_State, its current start - /// and end(s). This structure contains fragments of an NFA during - /// construction. - template - class _StateSeq - { - public: - typedef _NFA<_TraitsT> _RegexT; - - public: - _StateSeq(_RegexT& __nfa, _StateIdT __s) - : _M_nfa(__nfa), _M_start(__s), _M_end(__s) - { } - - _StateSeq(_RegexT& __nfa, _StateIdT __s, _StateIdT __end) - : _M_nfa(__nfa), _M_start(__s), _M_end(__end) - { } - - // Append a state on *this and change *this to the new sequence. - void - _M_append(_StateIdT __id) - { - _M_nfa[_M_end]._M_next = __id; - _M_end = __id; - } - - // Append a sequence on *this and change *this to the new sequence. - void - _M_append(const _StateSeq& __s) - { - _M_nfa[_M_end]._M_next = __s._M_start; - _M_end = __s._M_end; - } - - // Clones an entire sequence. - _StateSeq - _M_clone(); - - public: - _RegexT& _M_nfa; - _StateIdT _M_start; - _StateIdT _M_end; - }; - - //@} regex-detail -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace __detail -} // namespace std - -#include diff --git a/openflow/usr/include/c++/5/bits/regex_automaton.tcc b/openflow/usr/include/c++/5/bits/regex_automaton.tcc deleted file mode 100644 index fbc3389..0000000 --- a/openflow/usr/include/c++/5/bits/regex_automaton.tcc +++ /dev/null @@ -1,238 +0,0 @@ -// class template regex -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file bits/regex_automaton.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{regex} - */ - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __detail -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#ifdef _GLIBCXX_DEBUG - inline std::ostream& - _State_base::_M_print(std::ostream& ostr) const - { - switch (_M_opcode) - { - case _S_opcode_alternative: - case _S_opcode_repeat: - ostr << "alt next=" << _M_next << " alt=" << _M_alt; - break; - case _S_opcode_subexpr_begin: - ostr << "subexpr begin next=" << _M_next << " index=" << _M_subexpr; - break; - case _S_opcode_subexpr_end: - ostr << "subexpr end next=" << _M_next << " index=" << _M_subexpr; - break; - case _S_opcode_backref: - ostr << "backref next=" << _M_next << " index=" << _M_backref_index; - break; - case _S_opcode_match: - ostr << "match next=" << _M_next; - break; - case _S_opcode_accept: - ostr << "accept next=" << _M_next; - break; - default: - ostr << "unknown next=" << _M_next; - break; - } - return ostr; - } - - // Prints graphviz dot commands for state. - inline std::ostream& - _State_base::_M_dot(std::ostream& __ostr, _StateIdT __id) const - { - switch (_M_opcode) - { - case _S_opcode_alternative: - case _S_opcode_repeat: - __ostr << __id << " [label=\"" << __id << "\\nALT\"];\n" - << __id << " -> " << _M_next - << " [label=\"next\", tailport=\"s\"];\n" - << __id << " -> " << _M_alt - << " [label=\"alt\", tailport=\"n\"];\n"; - break; - case _S_opcode_backref: - __ostr << __id << " [label=\"" << __id << "\\nBACKREF " - << _M_subexpr << "\"];\n" - << __id << " -> " << _M_next << " [label=\"\"];\n"; - break; - case _S_opcode_line_begin_assertion: - __ostr << __id << " [label=\"" << __id << "\\nLINE_BEGIN \"];\n" - << __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; - break; - case _S_opcode_line_end_assertion: - __ostr << __id << " [label=\"" << __id << "\\nLINE_END \"];\n" - << __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; - break; - case _S_opcode_word_boundary: - __ostr << __id << " [label=\"" << __id << "\\nWORD_BOUNDRY " - << _M_neg << "\"];\n" - << __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; - break; - case _S_opcode_subexpr_lookahead: - __ostr << __id << " [label=\"" << __id << "\\nLOOK_AHEAD\"];\n" - << __id << " -> " << _M_next - << " [label=\"epsilon\", tailport=\"s\"];\n" - << __id << " -> " << _M_alt - << " [label=\"\", tailport=\"n\"];\n"; - break; - case _S_opcode_subexpr_begin: - __ostr << __id << " [label=\"" << __id << "\\nSBEGIN " - << _M_subexpr << "\"];\n" - << __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; - break; - case _S_opcode_subexpr_end: - __ostr << __id << " [label=\"" << __id << "\\nSEND " - << _M_subexpr << "\"];\n" - << __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; - break; - case _S_opcode_dummy: - break; - case _S_opcode_match: - __ostr << __id << " [label=\"" << __id << "\\nMATCH\"];\n" - << __id << " -> " << _M_next << " [label=\"\"];\n"; - break; - case _S_opcode_accept: - __ostr << __id << " [label=\"" << __id << "\\nACC\"];\n" ; - break; - default: - _GLIBCXX_DEBUG_ASSERT(false); - break; - } - return __ostr; - } - - template - std::ostream& - _NFA<_TraitsT>::_M_dot(std::ostream& __ostr) const - { - __ostr << "digraph _Nfa {\n" - " rankdir=LR;\n"; - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i]._M_dot(__ostr, __i); - __ostr << "}\n"; - return __ostr; - } -#endif - - template - _StateIdT - _NFA<_TraitsT>::_M_insert_backref(size_t __index) - { - // To figure out whether a backref is valid, a stack is used to store - // unfinished sub-expressions. For example, when parsing - // "(a(b)(c\\1(d)))" at '\\1', _M_subexpr_count is 3, indicating that 3 - // sub expressions are parsed or partially parsed(in the stack), aka, - // "(a..", "(b)" and "(c.."). - // _M_paren_stack is {1, 3}, for incomplete "(a.." and "(c..". At this - // time, "\\2" is valid, but "\\1" and "\\3" are not. - if (__index >= _M_subexpr_count) - __throw_regex_error(regex_constants::error_backref); - for (auto __it : this->_M_paren_stack) - if (__index == __it) - __throw_regex_error(regex_constants::error_backref); - this->_M_has_backref = true; - _StateT __tmp(_S_opcode_backref); - __tmp._M_backref_index = __index; - return _M_insert_state(std::move(__tmp)); - } - - template - void - _NFA<_TraitsT>::_M_eliminate_dummy() - { - for (auto& __it : *this) - { - while (__it._M_next >= 0 && (*this)[__it._M_next]._M_opcode - == _S_opcode_dummy) - __it._M_next = (*this)[__it._M_next]._M_next; - if (__it._M_opcode == _S_opcode_alternative - || __it._M_opcode == _S_opcode_repeat - || __it._M_opcode == _S_opcode_subexpr_lookahead) - while (__it._M_alt >= 0 && (*this)[__it._M_alt]._M_opcode - == _S_opcode_dummy) - __it._M_alt = (*this)[__it._M_alt]._M_next; - } - } - - // Just apply DFS on the sequence and re-link their links. - template - _StateSeq<_TraitsT> - _StateSeq<_TraitsT>::_M_clone() - { - std::map<_StateIdT, _StateIdT> __m; - std::stack<_StateIdT> __stack; - __stack.push(_M_start); - while (!__stack.empty()) - { - auto __u = __stack.top(); - __stack.pop(); - auto __dup = _M_nfa[__u]; - // _M_insert_state() never return -1 - auto __id = _M_nfa._M_insert_state(__dup); - __m[__u] = __id; - if (__dup._M_opcode == _S_opcode_alternative - || __dup._M_opcode == _S_opcode_repeat - || __dup._M_opcode == _S_opcode_subexpr_lookahead) - if (__dup._M_alt != _S_invalid_state_id - && __m.count(__dup._M_alt) == 0) - __stack.push(__dup._M_alt); - if (__u == _M_end) - continue; - if (__dup._M_next != _S_invalid_state_id - && __m.count(__dup._M_next) == 0) - __stack.push(__dup._M_next); - } - for (auto __it : __m) - { - auto __v = __it.second; - auto& __ref = _M_nfa[__v]; - if (__ref._M_next != _S_invalid_state_id) - { - _GLIBCXX_DEBUG_ASSERT(__m.count(__ref._M_next) > 0); - __ref._M_next = __m[__ref._M_next]; - } - if (__ref._M_opcode == _S_opcode_alternative - || __ref._M_opcode == _S_opcode_repeat - || __ref._M_opcode == _S_opcode_subexpr_lookahead) - if (__ref._M_alt != _S_invalid_state_id) - { - _GLIBCXX_DEBUG_ASSERT(__m.count(__ref._M_alt) > 0); - __ref._M_alt = __m[__ref._M_alt]; - } - } - return _StateSeq(_M_nfa, __m[_M_start], __m[_M_end]); - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace __detail -} // namespace diff --git a/openflow/usr/include/c++/5/bits/regex_compiler.h b/openflow/usr/include/c++/5/bits/regex_compiler.h deleted file mode 100644 index 0cb0c04..0000000 --- a/openflow/usr/include/c++/5/bits/regex_compiler.h +++ /dev/null @@ -1,519 +0,0 @@ -// class template regex -*- C++ -*- - -// Copyright (C) 2010-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file bits/regex_compiler.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{regex} - */ - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __detail -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup regex-detail - * @{ - */ - - template - struct _BracketMatcher; - - /** - * @brief Builds an NFA from an input iterator range. - * - * The %_TraitsT type should fulfill requirements [28.3]. - */ - template - class _Compiler - { - public: - typedef typename _TraitsT::char_type _CharT; - typedef const _CharT* _IterT; - typedef _NFA<_TraitsT> _RegexT; - typedef regex_constants::syntax_option_type _FlagT; - - _Compiler(_IterT __b, _IterT __e, - const typename _TraitsT::locale_type& __traits, _FlagT __flags); - - shared_ptr - _M_get_nfa() - { return std::move(_M_nfa); } - - private: - typedef _Scanner<_CharT> _ScannerT; - typedef typename _TraitsT::string_type _StringT; - typedef typename _ScannerT::_TokenT _TokenT; - typedef _StateSeq<_TraitsT> _StateSeqT; - typedef std::stack<_StateSeqT> _StackT; - typedef std::ctype<_CharT> _CtypeT; - - // accepts a specific token or returns false. - bool - _M_match_token(_TokenT __token); - - void - _M_disjunction(); - - void - _M_alternative(); - - bool - _M_term(); - - bool - _M_assertion(); - - bool - _M_quantifier(); - - bool - _M_atom(); - - bool - _M_bracket_expression(); - - template - void - _M_insert_any_matcher_ecma(); - - template - void - _M_insert_any_matcher_posix(); - - template - void - _M_insert_char_matcher(); - - template - void - _M_insert_character_class_matcher(); - - template - void - _M_insert_bracket_matcher(bool __neg); - - // Returns true if successfully matched one term and should continue. - // Returns false if the compiler should move on. - template - bool - _M_expression_term(pair& __last_char, - _BracketMatcher<_TraitsT, __icase, __collate>& - __matcher); - - int - _M_cur_int_value(int __radix); - - bool - _M_try_char(); - - _StateSeqT - _M_pop() - { - auto ret = _M_stack.top(); - _M_stack.pop(); - return ret; - } - - _FlagT _M_flags; - _ScannerT _M_scanner; - shared_ptr<_RegexT> _M_nfa; - _StringT _M_value; - _StackT _M_stack; - const _TraitsT& _M_traits; - const _CtypeT& _M_ctype; - }; - - template - struct __has_contiguous_iter : std::false_type { }; - - template - struct __has_contiguous_iter> - : std::true_type - { }; - - template - struct __has_contiguous_iter> - : std::true_type - { }; - - template - struct __is_contiguous_normal_iter : std::false_type { }; - - template - struct __is_contiguous_normal_iter<_CharT*> : std::true_type { }; - - template - struct - __is_contiguous_normal_iter<__gnu_cxx::__normal_iterator<_Tp, _Cont>> - : __has_contiguous_iter<_Cont>::type - { }; - - template - using __enable_if_contiguous_normal_iter - = typename enable_if< __is_contiguous_normal_iter<_Iter>::value, - std::shared_ptr> >::type; - - template - using __disable_if_contiguous_normal_iter - = typename enable_if< !__is_contiguous_normal_iter<_Iter>::value, - std::shared_ptr> >::type; - - template - inline __enable_if_contiguous_normal_iter<_FwdIter, _TraitsT> - __compile_nfa(_FwdIter __first, _FwdIter __last, - const typename _TraitsT::locale_type& __loc, - regex_constants::syntax_option_type __flags) - { - size_t __len = __last - __first; - const auto* __cfirst = __len ? std::__addressof(*__first) : nullptr; - using _Cmplr = _Compiler<_TraitsT>; - return _Cmplr(__cfirst, __cfirst + __len, __loc, __flags)._M_get_nfa(); - } - - template - inline __disable_if_contiguous_normal_iter<_FwdIter, _TraitsT> - __compile_nfa(_FwdIter __first, _FwdIter __last, - const typename _TraitsT::locale_type& __loc, - regex_constants::syntax_option_type __flags) - { - basic_string __str(__first, __last); - return __compile_nfa(__str.data(), __str.data() + __str.size(), __loc, - __flags); - } - - // [28.13.14] - template - class _RegexTranslator - { - public: - typedef typename _TraitsT::char_type _CharT; - typedef typename _TraitsT::string_type _StringT; - typedef typename std::conditional<__collate, - _StringT, - _CharT>::type _StrTransT; - - explicit - _RegexTranslator(const _TraitsT& __traits) - : _M_traits(__traits) - { } - - _CharT - _M_translate(_CharT __ch) const - { - if (__icase) - return _M_traits.translate_nocase(__ch); - else if (__collate) - return _M_traits.translate(__ch); - else - return __ch; - } - - _StrTransT - _M_transform(_CharT __ch) const - { - return _M_transform_impl(__ch, typename integral_constant::type()); - } - - private: - _StrTransT - _M_transform_impl(_CharT __ch, false_type) const - { return __ch; } - - _StrTransT - _M_transform_impl(_CharT __ch, true_type) const - { - _StrTransT __str = _StrTransT(1, _M_translate(__ch)); - return _M_traits.transform(__str.begin(), __str.end()); - } - - const _TraitsT& _M_traits; - }; - - template - class _RegexTranslator<_TraitsT, false, false> - { - public: - typedef typename _TraitsT::char_type _CharT; - typedef _CharT _StrTransT; - - explicit - _RegexTranslator(const _TraitsT&) - { } - - _CharT - _M_translate(_CharT __ch) const - { return __ch; } - - _StrTransT - _M_transform(_CharT __ch) const - { return __ch; } - }; - - template - struct _AnyMatcher; - - template - struct _AnyMatcher<_TraitsT, false, __icase, __collate> - { - typedef _RegexTranslator<_TraitsT, __icase, __collate> _TransT; - typedef typename _TransT::_CharT _CharT; - - explicit - _AnyMatcher(const _TraitsT& __traits) - : _M_translator(__traits) - { } - - bool - operator()(_CharT __ch) const - { - static auto __nul = _M_translator._M_translate('\0'); - return _M_translator._M_translate(__ch) != __nul; - } - - _TransT _M_translator; - }; - - template - struct _AnyMatcher<_TraitsT, true, __icase, __collate> - { - typedef _RegexTranslator<_TraitsT, __icase, __collate> _TransT; - typedef typename _TransT::_CharT _CharT; - - explicit - _AnyMatcher(const _TraitsT& __traits) - : _M_translator(__traits) - { } - - bool - operator()(_CharT __ch) const - { return _M_apply(__ch, typename is_same<_CharT, char>::type()); } - - bool - _M_apply(_CharT __ch, true_type) const - { - auto __c = _M_translator._M_translate(__ch); - auto __n = _M_translator._M_translate('\n'); - auto __r = _M_translator._M_translate('\r'); - return __c != __n && __c != __r; - } - - bool - _M_apply(_CharT __ch, false_type) const - { - auto __c = _M_translator._M_translate(__ch); - auto __n = _M_translator._M_translate('\n'); - auto __r = _M_translator._M_translate('\r'); - auto __u2028 = _M_translator._M_translate(u'\u2028'); - auto __u2029 = _M_translator._M_translate(u'\u2029'); - return __c != __n && __c != __r && __c != __u2028 && __c != __u2029; - } - - _TransT _M_translator; - }; - - template - struct _CharMatcher - { - typedef _RegexTranslator<_TraitsT, __icase, __collate> _TransT; - typedef typename _TransT::_CharT _CharT; - - _CharMatcher(_CharT __ch, const _TraitsT& __traits) - : _M_translator(__traits), _M_ch(_M_translator._M_translate(__ch)) - { } - - bool - operator()(_CharT __ch) const - { return _M_ch == _M_translator._M_translate(__ch); } - - _TransT _M_translator; - _CharT _M_ch; - }; - - /// Matches a character range (bracket expression) - template - struct _BracketMatcher - { - public: - typedef _RegexTranslator<_TraitsT, __icase, __collate> _TransT; - typedef typename _TransT::_CharT _CharT; - typedef typename _TransT::_StrTransT _StrTransT; - typedef typename _TraitsT::string_type _StringT; - typedef typename _TraitsT::char_class_type _CharClassT; - - public: - _BracketMatcher(bool __is_non_matching, - const _TraitsT& __traits) - : _M_class_set(0), _M_translator(__traits), _M_traits(__traits), - _M_is_non_matching(__is_non_matching) -#ifdef _GLIBCXX_DEBUG - , _M_is_ready(false) -#endif - { } - - bool - operator()(_CharT __ch) const - { - _GLIBCXX_DEBUG_ASSERT(_M_is_ready); - return _M_apply(__ch, _UseCache()); - } - - void - _M_add_char(_CharT __c) - { - _M_char_set.push_back(_M_translator._M_translate(__c)); -#ifdef _GLIBCXX_DEBUG - _M_is_ready = false; -#endif - } - - _StringT - _M_add_collate_element(const _StringT& __s) - { - auto __st = _M_traits.lookup_collatename(__s.data(), - __s.data() + __s.size()); - if (__st.empty()) - __throw_regex_error(regex_constants::error_collate); - _M_char_set.push_back(_M_translator._M_translate(__st[0])); -#ifdef _GLIBCXX_DEBUG - _M_is_ready = false; -#endif - return __st; - } - - void - _M_add_equivalence_class(const _StringT& __s) - { - auto __st = _M_traits.lookup_collatename(__s.data(), - __s.data() + __s.size()); - if (__st.empty()) - __throw_regex_error(regex_constants::error_collate); - __st = _M_traits.transform_primary(__st.data(), - __st.data() + __st.size()); - _M_equiv_set.push_back(__st); -#ifdef _GLIBCXX_DEBUG - _M_is_ready = false; -#endif - } - - // __neg should be true for \D, \S and \W only. - void - _M_add_character_class(const _StringT& __s, bool __neg) - { - auto __mask = _M_traits.lookup_classname(__s.data(), - __s.data() + __s.size(), - __icase); - if (__mask == 0) - __throw_regex_error(regex_constants::error_ctype); - if (!__neg) - _M_class_set |= __mask; - else - _M_neg_class_set.push_back(__mask); -#ifdef _GLIBCXX_DEBUG - _M_is_ready = false; -#endif - } - - void - _M_make_range(_CharT __l, _CharT __r) - { - if (__l > __r) - __throw_regex_error(regex_constants::error_range); - _M_range_set.push_back(make_pair(_M_translator._M_transform(__l), - _M_translator._M_transform(__r))); -#ifdef _GLIBCXX_DEBUG - _M_is_ready = false; -#endif - } - - void - _M_ready() - { - std::sort(_M_char_set.begin(), _M_char_set.end()); - auto __end = std::unique(_M_char_set.begin(), _M_char_set.end()); - _M_char_set.erase(__end, _M_char_set.end()); - _M_make_cache(_UseCache()); -#ifdef _GLIBCXX_DEBUG - _M_is_ready = true; -#endif - } - - private: - // Currently we only use the cache for char - typedef typename std::is_same<_CharT, char>::type _UseCache; - - static constexpr size_t - _S_cache_size() - { - return 1ul << (sizeof(_CharT) * __CHAR_BIT__ * int(_UseCache::value)); - } - - struct _Dummy { }; - typedef typename std::conditional<_UseCache::value, - std::bitset<_S_cache_size()>, - _Dummy>::type _CacheT; - typedef typename std::make_unsigned<_CharT>::type _UnsignedCharT; - - bool - _M_apply(_CharT __ch, false_type) const; - - bool - _M_apply(_CharT __ch, true_type) const - { return _M_cache[static_cast<_UnsignedCharT>(__ch)]; } - - void - _M_make_cache(true_type) - { - for (unsigned __i = 0; __i < _M_cache.size(); __i++) - _M_cache[__i] = _M_apply(static_cast<_CharT>(__i), false_type()); - } - - void - _M_make_cache(false_type) - { } - - private: - std::vector<_CharT> _M_char_set; - std::vector<_StringT> _M_equiv_set; - std::vector> _M_range_set; - std::vector<_CharClassT> _M_neg_class_set; - _CharClassT _M_class_set; - _TransT _M_translator; - const _TraitsT& _M_traits; - bool _M_is_non_matching; - _CacheT _M_cache; -#ifdef _GLIBCXX_DEBUG - bool _M_is_ready; -#endif - }; - - //@} regex-detail -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace __detail -} // namespace std - -#include diff --git a/openflow/usr/include/c++/5/bits/regex_compiler.tcc b/openflow/usr/include/c++/5/bits/regex_compiler.tcc deleted file mode 100644 index 9a62311..0000000 --- a/openflow/usr/include/c++/5/bits/regex_compiler.tcc +++ /dev/null @@ -1,603 +0,0 @@ -// class template regex -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file bits/regex_compiler.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{regex} - */ - -// FIXME make comments doxygen format. - -// This compiler refers to "Regular Expression Matching Can Be Simple And Fast" -// (http://swtch.com/~rsc/regexp/regexp1.html"), -// but doesn't strictly follow it. -// -// When compiling, states are *chained* instead of tree- or graph-constructed. -// It's more like structured programs: there's if statement and loop statement. -// -// For alternative structure (say "a|b"), aka "if statement", two branches -// should be constructed. However, these two shall merge to an "end_tag" at -// the end of this operator: -// -// branch1 -// / \ -// => begin_tag end_tag => -// \ / -// branch2 -// -// This is the difference between this implementation and that in Russ's -// article. -// -// That's why we introduced dummy node here ------ "end_tag" is a dummy node. -// All dummy node will be eliminated at the end of compiling process. - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __detail -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - _Compiler<_TraitsT>:: - _Compiler(_IterT __b, _IterT __e, - const typename _TraitsT::locale_type& __loc, _FlagT __flags) - : _M_flags((__flags - & (regex_constants::ECMAScript - | regex_constants::basic - | regex_constants::extended - | regex_constants::grep - | regex_constants::egrep - | regex_constants::awk)) - ? __flags - : __flags | regex_constants::ECMAScript), - _M_scanner(__b, __e, _M_flags, __loc), - _M_nfa(make_shared<_RegexT>(__loc, _M_flags)), - _M_traits(_M_nfa->_M_traits), - _M_ctype(std::use_facet<_CtypeT>(__loc)) - { - _StateSeqT __r(*_M_nfa, _M_nfa->_M_start()); - __r._M_append(_M_nfa->_M_insert_subexpr_begin()); - this->_M_disjunction(); - if (!_M_match_token(_ScannerT::_S_token_eof)) - __throw_regex_error(regex_constants::error_paren); - __r._M_append(_M_pop()); - _GLIBCXX_DEBUG_ASSERT(_M_stack.empty()); - __r._M_append(_M_nfa->_M_insert_subexpr_end()); - __r._M_append(_M_nfa->_M_insert_accept()); - _M_nfa->_M_eliminate_dummy(); - } - - template - void - _Compiler<_TraitsT>:: - _M_disjunction() - { - this->_M_alternative(); - while (_M_match_token(_ScannerT::_S_token_or)) - { - _StateSeqT __alt1 = _M_pop(); - this->_M_alternative(); - _StateSeqT __alt2 = _M_pop(); - auto __end = _M_nfa->_M_insert_dummy(); - __alt1._M_append(__end); - __alt2._M_append(__end); - // __alt2 is state._M_next, __alt1 is state._M_alt. The executor - // executes _M_alt before _M_next, as well as executing left - // alternative before right one. - _M_stack.push(_StateSeqT(*_M_nfa, - _M_nfa->_M_insert_alt( - __alt2._M_start, __alt1._M_start, false), - __end)); - } - } - - template - void - _Compiler<_TraitsT>:: - _M_alternative() - { - if (this->_M_term()) - { - _StateSeqT __re = _M_pop(); - this->_M_alternative(); - __re._M_append(_M_pop()); - _M_stack.push(__re); - } - else - _M_stack.push(_StateSeqT(*_M_nfa, _M_nfa->_M_insert_dummy())); - } - - template - bool - _Compiler<_TraitsT>:: - _M_term() - { - if (this->_M_assertion()) - return true; - if (this->_M_atom()) - { - while (this->_M_quantifier()); - return true; - } - return false; - } - - template - bool - _Compiler<_TraitsT>:: - _M_assertion() - { - if (_M_match_token(_ScannerT::_S_token_line_begin)) - _M_stack.push(_StateSeqT(*_M_nfa, _M_nfa->_M_insert_line_begin())); - else if (_M_match_token(_ScannerT::_S_token_line_end)) - _M_stack.push(_StateSeqT(*_M_nfa, _M_nfa->_M_insert_line_end())); - else if (_M_match_token(_ScannerT::_S_token_word_bound)) - // _M_value[0] == 'n' means it's negative, say "not word boundary". - _M_stack.push(_StateSeqT(*_M_nfa, _M_nfa-> - _M_insert_word_bound(_M_value[0] == 'n'))); - else if (_M_match_token(_ScannerT::_S_token_subexpr_lookahead_begin)) - { - auto __neg = _M_value[0] == 'n'; - this->_M_disjunction(); - if (!_M_match_token(_ScannerT::_S_token_subexpr_end)) - __throw_regex_error(regex_constants::error_paren); - auto __tmp = _M_pop(); - __tmp._M_append(_M_nfa->_M_insert_accept()); - _M_stack.push( - _StateSeqT( - *_M_nfa, - _M_nfa->_M_insert_lookahead(__tmp._M_start, __neg))); - } - else - return false; - return true; - } - - template - bool - _Compiler<_TraitsT>:: - _M_quantifier() - { - bool __neg = (_M_flags & regex_constants::ECMAScript); - auto __init = [this, &__neg]() - { - if (_M_stack.empty()) - __throw_regex_error(regex_constants::error_badrepeat); - __neg = __neg && _M_match_token(_ScannerT::_S_token_opt); - }; - if (_M_match_token(_ScannerT::_S_token_closure0)) - { - __init(); - auto __e = _M_pop(); - _StateSeqT __r(*_M_nfa, - _M_nfa->_M_insert_repeat(_S_invalid_state_id, - __e._M_start, __neg)); - __e._M_append(__r); - _M_stack.push(__r); - } - else if (_M_match_token(_ScannerT::_S_token_closure1)) - { - __init(); - auto __e = _M_pop(); - __e._M_append(_M_nfa->_M_insert_repeat(_S_invalid_state_id, - __e._M_start, __neg)); - _M_stack.push(__e); - } - else if (_M_match_token(_ScannerT::_S_token_opt)) - { - __init(); - auto __e = _M_pop(); - auto __end = _M_nfa->_M_insert_dummy(); - _StateSeqT __r(*_M_nfa, - _M_nfa->_M_insert_repeat(_S_invalid_state_id, - __e._M_start, __neg)); - __e._M_append(__end); - __r._M_append(__end); - _M_stack.push(__r); - } - else if (_M_match_token(_ScannerT::_S_token_interval_begin)) - { - if (_M_stack.empty()) - __throw_regex_error(regex_constants::error_badrepeat); - if (!_M_match_token(_ScannerT::_S_token_dup_count)) - __throw_regex_error(regex_constants::error_badbrace); - _StateSeqT __r(_M_pop()); - _StateSeqT __e(*_M_nfa, _M_nfa->_M_insert_dummy()); - long __min_rep = _M_cur_int_value(10); - bool __infi = false; - long __n; - - // {3 - if (_M_match_token(_ScannerT::_S_token_comma)) - if (_M_match_token(_ScannerT::_S_token_dup_count)) // {3,7} - __n = _M_cur_int_value(10) - __min_rep; - else - __infi = true; - else - __n = 0; - if (!_M_match_token(_ScannerT::_S_token_interval_end)) - __throw_regex_error(regex_constants::error_brace); - - __neg = __neg && _M_match_token(_ScannerT::_S_token_opt); - - for (long __i = 0; __i < __min_rep; ++__i) - __e._M_append(__r._M_clone()); - - if (__infi) - { - auto __tmp = __r._M_clone(); - _StateSeqT __s(*_M_nfa, - _M_nfa->_M_insert_repeat(_S_invalid_state_id, - __tmp._M_start, __neg)); - __tmp._M_append(__s); - __e._M_append(__s); - } - else - { - if (__n < 0) - __throw_regex_error(regex_constants::error_badbrace); - auto __end = _M_nfa->_M_insert_dummy(); - // _M_alt is the "match more" branch, and _M_next is the - // "match less" one. Switch _M_alt and _M_next of all created - // nodes. This is a hack but IMO works well. - std::stack<_StateIdT> __stack; - for (long __i = 0; __i < __n; ++__i) - { - auto __tmp = __r._M_clone(); - auto __alt = _M_nfa->_M_insert_repeat(__tmp._M_start, - __end, __neg); - __stack.push(__alt); - __e._M_append(_StateSeqT(*_M_nfa, __alt, __tmp._M_end)); - } - __e._M_append(__end); - while (!__stack.empty()) - { - auto& __tmp = (*_M_nfa)[__stack.top()]; - __stack.pop(); - std::swap(__tmp._M_next, __tmp._M_alt); - } - } - _M_stack.push(__e); - } - else - return false; - return true; - } - -#define __INSERT_REGEX_MATCHER(__func, args...)\ - do\ - if (!(_M_flags & regex_constants::icase))\ - if (!(_M_flags & regex_constants::collate))\ - __func(args);\ - else\ - __func(args);\ - else\ - if (!(_M_flags & regex_constants::collate))\ - __func(args);\ - else\ - __func(args);\ - while (false) - - template - bool - _Compiler<_TraitsT>:: - _M_atom() - { - if (_M_match_token(_ScannerT::_S_token_anychar)) - { - if (!(_M_flags & regex_constants::ECMAScript)) - __INSERT_REGEX_MATCHER(_M_insert_any_matcher_posix); - else - __INSERT_REGEX_MATCHER(_M_insert_any_matcher_ecma); - } - else if (_M_try_char()) - __INSERT_REGEX_MATCHER(_M_insert_char_matcher); - else if (_M_match_token(_ScannerT::_S_token_backref)) - _M_stack.push(_StateSeqT(*_M_nfa, _M_nfa-> - _M_insert_backref(_M_cur_int_value(10)))); - else if (_M_match_token(_ScannerT::_S_token_quoted_class)) - __INSERT_REGEX_MATCHER(_M_insert_character_class_matcher); - else if (_M_match_token(_ScannerT::_S_token_subexpr_no_group_begin)) - { - _StateSeqT __r(*_M_nfa, _M_nfa->_M_insert_dummy()); - this->_M_disjunction(); - if (!_M_match_token(_ScannerT::_S_token_subexpr_end)) - __throw_regex_error(regex_constants::error_paren); - __r._M_append(_M_pop()); - _M_stack.push(__r); - } - else if (_M_match_token(_ScannerT::_S_token_subexpr_begin)) - { - _StateSeqT __r(*_M_nfa, _M_nfa->_M_insert_subexpr_begin()); - this->_M_disjunction(); - if (!_M_match_token(_ScannerT::_S_token_subexpr_end)) - __throw_regex_error(regex_constants::error_paren); - __r._M_append(_M_pop()); - __r._M_append(_M_nfa->_M_insert_subexpr_end()); - _M_stack.push(__r); - } - else if (!_M_bracket_expression()) - return false; - return true; - } - - template - bool - _Compiler<_TraitsT>:: - _M_bracket_expression() - { - bool __neg = - _M_match_token(_ScannerT::_S_token_bracket_neg_begin); - if (!(__neg || _M_match_token(_ScannerT::_S_token_bracket_begin))) - return false; - __INSERT_REGEX_MATCHER(_M_insert_bracket_matcher, __neg); - return true; - } -#undef __INSERT_REGEX_MATCHER - - template - template - void - _Compiler<_TraitsT>:: - _M_insert_any_matcher_ecma() - { - _M_stack.push(_StateSeqT(*_M_nfa, - _M_nfa->_M_insert_matcher - (_AnyMatcher<_TraitsT, true, __icase, __collate> - (_M_traits)))); - } - - template - template - void - _Compiler<_TraitsT>:: - _M_insert_any_matcher_posix() - { - _M_stack.push(_StateSeqT(*_M_nfa, - _M_nfa->_M_insert_matcher - (_AnyMatcher<_TraitsT, false, __icase, __collate> - (_M_traits)))); - } - - template - template - void - _Compiler<_TraitsT>:: - _M_insert_char_matcher() - { - _M_stack.push(_StateSeqT(*_M_nfa, - _M_nfa->_M_insert_matcher - (_CharMatcher<_TraitsT, __icase, __collate> - (_M_value[0], _M_traits)))); - } - - template - template - void - _Compiler<_TraitsT>:: - _M_insert_character_class_matcher() - { - _GLIBCXX_DEBUG_ASSERT(_M_value.size() == 1); - _BracketMatcher<_TraitsT, __icase, __collate> __matcher - (_M_ctype.is(_CtypeT::upper, _M_value[0]), _M_traits); - __matcher._M_add_character_class(_M_value, false); - __matcher._M_ready(); - _M_stack.push(_StateSeqT(*_M_nfa, - _M_nfa->_M_insert_matcher(std::move(__matcher)))); - } - - template - template - void - _Compiler<_TraitsT>:: - _M_insert_bracket_matcher(bool __neg) - { - _BracketMatcher<_TraitsT, __icase, __collate> __matcher(__neg, _M_traits); - pair __last_char; // Optional<_CharT> - __last_char.first = false; - if (!(_M_flags & regex_constants::ECMAScript)) - if (_M_try_char()) - { - __matcher._M_add_char(_M_value[0]); - __last_char.first = true; - __last_char.second = _M_value[0]; - } - while (_M_expression_term(__last_char, __matcher)); - __matcher._M_ready(); - _M_stack.push(_StateSeqT( - *_M_nfa, - _M_nfa->_M_insert_matcher(std::move(__matcher)))); - } - - template - template - bool - _Compiler<_TraitsT>:: - _M_expression_term(pair& __last_char, - _BracketMatcher<_TraitsT, __icase, __collate>& __matcher) - { - if (_M_match_token(_ScannerT::_S_token_bracket_end)) - return false; - - if (_M_match_token(_ScannerT::_S_token_collsymbol)) - { - auto __symbol = __matcher._M_add_collate_element(_M_value); - if (__symbol.size() == 1) - { - __last_char.first = true; - __last_char.second = __symbol[0]; - } - } - else if (_M_match_token(_ScannerT::_S_token_equiv_class_name)) - __matcher._M_add_equivalence_class(_M_value); - else if (_M_match_token(_ScannerT::_S_token_char_class_name)) - __matcher._M_add_character_class(_M_value, false); - // POSIX doesn't allow '-' as a start-range char (say [a-z--0]), - // except when the '-' is the first or last character in the bracket - // expression ([--0]). ECMAScript treats all '-' after a range as a - // normal character. Also see above, where _M_expression_term gets called. - // - // As a result, POSIX rejects [-----], but ECMAScript doesn't. - // Boost (1.57.0) always uses POSIX style even in its ECMAScript syntax. - // Clang (3.5) always uses ECMAScript style even in its POSIX syntax. - // - // It turns out that no one reads BNFs ;) - else if (_M_try_char()) - { - if (!__last_char.first) - { - __matcher._M_add_char(_M_value[0]); - if (_M_value[0] == '-' - && !(_M_flags & regex_constants::ECMAScript)) - { - if (_M_match_token(_ScannerT::_S_token_bracket_end)) - return false; - __throw_regex_error(regex_constants::error_range); - } - __last_char.first = true; - __last_char.second = _M_value[0]; - } - else - { - if (_M_value[0] == '-') - { - if (_M_try_char()) - { - __matcher._M_make_range(__last_char.second , _M_value[0]); - __last_char.first = false; - } - else - { - if (_M_scanner._M_get_token() - != _ScannerT::_S_token_bracket_end) - __throw_regex_error(regex_constants::error_range); - __matcher._M_add_char(_M_value[0]); - } - } - else - { - __matcher._M_add_char(_M_value[0]); - __last_char.second = _M_value[0]; - } - } - } - else if (_M_match_token(_ScannerT::_S_token_quoted_class)) - __matcher._M_add_character_class(_M_value, - _M_ctype.is(_CtypeT::upper, - _M_value[0])); - else - __throw_regex_error(regex_constants::error_brack); - - return true; - } - - template - bool - _Compiler<_TraitsT>:: - _M_try_char() - { - bool __is_char = false; - if (_M_match_token(_ScannerT::_S_token_oct_num)) - { - __is_char = true; - _M_value.assign(1, _M_cur_int_value(8)); - } - else if (_M_match_token(_ScannerT::_S_token_hex_num)) - { - __is_char = true; - _M_value.assign(1, _M_cur_int_value(16)); - } - else if (_M_match_token(_ScannerT::_S_token_ord_char)) - __is_char = true; - return __is_char; - } - - template - bool - _Compiler<_TraitsT>:: - _M_match_token(_TokenT token) - { - if (token == _M_scanner._M_get_token()) - { - _M_value = _M_scanner._M_get_value(); - _M_scanner._M_advance(); - return true; - } - return false; - } - - template - int - _Compiler<_TraitsT>:: - _M_cur_int_value(int __radix) - { - long __v = 0; - for (typename _StringT::size_type __i = 0; - __i < _M_value.length(); ++__i) - __v =__v * __radix + _M_traits.value(_M_value[__i], __radix); - return __v; - } - - template - bool - _BracketMatcher<_TraitsT, __icase, __collate>:: - _M_apply(_CharT __ch, false_type) const - { - bool __ret = std::binary_search(_M_char_set.begin(), _M_char_set.end(), - _M_translator._M_translate(__ch)); - if (!__ret) - { - auto __s = _M_translator._M_transform(__ch); - for (auto& __it : _M_range_set) - if (__it.first <= __s && __s <= __it.second) - { - __ret = true; - break; - } - if (_M_traits.isctype(__ch, _M_class_set)) - __ret = true; - else if (std::find(_M_equiv_set.begin(), _M_equiv_set.end(), - _M_traits.transform_primary(&__ch, &__ch+1)) - != _M_equiv_set.end()) - __ret = true; - else - { - for (auto& __it : _M_neg_class_set) - if (!_M_traits.isctype(__ch, __it)) - { - __ret = true; - break; - } - } - } - if (_M_is_non_matching) - return !__ret; - else - return __ret; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace __detail -} // namespace diff --git a/openflow/usr/include/c++/5/bits/regex_constants.h b/openflow/usr/include/c++/5/bits/regex_constants.h deleted file mode 100644 index e2c7631..0000000 --- a/openflow/usr/include/c++/5/bits/regex_constants.h +++ /dev/null @@ -1,405 +0,0 @@ -// class template regex -*- C++ -*- - -// Copyright (C) 2010-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file bits/regex_constants.h - * @brief Constant definitions for the std regex library. - * - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{regex} - */ - -namespace std _GLIBCXX_VISIBILITY(default) -{ -/** - * @defgroup regex Regular Expressions - * - * A facility for performing regular expression pattern matching. - * @{ - */ - -/** - * @namespace std::regex_constants - * @brief ISO C++-0x entities sub namespace for regex. - */ -namespace regex_constants -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @name 5.1 Regular Expression Syntax Options - */ - //@{ - enum __syntax_option - { - _S_icase, - _S_nosubs, - _S_optimize, - _S_collate, - _S_ECMAScript, - _S_basic, - _S_extended, - _S_awk, - _S_grep, - _S_egrep, - _S_syntax_last - }; - - /** - * @brief This is a bitmask type indicating how to interpret the regex. - * - * The @c syntax_option_type is implementation defined but it is valid to - * perform bitwise operations on these values and expect the right thing to - * happen. - * - * A valid value of type syntax_option_type shall have exactly one of the - * elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep - * %set. - */ - enum syntax_option_type : unsigned int { }; - - /** - * Specifies that the matching of regular expressions against a character - * sequence shall be performed without regard to case. - */ - constexpr syntax_option_type icase = - static_cast(1 << _S_icase); - - /** - * Specifies that when a regular expression is matched against a character - * container sequence, no sub-expression matches are to be stored in the - * supplied match_results structure. - */ - constexpr syntax_option_type nosubs = - static_cast(1 << _S_nosubs); - - /** - * Specifies that the regular expression engine should pay more attention to - * the speed with which regular expressions are matched, and less to the - * speed with which regular expression objects are constructed. Otherwise - * it has no detectable effect on the program output. - */ - constexpr syntax_option_type optimize = - static_cast(1 << _S_optimize); - - /** - * Specifies that character ranges of the form [a-b] should be locale - * sensitive. - */ - constexpr syntax_option_type collate = - static_cast(1 << _S_collate); - - /** - * Specifies that the grammar recognized by the regular expression engine is - * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript - * Language Specification, Standard Ecma-262, third edition, 1999], as - * modified in section [28.13]. This grammar is similar to that defined - * in the PERL scripting language but extended with elements found in the - * POSIX regular expression grammar. - */ - constexpr syntax_option_type ECMAScript = - static_cast(1 << _S_ECMAScript); - - /** - * Specifies that the grammar recognized by the regular expression engine is - * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001, - * Portable Operating System Interface (POSIX), Base Definitions and - * Headers, Section 9, Regular Expressions [IEEE, Information Technology -- - * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001]. - */ - constexpr syntax_option_type basic = - static_cast(1 << _S_basic); - - /** - * Specifies that the grammar recognized by the regular expression engine is - * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001, - * Portable Operating System Interface (POSIX), Base Definitions and - * Headers, Section 9, Regular Expressions. - */ - constexpr syntax_option_type extended = - static_cast(1 << _S_extended); - - /** - * Specifies that the grammar recognized by the regular expression engine is - * that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is - * identical to syntax_option_type extended, except that C-style escape - * sequences are supported. These sequences are: - * \\\\, \\a, \\b, \\f, \\n, \\r, \\t , \\v, \\&apos,, &apos,, - * and \\ddd (where ddd is one, two, or three octal digits). - */ - constexpr syntax_option_type awk = - static_cast(1 << _S_awk); - - /** - * Specifies that the grammar recognized by the regular expression engine is - * that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is - * identical to syntax_option_type basic, except that newlines are treated - * as whitespace. - */ - constexpr syntax_option_type grep = - static_cast(1 << _S_grep); - - /** - * Specifies that the grammar recognized by the regular expression engine is - * that used by POSIX utility grep when given the -E option in - * IEEE Std 1003.1-2001. This option is identical to syntax_option_type - * extended, except that newlines are treated as whitespace. - */ - constexpr syntax_option_type egrep = - static_cast(1 << _S_egrep); - - constexpr inline syntax_option_type - operator&(syntax_option_type __a, syntax_option_type __b) - { - return (syntax_option_type)(static_cast(__a) - & static_cast(__b)); - } - - constexpr inline syntax_option_type - operator|(syntax_option_type __a, syntax_option_type __b) - { - return (syntax_option_type)(static_cast(__a) - | static_cast(__b)); - } - - constexpr inline syntax_option_type - operator^(syntax_option_type __a, syntax_option_type __b) - { - return (syntax_option_type)(static_cast(__a) - ^ static_cast(__b)); - } - - constexpr inline syntax_option_type - operator~(syntax_option_type __a) - { return (syntax_option_type)(~static_cast(__a)); } - - inline syntax_option_type& - operator&=(syntax_option_type& __a, syntax_option_type __b) - { return __a = __a & __b; } - - inline syntax_option_type& - operator|=(syntax_option_type& __a, syntax_option_type __b) - { return __a = __a | __b; } - - inline syntax_option_type& - operator^=(syntax_option_type& __a, syntax_option_type __b) - { return __a = __a ^ __b; } - - //@} - - /** - * @name 5.2 Matching Rules - * - * Matching a regular expression against a sequence of characters [first, - * last) proceeds according to the rules of the grammar specified for the - * regular expression object, modified according to the effects listed - * below for any bitmask elements set. - * - */ - //@{ - - enum __match_flag - { - _S_not_bol, - _S_not_eol, - _S_not_bow, - _S_not_eow, - _S_any, - _S_not_null, - _S_continuous, - _S_prev_avail, - _S_sed, - _S_no_copy, - _S_first_only, - _S_match_flag_last - }; - - /** - * @brief This is a bitmask type indicating regex matching rules. - * - * The @c match_flag_type is implementation defined but it is valid to - * perform bitwise operations on these values and expect the right thing to - * happen. - */ - enum match_flag_type : unsigned int { }; - - /** - * The default matching rules. - */ - constexpr match_flag_type match_default = static_cast(0); - - /** - * The first character in the sequence [first, last) is treated as though it - * is not at the beginning of a line, so the character (^) in the regular - * expression shall not match [first, first). - */ - constexpr match_flag_type match_not_bol = - static_cast(1 << _S_not_bol); - - /** - * The last character in the sequence [first, last) is treated as though it - * is not at the end of a line, so the character ($) in the regular - * expression shall not match [last, last). - */ - constexpr match_flag_type match_not_eol = - static_cast(1 << _S_not_eol); - - /** - * The expression \\b is not matched against the sub-sequence - * [first,first). - */ - constexpr match_flag_type match_not_bow = - static_cast(1 << _S_not_bow); - - /** - * The expression \\b should not be matched against the sub-sequence - * [last,last). - */ - constexpr match_flag_type match_not_eow = - static_cast(1 << _S_not_eow); - - /** - * If more than one match is possible then any match is an acceptable - * result. - */ - constexpr match_flag_type match_any = - static_cast(1 << _S_any); - - /** - * The expression does not match an empty sequence. - */ - constexpr match_flag_type match_not_null = - static_cast(1 << _S_not_null); - - /** - * The expression only matches a sub-sequence that begins at first . - */ - constexpr match_flag_type match_continuous = - static_cast(1 << _S_continuous); - - /** - * --first is a valid iterator position. When this flag is set then the - * flags match_not_bol and match_not_bow are ignored by the regular - * expression algorithms 28.11 and iterators 28.12. - */ - constexpr match_flag_type match_prev_avail = - static_cast(1 << _S_prev_avail); - - /** - * When a regular expression match is to be replaced by a new string, the - * new string is constructed using the rules used by the ECMAScript replace - * function in ECMA- 262 [Ecma International, ECMAScript Language - * Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11 - * String.prototype.replace. In addition, during search and replace - * operations all non-overlapping occurrences of the regular expression - * are located and replaced, and sections of the input that did not match - * the expression are copied unchanged to the output string. - * - * Format strings (from ECMA-262 [15.5.4.11]): - * @li $$ The dollar-sign itself ($) - * @li $& The matched substring. - * @li $` The portion of @a string that precedes the matched substring. - * This would be match_results::prefix(). - * @li $' The portion of @a string that follows the matched substring. - * This would be match_results::suffix(). - * @li $n The nth capture, where n is in [1,9] and $n is not followed by a - * decimal digit. If n <= match_results::size() and the nth capture - * is undefined, use the empty string instead. If n > - * match_results::size(), the result is implementation-defined. - * @li $nn The nnth capture, where nn is a two-digit decimal number on - * [01, 99]. If nn <= match_results::size() and the nth capture is - * undefined, use the empty string instead. If - * nn > match_results::size(), the result is implementation-defined. - */ - constexpr match_flag_type format_default = static_cast(0); - - /** - * When a regular expression match is to be replaced by a new string, the - * new string is constructed using the rules used by the POSIX sed utility - * in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable - * Operating System Interface (POSIX), IEEE Standard 1003.1-2001]. - */ - constexpr match_flag_type format_sed = - static_cast(1 << _S_sed); - - /** - * During a search and replace operation, sections of the character - * container sequence being searched that do not match the regular - * expression shall not be copied to the output string. - */ - constexpr match_flag_type format_no_copy = - static_cast(1 << _S_no_copy); - - /** - * When specified during a search and replace operation, only the first - * occurrence of the regular expression shall be replaced. - */ - constexpr match_flag_type format_first_only = - static_cast(1 << _S_first_only); - - constexpr inline match_flag_type - operator&(match_flag_type __a, match_flag_type __b) - { - return (match_flag_type)(static_cast(__a) - & static_cast(__b)); - } - - constexpr inline match_flag_type - operator|(match_flag_type __a, match_flag_type __b) - { - return (match_flag_type)(static_cast(__a) - | static_cast(__b)); - } - - constexpr inline match_flag_type - operator^(match_flag_type __a, match_flag_type __b) - { - return (match_flag_type)(static_cast(__a) - ^ static_cast(__b)); - } - - constexpr inline match_flag_type - operator~(match_flag_type __a) - { return (match_flag_type)(~static_cast(__a)); } - - inline match_flag_type& - operator&=(match_flag_type& __a, match_flag_type __b) - { return __a = __a & __b; } - - inline match_flag_type& - operator|=(match_flag_type& __a, match_flag_type __b) - { return __a = __a | __b; } - - inline match_flag_type& - operator^=(match_flag_type& __a, match_flag_type __b) - { return __a = __a ^ __b; } - - //@} - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace regex_constants - -/* @} */ // group regex -} // namespace std - diff --git a/openflow/usr/include/c++/5/bits/regex_error.h b/openflow/usr/include/c++/5/bits/regex_error.h deleted file mode 100644 index 778edd5..0000000 --- a/openflow/usr/include/c++/5/bits/regex_error.h +++ /dev/null @@ -1,166 +0,0 @@ -// class template regex -*- C++ -*- - -// Copyright (C) 2010-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file bits/regex_error.h - * @brief Error and exception objects for the std regex library. - * - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{regex} - */ - -namespace std _GLIBCXX_VISIBILITY(default) -{ -/** - * @addtogroup regex - * @{ - */ - -namespace regex_constants -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @name 5.3 Error Types - */ - //@{ - - enum error_type - { - _S_error_collate, - _S_error_ctype, - _S_error_escape, - _S_error_backref, - _S_error_brack, - _S_error_paren, - _S_error_brace, - _S_error_badbrace, - _S_error_range, - _S_error_space, - _S_error_badrepeat, - _S_error_complexity, - _S_error_stack, - }; - - /** The expression contained an invalid collating element name. */ - constexpr error_type error_collate(_S_error_collate); - - /** The expression contained an invalid character class name. */ - constexpr error_type error_ctype(_S_error_ctype); - - /** - * The expression contained an invalid escaped character, or a trailing - * escape. - */ - constexpr error_type error_escape(_S_error_escape); - - /** The expression contained an invalid back reference. */ - constexpr error_type error_backref(_S_error_backref); - - /** The expression contained mismatched [ and ]. */ - constexpr error_type error_brack(_S_error_brack); - - /** The expression contained mismatched ( and ). */ - constexpr error_type error_paren(_S_error_paren); - - /** The expression contained mismatched { and } */ - constexpr error_type error_brace(_S_error_brace); - - /** The expression contained an invalid range in a {} expression. */ - constexpr error_type error_badbrace(_S_error_badbrace); - - /** - * The expression contained an invalid character range, - * such as [b-a] in most encodings. - */ - constexpr error_type error_range(_S_error_range); - - /** - * There was insufficient memory to convert the expression into a - * finite state machine. - */ - constexpr error_type error_space(_S_error_space); - - /** - * One of *?+{ was not preceded by a valid regular expression. - */ - constexpr error_type error_badrepeat(_S_error_badrepeat); - - /** - * The complexity of an attempted match against a regular expression - * exceeded a pre-set level. - */ - constexpr error_type error_complexity(_S_error_complexity); - - /** - * There was insufficient memory to determine whether the - * regular expression could match the specified character sequence. - */ - constexpr error_type error_stack(_S_error_stack); - - //@} -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace regex_constants - -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // [7.8] Class regex_error - /** - * @brief A regular expression exception class. - * @ingroup exceptions - * - * The regular expression library throws objects of this class on error. - */ - class regex_error : public std::runtime_error - { - regex_constants::error_type _M_code; - - public: - /** - * @brief Constructs a regex_error object. - * - * @param __ecode the regex error code. - */ - explicit - regex_error(regex_constants::error_type __ecode); - - virtual ~regex_error() throw(); - - /** - * @brief Gets the regex error code. - * - * @returns the regex error code. - */ - regex_constants::error_type - code() const - { return _M_code; } - }; - - //@} // group regex - - void - __throw_regex_error(regex_constants::error_type __ecode); - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std diff --git a/openflow/usr/include/c++/5/bits/regex_executor.h b/openflow/usr/include/c++/5/bits/regex_executor.h deleted file mode 100644 index 404f30b..0000000 --- a/openflow/usr/include/c++/5/bits/regex_executor.h +++ /dev/null @@ -1,225 +0,0 @@ -// class template regex -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file bits/regex_executor.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{regex} - */ - -// FIXME convert comments to doxygen format. - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __detail -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup regex-detail - * @{ - */ - - /** - * @brief Takes a regex and an input string and does the matching. - * - * The %_Executor class has two modes: DFS mode and BFS mode, controlled - * by the template parameter %__dfs_mode. - */ - template - class _Executor - { - using __search_mode = integral_constant; - using __dfs = true_type; - using __bfs = false_type; - - enum class _Match_mode : unsigned char { _Exact, _Prefix }; - - public: - typedef typename iterator_traits<_BiIter>::value_type _CharT; - typedef basic_regex<_CharT, _TraitsT> _RegexT; - typedef std::vector, _Alloc> _ResultsVec; - typedef regex_constants::match_flag_type _FlagT; - typedef typename _TraitsT::char_class_type _ClassT; - typedef _NFA<_TraitsT> _NFAT; - - public: - _Executor(_BiIter __begin, - _BiIter __end, - _ResultsVec& __results, - const _RegexT& __re, - _FlagT __flags) - : _M_begin(__begin), - _M_end(__end), - _M_re(__re), - _M_nfa(*__re._M_automaton), - _M_results(__results), - _M_rep_count(_M_nfa.size()), - _M_states(_M_nfa._M_start(), _M_nfa.size()), - _M_flags((__flags & regex_constants::match_prev_avail) - ? (__flags - & ~regex_constants::match_not_bol - & ~regex_constants::match_not_bow) - : __flags) - { } - - // Set matched when string exactly matches the pattern. - bool - _M_match() - { - _M_current = _M_begin; - return _M_main(_Match_mode::_Exact); - } - - // Set matched when some prefix of the string matches the pattern. - bool - _M_search_from_first() - { - _M_current = _M_begin; - return _M_main(_Match_mode::_Prefix); - } - - bool - _M_search(); - - private: - void - _M_rep_once_more(_Match_mode __match_mode, _StateIdT); - - void - _M_dfs(_Match_mode __match_mode, _StateIdT __start); - - bool - _M_main(_Match_mode __match_mode) - { return _M_main_dispatch(__match_mode, __search_mode{}); } - - bool - _M_main_dispatch(_Match_mode __match_mode, __dfs); - - bool - _M_main_dispatch(_Match_mode __match_mode, __bfs); - - bool - _M_is_word(_CharT __ch) const - { - static const _CharT __s[2] = { 'w' }; - return _M_re._M_automaton->_M_traits.isctype - (__ch, _M_re._M_automaton->_M_traits.lookup_classname(__s, __s+1)); - } - - bool - _M_at_begin() const - { - return _M_current == _M_begin - && !(_M_flags & (regex_constants::match_not_bol - | regex_constants::match_prev_avail)); - } - - bool - _M_at_end() const - { - return _M_current == _M_end - && !(_M_flags & regex_constants::match_not_eol); - } - - bool - _M_word_boundary() const; - - bool - _M_lookahead(_State<_TraitsT> __state); - - // Holds additional information used in BFS-mode. - template - struct _State_info; - - template - struct _State_info<__bfs, _ResultsVec> - { - explicit - _State_info(_StateIdT __start, size_t __n) - : _M_visited_states(new bool[__n]()), _M_start(__start) - { } - - bool _M_visited(_StateIdT __i) - { - if (_M_visited_states[__i]) - return true; - _M_visited_states[__i] = true; - return false; - } - - void _M_queue(_StateIdT __i, const _ResultsVec& __res) - { _M_match_queue.emplace_back(__i, __res); } - - // Dummy implementations for BFS mode. - _BiIter* _M_get_sol_pos() { return nullptr; } - - // Saves states that need to be considered for the next character. - vector> _M_match_queue; - // Indicates which states are already visited. - unique_ptr _M_visited_states; - // To record current solution. - _StateIdT _M_start; - }; - - template - struct _State_info<__dfs, _ResultsVec> - { - explicit - _State_info(_StateIdT __start, size_t) : _M_start(__start) - { } - - // Dummy implementations for DFS mode. - bool _M_visited(_StateIdT) const { return false; } - void _M_queue(_StateIdT, const _ResultsVec&) { } - - _BiIter* _M_get_sol_pos() { return &_M_sol_pos; } - - // To record current solution. - _StateIdT _M_start; - _BiIter _M_sol_pos; - }; - - public: - _ResultsVec _M_cur_results; - _BiIter _M_current; - _BiIter _M_begin; - const _BiIter _M_end; - const _RegexT& _M_re; - const _NFAT& _M_nfa; - _ResultsVec& _M_results; - vector> _M_rep_count; - _State_info<__search_mode, _ResultsVec> _M_states; - _FlagT _M_flags; - // Do we have a solution so far? - bool _M_has_sol; - }; - - //@} regex-detail -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace __detail -} // namespace std - -#include diff --git a/openflow/usr/include/c++/5/bits/regex_executor.tcc b/openflow/usr/include/c++/5/bits/regex_executor.tcc deleted file mode 100644 index de217da..0000000 --- a/openflow/usr/include/c++/5/bits/regex_executor.tcc +++ /dev/null @@ -1,439 +0,0 @@ -// class template regex -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file bits/regex_executor.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{regex} - */ - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __detail -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - bool _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>:: - _M_search() - { - if (_M_search_from_first()) - return true; - if (_M_flags & regex_constants::match_continuous) - return false; - _M_flags |= regex_constants::match_prev_avail; - while (_M_begin != _M_end) - { - ++_M_begin; - if (_M_search_from_first()) - return true; - } - return false; - } - - // The _M_main function operates in different modes, DFS mode or BFS mode, - // indicated by template parameter __dfs_mode, and dispatches to one of the - // _M_main_dispatch overloads. - // - // ------------------------------------------------------------ - // - // DFS mode: - // - // It applies a Depth-First-Search (aka backtracking) on given NFA and input - // string. - // At the very beginning the executor stands in the start state, then it - // tries every possible state transition in current state recursively. Some - // state transitions consume input string, say, a single-char-matcher or a - // back-reference matcher; some don't, like assertion or other anchor nodes. - // When the input is exhausted and/or the current state is an accepting - // state, the whole executor returns true. - // - // TODO: This approach is exponentially slow for certain input. - // Try to compile the NFA to a DFA. - // - // Time complexity: \Omega(match_length), O(2^(_M_nfa.size())) - // Space complexity: \theta(match_results.size() + match_length) - // - template - bool _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>:: - _M_main_dispatch(_Match_mode __match_mode, __dfs) - { - _M_has_sol = false; - *_M_states._M_get_sol_pos() = _BiIter(); - _M_cur_results = _M_results; - _M_dfs(__match_mode, _M_states._M_start); - return _M_has_sol; - } - - // ------------------------------------------------------------ - // - // BFS mode: - // - // Russ Cox's article (http://swtch.com/~rsc/regexp/regexp1.html) - // explained this algorithm clearly. - // - // It first computes epsilon closure (states that can be achieved without - // consuming characters) for every state that's still matching, - // using the same DFS algorithm, but doesn't re-enter states (using - // _M_states._M_visited to check), nor follow _S_opcode_match. - // - // Then apply DFS using every _S_opcode_match (in _M_states._M_match_queue) - // as the start state. - // - // It significantly reduces potential duplicate states, so has a better - // upper bound; but it requires more overhead. - // - // Time complexity: \Omega(match_length * match_results.size()) - // O(match_length * _M_nfa.size() * match_results.size()) - // Space complexity: \Omega(_M_nfa.size() + match_results.size()) - // O(_M_nfa.size() * match_results.size()) - template - bool _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>:: - _M_main_dispatch(_Match_mode __match_mode, __bfs) - { - _M_states._M_queue(_M_states._M_start, _M_results); - bool __ret = false; - while (1) - { - _M_has_sol = false; - if (_M_states._M_match_queue.empty()) - break; - std::fill_n(_M_states._M_visited_states.get(), _M_nfa.size(), false); - auto __old_queue = std::move(_M_states._M_match_queue); - for (auto& __task : __old_queue) - { - _M_cur_results = std::move(__task.second); - _M_dfs(__match_mode, __task.first); - } - if (__match_mode == _Match_mode::_Prefix) - __ret |= _M_has_sol; - if (_M_current == _M_end) - break; - ++_M_current; - } - if (__match_mode == _Match_mode::_Exact) - __ret = _M_has_sol; - _M_states._M_match_queue.clear(); - return __ret; - } - - // Return whether now match the given sub-NFA. - template - bool _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>:: - _M_lookahead(_State<_TraitsT> __state) - { - // Backreferences may refer to captured content. - // We may want to make this faster by not copying, - // but let's not be clever prematurely. - _ResultsVec __what(_M_cur_results); - _Executor __sub(_M_current, _M_end, __what, _M_re, _M_flags); - __sub._M_states._M_start = __state._M_alt; - if (__sub._M_search_from_first()) - { - for (size_t __i = 0; __i < __what.size(); __i++) - if (__what[__i].matched) - _M_cur_results[__i] = __what[__i]; - return true; - } - return false; - } - - // __rep_count records how many times (__rep_count.second) - // this node is visited under certain input iterator - // (__rep_count.first). This prevent the executor from entering - // infinite loop by refusing to continue when it's already been - // visited more than twice. It's `twice` instead of `once` because - // we need to spare one more time for potential group capture. - template - void _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>:: - _M_rep_once_more(_Match_mode __match_mode, _StateIdT __i) - { - const auto& __state = _M_nfa[__i]; - auto& __rep_count = _M_rep_count[__i]; - if (__rep_count.second == 0 || __rep_count.first != _M_current) - { - auto __back = __rep_count; - __rep_count.first = _M_current; - __rep_count.second = 1; - _M_dfs(__match_mode, __state._M_alt); - __rep_count = __back; - } - else - { - if (__rep_count.second < 2) - { - __rep_count.second++; - _M_dfs(__match_mode, __state._M_alt); - __rep_count.second--; - } - } - }; - - template - void _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>:: - _M_dfs(_Match_mode __match_mode, _StateIdT __i) - { - if (_M_states._M_visited(__i)) - return; - - const auto& __state = _M_nfa[__i]; - // Every change on _M_cur_results and _M_current will be rolled back after - // finishing the recursion step. - switch (__state._M_opcode) - { - // _M_alt branch is "match once more", while _M_next is "get me out - // of this quantifier". Executing _M_next first or _M_alt first don't - // mean the same thing, and we need to choose the correct order under - // given greedy mode. - case _S_opcode_repeat: - { - // Greedy. - if (!__state._M_neg) - { - _M_rep_once_more(__match_mode, __i); - // If it's DFS executor and already accepted, we're done. - if (!__dfs_mode || !_M_has_sol) - _M_dfs(__match_mode, __state._M_next); - } - else // Non-greedy mode - { - if (__dfs_mode) - { - // vice-versa. - _M_dfs(__match_mode, __state._M_next); - if (!_M_has_sol) - _M_rep_once_more(__match_mode, __i); - } - else - { - // DON'T attempt anything, because there's already another - // state with higher priority accepted. This state cannot - // be better by attempting its next node. - if (!_M_has_sol) - { - _M_dfs(__match_mode, __state._M_next); - // DON'T attempt anything if it's already accepted. An - // accepted state *must* be better than a solution that - // matches a non-greedy quantifier one more time. - if (!_M_has_sol) - _M_rep_once_more(__match_mode, __i); - } - } - } - } - break; - case _S_opcode_subexpr_begin: - { - auto& __res = _M_cur_results[__state._M_subexpr]; - auto __back = __res.first; - __res.first = _M_current; - _M_dfs(__match_mode, __state._M_next); - __res.first = __back; - } - break; - case _S_opcode_subexpr_end: - { - auto& __res = _M_cur_results[__state._M_subexpr]; - auto __back = __res; - __res.second = _M_current; - __res.matched = true; - _M_dfs(__match_mode, __state._M_next); - __res = __back; - } - break; - case _S_opcode_line_begin_assertion: - if (_M_at_begin()) - _M_dfs(__match_mode, __state._M_next); - break; - case _S_opcode_line_end_assertion: - if (_M_at_end()) - _M_dfs(__match_mode, __state._M_next); - break; - case _S_opcode_word_boundary: - if (_M_word_boundary() == !__state._M_neg) - _M_dfs(__match_mode, __state._M_next); - break; - // Here __state._M_alt offers a single start node for a sub-NFA. - // We recursively invoke our algorithm to match the sub-NFA. - case _S_opcode_subexpr_lookahead: - if (_M_lookahead(__state) == !__state._M_neg) - _M_dfs(__match_mode, __state._M_next); - break; - case _S_opcode_match: - if (_M_current == _M_end) - break; - if (__dfs_mode) - { - if (__state._M_matches(*_M_current)) - { - ++_M_current; - _M_dfs(__match_mode, __state._M_next); - --_M_current; - } - } - else - if (__state._M_matches(*_M_current)) - _M_states._M_queue(__state._M_next, _M_cur_results); - break; - // First fetch the matched result from _M_cur_results as __submatch; - // then compare it with - // (_M_current, _M_current + (__submatch.second - __submatch.first)). - // If matched, keep going; else just return and try another state. - case _S_opcode_backref: - { - _GLIBCXX_DEBUG_ASSERT(__dfs_mode); - auto& __submatch = _M_cur_results[__state._M_backref_index]; - if (!__submatch.matched) - break; - auto __last = _M_current; - for (auto __tmp = __submatch.first; - __last != _M_end && __tmp != __submatch.second; - ++__tmp) - ++__last; - if (_M_re._M_automaton->_M_traits.transform(__submatch.first, - __submatch.second) - == _M_re._M_automaton->_M_traits.transform(_M_current, __last)) - { - if (__last != _M_current) - { - auto __backup = _M_current; - _M_current = __last; - _M_dfs(__match_mode, __state._M_next); - _M_current = __backup; - } - else - _M_dfs(__match_mode, __state._M_next); - } - } - break; - case _S_opcode_accept: - if (__dfs_mode) - { - _GLIBCXX_DEBUG_ASSERT(!_M_has_sol); - if (__match_mode == _Match_mode::_Exact) - _M_has_sol = _M_current == _M_end; - else - _M_has_sol = true; - if (_M_current == _M_begin - && (_M_flags & regex_constants::match_not_null)) - _M_has_sol = false; - if (_M_has_sol) - { - if (_M_nfa._M_flags & regex_constants::ECMAScript) - _M_results = _M_cur_results; - else // POSIX - { - _GLIBCXX_DEBUG_ASSERT(_M_states._M_get_sol_pos()); - // Here's POSIX's logic: match the longest one. However - // we never know which one (lhs or rhs of "|") is longer - // unless we try both of them and compare the results. - // The member variable _M_sol_pos records the end - // position of the last successful match. It's better - // to be larger, because POSIX regex is always greedy. - // TODO: This could be slow. - if (*_M_states._M_get_sol_pos() == _BiIter() - || std::distance(_M_begin, - *_M_states._M_get_sol_pos()) - < std::distance(_M_begin, _M_current)) - { - *_M_states._M_get_sol_pos() = _M_current; - _M_results = _M_cur_results; - } - } - } - } - else - { - if (_M_current == _M_begin - && (_M_flags & regex_constants::match_not_null)) - break; - if (__match_mode == _Match_mode::_Prefix || _M_current == _M_end) - if (!_M_has_sol) - { - _M_has_sol = true; - _M_results = _M_cur_results; - } - } - break; - case _S_opcode_alternative: - if (_M_nfa._M_flags & regex_constants::ECMAScript) - { - // TODO: Let BFS support ECMAScript's alternative operation. - _GLIBCXX_DEBUG_ASSERT(__dfs_mode); - _M_dfs(__match_mode, __state._M_alt); - // Pick lhs if it matches. Only try rhs if it doesn't. - if (!_M_has_sol) - _M_dfs(__match_mode, __state._M_next); - } - else - { - // Try both and compare the result. - // See "case _S_opcode_accept:" handling above. - _M_dfs(__match_mode, __state._M_alt); - auto __has_sol = _M_has_sol; - _M_has_sol = false; - _M_dfs(__match_mode, __state._M_next); - _M_has_sol |= __has_sol; - } - break; - default: - _GLIBCXX_DEBUG_ASSERT(false); - } - } - - // Return whether now is at some word boundary. - template - bool _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>:: - _M_word_boundary() const - { - bool __left_is_word = false; - if (_M_current != _M_begin - || (_M_flags & regex_constants::match_prev_avail)) - { - auto __prev = _M_current; - if (_M_is_word(*std::prev(__prev))) - __left_is_word = true; - } - bool __right_is_word = - _M_current != _M_end && _M_is_word(*_M_current); - - if (__left_is_word == __right_is_word) - return false; - if (__left_is_word && !(_M_flags & regex_constants::match_not_eow)) - return true; - if (__right_is_word && !(_M_flags & regex_constants::match_not_bow)) - return true; - return false; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace __detail -} // namespace diff --git a/openflow/usr/include/c++/5/bits/regex_scanner.h b/openflow/usr/include/c++/5/bits/regex_scanner.h deleted file mode 100644 index 6fefed7..0000000 --- a/openflow/usr/include/c++/5/bits/regex_scanner.h +++ /dev/null @@ -1,271 +0,0 @@ -// class template regex -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file bits/regex_scanner.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{regex} - */ - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __detail -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup regex-detail - * @{ - */ - - struct _ScannerBase - { - public: - /// Token types returned from the scanner. - enum _TokenT - { - _S_token_anychar, - _S_token_ord_char, - _S_token_oct_num, - _S_token_hex_num, - _S_token_backref, - _S_token_subexpr_begin, - _S_token_subexpr_no_group_begin, - _S_token_subexpr_lookahead_begin, // neg if _M_value[0] == 'n' - _S_token_subexpr_end, - _S_token_bracket_begin, - _S_token_bracket_neg_begin, - _S_token_bracket_end, - _S_token_interval_begin, - _S_token_interval_end, - _S_token_quoted_class, - _S_token_char_class_name, - _S_token_collsymbol, - _S_token_equiv_class_name, - _S_token_opt, - _S_token_or, - _S_token_closure0, - _S_token_closure1, - _S_token_line_begin, - _S_token_line_end, - _S_token_word_bound, // neg if _M_value[0] == 'n' - _S_token_comma, - _S_token_dup_count, - _S_token_eof, - _S_token_unknown - }; - - protected: - typedef regex_constants::syntax_option_type _FlagT; - - enum _StateT - { - _S_state_normal, - _S_state_in_brace, - _S_state_in_bracket, - }; - - protected: - _ScannerBase(_FlagT __flags) - : _M_state(_S_state_normal), - _M_flags(__flags), - _M_escape_tbl(_M_is_ecma() - ? _M_ecma_escape_tbl - : _M_awk_escape_tbl), - _M_spec_char(_M_is_ecma() - ? _M_ecma_spec_char - : _M_flags & regex_constants::basic - ? _M_basic_spec_char - : _M_flags & regex_constants::extended - ? _M_extended_spec_char - : _M_flags & regex_constants::grep - ? ".[\\*^$\n" - : _M_flags & regex_constants::egrep - ? ".[\\()*+?{|^$\n" - : _M_flags & regex_constants::awk - ? _M_extended_spec_char - : nullptr), - _M_at_bracket_start(false) - { __glibcxx_assert(_M_spec_char); } - - protected: - const char* - _M_find_escape(char __c) - { - auto __it = _M_escape_tbl; - for (; __it->first != '\0'; ++__it) - if (__it->first == __c) - return &__it->second; - return nullptr; - } - - bool - _M_is_ecma() const - { return _M_flags & regex_constants::ECMAScript; } - - bool - _M_is_basic() const - { return _M_flags & (regex_constants::basic | regex_constants::grep); } - - bool - _M_is_extended() const - { - return _M_flags & (regex_constants::extended - | regex_constants::egrep - | regex_constants::awk); - } - - bool - _M_is_grep() const - { return _M_flags & (regex_constants::grep | regex_constants::egrep); } - - bool - _M_is_awk() const - { return _M_flags & regex_constants::awk; } - - protected: - // TODO: Make them static in the next abi change. - const std::pair _M_token_tbl[9] = - { - {'^', _S_token_line_begin}, - {'$', _S_token_line_end}, - {'.', _S_token_anychar}, - {'*', _S_token_closure0}, - {'+', _S_token_closure1}, - {'?', _S_token_opt}, - {'|', _S_token_or}, - {'\n', _S_token_or}, // grep and egrep - {'\0', _S_token_or}, - }; - const std::pair _M_ecma_escape_tbl[8] = - { - {'0', '\0'}, - {'b', '\b'}, - {'f', '\f'}, - {'n', '\n'}, - {'r', '\r'}, - {'t', '\t'}, - {'v', '\v'}, - {'\0', '\0'}, - }; - const std::pair _M_awk_escape_tbl[11] = - { - {'"', '"'}, - {'/', '/'}, - {'\\', '\\'}, - {'a', '\a'}, - {'b', '\b'}, - {'f', '\f'}, - {'n', '\n'}, - {'r', '\r'}, - {'t', '\t'}, - {'v', '\v'}, - {'\0', '\0'}, - }; - const char* _M_ecma_spec_char = "^$\\.*+?()[]{}|"; - const char* _M_basic_spec_char = ".[\\*^$"; - const char* _M_extended_spec_char = ".[\\()*+?{|^$"; - - _StateT _M_state; - _FlagT _M_flags; - _TokenT _M_token; - const std::pair* _M_escape_tbl; - const char* _M_spec_char; - bool _M_at_bracket_start; - }; - - /** - * @brief Scans an input range for regex tokens. - * - * The %_Scanner class interprets the regular expression pattern in - * the input range passed to its constructor as a sequence of parse - * tokens passed to the regular expression compiler. The sequence - * of tokens provided depends on the flag settings passed to the - * constructor: different regular expression grammars will interpret - * the same input pattern in syntactically different ways. - */ - template - class _Scanner - : public _ScannerBase - { - public: - typedef const _CharT* _IterT; - typedef std::basic_string<_CharT> _StringT; - typedef regex_constants::syntax_option_type _FlagT; - typedef const std::ctype<_CharT> _CtypeT; - - _Scanner(_IterT __begin, _IterT __end, - _FlagT __flags, std::locale __loc); - - void - _M_advance(); - - _TokenT - _M_get_token() const - { return _M_token; } - - const _StringT& - _M_get_value() const - { return _M_value; } - -#ifdef _GLIBCXX_DEBUG - std::ostream& - _M_print(std::ostream&); -#endif - - private: - void - _M_scan_normal(); - - void - _M_scan_in_bracket(); - - void - _M_scan_in_brace(); - - void - _M_eat_escape_ecma(); - - void - _M_eat_escape_posix(); - - void - _M_eat_escape_awk(); - - void - _M_eat_class(char); - - _IterT _M_current; - _IterT _M_end; - _CtypeT& _M_ctype; - _StringT _M_value; - void (_Scanner::* _M_eat_escape)(); - }; - - //@} regex-detail -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace __detail -} // namespace std - -#include diff --git a/openflow/usr/include/c++/5/bits/regex_scanner.tcc b/openflow/usr/include/c++/5/bits/regex_scanner.tcc deleted file mode 100644 index 4658f99..0000000 --- a/openflow/usr/include/c++/5/bits/regex_scanner.tcc +++ /dev/null @@ -1,564 +0,0 @@ -// class template regex -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file bits/regex_scanner.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{regex} - */ - -// FIXME make comments doxygen format. - -// N3376 specified 6 regex styles: ECMAScript, basic, extended, grep, egrep -// and awk -// 1) grep is basic except '\n' is treated as '|' -// 2) egrep is extended except '\n' is treated as '|' -// 3) awk is extended except special escaping rules, and there's no -// back-reference. -// -// References: -// -// ECMAScript: ECMA-262 15.10 -// -// basic, extended: -// http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html -// -// awk: http://pubs.opengroup.org/onlinepubs/000095399/utilities/awk.html - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __detail -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - _Scanner<_CharT>:: - _Scanner(typename _Scanner::_IterT __begin, - typename _Scanner::_IterT __end, - _FlagT __flags, std::locale __loc) - : _ScannerBase(__flags), - _M_current(__begin), _M_end(__end), - _M_ctype(std::use_facet<_CtypeT>(__loc)), - _M_eat_escape(_M_is_ecma() - ? &_Scanner::_M_eat_escape_ecma - : &_Scanner::_M_eat_escape_posix) - { _M_advance(); } - - template - void - _Scanner<_CharT>:: - _M_advance() - { - if (_M_current == _M_end) - { - _M_token = _S_token_eof; - return; - } - - if (_M_state == _S_state_normal) - _M_scan_normal(); - else if (_M_state == _S_state_in_bracket) - _M_scan_in_bracket(); - else if (_M_state == _S_state_in_brace) - _M_scan_in_brace(); - else - { - _GLIBCXX_DEBUG_ASSERT(false); - } - } - - // Differences between styles: - // 1) "\(", "\)", "\{" in basic. It's not escaping. - // 2) "(?:", "(?=", "(?!" in ECMAScript. - template - void - _Scanner<_CharT>:: - _M_scan_normal() - { - auto __c = *_M_current++; - - if (std::strchr(_M_spec_char, _M_ctype.narrow(__c, ' ')) == nullptr) - { - _M_token = _S_token_ord_char; - _M_value.assign(1, __c); - return; - } - if (__c == '\\') - { - if (_M_current == _M_end) - __throw_regex_error(regex_constants::error_escape); - - if (!_M_is_basic() - || (*_M_current != '(' - && *_M_current != ')' - && *_M_current != '{')) - { - (this->*_M_eat_escape)(); - return; - } - __c = *_M_current++; - } - if (__c == '(') - { - if (_M_is_ecma() && *_M_current == '?') - { - if (++_M_current == _M_end) - __throw_regex_error(regex_constants::error_paren); - - if (*_M_current == ':') - { - ++_M_current; - _M_token = _S_token_subexpr_no_group_begin; - } - else if (*_M_current == '=') - { - ++_M_current; - _M_token = _S_token_subexpr_lookahead_begin; - _M_value.assign(1, 'p'); - } - else if (*_M_current == '!') - { - ++_M_current; - _M_token = _S_token_subexpr_lookahead_begin; - _M_value.assign(1, 'n'); - } - else - __throw_regex_error(regex_constants::error_paren); - } - else if (_M_flags & regex_constants::nosubs) - _M_token = _S_token_subexpr_no_group_begin; - else - _M_token = _S_token_subexpr_begin; - } - else if (__c == ')') - _M_token = _S_token_subexpr_end; - else if (__c == '[') - { - _M_state = _S_state_in_bracket; - _M_at_bracket_start = true; - if (_M_current != _M_end && *_M_current == '^') - { - _M_token = _S_token_bracket_neg_begin; - ++_M_current; - } - else - _M_token = _S_token_bracket_begin; - } - else if (__c == '{') - { - _M_state = _S_state_in_brace; - _M_token = _S_token_interval_begin; - } - else if (__c != ']' && __c != '}') - { - auto __it = _M_token_tbl; - auto __narrowc = _M_ctype.narrow(__c, '\0'); - for (; __it->first != '\0'; ++__it) - if (__it->first == __narrowc) - { - _M_token = __it->second; - return; - } - _GLIBCXX_DEBUG_ASSERT(false); - } - else - { - _M_token = _S_token_ord_char; - _M_value.assign(1, __c); - } - } - - // Differences between styles: - // 1) different semantics of "[]" and "[^]". - // 2) Escaping in bracket expr. - template - void - _Scanner<_CharT>:: - _M_scan_in_bracket() - { - if (_M_current == _M_end) - __throw_regex_error(regex_constants::error_brack); - - auto __c = *_M_current++; - - if (__c == '[') - { - if (_M_current == _M_end) - __throw_regex_error(regex_constants::error_brack); - - if (*_M_current == '.') - { - _M_token = _S_token_collsymbol; - _M_eat_class(*_M_current++); - } - else if (*_M_current == ':') - { - _M_token = _S_token_char_class_name; - _M_eat_class(*_M_current++); - } - else if (*_M_current == '=') - { - _M_token = _S_token_equiv_class_name; - _M_eat_class(*_M_current++); - } - else - { - _M_token = _S_token_ord_char; - _M_value.assign(1, __c); - } - } - // In POSIX, when encountering "[]" or "[^]", the ']' is interpreted - // literally. So "[]]" and "[^]]" are valid regexes. See the testcases - // `*/empty_range.cc`. - else if (__c == ']' && (_M_is_ecma() || !_M_at_bracket_start)) - { - _M_token = _S_token_bracket_end; - _M_state = _S_state_normal; - } - // ECMAScript and awk permits escaping in bracket. - else if (__c == '\\' && (_M_is_ecma() || _M_is_awk())) - (this->*_M_eat_escape)(); - else - { - _M_token = _S_token_ord_char; - _M_value.assign(1, __c); - } - _M_at_bracket_start = false; - } - - // Differences between styles: - // 1) "\}" in basic style. - template - void - _Scanner<_CharT>:: - _M_scan_in_brace() - { - if (_M_current == _M_end) - __throw_regex_error(regex_constants::error_brace); - - auto __c = *_M_current++; - - if (_M_ctype.is(_CtypeT::digit, __c)) - { - _M_token = _S_token_dup_count; - _M_value.assign(1, __c); - while (_M_current != _M_end - && _M_ctype.is(_CtypeT::digit, *_M_current)) - _M_value += *_M_current++; - } - else if (__c == ',') - _M_token = _S_token_comma; - // basic use \}. - else if (_M_is_basic()) - { - if (__c == '\\' && _M_current != _M_end && *_M_current == '}') - { - _M_state = _S_state_normal; - _M_token = _S_token_interval_end; - ++_M_current; - } - else - __throw_regex_error(regex_constants::error_badbrace); - } - else if (__c == '}') - { - _M_state = _S_state_normal; - _M_token = _S_token_interval_end; - } - else - __throw_regex_error(regex_constants::error_badbrace); - } - - template - void - _Scanner<_CharT>:: - _M_eat_escape_ecma() - { - if (_M_current == _M_end) - __throw_regex_error(regex_constants::error_escape); - - auto __c = *_M_current++; - auto __pos = _M_find_escape(_M_ctype.narrow(__c, '\0')); - - if (__pos != nullptr && (__c != 'b' || _M_state == _S_state_in_bracket)) - { - _M_token = _S_token_ord_char; - _M_value.assign(1, *__pos); - } - else if (__c == 'b') - { - _M_token = _S_token_word_bound; - _M_value.assign(1, 'p'); - } - else if (__c == 'B') - { - _M_token = _S_token_word_bound; - _M_value.assign(1, 'n'); - } - // N3376 28.13 - else if (__c == 'd' - || __c == 'D' - || __c == 's' - || __c == 'S' - || __c == 'w' - || __c == 'W') - { - _M_token = _S_token_quoted_class; - _M_value.assign(1, __c); - } - else if (__c == 'c') - { - if (_M_current == _M_end) - __throw_regex_error(regex_constants::error_escape); - _M_token = _S_token_ord_char; - _M_value.assign(1, *_M_current++); - } - else if (__c == 'x' || __c == 'u') - { - _M_value.erase(); - for (int __i = 0; __i < (__c == 'x' ? 2 : 4); __i++) - { - if (_M_current == _M_end - || !_M_ctype.is(_CtypeT::xdigit, *_M_current)) - __throw_regex_error(regex_constants::error_escape); - _M_value += *_M_current++; - } - _M_token = _S_token_hex_num; - } - // ECMAScript recognizes multi-digit back-references. - else if (_M_ctype.is(_CtypeT::digit, __c)) - { - _M_value.assign(1, __c); - while (_M_current != _M_end - && _M_ctype.is(_CtypeT::digit, *_M_current)) - _M_value += *_M_current++; - _M_token = _S_token_backref; - } - else - { - _M_token = _S_token_ord_char; - _M_value.assign(1, __c); - } - } - - // Differences between styles: - // 1) Extended doesn't support backref, but basic does. - template - void - _Scanner<_CharT>:: - _M_eat_escape_posix() - { - if (_M_current == _M_end) - __throw_regex_error(regex_constants::error_escape); - - auto __c = *_M_current; - auto __pos = std::strchr(_M_spec_char, _M_ctype.narrow(__c, '\0')); - - if (__pos != nullptr && *__pos != '\0') - { - _M_token = _S_token_ord_char; - _M_value.assign(1, __c); - } - // We MUST judge awk before handling backrefs. There's no backref in awk. - else if (_M_is_awk()) - { - _M_eat_escape_awk(); - return; - } - else if (_M_is_basic() && _M_ctype.is(_CtypeT::digit, __c) && __c != '0') - { - _M_token = _S_token_backref; - _M_value.assign(1, __c); - } - else - { -#ifdef __STRICT_ANSI__ - // POSIX says it is undefined to escape ordinary characters - __throw_regex_error(regex_constants::error_escape); -#else - _M_token = _S_token_ord_char; - _M_value.assign(1, __c); -#endif - } - ++_M_current; - } - - template - void - _Scanner<_CharT>:: - _M_eat_escape_awk() - { - auto __c = *_M_current++; - auto __pos = _M_find_escape(_M_ctype.narrow(__c, '\0')); - - if (__pos != nullptr) - { - _M_token = _S_token_ord_char; - _M_value.assign(1, *__pos); - } - // \ddd for oct representation - else if (_M_ctype.is(_CtypeT::digit, __c) - && __c != '8' - && __c != '9') - { - _M_value.assign(1, __c); - for (int __i = 0; - __i < 2 - && _M_current != _M_end - && _M_ctype.is(_CtypeT::digit, *_M_current) - && *_M_current != '8' - && *_M_current != '9'; - __i++) - _M_value += *_M_current++; - _M_token = _S_token_oct_num; - return; - } - else - __throw_regex_error(regex_constants::error_escape); - } - - // Eats a character class or throws an exception. - // __ch could be ':', '.' or '=', _M_current is the char after ']' when - // returning. - template - void - _Scanner<_CharT>:: - _M_eat_class(char __ch) - { - for (_M_value.clear(); _M_current != _M_end && *_M_current != __ch;) - _M_value += *_M_current++; - if (_M_current == _M_end - || *_M_current++ != __ch - || _M_current == _M_end // skip __ch - || *_M_current++ != ']') // skip ']' - { - if (__ch == ':') - __throw_regex_error(regex_constants::error_ctype); - else - __throw_regex_error(regex_constants::error_collate); - } - } - -#ifdef _GLIBCXX_DEBUG - template - std::ostream& - _Scanner<_CharT>:: - _M_print(std::ostream& ostr) - { - switch (_M_token) - { - case _S_token_anychar: - ostr << "any-character\n"; - break; - case _S_token_backref: - ostr << "backref\n"; - break; - case _S_token_bracket_begin: - ostr << "bracket-begin\n"; - break; - case _S_token_bracket_neg_begin: - ostr << "bracket-neg-begin\n"; - break; - case _S_token_bracket_end: - ostr << "bracket-end\n"; - break; - case _S_token_char_class_name: - ostr << "char-class-name \"" << _M_value << "\"\n"; - break; - case _S_token_closure0: - ostr << "closure0\n"; - break; - case _S_token_closure1: - ostr << "closure1\n"; - break; - case _S_token_collsymbol: - ostr << "collsymbol \"" << _M_value << "\"\n"; - break; - case _S_token_comma: - ostr << "comma\n"; - break; - case _S_token_dup_count: - ostr << "dup count: " << _M_value << "\n"; - break; - case _S_token_eof: - ostr << "EOF\n"; - break; - case _S_token_equiv_class_name: - ostr << "equiv-class-name \"" << _M_value << "\"\n"; - break; - case _S_token_interval_begin: - ostr << "interval begin\n"; - break; - case _S_token_interval_end: - ostr << "interval end\n"; - break; - case _S_token_line_begin: - ostr << "line begin\n"; - break; - case _S_token_line_end: - ostr << "line end\n"; - break; - case _S_token_opt: - ostr << "opt\n"; - break; - case _S_token_or: - ostr << "or\n"; - break; - case _S_token_ord_char: - ostr << "ordinary character: \"" << _M_value << "\"\n"; - break; - case _S_token_subexpr_begin: - ostr << "subexpr begin\n"; - break; - case _S_token_subexpr_no_group_begin: - ostr << "no grouping subexpr begin\n"; - break; - case _S_token_subexpr_lookahead_begin: - ostr << "lookahead subexpr begin\n"; - break; - case _S_token_subexpr_end: - ostr << "subexpr end\n"; - break; - case _S_token_unknown: - ostr << "-- unknown token --\n"; - break; - case _S_token_oct_num: - ostr << "oct number " << _M_value << "\n"; - break; - case _S_token_hex_num: - ostr << "hex number " << _M_value << "\n"; - break; - case _S_token_quoted_class: - ostr << "quoted class " << "\\" << _M_value << "\n"; - break; - default: - _GLIBCXX_DEBUG_ASSERT(false); - } - return ostr; - } -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace __detail -} // namespace diff --git a/openflow/usr/include/c++/5/bits/shared_ptr.h b/openflow/usr/include/c++/5/bits/shared_ptr.h deleted file mode 100644 index 26a0ad3..0000000 --- a/openflow/usr/include/c++/5/bits/shared_ptr.h +++ /dev/null @@ -1,654 +0,0 @@ -// shared_ptr and weak_ptr implementation -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -// GCC Note: Based on files from version 1.32.0 of the Boost library. - -// shared_count.hpp -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. - -// shared_ptr.hpp -// Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes. -// Copyright (C) 2001, 2002, 2003 Peter Dimov - -// weak_ptr.hpp -// Copyright (C) 2001, 2002, 2003 Peter Dimov - -// enable_shared_from_this.hpp -// Copyright (C) 2002 Peter Dimov - -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -/** @file bits/shared_ptr.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _SHARED_PTR_H -#define _SHARED_PTR_H 1 - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup pointer_abstractions - * @{ - */ - - /// 20.7.2.2.11 shared_ptr I/O - template - inline std::basic_ostream<_Ch, _Tr>& - operator<<(std::basic_ostream<_Ch, _Tr>& __os, - const __shared_ptr<_Tp, _Lp>& __p) - { - __os << __p.get(); - return __os; - } - - /// 20.7.2.2.10 shared_ptr get_deleter - template - inline _Del* - get_deleter(const __shared_ptr<_Tp, _Lp>& __p) noexcept - { -#if __cpp_rtti - return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del))); -#else - return 0; -#endif - } - - - /** - * @brief A smart pointer with reference-counted copy semantics. - * - * The object pointed to is deleted when the last shared_ptr pointing to - * it is destroyed or reset. - */ - template - class shared_ptr : public __shared_ptr<_Tp> - { - template - using _Convertible - = typename enable_if::value>::type; - - public: - /** - * @brief Construct an empty %shared_ptr. - * @post use_count()==0 && get()==0 - */ - constexpr shared_ptr() noexcept - : __shared_ptr<_Tp>() { } - - shared_ptr(const shared_ptr&) noexcept = default; - - /** - * @brief Construct a %shared_ptr that owns the pointer @a __p. - * @param __p A pointer that is convertible to element_type*. - * @post use_count() == 1 && get() == __p - * @throw std::bad_alloc, in which case @c delete @a __p is called. - */ - template - explicit shared_ptr(_Tp1* __p) - : __shared_ptr<_Tp>(__p) { } - - /** - * @brief Construct a %shared_ptr that owns the pointer @a __p - * and the deleter @a __d. - * @param __p A pointer. - * @param __d A deleter. - * @post use_count() == 1 && get() == __p - * @throw std::bad_alloc, in which case @a __d(__p) is called. - * - * Requirements: _Deleter's copy constructor and destructor must - * not throw - * - * __shared_ptr will release __p by calling __d(__p) - */ - template - shared_ptr(_Tp1* __p, _Deleter __d) - : __shared_ptr<_Tp>(__p, __d) { } - - /** - * @brief Construct a %shared_ptr that owns a null pointer - * and the deleter @a __d. - * @param __p A null pointer constant. - * @param __d A deleter. - * @post use_count() == 1 && get() == __p - * @throw std::bad_alloc, in which case @a __d(__p) is called. - * - * Requirements: _Deleter's copy constructor and destructor must - * not throw - * - * The last owner will call __d(__p) - */ - template - shared_ptr(nullptr_t __p, _Deleter __d) - : __shared_ptr<_Tp>(__p, __d) { } - - /** - * @brief Construct a %shared_ptr that owns the pointer @a __p - * and the deleter @a __d. - * @param __p A pointer. - * @param __d A deleter. - * @param __a An allocator. - * @post use_count() == 1 && get() == __p - * @throw std::bad_alloc, in which case @a __d(__p) is called. - * - * Requirements: _Deleter's copy constructor and destructor must - * not throw _Alloc's copy constructor and destructor must not - * throw. - * - * __shared_ptr will release __p by calling __d(__p) - */ - template - shared_ptr(_Tp1* __p, _Deleter __d, _Alloc __a) - : __shared_ptr<_Tp>(__p, __d, std::move(__a)) { } - - /** - * @brief Construct a %shared_ptr that owns a null pointer - * and the deleter @a __d. - * @param __p A null pointer constant. - * @param __d A deleter. - * @param __a An allocator. - * @post use_count() == 1 && get() == __p - * @throw std::bad_alloc, in which case @a __d(__p) is called. - * - * Requirements: _Deleter's copy constructor and destructor must - * not throw _Alloc's copy constructor and destructor must not - * throw. - * - * The last owner will call __d(__p) - */ - template - shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a) - : __shared_ptr<_Tp>(__p, __d, std::move(__a)) { } - - // Aliasing constructor - - /** - * @brief Constructs a %shared_ptr instance that stores @a __p - * and shares ownership with @a __r. - * @param __r A %shared_ptr. - * @param __p A pointer that will remain valid while @a *__r is valid. - * @post get() == __p && use_count() == __r.use_count() - * - * This can be used to construct a @c shared_ptr to a sub-object - * of an object managed by an existing @c shared_ptr. - * - * @code - * shared_ptr< pair > pii(new pair()); - * shared_ptr pi(pii, &pii->first); - * assert(pii.use_count() == 2); - * @endcode - */ - template - shared_ptr(const shared_ptr<_Tp1>& __r, _Tp* __p) noexcept - : __shared_ptr<_Tp>(__r, __p) { } - - /** - * @brief If @a __r is empty, constructs an empty %shared_ptr; - * otherwise construct a %shared_ptr that shares ownership - * with @a __r. - * @param __r A %shared_ptr. - * @post get() == __r.get() && use_count() == __r.use_count() - */ - template> - shared_ptr(const shared_ptr<_Tp1>& __r) noexcept - : __shared_ptr<_Tp>(__r) { } - - /** - * @brief Move-constructs a %shared_ptr instance from @a __r. - * @param __r A %shared_ptr rvalue. - * @post *this contains the old value of @a __r, @a __r is empty. - */ - shared_ptr(shared_ptr&& __r) noexcept - : __shared_ptr<_Tp>(std::move(__r)) { } - - /** - * @brief Move-constructs a %shared_ptr instance from @a __r. - * @param __r A %shared_ptr rvalue. - * @post *this contains the old value of @a __r, @a __r is empty. - */ - template> - shared_ptr(shared_ptr<_Tp1>&& __r) noexcept - : __shared_ptr<_Tp>(std::move(__r)) { } - - /** - * @brief Constructs a %shared_ptr that shares ownership with @a __r - * and stores a copy of the pointer stored in @a __r. - * @param __r A weak_ptr. - * @post use_count() == __r.use_count() - * @throw bad_weak_ptr when __r.expired(), - * in which case the constructor has no effect. - */ - template - explicit shared_ptr(const weak_ptr<_Tp1>& __r) - : __shared_ptr<_Tp>(__r) { } - -#if _GLIBCXX_USE_DEPRECATED - template - shared_ptr(std::auto_ptr<_Tp1>&& __r); -#endif - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2399. shared_ptr's constructor from unique_ptr should be constrained - template::pointer>> - shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r) - : __shared_ptr<_Tp>(std::move(__r)) { } - - /** - * @brief Construct an empty %shared_ptr. - * @post use_count() == 0 && get() == nullptr - */ - constexpr shared_ptr(nullptr_t) noexcept : shared_ptr() { } - - shared_ptr& operator=(const shared_ptr&) noexcept = default; - - template - shared_ptr& - operator=(const shared_ptr<_Tp1>& __r) noexcept - { - this->__shared_ptr<_Tp>::operator=(__r); - return *this; - } - -#if _GLIBCXX_USE_DEPRECATED - template - shared_ptr& - operator=(std::auto_ptr<_Tp1>&& __r) - { - this->__shared_ptr<_Tp>::operator=(std::move(__r)); - return *this; - } -#endif - - shared_ptr& - operator=(shared_ptr&& __r) noexcept - { - this->__shared_ptr<_Tp>::operator=(std::move(__r)); - return *this; - } - - template - shared_ptr& - operator=(shared_ptr<_Tp1>&& __r) noexcept - { - this->__shared_ptr<_Tp>::operator=(std::move(__r)); - return *this; - } - - template - shared_ptr& - operator=(std::unique_ptr<_Tp1, _Del>&& __r) - { - this->__shared_ptr<_Tp>::operator=(std::move(__r)); - return *this; - } - - private: - // This constructor is non-standard, it is used by allocate_shared. - template - shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a, - _Args&&... __args) - : __shared_ptr<_Tp>(__tag, __a, std::forward<_Args>(__args)...) - { } - - template - friend shared_ptr<_Tp1> - allocate_shared(const _Alloc& __a, _Args&&... __args); - - // This constructor is non-standard, it is used by weak_ptr::lock(). - shared_ptr(const weak_ptr<_Tp>& __r, std::nothrow_t) - : __shared_ptr<_Tp>(__r, std::nothrow) { } - - friend class weak_ptr<_Tp>; - }; - - // 20.7.2.2.7 shared_ptr comparisons - template - inline bool - operator==(const shared_ptr<_Tp1>& __a, - const shared_ptr<_Tp2>& __b) noexcept - { return __a.get() == __b.get(); } - - template - inline bool - operator==(const shared_ptr<_Tp>& __a, nullptr_t) noexcept - { return !__a; } - - template - inline bool - operator==(nullptr_t, const shared_ptr<_Tp>& __a) noexcept - { return !__a; } - - template - inline bool - operator!=(const shared_ptr<_Tp1>& __a, - const shared_ptr<_Tp2>& __b) noexcept - { return __a.get() != __b.get(); } - - template - inline bool - operator!=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept - { return (bool)__a; } - - template - inline bool - operator!=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept - { return (bool)__a; } - - template - inline bool - operator<(const shared_ptr<_Tp1>& __a, - const shared_ptr<_Tp2>& __b) noexcept - { - typedef typename std::common_type<_Tp1*, _Tp2*>::type _CT; - return std::less<_CT>()(__a.get(), __b.get()); - } - - template - inline bool - operator<(const shared_ptr<_Tp>& __a, nullptr_t) noexcept - { return std::less<_Tp*>()(__a.get(), nullptr); } - - template - inline bool - operator<(nullptr_t, const shared_ptr<_Tp>& __a) noexcept - { return std::less<_Tp*>()(nullptr, __a.get()); } - - template - inline bool - operator<=(const shared_ptr<_Tp1>& __a, - const shared_ptr<_Tp2>& __b) noexcept - { return !(__b < __a); } - - template - inline bool - operator<=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept - { return !(nullptr < __a); } - - template - inline bool - operator<=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept - { return !(__a < nullptr); } - - template - inline bool - operator>(const shared_ptr<_Tp1>& __a, - const shared_ptr<_Tp2>& __b) noexcept - { return (__b < __a); } - - template - inline bool - operator>(const shared_ptr<_Tp>& __a, nullptr_t) noexcept - { return std::less<_Tp*>()(nullptr, __a.get()); } - - template - inline bool - operator>(nullptr_t, const shared_ptr<_Tp>& __a) noexcept - { return std::less<_Tp*>()(__a.get(), nullptr); } - - template - inline bool - operator>=(const shared_ptr<_Tp1>& __a, - const shared_ptr<_Tp2>& __b) noexcept - { return !(__a < __b); } - - template - inline bool - operator>=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept - { return !(__a < nullptr); } - - template - inline bool - operator>=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept - { return !(nullptr < __a); } - - template - struct less> : public _Sp_less> - { }; - - // 20.7.2.2.8 shared_ptr specialized algorithms. - template - inline void - swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b) noexcept - { __a.swap(__b); } - - // 20.7.2.2.9 shared_ptr casts. - template - inline shared_ptr<_Tp> - static_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept - { return shared_ptr<_Tp>(__r, static_cast<_Tp*>(__r.get())); } - - template - inline shared_ptr<_Tp> - const_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept - { return shared_ptr<_Tp>(__r, const_cast<_Tp*>(__r.get())); } - - template - inline shared_ptr<_Tp> - dynamic_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept - { - if (_Tp* __p = dynamic_cast<_Tp*>(__r.get())) - return shared_ptr<_Tp>(__r, __p); - return shared_ptr<_Tp>(); - } - - - /** - * @brief A smart pointer with weak semantics. - * - * With forwarding constructors and assignment operators. - */ - template - class weak_ptr : public __weak_ptr<_Tp> - { - template - using _Convertible - = typename enable_if::value>::type; - - public: - constexpr weak_ptr() noexcept = default; - - template> - weak_ptr(const shared_ptr<_Tp1>& __r) noexcept - : __weak_ptr<_Tp>(__r) { } - - weak_ptr(const weak_ptr&) noexcept = default; - - template> - weak_ptr(const weak_ptr<_Tp1>& __r) noexcept - : __weak_ptr<_Tp>(__r) { } - - weak_ptr(weak_ptr&&) noexcept = default; - - template> - weak_ptr(weak_ptr<_Tp1>&& __r) noexcept - : __weak_ptr<_Tp>(std::move(__r)) { } - - weak_ptr& - operator=(const weak_ptr& __r) noexcept = default; - - template - weak_ptr& - operator=(const weak_ptr<_Tp1>& __r) noexcept - { - this->__weak_ptr<_Tp>::operator=(__r); - return *this; - } - - template - weak_ptr& - operator=(const shared_ptr<_Tp1>& __r) noexcept - { - this->__weak_ptr<_Tp>::operator=(__r); - return *this; - } - - weak_ptr& - operator=(weak_ptr&& __r) noexcept = default; - - template - weak_ptr& - operator=(weak_ptr<_Tp1>&& __r) noexcept - { - this->__weak_ptr<_Tp>::operator=(std::move(__r)); - return *this; - } - - shared_ptr<_Tp> - lock() const noexcept - { return shared_ptr<_Tp>(*this, std::nothrow); } - }; - - // 20.7.2.3.6 weak_ptr specialized algorithms. - template - inline void - swap(weak_ptr<_Tp>& __a, weak_ptr<_Tp>& __b) noexcept - { __a.swap(__b); } - - - /// Primary template owner_less - template - struct owner_less; - - /// Partial specialization of owner_less for shared_ptr. - template - struct owner_less> - : public _Sp_owner_less, weak_ptr<_Tp>> - { }; - - /// Partial specialization of owner_less for weak_ptr. - template - struct owner_less> - : public _Sp_owner_less, shared_ptr<_Tp>> - { }; - - /** - * @brief Base class allowing use of member function shared_from_this. - */ - template - class enable_shared_from_this - { - protected: - constexpr enable_shared_from_this() noexcept { } - - enable_shared_from_this(const enable_shared_from_this&) noexcept { } - - enable_shared_from_this& - operator=(const enable_shared_from_this&) noexcept - { return *this; } - - ~enable_shared_from_this() { } - - public: - shared_ptr<_Tp> - shared_from_this() - { return shared_ptr<_Tp>(this->_M_weak_this); } - - shared_ptr - shared_from_this() const - { return shared_ptr(this->_M_weak_this); } - - private: - template - void - _M_weak_assign(_Tp1* __p, const __shared_count<>& __n) const noexcept - { _M_weak_this._M_assign(__p, __n); } - - template - friend void - __enable_shared_from_this_helper(const __shared_count<>&, - const enable_shared_from_this<_Tp1>*, - const _Tp2*) noexcept; - - mutable weak_ptr<_Tp> _M_weak_this; - }; - - template - inline void - __enable_shared_from_this_helper(const __shared_count<>& __pn, - const enable_shared_from_this<_Tp1>* - __pe, const _Tp2* __px) noexcept - { - if (__pe != nullptr) - __pe->_M_weak_assign(const_cast<_Tp2*>(__px), __pn); - } - - /** - * @brief Create an object that is owned by a shared_ptr. - * @param __a An allocator. - * @param __args Arguments for the @a _Tp object's constructor. - * @return A shared_ptr that owns the newly created object. - * @throw An exception thrown from @a _Alloc::allocate or from the - * constructor of @a _Tp. - * - * A copy of @a __a will be used to allocate memory for the shared_ptr - * and the new object. - */ - template - inline shared_ptr<_Tp> - allocate_shared(const _Alloc& __a, _Args&&... __args) - { - return shared_ptr<_Tp>(_Sp_make_shared_tag(), __a, - std::forward<_Args>(__args)...); - } - - /** - * @brief Create an object that is owned by a shared_ptr. - * @param __args Arguments for the @a _Tp object's constructor. - * @return A shared_ptr that owns the newly created object. - * @throw std::bad_alloc, or an exception thrown from the - * constructor of @a _Tp. - */ - template - inline shared_ptr<_Tp> - make_shared(_Args&&... __args) - { - typedef typename std::remove_const<_Tp>::type _Tp_nc; - return std::allocate_shared<_Tp>(std::allocator<_Tp_nc>(), - std::forward<_Args>(__args)...); - } - - /// std::hash specialization for shared_ptr. - template - struct hash> - : public __hash_base> - { - size_t - operator()(const shared_ptr<_Tp>& __s) const noexcept - { return std::hash<_Tp*>()(__s.get()); } - }; - - // @} group pointer_abstractions - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif // _SHARED_PTR_H diff --git a/openflow/usr/include/c++/5/bits/shared_ptr_atomic.h b/openflow/usr/include/c++/5/bits/shared_ptr_atomic.h deleted file mode 100644 index 9eec3e0..0000000 --- a/openflow/usr/include/c++/5/bits/shared_ptr_atomic.h +++ /dev/null @@ -1,330 +0,0 @@ -// shared_ptr atomic access -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/shared_ptr_atomic.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _SHARED_PTR_ATOMIC_H -#define _SHARED_PTR_ATOMIC_H 1 - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup pointer_abstractions - * @{ - */ - - struct _Sp_locker - { - _Sp_locker(const _Sp_locker&) = delete; - _Sp_locker& operator=(const _Sp_locker&) = delete; - -#ifdef __GTHREADS - explicit - _Sp_locker(const void*) noexcept; - _Sp_locker(const void*, const void*) noexcept; - ~_Sp_locker(); - - private: - unsigned char _M_key1; - unsigned char _M_key2; -#else - explicit _Sp_locker(const void*, const void* = nullptr) { } -#endif - }; - - /** - * @brief Report whether shared_ptr atomic operations are lock-free. - * @param __p A non-null pointer to a shared_ptr object. - * @return True if atomic access to @c *__p is lock-free, false otherwise. - * @{ - */ - template - inline bool - atomic_is_lock_free(const __shared_ptr<_Tp, _Lp>* __p) - { -#ifdef __GTHREADS - return __gthread_active_p() == 0; -#else - return true; -#endif - } - - template - inline bool - atomic_is_lock_free(const shared_ptr<_Tp>* __p) - { return std::atomic_is_lock_free<_Tp, __default_lock_policy>(__p); } - - // @} - - /** - * @brief Atomic load for shared_ptr objects. - * @param __p A non-null pointer to a shared_ptr object. - * @return @c *__p - * - * The memory order shall not be @c memory_order_release or - * @c memory_order_acq_rel. - * @{ - */ - template - inline shared_ptr<_Tp> - atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) - { - _Sp_locker __lock{__p}; - return *__p; - } - - template - inline shared_ptr<_Tp> - atomic_load(const shared_ptr<_Tp>* __p) - { return std::atomic_load_explicit(__p, memory_order_seq_cst); } - - template - inline __shared_ptr<_Tp, _Lp> - atomic_load_explicit(const __shared_ptr<_Tp, _Lp>* __p, memory_order) - { - _Sp_locker __lock{__p}; - return *__p; - } - - template - inline __shared_ptr<_Tp, _Lp> - atomic_load(const __shared_ptr<_Tp, _Lp>* __p) - { return std::atomic_load_explicit(__p, memory_order_seq_cst); } - // @} - - /** - * @brief Atomic store for shared_ptr objects. - * @param __p A non-null pointer to a shared_ptr object. - * @param __r The value to store. - * - * The memory order shall not be @c memory_order_acquire or - * @c memory_order_acq_rel. - * @{ - */ - template - inline void - atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, - memory_order) - { - _Sp_locker __lock{__p}; - __p->swap(__r); // use swap so that **__p not destroyed while lock held - } - - template - inline void - atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) - { std::atomic_store_explicit(__p, std::move(__r), memory_order_seq_cst); } - - template - inline void - atomic_store_explicit(__shared_ptr<_Tp, _Lp>* __p, - __shared_ptr<_Tp, _Lp> __r, - memory_order) - { - _Sp_locker __lock{__p}; - __p->swap(__r); // use swap so that **__p not destroyed while lock held - } - - template - inline void - atomic_store(__shared_ptr<_Tp, _Lp>* __p, __shared_ptr<_Tp, _Lp> __r) - { std::atomic_store_explicit(__p, std::move(__r), memory_order_seq_cst); } - // @} - - /** - * @brief Atomic exchange for shared_ptr objects. - * @param __p A non-null pointer to a shared_ptr object. - * @param __r New value to store in @c *__p. - * @return The original value of @c *__p - * @{ - */ - template - inline shared_ptr<_Tp> - atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, - memory_order) - { - _Sp_locker __lock{__p}; - __p->swap(__r); - return __r; - } - - template - inline shared_ptr<_Tp> - atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) - { - return std::atomic_exchange_explicit(__p, std::move(__r), - memory_order_seq_cst); - } - - template - inline __shared_ptr<_Tp, _Lp> - atomic_exchange_explicit(__shared_ptr<_Tp, _Lp>* __p, - __shared_ptr<_Tp, _Lp> __r, - memory_order) - { - _Sp_locker __lock{__p}; - __p->swap(__r); - return __r; - } - - template - inline __shared_ptr<_Tp, _Lp> - atomic_exchange(__shared_ptr<_Tp, _Lp>* __p, __shared_ptr<_Tp, _Lp> __r) - { - return std::atomic_exchange_explicit(__p, std::move(__r), - memory_order_seq_cst); - } - // @} - - /** - * @brief Atomic compare-and-swap for shared_ptr objects. - * @param __p A non-null pointer to a shared_ptr object. - * @param __v A non-null pointer to a shared_ptr object. - * @param __w A non-null pointer to a shared_ptr object. - * @return True if @c *__p was equivalent to @c *__v, false otherwise. - * - * The memory order for failure shall not be @c memory_order_release or - * @c memory_order_acq_rel, or stronger than the memory order for success. - * @{ - */ - template - bool - atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, - shared_ptr<_Tp>* __v, - shared_ptr<_Tp> __w, - memory_order, - memory_order) - { - shared_ptr<_Tp> __x; // goes out of scope after __lock - _Sp_locker __lock{__p, __v}; - owner_less> __less; - if (*__p == *__v && !__less(*__p, *__v) && !__less(*__v, *__p)) - { - __x = std::move(*__p); - *__p = std::move(__w); - return true; - } - __x = std::move(*__v); - *__v = *__p; - return false; - } - - template - inline bool - atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, - shared_ptr<_Tp> __w) - { - return std::atomic_compare_exchange_strong_explicit(__p, __v, - std::move(__w), memory_order_seq_cst, memory_order_seq_cst); - } - - template - inline bool - atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, - shared_ptr<_Tp>* __v, - shared_ptr<_Tp> __w, - memory_order __success, - memory_order __failure) - { - return std::atomic_compare_exchange_strong_explicit(__p, __v, - std::move(__w), __success, __failure); - } - - template - inline bool - atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, - shared_ptr<_Tp> __w) - { - return std::atomic_compare_exchange_weak_explicit(__p, __v, - std::move(__w), memory_order_seq_cst, memory_order_seq_cst); - } - - template - bool - atomic_compare_exchange_strong_explicit(__shared_ptr<_Tp, _Lp>* __p, - __shared_ptr<_Tp, _Lp>* __v, - __shared_ptr<_Tp, _Lp> __w, - memory_order, - memory_order) - { - __shared_ptr<_Tp, _Lp> __x; // goes out of scope after __lock - _Sp_locker __lock{__p, __v}; - owner_less<__shared_ptr<_Tp, _Lp>> __less; - if (*__p == *__v && !__less(*__p, *__v) && !__less(*__v, *__p)) - { - __x = std::move(*__p); - *__p = std::move(__w); - return true; - } - __x = std::move(*__v); - *__v = *__p; - return false; - } - - template - inline bool - atomic_compare_exchange_strong(__shared_ptr<_Tp, _Lp>* __p, - __shared_ptr<_Tp, _Lp>* __v, - __shared_ptr<_Tp, _Lp> __w) - { - return std::atomic_compare_exchange_strong_explicit(__p, __v, - std::move(__w), memory_order_seq_cst, memory_order_seq_cst); - } - - template - inline bool - atomic_compare_exchange_weak_explicit(__shared_ptr<_Tp, _Lp>* __p, - __shared_ptr<_Tp, _Lp>* __v, - __shared_ptr<_Tp, _Lp> __w, - memory_order __success, - memory_order __failure) - { - return std::atomic_compare_exchange_strong_explicit(__p, __v, - std::move(__w), __success, __failure); - } - - template - inline bool - atomic_compare_exchange_weak(__shared_ptr<_Tp, _Lp>* __p, - __shared_ptr<_Tp, _Lp>* __v, - __shared_ptr<_Tp, _Lp> __w) - { - return std::atomic_compare_exchange_weak_explicit(__p, __v, - std::move(__w), memory_order_seq_cst, memory_order_seq_cst); - } - // @} - - // @} group pointer_abstractions - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif // _SHARED_PTR_ATOMIC_H diff --git a/openflow/usr/include/c++/5/bits/shared_ptr_base.h b/openflow/usr/include/c++/5/bits/shared_ptr_base.h deleted file mode 100644 index d71df31..0000000 --- a/openflow/usr/include/c++/5/bits/shared_ptr_base.h +++ /dev/null @@ -1,1593 +0,0 @@ -// shared_ptr and weak_ptr implementation details -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -// GCC Note: Based on files from version 1.32.0 of the Boost library. - -// shared_count.hpp -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. - -// shared_ptr.hpp -// Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes. -// Copyright (C) 2001, 2002, 2003 Peter Dimov - -// weak_ptr.hpp -// Copyright (C) 2001, 2002, 2003 Peter Dimov - -// enable_shared_from_this.hpp -// Copyright (C) 2002 Peter Dimov - -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -/** @file bits/shared_ptr_base.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _SHARED_PTR_BASE_H -#define _SHARED_PTR_BASE_H 1 - -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#if _GLIBCXX_USE_DEPRECATED - template class auto_ptr; -#endif - - /** - * @brief Exception possibly thrown by @c shared_ptr. - * @ingroup exceptions - */ - class bad_weak_ptr : public std::exception - { - public: - virtual char const* - what() const noexcept; - - virtual ~bad_weak_ptr() noexcept; - }; - - // Substitute for bad_weak_ptr object in the case of -fno-exceptions. - inline void - __throw_bad_weak_ptr() - { _GLIBCXX_THROW_OR_ABORT(bad_weak_ptr()); } - - using __gnu_cxx::_Lock_policy; - using __gnu_cxx::__default_lock_policy; - using __gnu_cxx::_S_single; - using __gnu_cxx::_S_mutex; - using __gnu_cxx::_S_atomic; - - // Empty helper class except when the template argument is _S_mutex. - template<_Lock_policy _Lp> - class _Mutex_base - { - protected: - // The atomic policy uses fully-fenced builtins, single doesn't care. - enum { _S_need_barriers = 0 }; - }; - - template<> - class _Mutex_base<_S_mutex> - : public __gnu_cxx::__mutex - { - protected: - // This policy is used when atomic builtins are not available. - // The replacement atomic operations might not have the necessary - // memory barriers. - enum { _S_need_barriers = 1 }; - }; - - template<_Lock_policy _Lp = __default_lock_policy> - class _Sp_counted_base - : public _Mutex_base<_Lp> - { - public: - _Sp_counted_base() noexcept - : _M_use_count(1), _M_weak_count(1) { } - - virtual - ~_Sp_counted_base() noexcept - { } - - // Called when _M_use_count drops to zero, to release the resources - // managed by *this. - virtual void - _M_dispose() noexcept = 0; - - // Called when _M_weak_count drops to zero. - virtual void - _M_destroy() noexcept - { delete this; } - - virtual void* - _M_get_deleter(const std::type_info&) noexcept = 0; - - void - _M_add_ref_copy() - { __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); } - - void - _M_add_ref_lock(); - - bool - _M_add_ref_lock_nothrow(); - - void - _M_release() noexcept - { - // Be race-detector-friendly. For more info see bits/c++config. - _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count); - if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1) - { - _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count); - _M_dispose(); - // There must be a memory barrier between dispose() and destroy() - // to ensure that the effects of dispose() are observed in the - // thread that runs destroy(). - // See http://gcc.gnu.org/ml/libstdc++/2005-11/msg00136.html - if (_Mutex_base<_Lp>::_S_need_barriers) - { - _GLIBCXX_READ_MEM_BARRIER; - _GLIBCXX_WRITE_MEM_BARRIER; - } - - // Be race-detector-friendly. For more info see bits/c++config. - _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count); - if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, - -1) == 1) - { - _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count); - _M_destroy(); - } - } - } - - void - _M_weak_add_ref() noexcept - { __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); } - - void - _M_weak_release() noexcept - { - // Be race-detector-friendly. For more info see bits/c++config. - _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count); - if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1) - { - _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count); - if (_Mutex_base<_Lp>::_S_need_barriers) - { - // See _M_release(), - // destroy() must observe results of dispose() - _GLIBCXX_READ_MEM_BARRIER; - _GLIBCXX_WRITE_MEM_BARRIER; - } - _M_destroy(); - } - } - - long - _M_get_use_count() const noexcept - { - // No memory barrier is used here so there is no synchronization - // with other threads. - return __atomic_load_n(&_M_use_count, __ATOMIC_RELAXED); - } - - private: - _Sp_counted_base(_Sp_counted_base const&) = delete; - _Sp_counted_base& operator=(_Sp_counted_base const&) = delete; - - _Atomic_word _M_use_count; // #shared - _Atomic_word _M_weak_count; // #weak + (#shared != 0) - }; - - template<> - inline void - _Sp_counted_base<_S_single>:: - _M_add_ref_lock() - { - if (_M_use_count == 0) - __throw_bad_weak_ptr(); - ++_M_use_count; - } - - template<> - inline void - _Sp_counted_base<_S_mutex>:: - _M_add_ref_lock() - { - __gnu_cxx::__scoped_lock sentry(*this); - if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0) - { - _M_use_count = 0; - __throw_bad_weak_ptr(); - } - } - - template<> - inline void - _Sp_counted_base<_S_atomic>:: - _M_add_ref_lock() - { - // Perform lock-free add-if-not-zero operation. - _Atomic_word __count = _M_get_use_count(); - do - { - if (__count == 0) - __throw_bad_weak_ptr(); - // Replace the current counter value with the old value + 1, as - // long as it's not changed meanwhile. - } - while (!__atomic_compare_exchange_n(&_M_use_count, &__count, __count + 1, - true, __ATOMIC_ACQ_REL, - __ATOMIC_RELAXED)); - } - - template<> - inline bool - _Sp_counted_base<_S_single>:: - _M_add_ref_lock_nothrow() - { - if (_M_use_count == 0) - return false; - ++_M_use_count; - return true; - } - - template<> - inline bool - _Sp_counted_base<_S_mutex>:: - _M_add_ref_lock_nothrow() - { - __gnu_cxx::__scoped_lock sentry(*this); - if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0) - { - _M_use_count = 0; - return false; - } - return true; - } - - template<> - inline bool - _Sp_counted_base<_S_atomic>:: - _M_add_ref_lock_nothrow() - { - // Perform lock-free add-if-not-zero operation. - _Atomic_word __count = _M_get_use_count(); - do - { - if (__count == 0) - return false; - // Replace the current counter value with the old value + 1, as - // long as it's not changed meanwhile. - } - while (!__atomic_compare_exchange_n(&_M_use_count, &__count, __count + 1, - true, __ATOMIC_ACQ_REL, - __ATOMIC_RELAXED)); - return true; - } - - template<> - inline void - _Sp_counted_base<_S_single>::_M_add_ref_copy() - { ++_M_use_count; } - - template<> - inline void - _Sp_counted_base<_S_single>::_M_release() noexcept - { - if (--_M_use_count == 0) - { - _M_dispose(); - if (--_M_weak_count == 0) - _M_destroy(); - } - } - - template<> - inline void - _Sp_counted_base<_S_single>::_M_weak_add_ref() noexcept - { ++_M_weak_count; } - - template<> - inline void - _Sp_counted_base<_S_single>::_M_weak_release() noexcept - { - if (--_M_weak_count == 0) - _M_destroy(); - } - - template<> - inline long - _Sp_counted_base<_S_single>::_M_get_use_count() const noexcept - { return _M_use_count; } - - - // Forward declarations. - template - class __shared_ptr; - - template - class __weak_ptr; - - template - class __enable_shared_from_this; - - template - class shared_ptr; - - template - class weak_ptr; - - template - struct owner_less; - - template - class enable_shared_from_this; - - template<_Lock_policy _Lp = __default_lock_policy> - class __weak_count; - - template<_Lock_policy _Lp = __default_lock_policy> - class __shared_count; - - - // Counted ptr with no deleter or allocator support - template - class _Sp_counted_ptr final : public _Sp_counted_base<_Lp> - { - public: - explicit - _Sp_counted_ptr(_Ptr __p) noexcept - : _M_ptr(__p) { } - - virtual void - _M_dispose() noexcept - { delete _M_ptr; } - - virtual void - _M_destroy() noexcept - { delete this; } - - virtual void* - _M_get_deleter(const std::type_info&) noexcept - { return nullptr; } - - _Sp_counted_ptr(const _Sp_counted_ptr&) = delete; - _Sp_counted_ptr& operator=(const _Sp_counted_ptr&) = delete; - - private: - _Ptr _M_ptr; - }; - - template<> - inline void - _Sp_counted_ptr::_M_dispose() noexcept { } - - template<> - inline void - _Sp_counted_ptr::_M_dispose() noexcept { } - - template<> - inline void - _Sp_counted_ptr::_M_dispose() noexcept { } - - template - struct _Sp_ebo_helper; - - /// Specialization using EBO. - template - struct _Sp_ebo_helper<_Nm, _Tp, true> : private _Tp - { - explicit _Sp_ebo_helper(const _Tp& __tp) : _Tp(__tp) { } - - static _Tp& - _S_get(_Sp_ebo_helper& __eboh) { return static_cast<_Tp&>(__eboh); } - }; - - /// Specialization not using EBO. - template - struct _Sp_ebo_helper<_Nm, _Tp, false> - { - explicit _Sp_ebo_helper(const _Tp& __tp) : _M_tp(__tp) { } - - static _Tp& - _S_get(_Sp_ebo_helper& __eboh) - { return __eboh._M_tp; } - - private: - _Tp _M_tp; - }; - - // Support for custom deleter and/or allocator - template - class _Sp_counted_deleter final : public _Sp_counted_base<_Lp> - { - class _Impl : _Sp_ebo_helper<0, _Deleter>, _Sp_ebo_helper<1, _Alloc> - { - typedef _Sp_ebo_helper<0, _Deleter> _Del_base; - typedef _Sp_ebo_helper<1, _Alloc> _Alloc_base; - - public: - _Impl(_Ptr __p, _Deleter __d, const _Alloc& __a) noexcept - : _M_ptr(__p), _Del_base(__d), _Alloc_base(__a) - { } - - _Deleter& _M_del() noexcept { return _Del_base::_S_get(*this); } - _Alloc& _M_alloc() noexcept { return _Alloc_base::_S_get(*this); } - - _Ptr _M_ptr; - }; - - public: - using __allocator_type = __alloc_rebind<_Alloc, _Sp_counted_deleter>; - - // __d(__p) must not throw. - _Sp_counted_deleter(_Ptr __p, _Deleter __d) noexcept - : _M_impl(__p, __d, _Alloc()) { } - - // __d(__p) must not throw. - _Sp_counted_deleter(_Ptr __p, _Deleter __d, const _Alloc& __a) noexcept - : _M_impl(__p, __d, __a) { } - - ~_Sp_counted_deleter() noexcept { } - - virtual void - _M_dispose() noexcept - { _M_impl._M_del()(_M_impl._M_ptr); } - - virtual void - _M_destroy() noexcept - { - __allocator_type __a(_M_impl._M_alloc()); - __allocated_ptr<__allocator_type> __guard_ptr{ __a, this }; - this->~_Sp_counted_deleter(); - } - - virtual void* - _M_get_deleter(const std::type_info& __ti) noexcept - { -#if __cpp_rtti - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2400. shared_ptr's get_deleter() should use addressof() - return __ti == typeid(_Deleter) - ? std::__addressof(_M_impl._M_del()) - : nullptr; -#else - return nullptr; -#endif - } - - private: - _Impl _M_impl; - }; - - // helpers for make_shared / allocate_shared - - struct _Sp_make_shared_tag { }; - - template - class _Sp_counted_ptr_inplace final : public _Sp_counted_base<_Lp> - { - class _Impl : _Sp_ebo_helper<0, _Alloc> - { - typedef _Sp_ebo_helper<0, _Alloc> _A_base; - - public: - explicit _Impl(_Alloc __a) noexcept : _A_base(__a) { } - - _Alloc& _M_alloc() noexcept { return _A_base::_S_get(*this); } - - __gnu_cxx::__aligned_buffer<_Tp> _M_storage; - }; - - public: - using __allocator_type = __alloc_rebind<_Alloc, _Sp_counted_ptr_inplace>; - - template - _Sp_counted_ptr_inplace(_Alloc __a, _Args&&... __args) - : _M_impl(__a) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2070. allocate_shared should use allocator_traits::construct - allocator_traits<_Alloc>::construct(__a, _M_ptr(), - std::forward<_Args>(__args)...); // might throw - } - - ~_Sp_counted_ptr_inplace() noexcept { } - - virtual void - _M_dispose() noexcept - { - allocator_traits<_Alloc>::destroy(_M_impl._M_alloc(), _M_ptr()); - } - - // Override because the allocator needs to know the dynamic type - virtual void - _M_destroy() noexcept - { - __allocator_type __a(_M_impl._M_alloc()); - __allocated_ptr<__allocator_type> __guard_ptr{ __a, this }; - this->~_Sp_counted_ptr_inplace(); - } - - // Sneaky trick so __shared_ptr can get the managed pointer - virtual void* - _M_get_deleter(const std::type_info& __ti) noexcept - { -#if __cpp_rtti - if (__ti == typeid(_Sp_make_shared_tag)) - return const_cast::type*>(_M_ptr()); -#endif - return nullptr; - } - - private: - _Tp* _M_ptr() noexcept { return _M_impl._M_storage._M_ptr(); } - - _Impl _M_impl; - }; - - - template<_Lock_policy _Lp> - class __shared_count - { - public: - constexpr __shared_count() noexcept : _M_pi(0) - { } - - template - explicit - __shared_count(_Ptr __p) : _M_pi(0) - { - __try - { - _M_pi = new _Sp_counted_ptr<_Ptr, _Lp>(__p); - } - __catch(...) - { - delete __p; - __throw_exception_again; - } - } - - template - __shared_count(_Ptr __p, _Deleter __d) - : __shared_count(__p, std::move(__d), allocator()) - { } - - template - __shared_count(_Ptr __p, _Deleter __d, _Alloc __a) : _M_pi(0) - { - typedef _Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp> _Sp_cd_type; - __try - { - typename _Sp_cd_type::__allocator_type __a2(__a); - auto __guard = std::__allocate_guarded(__a2); - _Sp_cd_type* __mem = __guard.get(); - ::new (__mem) _Sp_cd_type(__p, std::move(__d), std::move(__a)); - _M_pi = __mem; - __guard = nullptr; - } - __catch(...) - { - __d(__p); // Call _Deleter on __p. - __throw_exception_again; - } - } - - template - __shared_count(_Sp_make_shared_tag, _Tp*, const _Alloc& __a, - _Args&&... __args) - : _M_pi(0) - { - typedef _Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp> _Sp_cp_type; - typename _Sp_cp_type::__allocator_type __a2(__a); - auto __guard = std::__allocate_guarded(__a2); - _Sp_cp_type* __mem = __guard.get(); - ::new (__mem) _Sp_cp_type(std::move(__a), - std::forward<_Args>(__args)...); - _M_pi = __mem; - __guard = nullptr; - } - -#if _GLIBCXX_USE_DEPRECATED - // Special case for auto_ptr<_Tp> to provide the strong guarantee. - template - explicit - __shared_count(std::auto_ptr<_Tp>&& __r); -#endif - - // Special case for unique_ptr<_Tp,_Del> to provide the strong guarantee. - template - explicit - __shared_count(std::unique_ptr<_Tp, _Del>&& __r) : _M_pi(0) - { - using _Ptr = typename unique_ptr<_Tp, _Del>::pointer; - using _Del2 = typename conditional::value, - reference_wrapper::type>, - _Del>::type; - using _Sp_cd_type - = _Sp_counted_deleter<_Ptr, _Del2, allocator, _Lp>; - using _Alloc = allocator<_Sp_cd_type>; - using _Alloc_traits = allocator_traits<_Alloc>; - _Alloc __a; - _Sp_cd_type* __mem = _Alloc_traits::allocate(__a, 1); - _Alloc_traits::construct(__a, __mem, __r.release(), - __r.get_deleter()); // non-throwing - _M_pi = __mem; - } - - // Throw bad_weak_ptr when __r._M_get_use_count() == 0. - explicit __shared_count(const __weak_count<_Lp>& __r); - - // Does not throw if __r._M_get_use_count() == 0, caller must check. - explicit __shared_count(const __weak_count<_Lp>& __r, std::nothrow_t); - - ~__shared_count() noexcept - { - if (_M_pi != nullptr) - _M_pi->_M_release(); - } - - __shared_count(const __shared_count& __r) noexcept - : _M_pi(__r._M_pi) - { - if (_M_pi != 0) - _M_pi->_M_add_ref_copy(); - } - - __shared_count& - operator=(const __shared_count& __r) noexcept - { - _Sp_counted_base<_Lp>* __tmp = __r._M_pi; - if (__tmp != _M_pi) - { - if (__tmp != 0) - __tmp->_M_add_ref_copy(); - if (_M_pi != 0) - _M_pi->_M_release(); - _M_pi = __tmp; - } - return *this; - } - - void - _M_swap(__shared_count& __r) noexcept - { - _Sp_counted_base<_Lp>* __tmp = __r._M_pi; - __r._M_pi = _M_pi; - _M_pi = __tmp; - } - - long - _M_get_use_count() const noexcept - { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; } - - bool - _M_unique() const noexcept - { return this->_M_get_use_count() == 1; } - - void* - _M_get_deleter(const std::type_info& __ti) const noexcept - { return _M_pi ? _M_pi->_M_get_deleter(__ti) : nullptr; } - - bool - _M_less(const __shared_count& __rhs) const noexcept - { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } - - bool - _M_less(const __weak_count<_Lp>& __rhs) const noexcept - { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } - - // Friend function injected into enclosing namespace and found by ADL - friend inline bool - operator==(const __shared_count& __a, const __shared_count& __b) noexcept - { return __a._M_pi == __b._M_pi; } - - private: - friend class __weak_count<_Lp>; - - _Sp_counted_base<_Lp>* _M_pi; - }; - - - template<_Lock_policy _Lp> - class __weak_count - { - public: - constexpr __weak_count() noexcept : _M_pi(nullptr) - { } - - __weak_count(const __shared_count<_Lp>& __r) noexcept - : _M_pi(__r._M_pi) - { - if (_M_pi != nullptr) - _M_pi->_M_weak_add_ref(); - } - - __weak_count(const __weak_count& __r) noexcept - : _M_pi(__r._M_pi) - { - if (_M_pi != nullptr) - _M_pi->_M_weak_add_ref(); - } - - __weak_count(__weak_count&& __r) noexcept - : _M_pi(__r._M_pi) - { __r._M_pi = nullptr; } - - ~__weak_count() noexcept - { - if (_M_pi != nullptr) - _M_pi->_M_weak_release(); - } - - __weak_count& - operator=(const __shared_count<_Lp>& __r) noexcept - { - _Sp_counted_base<_Lp>* __tmp = __r._M_pi; - if (__tmp != nullptr) - __tmp->_M_weak_add_ref(); - if (_M_pi != nullptr) - _M_pi->_M_weak_release(); - _M_pi = __tmp; - return *this; - } - - __weak_count& - operator=(const __weak_count& __r) noexcept - { - _Sp_counted_base<_Lp>* __tmp = __r._M_pi; - if (__tmp != nullptr) - __tmp->_M_weak_add_ref(); - if (_M_pi != nullptr) - _M_pi->_M_weak_release(); - _M_pi = __tmp; - return *this; - } - - __weak_count& - operator=(__weak_count&& __r) noexcept - { - if (_M_pi != nullptr) - _M_pi->_M_weak_release(); - _M_pi = __r._M_pi; - __r._M_pi = nullptr; - return *this; - } - - void - _M_swap(__weak_count& __r) noexcept - { - _Sp_counted_base<_Lp>* __tmp = __r._M_pi; - __r._M_pi = _M_pi; - _M_pi = __tmp; - } - - long - _M_get_use_count() const noexcept - { return _M_pi != nullptr ? _M_pi->_M_get_use_count() : 0; } - - bool - _M_less(const __weak_count& __rhs) const noexcept - { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } - - bool - _M_less(const __shared_count<_Lp>& __rhs) const noexcept - { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } - - // Friend function injected into enclosing namespace and found by ADL - friend inline bool - operator==(const __weak_count& __a, const __weak_count& __b) noexcept - { return __a._M_pi == __b._M_pi; } - - private: - friend class __shared_count<_Lp>; - - _Sp_counted_base<_Lp>* _M_pi; - }; - - // Now that __weak_count is defined we can define this constructor: - template<_Lock_policy _Lp> - inline - __shared_count<_Lp>::__shared_count(const __weak_count<_Lp>& __r) - : _M_pi(__r._M_pi) - { - if (_M_pi != nullptr) - _M_pi->_M_add_ref_lock(); - else - __throw_bad_weak_ptr(); - } - - // Now that __weak_count is defined we can define this constructor: - template<_Lock_policy _Lp> - inline - __shared_count<_Lp>:: - __shared_count(const __weak_count<_Lp>& __r, std::nothrow_t) - : _M_pi(__r._M_pi) - { - if (_M_pi != nullptr) - if (!_M_pi->_M_add_ref_lock_nothrow()) - _M_pi = nullptr; - } - - // Support for enable_shared_from_this. - - // Friend of __enable_shared_from_this. - template<_Lock_policy _Lp, typename _Tp1, typename _Tp2> - void - __enable_shared_from_this_helper(const __shared_count<_Lp>&, - const __enable_shared_from_this<_Tp1, - _Lp>*, const _Tp2*) noexcept; - - // Friend of enable_shared_from_this. - template - void - __enable_shared_from_this_helper(const __shared_count<>&, - const enable_shared_from_this<_Tp1>*, - const _Tp2*) noexcept; - - template<_Lock_policy _Lp> - inline void - __enable_shared_from_this_helper(const __shared_count<_Lp>&, ...) noexcept - { } - - - template - class __shared_ptr - { - template - using _Convertible - = typename enable_if::value>::type; - - public: - typedef _Tp element_type; - - constexpr __shared_ptr() noexcept - : _M_ptr(0), _M_refcount() - { } - - template - explicit __shared_ptr(_Tp1* __p) - : _M_ptr(__p), _M_refcount(__p) - { - __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) - static_assert( !is_void<_Tp1>::value, "incomplete type" ); - static_assert( sizeof(_Tp1) > 0, "incomplete type" ); - __enable_shared_from_this_helper(_M_refcount, __p, __p); - } - - template - __shared_ptr(_Tp1* __p, _Deleter __d) - : _M_ptr(__p), _M_refcount(__p, __d) - { - __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) - // TODO requires _Deleter CopyConstructible and __d(__p) well-formed - __enable_shared_from_this_helper(_M_refcount, __p, __p); - } - - template - __shared_ptr(_Tp1* __p, _Deleter __d, _Alloc __a) - : _M_ptr(__p), _M_refcount(__p, __d, std::move(__a)) - { - __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) - // TODO requires _Deleter CopyConstructible and __d(__p) well-formed - __enable_shared_from_this_helper(_M_refcount, __p, __p); - } - - template - __shared_ptr(nullptr_t __p, _Deleter __d) - : _M_ptr(0), _M_refcount(__p, __d) - { } - - template - __shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a) - : _M_ptr(0), _M_refcount(__p, __d, std::move(__a)) - { } - - template - __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, _Tp* __p) noexcept - : _M_ptr(__p), _M_refcount(__r._M_refcount) // never throws - { } - - __shared_ptr(const __shared_ptr&) noexcept = default; - __shared_ptr& operator=(const __shared_ptr&) noexcept = default; - ~__shared_ptr() = default; - - template> - __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r) noexcept - : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) - { } - - __shared_ptr(__shared_ptr&& __r) noexcept - : _M_ptr(__r._M_ptr), _M_refcount() - { - _M_refcount._M_swap(__r._M_refcount); - __r._M_ptr = 0; - } - - template> - __shared_ptr(__shared_ptr<_Tp1, _Lp>&& __r) noexcept - : _M_ptr(__r._M_ptr), _M_refcount() - { - _M_refcount._M_swap(__r._M_refcount); - __r._M_ptr = 0; - } - - template - explicit __shared_ptr(const __weak_ptr<_Tp1, _Lp>& __r) - : _M_refcount(__r._M_refcount) // may throw - { - __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) - - // It is now safe to copy __r._M_ptr, as - // _M_refcount(__r._M_refcount) did not throw. - _M_ptr = __r._M_ptr; - } - - // If an exception is thrown this constructor has no effect. - template::pointer>> - __shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r) - : _M_ptr(__r.get()), _M_refcount() - { - __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) - auto __raw = _S_raw_ptr(__r.get()); - _M_refcount = __shared_count<_Lp>(std::move(__r)); - __enable_shared_from_this_helper(_M_refcount, __raw, __raw); - } - -#if _GLIBCXX_USE_DEPRECATED - // Postcondition: use_count() == 1 and __r.get() == 0 - template - __shared_ptr(std::auto_ptr<_Tp1>&& __r); -#endif - - constexpr __shared_ptr(nullptr_t) noexcept : __shared_ptr() { } - - template - __shared_ptr& - operator=(const __shared_ptr<_Tp1, _Lp>& __r) noexcept - { - _M_ptr = __r._M_ptr; - _M_refcount = __r._M_refcount; // __shared_count::op= doesn't throw - return *this; - } - -#if _GLIBCXX_USE_DEPRECATED - template - __shared_ptr& - operator=(std::auto_ptr<_Tp1>&& __r) - { - __shared_ptr(std::move(__r)).swap(*this); - return *this; - } -#endif - - __shared_ptr& - operator=(__shared_ptr&& __r) noexcept - { - __shared_ptr(std::move(__r)).swap(*this); - return *this; - } - - template - __shared_ptr& - operator=(__shared_ptr<_Tp1, _Lp>&& __r) noexcept - { - __shared_ptr(std::move(__r)).swap(*this); - return *this; - } - - template - __shared_ptr& - operator=(std::unique_ptr<_Tp1, _Del>&& __r) - { - __shared_ptr(std::move(__r)).swap(*this); - return *this; - } - - void - reset() noexcept - { __shared_ptr().swap(*this); } - - template - void - reset(_Tp1* __p) // _Tp1 must be complete. - { - // Catch self-reset errors. - _GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != _M_ptr); - __shared_ptr(__p).swap(*this); - } - - template - void - reset(_Tp1* __p, _Deleter __d) - { __shared_ptr(__p, __d).swap(*this); } - - template - void - reset(_Tp1* __p, _Deleter __d, _Alloc __a) - { __shared_ptr(__p, __d, std::move(__a)).swap(*this); } - - // Allow class instantiation when _Tp is [cv-qual] void. - typename std::add_lvalue_reference<_Tp>::type - operator*() const noexcept - { - _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); - return *_M_ptr; - } - - _Tp* - operator->() const noexcept - { - _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); - return _M_ptr; - } - - _Tp* - get() const noexcept - { return _M_ptr; } - - explicit operator bool() const // never throws - { return _M_ptr == 0 ? false : true; } - - bool - unique() const noexcept - { return _M_refcount._M_unique(); } - - long - use_count() const noexcept - { return _M_refcount._M_get_use_count(); } - - void - swap(__shared_ptr<_Tp, _Lp>& __other) noexcept - { - std::swap(_M_ptr, __other._M_ptr); - _M_refcount._M_swap(__other._M_refcount); - } - - template - bool - owner_before(__shared_ptr<_Tp1, _Lp> const& __rhs) const - { return _M_refcount._M_less(__rhs._M_refcount); } - - template - bool - owner_before(__weak_ptr<_Tp1, _Lp> const& __rhs) const - { return _M_refcount._M_less(__rhs._M_refcount); } - -#if __cpp_rtti - protected: - // This constructor is non-standard, it is used by allocate_shared. - template - __shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a, - _Args&&... __args) - : _M_ptr(), _M_refcount(__tag, (_Tp*)0, __a, - std::forward<_Args>(__args)...) - { - // _M_ptr needs to point to the newly constructed object. - // This relies on _Sp_counted_ptr_inplace::_M_get_deleter. - void* __p = _M_refcount._M_get_deleter(typeid(__tag)); - _M_ptr = static_cast<_Tp*>(__p); - __enable_shared_from_this_helper(_M_refcount, _M_ptr, _M_ptr); - } -#else - template - struct _Deleter - { - void operator()(typename _Alloc::value_type* __ptr) - { - __allocated_ptr<_Alloc> __guard{ _M_alloc, __ptr }; - allocator_traits<_Alloc>::destroy(_M_alloc, __guard.get()); - } - _Alloc _M_alloc; - }; - - template - __shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a, - _Args&&... __args) - : _M_ptr(), _M_refcount() - { - typedef typename allocator_traits<_Alloc>::template - rebind_traits::type> __traits; - _Deleter __del = { __a }; - auto __guard = std::__allocate_guarded(__del._M_alloc); - auto __ptr = __guard.get(); - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2070. allocate_shared should use allocator_traits::construct - __traits::construct(__del._M_alloc, __ptr, - std::forward<_Args>(__args)...); - __guard = nullptr; - __shared_count<_Lp> __count(__ptr, __del, __del._M_alloc); - _M_refcount._M_swap(__count); - _M_ptr = __ptr; - __enable_shared_from_this_helper(_M_refcount, _M_ptr, _M_ptr); - } -#endif - - template - friend __shared_ptr<_Tp1, _Lp1> - __allocate_shared(const _Alloc& __a, _Args&&... __args); - - // This constructor is used by __weak_ptr::lock() and - // shared_ptr::shared_ptr(const weak_ptr&, std::nothrow_t). - __shared_ptr(const __weak_ptr<_Tp, _Lp>& __r, std::nothrow_t) - : _M_refcount(__r._M_refcount, std::nothrow) - { - _M_ptr = _M_refcount._M_get_use_count() ? __r._M_ptr : nullptr; - } - - friend class __weak_ptr<_Tp, _Lp>; - - private: - void* - _M_get_deleter(const std::type_info& __ti) const noexcept - { return _M_refcount._M_get_deleter(__ti); } - - template - static _Tp1* - _S_raw_ptr(_Tp1* __ptr) - { return __ptr; } - - template - static auto - _S_raw_ptr(_Tp1 __ptr) -> decltype(std::__addressof(*__ptr)) - { return std::__addressof(*__ptr); } - - template friend class __shared_ptr; - template friend class __weak_ptr; - - template - friend _Del* get_deleter(const __shared_ptr<_Tp1, _Lp1>&) noexcept; - - _Tp* _M_ptr; // Contained pointer. - __shared_count<_Lp> _M_refcount; // Reference counter. - }; - - - // 20.7.2.2.7 shared_ptr comparisons - template - inline bool - operator==(const __shared_ptr<_Tp1, _Lp>& __a, - const __shared_ptr<_Tp2, _Lp>& __b) noexcept - { return __a.get() == __b.get(); } - - template - inline bool - operator==(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept - { return !__a; } - - template - inline bool - operator==(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept - { return !__a; } - - template - inline bool - operator!=(const __shared_ptr<_Tp1, _Lp>& __a, - const __shared_ptr<_Tp2, _Lp>& __b) noexcept - { return __a.get() != __b.get(); } - - template - inline bool - operator!=(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept - { return (bool)__a; } - - template - inline bool - operator!=(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept - { return (bool)__a; } - - template - inline bool - operator<(const __shared_ptr<_Tp1, _Lp>& __a, - const __shared_ptr<_Tp2, _Lp>& __b) noexcept - { - typedef typename std::common_type<_Tp1*, _Tp2*>::type _CT; - return std::less<_CT>()(__a.get(), __b.get()); - } - - template - inline bool - operator<(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept - { return std::less<_Tp*>()(__a.get(), nullptr); } - - template - inline bool - operator<(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept - { return std::less<_Tp*>()(nullptr, __a.get()); } - - template - inline bool - operator<=(const __shared_ptr<_Tp1, _Lp>& __a, - const __shared_ptr<_Tp2, _Lp>& __b) noexcept - { return !(__b < __a); } - - template - inline bool - operator<=(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept - { return !(nullptr < __a); } - - template - inline bool - operator<=(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept - { return !(__a < nullptr); } - - template - inline bool - operator>(const __shared_ptr<_Tp1, _Lp>& __a, - const __shared_ptr<_Tp2, _Lp>& __b) noexcept - { return (__b < __a); } - - template - inline bool - operator>(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept - { return std::less<_Tp*>()(nullptr, __a.get()); } - - template - inline bool - operator>(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept - { return std::less<_Tp*>()(__a.get(), nullptr); } - - template - inline bool - operator>=(const __shared_ptr<_Tp1, _Lp>& __a, - const __shared_ptr<_Tp2, _Lp>& __b) noexcept - { return !(__a < __b); } - - template - inline bool - operator>=(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept - { return !(__a < nullptr); } - - template - inline bool - operator>=(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept - { return !(nullptr < __a); } - - template - struct _Sp_less : public binary_function<_Sp, _Sp, bool> - { - bool - operator()(const _Sp& __lhs, const _Sp& __rhs) const noexcept - { - typedef typename _Sp::element_type element_type; - return std::less()(__lhs.get(), __rhs.get()); - } - }; - - template - struct less<__shared_ptr<_Tp, _Lp>> - : public _Sp_less<__shared_ptr<_Tp, _Lp>> - { }; - - // 20.7.2.2.8 shared_ptr specialized algorithms. - template - inline void - swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b) noexcept - { __a.swap(__b); } - - // 20.7.2.2.9 shared_ptr casts - - // The seemingly equivalent code: - // shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get())) - // will eventually result in undefined behaviour, attempting to - // delete the same object twice. - /// static_pointer_cast - template - inline __shared_ptr<_Tp, _Lp> - static_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept - { return __shared_ptr<_Tp, _Lp>(__r, static_cast<_Tp*>(__r.get())); } - - // The seemingly equivalent code: - // shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get())) - // will eventually result in undefined behaviour, attempting to - // delete the same object twice. - /// const_pointer_cast - template - inline __shared_ptr<_Tp, _Lp> - const_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept - { return __shared_ptr<_Tp, _Lp>(__r, const_cast<_Tp*>(__r.get())); } - - // The seemingly equivalent code: - // shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get())) - // will eventually result in undefined behaviour, attempting to - // delete the same object twice. - /// dynamic_pointer_cast - template - inline __shared_ptr<_Tp, _Lp> - dynamic_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept - { - if (_Tp* __p = dynamic_cast<_Tp*>(__r.get())) - return __shared_ptr<_Tp, _Lp>(__r, __p); - return __shared_ptr<_Tp, _Lp>(); - } - - - template - class __weak_ptr - { - template - using _Convertible - = typename enable_if::value>::type; - - public: - typedef _Tp element_type; - - constexpr __weak_ptr() noexcept - : _M_ptr(nullptr), _M_refcount() - { } - - __weak_ptr(const __weak_ptr&) noexcept = default; - - ~__weak_ptr() = default; - - // The "obvious" converting constructor implementation: - // - // template - // __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r) - // : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws - // { } - // - // has a serious problem. - // - // __r._M_ptr may already have been invalidated. The _M_ptr(__r._M_ptr) - // conversion may require access to *__r._M_ptr (virtual inheritance). - // - // It is not possible to avoid spurious access violations since - // in multithreaded programs __r._M_ptr may be invalidated at any point. - template> - __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r) noexcept - : _M_refcount(__r._M_refcount) - { _M_ptr = __r.lock().get(); } - - template> - __weak_ptr(const __shared_ptr<_Tp1, _Lp>& __r) noexcept - : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) - { } - - __weak_ptr(__weak_ptr&& __r) noexcept - : _M_ptr(__r._M_ptr), _M_refcount(std::move(__r._M_refcount)) - { __r._M_ptr = nullptr; } - - template> - __weak_ptr(__weak_ptr<_Tp1, _Lp>&& __r) noexcept - : _M_ptr(__r.lock().get()), _M_refcount(std::move(__r._M_refcount)) - { __r._M_ptr = nullptr; } - - __weak_ptr& - operator=(const __weak_ptr& __r) noexcept = default; - - template - __weak_ptr& - operator=(const __weak_ptr<_Tp1, _Lp>& __r) noexcept - { - _M_ptr = __r.lock().get(); - _M_refcount = __r._M_refcount; - return *this; - } - - template - __weak_ptr& - operator=(const __shared_ptr<_Tp1, _Lp>& __r) noexcept - { - _M_ptr = __r._M_ptr; - _M_refcount = __r._M_refcount; - return *this; - } - - __weak_ptr& - operator=(__weak_ptr&& __r) noexcept - { - _M_ptr = __r._M_ptr; - _M_refcount = std::move(__r._M_refcount); - __r._M_ptr = nullptr; - return *this; - } - - template - __weak_ptr& - operator=(__weak_ptr<_Tp1, _Lp>&& __r) noexcept - { - _M_ptr = __r.lock().get(); - _M_refcount = std::move(__r._M_refcount); - __r._M_ptr = nullptr; - return *this; - } - - __shared_ptr<_Tp, _Lp> - lock() const noexcept - { return __shared_ptr(*this, std::nothrow); } - - long - use_count() const noexcept - { return _M_refcount._M_get_use_count(); } - - bool - expired() const noexcept - { return _M_refcount._M_get_use_count() == 0; } - - template - bool - owner_before(const __shared_ptr<_Tp1, _Lp>& __rhs) const - { return _M_refcount._M_less(__rhs._M_refcount); } - - template - bool - owner_before(const __weak_ptr<_Tp1, _Lp>& __rhs) const - { return _M_refcount._M_less(__rhs._M_refcount); } - - void - reset() noexcept - { __weak_ptr().swap(*this); } - - void - swap(__weak_ptr& __s) noexcept - { - std::swap(_M_ptr, __s._M_ptr); - _M_refcount._M_swap(__s._M_refcount); - } - - private: - // Used by __enable_shared_from_this. - void - _M_assign(_Tp* __ptr, const __shared_count<_Lp>& __refcount) noexcept - { - _M_ptr = __ptr; - _M_refcount = __refcount; - } - - template friend class __shared_ptr; - template friend class __weak_ptr; - friend class __enable_shared_from_this<_Tp, _Lp>; - friend class enable_shared_from_this<_Tp>; - - _Tp* _M_ptr; // Contained pointer. - __weak_count<_Lp> _M_refcount; // Reference counter. - }; - - // 20.7.2.3.6 weak_ptr specialized algorithms. - template - inline void - swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b) noexcept - { __a.swap(__b); } - - template - struct _Sp_owner_less : public binary_function<_Tp, _Tp, bool> - { - bool - operator()(const _Tp& __lhs, const _Tp& __rhs) const - { return __lhs.owner_before(__rhs); } - - bool - operator()(const _Tp& __lhs, const _Tp1& __rhs) const - { return __lhs.owner_before(__rhs); } - - bool - operator()(const _Tp1& __lhs, const _Tp& __rhs) const - { return __lhs.owner_before(__rhs); } - }; - - template - struct owner_less<__shared_ptr<_Tp, _Lp>> - : public _Sp_owner_less<__shared_ptr<_Tp, _Lp>, __weak_ptr<_Tp, _Lp>> - { }; - - template - struct owner_less<__weak_ptr<_Tp, _Lp>> - : public _Sp_owner_less<__weak_ptr<_Tp, _Lp>, __shared_ptr<_Tp, _Lp>> - { }; - - - template - class __enable_shared_from_this - { - protected: - constexpr __enable_shared_from_this() noexcept { } - - __enable_shared_from_this(const __enable_shared_from_this&) noexcept { } - - __enable_shared_from_this& - operator=(const __enable_shared_from_this&) noexcept - { return *this; } - - ~__enable_shared_from_this() { } - - public: - __shared_ptr<_Tp, _Lp> - shared_from_this() - { return __shared_ptr<_Tp, _Lp>(this->_M_weak_this); } - - __shared_ptr - shared_from_this() const - { return __shared_ptr(this->_M_weak_this); } - - private: - template - void - _M_weak_assign(_Tp1* __p, const __shared_count<_Lp>& __n) const noexcept - { _M_weak_this._M_assign(__p, __n); } - - template<_Lock_policy _Lp1, typename _Tp1, typename _Tp2> - friend void - __enable_shared_from_this_helper(const __shared_count<_Lp1>&, - const __enable_shared_from_this<_Tp1, - _Lp1>*, const _Tp2*) noexcept; - - mutable __weak_ptr<_Tp, _Lp> _M_weak_this; - }; - - template<_Lock_policy _Lp1, typename _Tp1, typename _Tp2> - inline void - __enable_shared_from_this_helper(const __shared_count<_Lp1>& __pn, - const __enable_shared_from_this<_Tp1, - _Lp1>* __pe, - const _Tp2* __px) noexcept - { - if (__pe != nullptr) - __pe->_M_weak_assign(const_cast<_Tp2*>(__px), __pn); - } - - template - inline __shared_ptr<_Tp, _Lp> - __allocate_shared(const _Alloc& __a, _Args&&... __args) - { - return __shared_ptr<_Tp, _Lp>(_Sp_make_shared_tag(), __a, - std::forward<_Args>(__args)...); - } - - template - inline __shared_ptr<_Tp, _Lp> - __make_shared(_Args&&... __args) - { - typedef typename std::remove_const<_Tp>::type _Tp_nc; - return std::__allocate_shared<_Tp, _Lp>(std::allocator<_Tp_nc>(), - std::forward<_Args>(__args)...); - } - - /// std::hash specialization for __shared_ptr. - template - struct hash<__shared_ptr<_Tp, _Lp>> - : public __hash_base> - { - size_t - operator()(const __shared_ptr<_Tp, _Lp>& __s) const noexcept - { return std::hash<_Tp*>()(__s.get()); } - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif // _SHARED_PTR_BASE_H diff --git a/openflow/usr/include/c++/5/bits/slice_array.h b/openflow/usr/include/c++/5/bits/slice_array.h deleted file mode 100644 index ee1c546..0000000 --- a/openflow/usr/include/c++/5/bits/slice_array.h +++ /dev/null @@ -1,274 +0,0 @@ -// The template and inlines for the -*- C++ -*- slice_array class. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/slice_array.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{valarray} - */ - -// Written by Gabriel Dos Reis - -#ifndef _SLICE_ARRAY_H -#define _SLICE_ARRAY_H 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup numeric_arrays - * @{ - */ - - /** - * @brief Class defining one-dimensional subset of an array. - * - * The slice class represents a one-dimensional subset of an array, - * specified by three parameters: start offset, size, and stride. The - * start offset is the index of the first element of the array that is part - * of the subset. The size is the total number of elements in the subset. - * Stride is the distance between each successive array element to include - * in the subset. - * - * For example, with an array of size 10, and a slice with offset 1, size 3 - * and stride 2, the subset consists of array elements 1, 3, and 5. - */ - class slice - { - public: - /// Construct an empty slice. - slice(); - - /** - * @brief Construct a slice. - * - * @param __o Offset in array of first element. - * @param __d Number of elements in slice. - * @param __s Stride between array elements. - */ - slice(size_t __o, size_t __d, size_t __s); - - /// Return array offset of first slice element. - size_t start() const; - /// Return size of slice. - size_t size() const; - /// Return array stride of slice. - size_t stride() const; - - private: - size_t _M_off; // offset - size_t _M_sz; // size - size_t _M_st; // stride unit - }; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 543. valarray slice default constructor - inline - slice::slice() - : _M_off(0), _M_sz(0), _M_st(0) {} - - inline - slice::slice(size_t __o, size_t __d, size_t __s) - : _M_off(__o), _M_sz(__d), _M_st(__s) {} - - inline size_t - slice::start() const - { return _M_off; } - - inline size_t - slice::size() const - { return _M_sz; } - - inline size_t - slice::stride() const - { return _M_st; } - - /** - * @brief Reference to one-dimensional subset of an array. - * - * A slice_array is a reference to the actual elements of an array - * specified by a slice. The way to get a slice_array is to call - * operator[](slice) on a valarray. The returned slice_array then permits - * carrying operations out on the referenced subset of elements in the - * original valarray. For example, operator+=(valarray) will add values - * to the subset of elements in the underlying valarray this slice_array - * refers to. - * - * @param Tp Element type. - */ - template - class slice_array - { - public: - typedef _Tp value_type; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 253. valarray helper functions are almost entirely useless - - /// Copy constructor. Both slices refer to the same underlying array. - slice_array(const slice_array&); - - /// Assignment operator. Assigns slice elements to corresponding - /// elements of @a a. - slice_array& operator=(const slice_array&); - - /// Assign slice elements to corresponding elements of @a v. - void operator=(const valarray<_Tp>&) const; - /// Multiply slice elements by corresponding elements of @a v. - void operator*=(const valarray<_Tp>&) const; - /// Divide slice elements by corresponding elements of @a v. - void operator/=(const valarray<_Tp>&) const; - /// Modulo slice elements by corresponding elements of @a v. - void operator%=(const valarray<_Tp>&) const; - /// Add corresponding elements of @a v to slice elements. - void operator+=(const valarray<_Tp>&) const; - /// Subtract corresponding elements of @a v from slice elements. - void operator-=(const valarray<_Tp>&) const; - /// Logical xor slice elements with corresponding elements of @a v. - void operator^=(const valarray<_Tp>&) const; - /// Logical and slice elements with corresponding elements of @a v. - void operator&=(const valarray<_Tp>&) const; - /// Logical or slice elements with corresponding elements of @a v. - void operator|=(const valarray<_Tp>&) const; - /// Left shift slice elements by corresponding elements of @a v. - void operator<<=(const valarray<_Tp>&) const; - /// Right shift slice elements by corresponding elements of @a v. - void operator>>=(const valarray<_Tp>&) const; - /// Assign all slice elements to @a t. - void operator=(const _Tp &) const; - // ~slice_array (); - - template - void operator=(const _Expr<_Dom, _Tp>&) const; - template - void operator*=(const _Expr<_Dom, _Tp>&) const; - template - void operator/=(const _Expr<_Dom, _Tp>&) const; - template - void operator%=(const _Expr<_Dom, _Tp>&) const; - template - void operator+=(const _Expr<_Dom, _Tp>&) const; - template - void operator-=(const _Expr<_Dom, _Tp>&) const; - template - void operator^=(const _Expr<_Dom, _Tp>&) const; - template - void operator&=(const _Expr<_Dom, _Tp>&) const; - template - void operator|=(const _Expr<_Dom, _Tp>&) const; - template - void operator<<=(const _Expr<_Dom, _Tp>&) const; - template - void operator>>=(const _Expr<_Dom, _Tp>&) const; - - private: - friend class valarray<_Tp>; - slice_array(_Array<_Tp>, const slice&); - - const size_t _M_sz; - const size_t _M_stride; - const _Array<_Tp> _M_array; - - // not implemented - slice_array(); - }; - - template - inline - slice_array<_Tp>::slice_array(_Array<_Tp> __a, const slice& __s) - : _M_sz(__s.size()), _M_stride(__s.stride()), - _M_array(__a.begin() + __s.start()) {} - - template - inline - slice_array<_Tp>::slice_array(const slice_array<_Tp>& a) - : _M_sz(a._M_sz), _M_stride(a._M_stride), _M_array(a._M_array) {} - - // template - // inline slice_array<_Tp>::~slice_array () {} - - template - inline slice_array<_Tp>& - slice_array<_Tp>::operator=(const slice_array<_Tp>& __a) - { - std::__valarray_copy(__a._M_array, __a._M_sz, __a._M_stride, - _M_array, _M_stride); - return *this; - } - - template - inline void - slice_array<_Tp>::operator=(const _Tp& __t) const - { std::__valarray_fill(_M_array, _M_sz, _M_stride, __t); } - - template - inline void - slice_array<_Tp>::operator=(const valarray<_Tp>& __v) const - { std::__valarray_copy(_Array<_Tp>(__v), _M_array, _M_sz, _M_stride); } - - template - template - inline void - slice_array<_Tp>::operator=(const _Expr<_Dom,_Tp>& __e) const - { std::__valarray_copy(__e, _M_sz, _M_array, _M_stride); } - -#undef _DEFINE_VALARRAY_OPERATOR -#define _DEFINE_VALARRAY_OPERATOR(_Op,_Name) \ - template \ - inline void \ - slice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \ - { \ - _Array_augmented_##_Name(_M_array, _M_sz, _M_stride, _Array<_Tp>(__v));\ - } \ - \ - template \ - template \ - inline void \ - slice_array<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e) const\ - { \ - _Array_augmented_##_Name(_M_array, _M_stride, __e, _M_sz); \ - } - - -_DEFINE_VALARRAY_OPERATOR(*, __multiplies) -_DEFINE_VALARRAY_OPERATOR(/, __divides) -_DEFINE_VALARRAY_OPERATOR(%, __modulus) -_DEFINE_VALARRAY_OPERATOR(+, __plus) -_DEFINE_VALARRAY_OPERATOR(-, __minus) -_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor) -_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and) -_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or) -_DEFINE_VALARRAY_OPERATOR(<<, __shift_left) -_DEFINE_VALARRAY_OPERATOR(>>, __shift_right) - -#undef _DEFINE_VALARRAY_OPERATOR - - // @} group numeric_arrays - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _SLICE_ARRAY_H */ diff --git a/openflow/usr/include/c++/5/bits/sstream.tcc b/openflow/usr/include/c++/5/bits/sstream.tcc deleted file mode 100644 index 67c27f7..0000000 --- a/openflow/usr/include/c++/5/bits/sstream.tcc +++ /dev/null @@ -1,288 +0,0 @@ -// String based streams -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/sstream.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{sstream} - */ - -// -// ISO C++ 14882: 27.7 String-based streams -// - -#ifndef _SSTREAM_TCC -#define _SSTREAM_TCC 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type - basic_stringbuf<_CharT, _Traits, _Alloc>:: - pbackfail(int_type __c) - { - int_type __ret = traits_type::eof(); - if (this->eback() < this->gptr()) - { - // Try to put back __c into input sequence in one of three ways. - // Order these tests done in is unspecified by the standard. - const bool __testeof = traits_type::eq_int_type(__c, __ret); - if (!__testeof) - { - const bool __testeq = traits_type::eq(traits_type:: - to_char_type(__c), - this->gptr()[-1]); - const bool __testout = this->_M_mode & ios_base::out; - if (__testeq || __testout) - { - this->gbump(-1); - if (!__testeq) - *this->gptr() = traits_type::to_char_type(__c); - __ret = __c; - } - } - else - { - this->gbump(-1); - __ret = traits_type::not_eof(__c); - } - } - return __ret; - } - - template - typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type - basic_stringbuf<_CharT, _Traits, _Alloc>:: - overflow(int_type __c) - { - const bool __testout = this->_M_mode & ios_base::out; - if (__builtin_expect(!__testout, false)) - return traits_type::eof(); - - const bool __testeof = traits_type::eq_int_type(__c, traits_type::eof()); - if (__builtin_expect(__testeof, false)) - return traits_type::not_eof(__c); - - const __size_type __capacity = _M_string.capacity(); - const __size_type __max_size = _M_string.max_size(); - const bool __testput = this->pptr() < this->epptr(); - if (__builtin_expect(!__testput && __capacity == __max_size, false)) - return traits_type::eof(); - - // Try to append __c into output sequence in one of two ways. - // Order these tests done in is unspecified by the standard. - const char_type __conv = traits_type::to_char_type(__c); - if (!__testput) - { - // NB: Start ostringstream buffers at 512 chars. This is an - // experimental value (pronounced "arbitrary" in some of the - // hipper English-speaking countries), and can be changed to - // suit particular needs. - // - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 169. Bad efficiency of overflow() mandated - // 432. stringbuf::overflow() makes only one write position - // available - const __size_type __opt_len = std::max(__size_type(2 * __capacity), - __size_type(512)); - const __size_type __len = std::min(__opt_len, __max_size); - __string_type __tmp; - __tmp.reserve(__len); - if (this->pbase()) - __tmp.assign(this->pbase(), this->epptr() - this->pbase()); - __tmp.push_back(__conv); - _M_string.swap(__tmp); - _M_sync(const_cast(_M_string.data()), - this->gptr() - this->eback(), this->pptr() - this->pbase()); - } - else - *this->pptr() = __conv; - this->pbump(1); - return __c; - } - - template - typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type - basic_stringbuf<_CharT, _Traits, _Alloc>:: - underflow() - { - int_type __ret = traits_type::eof(); - const bool __testin = this->_M_mode & ios_base::in; - if (__testin) - { - // Update egptr() to match the actual string end. - _M_update_egptr(); - - if (this->gptr() < this->egptr()) - __ret = traits_type::to_int_type(*this->gptr()); - } - return __ret; - } - - template - typename basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type - basic_stringbuf<_CharT, _Traits, _Alloc>:: - seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode) - { - pos_type __ret = pos_type(off_type(-1)); - bool __testin = (ios_base::in & this->_M_mode & __mode) != 0; - bool __testout = (ios_base::out & this->_M_mode & __mode) != 0; - const bool __testboth = __testin && __testout && __way != ios_base::cur; - __testin &= !(__mode & ios_base::out); - __testout &= !(__mode & ios_base::in); - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 453. basic_stringbuf::seekoff need not always fail for an empty stream. - const char_type* __beg = __testin ? this->eback() : this->pbase(); - if ((__beg || !__off) && (__testin || __testout || __testboth)) - { - _M_update_egptr(); - - off_type __newoffi = __off; - off_type __newoffo = __newoffi; - if (__way == ios_base::cur) - { - __newoffi += this->gptr() - __beg; - __newoffo += this->pptr() - __beg; - } - else if (__way == ios_base::end) - __newoffo = __newoffi += this->egptr() - __beg; - - if ((__testin || __testboth) - && __newoffi >= 0 - && this->egptr() - __beg >= __newoffi) - { - this->setg(this->eback(), this->eback() + __newoffi, - this->egptr()); - __ret = pos_type(__newoffi); - } - if ((__testout || __testboth) - && __newoffo >= 0 - && this->egptr() - __beg >= __newoffo) - { - _M_pbump(this->pbase(), this->epptr(), __newoffo); - __ret = pos_type(__newoffo); - } - } - return __ret; - } - - template - typename basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type - basic_stringbuf<_CharT, _Traits, _Alloc>:: - seekpos(pos_type __sp, ios_base::openmode __mode) - { - pos_type __ret = pos_type(off_type(-1)); - const bool __testin = (ios_base::in & this->_M_mode & __mode) != 0; - const bool __testout = (ios_base::out & this->_M_mode & __mode) != 0; - - const char_type* __beg = __testin ? this->eback() : this->pbase(); - if ((__beg || !off_type(__sp)) && (__testin || __testout)) - { - _M_update_egptr(); - - const off_type __pos(__sp); - const bool __testpos = (0 <= __pos - && __pos <= this->egptr() - __beg); - if (__testpos) - { - if (__testin) - this->setg(this->eback(), this->eback() + __pos, - this->egptr()); - if (__testout) - _M_pbump(this->pbase(), this->epptr(), __pos); - __ret = __sp; - } - } - return __ret; - } - - template - void - basic_stringbuf<_CharT, _Traits, _Alloc>:: - _M_sync(char_type* __base, __size_type __i, __size_type __o) - { - const bool __testin = _M_mode & ios_base::in; - const bool __testout = _M_mode & ios_base::out; - char_type* __endg = __base + _M_string.size(); - char_type* __endp = __base + _M_string.capacity(); - - if (__base != _M_string.data()) - { - // setbuf: __i == size of buffer area (_M_string.size() == 0). - __endg += __i; - __i = 0; - __endp = __endg; - } - - if (__testin) - this->setg(__base, __base + __i, __endg); - if (__testout) - { - _M_pbump(__base, __endp, __o); - // egptr() always tracks the string end. When !__testin, - // for the correct functioning of the streambuf inlines - // the other get area pointers are identical. - if (!__testin) - this->setg(__endg, __endg, __endg); - } - } - - template - void - basic_stringbuf<_CharT, _Traits, _Alloc>:: - _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off) - { - this->setp(__pbeg, __pend); - while (__off > __gnu_cxx::__numeric_traits::__max) - { - this->pbump(__gnu_cxx::__numeric_traits::__max); - __off -= __gnu_cxx::__numeric_traits::__max; - } - this->pbump(__off); - } - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template class basic_stringbuf; - extern template class basic_istringstream; - extern template class basic_ostringstream; - extern template class basic_stringstream; - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template class basic_stringbuf; - extern template class basic_istringstream; - extern template class basic_ostringstream; - extern template class basic_stringstream; -#endif -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/stl_algo.h b/openflow/usr/include/c++/5/bits/stl_algo.h deleted file mode 100644 index 53c455b..0000000 --- a/openflow/usr/include/c++/5/bits/stl_algo.h +++ /dev/null @@ -1,5546 +0,0 @@ -// Algorithm implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_algo.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{algorithm} - */ - -#ifndef _STL_ALGO_H -#define _STL_ALGO_H 1 - -#include // for rand -#include -#include -#include // for _Temporary_buffer -#include - -#if __cplusplus >= 201103L -#include // for std::uniform_int_distribution -#endif - -// See concept_check.h for the __glibcxx_*_requires macros. - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /// Swaps the median value of *__a, *__b and *__c under __comp to *__result - template - void - __move_median_to_first(_Iterator __result,_Iterator __a, _Iterator __b, - _Iterator __c, _Compare __comp) - { - if (__comp(__a, __b)) - { - if (__comp(__b, __c)) - std::iter_swap(__result, __b); - else if (__comp(__a, __c)) - std::iter_swap(__result, __c); - else - std::iter_swap(__result, __a); - } - else if (__comp(__a, __c)) - std::iter_swap(__result, __a); - else if (__comp(__b, __c)) - std::iter_swap(__result, __c); - else - std::iter_swap(__result, __b); - } - - /// This is an overload used by find algos for the Input Iterator case. - template - inline _InputIterator - __find_if(_InputIterator __first, _InputIterator __last, - _Predicate __pred, input_iterator_tag) - { - while (__first != __last && !__pred(__first)) - ++__first; - return __first; - } - - /// This is an overload used by find algos for the RAI case. - template - _RandomAccessIterator - __find_if(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Predicate __pred, random_access_iterator_tag) - { - typename iterator_traits<_RandomAccessIterator>::difference_type - __trip_count = (__last - __first) >> 2; - - for (; __trip_count > 0; --__trip_count) - { - if (__pred(__first)) - return __first; - ++__first; - - if (__pred(__first)) - return __first; - ++__first; - - if (__pred(__first)) - return __first; - ++__first; - - if (__pred(__first)) - return __first; - ++__first; - } - - switch (__last - __first) - { - case 3: - if (__pred(__first)) - return __first; - ++__first; - case 2: - if (__pred(__first)) - return __first; - ++__first; - case 1: - if (__pred(__first)) - return __first; - ++__first; - case 0: - default: - return __last; - } - } - - template - inline _Iterator - __find_if(_Iterator __first, _Iterator __last, _Predicate __pred) - { - return __find_if(__first, __last, __pred, - std::__iterator_category(__first)); - } - - /// Provided for stable_partition to use. - template - inline _InputIterator - __find_if_not(_InputIterator __first, _InputIterator __last, - _Predicate __pred) - { - return std::__find_if(__first, __last, - __gnu_cxx::__ops::__negate(__pred), - std::__iterator_category(__first)); - } - - /// Like find_if_not(), but uses and updates a count of the - /// remaining range length instead of comparing against an end - /// iterator. - template - _InputIterator - __find_if_not_n(_InputIterator __first, _Distance& __len, _Predicate __pred) - { - for (; __len; --__len, ++__first) - if (!__pred(__first)) - break; - return __first; - } - - // set_difference - // set_intersection - // set_symmetric_difference - // set_union - // for_each - // find - // find_if - // find_first_of - // adjacent_find - // count - // count_if - // search - - template - _ForwardIterator1 - __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, - _ForwardIterator2 __first2, _ForwardIterator2 __last2, - _BinaryPredicate __predicate) - { - // Test for empty ranges - if (__first1 == __last1 || __first2 == __last2) - return __first1; - - // Test for a pattern of length 1. - _ForwardIterator2 __p1(__first2); - if (++__p1 == __last2) - return std::__find_if(__first1, __last1, - __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2)); - - // General case. - _ForwardIterator2 __p; - _ForwardIterator1 __current = __first1; - - for (;;) - { - __first1 = - std::__find_if(__first1, __last1, - __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2)); - - if (__first1 == __last1) - return __last1; - - __p = __p1; - __current = __first1; - if (++__current == __last1) - return __last1; - - while (__predicate(__current, __p)) - { - if (++__p == __last2) - return __first1; - if (++__current == __last1) - return __last1; - } - ++__first1; - } - return __first1; - } - - // search_n - - /** - * This is an helper function for search_n overloaded for forward iterators. - */ - template - _ForwardIterator - __search_n_aux(_ForwardIterator __first, _ForwardIterator __last, - _Integer __count, _UnaryPredicate __unary_pred, - std::forward_iterator_tag) - { - __first = std::__find_if(__first, __last, __unary_pred); - while (__first != __last) - { - typename iterator_traits<_ForwardIterator>::difference_type - __n = __count; - _ForwardIterator __i = __first; - ++__i; - while (__i != __last && __n != 1 && __unary_pred(__i)) - { - ++__i; - --__n; - } - if (__n == 1) - return __first; - if (__i == __last) - return __last; - __first = std::__find_if(++__i, __last, __unary_pred); - } - return __last; - } - - /** - * This is an helper function for search_n overloaded for random access - * iterators. - */ - template - _RandomAccessIter - __search_n_aux(_RandomAccessIter __first, _RandomAccessIter __last, - _Integer __count, _UnaryPredicate __unary_pred, - std::random_access_iterator_tag) - { - typedef typename std::iterator_traits<_RandomAccessIter>::difference_type - _DistanceType; - - _DistanceType __tailSize = __last - __first; - _DistanceType __remainder = __count; - - while (__remainder <= __tailSize) // the main loop... - { - __first += __remainder; - __tailSize -= __remainder; - // __first here is always pointing to one past the last element of - // next possible match. - _RandomAccessIter __backTrack = __first; - while (__unary_pred(--__backTrack)) - { - if (--__remainder == 0) - return (__first - __count); // Success - } - __remainder = __count + 1 - (__first - __backTrack); - } - return __last; // Failure - } - - template - _ForwardIterator - __search_n(_ForwardIterator __first, _ForwardIterator __last, - _Integer __count, - _UnaryPredicate __unary_pred) - { - if (__count <= 0) - return __first; - - if (__count == 1) - return std::__find_if(__first, __last, __unary_pred); - - return std::__search_n_aux(__first, __last, __count, __unary_pred, - std::__iterator_category(__first)); - } - - // find_end for forward iterators. - template - _ForwardIterator1 - __find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, - _ForwardIterator2 __first2, _ForwardIterator2 __last2, - forward_iterator_tag, forward_iterator_tag, - _BinaryPredicate __comp) - { - if (__first2 == __last2) - return __last1; - - _ForwardIterator1 __result = __last1; - while (1) - { - _ForwardIterator1 __new_result - = std::__search(__first1, __last1, __first2, __last2, __comp); - if (__new_result == __last1) - return __result; - else - { - __result = __new_result; - __first1 = __new_result; - ++__first1; - } - } - } - - // find_end for bidirectional iterators (much faster). - template - _BidirectionalIterator1 - __find_end(_BidirectionalIterator1 __first1, - _BidirectionalIterator1 __last1, - _BidirectionalIterator2 __first2, - _BidirectionalIterator2 __last2, - bidirectional_iterator_tag, bidirectional_iterator_tag, - _BinaryPredicate __comp) - { - // concept requirements - __glibcxx_function_requires(_BidirectionalIteratorConcept< - _BidirectionalIterator1>) - __glibcxx_function_requires(_BidirectionalIteratorConcept< - _BidirectionalIterator2>) - - typedef reverse_iterator<_BidirectionalIterator1> _RevIterator1; - typedef reverse_iterator<_BidirectionalIterator2> _RevIterator2; - - _RevIterator1 __rlast1(__first1); - _RevIterator2 __rlast2(__first2); - _RevIterator1 __rresult = std::__search(_RevIterator1(__last1), __rlast1, - _RevIterator2(__last2), __rlast2, - __comp); - - if (__rresult == __rlast1) - return __last1; - else - { - _BidirectionalIterator1 __result = __rresult.base(); - std::advance(__result, -std::distance(__first2, __last2)); - return __result; - } - } - - /** - * @brief Find last matching subsequence in a sequence. - * @ingroup non_mutating_algorithms - * @param __first1 Start of range to search. - * @param __last1 End of range to search. - * @param __first2 Start of sequence to match. - * @param __last2 End of sequence to match. - * @return The last iterator @c i in the range - * @p [__first1,__last1-(__last2-__first2)) such that @c *(i+N) == - * @p *(__first2+N) for each @c N in the range @p - * [0,__last2-__first2), or @p __last1 if no such iterator exists. - * - * Searches the range @p [__first1,__last1) for a sub-sequence that - * compares equal value-by-value with the sequence given by @p - * [__first2,__last2) and returns an iterator to the __first - * element of the sub-sequence, or @p __last1 if the sub-sequence - * is not found. The sub-sequence will be the last such - * subsequence contained in [__first1,__last1). - * - * Because the sub-sequence must lie completely within the range @p - * [__first1,__last1) it must start at a position less than @p - * __last1-(__last2-__first2) where @p __last2-__first2 is the - * length of the sub-sequence. This means that the returned - * iterator @c i will be in the range @p - * [__first1,__last1-(__last2-__first2)) - */ - template - inline _ForwardIterator1 - find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, - _ForwardIterator2 __first2, _ForwardIterator2 __last2) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_ForwardIterator1>::value_type, - typename iterator_traits<_ForwardIterator2>::value_type>) - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - return std::__find_end(__first1, __last1, __first2, __last2, - std::__iterator_category(__first1), - std::__iterator_category(__first2), - __gnu_cxx::__ops::__iter_equal_to_iter()); - } - - /** - * @brief Find last matching subsequence in a sequence using a predicate. - * @ingroup non_mutating_algorithms - * @param __first1 Start of range to search. - * @param __last1 End of range to search. - * @param __first2 Start of sequence to match. - * @param __last2 End of sequence to match. - * @param __comp The predicate to use. - * @return The last iterator @c i in the range @p - * [__first1,__last1-(__last2-__first2)) such that @c - * predicate(*(i+N), @p (__first2+N)) is true for each @c N in the - * range @p [0,__last2-__first2), or @p __last1 if no such iterator - * exists. - * - * Searches the range @p [__first1,__last1) for a sub-sequence that - * compares equal value-by-value with the sequence given by @p - * [__first2,__last2) using comp as a predicate and returns an - * iterator to the first element of the sub-sequence, or @p __last1 - * if the sub-sequence is not found. The sub-sequence will be the - * last such subsequence contained in [__first,__last1). - * - * Because the sub-sequence must lie completely within the range @p - * [__first1,__last1) it must start at a position less than @p - * __last1-(__last2-__first2) where @p __last2-__first2 is the - * length of the sub-sequence. This means that the returned - * iterator @c i will be in the range @p - * [__first1,__last1-(__last2-__first2)) - */ - template - inline _ForwardIterator1 - find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, - _ForwardIterator2 __first2, _ForwardIterator2 __last2, - _BinaryPredicate __comp) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) - __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, - typename iterator_traits<_ForwardIterator1>::value_type, - typename iterator_traits<_ForwardIterator2>::value_type>) - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - return std::__find_end(__first1, __last1, __first2, __last2, - std::__iterator_category(__first1), - std::__iterator_category(__first2), - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - -#if __cplusplus >= 201103L - /** - * @brief Checks that a predicate is true for all the elements - * of a sequence. - * @ingroup non_mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __pred A predicate. - * @return True if the check is true, false otherwise. - * - * Returns true if @p __pred is true for each element in the range - * @p [__first,__last), and false otherwise. - */ - template - inline bool - all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) - { return __last == std::find_if_not(__first, __last, __pred); } - - /** - * @brief Checks that a predicate is false for all the elements - * of a sequence. - * @ingroup non_mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __pred A predicate. - * @return True if the check is true, false otherwise. - * - * Returns true if @p __pred is false for each element in the range - * @p [__first,__last), and false otherwise. - */ - template - inline bool - none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) - { return __last == _GLIBCXX_STD_A::find_if(__first, __last, __pred); } - - /** - * @brief Checks that a predicate is false for at least an element - * of a sequence. - * @ingroup non_mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __pred A predicate. - * @return True if the check is true, false otherwise. - * - * Returns true if an element exists in the range @p - * [__first,__last) such that @p __pred is true, and false - * otherwise. - */ - template - inline bool - any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) - { return !std::none_of(__first, __last, __pred); } - - /** - * @brief Find the first element in a sequence for which a - * predicate is false. - * @ingroup non_mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __pred A predicate. - * @return The first iterator @c i in the range @p [__first,__last) - * such that @p __pred(*i) is false, or @p __last if no such iterator exists. - */ - template - inline _InputIterator - find_if_not(_InputIterator __first, _InputIterator __last, - _Predicate __pred) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - return std::__find_if_not(__first, __last, - __gnu_cxx::__ops::__pred_iter(__pred)); - } - - /** - * @brief Checks whether the sequence is partitioned. - * @ingroup mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __pred A predicate. - * @return True if the range @p [__first,__last) is partioned by @p __pred, - * i.e. if all elements that satisfy @p __pred appear before those that - * do not. - */ - template - inline bool - is_partitioned(_InputIterator __first, _InputIterator __last, - _Predicate __pred) - { - __first = std::find_if_not(__first, __last, __pred); - return std::none_of(__first, __last, __pred); - } - - /** - * @brief Find the partition point of a partitioned range. - * @ingroup mutating_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @param __pred A predicate. - * @return An iterator @p mid such that @p all_of(__first, mid, __pred) - * and @p none_of(mid, __last, __pred) are both true. - */ - template - _ForwardIterator - partition_point(_ForwardIterator __first, _ForwardIterator __last, - _Predicate __pred) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_ForwardIterator>::value_type>) - - // A specific debug-mode test will be necessary... - __glibcxx_requires_valid_range(__first, __last); - - typedef typename iterator_traits<_ForwardIterator>::difference_type - _DistanceType; - - _DistanceType __len = std::distance(__first, __last); - _DistanceType __half; - _ForwardIterator __middle; - - while (__len > 0) - { - __half = __len >> 1; - __middle = __first; - std::advance(__middle, __half); - if (__pred(*__middle)) - { - __first = __middle; - ++__first; - __len = __len - __half - 1; - } - else - __len = __half; - } - return __first; - } -#endif - - template - _OutputIterator - __remove_copy_if(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _Predicate __pred) - { - for (; __first != __last; ++__first) - if (!__pred(__first)) - { - *__result = *__first; - ++__result; - } - return __result; - } - - /** - * @brief Copy a sequence, removing elements of a given value. - * @ingroup mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __result An output iterator. - * @param __value The value to be removed. - * @return An iterator designating the end of the resulting sequence. - * - * Copies each element in the range @p [__first,__last) not equal - * to @p __value to the range beginning at @p __result. - * remove_copy() is stable, so the relative order of elements that - * are copied is unchanged. - */ - template - inline _OutputIterator - remove_copy(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, const _Tp& __value) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_InputIterator>::value_type, _Tp>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__remove_copy_if(__first, __last, __result, - __gnu_cxx::__ops::__iter_equals_val(__value)); - } - - /** - * @brief Copy a sequence, removing elements for which a predicate is true. - * @ingroup mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __result An output iterator. - * @param __pred A predicate. - * @return An iterator designating the end of the resulting sequence. - * - * Copies each element in the range @p [__first,__last) for which - * @p __pred returns false to the range beginning at @p __result. - * - * remove_copy_if() is stable, so the relative order of elements that are - * copied is unchanged. - */ - template - inline _OutputIterator - remove_copy_if(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _Predicate __pred) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__remove_copy_if(__first, __last, __result, - __gnu_cxx::__ops::__pred_iter(__pred)); - } - -#if __cplusplus >= 201103L - /** - * @brief Copy the elements of a sequence for which a predicate is true. - * @ingroup mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __result An output iterator. - * @param __pred A predicate. - * @return An iterator designating the end of the resulting sequence. - * - * Copies each element in the range @p [__first,__last) for which - * @p __pred returns true to the range beginning at @p __result. - * - * copy_if() is stable, so the relative order of elements that are - * copied is unchanged. - */ - template - _OutputIterator - copy_if(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _Predicate __pred) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - for (; __first != __last; ++__first) - if (__pred(*__first)) - { - *__result = *__first; - ++__result; - } - return __result; - } - - template - _OutputIterator - __copy_n(_InputIterator __first, _Size __n, - _OutputIterator __result, input_iterator_tag) - { - if (__n > 0) - { - while (true) - { - *__result = *__first; - ++__result; - if (--__n > 0) - ++__first; - else - break; - } - } - return __result; - } - - template - inline _OutputIterator - __copy_n(_RandomAccessIterator __first, _Size __n, - _OutputIterator __result, random_access_iterator_tag) - { return std::copy(__first, __first + __n, __result); } - - /** - * @brief Copies the range [first,first+n) into [result,result+n). - * @ingroup mutating_algorithms - * @param __first An input iterator. - * @param __n The number of elements to copy. - * @param __result An output iterator. - * @return result+n. - * - * This inline function will boil down to a call to @c memmove whenever - * possible. Failing that, if random access iterators are passed, then the - * loop count will be known (and therefore a candidate for compiler - * optimizations such as unrolling). - */ - template - inline _OutputIterator - copy_n(_InputIterator __first, _Size __n, _OutputIterator __result) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator>::value_type>) - - return std::__copy_n(__first, __n, __result, - std::__iterator_category(__first)); - } - - /** - * @brief Copy the elements of a sequence to separate output sequences - * depending on the truth value of a predicate. - * @ingroup mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __out_true An output iterator. - * @param __out_false An output iterator. - * @param __pred A predicate. - * @return A pair designating the ends of the resulting sequences. - * - * Copies each element in the range @p [__first,__last) for which - * @p __pred returns true to the range beginning at @p out_true - * and each element for which @p __pred returns false to @p __out_false. - */ - template - pair<_OutputIterator1, _OutputIterator2> - partition_copy(_InputIterator __first, _InputIterator __last, - _OutputIterator1 __out_true, _OutputIterator2 __out_false, - _Predicate __pred) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator1, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator2, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - for (; __first != __last; ++__first) - if (__pred(*__first)) - { - *__out_true = *__first; - ++__out_true; - } - else - { - *__out_false = *__first; - ++__out_false; - } - - return pair<_OutputIterator1, _OutputIterator2>(__out_true, __out_false); - } -#endif - - template - _ForwardIterator - __remove_if(_ForwardIterator __first, _ForwardIterator __last, - _Predicate __pred) - { - __first = std::__find_if(__first, __last, __pred); - if (__first == __last) - return __first; - _ForwardIterator __result = __first; - ++__first; - for (; __first != __last; ++__first) - if (!__pred(__first)) - { - *__result = _GLIBCXX_MOVE(*__first); - ++__result; - } - return __result; - } - - /** - * @brief Remove elements from a sequence. - * @ingroup mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __value The value to be removed. - * @return An iterator designating the end of the resulting sequence. - * - * All elements equal to @p __value are removed from the range - * @p [__first,__last). - * - * remove() is stable, so the relative order of elements that are - * not removed is unchanged. - * - * Elements between the end of the resulting sequence and @p __last - * are still present, but their value is unspecified. - */ - template - inline _ForwardIterator - remove(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __value) - { - // concept requirements - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_ForwardIterator>::value_type, _Tp>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__remove_if(__first, __last, - __gnu_cxx::__ops::__iter_equals_val(__value)); - } - - /** - * @brief Remove elements from a sequence using a predicate. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @param __pred A predicate. - * @return An iterator designating the end of the resulting sequence. - * - * All elements for which @p __pred returns true are removed from the range - * @p [__first,__last). - * - * remove_if() is stable, so the relative order of elements that are - * not removed is unchanged. - * - * Elements between the end of the resulting sequence and @p __last - * are still present, but their value is unspecified. - */ - template - inline _ForwardIterator - remove_if(_ForwardIterator __first, _ForwardIterator __last, - _Predicate __pred) - { - // concept requirements - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator>) - __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__remove_if(__first, __last, - __gnu_cxx::__ops::__pred_iter(__pred)); - } - - template - _ForwardIterator - __adjacent_find(_ForwardIterator __first, _ForwardIterator __last, - _BinaryPredicate __binary_pred) - { - if (__first == __last) - return __last; - _ForwardIterator __next = __first; - while (++__next != __last) - { - if (__binary_pred(__first, __next)) - return __first; - __first = __next; - } - return __last; - } - - template - _ForwardIterator - __unique(_ForwardIterator __first, _ForwardIterator __last, - _BinaryPredicate __binary_pred) - { - // Skip the beginning, if already unique. - __first = std::__adjacent_find(__first, __last, __binary_pred); - if (__first == __last) - return __last; - - // Do the real copy work. - _ForwardIterator __dest = __first; - ++__first; - while (++__first != __last) - if (!__binary_pred(__dest, __first)) - *++__dest = _GLIBCXX_MOVE(*__first); - return ++__dest; - } - - /** - * @brief Remove consecutive duplicate values from a sequence. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @return An iterator designating the end of the resulting sequence. - * - * Removes all but the first element from each group of consecutive - * values that compare equal. - * unique() is stable, so the relative order of elements that are - * not removed is unchanged. - * Elements between the end of the resulting sequence and @p __last - * are still present, but their value is unspecified. - */ - template - inline _ForwardIterator - unique(_ForwardIterator __first, _ForwardIterator __last) - { - // concept requirements - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator>) - __glibcxx_function_requires(_EqualityComparableConcept< - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__unique(__first, __last, - __gnu_cxx::__ops::__iter_equal_to_iter()); - } - - /** - * @brief Remove consecutive values from a sequence using a predicate. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @param __binary_pred A binary predicate. - * @return An iterator designating the end of the resulting sequence. - * - * Removes all but the first element from each group of consecutive - * values for which @p __binary_pred returns true. - * unique() is stable, so the relative order of elements that are - * not removed is unchanged. - * Elements between the end of the resulting sequence and @p __last - * are still present, but their value is unspecified. - */ - template - inline _ForwardIterator - unique(_ForwardIterator __first, _ForwardIterator __last, - _BinaryPredicate __binary_pred) - { - // concept requirements - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, - typename iterator_traits<_ForwardIterator>::value_type, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__unique(__first, __last, - __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); - } - - /** - * This is an uglified - * unique_copy(_InputIterator, _InputIterator, _OutputIterator, - * _BinaryPredicate) - * overloaded for forward iterators and output iterator as result. - */ - template - _OutputIterator - __unique_copy(_ForwardIterator __first, _ForwardIterator __last, - _OutputIterator __result, _BinaryPredicate __binary_pred, - forward_iterator_tag, output_iterator_tag) - { - // concept requirements -- iterators already checked - __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, - typename iterator_traits<_ForwardIterator>::value_type, - typename iterator_traits<_ForwardIterator>::value_type>) - - _ForwardIterator __next = __first; - *__result = *__first; - while (++__next != __last) - if (!__binary_pred(__first, __next)) - { - __first = __next; - *++__result = *__first; - } - return ++__result; - } - - /** - * This is an uglified - * unique_copy(_InputIterator, _InputIterator, _OutputIterator, - * _BinaryPredicate) - * overloaded for input iterators and output iterator as result. - */ - template - _OutputIterator - __unique_copy(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _BinaryPredicate __binary_pred, - input_iterator_tag, output_iterator_tag) - { - // concept requirements -- iterators already checked - __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, - typename iterator_traits<_InputIterator>::value_type, - typename iterator_traits<_InputIterator>::value_type>) - - typename iterator_traits<_InputIterator>::value_type __value = *__first; - __decltype(__gnu_cxx::__ops::__iter_comp_val(__binary_pred)) - __rebound_pred - = __gnu_cxx::__ops::__iter_comp_val(__binary_pred); - *__result = __value; - while (++__first != __last) - if (!__rebound_pred(__first, __value)) - { - __value = *__first; - *++__result = __value; - } - return ++__result; - } - - /** - * This is an uglified - * unique_copy(_InputIterator, _InputIterator, _OutputIterator, - * _BinaryPredicate) - * overloaded for input iterators and forward iterator as result. - */ - template - _ForwardIterator - __unique_copy(_InputIterator __first, _InputIterator __last, - _ForwardIterator __result, _BinaryPredicate __binary_pred, - input_iterator_tag, forward_iterator_tag) - { - // concept requirements -- iterators already checked - __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, - typename iterator_traits<_ForwardIterator>::value_type, - typename iterator_traits<_InputIterator>::value_type>) - *__result = *__first; - while (++__first != __last) - if (!__binary_pred(__result, __first)) - *++__result = *__first; - return ++__result; - } - - /** - * This is an uglified reverse(_BidirectionalIterator, - * _BidirectionalIterator) - * overloaded for bidirectional iterators. - */ - template - void - __reverse(_BidirectionalIterator __first, _BidirectionalIterator __last, - bidirectional_iterator_tag) - { - while (true) - if (__first == __last || __first == --__last) - return; - else - { - std::iter_swap(__first, __last); - ++__first; - } - } - - /** - * This is an uglified reverse(_BidirectionalIterator, - * _BidirectionalIterator) - * overloaded for random access iterators. - */ - template - void - __reverse(_RandomAccessIterator __first, _RandomAccessIterator __last, - random_access_iterator_tag) - { - if (__first == __last) - return; - --__last; - while (__first < __last) - { - std::iter_swap(__first, __last); - ++__first; - --__last; - } - } - - /** - * @brief Reverse a sequence. - * @ingroup mutating_algorithms - * @param __first A bidirectional iterator. - * @param __last A bidirectional iterator. - * @return reverse() returns no value. - * - * Reverses the order of the elements in the range @p [__first,__last), - * so that the first element becomes the last etc. - * For every @c i such that @p 0<=i<=(__last-__first)/2), @p reverse() - * swaps @p *(__first+i) and @p *(__last-(i+1)) - */ - template - inline void - reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) - { - // concept requirements - __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< - _BidirectionalIterator>) - __glibcxx_requires_valid_range(__first, __last); - std::__reverse(__first, __last, std::__iterator_category(__first)); - } - - /** - * @brief Copy a sequence, reversing its elements. - * @ingroup mutating_algorithms - * @param __first A bidirectional iterator. - * @param __last A bidirectional iterator. - * @param __result An output iterator. - * @return An iterator designating the end of the resulting sequence. - * - * Copies the elements in the range @p [__first,__last) to the - * range @p [__result,__result+(__last-__first)) such that the - * order of the elements is reversed. For every @c i such that @p - * 0<=i<=(__last-__first), @p reverse_copy() performs the - * assignment @p *(__result+(__last-__first)-1-i) = *(__first+i). - * The ranges @p [__first,__last) and @p - * [__result,__result+(__last-__first)) must not overlap. - */ - template - _OutputIterator - reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, - _OutputIterator __result) - { - // concept requirements - __glibcxx_function_requires(_BidirectionalIteratorConcept< - _BidirectionalIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_BidirectionalIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - while (__first != __last) - { - --__last; - *__result = *__last; - ++__result; - } - return __result; - } - - /** - * This is a helper function for the rotate algorithm specialized on RAIs. - * It returns the greatest common divisor of two integer values. - */ - template - _EuclideanRingElement - __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n) - { - while (__n != 0) - { - _EuclideanRingElement __t = __m % __n; - __m = __n; - __n = __t; - } - return __m; - } - - inline namespace _V2 - { - - /// This is a helper function for the rotate algorithm. - template - _ForwardIterator - __rotate(_ForwardIterator __first, - _ForwardIterator __middle, - _ForwardIterator __last, - forward_iterator_tag) - { - if (__first == __middle) - return __last; - else if (__last == __middle) - return __first; - - _ForwardIterator __first2 = __middle; - do - { - std::iter_swap(__first, __first2); - ++__first; - ++__first2; - if (__first == __middle) - __middle = __first2; - } - while (__first2 != __last); - - _ForwardIterator __ret = __first; - - __first2 = __middle; - - while (__first2 != __last) - { - std::iter_swap(__first, __first2); - ++__first; - ++__first2; - if (__first == __middle) - __middle = __first2; - else if (__first2 == __last) - __first2 = __middle; - } - return __ret; - } - - /// This is a helper function for the rotate algorithm. - template - _BidirectionalIterator - __rotate(_BidirectionalIterator __first, - _BidirectionalIterator __middle, - _BidirectionalIterator __last, - bidirectional_iterator_tag) - { - // concept requirements - __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< - _BidirectionalIterator>) - - if (__first == __middle) - return __last; - else if (__last == __middle) - return __first; - - std::__reverse(__first, __middle, bidirectional_iterator_tag()); - std::__reverse(__middle, __last, bidirectional_iterator_tag()); - - while (__first != __middle && __middle != __last) - { - std::iter_swap(__first, --__last); - ++__first; - } - - if (__first == __middle) - { - std::__reverse(__middle, __last, bidirectional_iterator_tag()); - return __last; - } - else - { - std::__reverse(__first, __middle, bidirectional_iterator_tag()); - return __first; - } - } - - /// This is a helper function for the rotate algorithm. - template - _RandomAccessIterator - __rotate(_RandomAccessIterator __first, - _RandomAccessIterator __middle, - _RandomAccessIterator __last, - random_access_iterator_tag) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - - if (__first == __middle) - return __last; - else if (__last == __middle) - return __first; - - typedef typename iterator_traits<_RandomAccessIterator>::difference_type - _Distance; - typedef typename iterator_traits<_RandomAccessIterator>::value_type - _ValueType; - - _Distance __n = __last - __first; - _Distance __k = __middle - __first; - - if (__k == __n - __k) - { - std::swap_ranges(__first, __middle, __middle); - return __middle; - } - - _RandomAccessIterator __p = __first; - _RandomAccessIterator __ret = __first + (__last - __middle); - - for (;;) - { - if (__k < __n - __k) - { - if (__is_pod(_ValueType) && __k == 1) - { - _ValueType __t = _GLIBCXX_MOVE(*__p); - _GLIBCXX_MOVE3(__p + 1, __p + __n, __p); - *(__p + __n - 1) = _GLIBCXX_MOVE(__t); - return __ret; - } - _RandomAccessIterator __q = __p + __k; - for (_Distance __i = 0; __i < __n - __k; ++ __i) - { - std::iter_swap(__p, __q); - ++__p; - ++__q; - } - __n %= __k; - if (__n == 0) - return __ret; - std::swap(__n, __k); - __k = __n - __k; - } - else - { - __k = __n - __k; - if (__is_pod(_ValueType) && __k == 1) - { - _ValueType __t = _GLIBCXX_MOVE(*(__p + __n - 1)); - _GLIBCXX_MOVE_BACKWARD3(__p, __p + __n - 1, __p + __n); - *__p = _GLIBCXX_MOVE(__t); - return __ret; - } - _RandomAccessIterator __q = __p + __n; - __p = __q - __k; - for (_Distance __i = 0; __i < __n - __k; ++ __i) - { - --__p; - --__q; - std::iter_swap(__p, __q); - } - __n %= __k; - if (__n == 0) - return __ret; - std::swap(__n, __k); - } - } - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 488. rotate throws away useful information - /** - * @brief Rotate the elements of a sequence. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __middle A forward iterator. - * @param __last A forward iterator. - * @return first + (last - middle). - * - * Rotates the elements of the range @p [__first,__last) by - * @p (__middle - __first) positions so that the element at @p __middle - * is moved to @p __first, the element at @p __middle+1 is moved to - * @p __first+1 and so on for each element in the range - * @p [__first,__last). - * - * This effectively swaps the ranges @p [__first,__middle) and - * @p [__middle,__last). - * - * Performs - * @p *(__first+(n+(__last-__middle))%(__last-__first))=*(__first+n) - * for each @p n in the range @p [0,__last-__first). - */ - template - inline _ForwardIterator - rotate(_ForwardIterator __first, _ForwardIterator __middle, - _ForwardIterator __last) - { - // concept requirements - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator>) - __glibcxx_requires_valid_range(__first, __middle); - __glibcxx_requires_valid_range(__middle, __last); - - return std::__rotate(__first, __middle, __last, - std::__iterator_category(__first)); - } - - } // namespace _V2 - - /** - * @brief Copy a sequence, rotating its elements. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __middle A forward iterator. - * @param __last A forward iterator. - * @param __result An output iterator. - * @return An iterator designating the end of the resulting sequence. - * - * Copies the elements of the range @p [__first,__last) to the - * range beginning at @result, rotating the copied elements by - * @p (__middle-__first) positions so that the element at @p __middle - * is moved to @p __result, the element at @p __middle+1 is moved - * to @p __result+1 and so on for each element in the range @p - * [__first,__last). - * - * Performs - * @p *(__result+(n+(__last-__middle))%(__last-__first))=*(__first+n) - * for each @p n in the range @p [0,__last-__first). - */ - template - inline _OutputIterator - rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, - _ForwardIterator __last, _OutputIterator __result) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __middle); - __glibcxx_requires_valid_range(__middle, __last); - - return std::copy(__first, __middle, - std::copy(__middle, __last, __result)); - } - - /// This is a helper function... - template - _ForwardIterator - __partition(_ForwardIterator __first, _ForwardIterator __last, - _Predicate __pred, forward_iterator_tag) - { - if (__first == __last) - return __first; - - while (__pred(*__first)) - if (++__first == __last) - return __first; - - _ForwardIterator __next = __first; - - while (++__next != __last) - if (__pred(*__next)) - { - std::iter_swap(__first, __next); - ++__first; - } - - return __first; - } - - /// This is a helper function... - template - _BidirectionalIterator - __partition(_BidirectionalIterator __first, _BidirectionalIterator __last, - _Predicate __pred, bidirectional_iterator_tag) - { - while (true) - { - while (true) - if (__first == __last) - return __first; - else if (__pred(*__first)) - ++__first; - else - break; - --__last; - while (true) - if (__first == __last) - return __first; - else if (!bool(__pred(*__last))) - --__last; - else - break; - std::iter_swap(__first, __last); - ++__first; - } - } - - // partition - - /// This is a helper function... - /// Requires __first != __last and !__pred(__first) - /// and __len == distance(__first, __last). - /// - /// !__pred(__first) allows us to guarantee that we don't - /// move-assign an element onto itself. - template - _ForwardIterator - __stable_partition_adaptive(_ForwardIterator __first, - _ForwardIterator __last, - _Predicate __pred, _Distance __len, - _Pointer __buffer, - _Distance __buffer_size) - { - if (__len == 1) - return __first; - - if (__len <= __buffer_size) - { - _ForwardIterator __result1 = __first; - _Pointer __result2 = __buffer; - - // The precondition guarantees that !__pred(__first), so - // move that element to the buffer before starting the loop. - // This ensures that we only call __pred once per element. - *__result2 = _GLIBCXX_MOVE(*__first); - ++__result2; - ++__first; - for (; __first != __last; ++__first) - if (__pred(__first)) - { - *__result1 = _GLIBCXX_MOVE(*__first); - ++__result1; - } - else - { - *__result2 = _GLIBCXX_MOVE(*__first); - ++__result2; - } - - _GLIBCXX_MOVE3(__buffer, __result2, __result1); - return __result1; - } - - _ForwardIterator __middle = __first; - std::advance(__middle, __len / 2); - _ForwardIterator __left_split = - std::__stable_partition_adaptive(__first, __middle, __pred, - __len / 2, __buffer, - __buffer_size); - - // Advance past true-predicate values to satisfy this - // function's preconditions. - _Distance __right_len = __len - __len / 2; - _ForwardIterator __right_split = - std::__find_if_not_n(__middle, __right_len, __pred); - - if (__right_len) - __right_split = - std::__stable_partition_adaptive(__right_split, __last, __pred, - __right_len, - __buffer, __buffer_size); - - std::rotate(__left_split, __middle, __right_split); - std::advance(__left_split, std::distance(__middle, __right_split)); - return __left_split; - } - - template - _ForwardIterator - __stable_partition(_ForwardIterator __first, _ForwardIterator __last, - _Predicate __pred) - { - __first = std::__find_if_not(__first, __last, __pred); - - if (__first == __last) - return __first; - - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; - typedef typename iterator_traits<_ForwardIterator>::difference_type - _DistanceType; - - _Temporary_buffer<_ForwardIterator, _ValueType> __buf(__first, __last); - return - std::__stable_partition_adaptive(__first, __last, __pred, - _DistanceType(__buf.requested_size()), - __buf.begin(), - _DistanceType(__buf.size())); - } - - /** - * @brief Move elements for which a predicate is true to the beginning - * of a sequence, preserving relative ordering. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @param __pred A predicate functor. - * @return An iterator @p middle such that @p __pred(i) is true for each - * iterator @p i in the range @p [first,middle) and false for each @p i - * in the range @p [middle,last). - * - * Performs the same function as @p partition() with the additional - * guarantee that the relative ordering of elements in each group is - * preserved, so any two elements @p x and @p y in the range - * @p [__first,__last) such that @p __pred(x)==__pred(y) will have the same - * relative ordering after calling @p stable_partition(). - */ - template - inline _ForwardIterator - stable_partition(_ForwardIterator __first, _ForwardIterator __last, - _Predicate __pred) - { - // concept requirements - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator>) - __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__stable_partition(__first, __last, - __gnu_cxx::__ops::__pred_iter(__pred)); - } - - /// This is a helper function for the sort routines. - template - void - __heap_select(_RandomAccessIterator __first, - _RandomAccessIterator __middle, - _RandomAccessIterator __last, _Compare __comp) - { - std::__make_heap(__first, __middle, __comp); - for (_RandomAccessIterator __i = __middle; __i < __last; ++__i) - if (__comp(__i, __first)) - std::__pop_heap(__first, __middle, __i, __comp); - } - - // partial_sort - - template - _RandomAccessIterator - __partial_sort_copy(_InputIterator __first, _InputIterator __last, - _RandomAccessIterator __result_first, - _RandomAccessIterator __result_last, - _Compare __comp) - { - typedef typename iterator_traits<_InputIterator>::value_type - _InputValueType; - typedef iterator_traits<_RandomAccessIterator> _RItTraits; - typedef typename _RItTraits::difference_type _DistanceType; - - if (__result_first == __result_last) - return __result_last; - _RandomAccessIterator __result_real_last = __result_first; - while (__first != __last && __result_real_last != __result_last) - { - *__result_real_last = *__first; - ++__result_real_last; - ++__first; - } - - std::__make_heap(__result_first, __result_real_last, __comp); - while (__first != __last) - { - if (__comp(__first, __result_first)) - std::__adjust_heap(__result_first, _DistanceType(0), - _DistanceType(__result_real_last - - __result_first), - _InputValueType(*__first), __comp); - ++__first; - } - std::__sort_heap(__result_first, __result_real_last, __comp); - return __result_real_last; - } - - /** - * @brief Copy the smallest elements of a sequence. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @param __result_first A random-access iterator. - * @param __result_last Another random-access iterator. - * @return An iterator indicating the end of the resulting sequence. - * - * Copies and sorts the smallest N values from the range @p [__first,__last) - * to the range beginning at @p __result_first, where the number of - * elements to be copied, @p N, is the smaller of @p (__last-__first) and - * @p (__result_last-__result_first). - * After the sort if @e i and @e j are iterators in the range - * @p [__result_first,__result_first+N) such that i precedes j then - * *j<*i is false. - * The value returned is @p __result_first+N. - */ - template - inline _RandomAccessIterator - partial_sort_copy(_InputIterator __first, _InputIterator __last, - _RandomAccessIterator __result_first, - _RandomAccessIterator __result_last) - { - typedef typename iterator_traits<_InputIterator>::value_type - _InputValueType; - typedef typename iterator_traits<_RandomAccessIterator>::value_type - _OutputValueType; - typedef typename iterator_traits<_RandomAccessIterator>::difference_type - _DistanceType; - - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_ConvertibleConcept<_InputValueType, - _OutputValueType>) - __glibcxx_function_requires(_LessThanOpConcept<_InputValueType, - _OutputValueType>) - __glibcxx_function_requires(_LessThanComparableConcept<_OutputValueType>) - __glibcxx_requires_valid_range(__first, __last); - __glibcxx_requires_valid_range(__result_first, __result_last); - - return std::__partial_sort_copy(__first, __last, - __result_first, __result_last, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Copy the smallest elements of a sequence using a predicate for - * comparison. - * @ingroup sorting_algorithms - * @param __first An input iterator. - * @param __last Another input iterator. - * @param __result_first A random-access iterator. - * @param __result_last Another random-access iterator. - * @param __comp A comparison functor. - * @return An iterator indicating the end of the resulting sequence. - * - * Copies and sorts the smallest N values from the range @p [__first,__last) - * to the range beginning at @p result_first, where the number of - * elements to be copied, @p N, is the smaller of @p (__last-__first) and - * @p (__result_last-__result_first). - * After the sort if @e i and @e j are iterators in the range - * @p [__result_first,__result_first+N) such that i precedes j then - * @p __comp(*j,*i) is false. - * The value returned is @p __result_first+N. - */ - template - inline _RandomAccessIterator - partial_sort_copy(_InputIterator __first, _InputIterator __last, - _RandomAccessIterator __result_first, - _RandomAccessIterator __result_last, - _Compare __comp) - { - typedef typename iterator_traits<_InputIterator>::value_type - _InputValueType; - typedef typename iterator_traits<_RandomAccessIterator>::value_type - _OutputValueType; - typedef typename iterator_traits<_RandomAccessIterator>::difference_type - _DistanceType; - - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_ConvertibleConcept<_InputValueType, - _OutputValueType>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - _InputValueType, _OutputValueType>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - _OutputValueType, _OutputValueType>) - __glibcxx_requires_valid_range(__first, __last); - __glibcxx_requires_valid_range(__result_first, __result_last); - - return std::__partial_sort_copy(__first, __last, - __result_first, __result_last, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - /// This is a helper function for the sort routine. - template - void - __unguarded_linear_insert(_RandomAccessIterator __last, - _Compare __comp) - { - typename iterator_traits<_RandomAccessIterator>::value_type - __val = _GLIBCXX_MOVE(*__last); - _RandomAccessIterator __next = __last; - --__next; - while (__comp(__val, __next)) - { - *__last = _GLIBCXX_MOVE(*__next); - __last = __next; - --__next; - } - *__last = _GLIBCXX_MOVE(__val); - } - - /// This is a helper function for the sort routine. - template - void - __insertion_sort(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp) - { - if (__first == __last) return; - - for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) - { - if (__comp(__i, __first)) - { - typename iterator_traits<_RandomAccessIterator>::value_type - __val = _GLIBCXX_MOVE(*__i); - _GLIBCXX_MOVE_BACKWARD3(__first, __i, __i + 1); - *__first = _GLIBCXX_MOVE(__val); - } - else - std::__unguarded_linear_insert(__i, - __gnu_cxx::__ops::__val_comp_iter(__comp)); - } - } - - /// This is a helper function for the sort routine. - template - inline void - __unguarded_insertion_sort(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp) - { - for (_RandomAccessIterator __i = __first; __i != __last; ++__i) - std::__unguarded_linear_insert(__i, - __gnu_cxx::__ops::__val_comp_iter(__comp)); - } - - /** - * @doctodo - * This controls some aspect of the sort routines. - */ - enum { _S_threshold = 16 }; - - /// This is a helper function for the sort routine. - template - void - __final_insertion_sort(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp) - { - if (__last - __first > int(_S_threshold)) - { - std::__insertion_sort(__first, __first + int(_S_threshold), __comp); - std::__unguarded_insertion_sort(__first + int(_S_threshold), __last, - __comp); - } - else - std::__insertion_sort(__first, __last, __comp); - } - - /// This is a helper function... - template - _RandomAccessIterator - __unguarded_partition(_RandomAccessIterator __first, - _RandomAccessIterator __last, - _RandomAccessIterator __pivot, _Compare __comp) - { - while (true) - { - while (__comp(__first, __pivot)) - ++__first; - --__last; - while (__comp(__pivot, __last)) - --__last; - if (!(__first < __last)) - return __first; - std::iter_swap(__first, __last); - ++__first; - } - } - - /// This is a helper function... - template - inline _RandomAccessIterator - __unguarded_partition_pivot(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp) - { - _RandomAccessIterator __mid = __first + (__last - __first) / 2; - std::__move_median_to_first(__first, __first + 1, __mid, __last - 1, - __comp); - return std::__unguarded_partition(__first + 1, __last, __first, __comp); - } - - template - inline void - __partial_sort(_RandomAccessIterator __first, - _RandomAccessIterator __middle, - _RandomAccessIterator __last, - _Compare __comp) - { - std::__heap_select(__first, __middle, __last, __comp); - std::__sort_heap(__first, __middle, __comp); - } - - /// This is a helper function for the sort routine. - template - void - __introsort_loop(_RandomAccessIterator __first, - _RandomAccessIterator __last, - _Size __depth_limit, _Compare __comp) - { - while (__last - __first > int(_S_threshold)) - { - if (__depth_limit == 0) - { - std::__partial_sort(__first, __last, __last, __comp); - return; - } - --__depth_limit; - _RandomAccessIterator __cut = - std::__unguarded_partition_pivot(__first, __last, __comp); - std::__introsort_loop(__cut, __last, __depth_limit, __comp); - __last = __cut; - } - } - - // sort - - template - inline void - __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) - { - if (__first != __last) - { - std::__introsort_loop(__first, __last, - std::__lg(__last - __first) * 2, - __comp); - std::__final_insertion_sort(__first, __last, __comp); - } - } - - template - void - __introselect(_RandomAccessIterator __first, _RandomAccessIterator __nth, - _RandomAccessIterator __last, _Size __depth_limit, - _Compare __comp) - { - while (__last - __first > 3) - { - if (__depth_limit == 0) - { - std::__heap_select(__first, __nth + 1, __last, __comp); - // Place the nth largest element in its final position. - std::iter_swap(__first, __nth); - return; - } - --__depth_limit; - _RandomAccessIterator __cut = - std::__unguarded_partition_pivot(__first, __last, __comp); - if (__cut <= __nth) - __first = __cut; - else - __last = __cut; - } - std::__insertion_sort(__first, __last, __comp); - } - - // nth_element - - // lower_bound moved to stl_algobase.h - - /** - * @brief Finds the first position in which @p __val could be inserted - * without changing the ordering. - * @ingroup binary_search_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @param __val The search term. - * @param __comp A functor to use for comparisons. - * @return An iterator pointing to the first element not less - * than @p __val, or end() if every element is less - * than @p __val. - * @ingroup binary_search_algorithms - * - * The comparison function should have the same effects on ordering as - * the function used for the initial sort. - */ - template - inline _ForwardIterator - lower_bound(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __val, _Compare __comp) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; - - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - _ValueType, _Tp>) - __glibcxx_requires_partitioned_lower_pred(__first, __last, - __val, __comp); - - return std::__lower_bound(__first, __last, __val, - __gnu_cxx::__ops::__iter_comp_val(__comp)); - } - - template - _ForwardIterator - __upper_bound(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __val, _Compare __comp) - { - typedef typename iterator_traits<_ForwardIterator>::difference_type - _DistanceType; - - _DistanceType __len = std::distance(__first, __last); - - while (__len > 0) - { - _DistanceType __half = __len >> 1; - _ForwardIterator __middle = __first; - std::advance(__middle, __half); - if (__comp(__val, __middle)) - __len = __half; - else - { - __first = __middle; - ++__first; - __len = __len - __half - 1; - } - } - return __first; - } - - /** - * @brief Finds the last position in which @p __val could be inserted - * without changing the ordering. - * @ingroup binary_search_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @param __val The search term. - * @return An iterator pointing to the first element greater than @p __val, - * or end() if no elements are greater than @p __val. - * @ingroup binary_search_algorithms - */ - template - inline _ForwardIterator - upper_bound(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __val) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; - - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>) - __glibcxx_requires_partitioned_upper(__first, __last, __val); - - return std::__upper_bound(__first, __last, __val, - __gnu_cxx::__ops::__val_less_iter()); - } - - /** - * @brief Finds the last position in which @p __val could be inserted - * without changing the ordering. - * @ingroup binary_search_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @param __val The search term. - * @param __comp A functor to use for comparisons. - * @return An iterator pointing to the first element greater than @p __val, - * or end() if no elements are greater than @p __val. - * @ingroup binary_search_algorithms - * - * The comparison function should have the same effects on ordering as - * the function used for the initial sort. - */ - template - inline _ForwardIterator - upper_bound(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __val, _Compare __comp) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; - - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - _Tp, _ValueType>) - __glibcxx_requires_partitioned_upper_pred(__first, __last, - __val, __comp); - - return std::__upper_bound(__first, __last, __val, - __gnu_cxx::__ops::__val_comp_iter(__comp)); - } - - template - pair<_ForwardIterator, _ForwardIterator> - __equal_range(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __val, - _CompareItTp __comp_it_val, _CompareTpIt __comp_val_it) - { - typedef typename iterator_traits<_ForwardIterator>::difference_type - _DistanceType; - - _DistanceType __len = std::distance(__first, __last); - - while (__len > 0) - { - _DistanceType __half = __len >> 1; - _ForwardIterator __middle = __first; - std::advance(__middle, __half); - if (__comp_it_val(__middle, __val)) - { - __first = __middle; - ++__first; - __len = __len - __half - 1; - } - else if (__comp_val_it(__val, __middle)) - __len = __half; - else - { - _ForwardIterator __left - = std::__lower_bound(__first, __middle, __val, __comp_it_val); - std::advance(__first, __len); - _ForwardIterator __right - = std::__upper_bound(++__middle, __first, __val, __comp_val_it); - return pair<_ForwardIterator, _ForwardIterator>(__left, __right); - } - } - return pair<_ForwardIterator, _ForwardIterator>(__first, __first); - } - - /** - * @brief Finds the largest subrange in which @p __val could be inserted - * at any place in it without changing the ordering. - * @ingroup binary_search_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @param __val The search term. - * @return An pair of iterators defining the subrange. - * @ingroup binary_search_algorithms - * - * This is equivalent to - * @code - * std::make_pair(lower_bound(__first, __last, __val), - * upper_bound(__first, __last, __val)) - * @endcode - * but does not actually call those functions. - */ - template - inline pair<_ForwardIterator, _ForwardIterator> - equal_range(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __val) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; - - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>) - __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>) - __glibcxx_requires_partitioned_lower(__first, __last, __val); - __glibcxx_requires_partitioned_upper(__first, __last, __val); - - return std::__equal_range(__first, __last, __val, - __gnu_cxx::__ops::__iter_less_val(), - __gnu_cxx::__ops::__val_less_iter()); - } - - /** - * @brief Finds the largest subrange in which @p __val could be inserted - * at any place in it without changing the ordering. - * @param __first An iterator. - * @param __last Another iterator. - * @param __val The search term. - * @param __comp A functor to use for comparisons. - * @return An pair of iterators defining the subrange. - * @ingroup binary_search_algorithms - * - * This is equivalent to - * @code - * std::make_pair(lower_bound(__first, __last, __val, __comp), - * upper_bound(__first, __last, __val, __comp)) - * @endcode - * but does not actually call those functions. - */ - template - inline pair<_ForwardIterator, _ForwardIterator> - equal_range(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __val, _Compare __comp) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; - - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - _ValueType, _Tp>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - _Tp, _ValueType>) - __glibcxx_requires_partitioned_lower_pred(__first, __last, - __val, __comp); - __glibcxx_requires_partitioned_upper_pred(__first, __last, - __val, __comp); - - return std::__equal_range(__first, __last, __val, - __gnu_cxx::__ops::__iter_comp_val(__comp), - __gnu_cxx::__ops::__val_comp_iter(__comp)); - } - - /** - * @brief Determines whether an element exists in a range. - * @ingroup binary_search_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @param __val The search term. - * @return True if @p __val (or its equivalent) is in [@p - * __first,@p __last ]. - * - * Note that this does not actually return an iterator to @p __val. For - * that, use std::find or a container's specialized find member functions. - */ - template - bool - binary_search(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __val) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; - - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>) - __glibcxx_requires_partitioned_lower(__first, __last, __val); - __glibcxx_requires_partitioned_upper(__first, __last, __val); - - _ForwardIterator __i - = std::__lower_bound(__first, __last, __val, - __gnu_cxx::__ops::__iter_less_val()); - return __i != __last && !(__val < *__i); - } - - /** - * @brief Determines whether an element exists in a range. - * @ingroup binary_search_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @param __val The search term. - * @param __comp A functor to use for comparisons. - * @return True if @p __val (or its equivalent) is in @p [__first,__last]. - * - * Note that this does not actually return an iterator to @p __val. For - * that, use std::find or a container's specialized find member functions. - * - * The comparison function should have the same effects on ordering as - * the function used for the initial sort. - */ - template - bool - binary_search(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __val, _Compare __comp) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; - - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - _Tp, _ValueType>) - __glibcxx_requires_partitioned_lower_pred(__first, __last, - __val, __comp); - __glibcxx_requires_partitioned_upper_pred(__first, __last, - __val, __comp); - - _ForwardIterator __i - = std::__lower_bound(__first, __last, __val, - __gnu_cxx::__ops::__iter_comp_val(__comp)); - return __i != __last && !bool(__comp(__val, *__i)); - } - - // merge - - /// This is a helper function for the __merge_adaptive routines. - template - void - __move_merge_adaptive(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result, _Compare __comp) - { - while (__first1 != __last1 && __first2 != __last2) - { - if (__comp(__first2, __first1)) - { - *__result = _GLIBCXX_MOVE(*__first2); - ++__first2; - } - else - { - *__result = _GLIBCXX_MOVE(*__first1); - ++__first1; - } - ++__result; - } - if (__first1 != __last1) - _GLIBCXX_MOVE3(__first1, __last1, __result); - } - - /// This is a helper function for the __merge_adaptive routines. - template - void - __move_merge_adaptive_backward(_BidirectionalIterator1 __first1, - _BidirectionalIterator1 __last1, - _BidirectionalIterator2 __first2, - _BidirectionalIterator2 __last2, - _BidirectionalIterator3 __result, - _Compare __comp) - { - if (__first1 == __last1) - { - _GLIBCXX_MOVE_BACKWARD3(__first2, __last2, __result); - return; - } - else if (__first2 == __last2) - return; - - --__last1; - --__last2; - while (true) - { - if (__comp(__last2, __last1)) - { - *--__result = _GLIBCXX_MOVE(*__last1); - if (__first1 == __last1) - { - _GLIBCXX_MOVE_BACKWARD3(__first2, ++__last2, __result); - return; - } - --__last1; - } - else - { - *--__result = _GLIBCXX_MOVE(*__last2); - if (__first2 == __last2) - return; - --__last2; - } - } - } - - /// This is a helper function for the merge routines. - template - _BidirectionalIterator1 - __rotate_adaptive(_BidirectionalIterator1 __first, - _BidirectionalIterator1 __middle, - _BidirectionalIterator1 __last, - _Distance __len1, _Distance __len2, - _BidirectionalIterator2 __buffer, - _Distance __buffer_size) - { - _BidirectionalIterator2 __buffer_end; - if (__len1 > __len2 && __len2 <= __buffer_size) - { - if (__len2) - { - __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer); - _GLIBCXX_MOVE_BACKWARD3(__first, __middle, __last); - return _GLIBCXX_MOVE3(__buffer, __buffer_end, __first); - } - else - return __first; - } - else if (__len1 <= __buffer_size) - { - if (__len1) - { - __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer); - _GLIBCXX_MOVE3(__middle, __last, __first); - return _GLIBCXX_MOVE_BACKWARD3(__buffer, __buffer_end, __last); - } - else - return __last; - } - else - { - std::rotate(__first, __middle, __last); - std::advance(__first, std::distance(__middle, __last)); - return __first; - } - } - - /// This is a helper function for the merge routines. - template - void - __merge_adaptive(_BidirectionalIterator __first, - _BidirectionalIterator __middle, - _BidirectionalIterator __last, - _Distance __len1, _Distance __len2, - _Pointer __buffer, _Distance __buffer_size, - _Compare __comp) - { - if (__len1 <= __len2 && __len1 <= __buffer_size) - { - _Pointer __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer); - std::__move_merge_adaptive(__buffer, __buffer_end, __middle, __last, - __first, __comp); - } - else if (__len2 <= __buffer_size) - { - _Pointer __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer); - std::__move_merge_adaptive_backward(__first, __middle, __buffer, - __buffer_end, __last, __comp); - } - else - { - _BidirectionalIterator __first_cut = __first; - _BidirectionalIterator __second_cut = __middle; - _Distance __len11 = 0; - _Distance __len22 = 0; - if (__len1 > __len2) - { - __len11 = __len1 / 2; - std::advance(__first_cut, __len11); - __second_cut - = std::__lower_bound(__middle, __last, *__first_cut, - __gnu_cxx::__ops::__iter_comp_val(__comp)); - __len22 = std::distance(__middle, __second_cut); - } - else - { - __len22 = __len2 / 2; - std::advance(__second_cut, __len22); - __first_cut - = std::__upper_bound(__first, __middle, *__second_cut, - __gnu_cxx::__ops::__val_comp_iter(__comp)); - __len11 = std::distance(__first, __first_cut); - } - - _BidirectionalIterator __new_middle - = std::__rotate_adaptive(__first_cut, __middle, __second_cut, - __len1 - __len11, __len22, __buffer, - __buffer_size); - std::__merge_adaptive(__first, __first_cut, __new_middle, __len11, - __len22, __buffer, __buffer_size, __comp); - std::__merge_adaptive(__new_middle, __second_cut, __last, - __len1 - __len11, - __len2 - __len22, __buffer, - __buffer_size, __comp); - } - } - - /// This is a helper function for the merge routines. - template - void - __merge_without_buffer(_BidirectionalIterator __first, - _BidirectionalIterator __middle, - _BidirectionalIterator __last, - _Distance __len1, _Distance __len2, - _Compare __comp) - { - if (__len1 == 0 || __len2 == 0) - return; - - if (__len1 + __len2 == 2) - { - if (__comp(__middle, __first)) - std::iter_swap(__first, __middle); - return; - } - - _BidirectionalIterator __first_cut = __first; - _BidirectionalIterator __second_cut = __middle; - _Distance __len11 = 0; - _Distance __len22 = 0; - if (__len1 > __len2) - { - __len11 = __len1 / 2; - std::advance(__first_cut, __len11); - __second_cut - = std::__lower_bound(__middle, __last, *__first_cut, - __gnu_cxx::__ops::__iter_comp_val(__comp)); - __len22 = std::distance(__middle, __second_cut); - } - else - { - __len22 = __len2 / 2; - std::advance(__second_cut, __len22); - __first_cut - = std::__upper_bound(__first, __middle, *__second_cut, - __gnu_cxx::__ops::__val_comp_iter(__comp)); - __len11 = std::distance(__first, __first_cut); - } - - std::rotate(__first_cut, __middle, __second_cut); - _BidirectionalIterator __new_middle = __first_cut; - std::advance(__new_middle, std::distance(__middle, __second_cut)); - std::__merge_without_buffer(__first, __first_cut, __new_middle, - __len11, __len22, __comp); - std::__merge_without_buffer(__new_middle, __second_cut, __last, - __len1 - __len11, __len2 - __len22, __comp); - } - - template - void - __inplace_merge(_BidirectionalIterator __first, - _BidirectionalIterator __middle, - _BidirectionalIterator __last, - _Compare __comp) - { - typedef typename iterator_traits<_BidirectionalIterator>::value_type - _ValueType; - typedef typename iterator_traits<_BidirectionalIterator>::difference_type - _DistanceType; - - if (__first == __middle || __middle == __last) - return; - - const _DistanceType __len1 = std::distance(__first, __middle); - const _DistanceType __len2 = std::distance(__middle, __last); - - typedef _Temporary_buffer<_BidirectionalIterator, _ValueType> _TmpBuf; - _TmpBuf __buf(__first, __last); - - if (__buf.begin() == 0) - std::__merge_without_buffer - (__first, __middle, __last, __len1, __len2, __comp); - else - std::__merge_adaptive - (__first, __middle, __last, __len1, __len2, __buf.begin(), - _DistanceType(__buf.size()), __comp); - } - - /** - * @brief Merges two sorted ranges in place. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __middle Another iterator. - * @param __last Another iterator. - * @return Nothing. - * - * Merges two sorted and consecutive ranges, [__first,__middle) and - * [__middle,__last), and puts the result in [__first,__last). The - * output will be sorted. The sort is @e stable, that is, for - * equivalent elements in the two ranges, elements from the first - * range will always come before elements from the second. - * - * If enough additional memory is available, this takes (__last-__first)-1 - * comparisons. Otherwise an NlogN algorithm is used, where N is - * distance(__first,__last). - */ - template - inline void - inplace_merge(_BidirectionalIterator __first, - _BidirectionalIterator __middle, - _BidirectionalIterator __last) - { - // concept requirements - __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< - _BidirectionalIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_BidirectionalIterator>::value_type>) - __glibcxx_requires_sorted(__first, __middle); - __glibcxx_requires_sorted(__middle, __last); - - std::__inplace_merge(__first, __middle, __last, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Merges two sorted ranges in place. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __middle Another iterator. - * @param __last Another iterator. - * @param __comp A functor to use for comparisons. - * @return Nothing. - * - * Merges two sorted and consecutive ranges, [__first,__middle) and - * [middle,last), and puts the result in [__first,__last). The output will - * be sorted. The sort is @e stable, that is, for equivalent - * elements in the two ranges, elements from the first range will always - * come before elements from the second. - * - * If enough additional memory is available, this takes (__last-__first)-1 - * comparisons. Otherwise an NlogN algorithm is used, where N is - * distance(__first,__last). - * - * The comparison function should have the same effects on ordering as - * the function used for the initial sort. - */ - template - inline void - inplace_merge(_BidirectionalIterator __first, - _BidirectionalIterator __middle, - _BidirectionalIterator __last, - _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< - _BidirectionalIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_BidirectionalIterator>::value_type, - typename iterator_traits<_BidirectionalIterator>::value_type>) - __glibcxx_requires_sorted_pred(__first, __middle, __comp); - __glibcxx_requires_sorted_pred(__middle, __last, __comp); - - std::__inplace_merge(__first, __middle, __last, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - - /// This is a helper function for the __merge_sort_loop routines. - template - _OutputIterator - __move_merge(_InputIterator __first1, _InputIterator __last1, - _InputIterator __first2, _InputIterator __last2, - _OutputIterator __result, _Compare __comp) - { - while (__first1 != __last1 && __first2 != __last2) - { - if (__comp(__first2, __first1)) - { - *__result = _GLIBCXX_MOVE(*__first2); - ++__first2; - } - else - { - *__result = _GLIBCXX_MOVE(*__first1); - ++__first1; - } - ++__result; - } - return _GLIBCXX_MOVE3(__first2, __last2, - _GLIBCXX_MOVE3(__first1, __last1, - __result)); - } - - template - void - __merge_sort_loop(_RandomAccessIterator1 __first, - _RandomAccessIterator1 __last, - _RandomAccessIterator2 __result, _Distance __step_size, - _Compare __comp) - { - const _Distance __two_step = 2 * __step_size; - - while (__last - __first >= __two_step) - { - __result = std::__move_merge(__first, __first + __step_size, - __first + __step_size, - __first + __two_step, - __result, __comp); - __first += __two_step; - } - __step_size = std::min(_Distance(__last - __first), __step_size); - - std::__move_merge(__first, __first + __step_size, - __first + __step_size, __last, __result, __comp); - } - - template - void - __chunk_insertion_sort(_RandomAccessIterator __first, - _RandomAccessIterator __last, - _Distance __chunk_size, _Compare __comp) - { - while (__last - __first >= __chunk_size) - { - std::__insertion_sort(__first, __first + __chunk_size, __comp); - __first += __chunk_size; - } - std::__insertion_sort(__first, __last, __comp); - } - - enum { _S_chunk_size = 7 }; - - template - void - __merge_sort_with_buffer(_RandomAccessIterator __first, - _RandomAccessIterator __last, - _Pointer __buffer, _Compare __comp) - { - typedef typename iterator_traits<_RandomAccessIterator>::difference_type - _Distance; - - const _Distance __len = __last - __first; - const _Pointer __buffer_last = __buffer + __len; - - _Distance __step_size = _S_chunk_size; - std::__chunk_insertion_sort(__first, __last, __step_size, __comp); - - while (__step_size < __len) - { - std::__merge_sort_loop(__first, __last, __buffer, - __step_size, __comp); - __step_size *= 2; - std::__merge_sort_loop(__buffer, __buffer_last, __first, - __step_size, __comp); - __step_size *= 2; - } - } - - template - void - __stable_sort_adaptive(_RandomAccessIterator __first, - _RandomAccessIterator __last, - _Pointer __buffer, _Distance __buffer_size, - _Compare __comp) - { - const _Distance __len = (__last - __first + 1) / 2; - const _RandomAccessIterator __middle = __first + __len; - if (__len > __buffer_size) - { - std::__stable_sort_adaptive(__first, __middle, __buffer, - __buffer_size, __comp); - std::__stable_sort_adaptive(__middle, __last, __buffer, - __buffer_size, __comp); - } - else - { - std::__merge_sort_with_buffer(__first, __middle, __buffer, __comp); - std::__merge_sort_with_buffer(__middle, __last, __buffer, __comp); - } - std::__merge_adaptive(__first, __middle, __last, - _Distance(__middle - __first), - _Distance(__last - __middle), - __buffer, __buffer_size, - __comp); - } - - /// This is a helper function for the stable sorting routines. - template - void - __inplace_stable_sort(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp) - { - if (__last - __first < 15) - { - std::__insertion_sort(__first, __last, __comp); - return; - } - _RandomAccessIterator __middle = __first + (__last - __first) / 2; - std::__inplace_stable_sort(__first, __middle, __comp); - std::__inplace_stable_sort(__middle, __last, __comp); - std::__merge_without_buffer(__first, __middle, __last, - __middle - __first, - __last - __middle, - __comp); - } - - // stable_sort - - // Set algorithms: includes, set_union, set_intersection, set_difference, - // set_symmetric_difference. All of these algorithms have the precondition - // that their input ranges are sorted and the postcondition that their output - // ranges are sorted. - - template - bool - __includes(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _Compare __comp) - { - while (__first1 != __last1 && __first2 != __last2) - if (__comp(__first2, __first1)) - return false; - else if (__comp(__first1, __first2)) - ++__first1; - else - ++__first1, ++__first2; - - return __first2 == __last2; - } - - /** - * @brief Determines whether all elements of a sequence exists in a range. - * @param __first1 Start of search range. - * @param __last1 End of search range. - * @param __first2 Start of sequence - * @param __last2 End of sequence. - * @return True if each element in [__first2,__last2) is contained in order - * within [__first1,__last1). False otherwise. - * @ingroup set_algorithms - * - * This operation expects both [__first1,__last1) and - * [__first2,__last2) to be sorted. Searches for the presence of - * each element in [__first2,__last2) within [__first1,__last1). - * The iterators over each range only move forward, so this is a - * linear algorithm. If an element in [__first2,__last2) is not - * found before the search iterator reaches @p __last2, false is - * returned. - */ - template - inline bool - includes(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_LessThanOpConcept< - typename iterator_traits<_InputIterator1>::value_type, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_LessThanOpConcept< - typename iterator_traits<_InputIterator2>::value_type, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_requires_sorted_set(__first1, __last1, __first2); - __glibcxx_requires_sorted_set(__first2, __last2, __first1); - - return std::__includes(__first1, __last1, __first2, __last2, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Determines whether all elements of a sequence exists in a range - * using comparison. - * @ingroup set_algorithms - * @param __first1 Start of search range. - * @param __last1 End of search range. - * @param __first2 Start of sequence - * @param __last2 End of sequence. - * @param __comp Comparison function to use. - * @return True if each element in [__first2,__last2) is contained - * in order within [__first1,__last1) according to comp. False - * otherwise. @ingroup set_algorithms - * - * This operation expects both [__first1,__last1) and - * [__first2,__last2) to be sorted. Searches for the presence of - * each element in [__first2,__last2) within [__first1,__last1), - * using comp to decide. The iterators over each range only move - * forward, so this is a linear algorithm. If an element in - * [__first2,__last2) is not found before the search iterator - * reaches @p __last2, false is returned. - */ - template - inline bool - includes(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_InputIterator1>::value_type, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_InputIterator2>::value_type, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); - __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); - - return std::__includes(__first1, __last1, __first2, __last2, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - // nth_element - // merge - // set_difference - // set_intersection - // set_union - // stable_sort - // set_symmetric_difference - // min_element - // max_element - - template - bool - __next_permutation(_BidirectionalIterator __first, - _BidirectionalIterator __last, _Compare __comp) - { - if (__first == __last) - return false; - _BidirectionalIterator __i = __first; - ++__i; - if (__i == __last) - return false; - __i = __last; - --__i; - - for(;;) - { - _BidirectionalIterator __ii = __i; - --__i; - if (__comp(__i, __ii)) - { - _BidirectionalIterator __j = __last; - while (!__comp(__i, --__j)) - {} - std::iter_swap(__i, __j); - std::__reverse(__ii, __last, - std::__iterator_category(__first)); - return true; - } - if (__i == __first) - { - std::__reverse(__first, __last, - std::__iterator_category(__first)); - return false; - } - } - } - - /** - * @brief Permute range into the next @e dictionary ordering. - * @ingroup sorting_algorithms - * @param __first Start of range. - * @param __last End of range. - * @return False if wrapped to first permutation, true otherwise. - * - * Treats all permutations of the range as a set of @e dictionary sorted - * sequences. Permutes the current sequence into the next one of this set. - * Returns true if there are more sequences to generate. If the sequence - * is the largest of the set, the smallest is generated and false returned. - */ - template - inline bool - next_permutation(_BidirectionalIterator __first, - _BidirectionalIterator __last) - { - // concept requirements - __glibcxx_function_requires(_BidirectionalIteratorConcept< - _BidirectionalIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_BidirectionalIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__next_permutation - (__first, __last, __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Permute range into the next @e dictionary ordering using - * comparison functor. - * @ingroup sorting_algorithms - * @param __first Start of range. - * @param __last End of range. - * @param __comp A comparison functor. - * @return False if wrapped to first permutation, true otherwise. - * - * Treats all permutations of the range [__first,__last) as a set of - * @e dictionary sorted sequences ordered by @p __comp. Permutes the current - * sequence into the next one of this set. Returns true if there are more - * sequences to generate. If the sequence is the largest of the set, the - * smallest is generated and false returned. - */ - template - inline bool - next_permutation(_BidirectionalIterator __first, - _BidirectionalIterator __last, _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_BidirectionalIteratorConcept< - _BidirectionalIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_BidirectionalIterator>::value_type, - typename iterator_traits<_BidirectionalIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__next_permutation - (__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - template - bool - __prev_permutation(_BidirectionalIterator __first, - _BidirectionalIterator __last, _Compare __comp) - { - if (__first == __last) - return false; - _BidirectionalIterator __i = __first; - ++__i; - if (__i == __last) - return false; - __i = __last; - --__i; - - for(;;) - { - _BidirectionalIterator __ii = __i; - --__i; - if (__comp(__ii, __i)) - { - _BidirectionalIterator __j = __last; - while (!__comp(--__j, __i)) - {} - std::iter_swap(__i, __j); - std::__reverse(__ii, __last, - std::__iterator_category(__first)); - return true; - } - if (__i == __first) - { - std::__reverse(__first, __last, - std::__iterator_category(__first)); - return false; - } - } - } - - /** - * @brief Permute range into the previous @e dictionary ordering. - * @ingroup sorting_algorithms - * @param __first Start of range. - * @param __last End of range. - * @return False if wrapped to last permutation, true otherwise. - * - * Treats all permutations of the range as a set of @e dictionary sorted - * sequences. Permutes the current sequence into the previous one of this - * set. Returns true if there are more sequences to generate. If the - * sequence is the smallest of the set, the largest is generated and false - * returned. - */ - template - inline bool - prev_permutation(_BidirectionalIterator __first, - _BidirectionalIterator __last) - { - // concept requirements - __glibcxx_function_requires(_BidirectionalIteratorConcept< - _BidirectionalIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_BidirectionalIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__prev_permutation(__first, __last, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Permute range into the previous @e dictionary ordering using - * comparison functor. - * @ingroup sorting_algorithms - * @param __first Start of range. - * @param __last End of range. - * @param __comp A comparison functor. - * @return False if wrapped to last permutation, true otherwise. - * - * Treats all permutations of the range [__first,__last) as a set of - * @e dictionary sorted sequences ordered by @p __comp. Permutes the current - * sequence into the previous one of this set. Returns true if there are - * more sequences to generate. If the sequence is the smallest of the set, - * the largest is generated and false returned. - */ - template - inline bool - prev_permutation(_BidirectionalIterator __first, - _BidirectionalIterator __last, _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_BidirectionalIteratorConcept< - _BidirectionalIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_BidirectionalIterator>::value_type, - typename iterator_traits<_BidirectionalIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__prev_permutation(__first, __last, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - // replace - // replace_if - - template - _OutputIterator - __replace_copy_if(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, - _Predicate __pred, const _Tp& __new_value) - { - for (; __first != __last; ++__first, ++__result) - if (__pred(__first)) - *__result = __new_value; - else - *__result = *__first; - return __result; - } - - /** - * @brief Copy a sequence, replacing each element of one value with another - * value. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __result An output iterator. - * @param __old_value The value to be replaced. - * @param __new_value The replacement value. - * @return The end of the output sequence, @p result+(last-first). - * - * Copies each element in the input range @p [__first,__last) to the - * output range @p [__result,__result+(__last-__first)) replacing elements - * equal to @p __old_value with @p __new_value. - */ - template - inline _OutputIterator - replace_copy(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, - const _Tp& __old_value, const _Tp& __new_value) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_InputIterator>::value_type, _Tp>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__replace_copy_if(__first, __last, __result, - __gnu_cxx::__ops::__iter_equals_val(__old_value), - __new_value); - } - - /** - * @brief Copy a sequence, replacing each value for which a predicate - * returns true with another value. - * @ingroup mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __result An output iterator. - * @param __pred A predicate. - * @param __new_value The replacement value. - * @return The end of the output sequence, @p __result+(__last-__first). - * - * Copies each element in the range @p [__first,__last) to the range - * @p [__result,__result+(__last-__first)) replacing elements for which - * @p __pred returns true with @p __new_value. - */ - template - inline _OutputIterator - replace_copy_if(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, - _Predicate __pred, const _Tp& __new_value) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__replace_copy_if(__first, __last, __result, - __gnu_cxx::__ops::__pred_iter(__pred), - __new_value); - } - - template - typename iterator_traits<_InputIterator>::difference_type - __count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) - { - typename iterator_traits<_InputIterator>::difference_type __n = 0; - for (; __first != __last; ++__first) - if (__pred(__first)) - ++__n; - return __n; - } - -#if __cplusplus >= 201103L - /** - * @brief Determines whether the elements of a sequence are sorted. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @return True if the elements are sorted, false otherwise. - */ - template - inline bool - is_sorted(_ForwardIterator __first, _ForwardIterator __last) - { return std::is_sorted_until(__first, __last) == __last; } - - /** - * @brief Determines whether the elements of a sequence are sorted - * according to a comparison functor. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @param __comp A comparison functor. - * @return True if the elements are sorted, false otherwise. - */ - template - inline bool - is_sorted(_ForwardIterator __first, _ForwardIterator __last, - _Compare __comp) - { return std::is_sorted_until(__first, __last, __comp) == __last; } - - template - _ForwardIterator - __is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, - _Compare __comp) - { - if (__first == __last) - return __last; - - _ForwardIterator __next = __first; - for (++__next; __next != __last; __first = __next, ++__next) - if (__comp(__next, __first)) - return __next; - return __next; - } - - /** - * @brief Determines the end of a sorted sequence. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @return An iterator pointing to the last iterator i in [__first, __last) - * for which the range [__first, i) is sorted. - */ - template - inline _ForwardIterator - is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__is_sorted_until(__first, __last, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Determines the end of a sorted sequence using comparison functor. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @param __comp A comparison functor. - * @return An iterator pointing to the last iterator i in [__first, __last) - * for which the range [__first, i) is sorted. - */ - template - inline _ForwardIterator - is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, - _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_ForwardIterator>::value_type, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__is_sorted_until(__first, __last, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - /** - * @brief Determines min and max at once as an ordered pair. - * @ingroup sorting_algorithms - * @param __a A thing of arbitrary type. - * @param __b Another thing of arbitrary type. - * @return A pair(__b, __a) if __b is smaller than __a, pair(__a, - * __b) otherwise. - */ - template - _GLIBCXX14_CONSTEXPR - inline pair - minmax(const _Tp& __a, const _Tp& __b) - { - // concept requirements - __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) - - return __b < __a ? pair(__b, __a) - : pair(__a, __b); - } - - /** - * @brief Determines min and max at once as an ordered pair. - * @ingroup sorting_algorithms - * @param __a A thing of arbitrary type. - * @param __b Another thing of arbitrary type. - * @param __comp A @link comparison_functors comparison functor @endlink. - * @return A pair(__b, __a) if __b is smaller than __a, pair(__a, - * __b) otherwise. - */ - template - _GLIBCXX14_CONSTEXPR - inline pair - minmax(const _Tp& __a, const _Tp& __b, _Compare __comp) - { - return __comp(__b, __a) ? pair(__b, __a) - : pair(__a, __b); - } - - template - _GLIBCXX14_CONSTEXPR - pair<_ForwardIterator, _ForwardIterator> - __minmax_element(_ForwardIterator __first, _ForwardIterator __last, - _Compare __comp) - { - _ForwardIterator __next = __first; - if (__first == __last - || ++__next == __last) - return std::make_pair(__first, __first); - - _ForwardIterator __min{}, __max{}; - if (__comp(__next, __first)) - { - __min = __next; - __max = __first; - } - else - { - __min = __first; - __max = __next; - } - - __first = __next; - ++__first; - - while (__first != __last) - { - __next = __first; - if (++__next == __last) - { - if (__comp(__first, __min)) - __min = __first; - else if (!__comp(__first, __max)) - __max = __first; - break; - } - - if (__comp(__next, __first)) - { - if (__comp(__next, __min)) - __min = __next; - if (!__comp(__first, __max)) - __max = __first; - } - else - { - if (__comp(__first, __min)) - __min = __first; - if (!__comp(__next, __max)) - __max = __next; - } - - __first = __next; - ++__first; - } - - return std::make_pair(__min, __max); - } - - /** - * @brief Return a pair of iterators pointing to the minimum and maximum - * elements in a range. - * @ingroup sorting_algorithms - * @param __first Start of range. - * @param __last End of range. - * @return make_pair(m, M), where m is the first iterator i in - * [__first, __last) such that no other element in the range is - * smaller, and where M is the last iterator i in [__first, __last) - * such that no other element in the range is larger. - */ - template - _GLIBCXX14_CONSTEXPR - inline pair<_ForwardIterator, _ForwardIterator> - minmax_element(_ForwardIterator __first, _ForwardIterator __last) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__minmax_element(__first, __last, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Return a pair of iterators pointing to the minimum and maximum - * elements in a range. - * @ingroup sorting_algorithms - * @param __first Start of range. - * @param __last End of range. - * @param __comp Comparison functor. - * @return make_pair(m, M), where m is the first iterator i in - * [__first, __last) such that no other element in the range is - * smaller, and where M is the last iterator i in [__first, __last) - * such that no other element in the range is larger. - */ - template - _GLIBCXX14_CONSTEXPR - inline pair<_ForwardIterator, _ForwardIterator> - minmax_element(_ForwardIterator __first, _ForwardIterator __last, - _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_ForwardIterator>::value_type, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__minmax_element(__first, __last, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - // N2722 + DR 915. - template - _GLIBCXX14_CONSTEXPR - inline _Tp - min(initializer_list<_Tp> __l) - { return *std::min_element(__l.begin(), __l.end()); } - - template - _GLIBCXX14_CONSTEXPR - inline _Tp - min(initializer_list<_Tp> __l, _Compare __comp) - { return *std::min_element(__l.begin(), __l.end(), __comp); } - - template - _GLIBCXX14_CONSTEXPR - inline _Tp - max(initializer_list<_Tp> __l) - { return *std::max_element(__l.begin(), __l.end()); } - - template - _GLIBCXX14_CONSTEXPR - inline _Tp - max(initializer_list<_Tp> __l, _Compare __comp) - { return *std::max_element(__l.begin(), __l.end(), __comp); } - - template - _GLIBCXX14_CONSTEXPR - inline pair<_Tp, _Tp> - minmax(initializer_list<_Tp> __l) - { - pair __p = - std::minmax_element(__l.begin(), __l.end()); - return std::make_pair(*__p.first, *__p.second); - } - - template - _GLIBCXX14_CONSTEXPR - inline pair<_Tp, _Tp> - minmax(initializer_list<_Tp> __l, _Compare __comp) - { - pair __p = - std::minmax_element(__l.begin(), __l.end(), __comp); - return std::make_pair(*__p.first, *__p.second); - } - - template - bool - __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, - _ForwardIterator2 __first2, _BinaryPredicate __pred) - { - // Efficiently compare identical prefixes: O(N) if sequences - // have the same elements in the same order. - for (; __first1 != __last1; ++__first1, ++__first2) - if (!__pred(__first1, __first2)) - break; - - if (__first1 == __last1) - return true; - - // Establish __last2 assuming equal ranges by iterating over the - // rest of the list. - _ForwardIterator2 __last2 = __first2; - std::advance(__last2, std::distance(__first1, __last1)); - for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan) - { - if (__scan != std::__find_if(__first1, __scan, - __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan))) - continue; // We've seen this one before. - - auto __matches - = std::__count_if(__first2, __last2, - __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)); - if (0 == __matches || - std::__count_if(__scan, __last1, - __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)) - != __matches) - return false; - } - return true; - } - - /** - * @brief Checks whether a permutation of the second sequence is equal - * to the first sequence. - * @ingroup non_mutating_algorithms - * @param __first1 Start of first range. - * @param __last1 End of first range. - * @param __first2 Start of second range. - * @return true if there exists a permutation of the elements in the range - * [__first2, __first2 + (__last1 - __first1)), beginning with - * ForwardIterator2 begin, such that equal(__first1, __last1, begin) - * returns true; otherwise, returns false. - */ - template - inline bool - is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, - _ForwardIterator2 __first2) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_ForwardIterator1>::value_type, - typename iterator_traits<_ForwardIterator2>::value_type>) - __glibcxx_requires_valid_range(__first1, __last1); - - return std::__is_permutation(__first1, __last1, __first2, - __gnu_cxx::__ops::__iter_equal_to_iter()); - } - - /** - * @brief Checks whether a permutation of the second sequence is equal - * to the first sequence. - * @ingroup non_mutating_algorithms - * @param __first1 Start of first range. - * @param __last1 End of first range. - * @param __first2 Start of second range. - * @param __pred A binary predicate. - * @return true if there exists a permutation of the elements in - * the range [__first2, __first2 + (__last1 - __first1)), - * beginning with ForwardIterator2 begin, such that - * equal(__first1, __last1, __begin, __pred) returns true; - * otherwise, returns false. - */ - template - inline bool - is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, - _ForwardIterator2 __first2, _BinaryPredicate __pred) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) - __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, - typename iterator_traits<_ForwardIterator1>::value_type, - typename iterator_traits<_ForwardIterator2>::value_type>) - __glibcxx_requires_valid_range(__first1, __last1); - - return std::__is_permutation(__first1, __last1, __first2, - __gnu_cxx::__ops::__iter_comp_iter(__pred)); - } - -#if __cplusplus > 201103L - template - bool - __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, - _ForwardIterator2 __first2, _ForwardIterator2 __last2, - _BinaryPredicate __pred) - { - using _Cat1 - = typename iterator_traits<_ForwardIterator1>::iterator_category; - using _Cat2 - = typename iterator_traits<_ForwardIterator2>::iterator_category; - using _It1_is_RA = is_same<_Cat1, random_access_iterator_tag>; - using _It2_is_RA = is_same<_Cat2, random_access_iterator_tag>; - constexpr bool __ra_iters = _It1_is_RA() && _It2_is_RA(); - if (__ra_iters) - { - auto __d1 = std::distance(__first1, __last1); - auto __d2 = std::distance(__first2, __last2); - if (__d1 != __d2) - return false; - } - - // Efficiently compare identical prefixes: O(N) if sequences - // have the same elements in the same order. - for (; __first1 != __last1 && __first2 != __last2; - ++__first1, ++__first2) - if (!__pred(__first1, __first2)) - break; - - if (__ra_iters) - { - if (__first1 == __last1) - return true; - } - else - { - auto __d1 = std::distance(__first1, __last1); - auto __d2 = std::distance(__first2, __last2); - if (__d1 == 0 && __d2 == 0) - return true; - if (__d1 != __d2) - return false; - } - - for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan) - { - if (__scan != std::__find_if(__first1, __scan, - __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan))) - continue; // We've seen this one before. - - auto __matches = std::__count_if(__first2, __last2, - __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)); - if (0 == __matches - || std::__count_if(__scan, __last1, - __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)) - != __matches) - return false; - } - return true; - } - - /** - * @brief Checks whether a permutaion of the second sequence is equal - * to the first sequence. - * @ingroup non_mutating_algorithms - * @param __first1 Start of first range. - * @param __last1 End of first range. - * @param __first2 Start of second range. - * @param __last2 End of first range. - * @return true if there exists a permutation of the elements in the range - * [__first2, __last2), beginning with ForwardIterator2 begin, - * such that equal(__first1, __last1, begin) returns true; - * otherwise, returns false. - */ - template - inline bool - is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, - _ForwardIterator2 __first2, _ForwardIterator2 __last2) - { - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - return - std::__is_permutation(__first1, __last1, __first2, __last2, - __gnu_cxx::__ops::__iter_equal_to_iter()); - } - - /** - * @brief Checks whether a permutation of the second sequence is equal - * to the first sequence. - * @ingroup non_mutating_algorithms - * @param __first1 Start of first range. - * @param __last1 End of first range. - * @param __first2 Start of second range. - * @param __last2 End of first range. - * @param __pred A binary predicate. - * @return true if there exists a permutation of the elements in the range - * [__first2, __last2), beginning with ForwardIterator2 begin, - * such that equal(__first1, __last1, __begin, __pred) returns true; - * otherwise, returns false. - */ - template - inline bool - is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, - _ForwardIterator2 __first2, _ForwardIterator2 __last2, - _BinaryPredicate __pred) - { - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - return std::__is_permutation(__first1, __last1, __first2, __last2, - __gnu_cxx::__ops::__iter_comp_iter(__pred)); - } -#endif - -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - /** - * @brief Shuffle the elements of a sequence using a uniform random - * number generator. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @param __g A UniformRandomNumberGenerator (26.5.1.3). - * @return Nothing. - * - * Reorders the elements in the range @p [__first,__last) using @p __g to - * provide random numbers. - */ - template - void - shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, - _UniformRandomNumberGenerator&& __g) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_requires_valid_range(__first, __last); - - if (__first == __last) - return; - - typedef typename iterator_traits<_RandomAccessIterator>::difference_type - _DistanceType; - - typedef typename std::make_unsigned<_DistanceType>::type __ud_type; - typedef typename std::uniform_int_distribution<__ud_type> __distr_type; - typedef typename __distr_type::param_type __p_type; - __distr_type __d; - - for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) - std::iter_swap(__i, __first + __d(__g, __p_type(0, __i - __first))); - } -#endif - -#endif // C++11 - -_GLIBCXX_END_NAMESPACE_VERSION - -_GLIBCXX_BEGIN_NAMESPACE_ALGO - - /** - * @brief Apply a function to every element of a sequence. - * @ingroup non_mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __f A unary function object. - * @return @p __f (std::move(@p __f) in C++0x). - * - * Applies the function object @p __f to each element in the range - * @p [first,last). @p __f must not modify the order of the sequence. - * If @p __f has a return value it is ignored. - */ - template - _Function - for_each(_InputIterator __first, _InputIterator __last, _Function __f) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_requires_valid_range(__first, __last); - for (; __first != __last; ++__first) - __f(*__first); - return _GLIBCXX_MOVE(__f); - } - - /** - * @brief Find the first occurrence of a value in a sequence. - * @ingroup non_mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __val The value to find. - * @return The first iterator @c i in the range @p [__first,__last) - * such that @c *i == @p __val, or @p __last if no such iterator exists. - */ - template - inline _InputIterator - find(_InputIterator __first, _InputIterator __last, - const _Tp& __val) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_InputIterator>::value_type, _Tp>) - __glibcxx_requires_valid_range(__first, __last); - return std::__find_if(__first, __last, - __gnu_cxx::__ops::__iter_equals_val(__val)); - } - - /** - * @brief Find the first element in a sequence for which a - * predicate is true. - * @ingroup non_mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __pred A predicate. - * @return The first iterator @c i in the range @p [__first,__last) - * such that @p __pred(*i) is true, or @p __last if no such iterator exists. - */ - template - inline _InputIterator - find_if(_InputIterator __first, _InputIterator __last, - _Predicate __pred) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__find_if(__first, __last, - __gnu_cxx::__ops::__pred_iter(__pred)); - } - - /** - * @brief Find element from a set in a sequence. - * @ingroup non_mutating_algorithms - * @param __first1 Start of range to search. - * @param __last1 End of range to search. - * @param __first2 Start of match candidates. - * @param __last2 End of match candidates. - * @return The first iterator @c i in the range - * @p [__first1,__last1) such that @c *i == @p *(i2) such that i2 is an - * iterator in [__first2,__last2), or @p __last1 if no such iterator exists. - * - * Searches the range @p [__first1,__last1) for an element that is - * equal to some element in the range [__first2,__last2). If - * found, returns an iterator in the range [__first1,__last1), - * otherwise returns @p __last1. - */ - template - _InputIterator - find_first_of(_InputIterator __first1, _InputIterator __last1, - _ForwardIterator __first2, _ForwardIterator __last2) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_InputIterator>::value_type, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - for (; __first1 != __last1; ++__first1) - for (_ForwardIterator __iter = __first2; __iter != __last2; ++__iter) - if (*__first1 == *__iter) - return __first1; - return __last1; - } - - /** - * @brief Find element from a set in a sequence using a predicate. - * @ingroup non_mutating_algorithms - * @param __first1 Start of range to search. - * @param __last1 End of range to search. - * @param __first2 Start of match candidates. - * @param __last2 End of match candidates. - * @param __comp Predicate to use. - * @return The first iterator @c i in the range - * @p [__first1,__last1) such that @c comp(*i, @p *(i2)) is true - * and i2 is an iterator in [__first2,__last2), or @p __last1 if no - * such iterator exists. - * - - * Searches the range @p [__first1,__last1) for an element that is - * equal to some element in the range [__first2,__last2). If - * found, returns an iterator in the range [__first1,__last1), - * otherwise returns @p __last1. - */ - template - _InputIterator - find_first_of(_InputIterator __first1, _InputIterator __last1, - _ForwardIterator __first2, _ForwardIterator __last2, - _BinaryPredicate __comp) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, - typename iterator_traits<_InputIterator>::value_type, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - for (; __first1 != __last1; ++__first1) - for (_ForwardIterator __iter = __first2; __iter != __last2; ++__iter) - if (__comp(*__first1, *__iter)) - return __first1; - return __last1; - } - - /** - * @brief Find two adjacent values in a sequence that are equal. - * @ingroup non_mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @return The first iterator @c i such that @c i and @c i+1 are both - * valid iterators in @p [__first,__last) and such that @c *i == @c *(i+1), - * or @p __last if no such iterator exists. - */ - template - inline _ForwardIterator - adjacent_find(_ForwardIterator __first, _ForwardIterator __last) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_EqualityComparableConcept< - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__adjacent_find(__first, __last, - __gnu_cxx::__ops::__iter_equal_to_iter()); - } - - /** - * @brief Find two adjacent values in a sequence using a predicate. - * @ingroup non_mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @param __binary_pred A binary predicate. - * @return The first iterator @c i such that @c i and @c i+1 are both - * valid iterators in @p [__first,__last) and such that - * @p __binary_pred(*i,*(i+1)) is true, or @p __last if no such iterator - * exists. - */ - template - inline _ForwardIterator - adjacent_find(_ForwardIterator __first, _ForwardIterator __last, - _BinaryPredicate __binary_pred) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, - typename iterator_traits<_ForwardIterator>::value_type, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__adjacent_find(__first, __last, - __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); - } - - /** - * @brief Count the number of copies of a value in a sequence. - * @ingroup non_mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __value The value to be counted. - * @return The number of iterators @c i in the range @p [__first,__last) - * for which @c *i == @p __value - */ - template - inline typename iterator_traits<_InputIterator>::difference_type - count(_InputIterator __first, _InputIterator __last, const _Tp& __value) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_InputIterator>::value_type, _Tp>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__count_if(__first, __last, - __gnu_cxx::__ops::__iter_equals_val(__value)); - } - - /** - * @brief Count the elements of a sequence for which a predicate is true. - * @ingroup non_mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __pred A predicate. - * @return The number of iterators @c i in the range @p [__first,__last) - * for which @p __pred(*i) is true. - */ - template - inline typename iterator_traits<_InputIterator>::difference_type - count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__count_if(__first, __last, - __gnu_cxx::__ops::__pred_iter(__pred)); - } - - /** - * @brief Search a sequence for a matching sub-sequence. - * @ingroup non_mutating_algorithms - * @param __first1 A forward iterator. - * @param __last1 A forward iterator. - * @param __first2 A forward iterator. - * @param __last2 A forward iterator. - * @return The first iterator @c i in the range @p - * [__first1,__last1-(__last2-__first2)) such that @c *(i+N) == @p - * *(__first2+N) for each @c N in the range @p - * [0,__last2-__first2), or @p __last1 if no such iterator exists. - * - * Searches the range @p [__first1,__last1) for a sub-sequence that - * compares equal value-by-value with the sequence given by @p - * [__first2,__last2) and returns an iterator to the first element - * of the sub-sequence, or @p __last1 if the sub-sequence is not - * found. - * - * Because the sub-sequence must lie completely within the range @p - * [__first1,__last1) it must start at a position less than @p - * __last1-(__last2-__first2) where @p __last2-__first2 is the - * length of the sub-sequence. - * - * This means that the returned iterator @c i will be in the range - * @p [__first1,__last1-(__last2-__first2)) - */ - template - inline _ForwardIterator1 - search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, - _ForwardIterator2 __first2, _ForwardIterator2 __last2) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_ForwardIterator1>::value_type, - typename iterator_traits<_ForwardIterator2>::value_type>) - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - return std::__search(__first1, __last1, __first2, __last2, - __gnu_cxx::__ops::__iter_equal_to_iter()); - } - - /** - * @brief Search a sequence for a matching sub-sequence using a predicate. - * @ingroup non_mutating_algorithms - * @param __first1 A forward iterator. - * @param __last1 A forward iterator. - * @param __first2 A forward iterator. - * @param __last2 A forward iterator. - * @param __predicate A binary predicate. - * @return The first iterator @c i in the range - * @p [__first1,__last1-(__last2-__first2)) such that - * @p __predicate(*(i+N),*(__first2+N)) is true for each @c N in the range - * @p [0,__last2-__first2), or @p __last1 if no such iterator exists. - * - * Searches the range @p [__first1,__last1) for a sub-sequence that - * compares equal value-by-value with the sequence given by @p - * [__first2,__last2), using @p __predicate to determine equality, - * and returns an iterator to the first element of the - * sub-sequence, or @p __last1 if no such iterator exists. - * - * @see search(_ForwardIter1, _ForwardIter1, _ForwardIter2, _ForwardIter2) - */ - template - inline _ForwardIterator1 - search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, - _ForwardIterator2 __first2, _ForwardIterator2 __last2, - _BinaryPredicate __predicate) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) - __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, - typename iterator_traits<_ForwardIterator1>::value_type, - typename iterator_traits<_ForwardIterator2>::value_type>) - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - return std::__search(__first1, __last1, __first2, __last2, - __gnu_cxx::__ops::__iter_comp_iter(__predicate)); - } - - /** - * @brief Search a sequence for a number of consecutive values. - * @ingroup non_mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @param __count The number of consecutive values. - * @param __val The value to find. - * @return The first iterator @c i in the range @p - * [__first,__last-__count) such that @c *(i+N) == @p __val for - * each @c N in the range @p [0,__count), or @p __last if no such - * iterator exists. - * - * Searches the range @p [__first,__last) for @p count consecutive elements - * equal to @p __val. - */ - template - inline _ForwardIterator - search_n(_ForwardIterator __first, _ForwardIterator __last, - _Integer __count, const _Tp& __val) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_ForwardIterator>::value_type, _Tp>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__search_n(__first, __last, __count, - __gnu_cxx::__ops::__iter_equals_val(__val)); - } - - - /** - * @brief Search a sequence for a number of consecutive values using a - * predicate. - * @ingroup non_mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @param __count The number of consecutive values. - * @param __val The value to find. - * @param __binary_pred A binary predicate. - * @return The first iterator @c i in the range @p - * [__first,__last-__count) such that @p - * __binary_pred(*(i+N),__val) is true for each @c N in the range - * @p [0,__count), or @p __last if no such iterator exists. - * - * Searches the range @p [__first,__last) for @p __count - * consecutive elements for which the predicate returns true. - */ - template - inline _ForwardIterator - search_n(_ForwardIterator __first, _ForwardIterator __last, - _Integer __count, const _Tp& __val, - _BinaryPredicate __binary_pred) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, - typename iterator_traits<_ForwardIterator>::value_type, _Tp>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__search_n(__first, __last, __count, - __gnu_cxx::__ops::__iter_comp_val(__binary_pred, __val)); - } - - - /** - * @brief Perform an operation on a sequence. - * @ingroup mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __result An output iterator. - * @param __unary_op A unary operator. - * @return An output iterator equal to @p __result+(__last-__first). - * - * Applies the operator to each element in the input range and assigns - * the results to successive elements of the output sequence. - * Evaluates @p *(__result+N)=unary_op(*(__first+N)) for each @c N in the - * range @p [0,__last-__first). - * - * @p unary_op must not alter its argument. - */ - template - _OutputIterator - transform(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _UnaryOperation __unary_op) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - // "the type returned by a _UnaryOperation" - __typeof__(__unary_op(*__first))>) - __glibcxx_requires_valid_range(__first, __last); - - for (; __first != __last; ++__first, ++__result) - *__result = __unary_op(*__first); - return __result; - } - - /** - * @brief Perform an operation on corresponding elements of two sequences. - * @ingroup mutating_algorithms - * @param __first1 An input iterator. - * @param __last1 An input iterator. - * @param __first2 An input iterator. - * @param __result An output iterator. - * @param __binary_op A binary operator. - * @return An output iterator equal to @p result+(last-first). - * - * Applies the operator to the corresponding elements in the two - * input ranges and assigns the results to successive elements of the - * output sequence. - * Evaluates @p - * *(__result+N)=__binary_op(*(__first1+N),*(__first2+N)) for each - * @c N in the range @p [0,__last1-__first1). - * - * @p binary_op must not alter either of its arguments. - */ - template - _OutputIterator - transform(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _OutputIterator __result, - _BinaryOperation __binary_op) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - // "the type returned by a _BinaryOperation" - __typeof__(__binary_op(*__first1,*__first2))>) - __glibcxx_requires_valid_range(__first1, __last1); - - for (; __first1 != __last1; ++__first1, ++__first2, ++__result) - *__result = __binary_op(*__first1, *__first2); - return __result; - } - - /** - * @brief Replace each occurrence of one value in a sequence with another - * value. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @param __old_value The value to be replaced. - * @param __new_value The replacement value. - * @return replace() returns no value. - * - * For each iterator @c i in the range @p [__first,__last) if @c *i == - * @p __old_value then the assignment @c *i = @p __new_value is performed. - */ - template - void - replace(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __old_value, const _Tp& __new_value) - { - // concept requirements - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_ForwardIterator>::value_type, _Tp>) - __glibcxx_function_requires(_ConvertibleConcept<_Tp, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - for (; __first != __last; ++__first) - if (*__first == __old_value) - *__first = __new_value; - } - - /** - * @brief Replace each value in a sequence for which a predicate returns - * true with another value. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @param __pred A predicate. - * @param __new_value The replacement value. - * @return replace_if() returns no value. - * - * For each iterator @c i in the range @p [__first,__last) if @p __pred(*i) - * is true then the assignment @c *i = @p __new_value is performed. - */ - template - void - replace_if(_ForwardIterator __first, _ForwardIterator __last, - _Predicate __pred, const _Tp& __new_value) - { - // concept requirements - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator>) - __glibcxx_function_requires(_ConvertibleConcept<_Tp, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - for (; __first != __last; ++__first) - if (__pred(*__first)) - *__first = __new_value; - } - - /** - * @brief Assign the result of a function object to each value in a - * sequence. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @param __gen A function object taking no arguments and returning - * std::iterator_traits<_ForwardIterator>::value_type - * @return generate() returns no value. - * - * Performs the assignment @c *i = @p __gen() for each @c i in the range - * @p [__first,__last). - */ - template - void - generate(_ForwardIterator __first, _ForwardIterator __last, - _Generator __gen) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_GeneratorConcept<_Generator, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - for (; __first != __last; ++__first) - *__first = __gen(); - } - - /** - * @brief Assign the result of a function object to each value in a - * sequence. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __n The length of the sequence. - * @param __gen A function object taking no arguments and returning - * std::iterator_traits<_ForwardIterator>::value_type - * @return The end of the sequence, @p __first+__n - * - * Performs the assignment @c *i = @p __gen() for each @c i in the range - * @p [__first,__first+__n). - * - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * DR 865. More algorithms that throw away information - */ - template - _OutputIterator - generate_n(_OutputIterator __first, _Size __n, _Generator __gen) - { - // concept requirements - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - // "the type returned by a _Generator" - __typeof__(__gen())>) - - for (__decltype(__n + 0) __niter = __n; - __niter > 0; --__niter, ++__first) - *__first = __gen(); - return __first; - } - - /** - * @brief Copy a sequence, removing consecutive duplicate values. - * @ingroup mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __result An output iterator. - * @return An iterator designating the end of the resulting sequence. - * - * Copies each element in the range @p [__first,__last) to the range - * beginning at @p __result, except that only the first element is copied - * from groups of consecutive elements that compare equal. - * unique_copy() is stable, so the relative order of elements that are - * copied is unchanged. - * - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * DR 241. Does unique_copy() require CopyConstructible and Assignable? - * - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * DR 538. 241 again: Does unique_copy() require CopyConstructible and - * Assignable? - */ - template - inline _OutputIterator - unique_copy(_InputIterator __first, _InputIterator __last, - _OutputIterator __result) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_function_requires(_EqualityComparableConcept< - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - if (__first == __last) - return __result; - return std::__unique_copy(__first, __last, __result, - __gnu_cxx::__ops::__iter_equal_to_iter(), - std::__iterator_category(__first), - std::__iterator_category(__result)); - } - - /** - * @brief Copy a sequence, removing consecutive values using a predicate. - * @ingroup mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __result An output iterator. - * @param __binary_pred A binary predicate. - * @return An iterator designating the end of the resulting sequence. - * - * Copies each element in the range @p [__first,__last) to the range - * beginning at @p __result, except that only the first element is copied - * from groups of consecutive elements for which @p __binary_pred returns - * true. - * unique_copy() is stable, so the relative order of elements that are - * copied is unchanged. - * - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * DR 241. Does unique_copy() require CopyConstructible and Assignable? - */ - template - inline _OutputIterator - unique_copy(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, - _BinaryPredicate __binary_pred) - { - // concept requirements -- predicates checked later - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - if (__first == __last) - return __result; - return std::__unique_copy(__first, __last, __result, - __gnu_cxx::__ops::__iter_comp_iter(__binary_pred), - std::__iterator_category(__first), - std::__iterator_category(__result)); - } - - /** - * @brief Randomly shuffle the elements of a sequence. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @return Nothing. - * - * Reorder the elements in the range @p [__first,__last) using a random - * distribution, so that every possible ordering of the sequence is - * equally likely. - */ - template - inline void - random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_requires_valid_range(__first, __last); - - if (__first != __last) - for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) - { - // XXX rand() % N is not uniformly distributed - _RandomAccessIterator __j = __first - + std::rand() % ((__i - __first) + 1); - if (__i != __j) - std::iter_swap(__i, __j); - } - } - - /** - * @brief Shuffle the elements of a sequence using a random number - * generator. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @param __rand The RNG functor or function. - * @return Nothing. - * - * Reorders the elements in the range @p [__first,__last) using @p __rand to - * provide a random distribution. Calling @p __rand(N) for a positive - * integer @p N should return a randomly chosen integer from the - * range [0,N). - */ - template - void - random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, -#if __cplusplus >= 201103L - _RandomNumberGenerator&& __rand) -#else - _RandomNumberGenerator& __rand) -#endif - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_requires_valid_range(__first, __last); - - if (__first == __last) - return; - for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) - { - _RandomAccessIterator __j = __first + __rand((__i - __first) + 1); - if (__i != __j) - std::iter_swap(__i, __j); - } - } - - - /** - * @brief Move elements for which a predicate is true to the beginning - * of a sequence. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @param __pred A predicate functor. - * @return An iterator @p middle such that @p __pred(i) is true for each - * iterator @p i in the range @p [__first,middle) and false for each @p i - * in the range @p [middle,__last). - * - * @p __pred must not modify its operand. @p partition() does not preserve - * the relative ordering of elements in each group, use - * @p stable_partition() if this is needed. - */ - template - inline _ForwardIterator - partition(_ForwardIterator __first, _ForwardIterator __last, - _Predicate __pred) - { - // concept requirements - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator>) - __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__partition(__first, __last, __pred, - std::__iterator_category(__first)); - } - - - /** - * @brief Sort the smallest elements of a sequence. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __middle Another iterator. - * @param __last Another iterator. - * @return Nothing. - * - * Sorts the smallest @p (__middle-__first) elements in the range - * @p [first,last) and moves them to the range @p [__first,__middle). The - * order of the remaining elements in the range @p [__middle,__last) is - * undefined. - * After the sort if @e i and @e j are iterators in the range - * @p [__first,__middle) such that i precedes j and @e k is an iterator in - * the range @p [__middle,__last) then *j<*i and *k<*i are both false. - */ - template - inline void - partial_sort(_RandomAccessIterator __first, - _RandomAccessIterator __middle, - _RandomAccessIterator __last) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_RandomAccessIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __middle); - __glibcxx_requires_valid_range(__middle, __last); - - std::__partial_sort(__first, __middle, __last, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Sort the smallest elements of a sequence using a predicate - * for comparison. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __middle Another iterator. - * @param __last Another iterator. - * @param __comp A comparison functor. - * @return Nothing. - * - * Sorts the smallest @p (__middle-__first) elements in the range - * @p [__first,__last) and moves them to the range @p [__first,__middle). The - * order of the remaining elements in the range @p [__middle,__last) is - * undefined. - * After the sort if @e i and @e j are iterators in the range - * @p [__first,__middle) such that i precedes j and @e k is an iterator in - * the range @p [__middle,__last) then @p *__comp(j,*i) and @p __comp(*k,*i) - * are both false. - */ - template - inline void - partial_sort(_RandomAccessIterator __first, - _RandomAccessIterator __middle, - _RandomAccessIterator __last, - _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_RandomAccessIterator>::value_type, - typename iterator_traits<_RandomAccessIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __middle); - __glibcxx_requires_valid_range(__middle, __last); - - std::__partial_sort(__first, __middle, __last, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - /** - * @brief Sort a sequence just enough to find a particular position. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __nth Another iterator. - * @param __last Another iterator. - * @return Nothing. - * - * Rearranges the elements in the range @p [__first,__last) so that @p *__nth - * is the same element that would have been in that position had the - * whole sequence been sorted. The elements either side of @p *__nth are - * not completely sorted, but for any iterator @e i in the range - * @p [__first,__nth) and any iterator @e j in the range @p [__nth,__last) it - * holds that *j < *i is false. - */ - template - inline void - nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, - _RandomAccessIterator __last) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_RandomAccessIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __nth); - __glibcxx_requires_valid_range(__nth, __last); - - if (__first == __last || __nth == __last) - return; - - std::__introselect(__first, __nth, __last, - std::__lg(__last - __first) * 2, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Sort a sequence just enough to find a particular position - * using a predicate for comparison. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __nth Another iterator. - * @param __last Another iterator. - * @param __comp A comparison functor. - * @return Nothing. - * - * Rearranges the elements in the range @p [__first,__last) so that @p *__nth - * is the same element that would have been in that position had the - * whole sequence been sorted. The elements either side of @p *__nth are - * not completely sorted, but for any iterator @e i in the range - * @p [__first,__nth) and any iterator @e j in the range @p [__nth,__last) it - * holds that @p __comp(*j,*i) is false. - */ - template - inline void - nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, - _RandomAccessIterator __last, _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_RandomAccessIterator>::value_type, - typename iterator_traits<_RandomAccessIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __nth); - __glibcxx_requires_valid_range(__nth, __last); - - if (__first == __last || __nth == __last) - return; - - std::__introselect(__first, __nth, __last, - std::__lg(__last - __first) * 2, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - /** - * @brief Sort the elements of a sequence. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @return Nothing. - * - * Sorts the elements in the range @p [__first,__last) in ascending order, - * such that for each iterator @e i in the range @p [__first,__last-1), - * *(i+1)<*i is false. - * - * The relative ordering of equivalent elements is not preserved, use - * @p stable_sort() if this is needed. - */ - template - inline void - sort(_RandomAccessIterator __first, _RandomAccessIterator __last) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_RandomAccessIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Sort the elements of a sequence using a predicate for comparison. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @param __comp A comparison functor. - * @return Nothing. - * - * Sorts the elements in the range @p [__first,__last) in ascending order, - * such that @p __comp(*(i+1),*i) is false for every iterator @e i in the - * range @p [__first,__last-1). - * - * The relative ordering of equivalent elements is not preserved, use - * @p stable_sort() if this is needed. - */ - template - inline void - sort(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_RandomAccessIterator>::value_type, - typename iterator_traits<_RandomAccessIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - template - _OutputIterator - __merge(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result, _Compare __comp) - { - while (__first1 != __last1 && __first2 != __last2) - { - if (__comp(__first2, __first1)) - { - *__result = *__first2; - ++__first2; - } - else - { - *__result = *__first1; - ++__first1; - } - ++__result; - } - return std::copy(__first2, __last2, - std::copy(__first1, __last1, __result)); - } - - /** - * @brief Merges two sorted ranges. - * @ingroup sorting_algorithms - * @param __first1 An iterator. - * @param __first2 Another iterator. - * @param __last1 Another iterator. - * @param __last2 Another iterator. - * @param __result An iterator pointing to the end of the merged range. - * @return An iterator pointing to the first element not less - * than @e val. - * - * Merges the ranges @p [__first1,__last1) and @p [__first2,__last2) into - * the sorted range @p [__result, __result + (__last1-__first1) + - * (__last2-__first2)). Both input ranges must be sorted, and the - * output range must not overlap with either of the input ranges. - * The sort is @e stable, that is, for equivalent elements in the - * two ranges, elements from the first range will always come - * before elements from the second. - */ - template - inline _OutputIterator - merge(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_LessThanOpConcept< - typename iterator_traits<_InputIterator2>::value_type, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_requires_sorted_set(__first1, __last1, __first2); - __glibcxx_requires_sorted_set(__first2, __last2, __first1); - - return _GLIBCXX_STD_A::__merge(__first1, __last1, - __first2, __last2, __result, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Merges two sorted ranges. - * @ingroup sorting_algorithms - * @param __first1 An iterator. - * @param __first2 Another iterator. - * @param __last1 Another iterator. - * @param __last2 Another iterator. - * @param __result An iterator pointing to the end of the merged range. - * @param __comp A functor to use for comparisons. - * @return An iterator pointing to the first element "not less - * than" @e val. - * - * Merges the ranges @p [__first1,__last1) and @p [__first2,__last2) into - * the sorted range @p [__result, __result + (__last1-__first1) + - * (__last2-__first2)). Both input ranges must be sorted, and the - * output range must not overlap with either of the input ranges. - * The sort is @e stable, that is, for equivalent elements in the - * two ranges, elements from the first range will always come - * before elements from the second. - * - * The comparison function should have the same effects on ordering as - * the function used for the initial sort. - */ - template - inline _OutputIterator - merge(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result, _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_InputIterator2>::value_type, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); - __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); - - return _GLIBCXX_STD_A::__merge(__first1, __last1, - __first2, __last2, __result, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - template - inline void - __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) - { - typedef typename iterator_traits<_RandomAccessIterator>::value_type - _ValueType; - typedef typename iterator_traits<_RandomAccessIterator>::difference_type - _DistanceType; - - typedef _Temporary_buffer<_RandomAccessIterator, _ValueType> _TmpBuf; - _TmpBuf __buf(__first, __last); - - if (__buf.begin() == 0) - std::__inplace_stable_sort(__first, __last, __comp); - else - std::__stable_sort_adaptive(__first, __last, __buf.begin(), - _DistanceType(__buf.size()), __comp); - } - - /** - * @brief Sort the elements of a sequence, preserving the relative order - * of equivalent elements. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @return Nothing. - * - * Sorts the elements in the range @p [__first,__last) in ascending order, - * such that for each iterator @p i in the range @p [__first,__last-1), - * @p *(i+1)<*i is false. - * - * The relative ordering of equivalent elements is preserved, so any two - * elements @p x and @p y in the range @p [__first,__last) such that - * @p x - inline void - stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_RandomAccessIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - _GLIBCXX_STD_A::__stable_sort(__first, __last, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Sort the elements of a sequence using a predicate for comparison, - * preserving the relative order of equivalent elements. - * @ingroup sorting_algorithms - * @param __first An iterator. - * @param __last Another iterator. - * @param __comp A comparison functor. - * @return Nothing. - * - * Sorts the elements in the range @p [__first,__last) in ascending order, - * such that for each iterator @p i in the range @p [__first,__last-1), - * @p __comp(*(i+1),*i) is false. - * - * The relative ordering of equivalent elements is preserved, so any two - * elements @p x and @p y in the range @p [__first,__last) such that - * @p __comp(x,y) is false and @p __comp(y,x) is false will have the same - * relative ordering after calling @p stable_sort(). - */ - template - inline void - stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_RandomAccessIterator>::value_type, - typename iterator_traits<_RandomAccessIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - _GLIBCXX_STD_A::__stable_sort(__first, __last, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - template - _OutputIterator - __set_union(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result, _Compare __comp) - { - while (__first1 != __last1 && __first2 != __last2) - { - if (__comp(__first1, __first2)) - { - *__result = *__first1; - ++__first1; - } - else if (__comp(__first2, __first1)) - { - *__result = *__first2; - ++__first2; - } - else - { - *__result = *__first1; - ++__first1; - ++__first2; - } - ++__result; - } - return std::copy(__first2, __last2, - std::copy(__first1, __last1, __result)); - } - - /** - * @brief Return the union of two sorted ranges. - * @ingroup set_algorithms - * @param __first1 Start of first range. - * @param __last1 End of first range. - * @param __first2 Start of second range. - * @param __last2 End of second range. - * @return End of the output range. - * @ingroup set_algorithms - * - * This operation iterates over both ranges, copying elements present in - * each range in order to the output range. Iterators increment for each - * range. When the current element of one range is less than the other, - * that element is copied and the iterator advanced. If an element is - * contained in both ranges, the element from the first range is copied and - * both ranges advance. The output range may not overlap either input - * range. - */ - template - inline _OutputIterator - set_union(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_LessThanOpConcept< - typename iterator_traits<_InputIterator1>::value_type, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_LessThanOpConcept< - typename iterator_traits<_InputIterator2>::value_type, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_requires_sorted_set(__first1, __last1, __first2); - __glibcxx_requires_sorted_set(__first2, __last2, __first1); - - return _GLIBCXX_STD_A::__set_union(__first1, __last1, - __first2, __last2, __result, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Return the union of two sorted ranges using a comparison functor. - * @ingroup set_algorithms - * @param __first1 Start of first range. - * @param __last1 End of first range. - * @param __first2 Start of second range. - * @param __last2 End of second range. - * @param __comp The comparison functor. - * @return End of the output range. - * @ingroup set_algorithms - * - * This operation iterates over both ranges, copying elements present in - * each range in order to the output range. Iterators increment for each - * range. When the current element of one range is less than the other - * according to @p __comp, that element is copied and the iterator advanced. - * If an equivalent element according to @p __comp is contained in both - * ranges, the element from the first range is copied and both ranges - * advance. The output range may not overlap either input range. - */ - template - inline _OutputIterator - set_union(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result, _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_InputIterator1>::value_type, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_InputIterator2>::value_type, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); - __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); - - return _GLIBCXX_STD_A::__set_union(__first1, __last1, - __first2, __last2, __result, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - template - _OutputIterator - __set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result, _Compare __comp) - { - while (__first1 != __last1 && __first2 != __last2) - if (__comp(__first1, __first2)) - ++__first1; - else if (__comp(__first2, __first1)) - ++__first2; - else - { - *__result = *__first1; - ++__first1; - ++__first2; - ++__result; - } - return __result; - } - - /** - * @brief Return the intersection of two sorted ranges. - * @ingroup set_algorithms - * @param __first1 Start of first range. - * @param __last1 End of first range. - * @param __first2 Start of second range. - * @param __last2 End of second range. - * @return End of the output range. - * @ingroup set_algorithms - * - * This operation iterates over both ranges, copying elements present in - * both ranges in order to the output range. Iterators increment for each - * range. When the current element of one range is less than the other, - * that iterator advances. If an element is contained in both ranges, the - * element from the first range is copied and both ranges advance. The - * output range may not overlap either input range. - */ - template - inline _OutputIterator - set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_function_requires(_LessThanOpConcept< - typename iterator_traits<_InputIterator1>::value_type, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_LessThanOpConcept< - typename iterator_traits<_InputIterator2>::value_type, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_requires_sorted_set(__first1, __last1, __first2); - __glibcxx_requires_sorted_set(__first2, __last2, __first1); - - return _GLIBCXX_STD_A::__set_intersection(__first1, __last1, - __first2, __last2, __result, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Return the intersection of two sorted ranges using comparison - * functor. - * @ingroup set_algorithms - * @param __first1 Start of first range. - * @param __last1 End of first range. - * @param __first2 Start of second range. - * @param __last2 End of second range. - * @param __comp The comparison functor. - * @return End of the output range. - * @ingroup set_algorithms - * - * This operation iterates over both ranges, copying elements present in - * both ranges in order to the output range. Iterators increment for each - * range. When the current element of one range is less than the other - * according to @p __comp, that iterator advances. If an element is - * contained in both ranges according to @p __comp, the element from the - * first range is copied and both ranges advance. The output range may not - * overlap either input range. - */ - template - inline _OutputIterator - set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result, _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_InputIterator1>::value_type, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_InputIterator2>::value_type, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); - __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); - - return _GLIBCXX_STD_A::__set_intersection(__first1, __last1, - __first2, __last2, __result, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - template - _OutputIterator - __set_difference(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result, _Compare __comp) - { - while (__first1 != __last1 && __first2 != __last2) - if (__comp(__first1, __first2)) - { - *__result = *__first1; - ++__first1; - ++__result; - } - else if (__comp(__first2, __first1)) - ++__first2; - else - { - ++__first1; - ++__first2; - } - return std::copy(__first1, __last1, __result); - } - - /** - * @brief Return the difference of two sorted ranges. - * @ingroup set_algorithms - * @param __first1 Start of first range. - * @param __last1 End of first range. - * @param __first2 Start of second range. - * @param __last2 End of second range. - * @return End of the output range. - * @ingroup set_algorithms - * - * This operation iterates over both ranges, copying elements present in - * the first range but not the second in order to the output range. - * Iterators increment for each range. When the current element of the - * first range is less than the second, that element is copied and the - * iterator advances. If the current element of the second range is less, - * the iterator advances, but no element is copied. If an element is - * contained in both ranges, no elements are copied and both ranges - * advance. The output range may not overlap either input range. - */ - template - inline _OutputIterator - set_difference(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_function_requires(_LessThanOpConcept< - typename iterator_traits<_InputIterator1>::value_type, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_LessThanOpConcept< - typename iterator_traits<_InputIterator2>::value_type, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_requires_sorted_set(__first1, __last1, __first2); - __glibcxx_requires_sorted_set(__first2, __last2, __first1); - - return _GLIBCXX_STD_A::__set_difference(__first1, __last1, - __first2, __last2, __result, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Return the difference of two sorted ranges using comparison - * functor. - * @ingroup set_algorithms - * @param __first1 Start of first range. - * @param __last1 End of first range. - * @param __first2 Start of second range. - * @param __last2 End of second range. - * @param __comp The comparison functor. - * @return End of the output range. - * @ingroup set_algorithms - * - * This operation iterates over both ranges, copying elements present in - * the first range but not the second in order to the output range. - * Iterators increment for each range. When the current element of the - * first range is less than the second according to @p __comp, that element - * is copied and the iterator advances. If the current element of the - * second range is less, no element is copied and the iterator advances. - * If an element is contained in both ranges according to @p __comp, no - * elements are copied and both ranges advance. The output range may not - * overlap either input range. - */ - template - inline _OutputIterator - set_difference(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result, _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_InputIterator1>::value_type, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_InputIterator2>::value_type, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); - __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); - - return _GLIBCXX_STD_A::__set_difference(__first1, __last1, - __first2, __last2, __result, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - template - _OutputIterator - __set_symmetric_difference(_InputIterator1 __first1, - _InputIterator1 __last1, - _InputIterator2 __first2, - _InputIterator2 __last2, - _OutputIterator __result, - _Compare __comp) - { - while (__first1 != __last1 && __first2 != __last2) - if (__comp(__first1, __first2)) - { - *__result = *__first1; - ++__first1; - ++__result; - } - else if (__comp(__first2, __first1)) - { - *__result = *__first2; - ++__first2; - ++__result; - } - else - { - ++__first1; - ++__first2; - } - return std::copy(__first2, __last2, - std::copy(__first1, __last1, __result)); - } - - /** - * @brief Return the symmetric difference of two sorted ranges. - * @ingroup set_algorithms - * @param __first1 Start of first range. - * @param __last1 End of first range. - * @param __first2 Start of second range. - * @param __last2 End of second range. - * @return End of the output range. - * @ingroup set_algorithms - * - * This operation iterates over both ranges, copying elements present in - * one range but not the other in order to the output range. Iterators - * increment for each range. When the current element of one range is less - * than the other, that element is copied and the iterator advances. If an - * element is contained in both ranges, no elements are copied and both - * ranges advance. The output range may not overlap either input range. - */ - template - inline _OutputIterator - set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_LessThanOpConcept< - typename iterator_traits<_InputIterator1>::value_type, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_LessThanOpConcept< - typename iterator_traits<_InputIterator2>::value_type, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_requires_sorted_set(__first1, __last1, __first2); - __glibcxx_requires_sorted_set(__first2, __last2, __first1); - - return _GLIBCXX_STD_A::__set_symmetric_difference(__first1, __last1, - __first2, __last2, __result, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Return the symmetric difference of two sorted ranges using - * comparison functor. - * @ingroup set_algorithms - * @param __first1 Start of first range. - * @param __last1 End of first range. - * @param __first2 Start of second range. - * @param __last2 End of second range. - * @param __comp The comparison functor. - * @return End of the output range. - * @ingroup set_algorithms - * - * This operation iterates over both ranges, copying elements present in - * one range but not the other in order to the output range. Iterators - * increment for each range. When the current element of one range is less - * than the other according to @p comp, that element is copied and the - * iterator advances. If an element is contained in both ranges according - * to @p __comp, no elements are copied and both ranges advance. The output - * range may not overlap either input range. - */ - template - inline _OutputIterator - set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _OutputIterator __result, - _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_InputIterator1>::value_type, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_InputIterator2>::value_type, - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); - __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); - - return _GLIBCXX_STD_A::__set_symmetric_difference(__first1, __last1, - __first2, __last2, __result, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - template - _GLIBCXX14_CONSTEXPR - _ForwardIterator - __min_element(_ForwardIterator __first, _ForwardIterator __last, - _Compare __comp) - { - if (__first == __last) - return __first; - _ForwardIterator __result = __first; - while (++__first != __last) - if (__comp(__first, __result)) - __result = __first; - return __result; - } - - /** - * @brief Return the minimum element in a range. - * @ingroup sorting_algorithms - * @param __first Start of range. - * @param __last End of range. - * @return Iterator referencing the first instance of the smallest value. - */ - template - _GLIBCXX14_CONSTEXPR - _ForwardIterator - inline min_element(_ForwardIterator __first, _ForwardIterator __last) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return _GLIBCXX_STD_A::__min_element(__first, __last, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Return the minimum element in a range using comparison functor. - * @ingroup sorting_algorithms - * @param __first Start of range. - * @param __last End of range. - * @param __comp Comparison functor. - * @return Iterator referencing the first instance of the smallest value - * according to __comp. - */ - template - _GLIBCXX14_CONSTEXPR - inline _ForwardIterator - min_element(_ForwardIterator __first, _ForwardIterator __last, - _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_ForwardIterator>::value_type, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return _GLIBCXX_STD_A::__min_element(__first, __last, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - template - _GLIBCXX14_CONSTEXPR - _ForwardIterator - __max_element(_ForwardIterator __first, _ForwardIterator __last, - _Compare __comp) - { - if (__first == __last) return __first; - _ForwardIterator __result = __first; - while (++__first != __last) - if (__comp(__result, __first)) - __result = __first; - return __result; - } - - /** - * @brief Return the maximum element in a range. - * @ingroup sorting_algorithms - * @param __first Start of range. - * @param __last End of range. - * @return Iterator referencing the first instance of the largest value. - */ - template - _GLIBCXX14_CONSTEXPR - inline _ForwardIterator - max_element(_ForwardIterator __first, _ForwardIterator __last) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return _GLIBCXX_STD_A::__max_element(__first, __last, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Return the maximum element in a range using comparison functor. - * @ingroup sorting_algorithms - * @param __first Start of range. - * @param __last End of range. - * @param __comp Comparison functor. - * @return Iterator referencing the first instance of the largest value - * according to __comp. - */ - template - _GLIBCXX14_CONSTEXPR - inline _ForwardIterator - max_element(_ForwardIterator __first, _ForwardIterator __last, - _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, - typename iterator_traits<_ForwardIterator>::value_type, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return _GLIBCXX_STD_A::__max_element(__first, __last, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - -_GLIBCXX_END_NAMESPACE_ALGO -} // namespace std - -#endif /* _STL_ALGO_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_algobase.h b/openflow/usr/include/c++/5/bits/stl_algobase.h deleted file mode 100644 index 2b69e61..0000000 --- a/openflow/usr/include/c++/5/bits/stl_algobase.h +++ /dev/null @@ -1,1433 +0,0 @@ -// Core algorithmic facilities -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_algobase.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{algorithm} - */ - -#ifndef _STL_ALGOBASE_H -#define _STL_ALGOBASE_H 1 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // For std::swap and _GLIBCXX_MOVE -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#if __cplusplus < 201103L - // See http://gcc.gnu.org/ml/libstdc++/2004-08/msg00167.html: in a - // nutshell, we are partially implementing the resolution of DR 187, - // when it's safe, i.e., the value_types are equal. - template - struct __iter_swap - { - template - static void - iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) - { - typedef typename iterator_traits<_ForwardIterator1>::value_type - _ValueType1; - _ValueType1 __tmp = _GLIBCXX_MOVE(*__a); - *__a = _GLIBCXX_MOVE(*__b); - *__b = _GLIBCXX_MOVE(__tmp); - } - }; - - template<> - struct __iter_swap - { - template - static void - iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) - { - swap(*__a, *__b); - } - }; -#endif - - /** - * @brief Swaps the contents of two iterators. - * @ingroup mutating_algorithms - * @param __a An iterator. - * @param __b Another iterator. - * @return Nothing. - * - * This function swaps the values pointed to by two iterators, not the - * iterators themselves. - */ - template - inline void - iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) - { - // concept requirements - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator1>) - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator2>) - -#if __cplusplus < 201103L - typedef typename iterator_traits<_ForwardIterator1>::value_type - _ValueType1; - typedef typename iterator_traits<_ForwardIterator2>::value_type - _ValueType2; - - __glibcxx_function_requires(_ConvertibleConcept<_ValueType1, - _ValueType2>) - __glibcxx_function_requires(_ConvertibleConcept<_ValueType2, - _ValueType1>) - - typedef typename iterator_traits<_ForwardIterator1>::reference - _ReferenceType1; - typedef typename iterator_traits<_ForwardIterator2>::reference - _ReferenceType2; - std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value - && __are_same<_ValueType1&, _ReferenceType1>::__value - && __are_same<_ValueType2&, _ReferenceType2>::__value>:: - iter_swap(__a, __b); -#else - swap(*__a, *__b); -#endif - } - - /** - * @brief Swap the elements of two sequences. - * @ingroup mutating_algorithms - * @param __first1 A forward iterator. - * @param __last1 A forward iterator. - * @param __first2 A forward iterator. - * @return An iterator equal to @p first2+(last1-first1). - * - * Swaps each element in the range @p [first1,last1) with the - * corresponding element in the range @p [first2,(last1-first1)). - * The ranges must not overlap. - */ - template - _ForwardIterator2 - swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, - _ForwardIterator2 __first2) - { - // concept requirements - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator1>) - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator2>) - __glibcxx_requires_valid_range(__first1, __last1); - - for (; __first1 != __last1; ++__first1, ++__first2) - std::iter_swap(__first1, __first2); - return __first2; - } - - /** - * @brief This does what you think it does. - * @ingroup sorting_algorithms - * @param __a A thing of arbitrary type. - * @param __b Another thing of arbitrary type. - * @return The lesser of the parameters. - * - * This is the simple classic generic implementation. It will work on - * temporary expressions, since they are only evaluated once, unlike a - * preprocessor macro. - */ - template - _GLIBCXX14_CONSTEXPR - inline const _Tp& - min(const _Tp& __a, const _Tp& __b) - { - // concept requirements - __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) - //return __b < __a ? __b : __a; - if (__b < __a) - return __b; - return __a; - } - - /** - * @brief This does what you think it does. - * @ingroup sorting_algorithms - * @param __a A thing of arbitrary type. - * @param __b Another thing of arbitrary type. - * @return The greater of the parameters. - * - * This is the simple classic generic implementation. It will work on - * temporary expressions, since they are only evaluated once, unlike a - * preprocessor macro. - */ - template - _GLIBCXX14_CONSTEXPR - inline const _Tp& - max(const _Tp& __a, const _Tp& __b) - { - // concept requirements - __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) - //return __a < __b ? __b : __a; - if (__a < __b) - return __b; - return __a; - } - - /** - * @brief This does what you think it does. - * @ingroup sorting_algorithms - * @param __a A thing of arbitrary type. - * @param __b Another thing of arbitrary type. - * @param __comp A @link comparison_functors comparison functor@endlink. - * @return The lesser of the parameters. - * - * This will work on temporary expressions, since they are only evaluated - * once, unlike a preprocessor macro. - */ - template - _GLIBCXX14_CONSTEXPR - inline const _Tp& - min(const _Tp& __a, const _Tp& __b, _Compare __comp) - { - //return __comp(__b, __a) ? __b : __a; - if (__comp(__b, __a)) - return __b; - return __a; - } - - /** - * @brief This does what you think it does. - * @ingroup sorting_algorithms - * @param __a A thing of arbitrary type. - * @param __b Another thing of arbitrary type. - * @param __comp A @link comparison_functors comparison functor@endlink. - * @return The greater of the parameters. - * - * This will work on temporary expressions, since they are only evaluated - * once, unlike a preprocessor macro. - */ - template - _GLIBCXX14_CONSTEXPR - inline const _Tp& - max(const _Tp& __a, const _Tp& __b, _Compare __comp) - { - //return __comp(__a, __b) ? __b : __a; - if (__comp(__a, __b)) - return __b; - return __a; - } - - // If _Iterator is a __normal_iterator return its base (a plain pointer, - // normally) otherwise return it untouched. See copy, fill, ... - template - struct _Niter_base - : _Iter_base<_Iterator, __is_normal_iterator<_Iterator>::__value> - { }; - - template - inline typename _Niter_base<_Iterator>::iterator_type - __niter_base(_Iterator __it) - { return std::_Niter_base<_Iterator>::_S_base(__it); } - - // Likewise, for move_iterator. - template - struct _Miter_base - : _Iter_base<_Iterator, __is_move_iterator<_Iterator>::__value> - { }; - - template - inline typename _Miter_base<_Iterator>::iterator_type - __miter_base(_Iterator __it) - { return std::_Miter_base<_Iterator>::_S_base(__it); } - - // All of these auxiliary structs serve two purposes. (1) Replace - // calls to copy with memmove whenever possible. (Memmove, not memcpy, - // because the input and output ranges are permitted to overlap.) - // (2) If we're using random access iterators, then write the loop as - // a for loop with an explicit count. - - template - struct __copy_move - { - template - static _OI - __copy_m(_II __first, _II __last, _OI __result) - { - for (; __first != __last; ++__result, ++__first) - *__result = *__first; - return __result; - } - }; - -#if __cplusplus >= 201103L - template - struct __copy_move - { - template - static _OI - __copy_m(_II __first, _II __last, _OI __result) - { - for (; __first != __last; ++__result, ++__first) - *__result = std::move(*__first); - return __result; - } - }; -#endif - - template<> - struct __copy_move - { - template - static _OI - __copy_m(_II __first, _II __last, _OI __result) - { - typedef typename iterator_traits<_II>::difference_type _Distance; - for(_Distance __n = __last - __first; __n > 0; --__n) - { - *__result = *__first; - ++__first; - ++__result; - } - return __result; - } - }; - -#if __cplusplus >= 201103L - template<> - struct __copy_move - { - template - static _OI - __copy_m(_II __first, _II __last, _OI __result) - { - typedef typename iterator_traits<_II>::difference_type _Distance; - for(_Distance __n = __last - __first; __n > 0; --__n) - { - *__result = std::move(*__first); - ++__first; - ++__result; - } - return __result; - } - }; -#endif - - template - struct __copy_move<_IsMove, true, random_access_iterator_tag> - { - template - static _Tp* - __copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result) - { -#if __cplusplus >= 201103L - // trivial types can have deleted assignment - static_assert( is_copy_assignable<_Tp>::value, - "type is not assignable" ); -#endif - const ptrdiff_t _Num = __last - __first; - if (_Num) - __builtin_memmove(__result, __first, sizeof(_Tp) * _Num); - return __result + _Num; - } - }; - - template - inline _OI - __copy_move_a(_II __first, _II __last, _OI __result) - { - typedef typename iterator_traits<_II>::value_type _ValueTypeI; - typedef typename iterator_traits<_OI>::value_type _ValueTypeO; - typedef typename iterator_traits<_II>::iterator_category _Category; - const bool __simple = (__is_trivial(_ValueTypeI) - && __is_pointer<_II>::__value - && __is_pointer<_OI>::__value - && __are_same<_ValueTypeI, _ValueTypeO>::__value); - - return std::__copy_move<_IsMove, __simple, - _Category>::__copy_m(__first, __last, __result); - } - - // Helpers for streambuf iterators (either istream or ostream). - // NB: avoid including , relatively large. - template - struct char_traits; - - template - class istreambuf_iterator; - - template - class ostreambuf_iterator; - - template - typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, - ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type - __copy_move_a2(_CharT*, _CharT*, - ostreambuf_iterator<_CharT, char_traits<_CharT> >); - - template - typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, - ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type - __copy_move_a2(const _CharT*, const _CharT*, - ostreambuf_iterator<_CharT, char_traits<_CharT> >); - - template - typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, - _CharT*>::__type - __copy_move_a2(istreambuf_iterator<_CharT, char_traits<_CharT> >, - istreambuf_iterator<_CharT, char_traits<_CharT> >, _CharT*); - - template - inline _OI - __copy_move_a2(_II __first, _II __last, _OI __result) - { - return _OI(std::__copy_move_a<_IsMove>(std::__niter_base(__first), - std::__niter_base(__last), - std::__niter_base(__result))); - } - - /** - * @brief Copies the range [first,last) into result. - * @ingroup mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __result An output iterator. - * @return result + (first - last) - * - * This inline function will boil down to a call to @c memmove whenever - * possible. Failing that, if random access iterators are passed, then the - * loop count will be known (and therefore a candidate for compiler - * optimizations such as unrolling). Result may not be contained within - * [first,last); the copy_backward function should be used instead. - * - * Note that the end of the output range is permitted to be contained - * within [first,last). - */ - template - inline _OI - copy(_II __first, _II __last, _OI __result) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_II>) - __glibcxx_function_requires(_OutputIteratorConcept<_OI, - typename iterator_traits<_II>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return (std::__copy_move_a2<__is_move_iterator<_II>::__value> - (std::__miter_base(__first), std::__miter_base(__last), - __result)); - } - -#if __cplusplus >= 201103L - /** - * @brief Moves the range [first,last) into result. - * @ingroup mutating_algorithms - * @param __first An input iterator. - * @param __last An input iterator. - * @param __result An output iterator. - * @return result + (first - last) - * - * This inline function will boil down to a call to @c memmove whenever - * possible. Failing that, if random access iterators are passed, then the - * loop count will be known (and therefore a candidate for compiler - * optimizations such as unrolling). Result may not be contained within - * [first,last); the move_backward function should be used instead. - * - * Note that the end of the output range is permitted to be contained - * within [first,last). - */ - template - inline _OI - move(_II __first, _II __last, _OI __result) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_II>) - __glibcxx_function_requires(_OutputIteratorConcept<_OI, - typename iterator_traits<_II>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__copy_move_a2(std::__miter_base(__first), - std::__miter_base(__last), __result); - } - -#define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::move(_Tp, _Up, _Vp) -#else -#define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::copy(_Tp, _Up, _Vp) -#endif - - template - struct __copy_move_backward - { - template - static _BI2 - __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) - { - while (__first != __last) - *--__result = *--__last; - return __result; - } - }; - -#if __cplusplus >= 201103L - template - struct __copy_move_backward - { - template - static _BI2 - __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) - { - while (__first != __last) - *--__result = std::move(*--__last); - return __result; - } - }; -#endif - - template<> - struct __copy_move_backward - { - template - static _BI2 - __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) - { - typename iterator_traits<_BI1>::difference_type __n; - for (__n = __last - __first; __n > 0; --__n) - *--__result = *--__last; - return __result; - } - }; - -#if __cplusplus >= 201103L - template<> - struct __copy_move_backward - { - template - static _BI2 - __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) - { - typename iterator_traits<_BI1>::difference_type __n; - for (__n = __last - __first; __n > 0; --__n) - *--__result = std::move(*--__last); - return __result; - } - }; -#endif - - template - struct __copy_move_backward<_IsMove, true, random_access_iterator_tag> - { - template - static _Tp* - __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result) - { -#if __cplusplus >= 201103L - // trivial types can have deleted assignment - static_assert( is_copy_assignable<_Tp>::value, - "type is not assignable" ); -#endif - const ptrdiff_t _Num = __last - __first; - if (_Num) - __builtin_memmove(__result - _Num, __first, sizeof(_Tp) * _Num); - return __result - _Num; - } - }; - - template - inline _BI2 - __copy_move_backward_a(_BI1 __first, _BI1 __last, _BI2 __result) - { - typedef typename iterator_traits<_BI1>::value_type _ValueType1; - typedef typename iterator_traits<_BI2>::value_type _ValueType2; - typedef typename iterator_traits<_BI1>::iterator_category _Category; - const bool __simple = (__is_trivial(_ValueType1) - && __is_pointer<_BI1>::__value - && __is_pointer<_BI2>::__value - && __are_same<_ValueType1, _ValueType2>::__value); - - return std::__copy_move_backward<_IsMove, __simple, - _Category>::__copy_move_b(__first, - __last, - __result); - } - - template - inline _BI2 - __copy_move_backward_a2(_BI1 __first, _BI1 __last, _BI2 __result) - { - return _BI2(std::__copy_move_backward_a<_IsMove> - (std::__niter_base(__first), std::__niter_base(__last), - std::__niter_base(__result))); - } - - /** - * @brief Copies the range [first,last) into result. - * @ingroup mutating_algorithms - * @param __first A bidirectional iterator. - * @param __last A bidirectional iterator. - * @param __result A bidirectional iterator. - * @return result - (first - last) - * - * The function has the same effect as copy, but starts at the end of the - * range and works its way to the start, returning the start of the result. - * This inline function will boil down to a call to @c memmove whenever - * possible. Failing that, if random access iterators are passed, then the - * loop count will be known (and therefore a candidate for compiler - * optimizations such as unrolling). - * - * Result may not be in the range (first,last]. Use copy instead. Note - * that the start of the output range may overlap [first,last). - */ - template - inline _BI2 - copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) - { - // concept requirements - __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>) - __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>) - __glibcxx_function_requires(_ConvertibleConcept< - typename iterator_traits<_BI1>::value_type, - typename iterator_traits<_BI2>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return (std::__copy_move_backward_a2<__is_move_iterator<_BI1>::__value> - (std::__miter_base(__first), std::__miter_base(__last), - __result)); - } - -#if __cplusplus >= 201103L - /** - * @brief Moves the range [first,last) into result. - * @ingroup mutating_algorithms - * @param __first A bidirectional iterator. - * @param __last A bidirectional iterator. - * @param __result A bidirectional iterator. - * @return result - (first - last) - * - * The function has the same effect as move, but starts at the end of the - * range and works its way to the start, returning the start of the result. - * This inline function will boil down to a call to @c memmove whenever - * possible. Failing that, if random access iterators are passed, then the - * loop count will be known (and therefore a candidate for compiler - * optimizations such as unrolling). - * - * Result may not be in the range (first,last]. Use move instead. Note - * that the start of the output range may overlap [first,last). - */ - template - inline _BI2 - move_backward(_BI1 __first, _BI1 __last, _BI2 __result) - { - // concept requirements - __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>) - __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>) - __glibcxx_function_requires(_ConvertibleConcept< - typename iterator_traits<_BI1>::value_type, - typename iterator_traits<_BI2>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__copy_move_backward_a2(std::__miter_base(__first), - std::__miter_base(__last), - __result); - } - -#define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::move_backward(_Tp, _Up, _Vp) -#else -#define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::copy_backward(_Tp, _Up, _Vp) -#endif - - template - inline typename - __gnu_cxx::__enable_if::__value, void>::__type - __fill_a(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __value) - { - for (; __first != __last; ++__first) - *__first = __value; - } - - template - inline typename - __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type - __fill_a(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __value) - { - const _Tp __tmp = __value; - for (; __first != __last; ++__first) - *__first = __tmp; - } - - // Specialization: for char types we can use memset. - template - inline typename - __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, void>::__type - __fill_a(_Tp* __first, _Tp* __last, const _Tp& __c) - { - const _Tp __tmp = __c; - if (const size_t __len = __last - __first) - __builtin_memset(__first, static_cast(__tmp), __len); - } - - /** - * @brief Fills the range [first,last) with copies of value. - * @ingroup mutating_algorithms - * @param __first A forward iterator. - * @param __last A forward iterator. - * @param __value A reference-to-const of arbitrary type. - * @return Nothing. - * - * This function fills a range with copies of the same value. For char - * types filling contiguous areas of memory, this becomes an inline call - * to @c memset or @c wmemset. - */ - template - inline void - fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) - { - // concept requirements - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator>) - __glibcxx_requires_valid_range(__first, __last); - - std::__fill_a(std::__niter_base(__first), std::__niter_base(__last), - __value); - } - - template - inline typename - __gnu_cxx::__enable_if::__value, _OutputIterator>::__type - __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) - { - for (__decltype(__n + 0) __niter = __n; - __niter > 0; --__niter, ++__first) - *__first = __value; - return __first; - } - - template - inline typename - __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, _OutputIterator>::__type - __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) - { - const _Tp __tmp = __value; - for (__decltype(__n + 0) __niter = __n; - __niter > 0; --__niter, ++__first) - *__first = __tmp; - return __first; - } - - template - inline typename - __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, _Tp*>::__type - __fill_n_a(_Tp* __first, _Size __n, const _Tp& __c) - { - std::__fill_a(__first, __first + __n, __c); - return __first + __n; - } - - /** - * @brief Fills the range [first,first+n) with copies of value. - * @ingroup mutating_algorithms - * @param __first An output iterator. - * @param __n The count of copies to perform. - * @param __value A reference-to-const of arbitrary type. - * @return The iterator at first+n. - * - * This function fills a range with copies of the same value. For char - * types filling contiguous areas of memory, this becomes an inline call - * to @c memset or @ wmemset. - * - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * DR 865. More algorithms that throw away information - */ - template - inline _OI - fill_n(_OI __first, _Size __n, const _Tp& __value) - { - // concept requirements - __glibcxx_function_requires(_OutputIteratorConcept<_OI, _Tp>) - - return _OI(std::__fill_n_a(std::__niter_base(__first), __n, __value)); - } - - template - struct __equal - { - template - static bool - equal(_II1 __first1, _II1 __last1, _II2 __first2) - { - for (; __first1 != __last1; ++__first1, ++__first2) - if (!(*__first1 == *__first2)) - return false; - return true; - } - }; - - template<> - struct __equal - { - template - static bool - equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2) - { - if (const size_t __len = (__last1 - __first1)) - return !__builtin_memcmp(__first1, __first2, sizeof(_Tp) * __len); - return true; - } - }; - - template - inline bool - __equal_aux(_II1 __first1, _II1 __last1, _II2 __first2) - { - typedef typename iterator_traits<_II1>::value_type _ValueType1; - typedef typename iterator_traits<_II2>::value_type _ValueType2; - const bool __simple = ((__is_integer<_ValueType1>::__value - || __is_pointer<_ValueType1>::__value) - && __is_pointer<_II1>::__value - && __is_pointer<_II2>::__value - && __are_same<_ValueType1, _ValueType2>::__value); - - return std::__equal<__simple>::equal(__first1, __last1, __first2); - } - - template - struct __lc_rai - { - template - static _II1 - __newlast1(_II1, _II1 __last1, _II2, _II2) - { return __last1; } - - template - static bool - __cnd2(_II __first, _II __last) - { return __first != __last; } - }; - - template<> - struct __lc_rai - { - template - static _RAI1 - __newlast1(_RAI1 __first1, _RAI1 __last1, - _RAI2 __first2, _RAI2 __last2) - { - const typename iterator_traits<_RAI1>::difference_type - __diff1 = __last1 - __first1; - const typename iterator_traits<_RAI2>::difference_type - __diff2 = __last2 - __first2; - return __diff2 < __diff1 ? __first1 + __diff2 : __last1; - } - - template - static bool - __cnd2(_RAI, _RAI) - { return true; } - }; - - template - bool - __lexicographical_compare_impl(_II1 __first1, _II1 __last1, - _II2 __first2, _II2 __last2, - _Compare __comp) - { - typedef typename iterator_traits<_II1>::iterator_category _Category1; - typedef typename iterator_traits<_II2>::iterator_category _Category2; - typedef std::__lc_rai<_Category1, _Category2> __rai_type; - - __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2); - for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2); - ++__first1, ++__first2) - { - if (__comp(__first1, __first2)) - return true; - if (__comp(__first2, __first1)) - return false; - } - return __first1 == __last1 && __first2 != __last2; - } - - template - struct __lexicographical_compare - { - template - static bool __lc(_II1, _II1, _II2, _II2); - }; - - template - template - bool - __lexicographical_compare<_BoolType>:: - __lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) - { - return std::__lexicographical_compare_impl(__first1, __last1, - __first2, __last2, - __gnu_cxx::__ops::__iter_less_iter()); - } - - template<> - struct __lexicographical_compare - { - template - static bool - __lc(const _Tp* __first1, const _Tp* __last1, - const _Up* __first2, const _Up* __last2) - { - const size_t __len1 = __last1 - __first1; - const size_t __len2 = __last2 - __first2; - if (const size_t __len = std::min(__len1, __len2)) - if (int __result = __builtin_memcmp(__first1, __first2, __len)) - return __result < 0; - return __len1 < __len2; - } - }; - - template - inline bool - __lexicographical_compare_aux(_II1 __first1, _II1 __last1, - _II2 __first2, _II2 __last2) - { - typedef typename iterator_traits<_II1>::value_type _ValueType1; - typedef typename iterator_traits<_II2>::value_type _ValueType2; - const bool __simple = - (__is_byte<_ValueType1>::__value && __is_byte<_ValueType2>::__value - && !__gnu_cxx::__numeric_traits<_ValueType1>::__is_signed - && !__gnu_cxx::__numeric_traits<_ValueType2>::__is_signed - && __is_pointer<_II1>::__value - && __is_pointer<_II2>::__value); - - return std::__lexicographical_compare<__simple>::__lc(__first1, __last1, - __first2, __last2); - } - - template - _ForwardIterator - __lower_bound(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __val, _Compare __comp) - { - typedef typename iterator_traits<_ForwardIterator>::difference_type - _DistanceType; - - _DistanceType __len = std::distance(__first, __last); - - while (__len > 0) - { - _DistanceType __half = __len >> 1; - _ForwardIterator __middle = __first; - std::advance(__middle, __half); - if (__comp(__middle, __val)) - { - __first = __middle; - ++__first; - __len = __len - __half - 1; - } - else - __len = __half; - } - return __first; - } - - /** - * @brief Finds the first position in which @a val could be inserted - * without changing the ordering. - * @param __first An iterator. - * @param __last Another iterator. - * @param __val The search term. - * @return An iterator pointing to the first element not less - * than @a val, or end() if every element is less than - * @a val. - * @ingroup binary_search_algorithms - */ - template - inline _ForwardIterator - lower_bound(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __val) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_LessThanOpConcept< - typename iterator_traits<_ForwardIterator>::value_type, _Tp>) - __glibcxx_requires_partitioned_lower(__first, __last, __val); - - return std::__lower_bound(__first, __last, __val, - __gnu_cxx::__ops::__iter_less_val()); - } - - /// This is a helper function for the sort routines and for random.tcc. - // Precondition: __n > 0. - inline _GLIBCXX_CONSTEXPR int - __lg(int __n) - { return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); } - - inline _GLIBCXX_CONSTEXPR unsigned - __lg(unsigned __n) - { return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); } - - inline _GLIBCXX_CONSTEXPR long - __lg(long __n) - { return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); } - - inline _GLIBCXX_CONSTEXPR unsigned long - __lg(unsigned long __n) - { return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); } - - inline _GLIBCXX_CONSTEXPR long long - __lg(long long __n) - { return sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); } - - inline _GLIBCXX_CONSTEXPR unsigned long long - __lg(unsigned long long __n) - { return sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); } - -_GLIBCXX_END_NAMESPACE_VERSION - -_GLIBCXX_BEGIN_NAMESPACE_ALGO - - /** - * @brief Tests a range for element-wise equality. - * @ingroup non_mutating_algorithms - * @param __first1 An input iterator. - * @param __last1 An input iterator. - * @param __first2 An input iterator. - * @return A boolean true or false. - * - * This compares the elements of two ranges using @c == and returns true or - * false depending on whether all of the corresponding elements of the - * ranges are equal. - */ - template - inline bool - equal(_II1 __first1, _II1 __last1, _II2 __first2) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_II1>) - __glibcxx_function_requires(_InputIteratorConcept<_II2>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_II1>::value_type, - typename iterator_traits<_II2>::value_type>) - __glibcxx_requires_valid_range(__first1, __last1); - - return std::__equal_aux(std::__niter_base(__first1), - std::__niter_base(__last1), - std::__niter_base(__first2)); - } - - /** - * @brief Tests a range for element-wise equality. - * @ingroup non_mutating_algorithms - * @param __first1 An input iterator. - * @param __last1 An input iterator. - * @param __first2 An input iterator. - * @param __binary_pred A binary predicate @link functors - * functor@endlink. - * @return A boolean true or false. - * - * This compares the elements of two ranges using the binary_pred - * parameter, and returns true or - * false depending on whether all of the corresponding elements of the - * ranges are equal. - */ - template - inline bool - equal(_IIter1 __first1, _IIter1 __last1, - _IIter2 __first2, _BinaryPredicate __binary_pred) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_IIter1>) - __glibcxx_function_requires(_InputIteratorConcept<_IIter2>) - __glibcxx_requires_valid_range(__first1, __last1); - - for (; __first1 != __last1; ++__first1, ++__first2) - if (!bool(__binary_pred(*__first1, *__first2))) - return false; - return true; - } - -#if __cplusplus > 201103L - -#define __cpp_lib_robust_nonmodifying_seq_ops 201304 - - /** - * @brief Tests a range for element-wise equality. - * @ingroup non_mutating_algorithms - * @param __first1 An input iterator. - * @param __last1 An input iterator. - * @param __first2 An input iterator. - * @param __last2 An input iterator. - * @return A boolean true or false. - * - * This compares the elements of two ranges using @c == and returns true or - * false depending on whether all of the corresponding elements of the - * ranges are equal. - */ - template - inline bool - equal(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_II1>) - __glibcxx_function_requires(_InputIteratorConcept<_II2>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_II1>::value_type, - typename iterator_traits<_II2>::value_type>) - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - using _RATag = random_access_iterator_tag; - using _Cat1 = typename iterator_traits<_II1>::iterator_category; - using _Cat2 = typename iterator_traits<_II2>::iterator_category; - using _RAIters = __and_, is_same<_Cat2, _RATag>>; - if (_RAIters()) - { - auto __d1 = std::distance(__first1, __last1); - auto __d2 = std::distance(__first2, __last2); - if (__d1 != __d2) - return false; - return _GLIBCXX_STD_A::equal(__first1, __last1, __first2); - } - - for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2) - if (!(*__first1 == *__first2)) - return false; - return __first1 == __last1 && __first2 == __last2; - } - - /** - * @brief Tests a range for element-wise equality. - * @ingroup non_mutating_algorithms - * @param __first1 An input iterator. - * @param __last1 An input iterator. - * @param __first2 An input iterator. - * @param __last2 An input iterator. - * @param __binary_pred A binary predicate @link functors - * functor@endlink. - * @return A boolean true or false. - * - * This compares the elements of two ranges using the binary_pred - * parameter, and returns true or - * false depending on whether all of the corresponding elements of the - * ranges are equal. - */ - template - inline bool - equal(_IIter1 __first1, _IIter1 __last1, - _IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_IIter1>) - __glibcxx_function_requires(_InputIteratorConcept<_IIter2>) - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - using _RATag = random_access_iterator_tag; - using _Cat1 = typename iterator_traits<_IIter1>::iterator_category; - using _Cat2 = typename iterator_traits<_IIter2>::iterator_category; - using _RAIters = __and_, is_same<_Cat2, _RATag>>; - if (_RAIters()) - { - auto __d1 = std::distance(__first1, __last1); - auto __d2 = std::distance(__first2, __last2); - if (__d1 != __d2) - return false; - return _GLIBCXX_STD_A::equal(__first1, __last1, __first2, - __binary_pred); - } - - for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2) - if (!bool(__binary_pred(*__first1, *__first2))) - return false; - return __first1 == __last1 && __first2 == __last2; - } -#endif - - /** - * @brief Performs @b dictionary comparison on ranges. - * @ingroup sorting_algorithms - * @param __first1 An input iterator. - * @param __last1 An input iterator. - * @param __first2 An input iterator. - * @param __last2 An input iterator. - * @return A boolean true or false. - * - * Returns true if the sequence of elements defined by the range - * [first1,last1) is lexicographically less than the sequence of elements - * defined by the range [first2,last2). Returns false otherwise. - * (Quoted from [25.3.8]/1.) If the iterators are all character pointers, - * then this is an inline call to @c memcmp. - */ - template - inline bool - lexicographical_compare(_II1 __first1, _II1 __last1, - _II2 __first2, _II2 __last2) - { -#ifdef _GLIBCXX_CONCEPT_CHECKS - // concept requirements - typedef typename iterator_traits<_II1>::value_type _ValueType1; - typedef typename iterator_traits<_II2>::value_type _ValueType2; -#endif - __glibcxx_function_requires(_InputIteratorConcept<_II1>) - __glibcxx_function_requires(_InputIteratorConcept<_II2>) - __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>) - __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>) - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - return std::__lexicographical_compare_aux(std::__niter_base(__first1), - std::__niter_base(__last1), - std::__niter_base(__first2), - std::__niter_base(__last2)); - } - - /** - * @brief Performs @b dictionary comparison on ranges. - * @ingroup sorting_algorithms - * @param __first1 An input iterator. - * @param __last1 An input iterator. - * @param __first2 An input iterator. - * @param __last2 An input iterator. - * @param __comp A @link comparison_functors comparison functor@endlink. - * @return A boolean true or false. - * - * The same as the four-parameter @c lexicographical_compare, but uses the - * comp parameter instead of @c <. - */ - template - inline bool - lexicographical_compare(_II1 __first1, _II1 __last1, - _II2 __first2, _II2 __last2, _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_II1>) - __glibcxx_function_requires(_InputIteratorConcept<_II2>) - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - return std::__lexicographical_compare_impl - (__first1, __last1, __first2, __last2, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - template - pair<_InputIterator1, _InputIterator2> - __mismatch(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _BinaryPredicate __binary_pred) - { - while (__first1 != __last1 && __binary_pred(__first1, __first2)) - { - ++__first1; - ++__first2; - } - return pair<_InputIterator1, _InputIterator2>(__first1, __first2); - } - - /** - * @brief Finds the places in ranges which don't match. - * @ingroup non_mutating_algorithms - * @param __first1 An input iterator. - * @param __last1 An input iterator. - * @param __first2 An input iterator. - * @return A pair of iterators pointing to the first mismatch. - * - * This compares the elements of two ranges using @c == and returns a pair - * of iterators. The first iterator points into the first range, the - * second iterator points into the second range, and the elements pointed - * to by the iterators are not equal. - */ - template - inline pair<_InputIterator1, _InputIterator2> - mismatch(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_InputIterator1>::value_type, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_requires_valid_range(__first1, __last1); - - return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, - __gnu_cxx::__ops::__iter_equal_to_iter()); - } - - /** - * @brief Finds the places in ranges which don't match. - * @ingroup non_mutating_algorithms - * @param __first1 An input iterator. - * @param __last1 An input iterator. - * @param __first2 An input iterator. - * @param __binary_pred A binary predicate @link functors - * functor@endlink. - * @return A pair of iterators pointing to the first mismatch. - * - * This compares the elements of two ranges using the binary_pred - * parameter, and returns a pair - * of iterators. The first iterator points into the first range, the - * second iterator points into the second range, and the elements pointed - * to by the iterators are not equal. - */ - template - inline pair<_InputIterator1, _InputIterator2> - mismatch(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _BinaryPredicate __binary_pred) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_requires_valid_range(__first1, __last1); - - return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, - __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); - } - -#if __cplusplus > 201103L - - template - pair<_InputIterator1, _InputIterator2> - __mismatch(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _BinaryPredicate __binary_pred) - { - while (__first1 != __last1 && __first2 != __last2 - && __binary_pred(__first1, __first2)) - { - ++__first1; - ++__first2; - } - return pair<_InputIterator1, _InputIterator2>(__first1, __first2); - } - - /** - * @brief Finds the places in ranges which don't match. - * @ingroup non_mutating_algorithms - * @param __first1 An input iterator. - * @param __last1 An input iterator. - * @param __first2 An input iterator. - * @param __last2 An input iterator. - * @return A pair of iterators pointing to the first mismatch. - * - * This compares the elements of two ranges using @c == and returns a pair - * of iterators. The first iterator points into the first range, the - * second iterator points into the second range, and the elements pointed - * to by the iterators are not equal. - */ - template - inline pair<_InputIterator1, _InputIterator2> - mismatch(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_EqualOpConcept< - typename iterator_traits<_InputIterator1>::value_type, - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, __last2, - __gnu_cxx::__ops::__iter_equal_to_iter()); - } - - /** - * @brief Finds the places in ranges which don't match. - * @ingroup non_mutating_algorithms - * @param __first1 An input iterator. - * @param __last1 An input iterator. - * @param __first2 An input iterator. - * @param __last2 An input iterator. - * @param __binary_pred A binary predicate @link functors - * functor@endlink. - * @return A pair of iterators pointing to the first mismatch. - * - * This compares the elements of two ranges using the binary_pred - * parameter, and returns a pair - * of iterators. The first iterator points into the first range, the - * second iterator points into the second range, and the elements pointed - * to by the iterators are not equal. - */ - template - inline pair<_InputIterator1, _InputIterator2> - mismatch(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _InputIterator2 __last2, - _BinaryPredicate __binary_pred) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, __last2, - __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); - } -#endif - -_GLIBCXX_END_NAMESPACE_ALGO -} // namespace std - -// NB: This file is included within many other C++ includes, as a way -// of getting the base algorithms. So, make sure that parallel bits -// come in too if requested. -#ifdef _GLIBCXX_PARALLEL -# include -#endif - -#endif diff --git a/openflow/usr/include/c++/5/bits/stl_bvector.h b/openflow/usr/include/c++/5/bits/stl_bvector.h deleted file mode 100644 index 71bee21..0000000 --- a/openflow/usr/include/c++/5/bits/stl_bvector.h +++ /dev/null @@ -1,1286 +0,0 @@ -// vector specialization -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996-1999 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_bvector.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{vector} - */ - -#ifndef _STL_BVECTOR_H -#define _STL_BVECTOR_H 1 - -#if __cplusplus >= 201103L -#include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - typedef unsigned long _Bit_type; - enum { _S_word_bit = int(__CHAR_BIT__ * sizeof(_Bit_type)) }; - - struct _Bit_reference - { - _Bit_type * _M_p; - _Bit_type _M_mask; - - _Bit_reference(_Bit_type * __x, _Bit_type __y) - : _M_p(__x), _M_mask(__y) { } - - _Bit_reference() _GLIBCXX_NOEXCEPT : _M_p(0), _M_mask(0) { } - - operator bool() const _GLIBCXX_NOEXCEPT - { return !!(*_M_p & _M_mask); } - - _Bit_reference& - operator=(bool __x) _GLIBCXX_NOEXCEPT - { - if (__x) - *_M_p |= _M_mask; - else - *_M_p &= ~_M_mask; - return *this; - } - - _Bit_reference& - operator=(const _Bit_reference& __x) _GLIBCXX_NOEXCEPT - { return *this = bool(__x); } - - bool - operator==(const _Bit_reference& __x) const - { return bool(*this) == bool(__x); } - - bool - operator<(const _Bit_reference& __x) const - { return !bool(*this) && bool(__x); } - - void - flip() _GLIBCXX_NOEXCEPT - { *_M_p ^= _M_mask; } - }; - -#if __cplusplus >= 201103L - inline void - swap(_Bit_reference __x, _Bit_reference __y) noexcept - { - bool __tmp = __x; - __x = __y; - __y = __tmp; - } - - inline void - swap(_Bit_reference __x, bool& __y) noexcept - { - bool __tmp = __x; - __x = __y; - __y = __tmp; - } - - inline void - swap(bool& __x, _Bit_reference __y) noexcept - { - bool __tmp = __x; - __x = __y; - __y = __tmp; - } -#endif - - struct _Bit_iterator_base - : public std::iterator - { - _Bit_type * _M_p; - unsigned int _M_offset; - - _Bit_iterator_base(_Bit_type * __x, unsigned int __y) - : _M_p(__x), _M_offset(__y) { } - - void - _M_bump_up() - { - if (_M_offset++ == int(_S_word_bit) - 1) - { - _M_offset = 0; - ++_M_p; - } - } - - void - _M_bump_down() - { - if (_M_offset-- == 0) - { - _M_offset = int(_S_word_bit) - 1; - --_M_p; - } - } - - void - _M_incr(ptrdiff_t __i) - { - difference_type __n = __i + _M_offset; - _M_p += __n / int(_S_word_bit); - __n = __n % int(_S_word_bit); - if (__n < 0) - { - __n += int(_S_word_bit); - --_M_p; - } - _M_offset = static_cast(__n); - } - - bool - operator==(const _Bit_iterator_base& __i) const - { return _M_p == __i._M_p && _M_offset == __i._M_offset; } - - bool - operator<(const _Bit_iterator_base& __i) const - { - return _M_p < __i._M_p - || (_M_p == __i._M_p && _M_offset < __i._M_offset); - } - - bool - operator!=(const _Bit_iterator_base& __i) const - { return !(*this == __i); } - - bool - operator>(const _Bit_iterator_base& __i) const - { return __i < *this; } - - bool - operator<=(const _Bit_iterator_base& __i) const - { return !(__i < *this); } - - bool - operator>=(const _Bit_iterator_base& __i) const - { return !(*this < __i); } - }; - - inline ptrdiff_t - operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) - { - return (int(_S_word_bit) * (__x._M_p - __y._M_p) - + __x._M_offset - __y._M_offset); - } - - struct _Bit_iterator : public _Bit_iterator_base - { - typedef _Bit_reference reference; - typedef _Bit_reference* pointer; - typedef _Bit_iterator iterator; - - _Bit_iterator() : _Bit_iterator_base(0, 0) { } - - _Bit_iterator(_Bit_type * __x, unsigned int __y) - : _Bit_iterator_base(__x, __y) { } - - iterator - _M_const_cast() const - { return *this; } - - reference - operator*() const - { return reference(_M_p, 1UL << _M_offset); } - - iterator& - operator++() - { - _M_bump_up(); - return *this; - } - - iterator - operator++(int) - { - iterator __tmp = *this; - _M_bump_up(); - return __tmp; - } - - iterator& - operator--() - { - _M_bump_down(); - return *this; - } - - iterator - operator--(int) - { - iterator __tmp = *this; - _M_bump_down(); - return __tmp; - } - - iterator& - operator+=(difference_type __i) - { - _M_incr(__i); - return *this; - } - - iterator& - operator-=(difference_type __i) - { - *this += -__i; - return *this; - } - - iterator - operator+(difference_type __i) const - { - iterator __tmp = *this; - return __tmp += __i; - } - - iterator - operator-(difference_type __i) const - { - iterator __tmp = *this; - return __tmp -= __i; - } - - reference - operator[](difference_type __i) const - { return *(*this + __i); } - }; - - inline _Bit_iterator - operator+(ptrdiff_t __n, const _Bit_iterator& __x) - { return __x + __n; } - - struct _Bit_const_iterator : public _Bit_iterator_base - { - typedef bool reference; - typedef bool const_reference; - typedef const bool* pointer; - typedef _Bit_const_iterator const_iterator; - - _Bit_const_iterator() : _Bit_iterator_base(0, 0) { } - - _Bit_const_iterator(_Bit_type * __x, unsigned int __y) - : _Bit_iterator_base(__x, __y) { } - - _Bit_const_iterator(const _Bit_iterator& __x) - : _Bit_iterator_base(__x._M_p, __x._M_offset) { } - - _Bit_iterator - _M_const_cast() const - { return _Bit_iterator(_M_p, _M_offset); } - - const_reference - operator*() const - { return _Bit_reference(_M_p, 1UL << _M_offset); } - - const_iterator& - operator++() - { - _M_bump_up(); - return *this; - } - - const_iterator - operator++(int) - { - const_iterator __tmp = *this; - _M_bump_up(); - return __tmp; - } - - const_iterator& - operator--() - { - _M_bump_down(); - return *this; - } - - const_iterator - operator--(int) - { - const_iterator __tmp = *this; - _M_bump_down(); - return __tmp; - } - - const_iterator& - operator+=(difference_type __i) - { - _M_incr(__i); - return *this; - } - - const_iterator& - operator-=(difference_type __i) - { - *this += -__i; - return *this; - } - - const_iterator - operator+(difference_type __i) const - { - const_iterator __tmp = *this; - return __tmp += __i; - } - - const_iterator - operator-(difference_type __i) const - { - const_iterator __tmp = *this; - return __tmp -= __i; - } - - const_reference - operator[](difference_type __i) const - { return *(*this + __i); } - }; - - inline _Bit_const_iterator - operator+(ptrdiff_t __n, const _Bit_const_iterator& __x) - { return __x + __n; } - - inline void - __fill_bvector(_Bit_iterator __first, _Bit_iterator __last, bool __x) - { - for (; __first != __last; ++__first) - *__first = __x; - } - - inline void - fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x) - { - if (__first._M_p != __last._M_p) - { - std::fill(__first._M_p + 1, __last._M_p, __x ? ~0 : 0); - __fill_bvector(__first, _Bit_iterator(__first._M_p + 1, 0), __x); - __fill_bvector(_Bit_iterator(__last._M_p, 0), __last, __x); - } - else - __fill_bvector(__first, __last, __x); - } - - template - struct _Bvector_base - { - typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template - rebind<_Bit_type>::other _Bit_alloc_type; - typedef typename __gnu_cxx::__alloc_traits<_Bit_alloc_type> - _Bit_alloc_traits; - typedef typename _Bit_alloc_traits::pointer _Bit_pointer; - - struct _Bvector_impl - : public _Bit_alloc_type - { - _Bit_iterator _M_start; - _Bit_iterator _M_finish; - _Bit_pointer _M_end_of_storage; - - _Bvector_impl() - : _Bit_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage() - { } - - _Bvector_impl(const _Bit_alloc_type& __a) - : _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage() - { } - -#if __cplusplus >= 201103L - _Bvector_impl(_Bit_alloc_type&& __a) - : _Bit_alloc_type(std::move(__a)), _M_start(), _M_finish(), - _M_end_of_storage() - { } -#endif - - _Bit_type* - _M_end_addr() const _GLIBCXX_NOEXCEPT - { - if (_M_end_of_storage) - return std::__addressof(_M_end_of_storage[-1]) + 1; - return 0; - } - }; - - public: - typedef _Alloc allocator_type; - - _Bit_alloc_type& - _M_get_Bit_allocator() _GLIBCXX_NOEXCEPT - { return *static_cast<_Bit_alloc_type*>(&this->_M_impl); } - - const _Bit_alloc_type& - _M_get_Bit_allocator() const _GLIBCXX_NOEXCEPT - { return *static_cast(&this->_M_impl); } - - allocator_type - get_allocator() const _GLIBCXX_NOEXCEPT - { return allocator_type(_M_get_Bit_allocator()); } - - _Bvector_base() - : _M_impl() { } - - _Bvector_base(const allocator_type& __a) - : _M_impl(__a) { } - -#if __cplusplus >= 201103L - _Bvector_base(_Bvector_base&& __x) noexcept - : _M_impl(std::move(__x._M_get_Bit_allocator())) - { - this->_M_impl._M_start = __x._M_impl._M_start; - this->_M_impl._M_finish = __x._M_impl._M_finish; - this->_M_impl._M_end_of_storage = __x._M_impl._M_end_of_storage; - __x._M_impl._M_start = _Bit_iterator(); - __x._M_impl._M_finish = _Bit_iterator(); - __x._M_impl._M_end_of_storage = nullptr; - } -#endif - - ~_Bvector_base() - { this->_M_deallocate(); } - - protected: - _Bvector_impl _M_impl; - - _Bit_pointer - _M_allocate(size_t __n) - { return _Bit_alloc_traits::allocate(_M_impl, _S_nword(__n)); } - - void - _M_deallocate() - { - if (_M_impl._M_start._M_p) - { - const size_t __n = _M_impl._M_end_addr() - _M_impl._M_start._M_p; - _Bit_alloc_traits::deallocate(_M_impl, - _M_impl._M_end_of_storage - __n, - __n); - } - } - - static size_t - _S_nword(size_t __n) - { return (__n + int(_S_word_bit) - 1) / int(_S_word_bit); } - }; - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -// Declare a partial specialization of vector. -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - /** - * @brief A specialization of vector for booleans which offers fixed time - * access to individual elements in any order. - * - * @ingroup sequences - * - * @tparam _Alloc Allocator type. - * - * Note that vector does not actually meet the requirements for being - * a container. This is because the reference and pointer types are not - * really references and pointers to bool. See DR96 for details. @see - * vector for function documentation. - * - * In some terminology a %vector can be described as a dynamic - * C-style array, it offers fast and efficient access to individual - * elements in any order and saves the user from worrying about - * memory and size allocation. Subscripting ( @c [] ) access is - * also provided as with C-style arrays. - */ -template - class vector : protected _Bvector_base<_Alloc> - { - typedef _Bvector_base<_Alloc> _Base; - typedef typename _Base::_Bit_pointer _Bit_pointer; - typedef typename _Base::_Bit_alloc_traits _Bit_alloc_traits; - -#if __cplusplus >= 201103L - template friend struct hash; -#endif - - public: - typedef bool value_type; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Bit_reference reference; - typedef bool const_reference; - typedef _Bit_reference* pointer; - typedef const bool* const_pointer; - typedef _Bit_iterator iterator; - typedef _Bit_const_iterator const_iterator; - typedef std::reverse_iterator const_reverse_iterator; - typedef std::reverse_iterator reverse_iterator; - typedef _Alloc allocator_type; - - allocator_type get_allocator() const - { return _Base::get_allocator(); } - - protected: - using _Base::_M_allocate; - using _Base::_M_deallocate; - using _Base::_S_nword; - using _Base::_M_get_Bit_allocator; - - public: - vector() -#if __cplusplus >= 201103L - noexcept(is_nothrow_default_constructible::value) -#endif - : _Base() { } - - explicit - vector(const allocator_type& __a) - : _Base(__a) { } - -#if __cplusplus >= 201103L - explicit - vector(size_type __n, const allocator_type& __a = allocator_type()) - : vector(__n, false, __a) - { } - - vector(size_type __n, const bool& __value, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { - _M_initialize(__n); - std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_addr(), - __value ? ~0 : 0); - } -#else - explicit - vector(size_type __n, const bool& __value = bool(), - const allocator_type& __a = allocator_type()) - : _Base(__a) - { - _M_initialize(__n); - std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_addr(), - __value ? ~0 : 0); - } -#endif - - vector(const vector& __x) - : _Base(_Bit_alloc_traits::_S_select_on_copy(__x._M_get_Bit_allocator())) - { - _M_initialize(__x.size()); - _M_copy_aligned(__x.begin(), __x.end(), this->_M_impl._M_start); - } - -#if __cplusplus >= 201103L - vector(vector&& __x) noexcept - : _Base(std::move(__x)) { } - - vector(vector&& __x, const allocator_type& __a) - noexcept(_Bit_alloc_traits::_S_always_equal()) - : _Base(__a) - { - if (__x.get_allocator() == __a) - { - this->_M_impl._M_start = __x._M_impl._M_start; - this->_M_impl._M_finish = __x._M_impl._M_finish; - this->_M_impl._M_end_of_storage = __x._M_impl._M_end_of_storage; - __x._M_impl._M_start = _Bit_iterator(); - __x._M_impl._M_finish = _Bit_iterator(); - __x._M_impl._M_end_of_storage = nullptr; - } - else - { - _M_initialize(__x.size()); - _M_copy_aligned(__x.begin(), __x.end(), begin()); - __x.clear(); - } - } - - vector(const vector& __x, const allocator_type& __a) - : _Base(__a) - { - _M_initialize(__x.size()); - _M_copy_aligned(__x.begin(), __x.end(), this->_M_impl._M_start); - } - - vector(initializer_list __l, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { - _M_initialize_range(__l.begin(), __l.end(), - random_access_iterator_tag()); - } -#endif - -#if __cplusplus >= 201103L - template> - vector(_InputIterator __first, _InputIterator __last, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { _M_initialize_dispatch(__first, __last, __false_type()); } -#else - template - vector(_InputIterator __first, _InputIterator __last, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - _M_initialize_dispatch(__first, __last, _Integral()); - } -#endif - - ~vector() _GLIBCXX_NOEXCEPT { } - - vector& - operator=(const vector& __x) - { - if (&__x == this) - return *this; -#if __cplusplus >= 201103L - if (_Bit_alloc_traits::_S_propagate_on_copy_assign()) - { - if (this->_M_get_Bit_allocator() != __x._M_get_Bit_allocator()) - { - this->_M_deallocate(); - std::__alloc_on_copy(_M_get_Bit_allocator(), - __x._M_get_Bit_allocator()); - _M_initialize(__x.size()); - } - else - std::__alloc_on_copy(_M_get_Bit_allocator(), - __x._M_get_Bit_allocator()); - } -#endif - if (__x.size() > capacity()) - { - this->_M_deallocate(); - _M_initialize(__x.size()); - } - this->_M_impl._M_finish = _M_copy_aligned(__x.begin(), __x.end(), - begin()); - return *this; - } - -#if __cplusplus >= 201103L - vector& - operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move()) - { - if (_Bit_alloc_traits::_S_propagate_on_move_assign() - || this->_M_get_Bit_allocator() == __x._M_get_Bit_allocator()) - { - this->_M_deallocate(); - this->_M_impl._M_start = __x._M_impl._M_start; - this->_M_impl._M_finish = __x._M_impl._M_finish; - this->_M_impl._M_end_of_storage = __x._M_impl._M_end_of_storage; - __x._M_impl._M_start = _Bit_iterator(); - __x._M_impl._M_finish = _Bit_iterator(); - __x._M_impl._M_end_of_storage = nullptr; - std::__alloc_on_move(_M_get_Bit_allocator(), - __x._M_get_Bit_allocator()); - } - else - { - if (__x.size() > capacity()) - { - this->_M_deallocate(); - _M_initialize(__x.size()); - } - this->_M_impl._M_finish = _M_copy_aligned(__x.begin(), __x.end(), - begin()); - __x.clear(); - } - return *this; - } - - vector& - operator=(initializer_list __l) - { - this->assign (__l.begin(), __l.end()); - return *this; - } -#endif - - // assign(), a generalized assignment member function. Two - // versions: one that takes a count, and one that takes a range. - // The range version is a member template, so we dispatch on whether - // or not the type is an integer. - void - assign(size_type __n, const bool& __x) - { _M_fill_assign(__n, __x); } - -#if __cplusplus >= 201103L - template> - void - assign(_InputIterator __first, _InputIterator __last) - { _M_assign_dispatch(__first, __last, __false_type()); } -#else - template - void - assign(_InputIterator __first, _InputIterator __last) - { - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } -#endif - -#if __cplusplus >= 201103L - void - assign(initializer_list __l) - { this->assign(__l.begin(), __l.end()); } -#endif - - iterator - begin() _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_start; } - - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_start; } - - iterator - end() _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_finish; } - - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_finish; } - - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return reverse_iterator(end()); } - - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(end()); } - - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return reverse_iterator(begin()); } - - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(begin()); } - -#if __cplusplus >= 201103L - const_iterator - cbegin() const noexcept - { return this->_M_impl._M_start; } - - const_iterator - cend() const noexcept - { return this->_M_impl._M_finish; } - - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(end()); } - - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(begin()); } -#endif - - size_type - size() const _GLIBCXX_NOEXCEPT - { return size_type(end() - begin()); } - - size_type - max_size() const _GLIBCXX_NOEXCEPT - { - const size_type __isize = - __gnu_cxx::__numeric_traits::__max - - int(_S_word_bit) + 1; - const size_type __asize - = _Bit_alloc_traits::max_size(_M_get_Bit_allocator()); - return (__asize <= __isize / int(_S_word_bit) - ? __asize * int(_S_word_bit) : __isize); - } - - size_type - capacity() const _GLIBCXX_NOEXCEPT - { return size_type(const_iterator(this->_M_impl._M_end_addr(), 0) - - begin()); } - - bool - empty() const _GLIBCXX_NOEXCEPT - { return begin() == end(); } - - reference - operator[](size_type __n) - { - return *iterator(this->_M_impl._M_start._M_p - + __n / int(_S_word_bit), __n % int(_S_word_bit)); - } - - const_reference - operator[](size_type __n) const - { - return *const_iterator(this->_M_impl._M_start._M_p - + __n / int(_S_word_bit), __n % int(_S_word_bit)); - } - - protected: - void - _M_range_check(size_type __n) const - { - if (__n >= this->size()) - __throw_out_of_range_fmt(__N("vector::_M_range_check: __n " - "(which is %zu) >= this->size() " - "(which is %zu)"), - __n, this->size()); - } - - public: - reference - at(size_type __n) - { _M_range_check(__n); return (*this)[__n]; } - - const_reference - at(size_type __n) const - { _M_range_check(__n); return (*this)[__n]; } - - void - reserve(size_type __n) - { - if (__n > max_size()) - __throw_length_error(__N("vector::reserve")); - if (capacity() < __n) - _M_reallocate(__n); - } - - reference - front() - { return *begin(); } - - const_reference - front() const - { return *begin(); } - - reference - back() - { return *(end() - 1); } - - const_reference - back() const - { return *(end() - 1); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 464. Suggestion for new member functions in standard containers. - // N.B. DR 464 says nothing about vector but we need something - // here due to the way we are implementing DR 464 in the debug-mode - // vector class. - void - data() _GLIBCXX_NOEXCEPT { } - - void - push_back(bool __x) - { - if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr()) - *this->_M_impl._M_finish++ = __x; - else - _M_insert_aux(end(), __x); - } - - void - swap(vector& __x) -#if __cplusplus >= 201103L - noexcept(_Bit_alloc_traits::_S_nothrow_swap()) -#endif - { - std::swap(this->_M_impl._M_start, __x._M_impl._M_start); - std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish); - std::swap(this->_M_impl._M_end_of_storage, - __x._M_impl._M_end_of_storage); - _Bit_alloc_traits::_S_on_swap(_M_get_Bit_allocator(), - __x._M_get_Bit_allocator()); - } - - // [23.2.5]/1, third-to-last entry in synopsis listing - static void - swap(reference __x, reference __y) _GLIBCXX_NOEXCEPT - { - bool __tmp = __x; - __x = __y; - __y = __tmp; - } - - iterator -#if __cplusplus >= 201103L - insert(const_iterator __position, const bool& __x = bool()) -#else - insert(iterator __position, const bool& __x = bool()) -#endif - { - const difference_type __n = __position - begin(); - if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr() - && __position == end()) - *this->_M_impl._M_finish++ = __x; - else - _M_insert_aux(__position._M_const_cast(), __x); - return begin() + __n; - } - -#if __cplusplus >= 201103L - template> - iterator - insert(const_iterator __position, - _InputIterator __first, _InputIterator __last) - { - difference_type __offset = __position - cbegin(); - _M_insert_dispatch(__position._M_const_cast(), - __first, __last, __false_type()); - return begin() + __offset; - } -#else - template - void - insert(iterator __position, - _InputIterator __first, _InputIterator __last) - { - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - _M_insert_dispatch(__position, __first, __last, _Integral()); - } -#endif - -#if __cplusplus >= 201103L - iterator - insert(const_iterator __position, size_type __n, const bool& __x) - { - difference_type __offset = __position - cbegin(); - _M_fill_insert(__position._M_const_cast(), __n, __x); - return begin() + __offset; - } -#else - void - insert(iterator __position, size_type __n, const bool& __x) - { _M_fill_insert(__position, __n, __x); } -#endif - -#if __cplusplus >= 201103L - iterator - insert(const_iterator __p, initializer_list __l) - { return this->insert(__p, __l.begin(), __l.end()); } -#endif - - void - pop_back() - { --this->_M_impl._M_finish; } - - iterator -#if __cplusplus >= 201103L - erase(const_iterator __position) -#else - erase(iterator __position) -#endif - { return _M_erase(__position._M_const_cast()); } - - iterator -#if __cplusplus >= 201103L - erase(const_iterator __first, const_iterator __last) -#else - erase(iterator __first, iterator __last) -#endif - { return _M_erase(__first._M_const_cast(), __last._M_const_cast()); } - - void - resize(size_type __new_size, bool __x = bool()) - { - if (__new_size < size()) - _M_erase_at_end(begin() + difference_type(__new_size)); - else - insert(end(), __new_size - size(), __x); - } - -#if __cplusplus >= 201103L - void - shrink_to_fit() - { _M_shrink_to_fit(); } -#endif - - void - flip() _GLIBCXX_NOEXCEPT - { - _Bit_type * const __end = this->_M_impl._M_end_addr(); - for (_Bit_type * __p = this->_M_impl._M_start._M_p; __p != __end; ++__p) - *__p = ~*__p; - } - - void - clear() _GLIBCXX_NOEXCEPT - { _M_erase_at_end(begin()); } - -#if __cplusplus >= 201103L - template - void - emplace_back(_Args&&... __args) - { push_back(bool(__args...)); } - - template - iterator - emplace(const_iterator __pos, _Args&&... __args) - { return insert(__pos, bool(__args...)); } -#endif - - protected: - // Precondition: __first._M_offset == 0 && __result._M_offset == 0. - iterator - _M_copy_aligned(const_iterator __first, const_iterator __last, - iterator __result) - { - _Bit_type* __q = std::copy(__first._M_p, __last._M_p, __result._M_p); - return std::copy(const_iterator(__last._M_p, 0), __last, - iterator(__q, 0)); - } - - void - _M_initialize(size_type __n) - { - _Bit_pointer __q = this->_M_allocate(__n); - this->_M_impl._M_end_of_storage = __q + _S_nword(__n); - this->_M_impl._M_start = iterator(std::__addressof(*__q), 0); - this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n); - } - - void - _M_reallocate(size_type __n); - -#if __cplusplus >= 201103L - bool - _M_shrink_to_fit(); -#endif - - // Check whether it's an integral type. If so, it's not an iterator. - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 438. Ambiguity in the "do the right thing" clause - template - void - _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) - { - _M_initialize(static_cast(__n)); - std::fill(this->_M_impl._M_start._M_p, - this->_M_impl._M_end_addr(), __x ? ~0 : 0); - } - - template - void - _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, - __false_type) - { _M_initialize_range(__first, __last, - std::__iterator_category(__first)); } - - template - void - _M_initialize_range(_InputIterator __first, _InputIterator __last, - std::input_iterator_tag) - { - for (; __first != __last; ++__first) - push_back(*__first); - } - - template - void - _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last, - std::forward_iterator_tag) - { - const size_type __n = std::distance(__first, __last); - _M_initialize(__n); - std::copy(__first, __last, this->_M_impl._M_start); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 438. Ambiguity in the "do the right thing" clause - template - void - _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) - { _M_fill_assign(__n, __val); } - - template - void - _M_assign_dispatch(_InputIterator __first, _InputIterator __last, - __false_type) - { _M_assign_aux(__first, __last, std::__iterator_category(__first)); } - - void - _M_fill_assign(size_t __n, bool __x) - { - if (__n > size()) - { - std::fill(this->_M_impl._M_start._M_p, - this->_M_impl._M_end_addr(), __x ? ~0 : 0); - insert(end(), __n - size(), __x); - } - else - { - _M_erase_at_end(begin() + __n); - std::fill(this->_M_impl._M_start._M_p, - this->_M_impl._M_end_addr(), __x ? ~0 : 0); - } - } - - template - void - _M_assign_aux(_InputIterator __first, _InputIterator __last, - std::input_iterator_tag) - { - iterator __cur = begin(); - for (; __first != __last && __cur != end(); ++__cur, ++__first) - *__cur = *__first; - if (__first == __last) - _M_erase_at_end(__cur); - else - insert(end(), __first, __last); - } - - template - void - _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, - std::forward_iterator_tag) - { - const size_type __len = std::distance(__first, __last); - if (__len < size()) - _M_erase_at_end(std::copy(__first, __last, begin())); - else - { - _ForwardIterator __mid = __first; - std::advance(__mid, size()); - std::copy(__first, __mid, begin()); - insert(end(), __mid, __last); - } - } - - // Check whether it's an integral type. If so, it's not an iterator. - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 438. Ambiguity in the "do the right thing" clause - template - void - _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, - __true_type) - { _M_fill_insert(__pos, __n, __x); } - - template - void - _M_insert_dispatch(iterator __pos, - _InputIterator __first, _InputIterator __last, - __false_type) - { _M_insert_range(__pos, __first, __last, - std::__iterator_category(__first)); } - - void - _M_fill_insert(iterator __position, size_type __n, bool __x); - - template - void - _M_insert_range(iterator __pos, _InputIterator __first, - _InputIterator __last, std::input_iterator_tag) - { - for (; __first != __last; ++__first) - { - __pos = insert(__pos, *__first); - ++__pos; - } - } - - template - void - _M_insert_range(iterator __position, _ForwardIterator __first, - _ForwardIterator __last, std::forward_iterator_tag); - - void - _M_insert_aux(iterator __position, bool __x); - - size_type - _M_check_len(size_type __n, const char* __s) const - { - if (max_size() - size() < __n) - __throw_length_error(__N(__s)); - - const size_type __len = size() + std::max(size(), __n); - return (__len < size() || __len > max_size()) ? max_size() : __len; - } - - void - _M_erase_at_end(iterator __pos) - { this->_M_impl._M_finish = __pos; } - - iterator - _M_erase(iterator __pos); - - iterator - _M_erase(iterator __first, iterator __last); - }; - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#if __cplusplus >= 201103L - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // DR 1182. - /// std::hash specialization for vector. - template - struct hash<_GLIBCXX_STD_C::vector> - : public __hash_base> - { - size_t - operator()(const _GLIBCXX_STD_C::vector&) const noexcept; - }; - -_GLIBCXX_END_NAMESPACE_VERSION -}// namespace std - -#endif // C++11 - -#endif diff --git a/openflow/usr/include/c++/5/bits/stl_construct.h b/openflow/usr/include/c++/5/bits/stl_construct.h deleted file mode 100644 index 5933d2d..0000000 --- a/openflow/usr/include/c++/5/bits/stl_construct.h +++ /dev/null @@ -1,158 +0,0 @@ -// nonstandard construct and destroy functions -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_construct.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _STL_CONSTRUCT_H -#define _STL_CONSTRUCT_H 1 - -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * Constructs an object in existing memory by invoking an allocated - * object's constructor with an initializer. - */ -#if __cplusplus >= 201103L - template - inline void - _Construct(_T1* __p, _Args&&... __args) - { ::new(static_cast(__p)) _T1(std::forward<_Args>(__args)...); } -#else - template - inline void - _Construct(_T1* __p, const _T2& __value) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 402. wrong new expression in [some_]allocator::construct - ::new(static_cast(__p)) _T1(__value); - } -#endif - - /** - * Destroy the object pointed to by a pointer type. - */ - template - inline void - _Destroy(_Tp* __pointer) - { __pointer->~_Tp(); } - - template - struct _Destroy_aux - { - template - static void - __destroy(_ForwardIterator __first, _ForwardIterator __last) - { - for (; __first != __last; ++__first) - std::_Destroy(std::__addressof(*__first)); - } - }; - - template<> - struct _Destroy_aux - { - template - static void - __destroy(_ForwardIterator, _ForwardIterator) { } - }; - - /** - * Destroy a range of objects. If the value_type of the object has - * a trivial destructor, the compiler should optimize all of this - * away, otherwise the objects' destructors must be invoked. - */ - template - inline void - _Destroy(_ForwardIterator __first, _ForwardIterator __last) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _Value_type; - std::_Destroy_aux<__has_trivial_destructor(_Value_type)>:: - __destroy(__first, __last); - } - - /** - * Destroy a range of objects using the supplied allocator. For - * nondefault allocators we do not optimize away invocation of - * destroy() even if _Tp has a trivial destructor. - */ - - template - void - _Destroy(_ForwardIterator __first, _ForwardIterator __last, - _Allocator& __alloc) - { - typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; - for (; __first != __last; ++__first) - __traits::destroy(__alloc, std::__addressof(*__first)); - } - - template - inline void - _Destroy(_ForwardIterator __first, _ForwardIterator __last, - allocator<_Tp>&) - { - _Destroy(__first, __last); - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif /* _STL_CONSTRUCT_H */ - diff --git a/openflow/usr/include/c++/5/bits/stl_deque.h b/openflow/usr/include/c++/5/bits/stl_deque.h deleted file mode 100644 index fa36023..0000000 --- a/openflow/usr/include/c++/5/bits/stl_deque.h +++ /dev/null @@ -1,2282 +0,0 @@ -// Deque implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_deque.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{deque} - */ - -#ifndef _STL_DEQUE_H -#define _STL_DEQUE_H 1 - -#include -#include -#include -#if __cplusplus >= 201103L -#include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - /** - * @brief This function controls the size of memory nodes. - * @param __size The size of an element. - * @return The number (not byte size) of elements per node. - * - * This function started off as a compiler kludge from SGI, but - * seems to be a useful wrapper around a repeated constant - * expression. The @b 512 is tunable (and no other code needs to - * change), but no investigation has been done since inheriting the - * SGI code. Touch _GLIBCXX_DEQUE_BUF_SIZE only if you know what - * you are doing, however: changing it breaks the binary - * compatibility!! - */ - -#ifndef _GLIBCXX_DEQUE_BUF_SIZE -#define _GLIBCXX_DEQUE_BUF_SIZE 512 -#endif - - _GLIBCXX_CONSTEXPR inline size_t - __deque_buf_size(size_t __size) - { return (__size < _GLIBCXX_DEQUE_BUF_SIZE - ? size_t(_GLIBCXX_DEQUE_BUF_SIZE / __size) : size_t(1)); } - - - /** - * @brief A deque::iterator. - * - * Quite a bit of intelligence here. Much of the functionality of - * deque is actually passed off to this class. A deque holds two - * of these internally, marking its valid range. Access to - * elements is done as offsets of either of those two, relying on - * operator overloading in this class. - * - * All the functions are op overloads except for _M_set_node. - */ - template - struct _Deque_iterator - { -#if __cplusplus < 201103L - typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator; - typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; - typedef _Tp* _Elt_pointer; - typedef _Tp** _Map_pointer; -#else - private: - template - using __ptr_to = typename pointer_traits<_Ptr>::template rebind<_Up>; - template - using __iter = _Deque_iterator<_Tp, _CvTp&, __ptr_to<_CvTp>>; - public: - typedef __iter<_Tp> iterator; - typedef __iter const_iterator; - typedef __ptr_to<_Tp> _Elt_pointer; - typedef __ptr_to<_Elt_pointer> _Map_pointer; -#endif - - static size_t _S_buffer_size() _GLIBCXX_NOEXCEPT - { return __deque_buf_size(sizeof(_Tp)); } - - typedef std::random_access_iterator_tag iterator_category; - typedef _Tp value_type; - typedef _Ptr pointer; - typedef _Ref reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Deque_iterator _Self; - - _Elt_pointer _M_cur; - _Elt_pointer _M_first; - _Elt_pointer _M_last; - _Map_pointer _M_node; - - _Deque_iterator(_Elt_pointer __x, _Map_pointer __y) _GLIBCXX_NOEXCEPT - : _M_cur(__x), _M_first(*__y), - _M_last(*__y + _S_buffer_size()), _M_node(__y) { } - - _Deque_iterator() _GLIBCXX_NOEXCEPT - : _M_cur(), _M_first(), _M_last(), _M_node() { } - - _Deque_iterator(const iterator& __x) _GLIBCXX_NOEXCEPT - : _M_cur(__x._M_cur), _M_first(__x._M_first), - _M_last(__x._M_last), _M_node(__x._M_node) { } - - iterator - _M_const_cast() const _GLIBCXX_NOEXCEPT - { return iterator(_M_cur, _M_node); } - - reference - operator*() const _GLIBCXX_NOEXCEPT - { return *_M_cur; } - - pointer - operator->() const _GLIBCXX_NOEXCEPT - { return _M_cur; } - - _Self& - operator++() _GLIBCXX_NOEXCEPT - { - ++_M_cur; - if (_M_cur == _M_last) - { - _M_set_node(_M_node + 1); - _M_cur = _M_first; - } - return *this; - } - - _Self - operator++(int) _GLIBCXX_NOEXCEPT - { - _Self __tmp = *this; - ++*this; - return __tmp; - } - - _Self& - operator--() _GLIBCXX_NOEXCEPT - { - if (_M_cur == _M_first) - { - _M_set_node(_M_node - 1); - _M_cur = _M_last; - } - --_M_cur; - return *this; - } - - _Self - operator--(int) _GLIBCXX_NOEXCEPT - { - _Self __tmp = *this; - --*this; - return __tmp; - } - - _Self& - operator+=(difference_type __n) _GLIBCXX_NOEXCEPT - { - const difference_type __offset = __n + (_M_cur - _M_first); - if (__offset >= 0 && __offset < difference_type(_S_buffer_size())) - _M_cur += __n; - else - { - const difference_type __node_offset = - __offset > 0 ? __offset / difference_type(_S_buffer_size()) - : -difference_type((-__offset - 1) - / _S_buffer_size()) - 1; - _M_set_node(_M_node + __node_offset); - _M_cur = _M_first + (__offset - __node_offset - * difference_type(_S_buffer_size())); - } - return *this; - } - - _Self - operator+(difference_type __n) const _GLIBCXX_NOEXCEPT - { - _Self __tmp = *this; - return __tmp += __n; - } - - _Self& - operator-=(difference_type __n) _GLIBCXX_NOEXCEPT - { return *this += -__n; } - - _Self - operator-(difference_type __n) const _GLIBCXX_NOEXCEPT - { - _Self __tmp = *this; - return __tmp -= __n; - } - - reference - operator[](difference_type __n) const _GLIBCXX_NOEXCEPT - { return *(*this + __n); } - - /** - * Prepares to traverse new_node. Sets everything except - * _M_cur, which should therefore be set by the caller - * immediately afterwards, based on _M_first and _M_last. - */ - void - _M_set_node(_Map_pointer __new_node) _GLIBCXX_NOEXCEPT - { - _M_node = __new_node; - _M_first = *__new_node; - _M_last = _M_first + difference_type(_S_buffer_size()); - } - }; - - // Note: we also provide overloads whose operands are of the same type in - // order to avoid ambiguous overload resolution when std::rel_ops operators - // are in scope (for additional details, see libstdc++/3628) - template - inline bool - operator==(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, - const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT - { return __x._M_cur == __y._M_cur; } - - template - inline bool - operator==(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, - const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT - { return __x._M_cur == __y._M_cur; } - - template - inline bool - operator!=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, - const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT - { return !(__x == __y); } - - template - inline bool - operator!=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, - const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT - { return !(__x == __y); } - - template - inline bool - operator<(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, - const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT - { return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur) - : (__x._M_node < __y._M_node); } - - template - inline bool - operator<(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, - const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT - { return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur) - : (__x._M_node < __y._M_node); } - - template - inline bool - operator>(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, - const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT - { return __y < __x; } - - template - inline bool - operator>(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, - const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT - { return __y < __x; } - - template - inline bool - operator<=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, - const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT - { return !(__y < __x); } - - template - inline bool - operator<=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, - const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT - { return !(__y < __x); } - - template - inline bool - operator>=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, - const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT - { return !(__x < __y); } - - template - inline bool - operator>=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, - const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT - { return !(__x < __y); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // According to the resolution of DR179 not only the various comparison - // operators but also operator- must accept mixed iterator/const_iterator - // parameters. - template - inline typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type - operator-(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, - const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT - { - return typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type - (_Deque_iterator<_Tp, _Ref, _Ptr>::_S_buffer_size()) - * (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first) - + (__y._M_last - __y._M_cur); - } - - template - inline typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type - operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, - const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT - { - return typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type - (_Deque_iterator<_Tp, _RefL, _PtrL>::_S_buffer_size()) - * (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first) - + (__y._M_last - __y._M_cur); - } - - template - inline _Deque_iterator<_Tp, _Ref, _Ptr> - operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x) - _GLIBCXX_NOEXCEPT - { return __x + __n; } - - template - void - fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>&, - const _Deque_iterator<_Tp, _Tp&, _Tp*>&, const _Tp&); - - template - _Deque_iterator<_Tp, _Tp&, _Tp*> - copy(_Deque_iterator<_Tp, const _Tp&, const _Tp*>, - _Deque_iterator<_Tp, const _Tp&, const _Tp*>, - _Deque_iterator<_Tp, _Tp&, _Tp*>); - - template - inline _Deque_iterator<_Tp, _Tp&, _Tp*> - copy(_Deque_iterator<_Tp, _Tp&, _Tp*> __first, - _Deque_iterator<_Tp, _Tp&, _Tp*> __last, - _Deque_iterator<_Tp, _Tp&, _Tp*> __result) - { return std::copy(_Deque_iterator<_Tp, const _Tp&, const _Tp*>(__first), - _Deque_iterator<_Tp, const _Tp&, const _Tp*>(__last), - __result); } - - template - _Deque_iterator<_Tp, _Tp&, _Tp*> - copy_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*>, - _Deque_iterator<_Tp, const _Tp&, const _Tp*>, - _Deque_iterator<_Tp, _Tp&, _Tp*>); - - template - inline _Deque_iterator<_Tp, _Tp&, _Tp*> - copy_backward(_Deque_iterator<_Tp, _Tp&, _Tp*> __first, - _Deque_iterator<_Tp, _Tp&, _Tp*> __last, - _Deque_iterator<_Tp, _Tp&, _Tp*> __result) - { return std::copy_backward(_Deque_iterator<_Tp, - const _Tp&, const _Tp*>(__first), - _Deque_iterator<_Tp, - const _Tp&, const _Tp*>(__last), - __result); } - -#if __cplusplus >= 201103L - template - _Deque_iterator<_Tp, _Tp&, _Tp*> - move(_Deque_iterator<_Tp, const _Tp&, const _Tp*>, - _Deque_iterator<_Tp, const _Tp&, const _Tp*>, - _Deque_iterator<_Tp, _Tp&, _Tp*>); - - template - inline _Deque_iterator<_Tp, _Tp&, _Tp*> - move(_Deque_iterator<_Tp, _Tp&, _Tp*> __first, - _Deque_iterator<_Tp, _Tp&, _Tp*> __last, - _Deque_iterator<_Tp, _Tp&, _Tp*> __result) - { return std::move(_Deque_iterator<_Tp, const _Tp&, const _Tp*>(__first), - _Deque_iterator<_Tp, const _Tp&, const _Tp*>(__last), - __result); } - - template - _Deque_iterator<_Tp, _Tp&, _Tp*> - move_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*>, - _Deque_iterator<_Tp, const _Tp&, const _Tp*>, - _Deque_iterator<_Tp, _Tp&, _Tp*>); - - template - inline _Deque_iterator<_Tp, _Tp&, _Tp*> - move_backward(_Deque_iterator<_Tp, _Tp&, _Tp*> __first, - _Deque_iterator<_Tp, _Tp&, _Tp*> __last, - _Deque_iterator<_Tp, _Tp&, _Tp*> __result) - { return std::move_backward(_Deque_iterator<_Tp, - const _Tp&, const _Tp*>(__first), - _Deque_iterator<_Tp, - const _Tp&, const _Tp*>(__last), - __result); } -#endif - - /** - * Deque base class. This class provides the unified face for %deque's - * allocation. This class's constructor and destructor allocate and - * deallocate (but do not initialize) storage. This makes %exception - * safety easier. - * - * Nothing in this class ever constructs or destroys an actual Tp element. - * (Deque handles that itself.) Only/All memory management is performed - * here. - */ - template - class _Deque_base - { - protected: - typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template - rebind<_Tp>::other _Tp_alloc_type; - typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits; - -#if __cplusplus < 201103L - typedef _Tp* _Ptr; - typedef const _Tp* _Ptr_const; -#else - typedef typename _Alloc_traits::pointer _Ptr; - typedef typename _Alloc_traits::const_pointer _Ptr_const; -#endif - - typedef typename _Alloc_traits::template rebind<_Ptr>::other - _Map_alloc_type; - typedef __gnu_cxx::__alloc_traits<_Map_alloc_type> _Map_alloc_traits; - - public: - typedef _Alloc allocator_type; - typedef typename _Alloc_traits::size_type size_type; - - allocator_type - get_allocator() const _GLIBCXX_NOEXCEPT - { return allocator_type(_M_get_Tp_allocator()); } - - typedef _Deque_iterator<_Tp, _Tp&, _Ptr> iterator; - typedef _Deque_iterator<_Tp, const _Tp&, _Ptr_const> const_iterator; - - _Deque_base() - : _M_impl() - { _M_initialize_map(0); } - - _Deque_base(size_t __num_elements) - : _M_impl() - { _M_initialize_map(__num_elements); } - - _Deque_base(const allocator_type& __a, size_t __num_elements) - : _M_impl(__a) - { _M_initialize_map(__num_elements); } - - _Deque_base(const allocator_type& __a) - : _M_impl(__a) - { /* Caller must initialize map. */ } - -#if __cplusplus >= 201103L - _Deque_base(_Deque_base&& __x, false_type) - : _M_impl(__x._M_move_impl()) - { } - - _Deque_base(_Deque_base&& __x, true_type) - : _M_impl(std::move(__x._M_get_Tp_allocator())) - { - _M_initialize_map(0); - if (__x._M_impl._M_map) - this->_M_impl._M_swap_data(__x._M_impl); - } - - _Deque_base(_Deque_base&& __x) - : _Deque_base(std::move(__x), - __gnu_cxx::__allocator_always_compares_equal<_Alloc>{}) - { } - - _Deque_base(_Deque_base&& __x, const allocator_type& __a, size_type __n) - : _M_impl(__a) - { - if (__x.get_allocator() == __a) - { - if (__x._M_impl._M_map) - { - _M_initialize_map(0); - this->_M_impl._M_swap_data(__x._M_impl); - } - } - else - { - _M_initialize_map(__n); - } - } -#endif - - ~_Deque_base() _GLIBCXX_NOEXCEPT; - - protected: - typedef typename iterator::_Map_pointer _Map_pointer; - - //This struct encapsulates the implementation of the std::deque - //standard container and at the same time makes use of the EBO - //for empty allocators. - struct _Deque_impl - : public _Tp_alloc_type - { - _Map_pointer _M_map; - size_t _M_map_size; - iterator _M_start; - iterator _M_finish; - - _Deque_impl() - : _Tp_alloc_type(), _M_map(), _M_map_size(0), - _M_start(), _M_finish() - { } - - _Deque_impl(const _Tp_alloc_type& __a) _GLIBCXX_NOEXCEPT - : _Tp_alloc_type(__a), _M_map(), _M_map_size(0), - _M_start(), _M_finish() - { } - -#if __cplusplus >= 201103L - _Deque_impl(_Deque_impl&&) = default; - - _Deque_impl(_Tp_alloc_type&& __a) noexcept - : _Tp_alloc_type(std::move(__a)), _M_map(), _M_map_size(0), - _M_start(), _M_finish() - { } -#endif - - void _M_swap_data(_Deque_impl& __x) _GLIBCXX_NOEXCEPT - { - using std::swap; - swap(this->_M_start, __x._M_start); - swap(this->_M_finish, __x._M_finish); - swap(this->_M_map, __x._M_map); - swap(this->_M_map_size, __x._M_map_size); - } - }; - - _Tp_alloc_type& - _M_get_Tp_allocator() _GLIBCXX_NOEXCEPT - { return *static_cast<_Tp_alloc_type*>(&this->_M_impl); } - - const _Tp_alloc_type& - _M_get_Tp_allocator() const _GLIBCXX_NOEXCEPT - { return *static_cast(&this->_M_impl); } - - _Map_alloc_type - _M_get_map_allocator() const _GLIBCXX_NOEXCEPT - { return _Map_alloc_type(_M_get_Tp_allocator()); } - - _Ptr - _M_allocate_node() - { - typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Traits; - return _Traits::allocate(_M_impl, __deque_buf_size(sizeof(_Tp))); - } - - void - _M_deallocate_node(_Ptr __p) _GLIBCXX_NOEXCEPT - { - typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Traits; - _Traits::deallocate(_M_impl, __p, __deque_buf_size(sizeof(_Tp))); - } - - _Map_pointer - _M_allocate_map(size_t __n) - { - _Map_alloc_type __map_alloc = _M_get_map_allocator(); - return _Map_alloc_traits::allocate(__map_alloc, __n); - } - - void - _M_deallocate_map(_Map_pointer __p, size_t __n) _GLIBCXX_NOEXCEPT - { - _Map_alloc_type __map_alloc = _M_get_map_allocator(); - _Map_alloc_traits::deallocate(__map_alloc, __p, __n); - } - - protected: - void _M_initialize_map(size_t); - void _M_create_nodes(_Map_pointer __nstart, _Map_pointer __nfinish); - void _M_destroy_nodes(_Map_pointer __nstart, - _Map_pointer __nfinish) _GLIBCXX_NOEXCEPT; - enum { _S_initial_map_size = 8 }; - - _Deque_impl _M_impl; - -#if __cplusplus >= 201103L - private: - _Deque_impl - _M_move_impl() - { - if (!_M_impl._M_map) - return std::move(_M_impl); - - // Create a copy of the current allocator. - _Tp_alloc_type __alloc{_M_get_Tp_allocator()}; - // Put that copy in a moved-from state. - _Tp_alloc_type __sink __attribute((__unused__)) {std::move(__alloc)}; - // Create an empty map that allocates using the moved-from allocator. - _Deque_base __empty{__alloc}; - __empty._M_initialize_map(0); - // Now safe to modify current allocator and perform non-throwing swaps. - _Deque_impl __ret{std::move(_M_get_Tp_allocator())}; - _M_impl._M_swap_data(__ret); - _M_impl._M_swap_data(__empty._M_impl); - return __ret; - } -#endif - }; - - template - _Deque_base<_Tp, _Alloc>:: - ~_Deque_base() _GLIBCXX_NOEXCEPT - { - if (this->_M_impl._M_map) - { - _M_destroy_nodes(this->_M_impl._M_start._M_node, - this->_M_impl._M_finish._M_node + 1); - _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size); - } - } - - /** - * @brief Layout storage. - * @param __num_elements The count of T's for which to allocate space - * at first. - * @return Nothing. - * - * The initial underlying memory layout is a bit complicated... - */ - template - void - _Deque_base<_Tp, _Alloc>:: - _M_initialize_map(size_t __num_elements) - { - const size_t __num_nodes = (__num_elements/ __deque_buf_size(sizeof(_Tp)) - + 1); - - this->_M_impl._M_map_size = std::max((size_t) _S_initial_map_size, - size_t(__num_nodes + 2)); - this->_M_impl._M_map = _M_allocate_map(this->_M_impl._M_map_size); - - // For "small" maps (needing less than _M_map_size nodes), allocation - // starts in the middle elements and grows outwards. So nstart may be - // the beginning of _M_map, but for small maps it may be as far in as - // _M_map+3. - - _Map_pointer __nstart = (this->_M_impl._M_map - + (this->_M_impl._M_map_size - __num_nodes) / 2); - _Map_pointer __nfinish = __nstart + __num_nodes; - - __try - { _M_create_nodes(__nstart, __nfinish); } - __catch(...) - { - _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size); - this->_M_impl._M_map = _Map_pointer(); - this->_M_impl._M_map_size = 0; - __throw_exception_again; - } - - this->_M_impl._M_start._M_set_node(__nstart); - this->_M_impl._M_finish._M_set_node(__nfinish - 1); - this->_M_impl._M_start._M_cur = _M_impl._M_start._M_first; - this->_M_impl._M_finish._M_cur = (this->_M_impl._M_finish._M_first - + __num_elements - % __deque_buf_size(sizeof(_Tp))); - } - - template - void - _Deque_base<_Tp, _Alloc>:: - _M_create_nodes(_Map_pointer __nstart, _Map_pointer __nfinish) - { - _Map_pointer __cur; - __try - { - for (__cur = __nstart; __cur < __nfinish; ++__cur) - *__cur = this->_M_allocate_node(); - } - __catch(...) - { - _M_destroy_nodes(__nstart, __cur); - __throw_exception_again; - } - } - - template - void - _Deque_base<_Tp, _Alloc>:: - _M_destroy_nodes(_Map_pointer __nstart, - _Map_pointer __nfinish) _GLIBCXX_NOEXCEPT - { - for (_Map_pointer __n = __nstart; __n < __nfinish; ++__n) - _M_deallocate_node(*__n); - } - - /** - * @brief A standard container using fixed-size memory allocation and - * constant-time manipulation of elements at either end. - * - * @ingroup sequences - * - * @tparam _Tp Type of element. - * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. - * - * Meets the requirements of a container, a - * reversible container, and a - * sequence, including the - * optional sequence requirements. - * - * In previous HP/SGI versions of deque, there was an extra template - * parameter so users could control the node size. This extension turned - * out to violate the C++ standard (it can be detected using template - * template parameters), and it was removed. - * - * Here's how a deque manages memory. Each deque has 4 members: - * - * - Tp** _M_map - * - size_t _M_map_size - * - iterator _M_start, _M_finish - * - * map_size is at least 8. %map is an array of map_size - * pointers-to-@a nodes. (The name %map has nothing to do with the - * std::map class, and @b nodes should not be confused with - * std::list's usage of @a node.) - * - * A @a node has no specific type name as such, but it is referred - * to as @a node in this file. It is a simple array-of-Tp. If Tp - * is very large, there will be one Tp element per node (i.e., an - * @a array of one). For non-huge Tp's, node size is inversely - * related to Tp size: the larger the Tp, the fewer Tp's will fit - * in a node. The goal here is to keep the total size of a node - * relatively small and constant over different Tp's, to improve - * allocator efficiency. - * - * Not every pointer in the %map array will point to a node. If - * the initial number of elements in the deque is small, the - * /middle/ %map pointers will be valid, and the ones at the edges - * will be unused. This same situation will arise as the %map - * grows: available %map pointers, if any, will be on the ends. As - * new nodes are created, only a subset of the %map's pointers need - * to be copied @a outward. - * - * Class invariants: - * - For any nonsingular iterator i: - * - i.node points to a member of the %map array. (Yes, you read that - * correctly: i.node does not actually point to a node.) The member of - * the %map array is what actually points to the node. - * - i.first == *(i.node) (This points to the node (first Tp element).) - * - i.last == i.first + node_size - * - i.cur is a pointer in the range [i.first, i.last). NOTE: - * the implication of this is that i.cur is always a dereferenceable - * pointer, even if i is a past-the-end iterator. - * - Start and Finish are always nonsingular iterators. NOTE: this - * means that an empty deque must have one node, a deque with > - class deque : protected _Deque_base<_Tp, _Alloc> - { - // concept requirements - typedef typename _Alloc::value_type _Alloc_value_type; - __glibcxx_class_requires(_Tp, _SGIAssignableConcept) - __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept) - - typedef _Deque_base<_Tp, _Alloc> _Base; - typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; - typedef typename _Base::_Alloc_traits _Alloc_traits; - typedef typename _Base::_Map_pointer _Map_pointer; - - public: - typedef _Tp value_type; - typedef typename _Alloc_traits::pointer pointer; - typedef typename _Alloc_traits::const_pointer const_pointer; - typedef typename _Alloc_traits::reference reference; - typedef typename _Alloc_traits::const_reference const_reference; - typedef typename _Base::iterator iterator; - typedef typename _Base::const_iterator const_iterator; - typedef std::reverse_iterator const_reverse_iterator; - typedef std::reverse_iterator reverse_iterator; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Alloc allocator_type; - - protected: - static size_t _S_buffer_size() _GLIBCXX_NOEXCEPT - { return __deque_buf_size(sizeof(_Tp)); } - - // Functions controlling memory layout, and nothing else. - using _Base::_M_initialize_map; - using _Base::_M_create_nodes; - using _Base::_M_destroy_nodes; - using _Base::_M_allocate_node; - using _Base::_M_deallocate_node; - using _Base::_M_allocate_map; - using _Base::_M_deallocate_map; - using _Base::_M_get_Tp_allocator; - - /** - * A total of four data members accumulated down the hierarchy. - * May be accessed via _M_impl.* - */ - using _Base::_M_impl; - - public: - // [23.2.1.1] construct/copy/destroy - // (assign() and get_allocator() are also listed in this section) - - /** - * @brief Creates a %deque with no elements. - */ - deque() : _Base() { } - - /** - * @brief Creates a %deque with no elements. - * @param __a An allocator object. - */ - explicit - deque(const allocator_type& __a) - : _Base(__a, 0) { } - -#if __cplusplus >= 201103L - /** - * @brief Creates a %deque with default constructed elements. - * @param __n The number of elements to initially create. - * - * This constructor fills the %deque with @a n default - * constructed elements. - */ - explicit - deque(size_type __n, const allocator_type& __a = allocator_type()) - : _Base(__a, __n) - { _M_default_initialize(); } - - /** - * @brief Creates a %deque with copies of an exemplar element. - * @param __n The number of elements to initially create. - * @param __value An element to copy. - * @param __a An allocator. - * - * This constructor fills the %deque with @a __n copies of @a __value. - */ - deque(size_type __n, const value_type& __value, - const allocator_type& __a = allocator_type()) - : _Base(__a, __n) - { _M_fill_initialize(__value); } -#else - /** - * @brief Creates a %deque with copies of an exemplar element. - * @param __n The number of elements to initially create. - * @param __value An element to copy. - * @param __a An allocator. - * - * This constructor fills the %deque with @a __n copies of @a __value. - */ - explicit - deque(size_type __n, const value_type& __value = value_type(), - const allocator_type& __a = allocator_type()) - : _Base(__a, __n) - { _M_fill_initialize(__value); } -#endif - - /** - * @brief %Deque copy constructor. - * @param __x A %deque of identical element and allocator types. - * - * The newly-created %deque uses a copy of the allocation object used - * by @a __x. - */ - deque(const deque& __x) - : _Base(_Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator()), - __x.size()) - { std::__uninitialized_copy_a(__x.begin(), __x.end(), - this->_M_impl._M_start, - _M_get_Tp_allocator()); } - -#if __cplusplus >= 201103L - /** - * @brief %Deque move constructor. - * @param __x A %deque of identical element and allocator types. - * - * The newly-created %deque contains the exact contents of @a __x. - * The contents of @a __x are a valid, but unspecified %deque. - */ - deque(deque&& __x) - : _Base(std::move(__x)) { } - - /// Copy constructor with alternative allocator - deque(const deque& __x, const allocator_type& __a) - : _Base(__a, __x.size()) - { std::__uninitialized_copy_a(__x.begin(), __x.end(), - this->_M_impl._M_start, - _M_get_Tp_allocator()); } - - /// Move constructor with alternative allocator - deque(deque&& __x, const allocator_type& __a) - : _Base(std::move(__x), __a, __x.size()) - { - if (__x.get_allocator() != __a) - { - std::__uninitialized_move_a(__x.begin(), __x.end(), - this->_M_impl._M_start, - _M_get_Tp_allocator()); - __x.clear(); - } - } - - /** - * @brief Builds a %deque from an initializer list. - * @param __l An initializer_list. - * @param __a An allocator object. - * - * Create a %deque consisting of copies of the elements in the - * initializer_list @a __l. - * - * This will call the element type's copy constructor N times - * (where N is __l.size()) and do no memory reallocation. - */ - deque(initializer_list __l, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { - _M_range_initialize(__l.begin(), __l.end(), - random_access_iterator_tag()); - } -#endif - - /** - * @brief Builds a %deque from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __a An allocator object. - * - * Create a %deque consisting of copies of the elements from [__first, - * __last). - * - * If the iterators are forward, bidirectional, or random-access, then - * this will call the elements' copy constructor N times (where N is - * distance(__first,__last)) and do no memory reallocation. But if only - * input iterators are used, then this will do at most 2N calls to the - * copy constructor, and logN memory reallocations. - */ -#if __cplusplus >= 201103L - template> - deque(_InputIterator __first, _InputIterator __last, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { _M_initialize_dispatch(__first, __last, __false_type()); } -#else - template - deque(_InputIterator __first, _InputIterator __last, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { - // Check whether it's an integral type. If so, it's not an iterator. - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - _M_initialize_dispatch(__first, __last, _Integral()); - } -#endif - - /** - * The dtor only erases the elements, and note that if the elements - * themselves are pointers, the pointed-to memory is not touched in any - * way. Managing the pointer is the user's responsibility. - */ - ~deque() - { _M_destroy_data(begin(), end(), _M_get_Tp_allocator()); } - - /** - * @brief %Deque assignment operator. - * @param __x A %deque of identical element and allocator types. - * - * All the elements of @a x are copied, but unlike the copy constructor, - * the allocator object is not copied. - */ - deque& - operator=(const deque& __x); - -#if __cplusplus >= 201103L - /** - * @brief %Deque move assignment operator. - * @param __x A %deque of identical element and allocator types. - * - * The contents of @a __x are moved into this deque (without copying, - * if the allocators permit it). - * @a __x is a valid, but unspecified %deque. - */ - deque& - operator=(deque&& __x) noexcept(_Alloc_traits::_S_always_equal()) - { - constexpr bool __always_equal = _Alloc_traits::_S_always_equal(); - _M_move_assign1(std::move(__x), - integral_constant()); - return *this; - } - - /** - * @brief Assigns an initializer list to a %deque. - * @param __l An initializer_list. - * - * This function fills a %deque with copies of the elements in the - * initializer_list @a __l. - * - * Note that the assignment completely changes the %deque and that the - * resulting %deque's size is the same as the number of elements - * assigned. Old data may be lost. - */ - deque& - operator=(initializer_list __l) - { - this->assign(__l.begin(), __l.end()); - return *this; - } -#endif - - /** - * @brief Assigns a given value to a %deque. - * @param __n Number of elements to be assigned. - * @param __val Value to be assigned. - * - * This function fills a %deque with @a n copies of the given - * value. Note that the assignment completely changes the - * %deque and that the resulting %deque's size is the same as - * the number of elements assigned. Old data may be lost. - */ - void - assign(size_type __n, const value_type& __val) - { _M_fill_assign(__n, __val); } - - /** - * @brief Assigns a range to a %deque. - * @param __first An input iterator. - * @param __last An input iterator. - * - * This function fills a %deque with copies of the elements in the - * range [__first,__last). - * - * Note that the assignment completely changes the %deque and that the - * resulting %deque's size is the same as the number of elements - * assigned. Old data may be lost. - */ -#if __cplusplus >= 201103L - template> - void - assign(_InputIterator __first, _InputIterator __last) - { _M_assign_dispatch(__first, __last, __false_type()); } -#else - template - void - assign(_InputIterator __first, _InputIterator __last) - { - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Assigns an initializer list to a %deque. - * @param __l An initializer_list. - * - * This function fills a %deque with copies of the elements in the - * initializer_list @a __l. - * - * Note that the assignment completely changes the %deque and that the - * resulting %deque's size is the same as the number of elements - * assigned. Old data may be lost. - */ - void - assign(initializer_list __l) - { this->assign(__l.begin(), __l.end()); } -#endif - - /// Get a copy of the memory allocation object. - allocator_type - get_allocator() const _GLIBCXX_NOEXCEPT - { return _Base::get_allocator(); } - - // iterators - /** - * Returns a read/write iterator that points to the first element in the - * %deque. Iteration is done in ordinary element order. - */ - iterator - begin() _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_start; } - - /** - * Returns a read-only (constant) iterator that points to the first - * element in the %deque. Iteration is done in ordinary element order. - */ - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_start; } - - /** - * Returns a read/write iterator that points one past the last - * element in the %deque. Iteration is done in ordinary - * element order. - */ - iterator - end() _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_finish; } - - /** - * Returns a read-only (constant) iterator that points one past - * the last element in the %deque. Iteration is done in - * ordinary element order. - */ - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_finish; } - - /** - * Returns a read/write reverse iterator that points to the - * last element in the %deque. Iteration is done in reverse - * element order. - */ - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return reverse_iterator(this->_M_impl._M_finish); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to the last element in the %deque. Iteration is done in - * reverse element order. - */ - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(this->_M_impl._M_finish); } - - /** - * Returns a read/write reverse iterator that points to one - * before the first element in the %deque. Iteration is done - * in reverse element order. - */ - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return reverse_iterator(this->_M_impl._M_start); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to one before the first element in the %deque. Iteration is - * done in reverse element order. - */ - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(this->_M_impl._M_start); } - -#if __cplusplus >= 201103L - /** - * Returns a read-only (constant) iterator that points to the first - * element in the %deque. Iteration is done in ordinary element order. - */ - const_iterator - cbegin() const noexcept - { return this->_M_impl._M_start; } - - /** - * Returns a read-only (constant) iterator that points one past - * the last element in the %deque. Iteration is done in - * ordinary element order. - */ - const_iterator - cend() const noexcept - { return this->_M_impl._M_finish; } - - /** - * Returns a read-only (constant) reverse iterator that points - * to the last element in the %deque. Iteration is done in - * reverse element order. - */ - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(this->_M_impl._M_finish); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to one before the first element in the %deque. Iteration is - * done in reverse element order. - */ - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(this->_M_impl._M_start); } -#endif - - // [23.2.1.2] capacity - /** Returns the number of elements in the %deque. */ - size_type - size() const _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_finish - this->_M_impl._M_start; } - - /** Returns the size() of the largest possible %deque. */ - size_type - max_size() const _GLIBCXX_NOEXCEPT - { return _Alloc_traits::max_size(_M_get_Tp_allocator()); } - -#if __cplusplus >= 201103L - /** - * @brief Resizes the %deque to the specified number of elements. - * @param __new_size Number of elements the %deque should contain. - * - * This function will %resize the %deque to the specified - * number of elements. If the number is smaller than the - * %deque's current size the %deque is truncated, otherwise - * default constructed elements are appended. - */ - void - resize(size_type __new_size) - { - const size_type __len = size(); - if (__new_size > __len) - _M_default_append(__new_size - __len); - else if (__new_size < __len) - _M_erase_at_end(this->_M_impl._M_start - + difference_type(__new_size)); - } - - /** - * @brief Resizes the %deque to the specified number of elements. - * @param __new_size Number of elements the %deque should contain. - * @param __x Data with which new elements should be populated. - * - * This function will %resize the %deque to the specified - * number of elements. If the number is smaller than the - * %deque's current size the %deque is truncated, otherwise the - * %deque is extended and new elements are populated with given - * data. - */ - void - resize(size_type __new_size, const value_type& __x) - { - const size_type __len = size(); - if (__new_size > __len) - insert(this->_M_impl._M_finish, __new_size - __len, __x); - else if (__new_size < __len) - _M_erase_at_end(this->_M_impl._M_start - + difference_type(__new_size)); - } -#else - /** - * @brief Resizes the %deque to the specified number of elements. - * @param __new_size Number of elements the %deque should contain. - * @param __x Data with which new elements should be populated. - * - * This function will %resize the %deque to the specified - * number of elements. If the number is smaller than the - * %deque's current size the %deque is truncated, otherwise the - * %deque is extended and new elements are populated with given - * data. - */ - void - resize(size_type __new_size, value_type __x = value_type()) - { - const size_type __len = size(); - if (__new_size > __len) - insert(this->_M_impl._M_finish, __new_size - __len, __x); - else if (__new_size < __len) - _M_erase_at_end(this->_M_impl._M_start - + difference_type(__new_size)); - } -#endif - -#if __cplusplus >= 201103L - /** A non-binding request to reduce memory use. */ - void - shrink_to_fit() noexcept - { _M_shrink_to_fit(); } -#endif - - /** - * Returns true if the %deque is empty. (Thus begin() would - * equal end().) - */ - bool - empty() const _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_finish == this->_M_impl._M_start; } - - // element access - /** - * @brief Subscript access to the data contained in the %deque. - * @param __n The index of the element for which data should be - * accessed. - * @return Read/write reference to data. - * - * This operator allows for easy, array-style, data access. - * Note that data access with this operator is unchecked and - * out_of_range lookups are not defined. (For checked lookups - * see at().) - */ - reference - operator[](size_type __n) _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_start[difference_type(__n)]; } - - /** - * @brief Subscript access to the data contained in the %deque. - * @param __n The index of the element for which data should be - * accessed. - * @return Read-only (constant) reference to data. - * - * This operator allows for easy, array-style, data access. - * Note that data access with this operator is unchecked and - * out_of_range lookups are not defined. (For checked lookups - * see at().) - */ - const_reference - operator[](size_type __n) const _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_start[difference_type(__n)]; } - - protected: - /// Safety check used only from at(). - void - _M_range_check(size_type __n) const - { - if (__n >= this->size()) - __throw_out_of_range_fmt(__N("deque::_M_range_check: __n " - "(which is %zu)>= this->size() " - "(which is %zu)"), - __n, this->size()); - } - - public: - /** - * @brief Provides access to the data contained in the %deque. - * @param __n The index of the element for which data should be - * accessed. - * @return Read/write reference to data. - * @throw std::out_of_range If @a __n is an invalid index. - * - * This function provides for safer data access. The parameter - * is first checked that it is in the range of the deque. The - * function throws out_of_range if the check fails. - */ - reference - at(size_type __n) - { - _M_range_check(__n); - return (*this)[__n]; - } - - /** - * @brief Provides access to the data contained in the %deque. - * @param __n The index of the element for which data should be - * accessed. - * @return Read-only (constant) reference to data. - * @throw std::out_of_range If @a __n is an invalid index. - * - * This function provides for safer data access. The parameter is first - * checked that it is in the range of the deque. The function throws - * out_of_range if the check fails. - */ - const_reference - at(size_type __n) const - { - _M_range_check(__n); - return (*this)[__n]; - } - - /** - * Returns a read/write reference to the data at the first - * element of the %deque. - */ - reference - front() _GLIBCXX_NOEXCEPT - { return *begin(); } - - /** - * Returns a read-only (constant) reference to the data at the first - * element of the %deque. - */ - const_reference - front() const _GLIBCXX_NOEXCEPT - { return *begin(); } - - /** - * Returns a read/write reference to the data at the last element of the - * %deque. - */ - reference - back() _GLIBCXX_NOEXCEPT - { - iterator __tmp = end(); - --__tmp; - return *__tmp; - } - - /** - * Returns a read-only (constant) reference to the data at the last - * element of the %deque. - */ - const_reference - back() const _GLIBCXX_NOEXCEPT - { - const_iterator __tmp = end(); - --__tmp; - return *__tmp; - } - - // [23.2.1.2] modifiers - /** - * @brief Add data to the front of the %deque. - * @param __x Data to be added. - * - * This is a typical stack operation. The function creates an - * element at the front of the %deque and assigns the given - * data to it. Due to the nature of a %deque this operation - * can be done in constant time. - */ - void - push_front(const value_type& __x) - { - if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first) - { - _Alloc_traits::construct(this->_M_impl, - this->_M_impl._M_start._M_cur - 1, - __x); - --this->_M_impl._M_start._M_cur; - } - else - _M_push_front_aux(__x); - } - -#if __cplusplus >= 201103L - void - push_front(value_type&& __x) - { emplace_front(std::move(__x)); } - - template - void - emplace_front(_Args&&... __args); -#endif - - /** - * @brief Add data to the end of the %deque. - * @param __x Data to be added. - * - * This is a typical stack operation. The function creates an - * element at the end of the %deque and assigns the given data - * to it. Due to the nature of a %deque this operation can be - * done in constant time. - */ - void - push_back(const value_type& __x) - { - if (this->_M_impl._M_finish._M_cur - != this->_M_impl._M_finish._M_last - 1) - { - _Alloc_traits::construct(this->_M_impl, - this->_M_impl._M_finish._M_cur, __x); - ++this->_M_impl._M_finish._M_cur; - } - else - _M_push_back_aux(__x); - } - -#if __cplusplus >= 201103L - void - push_back(value_type&& __x) - { emplace_back(std::move(__x)); } - - template - void - emplace_back(_Args&&... __args); -#endif - - /** - * @brief Removes first element. - * - * This is a typical stack operation. It shrinks the %deque by one. - * - * Note that no data is returned, and if the first element's data is - * needed, it should be retrieved before pop_front() is called. - */ - void - pop_front() _GLIBCXX_NOEXCEPT - { - if (this->_M_impl._M_start._M_cur - != this->_M_impl._M_start._M_last - 1) - { - _Alloc_traits::destroy(this->_M_impl, - this->_M_impl._M_start._M_cur); - ++this->_M_impl._M_start._M_cur; - } - else - _M_pop_front_aux(); - } - - /** - * @brief Removes last element. - * - * This is a typical stack operation. It shrinks the %deque by one. - * - * Note that no data is returned, and if the last element's data is - * needed, it should be retrieved before pop_back() is called. - */ - void - pop_back() _GLIBCXX_NOEXCEPT - { - if (this->_M_impl._M_finish._M_cur - != this->_M_impl._M_finish._M_first) - { - --this->_M_impl._M_finish._M_cur; - _Alloc_traits::destroy(this->_M_impl, - this->_M_impl._M_finish._M_cur); - } - else - _M_pop_back_aux(); - } - -#if __cplusplus >= 201103L - /** - * @brief Inserts an object in %deque before specified iterator. - * @param __position A const_iterator into the %deque. - * @param __args Arguments. - * @return An iterator that points to the inserted data. - * - * This function will insert an object of type T constructed - * with T(std::forward(args)...) before the specified location. - */ - template - iterator - emplace(const_iterator __position, _Args&&... __args); - - /** - * @brief Inserts given value into %deque before specified iterator. - * @param __position A const_iterator into the %deque. - * @param __x Data to be inserted. - * @return An iterator that points to the inserted data. - * - * This function will insert a copy of the given value before the - * specified location. - */ - iterator - insert(const_iterator __position, const value_type& __x); -#else - /** - * @brief Inserts given value into %deque before specified iterator. - * @param __position An iterator into the %deque. - * @param __x Data to be inserted. - * @return An iterator that points to the inserted data. - * - * This function will insert a copy of the given value before the - * specified location. - */ - iterator - insert(iterator __position, const value_type& __x); -#endif - -#if __cplusplus >= 201103L - /** - * @brief Inserts given rvalue into %deque before specified iterator. - * @param __position A const_iterator into the %deque. - * @param __x Data to be inserted. - * @return An iterator that points to the inserted data. - * - * This function will insert a copy of the given rvalue before the - * specified location. - */ - iterator - insert(const_iterator __position, value_type&& __x) - { return emplace(__position, std::move(__x)); } - - /** - * @brief Inserts an initializer list into the %deque. - * @param __p An iterator into the %deque. - * @param __l An initializer_list. - * - * This function will insert copies of the data in the - * initializer_list @a __l into the %deque before the location - * specified by @a __p. This is known as list insert. - */ - iterator - insert(const_iterator __p, initializer_list __l) - { return this->insert(__p, __l.begin(), __l.end()); } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Inserts a number of copies of given data into the %deque. - * @param __position A const_iterator into the %deque. - * @param __n Number of elements to be inserted. - * @param __x Data to be inserted. - * @return An iterator that points to the inserted data. - * - * This function will insert a specified number of copies of the given - * data before the location specified by @a __position. - */ - iterator - insert(const_iterator __position, size_type __n, const value_type& __x) - { - difference_type __offset = __position - cbegin(); - _M_fill_insert(__position._M_const_cast(), __n, __x); - return begin() + __offset; - } -#else - /** - * @brief Inserts a number of copies of given data into the %deque. - * @param __position An iterator into the %deque. - * @param __n Number of elements to be inserted. - * @param __x Data to be inserted. - * - * This function will insert a specified number of copies of the given - * data before the location specified by @a __position. - */ - void - insert(iterator __position, size_type __n, const value_type& __x) - { _M_fill_insert(__position, __n, __x); } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Inserts a range into the %deque. - * @param __position A const_iterator into the %deque. - * @param __first An input iterator. - * @param __last An input iterator. - * @return An iterator that points to the inserted data. - * - * This function will insert copies of the data in the range - * [__first,__last) into the %deque before the location specified - * by @a __position. This is known as range insert. - */ - template> - iterator - insert(const_iterator __position, _InputIterator __first, - _InputIterator __last) - { - difference_type __offset = __position - cbegin(); - _M_insert_dispatch(__position._M_const_cast(), - __first, __last, __false_type()); - return begin() + __offset; - } -#else - /** - * @brief Inserts a range into the %deque. - * @param __position An iterator into the %deque. - * @param __first An input iterator. - * @param __last An input iterator. - * - * This function will insert copies of the data in the range - * [__first,__last) into the %deque before the location specified - * by @a __position. This is known as range insert. - */ - template - void - insert(iterator __position, _InputIterator __first, - _InputIterator __last) - { - // Check whether it's an integral type. If so, it's not an iterator. - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - _M_insert_dispatch(__position, __first, __last, _Integral()); - } -#endif - - /** - * @brief Remove element at given position. - * @param __position Iterator pointing to element to be erased. - * @return An iterator pointing to the next element (or end()). - * - * This function will erase the element at the given position and thus - * shorten the %deque by one. - * - * The user is cautioned that - * this function only erases the element, and that if the element is - * itself a pointer, the pointed-to memory is not touched in any way. - * Managing the pointer is the user's responsibility. - */ - iterator -#if __cplusplus >= 201103L - erase(const_iterator __position) -#else - erase(iterator __position) -#endif - { return _M_erase(__position._M_const_cast()); } - - /** - * @brief Remove a range of elements. - * @param __first Iterator pointing to the first element to be erased. - * @param __last Iterator pointing to one past the last element to be - * erased. - * @return An iterator pointing to the element pointed to by @a last - * prior to erasing (or end()). - * - * This function will erase the elements in the range - * [__first,__last) and shorten the %deque accordingly. - * - * The user is cautioned that - * this function only erases the elements, and that if the elements - * themselves are pointers, the pointed-to memory is not touched in any - * way. Managing the pointer is the user's responsibility. - */ - iterator -#if __cplusplus >= 201103L - erase(const_iterator __first, const_iterator __last) -#else - erase(iterator __first, iterator __last) -#endif - { return _M_erase(__first._M_const_cast(), __last._M_const_cast()); } - - /** - * @brief Swaps data with another %deque. - * @param __x A %deque of the same element and allocator types. - * - * This exchanges the elements between two deques in constant time. - * (Four pointers, so it should be quite fast.) - * Note that the global std::swap() function is specialized such that - * std::swap(d1,d2) will feed to this function. - */ - void - swap(deque& __x) -#if __cplusplus >= 201103L - noexcept(_Alloc_traits::_S_nothrow_swap()) -#endif - { - _M_impl._M_swap_data(__x._M_impl); - _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(), - __x._M_get_Tp_allocator()); - } - - /** - * Erases all the elements. Note that this function only erases the - * elements, and that if the elements themselves are pointers, the - * pointed-to memory is not touched in any way. Managing the pointer is - * the user's responsibility. - */ - void - clear() _GLIBCXX_NOEXCEPT - { _M_erase_at_end(begin()); } - - protected: - // Internal constructor functions follow. - - // called by the range constructor to implement [23.1.1]/9 - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 438. Ambiguity in the "do the right thing" clause - template - void - _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) - { - _M_initialize_map(static_cast(__n)); - _M_fill_initialize(__x); - } - - // called by the range constructor to implement [23.1.1]/9 - template - void - _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, - __false_type) - { - typedef typename std::iterator_traits<_InputIterator>:: - iterator_category _IterCategory; - _M_range_initialize(__first, __last, _IterCategory()); - } - - // called by the second initialize_dispatch above - //@{ - /** - * @brief Fills the deque with whatever is in [first,last). - * @param __first An input iterator. - * @param __last An input iterator. - * @return Nothing. - * - * If the iterators are actually forward iterators (or better), then the - * memory layout can be done all at once. Else we move forward using - * push_back on each value from the iterator. - */ - template - void - _M_range_initialize(_InputIterator __first, _InputIterator __last, - std::input_iterator_tag); - - // called by the second initialize_dispatch above - template - void - _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, - std::forward_iterator_tag); - //@} - - /** - * @brief Fills the %deque with copies of value. - * @param __value Initial value. - * @return Nothing. - * @pre _M_start and _M_finish have already been initialized, - * but none of the %deque's elements have yet been constructed. - * - * This function is called only when the user provides an explicit size - * (with or without an explicit exemplar value). - */ - void - _M_fill_initialize(const value_type& __value); - -#if __cplusplus >= 201103L - // called by deque(n). - void - _M_default_initialize(); -#endif - - // Internal assign functions follow. The *_aux functions do the actual - // assignment work for the range versions. - - // called by the range assign to implement [23.1.1]/9 - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 438. Ambiguity in the "do the right thing" clause - template - void - _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) - { _M_fill_assign(__n, __val); } - - // called by the range assign to implement [23.1.1]/9 - template - void - _M_assign_dispatch(_InputIterator __first, _InputIterator __last, - __false_type) - { - typedef typename std::iterator_traits<_InputIterator>:: - iterator_category _IterCategory; - _M_assign_aux(__first, __last, _IterCategory()); - } - - // called by the second assign_dispatch above - template - void - _M_assign_aux(_InputIterator __first, _InputIterator __last, - std::input_iterator_tag); - - // called by the second assign_dispatch above - template - void - _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, - std::forward_iterator_tag) - { - const size_type __len = std::distance(__first, __last); - if (__len > size()) - { - _ForwardIterator __mid = __first; - std::advance(__mid, size()); - std::copy(__first, __mid, begin()); - insert(end(), __mid, __last); - } - else - _M_erase_at_end(std::copy(__first, __last, begin())); - } - - // Called by assign(n,t), and the range assign when it turns out - // to be the same thing. - void - _M_fill_assign(size_type __n, const value_type& __val) - { - if (__n > size()) - { - std::fill(begin(), end(), __val); - insert(end(), __n - size(), __val); - } - else - { - _M_erase_at_end(begin() + difference_type(__n)); - std::fill(begin(), end(), __val); - } - } - - //@{ - /// Helper functions for push_* and pop_*. -#if __cplusplus < 201103L - void _M_push_back_aux(const value_type&); - - void _M_push_front_aux(const value_type&); -#else - template - void _M_push_back_aux(_Args&&... __args); - - template - void _M_push_front_aux(_Args&&... __args); -#endif - - void _M_pop_back_aux(); - - void _M_pop_front_aux(); - //@} - - // Internal insert functions follow. The *_aux functions do the actual - // insertion work when all shortcuts fail. - - // called by the range insert to implement [23.1.1]/9 - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 438. Ambiguity in the "do the right thing" clause - template - void - _M_insert_dispatch(iterator __pos, - _Integer __n, _Integer __x, __true_type) - { _M_fill_insert(__pos, __n, __x); } - - // called by the range insert to implement [23.1.1]/9 - template - void - _M_insert_dispatch(iterator __pos, - _InputIterator __first, _InputIterator __last, - __false_type) - { - typedef typename std::iterator_traits<_InputIterator>:: - iterator_category _IterCategory; - _M_range_insert_aux(__pos, __first, __last, _IterCategory()); - } - - // called by the second insert_dispatch above - template - void - _M_range_insert_aux(iterator __pos, _InputIterator __first, - _InputIterator __last, std::input_iterator_tag); - - // called by the second insert_dispatch above - template - void - _M_range_insert_aux(iterator __pos, _ForwardIterator __first, - _ForwardIterator __last, std::forward_iterator_tag); - - // Called by insert(p,n,x), and the range insert when it turns out to be - // the same thing. Can use fill functions in optimal situations, - // otherwise passes off to insert_aux(p,n,x). - void - _M_fill_insert(iterator __pos, size_type __n, const value_type& __x); - - // called by insert(p,x) -#if __cplusplus < 201103L - iterator - _M_insert_aux(iterator __pos, const value_type& __x); -#else - template - iterator - _M_insert_aux(iterator __pos, _Args&&... __args); -#endif - - // called by insert(p,n,x) via fill_insert - void - _M_insert_aux(iterator __pos, size_type __n, const value_type& __x); - - // called by range_insert_aux for forward iterators - template - void - _M_insert_aux(iterator __pos, - _ForwardIterator __first, _ForwardIterator __last, - size_type __n); - - - // Internal erase functions follow. - - void - _M_destroy_data_aux(iterator __first, iterator __last); - - // Called by ~deque(). - // NB: Doesn't deallocate the nodes. - template - void - _M_destroy_data(iterator __first, iterator __last, const _Alloc1&) - { _M_destroy_data_aux(__first, __last); } - - void - _M_destroy_data(iterator __first, iterator __last, - const std::allocator<_Tp>&) - { - if (!__has_trivial_destructor(value_type)) - _M_destroy_data_aux(__first, __last); - } - - // Called by erase(q1, q2). - void - _M_erase_at_begin(iterator __pos) - { - _M_destroy_data(begin(), __pos, _M_get_Tp_allocator()); - _M_destroy_nodes(this->_M_impl._M_start._M_node, __pos._M_node); - this->_M_impl._M_start = __pos; - } - - // Called by erase(q1, q2), resize(), clear(), _M_assign_aux, - // _M_fill_assign, operator=. - void - _M_erase_at_end(iterator __pos) - { - _M_destroy_data(__pos, end(), _M_get_Tp_allocator()); - _M_destroy_nodes(__pos._M_node + 1, - this->_M_impl._M_finish._M_node + 1); - this->_M_impl._M_finish = __pos; - } - - iterator - _M_erase(iterator __pos); - - iterator - _M_erase(iterator __first, iterator __last); - -#if __cplusplus >= 201103L - // Called by resize(sz). - void - _M_default_append(size_type __n); - - bool - _M_shrink_to_fit(); -#endif - - //@{ - /// Memory-handling helpers for the previous internal insert functions. - iterator - _M_reserve_elements_at_front(size_type __n) - { - const size_type __vacancies = this->_M_impl._M_start._M_cur - - this->_M_impl._M_start._M_first; - if (__n > __vacancies) - _M_new_elements_at_front(__n - __vacancies); - return this->_M_impl._M_start - difference_type(__n); - } - - iterator - _M_reserve_elements_at_back(size_type __n) - { - const size_type __vacancies = (this->_M_impl._M_finish._M_last - - this->_M_impl._M_finish._M_cur) - 1; - if (__n > __vacancies) - _M_new_elements_at_back(__n - __vacancies); - return this->_M_impl._M_finish + difference_type(__n); - } - - void - _M_new_elements_at_front(size_type __new_elements); - - void - _M_new_elements_at_back(size_type __new_elements); - //@} - - - //@{ - /** - * @brief Memory-handling helpers for the major %map. - * - * Makes sure the _M_map has space for new nodes. Does not - * actually add the nodes. Can invalidate _M_map pointers. - * (And consequently, %deque iterators.) - */ - void - _M_reserve_map_at_back(size_type __nodes_to_add = 1) - { - if (__nodes_to_add + 1 > this->_M_impl._M_map_size - - (this->_M_impl._M_finish._M_node - this->_M_impl._M_map)) - _M_reallocate_map(__nodes_to_add, false); - } - - void - _M_reserve_map_at_front(size_type __nodes_to_add = 1) - { - if (__nodes_to_add > size_type(this->_M_impl._M_start._M_node - - this->_M_impl._M_map)) - _M_reallocate_map(__nodes_to_add, true); - } - - void - _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front); - //@} - -#if __cplusplus >= 201103L - // Constant-time, nothrow move assignment when source object's memory - // can be moved because the allocators are equal. - void - _M_move_assign1(deque&& __x, /* always equal: */ true_type) noexcept - { - this->_M_impl._M_swap_data(__x._M_impl); - __x.clear(); - std::__alloc_on_move(_M_get_Tp_allocator(), __x._M_get_Tp_allocator()); - } - - void - _M_move_assign1(deque&& __x, /* always equal: */ false_type) - { - constexpr bool __move_storage = - _Alloc_traits::_S_propagate_on_move_assign(); - _M_move_assign2(std::move(__x), - integral_constant()); - } - - // Destroy all elements and deallocate all memory, then replace - // with elements created from __args. - template - void - _M_replace_map(_Args&&... __args) - { - // Create new data first, so if allocation fails there are no effects. - deque __newobj(std::forward<_Args>(__args)...); - // Free existing storage using existing allocator. - clear(); - _M_deallocate_node(*begin()._M_node); // one node left after clear() - _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size); - this->_M_impl._M_map = nullptr; - this->_M_impl._M_map_size = 0; - // Take ownership of replacement memory. - this->_M_impl._M_swap_data(__newobj._M_impl); - } - - // Do move assignment when the allocator propagates. - void - _M_move_assign2(deque&& __x, /* propagate: */ true_type) - { - // Make a copy of the original allocator state. - auto __alloc = __x._M_get_Tp_allocator(); - // The allocator propagates so storage can be moved from __x, - // leaving __x in a valid empty state with a moved-from allocator. - _M_replace_map(std::move(__x)); - // Move the corresponding allocator state too. - _M_get_Tp_allocator() = std::move(__alloc); - } - - // Do move assignment when it may not be possible to move source - // object's memory, resulting in a linear-time operation. - void - _M_move_assign2(deque&& __x, /* propagate: */ false_type) - { - if (__x._M_get_Tp_allocator() == this->_M_get_Tp_allocator()) - { - // The allocators are equal so storage can be moved from __x, - // leaving __x in a valid empty state with its current allocator. - _M_replace_map(std::move(__x), __x.get_allocator()); - } - else - { - // The rvalue's allocator cannot be moved and is not equal, - // so we need to individually move each element. - this->assign(std::__make_move_if_noexcept_iterator(__x.begin()), - std::__make_move_if_noexcept_iterator(__x.end())); - __x.clear(); - } - } -#endif - }; - - - /** - * @brief Deque equality comparison. - * @param __x A %deque. - * @param __y A %deque of the same type as @a __x. - * @return True iff the size and elements of the deques are equal. - * - * This is an equivalence relation. It is linear in the size of the - * deques. Deques are considered equivalent if their sizes are equal, - * and if corresponding elements compare equal. - */ - template - inline bool - operator==(const deque<_Tp, _Alloc>& __x, - const deque<_Tp, _Alloc>& __y) - { return __x.size() == __y.size() - && std::equal(__x.begin(), __x.end(), __y.begin()); } - - /** - * @brief Deque ordering relation. - * @param __x A %deque. - * @param __y A %deque of the same type as @a __x. - * @return True iff @a x is lexicographically less than @a __y. - * - * This is a total ordering relation. It is linear in the size of the - * deques. The elements must be comparable with @c <. - * - * See std::lexicographical_compare() for how the determination is made. - */ - template - inline bool - operator<(const deque<_Tp, _Alloc>& __x, - const deque<_Tp, _Alloc>& __y) - { return std::lexicographical_compare(__x.begin(), __x.end(), - __y.begin(), __y.end()); } - - /// Based on operator== - template - inline bool - operator!=(const deque<_Tp, _Alloc>& __x, - const deque<_Tp, _Alloc>& __y) - { return !(__x == __y); } - - /// Based on operator< - template - inline bool - operator>(const deque<_Tp, _Alloc>& __x, - const deque<_Tp, _Alloc>& __y) - { return __y < __x; } - - /// Based on operator< - template - inline bool - operator<=(const deque<_Tp, _Alloc>& __x, - const deque<_Tp, _Alloc>& __y) - { return !(__y < __x); } - - /// Based on operator< - template - inline bool - operator>=(const deque<_Tp, _Alloc>& __x, - const deque<_Tp, _Alloc>& __y) - { return !(__x < __y); } - - /// See std::deque::swap(). - template - inline void - swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y) - { __x.swap(__y); } - -#undef _GLIBCXX_DEQUE_BUF_SIZE - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#endif /* _STL_DEQUE_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_function.h b/openflow/usr/include/c++/5/bits/stl_function.h deleted file mode 100644 index 0c16357..0000000 --- a/openflow/usr/include/c++/5/bits/stl_function.h +++ /dev/null @@ -1,1131 +0,0 @@ -// Functor implementations -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_function.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{functional} - */ - -#ifndef _STL_FUNCTION_H -#define _STL_FUNCTION_H 1 - -#if __cplusplus > 201103L -#include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // 20.3.1 base classes - /** @defgroup functors Function Objects - * @ingroup utilities - * - * Function objects, or @e functors, are objects with an @c operator() - * defined and accessible. They can be passed as arguments to algorithm - * templates and used in place of a function pointer. Not only is the - * resulting expressiveness of the library increased, but the generated - * code can be more efficient than what you might write by hand. When we - * refer to @a functors, then, generally we include function pointers in - * the description as well. - * - * Often, functors are only created as temporaries passed to algorithm - * calls, rather than being created as named variables. - * - * Two examples taken from the standard itself follow. To perform a - * by-element addition of two vectors @c a and @c b containing @c double, - * and put the result in @c a, use - * \code - * transform (a.begin(), a.end(), b.begin(), a.begin(), plus()); - * \endcode - * To negate every element in @c a, use - * \code - * transform(a.begin(), a.end(), a.begin(), negate()); - * \endcode - * The addition and negation functions will be inlined directly. - * - * The standard functors are derived from structs named @c unary_function - * and @c binary_function. These two classes contain nothing but typedefs, - * to aid in generic (template) programming. If you write your own - * functors, you might consider doing the same. - * - * @{ - */ - /** - * This is one of the @link functors functor base classes@endlink. - */ - template - struct unary_function - { - /// @c argument_type is the type of the argument - typedef _Arg argument_type; - - /// @c result_type is the return type - typedef _Result result_type; - }; - - /** - * This is one of the @link functors functor base classes@endlink. - */ - template - struct binary_function - { - /// @c first_argument_type is the type of the first argument - typedef _Arg1 first_argument_type; - - /// @c second_argument_type is the type of the second argument - typedef _Arg2 second_argument_type; - - /// @c result_type is the return type - typedef _Result result_type; - }; - /** @} */ - - // 20.3.2 arithmetic - /** @defgroup arithmetic_functors Arithmetic Classes - * @ingroup functors - * - * Because basic math often needs to be done during an algorithm, - * the library provides functors for those operations. See the - * documentation for @link functors the base classes@endlink - * for examples of their use. - * - * @{ - */ - -#if __cplusplus > 201103L - struct __is_transparent; // undefined - - template - struct plus; - - template - struct minus; - - template - struct multiplies; - - template - struct divides; - - template - struct modulus; - - template - struct negate; -#endif - - /// One of the @link arithmetic_functors math functors@endlink. - template - struct plus : public binary_function<_Tp, _Tp, _Tp> - { - _GLIBCXX14_CONSTEXPR - _Tp - operator()(const _Tp& __x, const _Tp& __y) const - { return __x + __y; } - }; - - /// One of the @link arithmetic_functors math functors@endlink. - template - struct minus : public binary_function<_Tp, _Tp, _Tp> - { - _GLIBCXX14_CONSTEXPR - _Tp - operator()(const _Tp& __x, const _Tp& __y) const - { return __x - __y; } - }; - - /// One of the @link arithmetic_functors math functors@endlink. - template - struct multiplies : public binary_function<_Tp, _Tp, _Tp> - { - _GLIBCXX14_CONSTEXPR - _Tp - operator()(const _Tp& __x, const _Tp& __y) const - { return __x * __y; } - }; - - /// One of the @link arithmetic_functors math functors@endlink. - template - struct divides : public binary_function<_Tp, _Tp, _Tp> - { - _GLIBCXX14_CONSTEXPR - _Tp - operator()(const _Tp& __x, const _Tp& __y) const - { return __x / __y; } - }; - - /// One of the @link arithmetic_functors math functors@endlink. - template - struct modulus : public binary_function<_Tp, _Tp, _Tp> - { - _GLIBCXX14_CONSTEXPR - _Tp - operator()(const _Tp& __x, const _Tp& __y) const - { return __x % __y; } - }; - - /// One of the @link arithmetic_functors math functors@endlink. - template - struct negate : public unary_function<_Tp, _Tp> - { - _GLIBCXX14_CONSTEXPR - _Tp - operator()(const _Tp& __x) const - { return -__x; } - }; - -#if __cplusplus > 201103L - -#define __cpp_lib_transparent_operators 201210 -//#define __cpp_lib_generic_associative_lookup 201304 - - template<> - struct plus - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) + std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) + std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) + std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - /// One of the @link arithmetic_functors math functors@endlink. - template<> - struct minus - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) - std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) - std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) - std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - /// One of the @link arithmetic_functors math functors@endlink. - template<> - struct multiplies - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) * std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) * std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) * std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - /// One of the @link arithmetic_functors math functors@endlink. - template<> - struct divides - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) / std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) / std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) / std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - /// One of the @link arithmetic_functors math functors@endlink. - template<> - struct modulus - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) % std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) % std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) % std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - /// One of the @link arithmetic_functors math functors@endlink. - template<> - struct negate - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t) const - noexcept(noexcept(-std::forward<_Tp>(__t))) - -> decltype(-std::forward<_Tp>(__t)) - { return -std::forward<_Tp>(__t); } - - typedef __is_transparent is_transparent; - }; -#endif - /** @} */ - - // 20.3.3 comparisons - /** @defgroup comparison_functors Comparison Classes - * @ingroup functors - * - * The library provides six wrapper functors for all the basic comparisons - * in C++, like @c <. - * - * @{ - */ -#if __cplusplus > 201103L - template - struct equal_to; - - template - struct not_equal_to; - - template - struct greater; - - template - struct less; - - template - struct greater_equal; - - template - struct less_equal; -#endif - - /// One of the @link comparison_functors comparison functors@endlink. - template - struct equal_to : public binary_function<_Tp, _Tp, bool> - { - _GLIBCXX14_CONSTEXPR - bool - operator()(const _Tp& __x, const _Tp& __y) const - { return __x == __y; } - }; - - /// One of the @link comparison_functors comparison functors@endlink. - template - struct not_equal_to : public binary_function<_Tp, _Tp, bool> - { - _GLIBCXX14_CONSTEXPR - bool - operator()(const _Tp& __x, const _Tp& __y) const - { return __x != __y; } - }; - - /// One of the @link comparison_functors comparison functors@endlink. - template - struct greater : public binary_function<_Tp, _Tp, bool> - { - _GLIBCXX14_CONSTEXPR - bool - operator()(const _Tp& __x, const _Tp& __y) const - { return __x > __y; } - }; - - /// One of the @link comparison_functors comparison functors@endlink. - template - struct less : public binary_function<_Tp, _Tp, bool> - { - _GLIBCXX14_CONSTEXPR - bool - operator()(const _Tp& __x, const _Tp& __y) const - { return __x < __y; } - }; - - /// One of the @link comparison_functors comparison functors@endlink. - template - struct greater_equal : public binary_function<_Tp, _Tp, bool> - { - _GLIBCXX14_CONSTEXPR - bool - operator()(const _Tp& __x, const _Tp& __y) const - { return __x >= __y; } - }; - - /// One of the @link comparison_functors comparison functors@endlink. - template - struct less_equal : public binary_function<_Tp, _Tp, bool> - { - _GLIBCXX14_CONSTEXPR - bool - operator()(const _Tp& __x, const _Tp& __y) const - { return __x <= __y; } - }; - -#if __cplusplus > 201103L - /// One of the @link comparison_functors comparison functors@endlink. - template<> - struct equal_to - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) == std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - /// One of the @link comparison_functors comparison functors@endlink. - template<> - struct not_equal_to - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) != std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) != std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) != std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - /// One of the @link comparison_functors comparison functors@endlink. - template<> - struct greater - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) > std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) > std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) > std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - /// One of the @link comparison_functors comparison functors@endlink. - template<> - struct less - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) < std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) < std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) < std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - /// One of the @link comparison_functors comparison functors@endlink. - template<> - struct greater_equal - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) >= std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) >= std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) >= std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - /// One of the @link comparison_functors comparison functors@endlink. - template<> - struct less_equal - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) <= std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) <= std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) <= std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; -#endif - /** @} */ - - // 20.3.4 logical operations - /** @defgroup logical_functors Boolean Operations Classes - * @ingroup functors - * - * Here are wrapper functors for Boolean operations: @c &&, @c ||, - * and @c !. - * - * @{ - */ -#if __cplusplus > 201103L - template - struct logical_and; - - template - struct logical_or; - - template - struct logical_not; -#endif - - /// One of the @link logical_functors Boolean operations functors@endlink. - template - struct logical_and : public binary_function<_Tp, _Tp, bool> - { - _GLIBCXX14_CONSTEXPR - bool - operator()(const _Tp& __x, const _Tp& __y) const - { return __x && __y; } - }; - - /// One of the @link logical_functors Boolean operations functors@endlink. - template - struct logical_or : public binary_function<_Tp, _Tp, bool> - { - _GLIBCXX14_CONSTEXPR - bool - operator()(const _Tp& __x, const _Tp& __y) const - { return __x || __y; } - }; - - /// One of the @link logical_functors Boolean operations functors@endlink. - template - struct logical_not : public unary_function<_Tp, bool> - { - _GLIBCXX14_CONSTEXPR - bool - operator()(const _Tp& __x) const - { return !__x; } - }; - -#if __cplusplus > 201103L - /// One of the @link logical_functors Boolean operations functors@endlink. - template<> - struct logical_and - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) && std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) && std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) && std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - /// One of the @link logical_functors Boolean operations functors@endlink. - template<> - struct logical_or - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) || std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) || std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) || std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - /// One of the @link logical_functors Boolean operations functors@endlink. - template<> - struct logical_not - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t) const - noexcept(noexcept(!std::forward<_Tp>(__t))) - -> decltype(!std::forward<_Tp>(__t)) - { return !std::forward<_Tp>(__t); } - - typedef __is_transparent is_transparent; - }; -#endif - /** @} */ - -#if __cplusplus > 201103L - template - struct bit_and; - - template - struct bit_or; - - template - struct bit_xor; - - template - struct bit_not; -#endif - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 660. Missing Bitwise Operations. - template - struct bit_and : public binary_function<_Tp, _Tp, _Tp> - { - _GLIBCXX14_CONSTEXPR - _Tp - operator()(const _Tp& __x, const _Tp& __y) const - { return __x & __y; } - }; - - template - struct bit_or : public binary_function<_Tp, _Tp, _Tp> - { - _GLIBCXX14_CONSTEXPR - _Tp - operator()(const _Tp& __x, const _Tp& __y) const - { return __x | __y; } - }; - - template - struct bit_xor : public binary_function<_Tp, _Tp, _Tp> - { - _GLIBCXX14_CONSTEXPR - _Tp - operator()(const _Tp& __x, const _Tp& __y) const - { return __x ^ __y; } - }; - - template - struct bit_not : public unary_function<_Tp, _Tp> - { - _GLIBCXX14_CONSTEXPR - _Tp - operator()(const _Tp& __x) const - { return ~__x; } - }; - -#if __cplusplus > 201103L - template <> - struct bit_and - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) & std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) & std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) & std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - template <> - struct bit_or - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) | std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) | std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) | std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - template <> - struct bit_xor - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u))) - -> decltype(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u)) - { return std::forward<_Tp>(__t) ^ std::forward<_Up>(__u); } - - typedef __is_transparent is_transparent; - }; - - template <> - struct bit_not - { - template - _GLIBCXX14_CONSTEXPR - auto - operator()(_Tp&& __t) const - noexcept(noexcept(~std::forward<_Tp>(__t))) - -> decltype(~std::forward<_Tp>(__t)) - { return ~std::forward<_Tp>(__t); } - - typedef __is_transparent is_transparent; - }; -#endif - - // 20.3.5 negators - /** @defgroup negators Negators - * @ingroup functors - * - * The functions @c not1 and @c not2 each take a predicate functor - * and return an instance of @c unary_negate or - * @c binary_negate, respectively. These classes are functors whose - * @c operator() performs the stored predicate function and then returns - * the negation of the result. - * - * For example, given a vector of integers and a trivial predicate, - * \code - * struct IntGreaterThanThree - * : public std::unary_function - * { - * bool operator() (int x) { return x > 3; } - * }; - * - * std::find_if (v.begin(), v.end(), not1(IntGreaterThanThree())); - * \endcode - * The call to @c find_if will locate the first index (i) of @c v for which - * !(v[i] > 3) is true. - * - * The not1/unary_negate combination works on predicates taking a single - * argument. The not2/binary_negate combination works on predicates which - * take two arguments. - * - * @{ - */ - /// One of the @link negators negation functors@endlink. - template - class unary_negate - : public unary_function - { - protected: - _Predicate _M_pred; - - public: - _GLIBCXX14_CONSTEXPR - explicit - unary_negate(const _Predicate& __x) : _M_pred(__x) { } - - _GLIBCXX14_CONSTEXPR - bool - operator()(const typename _Predicate::argument_type& __x) const - { return !_M_pred(__x); } - }; - - /// One of the @link negators negation functors@endlink. - template - _GLIBCXX14_CONSTEXPR - inline unary_negate<_Predicate> - not1(const _Predicate& __pred) - { return unary_negate<_Predicate>(__pred); } - - /// One of the @link negators negation functors@endlink. - template - class binary_negate - : public binary_function - { - protected: - _Predicate _M_pred; - - public: - _GLIBCXX14_CONSTEXPR - explicit - binary_negate(const _Predicate& __x) : _M_pred(__x) { } - - _GLIBCXX14_CONSTEXPR - bool - operator()(const typename _Predicate::first_argument_type& __x, - const typename _Predicate::second_argument_type& __y) const - { return !_M_pred(__x, __y); } - }; - - /// One of the @link negators negation functors@endlink. - template - _GLIBCXX14_CONSTEXPR - inline binary_negate<_Predicate> - not2(const _Predicate& __pred) - { return binary_negate<_Predicate>(__pred); } - /** @} */ - - // 20.3.7 adaptors pointers functions - /** @defgroup pointer_adaptors Adaptors for pointers to functions - * @ingroup functors - * - * The advantage of function objects over pointers to functions is that - * the objects in the standard library declare nested typedefs describing - * their argument and result types with uniform names (e.g., @c result_type - * from the base classes @c unary_function and @c binary_function). - * Sometimes those typedefs are required, not just optional. - * - * Adaptors are provided to turn pointers to unary (single-argument) and - * binary (double-argument) functions into function objects. The - * long-winded functor @c pointer_to_unary_function is constructed with a - * function pointer @c f, and its @c operator() called with argument @c x - * returns @c f(x). The functor @c pointer_to_binary_function does the same - * thing, but with a double-argument @c f and @c operator(). - * - * The function @c ptr_fun takes a pointer-to-function @c f and constructs - * an instance of the appropriate functor. - * - * @{ - */ - /// One of the @link pointer_adaptors adaptors for function pointers@endlink. - template - class pointer_to_unary_function : public unary_function<_Arg, _Result> - { - protected: - _Result (*_M_ptr)(_Arg); - - public: - pointer_to_unary_function() { } - - explicit - pointer_to_unary_function(_Result (*__x)(_Arg)) - : _M_ptr(__x) { } - - _Result - operator()(_Arg __x) const - { return _M_ptr(__x); } - }; - - /// One of the @link pointer_adaptors adaptors for function pointers@endlink. - template - inline pointer_to_unary_function<_Arg, _Result> - ptr_fun(_Result (*__x)(_Arg)) - { return pointer_to_unary_function<_Arg, _Result>(__x); } - - /// One of the @link pointer_adaptors adaptors for function pointers@endlink. - template - class pointer_to_binary_function - : public binary_function<_Arg1, _Arg2, _Result> - { - protected: - _Result (*_M_ptr)(_Arg1, _Arg2); - - public: - pointer_to_binary_function() { } - - explicit - pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2)) - : _M_ptr(__x) { } - - _Result - operator()(_Arg1 __x, _Arg2 __y) const - { return _M_ptr(__x, __y); } - }; - - /// One of the @link pointer_adaptors adaptors for function pointers@endlink. - template - inline pointer_to_binary_function<_Arg1, _Arg2, _Result> - ptr_fun(_Result (*__x)(_Arg1, _Arg2)) - { return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x); } - /** @} */ - - template - struct _Identity - : public unary_function<_Tp,_Tp> - { - _Tp& - operator()(_Tp& __x) const - { return __x; } - - const _Tp& - operator()(const _Tp& __x) const - { return __x; } - }; - - template - struct _Select1st - : public unary_function<_Pair, typename _Pair::first_type> - { - typename _Pair::first_type& - operator()(_Pair& __x) const - { return __x.first; } - - const typename _Pair::first_type& - operator()(const _Pair& __x) const - { return __x.first; } - -#if __cplusplus >= 201103L - template - typename _Pair2::first_type& - operator()(_Pair2& __x) const - { return __x.first; } - - template - const typename _Pair2::first_type& - operator()(const _Pair2& __x) const - { return __x.first; } -#endif - }; - - template - struct _Select2nd - : public unary_function<_Pair, typename _Pair::second_type> - { - typename _Pair::second_type& - operator()(_Pair& __x) const - { return __x.second; } - - const typename _Pair::second_type& - operator()(const _Pair& __x) const - { return __x.second; } - }; - - // 20.3.8 adaptors pointers members - /** @defgroup memory_adaptors Adaptors for pointers to members - * @ingroup functors - * - * There are a total of 8 = 2^3 function objects in this family. - * (1) Member functions taking no arguments vs member functions taking - * one argument. - * (2) Call through pointer vs call through reference. - * (3) Const vs non-const member function. - * - * All of this complexity is in the function objects themselves. You can - * ignore it by using the helper function mem_fun and mem_fun_ref, - * which create whichever type of adaptor is appropriate. - * - * @{ - */ - /// One of the @link memory_adaptors adaptors for member - /// pointers@endlink. - template - class mem_fun_t : public unary_function<_Tp*, _Ret> - { - public: - explicit - mem_fun_t(_Ret (_Tp::*__pf)()) - : _M_f(__pf) { } - - _Ret - operator()(_Tp* __p) const - { return (__p->*_M_f)(); } - - private: - _Ret (_Tp::*_M_f)(); - }; - - /// One of the @link memory_adaptors adaptors for member - /// pointers@endlink. - template - class const_mem_fun_t : public unary_function - { - public: - explicit - const_mem_fun_t(_Ret (_Tp::*__pf)() const) - : _M_f(__pf) { } - - _Ret - operator()(const _Tp* __p) const - { return (__p->*_M_f)(); } - - private: - _Ret (_Tp::*_M_f)() const; - }; - - /// One of the @link memory_adaptors adaptors for member - /// pointers@endlink. - template - class mem_fun_ref_t : public unary_function<_Tp, _Ret> - { - public: - explicit - mem_fun_ref_t(_Ret (_Tp::*__pf)()) - : _M_f(__pf) { } - - _Ret - operator()(_Tp& __r) const - { return (__r.*_M_f)(); } - - private: - _Ret (_Tp::*_M_f)(); - }; - - /// One of the @link memory_adaptors adaptors for member - /// pointers@endlink. - template - class const_mem_fun_ref_t : public unary_function<_Tp, _Ret> - { - public: - explicit - const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) - : _M_f(__pf) { } - - _Ret - operator()(const _Tp& __r) const - { return (__r.*_M_f)(); } - - private: - _Ret (_Tp::*_M_f)() const; - }; - - /// One of the @link memory_adaptors adaptors for member - /// pointers@endlink. - template - class mem_fun1_t : public binary_function<_Tp*, _Arg, _Ret> - { - public: - explicit - mem_fun1_t(_Ret (_Tp::*__pf)(_Arg)) - : _M_f(__pf) { } - - _Ret - operator()(_Tp* __p, _Arg __x) const - { return (__p->*_M_f)(__x); } - - private: - _Ret (_Tp::*_M_f)(_Arg); - }; - - /// One of the @link memory_adaptors adaptors for member - /// pointers@endlink. - template - class const_mem_fun1_t : public binary_function - { - public: - explicit - const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const) - : _M_f(__pf) { } - - _Ret - operator()(const _Tp* __p, _Arg __x) const - { return (__p->*_M_f)(__x); } - - private: - _Ret (_Tp::*_M_f)(_Arg) const; - }; - - /// One of the @link memory_adaptors adaptors for member - /// pointers@endlink. - template - class mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> - { - public: - explicit - mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg)) - : _M_f(__pf) { } - - _Ret - operator()(_Tp& __r, _Arg __x) const - { return (__r.*_M_f)(__x); } - - private: - _Ret (_Tp::*_M_f)(_Arg); - }; - - /// One of the @link memory_adaptors adaptors for member - /// pointers@endlink. - template - class const_mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> - { - public: - explicit - const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const) - : _M_f(__pf) { } - - _Ret - operator()(const _Tp& __r, _Arg __x) const - { return (__r.*_M_f)(__x); } - - private: - _Ret (_Tp::*_M_f)(_Arg) const; - }; - - // Mem_fun adaptor helper functions. There are only two: - // mem_fun and mem_fun_ref. - template - inline mem_fun_t<_Ret, _Tp> - mem_fun(_Ret (_Tp::*__f)()) - { return mem_fun_t<_Ret, _Tp>(__f); } - - template - inline const_mem_fun_t<_Ret, _Tp> - mem_fun(_Ret (_Tp::*__f)() const) - { return const_mem_fun_t<_Ret, _Tp>(__f); } - - template - inline mem_fun_ref_t<_Ret, _Tp> - mem_fun_ref(_Ret (_Tp::*__f)()) - { return mem_fun_ref_t<_Ret, _Tp>(__f); } - - template - inline const_mem_fun_ref_t<_Ret, _Tp> - mem_fun_ref(_Ret (_Tp::*__f)() const) - { return const_mem_fun_ref_t<_Ret, _Tp>(__f); } - - template - inline mem_fun1_t<_Ret, _Tp, _Arg> - mem_fun(_Ret (_Tp::*__f)(_Arg)) - { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); } - - template - inline const_mem_fun1_t<_Ret, _Tp, _Arg> - mem_fun(_Ret (_Tp::*__f)(_Arg) const) - { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); } - - template - inline mem_fun1_ref_t<_Ret, _Tp, _Arg> - mem_fun_ref(_Ret (_Tp::*__f)(_Arg)) - { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } - - template - inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg> - mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const) - { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } - - /** @} */ - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED -# include -#endif - -#endif /* _STL_FUNCTION_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_heap.h b/openflow/usr/include/c++/5/bits/stl_heap.h deleted file mode 100644 index 3ab37c7..0000000 --- a/openflow/usr/include/c++/5/bits/stl_heap.h +++ /dev/null @@ -1,532 +0,0 @@ -// Heap implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_heap.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{queue} - */ - -#ifndef _STL_HEAP_H -#define _STL_HEAP_H 1 - -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @defgroup heap_algorithms Heap - * @ingroup sorting_algorithms - */ - - template - _Distance - __is_heap_until(_RandomAccessIterator __first, _Distance __n, - _Compare __comp) - { - _Distance __parent = 0; - for (_Distance __child = 1; __child < __n; ++__child) - { - if (__comp(__first + __parent, __first + __child)) - return __child; - if ((__child & 1) == 0) - ++__parent; - } - return __n; - } - - // __is_heap, a predicate testing whether or not a range is a heap. - // This function is an extension, not part of the C++ standard. - template - inline bool - __is_heap(_RandomAccessIterator __first, _Distance __n) - { - return std::__is_heap_until(__first, __n, - __gnu_cxx::__ops::__iter_less_iter()) == __n; - } - - template - inline bool - __is_heap(_RandomAccessIterator __first, _Compare __comp, _Distance __n) - { - return std::__is_heap_until(__first, __n, - __gnu_cxx::__ops::__iter_comp_iter(__comp)) == __n; - } - - template - inline bool - __is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) - { return std::__is_heap(__first, std::distance(__first, __last)); } - - template - inline bool - __is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) - { return std::__is_heap(__first, __comp, std::distance(__first, __last)); } - - // Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap, - // + is_heap and is_heap_until in C++0x. - - template - void - __push_heap(_RandomAccessIterator __first, - _Distance __holeIndex, _Distance __topIndex, _Tp __value, - _Compare __comp) - { - _Distance __parent = (__holeIndex - 1) / 2; - while (__holeIndex > __topIndex && __comp(__first + __parent, __value)) - { - *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __parent)); - __holeIndex = __parent; - __parent = (__holeIndex - 1) / 2; - } - *(__first + __holeIndex) = _GLIBCXX_MOVE(__value); - } - - /** - * @brief Push an element onto a heap. - * @param __first Start of heap. - * @param __last End of heap + element. - * @ingroup heap_algorithms - * - * This operation pushes the element at last-1 onto the valid heap - * over the range [__first,__last-1). After completion, - * [__first,__last) is a valid heap. - */ - template - inline void - push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) - { - typedef typename iterator_traits<_RandomAccessIterator>::value_type - _ValueType; - typedef typename iterator_traits<_RandomAccessIterator>::difference_type - _DistanceType; - - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>) - __glibcxx_requires_valid_range(__first, __last); - __glibcxx_requires_heap(__first, __last - 1); - - _ValueType __value = _GLIBCXX_MOVE(*(__last - 1)); - std::__push_heap(__first, _DistanceType((__last - __first) - 1), - _DistanceType(0), _GLIBCXX_MOVE(__value), - __gnu_cxx::__ops::__iter_less_val()); - } - - /** - * @brief Push an element onto a heap using comparison functor. - * @param __first Start of heap. - * @param __last End of heap + element. - * @param __comp Comparison functor. - * @ingroup heap_algorithms - * - * This operation pushes the element at __last-1 onto the valid - * heap over the range [__first,__last-1). After completion, - * [__first,__last) is a valid heap. Compare operations are - * performed using comp. - */ - template - inline void - push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) - { - typedef typename iterator_traits<_RandomAccessIterator>::value_type - _ValueType; - typedef typename iterator_traits<_RandomAccessIterator>::difference_type - _DistanceType; - - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_requires_valid_range(__first, __last); - __glibcxx_requires_heap_pred(__first, __last - 1, __comp); - - _ValueType __value = _GLIBCXX_MOVE(*(__last - 1)); - std::__push_heap(__first, _DistanceType((__last - __first) - 1), - _DistanceType(0), _GLIBCXX_MOVE(__value), - __gnu_cxx::__ops::__iter_comp_val(__comp)); - } - - template - void - __adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, - _Distance __len, _Tp __value, _Compare __comp) - { - const _Distance __topIndex = __holeIndex; - _Distance __secondChild = __holeIndex; - while (__secondChild < (__len - 1) / 2) - { - __secondChild = 2 * (__secondChild + 1); - if (__comp(__first + __secondChild, - __first + (__secondChild - 1))) - __secondChild--; - *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); - __holeIndex = __secondChild; - } - if ((__len & 1) == 0 && __secondChild == (__len - 2) / 2) - { - __secondChild = 2 * (__secondChild + 1); - *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first - + (__secondChild - 1))); - __holeIndex = __secondChild - 1; - } - std::__push_heap(__first, __holeIndex, __topIndex, - _GLIBCXX_MOVE(__value), - __gnu_cxx::__ops::__iter_comp_val(__comp)); - } - - template - inline void - __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _RandomAccessIterator __result, _Compare __comp) - { - typedef typename iterator_traits<_RandomAccessIterator>::value_type - _ValueType; - typedef typename iterator_traits<_RandomAccessIterator>::difference_type - _DistanceType; - - _ValueType __value = _GLIBCXX_MOVE(*__result); - *__result = _GLIBCXX_MOVE(*__first); - std::__adjust_heap(__first, _DistanceType(0), - _DistanceType(__last - __first), - _GLIBCXX_MOVE(__value), __comp); - } - - /** - * @brief Pop an element off a heap. - * @param __first Start of heap. - * @param __last End of heap. - * @pre [__first, __last) is a valid, non-empty range. - * @ingroup heap_algorithms - * - * This operation pops the top of the heap. The elements __first - * and __last-1 are swapped and [__first,__last-1) is made into a - * heap. - */ - template - inline void - pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) - { - typedef typename iterator_traits<_RandomAccessIterator>::value_type - _ValueType; - - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>) - __glibcxx_requires_non_empty_range(__first, __last); - __glibcxx_requires_valid_range(__first, __last); - __glibcxx_requires_heap(__first, __last); - - if (__last - __first > 1) - { - --__last; - std::__pop_heap(__first, __last, __last, - __gnu_cxx::__ops::__iter_less_iter()); - } - } - - /** - * @brief Pop an element off a heap using comparison functor. - * @param __first Start of heap. - * @param __last End of heap. - * @param __comp Comparison functor to use. - * @ingroup heap_algorithms - * - * This operation pops the top of the heap. The elements __first - * and __last-1 are swapped and [__first,__last-1) is made into a - * heap. Comparisons are made using comp. - */ - template - inline void - pop_heap(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_requires_valid_range(__first, __last); - __glibcxx_requires_non_empty_range(__first, __last); - __glibcxx_requires_heap_pred(__first, __last, __comp); - - if (__last - __first > 1) - { - --__last; - std::__pop_heap(__first, __last, __last, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - } - - template - void - __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) - { - typedef typename iterator_traits<_RandomAccessIterator>::value_type - _ValueType; - typedef typename iterator_traits<_RandomAccessIterator>::difference_type - _DistanceType; - - if (__last - __first < 2) - return; - - const _DistanceType __len = __last - __first; - _DistanceType __parent = (__len - 2) / 2; - while (true) - { - _ValueType __value = _GLIBCXX_MOVE(*(__first + __parent)); - std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value), - __comp); - if (__parent == 0) - return; - __parent--; - } - } - - /** - * @brief Construct a heap over a range. - * @param __first Start of heap. - * @param __last End of heap. - * @ingroup heap_algorithms - * - * This operation makes the elements in [__first,__last) into a heap. - */ - template - inline void - make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_RandomAccessIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - std::__make_heap(__first, __last, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Construct a heap over a range using comparison functor. - * @param __first Start of heap. - * @param __last End of heap. - * @param __comp Comparison functor to use. - * @ingroup heap_algorithms - * - * This operation makes the elements in [__first,__last) into a heap. - * Comparisons are made using __comp. - */ - template - inline void - make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_requires_valid_range(__first, __last); - - std::__make_heap(__first, __last, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - template - void - __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) - { - while (__last - __first > 1) - { - --__last; - std::__pop_heap(__first, __last, __last, __comp); - } - } - - /** - * @brief Sort a heap. - * @param __first Start of heap. - * @param __last End of heap. - * @ingroup heap_algorithms - * - * This operation sorts the valid heap in the range [__first,__last). - */ - template - inline void - sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_RandomAccessIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - __glibcxx_requires_heap(__first, __last); - - std::__sort_heap(__first, __last, - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Sort a heap using comparison functor. - * @param __first Start of heap. - * @param __last End of heap. - * @param __comp Comparison functor to use. - * @ingroup heap_algorithms - * - * This operation sorts the valid heap in the range [__first,__last). - * Comparisons are made using __comp. - */ - template - inline void - sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_requires_valid_range(__first, __last); - __glibcxx_requires_heap_pred(__first, __last, __comp); - - std::__sort_heap(__first, __last, - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - -#if __cplusplus >= 201103L - /** - * @brief Search the end of a heap. - * @param __first Start of range. - * @param __last End of range. - * @return An iterator pointing to the first element not in the heap. - * @ingroup heap_algorithms - * - * This operation returns the last iterator i in [__first, __last) for which - * the range [__first, i) is a heap. - */ - template - inline _RandomAccessIterator - is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) - { - // concept requirements - __glibcxx_function_requires(_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_RandomAccessIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return __first + - std::__is_heap_until(__first, std::distance(__first, __last), - __gnu_cxx::__ops::__iter_less_iter()); - } - - /** - * @brief Search the end of a heap using comparison functor. - * @param __first Start of range. - * @param __last End of range. - * @param __comp Comparison functor to use. - * @return An iterator pointing to the first element not in the heap. - * @ingroup heap_algorithms - * - * This operation returns the last iterator i in [__first, __last) for which - * the range [__first, i) is a heap. Comparisons are made using __comp. - */ - template - inline _RandomAccessIterator - is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_requires_valid_range(__first, __last); - - return __first - + std::__is_heap_until(__first, std::distance(__first, __last), - __gnu_cxx::__ops::__iter_comp_iter(__comp)); - } - - /** - * @brief Determines whether a range is a heap. - * @param __first Start of range. - * @param __last End of range. - * @return True if range is a heap, false otherwise. - * @ingroup heap_algorithms - */ - template - inline bool - is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) - { return std::is_heap_until(__first, __last) == __last; } - - /** - * @brief Determines whether a range is a heap using comparison functor. - * @param __first Start of range. - * @param __last End of range. - * @param __comp Comparison functor to use. - * @return True if range is a heap, false otherwise. - * @ingroup heap_algorithms - */ - template - inline bool - is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) - { return std::is_heap_until(__first, __last, __comp) == __last; } -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _STL_HEAP_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_iterator.h b/openflow/usr/include/c++/5/bits/stl_iterator.h deleted file mode 100644 index 7b5872e..0000000 --- a/openflow/usr/include/c++/5/bits/stl_iterator.h +++ /dev/null @@ -1,1182 +0,0 @@ -// Iterators -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_iterator.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iterator} - * - * This file implements reverse_iterator, back_insert_iterator, - * front_insert_iterator, insert_iterator, __normal_iterator, and their - * supporting functions and overloaded operators. - */ - -#ifndef _STL_ITERATOR_H -#define _STL_ITERATOR_H 1 - -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup iterators - * @{ - */ - - // 24.4.1 Reverse iterators - /** - * Bidirectional and random access iterators have corresponding reverse - * %iterator adaptors that iterate through the data structure in the - * opposite direction. They have the same signatures as the corresponding - * iterators. The fundamental relation between a reverse %iterator and its - * corresponding %iterator @c i is established by the identity: - * @code - * &*(reverse_iterator(i)) == &*(i - 1) - * @endcode - * - * This mapping is dictated by the fact that while there is always a - * pointer past the end of an array, there might not be a valid pointer - * before the beginning of an array. [24.4.1]/1,2 - * - * Reverse iterators can be tricky and surprising at first. Their - * semantics make sense, however, and the trickiness is a side effect of - * the requirement that the iterators must be safe. - */ - template - class reverse_iterator - : public iterator::iterator_category, - typename iterator_traits<_Iterator>::value_type, - typename iterator_traits<_Iterator>::difference_type, - typename iterator_traits<_Iterator>::pointer, - typename iterator_traits<_Iterator>::reference> - { - protected: - _Iterator current; - - typedef iterator_traits<_Iterator> __traits_type; - - public: - typedef _Iterator iterator_type; - typedef typename __traits_type::difference_type difference_type; - typedef typename __traits_type::pointer pointer; - typedef typename __traits_type::reference reference; - - /** - * The default constructor value-initializes member @p current. - * If it is a pointer, that means it is zero-initialized. - */ - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 235 No specification of default ctor for reverse_iterator - reverse_iterator() : current() { } - - /** - * This %iterator will move in the opposite direction that @p x does. - */ - explicit - reverse_iterator(iterator_type __x) : current(__x) { } - - /** - * The copy constructor is normal. - */ - reverse_iterator(const reverse_iterator& __x) - : current(__x.current) { } - - /** - * A %reverse_iterator across other types can be copied if the - * underlying %iterator can be converted to the type of @c current. - */ - template - reverse_iterator(const reverse_iterator<_Iter>& __x) - : current(__x.base()) { } - - /** - * @return @c current, the %iterator used for underlying work. - */ - iterator_type - base() const - { return current; } - - /** - * @return A reference to the value at @c --current - * - * This requires that @c --current is dereferenceable. - * - * @warning This implementation requires that for an iterator of the - * underlying iterator type, @c x, a reference obtained by - * @c *x remains valid after @c x has been modified or - * destroyed. This is a bug: http://gcc.gnu.org/PR51823 - */ - reference - operator*() const - { - _Iterator __tmp = current; - return *--__tmp; - } - - /** - * @return A pointer to the value at @c --current - * - * This requires that @c --current is dereferenceable. - */ - pointer - operator->() const - { return &(operator*()); } - - /** - * @return @c *this - * - * Decrements the underlying iterator. - */ - reverse_iterator& - operator++() - { - --current; - return *this; - } - - /** - * @return The original value of @c *this - * - * Decrements the underlying iterator. - */ - reverse_iterator - operator++(int) - { - reverse_iterator __tmp = *this; - --current; - return __tmp; - } - - /** - * @return @c *this - * - * Increments the underlying iterator. - */ - reverse_iterator& - operator--() - { - ++current; - return *this; - } - - /** - * @return A reverse_iterator with the previous value of @c *this - * - * Increments the underlying iterator. - */ - reverse_iterator - operator--(int) - { - reverse_iterator __tmp = *this; - ++current; - return __tmp; - } - - /** - * @return A reverse_iterator that refers to @c current - @a __n - * - * The underlying iterator must be a Random Access Iterator. - */ - reverse_iterator - operator+(difference_type __n) const - { return reverse_iterator(current - __n); } - - /** - * @return *this - * - * Moves the underlying iterator backwards @a __n steps. - * The underlying iterator must be a Random Access Iterator. - */ - reverse_iterator& - operator+=(difference_type __n) - { - current -= __n; - return *this; - } - - /** - * @return A reverse_iterator that refers to @c current - @a __n - * - * The underlying iterator must be a Random Access Iterator. - */ - reverse_iterator - operator-(difference_type __n) const - { return reverse_iterator(current + __n); } - - /** - * @return *this - * - * Moves the underlying iterator forwards @a __n steps. - * The underlying iterator must be a Random Access Iterator. - */ - reverse_iterator& - operator-=(difference_type __n) - { - current += __n; - return *this; - } - - /** - * @return The value at @c current - @a __n - 1 - * - * The underlying iterator must be a Random Access Iterator. - */ - reference - operator[](difference_type __n) const - { return *(*this + __n); } - }; - - //@{ - /** - * @param __x A %reverse_iterator. - * @param __y A %reverse_iterator. - * @return A simple bool. - * - * Reverse iterators forward many operations to their underlying base() - * iterators. Others are implemented in terms of one another. - * - */ - template - inline bool - operator==(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) - { return __x.base() == __y.base(); } - - template - inline bool - operator<(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) - { return __y.base() < __x.base(); } - - template - inline bool - operator!=(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) - { return !(__x == __y); } - - template - inline bool - operator>(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) - { return __y < __x; } - - template - inline bool - operator<=(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) - { return !(__y < __x); } - - template - inline bool - operator>=(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) - { return !(__x < __y); } - - template - inline typename reverse_iterator<_Iterator>::difference_type - operator-(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) - { return __y.base() - __x.base(); } - - template - inline reverse_iterator<_Iterator> - operator+(typename reverse_iterator<_Iterator>::difference_type __n, - const reverse_iterator<_Iterator>& __x) - { return reverse_iterator<_Iterator>(__x.base() - __n); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 280. Comparison of reverse_iterator to const reverse_iterator. - template - inline bool - operator==(const reverse_iterator<_IteratorL>& __x, - const reverse_iterator<_IteratorR>& __y) - { return __x.base() == __y.base(); } - - template - inline bool - operator<(const reverse_iterator<_IteratorL>& __x, - const reverse_iterator<_IteratorR>& __y) - { return __y.base() < __x.base(); } - - template - inline bool - operator!=(const reverse_iterator<_IteratorL>& __x, - const reverse_iterator<_IteratorR>& __y) - { return !(__x == __y); } - - template - inline bool - operator>(const reverse_iterator<_IteratorL>& __x, - const reverse_iterator<_IteratorR>& __y) - { return __y < __x; } - - template - inline bool - operator<=(const reverse_iterator<_IteratorL>& __x, - const reverse_iterator<_IteratorR>& __y) - { return !(__y < __x); } - - template - inline bool - operator>=(const reverse_iterator<_IteratorL>& __x, - const reverse_iterator<_IteratorR>& __y) - { return !(__x < __y); } - - template -#if __cplusplus >= 201103L - // DR 685. - inline auto - operator-(const reverse_iterator<_IteratorL>& __x, - const reverse_iterator<_IteratorR>& __y) - -> decltype(__y.base() - __x.base()) -#else - inline typename reverse_iterator<_IteratorL>::difference_type - operator-(const reverse_iterator<_IteratorL>& __x, - const reverse_iterator<_IteratorR>& __y) -#endif - { return __y.base() - __x.base(); } - //@} - -#if __cplusplus > 201103L -#define __cpp_lib_make_reverse_iterator 201402 - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 2285. make_reverse_iterator - /// Generator function for reverse_iterator. - template - inline reverse_iterator<_Iterator> - make_reverse_iterator(_Iterator __i) - { return reverse_iterator<_Iterator>(__i); } -#endif - - // 24.4.2.2.1 back_insert_iterator - /** - * @brief Turns assignment into insertion. - * - * These are output iterators, constructed from a container-of-T. - * Assigning a T to the iterator appends it to the container using - * push_back. - * - * Tip: Using the back_inserter function to create these iterators can - * save typing. - */ - template - class back_insert_iterator - : public iterator - { - protected: - _Container* container; - - public: - /// A nested typedef for the type of whatever container you used. - typedef _Container container_type; - - /// The only way to create this %iterator is with a container. - explicit - back_insert_iterator(_Container& __x) : container(&__x) { } - - /** - * @param __value An instance of whatever type - * container_type::const_reference is; presumably a - * reference-to-const T for container. - * @return This %iterator, for chained operations. - * - * This kind of %iterator doesn't really have a @a position in the - * container (you can think of the position as being permanently at - * the end, if you like). Assigning a value to the %iterator will - * always append the value to the end of the container. - */ -#if __cplusplus < 201103L - back_insert_iterator& - operator=(typename _Container::const_reference __value) - { - container->push_back(__value); - return *this; - } -#else - back_insert_iterator& - operator=(const typename _Container::value_type& __value) - { - container->push_back(__value); - return *this; - } - - back_insert_iterator& - operator=(typename _Container::value_type&& __value) - { - container->push_back(std::move(__value)); - return *this; - } -#endif - - /// Simply returns *this. - back_insert_iterator& - operator*() - { return *this; } - - /// Simply returns *this. (This %iterator does not @a move.) - back_insert_iterator& - operator++() - { return *this; } - - /// Simply returns *this. (This %iterator does not @a move.) - back_insert_iterator - operator++(int) - { return *this; } - }; - - /** - * @param __x A container of arbitrary type. - * @return An instance of back_insert_iterator working on @p __x. - * - * This wrapper function helps in creating back_insert_iterator instances. - * Typing the name of the %iterator requires knowing the precise full - * type of the container, which can be tedious and impedes generic - * programming. Using this function lets you take advantage of automatic - * template parameter deduction, making the compiler match the correct - * types for you. - */ - template - inline back_insert_iterator<_Container> - back_inserter(_Container& __x) - { return back_insert_iterator<_Container>(__x); } - - /** - * @brief Turns assignment into insertion. - * - * These are output iterators, constructed from a container-of-T. - * Assigning a T to the iterator prepends it to the container using - * push_front. - * - * Tip: Using the front_inserter function to create these iterators can - * save typing. - */ - template - class front_insert_iterator - : public iterator - { - protected: - _Container* container; - - public: - /// A nested typedef for the type of whatever container you used. - typedef _Container container_type; - - /// The only way to create this %iterator is with a container. - explicit front_insert_iterator(_Container& __x) : container(&__x) { } - - /** - * @param __value An instance of whatever type - * container_type::const_reference is; presumably a - * reference-to-const T for container. - * @return This %iterator, for chained operations. - * - * This kind of %iterator doesn't really have a @a position in the - * container (you can think of the position as being permanently at - * the front, if you like). Assigning a value to the %iterator will - * always prepend the value to the front of the container. - */ -#if __cplusplus < 201103L - front_insert_iterator& - operator=(typename _Container::const_reference __value) - { - container->push_front(__value); - return *this; - } -#else - front_insert_iterator& - operator=(const typename _Container::value_type& __value) - { - container->push_front(__value); - return *this; - } - - front_insert_iterator& - operator=(typename _Container::value_type&& __value) - { - container->push_front(std::move(__value)); - return *this; - } -#endif - - /// Simply returns *this. - front_insert_iterator& - operator*() - { return *this; } - - /// Simply returns *this. (This %iterator does not @a move.) - front_insert_iterator& - operator++() - { return *this; } - - /// Simply returns *this. (This %iterator does not @a move.) - front_insert_iterator - operator++(int) - { return *this; } - }; - - /** - * @param __x A container of arbitrary type. - * @return An instance of front_insert_iterator working on @p x. - * - * This wrapper function helps in creating front_insert_iterator instances. - * Typing the name of the %iterator requires knowing the precise full - * type of the container, which can be tedious and impedes generic - * programming. Using this function lets you take advantage of automatic - * template parameter deduction, making the compiler match the correct - * types for you. - */ - template - inline front_insert_iterator<_Container> - front_inserter(_Container& __x) - { return front_insert_iterator<_Container>(__x); } - - /** - * @brief Turns assignment into insertion. - * - * These are output iterators, constructed from a container-of-T. - * Assigning a T to the iterator inserts it in the container at the - * %iterator's position, rather than overwriting the value at that - * position. - * - * (Sequences will actually insert a @e copy of the value before the - * %iterator's position.) - * - * Tip: Using the inserter function to create these iterators can - * save typing. - */ - template - class insert_iterator - : public iterator - { - protected: - _Container* container; - typename _Container::iterator iter; - - public: - /// A nested typedef for the type of whatever container you used. - typedef _Container container_type; - - /** - * The only way to create this %iterator is with a container and an - * initial position (a normal %iterator into the container). - */ - insert_iterator(_Container& __x, typename _Container::iterator __i) - : container(&__x), iter(__i) {} - - /** - * @param __value An instance of whatever type - * container_type::const_reference is; presumably a - * reference-to-const T for container. - * @return This %iterator, for chained operations. - * - * This kind of %iterator maintains its own position in the - * container. Assigning a value to the %iterator will insert the - * value into the container at the place before the %iterator. - * - * The position is maintained such that subsequent assignments will - * insert values immediately after one another. For example, - * @code - * // vector v contains A and Z - * - * insert_iterator i (v, ++v.begin()); - * i = 1; - * i = 2; - * i = 3; - * - * // vector v contains A, 1, 2, 3, and Z - * @endcode - */ -#if __cplusplus < 201103L - insert_iterator& - operator=(typename _Container::const_reference __value) - { - iter = container->insert(iter, __value); - ++iter; - return *this; - } -#else - insert_iterator& - operator=(const typename _Container::value_type& __value) - { - iter = container->insert(iter, __value); - ++iter; - return *this; - } - - insert_iterator& - operator=(typename _Container::value_type&& __value) - { - iter = container->insert(iter, std::move(__value)); - ++iter; - return *this; - } -#endif - - /// Simply returns *this. - insert_iterator& - operator*() - { return *this; } - - /// Simply returns *this. (This %iterator does not @a move.) - insert_iterator& - operator++() - { return *this; } - - /// Simply returns *this. (This %iterator does not @a move.) - insert_iterator& - operator++(int) - { return *this; } - }; - - /** - * @param __x A container of arbitrary type. - * @return An instance of insert_iterator working on @p __x. - * - * This wrapper function helps in creating insert_iterator instances. - * Typing the name of the %iterator requires knowing the precise full - * type of the container, which can be tedious and impedes generic - * programming. Using this function lets you take advantage of automatic - * template parameter deduction, making the compiler match the correct - * types for you. - */ - template - inline insert_iterator<_Container> - inserter(_Container& __x, _Iterator __i) - { - return insert_iterator<_Container>(__x, - typename _Container::iterator(__i)); - } - - // @} group iterators - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // This iterator adapter is @a normal in the sense that it does not - // change the semantics of any of the operators of its iterator - // parameter. Its primary purpose is to convert an iterator that is - // not a class, e.g. a pointer, into an iterator that is a class. - // The _Container parameter exists solely so that different containers - // using this template can instantiate different types, even if the - // _Iterator parameter is the same. - using std::iterator_traits; - using std::iterator; - template - class __normal_iterator - { - protected: - _Iterator _M_current; - - typedef iterator_traits<_Iterator> __traits_type; - - public: - typedef _Iterator iterator_type; - typedef typename __traits_type::iterator_category iterator_category; - typedef typename __traits_type::value_type value_type; - typedef typename __traits_type::difference_type difference_type; - typedef typename __traits_type::reference reference; - typedef typename __traits_type::pointer pointer; - - _GLIBCXX_CONSTEXPR __normal_iterator() _GLIBCXX_NOEXCEPT - : _M_current(_Iterator()) { } - - explicit - __normal_iterator(const _Iterator& __i) _GLIBCXX_NOEXCEPT - : _M_current(__i) { } - - // Allow iterator to const_iterator conversion - template - __normal_iterator(const __normal_iterator<_Iter, - typename __enable_if< - (std::__are_same<_Iter, typename _Container::pointer>::__value), - _Container>::__type>& __i) _GLIBCXX_NOEXCEPT - : _M_current(__i.base()) { } - - // Forward iterator requirements - reference - operator*() const _GLIBCXX_NOEXCEPT - { return *_M_current; } - - pointer - operator->() const _GLIBCXX_NOEXCEPT - { return _M_current; } - - __normal_iterator& - operator++() _GLIBCXX_NOEXCEPT - { - ++_M_current; - return *this; - } - - __normal_iterator - operator++(int) _GLIBCXX_NOEXCEPT - { return __normal_iterator(_M_current++); } - - // Bidirectional iterator requirements - __normal_iterator& - operator--() _GLIBCXX_NOEXCEPT - { - --_M_current; - return *this; - } - - __normal_iterator - operator--(int) _GLIBCXX_NOEXCEPT - { return __normal_iterator(_M_current--); } - - // Random access iterator requirements - reference - operator[](difference_type __n) const _GLIBCXX_NOEXCEPT - { return _M_current[__n]; } - - __normal_iterator& - operator+=(difference_type __n) _GLIBCXX_NOEXCEPT - { _M_current += __n; return *this; } - - __normal_iterator - operator+(difference_type __n) const _GLIBCXX_NOEXCEPT - { return __normal_iterator(_M_current + __n); } - - __normal_iterator& - operator-=(difference_type __n) _GLIBCXX_NOEXCEPT - { _M_current -= __n; return *this; } - - __normal_iterator - operator-(difference_type __n) const _GLIBCXX_NOEXCEPT - { return __normal_iterator(_M_current - __n); } - - const _Iterator& - base() const _GLIBCXX_NOEXCEPT - { return _M_current; } - }; - - // Note: In what follows, the left- and right-hand-side iterators are - // allowed to vary in types (conceptually in cv-qualification) so that - // comparison between cv-qualified and non-cv-qualified iterators be - // valid. However, the greedy and unfriendly operators in std::rel_ops - // will make overload resolution ambiguous (when in scope) if we don't - // provide overloads whose operands are of the same type. Can someone - // remind me what generic programming is about? -- Gaby - - // Forward iterator requirements - template - inline bool - operator==(const __normal_iterator<_IteratorL, _Container>& __lhs, - const __normal_iterator<_IteratorR, _Container>& __rhs) - _GLIBCXX_NOEXCEPT - { return __lhs.base() == __rhs.base(); } - - template - inline bool - operator==(const __normal_iterator<_Iterator, _Container>& __lhs, - const __normal_iterator<_Iterator, _Container>& __rhs) - _GLIBCXX_NOEXCEPT - { return __lhs.base() == __rhs.base(); } - - template - inline bool - operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs, - const __normal_iterator<_IteratorR, _Container>& __rhs) - _GLIBCXX_NOEXCEPT - { return __lhs.base() != __rhs.base(); } - - template - inline bool - operator!=(const __normal_iterator<_Iterator, _Container>& __lhs, - const __normal_iterator<_Iterator, _Container>& __rhs) - _GLIBCXX_NOEXCEPT - { return __lhs.base() != __rhs.base(); } - - // Random access iterator requirements - template - inline bool - operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, - const __normal_iterator<_IteratorR, _Container>& __rhs) - _GLIBCXX_NOEXCEPT - { return __lhs.base() < __rhs.base(); } - - template - inline bool - operator<(const __normal_iterator<_Iterator, _Container>& __lhs, - const __normal_iterator<_Iterator, _Container>& __rhs) - _GLIBCXX_NOEXCEPT - { return __lhs.base() < __rhs.base(); } - - template - inline bool - operator>(const __normal_iterator<_IteratorL, _Container>& __lhs, - const __normal_iterator<_IteratorR, _Container>& __rhs) - _GLIBCXX_NOEXCEPT - { return __lhs.base() > __rhs.base(); } - - template - inline bool - operator>(const __normal_iterator<_Iterator, _Container>& __lhs, - const __normal_iterator<_Iterator, _Container>& __rhs) - _GLIBCXX_NOEXCEPT - { return __lhs.base() > __rhs.base(); } - - template - inline bool - operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs, - const __normal_iterator<_IteratorR, _Container>& __rhs) - _GLIBCXX_NOEXCEPT - { return __lhs.base() <= __rhs.base(); } - - template - inline bool - operator<=(const __normal_iterator<_Iterator, _Container>& __lhs, - const __normal_iterator<_Iterator, _Container>& __rhs) - _GLIBCXX_NOEXCEPT - { return __lhs.base() <= __rhs.base(); } - - template - inline bool - operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs, - const __normal_iterator<_IteratorR, _Container>& __rhs) - _GLIBCXX_NOEXCEPT - { return __lhs.base() >= __rhs.base(); } - - template - inline bool - operator>=(const __normal_iterator<_Iterator, _Container>& __lhs, - const __normal_iterator<_Iterator, _Container>& __rhs) - _GLIBCXX_NOEXCEPT - { return __lhs.base() >= __rhs.base(); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // According to the resolution of DR179 not only the various comparison - // operators but also operator- must accept mixed iterator/const_iterator - // parameters. - template -#if __cplusplus >= 201103L - // DR 685. - inline auto - operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, - const __normal_iterator<_IteratorR, _Container>& __rhs) noexcept - -> decltype(__lhs.base() - __rhs.base()) -#else - inline typename __normal_iterator<_IteratorL, _Container>::difference_type - operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, - const __normal_iterator<_IteratorR, _Container>& __rhs) -#endif - { return __lhs.base() - __rhs.base(); } - - template - inline typename __normal_iterator<_Iterator, _Container>::difference_type - operator-(const __normal_iterator<_Iterator, _Container>& __lhs, - const __normal_iterator<_Iterator, _Container>& __rhs) - _GLIBCXX_NOEXCEPT - { return __lhs.base() - __rhs.base(); } - - template - inline __normal_iterator<_Iterator, _Container> - operator+(typename __normal_iterator<_Iterator, _Container>::difference_type - __n, const __normal_iterator<_Iterator, _Container>& __i) - _GLIBCXX_NOEXCEPT - { return __normal_iterator<_Iterator, _Container>(__i.base() + __n); } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#if __cplusplus >= 201103L - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup iterators - * @{ - */ - - // 24.4.3 Move iterators - /** - * Class template move_iterator is an iterator adapter with the same - * behavior as the underlying iterator except that its dereference - * operator implicitly converts the value returned by the underlying - * iterator's dereference operator to an rvalue reference. Some - * generic algorithms can be called with move iterators to replace - * copying with moving. - */ - template - class move_iterator - { - protected: - _Iterator _M_current; - - typedef iterator_traits<_Iterator> __traits_type; - typedef typename __traits_type::reference __base_ref; - - public: - typedef _Iterator iterator_type; - typedef typename __traits_type::iterator_category iterator_category; - typedef typename __traits_type::value_type value_type; - typedef typename __traits_type::difference_type difference_type; - // NB: DR 680. - typedef _Iterator pointer; - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2106. move_iterator wrapping iterators returning prvalues - typedef typename conditional::value, - typename remove_reference<__base_ref>::type&&, - __base_ref>::type reference; - - move_iterator() - : _M_current() { } - - explicit - move_iterator(iterator_type __i) - : _M_current(__i) { } - - template - move_iterator(const move_iterator<_Iter>& __i) - : _M_current(__i.base()) { } - - iterator_type - base() const - { return _M_current; } - - reference - operator*() const - { return static_cast(*_M_current); } - - pointer - operator->() const - { return _M_current; } - - move_iterator& - operator++() - { - ++_M_current; - return *this; - } - - move_iterator - operator++(int) - { - move_iterator __tmp = *this; - ++_M_current; - return __tmp; - } - - move_iterator& - operator--() - { - --_M_current; - return *this; - } - - move_iterator - operator--(int) - { - move_iterator __tmp = *this; - --_M_current; - return __tmp; - } - - move_iterator - operator+(difference_type __n) const - { return move_iterator(_M_current + __n); } - - move_iterator& - operator+=(difference_type __n) - { - _M_current += __n; - return *this; - } - - move_iterator - operator-(difference_type __n) const - { return move_iterator(_M_current - __n); } - - move_iterator& - operator-=(difference_type __n) - { - _M_current -= __n; - return *this; - } - - reference - operator[](difference_type __n) const - { return std::move(_M_current[__n]); } - }; - - // Note: See __normal_iterator operators note from Gaby to understand - // why there are always 2 versions for most of the move_iterator - // operators. - template - inline bool - operator==(const move_iterator<_IteratorL>& __x, - const move_iterator<_IteratorR>& __y) - { return __x.base() == __y.base(); } - - template - inline bool - operator==(const move_iterator<_Iterator>& __x, - const move_iterator<_Iterator>& __y) - { return __x.base() == __y.base(); } - - template - inline bool - operator!=(const move_iterator<_IteratorL>& __x, - const move_iterator<_IteratorR>& __y) - { return !(__x == __y); } - - template - inline bool - operator!=(const move_iterator<_Iterator>& __x, - const move_iterator<_Iterator>& __y) - { return !(__x == __y); } - - template - inline bool - operator<(const move_iterator<_IteratorL>& __x, - const move_iterator<_IteratorR>& __y) - { return __x.base() < __y.base(); } - - template - inline bool - operator<(const move_iterator<_Iterator>& __x, - const move_iterator<_Iterator>& __y) - { return __x.base() < __y.base(); } - - template - inline bool - operator<=(const move_iterator<_IteratorL>& __x, - const move_iterator<_IteratorR>& __y) - { return !(__y < __x); } - - template - inline bool - operator<=(const move_iterator<_Iterator>& __x, - const move_iterator<_Iterator>& __y) - { return !(__y < __x); } - - template - inline bool - operator>(const move_iterator<_IteratorL>& __x, - const move_iterator<_IteratorR>& __y) - { return __y < __x; } - - template - inline bool - operator>(const move_iterator<_Iterator>& __x, - const move_iterator<_Iterator>& __y) - { return __y < __x; } - - template - inline bool - operator>=(const move_iterator<_IteratorL>& __x, - const move_iterator<_IteratorR>& __y) - { return !(__x < __y); } - - template - inline bool - operator>=(const move_iterator<_Iterator>& __x, - const move_iterator<_Iterator>& __y) - { return !(__x < __y); } - - // DR 685. - template - inline auto - operator-(const move_iterator<_IteratorL>& __x, - const move_iterator<_IteratorR>& __y) - -> decltype(__x.base() - __y.base()) - { return __x.base() - __y.base(); } - - template - inline auto - operator-(const move_iterator<_Iterator>& __x, - const move_iterator<_Iterator>& __y) - -> decltype(__x.base() - __y.base()) - { return __x.base() - __y.base(); } - - template - inline move_iterator<_Iterator> - operator+(typename move_iterator<_Iterator>::difference_type __n, - const move_iterator<_Iterator>& __x) - { return __x + __n; } - - template - inline move_iterator<_Iterator> - make_move_iterator(_Iterator __i) - { return move_iterator<_Iterator>(__i); } - - template::value_type>::value, - _Iterator, move_iterator<_Iterator>>::type> - inline _ReturnType - __make_move_if_noexcept_iterator(_Iterator __i) - { return _ReturnType(__i); } - - // @} group iterators - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) std::make_move_iterator(_Iter) -#define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) \ - std::__make_move_if_noexcept_iterator(_Iter) -#else -#define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) (_Iter) -#define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) (_Iter) -#endif // C++11 - -#endif diff --git a/openflow/usr/include/c++/5/bits/stl_iterator_base_funcs.h b/openflow/usr/include/c++/5/bits/stl_iterator_base_funcs.h deleted file mode 100644 index a146611..0000000 --- a/openflow/usr/include/c++/5/bits/stl_iterator_base_funcs.h +++ /dev/null @@ -1,205 +0,0 @@ -// Functions used by iterators -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_iterator_base_funcs.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iterator} - * - * This file contains all of the general iterator-related utility - * functions, such as distance() and advance(). - */ - -#ifndef _STL_ITERATOR_BASE_FUNCS_H -#define _STL_ITERATOR_BASE_FUNCS_H 1 - -#pragma GCC system_header - -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - inline typename iterator_traits<_InputIterator>::difference_type - __distance(_InputIterator __first, _InputIterator __last, - input_iterator_tag) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - - typename iterator_traits<_InputIterator>::difference_type __n = 0; - while (__first != __last) - { - ++__first; - ++__n; - } - return __n; - } - - template - inline typename iterator_traits<_RandomAccessIterator>::difference_type - __distance(_RandomAccessIterator __first, _RandomAccessIterator __last, - random_access_iterator_tag) - { - // concept requirements - __glibcxx_function_requires(_RandomAccessIteratorConcept< - _RandomAccessIterator>) - return __last - __first; - } - - /** - * @brief A generalization of pointer arithmetic. - * @param __first An input iterator. - * @param __last An input iterator. - * @return The distance between them. - * - * Returns @c n such that __first + n == __last. This requires - * that @p __last must be reachable from @p __first. Note that @c - * n may be negative. - * - * For random access iterators, this uses their @c + and @c - operations - * and are constant time. For other %iterator classes they are linear time. - */ - template - inline typename iterator_traits<_InputIterator>::difference_type - distance(_InputIterator __first, _InputIterator __last) - { - // concept requirements -- taken care of in __distance - return std::__distance(__first, __last, - std::__iterator_category(__first)); - } - - template - inline void - __advance(_InputIterator& __i, _Distance __n, input_iterator_tag) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - _GLIBCXX_DEBUG_ASSERT(__n >= 0); - while (__n--) - ++__i; - } - - template - inline void - __advance(_BidirectionalIterator& __i, _Distance __n, - bidirectional_iterator_tag) - { - // concept requirements - __glibcxx_function_requires(_BidirectionalIteratorConcept< - _BidirectionalIterator>) - if (__n > 0) - while (__n--) - ++__i; - else - while (__n++) - --__i; - } - - template - inline void - __advance(_RandomAccessIterator& __i, _Distance __n, - random_access_iterator_tag) - { - // concept requirements - __glibcxx_function_requires(_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __i += __n; - } - - /** - * @brief A generalization of pointer arithmetic. - * @param __i An input iterator. - * @param __n The @a delta by which to change @p __i. - * @return Nothing. - * - * This increments @p i by @p n. For bidirectional and random access - * iterators, @p __n may be negative, in which case @p __i is decremented. - * - * For random access iterators, this uses their @c + and @c - operations - * and are constant time. For other %iterator classes they are linear time. - */ - template - inline void - advance(_InputIterator& __i, _Distance __n) - { - // concept requirements -- taken care of in __advance - typename iterator_traits<_InputIterator>::difference_type __d = __n; - std::__advance(__i, __d, std::__iterator_category(__i)); - } - -#if __cplusplus >= 201103L - - template - inline _ForwardIterator - next(_ForwardIterator __x, typename - iterator_traits<_ForwardIterator>::difference_type __n = 1) - { - std::advance(__x, __n); - return __x; - } - - template - inline _BidirectionalIterator - prev(_BidirectionalIterator __x, typename - iterator_traits<_BidirectionalIterator>::difference_type __n = 1) - { - std::advance(__x, -__n); - return __x; - } - -#endif // C++11 - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _STL_ITERATOR_BASE_FUNCS_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_iterator_base_types.h b/openflow/usr/include/c++/5/bits/stl_iterator_base_types.h deleted file mode 100644 index 83e6444..0000000 --- a/openflow/usr/include/c++/5/bits/stl_iterator_base_types.h +++ /dev/null @@ -1,239 +0,0 @@ -// Types used in iterator implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_iterator_base_types.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iterator} - * - * This file contains all of the general iterator-related utility types, - * such as iterator_traits and struct iterator. - */ - -#ifndef _STL_ITERATOR_BASE_TYPES_H -#define _STL_ITERATOR_BASE_TYPES_H 1 - -#pragma GCC system_header - -#include - -#if __cplusplus >= 201103L -# include // For __void_t, is_convertible -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @defgroup iterators Iterators - * Abstractions for uniform iterating through various underlying types. - */ - //@{ - - /** - * @defgroup iterator_tags Iterator Tags - * These are empty types, used to distinguish different iterators. The - * distinction is not made by what they contain, but simply by what they - * are. Different underlying algorithms can then be used based on the - * different operations supported by different iterator types. - */ - //@{ - /// Marking input iterators. - struct input_iterator_tag { }; - - /// Marking output iterators. - struct output_iterator_tag { }; - - /// Forward iterators support a superset of input iterator operations. - struct forward_iterator_tag : public input_iterator_tag { }; - - /// Bidirectional iterators support a superset of forward iterator - /// operations. - struct bidirectional_iterator_tag : public forward_iterator_tag { }; - - /// Random-access iterators support a superset of bidirectional - /// iterator operations. - struct random_access_iterator_tag : public bidirectional_iterator_tag { }; - //@} - - /** - * @brief Common %iterator class. - * - * This class does nothing but define nested typedefs. %Iterator classes - * can inherit from this class to save some work. The typedefs are then - * used in specializations and overloading. - * - * In particular, there are no default implementations of requirements - * such as @c operator++ and the like. (How could there be?) - */ - template - struct iterator - { - /// One of the @link iterator_tags tag types@endlink. - typedef _Category iterator_category; - /// The type "pointed to" by the iterator. - typedef _Tp value_type; - /// Distance between iterators is represented as this type. - typedef _Distance difference_type; - /// This type represents a pointer-to-value_type. - typedef _Pointer pointer; - /// This type represents a reference-to-value_type. - typedef _Reference reference; - }; - - /** - * @brief Traits class for iterators. - * - * This class does nothing but define nested typedefs. The general - * version simply @a forwards the nested typedefs from the Iterator - * argument. Specialized versions for pointers and pointers-to-const - * provide tighter, more correct semantics. - */ -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2408. SFINAE-friendly common_type/iterator_traits is missing in C++14 - template> - struct __iterator_traits { }; - - template - struct __iterator_traits<_Iterator, - __void_t> - { - typedef typename _Iterator::iterator_category iterator_category; - typedef typename _Iterator::value_type value_type; - typedef typename _Iterator::difference_type difference_type; - typedef typename _Iterator::pointer pointer; - typedef typename _Iterator::reference reference; - }; - - template - struct iterator_traits - : public __iterator_traits<_Iterator> { }; -#else - template - struct iterator_traits - { - typedef typename _Iterator::iterator_category iterator_category; - typedef typename _Iterator::value_type value_type; - typedef typename _Iterator::difference_type difference_type; - typedef typename _Iterator::pointer pointer; - typedef typename _Iterator::reference reference; - }; -#endif - - /// Partial specialization for pointer types. - template - struct iterator_traits<_Tp*> - { - typedef random_access_iterator_tag iterator_category; - typedef _Tp value_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef _Tp& reference; - }; - - /// Partial specialization for const pointer types. - template - struct iterator_traits - { - typedef random_access_iterator_tag iterator_category; - typedef _Tp value_type; - typedef ptrdiff_t difference_type; - typedef const _Tp* pointer; - typedef const _Tp& reference; - }; - - /** - * This function is not a part of the C++ standard but is syntactic - * sugar for internal library use only. - */ - template - inline typename iterator_traits<_Iter>::iterator_category - __iterator_category(const _Iter&) - { return typename iterator_traits<_Iter>::iterator_category(); } - - //@} - - // If _Iterator has a base returns it otherwise _Iterator is returned - // untouched - template - struct _Iter_base - { - typedef _Iterator iterator_type; - static iterator_type _S_base(_Iterator __it) - { return __it; } - }; - - template - struct _Iter_base<_Iterator, true> - { - typedef typename _Iterator::iterator_type iterator_type; - static iterator_type _S_base(_Iterator __it) - { return __it.base(); } - }; - -#if __cplusplus >= 201103L - template - using _RequireInputIter = typename - enable_if::iterator_category, - input_iterator_tag>::value>::type; -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _STL_ITERATOR_BASE_TYPES_H */ - diff --git a/openflow/usr/include/c++/5/bits/stl_list.h b/openflow/usr/include/c++/5/bits/stl_list.h deleted file mode 100644 index f8bfff1..0000000 --- a/openflow/usr/include/c++/5/bits/stl_list.h +++ /dev/null @@ -1,1873 +0,0 @@ -// List implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_list.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{list} - */ - -#ifndef _STL_LIST_H -#define _STL_LIST_H 1 - -#include -#if __cplusplus >= 201103L -#include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ - namespace __detail - { - _GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Supporting structures are split into common and templated - // types; the latter publicly inherits from the former in an - // effort to reduce code duplication. This results in some - // "needless" static_cast'ing later on, but it's all safe - // downcasting. - - /// Common part of a node in the %list. - struct _List_node_base - { - _List_node_base* _M_next; - _List_node_base* _M_prev; - - static void - swap(_List_node_base& __x, _List_node_base& __y) _GLIBCXX_USE_NOEXCEPT; - - void - _M_transfer(_List_node_base* const __first, - _List_node_base* const __last) _GLIBCXX_USE_NOEXCEPT; - - void - _M_reverse() _GLIBCXX_USE_NOEXCEPT; - - void - _M_hook(_List_node_base* const __position) _GLIBCXX_USE_NOEXCEPT; - - void - _M_unhook() _GLIBCXX_USE_NOEXCEPT; - }; - - _GLIBCXX_END_NAMESPACE_VERSION - } // namespace detail - -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - /// An actual node in the %list. - template - struct _List_node : public __detail::_List_node_base - { - ///< User's data. - _Tp _M_data; - -#if __cplusplus >= 201103L - template - _List_node(_Args&&... __args) - : __detail::_List_node_base(), _M_data(std::forward<_Args>(__args)...) - { } -#endif - }; - - /** - * @brief A list::iterator. - * - * All the functions are op overloads. - */ - template - struct _List_iterator - { - typedef _List_iterator<_Tp> _Self; - typedef _List_node<_Tp> _Node; - - typedef ptrdiff_t difference_type; - typedef std::bidirectional_iterator_tag iterator_category; - typedef _Tp value_type; - typedef _Tp* pointer; - typedef _Tp& reference; - - _List_iterator() _GLIBCXX_NOEXCEPT - : _M_node() { } - - explicit - _List_iterator(__detail::_List_node_base* __x) _GLIBCXX_NOEXCEPT - : _M_node(__x) { } - - _Self - _M_const_cast() const _GLIBCXX_NOEXCEPT - { return *this; } - - // Must downcast from _List_node_base to _List_node to get to _M_data. - reference - operator*() const _GLIBCXX_NOEXCEPT - { return static_cast<_Node*>(_M_node)->_M_data; } - - pointer - operator->() const _GLIBCXX_NOEXCEPT - { return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); } - - _Self& - operator++() _GLIBCXX_NOEXCEPT - { - _M_node = _M_node->_M_next; - return *this; - } - - _Self - operator++(int) _GLIBCXX_NOEXCEPT - { - _Self __tmp = *this; - _M_node = _M_node->_M_next; - return __tmp; - } - - _Self& - operator--() _GLIBCXX_NOEXCEPT - { - _M_node = _M_node->_M_prev; - return *this; - } - - _Self - operator--(int) _GLIBCXX_NOEXCEPT - { - _Self __tmp = *this; - _M_node = _M_node->_M_prev; - return __tmp; - } - - bool - operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT - { return _M_node == __x._M_node; } - - bool - operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT - { return _M_node != __x._M_node; } - - // The only member points to the %list element. - __detail::_List_node_base* _M_node; - }; - - /** - * @brief A list::const_iterator. - * - * All the functions are op overloads. - */ - template - struct _List_const_iterator - { - typedef _List_const_iterator<_Tp> _Self; - typedef const _List_node<_Tp> _Node; - typedef _List_iterator<_Tp> iterator; - - typedef ptrdiff_t difference_type; - typedef std::bidirectional_iterator_tag iterator_category; - typedef _Tp value_type; - typedef const _Tp* pointer; - typedef const _Tp& reference; - - _List_const_iterator() _GLIBCXX_NOEXCEPT - : _M_node() { } - - explicit - _List_const_iterator(const __detail::_List_node_base* __x) - _GLIBCXX_NOEXCEPT - : _M_node(__x) { } - - _List_const_iterator(const iterator& __x) _GLIBCXX_NOEXCEPT - : _M_node(__x._M_node) { } - - iterator - _M_const_cast() const _GLIBCXX_NOEXCEPT - { return iterator(const_cast<__detail::_List_node_base*>(_M_node)); } - - // Must downcast from List_node_base to _List_node to get to - // _M_data. - reference - operator*() const _GLIBCXX_NOEXCEPT - { return static_cast<_Node*>(_M_node)->_M_data; } - - pointer - operator->() const _GLIBCXX_NOEXCEPT - { return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); } - - _Self& - operator++() _GLIBCXX_NOEXCEPT - { - _M_node = _M_node->_M_next; - return *this; - } - - _Self - operator++(int) _GLIBCXX_NOEXCEPT - { - _Self __tmp = *this; - _M_node = _M_node->_M_next; - return __tmp; - } - - _Self& - operator--() _GLIBCXX_NOEXCEPT - { - _M_node = _M_node->_M_prev; - return *this; - } - - _Self - operator--(int) _GLIBCXX_NOEXCEPT - { - _Self __tmp = *this; - _M_node = _M_node->_M_prev; - return __tmp; - } - - bool - operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT - { return _M_node == __x._M_node; } - - bool - operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT - { return _M_node != __x._M_node; } - - // The only member points to the %list element. - const __detail::_List_node_base* _M_node; - }; - - template - inline bool - operator==(const _List_iterator<_Val>& __x, - const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT - { return __x._M_node == __y._M_node; } - - template - inline bool - operator!=(const _List_iterator<_Val>& __x, - const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT - { return __x._M_node != __y._M_node; } - -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - /// See bits/stl_deque.h's _Deque_base for an explanation. - template - class _List_base - { - protected: - // NOTA BENE - // The stored instance is not actually of "allocator_type"'s - // type. Instead we rebind the type to - // Allocator>, which according to [20.1.5]/4 - // should probably be the same. List_node is not the same - // size as Tp (it's two pointers larger), and specializations on - // Tp may go unused because List_node is being bound - // instead. - // - // We put this to the test in the constructors and in - // get_allocator, where we use conversions between - // allocator_type and _Node_alloc_type. The conversion is - // required by table 32 in [20.1.5]. - typedef typename _Alloc::template rebind<_List_node<_Tp> >::other - _Node_alloc_type; - - typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type; - - static size_t - _S_distance(const __detail::_List_node_base* __first, - const __detail::_List_node_base* __last) - { - size_t __n = 0; - while (__first != __last) - { - __first = __first->_M_next; - ++__n; - } - return __n; - } - - struct _List_impl - : public _Node_alloc_type - { -#if _GLIBCXX_USE_CXX11_ABI - _List_node _M_node; -#else - __detail::_List_node_base _M_node; -#endif - - _List_impl() - : _Node_alloc_type(), _M_node() - { } - - _List_impl(const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT - : _Node_alloc_type(__a), _M_node() - { } - -#if __cplusplus >= 201103L - _List_impl(_Node_alloc_type&& __a) _GLIBCXX_NOEXCEPT - : _Node_alloc_type(std::move(__a)), _M_node() - { } -#endif - }; - - _List_impl _M_impl; - -#if _GLIBCXX_USE_CXX11_ABI - size_t _M_get_size() const { return _M_impl._M_node._M_data; } - - void _M_set_size(size_t __n) { _M_impl._M_node._M_data = __n; } - - void _M_inc_size(size_t __n) { _M_impl._M_node._M_data += __n; } - - void _M_dec_size(size_t __n) { _M_impl._M_node._M_data -= __n; } - - size_t - _M_distance(const __detail::_List_node_base* __first, - const __detail::_List_node_base* __last) const - { return _S_distance(__first, __last); } - - // return the stored size - size_t _M_node_count() const { return _M_impl._M_node._M_data; } -#else - // dummy implementations used when the size is not stored - size_t _M_get_size() const { return 0; } - void _M_set_size(size_t) { } - void _M_inc_size(size_t) { } - void _M_dec_size(size_t) { } - size_t _M_distance(const void*, const void*) const { return 0; } - - // count the number of nodes - size_t _M_node_count() const - { - return _S_distance(_M_impl._M_node._M_next, - std::__addressof(_M_impl._M_node)); - } -#endif - - _List_node<_Tp>* - _M_get_node() - { return _M_impl._Node_alloc_type::allocate(1); } - - void - _M_put_node(_List_node<_Tp>* __p) _GLIBCXX_NOEXCEPT - { _M_impl._Node_alloc_type::deallocate(__p, 1); } - - public: - typedef _Alloc allocator_type; - - _Node_alloc_type& - _M_get_Node_allocator() _GLIBCXX_NOEXCEPT - { return *static_cast<_Node_alloc_type*>(&_M_impl); } - - const _Node_alloc_type& - _M_get_Node_allocator() const _GLIBCXX_NOEXCEPT - { return *static_cast(&_M_impl); } - - _Tp_alloc_type - _M_get_Tp_allocator() const _GLIBCXX_NOEXCEPT - { return _Tp_alloc_type(_M_get_Node_allocator()); } - - allocator_type - get_allocator() const _GLIBCXX_NOEXCEPT - { return allocator_type(_M_get_Node_allocator()); } - - _List_base() - : _M_impl() - { _M_init(); } - - _List_base(const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT - : _M_impl(__a) - { _M_init(); } - -#if __cplusplus >= 201103L - _List_base(_List_base&& __x) noexcept - : _M_impl(std::move(__x._M_get_Node_allocator())) - { - auto* const __xnode = std::__addressof(__x._M_impl._M_node); - if (__xnode->_M_next == __xnode) - _M_init(); - else - { - auto* const __node = std::__addressof(_M_impl._M_node); - __node->_M_next = __xnode->_M_next; - __node->_M_prev = __xnode->_M_prev; - __node->_M_next->_M_prev = __node->_M_prev->_M_next = __node; - _M_set_size(__x._M_get_size()); - __x._M_init(); - } - } -#endif - - // This is what actually destroys the list. - ~_List_base() _GLIBCXX_NOEXCEPT - { _M_clear(); } - - void - _M_clear() _GLIBCXX_NOEXCEPT; - - void - _M_init() _GLIBCXX_NOEXCEPT - { - this->_M_impl._M_node._M_next = &this->_M_impl._M_node; - this->_M_impl._M_node._M_prev = &this->_M_impl._M_node; - _M_set_size(0); - } - }; - - /** - * @brief A standard container with linear time access to elements, - * and fixed time insertion/deletion at any point in the sequence. - * - * @ingroup sequences - * - * @tparam _Tp Type of element. - * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. - * - * Meets the requirements of a container, a - * reversible container, and a - * sequence, including the - * optional sequence requirements with the - * %exception of @c at and @c operator[]. - * - * This is a @e doubly @e linked %list. Traversal up and down the - * %list requires linear time, but adding and removing elements (or - * @e nodes) is done in constant time, regardless of where the - * change takes place. Unlike std::vector and std::deque, - * random-access iterators are not provided, so subscripting ( @c - * [] ) access is not allowed. For algorithms which only need - * sequential access, this lack makes no difference. - * - * Also unlike the other standard containers, std::list provides - * specialized algorithms %unique to linked lists, such as - * splicing, sorting, and in-place reversal. - * - * A couple points on memory allocation for list: - * - * First, we never actually allocate a Tp, we allocate - * List_node's and trust [20.1.5]/4 to DTRT. This is to ensure - * that after elements from %list are spliced into - * %list, destroying the memory of the second %list is a - * valid operation, i.e., Alloc1 giveth and Alloc2 taketh away. - * - * Second, a %list conceptually represented as - * @code - * A <---> B <---> C <---> D - * @endcode - * is actually circular; a link exists between A and D. The %list - * class holds (as its only data member) a private list::iterator - * pointing to @e D, not to @e A! To get to the head of the %list, - * we start at the tail and move forward by one. When this member - * iterator's next/previous pointers refer to itself, the %list is - * %empty. - */ - template > - class list : protected _List_base<_Tp, _Alloc> - { - // concept requirements - typedef typename _Alloc::value_type _Alloc_value_type; - __glibcxx_class_requires(_Tp, _SGIAssignableConcept) - __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept) - - typedef _List_base<_Tp, _Alloc> _Base; - typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; - typedef typename _Base::_Node_alloc_type _Node_alloc_type; - - public: - typedef _Tp value_type; - typedef typename _Tp_alloc_type::pointer pointer; - typedef typename _Tp_alloc_type::const_pointer const_pointer; - typedef typename _Tp_alloc_type::reference reference; - typedef typename _Tp_alloc_type::const_reference const_reference; - typedef _List_iterator<_Tp> iterator; - typedef _List_const_iterator<_Tp> const_iterator; - typedef std::reverse_iterator const_reverse_iterator; - typedef std::reverse_iterator reverse_iterator; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Alloc allocator_type; - - protected: - // Note that pointers-to-_Node's can be ctor-converted to - // iterator types. - typedef _List_node<_Tp> _Node; - - using _Base::_M_impl; - using _Base::_M_put_node; - using _Base::_M_get_node; - using _Base::_M_get_Tp_allocator; - using _Base::_M_get_Node_allocator; - - /** - * @param __args An instance of user data. - * - * Allocates space for a new node and constructs a copy of - * @a __args in it. - */ -#if __cplusplus < 201103L - _Node* - _M_create_node(const value_type& __x) - { - _Node* __p = this->_M_get_node(); - __try - { - _M_get_Tp_allocator().construct - (std::__addressof(__p->_M_data), __x); - } - __catch(...) - { - _M_put_node(__p); - __throw_exception_again; - } - return __p; - } -#else - template - _Node* - _M_create_node(_Args&&... __args) - { - _Node* __p = this->_M_get_node(); - __try - { - _M_get_Node_allocator().construct(__p, - std::forward<_Args>(__args)...); - } - __catch(...) - { - _M_put_node(__p); - __throw_exception_again; - } - return __p; - } -#endif - - public: - // [23.2.2.1] construct/copy/destroy - // (assign() and get_allocator() are also listed in this section) - - /** - * @brief Creates a %list with no elements. - */ - list() -#if __cplusplus >= 201103L - noexcept(is_nothrow_default_constructible<_Node_alloc_type>::value) -#endif - : _Base() { } - - /** - * @brief Creates a %list with no elements. - * @param __a An allocator object. - */ - explicit - list(const allocator_type& __a) _GLIBCXX_NOEXCEPT - : _Base(_Node_alloc_type(__a)) { } - -#if __cplusplus >= 201103L - /** - * @brief Creates a %list with default constructed elements. - * @param __n The number of elements to initially create. - * - * This constructor fills the %list with @a __n default - * constructed elements. - */ - explicit - list(size_type __n) - : _Base() - { _M_default_initialize(__n); } - - /** - * @brief Creates a %list with copies of an exemplar element. - * @param __n The number of elements to initially create. - * @param __value An element to copy. - * @param __a An allocator object. - * - * This constructor fills the %list with @a __n copies of @a __value. - */ - list(size_type __n, const value_type& __value, - const allocator_type& __a = allocator_type()) - : _Base(_Node_alloc_type(__a)) - { _M_fill_initialize(__n, __value); } -#else - /** - * @brief Creates a %list with copies of an exemplar element. - * @param __n The number of elements to initially create. - * @param __value An element to copy. - * @param __a An allocator object. - * - * This constructor fills the %list with @a __n copies of @a __value. - */ - explicit - list(size_type __n, const value_type& __value = value_type(), - const allocator_type& __a = allocator_type()) - : _Base(_Node_alloc_type(__a)) - { _M_fill_initialize(__n, __value); } -#endif - - /** - * @brief %List copy constructor. - * @param __x A %list of identical element and allocator types. - * - * The newly-created %list uses a copy of the allocation object used - * by @a __x. - */ - list(const list& __x) - : _Base(__x._M_get_Node_allocator()) - { _M_initialize_dispatch(__x.begin(), __x.end(), __false_type()); } - -#if __cplusplus >= 201103L - /** - * @brief %List move constructor. - * @param __x A %list of identical element and allocator types. - * - * The newly-created %list contains the exact contents of @a __x. - * The contents of @a __x are a valid, but unspecified %list. - */ - list(list&& __x) noexcept - : _Base(std::move(__x)) { } - - /** - * @brief Builds a %list from an initializer_list - * @param __l An initializer_list of value_type. - * @param __a An allocator object. - * - * Create a %list consisting of copies of the elements in the - * initializer_list @a __l. This is linear in __l.size(). - */ - list(initializer_list __l, - const allocator_type& __a = allocator_type()) - : _Base(_Node_alloc_type(__a)) - { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); } -#endif - - /** - * @brief Builds a %list from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __a An allocator object. - * - * Create a %list consisting of copies of the elements from - * [@a __first,@a __last). This is linear in N (where N is - * distance(@a __first,@a __last)). - */ -#if __cplusplus >= 201103L - template> - list(_InputIterator __first, _InputIterator __last, - const allocator_type& __a = allocator_type()) - : _Base(_Node_alloc_type(__a)) - { _M_initialize_dispatch(__first, __last, __false_type()); } -#else - template - list(_InputIterator __first, _InputIterator __last, - const allocator_type& __a = allocator_type()) - : _Base(_Node_alloc_type(__a)) - { - // Check whether it's an integral type. If so, it's not an iterator. - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - _M_initialize_dispatch(__first, __last, _Integral()); - } -#endif - - /** - * No explicit dtor needed as the _Base dtor takes care of - * things. The _Base dtor only erases the elements, and note - * that if the elements themselves are pointers, the pointed-to - * memory is not touched in any way. Managing the pointer is - * the user's responsibility. - */ - - /** - * @brief %List assignment operator. - * @param __x A %list of identical element and allocator types. - * - * All the elements of @a __x are copied, but unlike the copy - * constructor, the allocator object is not copied. - */ - list& - operator=(const list& __x); - -#if __cplusplus >= 201103L - /** - * @brief %List move assignment operator. - * @param __x A %list of identical element and allocator types. - * - * The contents of @a __x are moved into this %list (without copying). - * @a __x is a valid, but unspecified %list - */ - list& - operator=(list&& __x) - { - // NB: DR 1204. - // NB: DR 675. - this->clear(); - this->swap(__x); - return *this; - } - - /** - * @brief %List initializer list assignment operator. - * @param __l An initializer_list of value_type. - * - * Replace the contents of the %list with copies of the elements - * in the initializer_list @a __l. This is linear in l.size(). - */ - list& - operator=(initializer_list __l) - { - this->assign(__l.begin(), __l.end()); - return *this; - } -#endif - - /** - * @brief Assigns a given value to a %list. - * @param __n Number of elements to be assigned. - * @param __val Value to be assigned. - * - * This function fills a %list with @a __n copies of the given - * value. Note that the assignment completely changes the %list - * and that the resulting %list's size is the same as the number - * of elements assigned. Old data may be lost. - */ - void - assign(size_type __n, const value_type& __val) - { _M_fill_assign(__n, __val); } - - /** - * @brief Assigns a range to a %list. - * @param __first An input iterator. - * @param __last An input iterator. - * - * This function fills a %list with copies of the elements in the - * range [@a __first,@a __last). - * - * Note that the assignment completely changes the %list and - * that the resulting %list's size is the same as the number of - * elements assigned. Old data may be lost. - */ -#if __cplusplus >= 201103L - template> - void - assign(_InputIterator __first, _InputIterator __last) - { _M_assign_dispatch(__first, __last, __false_type()); } -#else - template - void - assign(_InputIterator __first, _InputIterator __last) - { - // Check whether it's an integral type. If so, it's not an iterator. - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Assigns an initializer_list to a %list. - * @param __l An initializer_list of value_type. - * - * Replace the contents of the %list with copies of the elements - * in the initializer_list @a __l. This is linear in __l.size(). - */ - void - assign(initializer_list __l) - { this->assign(__l.begin(), __l.end()); } -#endif - - /// Get a copy of the memory allocation object. - allocator_type - get_allocator() const _GLIBCXX_NOEXCEPT - { return _Base::get_allocator(); } - - // iterators - /** - * Returns a read/write iterator that points to the first element in the - * %list. Iteration is done in ordinary element order. - */ - iterator - begin() _GLIBCXX_NOEXCEPT - { return iterator(this->_M_impl._M_node._M_next); } - - /** - * Returns a read-only (constant) iterator that points to the - * first element in the %list. Iteration is done in ordinary - * element order. - */ - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(this->_M_impl._M_node._M_next); } - - /** - * Returns a read/write iterator that points one past the last - * element in the %list. Iteration is done in ordinary element - * order. - */ - iterator - end() _GLIBCXX_NOEXCEPT - { return iterator(&this->_M_impl._M_node); } - - /** - * Returns a read-only (constant) iterator that points one past - * the last element in the %list. Iteration is done in ordinary - * element order. - */ - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return const_iterator(&this->_M_impl._M_node); } - - /** - * Returns a read/write reverse iterator that points to the last - * element in the %list. Iteration is done in reverse element - * order. - */ - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return reverse_iterator(end()); } - - /** - * Returns a read-only (constant) reverse iterator that points to - * the last element in the %list. Iteration is done in reverse - * element order. - */ - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(end()); } - - /** - * Returns a read/write reverse iterator that points to one - * before the first element in the %list. Iteration is done in - * reverse element order. - */ - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return reverse_iterator(begin()); } - - /** - * Returns a read-only (constant) reverse iterator that points to one - * before the first element in the %list. Iteration is done in reverse - * element order. - */ - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(begin()); } - -#if __cplusplus >= 201103L - /** - * Returns a read-only (constant) iterator that points to the - * first element in the %list. Iteration is done in ordinary - * element order. - */ - const_iterator - cbegin() const noexcept - { return const_iterator(this->_M_impl._M_node._M_next); } - - /** - * Returns a read-only (constant) iterator that points one past - * the last element in the %list. Iteration is done in ordinary - * element order. - */ - const_iterator - cend() const noexcept - { return const_iterator(&this->_M_impl._M_node); } - - /** - * Returns a read-only (constant) reverse iterator that points to - * the last element in the %list. Iteration is done in reverse - * element order. - */ - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(end()); } - - /** - * Returns a read-only (constant) reverse iterator that points to one - * before the first element in the %list. Iteration is done in reverse - * element order. - */ - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(begin()); } -#endif - - // [23.2.2.2] capacity - /** - * Returns true if the %list is empty. (Thus begin() would equal - * end().) - */ - bool - empty() const _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; } - - /** Returns the number of elements in the %list. */ - size_type - size() const _GLIBCXX_NOEXCEPT - { return this->_M_node_count(); } - - /** Returns the size() of the largest possible %list. */ - size_type - max_size() const _GLIBCXX_NOEXCEPT - { return _M_get_Node_allocator().max_size(); } - -#if __cplusplus >= 201103L - /** - * @brief Resizes the %list to the specified number of elements. - * @param __new_size Number of elements the %list should contain. - * - * This function will %resize the %list to the specified number - * of elements. If the number is smaller than the %list's - * current size the %list is truncated, otherwise default - * constructed elements are appended. - */ - void - resize(size_type __new_size); - - /** - * @brief Resizes the %list to the specified number of elements. - * @param __new_size Number of elements the %list should contain. - * @param __x Data with which new elements should be populated. - * - * This function will %resize the %list to the specified number - * of elements. If the number is smaller than the %list's - * current size the %list is truncated, otherwise the %list is - * extended and new elements are populated with given data. - */ - void - resize(size_type __new_size, const value_type& __x); -#else - /** - * @brief Resizes the %list to the specified number of elements. - * @param __new_size Number of elements the %list should contain. - * @param __x Data with which new elements should be populated. - * - * This function will %resize the %list to the specified number - * of elements. If the number is smaller than the %list's - * current size the %list is truncated, otherwise the %list is - * extended and new elements are populated with given data. - */ - void - resize(size_type __new_size, value_type __x = value_type()); -#endif - - // element access - /** - * Returns a read/write reference to the data at the first - * element of the %list. - */ - reference - front() _GLIBCXX_NOEXCEPT - { return *begin(); } - - /** - * Returns a read-only (constant) reference to the data at the first - * element of the %list. - */ - const_reference - front() const _GLIBCXX_NOEXCEPT - { return *begin(); } - - /** - * Returns a read/write reference to the data at the last element - * of the %list. - */ - reference - back() _GLIBCXX_NOEXCEPT - { - iterator __tmp = end(); - --__tmp; - return *__tmp; - } - - /** - * Returns a read-only (constant) reference to the data at the last - * element of the %list. - */ - const_reference - back() const _GLIBCXX_NOEXCEPT - { - const_iterator __tmp = end(); - --__tmp; - return *__tmp; - } - - // [23.2.2.3] modifiers - /** - * @brief Add data to the front of the %list. - * @param __x Data to be added. - * - * This is a typical stack operation. The function creates an - * element at the front of the %list and assigns the given data - * to it. Due to the nature of a %list this operation can be - * done in constant time, and does not invalidate iterators and - * references. - */ - void - push_front(const value_type& __x) - { this->_M_insert(begin(), __x); } - -#if __cplusplus >= 201103L - void - push_front(value_type&& __x) - { this->_M_insert(begin(), std::move(__x)); } - - template - void - emplace_front(_Args&&... __args) - { this->_M_insert(begin(), std::forward<_Args>(__args)...); } -#endif - - /** - * @brief Removes first element. - * - * This is a typical stack operation. It shrinks the %list by - * one. Due to the nature of a %list this operation can be done - * in constant time, and only invalidates iterators/references to - * the element being removed. - * - * Note that no data is returned, and if the first element's data - * is needed, it should be retrieved before pop_front() is - * called. - */ - void - pop_front() _GLIBCXX_NOEXCEPT - { this->_M_erase(begin()); } - - /** - * @brief Add data to the end of the %list. - * @param __x Data to be added. - * - * This is a typical stack operation. The function creates an - * element at the end of the %list and assigns the given data to - * it. Due to the nature of a %list this operation can be done - * in constant time, and does not invalidate iterators and - * references. - */ - void - push_back(const value_type& __x) - { this->_M_insert(end(), __x); } - -#if __cplusplus >= 201103L - void - push_back(value_type&& __x) - { this->_M_insert(end(), std::move(__x)); } - - template - void - emplace_back(_Args&&... __args) - { this->_M_insert(end(), std::forward<_Args>(__args)...); } -#endif - - /** - * @brief Removes last element. - * - * This is a typical stack operation. It shrinks the %list by - * one. Due to the nature of a %list this operation can be done - * in constant time, and only invalidates iterators/references to - * the element being removed. - * - * Note that no data is returned, and if the last element's data - * is needed, it should be retrieved before pop_back() is called. - */ - void - pop_back() _GLIBCXX_NOEXCEPT - { this->_M_erase(iterator(this->_M_impl._M_node._M_prev)); } - -#if __cplusplus >= 201103L - /** - * @brief Constructs object in %list before specified iterator. - * @param __position A const_iterator into the %list. - * @param __args Arguments. - * @return An iterator that points to the inserted data. - * - * This function will insert an object of type T constructed - * with T(std::forward(args)...) before the specified - * location. Due to the nature of a %list this operation can - * be done in constant time, and does not invalidate iterators - * and references. - */ - template - iterator - emplace(const_iterator __position, _Args&&... __args); - - /** - * @brief Inserts given value into %list before specified iterator. - * @param __position A const_iterator into the %list. - * @param __x Data to be inserted. - * @return An iterator that points to the inserted data. - * - * This function will insert a copy of the given value before - * the specified location. Due to the nature of a %list this - * operation can be done in constant time, and does not - * invalidate iterators and references. - */ - iterator - insert(const_iterator __position, const value_type& __x); -#else - /** - * @brief Inserts given value into %list before specified iterator. - * @param __position An iterator into the %list. - * @param __x Data to be inserted. - * @return An iterator that points to the inserted data. - * - * This function will insert a copy of the given value before - * the specified location. Due to the nature of a %list this - * operation can be done in constant time, and does not - * invalidate iterators and references. - */ - iterator - insert(iterator __position, const value_type& __x); -#endif - -#if __cplusplus >= 201103L - /** - * @brief Inserts given rvalue into %list before specified iterator. - * @param __position A const_iterator into the %list. - * @param __x Data to be inserted. - * @return An iterator that points to the inserted data. - * - * This function will insert a copy of the given rvalue before - * the specified location. Due to the nature of a %list this - * operation can be done in constant time, and does not - * invalidate iterators and references. - */ - iterator - insert(const_iterator __position, value_type&& __x) - { return emplace(__position, std::move(__x)); } - - /** - * @brief Inserts the contents of an initializer_list into %list - * before specified const_iterator. - * @param __p A const_iterator into the %list. - * @param __l An initializer_list of value_type. - * @return An iterator pointing to the first element inserted - * (or __position). - * - * This function will insert copies of the data in the - * initializer_list @a l into the %list before the location - * specified by @a p. - * - * This operation is linear in the number of elements inserted and - * does not invalidate iterators and references. - */ - iterator - insert(const_iterator __p, initializer_list __l) - { return this->insert(__p, __l.begin(), __l.end()); } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Inserts a number of copies of given data into the %list. - * @param __position A const_iterator into the %list. - * @param __n Number of elements to be inserted. - * @param __x Data to be inserted. - * @return An iterator pointing to the first element inserted - * (or __position). - * - * This function will insert a specified number of copies of the - * given data before the location specified by @a position. - * - * This operation is linear in the number of elements inserted and - * does not invalidate iterators and references. - */ - iterator - insert(const_iterator __position, size_type __n, const value_type& __x); -#else - /** - * @brief Inserts a number of copies of given data into the %list. - * @param __position An iterator into the %list. - * @param __n Number of elements to be inserted. - * @param __x Data to be inserted. - * - * This function will insert a specified number of copies of the - * given data before the location specified by @a position. - * - * This operation is linear in the number of elements inserted and - * does not invalidate iterators and references. - */ - void - insert(iterator __position, size_type __n, const value_type& __x) - { - list __tmp(__n, __x, get_allocator()); - splice(__position, __tmp); - } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Inserts a range into the %list. - * @param __position A const_iterator into the %list. - * @param __first An input iterator. - * @param __last An input iterator. - * @return An iterator pointing to the first element inserted - * (or __position). - * - * This function will insert copies of the data in the range [@a - * first,@a last) into the %list before the location specified by - * @a position. - * - * This operation is linear in the number of elements inserted and - * does not invalidate iterators and references. - */ - template> - iterator - insert(const_iterator __position, _InputIterator __first, - _InputIterator __last); -#else - /** - * @brief Inserts a range into the %list. - * @param __position An iterator into the %list. - * @param __first An input iterator. - * @param __last An input iterator. - * - * This function will insert copies of the data in the range [@a - * first,@a last) into the %list before the location specified by - * @a position. - * - * This operation is linear in the number of elements inserted and - * does not invalidate iterators and references. - */ - template - void - insert(iterator __position, _InputIterator __first, - _InputIterator __last) - { - list __tmp(__first, __last, get_allocator()); - splice(__position, __tmp); - } -#endif - - /** - * @brief Remove element at given position. - * @param __position Iterator pointing to element to be erased. - * @return An iterator pointing to the next element (or end()). - * - * This function will erase the element at the given position and thus - * shorten the %list by one. - * - * Due to the nature of a %list this operation can be done in - * constant time, and only invalidates iterators/references to - * the element being removed. The user is also cautioned that - * this function only erases the element, and that if the element - * is itself a pointer, the pointed-to memory is not touched in - * any way. Managing the pointer is the user's responsibility. - */ - iterator -#if __cplusplus >= 201103L - erase(const_iterator __position) noexcept; -#else - erase(iterator __position); -#endif - - /** - * @brief Remove a range of elements. - * @param __first Iterator pointing to the first element to be erased. - * @param __last Iterator pointing to one past the last element to be - * erased. - * @return An iterator pointing to the element pointed to by @a last - * prior to erasing (or end()). - * - * This function will erase the elements in the range @a - * [first,last) and shorten the %list accordingly. - * - * This operation is linear time in the size of the range and only - * invalidates iterators/references to the element being removed. - * The user is also cautioned that this function only erases the - * elements, and that if the elements themselves are pointers, the - * pointed-to memory is not touched in any way. Managing the pointer - * is the user's responsibility. - */ - iterator -#if __cplusplus >= 201103L - erase(const_iterator __first, const_iterator __last) noexcept -#else - erase(iterator __first, iterator __last) -#endif - { - while (__first != __last) - __first = erase(__first); - return __last._M_const_cast(); - } - - /** - * @brief Swaps data with another %list. - * @param __x A %list of the same element and allocator types. - * - * This exchanges the elements between two lists in constant - * time. Note that the global std::swap() function is - * specialized such that std::swap(l1,l2) will feed to this - * function. - */ - void - swap(list& __x) - { - __detail::_List_node_base::swap(this->_M_impl._M_node, - __x._M_impl._M_node); - - size_t __xsize = __x._M_get_size(); - __x._M_set_size(this->_M_get_size()); - this->_M_set_size(__xsize); - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 431. Swapping containers with unequal allocators. - std::__alloc_swap:: - _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator()); - } - - /** - * Erases all the elements. Note that this function only erases - * the elements, and that if the elements themselves are - * pointers, the pointed-to memory is not touched in any way. - * Managing the pointer is the user's responsibility. - */ - void - clear() _GLIBCXX_NOEXCEPT - { - _Base::_M_clear(); - _Base::_M_init(); - } - - // [23.2.2.4] list operations - /** - * @brief Insert contents of another %list. - * @param __position Iterator referencing the element to insert before. - * @param __x Source list. - * - * The elements of @a __x are inserted in constant time in front of - * the element referenced by @a __position. @a __x becomes an empty - * list. - * - * Requires this != @a __x. - */ - void -#if __cplusplus >= 201103L - splice(const_iterator __position, list&& __x) noexcept -#else - splice(iterator __position, list& __x) -#endif - { - if (!__x.empty()) - { - _M_check_equal_allocators(__x); - - this->_M_transfer(__position._M_const_cast(), - __x.begin(), __x.end()); - - this->_M_inc_size(__x._M_get_size()); - __x._M_set_size(0); - } - } - -#if __cplusplus >= 201103L - void - splice(const_iterator __position, list& __x) noexcept - { splice(__position, std::move(__x)); } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Insert element from another %list. - * @param __position Const_iterator referencing the element to - * insert before. - * @param __x Source list. - * @param __i Const_iterator referencing the element to move. - * - * Removes the element in list @a __x referenced by @a __i and - * inserts it into the current list before @a __position. - */ - void - splice(const_iterator __position, list&& __x, const_iterator __i) noexcept -#else - /** - * @brief Insert element from another %list. - * @param __position Iterator referencing the element to insert before. - * @param __x Source list. - * @param __i Iterator referencing the element to move. - * - * Removes the element in list @a __x referenced by @a __i and - * inserts it into the current list before @a __position. - */ - void - splice(iterator __position, list& __x, iterator __i) -#endif - { - iterator __j = __i._M_const_cast(); - ++__j; - if (__position == __i || __position == __j) - return; - - if (this != &__x) - _M_check_equal_allocators(__x); - - this->_M_transfer(__position._M_const_cast(), - __i._M_const_cast(), __j); - - this->_M_inc_size(1); - __x._M_dec_size(1); - } - -#if __cplusplus >= 201103L - /** - * @brief Insert element from another %list. - * @param __position Const_iterator referencing the element to - * insert before. - * @param __x Source list. - * @param __i Const_iterator referencing the element to move. - * - * Removes the element in list @a __x referenced by @a __i and - * inserts it into the current list before @a __position. - */ - void - splice(const_iterator __position, list& __x, const_iterator __i) noexcept - { splice(__position, std::move(__x), __i); } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Insert range from another %list. - * @param __position Const_iterator referencing the element to - * insert before. - * @param __x Source list. - * @param __first Const_iterator referencing the start of range in x. - * @param __last Const_iterator referencing the end of range in x. - * - * Removes elements in the range [__first,__last) and inserts them - * before @a __position in constant time. - * - * Undefined if @a __position is in [__first,__last). - */ - void - splice(const_iterator __position, list&& __x, const_iterator __first, - const_iterator __last) noexcept -#else - /** - * @brief Insert range from another %list. - * @param __position Iterator referencing the element to insert before. - * @param __x Source list. - * @param __first Iterator referencing the start of range in x. - * @param __last Iterator referencing the end of range in x. - * - * Removes elements in the range [__first,__last) and inserts them - * before @a __position in constant time. - * - * Undefined if @a __position is in [__first,__last). - */ - void - splice(iterator __position, list& __x, iterator __first, - iterator __last) -#endif - { - if (__first != __last) - { - if (this != &__x) - _M_check_equal_allocators(__x); - - size_t __n = this->_M_distance(__first._M_node, __last._M_node); - this->_M_inc_size(__n); - __x._M_dec_size(__n); - - this->_M_transfer(__position._M_const_cast(), - __first._M_const_cast(), - __last._M_const_cast()); - } - } - -#if __cplusplus >= 201103L - /** - * @brief Insert range from another %list. - * @param __position Const_iterator referencing the element to - * insert before. - * @param __x Source list. - * @param __first Const_iterator referencing the start of range in x. - * @param __last Const_iterator referencing the end of range in x. - * - * Removes elements in the range [__first,__last) and inserts them - * before @a __position in constant time. - * - * Undefined if @a __position is in [__first,__last). - */ - void - splice(const_iterator __position, list& __x, const_iterator __first, - const_iterator __last) noexcept - { splice(__position, std::move(__x), __first, __last); } -#endif - - /** - * @brief Remove all elements equal to value. - * @param __value The value to remove. - * - * Removes every element in the list equal to @a value. - * Remaining elements stay in list order. Note that this - * function only erases the elements, and that if the elements - * themselves are pointers, the pointed-to memory is not - * touched in any way. Managing the pointer is the user's - * responsibility. - */ - void - remove(const _Tp& __value); - - /** - * @brief Remove all elements satisfying a predicate. - * @tparam _Predicate Unary predicate function or object. - * - * Removes every element in the list for which the predicate - * returns true. Remaining elements stay in list order. Note - * that this function only erases the elements, and that if the - * elements themselves are pointers, the pointed-to memory is - * not touched in any way. Managing the pointer is the user's - * responsibility. - */ - template - void - remove_if(_Predicate); - - /** - * @brief Remove consecutive duplicate elements. - * - * For each consecutive set of elements with the same value, - * remove all but the first one. Remaining elements stay in - * list order. Note that this function only erases the - * elements, and that if the elements themselves are pointers, - * the pointed-to memory is not touched in any way. Managing - * the pointer is the user's responsibility. - */ - void - unique(); - - /** - * @brief Remove consecutive elements satisfying a predicate. - * @tparam _BinaryPredicate Binary predicate function or object. - * - * For each consecutive set of elements [first,last) that - * satisfy predicate(first,i) where i is an iterator in - * [first,last), remove all but the first one. Remaining - * elements stay in list order. Note that this function only - * erases the elements, and that if the elements themselves are - * pointers, the pointed-to memory is not touched in any way. - * Managing the pointer is the user's responsibility. - */ - template - void - unique(_BinaryPredicate); - - /** - * @brief Merge sorted lists. - * @param __x Sorted list to merge. - * - * Assumes that both @a __x and this list are sorted according to - * operator<(). Merges elements of @a __x into this list in - * sorted order, leaving @a __x empty when complete. Elements in - * this list precede elements in @a __x that are equal. - */ -#if __cplusplus >= 201103L - void - merge(list&& __x); - - void - merge(list& __x) - { merge(std::move(__x)); } -#else - void - merge(list& __x); -#endif - - /** - * @brief Merge sorted lists according to comparison function. - * @tparam _StrictWeakOrdering Comparison function defining - * sort order. - * @param __x Sorted list to merge. - * @param __comp Comparison functor. - * - * Assumes that both @a __x and this list are sorted according to - * StrictWeakOrdering. Merges elements of @a __x into this list - * in sorted order, leaving @a __x empty when complete. Elements - * in this list precede elements in @a __x that are equivalent - * according to StrictWeakOrdering(). - */ -#if __cplusplus >= 201103L - template - void - merge(list&& __x, _StrictWeakOrdering __comp); - - template - void - merge(list& __x, _StrictWeakOrdering __comp) - { merge(std::move(__x), __comp); } -#else - template - void - merge(list& __x, _StrictWeakOrdering __comp); -#endif - - /** - * @brief Reverse the elements in list. - * - * Reverse the order of elements in the list in linear time. - */ - void - reverse() _GLIBCXX_NOEXCEPT - { this->_M_impl._M_node._M_reverse(); } - - /** - * @brief Sort the elements. - * - * Sorts the elements of this list in NlogN time. Equivalent - * elements remain in list order. - */ - void - sort(); - - /** - * @brief Sort the elements according to comparison function. - * - * Sorts the elements of this list in NlogN time. Equivalent - * elements remain in list order. - */ - template - void - sort(_StrictWeakOrdering); - - protected: - // Internal constructor functions follow. - - // Called by the range constructor to implement [23.1.1]/9 - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 438. Ambiguity in the "do the right thing" clause - template - void - _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) - { _M_fill_initialize(static_cast(__n), __x); } - - // Called by the range constructor to implement [23.1.1]/9 - template - void - _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, - __false_type) - { - for (; __first != __last; ++__first) -#if __cplusplus >= 201103L - emplace_back(*__first); -#else - push_back(*__first); -#endif - } - - // Called by list(n,v,a), and the range constructor when it turns out - // to be the same thing. - void - _M_fill_initialize(size_type __n, const value_type& __x) - { - for (; __n; --__n) - push_back(__x); - } - -#if __cplusplus >= 201103L - // Called by list(n). - void - _M_default_initialize(size_type __n) - { - for (; __n; --__n) - emplace_back(); - } - - // Called by resize(sz). - void - _M_default_append(size_type __n); -#endif - - // Internal assign functions follow. - - // Called by the range assign to implement [23.1.1]/9 - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 438. Ambiguity in the "do the right thing" clause - template - void - _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) - { _M_fill_assign(__n, __val); } - - // Called by the range assign to implement [23.1.1]/9 - template - void - _M_assign_dispatch(_InputIterator __first, _InputIterator __last, - __false_type); - - // Called by assign(n,t), and the range assign when it turns out - // to be the same thing. - void - _M_fill_assign(size_type __n, const value_type& __val); - - - // Moves the elements from [first,last) before position. - void - _M_transfer(iterator __position, iterator __first, iterator __last) - { __position._M_node->_M_transfer(__first._M_node, __last._M_node); } - - // Inserts new element at position given and with value given. -#if __cplusplus < 201103L - void - _M_insert(iterator __position, const value_type& __x) - { - _Node* __tmp = _M_create_node(__x); - __tmp->_M_hook(__position._M_node); - this->_M_inc_size(1); - } -#else - template - void - _M_insert(iterator __position, _Args&&... __args) - { - _Node* __tmp = _M_create_node(std::forward<_Args>(__args)...); - __tmp->_M_hook(__position._M_node); - this->_M_inc_size(1); - } -#endif - - // Erases element at position given. - void - _M_erase(iterator __position) _GLIBCXX_NOEXCEPT - { - this->_M_dec_size(1); - __position._M_node->_M_unhook(); - _Node* __n = static_cast<_Node*>(__position._M_node); -#if __cplusplus >= 201103L - _M_get_Node_allocator().destroy(__n); -#else - _M_get_Tp_allocator().destroy(std::__addressof(__n->_M_data)); -#endif - _M_put_node(__n); - } - - // To implement the splice (and merge) bits of N1599. - void - _M_check_equal_allocators(list& __x) _GLIBCXX_NOEXCEPT - { - if (std::__alloc_neq:: - _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator())) - __builtin_abort(); - } - }; -_GLIBCXX_END_NAMESPACE_CXX11 - - /** - * @brief List equality comparison. - * @param __x A %list. - * @param __y A %list of the same type as @a __x. - * @return True iff the size and elements of the lists are equal. - * - * This is an equivalence relation. It is linear in the size of - * the lists. Lists are considered equivalent if their sizes are - * equal, and if corresponding elements compare equal. - */ - template - inline bool - operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) - { - typedef typename list<_Tp, _Alloc>::const_iterator const_iterator; - const_iterator __end1 = __x.end(); - const_iterator __end2 = __y.end(); - - const_iterator __i1 = __x.begin(); - const_iterator __i2 = __y.begin(); - while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) - { - ++__i1; - ++__i2; - } - return __i1 == __end1 && __i2 == __end2; - } - - /** - * @brief List ordering relation. - * @param __x A %list. - * @param __y A %list of the same type as @a __x. - * @return True iff @a __x is lexicographically less than @a __y. - * - * This is a total ordering relation. It is linear in the size of the - * lists. The elements must be comparable with @c <. - * - * See std::lexicographical_compare() for how the determination is made. - */ - template - inline bool - operator<(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) - { return std::lexicographical_compare(__x.begin(), __x.end(), - __y.begin(), __y.end()); } - - /// Based on operator== - template - inline bool - operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) - { return !(__x == __y); } - - /// Based on operator< - template - inline bool - operator>(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) - { return __y < __x; } - - /// Based on operator< - template - inline bool - operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) - { return !(__y < __x); } - - /// Based on operator< - template - inline bool - operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) - { return !(__x < __y); } - - /// See std::list::swap(). - template - inline void - swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y) - { __x.swap(__y); } - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#endif /* _STL_LIST_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_map.h b/openflow/usr/include/c++/5/bits/stl_map.h deleted file mode 100644 index 179e3f2..0000000 --- a/openflow/usr/include/c++/5/bits/stl_map.h +++ /dev/null @@ -1,1132 +0,0 @@ -// Map implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_map.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{map} - */ - -#ifndef _STL_MAP_H -#define _STL_MAP_H 1 - -#include -#include -#if __cplusplus >= 201103L -#include -#include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - /** - * @brief A standard container made up of (key,value) pairs, which can be - * retrieved based on a key, in logarithmic time. - * - * @ingroup associative_containers - * - * @tparam _Key Type of key objects. - * @tparam _Tp Type of mapped objects. - * @tparam _Compare Comparison function object type, defaults to less<_Key>. - * @tparam _Alloc Allocator type, defaults to - * allocator. - * - * Meets the requirements of a container, a - * reversible container, and an - * associative container (using unique keys). - * For a @c map the key_type is Key, the mapped_type is T, and the - * value_type is std::pair. - * - * Maps support bidirectional iterators. - * - * The private tree data is declared exactly the same way for map and - * multimap; the distinction is made entirely in how the tree functions are - * called (*_unique versus *_equal, same as the standard). - */ - template , - typename _Alloc = std::allocator > > - class map - { - public: - typedef _Key key_type; - typedef _Tp mapped_type; - typedef std::pair value_type; - typedef _Compare key_compare; - typedef _Alloc allocator_type; - - private: - // concept requirements - typedef typename _Alloc::value_type _Alloc_value_type; - __glibcxx_class_requires(_Tp, _SGIAssignableConcept) - __glibcxx_class_requires4(_Compare, bool, _Key, _Key, - _BinaryFunctionConcept) - __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept) - - public: - class value_compare - : public std::binary_function - { - friend class map<_Key, _Tp, _Compare, _Alloc>; - protected: - _Compare comp; - - value_compare(_Compare __c) - : comp(__c) { } - - public: - bool operator()(const value_type& __x, const value_type& __y) const - { return comp(__x.first, __y.first); } - }; - - private: - /// This turns a red-black tree into a [multi]map. - typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template - rebind::other _Pair_alloc_type; - - typedef _Rb_tree, - key_compare, _Pair_alloc_type> _Rep_type; - - /// The actual tree structure. - _Rep_type _M_t; - - typedef __gnu_cxx::__alloc_traits<_Pair_alloc_type> _Alloc_traits; - - public: - // many of these are specified differently in ISO, but the following are - // "functionally equivalent" - typedef typename _Alloc_traits::pointer pointer; - typedef typename _Alloc_traits::const_pointer const_pointer; - typedef typename _Alloc_traits::reference reference; - typedef typename _Alloc_traits::const_reference const_reference; - typedef typename _Rep_type::iterator iterator; - typedef typename _Rep_type::const_iterator const_iterator; - typedef typename _Rep_type::size_type size_type; - typedef typename _Rep_type::difference_type difference_type; - typedef typename _Rep_type::reverse_iterator reverse_iterator; - typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; - - // [23.3.1.1] construct/copy/destroy - // (get_allocator() is also listed in this section) - - /** - * @brief Default constructor creates no elements. - */ - map() -#if __cplusplus >= 201103L - noexcept(is_nothrow_default_constructible::value) -#endif - : _M_t() { } - - /** - * @brief Creates a %map with no elements. - * @param __comp A comparison object. - * @param __a An allocator object. - */ - explicit - map(const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _Pair_alloc_type(__a)) { } - - /** - * @brief %Map copy constructor. - * @param __x A %map of identical element and allocator types. - * - * The newly-created %map uses a copy of the allocation object - * used by @a __x. - */ - map(const map& __x) - : _M_t(__x._M_t) { } - -#if __cplusplus >= 201103L - /** - * @brief %Map move constructor. - * @param __x A %map of identical element and allocator types. - * - * The newly-created %map contains the exact contents of @a __x. - * The contents of @a __x are a valid, but unspecified %map. - */ - map(map&& __x) - noexcept(is_nothrow_copy_constructible<_Compare>::value) - : _M_t(std::move(__x._M_t)) { } - - /** - * @brief Builds a %map from an initializer_list. - * @param __l An initializer_list. - * @param __comp A comparison object. - * @param __a An allocator object. - * - * Create a %map consisting of copies of the elements in the - * initializer_list @a __l. - * This is linear in N if the range is already sorted, and NlogN - * otherwise (where N is @a __l.size()). - */ - map(initializer_list __l, - const _Compare& __comp = _Compare(), - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _Pair_alloc_type(__a)) - { _M_t._M_insert_unique(__l.begin(), __l.end()); } - - /// Allocator-extended default constructor. - explicit - map(const allocator_type& __a) - : _M_t(_Compare(), _Pair_alloc_type(__a)) { } - - /// Allocator-extended copy constructor. - map(const map& __m, const allocator_type& __a) - : _M_t(__m._M_t, _Pair_alloc_type(__a)) { } - - /// Allocator-extended move constructor. - map(map&& __m, const allocator_type& __a) - noexcept(is_nothrow_copy_constructible<_Compare>::value - && _Alloc_traits::_S_always_equal()) - : _M_t(std::move(__m._M_t), _Pair_alloc_type(__a)) { } - - /// Allocator-extended initialier-list constructor. - map(initializer_list __l, const allocator_type& __a) - : _M_t(_Compare(), _Pair_alloc_type(__a)) - { _M_t._M_insert_unique(__l.begin(), __l.end()); } - - /// Allocator-extended range constructor. - template - map(_InputIterator __first, _InputIterator __last, - const allocator_type& __a) - : _M_t(_Compare(), _Pair_alloc_type(__a)) - { _M_t._M_insert_unique(__first, __last); } -#endif - - /** - * @brief Builds a %map from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * - * Create a %map consisting of copies of the elements from - * [__first,__last). This is linear in N if the range is - * already sorted, and NlogN otherwise (where N is - * distance(__first,__last)). - */ - template - map(_InputIterator __first, _InputIterator __last) - : _M_t() - { _M_t._M_insert_unique(__first, __last); } - - /** - * @brief Builds a %map from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __comp A comparison functor. - * @param __a An allocator object. - * - * Create a %map consisting of copies of the elements from - * [__first,__last). This is linear in N if the range is - * already sorted, and NlogN otherwise (where N is - * distance(__first,__last)). - */ - template - map(_InputIterator __first, _InputIterator __last, - const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _Pair_alloc_type(__a)) - { _M_t._M_insert_unique(__first, __last); } - - // FIXME There is no dtor declared, but we should have something - // generated by Doxygen. I don't know what tags to add to this - // paragraph to make that happen: - /** - * The dtor only erases the elements, and note that if the elements - * themselves are pointers, the pointed-to memory is not touched in any - * way. Managing the pointer is the user's responsibility. - */ - - /** - * @brief %Map assignment operator. - * @param __x A %map of identical element and allocator types. - * - * All the elements of @a __x are copied, but unlike the copy - * constructor, the allocator object is not copied. - */ - map& - operator=(const map& __x) - { - _M_t = __x._M_t; - return *this; - } - -#if __cplusplus >= 201103L - /// Move assignment operator. - map& - operator=(map&&) = default; - - /** - * @brief %Map list assignment operator. - * @param __l An initializer_list. - * - * This function fills a %map with copies of the elements in the - * initializer list @a __l. - * - * Note that the assignment completely changes the %map and - * that the resulting %map's size is the same as the number - * of elements assigned. Old data may be lost. - */ - map& - operator=(initializer_list __l) - { - _M_t._M_assign_unique(__l.begin(), __l.end()); - return *this; - } -#endif - - /// Get a copy of the memory allocation object. - allocator_type - get_allocator() const _GLIBCXX_NOEXCEPT - { return allocator_type(_M_t.get_allocator()); } - - // iterators - /** - * Returns a read/write iterator that points to the first pair in the - * %map. - * Iteration is done in ascending order according to the keys. - */ - iterator - begin() _GLIBCXX_NOEXCEPT - { return _M_t.begin(); } - - /** - * Returns a read-only (constant) iterator that points to the first pair - * in the %map. Iteration is done in ascending order according to the - * keys. - */ - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return _M_t.begin(); } - - /** - * Returns a read/write iterator that points one past the last - * pair in the %map. Iteration is done in ascending order - * according to the keys. - */ - iterator - end() _GLIBCXX_NOEXCEPT - { return _M_t.end(); } - - /** - * Returns a read-only (constant) iterator that points one past the last - * pair in the %map. Iteration is done in ascending order according to - * the keys. - */ - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return _M_t.end(); } - - /** - * Returns a read/write reverse iterator that points to the last pair in - * the %map. Iteration is done in descending order according to the - * keys. - */ - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return _M_t.rbegin(); } - - /** - * Returns a read-only (constant) reverse iterator that points to the - * last pair in the %map. Iteration is done in descending order - * according to the keys. - */ - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return _M_t.rbegin(); } - - /** - * Returns a read/write reverse iterator that points to one before the - * first pair in the %map. Iteration is done in descending order - * according to the keys. - */ - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return _M_t.rend(); } - - /** - * Returns a read-only (constant) reverse iterator that points to one - * before the first pair in the %map. Iteration is done in descending - * order according to the keys. - */ - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return _M_t.rend(); } - -#if __cplusplus >= 201103L - /** - * Returns a read-only (constant) iterator that points to the first pair - * in the %map. Iteration is done in ascending order according to the - * keys. - */ - const_iterator - cbegin() const noexcept - { return _M_t.begin(); } - - /** - * Returns a read-only (constant) iterator that points one past the last - * pair in the %map. Iteration is done in ascending order according to - * the keys. - */ - const_iterator - cend() const noexcept - { return _M_t.end(); } - - /** - * Returns a read-only (constant) reverse iterator that points to the - * last pair in the %map. Iteration is done in descending order - * according to the keys. - */ - const_reverse_iterator - crbegin() const noexcept - { return _M_t.rbegin(); } - - /** - * Returns a read-only (constant) reverse iterator that points to one - * before the first pair in the %map. Iteration is done in descending - * order according to the keys. - */ - const_reverse_iterator - crend() const noexcept - { return _M_t.rend(); } -#endif - - // capacity - /** Returns true if the %map is empty. (Thus begin() would equal - * end().) - */ - bool - empty() const _GLIBCXX_NOEXCEPT - { return _M_t.empty(); } - - /** Returns the size of the %map. */ - size_type - size() const _GLIBCXX_NOEXCEPT - { return _M_t.size(); } - - /** Returns the maximum size of the %map. */ - size_type - max_size() const _GLIBCXX_NOEXCEPT - { return _M_t.max_size(); } - - // [23.3.1.2] element access - /** - * @brief Subscript ( @c [] ) access to %map data. - * @param __k The key for which data should be retrieved. - * @return A reference to the data of the (key,data) %pair. - * - * Allows for easy lookup with the subscript ( @c [] ) - * operator. Returns data associated with the key specified in - * subscript. If the key does not exist, a pair with that key - * is created using default values, which is then returned. - * - * Lookup requires logarithmic time. - */ - mapped_type& - operator[](const key_type& __k) - { - // concept requirements - __glibcxx_function_requires(_DefaultConstructibleConcept) - - iterator __i = lower_bound(__k); - // __i->first is greater than or equivalent to __k. - if (__i == end() || key_comp()(__k, (*__i).first)) -#if __cplusplus >= 201103L - __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct, - std::tuple(__k), - std::tuple<>()); -#else - __i = insert(__i, value_type(__k, mapped_type())); -#endif - return (*__i).second; - } - -#if __cplusplus >= 201103L - mapped_type& - operator[](key_type&& __k) - { - // concept requirements - __glibcxx_function_requires(_DefaultConstructibleConcept) - - iterator __i = lower_bound(__k); - // __i->first is greater than or equivalent to __k. - if (__i == end() || key_comp()(__k, (*__i).first)) - __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct, - std::forward_as_tuple(std::move(__k)), - std::tuple<>()); - return (*__i).second; - } -#endif - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 464. Suggestion for new member functions in standard containers. - /** - * @brief Access to %map data. - * @param __k The key for which data should be retrieved. - * @return A reference to the data whose key is equivalent to @a __k, if - * such a data is present in the %map. - * @throw std::out_of_range If no such data is present. - */ - mapped_type& - at(const key_type& __k) - { - iterator __i = lower_bound(__k); - if (__i == end() || key_comp()(__k, (*__i).first)) - __throw_out_of_range(__N("map::at")); - return (*__i).second; - } - - const mapped_type& - at(const key_type& __k) const - { - const_iterator __i = lower_bound(__k); - if (__i == end() || key_comp()(__k, (*__i).first)) - __throw_out_of_range(__N("map::at")); - return (*__i).second; - } - - // modifiers -#if __cplusplus >= 201103L - /** - * @brief Attempts to build and insert a std::pair into the %map. - * - * @param __args Arguments used to generate a new pair instance (see - * std::piecewise_contruct for passing arguments to each - * part of the pair constructor). - * - * @return A pair, of which the first element is an iterator that points - * to the possibly inserted pair, and the second is a bool that - * is true if the pair was actually inserted. - * - * This function attempts to build and insert a (key, value) %pair into - * the %map. - * A %map relies on unique keys and thus a %pair is only inserted if its - * first element (the key) is not already present in the %map. - * - * Insertion requires logarithmic time. - */ - template - std::pair - emplace(_Args&&... __args) - { return _M_t._M_emplace_unique(std::forward<_Args>(__args)...); } - - /** - * @brief Attempts to build and insert a std::pair into the %map. - * - * @param __pos An iterator that serves as a hint as to where the pair - * should be inserted. - * @param __args Arguments used to generate a new pair instance (see - * std::piecewise_contruct for passing arguments to each - * part of the pair constructor). - * @return An iterator that points to the element with key of the - * std::pair built from @a __args (may or may not be that - * std::pair). - * - * This function is not concerned about whether the insertion took place, - * and thus does not return a boolean like the single-argument emplace() - * does. - * Note that the first parameter is only a hint and can potentially - * improve the performance of the insertion process. A bad hint would - * cause no gains in efficiency. - * - * See - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * for more on @a hinting. - * - * Insertion requires logarithmic time (if the hint is not taken). - */ - template - iterator - emplace_hint(const_iterator __pos, _Args&&... __args) - { - return _M_t._M_emplace_hint_unique(__pos, - std::forward<_Args>(__args)...); - } -#endif - - /** - * @brief Attempts to insert a std::pair into the %map. - - * @param __x Pair to be inserted (see std::make_pair for easy - * creation of pairs). - * - * @return A pair, of which the first element is an iterator that - * points to the possibly inserted pair, and the second is - * a bool that is true if the pair was actually inserted. - * - * This function attempts to insert a (key, value) %pair into the %map. - * A %map relies on unique keys and thus a %pair is only inserted if its - * first element (the key) is not already present in the %map. - * - * Insertion requires logarithmic time. - */ - std::pair - insert(const value_type& __x) - { return _M_t._M_insert_unique(__x); } - -#if __cplusplus >= 201103L - template::value>::type> - std::pair - insert(_Pair&& __x) - { return _M_t._M_insert_unique(std::forward<_Pair>(__x)); } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Attempts to insert a list of std::pairs into the %map. - * @param __list A std::initializer_list of pairs to be - * inserted. - * - * Complexity similar to that of the range constructor. - */ - void - insert(std::initializer_list __list) - { insert(__list.begin(), __list.end()); } -#endif - - /** - * @brief Attempts to insert a std::pair into the %map. - * @param __position An iterator that serves as a hint as to where the - * pair should be inserted. - * @param __x Pair to be inserted (see std::make_pair for easy creation - * of pairs). - * @return An iterator that points to the element with key of - * @a __x (may or may not be the %pair passed in). - * - - * This function is not concerned about whether the insertion - * took place, and thus does not return a boolean like the - * single-argument insert() does. Note that the first - * parameter is only a hint and can potentially improve the - * performance of the insertion process. A bad hint would - * cause no gains in efficiency. - * - * See - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * for more on @a hinting. - * - * Insertion requires logarithmic time (if the hint is not taken). - */ - iterator -#if __cplusplus >= 201103L - insert(const_iterator __position, const value_type& __x) -#else - insert(iterator __position, const value_type& __x) -#endif - { return _M_t._M_insert_unique_(__position, __x); } - -#if __cplusplus >= 201103L - template::value>::type> - iterator - insert(const_iterator __position, _Pair&& __x) - { return _M_t._M_insert_unique_(__position, - std::forward<_Pair>(__x)); } -#endif - - /** - * @brief Template function that attempts to insert a range of elements. - * @param __first Iterator pointing to the start of the range to be - * inserted. - * @param __last Iterator pointing to the end of the range. - * - * Complexity similar to that of the range constructor. - */ - template - void - insert(_InputIterator __first, _InputIterator __last) - { _M_t._M_insert_unique(__first, __last); } - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 130. Associative erase should return an iterator. - /** - * @brief Erases an element from a %map. - * @param __position An iterator pointing to the element to be erased. - * @return An iterator pointing to the element immediately following - * @a position prior to the element being erased. If no such - * element exists, end() is returned. - * - * This function erases an element, pointed to by the given - * iterator, from a %map. Note that this function only erases - * the element, and that if the element is itself a pointer, - * the pointed-to memory is not touched in any way. Managing - * the pointer is the user's responsibility. - */ - iterator - erase(const_iterator __position) - { return _M_t.erase(__position); } - - // LWG 2059 - _GLIBCXX_ABI_TAG_CXX11 - iterator - erase(iterator __position) - { return _M_t.erase(__position); } -#else - /** - * @brief Erases an element from a %map. - * @param __position An iterator pointing to the element to be erased. - * - * This function erases an element, pointed to by the given - * iterator, from a %map. Note that this function only erases - * the element, and that if the element is itself a pointer, - * the pointed-to memory is not touched in any way. Managing - * the pointer is the user's responsibility. - */ - void - erase(iterator __position) - { _M_t.erase(__position); } -#endif - - /** - * @brief Erases elements according to the provided key. - * @param __x Key of element to be erased. - * @return The number of elements erased. - * - * This function erases all the elements located by the given key from - * a %map. - * Note that this function only erases the element, and that if - * the element is itself a pointer, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - size_type - erase(const key_type& __x) - { return _M_t.erase(__x); } - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 130. Associative erase should return an iterator. - /** - * @brief Erases a [first,last) range of elements from a %map. - * @param __first Iterator pointing to the start of the range to be - * erased. - * @param __last Iterator pointing to the end of the range to - * be erased. - * @return The iterator @a __last. - * - * This function erases a sequence of elements from a %map. - * Note that this function only erases the element, and that if - * the element is itself a pointer, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - iterator - erase(const_iterator __first, const_iterator __last) - { return _M_t.erase(__first, __last); } -#else - /** - * @brief Erases a [__first,__last) range of elements from a %map. - * @param __first Iterator pointing to the start of the range to be - * erased. - * @param __last Iterator pointing to the end of the range to - * be erased. - * - * This function erases a sequence of elements from a %map. - * Note that this function only erases the element, and that if - * the element is itself a pointer, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - void - erase(iterator __first, iterator __last) - { _M_t.erase(__first, __last); } -#endif - - /** - * @brief Swaps data with another %map. - * @param __x A %map of the same element and allocator types. - * - * This exchanges the elements between two maps in constant - * time. (It is only swapping a pointer, an integer, and an - * instance of the @c Compare type (which itself is often - * stateless and empty), so it should be quite fast.) Note - * that the global std::swap() function is specialized such - * that std::swap(m1,m2) will feed to this function. - */ - void - swap(map& __x) -#if __cplusplus >= 201103L - noexcept(_Alloc_traits::_S_nothrow_swap()) -#endif - { _M_t.swap(__x._M_t); } - - /** - * Erases all elements in a %map. Note that this function only - * erases the elements, and that if the elements themselves are - * pointers, the pointed-to memory is not touched in any way. - * Managing the pointer is the user's responsibility. - */ - void - clear() _GLIBCXX_NOEXCEPT - { _M_t.clear(); } - - // observers - /** - * Returns the key comparison object out of which the %map was - * constructed. - */ - key_compare - key_comp() const - { return _M_t.key_comp(); } - - /** - * Returns a value comparison object, built from the key comparison - * object out of which the %map was constructed. - */ - value_compare - value_comp() const - { return value_compare(_M_t.key_comp()); } - - // [23.3.1.3] map operations - - //@{ - /** - * @brief Tries to locate an element in a %map. - * @param __x Key of (key, value) %pair to be located. - * @return Iterator pointing to sought-after element, or end() if not - * found. - * - * This function takes a key and tries to locate the element with which - * the key matches. If successful the function returns an iterator - * pointing to the sought after %pair. If unsuccessful it returns the - * past-the-end ( @c end() ) iterator. - */ - - iterator - find(const key_type& __x) - { return _M_t.find(__x); } - -#if __cplusplus > 201103L - template - auto - find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x)) - { return _M_t._M_find_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Tries to locate an element in a %map. - * @param __x Key of (key, value) %pair to be located. - * @return Read-only (constant) iterator pointing to sought-after - * element, or end() if not found. - * - * This function takes a key and tries to locate the element with which - * the key matches. If successful the function returns a constant - * iterator pointing to the sought after %pair. If unsuccessful it - * returns the past-the-end ( @c end() ) iterator. - */ - - const_iterator - find(const key_type& __x) const - { return _M_t.find(__x); } - -#if __cplusplus > 201103L - template - auto - find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x)) - { return _M_t._M_find_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds the number of elements with given key. - * @param __x Key of (key, value) pairs to be located. - * @return Number of elements with specified key. - * - * This function only makes sense for multimaps; for map the result will - * either be 0 (not present) or 1 (present). - */ - size_type - count(const key_type& __x) const - { return _M_t.find(__x) == _M_t.end() ? 0 : 1; } - -#if __cplusplus > 201103L - template - auto - count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x)) - { return _M_t._M_find_tr(__x) == _M_t.end() ? 0 : 1; } -#endif - //@} - - //@{ - /** - * @brief Finds the beginning of a subsequence matching given key. - * @param __x Key of (key, value) pair to be located. - * @return Iterator pointing to first element equal to or greater - * than key, or end(). - * - * This function returns the first element of a subsequence of elements - * that matches the given key. If unsuccessful it returns an iterator - * pointing to the first element that has a greater value than given key - * or end() if no such element exists. - */ - iterator - lower_bound(const key_type& __x) - { return _M_t.lower_bound(__x); } - -#if __cplusplus > 201103L - template - auto - lower_bound(const _Kt& __x) - -> decltype(_M_t._M_lower_bound_tr(__x)) - { return _M_t._M_lower_bound_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds the beginning of a subsequence matching given key. - * @param __x Key of (key, value) pair to be located. - * @return Read-only (constant) iterator pointing to first element - * equal to or greater than key, or end(). - * - * This function returns the first element of a subsequence of elements - * that matches the given key. If unsuccessful it returns an iterator - * pointing to the first element that has a greater value than given key - * or end() if no such element exists. - */ - const_iterator - lower_bound(const key_type& __x) const - { return _M_t.lower_bound(__x); } - -#if __cplusplus > 201103L - template - auto - lower_bound(const _Kt& __x) const - -> decltype(_M_t._M_lower_bound_tr(__x)) - { return _M_t._M_lower_bound_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds the end of a subsequence matching given key. - * @param __x Key of (key, value) pair to be located. - * @return Iterator pointing to the first element - * greater than key, or end(). - */ - iterator - upper_bound(const key_type& __x) - { return _M_t.upper_bound(__x); } - -#if __cplusplus > 201103L - template - auto - upper_bound(const _Kt& __x) - -> decltype(_M_t._M_upper_bound_tr(__x)) - { return _M_t._M_upper_bound_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds the end of a subsequence matching given key. - * @param __x Key of (key, value) pair to be located. - * @return Read-only (constant) iterator pointing to first iterator - * greater than key, or end(). - */ - const_iterator - upper_bound(const key_type& __x) const - { return _M_t.upper_bound(__x); } - -#if __cplusplus > 201103L - template - auto - upper_bound(const _Kt& __x) const - -> decltype(_M_t._M_upper_bound_tr(__x)) - { return _M_t._M_upper_bound_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds a subsequence matching given key. - * @param __x Key of (key, value) pairs to be located. - * @return Pair of iterators that possibly points to the subsequence - * matching given key. - * - * This function is equivalent to - * @code - * std::make_pair(c.lower_bound(val), - * c.upper_bound(val)) - * @endcode - * (but is faster than making the calls separately). - * - * This function probably only makes sense for multimaps. - */ - std::pair - equal_range(const key_type& __x) - { return _M_t.equal_range(__x); } - -#if __cplusplus > 201103L - template - auto - equal_range(const _Kt& __x) - -> decltype(_M_t._M_equal_range_tr(__x)) - { return _M_t._M_equal_range_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds a subsequence matching given key. - * @param __x Key of (key, value) pairs to be located. - * @return Pair of read-only (constant) iterators that possibly points - * to the subsequence matching given key. - * - * This function is equivalent to - * @code - * std::make_pair(c.lower_bound(val), - * c.upper_bound(val)) - * @endcode - * (but is faster than making the calls separately). - * - * This function probably only makes sense for multimaps. - */ - std::pair - equal_range(const key_type& __x) const - { return _M_t.equal_range(__x); } - -#if __cplusplus > 201103L - template - auto - equal_range(const _Kt& __x) const - -> decltype(_M_t._M_equal_range_tr(__x)) - { return _M_t._M_equal_range_tr(__x); } -#endif - //@} - - template - friend bool - operator==(const map<_K1, _T1, _C1, _A1>&, - const map<_K1, _T1, _C1, _A1>&); - - template - friend bool - operator<(const map<_K1, _T1, _C1, _A1>&, - const map<_K1, _T1, _C1, _A1>&); - }; - - /** - * @brief Map equality comparison. - * @param __x A %map. - * @param __y A %map of the same type as @a x. - * @return True iff the size and elements of the maps are equal. - * - * This is an equivalence relation. It is linear in the size of the - * maps. Maps are considered equivalent if their sizes are equal, - * and if corresponding elements compare equal. - */ - template - inline bool - operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x, - const map<_Key, _Tp, _Compare, _Alloc>& __y) - { return __x._M_t == __y._M_t; } - - /** - * @brief Map ordering relation. - * @param __x A %map. - * @param __y A %map of the same type as @a x. - * @return True iff @a x is lexicographically less than @a y. - * - * This is a total ordering relation. It is linear in the size of the - * maps. The elements must be comparable with @c <. - * - * See std::lexicographical_compare() for how the determination is made. - */ - template - inline bool - operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x, - const map<_Key, _Tp, _Compare, _Alloc>& __y) - { return __x._M_t < __y._M_t; } - - /// Based on operator== - template - inline bool - operator!=(const map<_Key, _Tp, _Compare, _Alloc>& __x, - const map<_Key, _Tp, _Compare, _Alloc>& __y) - { return !(__x == __y); } - - /// Based on operator< - template - inline bool - operator>(const map<_Key, _Tp, _Compare, _Alloc>& __x, - const map<_Key, _Tp, _Compare, _Alloc>& __y) - { return __y < __x; } - - /// Based on operator< - template - inline bool - operator<=(const map<_Key, _Tp, _Compare, _Alloc>& __x, - const map<_Key, _Tp, _Compare, _Alloc>& __y) - { return !(__y < __x); } - - /// Based on operator< - template - inline bool - operator>=(const map<_Key, _Tp, _Compare, _Alloc>& __x, - const map<_Key, _Tp, _Compare, _Alloc>& __y) - { return !(__x < __y); } - - /// See std::map::swap(). - template - inline void - swap(map<_Key, _Tp, _Compare, _Alloc>& __x, - map<_Key, _Tp, _Compare, _Alloc>& __y) - { __x.swap(__y); } - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#endif /* _STL_MAP_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_multimap.h b/openflow/usr/include/c++/5/bits/stl_multimap.h deleted file mode 100644 index 10ac0fa..0000000 --- a/openflow/usr/include/c++/5/bits/stl_multimap.h +++ /dev/null @@ -1,1033 +0,0 @@ -// Multimap implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_multimap.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{map} - */ - -#ifndef _STL_MULTIMAP_H -#define _STL_MULTIMAP_H 1 - -#include -#if __cplusplus >= 201103L -#include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - /** - * @brief A standard container made up of (key,value) pairs, which can be - * retrieved based on a key, in logarithmic time. - * - * @ingroup associative_containers - * - * @tparam _Key Type of key objects. - * @tparam _Tp Type of mapped objects. - * @tparam _Compare Comparison function object type, defaults to less<_Key>. - * @tparam _Alloc Allocator type, defaults to - * allocator. - * - * Meets the requirements of a container, a - * reversible container, and an - * associative container (using equivalent - * keys). For a @c multimap the key_type is Key, the mapped_type - * is T, and the value_type is std::pair. - * - * Multimaps support bidirectional iterators. - * - * The private tree data is declared exactly the same way for map and - * multimap; the distinction is made entirely in how the tree functions are - * called (*_unique versus *_equal, same as the standard). - */ - template , - typename _Alloc = std::allocator > > - class multimap - { - public: - typedef _Key key_type; - typedef _Tp mapped_type; - typedef std::pair value_type; - typedef _Compare key_compare; - typedef _Alloc allocator_type; - - private: - // concept requirements - typedef typename _Alloc::value_type _Alloc_value_type; - __glibcxx_class_requires(_Tp, _SGIAssignableConcept) - __glibcxx_class_requires4(_Compare, bool, _Key, _Key, - _BinaryFunctionConcept) - __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept) - - public: - class value_compare - : public std::binary_function - { - friend class multimap<_Key, _Tp, _Compare, _Alloc>; - protected: - _Compare comp; - - value_compare(_Compare __c) - : comp(__c) { } - - public: - bool operator()(const value_type& __x, const value_type& __y) const - { return comp(__x.first, __y.first); } - }; - - private: - /// This turns a red-black tree into a [multi]map. - typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template - rebind::other _Pair_alloc_type; - - typedef _Rb_tree, - key_compare, _Pair_alloc_type> _Rep_type; - /// The actual tree structure. - _Rep_type _M_t; - - typedef __gnu_cxx::__alloc_traits<_Pair_alloc_type> _Alloc_traits; - - public: - // many of these are specified differently in ISO, but the following are - // "functionally equivalent" - typedef typename _Alloc_traits::pointer pointer; - typedef typename _Alloc_traits::const_pointer const_pointer; - typedef typename _Alloc_traits::reference reference; - typedef typename _Alloc_traits::const_reference const_reference; - typedef typename _Rep_type::iterator iterator; - typedef typename _Rep_type::const_iterator const_iterator; - typedef typename _Rep_type::size_type size_type; - typedef typename _Rep_type::difference_type difference_type; - typedef typename _Rep_type::reverse_iterator reverse_iterator; - typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; - - // [23.3.2] construct/copy/destroy - // (get_allocator() is also listed in this section) - - /** - * @brief Default constructor creates no elements. - */ - multimap() -#if __cplusplus >= 201103L - noexcept(is_nothrow_default_constructible::value) -#endif - : _M_t() { } - - /** - * @brief Creates a %multimap with no elements. - * @param __comp A comparison object. - * @param __a An allocator object. - */ - explicit - multimap(const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _Pair_alloc_type(__a)) { } - - /** - * @brief %Multimap copy constructor. - * @param __x A %multimap of identical element and allocator types. - * - * The newly-created %multimap uses a copy of the allocation object - * used by @a __x. - */ - multimap(const multimap& __x) - : _M_t(__x._M_t) { } - -#if __cplusplus >= 201103L - /** - * @brief %Multimap move constructor. - * @param __x A %multimap of identical element and allocator types. - * - * The newly-created %multimap contains the exact contents of @a __x. - * The contents of @a __x are a valid, but unspecified %multimap. - */ - multimap(multimap&& __x) - noexcept(is_nothrow_copy_constructible<_Compare>::value) - : _M_t(std::move(__x._M_t)) { } - - /** - * @brief Builds a %multimap from an initializer_list. - * @param __l An initializer_list. - * @param __comp A comparison functor. - * @param __a An allocator object. - * - * Create a %multimap consisting of copies of the elements from - * the initializer_list. This is linear in N if the list is already - * sorted, and NlogN otherwise (where N is @a __l.size()). - */ - multimap(initializer_list __l, - const _Compare& __comp = _Compare(), - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _Pair_alloc_type(__a)) - { _M_t._M_insert_equal(__l.begin(), __l.end()); } - - /// Allocator-extended default constructor. - explicit - multimap(const allocator_type& __a) - : _M_t(_Compare(), _Pair_alloc_type(__a)) { } - - /// Allocator-extended copy constructor. - multimap(const multimap& __m, const allocator_type& __a) - : _M_t(__m._M_t, _Pair_alloc_type(__a)) { } - - /// Allocator-extended move constructor. - multimap(multimap&& __m, const allocator_type& __a) - noexcept(is_nothrow_copy_constructible<_Compare>::value - && _Alloc_traits::_S_always_equal()) - : _M_t(std::move(__m._M_t), _Pair_alloc_type(__a)) { } - - /// Allocator-extended initialier-list constructor. - multimap(initializer_list __l, const allocator_type& __a) - : _M_t(_Compare(), _Pair_alloc_type(__a)) - { _M_t._M_insert_equal(__l.begin(), __l.end()); } - - /// Allocator-extended range constructor. - template - multimap(_InputIterator __first, _InputIterator __last, - const allocator_type& __a) - : _M_t(_Compare(), _Pair_alloc_type(__a)) - { _M_t._M_insert_equal(__first, __last); } -#endif - - /** - * @brief Builds a %multimap from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * - * Create a %multimap consisting of copies of the elements from - * [__first,__last). This is linear in N if the range is already sorted, - * and NlogN otherwise (where N is distance(__first,__last)). - */ - template - multimap(_InputIterator __first, _InputIterator __last) - : _M_t() - { _M_t._M_insert_equal(__first, __last); } - - /** - * @brief Builds a %multimap from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __comp A comparison functor. - * @param __a An allocator object. - * - * Create a %multimap consisting of copies of the elements from - * [__first,__last). This is linear in N if the range is already sorted, - * and NlogN otherwise (where N is distance(__first,__last)). - */ - template - multimap(_InputIterator __first, _InputIterator __last, - const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _Pair_alloc_type(__a)) - { _M_t._M_insert_equal(__first, __last); } - - // FIXME There is no dtor declared, but we should have something generated - // by Doxygen. I don't know what tags to add to this paragraph to make - // that happen: - /** - * The dtor only erases the elements, and note that if the elements - * themselves are pointers, the pointed-to memory is not touched in any - * way. Managing the pointer is the user's responsibility. - */ - - /** - * @brief %Multimap assignment operator. - * @param __x A %multimap of identical element and allocator types. - * - * All the elements of @a __x are copied, but unlike the copy - * constructor, the allocator object is not copied. - */ - multimap& - operator=(const multimap& __x) - { - _M_t = __x._M_t; - return *this; - } - -#if __cplusplus >= 201103L - /// Move assignment operator. - multimap& - operator=(multimap&&) = default; - - /** - * @brief %Multimap list assignment operator. - * @param __l An initializer_list. - * - * This function fills a %multimap with copies of the elements - * in the initializer list @a __l. - * - * Note that the assignment completely changes the %multimap and - * that the resulting %multimap's size is the same as the number - * of elements assigned. Old data may be lost. - */ - multimap& - operator=(initializer_list __l) - { - _M_t._M_assign_equal(__l.begin(), __l.end()); - return *this; - } -#endif - - /// Get a copy of the memory allocation object. - allocator_type - get_allocator() const _GLIBCXX_NOEXCEPT - { return allocator_type(_M_t.get_allocator()); } - - // iterators - /** - * Returns a read/write iterator that points to the first pair in the - * %multimap. Iteration is done in ascending order according to the - * keys. - */ - iterator - begin() _GLIBCXX_NOEXCEPT - { return _M_t.begin(); } - - /** - * Returns a read-only (constant) iterator that points to the first pair - * in the %multimap. Iteration is done in ascending order according to - * the keys. - */ - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return _M_t.begin(); } - - /** - * Returns a read/write iterator that points one past the last pair in - * the %multimap. Iteration is done in ascending order according to the - * keys. - */ - iterator - end() _GLIBCXX_NOEXCEPT - { return _M_t.end(); } - - /** - * Returns a read-only (constant) iterator that points one past the last - * pair in the %multimap. Iteration is done in ascending order according - * to the keys. - */ - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return _M_t.end(); } - - /** - * Returns a read/write reverse iterator that points to the last pair in - * the %multimap. Iteration is done in descending order according to the - * keys. - */ - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return _M_t.rbegin(); } - - /** - * Returns a read-only (constant) reverse iterator that points to the - * last pair in the %multimap. Iteration is done in descending order - * according to the keys. - */ - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return _M_t.rbegin(); } - - /** - * Returns a read/write reverse iterator that points to one before the - * first pair in the %multimap. Iteration is done in descending order - * according to the keys. - */ - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return _M_t.rend(); } - - /** - * Returns a read-only (constant) reverse iterator that points to one - * before the first pair in the %multimap. Iteration is done in - * descending order according to the keys. - */ - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return _M_t.rend(); } - -#if __cplusplus >= 201103L - /** - * Returns a read-only (constant) iterator that points to the first pair - * in the %multimap. Iteration is done in ascending order according to - * the keys. - */ - const_iterator - cbegin() const noexcept - { return _M_t.begin(); } - - /** - * Returns a read-only (constant) iterator that points one past the last - * pair in the %multimap. Iteration is done in ascending order according - * to the keys. - */ - const_iterator - cend() const noexcept - { return _M_t.end(); } - - /** - * Returns a read-only (constant) reverse iterator that points to the - * last pair in the %multimap. Iteration is done in descending order - * according to the keys. - */ - const_reverse_iterator - crbegin() const noexcept - { return _M_t.rbegin(); } - - /** - * Returns a read-only (constant) reverse iterator that points to one - * before the first pair in the %multimap. Iteration is done in - * descending order according to the keys. - */ - const_reverse_iterator - crend() const noexcept - { return _M_t.rend(); } -#endif - - // capacity - /** Returns true if the %multimap is empty. */ - bool - empty() const _GLIBCXX_NOEXCEPT - { return _M_t.empty(); } - - /** Returns the size of the %multimap. */ - size_type - size() const _GLIBCXX_NOEXCEPT - { return _M_t.size(); } - - /** Returns the maximum size of the %multimap. */ - size_type - max_size() const _GLIBCXX_NOEXCEPT - { return _M_t.max_size(); } - - // modifiers -#if __cplusplus >= 201103L - /** - * @brief Build and insert a std::pair into the %multimap. - * - * @param __args Arguments used to generate a new pair instance (see - * std::piecewise_contruct for passing arguments to each - * part of the pair constructor). - * - * @return An iterator that points to the inserted (key,value) pair. - * - * This function builds and inserts a (key, value) %pair into the - * %multimap. - * Contrary to a std::map the %multimap does not rely on unique keys and - * thus multiple pairs with the same key can be inserted. - * - * Insertion requires logarithmic time. - */ - template - iterator - emplace(_Args&&... __args) - { return _M_t._M_emplace_equal(std::forward<_Args>(__args)...); } - - /** - * @brief Builds and inserts a std::pair into the %multimap. - * - * @param __pos An iterator that serves as a hint as to where the pair - * should be inserted. - * @param __args Arguments used to generate a new pair instance (see - * std::piecewise_contruct for passing arguments to each - * part of the pair constructor). - * @return An iterator that points to the inserted (key,value) pair. - * - * This function inserts a (key, value) pair into the %multimap. - * Contrary to a std::map the %multimap does not rely on unique keys and - * thus multiple pairs with the same key can be inserted. - * Note that the first parameter is only a hint and can potentially - * improve the performance of the insertion process. A bad hint would - * cause no gains in efficiency. - * - * For more on @a hinting, see: - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * - * Insertion requires logarithmic time (if the hint is not taken). - */ - template - iterator - emplace_hint(const_iterator __pos, _Args&&... __args) - { - return _M_t._M_emplace_hint_equal(__pos, - std::forward<_Args>(__args)...); - } -#endif - - /** - * @brief Inserts a std::pair into the %multimap. - * @param __x Pair to be inserted (see std::make_pair for easy creation - * of pairs). - * @return An iterator that points to the inserted (key,value) pair. - * - * This function inserts a (key, value) pair into the %multimap. - * Contrary to a std::map the %multimap does not rely on unique keys and - * thus multiple pairs with the same key can be inserted. - * - * Insertion requires logarithmic time. - */ - iterator - insert(const value_type& __x) - { return _M_t._M_insert_equal(__x); } - -#if __cplusplus >= 201103L - template::value>::type> - iterator - insert(_Pair&& __x) - { return _M_t._M_insert_equal(std::forward<_Pair>(__x)); } -#endif - - /** - * @brief Inserts a std::pair into the %multimap. - * @param __position An iterator that serves as a hint as to where the - * pair should be inserted. - * @param __x Pair to be inserted (see std::make_pair for easy creation - * of pairs). - * @return An iterator that points to the inserted (key,value) pair. - * - * This function inserts a (key, value) pair into the %multimap. - * Contrary to a std::map the %multimap does not rely on unique keys and - * thus multiple pairs with the same key can be inserted. - * Note that the first parameter is only a hint and can potentially - * improve the performance of the insertion process. A bad hint would - * cause no gains in efficiency. - * - * For more on @a hinting, see: - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * - * Insertion requires logarithmic time (if the hint is not taken). - */ - iterator -#if __cplusplus >= 201103L - insert(const_iterator __position, const value_type& __x) -#else - insert(iterator __position, const value_type& __x) -#endif - { return _M_t._M_insert_equal_(__position, __x); } - -#if __cplusplus >= 201103L - template::value>::type> - iterator - insert(const_iterator __position, _Pair&& __x) - { return _M_t._M_insert_equal_(__position, - std::forward<_Pair>(__x)); } -#endif - - /** - * @brief A template function that attempts to insert a range - * of elements. - * @param __first Iterator pointing to the start of the range to be - * inserted. - * @param __last Iterator pointing to the end of the range. - * - * Complexity similar to that of the range constructor. - */ - template - void - insert(_InputIterator __first, _InputIterator __last) - { _M_t._M_insert_equal(__first, __last); } - -#if __cplusplus >= 201103L - /** - * @brief Attempts to insert a list of std::pairs into the %multimap. - * @param __l A std::initializer_list of pairs to be - * inserted. - * - * Complexity similar to that of the range constructor. - */ - void - insert(initializer_list __l) - { this->insert(__l.begin(), __l.end()); } -#endif - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 130. Associative erase should return an iterator. - /** - * @brief Erases an element from a %multimap. - * @param __position An iterator pointing to the element to be erased. - * @return An iterator pointing to the element immediately following - * @a position prior to the element being erased. If no such - * element exists, end() is returned. - * - * This function erases an element, pointed to by the given iterator, - * from a %multimap. Note that this function only erases the element, - * and that if the element is itself a pointer, the pointed-to memory is - * not touched in any way. Managing the pointer is the user's - * responsibility. - */ - iterator - erase(const_iterator __position) - { return _M_t.erase(__position); } - - // LWG 2059. - _GLIBCXX_ABI_TAG_CXX11 - iterator - erase(iterator __position) - { return _M_t.erase(__position); } -#else - /** - * @brief Erases an element from a %multimap. - * @param __position An iterator pointing to the element to be erased. - * - * This function erases an element, pointed to by the given iterator, - * from a %multimap. Note that this function only erases the element, - * and that if the element is itself a pointer, the pointed-to memory is - * not touched in any way. Managing the pointer is the user's - * responsibility. - */ - void - erase(iterator __position) - { _M_t.erase(__position); } -#endif - - /** - * @brief Erases elements according to the provided key. - * @param __x Key of element to be erased. - * @return The number of elements erased. - * - * This function erases all elements located by the given key from a - * %multimap. - * Note that this function only erases the element, and that if - * the element is itself a pointer, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - size_type - erase(const key_type& __x) - { return _M_t.erase(__x); } - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 130. Associative erase should return an iterator. - /** - * @brief Erases a [first,last) range of elements from a %multimap. - * @param __first Iterator pointing to the start of the range to be - * erased. - * @param __last Iterator pointing to the end of the range to be - * erased . - * @return The iterator @a __last. - * - * This function erases a sequence of elements from a %multimap. - * Note that this function only erases the elements, and that if - * the elements themselves are pointers, the pointed-to memory is not - * touched in any way. Managing the pointer is the user's - * responsibility. - */ - iterator - erase(const_iterator __first, const_iterator __last) - { return _M_t.erase(__first, __last); } -#else - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 130. Associative erase should return an iterator. - /** - * @brief Erases a [first,last) range of elements from a %multimap. - * @param __first Iterator pointing to the start of the range to be - * erased. - * @param __last Iterator pointing to the end of the range to - * be erased. - * - * This function erases a sequence of elements from a %multimap. - * Note that this function only erases the elements, and that if - * the elements themselves are pointers, the pointed-to memory is not - * touched in any way. Managing the pointer is the user's - * responsibility. - */ - void - erase(iterator __first, iterator __last) - { _M_t.erase(__first, __last); } -#endif - - /** - * @brief Swaps data with another %multimap. - * @param __x A %multimap of the same element and allocator types. - * - * This exchanges the elements between two multimaps in constant time. - * (It is only swapping a pointer, an integer, and an instance of - * the @c Compare type (which itself is often stateless and empty), so it - * should be quite fast.) - * Note that the global std::swap() function is specialized such that - * std::swap(m1,m2) will feed to this function. - */ - void - swap(multimap& __x) -#if __cplusplus >= 201103L - noexcept(_Alloc_traits::_S_nothrow_swap()) -#endif - { _M_t.swap(__x._M_t); } - - /** - * Erases all elements in a %multimap. Note that this function only - * erases the elements, and that if the elements themselves are pointers, - * the pointed-to memory is not touched in any way. Managing the pointer - * is the user's responsibility. - */ - void - clear() _GLIBCXX_NOEXCEPT - { _M_t.clear(); } - - // observers - /** - * Returns the key comparison object out of which the %multimap - * was constructed. - */ - key_compare - key_comp() const - { return _M_t.key_comp(); } - - /** - * Returns a value comparison object, built from the key comparison - * object out of which the %multimap was constructed. - */ - value_compare - value_comp() const - { return value_compare(_M_t.key_comp()); } - - // multimap operations - - //@{ - /** - * @brief Tries to locate an element in a %multimap. - * @param __x Key of (key, value) pair to be located. - * @return Iterator pointing to sought-after element, - * or end() if not found. - * - * This function takes a key and tries to locate the element with which - * the key matches. If successful the function returns an iterator - * pointing to the sought after %pair. If unsuccessful it returns the - * past-the-end ( @c end() ) iterator. - */ - iterator - find(const key_type& __x) - { return _M_t.find(__x); } - -#if __cplusplus > 201103L - template - auto - find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x)) - { return _M_t._M_find_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Tries to locate an element in a %multimap. - * @param __x Key of (key, value) pair to be located. - * @return Read-only (constant) iterator pointing to sought-after - * element, or end() if not found. - * - * This function takes a key and tries to locate the element with which - * the key matches. If successful the function returns a constant - * iterator pointing to the sought after %pair. If unsuccessful it - * returns the past-the-end ( @c end() ) iterator. - */ - const_iterator - find(const key_type& __x) const - { return _M_t.find(__x); } - -#if __cplusplus > 201103L - template - auto - find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x)) - { return _M_t._M_find_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds the number of elements with given key. - * @param __x Key of (key, value) pairs to be located. - * @return Number of elements with specified key. - */ - size_type - count(const key_type& __x) const - { return _M_t.count(__x); } - -#if __cplusplus > 201103L - template - auto - count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x)) - { return _M_t._M_count_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds the beginning of a subsequence matching given key. - * @param __x Key of (key, value) pair to be located. - * @return Iterator pointing to first element equal to or greater - * than key, or end(). - * - * This function returns the first element of a subsequence of elements - * that matches the given key. If unsuccessful it returns an iterator - * pointing to the first element that has a greater value than given key - * or end() if no such element exists. - */ - iterator - lower_bound(const key_type& __x) - { return _M_t.lower_bound(__x); } - -#if __cplusplus > 201103L - template - auto - lower_bound(const _Kt& __x) - -> decltype(_M_t._M_lower_bound_tr(__x)) - { return _M_t._M_lower_bound_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds the beginning of a subsequence matching given key. - * @param __x Key of (key, value) pair to be located. - * @return Read-only (constant) iterator pointing to first element - * equal to or greater than key, or end(). - * - * This function returns the first element of a subsequence of - * elements that matches the given key. If unsuccessful the - * iterator will point to the next greatest element or, if no - * such greater element exists, to end(). - */ - const_iterator - lower_bound(const key_type& __x) const - { return _M_t.lower_bound(__x); } - -#if __cplusplus > 201103L - template - auto - lower_bound(const _Kt& __x) const - -> decltype(_M_t._M_lower_bound_tr(__x)) - { return _M_t._M_lower_bound_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds the end of a subsequence matching given key. - * @param __x Key of (key, value) pair to be located. - * @return Iterator pointing to the first element - * greater than key, or end(). - */ - iterator - upper_bound(const key_type& __x) - { return _M_t.upper_bound(__x); } - -#if __cplusplus > 201103L - template - auto - upper_bound(const _Kt& __x) - -> decltype(_M_t._M_upper_bound_tr(__x)) - { return _M_t._M_upper_bound_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds the end of a subsequence matching given key. - * @param __x Key of (key, value) pair to be located. - * @return Read-only (constant) iterator pointing to first iterator - * greater than key, or end(). - */ - const_iterator - upper_bound(const key_type& __x) const - { return _M_t.upper_bound(__x); } - -#if __cplusplus > 201103L - template - auto - upper_bound(const _Kt& __x) const - -> decltype(_M_t._M_upper_bound_tr(__x)) - { return _M_t._M_upper_bound_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds a subsequence matching given key. - * @param __x Key of (key, value) pairs to be located. - * @return Pair of iterators that possibly points to the subsequence - * matching given key. - * - * This function is equivalent to - * @code - * std::make_pair(c.lower_bound(val), - * c.upper_bound(val)) - * @endcode - * (but is faster than making the calls separately). - */ - std::pair - equal_range(const key_type& __x) - { return _M_t.equal_range(__x); } - -#if __cplusplus > 201103L - template - auto - equal_range(const _Kt& __x) - -> decltype(_M_t._M_equal_range_tr(__x)) - { return _M_t._M_equal_range_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds a subsequence matching given key. - * @param __x Key of (key, value) pairs to be located. - * @return Pair of read-only (constant) iterators that possibly points - * to the subsequence matching given key. - * - * This function is equivalent to - * @code - * std::make_pair(c.lower_bound(val), - * c.upper_bound(val)) - * @endcode - * (but is faster than making the calls separately). - */ - std::pair - equal_range(const key_type& __x) const - { return _M_t.equal_range(__x); } - -#if __cplusplus > 201103L - template - auto - equal_range(const _Kt& __x) const - -> decltype(_M_t._M_equal_range_tr(__x)) - { return _M_t._M_equal_range_tr(__x); } -#endif - //@} - - template - friend bool - operator==(const multimap<_K1, _T1, _C1, _A1>&, - const multimap<_K1, _T1, _C1, _A1>&); - - template - friend bool - operator<(const multimap<_K1, _T1, _C1, _A1>&, - const multimap<_K1, _T1, _C1, _A1>&); - }; - - /** - * @brief Multimap equality comparison. - * @param __x A %multimap. - * @param __y A %multimap of the same type as @a __x. - * @return True iff the size and elements of the maps are equal. - * - * This is an equivalence relation. It is linear in the size of the - * multimaps. Multimaps are considered equivalent if their sizes are equal, - * and if corresponding elements compare equal. - */ - template - inline bool - operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, - const multimap<_Key, _Tp, _Compare, _Alloc>& __y) - { return __x._M_t == __y._M_t; } - - /** - * @brief Multimap ordering relation. - * @param __x A %multimap. - * @param __y A %multimap of the same type as @a __x. - * @return True iff @a x is lexicographically less than @a y. - * - * This is a total ordering relation. It is linear in the size of the - * multimaps. The elements must be comparable with @c <. - * - * See std::lexicographical_compare() for how the determination is made. - */ - template - inline bool - operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, - const multimap<_Key, _Tp, _Compare, _Alloc>& __y) - { return __x._M_t < __y._M_t; } - - /// Based on operator== - template - inline bool - operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, - const multimap<_Key, _Tp, _Compare, _Alloc>& __y) - { return !(__x == __y); } - - /// Based on operator< - template - inline bool - operator>(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, - const multimap<_Key, _Tp, _Compare, _Alloc>& __y) - { return __y < __x; } - - /// Based on operator< - template - inline bool - operator<=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, - const multimap<_Key, _Tp, _Compare, _Alloc>& __y) - { return !(__y < __x); } - - /// Based on operator< - template - inline bool - operator>=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, - const multimap<_Key, _Tp, _Compare, _Alloc>& __y) - { return !(__x < __y); } - - /// See std::multimap::swap(). - template - inline void - swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x, - multimap<_Key, _Tp, _Compare, _Alloc>& __y) - { __x.swap(__y); } - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#endif /* _STL_MULTIMAP_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_multiset.h b/openflow/usr/include/c++/5/bits/stl_multiset.h deleted file mode 100644 index ffe15ae..0000000 --- a/openflow/usr/include/c++/5/bits/stl_multiset.h +++ /dev/null @@ -1,884 +0,0 @@ -// Multiset implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_multiset.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{set} - */ - -#ifndef _STL_MULTISET_H -#define _STL_MULTISET_H 1 - -#include -#if __cplusplus >= 201103L -#include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - /** - * @brief A standard container made up of elements, which can be retrieved - * in logarithmic time. - * - * @ingroup associative_containers - * - * - * @tparam _Key Type of key objects. - * @tparam _Compare Comparison function object type, defaults to less<_Key>. - * @tparam _Alloc Allocator type, defaults to allocator<_Key>. - * - * Meets the requirements of a container, a - * reversible container, and an - * associative container (using equivalent - * keys). For a @c multiset the key_type and value_type are Key. - * - * Multisets support bidirectional iterators. - * - * The private tree data is declared exactly the same way for set and - * multiset; the distinction is made entirely in how the tree functions are - * called (*_unique versus *_equal, same as the standard). - */ - template , - typename _Alloc = std::allocator<_Key> > - class multiset - { - // concept requirements - typedef typename _Alloc::value_type _Alloc_value_type; - __glibcxx_class_requires(_Key, _SGIAssignableConcept) - __glibcxx_class_requires4(_Compare, bool, _Key, _Key, - _BinaryFunctionConcept) - __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept) - - public: - // typedefs: - typedef _Key key_type; - typedef _Key value_type; - typedef _Compare key_compare; - typedef _Compare value_compare; - typedef _Alloc allocator_type; - - private: - /// This turns a red-black tree into a [multi]set. - typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template - rebind<_Key>::other _Key_alloc_type; - - typedef _Rb_tree, - key_compare, _Key_alloc_type> _Rep_type; - /// The actual tree structure. - _Rep_type _M_t; - - typedef __gnu_cxx::__alloc_traits<_Key_alloc_type> _Alloc_traits; - - public: - typedef typename _Alloc_traits::pointer pointer; - typedef typename _Alloc_traits::const_pointer const_pointer; - typedef typename _Alloc_traits::reference reference; - typedef typename _Alloc_traits::const_reference const_reference; - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 103. set::iterator is required to be modifiable, - // but this allows modification of keys. - typedef typename _Rep_type::const_iterator iterator; - typedef typename _Rep_type::const_iterator const_iterator; - typedef typename _Rep_type::const_reverse_iterator reverse_iterator; - typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; - typedef typename _Rep_type::size_type size_type; - typedef typename _Rep_type::difference_type difference_type; - - // allocation/deallocation - /** - * @brief Default constructor creates no elements. - */ - multiset() -#if __cplusplus >= 201103L - noexcept(is_nothrow_default_constructible::value) -#endif - : _M_t() { } - - /** - * @brief Creates a %multiset with no elements. - * @param __comp Comparator to use. - * @param __a An allocator object. - */ - explicit - multiset(const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _Key_alloc_type(__a)) { } - - /** - * @brief Builds a %multiset from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * - * Create a %multiset consisting of copies of the elements from - * [first,last). This is linear in N if the range is already sorted, - * and NlogN otherwise (where N is distance(__first,__last)). - */ - template - multiset(_InputIterator __first, _InputIterator __last) - : _M_t() - { _M_t._M_insert_equal(__first, __last); } - - /** - * @brief Builds a %multiset from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __comp A comparison functor. - * @param __a An allocator object. - * - * Create a %multiset consisting of copies of the elements from - * [__first,__last). This is linear in N if the range is already sorted, - * and NlogN otherwise (where N is distance(__first,__last)). - */ - template - multiset(_InputIterator __first, _InputIterator __last, - const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _Key_alloc_type(__a)) - { _M_t._M_insert_equal(__first, __last); } - - /** - * @brief %Multiset copy constructor. - * @param __x A %multiset of identical element and allocator types. - * - * The newly-created %multiset uses a copy of the allocation object used - * by @a __x. - */ - multiset(const multiset& __x) - : _M_t(__x._M_t) { } - -#if __cplusplus >= 201103L - /** - * @brief %Multiset move constructor. - * @param __x A %multiset of identical element and allocator types. - * - * The newly-created %multiset contains the exact contents of @a __x. - * The contents of @a __x are a valid, but unspecified %multiset. - */ - multiset(multiset&& __x) - noexcept(is_nothrow_copy_constructible<_Compare>::value) - : _M_t(std::move(__x._M_t)) { } - - /** - * @brief Builds a %multiset from an initializer_list. - * @param __l An initializer_list. - * @param __comp A comparison functor. - * @param __a An allocator object. - * - * Create a %multiset consisting of copies of the elements from - * the list. This is linear in N if the list is already sorted, - * and NlogN otherwise (where N is @a __l.size()). - */ - multiset(initializer_list __l, - const _Compare& __comp = _Compare(), - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _Key_alloc_type(__a)) - { _M_t._M_insert_equal(__l.begin(), __l.end()); } - - /// Allocator-extended default constructor. - explicit - multiset(const allocator_type& __a) - : _M_t(_Compare(), _Key_alloc_type(__a)) { } - - /// Allocator-extended copy constructor. - multiset(const multiset& __m, const allocator_type& __a) - : _M_t(__m._M_t, _Key_alloc_type(__a)) { } - - /// Allocator-extended move constructor. - multiset(multiset&& __m, const allocator_type& __a) - noexcept(is_nothrow_copy_constructible<_Compare>::value - && _Alloc_traits::_S_always_equal()) - : _M_t(std::move(__m._M_t), _Key_alloc_type(__a)) { } - - /// Allocator-extended initialier-list constructor. - multiset(initializer_list __l, const allocator_type& __a) - : _M_t(_Compare(), _Key_alloc_type(__a)) - { _M_t._M_insert_equal(__l.begin(), __l.end()); } - - /// Allocator-extended range constructor. - template - multiset(_InputIterator __first, _InputIterator __last, - const allocator_type& __a) - : _M_t(_Compare(), _Key_alloc_type(__a)) - { _M_t._M_insert_equal(__first, __last); } -#endif - - /** - * @brief %Multiset assignment operator. - * @param __x A %multiset of identical element and allocator types. - * - * All the elements of @a __x are copied, but unlike the copy - * constructor, the allocator object is not copied. - */ - multiset& - operator=(const multiset& __x) - { - _M_t = __x._M_t; - return *this; - } - -#if __cplusplus >= 201103L - /// Move assignment operator. - multiset& - operator=(multiset&&) = default; - - /** - * @brief %Multiset list assignment operator. - * @param __l An initializer_list. - * - * This function fills a %multiset with copies of the elements in the - * initializer list @a __l. - * - * Note that the assignment completely changes the %multiset and - * that the resulting %multiset's size is the same as the number - * of elements assigned. Old data may be lost. - */ - multiset& - operator=(initializer_list __l) - { - _M_t._M_assign_equal(__l.begin(), __l.end()); - return *this; - } -#endif - - // accessors: - - /// Returns the comparison object. - key_compare - key_comp() const - { return _M_t.key_comp(); } - /// Returns the comparison object. - value_compare - value_comp() const - { return _M_t.key_comp(); } - /// Returns the memory allocation object. - allocator_type - get_allocator() const _GLIBCXX_NOEXCEPT - { return allocator_type(_M_t.get_allocator()); } - - /** - * Returns a read-only (constant) iterator that points to the first - * element in the %multiset. Iteration is done in ascending order - * according to the keys. - */ - iterator - begin() const _GLIBCXX_NOEXCEPT - { return _M_t.begin(); } - - /** - * Returns a read-only (constant) iterator that points one past the last - * element in the %multiset. Iteration is done in ascending order - * according to the keys. - */ - iterator - end() const _GLIBCXX_NOEXCEPT - { return _M_t.end(); } - - /** - * Returns a read-only (constant) reverse iterator that points to the - * last element in the %multiset. Iteration is done in descending order - * according to the keys. - */ - reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return _M_t.rbegin(); } - - /** - * Returns a read-only (constant) reverse iterator that points to the - * last element in the %multiset. Iteration is done in descending order - * according to the keys. - */ - reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return _M_t.rend(); } - -#if __cplusplus >= 201103L - /** - * Returns a read-only (constant) iterator that points to the first - * element in the %multiset. Iteration is done in ascending order - * according to the keys. - */ - iterator - cbegin() const noexcept - { return _M_t.begin(); } - - /** - * Returns a read-only (constant) iterator that points one past the last - * element in the %multiset. Iteration is done in ascending order - * according to the keys. - */ - iterator - cend() const noexcept - { return _M_t.end(); } - - /** - * Returns a read-only (constant) reverse iterator that points to the - * last element in the %multiset. Iteration is done in descending order - * according to the keys. - */ - reverse_iterator - crbegin() const noexcept - { return _M_t.rbegin(); } - - /** - * Returns a read-only (constant) reverse iterator that points to the - * last element in the %multiset. Iteration is done in descending order - * according to the keys. - */ - reverse_iterator - crend() const noexcept - { return _M_t.rend(); } -#endif - - /// Returns true if the %set is empty. - bool - empty() const _GLIBCXX_NOEXCEPT - { return _M_t.empty(); } - - /// Returns the size of the %set. - size_type - size() const _GLIBCXX_NOEXCEPT - { return _M_t.size(); } - - /// Returns the maximum size of the %set. - size_type - max_size() const _GLIBCXX_NOEXCEPT - { return _M_t.max_size(); } - - /** - * @brief Swaps data with another %multiset. - * @param __x A %multiset of the same element and allocator types. - * - * This exchanges the elements between two multisets in constant time. - * (It is only swapping a pointer, an integer, and an instance of the @c - * Compare type (which itself is often stateless and empty), so it should - * be quite fast.) - * Note that the global std::swap() function is specialized such that - * std::swap(s1,s2) will feed to this function. - */ - void - swap(multiset& __x) -#if __cplusplus >= 201103L - noexcept(_Alloc_traits::_S_nothrow_swap()) -#endif - { _M_t.swap(__x._M_t); } - - // insert/erase -#if __cplusplus >= 201103L - /** - * @brief Builds and inserts an element into the %multiset. - * @param __args Arguments used to generate the element instance to be - * inserted. - * @return An iterator that points to the inserted element. - * - * This function inserts an element into the %multiset. Contrary - * to a std::set the %multiset does not rely on unique keys and thus - * multiple copies of the same element can be inserted. - * - * Insertion requires logarithmic time. - */ - template - iterator - emplace(_Args&&... __args) - { return _M_t._M_emplace_equal(std::forward<_Args>(__args)...); } - - /** - * @brief Builds and inserts an element into the %multiset. - * @param __pos An iterator that serves as a hint as to where the - * element should be inserted. - * @param __args Arguments used to generate the element instance to be - * inserted. - * @return An iterator that points to the inserted element. - * - * This function inserts an element into the %multiset. Contrary - * to a std::set the %multiset does not rely on unique keys and thus - * multiple copies of the same element can be inserted. - * - * Note that the first parameter is only a hint and can potentially - * improve the performance of the insertion process. A bad hint would - * cause no gains in efficiency. - * - * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * for more on @a hinting. - * - * Insertion requires logarithmic time (if the hint is not taken). - */ - template - iterator - emplace_hint(const_iterator __pos, _Args&&... __args) - { - return _M_t._M_emplace_hint_equal(__pos, - std::forward<_Args>(__args)...); - } -#endif - - /** - * @brief Inserts an element into the %multiset. - * @param __x Element to be inserted. - * @return An iterator that points to the inserted element. - * - * This function inserts an element into the %multiset. Contrary - * to a std::set the %multiset does not rely on unique keys and thus - * multiple copies of the same element can be inserted. - * - * Insertion requires logarithmic time. - */ - iterator - insert(const value_type& __x) - { return _M_t._M_insert_equal(__x); } - -#if __cplusplus >= 201103L - iterator - insert(value_type&& __x) - { return _M_t._M_insert_equal(std::move(__x)); } -#endif - - /** - * @brief Inserts an element into the %multiset. - * @param __position An iterator that serves as a hint as to where the - * element should be inserted. - * @param __x Element to be inserted. - * @return An iterator that points to the inserted element. - * - * This function inserts an element into the %multiset. Contrary - * to a std::set the %multiset does not rely on unique keys and thus - * multiple copies of the same element can be inserted. - * - * Note that the first parameter is only a hint and can potentially - * improve the performance of the insertion process. A bad hint would - * cause no gains in efficiency. - * - * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * for more on @a hinting. - * - * Insertion requires logarithmic time (if the hint is not taken). - */ - iterator - insert(const_iterator __position, const value_type& __x) - { return _M_t._M_insert_equal_(__position, __x); } - -#if __cplusplus >= 201103L - iterator - insert(const_iterator __position, value_type&& __x) - { return _M_t._M_insert_equal_(__position, std::move(__x)); } -#endif - - /** - * @brief A template function that tries to insert a range of elements. - * @param __first Iterator pointing to the start of the range to be - * inserted. - * @param __last Iterator pointing to the end of the range. - * - * Complexity similar to that of the range constructor. - */ - template - void - insert(_InputIterator __first, _InputIterator __last) - { _M_t._M_insert_equal(__first, __last); } - -#if __cplusplus >= 201103L - /** - * @brief Attempts to insert a list of elements into the %multiset. - * @param __l A std::initializer_list of elements - * to be inserted. - * - * Complexity similar to that of the range constructor. - */ - void - insert(initializer_list __l) - { this->insert(__l.begin(), __l.end()); } -#endif - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 130. Associative erase should return an iterator. - /** - * @brief Erases an element from a %multiset. - * @param __position An iterator pointing to the element to be erased. - * @return An iterator pointing to the element immediately following - * @a position prior to the element being erased. If no such - * element exists, end() is returned. - * - * This function erases an element, pointed to by the given iterator, - * from a %multiset. Note that this function only erases the element, - * and that if the element is itself a pointer, the pointed-to memory is - * not touched in any way. Managing the pointer is the user's - * responsibility. - */ - _GLIBCXX_ABI_TAG_CXX11 - iterator - erase(const_iterator __position) - { return _M_t.erase(__position); } -#else - /** - * @brief Erases an element from a %multiset. - * @param __position An iterator pointing to the element to be erased. - * - * This function erases an element, pointed to by the given iterator, - * from a %multiset. Note that this function only erases the element, - * and that if the element is itself a pointer, the pointed-to memory is - * not touched in any way. Managing the pointer is the user's - * responsibility. - */ - void - erase(iterator __position) - { _M_t.erase(__position); } -#endif - - /** - * @brief Erases elements according to the provided key. - * @param __x Key of element to be erased. - * @return The number of elements erased. - * - * This function erases all elements located by the given key from a - * %multiset. - * Note that this function only erases the element, and that if - * the element is itself a pointer, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - size_type - erase(const key_type& __x) - { return _M_t.erase(__x); } - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 130. Associative erase should return an iterator. - /** - * @brief Erases a [first,last) range of elements from a %multiset. - * @param __first Iterator pointing to the start of the range to be - * erased. - * @param __last Iterator pointing to the end of the range to - * be erased. - * @return The iterator @a last. - * - * This function erases a sequence of elements from a %multiset. - * Note that this function only erases the elements, and that if - * the elements themselves are pointers, the pointed-to memory is not - * touched in any way. Managing the pointer is the user's - * responsibility. - */ - _GLIBCXX_ABI_TAG_CXX11 - iterator - erase(const_iterator __first, const_iterator __last) - { return _M_t.erase(__first, __last); } -#else - /** - * @brief Erases a [first,last) range of elements from a %multiset. - * @param first Iterator pointing to the start of the range to be - * erased. - * @param last Iterator pointing to the end of the range to be erased. - * - * This function erases a sequence of elements from a %multiset. - * Note that this function only erases the elements, and that if - * the elements themselves are pointers, the pointed-to memory is not - * touched in any way. Managing the pointer is the user's - * responsibility. - */ - void - erase(iterator __first, iterator __last) - { _M_t.erase(__first, __last); } -#endif - - /** - * Erases all elements in a %multiset. Note that this function only - * erases the elements, and that if the elements themselves are pointers, - * the pointed-to memory is not touched in any way. Managing the pointer - * is the user's responsibility. - */ - void - clear() _GLIBCXX_NOEXCEPT - { _M_t.clear(); } - - // multiset operations: - - //@{ - /** - * @brief Finds the number of elements with given key. - * @param __x Key of elements to be located. - * @return Number of elements with specified key. - */ - size_type - count(const key_type& __x) const - { return _M_t.count(__x); } - -#if __cplusplus > 201103L - template - auto - count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x)) - { return _M_t._M_count_tr(__x); } -#endif - //@} - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 214. set::find() missing const overload - //@{ - /** - * @brief Tries to locate an element in a %set. - * @param __x Element to be located. - * @return Iterator pointing to sought-after element, or end() if not - * found. - * - * This function takes a key and tries to locate the element with which - * the key matches. If successful the function returns an iterator - * pointing to the sought after element. If unsuccessful it returns the - * past-the-end ( @c end() ) iterator. - */ - iterator - find(const key_type& __x) - { return _M_t.find(__x); } - - const_iterator - find(const key_type& __x) const - { return _M_t.find(__x); } - -#if __cplusplus > 201103L - template - auto - find(const _Kt& __x) - -> decltype(iterator{_M_t._M_find_tr(__x)}) - { return iterator{_M_t._M_find_tr(__x)}; } - - template - auto - find(const _Kt& __x) const - -> decltype(const_iterator{_M_t._M_find_tr(__x)}) - { return const_iterator{_M_t._M_find_tr(__x)}; } -#endif - //@} - - //@{ - /** - * @brief Finds the beginning of a subsequence matching given key. - * @param __x Key to be located. - * @return Iterator pointing to first element equal to or greater - * than key, or end(). - * - * This function returns the first element of a subsequence of elements - * that matches the given key. If unsuccessful it returns an iterator - * pointing to the first element that has a greater value than given key - * or end() if no such element exists. - */ - iterator - lower_bound(const key_type& __x) - { return _M_t.lower_bound(__x); } - - const_iterator - lower_bound(const key_type& __x) const - { return _M_t.lower_bound(__x); } - -#if __cplusplus > 201103L - template - auto - lower_bound(const _Kt& __x) - -> decltype(_M_t._M_lower_bound_tr(__x)) - { return _M_t._M_lower_bound_tr(__x); } - - template - auto - lower_bound(const _Kt& __x) const - -> decltype(_M_t._M_lower_bound_tr(__x)) - { return _M_t._M_lower_bound_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds the end of a subsequence matching given key. - * @param __x Key to be located. - * @return Iterator pointing to the first element - * greater than key, or end(). - */ - iterator - upper_bound(const key_type& __x) - { return _M_t.upper_bound(__x); } - - const_iterator - upper_bound(const key_type& __x) const - { return _M_t.upper_bound(__x); } - -#if __cplusplus > 201103L - template - auto - upper_bound(const _Kt& __x) - -> decltype(_M_t._M_upper_bound_tr(__x)) - { return _M_t._M_upper_bound_tr(__x); } - - template - auto - upper_bound(const _Kt& __x) const - -> decltype(_M_t._M_upper_bound_tr(__x)) - { return _M_t._M_upper_bound_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds a subsequence matching given key. - * @param __x Key to be located. - * @return Pair of iterators that possibly points to the subsequence - * matching given key. - * - * This function is equivalent to - * @code - * std::make_pair(c.lower_bound(val), - * c.upper_bound(val)) - * @endcode - * (but is faster than making the calls separately). - * - * This function probably only makes sense for multisets. - */ - std::pair - equal_range(const key_type& __x) - { return _M_t.equal_range(__x); } - - std::pair - equal_range(const key_type& __x) const - { return _M_t.equal_range(__x); } - -#if __cplusplus > 201103L - template - auto - equal_range(const _Kt& __x) - -> decltype(_M_t._M_equal_range_tr(__x)) - { return _M_t._M_equal_range_tr(__x); } - - template - auto - equal_range(const _Kt& __x) const - -> decltype(_M_t._M_equal_range_tr(__x)) - { return _M_t._M_equal_range_tr(__x); } -#endif - //@} - - template - friend bool - operator==(const multiset<_K1, _C1, _A1>&, - const multiset<_K1, _C1, _A1>&); - - template - friend bool - operator< (const multiset<_K1, _C1, _A1>&, - const multiset<_K1, _C1, _A1>&); - }; - - /** - * @brief Multiset equality comparison. - * @param __x A %multiset. - * @param __y A %multiset of the same type as @a __x. - * @return True iff the size and elements of the multisets are equal. - * - * This is an equivalence relation. It is linear in the size of the - * multisets. - * Multisets are considered equivalent if their sizes are equal, and if - * corresponding elements compare equal. - */ - template - inline bool - operator==(const multiset<_Key, _Compare, _Alloc>& __x, - const multiset<_Key, _Compare, _Alloc>& __y) - { return __x._M_t == __y._M_t; } - - /** - * @brief Multiset ordering relation. - * @param __x A %multiset. - * @param __y A %multiset of the same type as @a __x. - * @return True iff @a __x is lexicographically less than @a __y. - * - * This is a total ordering relation. It is linear in the size of the - * sets. The elements must be comparable with @c <. - * - * See std::lexicographical_compare() for how the determination is made. - */ - template - inline bool - operator<(const multiset<_Key, _Compare, _Alloc>& __x, - const multiset<_Key, _Compare, _Alloc>& __y) - { return __x._M_t < __y._M_t; } - - /// Returns !(x == y). - template - inline bool - operator!=(const multiset<_Key, _Compare, _Alloc>& __x, - const multiset<_Key, _Compare, _Alloc>& __y) - { return !(__x == __y); } - - /// Returns y < x. - template - inline bool - operator>(const multiset<_Key,_Compare,_Alloc>& __x, - const multiset<_Key,_Compare,_Alloc>& __y) - { return __y < __x; } - - /// Returns !(y < x) - template - inline bool - operator<=(const multiset<_Key, _Compare, _Alloc>& __x, - const multiset<_Key, _Compare, _Alloc>& __y) - { return !(__y < __x); } - - /// Returns !(x < y) - template - inline bool - operator>=(const multiset<_Key, _Compare, _Alloc>& __x, - const multiset<_Key, _Compare, _Alloc>& __y) - { return !(__x < __y); } - - /// See std::multiset::swap(). - template - inline void - swap(multiset<_Key, _Compare, _Alloc>& __x, - multiset<_Key, _Compare, _Alloc>& __y) - { __x.swap(__y); } - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#endif /* _STL_MULTISET_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_numeric.h b/openflow/usr/include/c++/5/bits/stl_numeric.h deleted file mode 100644 index 8ad78fb..0000000 --- a/openflow/usr/include/c++/5/bits/stl_numeric.h +++ /dev/null @@ -1,387 +0,0 @@ -// Numeric functions implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_numeric.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{numeric} - */ - -#ifndef _STL_NUMERIC_H -#define _STL_NUMERIC_H 1 - -#include -#include -#include // For _GLIBCXX_MOVE - -#if __cplusplus >= 201103L - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @brief Create a range of sequentially increasing values. - * - * For each element in the range @p [first,last) assigns @p value and - * increments @p value as if by @p ++value. - * - * @param __first Start of range. - * @param __last End of range. - * @param __value Starting value. - * @return Nothing. - */ - template - void - iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) - { - // concept requirements - __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< - _ForwardIterator>) - __glibcxx_function_requires(_ConvertibleConcept<_Tp, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - for (; __first != __last; ++__first) - { - *__first = __value; - ++__value; - } - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_ALGO - - /** - * @brief Accumulate values in a range. - * - * Accumulates the values in the range [first,last) using operator+(). The - * initial value is @a init. The values are processed in order. - * - * @param __first Start of range. - * @param __last End of range. - * @param __init Starting value to add other values to. - * @return The final sum. - */ - template - inline _Tp - accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_requires_valid_range(__first, __last); - - for (; __first != __last; ++__first) - __init = __init + *__first; - return __init; - } - - /** - * @brief Accumulate values in a range with operation. - * - * Accumulates the values in the range [first,last) using the function - * object @p __binary_op. The initial value is @p __init. The values are - * processed in order. - * - * @param __first Start of range. - * @param __last End of range. - * @param __init Starting value to add other values to. - * @param __binary_op Function object to accumulate with. - * @return The final sum. - */ - template - inline _Tp - accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, - _BinaryOperation __binary_op) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_requires_valid_range(__first, __last); - - for (; __first != __last; ++__first) - __init = __binary_op(__init, *__first); - return __init; - } - - /** - * @brief Compute inner product of two ranges. - * - * Starting with an initial value of @p __init, multiplies successive - * elements from the two ranges and adds each product into the accumulated - * value using operator+(). The values in the ranges are processed in - * order. - * - * @param __first1 Start of range 1. - * @param __last1 End of range 1. - * @param __first2 Start of range 2. - * @param __init Starting value to add other values to. - * @return The final inner product. - */ - template - inline _Tp - inner_product(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _Tp __init) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_requires_valid_range(__first1, __last1); - - for (; __first1 != __last1; ++__first1, ++__first2) - __init = __init + (*__first1 * *__first2); - return __init; - } - - /** - * @brief Compute inner product of two ranges. - * - * Starting with an initial value of @p __init, applies @p __binary_op2 to - * successive elements from the two ranges and accumulates each result into - * the accumulated value using @p __binary_op1. The values in the ranges are - * processed in order. - * - * @param __first1 Start of range 1. - * @param __last1 End of range 1. - * @param __first2 Start of range 2. - * @param __init Starting value to add other values to. - * @param __binary_op1 Function object to accumulate with. - * @param __binary_op2 Function object to apply to pairs of input values. - * @return The final inner product. - */ - template - inline _Tp - inner_product(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _Tp __init, - _BinaryOperation1 __binary_op1, - _BinaryOperation2 __binary_op2) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_requires_valid_range(__first1, __last1); - - for (; __first1 != __last1; ++__first1, ++__first2) - __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); - return __init; - } - - /** - * @brief Return list of partial sums - * - * Accumulates the values in the range [first,last) using the @c + operator. - * As each successive input value is added into the total, that partial sum - * is written to @p __result. Therefore, the first value in @p __result is - * the first value of the input, the second value in @p __result is the sum - * of the first and second input values, and so on. - * - * @param __first Start of input range. - * @param __last End of input range. - * @param __result Output sum. - * @return Iterator pointing just beyond the values written to __result. - */ - template - _OutputIterator - partial_sum(_InputIterator __first, _InputIterator __last, - _OutputIterator __result) - { - typedef typename iterator_traits<_InputIterator>::value_type _ValueType; - - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - _ValueType>) - __glibcxx_requires_valid_range(__first, __last); - - if (__first == __last) - return __result; - _ValueType __value = *__first; - *__result = __value; - while (++__first != __last) - { - __value = __value + *__first; - *++__result = __value; - } - return ++__result; - } - - /** - * @brief Return list of partial sums - * - * Accumulates the values in the range [first,last) using @p __binary_op. - * As each successive input value is added into the total, that partial sum - * is written to @p __result. Therefore, the first value in @p __result is - * the first value of the input, the second value in @p __result is the sum - * of the first and second input values, and so on. - * - * @param __first Start of input range. - * @param __last End of input range. - * @param __result Output sum. - * @param __binary_op Function object. - * @return Iterator pointing just beyond the values written to __result. - */ - template - _OutputIterator - partial_sum(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _BinaryOperation __binary_op) - { - typedef typename iterator_traits<_InputIterator>::value_type _ValueType; - - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - _ValueType>) - __glibcxx_requires_valid_range(__first, __last); - - if (__first == __last) - return __result; - _ValueType __value = *__first; - *__result = __value; - while (++__first != __last) - { - __value = __binary_op(__value, *__first); - *++__result = __value; - } - return ++__result; - } - - /** - * @brief Return differences between adjacent values. - * - * Computes the difference between adjacent values in the range - * [first,last) using operator-() and writes the result to @p __result. - * - * @param __first Start of input range. - * @param __last End of input range. - * @param __result Output sums. - * @return Iterator pointing just beyond the values written to result. - * - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * DR 539. partial_sum and adjacent_difference should mention requirements - */ - template - _OutputIterator - adjacent_difference(_InputIterator __first, - _InputIterator __last, _OutputIterator __result) - { - typedef typename iterator_traits<_InputIterator>::value_type _ValueType; - - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - _ValueType>) - __glibcxx_requires_valid_range(__first, __last); - - if (__first == __last) - return __result; - _ValueType __value = *__first; - *__result = __value; - while (++__first != __last) - { - _ValueType __tmp = *__first; - *++__result = __tmp - __value; - __value = _GLIBCXX_MOVE(__tmp); - } - return ++__result; - } - - /** - * @brief Return differences between adjacent values. - * - * Computes the difference between adjacent values in the range - * [__first,__last) using the function object @p __binary_op and writes the - * result to @p __result. - * - * @param __first Start of input range. - * @param __last End of input range. - * @param __result Output sum. - * @param __binary_op Function object. - * @return Iterator pointing just beyond the values written to result. - * - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * DR 539. partial_sum and adjacent_difference should mention requirements - */ - template - _OutputIterator - adjacent_difference(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _BinaryOperation __binary_op) - { - typedef typename iterator_traits<_InputIterator>::value_type _ValueType; - - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - _ValueType>) - __glibcxx_requires_valid_range(__first, __last); - - if (__first == __last) - return __result; - _ValueType __value = *__first; - *__result = __value; - while (++__first != __last) - { - _ValueType __tmp = *__first; - *++__result = __binary_op(__tmp, __value); - __value = _GLIBCXX_MOVE(__tmp); - } - return ++__result; - } - -_GLIBCXX_END_NAMESPACE_ALGO -} // namespace std - -#endif /* _STL_NUMERIC_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_pair.h b/openflow/usr/include/c++/5/bits/stl_pair.h deleted file mode 100644 index 3daeb60..0000000 --- a/openflow/usr/include/c++/5/bits/stl_pair.h +++ /dev/null @@ -1,295 +0,0 @@ -// Pair implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_pair.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{utility} - */ - -#ifndef _STL_PAIR_H -#define _STL_PAIR_H 1 - -#include // for std::move / std::forward, and std::swap - -#if __cplusplus >= 201103L -#include // for std::__decay_and_strip too -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup utilities - * @{ - */ - -#if __cplusplus >= 201103L - /// piecewise_construct_t - struct piecewise_construct_t { }; - - /// piecewise_construct - constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); - - // Forward declarations. - template - class tuple; - - template - struct _Index_tuple; -#endif - - /** - * @brief Struct holding two objects of arbitrary type. - * - * @tparam _T1 Type of first object. - * @tparam _T2 Type of second object. - */ - template - struct pair - { - typedef _T1 first_type; /// @c first_type is the first bound type - typedef _T2 second_type; /// @c second_type is the second bound type - - _T1 first; /// @c first is a copy of the first object - _T2 second; /// @c second is a copy of the second object - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 265. std::pair::pair() effects overly restrictive - /** The default constructor creates @c first and @c second using their - * respective default constructors. */ - _GLIBCXX_CONSTEXPR pair() - : first(), second() { } - - /** Two objects may be passed to a @c pair constructor to be copied. */ - _GLIBCXX_CONSTEXPR pair(const _T1& __a, const _T2& __b) - : first(__a), second(__b) { } - - /** There is also a templated copy ctor for the @c pair class itself. */ -#if __cplusplus < 201103L - template - pair(const pair<_U1, _U2>& __p) - : first(__p.first), second(__p.second) { } -#else - template, - is_convertible>::value>::type> - constexpr pair(const pair<_U1, _U2>& __p) - : first(__p.first), second(__p.second) { } - - constexpr pair(const pair&) = default; - constexpr pair(pair&&) = default; - - // DR 811. - template::value>::type> - constexpr pair(_U1&& __x, const _T2& __y) - : first(std::forward<_U1>(__x)), second(__y) { } - - template::value>::type> - constexpr pair(const _T1& __x, _U2&& __y) - : first(__x), second(std::forward<_U2>(__y)) { } - - template, - is_convertible<_U2, _T2>>::value>::type> - constexpr pair(_U1&& __x, _U2&& __y) - : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { } - - template, - is_convertible<_U2, _T2>>::value>::type> - constexpr pair(pair<_U1, _U2>&& __p) - : first(std::forward<_U1>(__p.first)), - second(std::forward<_U2>(__p.second)) { } - - template - pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>); - - pair& - operator=(const pair& __p) - { - first = __p.first; - second = __p.second; - return *this; - } - - pair& - operator=(pair&& __p) - noexcept(__and_, - is_nothrow_move_assignable<_T2>>::value) - { - first = std::forward(__p.first); - second = std::forward(__p.second); - return *this; - } - - template - pair& - operator=(const pair<_U1, _U2>& __p) - { - first = __p.first; - second = __p.second; - return *this; - } - - template - pair& - operator=(pair<_U1, _U2>&& __p) - { - first = std::forward<_U1>(__p.first); - second = std::forward<_U2>(__p.second); - return *this; - } - - void - swap(pair& __p) - noexcept(noexcept(swap(first, __p.first)) - && noexcept(swap(second, __p.second))) - { - using std::swap; - swap(first, __p.first); - swap(second, __p.second); - } - - private: - template - pair(tuple<_Args1...>&, tuple<_Args2...>&, - _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>); -#endif - }; - - /// Two pairs of the same type are equal iff their members are equal. - template - inline _GLIBCXX_CONSTEXPR bool - operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) - { return __x.first == __y.first && __x.second == __y.second; } - - /// - template - inline _GLIBCXX_CONSTEXPR bool - operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) - { return __x.first < __y.first - || (!(__y.first < __x.first) && __x.second < __y.second); } - - /// Uses @c operator== to find the result. - template - inline _GLIBCXX_CONSTEXPR bool - operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) - { return !(__x == __y); } - - /// Uses @c operator< to find the result. - template - inline _GLIBCXX_CONSTEXPR bool - operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) - { return __y < __x; } - - /// Uses @c operator< to find the result. - template - inline _GLIBCXX_CONSTEXPR bool - operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) - { return !(__y < __x); } - - /// Uses @c operator< to find the result. - template - inline _GLIBCXX_CONSTEXPR bool - operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) - { return !(__x < __y); } - -#if __cplusplus >= 201103L - /// See std::pair::swap(). - // Note: no std::swap overloads in C++03 mode, this has performance - // implications, see, eg, libstdc++/38466. - template - inline void - swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) - noexcept(noexcept(__x.swap(__y))) - { __x.swap(__y); } -#endif - - /** - * @brief A convenience wrapper for creating a pair from two objects. - * @param __x The first object. - * @param __y The second object. - * @return A newly-constructed pair<> object of the appropriate type. - * - * The standard requires that the objects be passed by reference-to-const, - * but LWG issue #181 says they should be passed by const value. We follow - * the LWG by default. - */ - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 181. make_pair() unintended behavior -#if __cplusplus >= 201103L - // NB: DR 706. - template - constexpr pair::__type, - typename __decay_and_strip<_T2>::__type> - make_pair(_T1&& __x, _T2&& __y) - { - typedef typename __decay_and_strip<_T1>::__type __ds_type1; - typedef typename __decay_and_strip<_T2>::__type __ds_type2; - typedef pair<__ds_type1, __ds_type2> __pair_type; - return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y)); - } -#else - template - inline pair<_T1, _T2> - make_pair(_T1 __x, _T2 __y) - { return pair<_T1, _T2>(__x, __y); } -#endif - - /// @} - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif /* _STL_PAIR_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_queue.h b/openflow/usr/include/c++/5/bits/stl_queue.h deleted file mode 100644 index 48e1ee7..0000000 --- a/openflow/usr/include/c++/5/bits/stl_queue.h +++ /dev/null @@ -1,572 +0,0 @@ -// Queue implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_queue.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{queue} - */ - -#ifndef _STL_QUEUE_H -#define _STL_QUEUE_H 1 - -#include -#include -#if __cplusplus >= 201103L -# include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @brief A standard container giving FIFO behavior. - * - * @ingroup sequences - * - * @tparam _Tp Type of element. - * @tparam _Sequence Type of underlying sequence, defaults to deque<_Tp>. - * - * Meets many of the requirements of a - * container, - * but does not define anything to do with iterators. Very few of the - * other standard container interfaces are defined. - * - * This is not a true container, but an @e adaptor. It holds another - * container, and provides a wrapper interface to that container. The - * wrapper is what enforces strict first-in-first-out %queue behavior. - * - * The second template parameter defines the type of the underlying - * sequence/container. It defaults to std::deque, but it can be any type - * that supports @c front, @c back, @c push_back, and @c pop_front, - * such as std::list or an appropriate user-defined type. - * - * Members not found in @a normal containers are @c container_type, - * which is a typedef for the second Sequence parameter, and @c push and - * @c pop, which are standard %queue/FIFO operations. - */ - template > - class queue - { - // concept requirements - typedef typename _Sequence::value_type _Sequence_value_type; - __glibcxx_class_requires(_Tp, _SGIAssignableConcept) - __glibcxx_class_requires(_Sequence, _FrontInsertionSequenceConcept) - __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept) - __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept) - - template - friend bool - operator==(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&); - - template - friend bool - operator<(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&); - - public: - typedef typename _Sequence::value_type value_type; - typedef typename _Sequence::reference reference; - typedef typename _Sequence::const_reference const_reference; - typedef typename _Sequence::size_type size_type; - typedef _Sequence container_type; - - protected: - /** - * 'c' is the underlying container. Maintainers wondering why - * this isn't uglified as per style guidelines should note that - * this name is specified in the standard, [23.2.3.1]. (Why? - * Presumably for the same reason that it's protected instead - * of private: to allow derivation. But none of the other - * containers allow for derivation. Odd.) - */ - _Sequence c; - - public: - /** - * @brief Default constructor creates no elements. - */ -#if __cplusplus < 201103L - explicit - queue(const _Sequence& __c = _Sequence()) - : c(__c) { } -#else - explicit - queue(const _Sequence& __c) - : c(__c) { } - - explicit - queue(_Sequence&& __c = _Sequence()) - : c(std::move(__c)) { } -#endif - - /** - * Returns true if the %queue is empty. - */ - bool - empty() const - { return c.empty(); } - - /** Returns the number of elements in the %queue. */ - size_type - size() const - { return c.size(); } - - /** - * Returns a read/write reference to the data at the first - * element of the %queue. - */ - reference - front() - { - __glibcxx_requires_nonempty(); - return c.front(); - } - - /** - * Returns a read-only (constant) reference to the data at the first - * element of the %queue. - */ - const_reference - front() const - { - __glibcxx_requires_nonempty(); - return c.front(); - } - - /** - * Returns a read/write reference to the data at the last - * element of the %queue. - */ - reference - back() - { - __glibcxx_requires_nonempty(); - return c.back(); - } - - /** - * Returns a read-only (constant) reference to the data at the last - * element of the %queue. - */ - const_reference - back() const - { - __glibcxx_requires_nonempty(); - return c.back(); - } - - /** - * @brief Add data to the end of the %queue. - * @param __x Data to be added. - * - * This is a typical %queue operation. The function creates an - * element at the end of the %queue and assigns the given data - * to it. The time complexity of the operation depends on the - * underlying sequence. - */ - void - push(const value_type& __x) - { c.push_back(__x); } - -#if __cplusplus >= 201103L - void - push(value_type&& __x) - { c.push_back(std::move(__x)); } - - template - void - emplace(_Args&&... __args) - { c.emplace_back(std::forward<_Args>(__args)...); } -#endif - - /** - * @brief Removes first element. - * - * This is a typical %queue operation. It shrinks the %queue by one. - * The time complexity of the operation depends on the underlying - * sequence. - * - * Note that no data is returned, and if the first element's - * data is needed, it should be retrieved before pop() is - * called. - */ - void - pop() - { - __glibcxx_requires_nonempty(); - c.pop_front(); - } - -#if __cplusplus >= 201103L - void - swap(queue& __q) - noexcept(noexcept(swap(c, __q.c))) - { - using std::swap; - swap(c, __q.c); - } -#endif - }; - - /** - * @brief Queue equality comparison. - * @param __x A %queue. - * @param __y A %queue of the same type as @a __x. - * @return True iff the size and elements of the queues are equal. - * - * This is an equivalence relation. Complexity and semantics depend on the - * underlying sequence type, but the expected rules are: this relation is - * linear in the size of the sequences, and queues are considered equivalent - * if their sequences compare equal. - */ - template - inline bool - operator==(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) - { return __x.c == __y.c; } - - /** - * @brief Queue ordering relation. - * @param __x A %queue. - * @param __y A %queue of the same type as @a x. - * @return True iff @a __x is lexicographically less than @a __y. - * - * This is an total ordering relation. Complexity and semantics - * depend on the underlying sequence type, but the expected rules - * are: this relation is linear in the size of the sequences, the - * elements must be comparable with @c <, and - * std::lexicographical_compare() is usually used to make the - * determination. - */ - template - inline bool - operator<(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) - { return __x.c < __y.c; } - - /// Based on operator== - template - inline bool - operator!=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) - { return !(__x == __y); } - - /// Based on operator< - template - inline bool - operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) - { return __y < __x; } - - /// Based on operator< - template - inline bool - operator<=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) - { return !(__y < __x); } - - /// Based on operator< - template - inline bool - operator>=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) - { return !(__x < __y); } - -#if __cplusplus >= 201103L - template - inline void - swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y) - noexcept(noexcept(__x.swap(__y))) - { __x.swap(__y); } - - template - struct uses_allocator, _Alloc> - : public uses_allocator<_Seq, _Alloc>::type { }; -#endif - - /** - * @brief A standard container automatically sorting its contents. - * - * @ingroup sequences - * - * @tparam _Tp Type of element. - * @tparam _Sequence Type of underlying sequence, defaults to vector<_Tp>. - * @tparam _Compare Comparison function object type, defaults to - * less<_Sequence::value_type>. - * - * This is not a true container, but an @e adaptor. It holds - * another container, and provides a wrapper interface to that - * container. The wrapper is what enforces priority-based sorting - * and %queue behavior. Very few of the standard container/sequence - * interface requirements are met (e.g., iterators). - * - * The second template parameter defines the type of the underlying - * sequence/container. It defaults to std::vector, but it can be - * any type that supports @c front(), @c push_back, @c pop_back, - * and random-access iterators, such as std::deque or an - * appropriate user-defined type. - * - * The third template parameter supplies the means of making - * priority comparisons. It defaults to @c less but - * can be anything defining a strict weak ordering. - * - * Members not found in @a normal containers are @c container_type, - * which is a typedef for the second Sequence parameter, and @c - * push, @c pop, and @c top, which are standard %queue operations. - * - * @note No equality/comparison operators are provided for - * %priority_queue. - * - * @note Sorting of the elements takes place as they are added to, - * and removed from, the %priority_queue using the - * %priority_queue's member functions. If you access the elements - * by other means, and change their data such that the sorting - * order would be different, the %priority_queue will not re-sort - * the elements for you. (How could it know to do so?) - */ - template, - typename _Compare = less > - class priority_queue - { - // concept requirements - typedef typename _Sequence::value_type _Sequence_value_type; - __glibcxx_class_requires(_Tp, _SGIAssignableConcept) - __glibcxx_class_requires(_Sequence, _SequenceConcept) - __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept) - __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept) - __glibcxx_class_requires4(_Compare, bool, _Tp, _Tp, - _BinaryFunctionConcept) - - public: - typedef typename _Sequence::value_type value_type; - typedef typename _Sequence::reference reference; - typedef typename _Sequence::const_reference const_reference; - typedef typename _Sequence::size_type size_type; - typedef _Sequence container_type; - - protected: - // See queue::c for notes on these names. - _Sequence c; - _Compare comp; - - public: - /** - * @brief Default constructor creates no elements. - */ -#if __cplusplus < 201103L - explicit - priority_queue(const _Compare& __x = _Compare(), - const _Sequence& __s = _Sequence()) - : c(__s), comp(__x) - { std::make_heap(c.begin(), c.end(), comp); } -#else - explicit - priority_queue(const _Compare& __x, - const _Sequence& __s) - : c(__s), comp(__x) - { std::make_heap(c.begin(), c.end(), comp); } - - explicit - priority_queue(const _Compare& __x = _Compare(), - _Sequence&& __s = _Sequence()) - : c(std::move(__s)), comp(__x) - { std::make_heap(c.begin(), c.end(), comp); } -#endif - - /** - * @brief Builds a %queue from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __x A comparison functor describing a strict weak ordering. - * @param __s An initial sequence with which to start. - * - * Begins by copying @a __s, inserting a copy of the elements - * from @a [first,last) into the copy of @a __s, then ordering - * the copy according to @a __x. - * - * For more information on function objects, see the - * documentation on @link functors functor base - * classes@endlink. - */ -#if __cplusplus < 201103L - template - priority_queue(_InputIterator __first, _InputIterator __last, - const _Compare& __x = _Compare(), - const _Sequence& __s = _Sequence()) - : c(__s), comp(__x) - { - __glibcxx_requires_valid_range(__first, __last); - c.insert(c.end(), __first, __last); - std::make_heap(c.begin(), c.end(), comp); - } -#else - template - priority_queue(_InputIterator __first, _InputIterator __last, - const _Compare& __x, - const _Sequence& __s) - : c(__s), comp(__x) - { - __glibcxx_requires_valid_range(__first, __last); - c.insert(c.end(), __first, __last); - std::make_heap(c.begin(), c.end(), comp); - } - - template - priority_queue(_InputIterator __first, _InputIterator __last, - const _Compare& __x = _Compare(), - _Sequence&& __s = _Sequence()) - : c(std::move(__s)), comp(__x) - { - __glibcxx_requires_valid_range(__first, __last); - c.insert(c.end(), __first, __last); - std::make_heap(c.begin(), c.end(), comp); - } -#endif - - /** - * Returns true if the %queue is empty. - */ - bool - empty() const - { return c.empty(); } - - /** Returns the number of elements in the %queue. */ - size_type - size() const - { return c.size(); } - - /** - * Returns a read-only (constant) reference to the data at the first - * element of the %queue. - */ - const_reference - top() const - { - __glibcxx_requires_nonempty(); - return c.front(); - } - - /** - * @brief Add data to the %queue. - * @param __x Data to be added. - * - * This is a typical %queue operation. - * The time complexity of the operation depends on the underlying - * sequence. - */ - void - push(const value_type& __x) - { - c.push_back(__x); - std::push_heap(c.begin(), c.end(), comp); - } - -#if __cplusplus >= 201103L - void - push(value_type&& __x) - { - c.push_back(std::move(__x)); - std::push_heap(c.begin(), c.end(), comp); - } - - template - void - emplace(_Args&&... __args) - { - c.emplace_back(std::forward<_Args>(__args)...); - std::push_heap(c.begin(), c.end(), comp); - } -#endif - - /** - * @brief Removes first element. - * - * This is a typical %queue operation. It shrinks the %queue - * by one. The time complexity of the operation depends on the - * underlying sequence. - * - * Note that no data is returned, and if the first element's - * data is needed, it should be retrieved before pop() is - * called. - */ - void - pop() - { - __glibcxx_requires_nonempty(); - std::pop_heap(c.begin(), c.end(), comp); - c.pop_back(); - } - -#if __cplusplus >= 201103L - void - swap(priority_queue& __pq) - noexcept(noexcept(swap(c, __pq.c)) && noexcept(swap(comp, __pq.comp))) - { - using std::swap; - swap(c, __pq.c); - swap(comp, __pq.comp); - } -#endif - }; - - // No equality/comparison operators are provided for priority_queue. - -#if __cplusplus >= 201103L - template - inline void - swap(priority_queue<_Tp, _Sequence, _Compare>& __x, - priority_queue<_Tp, _Sequence, _Compare>& __y) - noexcept(noexcept(__x.swap(__y))) - { __x.swap(__y); } - - template - struct uses_allocator, _Alloc> - : public uses_allocator<_Sequence, _Alloc>::type { }; -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _STL_QUEUE_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_raw_storage_iter.h b/openflow/usr/include/c++/5/bits/stl_raw_storage_iter.h deleted file mode 100644 index 2ce83ff..0000000 --- a/openflow/usr/include/c++/5/bits/stl_raw_storage_iter.h +++ /dev/null @@ -1,108 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_raw_storage_iter.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _STL_RAW_STORAGE_ITERATOR_H -#define _STL_RAW_STORAGE_ITERATOR_H 1 - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * This iterator class lets algorithms store their results into - * uninitialized memory. - */ - template - class raw_storage_iterator - : public iterator - { - protected: - _OutputIterator _M_iter; - - public: - explicit - raw_storage_iterator(_OutputIterator __x) - : _M_iter(__x) {} - - raw_storage_iterator& - operator*() { return *this; } - - raw_storage_iterator& - operator=(const _Tp& __element) - { - std::_Construct(std::__addressof(*_M_iter), __element); - return *this; - } - - raw_storage_iterator<_OutputIterator, _Tp>& - operator++() - { - ++_M_iter; - return *this; - } - - raw_storage_iterator<_OutputIterator, _Tp> - operator++(int) - { - raw_storage_iterator<_OutputIterator, _Tp> __tmp = *this; - ++_M_iter; - return __tmp; - } - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/bits/stl_relops.h b/openflow/usr/include/c++/5/bits/stl_relops.h deleted file mode 100644 index b09694f..0000000 --- a/openflow/usr/include/c++/5/bits/stl_relops.h +++ /dev/null @@ -1,134 +0,0 @@ -// std::rel_ops implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the, 2009 Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * Copyright (c) 1996,1997 - * Silicon Graphics - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/** @file bits/stl_relops.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{utility} - * - * Inclusion of this file has been removed from - * all of the other STL headers for safety reasons, except std_utility.h. - * For more information, see the thread of about twenty messages starting - * with http://gcc.gnu.org/ml/libstdc++/2001-01/msg00223.html, or - * http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.ambiguous_overloads - * - * Short summary: the rel_ops operators should be avoided for the present. - */ - -#ifndef _STL_RELOPS_H -#define _STL_RELOPS_H 1 - -namespace std _GLIBCXX_VISIBILITY(default) -{ - namespace rel_ops - { - _GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** @namespace std::rel_ops - * @brief The generated relational operators are sequestered here. - */ - - /** - * @brief Defines @c != for arbitrary types, in terms of @c ==. - * @param __x A thing. - * @param __y Another thing. - * @return __x != __y - * - * This function uses @c == to determine its result. - */ - template - inline bool - operator!=(const _Tp& __x, const _Tp& __y) - { return !(__x == __y); } - - /** - * @brief Defines @c > for arbitrary types, in terms of @c <. - * @param __x A thing. - * @param __y Another thing. - * @return __x > __y - * - * This function uses @c < to determine its result. - */ - template - inline bool - operator>(const _Tp& __x, const _Tp& __y) - { return __y < __x; } - - /** - * @brief Defines @c <= for arbitrary types, in terms of @c <. - * @param __x A thing. - * @param __y Another thing. - * @return __x <= __y - * - * This function uses @c < to determine its result. - */ - template - inline bool - operator<=(const _Tp& __x, const _Tp& __y) - { return !(__y < __x); } - - /** - * @brief Defines @c >= for arbitrary types, in terms of @c <. - * @param __x A thing. - * @param __y Another thing. - * @return __x >= __y - * - * This function uses @c < to determine its result. - */ - template - inline bool - operator>=(const _Tp& __x, const _Tp& __y) - { return !(__x < __y); } - - _GLIBCXX_END_NAMESPACE_VERSION - } // namespace rel_ops - -} // namespace std - -#endif /* _STL_RELOPS_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_set.h b/openflow/usr/include/c++/5/bits/stl_set.h deleted file mode 100644 index 35cdf71..0000000 --- a/openflow/usr/include/c++/5/bits/stl_set.h +++ /dev/null @@ -1,899 +0,0 @@ -// Set implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_set.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{set} - */ - -#ifndef _STL_SET_H -#define _STL_SET_H 1 - -#include -#if __cplusplus >= 201103L -#include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - /** - * @brief A standard container made up of unique keys, which can be - * retrieved in logarithmic time. - * - * @ingroup associative_containers - * - * @tparam _Key Type of key objects. - * @tparam _Compare Comparison function object type, defaults to less<_Key>. - * @tparam _Alloc Allocator type, defaults to allocator<_Key>. - * - * Meets the requirements of a container, a - * reversible container, and an - * associative container (using unique keys). - * - * Sets support bidirectional iterators. - * - * The private tree data is declared exactly the same way for set and - * multiset; the distinction is made entirely in how the tree functions are - * called (*_unique versus *_equal, same as the standard). - */ - template, - typename _Alloc = std::allocator<_Key> > - class set - { - // concept requirements - typedef typename _Alloc::value_type _Alloc_value_type; - __glibcxx_class_requires(_Key, _SGIAssignableConcept) - __glibcxx_class_requires4(_Compare, bool, _Key, _Key, - _BinaryFunctionConcept) - __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept) - - public: - // typedefs: - //@{ - /// Public typedefs. - typedef _Key key_type; - typedef _Key value_type; - typedef _Compare key_compare; - typedef _Compare value_compare; - typedef _Alloc allocator_type; - //@} - - private: - typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template - rebind<_Key>::other _Key_alloc_type; - - typedef _Rb_tree, - key_compare, _Key_alloc_type> _Rep_type; - _Rep_type _M_t; // Red-black tree representing set. - - typedef __gnu_cxx::__alloc_traits<_Key_alloc_type> _Alloc_traits; - - public: - //@{ - /// Iterator-related typedefs. - typedef typename _Alloc_traits::pointer pointer; - typedef typename _Alloc_traits::const_pointer const_pointer; - typedef typename _Alloc_traits::reference reference; - typedef typename _Alloc_traits::const_reference const_reference; - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 103. set::iterator is required to be modifiable, - // but this allows modification of keys. - typedef typename _Rep_type::const_iterator iterator; - typedef typename _Rep_type::const_iterator const_iterator; - typedef typename _Rep_type::const_reverse_iterator reverse_iterator; - typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; - typedef typename _Rep_type::size_type size_type; - typedef typename _Rep_type::difference_type difference_type; - //@} - - // allocation/deallocation - /** - * @brief Default constructor creates no elements. - */ - set() -#if __cplusplus >= 201103L - noexcept(is_nothrow_default_constructible::value) -#endif - : _M_t() { } - - /** - * @brief Creates a %set with no elements. - * @param __comp Comparator to use. - * @param __a An allocator object. - */ - explicit - set(const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _Key_alloc_type(__a)) { } - - /** - * @brief Builds a %set from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * - * Create a %set consisting of copies of the elements from - * [__first,__last). This is linear in N if the range is - * already sorted, and NlogN otherwise (where N is - * distance(__first,__last)). - */ - template - set(_InputIterator __first, _InputIterator __last) - : _M_t() - { _M_t._M_insert_unique(__first, __last); } - - /** - * @brief Builds a %set from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __comp A comparison functor. - * @param __a An allocator object. - * - * Create a %set consisting of copies of the elements from - * [__first,__last). This is linear in N if the range is - * already sorted, and NlogN otherwise (where N is - * distance(__first,__last)). - */ - template - set(_InputIterator __first, _InputIterator __last, - const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _Key_alloc_type(__a)) - { _M_t._M_insert_unique(__first, __last); } - - /** - * @brief %Set copy constructor. - * @param __x A %set of identical element and allocator types. - * - * The newly-created %set uses a copy of the allocation object used - * by @a __x. - */ - set(const set& __x) - : _M_t(__x._M_t) { } - -#if __cplusplus >= 201103L - /** - * @brief %Set move constructor - * @param __x A %set of identical element and allocator types. - * - * The newly-created %set contains the exact contents of @a x. - * The contents of @a x are a valid, but unspecified %set. - */ - set(set&& __x) - noexcept(is_nothrow_copy_constructible<_Compare>::value) - : _M_t(std::move(__x._M_t)) { } - - /** - * @brief Builds a %set from an initializer_list. - * @param __l An initializer_list. - * @param __comp A comparison functor. - * @param __a An allocator object. - * - * Create a %set consisting of copies of the elements in the list. - * This is linear in N if the list is already sorted, and NlogN - * otherwise (where N is @a __l.size()). - */ - set(initializer_list __l, - const _Compare& __comp = _Compare(), - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _Key_alloc_type(__a)) - { _M_t._M_insert_unique(__l.begin(), __l.end()); } - - /// Allocator-extended default constructor. - explicit - set(const allocator_type& __a) - : _M_t(_Compare(), _Key_alloc_type(__a)) { } - - /// Allocator-extended copy constructor. - set(const set& __x, const allocator_type& __a) - : _M_t(__x._M_t, _Key_alloc_type(__a)) { } - - /// Allocator-extended move constructor. - set(set&& __x, const allocator_type& __a) - noexcept(is_nothrow_copy_constructible<_Compare>::value - && _Alloc_traits::_S_always_equal()) - : _M_t(std::move(__x._M_t), _Key_alloc_type(__a)) { } - - /// Allocator-extended initialier-list constructor. - set(initializer_list __l, const allocator_type& __a) - : _M_t(_Compare(), _Key_alloc_type(__a)) - { _M_t._M_insert_unique(__l.begin(), __l.end()); } - - /// Allocator-extended range constructor. - template - set(_InputIterator __first, _InputIterator __last, - const allocator_type& __a) - : _M_t(_Compare(), _Key_alloc_type(__a)) - { _M_t._M_insert_unique(__first, __last); } -#endif - - /** - * @brief %Set assignment operator. - * @param __x A %set of identical element and allocator types. - * - * All the elements of @a __x are copied, but unlike the copy - * constructor, the allocator object is not copied. - */ - set& - operator=(const set& __x) - { - _M_t = __x._M_t; - return *this; - } - -#if __cplusplus >= 201103L - /// Move assignment operator. - set& - operator=(set&&) = default; - - /** - * @brief %Set list assignment operator. - * @param __l An initializer_list. - * - * This function fills a %set with copies of the elements in the - * initializer list @a __l. - * - * Note that the assignment completely changes the %set and - * that the resulting %set's size is the same as the number - * of elements assigned. Old data may be lost. - */ - set& - operator=(initializer_list __l) - { - _M_t._M_assign_unique(__l.begin(), __l.end()); - return *this; - } -#endif - - // accessors: - - /// Returns the comparison object with which the %set was constructed. - key_compare - key_comp() const - { return _M_t.key_comp(); } - /// Returns the comparison object with which the %set was constructed. - value_compare - value_comp() const - { return _M_t.key_comp(); } - /// Returns the allocator object with which the %set was constructed. - allocator_type - get_allocator() const _GLIBCXX_NOEXCEPT - { return allocator_type(_M_t.get_allocator()); } - - /** - * Returns a read-only (constant) iterator that points to the first - * element in the %set. Iteration is done in ascending order according - * to the keys. - */ - iterator - begin() const _GLIBCXX_NOEXCEPT - { return _M_t.begin(); } - - /** - * Returns a read-only (constant) iterator that points one past the last - * element in the %set. Iteration is done in ascending order according - * to the keys. - */ - iterator - end() const _GLIBCXX_NOEXCEPT - { return _M_t.end(); } - - /** - * Returns a read-only (constant) iterator that points to the last - * element in the %set. Iteration is done in descending order according - * to the keys. - */ - reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return _M_t.rbegin(); } - - /** - * Returns a read-only (constant) reverse iterator that points to the - * last pair in the %set. Iteration is done in descending order - * according to the keys. - */ - reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return _M_t.rend(); } - -#if __cplusplus >= 201103L - /** - * Returns a read-only (constant) iterator that points to the first - * element in the %set. Iteration is done in ascending order according - * to the keys. - */ - iterator - cbegin() const noexcept - { return _M_t.begin(); } - - /** - * Returns a read-only (constant) iterator that points one past the last - * element in the %set. Iteration is done in ascending order according - * to the keys. - */ - iterator - cend() const noexcept - { return _M_t.end(); } - - /** - * Returns a read-only (constant) iterator that points to the last - * element in the %set. Iteration is done in descending order according - * to the keys. - */ - reverse_iterator - crbegin() const noexcept - { return _M_t.rbegin(); } - - /** - * Returns a read-only (constant) reverse iterator that points to the - * last pair in the %set. Iteration is done in descending order - * according to the keys. - */ - reverse_iterator - crend() const noexcept - { return _M_t.rend(); } -#endif - - /// Returns true if the %set is empty. - bool - empty() const _GLIBCXX_NOEXCEPT - { return _M_t.empty(); } - - /// Returns the size of the %set. - size_type - size() const _GLIBCXX_NOEXCEPT - { return _M_t.size(); } - - /// Returns the maximum size of the %set. - size_type - max_size() const _GLIBCXX_NOEXCEPT - { return _M_t.max_size(); } - - /** - * @brief Swaps data with another %set. - * @param __x A %set of the same element and allocator types. - * - * This exchanges the elements between two sets in constant - * time. (It is only swapping a pointer, an integer, and an - * instance of the @c Compare type (which itself is often - * stateless and empty), so it should be quite fast.) Note - * that the global std::swap() function is specialized such - * that std::swap(s1,s2) will feed to this function. - */ - void - swap(set& __x) -#if __cplusplus >= 201103L - noexcept(_Alloc_traits::_S_nothrow_swap()) -#endif - { _M_t.swap(__x._M_t); } - - // insert/erase -#if __cplusplus >= 201103L - /** - * @brief Attempts to build and insert an element into the %set. - * @param __args Arguments used to generate an element. - * @return A pair, of which the first element is an iterator that points - * to the possibly inserted element, and the second is a bool - * that is true if the element was actually inserted. - * - * This function attempts to build and insert an element into the %set. - * A %set relies on unique keys and thus an element is only inserted if - * it is not already present in the %set. - * - * Insertion requires logarithmic time. - */ - template - std::pair - emplace(_Args&&... __args) - { return _M_t._M_emplace_unique(std::forward<_Args>(__args)...); } - - /** - * @brief Attempts to insert an element into the %set. - * @param __pos An iterator that serves as a hint as to where the - * element should be inserted. - * @param __args Arguments used to generate the element to be - * inserted. - * @return An iterator that points to the element with key equivalent to - * the one generated from @a __args (may or may not be the - * element itself). - * - * This function is not concerned about whether the insertion took place, - * and thus does not return a boolean like the single-argument emplace() - * does. Note that the first parameter is only a hint and can - * potentially improve the performance of the insertion process. A bad - * hint would cause no gains in efficiency. - * - * For more on @a hinting, see: - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * - * Insertion requires logarithmic time (if the hint is not taken). - */ - template - iterator - emplace_hint(const_iterator __pos, _Args&&... __args) - { - return _M_t._M_emplace_hint_unique(__pos, - std::forward<_Args>(__args)...); - } -#endif - - /** - * @brief Attempts to insert an element into the %set. - * @param __x Element to be inserted. - * @return A pair, of which the first element is an iterator that points - * to the possibly inserted element, and the second is a bool - * that is true if the element was actually inserted. - * - * This function attempts to insert an element into the %set. A %set - * relies on unique keys and thus an element is only inserted if it is - * not already present in the %set. - * - * Insertion requires logarithmic time. - */ - std::pair - insert(const value_type& __x) - { - std::pair __p = - _M_t._M_insert_unique(__x); - return std::pair(__p.first, __p.second); - } - -#if __cplusplus >= 201103L - std::pair - insert(value_type&& __x) - { - std::pair __p = - _M_t._M_insert_unique(std::move(__x)); - return std::pair(__p.first, __p.second); - } -#endif - - /** - * @brief Attempts to insert an element into the %set. - * @param __position An iterator that serves as a hint as to where the - * element should be inserted. - * @param __x Element to be inserted. - * @return An iterator that points to the element with key of - * @a __x (may or may not be the element passed in). - * - * This function is not concerned about whether the insertion took place, - * and thus does not return a boolean like the single-argument insert() - * does. Note that the first parameter is only a hint and can - * potentially improve the performance of the insertion process. A bad - * hint would cause no gains in efficiency. - * - * For more on @a hinting, see: - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * - * Insertion requires logarithmic time (if the hint is not taken). - */ - iterator - insert(const_iterator __position, const value_type& __x) - { return _M_t._M_insert_unique_(__position, __x); } - -#if __cplusplus >= 201103L - iterator - insert(const_iterator __position, value_type&& __x) - { return _M_t._M_insert_unique_(__position, std::move(__x)); } -#endif - - /** - * @brief A template function that attempts to insert a range - * of elements. - * @param __first Iterator pointing to the start of the range to be - * inserted. - * @param __last Iterator pointing to the end of the range. - * - * Complexity similar to that of the range constructor. - */ - template - void - insert(_InputIterator __first, _InputIterator __last) - { _M_t._M_insert_unique(__first, __last); } - -#if __cplusplus >= 201103L - /** - * @brief Attempts to insert a list of elements into the %set. - * @param __l A std::initializer_list of elements - * to be inserted. - * - * Complexity similar to that of the range constructor. - */ - void - insert(initializer_list __l) - { this->insert(__l.begin(), __l.end()); } -#endif - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 130. Associative erase should return an iterator. - /** - * @brief Erases an element from a %set. - * @param __position An iterator pointing to the element to be erased. - * @return An iterator pointing to the element immediately following - * @a __position prior to the element being erased. If no such - * element exists, end() is returned. - * - * This function erases an element, pointed to by the given iterator, - * from a %set. Note that this function only erases the element, and - * that if the element is itself a pointer, the pointed-to memory is not - * touched in any way. Managing the pointer is the user's - * responsibility. - */ - _GLIBCXX_ABI_TAG_CXX11 - iterator - erase(const_iterator __position) - { return _M_t.erase(__position); } -#else - /** - * @brief Erases an element from a %set. - * @param position An iterator pointing to the element to be erased. - * - * This function erases an element, pointed to by the given iterator, - * from a %set. Note that this function only erases the element, and - * that if the element is itself a pointer, the pointed-to memory is not - * touched in any way. Managing the pointer is the user's - * responsibility. - */ - void - erase(iterator __position) - { _M_t.erase(__position); } -#endif - - /** - * @brief Erases elements according to the provided key. - * @param __x Key of element to be erased. - * @return The number of elements erased. - * - * This function erases all the elements located by the given key from - * a %set. - * Note that this function only erases the element, and that if - * the element is itself a pointer, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - size_type - erase(const key_type& __x) - { return _M_t.erase(__x); } - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 130. Associative erase should return an iterator. - /** - * @brief Erases a [__first,__last) range of elements from a %set. - * @param __first Iterator pointing to the start of the range to be - * erased. - - * @param __last Iterator pointing to the end of the range to - * be erased. - * @return The iterator @a __last. - * - * This function erases a sequence of elements from a %set. - * Note that this function only erases the element, and that if - * the element is itself a pointer, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - _GLIBCXX_ABI_TAG_CXX11 - iterator - erase(const_iterator __first, const_iterator __last) - { return _M_t.erase(__first, __last); } -#else - /** - * @brief Erases a [first,last) range of elements from a %set. - * @param __first Iterator pointing to the start of the range to be - * erased. - * @param __last Iterator pointing to the end of the range to - * be erased. - * - * This function erases a sequence of elements from a %set. - * Note that this function only erases the element, and that if - * the element is itself a pointer, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - void - erase(iterator __first, iterator __last) - { _M_t.erase(__first, __last); } -#endif - - /** - * Erases all elements in a %set. Note that this function only erases - * the elements, and that if the elements themselves are pointers, the - * pointed-to memory is not touched in any way. Managing the pointer is - * the user's responsibility. - */ - void - clear() _GLIBCXX_NOEXCEPT - { _M_t.clear(); } - - // set operations: - - //@{ - /** - * @brief Finds the number of elements. - * @param __x Element to located. - * @return Number of elements with specified key. - * - * This function only makes sense for multisets; for set the result will - * either be 0 (not present) or 1 (present). - */ - size_type - count(const key_type& __x) const - { return _M_t.find(__x) == _M_t.end() ? 0 : 1; } - -#if __cplusplus > 201103L - template - auto - count(const _Kt& __x) const - -> decltype(_M_t._M_count_tr(__x)) - { return _M_t._M_find_tr(__x) == _M_t.end() ? 0 : 1; } -#endif - //@} - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 214. set::find() missing const overload - //@{ - /** - * @brief Tries to locate an element in a %set. - * @param __x Element to be located. - * @return Iterator pointing to sought-after element, or end() if not - * found. - * - * This function takes a key and tries to locate the element with which - * the key matches. If successful the function returns an iterator - * pointing to the sought after element. If unsuccessful it returns the - * past-the-end ( @c end() ) iterator. - */ - iterator - find(const key_type& __x) - { return _M_t.find(__x); } - - const_iterator - find(const key_type& __x) const - { return _M_t.find(__x); } - -#if __cplusplus > 201103L - template - auto - find(const _Kt& __x) - -> decltype(iterator{_M_t._M_find_tr(__x)}) - { return iterator{_M_t._M_find_tr(__x)}; } - - template - auto - find(const _Kt& __x) const - -> decltype(const_iterator{_M_t._M_find_tr(__x)}) - { return const_iterator{_M_t._M_find_tr(__x)}; } -#endif - //@} - - //@{ - /** - * @brief Finds the beginning of a subsequence matching given key. - * @param __x Key to be located. - * @return Iterator pointing to first element equal to or greater - * than key, or end(). - * - * This function returns the first element of a subsequence of elements - * that matches the given key. If unsuccessful it returns an iterator - * pointing to the first element that has a greater value than given key - * or end() if no such element exists. - */ - iterator - lower_bound(const key_type& __x) - { return _M_t.lower_bound(__x); } - - const_iterator - lower_bound(const key_type& __x) const - { return _M_t.lower_bound(__x); } - -#if __cplusplus > 201103L - template - auto - lower_bound(const _Kt& __x) - -> decltype(_M_t._M_lower_bound_tr(__x)) - { return _M_t._M_lower_bound_tr(__x); } - - template - auto - lower_bound(const _Kt& __x) const - -> decltype(_M_t._M_lower_bound_tr(__x)) - { return _M_t._M_lower_bound_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds the end of a subsequence matching given key. - * @param __x Key to be located. - * @return Iterator pointing to the first element - * greater than key, or end(). - */ - iterator - upper_bound(const key_type& __x) - { return _M_t.upper_bound(__x); } - - const_iterator - upper_bound(const key_type& __x) const - { return _M_t.upper_bound(__x); } - -#if __cplusplus > 201103L - template - auto - upper_bound(const _Kt& __x) - -> decltype(_M_t._M_upper_bound_tr(__x)) - { return _M_t._M_upper_bound_tr(__x); } - - template - auto - upper_bound(const _Kt& __x) const - -> decltype(_M_t._M_upper_bound_tr(__x)) - { return _M_t._M_upper_bound_tr(__x); } -#endif - //@} - - //@{ - /** - * @brief Finds a subsequence matching given key. - * @param __x Key to be located. - * @return Pair of iterators that possibly points to the subsequence - * matching given key. - * - * This function is equivalent to - * @code - * std::make_pair(c.lower_bound(val), - * c.upper_bound(val)) - * @endcode - * (but is faster than making the calls separately). - * - * This function probably only makes sense for multisets. - */ - std::pair - equal_range(const key_type& __x) - { return _M_t.equal_range(__x); } - - std::pair - equal_range(const key_type& __x) const - { return _M_t.equal_range(__x); } - -#if __cplusplus > 201103L - template - auto - equal_range(const _Kt& __x) - -> decltype(_M_t._M_equal_range_tr(__x)) - { return _M_t._M_equal_range_tr(__x); } - - template - auto - equal_range(const _Kt& __x) const - -> decltype(_M_t._M_equal_range_tr(__x)) - { return _M_t._M_equal_range_tr(__x); } -#endif - //@} - - template - friend bool - operator==(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&); - - template - friend bool - operator<(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&); - }; - - - /** - * @brief Set equality comparison. - * @param __x A %set. - * @param __y A %set of the same type as @a x. - * @return True iff the size and elements of the sets are equal. - * - * This is an equivalence relation. It is linear in the size of the sets. - * Sets are considered equivalent if their sizes are equal, and if - * corresponding elements compare equal. - */ - template - inline bool - operator==(const set<_Key, _Compare, _Alloc>& __x, - const set<_Key, _Compare, _Alloc>& __y) - { return __x._M_t == __y._M_t; } - - /** - * @brief Set ordering relation. - * @param __x A %set. - * @param __y A %set of the same type as @a x. - * @return True iff @a __x is lexicographically less than @a __y. - * - * This is a total ordering relation. It is linear in the size of the - * sets. The elements must be comparable with @c <. - * - * See std::lexicographical_compare() for how the determination is made. - */ - template - inline bool - operator<(const set<_Key, _Compare, _Alloc>& __x, - const set<_Key, _Compare, _Alloc>& __y) - { return __x._M_t < __y._M_t; } - - /// Returns !(x == y). - template - inline bool - operator!=(const set<_Key, _Compare, _Alloc>& __x, - const set<_Key, _Compare, _Alloc>& __y) - { return !(__x == __y); } - - /// Returns y < x. - template - inline bool - operator>(const set<_Key, _Compare, _Alloc>& __x, - const set<_Key, _Compare, _Alloc>& __y) - { return __y < __x; } - - /// Returns !(y < x) - template - inline bool - operator<=(const set<_Key, _Compare, _Alloc>& __x, - const set<_Key, _Compare, _Alloc>& __y) - { return !(__y < __x); } - - /// Returns !(x < y) - template - inline bool - operator>=(const set<_Key, _Compare, _Alloc>& __x, - const set<_Key, _Compare, _Alloc>& __y) - { return !(__x < __y); } - - /// See std::set::swap(). - template - inline void - swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>& __y) - { __x.swap(__y); } - -_GLIBCXX_END_NAMESPACE_CONTAINER -} //namespace std -#endif /* _STL_SET_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_stack.h b/openflow/usr/include/c++/5/bits/stl_stack.h deleted file mode 100644 index 3ff307f..0000000 --- a/openflow/usr/include/c++/5/bits/stl_stack.h +++ /dev/null @@ -1,306 +0,0 @@ -// Stack implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_stack.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{stack} - */ - -#ifndef _STL_STACK_H -#define _STL_STACK_H 1 - -#include -#include -#if __cplusplus >= 201103L -# include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @brief A standard container giving FILO behavior. - * - * @ingroup sequences - * - * @tparam _Tp Type of element. - * @tparam _Sequence Type of underlying sequence, defaults to deque<_Tp>. - * - * Meets many of the requirements of a - * container, - * but does not define anything to do with iterators. Very few of the - * other standard container interfaces are defined. - * - * This is not a true container, but an @e adaptor. It holds - * another container, and provides a wrapper interface to that - * container. The wrapper is what enforces strict - * first-in-last-out %stack behavior. - * - * The second template parameter defines the type of the underlying - * sequence/container. It defaults to std::deque, but it can be - * any type that supports @c back, @c push_back, and @c pop_front, - * such as std::list, std::vector, or an appropriate user-defined - * type. - * - * Members not found in @a normal containers are @c container_type, - * which is a typedef for the second Sequence parameter, and @c - * push, @c pop, and @c top, which are standard %stack/FILO - * operations. - */ - template > - class stack - { - // concept requirements - typedef typename _Sequence::value_type _Sequence_value_type; - __glibcxx_class_requires(_Tp, _SGIAssignableConcept) - __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept) - __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept) - - template - friend bool - operator==(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&); - - template - friend bool - operator<(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&); - - public: - typedef typename _Sequence::value_type value_type; - typedef typename _Sequence::reference reference; - typedef typename _Sequence::const_reference const_reference; - typedef typename _Sequence::size_type size_type; - typedef _Sequence container_type; - - protected: - // See queue::c for notes on this name. - _Sequence c; - - public: - // XXX removed old def ctor, added def arg to this one to match 14882 - /** - * @brief Default constructor creates no elements. - */ -#if __cplusplus < 201103L - explicit - stack(const _Sequence& __c = _Sequence()) - : c(__c) { } -#else - explicit - stack(const _Sequence& __c) - : c(__c) { } - - explicit - stack(_Sequence&& __c = _Sequence()) - : c(std::move(__c)) { } -#endif - - /** - * Returns true if the %stack is empty. - */ - bool - empty() const - { return c.empty(); } - - /** Returns the number of elements in the %stack. */ - size_type - size() const - { return c.size(); } - - /** - * Returns a read/write reference to the data at the first - * element of the %stack. - */ - reference - top() - { - __glibcxx_requires_nonempty(); - return c.back(); - } - - /** - * Returns a read-only (constant) reference to the data at the first - * element of the %stack. - */ - const_reference - top() const - { - __glibcxx_requires_nonempty(); - return c.back(); - } - - /** - * @brief Add data to the top of the %stack. - * @param __x Data to be added. - * - * This is a typical %stack operation. The function creates an - * element at the top of the %stack and assigns the given data - * to it. The time complexity of the operation depends on the - * underlying sequence. - */ - void - push(const value_type& __x) - { c.push_back(__x); } - -#if __cplusplus >= 201103L - void - push(value_type&& __x) - { c.push_back(std::move(__x)); } - - template - void - emplace(_Args&&... __args) - { c.emplace_back(std::forward<_Args>(__args)...); } -#endif - - /** - * @brief Removes first element. - * - * This is a typical %stack operation. It shrinks the %stack - * by one. The time complexity of the operation depends on the - * underlying sequence. - * - * Note that no data is returned, and if the first element's - * data is needed, it should be retrieved before pop() is - * called. - */ - void - pop() - { - __glibcxx_requires_nonempty(); - c.pop_back(); - } - -#if __cplusplus >= 201103L - void - swap(stack& __s) - noexcept(noexcept(swap(c, __s.c))) - { - using std::swap; - swap(c, __s.c); - } -#endif - }; - - /** - * @brief Stack equality comparison. - * @param __x A %stack. - * @param __y A %stack of the same type as @a __x. - * @return True iff the size and elements of the stacks are equal. - * - * This is an equivalence relation. Complexity and semantics - * depend on the underlying sequence type, but the expected rules - * are: this relation is linear in the size of the sequences, and - * stacks are considered equivalent if their sequences compare - * equal. - */ - template - inline bool - operator==(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) - { return __x.c == __y.c; } - - /** - * @brief Stack ordering relation. - * @param __x A %stack. - * @param __y A %stack of the same type as @a x. - * @return True iff @a x is lexicographically less than @a __y. - * - * This is an total ordering relation. Complexity and semantics - * depend on the underlying sequence type, but the expected rules - * are: this relation is linear in the size of the sequences, the - * elements must be comparable with @c <, and - * std::lexicographical_compare() is usually used to make the - * determination. - */ - template - inline bool - operator<(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) - { return __x.c < __y.c; } - - /// Based on operator== - template - inline bool - operator!=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) - { return !(__x == __y); } - - /// Based on operator< - template - inline bool - operator>(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) - { return __y < __x; } - - /// Based on operator< - template - inline bool - operator<=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) - { return !(__y < __x); } - - /// Based on operator< - template - inline bool - operator>=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) - { return !(__x < __y); } - -#if __cplusplus >= 201103L - template - inline void - swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y) - noexcept(noexcept(__x.swap(__y))) - { __x.swap(__y); } - - template - struct uses_allocator, _Alloc> - : public uses_allocator<_Seq, _Alloc>::type { }; -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _STL_STACK_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_tempbuf.h b/openflow/usr/include/c++/5/bits/stl_tempbuf.h deleted file mode 100644 index af17091..0000000 --- a/openflow/usr/include/c++/5/bits/stl_tempbuf.h +++ /dev/null @@ -1,271 +0,0 @@ -// Temporary buffer implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_tempbuf.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _STL_TEMPBUF_H -#define _STL_TEMPBUF_H 1 - -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @brief Allocates a temporary buffer. - * @param __len The number of objects of type Tp. - * @return See full description. - * - * Reinventing the wheel, but this time with prettier spokes! - * - * This function tries to obtain storage for @c __len adjacent Tp - * objects. The objects themselves are not constructed, of course. - * A pair<> is returned containing the buffer s address and - * capacity (in the units of sizeof(_Tp)), or a pair of 0 values if - * no storage can be obtained. Note that the capacity obtained - * may be less than that requested if the memory is unavailable; - * you should compare len with the .second return value. - * - * Provides the nothrow exception guarantee. - */ - template - pair<_Tp*, ptrdiff_t> - get_temporary_buffer(ptrdiff_t __len) _GLIBCXX_NOEXCEPT - { - const ptrdiff_t __max = - __gnu_cxx::__numeric_traits::__max / sizeof(_Tp); - if (__len > __max) - __len = __max; - - while (__len > 0) - { - _Tp* __tmp = static_cast<_Tp*>(::operator new(__len * sizeof(_Tp), - std::nothrow)); - if (__tmp != 0) - return std::pair<_Tp*, ptrdiff_t>(__tmp, __len); - __len /= 2; - } - return std::pair<_Tp*, ptrdiff_t>(static_cast<_Tp*>(0), 0); - } - - /** - * @brief The companion to get_temporary_buffer(). - * @param __p A buffer previously allocated by get_temporary_buffer. - * @return None. - * - * Frees the memory pointed to by __p. - */ - template - inline void - return_temporary_buffer(_Tp* __p) - { ::operator delete(__p, std::nothrow); } - - - /** - * This class is used in two places: stl_algo.h and ext/memory, - * where it is wrapped as the temporary_buffer class. See - * temporary_buffer docs for more notes. - */ - template - class _Temporary_buffer - { - // concept requirements - __glibcxx_class_requires(_ForwardIterator, _ForwardIteratorConcept) - - public: - typedef _Tp value_type; - typedef value_type* pointer; - typedef pointer iterator; - typedef ptrdiff_t size_type; - - protected: - size_type _M_original_len; - size_type _M_len; - pointer _M_buffer; - - public: - /// As per Table mumble. - size_type - size() const - { return _M_len; } - - /// Returns the size requested by the constructor; may be >size(). - size_type - requested_size() const - { return _M_original_len; } - - /// As per Table mumble. - iterator - begin() - { return _M_buffer; } - - /// As per Table mumble. - iterator - end() - { return _M_buffer + _M_len; } - - /** - * Constructs a temporary buffer of a size somewhere between - * zero and the size of the given range. - */ - _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last); - - ~_Temporary_buffer() - { - std::_Destroy(_M_buffer, _M_buffer + _M_len); - std::return_temporary_buffer(_M_buffer); - } - - private: - // Disable copy constructor and assignment operator. - _Temporary_buffer(const _Temporary_buffer&); - - void - operator=(const _Temporary_buffer&); - }; - - - template - struct __uninitialized_construct_buf_dispatch - { - template - static void - __ucr(_Pointer __first, _Pointer __last, - _ForwardIterator __seed) - { - if(__first == __last) - return; - - _Pointer __cur = __first; - __try - { - std::_Construct(std::__addressof(*__first), - _GLIBCXX_MOVE(*__seed)); - _Pointer __prev = __cur; - ++__cur; - for(; __cur != __last; ++__cur, ++__prev) - std::_Construct(std::__addressof(*__cur), - _GLIBCXX_MOVE(*__prev)); - *__seed = _GLIBCXX_MOVE(*__prev); - } - __catch(...) - { - std::_Destroy(__first, __cur); - __throw_exception_again; - } - } - }; - - template<> - struct __uninitialized_construct_buf_dispatch - { - template - static void - __ucr(_Pointer, _Pointer, _ForwardIterator) { } - }; - - // Constructs objects in the range [first, last). - // Note that while these new objects will take valid values, - // their exact value is not defined. In particular they may - // be 'moved from'. - // - // While *__seed may be altered during this algorithm, it will have - // the same value when the algorithm finishes, unless one of the - // constructions throws. - // - // Requirements: _Pointer::value_type(_Tp&&) is valid. - template - inline void - __uninitialized_construct_buf(_Pointer __first, _Pointer __last, - _ForwardIterator __seed) - { - typedef typename std::iterator_traits<_Pointer>::value_type - _ValueType; - - std::__uninitialized_construct_buf_dispatch< - __has_trivial_constructor(_ValueType)>:: - __ucr(__first, __last, __seed); - } - - template - _Temporary_buffer<_ForwardIterator, _Tp>:: - _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) - : _M_original_len(std::distance(__first, __last)), - _M_len(0), _M_buffer(0) - { - __try - { - std::pair __p(std::get_temporary_buffer< - value_type>(_M_original_len)); - _M_buffer = __p.first; - _M_len = __p.second; - if (_M_buffer) - std::__uninitialized_construct_buf(_M_buffer, _M_buffer + _M_len, - __first); - } - __catch(...) - { - std::return_temporary_buffer(_M_buffer); - _M_buffer = 0; - _M_len = 0; - __throw_exception_again; - } - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _STL_TEMPBUF_H */ - diff --git a/openflow/usr/include/c++/5/bits/stl_tree.h b/openflow/usr/include/c++/5/bits/stl_tree.h deleted file mode 100644 index d39042f..0000000 --- a/openflow/usr/include/c++/5/bits/stl_tree.h +++ /dev/null @@ -1,2370 +0,0 @@ -// RB tree implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - */ - -/** @file bits/stl_tree.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{map,set} - */ - -#ifndef _STL_TREE_H -#define _STL_TREE_H 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include -#if __cplusplus >= 201103L -#include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Red-black tree class, designed for use in implementing STL - // associative containers (set, multiset, map, and multimap). The - // insertion and deletion algorithms are based on those in Cormen, - // Leiserson, and Rivest, Introduction to Algorithms (MIT Press, - // 1990), except that - // - // (1) the header cell is maintained with links not only to the root - // but also to the leftmost node of the tree, to enable constant - // time begin(), and to the rightmost node of the tree, to enable - // linear time performance when used with the generic set algorithms - // (set_union, etc.) - // - // (2) when a node being deleted has two children its successor node - // is relinked into its place, rather than copied, so that the only - // iterators invalidated are those referring to the deleted node. - - enum _Rb_tree_color { _S_red = false, _S_black = true }; - - struct _Rb_tree_node_base - { - typedef _Rb_tree_node_base* _Base_ptr; - typedef const _Rb_tree_node_base* _Const_Base_ptr; - - _Rb_tree_color _M_color; - _Base_ptr _M_parent; - _Base_ptr _M_left; - _Base_ptr _M_right; - - static _Base_ptr - _S_minimum(_Base_ptr __x) _GLIBCXX_NOEXCEPT - { - while (__x->_M_left != 0) __x = __x->_M_left; - return __x; - } - - static _Const_Base_ptr - _S_minimum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT - { - while (__x->_M_left != 0) __x = __x->_M_left; - return __x; - } - - static _Base_ptr - _S_maximum(_Base_ptr __x) _GLIBCXX_NOEXCEPT - { - while (__x->_M_right != 0) __x = __x->_M_right; - return __x; - } - - static _Const_Base_ptr - _S_maximum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT - { - while (__x->_M_right != 0) __x = __x->_M_right; - return __x; - } - }; - - template - struct _Rb_tree_node : public _Rb_tree_node_base - { - typedef _Rb_tree_node<_Val>* _Link_type; - -#if __cplusplus < 201103L - _Val _M_value_field; - - _Val* - _M_valptr() - { return std::__addressof(_M_value_field); } - - const _Val* - _M_valptr() const - { return std::__addressof(_M_value_field); } -#else - __gnu_cxx::__aligned_membuf<_Val> _M_storage; - - _Val* - _M_valptr() - { return _M_storage._M_ptr(); } - - const _Val* - _M_valptr() const - { return _M_storage._M_ptr(); } -#endif - }; - - _GLIBCXX_PURE _Rb_tree_node_base* - _Rb_tree_increment(_Rb_tree_node_base* __x) throw (); - - _GLIBCXX_PURE const _Rb_tree_node_base* - _Rb_tree_increment(const _Rb_tree_node_base* __x) throw (); - - _GLIBCXX_PURE _Rb_tree_node_base* - _Rb_tree_decrement(_Rb_tree_node_base* __x) throw (); - - _GLIBCXX_PURE const _Rb_tree_node_base* - _Rb_tree_decrement(const _Rb_tree_node_base* __x) throw (); - - template - struct _Rb_tree_iterator - { - typedef _Tp value_type; - typedef _Tp& reference; - typedef _Tp* pointer; - - typedef bidirectional_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; - - typedef _Rb_tree_iterator<_Tp> _Self; - typedef _Rb_tree_node_base::_Base_ptr _Base_ptr; - typedef _Rb_tree_node<_Tp>* _Link_type; - - _Rb_tree_iterator() _GLIBCXX_NOEXCEPT - : _M_node() { } - - explicit - _Rb_tree_iterator(_Base_ptr __x) _GLIBCXX_NOEXCEPT - : _M_node(__x) { } - - reference - operator*() const _GLIBCXX_NOEXCEPT - { return *static_cast<_Link_type>(_M_node)->_M_valptr(); } - - pointer - operator->() const _GLIBCXX_NOEXCEPT - { return static_cast<_Link_type> (_M_node)->_M_valptr(); } - - _Self& - operator++() _GLIBCXX_NOEXCEPT - { - _M_node = _Rb_tree_increment(_M_node); - return *this; - } - - _Self - operator++(int) _GLIBCXX_NOEXCEPT - { - _Self __tmp = *this; - _M_node = _Rb_tree_increment(_M_node); - return __tmp; - } - - _Self& - operator--() _GLIBCXX_NOEXCEPT - { - _M_node = _Rb_tree_decrement(_M_node); - return *this; - } - - _Self - operator--(int) _GLIBCXX_NOEXCEPT - { - _Self __tmp = *this; - _M_node = _Rb_tree_decrement(_M_node); - return __tmp; - } - - bool - operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT - { return _M_node == __x._M_node; } - - bool - operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT - { return _M_node != __x._M_node; } - - _Base_ptr _M_node; - }; - - template - struct _Rb_tree_const_iterator - { - typedef _Tp value_type; - typedef const _Tp& reference; - typedef const _Tp* pointer; - - typedef _Rb_tree_iterator<_Tp> iterator; - - typedef bidirectional_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; - - typedef _Rb_tree_const_iterator<_Tp> _Self; - typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr; - typedef const _Rb_tree_node<_Tp>* _Link_type; - - _Rb_tree_const_iterator() _GLIBCXX_NOEXCEPT - : _M_node() { } - - explicit - _Rb_tree_const_iterator(_Base_ptr __x) _GLIBCXX_NOEXCEPT - : _M_node(__x) { } - - _Rb_tree_const_iterator(const iterator& __it) _GLIBCXX_NOEXCEPT - : _M_node(__it._M_node) { } - - iterator - _M_const_cast() const _GLIBCXX_NOEXCEPT - { return iterator(const_cast(_M_node)); } - - reference - operator*() const _GLIBCXX_NOEXCEPT - { return *static_cast<_Link_type>(_M_node)->_M_valptr(); } - - pointer - operator->() const _GLIBCXX_NOEXCEPT - { return static_cast<_Link_type>(_M_node)->_M_valptr(); } - - _Self& - operator++() _GLIBCXX_NOEXCEPT - { - _M_node = _Rb_tree_increment(_M_node); - return *this; - } - - _Self - operator++(int) _GLIBCXX_NOEXCEPT - { - _Self __tmp = *this; - _M_node = _Rb_tree_increment(_M_node); - return __tmp; - } - - _Self& - operator--() _GLIBCXX_NOEXCEPT - { - _M_node = _Rb_tree_decrement(_M_node); - return *this; - } - - _Self - operator--(int) _GLIBCXX_NOEXCEPT - { - _Self __tmp = *this; - _M_node = _Rb_tree_decrement(_M_node); - return __tmp; - } - - bool - operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT - { return _M_node == __x._M_node; } - - bool - operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT - { return _M_node != __x._M_node; } - - _Base_ptr _M_node; - }; - - template - inline bool - operator==(const _Rb_tree_iterator<_Val>& __x, - const _Rb_tree_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT - { return __x._M_node == __y._M_node; } - - template - inline bool - operator!=(const _Rb_tree_iterator<_Val>& __x, - const _Rb_tree_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT - { return __x._M_node != __y._M_node; } - - void - _Rb_tree_insert_and_rebalance(const bool __insert_left, - _Rb_tree_node_base* __x, - _Rb_tree_node_base* __p, - _Rb_tree_node_base& __header) throw (); - - _Rb_tree_node_base* - _Rb_tree_rebalance_for_erase(_Rb_tree_node_base* const __z, - _Rb_tree_node_base& __header) throw (); - - - template > - class _Rb_tree - { - typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template - rebind<_Rb_tree_node<_Val> >::other _Node_allocator; - - typedef __gnu_cxx::__alloc_traits<_Node_allocator> _Alloc_traits; - - protected: - typedef _Rb_tree_node_base* _Base_ptr; - typedef const _Rb_tree_node_base* _Const_Base_ptr; - typedef _Rb_tree_node<_Val>* _Link_type; - typedef const _Rb_tree_node<_Val>* _Const_Link_type; - - private: - // Functor recycling a pool of nodes and using allocation once the pool - // is empty. - struct _Reuse_or_alloc_node - { - _Reuse_or_alloc_node(_Rb_tree& __t) - : _M_root(__t._M_root()), _M_nodes(__t._M_rightmost()), _M_t(__t) - { - if (_M_root) - { - _M_root->_M_parent = 0; - - if (_M_nodes->_M_left) - _M_nodes = _M_nodes->_M_left; - } - else - _M_nodes = 0; - } - -#if __cplusplus >= 201103L - _Reuse_or_alloc_node(const _Reuse_or_alloc_node&) = delete; -#endif - - ~_Reuse_or_alloc_node() - { _M_t._M_erase(static_cast<_Link_type>(_M_root)); } - - template - _Link_type -#if __cplusplus < 201103L - operator()(const _Arg& __arg) -#else - operator()(_Arg&& __arg) -#endif - { - _Link_type __node = static_cast<_Link_type>(_M_extract()); - if (__node) - { - _M_t._M_destroy_node(__node); - _M_t._M_construct_node(__node, _GLIBCXX_FORWARD(_Arg, __arg)); - return __node; - } - - return _M_t._M_create_node(_GLIBCXX_FORWARD(_Arg, __arg)); - } - - private: - _Base_ptr - _M_extract() - { - if (!_M_nodes) - return _M_nodes; - - _Base_ptr __node = _M_nodes; - _M_nodes = _M_nodes->_M_parent; - if (_M_nodes) - { - if (_M_nodes->_M_right == __node) - { - _M_nodes->_M_right = 0; - - if (_M_nodes->_M_left) - { - _M_nodes = _M_nodes->_M_left; - - while (_M_nodes->_M_right) - _M_nodes = _M_nodes->_M_right; - - if (_M_nodes->_M_left) - _M_nodes = _M_nodes->_M_left; - } - } - else // __node is on the left. - _M_nodes->_M_left = 0; - } - else - _M_root = 0; - - return __node; - } - - _Base_ptr _M_root; - _Base_ptr _M_nodes; - _Rb_tree& _M_t; - }; - - // Functor similar to the previous one but without any pool of nodes to - // recycle. - struct _Alloc_node - { - _Alloc_node(_Rb_tree& __t) - : _M_t(__t) { } - - template - _Link_type -#if __cplusplus < 201103L - operator()(const _Arg& __arg) const -#else - operator()(_Arg&& __arg) const -#endif - { return _M_t._M_create_node(_GLIBCXX_FORWARD(_Arg, __arg)); } - - private: - _Rb_tree& _M_t; - }; - - public: - typedef _Key key_type; - typedef _Val value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Alloc allocator_type; - - _Node_allocator& - _M_get_Node_allocator() _GLIBCXX_NOEXCEPT - { return *static_cast<_Node_allocator*>(&this->_M_impl); } - - const _Node_allocator& - _M_get_Node_allocator() const _GLIBCXX_NOEXCEPT - { return *static_cast(&this->_M_impl); } - - allocator_type - get_allocator() const _GLIBCXX_NOEXCEPT - { return allocator_type(_M_get_Node_allocator()); } - - protected: - _Link_type - _M_get_node() - { return _Alloc_traits::allocate(_M_get_Node_allocator(), 1); } - - void - _M_put_node(_Link_type __p) _GLIBCXX_NOEXCEPT - { _Alloc_traits::deallocate(_M_get_Node_allocator(), __p, 1); } - -#if __cplusplus < 201103L - void - _M_construct_node(_Link_type __node, const value_type& __x) - { - __try - { get_allocator().construct(__node->_M_valptr(), __x); } - __catch(...) - { - _M_put_node(__node); - __throw_exception_again; - } - } - - _Link_type - _M_create_node(const value_type& __x) - { - _Link_type __tmp = _M_get_node(); - _M_construct_node(__tmp, __x); - return __tmp; - } - - void - _M_destroy_node(_Link_type __p) - { get_allocator().destroy(__p->_M_valptr()); } -#else - template - void - _M_construct_node(_Link_type __node, _Args&&... __args) - { - __try - { - ::new(__node) _Rb_tree_node<_Val>; - _Alloc_traits::construct(_M_get_Node_allocator(), - __node->_M_valptr(), - std::forward<_Args>(__args)...); - } - __catch(...) - { - __node->~_Rb_tree_node<_Val>(); - _M_put_node(__node); - __throw_exception_again; - } - } - - template - _Link_type - _M_create_node(_Args&&... __args) - { - _Link_type __tmp = _M_get_node(); - _M_construct_node(__tmp, std::forward<_Args>(__args)...); - return __tmp; - } - - void - _M_destroy_node(_Link_type __p) noexcept - { - _Alloc_traits::destroy(_M_get_Node_allocator(), __p->_M_valptr()); - __p->~_Rb_tree_node<_Val>(); - } -#endif - - void - _M_drop_node(_Link_type __p) _GLIBCXX_NOEXCEPT - { - _M_destroy_node(__p); - _M_put_node(__p); - } - - template - _Link_type - _M_clone_node(_Const_Link_type __x, _NodeGen& __node_gen) - { - _Link_type __tmp = __node_gen(*__x->_M_valptr()); - __tmp->_M_color = __x->_M_color; - __tmp->_M_left = 0; - __tmp->_M_right = 0; - return __tmp; - } - - protected: - // Unused _Is_pod_comparator is kept as it is part of mangled name. - template - struct _Rb_tree_impl : public _Node_allocator - { - _Key_compare _M_key_compare; - _Rb_tree_node_base _M_header; - size_type _M_node_count; // Keeps track of size of tree. - - _Rb_tree_impl() - : _Node_allocator(), _M_key_compare(), _M_header(), - _M_node_count(0) - { _M_initialize(); } - - _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a) - : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), - _M_node_count(0) - { _M_initialize(); } - -#if __cplusplus >= 201103L - _Rb_tree_impl(const _Key_compare& __comp, _Node_allocator&& __a) - : _Node_allocator(std::move(__a)), _M_key_compare(__comp), - _M_header(), _M_node_count(0) - { _M_initialize(); } -#endif - - void - _M_reset() - { - this->_M_header._M_parent = 0; - this->_M_header._M_left = &this->_M_header; - this->_M_header._M_right = &this->_M_header; - this->_M_node_count = 0; - } - - private: - void - _M_initialize() - { - this->_M_header._M_color = _S_red; - this->_M_header._M_parent = 0; - this->_M_header._M_left = &this->_M_header; - this->_M_header._M_right = &this->_M_header; - } - }; - - _Rb_tree_impl<_Compare> _M_impl; - - protected: - _Base_ptr& - _M_root() _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_header._M_parent; } - - _Const_Base_ptr - _M_root() const _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_header._M_parent; } - - _Base_ptr& - _M_leftmost() _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_header._M_left; } - - _Const_Base_ptr - _M_leftmost() const _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_header._M_left; } - - _Base_ptr& - _M_rightmost() _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_header._M_right; } - - _Const_Base_ptr - _M_rightmost() const _GLIBCXX_NOEXCEPT - { return this->_M_impl._M_header._M_right; } - - _Link_type - _M_begin() _GLIBCXX_NOEXCEPT - { return static_cast<_Link_type>(this->_M_impl._M_header._M_parent); } - - _Const_Link_type - _M_begin() const _GLIBCXX_NOEXCEPT - { - return static_cast<_Const_Link_type> - (this->_M_impl._M_header._M_parent); - } - - _Link_type - _M_end() _GLIBCXX_NOEXCEPT - { return reinterpret_cast<_Link_type>(&this->_M_impl._M_header); } - - _Const_Link_type - _M_end() const _GLIBCXX_NOEXCEPT - { return reinterpret_cast<_Const_Link_type>(&this->_M_impl._M_header); } - - static const_reference - _S_value(_Const_Link_type __x) - { return *__x->_M_valptr(); } - - static const _Key& - _S_key(_Const_Link_type __x) - { return _KeyOfValue()(_S_value(__x)); } - - static _Link_type - _S_left(_Base_ptr __x) _GLIBCXX_NOEXCEPT - { return static_cast<_Link_type>(__x->_M_left); } - - static _Const_Link_type - _S_left(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT - { return static_cast<_Const_Link_type>(__x->_M_left); } - - static _Link_type - _S_right(_Base_ptr __x) _GLIBCXX_NOEXCEPT - { return static_cast<_Link_type>(__x->_M_right); } - - static _Const_Link_type - _S_right(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT - { return static_cast<_Const_Link_type>(__x->_M_right); } - - static const_reference - _S_value(_Const_Base_ptr __x) - { return *static_cast<_Const_Link_type>(__x)->_M_valptr(); } - - static const _Key& - _S_key(_Const_Base_ptr __x) - { return _KeyOfValue()(_S_value(__x)); } - - static _Base_ptr - _S_minimum(_Base_ptr __x) _GLIBCXX_NOEXCEPT - { return _Rb_tree_node_base::_S_minimum(__x); } - - static _Const_Base_ptr - _S_minimum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT - { return _Rb_tree_node_base::_S_minimum(__x); } - - static _Base_ptr - _S_maximum(_Base_ptr __x) _GLIBCXX_NOEXCEPT - { return _Rb_tree_node_base::_S_maximum(__x); } - - static _Const_Base_ptr - _S_maximum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT - { return _Rb_tree_node_base::_S_maximum(__x); } - - public: - typedef _Rb_tree_iterator iterator; - typedef _Rb_tree_const_iterator const_iterator; - - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - private: - pair<_Base_ptr, _Base_ptr> - _M_get_insert_unique_pos(const key_type& __k); - - pair<_Base_ptr, _Base_ptr> - _M_get_insert_equal_pos(const key_type& __k); - - pair<_Base_ptr, _Base_ptr> - _M_get_insert_hint_unique_pos(const_iterator __pos, - const key_type& __k); - - pair<_Base_ptr, _Base_ptr> - _M_get_insert_hint_equal_pos(const_iterator __pos, - const key_type& __k); - -#if __cplusplus >= 201103L - template - iterator - _M_insert_(_Base_ptr __x, _Base_ptr __y, _Arg&& __v, _NodeGen&); - - iterator - _M_insert_node(_Base_ptr __x, _Base_ptr __y, _Link_type __z); - - template - iterator - _M_insert_lower(_Base_ptr __y, _Arg&& __v); - - template - iterator - _M_insert_equal_lower(_Arg&& __x); - - iterator - _M_insert_lower_node(_Base_ptr __p, _Link_type __z); - - iterator - _M_insert_equal_lower_node(_Link_type __z); -#else - template - iterator - _M_insert_(_Base_ptr __x, _Base_ptr __y, - const value_type& __v, _NodeGen&); - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 233. Insertion hints in associative containers. - iterator - _M_insert_lower(_Base_ptr __y, const value_type& __v); - - iterator - _M_insert_equal_lower(const value_type& __x); -#endif - - template - _Link_type - _M_copy(_Const_Link_type __x, _Link_type __p, _NodeGen&); - - _Link_type - _M_copy(_Const_Link_type __x, _Link_type __p) - { - _Alloc_node __an(*this); - return _M_copy(__x, __p, __an); - } - - void - _M_erase(_Link_type __x); - - iterator - _M_lower_bound(_Link_type __x, _Link_type __y, - const _Key& __k); - - const_iterator - _M_lower_bound(_Const_Link_type __x, _Const_Link_type __y, - const _Key& __k) const; - - iterator - _M_upper_bound(_Link_type __x, _Link_type __y, - const _Key& __k); - - const_iterator - _M_upper_bound(_Const_Link_type __x, _Const_Link_type __y, - const _Key& __k) const; - - public: - // allocation/deallocation - _Rb_tree() { } - - _Rb_tree(const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_impl(__comp, _Node_allocator(__a)) { } - - _Rb_tree(const _Rb_tree& __x) - : _M_impl(__x._M_impl._M_key_compare, - _Alloc_traits::_S_select_on_copy(__x._M_get_Node_allocator())) - { - if (__x._M_root() != 0) - { - _M_root() = _M_copy(__x._M_begin(), _M_end()); - _M_leftmost() = _S_minimum(_M_root()); - _M_rightmost() = _S_maximum(_M_root()); - _M_impl._M_node_count = __x._M_impl._M_node_count; - } - } - -#if __cplusplus >= 201103L - _Rb_tree(const allocator_type& __a) - : _M_impl(_Compare(), _Node_allocator(__a)) - { } - - _Rb_tree(const _Rb_tree& __x, const allocator_type& __a) - : _M_impl(__x._M_impl._M_key_compare, _Node_allocator(__a)) - { - if (__x._M_root() != nullptr) - { - _M_root() = _M_copy(__x._M_begin(), _M_end()); - _M_leftmost() = _S_minimum(_M_root()); - _M_rightmost() = _S_maximum(_M_root()); - _M_impl._M_node_count = __x._M_impl._M_node_count; - } - } - - _Rb_tree(_Rb_tree&& __x) - : _M_impl(__x._M_impl._M_key_compare, __x._M_get_Node_allocator()) - { - if (__x._M_root() != 0) - _M_move_data(__x, std::true_type()); - } - - _Rb_tree(_Rb_tree&& __x, const allocator_type& __a) - : _Rb_tree(std::move(__x), _Node_allocator(__a)) - { } - - _Rb_tree(_Rb_tree&& __x, _Node_allocator&& __a); -#endif - - ~_Rb_tree() _GLIBCXX_NOEXCEPT - { _M_erase(_M_begin()); } - - _Rb_tree& - operator=(const _Rb_tree& __x); - - // Accessors. - _Compare - key_comp() const - { return _M_impl._M_key_compare; } - - iterator - begin() _GLIBCXX_NOEXCEPT - { return iterator(this->_M_impl._M_header._M_left); } - - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(this->_M_impl._M_header._M_left); } - - iterator - end() _GLIBCXX_NOEXCEPT - { return iterator(&this->_M_impl._M_header); } - - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return const_iterator(&this->_M_impl._M_header); } - - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return reverse_iterator(end()); } - - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(end()); } - - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return reverse_iterator(begin()); } - - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(begin()); } - - bool - empty() const _GLIBCXX_NOEXCEPT - { return _M_impl._M_node_count == 0; } - - size_type - size() const _GLIBCXX_NOEXCEPT - { return _M_impl._M_node_count; } - - size_type - max_size() const _GLIBCXX_NOEXCEPT - { return _Alloc_traits::max_size(_M_get_Node_allocator()); } - - void -#if __cplusplus >= 201103L - swap(_Rb_tree& __t) noexcept(_Alloc_traits::_S_nothrow_swap()); -#else - swap(_Rb_tree& __t); -#endif - - // Insert/erase. -#if __cplusplus >= 201103L - template - pair - _M_insert_unique(_Arg&& __x); - - template - iterator - _M_insert_equal(_Arg&& __x); - - template - iterator - _M_insert_unique_(const_iterator __pos, _Arg&& __x, _NodeGen&); - - template - iterator - _M_insert_unique_(const_iterator __pos, _Arg&& __x) - { - _Alloc_node __an(*this); - return _M_insert_unique_(__pos, std::forward<_Arg>(__x), __an); - } - - template - iterator - _M_insert_equal_(const_iterator __pos, _Arg&& __x, _NodeGen&); - - template - iterator - _M_insert_equal_(const_iterator __pos, _Arg&& __x) - { - _Alloc_node __an(*this); - return _M_insert_equal_(__pos, std::forward<_Arg>(__x), __an); - } - - template - pair - _M_emplace_unique(_Args&&... __args); - - template - iterator - _M_emplace_equal(_Args&&... __args); - - template - iterator - _M_emplace_hint_unique(const_iterator __pos, _Args&&... __args); - - template - iterator - _M_emplace_hint_equal(const_iterator __pos, _Args&&... __args); -#else - pair - _M_insert_unique(const value_type& __x); - - iterator - _M_insert_equal(const value_type& __x); - - template - iterator - _M_insert_unique_(const_iterator __pos, const value_type& __x, - _NodeGen&); - - iterator - _M_insert_unique_(const_iterator __pos, const value_type& __x) - { - _Alloc_node __an(*this); - return _M_insert_unique_(__pos, __x, __an); - } - - template - iterator - _M_insert_equal_(const_iterator __pos, const value_type& __x, - _NodeGen&); - iterator - _M_insert_equal_(const_iterator __pos, const value_type& __x) - { - _Alloc_node __an(*this); - return _M_insert_equal_(__pos, __x, __an); - } -#endif - - template - void - _M_insert_unique(_InputIterator __first, _InputIterator __last); - - template - void - _M_insert_equal(_InputIterator __first, _InputIterator __last); - - private: - void - _M_erase_aux(const_iterator __position); - - void - _M_erase_aux(const_iterator __first, const_iterator __last); - - public: -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 130. Associative erase should return an iterator. - _GLIBCXX_ABI_TAG_CXX11 - iterator - erase(const_iterator __position) - { - const_iterator __result = __position; - ++__result; - _M_erase_aux(__position); - return __result._M_const_cast(); - } - - // LWG 2059. - _GLIBCXX_ABI_TAG_CXX11 - iterator - erase(iterator __position) - { - iterator __result = __position; - ++__result; - _M_erase_aux(__position); - return __result; - } -#else - void - erase(iterator __position) - { _M_erase_aux(__position); } - - void - erase(const_iterator __position) - { _M_erase_aux(__position); } -#endif - size_type - erase(const key_type& __x); - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 130. Associative erase should return an iterator. - _GLIBCXX_ABI_TAG_CXX11 - iterator - erase(const_iterator __first, const_iterator __last) - { - _M_erase_aux(__first, __last); - return __last._M_const_cast(); - } -#else - void - erase(iterator __first, iterator __last) - { _M_erase_aux(__first, __last); } - - void - erase(const_iterator __first, const_iterator __last) - { _M_erase_aux(__first, __last); } -#endif - void - erase(const key_type* __first, const key_type* __last); - - void - clear() _GLIBCXX_NOEXCEPT - { - _M_erase(_M_begin()); - _M_impl._M_reset(); - } - - // Set operations. - iterator - find(const key_type& __k); - - const_iterator - find(const key_type& __k) const; - - size_type - count(const key_type& __k) const; - - iterator - lower_bound(const key_type& __k) - { return _M_lower_bound(_M_begin(), _M_end(), __k); } - - const_iterator - lower_bound(const key_type& __k) const - { return _M_lower_bound(_M_begin(), _M_end(), __k); } - - iterator - upper_bound(const key_type& __k) - { return _M_upper_bound(_M_begin(), _M_end(), __k); } - - const_iterator - upper_bound(const key_type& __k) const - { return _M_upper_bound(_M_begin(), _M_end(), __k); } - - pair - equal_range(const key_type& __k); - - pair - equal_range(const key_type& __k) const; - -#if __cplusplus > 201103L - template> - struct __is_transparent { }; - - template - struct - __is_transparent<_Cmp, _Kt, __void_t> - { typedef void type; }; - - static auto _S_iter(_Link_type __x) { return iterator(__x); } - - static auto _S_iter(_Const_Link_type __x) { return const_iterator(__x); } - - template - static auto - _S_lower_bound_tr(_Cmp& __cmp, _Link __x, _Link __y, const _Kt& __k) - { - while (__x != 0) - if (!__cmp(_S_key(__x), __k)) - __y = __x, __x = _S_left(__x); - else - __x = _S_right(__x); - return _S_iter(__y); - } - - template - static auto - _S_upper_bound_tr(_Cmp& __cmp, _Link __x, _Link __y, const _Kt& __k) - { - while (__x != 0) - if (__cmp(__k, _S_key(__x))) - __y = __x, __x = _S_left(__x); - else - __x = _S_right(__x); - return _S_iter(__y); - } - - template::type> - iterator - _M_find_tr(const _Kt& __k) - { - auto& __cmp = _M_impl._M_key_compare; - auto __j = _S_lower_bound_tr(__cmp, _M_begin(), _M_end(), __k); - return (__j == end() || __cmp(__k, _S_key(__j._M_node))) - ? end() : __j; - } - - template::type> - const_iterator - _M_find_tr(const _Kt& __k) const - { - auto& __cmp = _M_impl._M_key_compare; - auto __j = _S_lower_bound_tr(__cmp, _M_begin(), _M_end(), __k); - return (__j == end() || __cmp(__k, _S_key(__j._M_node))) - ? end() : __j; - } - - template::type> - size_type - _M_count_tr(const _Kt& __k) const - { - auto __p = _M_equal_range_tr(__k); - return std::distance(__p.first, __p.second); - } - - template::type> - iterator - _M_lower_bound_tr(const _Kt& __k) - { - auto& __cmp = _M_impl._M_key_compare; - return _S_lower_bound_tr(__cmp, _M_begin(), _M_end(), __k); - } - - template::type> - const_iterator - _M_lower_bound_tr(const _Kt& __k) const - { - auto& __cmp = _M_impl._M_key_compare; - return _S_lower_bound_tr(__cmp, _M_begin(), _M_end(), __k); - } - - template::type> - iterator - _M_upper_bound_tr(const _Kt& __k) - { - auto& __cmp = _M_impl._M_key_compare; - return _S_upper_bound_tr(__cmp, _M_begin(), _M_end(), __k); - } - - template::type> - const_iterator - _M_upper_bound_tr(const _Kt& __k) const - { - auto& __cmp = _M_impl._M_key_compare; - return _S_upper_bound_tr(__cmp, _M_begin(), _M_end(), __k); - } - - template::type> - pair - _M_equal_range_tr(const _Kt& __k) - { - auto __low = _M_lower_bound_tr(__k); - auto __high = __low; - auto& __cmp = _M_impl._M_key_compare; - while (__high != end() && !__cmp(__k, _S_key(__high._M_node))) - ++__high; - return { __low, __high }; - } - - template::type> - pair - _M_equal_range_tr(const _Kt& __k) const - { - auto __low = _M_lower_bound_tr(__k); - auto __high = __low; - auto& __cmp = _M_impl._M_key_compare; - while (__high != end() && !__cmp(__k, _S_key(__high._M_node))) - ++__high; - return { __low, __high }; - } -#endif - - // Debugging. - bool - __rb_verify() const; - -#if __cplusplus >= 201103L - _Rb_tree& - operator=(_Rb_tree&&) noexcept(_Alloc_traits::_S_nothrow_move()); - - template - void - _M_assign_unique(_Iterator, _Iterator); - - template - void - _M_assign_equal(_Iterator, _Iterator); - - private: - // Move elements from container with equal allocator. - void - _M_move_data(_Rb_tree&, std::true_type); - - // Move elements from container with possibly non-equal allocator, - // which might result in a copy not a move. - void - _M_move_data(_Rb_tree&, std::false_type); -#endif - }; - - template - inline bool - operator==(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, - const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) - { - return __x.size() == __y.size() - && std::equal(__x.begin(), __x.end(), __y.begin()); - } - - template - inline bool - operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, - const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) - { - return std::lexicographical_compare(__x.begin(), __x.end(), - __y.begin(), __y.end()); - } - - template - inline bool - operator!=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, - const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) - { return !(__x == __y); } - - template - inline bool - operator>(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, - const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) - { return __y < __x; } - - template - inline bool - operator<=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, - const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) - { return !(__y < __x); } - - template - inline bool - operator>=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, - const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) - { return !(__x < __y); } - - template - inline void - swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) - { __x.swap(__y); } - -#if __cplusplus >= 201103L - template - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _Rb_tree(_Rb_tree&& __x, _Node_allocator&& __a) - : _M_impl(__x._M_impl._M_key_compare, std::move(__a)) - { - using __eq = integral_constant; - if (__x._M_root() != nullptr) - _M_move_data(__x, __eq()); - } - - template - void - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_move_data(_Rb_tree& __x, std::true_type) - { - _M_root() = __x._M_root(); - _M_leftmost() = __x._M_leftmost(); - _M_rightmost() = __x._M_rightmost(); - _M_root()->_M_parent = _M_end(); - - __x._M_root() = 0; - __x._M_leftmost() = __x._M_end(); - __x._M_rightmost() = __x._M_end(); - - this->_M_impl._M_node_count = __x._M_impl._M_node_count; - __x._M_impl._M_node_count = 0; - } - - template - void - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_move_data(_Rb_tree& __x, std::false_type) - { - if (_M_get_Node_allocator() == __x._M_get_Node_allocator()) - _M_move_data(__x, std::true_type()); - else - { - _Alloc_node __an(*this); - auto __lbd = - [&__an](const value_type& __cval) - { - auto& __val = const_cast(__cval); - return __an(std::move_if_noexcept(__val)); - }; - _M_root() = _M_copy(__x._M_begin(), _M_end(), __lbd); - _M_leftmost() = _S_minimum(_M_root()); - _M_rightmost() = _S_maximum(_M_root()); - _M_impl._M_node_count = __x._M_impl._M_node_count; - } - } - - template - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - operator=(_Rb_tree&& __x) - noexcept(_Alloc_traits::_S_nothrow_move()) - { - _M_impl._M_key_compare = __x._M_impl._M_key_compare; - if (_Alloc_traits::_S_propagate_on_move_assign() - || _Alloc_traits::_S_always_equal() - || _M_get_Node_allocator() == __x._M_get_Node_allocator()) - { - clear(); - if (__x._M_root() != nullptr) - _M_move_data(__x, std::true_type()); - std::__alloc_on_move(_M_get_Node_allocator(), - __x._M_get_Node_allocator()); - return *this; - } - - // Try to move each node reusing existing nodes and copying __x nodes - // structure. - _Reuse_or_alloc_node __roan(*this); - _M_impl._M_reset(); - if (__x._M_root() != nullptr) - { - auto __lbd = - [&__roan](const value_type& __cval) - { - auto& __val = const_cast(__cval); - return __roan(std::move_if_noexcept(__val)); - }; - _M_root() = _M_copy(__x._M_begin(), _M_end(), __lbd); - _M_leftmost() = _S_minimum(_M_root()); - _M_rightmost() = _S_maximum(_M_root()); - _M_impl._M_node_count = __x._M_impl._M_node_count; - __x.clear(); - } - return *this; - } - - template - template - void - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_assign_unique(_Iterator __first, _Iterator __last) - { - _Reuse_or_alloc_node __roan(*this); - _M_impl._M_reset(); - for (; __first != __last; ++__first) - _M_insert_unique_(end(), *__first, __roan); - } - - template - template - void - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_assign_equal(_Iterator __first, _Iterator __last) - { - _Reuse_or_alloc_node __roan(*this); - _M_impl._M_reset(); - for (; __first != __last; ++__first) - _M_insert_equal_(end(), *__first, __roan); - } -#endif - - template - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - operator=(const _Rb_tree& __x) - { - if (this != &__x) - { - // Note that _Key may be a constant type. -#if __cplusplus >= 201103L - if (_Alloc_traits::_S_propagate_on_copy_assign()) - { - auto& __this_alloc = this->_M_get_Node_allocator(); - auto& __that_alloc = __x._M_get_Node_allocator(); - if (!_Alloc_traits::_S_always_equal() - && __this_alloc != __that_alloc) - { - // Replacement allocator cannot free existing storage, we need - // to erase nodes first. - clear(); - std::__alloc_on_copy(__this_alloc, __that_alloc); - } - } -#endif - - _Reuse_or_alloc_node __roan(*this); - _M_impl._M_reset(); - _M_impl._M_key_compare = __x._M_impl._M_key_compare; - if (__x._M_root() != 0) - { - _M_root() = _M_copy(__x._M_begin(), _M_end(), __roan); - _M_leftmost() = _S_minimum(_M_root()); - _M_rightmost() = _S_maximum(_M_root()); - _M_impl._M_node_count = __x._M_impl._M_node_count; - } - } - - return *this; - } - - template -#if __cplusplus >= 201103L - template -#else - template -#endif - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_insert_(_Base_ptr __x, _Base_ptr __p, -#if __cplusplus >= 201103L - _Arg&& __v, -#else - const _Val& __v, -#endif - _NodeGen& __node_gen) - { - bool __insert_left = (__x != 0 || __p == _M_end() - || _M_impl._M_key_compare(_KeyOfValue()(__v), - _S_key(__p))); - - _Link_type __z = __node_gen(_GLIBCXX_FORWARD(_Arg, __v)); - - _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, - this->_M_impl._M_header); - ++_M_impl._M_node_count; - return iterator(__z); - } - - template -#if __cplusplus >= 201103L - template -#endif - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: -#if __cplusplus >= 201103L - _M_insert_lower(_Base_ptr __p, _Arg&& __v) -#else - _M_insert_lower(_Base_ptr __p, const _Val& __v) -#endif - { - bool __insert_left = (__p == _M_end() - || !_M_impl._M_key_compare(_S_key(__p), - _KeyOfValue()(__v))); - - _Link_type __z = _M_create_node(_GLIBCXX_FORWARD(_Arg, __v)); - - _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, - this->_M_impl._M_header); - ++_M_impl._M_node_count; - return iterator(__z); - } - - template -#if __cplusplus >= 201103L - template -#endif - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: -#if __cplusplus >= 201103L - _M_insert_equal_lower(_Arg&& __v) -#else - _M_insert_equal_lower(const _Val& __v) -#endif - { - _Link_type __x = _M_begin(); - _Link_type __y = _M_end(); - while (__x != 0) - { - __y = __x; - __x = !_M_impl._M_key_compare(_S_key(__x), _KeyOfValue()(__v)) ? - _S_left(__x) : _S_right(__x); - } - return _M_insert_lower(__y, _GLIBCXX_FORWARD(_Arg, __v)); - } - - template - template - typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type - _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>:: - _M_copy(_Const_Link_type __x, _Link_type __p, _NodeGen& __node_gen) - { - // Structural copy. __x and __p must be non-null. - _Link_type __top = _M_clone_node(__x, __node_gen); - __top->_M_parent = __p; - - __try - { - if (__x->_M_right) - __top->_M_right = _M_copy(_S_right(__x), __top, __node_gen); - __p = __top; - __x = _S_left(__x); - - while (__x != 0) - { - _Link_type __y = _M_clone_node(__x, __node_gen); - __p->_M_left = __y; - __y->_M_parent = __p; - if (__x->_M_right) - __y->_M_right = _M_copy(_S_right(__x), __y, __node_gen); - __p = __y; - __x = _S_left(__x); - } - } - __catch(...) - { - _M_erase(__top); - __throw_exception_again; - } - return __top; - } - - template - void - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_erase(_Link_type __x) - { - // Erase without rebalancing. - while (__x != 0) - { - _M_erase(_S_right(__x)); - _Link_type __y = _S_left(__x); - _M_drop_node(__x); - __x = __y; - } - } - - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, - _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_lower_bound(_Link_type __x, _Link_type __y, - const _Key& __k) - { - while (__x != 0) - if (!_M_impl._M_key_compare(_S_key(__x), __k)) - __y = __x, __x = _S_left(__x); - else - __x = _S_right(__x); - return iterator(__y); - } - - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, - _Compare, _Alloc>::const_iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_lower_bound(_Const_Link_type __x, _Const_Link_type __y, - const _Key& __k) const - { - while (__x != 0) - if (!_M_impl._M_key_compare(_S_key(__x), __k)) - __y = __x, __x = _S_left(__x); - else - __x = _S_right(__x); - return const_iterator(__y); - } - - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, - _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_upper_bound(_Link_type __x, _Link_type __y, - const _Key& __k) - { - while (__x != 0) - if (_M_impl._M_key_compare(__k, _S_key(__x))) - __y = __x, __x = _S_left(__x); - else - __x = _S_right(__x); - return iterator(__y); - } - - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, - _Compare, _Alloc>::const_iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_upper_bound(_Const_Link_type __x, _Const_Link_type __y, - const _Key& __k) const - { - while (__x != 0) - if (_M_impl._M_key_compare(__k, _S_key(__x))) - __y = __x, __x = _S_left(__x); - else - __x = _S_right(__x); - return const_iterator(__y); - } - - template - pair::iterator, - typename _Rb_tree<_Key, _Val, _KeyOfValue, - _Compare, _Alloc>::iterator> - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - equal_range(const _Key& __k) - { - _Link_type __x = _M_begin(); - _Link_type __y = _M_end(); - while (__x != 0) - { - if (_M_impl._M_key_compare(_S_key(__x), __k)) - __x = _S_right(__x); - else if (_M_impl._M_key_compare(__k, _S_key(__x))) - __y = __x, __x = _S_left(__x); - else - { - _Link_type __xu(__x), __yu(__y); - __y = __x, __x = _S_left(__x); - __xu = _S_right(__xu); - return pair(_M_lower_bound(__x, __y, __k), - _M_upper_bound(__xu, __yu, __k)); - } - } - return pair(iterator(__y), - iterator(__y)); - } - - template - pair::const_iterator, - typename _Rb_tree<_Key, _Val, _KeyOfValue, - _Compare, _Alloc>::const_iterator> - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - equal_range(const _Key& __k) const - { - _Const_Link_type __x = _M_begin(); - _Const_Link_type __y = _M_end(); - while (__x != 0) - { - if (_M_impl._M_key_compare(_S_key(__x), __k)) - __x = _S_right(__x); - else if (_M_impl._M_key_compare(__k, _S_key(__x))) - __y = __x, __x = _S_left(__x); - else - { - _Const_Link_type __xu(__x), __yu(__y); - __y = __x, __x = _S_left(__x); - __xu = _S_right(__xu); - return pair(_M_lower_bound(__x, __y, __k), - _M_upper_bound(__xu, __yu, __k)); - } - } - return pair(const_iterator(__y), - const_iterator(__y)); - } - - template - void - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t) -#if __cplusplus >= 201103L - noexcept(_Alloc_traits::_S_nothrow_swap()) -#endif - { - if (_M_root() == 0) - { - if (__t._M_root() != 0) - { - _M_root() = __t._M_root(); - _M_leftmost() = __t._M_leftmost(); - _M_rightmost() = __t._M_rightmost(); - _M_root()->_M_parent = _M_end(); - _M_impl._M_node_count = __t._M_impl._M_node_count; - - __t._M_impl._M_reset(); - } - } - else if (__t._M_root() == 0) - { - __t._M_root() = _M_root(); - __t._M_leftmost() = _M_leftmost(); - __t._M_rightmost() = _M_rightmost(); - __t._M_root()->_M_parent = __t._M_end(); - __t._M_impl._M_node_count = _M_impl._M_node_count; - - _M_impl._M_reset(); - } - else - { - std::swap(_M_root(),__t._M_root()); - std::swap(_M_leftmost(),__t._M_leftmost()); - std::swap(_M_rightmost(),__t._M_rightmost()); - - _M_root()->_M_parent = _M_end(); - __t._M_root()->_M_parent = __t._M_end(); - std::swap(this->_M_impl._M_node_count, __t._M_impl._M_node_count); - } - // No need to swap header's color as it does not change. - std::swap(this->_M_impl._M_key_compare, __t._M_impl._M_key_compare); - - _Alloc_traits::_S_on_swap(_M_get_Node_allocator(), - __t._M_get_Node_allocator()); - } - - template - pair::_Base_ptr, - typename _Rb_tree<_Key, _Val, _KeyOfValue, - _Compare, _Alloc>::_Base_ptr> - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_get_insert_unique_pos(const key_type& __k) - { - typedef pair<_Base_ptr, _Base_ptr> _Res; - _Link_type __x = _M_begin(); - _Link_type __y = _M_end(); - bool __comp = true; - while (__x != 0) - { - __y = __x; - __comp = _M_impl._M_key_compare(__k, _S_key(__x)); - __x = __comp ? _S_left(__x) : _S_right(__x); - } - iterator __j = iterator(__y); - if (__comp) - { - if (__j == begin()) - return _Res(__x, __y); - else - --__j; - } - if (_M_impl._M_key_compare(_S_key(__j._M_node), __k)) - return _Res(__x, __y); - return _Res(__j._M_node, 0); - } - - template - pair::_Base_ptr, - typename _Rb_tree<_Key, _Val, _KeyOfValue, - _Compare, _Alloc>::_Base_ptr> - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_get_insert_equal_pos(const key_type& __k) - { - typedef pair<_Base_ptr, _Base_ptr> _Res; - _Link_type __x = _M_begin(); - _Link_type __y = _M_end(); - while (__x != 0) - { - __y = __x; - __x = _M_impl._M_key_compare(__k, _S_key(__x)) ? - _S_left(__x) : _S_right(__x); - } - return _Res(__x, __y); - } - - template -#if __cplusplus >= 201103L - template -#endif - pair::iterator, bool> - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: -#if __cplusplus >= 201103L - _M_insert_unique(_Arg&& __v) -#else - _M_insert_unique(const _Val& __v) -#endif - { - typedef pair _Res; - pair<_Base_ptr, _Base_ptr> __res - = _M_get_insert_unique_pos(_KeyOfValue()(__v)); - - if (__res.second) - { - _Alloc_node __an(*this); - return _Res(_M_insert_(__res.first, __res.second, - _GLIBCXX_FORWARD(_Arg, __v), __an), - true); - } - - return _Res(iterator(static_cast<_Link_type>(__res.first)), false); - } - - template -#if __cplusplus >= 201103L - template -#endif - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: -#if __cplusplus >= 201103L - _M_insert_equal(_Arg&& __v) -#else - _M_insert_equal(const _Val& __v) -#endif - { - pair<_Base_ptr, _Base_ptr> __res - = _M_get_insert_equal_pos(_KeyOfValue()(__v)); - _Alloc_node __an(*this); - return _M_insert_(__res.first, __res.second, - _GLIBCXX_FORWARD(_Arg, __v), __an); - } - - template - pair::_Base_ptr, - typename _Rb_tree<_Key, _Val, _KeyOfValue, - _Compare, _Alloc>::_Base_ptr> - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_get_insert_hint_unique_pos(const_iterator __position, - const key_type& __k) - { - iterator __pos = __position._M_const_cast(); - typedef pair<_Base_ptr, _Base_ptr> _Res; - - // end() - if (__pos._M_node == _M_end()) - { - if (size() > 0 - && _M_impl._M_key_compare(_S_key(_M_rightmost()), __k)) - return _Res(0, _M_rightmost()); - else - return _M_get_insert_unique_pos(__k); - } - else if (_M_impl._M_key_compare(__k, _S_key(__pos._M_node))) - { - // First, try before... - iterator __before = __pos; - if (__pos._M_node == _M_leftmost()) // begin() - return _Res(_M_leftmost(), _M_leftmost()); - else if (_M_impl._M_key_compare(_S_key((--__before)._M_node), __k)) - { - if (_S_right(__before._M_node) == 0) - return _Res(0, __before._M_node); - else - return _Res(__pos._M_node, __pos._M_node); - } - else - return _M_get_insert_unique_pos(__k); - } - else if (_M_impl._M_key_compare(_S_key(__pos._M_node), __k)) - { - // ... then try after. - iterator __after = __pos; - if (__pos._M_node == _M_rightmost()) - return _Res(0, _M_rightmost()); - else if (_M_impl._M_key_compare(__k, _S_key((++__after)._M_node))) - { - if (_S_right(__pos._M_node) == 0) - return _Res(0, __pos._M_node); - else - return _Res(__after._M_node, __after._M_node); - } - else - return _M_get_insert_unique_pos(__k); - } - else - // Equivalent keys. - return _Res(__pos._M_node, 0); - } - - template -#if __cplusplus >= 201103L - template -#else - template -#endif - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_insert_unique_(const_iterator __position, -#if __cplusplus >= 201103L - _Arg&& __v, -#else - const _Val& __v, -#endif - _NodeGen& __node_gen) - { - pair<_Base_ptr, _Base_ptr> __res - = _M_get_insert_hint_unique_pos(__position, _KeyOfValue()(__v)); - - if (__res.second) - return _M_insert_(__res.first, __res.second, - _GLIBCXX_FORWARD(_Arg, __v), - __node_gen); - return iterator(static_cast<_Link_type>(__res.first)); - } - - template - pair::_Base_ptr, - typename _Rb_tree<_Key, _Val, _KeyOfValue, - _Compare, _Alloc>::_Base_ptr> - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_get_insert_hint_equal_pos(const_iterator __position, const key_type& __k) - { - iterator __pos = __position._M_const_cast(); - typedef pair<_Base_ptr, _Base_ptr> _Res; - - // end() - if (__pos._M_node == _M_end()) - { - if (size() > 0 - && !_M_impl._M_key_compare(__k, _S_key(_M_rightmost()))) - return _Res(0, _M_rightmost()); - else - return _M_get_insert_equal_pos(__k); - } - else if (!_M_impl._M_key_compare(_S_key(__pos._M_node), __k)) - { - // First, try before... - iterator __before = __pos; - if (__pos._M_node == _M_leftmost()) // begin() - return _Res(_M_leftmost(), _M_leftmost()); - else if (!_M_impl._M_key_compare(__k, _S_key((--__before)._M_node))) - { - if (_S_right(__before._M_node) == 0) - return _Res(0, __before._M_node); - else - return _Res(__pos._M_node, __pos._M_node); - } - else - return _M_get_insert_equal_pos(__k); - } - else - { - // ... then try after. - iterator __after = __pos; - if (__pos._M_node == _M_rightmost()) - return _Res(0, _M_rightmost()); - else if (!_M_impl._M_key_compare(_S_key((++__after)._M_node), __k)) - { - if (_S_right(__pos._M_node) == 0) - return _Res(0, __pos._M_node); - else - return _Res(__after._M_node, __after._M_node); - } - else - return _Res(0, 0); - } - } - - template -#if __cplusplus >= 201103L - template -#else - template -#endif - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_insert_equal_(const_iterator __position, -#if __cplusplus >= 201103L - _Arg&& __v, -#else - const _Val& __v, -#endif - _NodeGen& __node_gen) - { - pair<_Base_ptr, _Base_ptr> __res - = _M_get_insert_hint_equal_pos(__position, _KeyOfValue()(__v)); - - if (__res.second) - return _M_insert_(__res.first, __res.second, - _GLIBCXX_FORWARD(_Arg, __v), - __node_gen); - - return _M_insert_equal_lower(_GLIBCXX_FORWARD(_Arg, __v)); - } - -#if __cplusplus >= 201103L - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_insert_node(_Base_ptr __x, _Base_ptr __p, _Link_type __z) - { - bool __insert_left = (__x != 0 || __p == _M_end() - || _M_impl._M_key_compare(_S_key(__z), - _S_key(__p))); - - _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, - this->_M_impl._M_header); - ++_M_impl._M_node_count; - return iterator(__z); - } - - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_insert_lower_node(_Base_ptr __p, _Link_type __z) - { - bool __insert_left = (__p == _M_end() - || !_M_impl._M_key_compare(_S_key(__p), - _S_key(__z))); - - _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, - this->_M_impl._M_header); - ++_M_impl._M_node_count; - return iterator(__z); - } - - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_insert_equal_lower_node(_Link_type __z) - { - _Link_type __x = _M_begin(); - _Link_type __y = _M_end(); - while (__x != 0) - { - __y = __x; - __x = !_M_impl._M_key_compare(_S_key(__x), _S_key(__z)) ? - _S_left(__x) : _S_right(__x); - } - return _M_insert_lower_node(__y, __z); - } - - template - template - pair::iterator, bool> - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_emplace_unique(_Args&&... __args) - { - _Link_type __z = _M_create_node(std::forward<_Args>(__args)...); - - __try - { - typedef pair _Res; - auto __res = _M_get_insert_unique_pos(_S_key(__z)); - if (__res.second) - return _Res(_M_insert_node(__res.first, __res.second, __z), true); - - _M_drop_node(__z); - return _Res(iterator(static_cast<_Link_type>(__res.first)), false); - } - __catch(...) - { - _M_drop_node(__z); - __throw_exception_again; - } - } - - template - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_emplace_equal(_Args&&... __args) - { - _Link_type __z = _M_create_node(std::forward<_Args>(__args)...); - - __try - { - auto __res = _M_get_insert_equal_pos(_S_key(__z)); - return _M_insert_node(__res.first, __res.second, __z); - } - __catch(...) - { - _M_drop_node(__z); - __throw_exception_again; - } - } - - template - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_emplace_hint_unique(const_iterator __pos, _Args&&... __args) - { - _Link_type __z = _M_create_node(std::forward<_Args>(__args)...); - - __try - { - auto __res = _M_get_insert_hint_unique_pos(__pos, _S_key(__z)); - - if (__res.second) - return _M_insert_node(__res.first, __res.second, __z); - - _M_drop_node(__z); - return iterator(static_cast<_Link_type>(__res.first)); - } - __catch(...) - { - _M_drop_node(__z); - __throw_exception_again; - } - } - - template - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_emplace_hint_equal(const_iterator __pos, _Args&&... __args) - { - _Link_type __z = _M_create_node(std::forward<_Args>(__args)...); - - __try - { - auto __res = _M_get_insert_hint_equal_pos(__pos, _S_key(__z)); - - if (__res.second) - return _M_insert_node(__res.first, __res.second, __z); - - return _M_insert_equal_lower_node(__z); - } - __catch(...) - { - _M_drop_node(__z); - __throw_exception_again; - } - } -#endif - - template - template - void - _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>:: - _M_insert_unique(_II __first, _II __last) - { - _Alloc_node __an(*this); - for (; __first != __last; ++__first) - _M_insert_unique_(end(), *__first, __an); - } - - template - template - void - _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>:: - _M_insert_equal(_II __first, _II __last) - { - _Alloc_node __an(*this); - for (; __first != __last; ++__first) - _M_insert_equal_(end(), *__first, __an); - } - - template - void - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_erase_aux(const_iterator __position) - { - _Link_type __y = - static_cast<_Link_type>(_Rb_tree_rebalance_for_erase - (const_cast<_Base_ptr>(__position._M_node), - this->_M_impl._M_header)); - _M_drop_node(__y); - --_M_impl._M_node_count; - } - - template - void - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - _M_erase_aux(const_iterator __first, const_iterator __last) - { - if (__first == begin() && __last == end()) - clear(); - else - while (__first != __last) - erase(__first++); - } - - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - erase(const _Key& __x) - { - pair __p = equal_range(__x); - const size_type __old_size = size(); - erase(__p.first, __p.second); - return __old_size - size(); - } - - template - void - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - erase(const _Key* __first, const _Key* __last) - { - while (__first != __last) - erase(*__first++); - } - - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, - _Compare, _Alloc>::iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - find(const _Key& __k) - { - iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k); - return (__j == end() - || _M_impl._M_key_compare(__k, - _S_key(__j._M_node))) ? end() : __j; - } - - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, - _Compare, _Alloc>::const_iterator - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - find(const _Key& __k) const - { - const_iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k); - return (__j == end() - || _M_impl._M_key_compare(__k, - _S_key(__j._M_node))) ? end() : __j; - } - - template - typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - count(const _Key& __k) const - { - pair __p = equal_range(__k); - const size_type __n = std::distance(__p.first, __p.second); - return __n; - } - - _GLIBCXX_PURE unsigned int - _Rb_tree_black_count(const _Rb_tree_node_base* __node, - const _Rb_tree_node_base* __root) throw (); - - template - bool - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::__rb_verify() const - { - if (_M_impl._M_node_count == 0 || begin() == end()) - return _M_impl._M_node_count == 0 && begin() == end() - && this->_M_impl._M_header._M_left == _M_end() - && this->_M_impl._M_header._M_right == _M_end(); - - unsigned int __len = _Rb_tree_black_count(_M_leftmost(), _M_root()); - for (const_iterator __it = begin(); __it != end(); ++__it) - { - _Const_Link_type __x = static_cast<_Const_Link_type>(__it._M_node); - _Const_Link_type __L = _S_left(__x); - _Const_Link_type __R = _S_right(__x); - - if (__x->_M_color == _S_red) - if ((__L && __L->_M_color == _S_red) - || (__R && __R->_M_color == _S_red)) - return false; - - if (__L && _M_impl._M_key_compare(_S_key(__x), _S_key(__L))) - return false; - if (__R && _M_impl._M_key_compare(_S_key(__R), _S_key(__x))) - return false; - - if (!__L && !__R && _Rb_tree_black_count(__x, _M_root()) != __len) - return false; - } - - if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root())) - return false; - if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root())) - return false; - return true; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/bits/stl_uninitialized.h b/openflow/usr/include/c++/5/bits/stl_uninitialized.h deleted file mode 100644 index 61a1561..0000000 --- a/openflow/usr/include/c++/5/bits/stl_uninitialized.h +++ /dev/null @@ -1,688 +0,0 @@ -// Raw memory manipulators -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_uninitialized.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _STL_UNINITIALIZED_H -#define _STL_UNINITIALIZED_H 1 - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - struct __uninitialized_copy - { - template - static _ForwardIterator - __uninit_copy(_InputIterator __first, _InputIterator __last, - _ForwardIterator __result) - { - _ForwardIterator __cur = __result; - __try - { - for (; __first != __last; ++__first, ++__cur) - std::_Construct(std::__addressof(*__cur), *__first); - return __cur; - } - __catch(...) - { - std::_Destroy(__result, __cur); - __throw_exception_again; - } - } - }; - - template<> - struct __uninitialized_copy - { - template - static _ForwardIterator - __uninit_copy(_InputIterator __first, _InputIterator __last, - _ForwardIterator __result) - { return std::copy(__first, __last, __result); } - }; - - /** - * @brief Copies the range [first,last) into result. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __result An output iterator. - * @return __result + (__first - __last) - * - * Like copy(), but does not require an initialized output range. - */ - template - inline _ForwardIterator - uninitialized_copy(_InputIterator __first, _InputIterator __last, - _ForwardIterator __result) - { - typedef typename iterator_traits<_InputIterator>::value_type - _ValueType1; - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType2; -#if __cplusplus < 201103L - const bool __assignable = true; -#else - // trivial types can have deleted assignment - typedef typename iterator_traits<_InputIterator>::reference _RefType1; - typedef typename iterator_traits<_ForwardIterator>::reference _RefType2; - const bool __assignable = is_assignable<_RefType2, _RefType1>::value; -#endif - - return std::__uninitialized_copy<__is_trivial(_ValueType1) - && __is_trivial(_ValueType2) - && __assignable>:: - __uninit_copy(__first, __last, __result); - } - - - template - struct __uninitialized_fill - { - template - static void - __uninit_fill(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __x) - { - _ForwardIterator __cur = __first; - __try - { - for (; __cur != __last; ++__cur) - std::_Construct(std::__addressof(*__cur), __x); - } - __catch(...) - { - std::_Destroy(__first, __cur); - __throw_exception_again; - } - } - }; - - template<> - struct __uninitialized_fill - { - template - static void - __uninit_fill(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __x) - { std::fill(__first, __last, __x); } - }; - - /** - * @brief Copies the value x into the range [first,last). - * @param __first An input iterator. - * @param __last An input iterator. - * @param __x The source value. - * @return Nothing. - * - * Like fill(), but does not require an initialized output range. - */ - template - inline void - uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __x) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; -#if __cplusplus < 201103L - const bool __assignable = true; -#else - // trivial types can have deleted assignment - const bool __assignable = is_copy_assignable<_ValueType>::value; -#endif - - std::__uninitialized_fill<__is_trivial(_ValueType) && __assignable>:: - __uninit_fill(__first, __last, __x); - } - - - template - struct __uninitialized_fill_n - { - template - static _ForwardIterator - __uninit_fill_n(_ForwardIterator __first, _Size __n, - const _Tp& __x) - { - _ForwardIterator __cur = __first; - __try - { - for (; __n > 0; --__n, ++__cur) - std::_Construct(std::__addressof(*__cur), __x); - return __cur; - } - __catch(...) - { - std::_Destroy(__first, __cur); - __throw_exception_again; - } - } - }; - - template<> - struct __uninitialized_fill_n - { - template - static _ForwardIterator - __uninit_fill_n(_ForwardIterator __first, _Size __n, - const _Tp& __x) - { return std::fill_n(__first, __n, __x); } - }; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 1339. uninitialized_fill_n should return the end of its range - /** - * @brief Copies the value x into the range [first,first+n). - * @param __first An input iterator. - * @param __n The number of copies to make. - * @param __x The source value. - * @return Nothing. - * - * Like fill_n(), but does not require an initialized output range. - */ - template - inline _ForwardIterator - uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; -#if __cplusplus < 201103L - const bool __assignable = true; -#else - // trivial types can have deleted assignment - const bool __assignable = is_copy_assignable<_ValueType>::value; -#endif - return __uninitialized_fill_n<__is_trivial(_ValueType) && __assignable>:: - __uninit_fill_n(__first, __n, __x); - } - - // Extensions: versions of uninitialized_copy, uninitialized_fill, - // and uninitialized_fill_n that take an allocator parameter. - // We dispatch back to the standard versions when we're given the - // default allocator. For nondefault allocators we do not use - // any of the POD optimizations. - - template - _ForwardIterator - __uninitialized_copy_a(_InputIterator __first, _InputIterator __last, - _ForwardIterator __result, _Allocator& __alloc) - { - _ForwardIterator __cur = __result; - __try - { - typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; - for (; __first != __last; ++__first, ++__cur) - __traits::construct(__alloc, std::__addressof(*__cur), *__first); - return __cur; - } - __catch(...) - { - std::_Destroy(__result, __cur, __alloc); - __throw_exception_again; - } - } - - template - inline _ForwardIterator - __uninitialized_copy_a(_InputIterator __first, _InputIterator __last, - _ForwardIterator __result, allocator<_Tp>&) - { return std::uninitialized_copy(__first, __last, __result); } - - template - inline _ForwardIterator - __uninitialized_move_a(_InputIterator __first, _InputIterator __last, - _ForwardIterator __result, _Allocator& __alloc) - { - return std::__uninitialized_copy_a(_GLIBCXX_MAKE_MOVE_ITERATOR(__first), - _GLIBCXX_MAKE_MOVE_ITERATOR(__last), - __result, __alloc); - } - - template - inline _ForwardIterator - __uninitialized_move_if_noexcept_a(_InputIterator __first, - _InputIterator __last, - _ForwardIterator __result, - _Allocator& __alloc) - { - return std::__uninitialized_copy_a - (_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__first), - _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc); - } - - template - void - __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __x, _Allocator& __alloc) - { - _ForwardIterator __cur = __first; - __try - { - typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; - for (; __cur != __last; ++__cur) - __traits::construct(__alloc, std::__addressof(*__cur), __x); - } - __catch(...) - { - std::_Destroy(__first, __cur, __alloc); - __throw_exception_again; - } - } - - template - inline void - __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __x, allocator<_Tp2>&) - { std::uninitialized_fill(__first, __last, __x); } - - template - _ForwardIterator - __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, - const _Tp& __x, _Allocator& __alloc) - { - _ForwardIterator __cur = __first; - __try - { - typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; - for (; __n > 0; --__n, ++__cur) - __traits::construct(__alloc, std::__addressof(*__cur), __x); - return __cur; - } - __catch(...) - { - std::_Destroy(__first, __cur, __alloc); - __throw_exception_again; - } - } - - template - inline _ForwardIterator - __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, - const _Tp& __x, allocator<_Tp2>&) - { return std::uninitialized_fill_n(__first, __n, __x); } - - - // Extensions: __uninitialized_copy_move, __uninitialized_move_copy, - // __uninitialized_fill_move, __uninitialized_move_fill. - // All of these algorithms take a user-supplied allocator, which is used - // for construction and destruction. - - // __uninitialized_copy_move - // Copies [first1, last1) into [result, result + (last1 - first1)), and - // move [first2, last2) into - // [result, result + (last1 - first1) + (last2 - first2)). - template - inline _ForwardIterator - __uninitialized_copy_move(_InputIterator1 __first1, - _InputIterator1 __last1, - _InputIterator2 __first2, - _InputIterator2 __last2, - _ForwardIterator __result, - _Allocator& __alloc) - { - _ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1, - __result, - __alloc); - __try - { - return std::__uninitialized_move_a(__first2, __last2, __mid, __alloc); - } - __catch(...) - { - std::_Destroy(__result, __mid, __alloc); - __throw_exception_again; - } - } - - // __uninitialized_move_copy - // Moves [first1, last1) into [result, result + (last1 - first1)), and - // copies [first2, last2) into - // [result, result + (last1 - first1) + (last2 - first2)). - template - inline _ForwardIterator - __uninitialized_move_copy(_InputIterator1 __first1, - _InputIterator1 __last1, - _InputIterator2 __first2, - _InputIterator2 __last2, - _ForwardIterator __result, - _Allocator& __alloc) - { - _ForwardIterator __mid = std::__uninitialized_move_a(__first1, __last1, - __result, - __alloc); - __try - { - return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc); - } - __catch(...) - { - std::_Destroy(__result, __mid, __alloc); - __throw_exception_again; - } - } - - // __uninitialized_fill_move - // Fills [result, mid) with x, and moves [first, last) into - // [mid, mid + (last - first)). - template - inline _ForwardIterator - __uninitialized_fill_move(_ForwardIterator __result, _ForwardIterator __mid, - const _Tp& __x, _InputIterator __first, - _InputIterator __last, _Allocator& __alloc) - { - std::__uninitialized_fill_a(__result, __mid, __x, __alloc); - __try - { - return std::__uninitialized_move_a(__first, __last, __mid, __alloc); - } - __catch(...) - { - std::_Destroy(__result, __mid, __alloc); - __throw_exception_again; - } - } - - // __uninitialized_move_fill - // Moves [first1, last1) into [first2, first2 + (last1 - first1)), and - // fills [first2 + (last1 - first1), last2) with x. - template - inline void - __uninitialized_move_fill(_InputIterator __first1, _InputIterator __last1, - _ForwardIterator __first2, - _ForwardIterator __last2, const _Tp& __x, - _Allocator& __alloc) - { - _ForwardIterator __mid2 = std::__uninitialized_move_a(__first1, __last1, - __first2, - __alloc); - __try - { - std::__uninitialized_fill_a(__mid2, __last2, __x, __alloc); - } - __catch(...) - { - std::_Destroy(__first2, __mid2, __alloc); - __throw_exception_again; - } - } - -#if __cplusplus >= 201103L - // Extensions: __uninitialized_default, __uninitialized_default_n, - // __uninitialized_default_a, __uninitialized_default_n_a. - - template - struct __uninitialized_default_1 - { - template - static void - __uninit_default(_ForwardIterator __first, _ForwardIterator __last) - { - _ForwardIterator __cur = __first; - __try - { - for (; __cur != __last; ++__cur) - std::_Construct(std::__addressof(*__cur)); - } - __catch(...) - { - std::_Destroy(__first, __cur); - __throw_exception_again; - } - } - }; - - template<> - struct __uninitialized_default_1 - { - template - static void - __uninit_default(_ForwardIterator __first, _ForwardIterator __last) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; - - std::fill(__first, __last, _ValueType()); - } - }; - - template - struct __uninitialized_default_n_1 - { - template - static _ForwardIterator - __uninit_default_n(_ForwardIterator __first, _Size __n) - { - _ForwardIterator __cur = __first; - __try - { - for (; __n > 0; --__n, ++__cur) - std::_Construct(std::__addressof(*__cur)); - return __cur; - } - __catch(...) - { - std::_Destroy(__first, __cur); - __throw_exception_again; - } - } - }; - - template<> - struct __uninitialized_default_n_1 - { - template - static _ForwardIterator - __uninit_default_n(_ForwardIterator __first, _Size __n) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; - - return std::fill_n(__first, __n, _ValueType()); - } - }; - - // __uninitialized_default - // Fills [first, last) with std::distance(first, last) default - // constructed value_types(s). - template - inline void - __uninitialized_default(_ForwardIterator __first, - _ForwardIterator __last) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; - // trivial types can have deleted assignment - const bool __assignable = is_copy_assignable<_ValueType>::value; - - std::__uninitialized_default_1<__is_trivial(_ValueType) - && __assignable>:: - __uninit_default(__first, __last); - } - - // __uninitialized_default_n - // Fills [first, first + n) with n default constructed value_type(s). - template - inline _ForwardIterator - __uninitialized_default_n(_ForwardIterator __first, _Size __n) - { - typedef typename iterator_traits<_ForwardIterator>::value_type - _ValueType; - // trivial types can have deleted assignment - const bool __assignable = is_copy_assignable<_ValueType>::value; - - return __uninitialized_default_n_1<__is_trivial(_ValueType) - && __assignable>:: - __uninit_default_n(__first, __n); - } - - - // __uninitialized_default_a - // Fills [first, last) with std::distance(first, last) default - // constructed value_types(s), constructed with the allocator alloc. - template - void - __uninitialized_default_a(_ForwardIterator __first, - _ForwardIterator __last, - _Allocator& __alloc) - { - _ForwardIterator __cur = __first; - __try - { - typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; - for (; __cur != __last; ++__cur) - __traits::construct(__alloc, std::__addressof(*__cur)); - } - __catch(...) - { - std::_Destroy(__first, __cur, __alloc); - __throw_exception_again; - } - } - - template - inline void - __uninitialized_default_a(_ForwardIterator __first, - _ForwardIterator __last, - allocator<_Tp>&) - { std::__uninitialized_default(__first, __last); } - - - // __uninitialized_default_n_a - // Fills [first, first + n) with n default constructed value_types(s), - // constructed with the allocator alloc. - template - _ForwardIterator - __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, - _Allocator& __alloc) - { - _ForwardIterator __cur = __first; - __try - { - typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; - for (; __n > 0; --__n, ++__cur) - __traits::construct(__alloc, std::__addressof(*__cur)); - return __cur; - } - __catch(...) - { - std::_Destroy(__first, __cur, __alloc); - __throw_exception_again; - } - } - - template - inline _ForwardIterator - __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, - allocator<_Tp>&) - { return std::__uninitialized_default_n(__first, __n); } - - - template - _ForwardIterator - __uninitialized_copy_n(_InputIterator __first, _Size __n, - _ForwardIterator __result, input_iterator_tag) - { - _ForwardIterator __cur = __result; - __try - { - for (; __n > 0; --__n, ++__first, ++__cur) - std::_Construct(std::__addressof(*__cur), *__first); - return __cur; - } - __catch(...) - { - std::_Destroy(__result, __cur); - __throw_exception_again; - } - } - - template - inline _ForwardIterator - __uninitialized_copy_n(_RandomAccessIterator __first, _Size __n, - _ForwardIterator __result, - random_access_iterator_tag) - { return std::uninitialized_copy(__first, __first + __n, __result); } - - /** - * @brief Copies the range [first,first+n) into result. - * @param __first An input iterator. - * @param __n The number of elements to copy. - * @param __result An output iterator. - * @return __result + __n - * - * Like copy_n(), but does not require an initialized output range. - */ - template - inline _ForwardIterator - uninitialized_copy_n(_InputIterator __first, _Size __n, - _ForwardIterator __result) - { return std::__uninitialized_copy_n(__first, __n, __result, - std::__iterator_category(__first)); } -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _STL_UNINITIALIZED_H */ diff --git a/openflow/usr/include/c++/5/bits/stl_vector.h b/openflow/usr/include/c++/5/bits/stl_vector.h deleted file mode 100644 index b00f770..0000000 --- a/openflow/usr/include/c++/5/bits/stl_vector.h +++ /dev/null @@ -1,1565 +0,0 @@ -// Vector implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/stl_vector.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{vector} - */ - -#ifndef _STL_VECTOR_H -#define _STL_VECTOR_H 1 - -#include -#include -#include -#if __cplusplus >= 201103L -#include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - /// See bits/stl_deque.h's _Deque_base for an explanation. - template - struct _Vector_base - { - typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template - rebind<_Tp>::other _Tp_alloc_type; - typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer - pointer; - - struct _Vector_impl - : public _Tp_alloc_type - { - pointer _M_start; - pointer _M_finish; - pointer _M_end_of_storage; - - _Vector_impl() - : _Tp_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage() - { } - - _Vector_impl(_Tp_alloc_type const& __a) _GLIBCXX_NOEXCEPT - : _Tp_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage() - { } - -#if __cplusplus >= 201103L - _Vector_impl(_Tp_alloc_type&& __a) noexcept - : _Tp_alloc_type(std::move(__a)), - _M_start(), _M_finish(), _M_end_of_storage() - { } -#endif - - void _M_swap_data(_Vector_impl& __x) _GLIBCXX_NOEXCEPT - { - std::swap(_M_start, __x._M_start); - std::swap(_M_finish, __x._M_finish); - std::swap(_M_end_of_storage, __x._M_end_of_storage); - } - }; - - public: - typedef _Alloc allocator_type; - - _Tp_alloc_type& - _M_get_Tp_allocator() _GLIBCXX_NOEXCEPT - { return *static_cast<_Tp_alloc_type*>(&this->_M_impl); } - - const _Tp_alloc_type& - _M_get_Tp_allocator() const _GLIBCXX_NOEXCEPT - { return *static_cast(&this->_M_impl); } - - allocator_type - get_allocator() const _GLIBCXX_NOEXCEPT - { return allocator_type(_M_get_Tp_allocator()); } - - _Vector_base() - : _M_impl() { } - - _Vector_base(const allocator_type& __a) _GLIBCXX_NOEXCEPT - : _M_impl(__a) { } - - _Vector_base(size_t __n) - : _M_impl() - { _M_create_storage(__n); } - - _Vector_base(size_t __n, const allocator_type& __a) - : _M_impl(__a) - { _M_create_storage(__n); } - -#if __cplusplus >= 201103L - _Vector_base(_Tp_alloc_type&& __a) noexcept - : _M_impl(std::move(__a)) { } - - _Vector_base(_Vector_base&& __x) noexcept - : _M_impl(std::move(__x._M_get_Tp_allocator())) - { this->_M_impl._M_swap_data(__x._M_impl); } - - _Vector_base(_Vector_base&& __x, const allocator_type& __a) - : _M_impl(__a) - { - if (__x.get_allocator() == __a) - this->_M_impl._M_swap_data(__x._M_impl); - else - { - size_t __n = __x._M_impl._M_finish - __x._M_impl._M_start; - _M_create_storage(__n); - } - } -#endif - - ~_Vector_base() _GLIBCXX_NOEXCEPT - { _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - - this->_M_impl._M_start); } - - public: - _Vector_impl _M_impl; - - pointer - _M_allocate(size_t __n) - { - typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Tr; - return __n != 0 ? _Tr::allocate(_M_impl, __n) : pointer(); - } - - void - _M_deallocate(pointer __p, size_t __n) - { - typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Tr; - if (__p) - _Tr::deallocate(_M_impl, __p, __n); - } - - private: - void - _M_create_storage(size_t __n) - { - this->_M_impl._M_start = this->_M_allocate(__n); - this->_M_impl._M_finish = this->_M_impl._M_start; - this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; - } - }; - - - /** - * @brief A standard container which offers fixed time access to - * individual elements in any order. - * - * @ingroup sequences - * - * @tparam _Tp Type of element. - * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. - * - * Meets the requirements of a container, a - * reversible container, and a - * sequence, including the - * optional sequence requirements with the - * %exception of @c push_front and @c pop_front. - * - * In some terminology a %vector can be described as a dynamic - * C-style array, it offers fast and efficient access to individual - * elements in any order and saves the user from worrying about - * memory and size allocation. Subscripting ( @c [] ) access is - * also provided as with C-style arrays. - */ - template > - class vector : protected _Vector_base<_Tp, _Alloc> - { - // Concept requirements. - typedef typename _Alloc::value_type _Alloc_value_type; - __glibcxx_class_requires(_Tp, _SGIAssignableConcept) - __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept) - - typedef _Vector_base<_Tp, _Alloc> _Base; - typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; - typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits; - - public: - typedef _Tp value_type; - typedef typename _Base::pointer pointer; - typedef typename _Alloc_traits::const_pointer const_pointer; - typedef typename _Alloc_traits::reference reference; - typedef typename _Alloc_traits::const_reference const_reference; - typedef __gnu_cxx::__normal_iterator iterator; - typedef __gnu_cxx::__normal_iterator - const_iterator; - typedef std::reverse_iterator const_reverse_iterator; - typedef std::reverse_iterator reverse_iterator; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Alloc allocator_type; - - protected: - using _Base::_M_allocate; - using _Base::_M_deallocate; - using _Base::_M_impl; - using _Base::_M_get_Tp_allocator; - - public: - // [23.2.4.1] construct/copy/destroy - // (assign() and get_allocator() are also listed in this section) - - /** - * @brief Creates a %vector with no elements. - */ - vector() -#if __cplusplus >= 201103L - noexcept(is_nothrow_default_constructible<_Alloc>::value) -#endif - : _Base() { } - - /** - * @brief Creates a %vector with no elements. - * @param __a An allocator object. - */ - explicit - vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT - : _Base(__a) { } - -#if __cplusplus >= 201103L - /** - * @brief Creates a %vector with default constructed elements. - * @param __n The number of elements to initially create. - * @param __a An allocator. - * - * This constructor fills the %vector with @a __n default - * constructed elements. - */ - explicit - vector(size_type __n, const allocator_type& __a = allocator_type()) - : _Base(__n, __a) - { _M_default_initialize(__n); } - - /** - * @brief Creates a %vector with copies of an exemplar element. - * @param __n The number of elements to initially create. - * @param __value An element to copy. - * @param __a An allocator. - * - * This constructor fills the %vector with @a __n copies of @a __value. - */ - vector(size_type __n, const value_type& __value, - const allocator_type& __a = allocator_type()) - : _Base(__n, __a) - { _M_fill_initialize(__n, __value); } -#else - /** - * @brief Creates a %vector with copies of an exemplar element. - * @param __n The number of elements to initially create. - * @param __value An element to copy. - * @param __a An allocator. - * - * This constructor fills the %vector with @a __n copies of @a __value. - */ - explicit - vector(size_type __n, const value_type& __value = value_type(), - const allocator_type& __a = allocator_type()) - : _Base(__n, __a) - { _M_fill_initialize(__n, __value); } -#endif - - /** - * @brief %Vector copy constructor. - * @param __x A %vector of identical element and allocator types. - * - * The newly-created %vector uses a copy of the allocation - * object used by @a __x. All the elements of @a __x are copied, - * but any extra memory in - * @a __x (for fast expansion) will not be copied. - */ - vector(const vector& __x) - : _Base(__x.size(), - _Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator())) - { this->_M_impl._M_finish = - std::__uninitialized_copy_a(__x.begin(), __x.end(), - this->_M_impl._M_start, - _M_get_Tp_allocator()); - } - -#if __cplusplus >= 201103L - /** - * @brief %Vector move constructor. - * @param __x A %vector of identical element and allocator types. - * - * The newly-created %vector contains the exact contents of @a __x. - * The contents of @a __x are a valid, but unspecified %vector. - */ - vector(vector&& __x) noexcept - : _Base(std::move(__x)) { } - - /// Copy constructor with alternative allocator - vector(const vector& __x, const allocator_type& __a) - : _Base(__x.size(), __a) - { this->_M_impl._M_finish = - std::__uninitialized_copy_a(__x.begin(), __x.end(), - this->_M_impl._M_start, - _M_get_Tp_allocator()); - } - - /// Move constructor with alternative allocator - vector(vector&& __rv, const allocator_type& __m) - noexcept(_Alloc_traits::_S_always_equal()) - : _Base(std::move(__rv), __m) - { - if (__rv.get_allocator() != __m) - { - this->_M_impl._M_finish = - std::__uninitialized_move_a(__rv.begin(), __rv.end(), - this->_M_impl._M_start, - _M_get_Tp_allocator()); - __rv.clear(); - } - } - - /** - * @brief Builds a %vector from an initializer list. - * @param __l An initializer_list. - * @param __a An allocator. - * - * Create a %vector consisting of copies of the elements in the - * initializer_list @a __l. - * - * This will call the element type's copy constructor N times - * (where N is @a __l.size()) and do no memory reallocation. - */ - vector(initializer_list __l, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { - _M_range_initialize(__l.begin(), __l.end(), - random_access_iterator_tag()); - } -#endif - - /** - * @brief Builds a %vector from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __a An allocator. - * - * Create a %vector consisting of copies of the elements from - * [first,last). - * - * If the iterators are forward, bidirectional, or - * random-access, then this will call the elements' copy - * constructor N times (where N is distance(first,last)) and do - * no memory reallocation. But if only input iterators are - * used, then this will do at most 2N calls to the copy - * constructor, and logN memory reallocations. - */ -#if __cplusplus >= 201103L - template> - vector(_InputIterator __first, _InputIterator __last, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { _M_initialize_dispatch(__first, __last, __false_type()); } -#else - template - vector(_InputIterator __first, _InputIterator __last, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { - // Check whether it's an integral type. If so, it's not an iterator. - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - _M_initialize_dispatch(__first, __last, _Integral()); - } -#endif - - /** - * The dtor only erases the elements, and note that if the - * elements themselves are pointers, the pointed-to memory is - * not touched in any way. Managing the pointer is the user's - * responsibility. - */ - ~vector() _GLIBCXX_NOEXCEPT - { std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, - _M_get_Tp_allocator()); } - - /** - * @brief %Vector assignment operator. - * @param __x A %vector of identical element and allocator types. - * - * All the elements of @a __x are copied, but any extra memory in - * @a __x (for fast expansion) will not be copied. Unlike the - * copy constructor, the allocator object is not copied. - */ - vector& - operator=(const vector& __x); - -#if __cplusplus >= 201103L - /** - * @brief %Vector move assignment operator. - * @param __x A %vector of identical element and allocator types. - * - * The contents of @a __x are moved into this %vector (without copying, - * if the allocators permit it). - * @a __x is a valid, but unspecified %vector. - */ - vector& - operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) - { - constexpr bool __move_storage = - _Alloc_traits::_S_propagate_on_move_assign() - || _Alloc_traits::_S_always_equal(); - _M_move_assign(std::move(__x), - integral_constant()); - return *this; - } - - /** - * @brief %Vector list assignment operator. - * @param __l An initializer_list. - * - * This function fills a %vector with copies of the elements in the - * initializer list @a __l. - * - * Note that the assignment completely changes the %vector and - * that the resulting %vector's size is the same as the number - * of elements assigned. Old data may be lost. - */ - vector& - operator=(initializer_list __l) - { - this->assign(__l.begin(), __l.end()); - return *this; - } -#endif - - /** - * @brief Assigns a given value to a %vector. - * @param __n Number of elements to be assigned. - * @param __val Value to be assigned. - * - * This function fills a %vector with @a __n copies of the given - * value. Note that the assignment completely changes the - * %vector and that the resulting %vector's size is the same as - * the number of elements assigned. Old data may be lost. - */ - void - assign(size_type __n, const value_type& __val) - { _M_fill_assign(__n, __val); } - - /** - * @brief Assigns a range to a %vector. - * @param __first An input iterator. - * @param __last An input iterator. - * - * This function fills a %vector with copies of the elements in the - * range [__first,__last). - * - * Note that the assignment completely changes the %vector and - * that the resulting %vector's size is the same as the number - * of elements assigned. Old data may be lost. - */ -#if __cplusplus >= 201103L - template> - void - assign(_InputIterator __first, _InputIterator __last) - { _M_assign_dispatch(__first, __last, __false_type()); } -#else - template - void - assign(_InputIterator __first, _InputIterator __last) - { - // Check whether it's an integral type. If so, it's not an iterator. - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Assigns an initializer list to a %vector. - * @param __l An initializer_list. - * - * This function fills a %vector with copies of the elements in the - * initializer list @a __l. - * - * Note that the assignment completely changes the %vector and - * that the resulting %vector's size is the same as the number - * of elements assigned. Old data may be lost. - */ - void - assign(initializer_list __l) - { this->assign(__l.begin(), __l.end()); } -#endif - - /// Get a copy of the memory allocation object. - using _Base::get_allocator; - - // iterators - /** - * Returns a read/write iterator that points to the first - * element in the %vector. Iteration is done in ordinary - * element order. - */ - iterator - begin() _GLIBCXX_NOEXCEPT - { return iterator(this->_M_impl._M_start); } - - /** - * Returns a read-only (constant) iterator that points to the - * first element in the %vector. Iteration is done in ordinary - * element order. - */ - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(this->_M_impl._M_start); } - - /** - * Returns a read/write iterator that points one past the last - * element in the %vector. Iteration is done in ordinary - * element order. - */ - iterator - end() _GLIBCXX_NOEXCEPT - { return iterator(this->_M_impl._M_finish); } - - /** - * Returns a read-only (constant) iterator that points one past - * the last element in the %vector. Iteration is done in - * ordinary element order. - */ - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return const_iterator(this->_M_impl._M_finish); } - - /** - * Returns a read/write reverse iterator that points to the - * last element in the %vector. Iteration is done in reverse - * element order. - */ - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return reverse_iterator(end()); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to the last element in the %vector. Iteration is done in - * reverse element order. - */ - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(end()); } - - /** - * Returns a read/write reverse iterator that points to one - * before the first element in the %vector. Iteration is done - * in reverse element order. - */ - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return reverse_iterator(begin()); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to one before the first element in the %vector. Iteration - * is done in reverse element order. - */ - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(begin()); } - -#if __cplusplus >= 201103L - /** - * Returns a read-only (constant) iterator that points to the - * first element in the %vector. Iteration is done in ordinary - * element order. - */ - const_iterator - cbegin() const noexcept - { return const_iterator(this->_M_impl._M_start); } - - /** - * Returns a read-only (constant) iterator that points one past - * the last element in the %vector. Iteration is done in - * ordinary element order. - */ - const_iterator - cend() const noexcept - { return const_iterator(this->_M_impl._M_finish); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to the last element in the %vector. Iteration is done in - * reverse element order. - */ - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(end()); } - - /** - * Returns a read-only (constant) reverse iterator that points - * to one before the first element in the %vector. Iteration - * is done in reverse element order. - */ - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(begin()); } -#endif - - // [23.2.4.2] capacity - /** Returns the number of elements in the %vector. */ - size_type - size() const _GLIBCXX_NOEXCEPT - { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); } - - /** Returns the size() of the largest possible %vector. */ - size_type - max_size() const _GLIBCXX_NOEXCEPT - { return _Alloc_traits::max_size(_M_get_Tp_allocator()); } - -#if __cplusplus >= 201103L - /** - * @brief Resizes the %vector to the specified number of elements. - * @param __new_size Number of elements the %vector should contain. - * - * This function will %resize the %vector to the specified - * number of elements. If the number is smaller than the - * %vector's current size the %vector is truncated, otherwise - * default constructed elements are appended. - */ - void - resize(size_type __new_size) - { - if (__new_size > size()) - _M_default_append(__new_size - size()); - else if (__new_size < size()) - _M_erase_at_end(this->_M_impl._M_start + __new_size); - } - - /** - * @brief Resizes the %vector to the specified number of elements. - * @param __new_size Number of elements the %vector should contain. - * @param __x Data with which new elements should be populated. - * - * This function will %resize the %vector to the specified - * number of elements. If the number is smaller than the - * %vector's current size the %vector is truncated, otherwise - * the %vector is extended and new elements are populated with - * given data. - */ - void - resize(size_type __new_size, const value_type& __x) - { - if (__new_size > size()) - insert(end(), __new_size - size(), __x); - else if (__new_size < size()) - _M_erase_at_end(this->_M_impl._M_start + __new_size); - } -#else - /** - * @brief Resizes the %vector to the specified number of elements. - * @param __new_size Number of elements the %vector should contain. - * @param __x Data with which new elements should be populated. - * - * This function will %resize the %vector to the specified - * number of elements. If the number is smaller than the - * %vector's current size the %vector is truncated, otherwise - * the %vector is extended and new elements are populated with - * given data. - */ - void - resize(size_type __new_size, value_type __x = value_type()) - { - if (__new_size > size()) - insert(end(), __new_size - size(), __x); - else if (__new_size < size()) - _M_erase_at_end(this->_M_impl._M_start + __new_size); - } -#endif - -#if __cplusplus >= 201103L - /** A non-binding request to reduce capacity() to size(). */ - void - shrink_to_fit() - { _M_shrink_to_fit(); } -#endif - - /** - * Returns the total number of elements that the %vector can - * hold before needing to allocate more memory. - */ - size_type - capacity() const _GLIBCXX_NOEXCEPT - { return size_type(this->_M_impl._M_end_of_storage - - this->_M_impl._M_start); } - - /** - * Returns true if the %vector is empty. (Thus begin() would - * equal end().) - */ - bool - empty() const _GLIBCXX_NOEXCEPT - { return begin() == end(); } - - /** - * @brief Attempt to preallocate enough memory for specified number of - * elements. - * @param __n Number of elements required. - * @throw std::length_error If @a n exceeds @c max_size(). - * - * This function attempts to reserve enough memory for the - * %vector to hold the specified number of elements. If the - * number requested is more than max_size(), length_error is - * thrown. - * - * The advantage of this function is that if optimal code is a - * necessity and the user can determine the number of elements - * that will be required, the user can reserve the memory in - * %advance, and thus prevent a possible reallocation of memory - * and copying of %vector data. - */ - void - reserve(size_type __n); - - // element access - /** - * @brief Subscript access to the data contained in the %vector. - * @param __n The index of the element for which data should be - * accessed. - * @return Read/write reference to data. - * - * This operator allows for easy, array-style, data access. - * Note that data access with this operator is unchecked and - * out_of_range lookups are not defined. (For checked lookups - * see at().) - */ - reference - operator[](size_type __n) _GLIBCXX_NOEXCEPT - { return *(this->_M_impl._M_start + __n); } - - /** - * @brief Subscript access to the data contained in the %vector. - * @param __n The index of the element for which data should be - * accessed. - * @return Read-only (constant) reference to data. - * - * This operator allows for easy, array-style, data access. - * Note that data access with this operator is unchecked and - * out_of_range lookups are not defined. (For checked lookups - * see at().) - */ - const_reference - operator[](size_type __n) const _GLIBCXX_NOEXCEPT - { return *(this->_M_impl._M_start + __n); } - - protected: - /// Safety check used only from at(). - void - _M_range_check(size_type __n) const - { - if (__n >= this->size()) - __throw_out_of_range_fmt(__N("vector::_M_range_check: __n " - "(which is %zu) >= this->size() " - "(which is %zu)"), - __n, this->size()); - } - - public: - /** - * @brief Provides access to the data contained in the %vector. - * @param __n The index of the element for which data should be - * accessed. - * @return Read/write reference to data. - * @throw std::out_of_range If @a __n is an invalid index. - * - * This function provides for safer data access. The parameter - * is first checked that it is in the range of the vector. The - * function throws out_of_range if the check fails. - */ - reference - at(size_type __n) - { - _M_range_check(__n); - return (*this)[__n]; - } - - /** - * @brief Provides access to the data contained in the %vector. - * @param __n The index of the element for which data should be - * accessed. - * @return Read-only (constant) reference to data. - * @throw std::out_of_range If @a __n is an invalid index. - * - * This function provides for safer data access. The parameter - * is first checked that it is in the range of the vector. The - * function throws out_of_range if the check fails. - */ - const_reference - at(size_type __n) const - { - _M_range_check(__n); - return (*this)[__n]; - } - - /** - * Returns a read/write reference to the data at the first - * element of the %vector. - */ - reference - front() _GLIBCXX_NOEXCEPT - { return *begin(); } - - /** - * Returns a read-only (constant) reference to the data at the first - * element of the %vector. - */ - const_reference - front() const _GLIBCXX_NOEXCEPT - { return *begin(); } - - /** - * Returns a read/write reference to the data at the last - * element of the %vector. - */ - reference - back() _GLIBCXX_NOEXCEPT - { return *(end() - 1); } - - /** - * Returns a read-only (constant) reference to the data at the - * last element of the %vector. - */ - const_reference - back() const _GLIBCXX_NOEXCEPT - { return *(end() - 1); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 464. Suggestion for new member functions in standard containers. - // data access - /** - * Returns a pointer such that [data(), data() + size()) is a valid - * range. For a non-empty %vector, data() == &front(). - */ -#if __cplusplus >= 201103L - _Tp* -#else - pointer -#endif - data() _GLIBCXX_NOEXCEPT - { return _M_data_ptr(this->_M_impl._M_start); } - -#if __cplusplus >= 201103L - const _Tp* -#else - const_pointer -#endif - data() const _GLIBCXX_NOEXCEPT - { return _M_data_ptr(this->_M_impl._M_start); } - - // [23.2.4.3] modifiers - /** - * @brief Add data to the end of the %vector. - * @param __x Data to be added. - * - * This is a typical stack operation. The function creates an - * element at the end of the %vector and assigns the given data - * to it. Due to the nature of a %vector this operation can be - * done in constant time if the %vector has preallocated space - * available. - */ - void - push_back(const value_type& __x) - { - if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) - { - _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, - __x); - ++this->_M_impl._M_finish; - } - else -#if __cplusplus >= 201103L - _M_emplace_back_aux(__x); -#else - _M_insert_aux(end(), __x); -#endif - } - -#if __cplusplus >= 201103L - void - push_back(value_type&& __x) - { emplace_back(std::move(__x)); } - - template - void - emplace_back(_Args&&... __args); -#endif - - /** - * @brief Removes last element. - * - * This is a typical stack operation. It shrinks the %vector by one. - * - * Note that no data is returned, and if the last element's - * data is needed, it should be retrieved before pop_back() is - * called. - */ - void - pop_back() _GLIBCXX_NOEXCEPT - { - --this->_M_impl._M_finish; - _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish); - } - -#if __cplusplus >= 201103L - /** - * @brief Inserts an object in %vector before specified iterator. - * @param __position A const_iterator into the %vector. - * @param __args Arguments. - * @return An iterator that points to the inserted data. - * - * This function will insert an object of type T constructed - * with T(std::forward(args)...) before the specified location. - * Note that this kind of operation could be expensive for a %vector - * and if it is frequently used the user should consider using - * std::list. - */ - template - iterator - emplace(const_iterator __position, _Args&&... __args); - - /** - * @brief Inserts given value into %vector before specified iterator. - * @param __position A const_iterator into the %vector. - * @param __x Data to be inserted. - * @return An iterator that points to the inserted data. - * - * This function will insert a copy of the given value before - * the specified location. Note that this kind of operation - * could be expensive for a %vector and if it is frequently - * used the user should consider using std::list. - */ - iterator - insert(const_iterator __position, const value_type& __x); -#else - /** - * @brief Inserts given value into %vector before specified iterator. - * @param __position An iterator into the %vector. - * @param __x Data to be inserted. - * @return An iterator that points to the inserted data. - * - * This function will insert a copy of the given value before - * the specified location. Note that this kind of operation - * could be expensive for a %vector and if it is frequently - * used the user should consider using std::list. - */ - iterator - insert(iterator __position, const value_type& __x); -#endif - -#if __cplusplus >= 201103L - /** - * @brief Inserts given rvalue into %vector before specified iterator. - * @param __position A const_iterator into the %vector. - * @param __x Data to be inserted. - * @return An iterator that points to the inserted data. - * - * This function will insert a copy of the given rvalue before - * the specified location. Note that this kind of operation - * could be expensive for a %vector and if it is frequently - * used the user should consider using std::list. - */ - iterator - insert(const_iterator __position, value_type&& __x) - { return emplace(__position, std::move(__x)); } - - /** - * @brief Inserts an initializer_list into the %vector. - * @param __position An iterator into the %vector. - * @param __l An initializer_list. - * - * This function will insert copies of the data in the - * initializer_list @a l into the %vector before the location - * specified by @a position. - * - * Note that this kind of operation could be expensive for a - * %vector and if it is frequently used the user should - * consider using std::list. - */ - iterator - insert(const_iterator __position, initializer_list __l) - { return this->insert(__position, __l.begin(), __l.end()); } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Inserts a number of copies of given data into the %vector. - * @param __position A const_iterator into the %vector. - * @param __n Number of elements to be inserted. - * @param __x Data to be inserted. - * @return An iterator that points to the inserted data. - * - * This function will insert a specified number of copies of - * the given data before the location specified by @a position. - * - * Note that this kind of operation could be expensive for a - * %vector and if it is frequently used the user should - * consider using std::list. - */ - iterator - insert(const_iterator __position, size_type __n, const value_type& __x) - { - difference_type __offset = __position - cbegin(); - _M_fill_insert(begin() + __offset, __n, __x); - return begin() + __offset; - } -#else - /** - * @brief Inserts a number of copies of given data into the %vector. - * @param __position An iterator into the %vector. - * @param __n Number of elements to be inserted. - * @param __x Data to be inserted. - * - * This function will insert a specified number of copies of - * the given data before the location specified by @a position. - * - * Note that this kind of operation could be expensive for a - * %vector and if it is frequently used the user should - * consider using std::list. - */ - void - insert(iterator __position, size_type __n, const value_type& __x) - { _M_fill_insert(__position, __n, __x); } -#endif - -#if __cplusplus >= 201103L - /** - * @brief Inserts a range into the %vector. - * @param __position A const_iterator into the %vector. - * @param __first An input iterator. - * @param __last An input iterator. - * @return An iterator that points to the inserted data. - * - * This function will insert copies of the data in the range - * [__first,__last) into the %vector before the location specified - * by @a pos. - * - * Note that this kind of operation could be expensive for a - * %vector and if it is frequently used the user should - * consider using std::list. - */ - template> - iterator - insert(const_iterator __position, _InputIterator __first, - _InputIterator __last) - { - difference_type __offset = __position - cbegin(); - _M_insert_dispatch(begin() + __offset, - __first, __last, __false_type()); - return begin() + __offset; - } -#else - /** - * @brief Inserts a range into the %vector. - * @param __position An iterator into the %vector. - * @param __first An input iterator. - * @param __last An input iterator. - * - * This function will insert copies of the data in the range - * [__first,__last) into the %vector before the location specified - * by @a pos. - * - * Note that this kind of operation could be expensive for a - * %vector and if it is frequently used the user should - * consider using std::list. - */ - template - void - insert(iterator __position, _InputIterator __first, - _InputIterator __last) - { - // Check whether it's an integral type. If so, it's not an iterator. - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - _M_insert_dispatch(__position, __first, __last, _Integral()); - } -#endif - - /** - * @brief Remove element at given position. - * @param __position Iterator pointing to element to be erased. - * @return An iterator pointing to the next element (or end()). - * - * This function will erase the element at the given position and thus - * shorten the %vector by one. - * - * Note This operation could be expensive and if it is - * frequently used the user should consider using std::list. - * The user is also cautioned that this function only erases - * the element, and that if the element is itself a pointer, - * the pointed-to memory is not touched in any way. Managing - * the pointer is the user's responsibility. - */ - iterator -#if __cplusplus >= 201103L - erase(const_iterator __position) - { return _M_erase(begin() + (__position - cbegin())); } -#else - erase(iterator __position) - { return _M_erase(__position); } -#endif - - /** - * @brief Remove a range of elements. - * @param __first Iterator pointing to the first element to be erased. - * @param __last Iterator pointing to one past the last element to be - * erased. - * @return An iterator pointing to the element pointed to by @a __last - * prior to erasing (or end()). - * - * This function will erase the elements in the range - * [__first,__last) and shorten the %vector accordingly. - * - * Note This operation could be expensive and if it is - * frequently used the user should consider using std::list. - * The user is also cautioned that this function only erases - * the elements, and that if the elements themselves are - * pointers, the pointed-to memory is not touched in any way. - * Managing the pointer is the user's responsibility. - */ - iterator -#if __cplusplus >= 201103L - erase(const_iterator __first, const_iterator __last) - { - const auto __beg = begin(); - const auto __cbeg = cbegin(); - return _M_erase(__beg + (__first - __cbeg), __beg + (__last - __cbeg)); - } -#else - erase(iterator __first, iterator __last) - { return _M_erase(__first, __last); } -#endif - - /** - * @brief Swaps data with another %vector. - * @param __x A %vector of the same element and allocator types. - * - * This exchanges the elements between two vectors in constant time. - * (Three pointers, so it should be quite fast.) - * Note that the global std::swap() function is specialized such that - * std::swap(v1,v2) will feed to this function. - */ - void - swap(vector& __x) -#if __cplusplus >= 201103L - noexcept(_Alloc_traits::_S_nothrow_swap()) -#endif - { - this->_M_impl._M_swap_data(__x._M_impl); - _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(), - __x._M_get_Tp_allocator()); - } - - /** - * Erases all the elements. Note that this function only erases the - * elements, and that if the elements themselves are pointers, the - * pointed-to memory is not touched in any way. Managing the pointer is - * the user's responsibility. - */ - void - clear() _GLIBCXX_NOEXCEPT - { _M_erase_at_end(this->_M_impl._M_start); } - - protected: - /** - * Memory expansion handler. Uses the member allocation function to - * obtain @a n bytes of memory, and then copies [first,last) into it. - */ - template - pointer - _M_allocate_and_copy(size_type __n, - _ForwardIterator __first, _ForwardIterator __last) - { - pointer __result = this->_M_allocate(__n); - __try - { - std::__uninitialized_copy_a(__first, __last, __result, - _M_get_Tp_allocator()); - return __result; - } - __catch(...) - { - _M_deallocate(__result, __n); - __throw_exception_again; - } - } - - - // Internal constructor functions follow. - - // Called by the range constructor to implement [23.1.1]/9 - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 438. Ambiguity in the "do the right thing" clause - template - void - _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type) - { - this->_M_impl._M_start = _M_allocate(static_cast(__n)); - this->_M_impl._M_end_of_storage = - this->_M_impl._M_start + static_cast(__n); - _M_fill_initialize(static_cast(__n), __value); - } - - // Called by the range constructor to implement [23.1.1]/9 - template - void - _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, - __false_type) - { - typedef typename std::iterator_traits<_InputIterator>:: - iterator_category _IterCategory; - _M_range_initialize(__first, __last, _IterCategory()); - } - - // Called by the second initialize_dispatch above - template - void - _M_range_initialize(_InputIterator __first, - _InputIterator __last, std::input_iterator_tag) - { - for (; __first != __last; ++__first) -#if __cplusplus >= 201103L - emplace_back(*__first); -#else - push_back(*__first); -#endif - } - - // Called by the second initialize_dispatch above - template - void - _M_range_initialize(_ForwardIterator __first, - _ForwardIterator __last, std::forward_iterator_tag) - { - const size_type __n = std::distance(__first, __last); - this->_M_impl._M_start = this->_M_allocate(__n); - this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; - this->_M_impl._M_finish = - std::__uninitialized_copy_a(__first, __last, - this->_M_impl._M_start, - _M_get_Tp_allocator()); - } - - // Called by the first initialize_dispatch above and by the - // vector(n,value,a) constructor. - void - _M_fill_initialize(size_type __n, const value_type& __value) - { - this->_M_impl._M_finish = - std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value, - _M_get_Tp_allocator()); - } - -#if __cplusplus >= 201103L - // Called by the vector(n) constructor. - void - _M_default_initialize(size_type __n) - { - this->_M_impl._M_finish = - std::__uninitialized_default_n_a(this->_M_impl._M_start, __n, - _M_get_Tp_allocator()); - } -#endif - - // Internal assign functions follow. The *_aux functions do the actual - // assignment work for the range versions. - - // Called by the range assign to implement [23.1.1]/9 - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 438. Ambiguity in the "do the right thing" clause - template - void - _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) - { _M_fill_assign(__n, __val); } - - // Called by the range assign to implement [23.1.1]/9 - template - void - _M_assign_dispatch(_InputIterator __first, _InputIterator __last, - __false_type) - { - typedef typename std::iterator_traits<_InputIterator>:: - iterator_category _IterCategory; - _M_assign_aux(__first, __last, _IterCategory()); - } - - // Called by the second assign_dispatch above - template - void - _M_assign_aux(_InputIterator __first, _InputIterator __last, - std::input_iterator_tag); - - // Called by the second assign_dispatch above - template - void - _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, - std::forward_iterator_tag); - - // Called by assign(n,t), and the range assign when it turns out - // to be the same thing. - void - _M_fill_assign(size_type __n, const value_type& __val); - - - // Internal insert functions follow. - - // Called by the range insert to implement [23.1.1]/9 - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 438. Ambiguity in the "do the right thing" clause - template - void - _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, - __true_type) - { _M_fill_insert(__pos, __n, __val); } - - // Called by the range insert to implement [23.1.1]/9 - template - void - _M_insert_dispatch(iterator __pos, _InputIterator __first, - _InputIterator __last, __false_type) - { - typedef typename std::iterator_traits<_InputIterator>:: - iterator_category _IterCategory; - _M_range_insert(__pos, __first, __last, _IterCategory()); - } - - // Called by the second insert_dispatch above - template - void - _M_range_insert(iterator __pos, _InputIterator __first, - _InputIterator __last, std::input_iterator_tag); - - // Called by the second insert_dispatch above - template - void - _M_range_insert(iterator __pos, _ForwardIterator __first, - _ForwardIterator __last, std::forward_iterator_tag); - - // Called by insert(p,n,x), and the range insert when it turns out to be - // the same thing. - void - _M_fill_insert(iterator __pos, size_type __n, const value_type& __x); - -#if __cplusplus >= 201103L - // Called by resize(n). - void - _M_default_append(size_type __n); - - bool - _M_shrink_to_fit(); -#endif - - // Called by insert(p,x) -#if __cplusplus < 201103L - void - _M_insert_aux(iterator __position, const value_type& __x); -#else - template - void - _M_insert_aux(iterator __position, _Args&&... __args); - - template - void - _M_emplace_back_aux(_Args&&... __args); -#endif - - // Called by the latter. - size_type - _M_check_len(size_type __n, const char* __s) const - { - if (max_size() - size() < __n) - __throw_length_error(__N(__s)); - - const size_type __len = size() + std::max(size(), __n); - return (__len < size() || __len > max_size()) ? max_size() : __len; - } - - // Internal erase functions follow. - - // Called by erase(q1,q2), clear(), resize(), _M_fill_assign, - // _M_assign_aux. - void - _M_erase_at_end(pointer __pos) _GLIBCXX_NOEXCEPT - { - std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator()); - this->_M_impl._M_finish = __pos; - } - - iterator - _M_erase(iterator __position); - - iterator - _M_erase(iterator __first, iterator __last); - -#if __cplusplus >= 201103L - private: - // Constant-time move assignment when source object's memory can be - // moved, either because the source's allocator will move too - // or because the allocators are equal. - void - _M_move_assign(vector&& __x, std::true_type) noexcept - { - vector __tmp(get_allocator()); - this->_M_impl._M_swap_data(__tmp._M_impl); - this->_M_impl._M_swap_data(__x._M_impl); - std::__alloc_on_move(_M_get_Tp_allocator(), __x._M_get_Tp_allocator()); - } - - // Do move assignment when it might not be possible to move source - // object's memory, resulting in a linear-time operation. - void - _M_move_assign(vector&& __x, std::false_type) - { - if (__x._M_get_Tp_allocator() == this->_M_get_Tp_allocator()) - _M_move_assign(std::move(__x), std::true_type()); - else - { - // The rvalue's allocator cannot be moved and is not equal, - // so we need to individually move each element. - this->assign(std::__make_move_if_noexcept_iterator(__x.begin()), - std::__make_move_if_noexcept_iterator(__x.end())); - __x.clear(); - } - } -#endif - -#if __cplusplus >= 201103L - template - _Up* - _M_data_ptr(_Up* __ptr) const - { return __ptr; } - - template - typename std::pointer_traits<_Ptr>::element_type* - _M_data_ptr(_Ptr __ptr) const - { return empty() ? nullptr : std::__addressof(*__ptr); } -#else - template - _Ptr - _M_data_ptr(_Ptr __ptr) const - { return __ptr; } -#endif - }; - - - /** - * @brief Vector equality comparison. - * @param __x A %vector. - * @param __y A %vector of the same type as @a __x. - * @return True iff the size and elements of the vectors are equal. - * - * This is an equivalence relation. It is linear in the size of the - * vectors. Vectors are considered equivalent if their sizes are equal, - * and if corresponding elements compare equal. - */ - template - inline bool - operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) - { return (__x.size() == __y.size() - && std::equal(__x.begin(), __x.end(), __y.begin())); } - - /** - * @brief Vector ordering relation. - * @param __x A %vector. - * @param __y A %vector of the same type as @a __x. - * @return True iff @a __x is lexicographically less than @a __y. - * - * This is a total ordering relation. It is linear in the size of the - * vectors. The elements must be comparable with @c <. - * - * See std::lexicographical_compare() for how the determination is made. - */ - template - inline bool - operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) - { return std::lexicographical_compare(__x.begin(), __x.end(), - __y.begin(), __y.end()); } - - /// Based on operator== - template - inline bool - operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) - { return !(__x == __y); } - - /// Based on operator< - template - inline bool - operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) - { return __y < __x; } - - /// Based on operator< - template - inline bool - operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) - { return !(__y < __x); } - - /// Based on operator< - template - inline bool - operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) - { return !(__x < __y); } - - /// See std::vector::swap(). - template - inline void - swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y) - { __x.swap(__y); } - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#endif /* _STL_VECTOR_H */ diff --git a/openflow/usr/include/c++/5/bits/stream_iterator.h b/openflow/usr/include/c++/5/bits/stream_iterator.h deleted file mode 100644 index 270b01b..0000000 --- a/openflow/usr/include/c++/5/bits/stream_iterator.h +++ /dev/null @@ -1,221 +0,0 @@ -// Stream iterators - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/stream_iterator.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iterator} - */ - -#ifndef _STREAM_ITERATOR_H -#define _STREAM_ITERATOR_H 1 - -#pragma GCC system_header - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup iterators - * @{ - */ - - /// Provides input iterator semantics for streams. - template, typename _Dist = ptrdiff_t> - class istream_iterator - : public iterator - { - public: - typedef _CharT char_type; - typedef _Traits traits_type; - typedef basic_istream<_CharT, _Traits> istream_type; - - private: - istream_type* _M_stream; - _Tp _M_value; - bool _M_ok; - - public: - /// Construct end of input stream iterator. - _GLIBCXX_CONSTEXPR istream_iterator() - : _M_stream(0), _M_value(), _M_ok(false) {} - - /// Construct start of input stream iterator. - istream_iterator(istream_type& __s) - : _M_stream(&__s) - { _M_read(); } - - istream_iterator(const istream_iterator& __obj) - : _M_stream(__obj._M_stream), _M_value(__obj._M_value), - _M_ok(__obj._M_ok) - { } - - const _Tp& - operator*() const - { - __glibcxx_requires_cond(_M_ok, - _M_message(__gnu_debug::__msg_deref_istream) - ._M_iterator(*this)); - return _M_value; - } - - const _Tp* - operator->() const { return &(operator*()); } - - istream_iterator& - operator++() - { - __glibcxx_requires_cond(_M_ok, - _M_message(__gnu_debug::__msg_inc_istream) - ._M_iterator(*this)); - _M_read(); - return *this; - } - - istream_iterator - operator++(int) - { - __glibcxx_requires_cond(_M_ok, - _M_message(__gnu_debug::__msg_inc_istream) - ._M_iterator(*this)); - istream_iterator __tmp = *this; - _M_read(); - return __tmp; - } - - bool - _M_equal(const istream_iterator& __x) const - { return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream); } - - private: - void - _M_read() - { - _M_ok = (_M_stream && *_M_stream) ? true : false; - if (_M_ok) - { - *_M_stream >> _M_value; - _M_ok = *_M_stream ? true : false; - } - } - }; - - /// Return true if x and y are both end or not end, or x and y are the same. - template - inline bool - operator==(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x, - const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) - { return __x._M_equal(__y); } - - /// Return false if x and y are both end or not end, or x and y are the same. - template - inline bool - operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x, - const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) - { return !__x._M_equal(__y); } - - /** - * @brief Provides output iterator semantics for streams. - * - * This class provides an iterator to write to an ostream. The type Tp is - * the only type written by this iterator and there must be an - * operator<<(Tp) defined. - * - * @tparam _Tp The type to write to the ostream. - * @tparam _CharT The ostream char_type. - * @tparam _Traits The ostream char_traits. - */ - template > - class ostream_iterator - : public iterator - { - public: - //@{ - /// Public typedef - typedef _CharT char_type; - typedef _Traits traits_type; - typedef basic_ostream<_CharT, _Traits> ostream_type; - //@} - - private: - ostream_type* _M_stream; - const _CharT* _M_string; - - public: - /// Construct from an ostream. - ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {} - - /** - * Construct from an ostream. - * - * The delimiter string @a c is written to the stream after every Tp - * written to the stream. The delimiter is not copied, and thus must - * not be destroyed while this iterator is in use. - * - * @param __s Underlying ostream to write to. - * @param __c CharT delimiter string to insert. - */ - ostream_iterator(ostream_type& __s, const _CharT* __c) - : _M_stream(&__s), _M_string(__c) { } - - /// Copy constructor. - ostream_iterator(const ostream_iterator& __obj) - : _M_stream(__obj._M_stream), _M_string(__obj._M_string) { } - - /// Writes @a value to underlying ostream using operator<<. If - /// constructed with delimiter string, writes delimiter to ostream. - ostream_iterator& - operator=(const _Tp& __value) - { - __glibcxx_requires_cond(_M_stream != 0, - _M_message(__gnu_debug::__msg_output_ostream) - ._M_iterator(*this)); - *_M_stream << __value; - if (_M_string) *_M_stream << _M_string; - return *this; - } - - ostream_iterator& - operator*() - { return *this; } - - ostream_iterator& - operator++() - { return *this; } - - ostream_iterator& - operator++(int) - { return *this; } - }; - - // @} group iterators - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/bits/streambuf.tcc b/openflow/usr/include/c++/5/bits/streambuf.tcc deleted file mode 100644 index 76f8513..0000000 --- a/openflow/usr/include/c++/5/bits/streambuf.tcc +++ /dev/null @@ -1,175 +0,0 @@ -// Stream buffer classes -*- C++ -*- - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/streambuf.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{streambuf} - */ - -// -// ISO C++ 14882: 27.5 Stream buffers -// - -#ifndef _STREAMBUF_TCC -#define _STREAMBUF_TCC 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - streamsize - basic_streambuf<_CharT, _Traits>:: - xsgetn(char_type* __s, streamsize __n) - { - streamsize __ret = 0; - while (__ret < __n) - { - const streamsize __buf_len = this->egptr() - this->gptr(); - if (__buf_len) - { - const streamsize __remaining = __n - __ret; - const streamsize __len = std::min(__buf_len, __remaining); - traits_type::copy(__s, this->gptr(), __len); - __ret += __len; - __s += __len; - this->__safe_gbump(__len); - } - - if (__ret < __n) - { - const int_type __c = this->uflow(); - if (!traits_type::eq_int_type(__c, traits_type::eof())) - { - traits_type::assign(*__s++, traits_type::to_char_type(__c)); - ++__ret; - } - else - break; - } - } - return __ret; - } - - template - streamsize - basic_streambuf<_CharT, _Traits>:: - xsputn(const char_type* __s, streamsize __n) - { - streamsize __ret = 0; - while (__ret < __n) - { - const streamsize __buf_len = this->epptr() - this->pptr(); - if (__buf_len) - { - const streamsize __remaining = __n - __ret; - const streamsize __len = std::min(__buf_len, __remaining); - traits_type::copy(this->pptr(), __s, __len); - __ret += __len; - __s += __len; - this->__safe_pbump(__len); - } - - if (__ret < __n) - { - int_type __c = this->overflow(traits_type::to_int_type(*__s)); - if (!traits_type::eq_int_type(__c, traits_type::eof())) - { - ++__ret; - ++__s; - } - else - break; - } - } - return __ret; - } - - // Conceivably, this could be used to implement buffer-to-buffer - // copies, if this was ever desired in an un-ambiguous way by the - // standard. - template - streamsize - __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>* __sbin, - basic_streambuf<_CharT, _Traits>* __sbout, - bool& __ineof) - { - streamsize __ret = 0; - __ineof = true; - typename _Traits::int_type __c = __sbin->sgetc(); - while (!_Traits::eq_int_type(__c, _Traits::eof())) - { - __c = __sbout->sputc(_Traits::to_char_type(__c)); - if (_Traits::eq_int_type(__c, _Traits::eof())) - { - __ineof = false; - break; - } - ++__ret; - __c = __sbin->snextc(); - } - return __ret; - } - - template - inline streamsize - __copy_streambufs(basic_streambuf<_CharT, _Traits>* __sbin, - basic_streambuf<_CharT, _Traits>* __sbout) - { - bool __ineof; - return __copy_streambufs_eof(__sbin, __sbout, __ineof); - } - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template class basic_streambuf; - extern template - streamsize - __copy_streambufs(basic_streambuf*, - basic_streambuf*); - extern template - streamsize - __copy_streambufs_eof(basic_streambuf*, - basic_streambuf*, bool&); - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template class basic_streambuf; - extern template - streamsize - __copy_streambufs(basic_streambuf*, - basic_streambuf*); - extern template - streamsize - __copy_streambufs_eof(basic_streambuf*, - basic_streambuf*, bool&); -#endif -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/bits/streambuf_iterator.h b/openflow/usr/include/c++/5/bits/streambuf_iterator.h deleted file mode 100644 index 372b232..0000000 --- a/openflow/usr/include/c++/5/bits/streambuf_iterator.h +++ /dev/null @@ -1,412 +0,0 @@ -// Streambuf iterators - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/streambuf_iterator.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iterator} - */ - -#ifndef _STREAMBUF_ITERATOR_H -#define _STREAMBUF_ITERATOR_H 1 - -#pragma GCC system_header - -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup iterators - * @{ - */ - - // 24.5.3 Template class istreambuf_iterator - /// Provides input iterator semantics for streambufs. - template - class istreambuf_iterator - : public iterator= 201103L - // LWG 445. - _CharT> -#else - _CharT&> -#endif - { - public: - // Types: - //@{ - /// Public typedefs - typedef _CharT char_type; - typedef _Traits traits_type; - typedef typename _Traits::int_type int_type; - typedef basic_streambuf<_CharT, _Traits> streambuf_type; - typedef basic_istream<_CharT, _Traits> istream_type; - //@} - - template - friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, - ostreambuf_iterator<_CharT2> >::__type - copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, - ostreambuf_iterator<_CharT2>); - - template - friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, - _CharT2*>::__type - __copy_move_a2(istreambuf_iterator<_CharT2>, - istreambuf_iterator<_CharT2>, _CharT2*); - - template - friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, - istreambuf_iterator<_CharT2> >::__type - find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, - const _CharT2&); - - private: - // 24.5.3 istreambuf_iterator - // p 1 - // If the end of stream is reached (streambuf_type::sgetc() - // returns traits_type::eof()), the iterator becomes equal to - // the "end of stream" iterator value. - // NB: This implementation assumes the "end of stream" value - // is EOF, or -1. - mutable streambuf_type* _M_sbuf; - mutable int_type _M_c; - - public: - /// Construct end of input stream iterator. - _GLIBCXX_CONSTEXPR istreambuf_iterator() _GLIBCXX_USE_NOEXCEPT - : _M_sbuf(0), _M_c(traits_type::eof()) { } - -#if __cplusplus >= 201103L - istreambuf_iterator(const istreambuf_iterator&) noexcept = default; - - ~istreambuf_iterator() = default; -#endif - - /// Construct start of input stream iterator. - istreambuf_iterator(istream_type& __s) _GLIBCXX_USE_NOEXCEPT - : _M_sbuf(__s.rdbuf()), _M_c(traits_type::eof()) { } - - /// Construct start of streambuf iterator. - istreambuf_iterator(streambuf_type* __s) _GLIBCXX_USE_NOEXCEPT - : _M_sbuf(__s), _M_c(traits_type::eof()) { } - - /// Return the current character pointed to by iterator. This returns - /// streambuf.sgetc(). It cannot be assigned. NB: The result of - /// operator*() on an end of stream is undefined. - char_type - operator*() const - { -#ifdef _GLIBCXX_DEBUG_PEDANTIC - // Dereferencing a past-the-end istreambuf_iterator is a - // libstdc++ extension - __glibcxx_requires_cond(!_M_at_eof(), - _M_message(__gnu_debug::__msg_deref_istreambuf) - ._M_iterator(*this)); -#endif - return traits_type::to_char_type(_M_get()); - } - - /// Advance the iterator. Calls streambuf.sbumpc(). - istreambuf_iterator& - operator++() - { - __glibcxx_requires_cond(!_M_at_eof(), - _M_message(__gnu_debug::__msg_inc_istreambuf) - ._M_iterator(*this)); - if (_M_sbuf) - { - _M_sbuf->sbumpc(); - _M_c = traits_type::eof(); - } - return *this; - } - - /// Advance the iterator. Calls streambuf.sbumpc(). - istreambuf_iterator - operator++(int) - { - __glibcxx_requires_cond(!_M_at_eof(), - _M_message(__gnu_debug::__msg_inc_istreambuf) - ._M_iterator(*this)); - - istreambuf_iterator __old = *this; - if (_M_sbuf) - { - __old._M_c = _M_sbuf->sbumpc(); - _M_c = traits_type::eof(); - } - return __old; - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 110 istreambuf_iterator::equal not const - // NB: there is also number 111 (NAD, Future) pending on this function. - /// Return true both iterators are end or both are not end. - bool - equal(const istreambuf_iterator& __b) const - { return _M_at_eof() == __b._M_at_eof(); } - - private: - int_type - _M_get() const - { - const int_type __eof = traits_type::eof(); - int_type __ret = __eof; - if (_M_sbuf) - { - if (!traits_type::eq_int_type(_M_c, __eof)) - __ret = _M_c; - else if (!traits_type::eq_int_type((__ret = _M_sbuf->sgetc()), - __eof)) - _M_c = __ret; - else - _M_sbuf = 0; - } - return __ret; - } - - bool - _M_at_eof() const - { - const int_type __eof = traits_type::eof(); - return traits_type::eq_int_type(_M_get(), __eof); - } - }; - - template - inline bool - operator==(const istreambuf_iterator<_CharT, _Traits>& __a, - const istreambuf_iterator<_CharT, _Traits>& __b) - { return __a.equal(__b); } - - template - inline bool - operator!=(const istreambuf_iterator<_CharT, _Traits>& __a, - const istreambuf_iterator<_CharT, _Traits>& __b) - { return !__a.equal(__b); } - - /// Provides output iterator semantics for streambufs. - template - class ostreambuf_iterator - : public iterator - { - public: - // Types: - //@{ - /// Public typedefs - typedef _CharT char_type; - typedef _Traits traits_type; - typedef basic_streambuf<_CharT, _Traits> streambuf_type; - typedef basic_ostream<_CharT, _Traits> ostream_type; - //@} - - template - friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, - ostreambuf_iterator<_CharT2> >::__type - copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, - ostreambuf_iterator<_CharT2>); - - private: - streambuf_type* _M_sbuf; - bool _M_failed; - - public: - /// Construct output iterator from ostream. - ostreambuf_iterator(ostream_type& __s) _GLIBCXX_USE_NOEXCEPT - : _M_sbuf(__s.rdbuf()), _M_failed(!_M_sbuf) { } - - /// Construct output iterator from streambuf. - ostreambuf_iterator(streambuf_type* __s) _GLIBCXX_USE_NOEXCEPT - : _M_sbuf(__s), _M_failed(!_M_sbuf) { } - - /// Write character to streambuf. Calls streambuf.sputc(). - ostreambuf_iterator& - operator=(_CharT __c) - { - if (!_M_failed && - _Traits::eq_int_type(_M_sbuf->sputc(__c), _Traits::eof())) - _M_failed = true; - return *this; - } - - /// Return *this. - ostreambuf_iterator& - operator*() - { return *this; } - - /// Return *this. - ostreambuf_iterator& - operator++(int) - { return *this; } - - /// Return *this. - ostreambuf_iterator& - operator++() - { return *this; } - - /// Return true if previous operator=() failed. - bool - failed() const _GLIBCXX_USE_NOEXCEPT - { return _M_failed; } - - ostreambuf_iterator& - _M_put(const _CharT* __ws, streamsize __len) - { - if (__builtin_expect(!_M_failed, true) - && __builtin_expect(this->_M_sbuf->sputn(__ws, __len) != __len, - false)) - _M_failed = true; - return *this; - } - }; - - // Overloads for streambuf iterators. - template - typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, - ostreambuf_iterator<_CharT> >::__type - copy(istreambuf_iterator<_CharT> __first, - istreambuf_iterator<_CharT> __last, - ostreambuf_iterator<_CharT> __result) - { - if (__first._M_sbuf && !__last._M_sbuf && !__result._M_failed) - { - bool __ineof; - __copy_streambufs_eof(__first._M_sbuf, __result._M_sbuf, __ineof); - if (!__ineof) - __result._M_failed = true; - } - return __result; - } - - template - typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, - ostreambuf_iterator<_CharT> >::__type - __copy_move_a2(_CharT* __first, _CharT* __last, - ostreambuf_iterator<_CharT> __result) - { - const streamsize __num = __last - __first; - if (__num > 0) - __result._M_put(__first, __num); - return __result; - } - - template - typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, - ostreambuf_iterator<_CharT> >::__type - __copy_move_a2(const _CharT* __first, const _CharT* __last, - ostreambuf_iterator<_CharT> __result) - { - const streamsize __num = __last - __first; - if (__num > 0) - __result._M_put(__first, __num); - return __result; - } - - template - typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, - _CharT*>::__type - __copy_move_a2(istreambuf_iterator<_CharT> __first, - istreambuf_iterator<_CharT> __last, _CharT* __result) - { - typedef istreambuf_iterator<_CharT> __is_iterator_type; - typedef typename __is_iterator_type::traits_type traits_type; - typedef typename __is_iterator_type::streambuf_type streambuf_type; - typedef typename traits_type::int_type int_type; - - if (__first._M_sbuf && !__last._M_sbuf) - { - streambuf_type* __sb = __first._M_sbuf; - int_type __c = __sb->sgetc(); - while (!traits_type::eq_int_type(__c, traits_type::eof())) - { - const streamsize __n = __sb->egptr() - __sb->gptr(); - if (__n > 1) - { - traits_type::copy(__result, __sb->gptr(), __n); - __sb->__safe_gbump(__n); - __result += __n; - __c = __sb->underflow(); - } - else - { - *__result++ = traits_type::to_char_type(__c); - __c = __sb->snextc(); - } - } - } - return __result; - } - - template - typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, - istreambuf_iterator<_CharT> >::__type - find(istreambuf_iterator<_CharT> __first, - istreambuf_iterator<_CharT> __last, const _CharT& __val) - { - typedef istreambuf_iterator<_CharT> __is_iterator_type; - typedef typename __is_iterator_type::traits_type traits_type; - typedef typename __is_iterator_type::streambuf_type streambuf_type; - typedef typename traits_type::int_type int_type; - - if (__first._M_sbuf && !__last._M_sbuf) - { - const int_type __ival = traits_type::to_int_type(__val); - streambuf_type* __sb = __first._M_sbuf; - int_type __c = __sb->sgetc(); - while (!traits_type::eq_int_type(__c, traits_type::eof()) - && !traits_type::eq_int_type(__c, __ival)) - { - streamsize __n = __sb->egptr() - __sb->gptr(); - if (__n > 1) - { - const _CharT* __p = traits_type::find(__sb->gptr(), - __n, __val); - if (__p) - __n = __p - __sb->gptr(); - __sb->__safe_gbump(__n); - __c = __sb->sgetc(); - } - else - __c = __sb->snextc(); - } - - if (!traits_type::eq_int_type(__c, traits_type::eof())) - __first._M_c = __c; - else - __first._M_sbuf = 0; - } - return __first; - } - -// @} group iterators - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/bits/stringfwd.h b/openflow/usr/include/c++/5/bits/stringfwd.h deleted file mode 100644 index f1a5e87..0000000 --- a/openflow/usr/include/c++/5/bits/stringfwd.h +++ /dev/null @@ -1,97 +0,0 @@ -// Forward declarations -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/stringfwd.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{string} - */ - -// -// ISO C++ 14882: 21 Strings library -// - -#ifndef _STRINGFWD_H -#define _STRINGFWD_H 1 - -#pragma GCC system_header - -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @defgroup strings Strings - * - * @{ - */ - - template - struct char_traits; - - template<> struct char_traits; - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> struct char_traits; -#endif - -#if ((__cplusplus >= 201103L) \ - && defined(_GLIBCXX_USE_C99_STDINT_TR1)) - template<> struct char_traits; - template<> struct char_traits; -#endif - -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - - template, - typename _Alloc = allocator<_CharT> > - class basic_string; - - /// A string of @c char - typedef basic_string string; - -#ifdef _GLIBCXX_USE_WCHAR_T - /// A string of @c wchar_t - typedef basic_string wstring; -#endif - -#if ((__cplusplus >= 201103L) \ - && defined(_GLIBCXX_USE_C99_STDINT_TR1)) - /// A string of @c char16_t - typedef basic_string u16string; - - /// A string of @c char32_t - typedef basic_string u32string; -#endif - -_GLIBCXX_END_NAMESPACE_CXX11 - - /** @} */ - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif // _STRINGFWD_H diff --git a/openflow/usr/include/c++/5/bits/unique_ptr.h b/openflow/usr/include/c++/5/bits/unique_ptr.h deleted file mode 100644 index 59078d7..0000000 --- a/openflow/usr/include/c++/5/bits/unique_ptr.h +++ /dev/null @@ -1,784 +0,0 @@ -// unique_ptr implementation -*- C++ -*- - -// Copyright (C) 2008-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/unique_ptr.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{memory} - */ - -#ifndef _UNIQUE_PTR_H -#define _UNIQUE_PTR_H 1 - -#include -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @addtogroup pointer_abstractions - * @{ - */ - -#if _GLIBCXX_USE_DEPRECATED - template class auto_ptr; -#endif - - /// Primary template of default_delete, used by unique_ptr - template - struct default_delete - { - /// Default constructor - constexpr default_delete() noexcept = default; - - /** @brief Converting constructor. - * - * Allows conversion from a deleter for arrays of another type, @p _Up, - * only if @p _Up* is convertible to @p _Tp*. - */ - template::value>::type> - default_delete(const default_delete<_Up>&) noexcept { } - - /// Calls @c delete @p __ptr - void - operator()(_Tp* __ptr) const - { - static_assert(!is_void<_Tp>::value, - "can't delete pointer to incomplete type"); - static_assert(sizeof(_Tp)>0, - "can't delete pointer to incomplete type"); - delete __ptr; - } - }; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 740 - omit specialization for array objects with a compile time length - /// Specialization for arrays, default_delete. - template - struct default_delete<_Tp[]> - { - private: - template - using __remove_cv = typename remove_cv<_Up>::type; - - // Like is_base_of<_Tp, _Up> but false if unqualified types are the same - template - using __is_derived_Tp - = __and_< is_base_of<_Tp, _Up>, - __not_, __remove_cv<_Up>>> >; - - public: - /// Default constructor - constexpr default_delete() noexcept = default; - - /** @brief Converting constructor. - * - * Allows conversion from a deleter for arrays of another type, such as - * a const-qualified version of @p _Tp. - * - * Conversions from types derived from @c _Tp are not allowed because - * it is unsafe to @c delete[] an array of derived types through a - * pointer to the base type. - */ - template::value>::type> - default_delete(const default_delete<_Up[]>&) noexcept { } - - /// Calls @c delete[] @p __ptr - void - operator()(_Tp* __ptr) const - { - static_assert(sizeof(_Tp)>0, - "can't delete pointer to incomplete type"); - delete [] __ptr; - } - - template - typename enable_if<__is_derived_Tp<_Up>::value>::type - operator()(_Up*) const = delete; - }; - - /// 20.7.1.2 unique_ptr for single objects. - template > - class unique_ptr - { - // use SFINAE to determine whether _Del::pointer exists - class _Pointer - { - template - static typename _Up::pointer __test(typename _Up::pointer*); - - template - static _Tp* __test(...); - - typedef typename remove_reference<_Dp>::type _Del; - - public: - typedef decltype(__test<_Del>(0)) type; - }; - - typedef std::tuple __tuple_type; - __tuple_type _M_t; - - public: - typedef typename _Pointer::type pointer; - typedef _Tp element_type; - typedef _Dp deleter_type; - - // Constructors. - - /// Default constructor, creates a unique_ptr that owns nothing. - constexpr unique_ptr() noexcept - : _M_t() - { static_assert(!is_pointer::value, - "constructed with null function pointer deleter"); } - - /** Takes ownership of a pointer. - * - * @param __p A pointer to an object of @c element_type - * - * The deleter will be value-initialized. - */ - explicit - unique_ptr(pointer __p) noexcept - : _M_t(__p, deleter_type()) - { static_assert(!is_pointer::value, - "constructed with null function pointer deleter"); } - - /** Takes ownership of a pointer. - * - * @param __p A pointer to an object of @c element_type - * @param __d A reference to a deleter. - * - * The deleter will be initialized with @p __d - */ - unique_ptr(pointer __p, - typename conditional::value, - deleter_type, const deleter_type&>::type __d) noexcept - : _M_t(__p, __d) { } - - /** Takes ownership of a pointer. - * - * @param __p A pointer to an object of @c element_type - * @param __d An rvalue reference to a deleter. - * - * The deleter will be initialized with @p std::move(__d) - */ - unique_ptr(pointer __p, - typename remove_reference::type&& __d) noexcept - : _M_t(std::move(__p), std::move(__d)) - { static_assert(!std::is_reference::value, - "rvalue deleter bound to reference"); } - - /// Creates a unique_ptr that owns nothing. - constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { } - - // Move constructors. - - /// Move constructor. - unique_ptr(unique_ptr&& __u) noexcept - : _M_t(__u.release(), std::forward(__u.get_deleter())) { } - - /** @brief Converting constructor from another type - * - * Requires that the pointer owned by @p __u is convertible to the - * type of pointer owned by this object, @p __u does not own an array, - * and @p __u has a compatible deleter type. - */ - template::pointer, pointer>, - __not_>, - typename conditional::value, - is_same<_Ep, _Dp>, - is_convertible<_Ep, _Dp>>::type>> - unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept - : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter())) - { } - -#if _GLIBCXX_USE_DEPRECATED - /// Converting constructor from @c auto_ptr - template, is_same<_Dp, default_delete<_Tp>>>> - unique_ptr(auto_ptr<_Up>&& __u) noexcept; -#endif - - /// Destructor, invokes the deleter if the stored pointer is not null. - ~unique_ptr() noexcept - { - auto& __ptr = std::get<0>(_M_t); - if (__ptr != nullptr) - get_deleter()(__ptr); - __ptr = pointer(); - } - - // Assignment. - - /** @brief Move assignment operator. - * - * @param __u The object to transfer ownership from. - * - * Invokes the deleter first if this object owns a pointer. - */ - unique_ptr& - operator=(unique_ptr&& __u) noexcept - { - reset(__u.release()); - get_deleter() = std::forward(__u.get_deleter()); - return *this; - } - - /** @brief Assignment from another type. - * - * @param __u The object to transfer ownership from, which owns a - * convertible pointer to a non-array object. - * - * Invokes the deleter first if this object owns a pointer. - */ - template - typename enable_if< __and_< - is_convertible::pointer, pointer>, - __not_> - >::value, - unique_ptr&>::type - operator=(unique_ptr<_Up, _Ep>&& __u) noexcept - { - reset(__u.release()); - get_deleter() = std::forward<_Ep>(__u.get_deleter()); - return *this; - } - - /// Reset the %unique_ptr to empty, invoking the deleter if necessary. - unique_ptr& - operator=(nullptr_t) noexcept - { - reset(); - return *this; - } - - // Observers. - - /// Dereference the stored pointer. - typename add_lvalue_reference::type - operator*() const - { - _GLIBCXX_DEBUG_ASSERT(get() != pointer()); - return *get(); - } - - /// Return the stored pointer. - pointer - operator->() const noexcept - { - _GLIBCXX_DEBUG_ASSERT(get() != pointer()); - return get(); - } - - /// Return the stored pointer. - pointer - get() const noexcept - { return std::get<0>(_M_t); } - - /// Return a reference to the stored deleter. - deleter_type& - get_deleter() noexcept - { return std::get<1>(_M_t); } - - /// Return a reference to the stored deleter. - const deleter_type& - get_deleter() const noexcept - { return std::get<1>(_M_t); } - - /// Return @c true if the stored pointer is not null. - explicit operator bool() const noexcept - { return get() == pointer() ? false : true; } - - // Modifiers. - - /// Release ownership of any stored pointer. - pointer - release() noexcept - { - pointer __p = get(); - std::get<0>(_M_t) = pointer(); - return __p; - } - - /** @brief Replace the stored pointer. - * - * @param __p The new pointer to store. - * - * The deleter will be invoked if a pointer is already owned. - */ - void - reset(pointer __p = pointer()) noexcept - { - using std::swap; - swap(std::get<0>(_M_t), __p); - if (__p != pointer()) - get_deleter()(__p); - } - - /// Exchange the pointer and deleter with another object. - void - swap(unique_ptr& __u) noexcept - { - using std::swap; - swap(_M_t, __u._M_t); - } - - // Disable copy from lvalue. - unique_ptr(const unique_ptr&) = delete; - unique_ptr& operator=(const unique_ptr&) = delete; - }; - - /// 20.7.1.3 unique_ptr for array objects with a runtime length - // [unique.ptr.runtime] - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 740 - omit specialization for array objects with a compile time length - template - class unique_ptr<_Tp[], _Dp> - { - // use SFINAE to determine whether _Del::pointer exists - class _Pointer - { - template - static typename _Up::pointer __test(typename _Up::pointer*); - - template - static _Tp* __test(...); - - typedef typename remove_reference<_Dp>::type _Del; - - public: - typedef decltype(__test<_Del>(0)) type; - }; - - typedef std::tuple __tuple_type; - __tuple_type _M_t; - - template - using __remove_cv = typename remove_cv<_Up>::type; - - // like is_base_of<_Tp, _Up> but false if unqualified types are the same - template - using __is_derived_Tp - = __and_< is_base_of<_Tp, _Up>, - __not_, __remove_cv<_Up>>> >; - - template::pointer> - using __safe_conversion = __and_< - is_convertible<_Up_pointer, _Tp_pointer>, - is_array<_Up>, - __or_<__not_>, - __not_>, - __not_<__is_derived_Tp::type>> - > - >; - - public: - typedef typename _Pointer::type pointer; - typedef _Tp element_type; - typedef _Dp deleter_type; - - // Constructors. - - /// Default constructor, creates a unique_ptr that owns nothing. - constexpr unique_ptr() noexcept - : _M_t() - { static_assert(!std::is_pointer::value, - "constructed with null function pointer deleter"); } - - /** Takes ownership of a pointer. - * - * @param __p A pointer to an array of @c element_type - * - * The deleter will be value-initialized. - */ - explicit - unique_ptr(pointer __p) noexcept - : _M_t(__p, deleter_type()) - { static_assert(!is_pointer::value, - "constructed with null function pointer deleter"); } - - // Disable construction from convertible pointer types. - template, - is_convertible<_Up*, pointer>, __is_derived_Tp<_Up>>> - explicit - unique_ptr(_Up* __p) = delete; - - /** Takes ownership of a pointer. - * - * @param __p A pointer to an array of @c element_type - * @param __d A reference to a deleter. - * - * The deleter will be initialized with @p __d - */ - unique_ptr(pointer __p, - typename conditional::value, - deleter_type, const deleter_type&>::type __d) noexcept - : _M_t(__p, __d) { } - - /** Takes ownership of a pointer. - * - * @param __p A pointer to an array of @c element_type - * @param __d A reference to a deleter. - * - * The deleter will be initialized with @p std::move(__d) - */ - unique_ptr(pointer __p, typename - remove_reference::type&& __d) noexcept - : _M_t(std::move(__p), std::move(__d)) - { static_assert(!is_reference::value, - "rvalue deleter bound to reference"); } - - /// Move constructor. - unique_ptr(unique_ptr&& __u) noexcept - : _M_t(__u.release(), std::forward(__u.get_deleter())) { } - - /// Creates a unique_ptr that owns nothing. - constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { } - - template, - typename conditional::value, - is_same<_Ep, _Dp>, - is_convertible<_Ep, _Dp>>::type - >> - unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept - : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter())) - { } - - /// Destructor, invokes the deleter if the stored pointer is not null. - ~unique_ptr() - { - auto& __ptr = std::get<0>(_M_t); - if (__ptr != nullptr) - get_deleter()(__ptr); - __ptr = pointer(); - } - - // Assignment. - - /** @brief Move assignment operator. - * - * @param __u The object to transfer ownership from. - * - * Invokes the deleter first if this object owns a pointer. - */ - unique_ptr& - operator=(unique_ptr&& __u) noexcept - { - reset(__u.release()); - get_deleter() = std::forward(__u.get_deleter()); - return *this; - } - - /** @brief Assignment from another type. - * - * @param __u The object to transfer ownership from, which owns a - * convertible pointer to an array object. - * - * Invokes the deleter first if this object owns a pointer. - */ - template - typename - enable_if<__safe_conversion<_Up, _Ep>::value, unique_ptr&>::type - operator=(unique_ptr<_Up, _Ep>&& __u) noexcept - { - reset(__u.release()); - get_deleter() = std::forward<_Ep>(__u.get_deleter()); - return *this; - } - - /// Reset the %unique_ptr to empty, invoking the deleter if necessary. - unique_ptr& - operator=(nullptr_t) noexcept - { - reset(); - return *this; - } - - // Observers. - - /// Access an element of owned array. - typename std::add_lvalue_reference::type - operator[](size_t __i) const - { - _GLIBCXX_DEBUG_ASSERT(get() != pointer()); - return get()[__i]; - } - - /// Return the stored pointer. - pointer - get() const noexcept - { return std::get<0>(_M_t); } - - /// Return a reference to the stored deleter. - deleter_type& - get_deleter() noexcept - { return std::get<1>(_M_t); } - - /// Return a reference to the stored deleter. - const deleter_type& - get_deleter() const noexcept - { return std::get<1>(_M_t); } - - /// Return @c true if the stored pointer is not null. - explicit operator bool() const noexcept - { return get() == pointer() ? false : true; } - - // Modifiers. - - /// Release ownership of any stored pointer. - pointer - release() noexcept - { - pointer __p = get(); - std::get<0>(_M_t) = pointer(); - return __p; - } - - /** @brief Replace the stored pointer. - * - * @param __p The new pointer to store. - * - * The deleter will be invoked if a pointer is already owned. - */ - void - reset(pointer __p = pointer()) noexcept - { - using std::swap; - swap(std::get<0>(_M_t), __p); - if (__p != nullptr) - get_deleter()(__p); - } - - // Disable resetting from convertible pointer types. - template, - is_convertible<_Up*, pointer>, __is_derived_Tp<_Up>>> - void reset(_Up*) = delete; - - /// Exchange the pointer and deleter with another object. - void - swap(unique_ptr& __u) noexcept - { - using std::swap; - swap(_M_t, __u._M_t); - } - - // Disable copy from lvalue. - unique_ptr(const unique_ptr&) = delete; - unique_ptr& operator=(const unique_ptr&) = delete; - - // Disable construction from convertible pointer types. - template, - is_convertible<_Up*, pointer>, __is_derived_Tp<_Up>>> - unique_ptr(_Up*, typename - conditional::value, - deleter_type, const deleter_type&>::type) = delete; - - // Disable construction from convertible pointer types. - template, - is_convertible<_Up*, pointer>, __is_derived_Tp<_Up>>> - unique_ptr(_Up*, typename - remove_reference::type&&) = delete; - }; - - template - inline void - swap(unique_ptr<_Tp, _Dp>& __x, - unique_ptr<_Tp, _Dp>& __y) noexcept - { __x.swap(__y); } - - template - inline bool - operator==(const unique_ptr<_Tp, _Dp>& __x, - const unique_ptr<_Up, _Ep>& __y) - { return __x.get() == __y.get(); } - - template - inline bool - operator==(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) noexcept - { return !__x; } - - template - inline bool - operator==(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) noexcept - { return !__x; } - - template - inline bool - operator!=(const unique_ptr<_Tp, _Dp>& __x, - const unique_ptr<_Up, _Ep>& __y) - { return __x.get() != __y.get(); } - - template - inline bool - operator!=(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) noexcept - { return (bool)__x; } - - template - inline bool - operator!=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) noexcept - { return (bool)__x; } - - template - inline bool - operator<(const unique_ptr<_Tp, _Dp>& __x, - const unique_ptr<_Up, _Ep>& __y) - { - typedef typename - std::common_type::pointer, - typename unique_ptr<_Up, _Ep>::pointer>::type _CT; - return std::less<_CT>()(__x.get(), __y.get()); - } - - template - inline bool - operator<(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) - { return std::less::pointer>()(__x.get(), - nullptr); } - - template - inline bool - operator<(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) - { return std::less::pointer>()(nullptr, - __x.get()); } - - template - inline bool - operator<=(const unique_ptr<_Tp, _Dp>& __x, - const unique_ptr<_Up, _Ep>& __y) - { return !(__y < __x); } - - template - inline bool - operator<=(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) - { return !(nullptr < __x); } - - template - inline bool - operator<=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) - { return !(__x < nullptr); } - - template - inline bool - operator>(const unique_ptr<_Tp, _Dp>& __x, - const unique_ptr<_Up, _Ep>& __y) - { return (__y < __x); } - - template - inline bool - operator>(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) - { return std::less::pointer>()(nullptr, - __x.get()); } - - template - inline bool - operator>(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) - { return std::less::pointer>()(__x.get(), - nullptr); } - - template - inline bool - operator>=(const unique_ptr<_Tp, _Dp>& __x, - const unique_ptr<_Up, _Ep>& __y) - { return !(__x < __y); } - - template - inline bool - operator>=(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) - { return !(__x < nullptr); } - - template - inline bool - operator>=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) - { return !(nullptr < __x); } - - /// std::hash specialization for unique_ptr. - template - struct hash> - : public __hash_base> - { - size_t - operator()(const unique_ptr<_Tp, _Dp>& __u) const noexcept - { - typedef unique_ptr<_Tp, _Dp> _UP; - return std::hash()(__u.get()); - } - }; - -#if __cplusplus > 201103L - -#define __cpp_lib_make_unique 201304 - - template - struct _MakeUniq - { typedef unique_ptr<_Tp> __single_object; }; - - template - struct _MakeUniq<_Tp[]> - { typedef unique_ptr<_Tp[]> __array; }; - - template - struct _MakeUniq<_Tp[_Bound]> - { struct __invalid_type { }; }; - - /// std::make_unique for single objects - template - inline typename _MakeUniq<_Tp>::__single_object - make_unique(_Args&&... __args) - { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); } - - /// std::make_unique for arrays of unknown bound - template - inline typename _MakeUniq<_Tp>::__array - make_unique(size_t __num) - { return unique_ptr<_Tp>(new remove_extent_t<_Tp>[__num]()); } - - /// Disable std::make_unique for arrays of known bound - template - inline typename _MakeUniq<_Tp>::__invalid_type - make_unique(_Args&&...) = delete; -#endif - - // @} group pointer_abstractions - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _UNIQUE_PTR_H */ diff --git a/openflow/usr/include/c++/5/bits/unordered_map.h b/openflow/usr/include/c++/5/bits/unordered_map.h deleted file mode 100644 index 3c434ab..0000000 --- a/openflow/usr/include/c++/5/bits/unordered_map.h +++ /dev/null @@ -1,1555 +0,0 @@ -// unordered_map implementation -*- C++ -*- - -// Copyright (C) 2010-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/unordered_map.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{unordered_map} - */ - -#ifndef _UNORDERED_MAP_H -#define _UNORDERED_MAP_H - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - /// Base types for unordered_map. - template - using __umap_traits = __detail::_Hashtable_traits<_Cache, false, true>; - - template, - typename _Pred = std::equal_to<_Key>, - typename _Alloc = std::allocator >, - typename _Tr = __umap_traits<__cache_default<_Key, _Hash>::value>> - using __umap_hashtable = _Hashtable<_Key, std::pair, - _Alloc, __detail::_Select1st, - _Pred, _Hash, - __detail::_Mod_range_hashing, - __detail::_Default_ranged_hash, - __detail::_Prime_rehash_policy, _Tr>; - - /// Base types for unordered_multimap. - template - using __ummap_traits = __detail::_Hashtable_traits<_Cache, false, false>; - - template, - typename _Pred = std::equal_to<_Key>, - typename _Alloc = std::allocator >, - typename _Tr = __ummap_traits<__cache_default<_Key, _Hash>::value>> - using __ummap_hashtable = _Hashtable<_Key, std::pair, - _Alloc, __detail::_Select1st, - _Pred, _Hash, - __detail::_Mod_range_hashing, - __detail::_Default_ranged_hash, - __detail::_Prime_rehash_policy, _Tr>; - - /** - * @brief A standard container composed of unique keys (containing - * at most one of each key value) that associates values of another type - * with the keys. - * - * @ingroup unordered_associative_containers - * - * @tparam _Key Type of key objects. - * @tparam _Tp Type of mapped objects. - * @tparam _Hash Hashing function object type, defaults to hash<_Value>. - * @tparam _Pred Predicate function object type, defaults - * to equal_to<_Value>. - * @tparam _Alloc Allocator type, defaults to - * std::allocator>. - * - * Meets the requirements of a container, and - * unordered associative container - * - * The resulting value type of the container is std::pair. - * - * Base is _Hashtable, dispatched at compile time via template - * alias __umap_hashtable. - */ - template, - class _Pred = std::equal_to<_Key>, - class _Alloc = std::allocator > > - class unordered_map - { - typedef __umap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable; - _Hashtable _M_h; - - public: - // typedefs: - //@{ - /// Public typedefs. - typedef typename _Hashtable::key_type key_type; - typedef typename _Hashtable::value_type value_type; - typedef typename _Hashtable::mapped_type mapped_type; - typedef typename _Hashtable::hasher hasher; - typedef typename _Hashtable::key_equal key_equal; - typedef typename _Hashtable::allocator_type allocator_type; - //@} - - //@{ - /// Iterator-related typedefs. - typedef typename _Hashtable::pointer pointer; - typedef typename _Hashtable::const_pointer const_pointer; - typedef typename _Hashtable::reference reference; - typedef typename _Hashtable::const_reference const_reference; - typedef typename _Hashtable::iterator iterator; - typedef typename _Hashtable::const_iterator const_iterator; - typedef typename _Hashtable::local_iterator local_iterator; - typedef typename _Hashtable::const_local_iterator const_local_iterator; - typedef typename _Hashtable::size_type size_type; - typedef typename _Hashtable::difference_type difference_type; - //@} - - //construct/destroy/copy - - /// Default constructor. - unordered_map() = default; - - /** - * @brief Default constructor creates no elements. - * @param __n Minimal initial number of buckets. - * @param __hf A hash functor. - * @param __eql A key equality functor. - * @param __a An allocator object. - */ - explicit - unordered_map(size_type __n, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_h(__n, __hf, __eql, __a) - { } - - /** - * @brief Builds an %unordered_map from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __n Minimal initial number of buckets. - * @param __hf A hash functor. - * @param __eql A key equality functor. - * @param __a An allocator object. - * - * Create an %unordered_map consisting of copies of the elements from - * [__first,__last). This is linear in N (where N is - * distance(__first,__last)). - */ - template - unordered_map(_InputIterator __first, _InputIterator __last, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_h(__first, __last, __n, __hf, __eql, __a) - { } - - /// Copy constructor. - unordered_map(const unordered_map&) = default; - - /// Move constructor. - unordered_map(unordered_map&&) = default; - - /** - * @brief Creates an %unordered_map with no elements. - * @param __a An allocator object. - */ - explicit - unordered_map(const allocator_type& __a) - : _M_h(__a) - { } - - /* - * @brief Copy constructor with allocator argument. - * @param __uset Input %unordered_map to copy. - * @param __a An allocator object. - */ - unordered_map(const unordered_map& __umap, - const allocator_type& __a) - : _M_h(__umap._M_h, __a) - { } - - /* - * @brief Move constructor with allocator argument. - * @param __uset Input %unordered_map to move. - * @param __a An allocator object. - */ - unordered_map(unordered_map&& __umap, - const allocator_type& __a) - : _M_h(std::move(__umap._M_h), __a) - { } - - /** - * @brief Builds an %unordered_map from an initializer_list. - * @param __l An initializer_list. - * @param __n Minimal initial number of buckets. - * @param __hf A hash functor. - * @param __eql A key equality functor. - * @param __a An allocator object. - * - * Create an %unordered_map consisting of copies of the elements in the - * list. This is linear in N (where N is @a __l.size()). - */ - unordered_map(initializer_list __l, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_h(__l, __n, __hf, __eql, __a) - { } - - unordered_map(size_type __n, const allocator_type& __a) - : unordered_map(__n, hasher(), key_equal(), __a) - { } - - unordered_map(size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_map(__n, __hf, key_equal(), __a) - { } - - template - unordered_map(_InputIterator __first, _InputIterator __last, - size_type __n, - const allocator_type& __a) - : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) - { } - - template - unordered_map(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_map(__first, __last, __n, __hf, key_equal(), __a) - { } - - unordered_map(initializer_list __l, - size_type __n, - const allocator_type& __a) - : unordered_map(__l, __n, hasher(), key_equal(), __a) - { } - - unordered_map(initializer_list __l, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_map(__l, __n, __hf, key_equal(), __a) - { } - - /// Copy assignment operator. - unordered_map& - operator=(const unordered_map&) = default; - - /// Move assignment operator. - unordered_map& - operator=(unordered_map&&) = default; - - /** - * @brief %Unordered_map list assignment operator. - * @param __l An initializer_list. - * - * This function fills an %unordered_map with copies of the elements in - * the initializer list @a __l. - * - * Note that the assignment completely changes the %unordered_map and - * that the resulting %unordered_map's size is the same as the number - * of elements assigned. Old data may be lost. - */ - unordered_map& - operator=(initializer_list __l) - { - _M_h = __l; - return *this; - } - - /// Returns the allocator object with which the %unordered_map was - /// constructed. - allocator_type - get_allocator() const noexcept - { return _M_h.get_allocator(); } - - // size and capacity: - - /// Returns true if the %unordered_map is empty. - bool - empty() const noexcept - { return _M_h.empty(); } - - /// Returns the size of the %unordered_map. - size_type - size() const noexcept - { return _M_h.size(); } - - /// Returns the maximum size of the %unordered_map. - size_type - max_size() const noexcept - { return _M_h.max_size(); } - - // iterators. - - /** - * Returns a read/write iterator that points to the first element in the - * %unordered_map. - */ - iterator - begin() noexcept - { return _M_h.begin(); } - - //@{ - /** - * Returns a read-only (constant) iterator that points to the first - * element in the %unordered_map. - */ - const_iterator - begin() const noexcept - { return _M_h.begin(); } - - const_iterator - cbegin() const noexcept - { return _M_h.begin(); } - //@} - - /** - * Returns a read/write iterator that points one past the last element in - * the %unordered_map. - */ - iterator - end() noexcept - { return _M_h.end(); } - - //@{ - /** - * Returns a read-only (constant) iterator that points one past the last - * element in the %unordered_map. - */ - const_iterator - end() const noexcept - { return _M_h.end(); } - - const_iterator - cend() const noexcept - { return _M_h.end(); } - //@} - - // modifiers. - - /** - * @brief Attempts to build and insert a std::pair into the - * %unordered_map. - * - * @param __args Arguments used to generate a new pair instance (see - * std::piecewise_contruct for passing arguments to each - * part of the pair constructor). - * - * @return A pair, of which the first element is an iterator that points - * to the possibly inserted pair, and the second is a bool that - * is true if the pair was actually inserted. - * - * This function attempts to build and insert a (key, value) %pair into - * the %unordered_map. - * An %unordered_map relies on unique keys and thus a %pair is only - * inserted if its first element (the key) is not already present in the - * %unordered_map. - * - * Insertion requires amortized constant time. - */ - template - std::pair - emplace(_Args&&... __args) - { return _M_h.emplace(std::forward<_Args>(__args)...); } - - /** - * @brief Attempts to build and insert a std::pair into the - * %unordered_map. - * - * @param __pos An iterator that serves as a hint as to where the pair - * should be inserted. - * @param __args Arguments used to generate a new pair instance (see - * std::piecewise_contruct for passing arguments to each - * part of the pair constructor). - * @return An iterator that points to the element with key of the - * std::pair built from @a __args (may or may not be that - * std::pair). - * - * This function is not concerned about whether the insertion took place, - * and thus does not return a boolean like the single-argument emplace() - * does. - * Note that the first parameter is only a hint and can potentially - * improve the performance of the insertion process. A bad hint would - * cause no gains in efficiency. - * - * See - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * for more on @a hinting. - * - * Insertion requires amortized constant time. - */ - template - iterator - emplace_hint(const_iterator __pos, _Args&&... __args) - { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } - - //@{ - /** - * @brief Attempts to insert a std::pair into the %unordered_map. - - * @param __x Pair to be inserted (see std::make_pair for easy - * creation of pairs). - * - * @return A pair, of which the first element is an iterator that - * points to the possibly inserted pair, and the second is - * a bool that is true if the pair was actually inserted. - * - * This function attempts to insert a (key, value) %pair into the - * %unordered_map. An %unordered_map relies on unique keys and thus a - * %pair is only inserted if its first element (the key) is not already - * present in the %unordered_map. - * - * Insertion requires amortized constant time. - */ - std::pair - insert(const value_type& __x) - { return _M_h.insert(__x); } - - template::value>::type> - std::pair - insert(_Pair&& __x) - { return _M_h.insert(std::forward<_Pair>(__x)); } - //@} - - //@{ - /** - * @brief Attempts to insert a std::pair into the %unordered_map. - * @param __hint An iterator that serves as a hint as to where the - * pair should be inserted. - * @param __x Pair to be inserted (see std::make_pair for easy creation - * of pairs). - * @return An iterator that points to the element with key of - * @a __x (may or may not be the %pair passed in). - * - * This function is not concerned about whether the insertion took place, - * and thus does not return a boolean like the single-argument insert() - * does. Note that the first parameter is only a hint and can - * potentially improve the performance of the insertion process. A bad - * hint would cause no gains in efficiency. - * - * See - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * for more on @a hinting. - * - * Insertion requires amortized constant time. - */ - iterator - insert(const_iterator __hint, const value_type& __x) - { return _M_h.insert(__hint, __x); } - - template::value>::type> - iterator - insert(const_iterator __hint, _Pair&& __x) - { return _M_h.insert(__hint, std::forward<_Pair>(__x)); } - //@} - - /** - * @brief A template function that attempts to insert a range of - * elements. - * @param __first Iterator pointing to the start of the range to be - * inserted. - * @param __last Iterator pointing to the end of the range. - * - * Complexity similar to that of the range constructor. - */ - template - void - insert(_InputIterator __first, _InputIterator __last) - { _M_h.insert(__first, __last); } - - /** - * @brief Attempts to insert a list of elements into the %unordered_map. - * @param __l A std::initializer_list of elements - * to be inserted. - * - * Complexity similar to that of the range constructor. - */ - void - insert(initializer_list __l) - { _M_h.insert(__l); } - - //@{ - /** - * @brief Erases an element from an %unordered_map. - * @param __position An iterator pointing to the element to be erased. - * @return An iterator pointing to the element immediately following - * @a __position prior to the element being erased. If no such - * element exists, end() is returned. - * - * This function erases an element, pointed to by the given iterator, - * from an %unordered_map. - * Note that this function only erases the element, and that if the - * element is itself a pointer, the pointed-to memory is not touched in - * any way. Managing the pointer is the user's responsibility. - */ - iterator - erase(const_iterator __position) - { return _M_h.erase(__position); } - - // LWG 2059. - iterator - erase(iterator __position) - { return _M_h.erase(__position); } - //@} - - /** - * @brief Erases elements according to the provided key. - * @param __x Key of element to be erased. - * @return The number of elements erased. - * - * This function erases all the elements located by the given key from - * an %unordered_map. For an %unordered_map the result of this function - * can only be 0 (not present) or 1 (present). - * Note that this function only erases the element, and that if the - * element is itself a pointer, the pointed-to memory is not touched in - * any way. Managing the pointer is the user's responsibility. - */ - size_type - erase(const key_type& __x) - { return _M_h.erase(__x); } - - /** - * @brief Erases a [__first,__last) range of elements from an - * %unordered_map. - * @param __first Iterator pointing to the start of the range to be - * erased. - * @param __last Iterator pointing to the end of the range to - * be erased. - * @return The iterator @a __last. - * - * This function erases a sequence of elements from an %unordered_map. - * Note that this function only erases the elements, and that if - * the element is itself a pointer, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - iterator - erase(const_iterator __first, const_iterator __last) - { return _M_h.erase(__first, __last); } - - /** - * Erases all elements in an %unordered_map. - * Note that this function only erases the elements, and that if the - * elements themselves are pointers, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - void - clear() noexcept - { _M_h.clear(); } - - /** - * @brief Swaps data with another %unordered_map. - * @param __x An %unordered_map of the same element and allocator - * types. - * - * This exchanges the elements between two %unordered_map in constant - * time. - * Note that the global std::swap() function is specialized such that - * std::swap(m1,m2) will feed to this function. - */ - void - swap(unordered_map& __x) - noexcept( noexcept(_M_h.swap(__x._M_h)) ) - { _M_h.swap(__x._M_h); } - - // observers. - - /// Returns the hash functor object with which the %unordered_map was - /// constructed. - hasher - hash_function() const - { return _M_h.hash_function(); } - - /// Returns the key comparison object with which the %unordered_map was - /// constructed. - key_equal - key_eq() const - { return _M_h.key_eq(); } - - // lookup. - - //@{ - /** - * @brief Tries to locate an element in an %unordered_map. - * @param __x Key to be located. - * @return Iterator pointing to sought-after element, or end() if not - * found. - * - * This function takes a key and tries to locate the element with which - * the key matches. If successful the function returns an iterator - * pointing to the sought after element. If unsuccessful it returns the - * past-the-end ( @c end() ) iterator. - */ - iterator - find(const key_type& __x) - { return _M_h.find(__x); } - - const_iterator - find(const key_type& __x) const - { return _M_h.find(__x); } - //@} - - /** - * @brief Finds the number of elements. - * @param __x Key to count. - * @return Number of elements with specified key. - * - * This function only makes sense for %unordered_multimap; for - * %unordered_map the result will either be 0 (not present) or 1 - * (present). - */ - size_type - count(const key_type& __x) const - { return _M_h.count(__x); } - - //@{ - /** - * @brief Finds a subsequence matching given key. - * @param __x Key to be located. - * @return Pair of iterators that possibly points to the subsequence - * matching given key. - * - * This function probably only makes sense for %unordered_multimap. - */ - std::pair - equal_range(const key_type& __x) - { return _M_h.equal_range(__x); } - - std::pair - equal_range(const key_type& __x) const - { return _M_h.equal_range(__x); } - //@} - - //@{ - /** - * @brief Subscript ( @c [] ) access to %unordered_map data. - * @param __k The key for which data should be retrieved. - * @return A reference to the data of the (key,data) %pair. - * - * Allows for easy lookup with the subscript ( @c [] )operator. Returns - * data associated with the key specified in subscript. If the key does - * not exist, a pair with that key is created using default values, which - * is then returned. - * - * Lookup requires constant time. - */ - mapped_type& - operator[](const key_type& __k) - { return _M_h[__k]; } - - mapped_type& - operator[](key_type&& __k) - { return _M_h[std::move(__k)]; } - //@} - - //@{ - /** - * @brief Access to %unordered_map data. - * @param __k The key for which data should be retrieved. - * @return A reference to the data whose key is equal to @a __k, if - * such a data is present in the %unordered_map. - * @throw std::out_of_range If no such data is present. - */ - mapped_type& - at(const key_type& __k) - { return _M_h.at(__k); } - - const mapped_type& - at(const key_type& __k) const - { return _M_h.at(__k); } - //@} - - // bucket interface. - - /// Returns the number of buckets of the %unordered_map. - size_type - bucket_count() const noexcept - { return _M_h.bucket_count(); } - - /// Returns the maximum number of buckets of the %unordered_map. - size_type - max_bucket_count() const noexcept - { return _M_h.max_bucket_count(); } - - /* - * @brief Returns the number of elements in a given bucket. - * @param __n A bucket index. - * @return The number of elements in the bucket. - */ - size_type - bucket_size(size_type __n) const - { return _M_h.bucket_size(__n); } - - /* - * @brief Returns the bucket index of a given element. - * @param __key A key instance. - * @return The key bucket index. - */ - size_type - bucket(const key_type& __key) const - { return _M_h.bucket(__key); } - - /** - * @brief Returns a read/write iterator pointing to the first bucket - * element. - * @param __n The bucket index. - * @return A read/write local iterator. - */ - local_iterator - begin(size_type __n) - { return _M_h.begin(__n); } - - //@{ - /** - * @brief Returns a read-only (constant) iterator pointing to the first - * bucket element. - * @param __n The bucket index. - * @return A read-only local iterator. - */ - const_local_iterator - begin(size_type __n) const - { return _M_h.begin(__n); } - - const_local_iterator - cbegin(size_type __n) const - { return _M_h.cbegin(__n); } - //@} - - /** - * @brief Returns a read/write iterator pointing to one past the last - * bucket elements. - * @param __n The bucket index. - * @return A read/write local iterator. - */ - local_iterator - end(size_type __n) - { return _M_h.end(__n); } - - //@{ - /** - * @brief Returns a read-only (constant) iterator pointing to one past - * the last bucket elements. - * @param __n The bucket index. - * @return A read-only local iterator. - */ - const_local_iterator - end(size_type __n) const - { return _M_h.end(__n); } - - const_local_iterator - cend(size_type __n) const - { return _M_h.cend(__n); } - //@} - - // hash policy. - - /// Returns the average number of elements per bucket. - float - load_factor() const noexcept - { return _M_h.load_factor(); } - - /// Returns a positive number that the %unordered_map tries to keep the - /// load factor less than or equal to. - float - max_load_factor() const noexcept - { return _M_h.max_load_factor(); } - - /** - * @brief Change the %unordered_map maximum load factor. - * @param __z The new maximum load factor. - */ - void - max_load_factor(float __z) - { _M_h.max_load_factor(__z); } - - /** - * @brief May rehash the %unordered_map. - * @param __n The new number of buckets. - * - * Rehash will occur only if the new number of buckets respect the - * %unordered_map maximum load factor. - */ - void - rehash(size_type __n) - { _M_h.rehash(__n); } - - /** - * @brief Prepare the %unordered_map for a specified number of - * elements. - * @param __n Number of elements required. - * - * Same as rehash(ceil(n / max_load_factor())). - */ - void - reserve(size_type __n) - { _M_h.reserve(__n); } - - template - friend bool - operator==(const unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&, - const unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&); - }; - - /** - * @brief A standard container composed of equivalent keys - * (possibly containing multiple of each key value) that associates - * values of another type with the keys. - * - * @ingroup unordered_associative_containers - * - * @tparam _Key Type of key objects. - * @tparam _Tp Type of mapped objects. - * @tparam _Hash Hashing function object type, defaults to hash<_Value>. - * @tparam _Pred Predicate function object type, defaults - * to equal_to<_Value>. - * @tparam _Alloc Allocator type, defaults to - * std::allocator>. - * - * Meets the requirements of a container, and - * unordered associative container - * - * The resulting value type of the container is std::pair. - * - * Base is _Hashtable, dispatched at compile time via template - * alias __ummap_hashtable. - */ - template, - class _Pred = std::equal_to<_Key>, - class _Alloc = std::allocator > > - class unordered_multimap - { - typedef __ummap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable; - _Hashtable _M_h; - - public: - // typedefs: - //@{ - /// Public typedefs. - typedef typename _Hashtable::key_type key_type; - typedef typename _Hashtable::value_type value_type; - typedef typename _Hashtable::mapped_type mapped_type; - typedef typename _Hashtable::hasher hasher; - typedef typename _Hashtable::key_equal key_equal; - typedef typename _Hashtable::allocator_type allocator_type; - //@} - - //@{ - /// Iterator-related typedefs. - typedef typename _Hashtable::pointer pointer; - typedef typename _Hashtable::const_pointer const_pointer; - typedef typename _Hashtable::reference reference; - typedef typename _Hashtable::const_reference const_reference; - typedef typename _Hashtable::iterator iterator; - typedef typename _Hashtable::const_iterator const_iterator; - typedef typename _Hashtable::local_iterator local_iterator; - typedef typename _Hashtable::const_local_iterator const_local_iterator; - typedef typename _Hashtable::size_type size_type; - typedef typename _Hashtable::difference_type difference_type; - //@} - - //construct/destroy/copy - - /// Default constructor. - unordered_multimap() = default; - - /** - * @brief Default constructor creates no elements. - * @param __n Mnimal initial number of buckets. - * @param __hf A hash functor. - * @param __eql A key equality functor. - * @param __a An allocator object. - */ - explicit - unordered_multimap(size_type __n, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_h(__n, __hf, __eql, __a) - { } - - /** - * @brief Builds an %unordered_multimap from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __n Minimal initial number of buckets. - * @param __hf A hash functor. - * @param __eql A key equality functor. - * @param __a An allocator object. - * - * Create an %unordered_multimap consisting of copies of the elements - * from [__first,__last). This is linear in N (where N is - * distance(__first,__last)). - */ - template - unordered_multimap(_InputIterator __first, _InputIterator __last, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_h(__first, __last, __n, __hf, __eql, __a) - { } - - /// Copy constructor. - unordered_multimap(const unordered_multimap&) = default; - - /// Move constructor. - unordered_multimap(unordered_multimap&&) = default; - - /** - * @brief Creates an %unordered_multimap with no elements. - * @param __a An allocator object. - */ - explicit - unordered_multimap(const allocator_type& __a) - : _M_h(__a) - { } - - /* - * @brief Copy constructor with allocator argument. - * @param __uset Input %unordered_multimap to copy. - * @param __a An allocator object. - */ - unordered_multimap(const unordered_multimap& __ummap, - const allocator_type& __a) - : _M_h(__ummap._M_h, __a) - { } - - /* - * @brief Move constructor with allocator argument. - * @param __uset Input %unordered_multimap to move. - * @param __a An allocator object. - */ - unordered_multimap(unordered_multimap&& __ummap, - const allocator_type& __a) - : _M_h(std::move(__ummap._M_h), __a) - { } - - /** - * @brief Builds an %unordered_multimap from an initializer_list. - * @param __l An initializer_list. - * @param __n Minimal initial number of buckets. - * @param __hf A hash functor. - * @param __eql A key equality functor. - * @param __a An allocator object. - * - * Create an %unordered_multimap consisting of copies of the elements in - * the list. This is linear in N (where N is @a __l.size()). - */ - unordered_multimap(initializer_list __l, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_h(__l, __n, __hf, __eql, __a) - { } - - unordered_multimap(size_type __n, const allocator_type& __a) - : unordered_multimap(__n, hasher(), key_equal(), __a) - { } - - unordered_multimap(size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multimap(__n, __hf, key_equal(), __a) - { } - - template - unordered_multimap(_InputIterator __first, _InputIterator __last, - size_type __n, - const allocator_type& __a) - : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) - { } - - template - unordered_multimap(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) - { } - - unordered_multimap(initializer_list __l, - size_type __n, - const allocator_type& __a) - : unordered_multimap(__l, __n, hasher(), key_equal(), __a) - { } - - unordered_multimap(initializer_list __l, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multimap(__l, __n, __hf, key_equal(), __a) - { } - - /// Copy assignment operator. - unordered_multimap& - operator=(const unordered_multimap&) = default; - - /// Move assignment operator. - unordered_multimap& - operator=(unordered_multimap&&) = default; - - /** - * @brief %Unordered_multimap list assignment operator. - * @param __l An initializer_list. - * - * This function fills an %unordered_multimap with copies of the elements - * in the initializer list @a __l. - * - * Note that the assignment completely changes the %unordered_multimap - * and that the resulting %unordered_multimap's size is the same as the - * number of elements assigned. Old data may be lost. - */ - unordered_multimap& - operator=(initializer_list __l) - { - _M_h = __l; - return *this; - } - - /// Returns the allocator object with which the %unordered_multimap was - /// constructed. - allocator_type - get_allocator() const noexcept - { return _M_h.get_allocator(); } - - // size and capacity: - - /// Returns true if the %unordered_multimap is empty. - bool - empty() const noexcept - { return _M_h.empty(); } - - /// Returns the size of the %unordered_multimap. - size_type - size() const noexcept - { return _M_h.size(); } - - /// Returns the maximum size of the %unordered_multimap. - size_type - max_size() const noexcept - { return _M_h.max_size(); } - - // iterators. - - /** - * Returns a read/write iterator that points to the first element in the - * %unordered_multimap. - */ - iterator - begin() noexcept - { return _M_h.begin(); } - - //@{ - /** - * Returns a read-only (constant) iterator that points to the first - * element in the %unordered_multimap. - */ - const_iterator - begin() const noexcept - { return _M_h.begin(); } - - const_iterator - cbegin() const noexcept - { return _M_h.begin(); } - //@} - - /** - * Returns a read/write iterator that points one past the last element in - * the %unordered_multimap. - */ - iterator - end() noexcept - { return _M_h.end(); } - - //@{ - /** - * Returns a read-only (constant) iterator that points one past the last - * element in the %unordered_multimap. - */ - const_iterator - end() const noexcept - { return _M_h.end(); } - - const_iterator - cend() const noexcept - { return _M_h.end(); } - //@} - - // modifiers. - - /** - * @brief Attempts to build and insert a std::pair into the - * %unordered_multimap. - * - * @param __args Arguments used to generate a new pair instance (see - * std::piecewise_contruct for passing arguments to each - * part of the pair constructor). - * - * @return An iterator that points to the inserted pair. - * - * This function attempts to build and insert a (key, value) %pair into - * the %unordered_multimap. - * - * Insertion requires amortized constant time. - */ - template - iterator - emplace(_Args&&... __args) - { return _M_h.emplace(std::forward<_Args>(__args)...); } - - /** - * @brief Attempts to build and insert a std::pair into the - * %unordered_multimap. - * - * @param __pos An iterator that serves as a hint as to where the pair - * should be inserted. - * @param __args Arguments used to generate a new pair instance (see - * std::piecewise_contruct for passing arguments to each - * part of the pair constructor). - * @return An iterator that points to the element with key of the - * std::pair built from @a __args. - * - * Note that the first parameter is only a hint and can potentially - * improve the performance of the insertion process. A bad hint would - * cause no gains in efficiency. - * - * See - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * for more on @a hinting. - * - * Insertion requires amortized constant time. - */ - template - iterator - emplace_hint(const_iterator __pos, _Args&&... __args) - { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } - - //@{ - /** - * @brief Inserts a std::pair into the %unordered_multimap. - * @param __x Pair to be inserted (see std::make_pair for easy - * creation of pairs). - * - * @return An iterator that points to the inserted pair. - * - * Insertion requires amortized constant time. - */ - iterator - insert(const value_type& __x) - { return _M_h.insert(__x); } - - template::value>::type> - iterator - insert(_Pair&& __x) - { return _M_h.insert(std::forward<_Pair>(__x)); } - //@} - - //@{ - /** - * @brief Inserts a std::pair into the %unordered_multimap. - * @param __hint An iterator that serves as a hint as to where the - * pair should be inserted. - * @param __x Pair to be inserted (see std::make_pair for easy creation - * of pairs). - * @return An iterator that points to the element with key of - * @a __x (may or may not be the %pair passed in). - * - * Note that the first parameter is only a hint and can potentially - * improve the performance of the insertion process. A bad hint would - * cause no gains in efficiency. - * - * See - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * for more on @a hinting. - * - * Insertion requires amortized constant time. - */ - iterator - insert(const_iterator __hint, const value_type& __x) - { return _M_h.insert(__hint, __x); } - - template::value>::type> - iterator - insert(const_iterator __hint, _Pair&& __x) - { return _M_h.insert(__hint, std::forward<_Pair>(__x)); } - //@} - - /** - * @brief A template function that attempts to insert a range of - * elements. - * @param __first Iterator pointing to the start of the range to be - * inserted. - * @param __last Iterator pointing to the end of the range. - * - * Complexity similar to that of the range constructor. - */ - template - void - insert(_InputIterator __first, _InputIterator __last) - { _M_h.insert(__first, __last); } - - /** - * @brief Attempts to insert a list of elements into the - * %unordered_multimap. - * @param __l A std::initializer_list of elements - * to be inserted. - * - * Complexity similar to that of the range constructor. - */ - void - insert(initializer_list __l) - { _M_h.insert(__l); } - - //@{ - /** - * @brief Erases an element from an %unordered_multimap. - * @param __position An iterator pointing to the element to be erased. - * @return An iterator pointing to the element immediately following - * @a __position prior to the element being erased. If no such - * element exists, end() is returned. - * - * This function erases an element, pointed to by the given iterator, - * from an %unordered_multimap. - * Note that this function only erases the element, and that if the - * element is itself a pointer, the pointed-to memory is not touched in - * any way. Managing the pointer is the user's responsibility. - */ - iterator - erase(const_iterator __position) - { return _M_h.erase(__position); } - - // LWG 2059. - iterator - erase(iterator __position) - { return _M_h.erase(__position); } - //@} - - /** - * @brief Erases elements according to the provided key. - * @param __x Key of elements to be erased. - * @return The number of elements erased. - * - * This function erases all the elements located by the given key from - * an %unordered_multimap. - * Note that this function only erases the element, and that if the - * element is itself a pointer, the pointed-to memory is not touched in - * any way. Managing the pointer is the user's responsibility. - */ - size_type - erase(const key_type& __x) - { return _M_h.erase(__x); } - - /** - * @brief Erases a [__first,__last) range of elements from an - * %unordered_multimap. - * @param __first Iterator pointing to the start of the range to be - * erased. - * @param __last Iterator pointing to the end of the range to - * be erased. - * @return The iterator @a __last. - * - * This function erases a sequence of elements from an - * %unordered_multimap. - * Note that this function only erases the elements, and that if - * the element is itself a pointer, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - iterator - erase(const_iterator __first, const_iterator __last) - { return _M_h.erase(__first, __last); } - - /** - * Erases all elements in an %unordered_multimap. - * Note that this function only erases the elements, and that if the - * elements themselves are pointers, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - void - clear() noexcept - { _M_h.clear(); } - - /** - * @brief Swaps data with another %unordered_multimap. - * @param __x An %unordered_multimap of the same element and allocator - * types. - * - * This exchanges the elements between two %unordered_multimap in - * constant time. - * Note that the global std::swap() function is specialized such that - * std::swap(m1,m2) will feed to this function. - */ - void - swap(unordered_multimap& __x) - noexcept( noexcept(_M_h.swap(__x._M_h)) ) - { _M_h.swap(__x._M_h); } - - // observers. - - /// Returns the hash functor object with which the %unordered_multimap - /// was constructed. - hasher - hash_function() const - { return _M_h.hash_function(); } - - /// Returns the key comparison object with which the %unordered_multimap - /// was constructed. - key_equal - key_eq() const - { return _M_h.key_eq(); } - - // lookup. - - //@{ - /** - * @brief Tries to locate an element in an %unordered_multimap. - * @param __x Key to be located. - * @return Iterator pointing to sought-after element, or end() if not - * found. - * - * This function takes a key and tries to locate the element with which - * the key matches. If successful the function returns an iterator - * pointing to the sought after element. If unsuccessful it returns the - * past-the-end ( @c end() ) iterator. - */ - iterator - find(const key_type& __x) - { return _M_h.find(__x); } - - const_iterator - find(const key_type& __x) const - { return _M_h.find(__x); } - //@} - - /** - * @brief Finds the number of elements. - * @param __x Key to count. - * @return Number of elements with specified key. - */ - size_type - count(const key_type& __x) const - { return _M_h.count(__x); } - - //@{ - /** - * @brief Finds a subsequence matching given key. - * @param __x Key to be located. - * @return Pair of iterators that possibly points to the subsequence - * matching given key. - */ - std::pair - equal_range(const key_type& __x) - { return _M_h.equal_range(__x); } - - std::pair - equal_range(const key_type& __x) const - { return _M_h.equal_range(__x); } - //@} - - // bucket interface. - - /// Returns the number of buckets of the %unordered_multimap. - size_type - bucket_count() const noexcept - { return _M_h.bucket_count(); } - - /// Returns the maximum number of buckets of the %unordered_multimap. - size_type - max_bucket_count() const noexcept - { return _M_h.max_bucket_count(); } - - /* - * @brief Returns the number of elements in a given bucket. - * @param __n A bucket index. - * @return The number of elements in the bucket. - */ - size_type - bucket_size(size_type __n) const - { return _M_h.bucket_size(__n); } - - /* - * @brief Returns the bucket index of a given element. - * @param __key A key instance. - * @return The key bucket index. - */ - size_type - bucket(const key_type& __key) const - { return _M_h.bucket(__key); } - - /** - * @brief Returns a read/write iterator pointing to the first bucket - * element. - * @param __n The bucket index. - * @return A read/write local iterator. - */ - local_iterator - begin(size_type __n) - { return _M_h.begin(__n); } - - //@{ - /** - * @brief Returns a read-only (constant) iterator pointing to the first - * bucket element. - * @param __n The bucket index. - * @return A read-only local iterator. - */ - const_local_iterator - begin(size_type __n) const - { return _M_h.begin(__n); } - - const_local_iterator - cbegin(size_type __n) const - { return _M_h.cbegin(__n); } - //@} - - /** - * @brief Returns a read/write iterator pointing to one past the last - * bucket elements. - * @param __n The bucket index. - * @return A read/write local iterator. - */ - local_iterator - end(size_type __n) - { return _M_h.end(__n); } - - //@{ - /** - * @brief Returns a read-only (constant) iterator pointing to one past - * the last bucket elements. - * @param __n The bucket index. - * @return A read-only local iterator. - */ - const_local_iterator - end(size_type __n) const - { return _M_h.end(__n); } - - const_local_iterator - cend(size_type __n) const - { return _M_h.cend(__n); } - //@} - - // hash policy. - - /// Returns the average number of elements per bucket. - float - load_factor() const noexcept - { return _M_h.load_factor(); } - - /// Returns a positive number that the %unordered_multimap tries to keep - /// the load factor less than or equal to. - float - max_load_factor() const noexcept - { return _M_h.max_load_factor(); } - - /** - * @brief Change the %unordered_multimap maximum load factor. - * @param __z The new maximum load factor. - */ - void - max_load_factor(float __z) - { _M_h.max_load_factor(__z); } - - /** - * @brief May rehash the %unordered_multimap. - * @param __n The new number of buckets. - * - * Rehash will occur only if the new number of buckets respect the - * %unordered_multimap maximum load factor. - */ - void - rehash(size_type __n) - { _M_h.rehash(__n); } - - /** - * @brief Prepare the %unordered_multimap for a specified number of - * elements. - * @param __n Number of elements required. - * - * Same as rehash(ceil(n / max_load_factor())). - */ - void - reserve(size_type __n) - { _M_h.reserve(__n); } - - template - friend bool - operator==(const unordered_multimap<_Key1, _Tp1, - _Hash1, _Pred1, _Alloc1>&, - const unordered_multimap<_Key1, _Tp1, - _Hash1, _Pred1, _Alloc1>&); - }; - - template - inline void - swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { __x.swap(__y); } - - template - inline void - swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { __x.swap(__y); } - - template - inline bool - operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { return __x._M_h._M_equal(__y._M_h); } - - template - inline bool - operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { return !(__x == __y); } - - template - inline bool - operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { return __x._M_h._M_equal(__y._M_h); } - - template - inline bool - operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { return !(__x == __y); } - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#endif /* _UNORDERED_MAP_H */ diff --git a/openflow/usr/include/c++/5/bits/unordered_set.h b/openflow/usr/include/c++/5/bits/unordered_set.h deleted file mode 100644 index 664d97e..0000000 --- a/openflow/usr/include/c++/5/bits/unordered_set.h +++ /dev/null @@ -1,1434 +0,0 @@ -// unordered_set implementation -*- C++ -*- - -// Copyright (C) 2010-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/unordered_set.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{unordered_set} - */ - -#ifndef _UNORDERED_SET_H -#define _UNORDERED_SET_H - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - /// Base types for unordered_set. - template - using __uset_traits = __detail::_Hashtable_traits<_Cache, true, true>; - - template, - typename _Pred = std::equal_to<_Value>, - typename _Alloc = std::allocator<_Value>, - typename _Tr = __uset_traits<__cache_default<_Value, _Hash>::value>> - using __uset_hashtable = _Hashtable<_Value, _Value, _Alloc, - __detail::_Identity, _Pred, _Hash, - __detail::_Mod_range_hashing, - __detail::_Default_ranged_hash, - __detail::_Prime_rehash_policy, _Tr>; - - /// Base types for unordered_multiset. - template - using __umset_traits = __detail::_Hashtable_traits<_Cache, true, false>; - - template, - typename _Pred = std::equal_to<_Value>, - typename _Alloc = std::allocator<_Value>, - typename _Tr = __umset_traits<__cache_default<_Value, _Hash>::value>> - using __umset_hashtable = _Hashtable<_Value, _Value, _Alloc, - __detail::_Identity, - _Pred, _Hash, - __detail::_Mod_range_hashing, - __detail::_Default_ranged_hash, - __detail::_Prime_rehash_policy, _Tr>; - - /** - * @brief A standard container composed of unique keys (containing - * at most one of each key value) in which the elements' keys are - * the elements themselves. - * - * @ingroup unordered_associative_containers - * - * @tparam _Value Type of key objects. - * @tparam _Hash Hashing function object type, defaults to hash<_Value>. - - * @tparam _Pred Predicate function object type, defaults to - * equal_to<_Value>. - * - * @tparam _Alloc Allocator type, defaults to allocator<_Key>. - * - * Meets the requirements of a container, and - * unordered associative container - * - * Base is _Hashtable, dispatched at compile time via template - * alias __uset_hashtable. - */ - template, - class _Pred = std::equal_to<_Value>, - class _Alloc = std::allocator<_Value> > - class unordered_set - { - typedef __uset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable; - _Hashtable _M_h; - - public: - // typedefs: - //@{ - /// Public typedefs. - typedef typename _Hashtable::key_type key_type; - typedef typename _Hashtable::value_type value_type; - typedef typename _Hashtable::hasher hasher; - typedef typename _Hashtable::key_equal key_equal; - typedef typename _Hashtable::allocator_type allocator_type; - //@} - - //@{ - /// Iterator-related typedefs. - typedef typename _Hashtable::pointer pointer; - typedef typename _Hashtable::const_pointer const_pointer; - typedef typename _Hashtable::reference reference; - typedef typename _Hashtable::const_reference const_reference; - typedef typename _Hashtable::iterator iterator; - typedef typename _Hashtable::const_iterator const_iterator; - typedef typename _Hashtable::local_iterator local_iterator; - typedef typename _Hashtable::const_local_iterator const_local_iterator; - typedef typename _Hashtable::size_type size_type; - typedef typename _Hashtable::difference_type difference_type; - //@} - - // construct/destroy/copy - - /// Default constructor. - unordered_set() = default; - - /** - * @brief Default constructor creates no elements. - * @param __n Minimal initial number of buckets. - * @param __hf A hash functor. - * @param __eql A key equality functor. - * @param __a An allocator object. - */ - explicit - unordered_set(size_type __n, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_h(__n, __hf, __eql, __a) - { } - - /** - * @brief Builds an %unordered_set from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __n Minimal initial number of buckets. - * @param __hf A hash functor. - * @param __eql A key equality functor. - * @param __a An allocator object. - * - * Create an %unordered_set consisting of copies of the elements from - * [__first,__last). This is linear in N (where N is - * distance(__first,__last)). - */ - template - unordered_set(_InputIterator __first, _InputIterator __last, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_h(__first, __last, __n, __hf, __eql, __a) - { } - - /// Copy constructor. - unordered_set(const unordered_set&) = default; - - /// Move constructor. - unordered_set(unordered_set&&) = default; - - /** - * @brief Creates an %unordered_set with no elements. - * @param __a An allocator object. - */ - explicit - unordered_set(const allocator_type& __a) - : _M_h(__a) - { } - - /* - * @brief Copy constructor with allocator argument. - * @param __uset Input %unordered_set to copy. - * @param __a An allocator object. - */ - unordered_set(const unordered_set& __uset, - const allocator_type& __a) - : _M_h(__uset._M_h, __a) - { } - - /* - * @brief Move constructor with allocator argument. - * @param __uset Input %unordered_set to move. - * @param __a An allocator object. - */ - unordered_set(unordered_set&& __uset, - const allocator_type& __a) - : _M_h(std::move(__uset._M_h), __a) - { } - - /** - * @brief Builds an %unordered_set from an initializer_list. - * @param __l An initializer_list. - * @param __n Minimal initial number of buckets. - * @param __hf A hash functor. - * @param __eql A key equality functor. - * @param __a An allocator object. - * - * Create an %unordered_set consisting of copies of the elements in the - * list. This is linear in N (where N is @a __l.size()). - */ - unordered_set(initializer_list __l, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_h(__l, __n, __hf, __eql, __a) - { } - - unordered_set(size_type __n, const allocator_type& __a) - : unordered_set(__n, hasher(), key_equal(), __a) - { } - - unordered_set(size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_set(__n, __hf, key_equal(), __a) - { } - - template - unordered_set(_InputIterator __first, _InputIterator __last, - size_type __n, - const allocator_type& __a) - : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) - { } - - template - unordered_set(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_set(__first, __last, __n, __hf, key_equal(), __a) - { } - - unordered_set(initializer_list __l, - size_type __n, - const allocator_type& __a) - : unordered_set(__l, __n, hasher(), key_equal(), __a) - { } - - unordered_set(initializer_list __l, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_set(__l, __n, __hf, key_equal(), __a) - { } - - /// Copy assignment operator. - unordered_set& - operator=(const unordered_set&) = default; - - /// Move assignment operator. - unordered_set& - operator=(unordered_set&&) = default; - - /** - * @brief %Unordered_set list assignment operator. - * @param __l An initializer_list. - * - * This function fills an %unordered_set with copies of the elements in - * the initializer list @a __l. - * - * Note that the assignment completely changes the %unordered_set and - * that the resulting %unordered_set's size is the same as the number - * of elements assigned. Old data may be lost. - */ - unordered_set& - operator=(initializer_list __l) - { - _M_h = __l; - return *this; - } - - /// Returns the allocator object with which the %unordered_set was - /// constructed. - allocator_type - get_allocator() const noexcept - { return _M_h.get_allocator(); } - - // size and capacity: - - /// Returns true if the %unordered_set is empty. - bool - empty() const noexcept - { return _M_h.empty(); } - - /// Returns the size of the %unordered_set. - size_type - size() const noexcept - { return _M_h.size(); } - - /// Returns the maximum size of the %unordered_set. - size_type - max_size() const noexcept - { return _M_h.max_size(); } - - // iterators. - - //@{ - /** - * Returns a read-only (constant) iterator that points to the first - * element in the %unordered_set. - */ - iterator - begin() noexcept - { return _M_h.begin(); } - - const_iterator - begin() const noexcept - { return _M_h.begin(); } - //@} - - //@{ - /** - * Returns a read-only (constant) iterator that points one past the last - * element in the %unordered_set. - */ - iterator - end() noexcept - { return _M_h.end(); } - - const_iterator - end() const noexcept - { return _M_h.end(); } - //@} - - /** - * Returns a read-only (constant) iterator that points to the first - * element in the %unordered_set. - */ - const_iterator - cbegin() const noexcept - { return _M_h.begin(); } - - /** - * Returns a read-only (constant) iterator that points one past the last - * element in the %unordered_set. - */ - const_iterator - cend() const noexcept - { return _M_h.end(); } - - // modifiers. - - /** - * @brief Attempts to build and insert an element into the - * %unordered_set. - * @param __args Arguments used to generate an element. - * @return A pair, of which the first element is an iterator that points - * to the possibly inserted element, and the second is a bool - * that is true if the element was actually inserted. - * - * This function attempts to build and insert an element into the - * %unordered_set. An %unordered_set relies on unique keys and thus an - * element is only inserted if it is not already present in the - * %unordered_set. - * - * Insertion requires amortized constant time. - */ - template - std::pair - emplace(_Args&&... __args) - { return _M_h.emplace(std::forward<_Args>(__args)...); } - - /** - * @brief Attempts to insert an element into the %unordered_set. - * @param __pos An iterator that serves as a hint as to where the - * element should be inserted. - * @param __args Arguments used to generate the element to be - * inserted. - * @return An iterator that points to the element with key equivalent to - * the one generated from @a __args (may or may not be the - * element itself). - * - * This function is not concerned about whether the insertion took place, - * and thus does not return a boolean like the single-argument emplace() - * does. Note that the first parameter is only a hint and can - * potentially improve the performance of the insertion process. A bad - * hint would cause no gains in efficiency. - * - * For more on @a hinting, see: - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * - * Insertion requires amortized constant time. - */ - template - iterator - emplace_hint(const_iterator __pos, _Args&&... __args) - { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } - - //@{ - /** - * @brief Attempts to insert an element into the %unordered_set. - * @param __x Element to be inserted. - * @return A pair, of which the first element is an iterator that points - * to the possibly inserted element, and the second is a bool - * that is true if the element was actually inserted. - * - * This function attempts to insert an element into the %unordered_set. - * An %unordered_set relies on unique keys and thus an element is only - * inserted if it is not already present in the %unordered_set. - * - * Insertion requires amortized constant time. - */ - std::pair - insert(const value_type& __x) - { return _M_h.insert(__x); } - - std::pair - insert(value_type&& __x) - { return _M_h.insert(std::move(__x)); } - //@} - - //@{ - /** - * @brief Attempts to insert an element into the %unordered_set. - * @param __hint An iterator that serves as a hint as to where the - * element should be inserted. - * @param __x Element to be inserted. - * @return An iterator that points to the element with key of - * @a __x (may or may not be the element passed in). - * - * This function is not concerned about whether the insertion took place, - * and thus does not return a boolean like the single-argument insert() - * does. Note that the first parameter is only a hint and can - * potentially improve the performance of the insertion process. A bad - * hint would cause no gains in efficiency. - * - * For more on @a hinting, see: - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * - * Insertion requires amortized constant. - */ - iterator - insert(const_iterator __hint, const value_type& __x) - { return _M_h.insert(__hint, __x); } - - iterator - insert(const_iterator __hint, value_type&& __x) - { return _M_h.insert(__hint, std::move(__x)); } - //@} - - /** - * @brief A template function that attempts to insert a range of - * elements. - * @param __first Iterator pointing to the start of the range to be - * inserted. - * @param __last Iterator pointing to the end of the range. - * - * Complexity similar to that of the range constructor. - */ - template - void - insert(_InputIterator __first, _InputIterator __last) - { _M_h.insert(__first, __last); } - - /** - * @brief Attempts to insert a list of elements into the %unordered_set. - * @param __l A std::initializer_list of elements - * to be inserted. - * - * Complexity similar to that of the range constructor. - */ - void - insert(initializer_list __l) - { _M_h.insert(__l); } - - //@{ - /** - * @brief Erases an element from an %unordered_set. - * @param __position An iterator pointing to the element to be erased. - * @return An iterator pointing to the element immediately following - * @a __position prior to the element being erased. If no such - * element exists, end() is returned. - * - * This function erases an element, pointed to by the given iterator, - * from an %unordered_set. Note that this function only erases the - * element, and that if the element is itself a pointer, the pointed-to - * memory is not touched in any way. Managing the pointer is the user's - * responsibility. - */ - iterator - erase(const_iterator __position) - { return _M_h.erase(__position); } - - // LWG 2059. - iterator - erase(iterator __position) - { return _M_h.erase(__position); } - //@} - - /** - * @brief Erases elements according to the provided key. - * @param __x Key of element to be erased. - * @return The number of elements erased. - * - * This function erases all the elements located by the given key from - * an %unordered_set. For an %unordered_set the result of this function - * can only be 0 (not present) or 1 (present). - * Note that this function only erases the element, and that if - * the element is itself a pointer, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - size_type - erase(const key_type& __x) - { return _M_h.erase(__x); } - - /** - * @brief Erases a [__first,__last) range of elements from an - * %unordered_set. - * @param __first Iterator pointing to the start of the range to be - * erased. - * @param __last Iterator pointing to the end of the range to - * be erased. - * @return The iterator @a __last. - * - * This function erases a sequence of elements from an %unordered_set. - * Note that this function only erases the element, and that if - * the element is itself a pointer, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - iterator - erase(const_iterator __first, const_iterator __last) - { return _M_h.erase(__first, __last); } - - /** - * Erases all elements in an %unordered_set. Note that this function only - * erases the elements, and that if the elements themselves are pointers, - * the pointed-to memory is not touched in any way. Managing the pointer - * is the user's responsibility. - */ - void - clear() noexcept - { _M_h.clear(); } - - /** - * @brief Swaps data with another %unordered_set. - * @param __x An %unordered_set of the same element and allocator - * types. - * - * This exchanges the elements between two sets in constant time. - * Note that the global std::swap() function is specialized such that - * std::swap(s1,s2) will feed to this function. - */ - void - swap(unordered_set& __x) - noexcept( noexcept(_M_h.swap(__x._M_h)) ) - { _M_h.swap(__x._M_h); } - - // observers. - - /// Returns the hash functor object with which the %unordered_set was - /// constructed. - hasher - hash_function() const - { return _M_h.hash_function(); } - - /// Returns the key comparison object with which the %unordered_set was - /// constructed. - key_equal - key_eq() const - { return _M_h.key_eq(); } - - // lookup. - - //@{ - /** - * @brief Tries to locate an element in an %unordered_set. - * @param __x Element to be located. - * @return Iterator pointing to sought-after element, or end() if not - * found. - * - * This function takes a key and tries to locate the element with which - * the key matches. If successful the function returns an iterator - * pointing to the sought after element. If unsuccessful it returns the - * past-the-end ( @c end() ) iterator. - */ - iterator - find(const key_type& __x) - { return _M_h.find(__x); } - - const_iterator - find(const key_type& __x) const - { return _M_h.find(__x); } - //@} - - /** - * @brief Finds the number of elements. - * @param __x Element to located. - * @return Number of elements with specified key. - * - * This function only makes sense for unordered_multisets; for - * unordered_set the result will either be 0 (not present) or 1 - * (present). - */ - size_type - count(const key_type& __x) const - { return _M_h.count(__x); } - - //@{ - /** - * @brief Finds a subsequence matching given key. - * @param __x Key to be located. - * @return Pair of iterators that possibly points to the subsequence - * matching given key. - * - * This function probably only makes sense for multisets. - */ - std::pair - equal_range(const key_type& __x) - { return _M_h.equal_range(__x); } - - std::pair - equal_range(const key_type& __x) const - { return _M_h.equal_range(__x); } - //@} - - // bucket interface. - - /// Returns the number of buckets of the %unordered_set. - size_type - bucket_count() const noexcept - { return _M_h.bucket_count(); } - - /// Returns the maximum number of buckets of the %unordered_set. - size_type - max_bucket_count() const noexcept - { return _M_h.max_bucket_count(); } - - /* - * @brief Returns the number of elements in a given bucket. - * @param __n A bucket index. - * @return The number of elements in the bucket. - */ - size_type - bucket_size(size_type __n) const - { return _M_h.bucket_size(__n); } - - /* - * @brief Returns the bucket index of a given element. - * @param __key A key instance. - * @return The key bucket index. - */ - size_type - bucket(const key_type& __key) const - { return _M_h.bucket(__key); } - - //@{ - /** - * @brief Returns a read-only (constant) iterator pointing to the first - * bucket element. - * @param __n The bucket index. - * @return A read-only local iterator. - */ - local_iterator - begin(size_type __n) - { return _M_h.begin(__n); } - - const_local_iterator - begin(size_type __n) const - { return _M_h.begin(__n); } - - const_local_iterator - cbegin(size_type __n) const - { return _M_h.cbegin(__n); } - //@} - - //@{ - /** - * @brief Returns a read-only (constant) iterator pointing to one past - * the last bucket elements. - * @param __n The bucket index. - * @return A read-only local iterator. - */ - local_iterator - end(size_type __n) - { return _M_h.end(__n); } - - const_local_iterator - end(size_type __n) const - { return _M_h.end(__n); } - - const_local_iterator - cend(size_type __n) const - { return _M_h.cend(__n); } - //@} - - // hash policy. - - /// Returns the average number of elements per bucket. - float - load_factor() const noexcept - { return _M_h.load_factor(); } - - /// Returns a positive number that the %unordered_set tries to keep the - /// load factor less than or equal to. - float - max_load_factor() const noexcept - { return _M_h.max_load_factor(); } - - /** - * @brief Change the %unordered_set maximum load factor. - * @param __z The new maximum load factor. - */ - void - max_load_factor(float __z) - { _M_h.max_load_factor(__z); } - - /** - * @brief May rehash the %unordered_set. - * @param __n The new number of buckets. - * - * Rehash will occur only if the new number of buckets respect the - * %unordered_set maximum load factor. - */ - void - rehash(size_type __n) - { _M_h.rehash(__n); } - - /** - * @brief Prepare the %unordered_set for a specified number of - * elements. - * @param __n Number of elements required. - * - * Same as rehash(ceil(n / max_load_factor())). - */ - void - reserve(size_type __n) - { _M_h.reserve(__n); } - - template - friend bool - operator==(const unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&, - const unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&); - }; - - /** - * @brief A standard container composed of equivalent keys - * (possibly containing multiple of each key value) in which the - * elements' keys are the elements themselves. - * - * @ingroup unordered_associative_containers - * - * @tparam _Value Type of key objects. - * @tparam _Hash Hashing function object type, defaults to hash<_Value>. - * @tparam _Pred Predicate function object type, defaults - * to equal_to<_Value>. - * @tparam _Alloc Allocator type, defaults to allocator<_Key>. - * - * Meets the requirements of a container, and - * unordered associative container - * - * Base is _Hashtable, dispatched at compile time via template - * alias __umset_hashtable. - */ - template, - class _Pred = std::equal_to<_Value>, - class _Alloc = std::allocator<_Value> > - class unordered_multiset - { - typedef __umset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable; - _Hashtable _M_h; - - public: - // typedefs: - //@{ - /// Public typedefs. - typedef typename _Hashtable::key_type key_type; - typedef typename _Hashtable::value_type value_type; - typedef typename _Hashtable::hasher hasher; - typedef typename _Hashtable::key_equal key_equal; - typedef typename _Hashtable::allocator_type allocator_type; - //@} - - //@{ - /// Iterator-related typedefs. - typedef typename _Hashtable::pointer pointer; - typedef typename _Hashtable::const_pointer const_pointer; - typedef typename _Hashtable::reference reference; - typedef typename _Hashtable::const_reference const_reference; - typedef typename _Hashtable::iterator iterator; - typedef typename _Hashtable::const_iterator const_iterator; - typedef typename _Hashtable::local_iterator local_iterator; - typedef typename _Hashtable::const_local_iterator const_local_iterator; - typedef typename _Hashtable::size_type size_type; - typedef typename _Hashtable::difference_type difference_type; - //@} - - // construct/destroy/copy - - /// Default constructor. - unordered_multiset() = default; - - /** - * @brief Default constructor creates no elements. - * @param __n Minimal initial number of buckets. - * @param __hf A hash functor. - * @param __eql A key equality functor. - * @param __a An allocator object. - */ - explicit - unordered_multiset(size_type __n, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_h(__n, __hf, __eql, __a) - { } - - /** - * @brief Builds an %unordered_multiset from a range. - * @param __first An input iterator. - * @param __last An input iterator. - * @param __n Minimal initial number of buckets. - * @param __hf A hash functor. - * @param __eql A key equality functor. - * @param __a An allocator object. - * - * Create an %unordered_multiset consisting of copies of the elements - * from [__first,__last). This is linear in N (where N is - * distance(__first,__last)). - */ - template - unordered_multiset(_InputIterator __first, _InputIterator __last, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_h(__first, __last, __n, __hf, __eql, __a) - { } - - /// Copy constructor. - unordered_multiset(const unordered_multiset&) = default; - - /// Move constructor. - unordered_multiset(unordered_multiset&&) = default; - - /** - * @brief Builds an %unordered_multiset from an initializer_list. - * @param __l An initializer_list. - * @param __n Minimal initial number of buckets. - * @param __hf A hash functor. - * @param __eql A key equality functor. - * @param __a An allocator object. - * - * Create an %unordered_multiset consisting of copies of the elements in - * the list. This is linear in N (where N is @a __l.size()). - */ - unordered_multiset(initializer_list __l, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_h(__l, __n, __hf, __eql, __a) - { } - - /// Copy assignment operator. - unordered_multiset& - operator=(const unordered_multiset&) = default; - - /// Move assignment operator. - unordered_multiset& - operator=(unordered_multiset&&) = default; - - /** - * @brief Creates an %unordered_multiset with no elements. - * @param __a An allocator object. - */ - explicit - unordered_multiset(const allocator_type& __a) - : _M_h(__a) - { } - - /* - * @brief Copy constructor with allocator argument. - * @param __uset Input %unordered_multiset to copy. - * @param __a An allocator object. - */ - unordered_multiset(const unordered_multiset& __umset, - const allocator_type& __a) - : _M_h(__umset._M_h, __a) - { } - - /* - * @brief Move constructor with allocator argument. - * @param __umset Input %unordered_multiset to move. - * @param __a An allocator object. - */ - unordered_multiset(unordered_multiset&& __umset, - const allocator_type& __a) - : _M_h(std::move(__umset._M_h), __a) - { } - - unordered_multiset(size_type __n, const allocator_type& __a) - : unordered_multiset(__n, hasher(), key_equal(), __a) - { } - - unordered_multiset(size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multiset(__n, __hf, key_equal(), __a) - { } - - template - unordered_multiset(_InputIterator __first, _InputIterator __last, - size_type __n, - const allocator_type& __a) - : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) - { } - - template - unordered_multiset(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) - { } - - unordered_multiset(initializer_list __l, - size_type __n, - const allocator_type& __a) - : unordered_multiset(__l, __n, hasher(), key_equal(), __a) - { } - - unordered_multiset(initializer_list __l, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multiset(__l, __n, __hf, key_equal(), __a) - { } - - /** - * @brief %Unordered_multiset list assignment operator. - * @param __l An initializer_list. - * - * This function fills an %unordered_multiset with copies of the elements - * in the initializer list @a __l. - * - * Note that the assignment completely changes the %unordered_multiset - * and that the resulting %unordered_multiset's size is the same as the - * number of elements assigned. Old data may be lost. - */ - unordered_multiset& - operator=(initializer_list __l) - { - _M_h = __l; - return *this; - } - - /// Returns the allocator object with which the %unordered_multiset was - /// constructed. - allocator_type - get_allocator() const noexcept - { return _M_h.get_allocator(); } - - // size and capacity: - - /// Returns true if the %unordered_multiset is empty. - bool - empty() const noexcept - { return _M_h.empty(); } - - /// Returns the size of the %unordered_multiset. - size_type - size() const noexcept - { return _M_h.size(); } - - /// Returns the maximum size of the %unordered_multiset. - size_type - max_size() const noexcept - { return _M_h.max_size(); } - - // iterators. - - //@{ - /** - * Returns a read-only (constant) iterator that points to the first - * element in the %unordered_multiset. - */ - iterator - begin() noexcept - { return _M_h.begin(); } - - const_iterator - begin() const noexcept - { return _M_h.begin(); } - //@} - - //@{ - /** - * Returns a read-only (constant) iterator that points one past the last - * element in the %unordered_multiset. - */ - iterator - end() noexcept - { return _M_h.end(); } - - const_iterator - end() const noexcept - { return _M_h.end(); } - //@} - - /** - * Returns a read-only (constant) iterator that points to the first - * element in the %unordered_multiset. - */ - const_iterator - cbegin() const noexcept - { return _M_h.begin(); } - - /** - * Returns a read-only (constant) iterator that points one past the last - * element in the %unordered_multiset. - */ - const_iterator - cend() const noexcept - { return _M_h.end(); } - - // modifiers. - - /** - * @brief Builds and insert an element into the %unordered_multiset. - * @param __args Arguments used to generate an element. - * @return An iterator that points to the inserted element. - * - * Insertion requires amortized constant time. - */ - template - iterator - emplace(_Args&&... __args) - { return _M_h.emplace(std::forward<_Args>(__args)...); } - - /** - * @brief Inserts an element into the %unordered_multiset. - * @param __pos An iterator that serves as a hint as to where the - * element should be inserted. - * @param __args Arguments used to generate the element to be - * inserted. - * @return An iterator that points to the inserted element. - * - * Note that the first parameter is only a hint and can potentially - * improve the performance of the insertion process. A bad hint would - * cause no gains in efficiency. - * - * For more on @a hinting, see: - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * - * Insertion requires amortized constant time. - */ - template - iterator - emplace_hint(const_iterator __pos, _Args&&... __args) - { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } - - //@{ - /** - * @brief Inserts an element into the %unordered_multiset. - * @param __x Element to be inserted. - * @return An iterator that points to the inserted element. - * - * Insertion requires amortized constant time. - */ - iterator - insert(const value_type& __x) - { return _M_h.insert(__x); } - - iterator - insert(value_type&& __x) - { return _M_h.insert(std::move(__x)); } - //@} - - //@{ - /** - * @brief Inserts an element into the %unordered_multiset. - * @param __hint An iterator that serves as a hint as to where the - * element should be inserted. - * @param __x Element to be inserted. - * @return An iterator that points to the inserted element. - * - * Note that the first parameter is only a hint and can potentially - * improve the performance of the insertion process. A bad hint would - * cause no gains in efficiency. - * - * For more on @a hinting, see: - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints - * - * Insertion requires amortized constant. - */ - iterator - insert(const_iterator __hint, const value_type& __x) - { return _M_h.insert(__hint, __x); } - - iterator - insert(const_iterator __hint, value_type&& __x) - { return _M_h.insert(__hint, std::move(__x)); } - //@} - - /** - * @brief A template function that inserts a range of elements. - * @param __first Iterator pointing to the start of the range to be - * inserted. - * @param __last Iterator pointing to the end of the range. - * - * Complexity similar to that of the range constructor. - */ - template - void - insert(_InputIterator __first, _InputIterator __last) - { _M_h.insert(__first, __last); } - - /** - * @brief Inserts a list of elements into the %unordered_multiset. - * @param __l A std::initializer_list of elements to be - * inserted. - * - * Complexity similar to that of the range constructor. - */ - void - insert(initializer_list __l) - { _M_h.insert(__l); } - - //@{ - /** - * @brief Erases an element from an %unordered_multiset. - * @param __position An iterator pointing to the element to be erased. - * @return An iterator pointing to the element immediately following - * @a __position prior to the element being erased. If no such - * element exists, end() is returned. - * - * This function erases an element, pointed to by the given iterator, - * from an %unordered_multiset. - * - * Note that this function only erases the element, and that if the - * element is itself a pointer, the pointed-to memory is not touched in - * any way. Managing the pointer is the user's responsibility. - */ - iterator - erase(const_iterator __position) - { return _M_h.erase(__position); } - - // LWG 2059. - iterator - erase(iterator __position) - { return _M_h.erase(__position); } - //@} - - - /** - * @brief Erases elements according to the provided key. - * @param __x Key of element to be erased. - * @return The number of elements erased. - * - * This function erases all the elements located by the given key from - * an %unordered_multiset. - * - * Note that this function only erases the element, and that if the - * element is itself a pointer, the pointed-to memory is not touched in - * any way. Managing the pointer is the user's responsibility. - */ - size_type - erase(const key_type& __x) - { return _M_h.erase(__x); } - - /** - * @brief Erases a [__first,__last) range of elements from an - * %unordered_multiset. - * @param __first Iterator pointing to the start of the range to be - * erased. - * @param __last Iterator pointing to the end of the range to - * be erased. - * @return The iterator @a __last. - * - * This function erases a sequence of elements from an - * %unordered_multiset. - * - * Note that this function only erases the element, and that if - * the element is itself a pointer, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - iterator - erase(const_iterator __first, const_iterator __last) - { return _M_h.erase(__first, __last); } - - /** - * Erases all elements in an %unordered_multiset. - * - * Note that this function only erases the elements, and that if the - * elements themselves are pointers, the pointed-to memory is not touched - * in any way. Managing the pointer is the user's responsibility. - */ - void - clear() noexcept - { _M_h.clear(); } - - /** - * @brief Swaps data with another %unordered_multiset. - * @param __x An %unordered_multiset of the same element and allocator - * types. - * - * This exchanges the elements between two sets in constant time. - * Note that the global std::swap() function is specialized such that - * std::swap(s1,s2) will feed to this function. - */ - void - swap(unordered_multiset& __x) - noexcept( noexcept(_M_h.swap(__x._M_h)) ) - { _M_h.swap(__x._M_h); } - - // observers. - - /// Returns the hash functor object with which the %unordered_multiset - /// was constructed. - hasher - hash_function() const - { return _M_h.hash_function(); } - - /// Returns the key comparison object with which the %unordered_multiset - /// was constructed. - key_equal - key_eq() const - { return _M_h.key_eq(); } - - // lookup. - - //@{ - /** - * @brief Tries to locate an element in an %unordered_multiset. - * @param __x Element to be located. - * @return Iterator pointing to sought-after element, or end() if not - * found. - * - * This function takes a key and tries to locate the element with which - * the key matches. If successful the function returns an iterator - * pointing to the sought after element. If unsuccessful it returns the - * past-the-end ( @c end() ) iterator. - */ - iterator - find(const key_type& __x) - { return _M_h.find(__x); } - - const_iterator - find(const key_type& __x) const - { return _M_h.find(__x); } - //@} - - /** - * @brief Finds the number of elements. - * @param __x Element to located. - * @return Number of elements with specified key. - */ - size_type - count(const key_type& __x) const - { return _M_h.count(__x); } - - //@{ - /** - * @brief Finds a subsequence matching given key. - * @param __x Key to be located. - * @return Pair of iterators that possibly points to the subsequence - * matching given key. - */ - std::pair - equal_range(const key_type& __x) - { return _M_h.equal_range(__x); } - - std::pair - equal_range(const key_type& __x) const - { return _M_h.equal_range(__x); } - //@} - - // bucket interface. - - /// Returns the number of buckets of the %unordered_multiset. - size_type - bucket_count() const noexcept - { return _M_h.bucket_count(); } - - /// Returns the maximum number of buckets of the %unordered_multiset. - size_type - max_bucket_count() const noexcept - { return _M_h.max_bucket_count(); } - - /* - * @brief Returns the number of elements in a given bucket. - * @param __n A bucket index. - * @return The number of elements in the bucket. - */ - size_type - bucket_size(size_type __n) const - { return _M_h.bucket_size(__n); } - - /* - * @brief Returns the bucket index of a given element. - * @param __key A key instance. - * @return The key bucket index. - */ - size_type - bucket(const key_type& __key) const - { return _M_h.bucket(__key); } - - //@{ - /** - * @brief Returns a read-only (constant) iterator pointing to the first - * bucket element. - * @param __n The bucket index. - * @return A read-only local iterator. - */ - local_iterator - begin(size_type __n) - { return _M_h.begin(__n); } - - const_local_iterator - begin(size_type __n) const - { return _M_h.begin(__n); } - - const_local_iterator - cbegin(size_type __n) const - { return _M_h.cbegin(__n); } - //@} - - //@{ - /** - * @brief Returns a read-only (constant) iterator pointing to one past - * the last bucket elements. - * @param __n The bucket index. - * @return A read-only local iterator. - */ - local_iterator - end(size_type __n) - { return _M_h.end(__n); } - - const_local_iterator - end(size_type __n) const - { return _M_h.end(__n); } - - const_local_iterator - cend(size_type __n) const - { return _M_h.cend(__n); } - //@} - - // hash policy. - - /// Returns the average number of elements per bucket. - float - load_factor() const noexcept - { return _M_h.load_factor(); } - - /// Returns a positive number that the %unordered_multiset tries to keep the - /// load factor less than or equal to. - float - max_load_factor() const noexcept - { return _M_h.max_load_factor(); } - - /** - * @brief Change the %unordered_multiset maximum load factor. - * @param __z The new maximum load factor. - */ - void - max_load_factor(float __z) - { _M_h.max_load_factor(__z); } - - /** - * @brief May rehash the %unordered_multiset. - * @param __n The new number of buckets. - * - * Rehash will occur only if the new number of buckets respect the - * %unordered_multiset maximum load factor. - */ - void - rehash(size_type __n) - { _M_h.rehash(__n); } - - /** - * @brief Prepare the %unordered_multiset for a specified number of - * elements. - * @param __n Number of elements required. - * - * Same as rehash(ceil(n / max_load_factor())). - */ - void - reserve(size_type __n) - { _M_h.reserve(__n); } - - template - friend bool - operator==(const unordered_multiset<_Value1, _Hash1, _Pred1, _Alloc1>&, - const unordered_multiset<_Value1, _Hash1, _Pred1, _Alloc1>&); - }; - - template - inline void - swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, - unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) - { __x.swap(__y); } - - template - inline void - swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, - unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) - { __x.swap(__y); } - - template - inline bool - operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) - { return __x._M_h._M_equal(__y._M_h); } - - template - inline bool - operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) - { return !(__x == __y); } - - template - inline bool - operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) - { return __x._M_h._M_equal(__y._M_h); } - - template - inline bool - operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) - { return !(__x == __y); } - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#endif /* _UNORDERED_SET_H */ diff --git a/openflow/usr/include/c++/5/bits/uses_allocator.h b/openflow/usr/include/c++/5/bits/uses_allocator.h deleted file mode 100644 index f9ea7d6..0000000 --- a/openflow/usr/include/c++/5/bits/uses_allocator.h +++ /dev/null @@ -1,104 +0,0 @@ -// Uses-allocator Construction -*- C++ -*- - -// Copyright (C) 2010-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -#ifndef _USES_ALLOCATOR_H -#define _USES_ALLOCATOR_H 1 - -#if __cplusplus < 201103L -# include -#else - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /// [allocator.tag] - struct allocator_arg_t { }; - - constexpr allocator_arg_t allocator_arg = allocator_arg_t(); - - template> - struct __uses_allocator_helper - : false_type { }; - - template - struct __uses_allocator_helper<_Tp, _Alloc, - __void_t> - : is_convertible<_Alloc, typename _Tp::allocator_type>::type - { }; - - /// [allocator.uses.trait] - template - struct uses_allocator - : __uses_allocator_helper<_Tp, _Alloc>::type - { }; - - struct __uses_alloc_base { }; - - struct __uses_alloc0 : __uses_alloc_base - { - struct _Sink { void operator=(const void*) { } } _M_a; - }; - - template - struct __uses_alloc1 : __uses_alloc_base { const _Alloc* _M_a; }; - - template - struct __uses_alloc2 : __uses_alloc_base { const _Alloc* _M_a; }; - - template - struct __uses_alloc; - - template - struct __uses_alloc - : conditional< - is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value, - __uses_alloc1<_Alloc>, - __uses_alloc2<_Alloc>>::type - { }; - - template - struct __uses_alloc - : __uses_alloc0 { }; - - template - using __uses_alloc_t = - __uses_alloc::value, _Tp, _Alloc, _Args...>; - - template - inline __uses_alloc_t<_Tp, _Alloc, _Args...> - __use_alloc(const _Alloc& __a) - { - __uses_alloc_t<_Tp, _Alloc, _Args...> __ret; - __ret._M_a = &__a; - return __ret; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif -#endif diff --git a/openflow/usr/include/c++/5/bits/valarray_after.h b/openflow/usr/include/c++/5/bits/valarray_after.h deleted file mode 100644 index 0c02ed1..0000000 --- a/openflow/usr/include/c++/5/bits/valarray_after.h +++ /dev/null @@ -1,551 +0,0 @@ -// The template and inlines for the -*- C++ -*- internal _Meta class. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/valarray_after.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{valarray} - */ - -// Written by Gabriel Dos Reis - -#ifndef _VALARRAY_AFTER_H -#define _VALARRAY_AFTER_H 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // - // gslice_array closure. - // - template - class _GBase - { - public: - typedef typename _Dom::value_type value_type; - - _GBase (const _Dom& __e, const valarray& __i) - : _M_expr (__e), _M_index(__i) {} - - value_type - operator[] (size_t __i) const - { return _M_expr[_M_index[__i]]; } - - size_t - size () const - { return _M_index.size(); } - - private: - const _Dom& _M_expr; - const valarray& _M_index; - }; - - template - class _GBase<_Array<_Tp> > - { - public: - typedef _Tp value_type; - - _GBase (_Array<_Tp> __a, const valarray& __i) - : _M_array (__a), _M_index(__i) {} - - value_type - operator[] (size_t __i) const - { return _M_array._M_data[_M_index[__i]]; } - - size_t - size () const - { return _M_index.size(); } - - private: - const _Array<_Tp> _M_array; - const valarray& _M_index; - }; - - template - struct _GClos<_Expr, _Dom> - : _GBase<_Dom> - { - typedef _GBase<_Dom> _Base; - typedef typename _Base::value_type value_type; - - _GClos (const _Dom& __e, const valarray& __i) - : _Base (__e, __i) {} - }; - - template - struct _GClos<_ValArray, _Tp> - : _GBase<_Array<_Tp> > - { - typedef _GBase<_Array<_Tp> > _Base; - typedef typename _Base::value_type value_type; - - _GClos (_Array<_Tp> __a, const valarray& __i) - : _Base (__a, __i) {} - }; - - // - // indirect_array closure - // - template - class _IBase - { - public: - typedef typename _Dom::value_type value_type; - - _IBase (const _Dom& __e, const valarray& __i) - : _M_expr (__e), _M_index (__i) {} - - value_type - operator[] (size_t __i) const - { return _M_expr[_M_index[__i]]; } - - size_t - size() const - { return _M_index.size(); } - - private: - const _Dom& _M_expr; - const valarray& _M_index; - }; - - template - struct _IClos<_Expr, _Dom> - : _IBase<_Dom> - { - typedef _IBase<_Dom> _Base; - typedef typename _Base::value_type value_type; - - _IClos (const _Dom& __e, const valarray& __i) - : _Base (__e, __i) {} - }; - - template - struct _IClos<_ValArray, _Tp> - : _IBase > - { - typedef _IBase > _Base; - typedef _Tp value_type; - - _IClos (const valarray<_Tp>& __a, const valarray& __i) - : _Base (__a, __i) {} - }; - - // - // class _Expr - // - template - class _Expr - { - public: - typedef _Tp value_type; - - _Expr(const _Clos&); - - const _Clos& operator()() const; - - value_type operator[](size_t) const; - valarray operator[](slice) const; - valarray operator[](const gslice&) const; - valarray operator[](const valarray&) const; - valarray operator[](const valarray&) const; - - _Expr<_UnClos<__unary_plus, std::_Expr, _Clos>, value_type> - operator+() const; - - _Expr<_UnClos<__negate, std::_Expr, _Clos>, value_type> - operator-() const; - - _Expr<_UnClos<__bitwise_not, std::_Expr, _Clos>, value_type> - operator~() const; - - _Expr<_UnClos<__logical_not, std::_Expr, _Clos>, bool> - operator!() const; - - size_t size() const; - value_type sum() const; - - valarray shift(int) const; - valarray cshift(int) const; - - value_type min() const; - value_type max() const; - - valarray apply(value_type (*)(const value_type&)) const; - valarray apply(value_type (*)(value_type)) const; - - private: - const _Clos _M_closure; - }; - - template - inline - _Expr<_Clos, _Tp>::_Expr(const _Clos& __c) : _M_closure(__c) {} - - template - inline const _Clos& - _Expr<_Clos, _Tp>::operator()() const - { return _M_closure; } - - template - inline _Tp - _Expr<_Clos, _Tp>::operator[](size_t __i) const - { return _M_closure[__i]; } - - template - inline valarray<_Tp> - _Expr<_Clos, _Tp>::operator[](slice __s) const - { - valarray<_Tp> __v = valarray<_Tp>(*this)[__s]; - return __v; - } - - template - inline valarray<_Tp> - _Expr<_Clos, _Tp>::operator[](const gslice& __gs) const - { - valarray<_Tp> __v = valarray<_Tp>(*this)[__gs]; - return __v; - } - - template - inline valarray<_Tp> - _Expr<_Clos, _Tp>::operator[](const valarray& __m) const - { - valarray<_Tp> __v = valarray<_Tp>(*this)[__m]; - return __v; - } - - template - inline valarray<_Tp> - _Expr<_Clos, _Tp>::operator[](const valarray& __i) const - { - valarray<_Tp> __v = valarray<_Tp>(*this)[__i]; - return __v; - } - - template - inline size_t - _Expr<_Clos, _Tp>::size() const - { return _M_closure.size(); } - - template - inline valarray<_Tp> - _Expr<_Clos, _Tp>::shift(int __n) const - { - valarray<_Tp> __v = valarray<_Tp>(*this).shift(__n); - return __v; - } - - template - inline valarray<_Tp> - _Expr<_Clos, _Tp>::cshift(int __n) const - { - valarray<_Tp> __v = valarray<_Tp>(*this).cshift(__n); - return __v; - } - - template - inline valarray<_Tp> - _Expr<_Clos, _Tp>::apply(_Tp __f(const _Tp&)) const - { - valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f); - return __v; - } - - template - inline valarray<_Tp> - _Expr<_Clos, _Tp>::apply(_Tp __f(_Tp)) const - { - valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f); - return __v; - } - - // XXX: replace this with a more robust summation algorithm. - template - inline _Tp - _Expr<_Clos, _Tp>::sum() const - { - size_t __n = _M_closure.size(); - if (__n == 0) - return _Tp(); - else - { - _Tp __s = _M_closure[--__n]; - while (__n != 0) - __s += _M_closure[--__n]; - return __s; - } - } - - template - inline _Tp - _Expr<_Clos, _Tp>::min() const - { return __valarray_min(_M_closure); } - - template - inline _Tp - _Expr<_Clos, _Tp>::max() const - { return __valarray_max(_M_closure); } - - template - inline _Expr<_UnClos<__logical_not, _Expr, _Dom>, bool> - _Expr<_Dom, _Tp>::operator!() const - { - typedef _UnClos<__logical_not, std::_Expr, _Dom> _Closure; - return _Expr<_Closure, bool>(_Closure(this->_M_closure)); - } - -#define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name) \ - template \ - inline _Expr<_UnClos<_Name, std::_Expr, _Dom>, _Tp> \ - _Expr<_Dom, _Tp>::operator _Op() const \ - { \ - typedef _UnClos<_Name, std::_Expr, _Dom> _Closure; \ - return _Expr<_Closure, _Tp>(_Closure(this->_M_closure)); \ - } - - _DEFINE_EXPR_UNARY_OPERATOR(+, __unary_plus) - _DEFINE_EXPR_UNARY_OPERATOR(-, __negate) - _DEFINE_EXPR_UNARY_OPERATOR(~, __bitwise_not) - -#undef _DEFINE_EXPR_UNARY_OPERATOR - -#define _DEFINE_EXPR_BINARY_OPERATOR(_Op, _Name) \ - template \ - inline _Expr<_BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2>, \ - typename __fun<_Name, typename _Dom1::value_type>::result_type> \ - operator _Op(const _Expr<_Dom1, typename _Dom1::value_type>& __v, \ - const _Expr<_Dom2, typename _Dom2::value_type>& __w) \ - { \ - typedef typename _Dom1::value_type _Arg; \ - typedef typename __fun<_Name, _Arg>::result_type _Value; \ - typedef _BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2> _Closure; \ - return _Expr<_Closure, _Value>(_Closure(__v(), __w())); \ - } \ - \ - template \ - inline _Expr<_BinClos<_Name, _Expr, _Constant, _Dom, \ - typename _Dom::value_type>, \ - typename __fun<_Name, typename _Dom::value_type>::result_type> \ - operator _Op(const _Expr<_Dom, typename _Dom::value_type>& __v, \ - const typename _Dom::value_type& __t) \ - { \ - typedef typename _Dom::value_type _Arg; \ - typedef typename __fun<_Name, _Arg>::result_type _Value; \ - typedef _BinClos<_Name, _Expr, _Constant, _Dom, _Arg> _Closure; \ - return _Expr<_Closure, _Value>(_Closure(__v(), __t)); \ - } \ - \ - template \ - inline _Expr<_BinClos<_Name, _Constant, _Expr, \ - typename _Dom::value_type, _Dom>, \ - typename __fun<_Name, typename _Dom::value_type>::result_type> \ - operator _Op(const typename _Dom::value_type& __t, \ - const _Expr<_Dom, typename _Dom::value_type>& __v) \ - { \ - typedef typename _Dom::value_type _Arg; \ - typedef typename __fun<_Name, _Arg>::result_type _Value; \ - typedef _BinClos<_Name, _Constant, _Expr, _Arg, _Dom> _Closure; \ - return _Expr<_Closure, _Value>(_Closure(__t, __v())); \ - } \ - \ - template \ - inline _Expr<_BinClos<_Name, _Expr, _ValArray, \ - _Dom, typename _Dom::value_type>, \ - typename __fun<_Name, typename _Dom::value_type>::result_type> \ - operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __e, \ - const valarray& __v) \ - { \ - typedef typename _Dom::value_type _Arg; \ - typedef typename __fun<_Name, _Arg>::result_type _Value; \ - typedef _BinClos<_Name, _Expr, _ValArray, _Dom, _Arg> _Closure; \ - return _Expr<_Closure, _Value>(_Closure(__e(), __v)); \ - } \ - \ - template \ - inline _Expr<_BinClos<_Name, _ValArray, _Expr, \ - typename _Dom::value_type, _Dom>, \ - typename __fun<_Name, typename _Dom::value_type>::result_type> \ - operator _Op(const valarray& __v, \ - const _Expr<_Dom, typename _Dom::value_type>& __e) \ - { \ - typedef typename _Dom::value_type _Tp; \ - typedef typename __fun<_Name, _Tp>::result_type _Value; \ - typedef _BinClos<_Name, _ValArray, _Expr, _Tp, _Dom> _Closure; \ - return _Expr<_Closure, _Value>(_Closure(__v, __e ())); \ - } - - _DEFINE_EXPR_BINARY_OPERATOR(+, __plus) - _DEFINE_EXPR_BINARY_OPERATOR(-, __minus) - _DEFINE_EXPR_BINARY_OPERATOR(*, __multiplies) - _DEFINE_EXPR_BINARY_OPERATOR(/, __divides) - _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus) - _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor) - _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and) - _DEFINE_EXPR_BINARY_OPERATOR(|, __bitwise_or) - _DEFINE_EXPR_BINARY_OPERATOR(<<, __shift_left) - _DEFINE_EXPR_BINARY_OPERATOR(>>, __shift_right) - _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and) - _DEFINE_EXPR_BINARY_OPERATOR(||, __logical_or) - _DEFINE_EXPR_BINARY_OPERATOR(==, __equal_to) - _DEFINE_EXPR_BINARY_OPERATOR(!=, __not_equal_to) - _DEFINE_EXPR_BINARY_OPERATOR(<, __less) - _DEFINE_EXPR_BINARY_OPERATOR(>, __greater) - _DEFINE_EXPR_BINARY_OPERATOR(<=, __less_equal) - _DEFINE_EXPR_BINARY_OPERATOR(>=, __greater_equal) - -#undef _DEFINE_EXPR_BINARY_OPERATOR - -#define _DEFINE_EXPR_UNARY_FUNCTION(_Name, _UName) \ - template \ - inline _Expr<_UnClos<_UName, _Expr, _Dom>, \ - typename _Dom::value_type> \ - _Name(const _Expr<_Dom, typename _Dom::value_type>& __e) \ - { \ - typedef typename _Dom::value_type _Tp; \ - typedef _UnClos<_UName, _Expr, _Dom> _Closure; \ - return _Expr<_Closure, _Tp>(_Closure(__e())); \ - } \ - \ - template \ - inline _Expr<_UnClos<_UName, _ValArray, _Tp>, _Tp> \ - _Name(const valarray<_Tp>& __v) \ - { \ - typedef _UnClos<_UName, _ValArray, _Tp> _Closure; \ - return _Expr<_Closure, _Tp>(_Closure(__v)); \ - } - - _DEFINE_EXPR_UNARY_FUNCTION(abs, _Abs) - _DEFINE_EXPR_UNARY_FUNCTION(cos, _Cos) - _DEFINE_EXPR_UNARY_FUNCTION(acos, _Acos) - _DEFINE_EXPR_UNARY_FUNCTION(cosh, _Cosh) - _DEFINE_EXPR_UNARY_FUNCTION(sin, _Sin) - _DEFINE_EXPR_UNARY_FUNCTION(asin, _Asin) - _DEFINE_EXPR_UNARY_FUNCTION(sinh, _Sinh) - _DEFINE_EXPR_UNARY_FUNCTION(tan, _Tan) - _DEFINE_EXPR_UNARY_FUNCTION(tanh, _Tanh) - _DEFINE_EXPR_UNARY_FUNCTION(atan, _Atan) - _DEFINE_EXPR_UNARY_FUNCTION(exp, _Exp) - _DEFINE_EXPR_UNARY_FUNCTION(log, _Log) - _DEFINE_EXPR_UNARY_FUNCTION(log10, _Log10) - _DEFINE_EXPR_UNARY_FUNCTION(sqrt, _Sqrt) - -#undef _DEFINE_EXPR_UNARY_FUNCTION - -#define _DEFINE_EXPR_BINARY_FUNCTION(_Fun, _UFun) \ - template \ - inline _Expr<_BinClos<_UFun, _Expr, _Expr, _Dom1, _Dom2>, \ - typename _Dom1::value_type> \ - _Fun(const _Expr<_Dom1, typename _Dom1::value_type>& __e1, \ - const _Expr<_Dom2, typename _Dom2::value_type>& __e2) \ - { \ - typedef typename _Dom1::value_type _Tp; \ - typedef _BinClos<_UFun, _Expr, _Expr, _Dom1, _Dom2> _Closure; \ - return _Expr<_Closure, _Tp>(_Closure(__e1(), __e2())); \ - } \ - \ - template \ - inline _Expr<_BinClos<_UFun, _Expr, _ValArray, _Dom, \ - typename _Dom::value_type>, \ - typename _Dom::value_type> \ - _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \ - const valarray& __v) \ - { \ - typedef typename _Dom::value_type _Tp; \ - typedef _BinClos<_UFun, _Expr, _ValArray, _Dom, _Tp> _Closure; \ - return _Expr<_Closure, _Tp>(_Closure(__e(), __v)); \ - } \ - \ - template \ - inline _Expr<_BinClos<_UFun, _ValArray, _Expr, \ - typename _Dom::value_type, _Dom>, \ - typename _Dom::value_type> \ - _Fun(const valarray& __v, \ - const _Expr<_Dom, typename _Dom::value_type>& __e) \ - { \ - typedef typename _Dom::value_type _Tp; \ - typedef _BinClos<_UFun, _ValArray, _Expr, _Tp, _Dom> _Closure; \ - return _Expr<_Closure, _Tp>(_Closure(__v, __e())); \ - } \ - \ - template \ - inline _Expr<_BinClos<_UFun, _Expr, _Constant, _Dom, \ - typename _Dom::value_type>, \ - typename _Dom::value_type> \ - _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \ - const typename _Dom::value_type& __t) \ - { \ - typedef typename _Dom::value_type _Tp; \ - typedef _BinClos<_UFun, _Expr, _Constant, _Dom, _Tp> _Closure; \ - return _Expr<_Closure, _Tp>(_Closure(__e(), __t)); \ - } \ - \ - template \ - inline _Expr<_BinClos<_UFun, _Constant, _Expr, \ - typename _Dom::value_type, _Dom>, \ - typename _Dom::value_type> \ - _Fun(const typename _Dom::value_type& __t, \ - const _Expr<_Dom, typename _Dom::value_type>& __e) \ - { \ - typedef typename _Dom::value_type _Tp; \ - typedef _BinClos<_UFun, _Constant, _Expr, _Tp, _Dom> _Closure; \ - return _Expr<_Closure, _Tp>(_Closure(__t, __e())); \ - } \ - \ - template \ - inline _Expr<_BinClos<_UFun, _ValArray, _ValArray, _Tp, _Tp>, _Tp> \ - _Fun(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \ - { \ - typedef _BinClos<_UFun, _ValArray, _ValArray, _Tp, _Tp> _Closure;\ - return _Expr<_Closure, _Tp>(_Closure(__v, __w)); \ - } \ - \ - template \ - inline _Expr<_BinClos<_UFun, _ValArray, _Constant, _Tp, _Tp>, _Tp> \ - _Fun(const valarray<_Tp>& __v, const _Tp& __t) \ - { \ - typedef _BinClos<_UFun, _ValArray, _Constant, _Tp, _Tp> _Closure;\ - return _Expr<_Closure, _Tp>(_Closure(__v, __t)); \ - } \ - \ - template \ - inline _Expr<_BinClos<_UFun, _Constant, _ValArray, _Tp, _Tp>, _Tp> \ - _Fun(const _Tp& __t, const valarray<_Tp>& __v) \ - { \ - typedef _BinClos<_UFun, _Constant, _ValArray, _Tp, _Tp> _Closure;\ - return _Expr<_Closure, _Tp>(_Closure(__t, __v)); \ - } - -_DEFINE_EXPR_BINARY_FUNCTION(atan2, _Atan2) -_DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow) - -#undef _DEFINE_EXPR_BINARY_FUNCTION - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _CPP_VALARRAY_AFTER_H */ diff --git a/openflow/usr/include/c++/5/bits/valarray_array.h b/openflow/usr/include/c++/5/bits/valarray_array.h deleted file mode 100644 index 307dbf8..0000000 --- a/openflow/usr/include/c++/5/bits/valarray_array.h +++ /dev/null @@ -1,693 +0,0 @@ -// The template and inlines for the -*- C++ -*- internal _Array helper class. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/valarray_array.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{valarray} - */ - -// Written by Gabriel Dos Reis - -#ifndef _VALARRAY_ARRAY_H -#define _VALARRAY_ARRAY_H 1 - -#pragma GCC system_header - -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // - // Helper functions on raw pointers - // - - // We get memory by the old fashion way - inline void* - __valarray_get_memory(size_t __n) - { return operator new(__n); } - - template - inline _Tp*__restrict__ - __valarray_get_storage(size_t __n) - { - return static_cast<_Tp*__restrict__> - (std::__valarray_get_memory(__n * sizeof(_Tp))); - } - - // Return memory to the system - inline void - __valarray_release_memory(void* __p) - { operator delete(__p); } - - // Turn a raw-memory into an array of _Tp filled with _Tp() - // This is required in 'valarray v(n);' - template - struct _Array_default_ctor - { - // Please note that this isn't exception safe. But - // valarrays aren't required to be exception safe. - inline static void - _S_do_it(_Tp* __b, _Tp* __e) - { - while (__b != __e) - new(__b++) _Tp(); - } - }; - - template - struct _Array_default_ctor<_Tp, true> - { - // For fundamental types, it suffices to say 'memset()' - inline static void - _S_do_it(_Tp* __b, _Tp* __e) - { __builtin_memset(__b, 0, (__e - __b) * sizeof(_Tp)); } - }; - - template - inline void - __valarray_default_construct(_Tp* __b, _Tp* __e) - { - _Array_default_ctor<_Tp, __is_scalar<_Tp>::__value>::_S_do_it(__b, __e); - } - - // Turn a raw-memory into an array of _Tp filled with __t - // This is the required in valarray v(n, t). Also - // used in valarray<>::resize(). - template - struct _Array_init_ctor - { - // Please note that this isn't exception safe. But - // valarrays aren't required to be exception safe. - inline static void - _S_do_it(_Tp* __b, _Tp* __e, const _Tp __t) - { - while (__b != __e) - new(__b++) _Tp(__t); - } - }; - - template - struct _Array_init_ctor<_Tp, true> - { - inline static void - _S_do_it(_Tp* __b, _Tp* __e, const _Tp __t) - { - while (__b != __e) - *__b++ = __t; - } - }; - - template - inline void - __valarray_fill_construct(_Tp* __b, _Tp* __e, const _Tp __t) - { - _Array_init_ctor<_Tp, __is_trivial(_Tp)>::_S_do_it(__b, __e, __t); - } - - // - // copy-construct raw array [__o, *) from plain array [__b, __e) - // We can't just say 'memcpy()' - // - template - struct _Array_copy_ctor - { - // Please note that this isn't exception safe. But - // valarrays aren't required to be exception safe. - inline static void - _S_do_it(const _Tp* __b, const _Tp* __e, _Tp* __restrict__ __o) - { - while (__b != __e) - new(__o++) _Tp(*__b++); - } - }; - - template - struct _Array_copy_ctor<_Tp, true> - { - inline static void - _S_do_it(const _Tp* __b, const _Tp* __e, _Tp* __restrict__ __o) - { __builtin_memcpy(__o, __b, (__e - __b) * sizeof(_Tp)); } - }; - - template - inline void - __valarray_copy_construct(const _Tp* __b, const _Tp* __e, - _Tp* __restrict__ __o) - { - _Array_copy_ctor<_Tp, __is_trivial(_Tp)>::_S_do_it(__b, __e, __o); - } - - // copy-construct raw array [__o, *) from strided array __a[<__n : __s>] - template - inline void - __valarray_copy_construct (const _Tp* __restrict__ __a, size_t __n, - size_t __s, _Tp* __restrict__ __o) - { - if (__is_trivial(_Tp)) - while (__n--) - { - *__o++ = *__a; - __a += __s; - } - else - while (__n--) - { - new(__o++) _Tp(*__a); - __a += __s; - } - } - - // copy-construct raw array [__o, *) from indexed array __a[__i[<__n>]] - template - inline void - __valarray_copy_construct (const _Tp* __restrict__ __a, - const size_t* __restrict__ __i, - _Tp* __restrict__ __o, size_t __n) - { - if (__is_trivial(_Tp)) - while (__n--) - *__o++ = __a[*__i++]; - else - while (__n--) - new (__o++) _Tp(__a[*__i++]); - } - - // Do the necessary cleanup when we're done with arrays. - template - inline void - __valarray_destroy_elements(_Tp* __b, _Tp* __e) - { - if (!__is_trivial(_Tp)) - while (__b != __e) - { - __b->~_Tp(); - ++__b; - } - } - - // Fill a plain array __a[<__n>] with __t - template - inline void - __valarray_fill(_Tp* __restrict__ __a, size_t __n, const _Tp& __t) - { - while (__n--) - *__a++ = __t; - } - - // fill strided array __a[<__n-1 : __s>] with __t - template - inline void - __valarray_fill(_Tp* __restrict__ __a, size_t __n, - size_t __s, const _Tp& __t) - { - for (size_t __i = 0; __i < __n; ++__i, __a += __s) - *__a = __t; - } - - // fill indirect array __a[__i[<__n>]] with __i - template - inline void - __valarray_fill(_Tp* __restrict__ __a, const size_t* __restrict__ __i, - size_t __n, const _Tp& __t) - { - for (size_t __j = 0; __j < __n; ++__j, ++__i) - __a[*__i] = __t; - } - - // copy plain array __a[<__n>] in __b[<__n>] - // For non-fundamental types, it is wrong to say 'memcpy()' - template - struct _Array_copier - { - inline static void - _S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b) - { - while(__n--) - *__b++ = *__a++; - } - }; - - template - struct _Array_copier<_Tp, true> - { - inline static void - _S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b) - { __builtin_memcpy(__b, __a, __n * sizeof (_Tp)); } - }; - - // Copy a plain array __a[<__n>] into a play array __b[<>] - template - inline void - __valarray_copy(const _Tp* __restrict__ __a, size_t __n, - _Tp* __restrict__ __b) - { - _Array_copier<_Tp, __is_trivial(_Tp)>::_S_do_it(__a, __n, __b); - } - - // Copy strided array __a[<__n : __s>] in plain __b[<__n>] - template - inline void - __valarray_copy(const _Tp* __restrict__ __a, size_t __n, size_t __s, - _Tp* __restrict__ __b) - { - for (size_t __i = 0; __i < __n; ++__i, ++__b, __a += __s) - *__b = *__a; - } - - // Copy a plain array __a[<__n>] into a strided array __b[<__n : __s>] - template - inline void - __valarray_copy(const _Tp* __restrict__ __a, _Tp* __restrict__ __b, - size_t __n, size_t __s) - { - for (size_t __i = 0; __i < __n; ++__i, ++__a, __b += __s) - *__b = *__a; - } - - // Copy strided array __src[<__n : __s1>] into another - // strided array __dst[< : __s2>]. Their sizes must match. - template - inline void - __valarray_copy(const _Tp* __restrict__ __src, size_t __n, size_t __s1, - _Tp* __restrict__ __dst, size_t __s2) - { - for (size_t __i = 0; __i < __n; ++__i) - __dst[__i * __s2] = __src[__i * __s1]; - } - - // Copy an indexed array __a[__i[<__n>]] in plain array __b[<__n>] - template - inline void - __valarray_copy(const _Tp* __restrict__ __a, - const size_t* __restrict__ __i, - _Tp* __restrict__ __b, size_t __n) - { - for (size_t __j = 0; __j < __n; ++__j, ++__b, ++__i) - *__b = __a[*__i]; - } - - // Copy a plain array __a[<__n>] in an indexed array __b[__i[<__n>]] - template - inline void - __valarray_copy(const _Tp* __restrict__ __a, size_t __n, - _Tp* __restrict__ __b, const size_t* __restrict__ __i) - { - for (size_t __j = 0; __j < __n; ++__j, ++__a, ++__i) - __b[*__i] = *__a; - } - - // Copy the __n first elements of an indexed array __src[<__i>] into - // another indexed array __dst[<__j>]. - template - inline void - __valarray_copy(const _Tp* __restrict__ __src, size_t __n, - const size_t* __restrict__ __i, - _Tp* __restrict__ __dst, const size_t* __restrict__ __j) - { - for (size_t __k = 0; __k < __n; ++__k) - __dst[*__j++] = __src[*__i++]; - } - - // - // Compute the sum of elements in range [__f, __l) - // This is a naive algorithm. It suffers from cancelling. - // In the future try to specialize - // for _Tp = float, double, long double using a more accurate - // algorithm. - // - template - inline _Tp - __valarray_sum(const _Tp* __f, const _Tp* __l) - { - _Tp __r = _Tp(); - while (__f != __l) - __r += *__f++; - return __r; - } - - // Compute the product of all elements in range [__f, __l) - template - inline _Tp - __valarray_product(const _Tp* __f, const _Tp* __l) - { - _Tp __r = _Tp(1); - while (__f != __l) - __r = __r * *__f++; - return __r; - } - - // Compute the min/max of an array-expression - template - inline typename _Ta::value_type - __valarray_min(const _Ta& __a) - { - size_t __s = __a.size(); - typedef typename _Ta::value_type _Value_type; - _Value_type __r = __s == 0 ? _Value_type() : __a[0]; - for (size_t __i = 1; __i < __s; ++__i) - { - _Value_type __t = __a[__i]; - if (__t < __r) - __r = __t; - } - return __r; - } - - template - inline typename _Ta::value_type - __valarray_max(const _Ta& __a) - { - size_t __s = __a.size(); - typedef typename _Ta::value_type _Value_type; - _Value_type __r = __s == 0 ? _Value_type() : __a[0]; - for (size_t __i = 1; __i < __s; ++__i) - { - _Value_type __t = __a[__i]; - if (__t > __r) - __r = __t; - } - return __r; - } - - // - // Helper class _Array, first layer of valarray abstraction. - // All operations on valarray should be forwarded to this class - // whenever possible. -- gdr - // - - template - struct _Array - { - explicit _Array(size_t); - explicit _Array(_Tp* const __restrict__); - explicit _Array(const valarray<_Tp>&); - _Array(const _Tp* __restrict__, size_t); - - _Tp* begin() const; - - _Tp* const __restrict__ _M_data; - }; - - - // Copy-construct plain array __b[<__n>] from indexed array __a[__i[<__n>]] - template - inline void - __valarray_copy_construct(_Array<_Tp> __a, _Array __i, - _Array<_Tp> __b, size_t __n) - { std::__valarray_copy_construct(__a._M_data, __i._M_data, - __b._M_data, __n); } - - // Copy-construct plain array __b[<__n>] from strided array __a[<__n : __s>] - template - inline void - __valarray_copy_construct(_Array<_Tp> __a, size_t __n, size_t __s, - _Array<_Tp> __b) - { std::__valarray_copy_construct(__a._M_data, __n, __s, __b._M_data); } - - template - inline void - __valarray_fill (_Array<_Tp> __a, size_t __n, const _Tp& __t) - { std::__valarray_fill(__a._M_data, __n, __t); } - - template - inline void - __valarray_fill(_Array<_Tp> __a, size_t __n, size_t __s, const _Tp& __t) - { std::__valarray_fill(__a._M_data, __n, __s, __t); } - - template - inline void - __valarray_fill(_Array<_Tp> __a, _Array __i, - size_t __n, const _Tp& __t) - { std::__valarray_fill(__a._M_data, __i._M_data, __n, __t); } - - // Copy a plain array __a[<__n>] into a play array __b[<>] - template - inline void - __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b) - { std::__valarray_copy(__a._M_data, __n, __b._M_data); } - - // Copy strided array __a[<__n : __s>] in plain __b[<__n>] - template - inline void - __valarray_copy(_Array<_Tp> __a, size_t __n, size_t __s, _Array<_Tp> __b) - { std::__valarray_copy(__a._M_data, __n, __s, __b._M_data); } - - // Copy a plain array __a[<__n>] into a strided array __b[<__n : __s>] - template - inline void - __valarray_copy(_Array<_Tp> __a, _Array<_Tp> __b, size_t __n, size_t __s) - { __valarray_copy(__a._M_data, __b._M_data, __n, __s); } - - // Copy strided array __src[<__n : __s1>] into another - // strided array __dst[< : __s2>]. Their sizes must match. - template - inline void - __valarray_copy(_Array<_Tp> __a, size_t __n, size_t __s1, - _Array<_Tp> __b, size_t __s2) - { std::__valarray_copy(__a._M_data, __n, __s1, __b._M_data, __s2); } - - // Copy an indexed array __a[__i[<__n>]] in plain array __b[<__n>] - template - inline void - __valarray_copy(_Array<_Tp> __a, _Array __i, - _Array<_Tp> __b, size_t __n) - { std::__valarray_copy(__a._M_data, __i._M_data, __b._M_data, __n); } - - // Copy a plain array __a[<__n>] in an indexed array __b[__i[<__n>]] - template - inline void - __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b, - _Array __i) - { std::__valarray_copy(__a._M_data, __n, __b._M_data, __i._M_data); } - - // Copy the __n first elements of an indexed array __src[<__i>] into - // another indexed array __dst[<__j>]. - template - inline void - __valarray_copy(_Array<_Tp> __src, size_t __n, _Array __i, - _Array<_Tp> __dst, _Array __j) - { - std::__valarray_copy(__src._M_data, __n, __i._M_data, - __dst._M_data, __j._M_data); - } - - template - inline - _Array<_Tp>::_Array(size_t __n) - : _M_data(__valarray_get_storage<_Tp>(__n)) - { std::__valarray_default_construct(_M_data, _M_data + __n); } - - template - inline - _Array<_Tp>::_Array(_Tp* const __restrict__ __p) - : _M_data (__p) {} - - template - inline - _Array<_Tp>::_Array(const valarray<_Tp>& __v) - : _M_data (__v._M_data) {} - - template - inline - _Array<_Tp>::_Array(const _Tp* __restrict__ __b, size_t __s) - : _M_data(__valarray_get_storage<_Tp>(__s)) - { std::__valarray_copy_construct(__b, __s, _M_data); } - - template - inline _Tp* - _Array<_Tp>::begin () const - { return _M_data; } - -#define _DEFINE_ARRAY_FUNCTION(_Op, _Name) \ - template \ - inline void \ - _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, const _Tp& __t) \ - { \ - for (_Tp* __p = __a._M_data; __p < __a._M_data + __n; ++__p) \ - *__p _Op##= __t; \ - } \ - \ - template \ - inline void \ - _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b) \ - { \ - _Tp* __p = __a._M_data; \ - for (_Tp* __q = __b._M_data; __q < __b._M_data + __n; ++__p, ++__q) \ - *__p _Op##= *__q; \ - } \ - \ - template \ - void \ - _Array_augmented_##_Name(_Array<_Tp> __a, \ - const _Expr<_Dom, _Tp>& __e, size_t __n) \ - { \ - _Tp* __p(__a._M_data); \ - for (size_t __i = 0; __i < __n; ++__i, ++__p) \ - *__p _Op##= __e[__i]; \ - } \ - \ - template \ - inline void \ - _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, size_t __s, \ - _Array<_Tp> __b) \ - { \ - _Tp* __q(__b._M_data); \ - for (_Tp* __p = __a._M_data; __p < __a._M_data + __s * __n; \ - __p += __s, ++__q) \ - *__p _Op##= *__q; \ - } \ - \ - template \ - inline void \ - _Array_augmented_##_Name(_Array<_Tp> __a, _Array<_Tp> __b, \ - size_t __n, size_t __s) \ - { \ - _Tp* __q(__b._M_data); \ - for (_Tp* __p = __a._M_data; __p < __a._M_data + __n; \ - ++__p, __q += __s) \ - *__p _Op##= *__q; \ - } \ - \ - template \ - void \ - _Array_augmented_##_Name(_Array<_Tp> __a, size_t __s, \ - const _Expr<_Dom, _Tp>& __e, size_t __n) \ - { \ - _Tp* __p(__a._M_data); \ - for (size_t __i = 0; __i < __n; ++__i, __p += __s) \ - *__p _Op##= __e[__i]; \ - } \ - \ - template \ - inline void \ - _Array_augmented_##_Name(_Array<_Tp> __a, _Array __i, \ - _Array<_Tp> __b, size_t __n) \ - { \ - _Tp* __q(__b._M_data); \ - for (size_t* __j = __i._M_data; __j < __i._M_data + __n; \ - ++__j, ++__q) \ - __a._M_data[*__j] _Op##= *__q; \ - } \ - \ - template \ - inline void \ - _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, \ - _Array<_Tp> __b, _Array __i) \ - { \ - _Tp* __p(__a._M_data); \ - for (size_t* __j = __i._M_data; __j<__i._M_data + __n; \ - ++__j, ++__p) \ - *__p _Op##= __b._M_data[*__j]; \ - } \ - \ - template \ - void \ - _Array_augmented_##_Name(_Array<_Tp> __a, _Array __i, \ - const _Expr<_Dom, _Tp>& __e, size_t __n) \ - { \ - size_t* __j(__i._M_data); \ - for (size_t __k = 0; __k<__n; ++__k, ++__j) \ - __a._M_data[*__j] _Op##= __e[__k]; \ - } \ - \ - template \ - void \ - _Array_augmented_##_Name(_Array<_Tp> __a, _Array __m, \ - _Array<_Tp> __b, size_t __n) \ - { \ - bool* __ok(__m._M_data); \ - _Tp* __p(__a._M_data); \ - for (_Tp* __q = __b._M_data; __q < __b._M_data + __n; \ - ++__q, ++__ok, ++__p) \ - { \ - while (! *__ok) \ - { \ - ++__ok; \ - ++__p; \ - } \ - *__p _Op##= *__q; \ - } \ - } \ - \ - template \ - void \ - _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, \ - _Array<_Tp> __b, _Array __m) \ - { \ - bool* __ok(__m._M_data); \ - _Tp* __q(__b._M_data); \ - for (_Tp* __p = __a._M_data; __p < __a._M_data + __n; \ - ++__p, ++__ok, ++__q) \ - { \ - while (! *__ok) \ - { \ - ++__ok; \ - ++__q; \ - } \ - *__p _Op##= *__q; \ - } \ - } \ - \ - template \ - void \ - _Array_augmented_##_Name(_Array<_Tp> __a, _Array __m, \ - const _Expr<_Dom, _Tp>& __e, size_t __n) \ - { \ - bool* __ok(__m._M_data); \ - _Tp* __p(__a._M_data); \ - for (size_t __i = 0; __i < __n; ++__i, ++__ok, ++__p) \ - { \ - while (! *__ok) \ - { \ - ++__ok; \ - ++__p; \ - } \ - *__p _Op##= __e[__i]; \ - } \ - } - - _DEFINE_ARRAY_FUNCTION(+, __plus) - _DEFINE_ARRAY_FUNCTION(-, __minus) - _DEFINE_ARRAY_FUNCTION(*, __multiplies) - _DEFINE_ARRAY_FUNCTION(/, __divides) - _DEFINE_ARRAY_FUNCTION(%, __modulus) - _DEFINE_ARRAY_FUNCTION(^, __bitwise_xor) - _DEFINE_ARRAY_FUNCTION(|, __bitwise_or) - _DEFINE_ARRAY_FUNCTION(&, __bitwise_and) - _DEFINE_ARRAY_FUNCTION(<<, __shift_left) - _DEFINE_ARRAY_FUNCTION(>>, __shift_right) - -#undef _DEFINE_ARRAY_FUNCTION - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -# include - -#endif /* _ARRAY_H */ diff --git a/openflow/usr/include/c++/5/bits/valarray_array.tcc b/openflow/usr/include/c++/5/bits/valarray_array.tcc deleted file mode 100644 index 7a2d285..0000000 --- a/openflow/usr/include/c++/5/bits/valarray_array.tcc +++ /dev/null @@ -1,244 +0,0 @@ -// The template and inlines for the -*- C++ -*- internal _Array helper class. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/valarray_array.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{valarray} - */ - -// Written by Gabriel Dos Reis - -#ifndef _VALARRAY_ARRAY_TCC -#define _VALARRAY_ARRAY_TCC 1 - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - void - __valarray_fill(_Array<_Tp> __a, size_t __n, _Array __m, - const _Tp& __t) - { - _Tp* __p = __a._M_data; - bool* __ok (__m._M_data); - for (size_t __i=0; __i < __n; ++__i, ++__ok, ++__p) - { - while (!*__ok) - { - ++__ok; - ++__p; - } - *__p = __t; - } - } - - // Copy n elements of a into consecutive elements of b. When m is - // false, the corresponding element of a is skipped. m must contain - // at least n true elements. a must contain at least n elements and - // enough elements to match up with m through the nth true element - // of m. I.e. if n is 10, m has 15 elements with 5 false followed - // by 10 true, a must have 15 elements. - template - void - __valarray_copy(_Array<_Tp> __a, _Array __m, _Array<_Tp> __b, - size_t __n) - { - _Tp* __p (__a._M_data); - bool* __ok (__m._M_data); - for (_Tp* __q = __b._M_data; __q < __b._M_data + __n; - ++__q, ++__ok, ++__p) - { - while (! *__ok) - { - ++__ok; - ++__p; - } - *__q = *__p; - } - } - - // Copy n consecutive elements from a into elements of b. Elements - // of b are skipped if the corresponding element of m is false. m - // must contain at least n true elements. b must have at least as - // many elements as the index of the nth true element of m. I.e. if - // m has 15 elements with 5 false followed by 10 true, b must have - // at least 15 elements. - template - void - __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b, - _Array __m) - { - _Tp* __q (__b._M_data); - bool* __ok (__m._M_data); - for (_Tp* __p = __a._M_data; __p < __a._M_data+__n; - ++__p, ++__ok, ++__q) - { - while (! *__ok) - { - ++__ok; - ++__q; - } - *__q = *__p; - } - } - - // Copy n elements from a into elements of b. Elements of a are - // skipped if the corresponding element of m is false. Elements of - // b are skipped if the corresponding element of k is false. m and - // k must contain at least n true elements. a and b must have at - // least as many elements as the index of the nth true element of m. - template - void - __valarray_copy(_Array<_Tp> __a, _Array __m, size_t __n, - _Array<_Tp> __b, _Array __k) - { - _Tp* __p (__a._M_data); - _Tp* __q (__b._M_data); - bool* __srcok (__m._M_data); - bool* __dstok (__k._M_data); - for (size_t __i = 0; __i < __n; - ++__srcok, ++__p, ++__dstok, ++__q, ++__i) - { - while (! *__srcok) - { - ++__srcok; - ++__p; - } - while (! *__dstok) - { - ++__dstok; - ++__q; - } - *__q = *__p; - } - } - - // Copy n consecutive elements of e into consecutive elements of a. - // I.e. a[i] = e[i]. - template - void - __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n, _Array<_Tp> __a) - { - _Tp* __p (__a._M_data); - for (size_t __i = 0; __i < __n; ++__i, ++__p) - *__p = __e[__i]; - } - - // Copy n consecutive elements of e into elements of a using stride - // s. I.e., a[0] = e[0], a[s] = e[1], a[2*s] = e[2]. - template - void - __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n, - _Array<_Tp> __a, size_t __s) - { - _Tp* __p (__a._M_data); - for (size_t __i = 0; __i < __n; ++__i, __p += __s) - *__p = __e[__i]; - } - - // Copy n consecutive elements of e into elements of a indexed by - // contents of i. I.e., a[i[0]] = e[0]. - template - void - __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n, - _Array<_Tp> __a, _Array __i) - { - size_t* __j (__i._M_data); - for (size_t __k = 0; __k < __n; ++__k, ++__j) - __a._M_data[*__j] = __e[__k]; - } - - // Copy n elements of e indexed by contents of f into elements of a - // indexed by contents of i. I.e., a[i[0]] = e[f[0]]. - template - void - __valarray_copy(_Array<_Tp> __e, _Array __f, - size_t __n, - _Array<_Tp> __a, _Array __i) - { - size_t* __g (__f._M_data); - size_t* __j (__i._M_data); - for (size_t __k = 0; __k < __n; ++__k, ++__j, ++__g) - __a._M_data[*__j] = __e._M_data[*__g]; - } - - // Copy n consecutive elements of e into elements of a. Elements of - // a are skipped if the corresponding element of m is false. m must - // have at least n true elements and a must have at least as many - // elements as the index of the nth true element of m. I.e. if m - // has 5 false followed by 10 true elements and n == 10, a must have - // at least 15 elements. - template - void - __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n, - _Array<_Tp> __a, _Array __m) - { - bool* __ok (__m._M_data); - _Tp* __p (__a._M_data); - for (size_t __i = 0; __i < __n; ++__i, ++__ok, ++__p) - { - while (! *__ok) - { - ++__ok; - ++__p; - } - *__p = __e[__i]; - } - } - - - template - void - __valarray_copy_construct(const _Expr<_Dom, _Tp>& __e, size_t __n, - _Array<_Tp> __a) - { - _Tp* __p (__a._M_data); - for (size_t __i = 0; __i < __n; ++__i, ++__p) - new (__p) _Tp(__e[__i]); - } - - - template - void - __valarray_copy_construct(_Array<_Tp> __a, _Array __m, - _Array<_Tp> __b, size_t __n) - { - _Tp* __p (__a._M_data); - bool* __ok (__m._M_data); - for (_Tp* __q = __b._M_data; __q < __b._M_data+__n; ++__q, ++__ok, ++__p) - { - while (! *__ok) - { - ++__ok; - ++__p; - } - new (__q) _Tp(*__p); - } - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _VALARRAY_ARRAY_TCC */ diff --git a/openflow/usr/include/c++/5/bits/valarray_before.h b/openflow/usr/include/c++/5/bits/valarray_before.h deleted file mode 100644 index 498c573..0000000 --- a/openflow/usr/include/c++/5/bits/valarray_before.h +++ /dev/null @@ -1,743 +0,0 @@ -// The template and inlines for the -*- C++ -*- internal _Meta class. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file bits/valarray_before.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{valarray} - */ - -// Written by Gabriel Dos Reis - -#ifndef _VALARRAY_BEFORE_H -#define _VALARRAY_BEFORE_H 1 - -#pragma GCC system_header - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // - // Implementing a loosened valarray return value is tricky. - // First we need to meet 26.3.1/3: we should not add more than - // two levels of template nesting. Therefore we resort to template - // template to "flatten" loosened return value types. - // At some point we use partial specialization to remove one level - // template nesting due to _Expr<> - // - - // This class is NOT defined. It doesn't need to. - template class _Constant; - - // Implementations of unary functions applied to valarray<>s. - // I use hard-coded object functions here instead of a generic - // approach like pointers to function: - // 1) correctness: some functions take references, others values. - // we can't deduce the correct type afterwards. - // 2) efficiency -- object functions can be easily inlined - // 3) be Koenig-lookup-friendly - - struct _Abs - { - template - _Tp operator()(const _Tp& __t) const - { return abs(__t); } - }; - - struct _Cos - { - template - _Tp operator()(const _Tp& __t) const - { return cos(__t); } - }; - - struct _Acos - { - template - _Tp operator()(const _Tp& __t) const - { return acos(__t); } - }; - - struct _Cosh - { - template - _Tp operator()(const _Tp& __t) const - { return cosh(__t); } - }; - - struct _Sin - { - template - _Tp operator()(const _Tp& __t) const - { return sin(__t); } - }; - - struct _Asin - { - template - _Tp operator()(const _Tp& __t) const - { return asin(__t); } - }; - - struct _Sinh - { - template - _Tp operator()(const _Tp& __t) const - { return sinh(__t); } - }; - - struct _Tan - { - template - _Tp operator()(const _Tp& __t) const - { return tan(__t); } - }; - - struct _Atan - { - template - _Tp operator()(const _Tp& __t) const - { return atan(__t); } - }; - - struct _Tanh - { - template - _Tp operator()(const _Tp& __t) const - { return tanh(__t); } - }; - - struct _Exp - { - template - _Tp operator()(const _Tp& __t) const - { return exp(__t); } - }; - - struct _Log - { - template - _Tp operator()(const _Tp& __t) const - { return log(__t); } - }; - - struct _Log10 - { - template - _Tp operator()(const _Tp& __t) const - { return log10(__t); } - }; - - struct _Sqrt - { - template - _Tp operator()(const _Tp& __t) const - { return sqrt(__t); } - }; - - // In the past, we used to tailor operator applications semantics - // to the specialization of standard function objects (i.e. plus<>, etc.) - // That is incorrect. Therefore we provide our own surrogates. - - struct __unary_plus - { - template - _Tp operator()(const _Tp& __t) const - { return +__t; } - }; - - struct __negate - { - template - _Tp operator()(const _Tp& __t) const - { return -__t; } - }; - - struct __bitwise_not - { - template - _Tp operator()(const _Tp& __t) const - { return ~__t; } - }; - - struct __plus - { - template - _Tp operator()(const _Tp& __x, const _Tp& __y) const - { return __x + __y; } - }; - - struct __minus - { - template - _Tp operator()(const _Tp& __x, const _Tp& __y) const - { return __x - __y; } - }; - - struct __multiplies - { - template - _Tp operator()(const _Tp& __x, const _Tp& __y) const - { return __x * __y; } - }; - - struct __divides - { - template - _Tp operator()(const _Tp& __x, const _Tp& __y) const - { return __x / __y; } - }; - - struct __modulus - { - template - _Tp operator()(const _Tp& __x, const _Tp& __y) const - { return __x % __y; } - }; - - struct __bitwise_xor - { - template - _Tp operator()(const _Tp& __x, const _Tp& __y) const - { return __x ^ __y; } - }; - - struct __bitwise_and - { - template - _Tp operator()(const _Tp& __x, const _Tp& __y) const - { return __x & __y; } - }; - - struct __bitwise_or - { - template - _Tp operator()(const _Tp& __x, const _Tp& __y) const - { return __x | __y; } - }; - - struct __shift_left - { - template - _Tp operator()(const _Tp& __x, const _Tp& __y) const - { return __x << __y; } - }; - - struct __shift_right - { - template - _Tp operator()(const _Tp& __x, const _Tp& __y) const - { return __x >> __y; } - }; - - struct __logical_and - { - template - bool operator()(const _Tp& __x, const _Tp& __y) const - { return __x && __y; } - }; - - struct __logical_or - { - template - bool operator()(const _Tp& __x, const _Tp& __y) const - { return __x || __y; } - }; - - struct __logical_not - { - template - bool operator()(const _Tp& __x) const - { return !__x; } - }; - - struct __equal_to - { - template - bool operator()(const _Tp& __x, const _Tp& __y) const - { return __x == __y; } - }; - - struct __not_equal_to - { - template - bool operator()(const _Tp& __x, const _Tp& __y) const - { return __x != __y; } - }; - - struct __less - { - template - bool operator()(const _Tp& __x, const _Tp& __y) const - { return __x < __y; } - }; - - struct __greater - { - template - bool operator()(const _Tp& __x, const _Tp& __y) const - { return __x > __y; } - }; - - struct __less_equal - { - template - bool operator()(const _Tp& __x, const _Tp& __y) const - { return __x <= __y; } - }; - - struct __greater_equal - { - template - bool operator()(const _Tp& __x, const _Tp& __y) const - { return __x >= __y; } - }; - - // The few binary functions we miss. - struct _Atan2 - { - template - _Tp operator()(const _Tp& __x, const _Tp& __y) const - { return atan2(__x, __y); } - }; - - struct _Pow - { - template - _Tp operator()(const _Tp& __x, const _Tp& __y) const - { return pow(__x, __y); } - }; - - template - struct __fun_with_valarray - { - typedef _Tp result_type; - }; - - template - struct __fun_with_valarray<_Tp, false> - { - // No result type defined for invalid value types. - }; - - // We need these bits in order to recover the return type of - // some functions/operators now that we're no longer using - // function templates. - template - struct __fun : __fun_with_valarray<_Tp> - { - }; - - // several specializations for relational operators. - template - struct __fun<__logical_not, _Tp> - { - typedef bool result_type; - }; - - template - struct __fun<__logical_and, _Tp> - { - typedef bool result_type; - }; - - template - struct __fun<__logical_or, _Tp> - { - typedef bool result_type; - }; - - template - struct __fun<__less, _Tp> - { - typedef bool result_type; - }; - - template - struct __fun<__greater, _Tp> - { - typedef bool result_type; - }; - - template - struct __fun<__less_equal, _Tp> - { - typedef bool result_type; - }; - - template - struct __fun<__greater_equal, _Tp> - { - typedef bool result_type; - }; - - template - struct __fun<__equal_to, _Tp> - { - typedef bool result_type; - }; - - template - struct __fun<__not_equal_to, _Tp> - { - typedef bool result_type; - }; - - // - // Apply function taking a value/const reference closure - // - - template - class _FunBase - { - public: - typedef typename _Dom::value_type value_type; - - _FunBase(const _Dom& __e, value_type __f(_Arg)) - : _M_expr(__e), _M_func(__f) {} - - value_type operator[](size_t __i) const - { return _M_func (_M_expr[__i]); } - - size_t size() const { return _M_expr.size ();} - - private: - const _Dom& _M_expr; - value_type (*_M_func)(_Arg); - }; - - template - struct _ValFunClos<_Expr,_Dom> : _FunBase<_Dom, typename _Dom::value_type> - { - typedef _FunBase<_Dom, typename _Dom::value_type> _Base; - typedef typename _Base::value_type value_type; - typedef value_type _Tp; - - _ValFunClos(const _Dom& __e, _Tp __f(_Tp)) : _Base(__e, __f) {} - }; - - template - struct _ValFunClos<_ValArray,_Tp> : _FunBase, _Tp> - { - typedef _FunBase, _Tp> _Base; - typedef _Tp value_type; - - _ValFunClos(const valarray<_Tp>& __v, _Tp __f(_Tp)) : _Base(__v, __f) {} - }; - - template - struct _RefFunClos<_Expr, _Dom> - : _FunBase<_Dom, const typename _Dom::value_type&> - { - typedef _FunBase<_Dom, const typename _Dom::value_type&> _Base; - typedef typename _Base::value_type value_type; - typedef value_type _Tp; - - _RefFunClos(const _Dom& __e, _Tp __f(const _Tp&)) - : _Base(__e, __f) {} - }; - - template - struct _RefFunClos<_ValArray, _Tp> - : _FunBase, const _Tp&> - { - typedef _FunBase, const _Tp&> _Base; - typedef _Tp value_type; - - _RefFunClos(const valarray<_Tp>& __v, _Tp __f(const _Tp&)) - : _Base(__v, __f) {} - }; - - // - // Unary expression closure. - // - - template - class _UnBase - { - public: - typedef typename _Arg::value_type _Vt; - typedef typename __fun<_Oper, _Vt>::result_type value_type; - - _UnBase(const _Arg& __e) : _M_expr(__e) {} - - value_type operator[](size_t __i) const - { return _Oper()(_M_expr[__i]); } - - size_t size() const { return _M_expr.size(); } - - private: - const _Arg& _M_expr; - }; - - template - struct _UnClos<_Oper, _Expr, _Dom> - : _UnBase<_Oper, _Dom> - { - typedef _Dom _Arg; - typedef _UnBase<_Oper, _Dom> _Base; - typedef typename _Base::value_type value_type; - - _UnClos(const _Arg& __e) : _Base(__e) {} - }; - - template - struct _UnClos<_Oper, _ValArray, _Tp> - : _UnBase<_Oper, valarray<_Tp> > - { - typedef valarray<_Tp> _Arg; - typedef _UnBase<_Oper, valarray<_Tp> > _Base; - typedef typename _Base::value_type value_type; - - _UnClos(const _Arg& __e) : _Base(__e) {} - }; - - - // - // Binary expression closure. - // - - template - class _BinBase - { - public: - typedef typename _FirstArg::value_type _Vt; - typedef typename __fun<_Oper, _Vt>::result_type value_type; - - _BinBase(const _FirstArg& __e1, const _SecondArg& __e2) - : _M_expr1(__e1), _M_expr2(__e2) {} - - value_type operator[](size_t __i) const - { return _Oper()(_M_expr1[__i], _M_expr2[__i]); } - - size_t size() const { return _M_expr1.size(); } - - private: - const _FirstArg& _M_expr1; - const _SecondArg& _M_expr2; - }; - - - template - class _BinBase2 - { - public: - typedef typename _Clos::value_type _Vt; - typedef typename __fun<_Oper, _Vt>::result_type value_type; - - _BinBase2(const _Clos& __e, const _Vt& __t) - : _M_expr1(__e), _M_expr2(__t) {} - - value_type operator[](size_t __i) const - { return _Oper()(_M_expr1[__i], _M_expr2); } - - size_t size() const { return _M_expr1.size(); } - - private: - const _Clos& _M_expr1; - const _Vt& _M_expr2; - }; - - template - class _BinBase1 - { - public: - typedef typename _Clos::value_type _Vt; - typedef typename __fun<_Oper, _Vt>::result_type value_type; - - _BinBase1(const _Vt& __t, const _Clos& __e) - : _M_expr1(__t), _M_expr2(__e) {} - - value_type operator[](size_t __i) const - { return _Oper()(_M_expr1, _M_expr2[__i]); } - - size_t size() const { return _M_expr2.size(); } - - private: - const _Vt& _M_expr1; - const _Clos& _M_expr2; - }; - - template - struct _BinClos<_Oper, _Expr, _Expr, _Dom1, _Dom2> - : _BinBase<_Oper, _Dom1, _Dom2> - { - typedef _BinBase<_Oper, _Dom1, _Dom2> _Base; - typedef typename _Base::value_type value_type; - - _BinClos(const _Dom1& __e1, const _Dom2& __e2) : _Base(__e1, __e2) {} - }; - - template - struct _BinClos<_Oper,_ValArray, _ValArray, _Tp, _Tp> - : _BinBase<_Oper, valarray<_Tp>, valarray<_Tp> > - { - typedef _BinBase<_Oper, valarray<_Tp>, valarray<_Tp> > _Base; - typedef typename _Base::value_type value_type; - - _BinClos(const valarray<_Tp>& __v, const valarray<_Tp>& __w) - : _Base(__v, __w) {} - }; - - template - struct _BinClos<_Oper, _Expr, _ValArray, _Dom, typename _Dom::value_type> - : _BinBase<_Oper, _Dom, valarray > - { - typedef typename _Dom::value_type _Tp; - typedef _BinBase<_Oper,_Dom,valarray<_Tp> > _Base; - typedef typename _Base::value_type value_type; - - _BinClos(const _Dom& __e1, const valarray<_Tp>& __e2) - : _Base(__e1, __e2) {} - }; - - template - struct _BinClos<_Oper, _ValArray, _Expr, typename _Dom::value_type, _Dom> - : _BinBase<_Oper, valarray,_Dom> - { - typedef typename _Dom::value_type _Tp; - typedef _BinBase<_Oper, valarray<_Tp>, _Dom> _Base; - typedef typename _Base::value_type value_type; - - _BinClos(const valarray<_Tp>& __e1, const _Dom& __e2) - : _Base(__e1, __e2) {} - }; - - template - struct _BinClos<_Oper, _Expr, _Constant, _Dom, typename _Dom::value_type> - : _BinBase2<_Oper, _Dom> - { - typedef typename _Dom::value_type _Tp; - typedef _BinBase2<_Oper,_Dom> _Base; - typedef typename _Base::value_type value_type; - - _BinClos(const _Dom& __e1, const _Tp& __e2) : _Base(__e1, __e2) {} - }; - - template - struct _BinClos<_Oper, _Constant, _Expr, typename _Dom::value_type, _Dom> - : _BinBase1<_Oper, _Dom> - { - typedef typename _Dom::value_type _Tp; - typedef _BinBase1<_Oper, _Dom> _Base; - typedef typename _Base::value_type value_type; - - _BinClos(const _Tp& __e1, const _Dom& __e2) : _Base(__e1, __e2) {} - }; - - template - struct _BinClos<_Oper, _ValArray, _Constant, _Tp, _Tp> - : _BinBase2<_Oper, valarray<_Tp> > - { - typedef _BinBase2<_Oper,valarray<_Tp> > _Base; - typedef typename _Base::value_type value_type; - - _BinClos(const valarray<_Tp>& __v, const _Tp& __t) : _Base(__v, __t) {} - }; - - template - struct _BinClos<_Oper, _Constant, _ValArray, _Tp, _Tp> - : _BinBase1<_Oper, valarray<_Tp> > - { - typedef _BinBase1<_Oper, valarray<_Tp> > _Base; - typedef typename _Base::value_type value_type; - - _BinClos(const _Tp& __t, const valarray<_Tp>& __v) : _Base(__t, __v) {} - }; - - // - // slice_array closure. - // - template - class _SBase - { - public: - typedef typename _Dom::value_type value_type; - - _SBase (const _Dom& __e, const slice& __s) - : _M_expr (__e), _M_slice (__s) {} - - value_type - operator[] (size_t __i) const - { return _M_expr[_M_slice.start () + __i * _M_slice.stride ()]; } - - size_t - size() const - { return _M_slice.size (); } - - private: - const _Dom& _M_expr; - const slice& _M_slice; - }; - - template - class _SBase<_Array<_Tp> > - { - public: - typedef _Tp value_type; - - _SBase (_Array<_Tp> __a, const slice& __s) - : _M_array (__a._M_data+__s.start()), _M_size (__s.size()), - _M_stride (__s.stride()) {} - - value_type - operator[] (size_t __i) const - { return _M_array._M_data[__i * _M_stride]; } - - size_t - size() const - { return _M_size; } - - private: - const _Array<_Tp> _M_array; - const size_t _M_size; - const size_t _M_stride; - }; - - template - struct _SClos<_Expr, _Dom> - : _SBase<_Dom> - { - typedef _SBase<_Dom> _Base; - typedef typename _Base::value_type value_type; - - _SClos (const _Dom& __e, const slice& __s) : _Base (__e, __s) {} - }; - - template - struct _SClos<_ValArray, _Tp> - : _SBase<_Array<_Tp> > - { - typedef _SBase<_Array<_Tp> > _Base; - typedef _Tp value_type; - - _SClos (_Array<_Tp> __a, const slice& __s) : _Base (__a, __s) {} - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _CPP_VALARRAY_BEFORE_H */ diff --git a/openflow/usr/include/c++/5/bits/vector.tcc b/openflow/usr/include/c++/5/bits/vector.tcc deleted file mode 100644 index 34118a4..0000000 --- a/openflow/usr/include/c++/5/bits/vector.tcc +++ /dev/null @@ -1,887 +0,0 @@ -// Vector implementation (out of line) -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file bits/vector.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{vector} - */ - -#ifndef _VECTOR_TCC -#define _VECTOR_TCC 1 - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - template - void - vector<_Tp, _Alloc>:: - reserve(size_type __n) - { - if (__n > this->max_size()) - __throw_length_error(__N("vector::reserve")); - if (this->capacity() < __n) - { - const size_type __old_size = size(); - pointer __tmp = _M_allocate_and_copy(__n, - _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(this->_M_impl._M_start), - _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(this->_M_impl._M_finish)); - std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, - _M_get_Tp_allocator()); - _M_deallocate(this->_M_impl._M_start, - this->_M_impl._M_end_of_storage - - this->_M_impl._M_start); - this->_M_impl._M_start = __tmp; - this->_M_impl._M_finish = __tmp + __old_size; - this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; - } - } - -#if __cplusplus >= 201103L - template - template - void - vector<_Tp, _Alloc>:: - emplace_back(_Args&&... __args) - { - if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) - { - _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, - std::forward<_Args>(__args)...); - ++this->_M_impl._M_finish; - } - else - _M_emplace_back_aux(std::forward<_Args>(__args)...); - } -#endif - - template - typename vector<_Tp, _Alloc>::iterator - vector<_Tp, _Alloc>:: -#if __cplusplus >= 201103L - insert(const_iterator __position, const value_type& __x) -#else - insert(iterator __position, const value_type& __x) -#endif - { - const size_type __n = __position - begin(); - if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage - && __position == end()) - { - _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, __x); - ++this->_M_impl._M_finish; - } - else - { -#if __cplusplus >= 201103L - const auto __pos = begin() + (__position - cbegin()); - if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) - { - _Tp __x_copy = __x; - _M_insert_aux(__pos, std::move(__x_copy)); - } - else - _M_insert_aux(__pos, __x); -#else - _M_insert_aux(__position, __x); -#endif - } - return iterator(this->_M_impl._M_start + __n); - } - - template - typename vector<_Tp, _Alloc>::iterator - vector<_Tp, _Alloc>:: - _M_erase(iterator __position) - { - if (__position + 1 != end()) - _GLIBCXX_MOVE3(__position + 1, end(), __position); - --this->_M_impl._M_finish; - _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish); - return __position; - } - - template - typename vector<_Tp, _Alloc>::iterator - vector<_Tp, _Alloc>:: - _M_erase(iterator __first, iterator __last) - { - if (__first != __last) - { - if (__last != end()) - _GLIBCXX_MOVE3(__last, end(), __first); - _M_erase_at_end(__first.base() + (end() - __last)); - } - return __first; - } - - template - vector<_Tp, _Alloc>& - vector<_Tp, _Alloc>:: - operator=(const vector<_Tp, _Alloc>& __x) - { - if (&__x != this) - { -#if __cplusplus >= 201103L - if (_Alloc_traits::_S_propagate_on_copy_assign()) - { - if (!_Alloc_traits::_S_always_equal() - && _M_get_Tp_allocator() != __x._M_get_Tp_allocator()) - { - // replacement allocator cannot free existing storage - this->clear(); - _M_deallocate(this->_M_impl._M_start, - this->_M_impl._M_end_of_storage - - this->_M_impl._M_start); - this->_M_impl._M_start = nullptr; - this->_M_impl._M_finish = nullptr; - this->_M_impl._M_end_of_storage = nullptr; - } - std::__alloc_on_copy(_M_get_Tp_allocator(), - __x._M_get_Tp_allocator()); - } -#endif - const size_type __xlen = __x.size(); - if (__xlen > capacity()) - { - pointer __tmp = _M_allocate_and_copy(__xlen, __x.begin(), - __x.end()); - std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, - _M_get_Tp_allocator()); - _M_deallocate(this->_M_impl._M_start, - this->_M_impl._M_end_of_storage - - this->_M_impl._M_start); - this->_M_impl._M_start = __tmp; - this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __xlen; - } - else if (size() >= __xlen) - { - std::_Destroy(std::copy(__x.begin(), __x.end(), begin()), - end(), _M_get_Tp_allocator()); - } - else - { - std::copy(__x._M_impl._M_start, __x._M_impl._M_start + size(), - this->_M_impl._M_start); - std::__uninitialized_copy_a(__x._M_impl._M_start + size(), - __x._M_impl._M_finish, - this->_M_impl._M_finish, - _M_get_Tp_allocator()); - } - this->_M_impl._M_finish = this->_M_impl._M_start + __xlen; - } - return *this; - } - - template - void - vector<_Tp, _Alloc>:: - _M_fill_assign(size_t __n, const value_type& __val) - { - if (__n > capacity()) - { - vector __tmp(__n, __val, _M_get_Tp_allocator()); - __tmp._M_impl._M_swap_data(this->_M_impl); - } - else if (__n > size()) - { - std::fill(begin(), end(), __val); - this->_M_impl._M_finish = - std::__uninitialized_fill_n_a(this->_M_impl._M_finish, - __n - size(), __val, - _M_get_Tp_allocator()); - } - else - _M_erase_at_end(std::fill_n(this->_M_impl._M_start, __n, __val)); - } - - template - template - void - vector<_Tp, _Alloc>:: - _M_assign_aux(_InputIterator __first, _InputIterator __last, - std::input_iterator_tag) - { - pointer __cur(this->_M_impl._M_start); - for (; __first != __last && __cur != this->_M_impl._M_finish; - ++__cur, ++__first) - *__cur = *__first; - if (__first == __last) - _M_erase_at_end(__cur); - else - insert(end(), __first, __last); - } - - template - template - void - vector<_Tp, _Alloc>:: - _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, - std::forward_iterator_tag) - { - const size_type __len = std::distance(__first, __last); - - if (__len > capacity()) - { - pointer __tmp(_M_allocate_and_copy(__len, __first, __last)); - std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, - _M_get_Tp_allocator()); - _M_deallocate(this->_M_impl._M_start, - this->_M_impl._M_end_of_storage - - this->_M_impl._M_start); - this->_M_impl._M_start = __tmp; - this->_M_impl._M_finish = this->_M_impl._M_start + __len; - this->_M_impl._M_end_of_storage = this->_M_impl._M_finish; - } - else if (size() >= __len) - _M_erase_at_end(std::copy(__first, __last, this->_M_impl._M_start)); - else - { - _ForwardIterator __mid = __first; - std::advance(__mid, size()); - std::copy(__first, __mid, this->_M_impl._M_start); - this->_M_impl._M_finish = - std::__uninitialized_copy_a(__mid, __last, - this->_M_impl._M_finish, - _M_get_Tp_allocator()); - } - } - -#if __cplusplus >= 201103L - template - template - typename vector<_Tp, _Alloc>::iterator - vector<_Tp, _Alloc>:: - emplace(const_iterator __position, _Args&&... __args) - { - const size_type __n = __position - begin(); - if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage - && __position == end()) - { - _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, - std::forward<_Args>(__args)...); - ++this->_M_impl._M_finish; - } - else - _M_insert_aux(begin() + (__position - cbegin()), - std::forward<_Args>(__args)...); - return iterator(this->_M_impl._M_start + __n); - } - - template - template - void - vector<_Tp, _Alloc>:: - _M_insert_aux(iterator __position, _Args&&... __args) -#else - template - void - vector<_Tp, _Alloc>:: - _M_insert_aux(iterator __position, const _Tp& __x) -#endif - { - if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) - { - _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, - _GLIBCXX_MOVE(*(this->_M_impl._M_finish - - 1))); - ++this->_M_impl._M_finish; -#if __cplusplus < 201103L - _Tp __x_copy = __x; -#endif - _GLIBCXX_MOVE_BACKWARD3(__position.base(), - this->_M_impl._M_finish - 2, - this->_M_impl._M_finish - 1); -#if __cplusplus < 201103L - *__position = __x_copy; -#else - *__position = _Tp(std::forward<_Args>(__args)...); -#endif - } - else - { - const size_type __len = - _M_check_len(size_type(1), "vector::_M_insert_aux"); - const size_type __elems_before = __position - begin(); - pointer __new_start(this->_M_allocate(__len)); - pointer __new_finish(__new_start); - __try - { - // The order of the three operations is dictated by the C++0x - // case, where the moves could alter a new element belonging - // to the existing vector. This is an issue only for callers - // taking the element by const lvalue ref (see 23.1/13). - _Alloc_traits::construct(this->_M_impl, - __new_start + __elems_before, -#if __cplusplus >= 201103L - std::forward<_Args>(__args)...); -#else - __x); -#endif - __new_finish = pointer(); - - __new_finish - = std::__uninitialized_move_if_noexcept_a - (this->_M_impl._M_start, __position.base(), - __new_start, _M_get_Tp_allocator()); - - ++__new_finish; - - __new_finish - = std::__uninitialized_move_if_noexcept_a - (__position.base(), this->_M_impl._M_finish, - __new_finish, _M_get_Tp_allocator()); - } - __catch(...) - { - if (!__new_finish) - _Alloc_traits::destroy(this->_M_impl, - __new_start + __elems_before); - else - std::_Destroy(__new_start, __new_finish, _M_get_Tp_allocator()); - _M_deallocate(__new_start, __len); - __throw_exception_again; - } - std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, - _M_get_Tp_allocator()); - _M_deallocate(this->_M_impl._M_start, - this->_M_impl._M_end_of_storage - - this->_M_impl._M_start); - this->_M_impl._M_start = __new_start; - this->_M_impl._M_finish = __new_finish; - this->_M_impl._M_end_of_storage = __new_start + __len; - } - } - -#if __cplusplus >= 201103L - template - template - void - vector<_Tp, _Alloc>:: - _M_emplace_back_aux(_Args&&... __args) - { - const size_type __len = - _M_check_len(size_type(1), "vector::_M_emplace_back_aux"); - pointer __new_start(this->_M_allocate(__len)); - pointer __new_finish(__new_start); - __try - { - _Alloc_traits::construct(this->_M_impl, __new_start + size(), - std::forward<_Args>(__args)...); - __new_finish = pointer(); - - __new_finish - = std::__uninitialized_move_if_noexcept_a - (this->_M_impl._M_start, this->_M_impl._M_finish, - __new_start, _M_get_Tp_allocator()); - - ++__new_finish; - } - __catch(...) - { - if (!__new_finish) - _Alloc_traits::destroy(this->_M_impl, __new_start + size()); - else - std::_Destroy(__new_start, __new_finish, _M_get_Tp_allocator()); - _M_deallocate(__new_start, __len); - __throw_exception_again; - } - std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, - _M_get_Tp_allocator()); - _M_deallocate(this->_M_impl._M_start, - this->_M_impl._M_end_of_storage - - this->_M_impl._M_start); - this->_M_impl._M_start = __new_start; - this->_M_impl._M_finish = __new_finish; - this->_M_impl._M_end_of_storage = __new_start + __len; - } -#endif - - template - void - vector<_Tp, _Alloc>:: - _M_fill_insert(iterator __position, size_type __n, const value_type& __x) - { - if (__n != 0) - { - if (size_type(this->_M_impl._M_end_of_storage - - this->_M_impl._M_finish) >= __n) - { - value_type __x_copy = __x; - const size_type __elems_after = end() - __position; - pointer __old_finish(this->_M_impl._M_finish); - if (__elems_after > __n) - { - std::__uninitialized_move_a(this->_M_impl._M_finish - __n, - this->_M_impl._M_finish, - this->_M_impl._M_finish, - _M_get_Tp_allocator()); - this->_M_impl._M_finish += __n; - _GLIBCXX_MOVE_BACKWARD3(__position.base(), - __old_finish - __n, __old_finish); - std::fill(__position.base(), __position.base() + __n, - __x_copy); - } - else - { - this->_M_impl._M_finish = - std::__uninitialized_fill_n_a(this->_M_impl._M_finish, - __n - __elems_after, - __x_copy, - _M_get_Tp_allocator()); - std::__uninitialized_move_a(__position.base(), __old_finish, - this->_M_impl._M_finish, - _M_get_Tp_allocator()); - this->_M_impl._M_finish += __elems_after; - std::fill(__position.base(), __old_finish, __x_copy); - } - } - else - { - const size_type __len = - _M_check_len(__n, "vector::_M_fill_insert"); - const size_type __elems_before = __position - begin(); - pointer __new_start(this->_M_allocate(__len)); - pointer __new_finish(__new_start); - __try - { - // See _M_insert_aux above. - std::__uninitialized_fill_n_a(__new_start + __elems_before, - __n, __x, - _M_get_Tp_allocator()); - __new_finish = pointer(); - - __new_finish - = std::__uninitialized_move_if_noexcept_a - (this->_M_impl._M_start, __position.base(), - __new_start, _M_get_Tp_allocator()); - - __new_finish += __n; - - __new_finish - = std::__uninitialized_move_if_noexcept_a - (__position.base(), this->_M_impl._M_finish, - __new_finish, _M_get_Tp_allocator()); - } - __catch(...) - { - if (!__new_finish) - std::_Destroy(__new_start + __elems_before, - __new_start + __elems_before + __n, - _M_get_Tp_allocator()); - else - std::_Destroy(__new_start, __new_finish, - _M_get_Tp_allocator()); - _M_deallocate(__new_start, __len); - __throw_exception_again; - } - std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, - _M_get_Tp_allocator()); - _M_deallocate(this->_M_impl._M_start, - this->_M_impl._M_end_of_storage - - this->_M_impl._M_start); - this->_M_impl._M_start = __new_start; - this->_M_impl._M_finish = __new_finish; - this->_M_impl._M_end_of_storage = __new_start + __len; - } - } - } - -#if __cplusplus >= 201103L - template - void - vector<_Tp, _Alloc>:: - _M_default_append(size_type __n) - { - if (__n != 0) - { - if (size_type(this->_M_impl._M_end_of_storage - - this->_M_impl._M_finish) >= __n) - { - this->_M_impl._M_finish = - std::__uninitialized_default_n_a(this->_M_impl._M_finish, - __n, _M_get_Tp_allocator()); - } - else - { - const size_type __len = - _M_check_len(__n, "vector::_M_default_append"); - const size_type __old_size = this->size(); - pointer __new_start(this->_M_allocate(__len)); - pointer __new_finish(__new_start); - __try - { - __new_finish - = std::__uninitialized_move_if_noexcept_a - (this->_M_impl._M_start, this->_M_impl._M_finish, - __new_start, _M_get_Tp_allocator()); - __new_finish = - std::__uninitialized_default_n_a(__new_finish, __n, - _M_get_Tp_allocator()); - } - __catch(...) - { - std::_Destroy(__new_start, __new_finish, - _M_get_Tp_allocator()); - _M_deallocate(__new_start, __len); - __throw_exception_again; - } - std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, - _M_get_Tp_allocator()); - _M_deallocate(this->_M_impl._M_start, - this->_M_impl._M_end_of_storage - - this->_M_impl._M_start); - this->_M_impl._M_start = __new_start; - this->_M_impl._M_finish = __new_finish; - this->_M_impl._M_end_of_storage = __new_start + __len; - } - } - } - - template - bool - vector<_Tp, _Alloc>:: - _M_shrink_to_fit() - { - if (capacity() == size()) - return false; - return std::__shrink_to_fit_aux::_S_do_it(*this); - } -#endif - - template - template - void - vector<_Tp, _Alloc>:: - _M_range_insert(iterator __pos, _InputIterator __first, - _InputIterator __last, std::input_iterator_tag) - { - for (; __first != __last; ++__first) - { - __pos = insert(__pos, *__first); - ++__pos; - } - } - - template - template - void - vector<_Tp, _Alloc>:: - _M_range_insert(iterator __position, _ForwardIterator __first, - _ForwardIterator __last, std::forward_iterator_tag) - { - if (__first != __last) - { - const size_type __n = std::distance(__first, __last); - if (size_type(this->_M_impl._M_end_of_storage - - this->_M_impl._M_finish) >= __n) - { - const size_type __elems_after = end() - __position; - pointer __old_finish(this->_M_impl._M_finish); - if (__elems_after > __n) - { - std::__uninitialized_move_a(this->_M_impl._M_finish - __n, - this->_M_impl._M_finish, - this->_M_impl._M_finish, - _M_get_Tp_allocator()); - this->_M_impl._M_finish += __n; - _GLIBCXX_MOVE_BACKWARD3(__position.base(), - __old_finish - __n, __old_finish); - std::copy(__first, __last, __position); - } - else - { - _ForwardIterator __mid = __first; - std::advance(__mid, __elems_after); - std::__uninitialized_copy_a(__mid, __last, - this->_M_impl._M_finish, - _M_get_Tp_allocator()); - this->_M_impl._M_finish += __n - __elems_after; - std::__uninitialized_move_a(__position.base(), - __old_finish, - this->_M_impl._M_finish, - _M_get_Tp_allocator()); - this->_M_impl._M_finish += __elems_after; - std::copy(__first, __mid, __position); - } - } - else - { - const size_type __len = - _M_check_len(__n, "vector::_M_range_insert"); - pointer __new_start(this->_M_allocate(__len)); - pointer __new_finish(__new_start); - __try - { - __new_finish - = std::__uninitialized_move_if_noexcept_a - (this->_M_impl._M_start, __position.base(), - __new_start, _M_get_Tp_allocator()); - __new_finish - = std::__uninitialized_copy_a(__first, __last, - __new_finish, - _M_get_Tp_allocator()); - __new_finish - = std::__uninitialized_move_if_noexcept_a - (__position.base(), this->_M_impl._M_finish, - __new_finish, _M_get_Tp_allocator()); - } - __catch(...) - { - std::_Destroy(__new_start, __new_finish, - _M_get_Tp_allocator()); - _M_deallocate(__new_start, __len); - __throw_exception_again; - } - std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, - _M_get_Tp_allocator()); - _M_deallocate(this->_M_impl._M_start, - this->_M_impl._M_end_of_storage - - this->_M_impl._M_start); - this->_M_impl._M_start = __new_start; - this->_M_impl._M_finish = __new_finish; - this->_M_impl._M_end_of_storage = __new_start + __len; - } - } - } - - - // vector - template - void - vector:: - _M_reallocate(size_type __n) - { - _Bit_pointer __q = this->_M_allocate(__n); - iterator __start(std::__addressof(*__q), 0); - this->_M_impl._M_finish = _M_copy_aligned(begin(), end(), __start); - this->_M_deallocate(); - this->_M_impl._M_start = __start; - this->_M_impl._M_end_of_storage = __q + _S_nword(__n); - } - - template - void - vector:: - _M_fill_insert(iterator __position, size_type __n, bool __x) - { - if (__n == 0) - return; - if (capacity() - size() >= __n) - { - std::copy_backward(__position, end(), - this->_M_impl._M_finish + difference_type(__n)); - std::fill(__position, __position + difference_type(__n), __x); - this->_M_impl._M_finish += difference_type(__n); - } - else - { - const size_type __len = - _M_check_len(__n, "vector::_M_fill_insert"); - _Bit_pointer __q = this->_M_allocate(__len); - iterator __start(std::__addressof(*__q), 0); - iterator __i = _M_copy_aligned(begin(), __position, __start); - std::fill(__i, __i + difference_type(__n), __x); - this->_M_impl._M_finish = std::copy(__position, end(), - __i + difference_type(__n)); - this->_M_deallocate(); - this->_M_impl._M_end_of_storage = __q + _S_nword(__len); - this->_M_impl._M_start = __start; - } - } - - template - template - void - vector:: - _M_insert_range(iterator __position, _ForwardIterator __first, - _ForwardIterator __last, std::forward_iterator_tag) - { - if (__first != __last) - { - size_type __n = std::distance(__first, __last); - if (capacity() - size() >= __n) - { - std::copy_backward(__position, end(), - this->_M_impl._M_finish - + difference_type(__n)); - std::copy(__first, __last, __position); - this->_M_impl._M_finish += difference_type(__n); - } - else - { - const size_type __len = - _M_check_len(__n, "vector::_M_insert_range"); - _Bit_pointer __q = this->_M_allocate(__len); - iterator __start(std::__addressof(*__q), 0); - iterator __i = _M_copy_aligned(begin(), __position, __start); - __i = std::copy(__first, __last, __i); - this->_M_impl._M_finish = std::copy(__position, end(), __i); - this->_M_deallocate(); - this->_M_impl._M_end_of_storage = __q + _S_nword(__len); - this->_M_impl._M_start = __start; - } - } - } - - template - void - vector:: - _M_insert_aux(iterator __position, bool __x) - { - if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr()) - { - std::copy_backward(__position, this->_M_impl._M_finish, - this->_M_impl._M_finish + 1); - *__position = __x; - ++this->_M_impl._M_finish; - } - else - { - const size_type __len = - _M_check_len(size_type(1), "vector::_M_insert_aux"); - _Bit_pointer __q = this->_M_allocate(__len); - iterator __start(std::__addressof(*__q), 0); - iterator __i = _M_copy_aligned(begin(), __position, __start); - *__i++ = __x; - this->_M_impl._M_finish = std::copy(__position, end(), __i); - this->_M_deallocate(); - this->_M_impl._M_end_of_storage = __q + _S_nword(__len); - this->_M_impl._M_start = __start; - } - } - - template - typename vector::iterator - vector:: - _M_erase(iterator __position) - { - if (__position + 1 != end()) - std::copy(__position + 1, end(), __position); - --this->_M_impl._M_finish; - return __position; - } - - template - typename vector::iterator - vector:: - _M_erase(iterator __first, iterator __last) - { - if (__first != __last) - _M_erase_at_end(std::copy(__last, end(), __first)); - return __first; - } - -#if __cplusplus >= 201103L - template - bool - vector:: - _M_shrink_to_fit() - { - if (capacity() - size() < int(_S_word_bit)) - return false; - __try - { - _M_reallocate(size()); - return true; - } - __catch(...) - { return false; } - } -#endif - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#if __cplusplus >= 201103L - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - size_t - hash<_GLIBCXX_STD_C::vector>:: - operator()(const _GLIBCXX_STD_C::vector& __b) const noexcept - { - size_t __hash = 0; - using _GLIBCXX_STD_C::_S_word_bit; - using _GLIBCXX_STD_C::_Bit_type; - - const size_t __words = __b.size() / _S_word_bit; - if (__words) - { - const size_t __clength = __words * sizeof(_Bit_type); - __hash = std::_Hash_impl::hash(__b._M_impl._M_start._M_p, __clength); - } - - const size_t __extrabits = __b.size() % _S_word_bit; - if (__extrabits) - { - _Bit_type __hiword = *__b._M_impl._M_finish._M_p; - __hiword &= ~((~static_cast<_Bit_type>(0)) << __extrabits); - - const size_t __clength - = (__extrabits + __CHAR_BIT__ - 1) / __CHAR_BIT__; - if (__words) - __hash = std::_Hash_impl::hash(&__hiword, __clength, __hash); - else - __hash = std::_Hash_impl::hash(&__hiword, __clength); - } - - return __hash; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -#endif // C++11 - -#endif /* _VECTOR_TCC */ diff --git a/openflow/usr/include/c++/5/bitset b/openflow/usr/include/c++/5/bitset deleted file mode 100644 index 44df60c..0000000 --- a/openflow/usr/include/c++/5/bitset +++ /dev/null @@ -1,1594 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * Copyright (c) 1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/bitset - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_BITSET -#define _GLIBCXX_BITSET 1 - -#pragma GCC system_header - -#include -#include // For invalid_argument, out_of_range, - // overflow_error -#include -#include - -#define _GLIBCXX_BITSET_BITS_PER_WORD (__CHAR_BIT__ * __SIZEOF_LONG__) -#define _GLIBCXX_BITSET_WORDS(__n) \ - ((__n) / _GLIBCXX_BITSET_BITS_PER_WORD + \ - ((__n) % _GLIBCXX_BITSET_BITS_PER_WORD == 0 ? 0 : 1)) - -#define _GLIBCXX_BITSET_BITS_PER_ULL (__CHAR_BIT__ * __SIZEOF_LONG_LONG__) - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - - /** - * Base class, general case. It is a class invariant that _Nw will be - * nonnegative. - * - * See documentation for bitset. - */ - template - struct _Base_bitset - { - typedef unsigned long _WordT; - - /// 0 is the least significant word. - _WordT _M_w[_Nw]; - - _GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_NOEXCEPT - : _M_w() { } - -#if __cplusplus >= 201103L - constexpr _Base_bitset(unsigned long long __val) noexcept - : _M_w{ _WordT(__val) -#if __SIZEOF_LONG_LONG__ > __SIZEOF_LONG__ - , _WordT(__val >> _GLIBCXX_BITSET_BITS_PER_WORD) -#endif - } { } -#else - _Base_bitset(unsigned long __val) - : _M_w() - { _M_w[0] = __val; } -#endif - - static _GLIBCXX_CONSTEXPR size_t - _S_whichword(size_t __pos) _GLIBCXX_NOEXCEPT - { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } - - static _GLIBCXX_CONSTEXPR size_t - _S_whichbyte(size_t __pos) _GLIBCXX_NOEXCEPT - { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } - - static _GLIBCXX_CONSTEXPR size_t - _S_whichbit(size_t __pos) _GLIBCXX_NOEXCEPT - { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } - - static _GLIBCXX_CONSTEXPR _WordT - _S_maskbit(size_t __pos) _GLIBCXX_NOEXCEPT - { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } - - _WordT& - _M_getword(size_t __pos) _GLIBCXX_NOEXCEPT - { return _M_w[_S_whichword(__pos)]; } - - _GLIBCXX_CONSTEXPR _WordT - _M_getword(size_t __pos) const _GLIBCXX_NOEXCEPT - { return _M_w[_S_whichword(__pos)]; } - -#if __cplusplus >= 201103L - const _WordT* - _M_getdata() const noexcept - { return _M_w; } -#endif - - _WordT& - _M_hiword() _GLIBCXX_NOEXCEPT - { return _M_w[_Nw - 1]; } - - _GLIBCXX_CONSTEXPR _WordT - _M_hiword() const _GLIBCXX_NOEXCEPT - { return _M_w[_Nw - 1]; } - - void - _M_do_and(const _Base_bitset<_Nw>& __x) _GLIBCXX_NOEXCEPT - { - for (size_t __i = 0; __i < _Nw; __i++) - _M_w[__i] &= __x._M_w[__i]; - } - - void - _M_do_or(const _Base_bitset<_Nw>& __x) _GLIBCXX_NOEXCEPT - { - for (size_t __i = 0; __i < _Nw; __i++) - _M_w[__i] |= __x._M_w[__i]; - } - - void - _M_do_xor(const _Base_bitset<_Nw>& __x) _GLIBCXX_NOEXCEPT - { - for (size_t __i = 0; __i < _Nw; __i++) - _M_w[__i] ^= __x._M_w[__i]; - } - - void - _M_do_left_shift(size_t __shift) _GLIBCXX_NOEXCEPT; - - void - _M_do_right_shift(size_t __shift) _GLIBCXX_NOEXCEPT; - - void - _M_do_flip() _GLIBCXX_NOEXCEPT - { - for (size_t __i = 0; __i < _Nw; __i++) - _M_w[__i] = ~_M_w[__i]; - } - - void - _M_do_set() _GLIBCXX_NOEXCEPT - { - for (size_t __i = 0; __i < _Nw; __i++) - _M_w[__i] = ~static_cast<_WordT>(0); - } - - void - _M_do_reset() _GLIBCXX_NOEXCEPT - { __builtin_memset(_M_w, 0, _Nw * sizeof(_WordT)); } - - bool - _M_is_equal(const _Base_bitset<_Nw>& __x) const _GLIBCXX_NOEXCEPT - { - for (size_t __i = 0; __i < _Nw; ++__i) - if (_M_w[__i] != __x._M_w[__i]) - return false; - return true; - } - - template - bool - _M_are_all() const _GLIBCXX_NOEXCEPT - { - for (size_t __i = 0; __i < _Nw - 1; __i++) - if (_M_w[__i] != ~static_cast<_WordT>(0)) - return false; - return _M_hiword() == (~static_cast<_WordT>(0) - >> (_Nw * _GLIBCXX_BITSET_BITS_PER_WORD - - _Nb)); - } - - bool - _M_is_any() const _GLIBCXX_NOEXCEPT - { - for (size_t __i = 0; __i < _Nw; __i++) - if (_M_w[__i] != static_cast<_WordT>(0)) - return true; - return false; - } - - size_t - _M_do_count() const _GLIBCXX_NOEXCEPT - { - size_t __result = 0; - for (size_t __i = 0; __i < _Nw; __i++) - __result += __builtin_popcountl(_M_w[__i]); - return __result; - } - - unsigned long - _M_do_to_ulong() const; - -#if __cplusplus >= 201103L - unsigned long long - _M_do_to_ullong() const; -#endif - - // find first "on" bit - size_t - _M_do_find_first(size_t) const _GLIBCXX_NOEXCEPT; - - // find the next "on" bit that follows "prev" - size_t - _M_do_find_next(size_t, size_t) const _GLIBCXX_NOEXCEPT; - }; - - // Definitions of non-inline functions from _Base_bitset. - template - void - _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift) _GLIBCXX_NOEXCEPT - { - if (__builtin_expect(__shift != 0, 1)) - { - const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD; - const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD; - - if (__offset == 0) - for (size_t __n = _Nw - 1; __n >= __wshift; --__n) - _M_w[__n] = _M_w[__n - __wshift]; - else - { - const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD - - __offset); - for (size_t __n = _Nw - 1; __n > __wshift; --__n) - _M_w[__n] = ((_M_w[__n - __wshift] << __offset) - | (_M_w[__n - __wshift - 1] >> __sub_offset)); - _M_w[__wshift] = _M_w[0] << __offset; - } - - std::fill(_M_w + 0, _M_w + __wshift, static_cast<_WordT>(0)); - } - } - - template - void - _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift) _GLIBCXX_NOEXCEPT - { - if (__builtin_expect(__shift != 0, 1)) - { - const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD; - const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD; - const size_t __limit = _Nw - __wshift - 1; - - if (__offset == 0) - for (size_t __n = 0; __n <= __limit; ++__n) - _M_w[__n] = _M_w[__n + __wshift]; - else - { - const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD - - __offset); - for (size_t __n = 0; __n < __limit; ++__n) - _M_w[__n] = ((_M_w[__n + __wshift] >> __offset) - | (_M_w[__n + __wshift + 1] << __sub_offset)); - _M_w[__limit] = _M_w[_Nw-1] >> __offset; - } - - std::fill(_M_w + __limit + 1, _M_w + _Nw, static_cast<_WordT>(0)); - } - } - - template - unsigned long - _Base_bitset<_Nw>::_M_do_to_ulong() const - { - for (size_t __i = 1; __i < _Nw; ++__i) - if (_M_w[__i]) - __throw_overflow_error(__N("_Base_bitset::_M_do_to_ulong")); - return _M_w[0]; - } - -#if __cplusplus >= 201103L - template - unsigned long long - _Base_bitset<_Nw>::_M_do_to_ullong() const - { - const bool __dw = sizeof(unsigned long long) > sizeof(unsigned long); - for (size_t __i = 1 + __dw; __i < _Nw; ++__i) - if (_M_w[__i]) - __throw_overflow_error(__N("_Base_bitset::_M_do_to_ullong")); - - if (__dw) - return _M_w[0] + (static_cast(_M_w[1]) - << _GLIBCXX_BITSET_BITS_PER_WORD); - return _M_w[0]; - } -#endif - - template - size_t - _Base_bitset<_Nw>:: - _M_do_find_first(size_t __not_found) const _GLIBCXX_NOEXCEPT - { - for (size_t __i = 0; __i < _Nw; __i++) - { - _WordT __thisword = _M_w[__i]; - if (__thisword != static_cast<_WordT>(0)) - return (__i * _GLIBCXX_BITSET_BITS_PER_WORD - + __builtin_ctzl(__thisword)); - } - // not found, so return an indication of failure. - return __not_found; - } - - template - size_t - _Base_bitset<_Nw>:: - _M_do_find_next(size_t __prev, size_t __not_found) const _GLIBCXX_NOEXCEPT - { - // make bound inclusive - ++__prev; - - // check out of bounds - if (__prev >= _Nw * _GLIBCXX_BITSET_BITS_PER_WORD) - return __not_found; - - // search first word - size_t __i = _S_whichword(__prev); - _WordT __thisword = _M_w[__i]; - - // mask off bits below bound - __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev); - - if (__thisword != static_cast<_WordT>(0)) - return (__i * _GLIBCXX_BITSET_BITS_PER_WORD - + __builtin_ctzl(__thisword)); - - // check subsequent words - __i++; - for (; __i < _Nw; __i++) - { - __thisword = _M_w[__i]; - if (__thisword != static_cast<_WordT>(0)) - return (__i * _GLIBCXX_BITSET_BITS_PER_WORD - + __builtin_ctzl(__thisword)); - } - // not found, so return an indication of failure. - return __not_found; - } // end _M_do_find_next - - /** - * Base class, specialization for a single word. - * - * See documentation for bitset. - */ - template<> - struct _Base_bitset<1> - { - typedef unsigned long _WordT; - _WordT _M_w; - - _GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_NOEXCEPT - : _M_w(0) - { } - -#if __cplusplus >= 201103L - constexpr _Base_bitset(unsigned long long __val) noexcept -#else - _Base_bitset(unsigned long __val) -#endif - : _M_w(__val) - { } - - static _GLIBCXX_CONSTEXPR size_t - _S_whichword(size_t __pos) _GLIBCXX_NOEXCEPT - { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } - - static _GLIBCXX_CONSTEXPR size_t - _S_whichbyte(size_t __pos) _GLIBCXX_NOEXCEPT - { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } - - static _GLIBCXX_CONSTEXPR size_t - _S_whichbit(size_t __pos) _GLIBCXX_NOEXCEPT - { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } - - static _GLIBCXX_CONSTEXPR _WordT - _S_maskbit(size_t __pos) _GLIBCXX_NOEXCEPT - { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } - - _WordT& - _M_getword(size_t) _GLIBCXX_NOEXCEPT - { return _M_w; } - - _GLIBCXX_CONSTEXPR _WordT - _M_getword(size_t) const _GLIBCXX_NOEXCEPT - { return _M_w; } - -#if __cplusplus >= 201103L - const _WordT* - _M_getdata() const noexcept - { return &_M_w; } -#endif - - _WordT& - _M_hiword() _GLIBCXX_NOEXCEPT - { return _M_w; } - - _GLIBCXX_CONSTEXPR _WordT - _M_hiword() const _GLIBCXX_NOEXCEPT - { return _M_w; } - - void - _M_do_and(const _Base_bitset<1>& __x) _GLIBCXX_NOEXCEPT - { _M_w &= __x._M_w; } - - void - _M_do_or(const _Base_bitset<1>& __x) _GLIBCXX_NOEXCEPT - { _M_w |= __x._M_w; } - - void - _M_do_xor(const _Base_bitset<1>& __x) _GLIBCXX_NOEXCEPT - { _M_w ^= __x._M_w; } - - void - _M_do_left_shift(size_t __shift) _GLIBCXX_NOEXCEPT - { _M_w <<= __shift; } - - void - _M_do_right_shift(size_t __shift) _GLIBCXX_NOEXCEPT - { _M_w >>= __shift; } - - void - _M_do_flip() _GLIBCXX_NOEXCEPT - { _M_w = ~_M_w; } - - void - _M_do_set() _GLIBCXX_NOEXCEPT - { _M_w = ~static_cast<_WordT>(0); } - - void - _M_do_reset() _GLIBCXX_NOEXCEPT - { _M_w = 0; } - - bool - _M_is_equal(const _Base_bitset<1>& __x) const _GLIBCXX_NOEXCEPT - { return _M_w == __x._M_w; } - - template - bool - _M_are_all() const _GLIBCXX_NOEXCEPT - { return _M_w == (~static_cast<_WordT>(0) - >> (_GLIBCXX_BITSET_BITS_PER_WORD - _Nb)); } - - bool - _M_is_any() const _GLIBCXX_NOEXCEPT - { return _M_w != 0; } - - size_t - _M_do_count() const _GLIBCXX_NOEXCEPT - { return __builtin_popcountl(_M_w); } - - unsigned long - _M_do_to_ulong() const _GLIBCXX_NOEXCEPT - { return _M_w; } - -#if __cplusplus >= 201103L - unsigned long long - _M_do_to_ullong() const noexcept - { return _M_w; } -#endif - - size_t - _M_do_find_first(size_t __not_found) const _GLIBCXX_NOEXCEPT - { - if (_M_w != 0) - return __builtin_ctzl(_M_w); - else - return __not_found; - } - - // find the next "on" bit that follows "prev" - size_t - _M_do_find_next(size_t __prev, size_t __not_found) const - _GLIBCXX_NOEXCEPT - { - ++__prev; - if (__prev >= ((size_t) _GLIBCXX_BITSET_BITS_PER_WORD)) - return __not_found; - - _WordT __x = _M_w >> __prev; - if (__x != 0) - return __builtin_ctzl(__x) + __prev; - else - return __not_found; - } - }; - - /** - * Base class, specialization for no storage (zero-length %bitset). - * - * See documentation for bitset. - */ - template<> - struct _Base_bitset<0> - { - typedef unsigned long _WordT; - - _GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_NOEXCEPT - { } - -#if __cplusplus >= 201103L - constexpr _Base_bitset(unsigned long long) noexcept -#else - _Base_bitset(unsigned long) -#endif - { } - - static _GLIBCXX_CONSTEXPR size_t - _S_whichword(size_t __pos) _GLIBCXX_NOEXCEPT - { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } - - static _GLIBCXX_CONSTEXPR size_t - _S_whichbyte(size_t __pos) _GLIBCXX_NOEXCEPT - { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } - - static _GLIBCXX_CONSTEXPR size_t - _S_whichbit(size_t __pos) _GLIBCXX_NOEXCEPT - { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } - - static _GLIBCXX_CONSTEXPR _WordT - _S_maskbit(size_t __pos) _GLIBCXX_NOEXCEPT - { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } - - // This would normally give access to the data. The bounds-checking - // in the bitset class will prevent the user from getting this far, - // but (1) it must still return an lvalue to compile, and (2) the - // user might call _Unchecked_set directly, in which case this /needs/ - // to fail. Let's not penalize zero-length users unless they actually - // make an unchecked call; all the memory ugliness is therefore - // localized to this single should-never-get-this-far function. - _WordT& - _M_getword(size_t) _GLIBCXX_NOEXCEPT - { - __throw_out_of_range(__N("_Base_bitset::_M_getword")); - return *new _WordT; - } - - _GLIBCXX_CONSTEXPR _WordT - _M_getword(size_t __pos) const _GLIBCXX_NOEXCEPT - { return 0; } - - _GLIBCXX_CONSTEXPR _WordT - _M_hiword() const _GLIBCXX_NOEXCEPT - { return 0; } - - void - _M_do_and(const _Base_bitset<0>&) _GLIBCXX_NOEXCEPT - { } - - void - _M_do_or(const _Base_bitset<0>&) _GLIBCXX_NOEXCEPT - { } - - void - _M_do_xor(const _Base_bitset<0>&) _GLIBCXX_NOEXCEPT - { } - - void - _M_do_left_shift(size_t) _GLIBCXX_NOEXCEPT - { } - - void - _M_do_right_shift(size_t) _GLIBCXX_NOEXCEPT - { } - - void - _M_do_flip() _GLIBCXX_NOEXCEPT - { } - - void - _M_do_set() _GLIBCXX_NOEXCEPT - { } - - void - _M_do_reset() _GLIBCXX_NOEXCEPT - { } - - // Are all empty bitsets equal to each other? Are they equal to - // themselves? How to compare a thing which has no state? What is - // the sound of one zero-length bitset clapping? - bool - _M_is_equal(const _Base_bitset<0>&) const _GLIBCXX_NOEXCEPT - { return true; } - - template - bool - _M_are_all() const _GLIBCXX_NOEXCEPT - { return true; } - - bool - _M_is_any() const _GLIBCXX_NOEXCEPT - { return false; } - - size_t - _M_do_count() const _GLIBCXX_NOEXCEPT - { return 0; } - - unsigned long - _M_do_to_ulong() const _GLIBCXX_NOEXCEPT - { return 0; } - -#if __cplusplus >= 201103L - unsigned long long - _M_do_to_ullong() const noexcept - { return 0; } -#endif - - // Normally "not found" is the size, but that could also be - // misinterpreted as an index in this corner case. Oh well. - size_t - _M_do_find_first(size_t) const _GLIBCXX_NOEXCEPT - { return 0; } - - size_t - _M_do_find_next(size_t, size_t) const _GLIBCXX_NOEXCEPT - { return 0; } - }; - - - // Helper class to zero out the unused high-order bits in the highest word. - template - struct _Sanitize - { - typedef unsigned long _WordT; - - static void - _S_do_sanitize(_WordT& __val) _GLIBCXX_NOEXCEPT - { __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); } - }; - - template<> - struct _Sanitize<0> - { - typedef unsigned long _WordT; - - static void - _S_do_sanitize(_WordT) _GLIBCXX_NOEXCEPT { } - }; - -#if __cplusplus >= 201103L - template - struct _Sanitize_val - { - static constexpr unsigned long long - _S_do_sanitize_val(unsigned long long __val) - { return __val; } - }; - - template - struct _Sanitize_val<_Nb, true> - { - static constexpr unsigned long long - _S_do_sanitize_val(unsigned long long __val) - { return __val & ~((~static_cast(0)) << _Nb); } - }; -#endif - - /** - * @brief The %bitset class represents a @e fixed-size sequence of bits. - * @ingroup utilities - * - * (Note that %bitset does @e not meet the formal requirements of a - * container. Mainly, it lacks iterators.) - * - * The template argument, @a Nb, may be any non-negative number, - * specifying the number of bits (e.g., "0", "12", "1024*1024"). - * - * In the general unoptimized case, storage is allocated in word-sized - * blocks. Let B be the number of bits in a word, then (Nb+(B-1))/B - * words will be used for storage. B - Nb%B bits are unused. (They are - * the high-order bits in the highest word.) It is a class invariant - * that those unused bits are always zero. - * - * If you think of %bitset as a simple array of bits, be - * aware that your mental picture is reversed: a %bitset behaves - * the same way as bits in integers do, with the bit at index 0 in - * the least significant / right-hand position, and the bit at - * index Nb-1 in the most significant / left-hand position. - * Thus, unlike other containers, a %bitset's index counts from - * right to left, to put it very loosely. - * - * This behavior is preserved when translating to and from strings. For - * example, the first line of the following program probably prints - * b('a') is 0001100001 on a modern ASCII system. - * - * @code - * #include - * #include - * #include - * - * using namespace std; - * - * int main() - * { - * long a = 'a'; - * bitset<10> b(a); - * - * cout << "b('a') is " << b << endl; - * - * ostringstream s; - * s << b; - * string str = s.str(); - * cout << "index 3 in the string is " << str[3] << " but\n" - * << "index 3 in the bitset is " << b[3] << endl; - * } - * @endcode - * - * Also see: - * https://gcc.gnu.org/onlinedocs/libstdc++/manual/ext_containers.html - * for a description of extensions. - * - * Most of the actual code isn't contained in %bitset<> itself, but in the - * base class _Base_bitset. The base class works with whole words, not with - * individual bits. This allows us to specialize _Base_bitset for the - * important special case where the %bitset is only a single word. - * - * Extra confusion can result due to the fact that the storage for - * _Base_bitset @e is a regular array, and is indexed as such. This is - * carefully encapsulated. - */ - template - class bitset - : private _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)> - { - private: - typedef _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)> _Base; - typedef unsigned long _WordT; - - template - void - _M_check_initial_position(const std::basic_string<_CharT, _Traits, _Alloc>& __s, - size_t __position) const - { - if (__position > __s.size()) - __throw_out_of_range_fmt(__N("bitset::bitset: __position " - "(which is %zu) > __s.size() " - "(which is %zu)"), - __position, __s.size()); - } - - void _M_check(size_t __position, const char *__s) const - { - if (__position >= _Nb) - __throw_out_of_range_fmt(__N("%s: __position (which is %zu) " - ">= _Nb (which is %zu)"), - __s, __position, _Nb); - } - - void - _M_do_sanitize() _GLIBCXX_NOEXCEPT - { - typedef _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD> __sanitize_type; - __sanitize_type::_S_do_sanitize(this->_M_hiword()); - } - -#if __cplusplus >= 201103L - template friend struct hash; -#endif - - public: - /** - * This encapsulates the concept of a single bit. An instance of this - * class is a proxy for an actual bit; this way the individual bit - * operations are done as faster word-size bitwise instructions. - * - * Most users will never need to use this class directly; conversions - * to and from bool are automatic and should be transparent. Overloaded - * operators help to preserve the illusion. - * - * (On a typical system, this bit %reference is 64 - * times the size of an actual bit. Ha.) - */ - class reference - { - friend class bitset; - - _WordT* _M_wp; - size_t _M_bpos; - - // left undefined - reference(); - - public: - reference(bitset& __b, size_t __pos) _GLIBCXX_NOEXCEPT - { - _M_wp = &__b._M_getword(__pos); - _M_bpos = _Base::_S_whichbit(__pos); - } - - ~reference() _GLIBCXX_NOEXCEPT - { } - - // For b[i] = __x; - reference& - operator=(bool __x) _GLIBCXX_NOEXCEPT - { - if (__x) - *_M_wp |= _Base::_S_maskbit(_M_bpos); - else - *_M_wp &= ~_Base::_S_maskbit(_M_bpos); - return *this; - } - - // For b[i] = b[__j]; - reference& - operator=(const reference& __j) _GLIBCXX_NOEXCEPT - { - if ((*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos))) - *_M_wp |= _Base::_S_maskbit(_M_bpos); - else - *_M_wp &= ~_Base::_S_maskbit(_M_bpos); - return *this; - } - - // Flips the bit - bool - operator~() const _GLIBCXX_NOEXCEPT - { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; } - - // For __x = b[i]; - operator bool() const _GLIBCXX_NOEXCEPT - { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; } - - // For b[i].flip(); - reference& - flip() _GLIBCXX_NOEXCEPT - { - *_M_wp ^= _Base::_S_maskbit(_M_bpos); - return *this; - } - }; - friend class reference; - - // 23.3.5.1 constructors: - /// All bits set to zero. - _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT - { } - - /// Initial bits bitwise-copied from a single word (others set to zero). -#if __cplusplus >= 201103L - constexpr bitset(unsigned long long __val) noexcept - : _Base(_Sanitize_val<_Nb>::_S_do_sanitize_val(__val)) { } -#else - bitset(unsigned long __val) - : _Base(__val) - { _M_do_sanitize(); } -#endif - - /** - * Use a subset of a string. - * @param __s A string of @a 0 and @a 1 characters. - * @param __position Index of the first character in @a __s to use; - * defaults to zero. - * @throw std::out_of_range If @a pos is bigger the size of @a __s. - * @throw std::invalid_argument If a character appears in the string - * which is neither @a 0 nor @a 1. - */ - template - explicit - bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, - size_t __position = 0) - : _Base() - { - _M_check_initial_position(__s, __position); - _M_copy_from_string(__s, __position, - std::basic_string<_CharT, _Traits, _Alloc>::npos, - _CharT('0'), _CharT('1')); - } - - /** - * Use a subset of a string. - * @param __s A string of @a 0 and @a 1 characters. - * @param __position Index of the first character in @a __s to use. - * @param __n The number of characters to copy. - * @throw std::out_of_range If @a __position is bigger the size - * of @a __s. - * @throw std::invalid_argument If a character appears in the string - * which is neither @a 0 nor @a 1. - */ - template - bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, - size_t __position, size_t __n) - : _Base() - { - _M_check_initial_position(__s, __position); - _M_copy_from_string(__s, __position, __n, _CharT('0'), _CharT('1')); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 396. what are characters zero and one. - template - bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, - size_t __position, size_t __n, - _CharT __zero, _CharT __one = _CharT('1')) - : _Base() - { - _M_check_initial_position(__s, __position); - _M_copy_from_string(__s, __position, __n, __zero, __one); - } - -#if __cplusplus >= 201103L - /** - * Construct from a character %array. - * @param __str An %array of characters @a zero and @a one. - * @param __n The number of characters to use. - * @param __zero The character corresponding to the value 0. - * @param __one The character corresponding to the value 1. - * @throw std::invalid_argument If a character appears in the string - * which is neither @a __zero nor @a __one. - */ - template - explicit - bitset(const _CharT* __str, - typename std::basic_string<_CharT>::size_type __n - = std::basic_string<_CharT>::npos, - _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) - : _Base() - { - if (!__str) - __throw_logic_error(__N("bitset::bitset(const _CharT*, ...)")); - - if (__n == std::basic_string<_CharT>::npos) - __n = std::char_traits<_CharT>::length(__str); - _M_copy_from_ptr<_CharT, std::char_traits<_CharT>>(__str, __n, 0, - __n, __zero, - __one); - } -#endif - - // 23.3.5.2 bitset operations: - //@{ - /** - * Operations on bitsets. - * @param __rhs A same-sized bitset. - * - * These should be self-explanatory. - */ - bitset<_Nb>& - operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT - { - this->_M_do_and(__rhs); - return *this; - } - - bitset<_Nb>& - operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT - { - this->_M_do_or(__rhs); - return *this; - } - - bitset<_Nb>& - operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT - { - this->_M_do_xor(__rhs); - return *this; - } - //@} - - //@{ - /** - * Operations on bitsets. - * @param __position The number of places to shift. - * - * These should be self-explanatory. - */ - bitset<_Nb>& - operator<<=(size_t __position) _GLIBCXX_NOEXCEPT - { - if (__builtin_expect(__position < _Nb, 1)) - { - this->_M_do_left_shift(__position); - this->_M_do_sanitize(); - } - else - this->_M_do_reset(); - return *this; - } - - bitset<_Nb>& - operator>>=(size_t __position) _GLIBCXX_NOEXCEPT - { - if (__builtin_expect(__position < _Nb, 1)) - { - this->_M_do_right_shift(__position); - this->_M_do_sanitize(); - } - else - this->_M_do_reset(); - return *this; - } - //@} - - //@{ - /** - * These versions of single-bit set, reset, flip, and test are - * extensions from the SGI version. They do no range checking. - * @ingroup SGIextensions - */ - bitset<_Nb>& - _Unchecked_set(size_t __pos) _GLIBCXX_NOEXCEPT - { - this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& - _Unchecked_set(size_t __pos, int __val) _GLIBCXX_NOEXCEPT - { - if (__val) - this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); - else - this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& - _Unchecked_reset(size_t __pos) _GLIBCXX_NOEXCEPT - { - this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& - _Unchecked_flip(size_t __pos) _GLIBCXX_NOEXCEPT - { - this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos); - return *this; - } - - _GLIBCXX_CONSTEXPR bool - _Unchecked_test(size_t __pos) const _GLIBCXX_NOEXCEPT - { return ((this->_M_getword(__pos) & _Base::_S_maskbit(__pos)) - != static_cast<_WordT>(0)); } - //@} - - // Set, reset, and flip. - /** - * @brief Sets every bit to true. - */ - bitset<_Nb>& - set() _GLIBCXX_NOEXCEPT - { - this->_M_do_set(); - this->_M_do_sanitize(); - return *this; - } - - /** - * @brief Sets a given bit to a particular value. - * @param __position The index of the bit. - * @param __val Either true or false, defaults to true. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - */ - bitset<_Nb>& - set(size_t __position, bool __val = true) - { - this->_M_check(__position, __N("bitset::set")); - return _Unchecked_set(__position, __val); - } - - /** - * @brief Sets every bit to false. - */ - bitset<_Nb>& - reset() _GLIBCXX_NOEXCEPT - { - this->_M_do_reset(); - return *this; - } - - /** - * @brief Sets a given bit to false. - * @param __position The index of the bit. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - * - * Same as writing @c set(pos,false). - */ - bitset<_Nb>& - reset(size_t __position) - { - this->_M_check(__position, __N("bitset::reset")); - return _Unchecked_reset(__position); - } - - /** - * @brief Toggles every bit to its opposite value. - */ - bitset<_Nb>& - flip() _GLIBCXX_NOEXCEPT - { - this->_M_do_flip(); - this->_M_do_sanitize(); - return *this; - } - - /** - * @brief Toggles a given bit to its opposite value. - * @param __position The index of the bit. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - */ - bitset<_Nb>& - flip(size_t __position) - { - this->_M_check(__position, __N("bitset::flip")); - return _Unchecked_flip(__position); - } - - /// See the no-argument flip(). - bitset<_Nb> - operator~() const _GLIBCXX_NOEXCEPT - { return bitset<_Nb>(*this).flip(); } - - //@{ - /** - * @brief Array-indexing support. - * @param __position Index into the %bitset. - * @return A bool for a const %bitset. For non-const - * bitsets, an instance of the reference proxy class. - * @note These operators do no range checking and throw no exceptions, - * as required by DR 11 to the standard. - * - * _GLIBCXX_RESOLVE_LIB_DEFECTS Note that this implementation already - * resolves DR 11 (items 1 and 2), but does not do the range-checking - * required by that DR's resolution. -pme - * The DR has since been changed: range-checking is a precondition - * (users' responsibility), and these functions must not throw. -pme - */ - reference - operator[](size_t __position) - { return reference(*this, __position); } - - _GLIBCXX_CONSTEXPR bool - operator[](size_t __position) const - { return _Unchecked_test(__position); } - //@} - - /** - * @brief Returns a numerical interpretation of the %bitset. - * @return The integral equivalent of the bits. - * @throw std::overflow_error If there are too many bits to be - * represented in an @c unsigned @c long. - */ - unsigned long - to_ulong() const - { return this->_M_do_to_ulong(); } - -#if __cplusplus >= 201103L - unsigned long long - to_ullong() const - { return this->_M_do_to_ullong(); } -#endif - - /** - * @brief Returns a character interpretation of the %bitset. - * @return The string equivalent of the bits. - * - * Note the ordering of the bits: decreasing character positions - * correspond to increasing bit positions (see the main class notes for - * an example). - */ - template - std::basic_string<_CharT, _Traits, _Alloc> - to_string() const - { - std::basic_string<_CharT, _Traits, _Alloc> __result; - _M_copy_to_string(__result, _CharT('0'), _CharT('1')); - return __result; - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 396. what are characters zero and one. - template - std::basic_string<_CharT, _Traits, _Alloc> - to_string(_CharT __zero, _CharT __one = _CharT('1')) const - { - std::basic_string<_CharT, _Traits, _Alloc> __result; - _M_copy_to_string(__result, __zero, __one); - return __result; - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 434. bitset::to_string() hard to use. - template - std::basic_string<_CharT, _Traits, std::allocator<_CharT> > - to_string() const - { return to_string<_CharT, _Traits, std::allocator<_CharT> >(); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 853. to_string needs updating with zero and one. - template - std::basic_string<_CharT, _Traits, std::allocator<_CharT> > - to_string(_CharT __zero, _CharT __one = _CharT('1')) const - { return to_string<_CharT, _Traits, - std::allocator<_CharT> >(__zero, __one); } - - template - std::basic_string<_CharT, std::char_traits<_CharT>, - std::allocator<_CharT> > - to_string() const - { - return to_string<_CharT, std::char_traits<_CharT>, - std::allocator<_CharT> >(); - } - - template - std::basic_string<_CharT, std::char_traits<_CharT>, - std::allocator<_CharT> > - to_string(_CharT __zero, _CharT __one = _CharT('1')) const - { - return to_string<_CharT, std::char_traits<_CharT>, - std::allocator<_CharT> >(__zero, __one); - } - - std::basic_string, std::allocator > - to_string() const - { - return to_string, - std::allocator >(); - } - - std::basic_string, std::allocator > - to_string(char __zero, char __one = '1') const - { - return to_string, - std::allocator >(__zero, __one); - } - - // Helper functions for string operations. - template - void - _M_copy_from_ptr(const _CharT*, size_t, size_t, size_t, - _CharT, _CharT); - - template - void - _M_copy_from_string(const std::basic_string<_CharT, - _Traits, _Alloc>& __s, size_t __pos, size_t __n, - _CharT __zero, _CharT __one) - { _M_copy_from_ptr<_CharT, _Traits>(__s.data(), __s.size(), __pos, __n, - __zero, __one); } - - template - void - _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>&, - _CharT, _CharT) const; - - // NB: Backward compat. - template - void - _M_copy_from_string(const std::basic_string<_CharT, - _Traits, _Alloc>& __s, size_t __pos, size_t __n) - { _M_copy_from_string(__s, __pos, __n, _CharT('0'), _CharT('1')); } - - template - void - _M_copy_to_string(std::basic_string<_CharT, _Traits,_Alloc>& __s) const - { _M_copy_to_string(__s, _CharT('0'), _CharT('1')); } - - /// Returns the number of bits which are set. - size_t - count() const _GLIBCXX_NOEXCEPT - { return this->_M_do_count(); } - - /// Returns the total number of bits. - _GLIBCXX_CONSTEXPR size_t - size() const _GLIBCXX_NOEXCEPT - { return _Nb; } - - //@{ - /// These comparisons for equality/inequality are, well, @e bitwise. - bool - operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT - { return this->_M_is_equal(__rhs); } - - bool - operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT - { return !this->_M_is_equal(__rhs); } - //@} - - /** - * @brief Tests the value of a bit. - * @param __position The index of a bit. - * @return The value at @a pos. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - */ - bool - test(size_t __position) const - { - this->_M_check(__position, __N("bitset::test")); - return _Unchecked_test(__position); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 693. std::bitset::all() missing. - /** - * @brief Tests whether all the bits are on. - * @return True if all the bits are set. - */ - bool - all() const _GLIBCXX_NOEXCEPT - { return this->template _M_are_all<_Nb>(); } - - /** - * @brief Tests whether any of the bits are on. - * @return True if at least one bit is set. - */ - bool - any() const _GLIBCXX_NOEXCEPT - { return this->_M_is_any(); } - - /** - * @brief Tests whether any of the bits are on. - * @return True if none of the bits are set. - */ - bool - none() const _GLIBCXX_NOEXCEPT - { return !this->_M_is_any(); } - - //@{ - /// Self-explanatory. - bitset<_Nb> - operator<<(size_t __position) const _GLIBCXX_NOEXCEPT - { return bitset<_Nb>(*this) <<= __position; } - - bitset<_Nb> - operator>>(size_t __position) const _GLIBCXX_NOEXCEPT - { return bitset<_Nb>(*this) >>= __position; } - //@} - - /** - * @brief Finds the index of the first "on" bit. - * @return The index of the first bit set, or size() if not found. - * @ingroup SGIextensions - * @sa _Find_next - */ - size_t - _Find_first() const _GLIBCXX_NOEXCEPT - { return this->_M_do_find_first(_Nb); } - - /** - * @brief Finds the index of the next "on" bit after prev. - * @return The index of the next bit set, or size() if not found. - * @param __prev Where to start searching. - * @ingroup SGIextensions - * @sa _Find_first - */ - size_t - _Find_next(size_t __prev) const _GLIBCXX_NOEXCEPT - { return this->_M_do_find_next(__prev, _Nb); } - }; - - // Definitions of non-inline member functions. - template - template - void - bitset<_Nb>:: - _M_copy_from_ptr(const _CharT* __s, size_t __len, - size_t __pos, size_t __n, _CharT __zero, _CharT __one) - { - reset(); - const size_t __nbits = std::min(_Nb, std::min(__n, size_t(__len - __pos))); - for (size_t __i = __nbits; __i > 0; --__i) - { - const _CharT __c = __s[__pos + __nbits - __i]; - if (_Traits::eq(__c, __zero)) - ; - else if (_Traits::eq(__c, __one)) - _Unchecked_set(__i - 1); - else - __throw_invalid_argument(__N("bitset::_M_copy_from_ptr")); - } - } - - template - template - void - bitset<_Nb>:: - _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>& __s, - _CharT __zero, _CharT __one) const - { - __s.assign(_Nb, __zero); - for (size_t __i = _Nb; __i > 0; --__i) - if (_Unchecked_test(__i - 1)) - _Traits::assign(__s[_Nb - __i], __one); - } - - // 23.3.5.3 bitset operations: - //@{ - /** - * @brief Global bitwise operations on bitsets. - * @param __x A bitset. - * @param __y A bitset of the same size as @a __x. - * @return A new bitset. - * - * These should be self-explanatory. - */ - template - inline bitset<_Nb> - operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT - { - bitset<_Nb> __result(__x); - __result &= __y; - return __result; - } - - template - inline bitset<_Nb> - operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT - { - bitset<_Nb> __result(__x); - __result |= __y; - return __result; - } - - template - inline bitset<_Nb> - operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT - { - bitset<_Nb> __result(__x); - __result ^= __y; - return __result; - } - //@} - - //@{ - /** - * @brief Global I/O operators for bitsets. - * - * Direct I/O between streams and bitsets is supported. Output is - * straightforward. Input will skip whitespace, only accept @a 0 and @a 1 - * characters, and will only extract as many digits as the %bitset will - * hold. - */ - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) - { - typedef typename _Traits::char_type char_type; - typedef std::basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::ios_base __ios_base; - - std::basic_string<_CharT, _Traits> __tmp; - __tmp.reserve(_Nb); - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 303. Bitset input operator underspecified - const char_type __zero = __is.widen('0'); - const char_type __one = __is.widen('1'); - - typename __ios_base::iostate __state = __ios_base::goodbit; - typename __istream_type::sentry __sentry(__is); - if (__sentry) - { - __try - { - for (size_t __i = _Nb; __i > 0; --__i) - { - static typename _Traits::int_type __eof = _Traits::eof(); - - typename _Traits::int_type __c1 = __is.rdbuf()->sbumpc(); - if (_Traits::eq_int_type(__c1, __eof)) - { - __state |= __ios_base::eofbit; - break; - } - else - { - const char_type __c2 = _Traits::to_char_type(__c1); - if (_Traits::eq(__c2, __zero)) - __tmp.push_back(__zero); - else if (_Traits::eq(__c2, __one)) - __tmp.push_back(__one); - else if (_Traits:: - eq_int_type(__is.rdbuf()->sputbackc(__c2), - __eof)) - { - __state |= __ios_base::failbit; - break; - } - } - } - } - __catch(__cxxabiv1::__forced_unwind&) - { - __is._M_setstate(__ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { __is._M_setstate(__ios_base::badbit); } - } - - if (__tmp.empty() && _Nb) - __state |= __ios_base::failbit; - else - __x._M_copy_from_string(__tmp, static_cast(0), _Nb, - __zero, __one); - if (__state) - __is.setstate(__state); - return __is; - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const bitset<_Nb>& __x) - { - std::basic_string<_CharT, _Traits> __tmp; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 396. what are characters zero and one. - const ctype<_CharT>& __ct = use_facet >(__os.getloc()); - __x._M_copy_to_string(__tmp, __ct.widen('0'), __ct.widen('1')); - return __os << __tmp; - } - //@} - -_GLIBCXX_END_NAMESPACE_CONTAINER -} // namespace std - -#undef _GLIBCXX_BITSET_WORDS -#undef _GLIBCXX_BITSET_BITS_PER_WORD -#undef _GLIBCXX_BITSET_BITS_PER_ULL - -#if __cplusplus >= 201103L - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // DR 1182. - /// std::hash specialization for bitset. - template - struct hash<_GLIBCXX_STD_C::bitset<_Nb>> - : public __hash_base> - { - size_t - operator()(const _GLIBCXX_STD_C::bitset<_Nb>& __b) const noexcept - { - const size_t __clength = (_Nb + __CHAR_BIT__ - 1) / __CHAR_BIT__; - return std::_Hash_impl::hash(__b._M_getdata(), __clength); - } - }; - - template<> - struct hash<_GLIBCXX_STD_C::bitset<0>> - : public __hash_base> - { - size_t - operator()(const _GLIBCXX_STD_C::bitset<0>&) const noexcept - { return 0; } - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif // C++11 - -#ifdef _GLIBCXX_DEBUG -# include -#endif - -#ifdef _GLIBCXX_PROFILE -# include -#endif - -#endif /* _GLIBCXX_BITSET */ diff --git a/openflow/usr/include/c++/5/cassert b/openflow/usr/include/c++/5/cassert deleted file mode 100644 index e555a38..0000000 --- a/openflow/usr/include/c++/5/cassert +++ /dev/null @@ -1,43 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file cassert - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c assert.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 19.2 Assertions -// - -// No include guards on this header... - -#pragma GCC system_header - -#include diff --git a/openflow/usr/include/c++/5/ccomplex b/openflow/usr/include/c++/5/ccomplex deleted file mode 100644 index bb164df..0000000 --- a/openflow/usr/include/c++/5/ccomplex +++ /dev/null @@ -1,40 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/ccomplex - * This is a Standard C++ Library header. - */ - -#pragma GCC system_header - -#ifndef _GLIBCXX_CCOMPLEX -#define _GLIBCXX_CCOMPLEX 1 - -#if __cplusplus < 201103L -# include -#endif - -#include - -#endif diff --git a/openflow/usr/include/c++/5/cctype b/openflow/usr/include/c++/5/cctype deleted file mode 100644 index f7a1e5f..0000000 --- a/openflow/usr/include/c++/5/cctype +++ /dev/null @@ -1,94 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/cctype - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c ctype.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: -// - -#pragma GCC system_header - -#include -#include - -#ifndef _GLIBCXX_CCTYPE -#define _GLIBCXX_CCTYPE 1 - -// Get rid of those macros defined in in lieu of real functions. -#undef isalnum -#undef isalpha -#undef iscntrl -#undef isdigit -#undef isgraph -#undef islower -#undef isprint -#undef ispunct -#undef isspace -#undef isupper -#undef isxdigit -#undef tolower -#undef toupper - -namespace std -{ - using ::isalnum; - using ::isalpha; - using ::iscntrl; - using ::isdigit; - using ::isgraph; - using ::islower; - using ::isprint; - using ::ispunct; - using ::isspace; - using ::isupper; - using ::isxdigit; - using ::tolower; - using ::toupper; -} // namespace std - -#if __cplusplus >= 201103L - -#ifdef _GLIBCXX_USE_C99_CTYPE_TR1 - -#undef isblank - -namespace std -{ - using ::isblank; -} // namespace std - -#endif // _GLIBCXX_USE_C99_CTYPE_TR1 - -#endif // C++11 - -#endif diff --git a/openflow/usr/include/c++/5/cerrno b/openflow/usr/include/c++/5/cerrno deleted file mode 100644 index 7060b1e..0000000 --- a/openflow/usr/include/c++/5/cerrno +++ /dev/null @@ -1,51 +0,0 @@ -// The -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file cerrno - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c errno.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 19.3 Error numbers -// - -#pragma GCC system_header - -#include - -#ifndef _GLIBCXX_CERRNO -#define _GLIBCXX_CERRNO 1 - -// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 -#ifndef errno -#define errno errno -#endif - -#endif diff --git a/openflow/usr/include/c++/5/cfenv b/openflow/usr/include/c++/5/cfenv deleted file mode 100644 index 5b62131..0000000 --- a/openflow/usr/include/c++/5/cfenv +++ /dev/null @@ -1,84 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/cfenv - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_CFENV -#define _GLIBCXX_CFENV 1 - -#pragma GCC system_header - -#if __cplusplus < 201103L -# include -#else - -#include - -#if _GLIBCXX_HAVE_FENV_H -# include -#endif - -#ifdef _GLIBCXX_USE_C99_FENV_TR1 - -#undef feclearexcept -#undef fegetexceptflag -#undef feraiseexcept -#undef fesetexceptflag -#undef fetestexcept -#undef fegetround -#undef fesetround -#undef fegetenv -#undef feholdexcept -#undef fesetenv -#undef feupdateenv - -namespace std -{ - // types - using ::fenv_t; - using ::fexcept_t; - - // functions - using ::feclearexcept; - using ::fegetexceptflag; - using ::feraiseexcept; - using ::fesetexceptflag; - using ::fetestexcept; - - using ::fegetround; - using ::fesetround; - - using ::fegetenv; - using ::feholdexcept; - using ::fesetenv; - using ::feupdateenv; -} // namespace std - -#endif // _GLIBCXX_USE_C99_FENV_TR1 - -#endif // C++11 - -#endif // _GLIBCXX_CFENV diff --git a/openflow/usr/include/c++/5/cfloat b/openflow/usr/include/c++/5/cfloat deleted file mode 100644 index 2c4ae28..0000000 --- a/openflow/usr/include/c++/5/cfloat +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/cfloat - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c float.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 18.2.2 Implementation properties: C library -// - -#pragma GCC system_header - -#include - -#ifndef _GLIBCXX_CFLOAT -#define _GLIBCXX_CFLOAT 1 - -#if __cplusplus >= 201103L -# ifndef DECIMAL_DIG -# define DECIMAL_DIG __DECIMAL_DIG__ -# endif -# ifndef FLT_EVAL_METHOD -# define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ -# endif -#endif - -#endif diff --git a/openflow/usr/include/c++/5/chrono b/openflow/usr/include/c++/5/chrono deleted file mode 100644 index 50a2bbf..0000000 --- a/openflow/usr/include/c++/5/chrono +++ /dev/null @@ -1,887 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2008-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/chrono - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_CHRONO -#define _GLIBCXX_CHRONO 1 - -#pragma GCC system_header - -#if __cplusplus < 201103L -# include -#else - -#include -#include -#include -#include -#include // for literals support. - -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - -namespace std _GLIBCXX_VISIBILITY(default) -{ - /** - * @defgroup chrono Time - * @ingroup utilities - * - * Classes and functions for time. - * @{ - */ - - /** @namespace std::chrono - * @brief ISO C++ 2011 entities sub-namespace for time and date. - */ - namespace chrono - { - _GLIBCXX_BEGIN_NAMESPACE_VERSION - - template> - struct duration; - - template - struct time_point; - - _GLIBCXX_END_NAMESPACE_VERSION - } - -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // 20.11.4.3 specialization of common_type (for duration, sfinae-friendly) - - template - struct __duration_common_type_wrapper - { - private: - typedef __static_gcd<_Period1::num, _Period2::num> __gcd_num; - typedef __static_gcd<_Period1::den, _Period2::den> __gcd_den; - typedef typename _CT::type __cr; - typedef ratio<__gcd_num::value, - (_Period1::den / __gcd_den::value) * _Period2::den> __r; - public: - typedef __success_type> type; - }; - - template - struct __duration_common_type_wrapper<__failure_type, _Period1, _Period2> - { typedef __failure_type type; }; - - template - struct common_type, - chrono::duration<_Rep2, _Period2>> - : public __duration_common_type_wrapper>::type, _Period1, _Period2>::type - { }; - - // 20.11.4.3 specialization of common_type (for time_point, sfinae-friendly) - - template - struct __timepoint_common_type_wrapper - { - typedef __success_type> - type; - }; - - template - struct __timepoint_common_type_wrapper<__failure_type, _Clock> - { typedef __failure_type type; }; - - template - struct common_type, - chrono::time_point<_Clock, _Duration2>> - : public __timepoint_common_type_wrapper>::type, _Clock>::type - { }; - -_GLIBCXX_END_NAMESPACE_VERSION - - namespace chrono - { - _GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Primary template for duration_cast impl. - template - struct __duration_cast_impl - { - template - static constexpr _ToDur - __cast(const duration<_Rep, _Period>& __d) - { - typedef typename _ToDur::rep __to_rep; - return _ToDur(static_cast<__to_rep>(static_cast<_CR>(__d.count()) - * static_cast<_CR>(_CF::num) - / static_cast<_CR>(_CF::den))); - } - }; - - template - struct __duration_cast_impl<_ToDur, _CF, _CR, true, true> - { - template - static constexpr _ToDur - __cast(const duration<_Rep, _Period>& __d) - { - typedef typename _ToDur::rep __to_rep; - return _ToDur(static_cast<__to_rep>(__d.count())); - } - }; - - template - struct __duration_cast_impl<_ToDur, _CF, _CR, true, false> - { - template - static constexpr _ToDur - __cast(const duration<_Rep, _Period>& __d) - { - typedef typename _ToDur::rep __to_rep; - return _ToDur(static_cast<__to_rep>( - static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den))); - } - }; - - template - struct __duration_cast_impl<_ToDur, _CF, _CR, false, true> - { - template - static constexpr _ToDur - __cast(const duration<_Rep, _Period>& __d) - { - typedef typename _ToDur::rep __to_rep; - return _ToDur(static_cast<__to_rep>( - static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num))); - } - }; - - template - struct __is_duration - : std::false_type - { }; - - template - struct __is_duration> - : std::true_type - { }; - - /// duration_cast - template - constexpr typename enable_if<__is_duration<_ToDur>::value, - _ToDur>::type - duration_cast(const duration<_Rep, _Period>& __d) - { - typedef typename _ToDur::period __to_period; - typedef typename _ToDur::rep __to_rep; - typedef ratio_divide<_Period, __to_period> __cf; - typedef typename common_type<__to_rep, _Rep, intmax_t>::type - __cr; - typedef __duration_cast_impl<_ToDur, __cf, __cr, - __cf::num == 1, __cf::den == 1> __dc; - return __dc::__cast(__d); - } - - /// treat_as_floating_point - template - struct treat_as_floating_point - : is_floating_point<_Rep> - { }; - - /// duration_values - template - struct duration_values - { - static constexpr _Rep - zero() - { return _Rep(0); } - - static constexpr _Rep - max() - { return numeric_limits<_Rep>::max(); } - - static constexpr _Rep - min() - { return numeric_limits<_Rep>::lowest(); } - }; - - template - struct __is_ratio - : std::false_type - { }; - - template - struct __is_ratio> - : std::true_type - { }; - - /// duration - template - struct duration - { - typedef _Rep rep; - typedef _Period period; - - static_assert(!__is_duration<_Rep>::value, "rep cannot be a duration"); - static_assert(__is_ratio<_Period>::value, - "period must be a specialization of ratio"); - static_assert(_Period::num > 0, "period must be positive"); - - // 20.11.5.1 construction / copy / destroy - constexpr duration() = default; - - // NB: Make constexpr implicit. This cannot be explicitly - // constexpr, as any UDT that is not a literal type with a - // constexpr copy constructor will be ill-formed. - duration(const duration&) = default; - - template::value - && (treat_as_floating_point::value - || !treat_as_floating_point<_Rep2>::value)>::type> - constexpr explicit duration(const _Rep2& __rep) - : __r(static_cast(__rep)) { } - - template::value - || (ratio_divide<_Period2, period>::den == 1 - && !treat_as_floating_point<_Rep2>::value)>::type> - constexpr duration(const duration<_Rep2, _Period2>& __d) - : __r(duration_cast(__d).count()) { } - - ~duration() = default; - duration& operator=(const duration&) = default; - - // 20.11.5.2 observer - constexpr rep - count() const - { return __r; } - - // 20.11.5.3 arithmetic - constexpr duration - operator+() const - { return *this; } - - constexpr duration - operator-() const - { return duration(-__r); } - - duration& - operator++() - { - ++__r; - return *this; - } - - duration - operator++(int) - { return duration(__r++); } - - duration& - operator--() - { - --__r; - return *this; - } - - duration - operator--(int) - { return duration(__r--); } - - duration& - operator+=(const duration& __d) - { - __r += __d.count(); - return *this; - } - - duration& - operator-=(const duration& __d) - { - __r -= __d.count(); - return *this; - } - - duration& - operator*=(const rep& __rhs) - { - __r *= __rhs; - return *this; - } - - duration& - operator/=(const rep& __rhs) - { - __r /= __rhs; - return *this; - } - - // DR 934. - template - typename enable_if::value, - duration&>::type - operator%=(const rep& __rhs) - { - __r %= __rhs; - return *this; - } - - template - typename enable_if::value, - duration&>::type - operator%=(const duration& __d) - { - __r %= __d.count(); - return *this; - } - - // 20.11.5.4 special values - static constexpr duration - zero() - { return duration(duration_values::zero()); } - - static constexpr duration - min() - { return duration(duration_values::min()); } - - static constexpr duration - max() - { return duration(duration_values::max()); } - - private: - rep __r; - }; - - template - constexpr typename common_type, - duration<_Rep2, _Period2>>::type - operator+(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) - { - typedef duration<_Rep1, _Period1> __dur1; - typedef duration<_Rep2, _Period2> __dur2; - typedef typename common_type<__dur1,__dur2>::type __cd; - return __cd(__cd(__lhs).count() + __cd(__rhs).count()); - } - - template - constexpr typename common_type, - duration<_Rep2, _Period2>>::type - operator-(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) - { - typedef duration<_Rep1, _Period1> __dur1; - typedef duration<_Rep2, _Period2> __dur2; - typedef typename common_type<__dur1,__dur2>::type __cd; - return __cd(__cd(__lhs).count() - __cd(__rhs).count()); - } - - template::type>::value> - struct __common_rep_type { }; - - template - struct __common_rep_type<_Rep1, _Rep2, true> - { typedef typename common_type<_Rep1, _Rep2>::type type; }; - - template - constexpr - duration::type, _Period> - operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) - { - typedef duration::type, _Period> - __cd; - return __cd(__cd(__d).count() * __s); - } - - template - constexpr - duration::type, _Period> - operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) - { return __d * __s; } - - template - constexpr duration::value, _Rep2>::type>::type, _Period> - operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) - { - typedef duration::type, _Period> - __cd; - return __cd(__cd(__d).count() / __s); - } - - template - constexpr typename common_type<_Rep1, _Rep2>::type - operator/(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) - { - typedef duration<_Rep1, _Period1> __dur1; - typedef duration<_Rep2, _Period2> __dur2; - typedef typename common_type<__dur1,__dur2>::type __cd; - return __cd(__lhs).count() / __cd(__rhs).count(); - } - - // DR 934. - template - constexpr duration::value, _Rep2>::type>::type, _Period> - operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) - { - typedef duration::type, _Period> - __cd; - return __cd(__cd(__d).count() % __s); - } - - template - constexpr typename common_type, - duration<_Rep2, _Period2>>::type - operator%(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) - { - typedef duration<_Rep1, _Period1> __dur1; - typedef duration<_Rep2, _Period2> __dur2; - typedef typename common_type<__dur1,__dur2>::type __cd; - return __cd(__cd(__lhs).count() % __cd(__rhs).count()); - } - - // comparisons - template - constexpr bool - operator==(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) - { - typedef duration<_Rep1, _Period1> __dur1; - typedef duration<_Rep2, _Period2> __dur2; - typedef typename common_type<__dur1,__dur2>::type __ct; - return __ct(__lhs).count() == __ct(__rhs).count(); - } - - template - constexpr bool - operator<(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) - { - typedef duration<_Rep1, _Period1> __dur1; - typedef duration<_Rep2, _Period2> __dur2; - typedef typename common_type<__dur1,__dur2>::type __ct; - return __ct(__lhs).count() < __ct(__rhs).count(); - } - - template - constexpr bool - operator!=(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) - { return !(__lhs == __rhs); } - - template - constexpr bool - operator<=(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) - { return !(__rhs < __lhs); } - - template - constexpr bool - operator>(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) - { return __rhs < __lhs; } - - template - constexpr bool - operator>=(const duration<_Rep1, _Period1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) - { return !(__lhs < __rhs); } - - /// nanoseconds - typedef duration nanoseconds; - - /// microseconds - typedef duration microseconds; - - /// milliseconds - typedef duration milliseconds; - - /// seconds - typedef duration seconds; - - /// minutes - typedef duration> minutes; - - /// hours - typedef duration> hours; - - /// time_point - template - struct time_point - { - typedef _Clock clock; - typedef _Dur duration; - typedef typename duration::rep rep; - typedef typename duration::period period; - - constexpr time_point() : __d(duration::zero()) - { } - - constexpr explicit time_point(const duration& __dur) - : __d(__dur) - { } - - // conversions - template - constexpr time_point(const time_point& __t) - : __d(__t.time_since_epoch()) - { } - - // observer - constexpr duration - time_since_epoch() const - { return __d; } - - // arithmetic - time_point& - operator+=(const duration& __dur) - { - __d += __dur; - return *this; - } - - time_point& - operator-=(const duration& __dur) - { - __d -= __dur; - return *this; - } - - // special values - static constexpr time_point - min() - { return time_point(duration::min()); } - - static constexpr time_point - max() - { return time_point(duration::max()); } - - private: - duration __d; - }; - - /// time_point_cast - template - constexpr typename enable_if<__is_duration<_ToDur>::value, - time_point<_Clock, _ToDur>>::type - time_point_cast(const time_point<_Clock, _Dur>& __t) - { - typedef time_point<_Clock, _ToDur> __time_point; - return __time_point(duration_cast<_ToDur>(__t.time_since_epoch())); - } - - template - constexpr time_point<_Clock, - typename common_type<_Dur1, duration<_Rep2, _Period2>>::type> - operator+(const time_point<_Clock, _Dur1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) - { - typedef duration<_Rep2, _Period2> __dur2; - typedef typename common_type<_Dur1,__dur2>::type __ct; - typedef time_point<_Clock, __ct> __time_point; - return __time_point(__lhs.time_since_epoch() + __rhs); - } - - template - constexpr time_point<_Clock, - typename common_type, _Dur2>::type> - operator+(const duration<_Rep1, _Period1>& __lhs, - const time_point<_Clock, _Dur2>& __rhs) - { - typedef duration<_Rep1, _Period1> __dur1; - typedef typename common_type<__dur1,_Dur2>::type __ct; - typedef time_point<_Clock, __ct> __time_point; - return __time_point(__rhs.time_since_epoch() + __lhs); - } - - template - constexpr time_point<_Clock, - typename common_type<_Dur1, duration<_Rep2, _Period2>>::type> - operator-(const time_point<_Clock, _Dur1>& __lhs, - const duration<_Rep2, _Period2>& __rhs) - { - typedef duration<_Rep2, _Period2> __dur2; - typedef typename common_type<_Dur1,__dur2>::type __ct; - typedef time_point<_Clock, __ct> __time_point; - return __time_point(__lhs.time_since_epoch() -__rhs); - } - - template - constexpr typename common_type<_Dur1, _Dur2>::type - operator-(const time_point<_Clock, _Dur1>& __lhs, - const time_point<_Clock, _Dur2>& __rhs) - { return __lhs.time_since_epoch() - __rhs.time_since_epoch(); } - - template - constexpr bool - operator==(const time_point<_Clock, _Dur1>& __lhs, - const time_point<_Clock, _Dur2>& __rhs) - { return __lhs.time_since_epoch() == __rhs.time_since_epoch(); } - - template - constexpr bool - operator!=(const time_point<_Clock, _Dur1>& __lhs, - const time_point<_Clock, _Dur2>& __rhs) - { return !(__lhs == __rhs); } - - template - constexpr bool - operator<(const time_point<_Clock, _Dur1>& __lhs, - const time_point<_Clock, _Dur2>& __rhs) - { return __lhs.time_since_epoch() < __rhs.time_since_epoch(); } - - template - constexpr bool - operator<=(const time_point<_Clock, _Dur1>& __lhs, - const time_point<_Clock, _Dur2>& __rhs) - { return !(__rhs < __lhs); } - - template - constexpr bool - operator>(const time_point<_Clock, _Dur1>& __lhs, - const time_point<_Clock, _Dur2>& __rhs) - { return __rhs < __lhs; } - - template - constexpr bool - operator>=(const time_point<_Clock, _Dur1>& __lhs, - const time_point<_Clock, _Dur2>& __rhs) - { return !(__lhs < __rhs); } - - - // Clocks. - - // Why nanosecond resolution as the default? - // Why have std::system_clock always count in the higest - // resolution (ie nanoseconds), even if on some OSes the low 3 - // or 9 decimal digits will be always zero? This allows later - // implementations to change the system_clock::now() - // implementation any time to provide better resolution without - // changing function signature or units. - - // To support the (forward) evolution of the library's defined - // clocks, wrap inside inline namespace so that the current - // defintions of system_clock, steady_clock, and - // high_resolution_clock types are uniquely mangled. This way, new - // code can use the latests clocks, while the library can contain - // compatibility definitions for previous versions. At some - // point, when these clocks settle down, the inlined namespaces - // can be removed. XXX GLIBCXX_ABI Deprecated - inline namespace _V2 { - - /** - * @brief System clock. - * - * Time returned represents wall time from the system-wide clock. - */ - struct system_clock - { - typedef chrono::nanoseconds duration; - typedef duration::rep rep; - typedef duration::period period; - typedef chrono::time_point time_point; - - static_assert(system_clock::duration::min() - < system_clock::duration::zero(), - "a clock's minimum duration cannot be less than its epoch"); - - static constexpr bool is_steady = false; - - static time_point - now() noexcept; - - // Map to C API - static std::time_t - to_time_t(const time_point& __t) noexcept - { - return std::time_t(duration_cast - (__t.time_since_epoch()).count()); - } - - static time_point - from_time_t(std::time_t __t) noexcept - { - typedef chrono::time_point __from; - return time_point_cast - (__from(chrono::seconds(__t))); - } - }; - - - /** - * @brief Monotonic clock - * - * Time returned has the property of only increasing at a uniform rate. - */ - struct steady_clock - { - typedef chrono::nanoseconds duration; - typedef duration::rep rep; - typedef duration::period period; - typedef chrono::time_point time_point; - - static constexpr bool is_steady = true; - - static time_point - now() noexcept; - }; - - - /** - * @brief Highest-resolution clock - * - * This is the clock "with the shortest tick period." Alias to - * std::system_clock until higher-than-nanosecond definitions - * become feasible. - */ - using high_resolution_clock = system_clock; - - } // end inline namespace _V2 - - _GLIBCXX_END_NAMESPACE_VERSION - } // namespace chrono - -#if __cplusplus > 201103L - -#define __cpp_lib_chrono_udls 201304 - - inline namespace literals - { - inline namespace chrono_literals - { - - template - struct _Checked_integral_constant - : integral_constant<_Rep, static_cast<_Rep>(_Val)> - { - static_assert(_Checked_integral_constant::value >= 0 - && _Checked_integral_constant::value == _Val, - "literal value cannot be represented by duration type"); - }; - - template - constexpr _Dur __check_overflow() - { - using _Val = __parse_int::_Parse_int<_Digits...>; - using _Rep = typename _Dur::rep; - // TODO: should be simply integral_constant<_Rep, _Val::value> - // but GCC doesn't reject narrowing conversions to _Rep. - using _CheckedVal = _Checked_integral_constant<_Rep, _Val::value>; - return _Dur{_CheckedVal::value}; - } - - constexpr chrono::duration> - operator""h(long double __hours) - { return chrono::duration>{__hours}; } - - template - constexpr chrono::hours - operator""h() - { return __check_overflow(); } - - constexpr chrono::duration> - operator""min(long double __mins) - { return chrono::duration>{__mins}; } - - template - constexpr chrono::minutes - operator""min() - { return __check_overflow(); } - - constexpr chrono::duration - operator""s(long double __secs) - { return chrono::duration{__secs}; } - - template - constexpr chrono::seconds - operator""s() - { return __check_overflow(); } - - constexpr chrono::duration - operator""ms(long double __msecs) - { return chrono::duration{__msecs}; } - - template - constexpr chrono::milliseconds - operator""ms() - { return __check_overflow(); } - - constexpr chrono::duration - operator""us(long double __usecs) - { return chrono::duration{__usecs}; } - - template - constexpr chrono::microseconds - operator""us() - { return __check_overflow(); } - - constexpr chrono::duration - operator""ns(long double __nsecs) - { return chrono::duration{__nsecs}; } - - template - constexpr chrono::nanoseconds - operator""ns() - { return __check_overflow(); } - - } // inline namespace chrono_literals - } // inline namespace literals - - namespace chrono - { - _GLIBCXX_BEGIN_NAMESPACE_VERSION - - using namespace literals::chrono_literals; - - _GLIBCXX_END_NAMESPACE_VERSION - } // namespace chrono - -#endif // __cplusplus > 201103L - - // @} group chrono -} // namespace std - -#endif //_GLIBCXX_USE_C99_STDINT_TR1 - -#endif // C++11 - -#endif //_GLIBCXX_CHRONO diff --git a/openflow/usr/include/c++/5/cinttypes b/openflow/usr/include/c++/5/cinttypes deleted file mode 100644 index 5a72a5c..0000000 --- a/openflow/usr/include/c++/5/cinttypes +++ /dev/null @@ -1,81 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/cinttypes - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_CINTTYPES -#define _GLIBCXX_CINTTYPES 1 - -#pragma GCC system_header - -#if __cplusplus < 201103L -# include -#else - -#include - -// For 27.9.2/3 (see C99, Note 184) -#if _GLIBCXX_HAVE_INTTYPES_H -# ifndef __STDC_FORMAT_MACROS -# define _UNDEF__STDC_FORMAT_MACROS -# define __STDC_FORMAT_MACROS -# endif -# include -# ifdef _UNDEF__STDC_FORMAT_MACROS -# undef __STDC_FORMAT_MACROS -# undef _UNDEF__STDC_FORMAT_MACROS -# endif -#endif - -#ifdef _GLIBCXX_USE_C99_INTTYPES_TR1 - -namespace std -{ - // types - using ::imaxdiv_t; - - // functions - using ::imaxabs; - using ::imaxdiv; - - // GCC does not support extended integer types - // intmax_t abs(intmax_t) - // imaxdiv_t div(intmax_t, intmax_t) - - using ::strtoimax; - using ::strtoumax; - -#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 - using ::wcstoimax; - using ::wcstoumax; -#endif -} // namespace std - -#endif // _GLIBCXX_USE_C99_INTTYPES_TR1 - -#endif // C++11 - -#endif // _GLIBCXX_CINTTYPES diff --git a/openflow/usr/include/c++/5/ciso646 b/openflow/usr/include/c++/5/ciso646 deleted file mode 100644 index 818db67..0000000 --- a/openflow/usr/include/c++/5/ciso646 +++ /dev/null @@ -1,33 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ciso646 - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c iso646.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ diff --git a/openflow/usr/include/c++/5/climits b/openflow/usr/include/c++/5/climits deleted file mode 100644 index e3da66c..0000000 --- a/openflow/usr/include/c++/5/climits +++ /dev/null @@ -1,58 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/climits - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c limits.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 18.2.2 Implementation properties: C library -// - -#pragma GCC system_header - -#include - -#ifndef _GLIBCXX_CLIMITS -#define _GLIBCXX_CLIMITS 1 - -#ifndef LLONG_MIN -#define LLONG_MIN (-__LONG_LONG_MAX__ - 1) -#endif - -#ifndef LLONG_MAX -#define LLONG_MAX __LONG_LONG_MAX__ -#endif - -#ifndef ULLONG_MAX -#define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1) -#endif - -#endif diff --git a/openflow/usr/include/c++/5/clocale b/openflow/usr/include/c++/5/clocale deleted file mode 100644 index 95d17d2..0000000 --- a/openflow/usr/include/c++/5/clocale +++ /dev/null @@ -1,58 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file clocale - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c locale.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 18.2.2 Implementation properties: C library -// - -#pragma GCC system_header - -#include -#include - -#ifndef _GLIBCXX_CLOCALE -#define _GLIBCXX_CLOCALE 1 - -// Get rid of those macros defined in in lieu of real functions. -#undef setlocale -#undef localeconv - -namespace std -{ - using ::lconv; - using ::setlocale; - using ::localeconv; -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/cmath b/openflow/usr/include/c++/5/cmath deleted file mode 100644 index d3fc8b7..0000000 --- a/openflow/usr/include/c++/5/cmath +++ /dev/null @@ -1,1783 +0,0 @@ -// -*- C++ -*- C forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/cmath - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c math.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 26.5 C library -// - -#pragma GCC system_header - -#include -#include -#include -#include - -#ifndef _GLIBCXX_CMATH -#define _GLIBCXX_CMATH 1 - -// Get rid of those macros defined in in lieu of real functions. -#undef abs -#undef div -#undef acos -#undef asin -#undef atan -#undef atan2 -#undef ceil -#undef cos -#undef cosh -#undef exp -#undef fabs -#undef floor -#undef fmod -#undef frexp -#undef ldexp -#undef log -#undef log10 -#undef modf -#undef pow -#undef sin -#undef sinh -#undef sqrt -#undef tan -#undef tanh - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR double - abs(double __x) - { return __builtin_fabs(__x); } -#endif - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - abs(float __x) - { return __builtin_fabsf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - abs(long double __x) - { return __builtin_fabsl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - abs(_Tp __x) - { return __builtin_fabs(__x); } - - using ::acos; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - acos(float __x) - { return __builtin_acosf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - acos(long double __x) - { return __builtin_acosl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - acos(_Tp __x) - { return __builtin_acos(__x); } - - using ::asin; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - asin(float __x) - { return __builtin_asinf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - asin(long double __x) - { return __builtin_asinl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - asin(_Tp __x) - { return __builtin_asin(__x); } - - using ::atan; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - atan(float __x) - { return __builtin_atanf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - atan(long double __x) - { return __builtin_atanl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - atan(_Tp __x) - { return __builtin_atan(__x); } - - using ::atan2; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - atan2(float __y, float __x) - { return __builtin_atan2f(__y, __x); } - - inline _GLIBCXX_CONSTEXPR long double - atan2(long double __y, long double __x) - { return __builtin_atan2l(__y, __x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__promote_2<_Tp, _Up>::__type - atan2(_Tp __y, _Up __x) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return atan2(__type(__y), __type(__x)); - } - - using ::ceil; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - ceil(float __x) - { return __builtin_ceilf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - ceil(long double __x) - { return __builtin_ceill(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - ceil(_Tp __x) - { return __builtin_ceil(__x); } - - using ::cos; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - cos(float __x) - { return __builtin_cosf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - cos(long double __x) - { return __builtin_cosl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - cos(_Tp __x) - { return __builtin_cos(__x); } - - using ::cosh; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - cosh(float __x) - { return __builtin_coshf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - cosh(long double __x) - { return __builtin_coshl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - cosh(_Tp __x) - { return __builtin_cosh(__x); } - - using ::exp; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - exp(float __x) - { return __builtin_expf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - exp(long double __x) - { return __builtin_expl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - exp(_Tp __x) - { return __builtin_exp(__x); } - - using ::fabs; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - fabs(float __x) - { return __builtin_fabsf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - fabs(long double __x) - { return __builtin_fabsl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - fabs(_Tp __x) - { return __builtin_fabs(__x); } - - using ::floor; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - floor(float __x) - { return __builtin_floorf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - floor(long double __x) - { return __builtin_floorl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - floor(_Tp __x) - { return __builtin_floor(__x); } - - using ::fmod; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - fmod(float __x, float __y) - { return __builtin_fmodf(__x, __y); } - - inline _GLIBCXX_CONSTEXPR long double - fmod(long double __x, long double __y) - { return __builtin_fmodl(__x, __y); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__promote_2<_Tp, _Up>::__type - fmod(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return fmod(__type(__x), __type(__y)); - } - - using ::frexp; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline float - frexp(float __x, int* __exp) - { return __builtin_frexpf(__x, __exp); } - - inline long double - frexp(long double __x, int* __exp) - { return __builtin_frexpl(__x, __exp); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - frexp(_Tp __x, int* __exp) - { return __builtin_frexp(__x, __exp); } - - using ::ldexp; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - ldexp(float __x, int __exp) - { return __builtin_ldexpf(__x, __exp); } - - inline _GLIBCXX_CONSTEXPR long double - ldexp(long double __x, int __exp) - { return __builtin_ldexpl(__x, __exp); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - ldexp(_Tp __x, int __exp) - { return __builtin_ldexp(__x, __exp); } - - using ::log; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - log(float __x) - { return __builtin_logf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - log(long double __x) - { return __builtin_logl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - log(_Tp __x) - { return __builtin_log(__x); } - - using ::log10; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - log10(float __x) - { return __builtin_log10f(__x); } - - inline _GLIBCXX_CONSTEXPR long double - log10(long double __x) - { return __builtin_log10l(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - log10(_Tp __x) - { return __builtin_log10(__x); } - - using ::modf; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline float - modf(float __x, float* __iptr) - { return __builtin_modff(__x, __iptr); } - - inline long double - modf(long double __x, long double* __iptr) - { return __builtin_modfl(__x, __iptr); } -#endif - - using ::pow; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - pow(float __x, float __y) - { return __builtin_powf(__x, __y); } - - inline _GLIBCXX_CONSTEXPR long double - pow(long double __x, long double __y) - { return __builtin_powl(__x, __y); } - -#if __cplusplus < 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 550. What should the return type of pow(float,int) be? - inline double - pow(double __x, int __i) - { return __builtin_powi(__x, __i); } - - inline float - pow(float __x, int __n) - { return __builtin_powif(__x, __n); } - - inline long double - pow(long double __x, int __n) - { return __builtin_powil(__x, __n); } -#endif -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__promote_2<_Tp, _Up>::__type - pow(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return pow(__type(__x), __type(__y)); - } - - using ::sin; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - sin(float __x) - { return __builtin_sinf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - sin(long double __x) - { return __builtin_sinl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - sin(_Tp __x) - { return __builtin_sin(__x); } - - using ::sinh; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - sinh(float __x) - { return __builtin_sinhf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - sinh(long double __x) - { return __builtin_sinhl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - sinh(_Tp __x) - { return __builtin_sinh(__x); } - - using ::sqrt; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - sqrt(float __x) - { return __builtin_sqrtf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - sqrt(long double __x) - { return __builtin_sqrtl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - sqrt(_Tp __x) - { return __builtin_sqrt(__x); } - - using ::tan; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - tan(float __x) - { return __builtin_tanf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - tan(long double __x) - { return __builtin_tanl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - tan(_Tp __x) - { return __builtin_tan(__x); } - - using ::tanh; - -#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO - inline _GLIBCXX_CONSTEXPR float - tanh(float __x) - { return __builtin_tanhf(__x); } - - inline _GLIBCXX_CONSTEXPR long double - tanh(long double __x) - { return __builtin_tanhl(__x); } -#endif - - template - inline _GLIBCXX_CONSTEXPR - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - tanh(_Tp __x) - { return __builtin_tanh(__x); } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#if _GLIBCXX_USE_C99_MATH -#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC - -// These are possible macros imported from C99-land. -#undef fpclassify -#undef isfinite -#undef isinf -#undef isnan -#undef isnormal -#undef signbit -#undef isgreater -#undef isgreaterequal -#undef isless -#undef islessequal -#undef islessgreater -#undef isunordered - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#if __cplusplus >= 201103L - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr int - fpclassify(float __x) - { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, - FP_SUBNORMAL, FP_ZERO, __x); } - - constexpr int - fpclassify(double __x) - { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, - FP_SUBNORMAL, FP_ZERO, __x); } - - constexpr int - fpclassify(long double __x) - { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, - FP_SUBNORMAL, FP_ZERO, __x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - int>::__type - fpclassify(_Tp __x) - { return __x != 0 ? FP_NORMAL : FP_ZERO; } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr bool - isfinite(float __x) - { return __builtin_isfinite(__x); } - - constexpr bool - isfinite(double __x) - { return __builtin_isfinite(__x); } - - constexpr bool - isfinite(long double __x) - { return __builtin_isfinite(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - bool>::__type - isfinite(_Tp __x) - { return true; } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr bool - isinf(float __x) - { return __builtin_isinf(__x); } - - constexpr bool - isinf(double __x) - { return __builtin_isinf(__x); } - - constexpr bool - isinf(long double __x) - { return __builtin_isinf(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - bool>::__type - isinf(_Tp __x) - { return false; } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr bool - isnan(float __x) - { return __builtin_isnan(__x); } - - constexpr bool - isnan(double __x) - { return __builtin_isnan(__x); } - - constexpr bool - isnan(long double __x) - { return __builtin_isnan(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - bool>::__type - isnan(_Tp __x) - { return false; } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr bool - isnormal(float __x) - { return __builtin_isnormal(__x); } - - constexpr bool - isnormal(double __x) - { return __builtin_isnormal(__x); } - - constexpr bool - isnormal(long double __x) - { return __builtin_isnormal(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - bool>::__type - isnormal(_Tp __x) - { return __x != 0 ? true : false; } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - // The front-end doesn't provide a type generic builtin (libstdc++/58625). - constexpr bool - signbit(float __x) - { return __builtin_signbitf(__x); } - - constexpr bool - signbit(double __x) - { return __builtin_signbit(__x); } - - constexpr bool - signbit(long double __x) - { return __builtin_signbitl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - bool>::__type - signbit(_Tp __x) - { return __x < 0 ? true : false; } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr bool - isgreater(float __x, float __y) - { return __builtin_isgreater(__x, __y); } - - constexpr bool - isgreater(double __x, double __y) - { return __builtin_isgreater(__x, __y); } - - constexpr bool - isgreater(long double __x, long double __y) - { return __builtin_isgreater(__x, __y); } -#endif - - template - constexpr typename - __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value - && __is_arithmetic<_Up>::__value), bool>::__type - isgreater(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return __builtin_isgreater(__type(__x), __type(__y)); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr bool - isgreaterequal(float __x, float __y) - { return __builtin_isgreaterequal(__x, __y); } - - constexpr bool - isgreaterequal(double __x, double __y) - { return __builtin_isgreaterequal(__x, __y); } - - constexpr bool - isgreaterequal(long double __x, long double __y) - { return __builtin_isgreaterequal(__x, __y); } -#endif - - template - constexpr typename - __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value - && __is_arithmetic<_Up>::__value), bool>::__type - isgreaterequal(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return __builtin_isgreaterequal(__type(__x), __type(__y)); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr bool - isless(float __x, float __y) - { return __builtin_isless(__x, __y); } - - constexpr bool - isless(double __x, double __y) - { return __builtin_isless(__x, __y); } - - constexpr bool - isless(long double __x, long double __y) - { return __builtin_isless(__x, __y); } -#endif - - template - constexpr typename - __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value - && __is_arithmetic<_Up>::__value), bool>::__type - isless(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return __builtin_isless(__type(__x), __type(__y)); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr bool - islessequal(float __x, float __y) - { return __builtin_islessequal(__x, __y); } - - constexpr bool - islessequal(double __x, double __y) - { return __builtin_islessequal(__x, __y); } - - constexpr bool - islessequal(long double __x, long double __y) - { return __builtin_islessequal(__x, __y); } -#endif - - template - constexpr typename - __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value - && __is_arithmetic<_Up>::__value), bool>::__type - islessequal(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return __builtin_islessequal(__type(__x), __type(__y)); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr bool - islessgreater(float __x, float __y) - { return __builtin_islessgreater(__x, __y); } - - constexpr bool - islessgreater(double __x, double __y) - { return __builtin_islessgreater(__x, __y); } - - constexpr bool - islessgreater(long double __x, long double __y) - { return __builtin_islessgreater(__x, __y); } -#endif - - template - constexpr typename - __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value - && __is_arithmetic<_Up>::__value), bool>::__type - islessgreater(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return __builtin_islessgreater(__type(__x), __type(__y)); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr bool - isunordered(float __x, float __y) - { return __builtin_isunordered(__x, __y); } - - constexpr bool - isunordered(double __x, double __y) - { return __builtin_isunordered(__x, __y); } - - constexpr bool - isunordered(long double __x, long double __y) - { return __builtin_isunordered(__x, __y); } -#endif - - template - constexpr typename - __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value - && __is_arithmetic<_Up>::__value), bool>::__type - isunordered(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return __builtin_isunordered(__type(__x), __type(__y)); - } - -#else - - template - inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, - int>::__type - fpclassify(_Tp __f) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; - return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, - FP_SUBNORMAL, FP_ZERO, __type(__f)); - } - - template - inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, - int>::__type - isfinite(_Tp __f) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; - return __builtin_isfinite(__type(__f)); - } - - template - inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, - int>::__type - isinf(_Tp __f) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; - return __builtin_isinf(__type(__f)); - } - - template - inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, - int>::__type - isnan(_Tp __f) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; - return __builtin_isnan(__type(__f)); - } - - template - inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, - int>::__type - isnormal(_Tp __f) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; - return __builtin_isnormal(__type(__f)); - } - - template - inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, - int>::__type - signbit(_Tp __f) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; - return sizeof(__type) == sizeof(float) - ? __builtin_signbitf(__type(__f)) - : sizeof(__type) == sizeof(double) - ? __builtin_signbit(__type(__f)) - : __builtin_signbitl(__type(__f)); - } - - template - inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, - int>::__type - isgreater(_Tp __f1, _Tp __f2) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; - return __builtin_isgreater(__type(__f1), __type(__f2)); - } - - template - inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, - int>::__type - isgreaterequal(_Tp __f1, _Tp __f2) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; - return __builtin_isgreaterequal(__type(__f1), __type(__f2)); - } - - template - inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, - int>::__type - isless(_Tp __f1, _Tp __f2) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; - return __builtin_isless(__type(__f1), __type(__f2)); - } - - template - inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, - int>::__type - islessequal(_Tp __f1, _Tp __f2) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; - return __builtin_islessequal(__type(__f1), __type(__f2)); - } - - template - inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, - int>::__type - islessgreater(_Tp __f1, _Tp __f2) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; - return __builtin_islessgreater(__type(__f1), __type(__f2)); - } - - template - inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, - int>::__type - isunordered(_Tp __f1, _Tp __f2) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; - return __builtin_isunordered(__type(__f1), __type(__f2)); - } - -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */ -#endif - -#if __cplusplus >= 201103L - -#ifdef _GLIBCXX_USE_C99_MATH_TR1 - -#undef acosh -#undef acoshf -#undef acoshl -#undef asinh -#undef asinhf -#undef asinhl -#undef atanh -#undef atanhf -#undef atanhl -#undef cbrt -#undef cbrtf -#undef cbrtl -#undef copysign -#undef copysignf -#undef copysignl -#undef erf -#undef erff -#undef erfl -#undef erfc -#undef erfcf -#undef erfcl -#undef exp2 -#undef exp2f -#undef exp2l -#undef expm1 -#undef expm1f -#undef expm1l -#undef fdim -#undef fdimf -#undef fdiml -#undef fma -#undef fmaf -#undef fmal -#undef fmax -#undef fmaxf -#undef fmaxl -#undef fmin -#undef fminf -#undef fminl -#undef hypot -#undef hypotf -#undef hypotl -#undef ilogb -#undef ilogbf -#undef ilogbl -#undef lgamma -#undef lgammaf -#undef lgammal -#undef llrint -#undef llrintf -#undef llrintl -#undef llround -#undef llroundf -#undef llroundl -#undef log1p -#undef log1pf -#undef log1pl -#undef log2 -#undef log2f -#undef log2l -#undef logb -#undef logbf -#undef logbl -#undef lrint -#undef lrintf -#undef lrintl -#undef lround -#undef lroundf -#undef lroundl -#undef nan -#undef nanf -#undef nanl -#undef nearbyint -#undef nearbyintf -#undef nearbyintl -#undef nextafter -#undef nextafterf -#undef nextafterl -#undef nexttoward -#undef nexttowardf -#undef nexttowardl -#undef remainder -#undef remainderf -#undef remainderl -#undef remquo -#undef remquof -#undef remquol -#undef rint -#undef rintf -#undef rintl -#undef round -#undef roundf -#undef roundl -#undef scalbln -#undef scalblnf -#undef scalblnl -#undef scalbn -#undef scalbnf -#undef scalbnl -#undef tgamma -#undef tgammaf -#undef tgammal -#undef trunc -#undef truncf -#undef truncl - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // types - using ::double_t; - using ::float_t; - - // functions - using ::acosh; - using ::acoshf; - using ::acoshl; - - using ::asinh; - using ::asinhf; - using ::asinhl; - - using ::atanh; - using ::atanhf; - using ::atanhl; - - using ::cbrt; - using ::cbrtf; - using ::cbrtl; - - using ::copysign; - using ::copysignf; - using ::copysignl; - - using ::erf; - using ::erff; - using ::erfl; - - using ::erfc; - using ::erfcf; - using ::erfcl; - - using ::exp2; - using ::exp2f; - using ::exp2l; - - using ::expm1; - using ::expm1f; - using ::expm1l; - - using ::fdim; - using ::fdimf; - using ::fdiml; - - using ::fma; - using ::fmaf; - using ::fmal; - - using ::fmax; - using ::fmaxf; - using ::fmaxl; - - using ::fmin; - using ::fminf; - using ::fminl; - - using ::hypot; - using ::hypotf; - using ::hypotl; - - using ::ilogb; - using ::ilogbf; - using ::ilogbl; - - using ::lgamma; - using ::lgammaf; - using ::lgammal; - - using ::llrint; - using ::llrintf; - using ::llrintl; - - using ::llround; - using ::llroundf; - using ::llroundl; - - using ::log1p; - using ::log1pf; - using ::log1pl; - - using ::log2; - using ::log2f; - using ::log2l; - - using ::logb; - using ::logbf; - using ::logbl; - - using ::lrint; - using ::lrintf; - using ::lrintl; - - using ::lround; - using ::lroundf; - using ::lroundl; - - using ::nan; - using ::nanf; - using ::nanl; - - using ::nearbyint; - using ::nearbyintf; - using ::nearbyintl; - - using ::nextafter; - using ::nextafterf; - using ::nextafterl; - - using ::nexttoward; - using ::nexttowardf; - using ::nexttowardl; - - using ::remainder; - using ::remainderf; - using ::remainderl; - - using ::remquo; - using ::remquof; - using ::remquol; - - using ::rint; - using ::rintf; - using ::rintl; - - using ::round; - using ::roundf; - using ::roundl; - - using ::scalbln; - using ::scalblnf; - using ::scalblnl; - - using ::scalbn; - using ::scalbnf; - using ::scalbnl; - - using ::tgamma; - using ::tgammaf; - using ::tgammal; - - using ::trunc; - using ::truncf; - using ::truncl; - - /// Additional overloads. -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - acosh(float __x) - { return __builtin_acoshf(__x); } - - constexpr long double - acosh(long double __x) - { return __builtin_acoshl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - acosh(_Tp __x) - { return __builtin_acosh(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - asinh(float __x) - { return __builtin_asinhf(__x); } - - constexpr long double - asinh(long double __x) - { return __builtin_asinhl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - asinh(_Tp __x) - { return __builtin_asinh(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - atanh(float __x) - { return __builtin_atanhf(__x); } - - constexpr long double - atanh(long double __x) - { return __builtin_atanhl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - atanh(_Tp __x) - { return __builtin_atanh(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - cbrt(float __x) - { return __builtin_cbrtf(__x); } - - constexpr long double - cbrt(long double __x) - { return __builtin_cbrtl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - cbrt(_Tp __x) - { return __builtin_cbrt(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - copysign(float __x, float __y) - { return __builtin_copysignf(__x, __y); } - - constexpr long double - copysign(long double __x, long double __y) - { return __builtin_copysignl(__x, __y); } -#endif - - template - constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type - copysign(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return copysign(__type(__x), __type(__y)); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - erf(float __x) - { return __builtin_erff(__x); } - - constexpr long double - erf(long double __x) - { return __builtin_erfl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - erf(_Tp __x) - { return __builtin_erf(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - erfc(float __x) - { return __builtin_erfcf(__x); } - - constexpr long double - erfc(long double __x) - { return __builtin_erfcl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - erfc(_Tp __x) - { return __builtin_erfc(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - exp2(float __x) - { return __builtin_exp2f(__x); } - - constexpr long double - exp2(long double __x) - { return __builtin_exp2l(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - exp2(_Tp __x) - { return __builtin_exp2(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - expm1(float __x) - { return __builtin_expm1f(__x); } - - constexpr long double - expm1(long double __x) - { return __builtin_expm1l(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - expm1(_Tp __x) - { return __builtin_expm1(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - fdim(float __x, float __y) - { return __builtin_fdimf(__x, __y); } - - constexpr long double - fdim(long double __x, long double __y) - { return __builtin_fdiml(__x, __y); } -#endif - - template - constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type - fdim(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return fdim(__type(__x), __type(__y)); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - fma(float __x, float __y, float __z) - { return __builtin_fmaf(__x, __y, __z); } - - constexpr long double - fma(long double __x, long double __y, long double __z) - { return __builtin_fmal(__x, __y, __z); } -#endif - - template - constexpr typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type - fma(_Tp __x, _Up __y, _Vp __z) - { - typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type; - return fma(__type(__x), __type(__y), __type(__z)); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - fmax(float __x, float __y) - { return __builtin_fmaxf(__x, __y); } - - constexpr long double - fmax(long double __x, long double __y) - { return __builtin_fmaxl(__x, __y); } -#endif - - template - constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type - fmax(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return fmax(__type(__x), __type(__y)); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - fmin(float __x, float __y) - { return __builtin_fminf(__x, __y); } - - constexpr long double - fmin(long double __x, long double __y) - { return __builtin_fminl(__x, __y); } -#endif - - template - constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type - fmin(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return fmin(__type(__x), __type(__y)); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - hypot(float __x, float __y) - { return __builtin_hypotf(__x, __y); } - - constexpr long double - hypot(long double __x, long double __y) - { return __builtin_hypotl(__x, __y); } -#endif - - template - constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type - hypot(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return hypot(__type(__x), __type(__y)); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr int - ilogb(float __x) - { return __builtin_ilogbf(__x); } - - constexpr int - ilogb(long double __x) - { return __builtin_ilogbl(__x); } -#endif - - template - constexpr - typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - int>::__type - ilogb(_Tp __x) - { return __builtin_ilogb(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - lgamma(float __x) - { return __builtin_lgammaf(__x); } - - constexpr long double - lgamma(long double __x) - { return __builtin_lgammal(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - lgamma(_Tp __x) - { return __builtin_lgamma(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr long long - llrint(float __x) - { return __builtin_llrintf(__x); } - - constexpr long long - llrint(long double __x) - { return __builtin_llrintl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - long long>::__type - llrint(_Tp __x) - { return __builtin_llrint(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr long long - llround(float __x) - { return __builtin_llroundf(__x); } - - constexpr long long - llround(long double __x) - { return __builtin_llroundl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - long long>::__type - llround(_Tp __x) - { return __builtin_llround(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - log1p(float __x) - { return __builtin_log1pf(__x); } - - constexpr long double - log1p(long double __x) - { return __builtin_log1pl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - log1p(_Tp __x) - { return __builtin_log1p(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - // DR 568. - constexpr float - log2(float __x) - { return __builtin_log2f(__x); } - - constexpr long double - log2(long double __x) - { return __builtin_log2l(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - log2(_Tp __x) - { return __builtin_log2(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - logb(float __x) - { return __builtin_logbf(__x); } - - constexpr long double - logb(long double __x) - { return __builtin_logbl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - logb(_Tp __x) - { return __builtin_logb(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr long - lrint(float __x) - { return __builtin_lrintf(__x); } - - constexpr long - lrint(long double __x) - { return __builtin_lrintl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - long>::__type - lrint(_Tp __x) - { return __builtin_lrint(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr long - lround(float __x) - { return __builtin_lroundf(__x); } - - constexpr long - lround(long double __x) - { return __builtin_lroundl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - long>::__type - lround(_Tp __x) - { return __builtin_lround(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - nearbyint(float __x) - { return __builtin_nearbyintf(__x); } - - constexpr long double - nearbyint(long double __x) - { return __builtin_nearbyintl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - nearbyint(_Tp __x) - { return __builtin_nearbyint(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - nextafter(float __x, float __y) - { return __builtin_nextafterf(__x, __y); } - - constexpr long double - nextafter(long double __x, long double __y) - { return __builtin_nextafterl(__x, __y); } -#endif - - template - constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type - nextafter(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return nextafter(__type(__x), __type(__y)); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - nexttoward(float __x, long double __y) - { return __builtin_nexttowardf(__x, __y); } - - constexpr long double - nexttoward(long double __x, long double __y) - { return __builtin_nexttowardl(__x, __y); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - nexttoward(_Tp __x, long double __y) - { return __builtin_nexttoward(__x, __y); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - remainder(float __x, float __y) - { return __builtin_remainderf(__x, __y); } - - constexpr long double - remainder(long double __x, long double __y) - { return __builtin_remainderl(__x, __y); } -#endif - - template - constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type - remainder(_Tp __x, _Up __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return remainder(__type(__x), __type(__y)); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - inline float - remquo(float __x, float __y, int* __pquo) - { return __builtin_remquof(__x, __y, __pquo); } - - inline long double - remquo(long double __x, long double __y, int* __pquo) - { return __builtin_remquol(__x, __y, __pquo); } -#endif - - template - inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type - remquo(_Tp __x, _Up __y, int* __pquo) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return remquo(__type(__x), __type(__y), __pquo); - } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - rint(float __x) - { return __builtin_rintf(__x); } - - constexpr long double - rint(long double __x) - { return __builtin_rintl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - rint(_Tp __x) - { return __builtin_rint(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - round(float __x) - { return __builtin_roundf(__x); } - - constexpr long double - round(long double __x) - { return __builtin_roundl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - round(_Tp __x) - { return __builtin_round(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - scalbln(float __x, long __ex) - { return __builtin_scalblnf(__x, __ex); } - - constexpr long double - scalbln(long double __x, long __ex) - { return __builtin_scalblnl(__x, __ex); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - scalbln(_Tp __x, long __ex) - { return __builtin_scalbln(__x, __ex); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - scalbn(float __x, int __ex) - { return __builtin_scalbnf(__x, __ex); } - - constexpr long double - scalbn(long double __x, int __ex) - { return __builtin_scalbnl(__x, __ex); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - scalbn(_Tp __x, int __ex) - { return __builtin_scalbn(__x, __ex); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - tgamma(float __x) - { return __builtin_tgammaf(__x); } - - constexpr long double - tgamma(long double __x) - { return __builtin_tgammal(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - tgamma(_Tp __x) - { return __builtin_tgamma(__x); } - -#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO - constexpr float - trunc(float __x) - { return __builtin_truncf(__x); } - - constexpr long double - trunc(long double __x) - { return __builtin_truncl(__x); } -#endif - - template - constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - trunc(_Tp __x) - { return __builtin_trunc(__x); } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif // _GLIBCXX_USE_C99_MATH_TR1 - -#endif // C++11 - -#endif diff --git a/openflow/usr/include/c++/5/codecvt b/openflow/usr/include/c++/5/codecvt deleted file mode 100644 index e4a7d5b..0000000 --- a/openflow/usr/include/c++/5/codecvt +++ /dev/null @@ -1,181 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -// ISO C++ 14882: 22.5 Standard code conversion facets - -/** @file include/codecvt - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_CODECVT -#define _GLIBCXX_CODECVT 1 - -#pragma GCC system_header - -#if __cplusplus < 201103L -# include -#else - -#include -#include - -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - enum codecvt_mode - { - consume_header = 4, - generate_header = 2, - little_endian = 1 - }; - - template - class codecvt_utf8 : public codecvt<_Elem, char, mbstate_t> - { - public: - explicit - codecvt_utf8(size_t __refs = 0); - - ~codecvt_utf8(); - }; - - template - class codecvt_utf16 : public codecvt<_Elem, char, mbstate_t> - { - public: - explicit - codecvt_utf16(size_t __refs = 0); - - ~codecvt_utf16(); - }; - - template - class codecvt_utf8_utf16 : public codecvt<_Elem, char, mbstate_t> - { - public: - explicit - codecvt_utf8_utf16(size_t __refs = 0); - - ~codecvt_utf8_utf16(); - }; - -#define _GLIBCXX_CODECVT_SPECIALIZATION2(_NAME, _ELEM) \ - template<> \ - class _NAME<_ELEM> \ - : public codecvt<_ELEM, char, mbstate_t> \ - { \ - public: \ - typedef _ELEM intern_type; \ - typedef char extern_type; \ - typedef mbstate_t state_type; \ - \ - protected: \ - _NAME(unsigned long __maxcode, codecvt_mode __mode, size_t __refs) \ - : codecvt(__refs), _M_maxcode(__maxcode), _M_mode(__mode) { } \ - \ - virtual \ - ~_NAME(); \ - \ - virtual result \ - do_out(state_type& __state, const intern_type* __from, \ - const intern_type* __from_end, const intern_type*& __from_next, \ - extern_type* __to, extern_type* __to_end, \ - extern_type*& __to_next) const; \ - \ - virtual result \ - do_unshift(state_type& __state, \ - extern_type* __to, extern_type* __to_end, \ - extern_type*& __to_next) const; \ - \ - virtual result \ - do_in(state_type& __state, \ - const extern_type* __from, const extern_type* __from_end, \ - const extern_type*& __from_next, \ - intern_type* __to, intern_type* __to_end, \ - intern_type*& __to_next) const; \ - \ - virtual \ - int do_encoding() const throw(); \ - \ - virtual \ - bool do_always_noconv() const throw(); \ - \ - virtual \ - int do_length(state_type&, const extern_type* __from, \ - const extern_type* __end, size_t __max) const; \ - \ - virtual int \ - do_max_length() const throw(); \ - \ - private: \ - unsigned long _M_maxcode; \ - codecvt_mode _M_mode; \ - } - -#define _GLIBCXX_CODECVT_SPECIALIZATION(_NAME, _ELEM) \ - _GLIBCXX_CODECVT_SPECIALIZATION2(__ ## _NAME ## _base, _ELEM); \ - template \ - class _NAME<_ELEM, _Maxcode, _Mode> \ - : public __ ## _NAME ## _base<_ELEM> \ - { \ - public: \ - explicit \ - _NAME(size_t __refs = 0) \ - : __ ## _NAME ## _base<_ELEM>(std::min(_Maxcode, 0x10fffful), \ - _Mode, __refs) \ - { } \ - } - - template class __codecvt_utf8_base; - template class __codecvt_utf16_base; - template class __codecvt_utf8_utf16_base; - - _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8, char16_t); - _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf16, char16_t); - _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8_utf16, char16_t); - - _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8, char32_t); - _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf16, char32_t); - _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8_utf16, char32_t); - -#ifdef _GLIBCXX_USE_WCHAR_T - _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8, wchar_t); - _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf16, wchar_t); - _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8_utf16, wchar_t); -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif // _GLIBCXX_USE_C99_STDINT_TR1 - -#endif - -#endif /* _GLIBCXX_CODECVT */ diff --git a/openflow/usr/include/c++/5/complex b/openflow/usr/include/c++/5/complex deleted file mode 100644 index 585683c..0000000 --- a/openflow/usr/include/c++/5/complex +++ /dev/null @@ -1,1973 +0,0 @@ -// The template and inlines for the -*- C++ -*- complex number classes. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/complex - * This is a Standard C++ Library header. - */ - -// -// ISO C++ 14882: 26.2 Complex Numbers -// Note: this is not a conforming implementation. -// Initially implemented by Ulrich Drepper -// Improved by Gabriel Dos Reis -// - -#ifndef _GLIBCXX_COMPLEX -#define _GLIBCXX_COMPLEX 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include - -// Get rid of a macro possibly defined in -#undef complex - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @defgroup complex_numbers Complex Numbers - * @ingroup numerics - * - * Classes and functions for complex numbers. - * @{ - */ - - // Forward declarations. - template class complex; - template<> class complex; - template<> class complex; - template<> class complex; - - /// Return magnitude of @a z. - template _Tp abs(const complex<_Tp>&); - /// Return phase angle of @a z. - template _Tp arg(const complex<_Tp>&); - /// Return @a z magnitude squared. - template _Tp norm(const complex<_Tp>&); - - /// Return complex conjugate of @a z. - template complex<_Tp> conj(const complex<_Tp>&); - /// Return complex with magnitude @a rho and angle @a theta. - template complex<_Tp> polar(const _Tp&, const _Tp& = 0); - - // Transcendentals: - /// Return complex cosine of @a z. - template complex<_Tp> cos(const complex<_Tp>&); - /// Return complex hyperbolic cosine of @a z. - template complex<_Tp> cosh(const complex<_Tp>&); - /// Return complex base e exponential of @a z. - template complex<_Tp> exp(const complex<_Tp>&); - /// Return complex natural logarithm of @a z. - template complex<_Tp> log(const complex<_Tp>&); - /// Return complex base 10 logarithm of @a z. - template complex<_Tp> log10(const complex<_Tp>&); - /// Return @a x to the @a y'th power. - template complex<_Tp> pow(const complex<_Tp>&, int); - /// Return @a x to the @a y'th power. - template complex<_Tp> pow(const complex<_Tp>&, const _Tp&); - /// Return @a x to the @a y'th power. - template complex<_Tp> pow(const complex<_Tp>&, - const complex<_Tp>&); - /// Return @a x to the @a y'th power. - template complex<_Tp> pow(const _Tp&, const complex<_Tp>&); - /// Return complex sine of @a z. - template complex<_Tp> sin(const complex<_Tp>&); - /// Return complex hyperbolic sine of @a z. - template complex<_Tp> sinh(const complex<_Tp>&); - /// Return complex square root of @a z. - template complex<_Tp> sqrt(const complex<_Tp>&); - /// Return complex tangent of @a z. - template complex<_Tp> tan(const complex<_Tp>&); - /// Return complex hyperbolic tangent of @a z. - template complex<_Tp> tanh(const complex<_Tp>&); - - - // 26.2.2 Primary template class complex - /** - * Template to represent complex numbers. - * - * Specializations for float, double, and long double are part of the - * library. Results with any other type are not guaranteed. - * - * @param Tp Type of real and imaginary values. - */ - template - struct complex - { - /// Value typedef. - typedef _Tp value_type; - - /// Default constructor. First parameter is x, second parameter is y. - /// Unspecified parameters default to 0. - _GLIBCXX_CONSTEXPR complex(const _Tp& __r = _Tp(), const _Tp& __i = _Tp()) - : _M_real(__r), _M_imag(__i) { } - - // Let the compiler synthesize the copy constructor -#if __cplusplus >= 201103L - constexpr complex(const complex&) = default; -#endif - - /// Converting constructor. - template - _GLIBCXX_CONSTEXPR complex(const complex<_Up>& __z) - : _M_real(__z.real()), _M_imag(__z.imag()) { } - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 387. std::complex over-encapsulated. - _GLIBCXX_ABI_TAG_CXX11 - constexpr _Tp - real() const { return _M_real; } - - _GLIBCXX_ABI_TAG_CXX11 - constexpr _Tp - imag() const { return _M_imag; } -#else - /// Return real part of complex number. - _Tp& - real() { return _M_real; } - - /// Return real part of complex number. - const _Tp& - real() const { return _M_real; } - - /// Return imaginary part of complex number. - _Tp& - imag() { return _M_imag; } - - /// Return imaginary part of complex number. - const _Tp& - imag() const { return _M_imag; } -#endif - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 387. std::complex over-encapsulated. - void - real(_Tp __val) { _M_real = __val; } - - void - imag(_Tp __val) { _M_imag = __val; } - - /// Assign a scalar to this complex number. - complex<_Tp>& operator=(const _Tp&); - - /// Add a scalar to this complex number. - // 26.2.5/1 - complex<_Tp>& - operator+=(const _Tp& __t) - { - _M_real += __t; - return *this; - } - - /// Subtract a scalar from this complex number. - // 26.2.5/3 - complex<_Tp>& - operator-=(const _Tp& __t) - { - _M_real -= __t; - return *this; - } - - /// Multiply this complex number by a scalar. - complex<_Tp>& operator*=(const _Tp&); - /// Divide this complex number by a scalar. - complex<_Tp>& operator/=(const _Tp&); - - // Let the compiler synthesize the copy assignment operator -#if __cplusplus >= 201103L - complex& operator=(const complex&) = default; -#endif - - /// Assign another complex number to this one. - template - complex<_Tp>& operator=(const complex<_Up>&); - /// Add another complex number to this one. - template - complex<_Tp>& operator+=(const complex<_Up>&); - /// Subtract another complex number from this one. - template - complex<_Tp>& operator-=(const complex<_Up>&); - /// Multiply this complex number by another. - template - complex<_Tp>& operator*=(const complex<_Up>&); - /// Divide this complex number by another. - template - complex<_Tp>& operator/=(const complex<_Up>&); - - _GLIBCXX_CONSTEXPR complex __rep() const - { return *this; } - - private: - _Tp _M_real; - _Tp _M_imag; - }; - - template - complex<_Tp>& - complex<_Tp>::operator=(const _Tp& __t) - { - _M_real = __t; - _M_imag = _Tp(); - return *this; - } - - // 26.2.5/5 - template - complex<_Tp>& - complex<_Tp>::operator*=(const _Tp& __t) - { - _M_real *= __t; - _M_imag *= __t; - return *this; - } - - // 26.2.5/7 - template - complex<_Tp>& - complex<_Tp>::operator/=(const _Tp& __t) - { - _M_real /= __t; - _M_imag /= __t; - return *this; - } - - template - template - complex<_Tp>& - complex<_Tp>::operator=(const complex<_Up>& __z) - { - _M_real = __z.real(); - _M_imag = __z.imag(); - return *this; - } - - // 26.2.5/9 - template - template - complex<_Tp>& - complex<_Tp>::operator+=(const complex<_Up>& __z) - { - _M_real += __z.real(); - _M_imag += __z.imag(); - return *this; - } - - // 26.2.5/11 - template - template - complex<_Tp>& - complex<_Tp>::operator-=(const complex<_Up>& __z) - { - _M_real -= __z.real(); - _M_imag -= __z.imag(); - return *this; - } - - // 26.2.5/13 - // XXX: This is a grammar school implementation. - template - template - complex<_Tp>& - complex<_Tp>::operator*=(const complex<_Up>& __z) - { - const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag(); - _M_imag = _M_real * __z.imag() + _M_imag * __z.real(); - _M_real = __r; - return *this; - } - - // 26.2.5/15 - // XXX: This is a grammar school implementation. - template - template - complex<_Tp>& - complex<_Tp>::operator/=(const complex<_Up>& __z) - { - const _Tp __r = _M_real * __z.real() + _M_imag * __z.imag(); - const _Tp __n = std::norm(__z); - _M_imag = (_M_imag * __z.real() - _M_real * __z.imag()) / __n; - _M_real = __r / __n; - return *this; - } - - // Operators: - //@{ - /// Return new complex value @a x plus @a y. - template - inline complex<_Tp> - operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __x; - __r += __y; - return __r; - } - - template - inline complex<_Tp> - operator+(const complex<_Tp>& __x, const _Tp& __y) - { - complex<_Tp> __r = __x; - __r += __y; - return __r; - } - - template - inline complex<_Tp> - operator+(const _Tp& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __y; - __r += __x; - return __r; - } - //@} - - //@{ - /// Return new complex value @a x minus @a y. - template - inline complex<_Tp> - operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __x; - __r -= __y; - return __r; - } - - template - inline complex<_Tp> - operator-(const complex<_Tp>& __x, const _Tp& __y) - { - complex<_Tp> __r = __x; - __r -= __y; - return __r; - } - - template - inline complex<_Tp> - operator-(const _Tp& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r(__x, -__y.imag()); - __r -= __y.real(); - return __r; - } - //@} - - //@{ - /// Return new complex value @a x times @a y. - template - inline complex<_Tp> - operator*(const complex<_Tp>& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __x; - __r *= __y; - return __r; - } - - template - inline complex<_Tp> - operator*(const complex<_Tp>& __x, const _Tp& __y) - { - complex<_Tp> __r = __x; - __r *= __y; - return __r; - } - - template - inline complex<_Tp> - operator*(const _Tp& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __y; - __r *= __x; - return __r; - } - //@} - - //@{ - /// Return new complex value @a x divided by @a y. - template - inline complex<_Tp> - operator/(const complex<_Tp>& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __x; - __r /= __y; - return __r; - } - - template - inline complex<_Tp> - operator/(const complex<_Tp>& __x, const _Tp& __y) - { - complex<_Tp> __r = __x; - __r /= __y; - return __r; - } - - template - inline complex<_Tp> - operator/(const _Tp& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __x; - __r /= __y; - return __r; - } - //@} - - /// Return @a x. - template - inline complex<_Tp> - operator+(const complex<_Tp>& __x) - { return __x; } - - /// Return complex negation of @a x. - template - inline complex<_Tp> - operator-(const complex<_Tp>& __x) - { return complex<_Tp>(-__x.real(), -__x.imag()); } - - //@{ - /// Return true if @a x is equal to @a y. - template - inline _GLIBCXX_CONSTEXPR bool - operator==(const complex<_Tp>& __x, const complex<_Tp>& __y) - { return __x.real() == __y.real() && __x.imag() == __y.imag(); } - - template - inline _GLIBCXX_CONSTEXPR bool - operator==(const complex<_Tp>& __x, const _Tp& __y) - { return __x.real() == __y && __x.imag() == _Tp(); } - - template - inline _GLIBCXX_CONSTEXPR bool - operator==(const _Tp& __x, const complex<_Tp>& __y) - { return __x == __y.real() && _Tp() == __y.imag(); } - //@} - - //@{ - /// Return false if @a x is equal to @a y. - template - inline _GLIBCXX_CONSTEXPR bool - operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y) - { return __x.real() != __y.real() || __x.imag() != __y.imag(); } - - template - inline _GLIBCXX_CONSTEXPR bool - operator!=(const complex<_Tp>& __x, const _Tp& __y) - { return __x.real() != __y || __x.imag() != _Tp(); } - - template - inline _GLIBCXX_CONSTEXPR bool - operator!=(const _Tp& __x, const complex<_Tp>& __y) - { return __x != __y.real() || _Tp() != __y.imag(); } - //@} - - /// Extraction operator for complex values. - template - basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) - { - _Tp __re_x, __im_x; - _CharT __ch; - __is >> __ch; - if (__ch == '(') - { - __is >> __re_x >> __ch; - if (__ch == ',') - { - __is >> __im_x >> __ch; - if (__ch == ')') - __x = complex<_Tp>(__re_x, __im_x); - else - __is.setstate(ios_base::failbit); - } - else if (__ch == ')') - __x = __re_x; - else - __is.setstate(ios_base::failbit); - } - else - { - __is.putback(__ch); - __is >> __re_x; - __x = __re_x; - } - return __is; - } - - /// Insertion operator for complex values. - template - basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) - { - basic_ostringstream<_CharT, _Traits> __s; - __s.flags(__os.flags()); - __s.imbue(__os.getloc()); - __s.precision(__os.precision()); - __s << '(' << __x.real() << ',' << __x.imag() << ')'; - return __os << __s.str(); - } - - // Values -#if __cplusplus >= 201103L - template - constexpr _Tp - real(const complex<_Tp>& __z) - { return __z.real(); } - - template - constexpr _Tp - imag(const complex<_Tp>& __z) - { return __z.imag(); } -#else - template - inline _Tp& - real(complex<_Tp>& __z) - { return __z.real(); } - - template - inline const _Tp& - real(const complex<_Tp>& __z) - { return __z.real(); } - - template - inline _Tp& - imag(complex<_Tp>& __z) - { return __z.imag(); } - - template - inline const _Tp& - imag(const complex<_Tp>& __z) - { return __z.imag(); } -#endif - - // 26.2.7/3 abs(__z): Returns the magnitude of __z. - template - inline _Tp - __complex_abs(const complex<_Tp>& __z) - { - _Tp __x = __z.real(); - _Tp __y = __z.imag(); - const _Tp __s = std::max(abs(__x), abs(__y)); - if (__s == _Tp()) // well ... - return __s; - __x /= __s; - __y /= __s; - return __s * sqrt(__x * __x + __y * __y); - } - -#if _GLIBCXX_USE_C99_COMPLEX - inline float - __complex_abs(__complex__ float __z) { return __builtin_cabsf(__z); } - - inline double - __complex_abs(__complex__ double __z) { return __builtin_cabs(__z); } - - inline long double - __complex_abs(const __complex__ long double& __z) - { return __builtin_cabsl(__z); } - - template - inline _Tp - abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); } -#else - template - inline _Tp - abs(const complex<_Tp>& __z) { return __complex_abs(__z); } -#endif - - - // 26.2.7/4: arg(__z): Returns the phase angle of __z. - template - inline _Tp - __complex_arg(const complex<_Tp>& __z) - { return atan2(__z.imag(), __z.real()); } - -#if _GLIBCXX_USE_C99_COMPLEX - inline float - __complex_arg(__complex__ float __z) { return __builtin_cargf(__z); } - - inline double - __complex_arg(__complex__ double __z) { return __builtin_carg(__z); } - - inline long double - __complex_arg(const __complex__ long double& __z) - { return __builtin_cargl(__z); } - - template - inline _Tp - arg(const complex<_Tp>& __z) { return __complex_arg(__z.__rep()); } -#else - template - inline _Tp - arg(const complex<_Tp>& __z) { return __complex_arg(__z); } -#endif - - // 26.2.7/5: norm(__z) returns the squared magnitude of __z. - // As defined, norm() is -not- a norm is the common mathematical - // sense used in numerics. The helper class _Norm_helper<> tries to - // distinguish between builtin floating point and the rest, so as - // to deliver an answer as close as possible to the real value. - template - struct _Norm_helper - { - template - static inline _Tp _S_do_it(const complex<_Tp>& __z) - { - const _Tp __x = __z.real(); - const _Tp __y = __z.imag(); - return __x * __x + __y * __y; - } - }; - - template<> - struct _Norm_helper - { - template - static inline _Tp _S_do_it(const complex<_Tp>& __z) - { - _Tp __res = std::abs(__z); - return __res * __res; - } - }; - - template - inline _Tp - norm(const complex<_Tp>& __z) - { - return _Norm_helper<__is_floating<_Tp>::__value - && !_GLIBCXX_FAST_MATH>::_S_do_it(__z); - } - - template - inline complex<_Tp> - polar(const _Tp& __rho, const _Tp& __theta) - { return complex<_Tp>(__rho * cos(__theta), __rho * sin(__theta)); } - - template - inline complex<_Tp> - conj(const complex<_Tp>& __z) - { return complex<_Tp>(__z.real(), -__z.imag()); } - - // Transcendentals - - // 26.2.8/1 cos(__z): Returns the cosine of __z. - template - inline complex<_Tp> - __complex_cos(const complex<_Tp>& __z) - { - const _Tp __x = __z.real(); - const _Tp __y = __z.imag(); - return complex<_Tp>(cos(__x) * cosh(__y), -sin(__x) * sinh(__y)); - } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_cos(__complex__ float __z) { return __builtin_ccosf(__z); } - - inline __complex__ double - __complex_cos(__complex__ double __z) { return __builtin_ccos(__z); } - - inline __complex__ long double - __complex_cos(const __complex__ long double& __z) - { return __builtin_ccosl(__z); } - - template - inline complex<_Tp> - cos(const complex<_Tp>& __z) { return __complex_cos(__z.__rep()); } -#else - template - inline complex<_Tp> - cos(const complex<_Tp>& __z) { return __complex_cos(__z); } -#endif - - // 26.2.8/2 cosh(__z): Returns the hyperbolic cosine of __z. - template - inline complex<_Tp> - __complex_cosh(const complex<_Tp>& __z) - { - const _Tp __x = __z.real(); - const _Tp __y = __z.imag(); - return complex<_Tp>(cosh(__x) * cos(__y), sinh(__x) * sin(__y)); - } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_cosh(__complex__ float __z) { return __builtin_ccoshf(__z); } - - inline __complex__ double - __complex_cosh(__complex__ double __z) { return __builtin_ccosh(__z); } - - inline __complex__ long double - __complex_cosh(const __complex__ long double& __z) - { return __builtin_ccoshl(__z); } - - template - inline complex<_Tp> - cosh(const complex<_Tp>& __z) { return __complex_cosh(__z.__rep()); } -#else - template - inline complex<_Tp> - cosh(const complex<_Tp>& __z) { return __complex_cosh(__z); } -#endif - - // 26.2.8/3 exp(__z): Returns the complex base e exponential of x - template - inline complex<_Tp> - __complex_exp(const complex<_Tp>& __z) - { return std::polar<_Tp>(exp(__z.real()), __z.imag()); } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_exp(__complex__ float __z) { return __builtin_cexpf(__z); } - - inline __complex__ double - __complex_exp(__complex__ double __z) { return __builtin_cexp(__z); } - - inline __complex__ long double - __complex_exp(const __complex__ long double& __z) - { return __builtin_cexpl(__z); } - - template - inline complex<_Tp> - exp(const complex<_Tp>& __z) { return __complex_exp(__z.__rep()); } -#else - template - inline complex<_Tp> - exp(const complex<_Tp>& __z) { return __complex_exp(__z); } -#endif - - // 26.2.8/5 log(__z): Returns the natural complex logarithm of __z. - // The branch cut is along the negative axis. - template - inline complex<_Tp> - __complex_log(const complex<_Tp>& __z) - { return complex<_Tp>(log(std::abs(__z)), std::arg(__z)); } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_log(__complex__ float __z) { return __builtin_clogf(__z); } - - inline __complex__ double - __complex_log(__complex__ double __z) { return __builtin_clog(__z); } - - inline __complex__ long double - __complex_log(const __complex__ long double& __z) - { return __builtin_clogl(__z); } - - template - inline complex<_Tp> - log(const complex<_Tp>& __z) { return __complex_log(__z.__rep()); } -#else - template - inline complex<_Tp> - log(const complex<_Tp>& __z) { return __complex_log(__z); } -#endif - - template - inline complex<_Tp> - log10(const complex<_Tp>& __z) - { return std::log(__z) / log(_Tp(10.0)); } - - // 26.2.8/10 sin(__z): Returns the sine of __z. - template - inline complex<_Tp> - __complex_sin(const complex<_Tp>& __z) - { - const _Tp __x = __z.real(); - const _Tp __y = __z.imag(); - return complex<_Tp>(sin(__x) * cosh(__y), cos(__x) * sinh(__y)); - } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_sin(__complex__ float __z) { return __builtin_csinf(__z); } - - inline __complex__ double - __complex_sin(__complex__ double __z) { return __builtin_csin(__z); } - - inline __complex__ long double - __complex_sin(const __complex__ long double& __z) - { return __builtin_csinl(__z); } - - template - inline complex<_Tp> - sin(const complex<_Tp>& __z) { return __complex_sin(__z.__rep()); } -#else - template - inline complex<_Tp> - sin(const complex<_Tp>& __z) { return __complex_sin(__z); } -#endif - - // 26.2.8/11 sinh(__z): Returns the hyperbolic sine of __z. - template - inline complex<_Tp> - __complex_sinh(const complex<_Tp>& __z) - { - const _Tp __x = __z.real(); - const _Tp __y = __z.imag(); - return complex<_Tp>(sinh(__x) * cos(__y), cosh(__x) * sin(__y)); - } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_sinh(__complex__ float __z) { return __builtin_csinhf(__z); } - - inline __complex__ double - __complex_sinh(__complex__ double __z) { return __builtin_csinh(__z); } - - inline __complex__ long double - __complex_sinh(const __complex__ long double& __z) - { return __builtin_csinhl(__z); } - - template - inline complex<_Tp> - sinh(const complex<_Tp>& __z) { return __complex_sinh(__z.__rep()); } -#else - template - inline complex<_Tp> - sinh(const complex<_Tp>& __z) { return __complex_sinh(__z); } -#endif - - // 26.2.8/13 sqrt(__z): Returns the complex square root of __z. - // The branch cut is on the negative axis. - template - complex<_Tp> - __complex_sqrt(const complex<_Tp>& __z) - { - _Tp __x = __z.real(); - _Tp __y = __z.imag(); - - if (__x == _Tp()) - { - _Tp __t = sqrt(abs(__y) / 2); - return complex<_Tp>(__t, __y < _Tp() ? -__t : __t); - } - else - { - _Tp __t = sqrt(2 * (std::abs(__z) + abs(__x))); - _Tp __u = __t / 2; - return __x > _Tp() - ? complex<_Tp>(__u, __y / __t) - : complex<_Tp>(abs(__y) / __t, __y < _Tp() ? -__u : __u); - } - } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_sqrt(__complex__ float __z) { return __builtin_csqrtf(__z); } - - inline __complex__ double - __complex_sqrt(__complex__ double __z) { return __builtin_csqrt(__z); } - - inline __complex__ long double - __complex_sqrt(const __complex__ long double& __z) - { return __builtin_csqrtl(__z); } - - template - inline complex<_Tp> - sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z.__rep()); } -#else - template - inline complex<_Tp> - sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z); } -#endif - - // 26.2.8/14 tan(__z): Return the complex tangent of __z. - - template - inline complex<_Tp> - __complex_tan(const complex<_Tp>& __z) - { return std::sin(__z) / std::cos(__z); } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_tan(__complex__ float __z) { return __builtin_ctanf(__z); } - - inline __complex__ double - __complex_tan(__complex__ double __z) { return __builtin_ctan(__z); } - - inline __complex__ long double - __complex_tan(const __complex__ long double& __z) - { return __builtin_ctanl(__z); } - - template - inline complex<_Tp> - tan(const complex<_Tp>& __z) { return __complex_tan(__z.__rep()); } -#else - template - inline complex<_Tp> - tan(const complex<_Tp>& __z) { return __complex_tan(__z); } -#endif - - - // 26.2.8/15 tanh(__z): Returns the hyperbolic tangent of __z. - - template - inline complex<_Tp> - __complex_tanh(const complex<_Tp>& __z) - { return std::sinh(__z) / std::cosh(__z); } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_tanh(__complex__ float __z) { return __builtin_ctanhf(__z); } - - inline __complex__ double - __complex_tanh(__complex__ double __z) { return __builtin_ctanh(__z); } - - inline __complex__ long double - __complex_tanh(const __complex__ long double& __z) - { return __builtin_ctanhl(__z); } - - template - inline complex<_Tp> - tanh(const complex<_Tp>& __z) { return __complex_tanh(__z.__rep()); } -#else - template - inline complex<_Tp> - tanh(const complex<_Tp>& __z) { return __complex_tanh(__z); } -#endif - - - // 26.2.8/9 pow(__x, __y): Returns the complex power base of __x - // raised to the __y-th power. The branch - // cut is on the negative axis. - template - complex<_Tp> - __complex_pow_unsigned(complex<_Tp> __x, unsigned __n) - { - complex<_Tp> __y = __n % 2 ? __x : complex<_Tp>(1); - - while (__n >>= 1) - { - __x *= __x; - if (__n % 2) - __y *= __x; - } - - return __y; - } - - // In C++11 mode we used to implement the resolution of - // DR 844. complex pow return type is ambiguous. - // thus the following overload was disabled in that mode. However, doing - // that causes all sorts of issues, see, for example: - // http://gcc.gnu.org/ml/libstdc++/2013-01/msg00058.html - // and also PR57974. - template - inline complex<_Tp> - pow(const complex<_Tp>& __z, int __n) - { - return __n < 0 - ? complex<_Tp>(1) / std::__complex_pow_unsigned(__z, -(unsigned)__n) - : std::__complex_pow_unsigned(__z, __n); - } - - template - complex<_Tp> - pow(const complex<_Tp>& __x, const _Tp& __y) - { -#ifndef _GLIBCXX_USE_C99_COMPLEX - if (__x == _Tp()) - return _Tp(); -#endif - if (__x.imag() == _Tp() && __x.real() > _Tp()) - return pow(__x.real(), __y); - - complex<_Tp> __t = std::log(__x); - return std::polar<_Tp>(exp(__y * __t.real()), __y * __t.imag()); - } - - template - inline complex<_Tp> - __complex_pow(const complex<_Tp>& __x, const complex<_Tp>& __y) - { return __x == _Tp() ? _Tp() : std::exp(__y * std::log(__x)); } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_pow(__complex__ float __x, __complex__ float __y) - { return __builtin_cpowf(__x, __y); } - - inline __complex__ double - __complex_pow(__complex__ double __x, __complex__ double __y) - { return __builtin_cpow(__x, __y); } - - inline __complex__ long double - __complex_pow(const __complex__ long double& __x, - const __complex__ long double& __y) - { return __builtin_cpowl(__x, __y); } - - template - inline complex<_Tp> - pow(const complex<_Tp>& __x, const complex<_Tp>& __y) - { return __complex_pow(__x.__rep(), __y.__rep()); } -#else - template - inline complex<_Tp> - pow(const complex<_Tp>& __x, const complex<_Tp>& __y) - { return __complex_pow(__x, __y); } -#endif - - template - inline complex<_Tp> - pow(const _Tp& __x, const complex<_Tp>& __y) - { - return __x > _Tp() ? std::polar<_Tp>(pow(__x, __y.real()), - __y.imag() * log(__x)) - : std::pow(complex<_Tp>(__x), __y); - } - - /// 26.2.3 complex specializations - /// complex specialization - template<> - struct complex - { - typedef float value_type; - typedef __complex__ float _ComplexT; - - _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { } - - _GLIBCXX_CONSTEXPR complex(float __r = 0.0f, float __i = 0.0f) -#if __cplusplus >= 201103L - : _M_value{ __r, __i } { } -#else - { - __real__ _M_value = __r; - __imag__ _M_value = __i; - } -#endif - - explicit _GLIBCXX_CONSTEXPR complex(const complex&); - explicit _GLIBCXX_CONSTEXPR complex(const complex&); - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 387. std::complex over-encapsulated. - __attribute ((__abi_tag__ ("cxx11"))) - constexpr float - real() const { return __real__ _M_value; } - - __attribute ((__abi_tag__ ("cxx11"))) - constexpr float - imag() const { return __imag__ _M_value; } -#else - float& - real() { return __real__ _M_value; } - - const float& - real() const { return __real__ _M_value; } - - float& - imag() { return __imag__ _M_value; } - - const float& - imag() const { return __imag__ _M_value; } -#endif - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 387. std::complex over-encapsulated. - void - real(float __val) { __real__ _M_value = __val; } - - void - imag(float __val) { __imag__ _M_value = __val; } - - complex& - operator=(float __f) - { - _M_value = __f; - return *this; - } - - complex& - operator+=(float __f) - { - _M_value += __f; - return *this; - } - - complex& - operator-=(float __f) - { - _M_value -= __f; - return *this; - } - - complex& - operator*=(float __f) - { - _M_value *= __f; - return *this; - } - - complex& - operator/=(float __f) - { - _M_value /= __f; - return *this; - } - - // Let the compiler synthesize the copy and assignment - // operator. It always does a pretty good job. - // complex& operator=(const complex&); - - template - complex& - operator=(const complex<_Tp>& __z) - { - __real__ _M_value = __z.real(); - __imag__ _M_value = __z.imag(); - return *this; - } - - template - complex& - operator+=(const complex<_Tp>& __z) - { - __real__ _M_value += __z.real(); - __imag__ _M_value += __z.imag(); - return *this; - } - - template - complex& - operator-=(const complex<_Tp>& __z) - { - __real__ _M_value -= __z.real(); - __imag__ _M_value -= __z.imag(); - return *this; - } - - template - complex& - operator*=(const complex<_Tp>& __z) - { - _ComplexT __t; - __real__ __t = __z.real(); - __imag__ __t = __z.imag(); - _M_value *= __t; - return *this; - } - - template - complex& - operator/=(const complex<_Tp>& __z) - { - _ComplexT __t; - __real__ __t = __z.real(); - __imag__ __t = __z.imag(); - _M_value /= __t; - return *this; - } - - _GLIBCXX_CONSTEXPR _ComplexT __rep() const { return _M_value; } - - private: - _ComplexT _M_value; - }; - - /// 26.2.3 complex specializations - /// complex specialization - template<> - struct complex - { - typedef double value_type; - typedef __complex__ double _ComplexT; - - _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { } - - _GLIBCXX_CONSTEXPR complex(double __r = 0.0, double __i = 0.0) -#if __cplusplus >= 201103L - : _M_value{ __r, __i } { } -#else - { - __real__ _M_value = __r; - __imag__ _M_value = __i; - } -#endif - - _GLIBCXX_CONSTEXPR complex(const complex& __z) - : _M_value(__z.__rep()) { } - - explicit _GLIBCXX_CONSTEXPR complex(const complex&); - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 387. std::complex over-encapsulated. - __attribute ((__abi_tag__ ("cxx11"))) - constexpr double - real() const { return __real__ _M_value; } - - __attribute ((__abi_tag__ ("cxx11"))) - constexpr double - imag() const { return __imag__ _M_value; } -#else - double& - real() { return __real__ _M_value; } - - const double& - real() const { return __real__ _M_value; } - - double& - imag() { return __imag__ _M_value; } - - const double& - imag() const { return __imag__ _M_value; } -#endif - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 387. std::complex over-encapsulated. - void - real(double __val) { __real__ _M_value = __val; } - - void - imag(double __val) { __imag__ _M_value = __val; } - - complex& - operator=(double __d) - { - _M_value = __d; - return *this; - } - - complex& - operator+=(double __d) - { - _M_value += __d; - return *this; - } - - complex& - operator-=(double __d) - { - _M_value -= __d; - return *this; - } - - complex& - operator*=(double __d) - { - _M_value *= __d; - return *this; - } - - complex& - operator/=(double __d) - { - _M_value /= __d; - return *this; - } - - // The compiler will synthesize this, efficiently. - // complex& operator=(const complex&); - - template - complex& - operator=(const complex<_Tp>& __z) - { - __real__ _M_value = __z.real(); - __imag__ _M_value = __z.imag(); - return *this; - } - - template - complex& - operator+=(const complex<_Tp>& __z) - { - __real__ _M_value += __z.real(); - __imag__ _M_value += __z.imag(); - return *this; - } - - template - complex& - operator-=(const complex<_Tp>& __z) - { - __real__ _M_value -= __z.real(); - __imag__ _M_value -= __z.imag(); - return *this; - } - - template - complex& - operator*=(const complex<_Tp>& __z) - { - _ComplexT __t; - __real__ __t = __z.real(); - __imag__ __t = __z.imag(); - _M_value *= __t; - return *this; - } - - template - complex& - operator/=(const complex<_Tp>& __z) - { - _ComplexT __t; - __real__ __t = __z.real(); - __imag__ __t = __z.imag(); - _M_value /= __t; - return *this; - } - - _GLIBCXX_CONSTEXPR _ComplexT __rep() const { return _M_value; } - - private: - _ComplexT _M_value; - }; - - /// 26.2.3 complex specializations - /// complex specialization - template<> - struct complex - { - typedef long double value_type; - typedef __complex__ long double _ComplexT; - - _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { } - - _GLIBCXX_CONSTEXPR complex(long double __r = 0.0L, - long double __i = 0.0L) -#if __cplusplus >= 201103L - : _M_value{ __r, __i } { } -#else - { - __real__ _M_value = __r; - __imag__ _M_value = __i; - } -#endif - - _GLIBCXX_CONSTEXPR complex(const complex& __z) - : _M_value(__z.__rep()) { } - - _GLIBCXX_CONSTEXPR complex(const complex& __z) - : _M_value(__z.__rep()) { } - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 387. std::complex over-encapsulated. - __attribute ((__abi_tag__ ("cxx11"))) - constexpr long double - real() const { return __real__ _M_value; } - - __attribute ((__abi_tag__ ("cxx11"))) - constexpr long double - imag() const { return __imag__ _M_value; } -#else - long double& - real() { return __real__ _M_value; } - - const long double& - real() const { return __real__ _M_value; } - - long double& - imag() { return __imag__ _M_value; } - - const long double& - imag() const { return __imag__ _M_value; } -#endif - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 387. std::complex over-encapsulated. - void - real(long double __val) { __real__ _M_value = __val; } - - void - imag(long double __val) { __imag__ _M_value = __val; } - - complex& - operator=(long double __r) - { - _M_value = __r; - return *this; - } - - complex& - operator+=(long double __r) - { - _M_value += __r; - return *this; - } - - complex& - operator-=(long double __r) - { - _M_value -= __r; - return *this; - } - - complex& - operator*=(long double __r) - { - _M_value *= __r; - return *this; - } - - complex& - operator/=(long double __r) - { - _M_value /= __r; - return *this; - } - - // The compiler knows how to do this efficiently - // complex& operator=(const complex&); - - template - complex& - operator=(const complex<_Tp>& __z) - { - __real__ _M_value = __z.real(); - __imag__ _M_value = __z.imag(); - return *this; - } - - template - complex& - operator+=(const complex<_Tp>& __z) - { - __real__ _M_value += __z.real(); - __imag__ _M_value += __z.imag(); - return *this; - } - - template - complex& - operator-=(const complex<_Tp>& __z) - { - __real__ _M_value -= __z.real(); - __imag__ _M_value -= __z.imag(); - return *this; - } - - template - complex& - operator*=(const complex<_Tp>& __z) - { - _ComplexT __t; - __real__ __t = __z.real(); - __imag__ __t = __z.imag(); - _M_value *= __t; - return *this; - } - - template - complex& - operator/=(const complex<_Tp>& __z) - { - _ComplexT __t; - __real__ __t = __z.real(); - __imag__ __t = __z.imag(); - _M_value /= __t; - return *this; - } - - _GLIBCXX_CONSTEXPR _ComplexT __rep() const { return _M_value; } - - private: - _ComplexT _M_value; - }; - - // These bits have to be at the end of this file, so that the - // specializations have all been defined. - inline _GLIBCXX_CONSTEXPR - complex::complex(const complex& __z) - : _M_value(__z.__rep()) { } - - inline _GLIBCXX_CONSTEXPR - complex::complex(const complex& __z) - : _M_value(__z.__rep()) { } - - inline _GLIBCXX_CONSTEXPR - complex::complex(const complex& __z) - : _M_value(__z.__rep()) { } - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template istream& operator>>(istream&, complex&); - extern template ostream& operator<<(ostream&, const complex&); - extern template istream& operator>>(istream&, complex&); - extern template ostream& operator<<(ostream&, const complex&); - extern template istream& operator>>(istream&, complex&); - extern template ostream& operator<<(ostream&, const complex&); - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template wistream& operator>>(wistream&, complex&); - extern template wostream& operator<<(wostream&, const complex&); - extern template wistream& operator>>(wistream&, complex&); - extern template wostream& operator<<(wostream&, const complex&); - extern template wistream& operator>>(wistream&, complex&); - extern template wostream& operator<<(wostream&, const complex&); -#endif -#endif - - // @} group complex_numbers - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // See ext/type_traits.h for the primary template. - template - struct __promote_2, _Up> - { - public: - typedef std::complex::__type> __type; - }; - - template - struct __promote_2<_Tp, std::complex<_Up> > - { - public: - typedef std::complex::__type> __type; - }; - - template - struct __promote_2, std::complex<_Up> > - { - public: - typedef std::complex::__type> __type; - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#if __cplusplus >= 201103L - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Forward declarations. - template std::complex<_Tp> acos(const std::complex<_Tp>&); - template std::complex<_Tp> asin(const std::complex<_Tp>&); - template std::complex<_Tp> atan(const std::complex<_Tp>&); - - template std::complex<_Tp> acosh(const std::complex<_Tp>&); - template std::complex<_Tp> asinh(const std::complex<_Tp>&); - template std::complex<_Tp> atanh(const std::complex<_Tp>&); - // DR 595. - template _Tp fabs(const std::complex<_Tp>&); - - template - inline std::complex<_Tp> - __complex_acos(const std::complex<_Tp>& __z) - { - const std::complex<_Tp> __t = std::asin(__z); - const _Tp __pi_2 = 1.5707963267948966192313216916397514L; - return std::complex<_Tp>(__pi_2 - __t.real(), -__t.imag()); - } - -#if _GLIBCXX_USE_C99_COMPLEX_TR1 - inline __complex__ float - __complex_acos(__complex__ float __z) - { return __builtin_cacosf(__z); } - - inline __complex__ double - __complex_acos(__complex__ double __z) - { return __builtin_cacos(__z); } - - inline __complex__ long double - __complex_acos(const __complex__ long double& __z) - { return __builtin_cacosl(__z); } - - template - inline std::complex<_Tp> - acos(const std::complex<_Tp>& __z) - { return __complex_acos(__z.__rep()); } -#else - /// acos(__z) [8.1.2]. - // Effects: Behaves the same as C99 function cacos, defined - // in subclause 7.3.5.1. - template - inline std::complex<_Tp> - acos(const std::complex<_Tp>& __z) - { return __complex_acos(__z); } -#endif - - template - inline std::complex<_Tp> - __complex_asin(const std::complex<_Tp>& __z) - { - std::complex<_Tp> __t(-__z.imag(), __z.real()); - __t = std::asinh(__t); - return std::complex<_Tp>(__t.imag(), -__t.real()); - } - -#if _GLIBCXX_USE_C99_COMPLEX_TR1 - inline __complex__ float - __complex_asin(__complex__ float __z) - { return __builtin_casinf(__z); } - - inline __complex__ double - __complex_asin(__complex__ double __z) - { return __builtin_casin(__z); } - - inline __complex__ long double - __complex_asin(const __complex__ long double& __z) - { return __builtin_casinl(__z); } - - template - inline std::complex<_Tp> - asin(const std::complex<_Tp>& __z) - { return __complex_asin(__z.__rep()); } -#else - /// asin(__z) [8.1.3]. - // Effects: Behaves the same as C99 function casin, defined - // in subclause 7.3.5.2. - template - inline std::complex<_Tp> - asin(const std::complex<_Tp>& __z) - { return __complex_asin(__z); } -#endif - - template - std::complex<_Tp> - __complex_atan(const std::complex<_Tp>& __z) - { - const _Tp __r2 = __z.real() * __z.real(); - const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag(); - - _Tp __num = __z.imag() + _Tp(1.0); - _Tp __den = __z.imag() - _Tp(1.0); - - __num = __r2 + __num * __num; - __den = __r2 + __den * __den; - - return std::complex<_Tp>(_Tp(0.5) * atan2(_Tp(2.0) * __z.real(), __x), - _Tp(0.25) * log(__num / __den)); - } - -#if _GLIBCXX_USE_C99_COMPLEX_TR1 - inline __complex__ float - __complex_atan(__complex__ float __z) - { return __builtin_catanf(__z); } - - inline __complex__ double - __complex_atan(__complex__ double __z) - { return __builtin_catan(__z); } - - inline __complex__ long double - __complex_atan(const __complex__ long double& __z) - { return __builtin_catanl(__z); } - - template - inline std::complex<_Tp> - atan(const std::complex<_Tp>& __z) - { return __complex_atan(__z.__rep()); } -#else - /// atan(__z) [8.1.4]. - // Effects: Behaves the same as C99 function catan, defined - // in subclause 7.3.5.3. - template - inline std::complex<_Tp> - atan(const std::complex<_Tp>& __z) - { return __complex_atan(__z); } -#endif - - template - std::complex<_Tp> - __complex_acosh(const std::complex<_Tp>& __z) - { - // Kahan's formula. - return _Tp(2.0) * std::log(std::sqrt(_Tp(0.5) * (__z + _Tp(1.0))) - + std::sqrt(_Tp(0.5) * (__z - _Tp(1.0)))); - } - -#if _GLIBCXX_USE_C99_COMPLEX_TR1 - inline __complex__ float - __complex_acosh(__complex__ float __z) - { return __builtin_cacoshf(__z); } - - inline __complex__ double - __complex_acosh(__complex__ double __z) - { return __builtin_cacosh(__z); } - - inline __complex__ long double - __complex_acosh(const __complex__ long double& __z) - { return __builtin_cacoshl(__z); } - - template - inline std::complex<_Tp> - acosh(const std::complex<_Tp>& __z) - { return __complex_acosh(__z.__rep()); } -#else - /// acosh(__z) [8.1.5]. - // Effects: Behaves the same as C99 function cacosh, defined - // in subclause 7.3.6.1. - template - inline std::complex<_Tp> - acosh(const std::complex<_Tp>& __z) - { return __complex_acosh(__z); } -#endif - - template - std::complex<_Tp> - __complex_asinh(const std::complex<_Tp>& __z) - { - std::complex<_Tp> __t((__z.real() - __z.imag()) - * (__z.real() + __z.imag()) + _Tp(1.0), - _Tp(2.0) * __z.real() * __z.imag()); - __t = std::sqrt(__t); - - return std::log(__t + __z); - } - -#if _GLIBCXX_USE_C99_COMPLEX_TR1 - inline __complex__ float - __complex_asinh(__complex__ float __z) - { return __builtin_casinhf(__z); } - - inline __complex__ double - __complex_asinh(__complex__ double __z) - { return __builtin_casinh(__z); } - - inline __complex__ long double - __complex_asinh(const __complex__ long double& __z) - { return __builtin_casinhl(__z); } - - template - inline std::complex<_Tp> - asinh(const std::complex<_Tp>& __z) - { return __complex_asinh(__z.__rep()); } -#else - /// asinh(__z) [8.1.6]. - // Effects: Behaves the same as C99 function casin, defined - // in subclause 7.3.6.2. - template - inline std::complex<_Tp> - asinh(const std::complex<_Tp>& __z) - { return __complex_asinh(__z); } -#endif - - template - std::complex<_Tp> - __complex_atanh(const std::complex<_Tp>& __z) - { - const _Tp __i2 = __z.imag() * __z.imag(); - const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real(); - - _Tp __num = _Tp(1.0) + __z.real(); - _Tp __den = _Tp(1.0) - __z.real(); - - __num = __i2 + __num * __num; - __den = __i2 + __den * __den; - - return std::complex<_Tp>(_Tp(0.25) * (log(__num) - log(__den)), - _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x)); - } - -#if _GLIBCXX_USE_C99_COMPLEX_TR1 - inline __complex__ float - __complex_atanh(__complex__ float __z) - { return __builtin_catanhf(__z); } - - inline __complex__ double - __complex_atanh(__complex__ double __z) - { return __builtin_catanh(__z); } - - inline __complex__ long double - __complex_atanh(const __complex__ long double& __z) - { return __builtin_catanhl(__z); } - - template - inline std::complex<_Tp> - atanh(const std::complex<_Tp>& __z) - { return __complex_atanh(__z.__rep()); } -#else - /// atanh(__z) [8.1.7]. - // Effects: Behaves the same as C99 function catanh, defined - // in subclause 7.3.6.3. - template - inline std::complex<_Tp> - atanh(const std::complex<_Tp>& __z) - { return __complex_atanh(__z); } -#endif - - template - inline _Tp - /// fabs(__z) [8.1.8]. - // Effects: Behaves the same as C99 function cabs, defined - // in subclause 7.3.8.1. - fabs(const std::complex<_Tp>& __z) - { return std::abs(__z); } - - /// Additional overloads [8.1.9]. - template - inline typename __gnu_cxx::__promote<_Tp>::__type - arg(_Tp __x) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; -#if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC) - return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L) - : __type(); -#else - return std::arg(std::complex<__type>(__x)); -#endif - } - - template - inline typename __gnu_cxx::__promote<_Tp>::__type - imag(_Tp) - { return _Tp(); } - - template - inline typename __gnu_cxx::__promote<_Tp>::__type - norm(_Tp __x) - { - typedef typename __gnu_cxx::__promote<_Tp>::__type __type; - return __type(__x) * __type(__x); - } - - template - inline typename __gnu_cxx::__promote<_Tp>::__type - real(_Tp __x) - { return __x; } - - template - inline std::complex::__type> - pow(const std::complex<_Tp>& __x, const _Up& __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return std::pow(std::complex<__type>(__x), __type(__y)); - } - - template - inline std::complex::__type> - pow(const _Tp& __x, const std::complex<_Up>& __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return std::pow(__type(__x), std::complex<__type>(__y)); - } - - template - inline std::complex::__type> - pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y) - { - typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; - return std::pow(std::complex<__type>(__x), - std::complex<__type>(__y)); - } - - // Forward declarations. - // DR 781. - template std::complex<_Tp> proj(const std::complex<_Tp>&); - - template - std::complex<_Tp> - __complex_proj(const std::complex<_Tp>& __z) - { - const _Tp __den = (__z.real() * __z.real() - + __z.imag() * __z.imag() + _Tp(1.0)); - - return std::complex<_Tp>((_Tp(2.0) * __z.real()) / __den, - (_Tp(2.0) * __z.imag()) / __den); - } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_proj(__complex__ float __z) - { return __builtin_cprojf(__z); } - - inline __complex__ double - __complex_proj(__complex__ double __z) - { return __builtin_cproj(__z); } - - inline __complex__ long double - __complex_proj(const __complex__ long double& __z) - { return __builtin_cprojl(__z); } - - template - inline std::complex<_Tp> - proj(const std::complex<_Tp>& __z) - { return __complex_proj(__z.__rep()); } -#else - template - inline std::complex<_Tp> - proj(const std::complex<_Tp>& __z) - { return __complex_proj(__z); } -#endif - - // DR 1137. - template - inline typename __gnu_cxx::__promote<_Tp>::__type - proj(_Tp __x) - { return __x; } - - template - inline typename __gnu_cxx::__promote<_Tp>::__type - conj(_Tp __x) - { return __x; } - -#if __cplusplus > 201103L - -inline namespace literals { -inline namespace complex_literals { - -#define __cpp_lib_complex_udls 201309 - - constexpr std::complex - operator""if(long double __num) - { return std::complex{0.0F, static_cast(__num)}; } - - constexpr std::complex - operator""if(unsigned long long __num) - { return std::complex{0.0F, static_cast(__num)}; } - - constexpr std::complex - operator""i(long double __num) - { return std::complex{0.0, static_cast(__num)}; } - - constexpr std::complex - operator""i(unsigned long long __num) - { return std::complex{0.0, static_cast(__num)}; } - - constexpr std::complex - operator""il(long double __num) - { return std::complex{0.0L, __num}; } - - constexpr std::complex - operator""il(unsigned long long __num) - { return std::complex{0.0L, static_cast(__num)}; } - -} // inline namespace complex_literals -} // inline namespace literals - -#endif // C++14 - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif // C++11 - -#endif /* _GLIBCXX_COMPLEX */ diff --git a/openflow/usr/include/c++/5/complex.h b/openflow/usr/include/c++/5/complex.h deleted file mode 100644 index b383075..0000000 --- a/openflow/usr/include/c++/5/complex.h +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- compatibility header. - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file complex.h - * This is a Standard C++ Library header. - */ - -#include - -#if __cplusplus >= 201103L -# include -#endif - -#if _GLIBCXX_HAVE_COMPLEX_H -# include_next -# ifdef _GLIBCXX_COMPLEX -// See PR56111, keep the macro in C++03 if possible. -# undef complex -# endif -#endif - -#ifndef _GLIBCXX_COMPLEX_H -#define _GLIBCXX_COMPLEX_H 1 - -#endif diff --git a/openflow/usr/include/c++/5/condition_variable b/openflow/usr/include/c++/5/condition_variable deleted file mode 100644 index f7da017..0000000 --- a/openflow/usr/include/c++/5/condition_variable +++ /dev/null @@ -1,312 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2008-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/condition_variable - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_CONDITION_VARIABLE -#define _GLIBCXX_CONDITION_VARIABLE 1 - -#pragma GCC system_header - -#if __cplusplus < 201103L -# include -#else - -#include -#include -#include -#include -#include -#include -#include - -#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @defgroup condition_variables Condition Variables - * @ingroup concurrency - * - * Classes for condition_variable support. - * @{ - */ - - /// cv_status - enum class cv_status { no_timeout, timeout }; - - /// condition_variable - class condition_variable - { - typedef chrono::system_clock __clock_t; - typedef __gthread_cond_t __native_type; - -#ifdef __GTHREAD_COND_INIT - __native_type _M_cond = __GTHREAD_COND_INIT; -#else - __native_type _M_cond; -#endif - - public: - typedef __native_type* native_handle_type; - - condition_variable() noexcept; - ~condition_variable() noexcept; - - condition_variable(const condition_variable&) = delete; - condition_variable& operator=(const condition_variable&) = delete; - - void - notify_one() noexcept; - - void - notify_all() noexcept; - - void - wait(unique_lock& __lock); - - template - void - wait(unique_lock& __lock, _Predicate __p) - { - while (!__p()) - wait(__lock); - } - - template - cv_status - wait_until(unique_lock& __lock, - const chrono::time_point<__clock_t, _Duration>& __atime) - { return __wait_until_impl(__lock, __atime); } - - template - cv_status - wait_until(unique_lock& __lock, - const chrono::time_point<_Clock, _Duration>& __atime) - { - // DR 887 - Sync unknown clock to known clock. - const typename _Clock::time_point __c_entry = _Clock::now(); - const __clock_t::time_point __s_entry = __clock_t::now(); - const auto __delta = __atime - __c_entry; - const auto __s_atime = __s_entry + __delta; - - return __wait_until_impl(__lock, __s_atime); - } - - template - bool - wait_until(unique_lock& __lock, - const chrono::time_point<_Clock, _Duration>& __atime, - _Predicate __p) - { - while (!__p()) - if (wait_until(__lock, __atime) == cv_status::timeout) - return __p(); - return true; - } - - template - cv_status - wait_for(unique_lock& __lock, - const chrono::duration<_Rep, _Period>& __rtime) - { return wait_until(__lock, __clock_t::now() + __rtime); } - - template - bool - wait_for(unique_lock& __lock, - const chrono::duration<_Rep, _Period>& __rtime, - _Predicate __p) - { return wait_until(__lock, __clock_t::now() + __rtime, std::move(__p)); } - - native_handle_type - native_handle() - { return &_M_cond; } - - private: - template - cv_status - __wait_until_impl(unique_lock& __lock, - const chrono::time_point<__clock_t, _Dur>& __atime) - { - auto __s = chrono::time_point_cast(__atime); - auto __ns = chrono::duration_cast(__atime - __s); - - __gthread_time_t __ts = - { - static_cast(__s.time_since_epoch().count()), - static_cast(__ns.count()) - }; - - __gthread_cond_timedwait(&_M_cond, __lock.mutex()->native_handle(), - &__ts); - - return (__clock_t::now() < __atime - ? cv_status::no_timeout : cv_status::timeout); - } - }; - - void - notify_all_at_thread_exit(condition_variable&, unique_lock); - - struct __at_thread_exit_elt - { - __at_thread_exit_elt* _M_next; - void (*_M_cb)(void*); - }; - - inline namespace _V2 { - - /// condition_variable_any - // Like above, but mutex is not required to have try_lock. - class condition_variable_any - { - typedef chrono::system_clock __clock_t; - condition_variable _M_cond; - shared_ptr _M_mutex; - - // scoped unlock - unlocks in ctor, re-locks in dtor - template - struct _Unlock - { - explicit _Unlock(_Lock& __lk) : _M_lock(__lk) { __lk.unlock(); } - - ~_Unlock() noexcept(false) - { - if (uncaught_exception()) - { - __try - { _M_lock.lock(); } - __catch(const __cxxabiv1::__forced_unwind&) - { __throw_exception_again; } - __catch(...) - { } - } - else - _M_lock.lock(); - } - - _Unlock(const _Unlock&) = delete; - _Unlock& operator=(const _Unlock&) = delete; - - _Lock& _M_lock; - }; - - public: - condition_variable_any() : _M_mutex(std::make_shared()) { } - ~condition_variable_any() = default; - - condition_variable_any(const condition_variable_any&) = delete; - condition_variable_any& operator=(const condition_variable_any&) = delete; - - void - notify_one() noexcept - { - lock_guard __lock(*_M_mutex); - _M_cond.notify_one(); - } - - void - notify_all() noexcept - { - lock_guard __lock(*_M_mutex); - _M_cond.notify_all(); - } - - template - void - wait(_Lock& __lock) - { - shared_ptr __mutex = _M_mutex; - unique_lock __my_lock(*__mutex); - _Unlock<_Lock> __unlock(__lock); - // *__mutex must be unlocked before re-locking __lock so move - // ownership of *__mutex lock to an object with shorter lifetime. - unique_lock __my_lock2(std::move(__my_lock)); - _M_cond.wait(__my_lock2); - } - - - template - void - wait(_Lock& __lock, _Predicate __p) - { - while (!__p()) - wait(__lock); - } - - template - cv_status - wait_until(_Lock& __lock, - const chrono::time_point<_Clock, _Duration>& __atime) - { - shared_ptr __mutex = _M_mutex; - unique_lock __my_lock(*__mutex); - _Unlock<_Lock> __unlock(__lock); - // *__mutex must be unlocked before re-locking __lock so move - // ownership of *__mutex lock to an object with shorter lifetime. - unique_lock __my_lock2(std::move(__my_lock)); - return _M_cond.wait_until(__my_lock2, __atime); - } - - template - bool - wait_until(_Lock& __lock, - const chrono::time_point<_Clock, _Duration>& __atime, - _Predicate __p) - { - while (!__p()) - if (wait_until(__lock, __atime) == cv_status::timeout) - return __p(); - return true; - } - - template - cv_status - wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __rtime) - { return wait_until(__lock, __clock_t::now() + __rtime); } - - template - bool - wait_for(_Lock& __lock, - const chrono::duration<_Rep, _Period>& __rtime, _Predicate __p) - { return wait_until(__lock, __clock_t::now() + __rtime, std::move(__p)); } - }; - - } // end inline namespace - - // @} group condition_variables -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1 - -#endif // C++11 - -#endif // _GLIBCXX_CONDITION_VARIABLE diff --git a/openflow/usr/include/c++/5/csetjmp b/openflow/usr/include/c++/5/csetjmp deleted file mode 100644 index baadeee..0000000 --- a/openflow/usr/include/c++/5/csetjmp +++ /dev/null @@ -1,61 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file csetjmp - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c setjmp.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.4.6 C library -// - -#pragma GCC system_header - -#include -#include - -#ifndef _GLIBCXX_CSETJMP -#define _GLIBCXX_CSETJMP 1 - -// Get rid of those macros defined in in lieu of real functions. -#undef longjmp - -// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 -#ifndef setjmp -#define setjmp(env) setjmp (env) -#endif - -namespace std -{ - using ::jmp_buf; - using ::longjmp; -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/csignal b/openflow/usr/include/c++/5/csignal deleted file mode 100644 index 95d5dfe..0000000 --- a/openflow/usr/include/c++/5/csignal +++ /dev/null @@ -1,57 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file csignal - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c signal.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.4.6 C library -// - -#pragma GCC system_header - -#include -#include - -#ifndef _GLIBCXX_CSIGNAL -#define _GLIBCXX_CSIGNAL 1 - -// Get rid of those macros defined in in lieu of real functions. -#undef raise - -namespace std -{ - using ::sig_atomic_t; - using ::signal; - using ::raise; -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/cstdalign b/openflow/usr/include/c++/5/cstdalign deleted file mode 100644 index 27dff9b..0000000 --- a/openflow/usr/include/c++/5/cstdalign +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2011-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/cstdalign - * This is a Standard C++ Library header. - */ - -#pragma GCC system_header - -#ifndef _GLIBCXX_CSTDALIGN -#define _GLIBCXX_CSTDALIGN 1 - -#if __cplusplus < 201103L -# include -#else -# include -# if _GLIBCXX_HAVE_STDALIGN_H -# include -# endif -#endif - -#endif - diff --git a/openflow/usr/include/c++/5/cstdarg b/openflow/usr/include/c++/5/cstdarg deleted file mode 100644 index 6dde251..0000000 --- a/openflow/usr/include/c++/5/cstdarg +++ /dev/null @@ -1,57 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/cstdarg - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c stdarg.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.4.6 C library -// - -#pragma GCC system_header - -#include -#include - -#ifndef _GLIBCXX_CSTDARG -#define _GLIBCXX_CSTDARG 1 - -// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 -#ifndef va_end -#define va_end(ap) va_end (ap) -#endif - -namespace std -{ - using ::va_list; -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/cstdbool b/openflow/usr/include/c++/5/cstdbool deleted file mode 100644 index 3d0df32..0000000 --- a/openflow/usr/include/c++/5/cstdbool +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/cstdbool - * This is a Standard C++ Library header. - */ - -#pragma GCC system_header - -#ifndef _GLIBCXX_CSTDBOOL -#define _GLIBCXX_CSTDBOOL 1 - -#if __cplusplus < 201103L -# include -#else -# include -# if _GLIBCXX_HAVE_STDBOOL_H -# include -# endif -#endif - -#endif - diff --git a/openflow/usr/include/c++/5/cstddef b/openflow/usr/include/c++/5/cstddef deleted file mode 100644 index 33f4f8f..0000000 --- a/openflow/usr/include/c++/5/cstddef +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file cstddef - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c stddef.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 18.1 Types -// - -#ifndef _GLIBCXX_CSTDDEF -#define _GLIBCXX_CSTDDEF 1 - -#pragma GCC system_header - -#include -#include - -#if __cplusplus >= 201103L -namespace std -{ - // We handle size_t, ptrdiff_t, and nullptr_t in c++config.h. - using ::max_align_t; -} -#endif - -#endif // _GLIBCXX_CSTDDEF diff --git a/openflow/usr/include/c++/5/cstdint b/openflow/usr/include/c++/5/cstdint deleted file mode 100644 index 4e226a1..0000000 --- a/openflow/usr/include/c++/5/cstdint +++ /dev/null @@ -1,89 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/cstdint - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_CSTDINT -#define _GLIBCXX_CSTDINT 1 - -#pragma GCC system_header - -#if __cplusplus < 201103L -# include -#else - -#include - -#if _GLIBCXX_HAVE_STDINT_H -# include -#endif - -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - -namespace std -{ - using ::int8_t; - using ::int16_t; - using ::int32_t; - using ::int64_t; - - using ::int_fast8_t; - using ::int_fast16_t; - using ::int_fast32_t; - using ::int_fast64_t; - - using ::int_least8_t; - using ::int_least16_t; - using ::int_least32_t; - using ::int_least64_t; - - using ::intmax_t; - using ::intptr_t; - - using ::uint8_t; - using ::uint16_t; - using ::uint32_t; - using ::uint64_t; - - using ::uint_fast8_t; - using ::uint_fast16_t; - using ::uint_fast32_t; - using ::uint_fast64_t; - - using ::uint_least8_t; - using ::uint_least16_t; - using ::uint_least32_t; - using ::uint_least64_t; - - using ::uintmax_t; - using ::uintptr_t; -} // namespace std - -#endif // _GLIBCXX_USE_C99_STDINT_TR1 - -#endif // C++11 - -#endif // _GLIBCXX_CSTDINT diff --git a/openflow/usr/include/c++/5/cstdio b/openflow/usr/include/c++/5/cstdio deleted file mode 100644 index d1c958b..0000000 --- a/openflow/usr/include/c++/5/cstdio +++ /dev/null @@ -1,194 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/cstdio - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c stdio.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 27.8.2 C Library files -// - -#pragma GCC system_header - -#include -#include - -#ifndef _GLIBCXX_CSTDIO -#define _GLIBCXX_CSTDIO 1 - -#ifndef _GLIBCXX_HAVE_GETS -extern "C" char* gets (char* __s) __attribute__((__deprecated__)); -#endif - -// Get rid of those macros defined in in lieu of real functions. -#undef clearerr -#undef fclose -#undef feof -#undef ferror -#undef fflush -#undef fgetc -#undef fgetpos -#undef fgets -#undef fopen -#undef fprintf -#undef fputc -#undef fputs -#undef fread -#undef freopen -#undef fscanf -#undef fseek -#undef fsetpos -#undef ftell -#undef fwrite -#undef getc -#undef getchar -#if __cplusplus <= 201103L -# undef gets -#endif -#undef perror -#undef printf -#undef putc -#undef putchar -#undef puts -#undef remove -#undef rename -#undef rewind -#undef scanf -#undef setbuf -#undef setvbuf -#undef sprintf -#undef sscanf -#undef tmpfile -#undef tmpnam -#undef ungetc -#undef vfprintf -#undef vprintf -#undef vsprintf - -namespace std -{ - using ::FILE; - using ::fpos_t; - - using ::clearerr; - using ::fclose; - using ::feof; - using ::ferror; - using ::fflush; - using ::fgetc; - using ::fgetpos; - using ::fgets; - using ::fopen; - using ::fprintf; - using ::fputc; - using ::fputs; - using ::fread; - using ::freopen; - using ::fscanf; - using ::fseek; - using ::fsetpos; - using ::ftell; - using ::fwrite; - using ::getc; - using ::getchar; -#if __cplusplus <= 201103L - // LWG 2249 - using ::gets; -#endif - using ::perror; - using ::printf; - using ::putc; - using ::putchar; - using ::puts; - using ::remove; - using ::rename; - using ::rewind; - using ::scanf; - using ::setbuf; - using ::setvbuf; - using ::sprintf; - using ::sscanf; - using ::tmpfile; -#if _GLIBCXX_USE_TMPNAM - using ::tmpnam; -#endif - using ::ungetc; - using ::vfprintf; - using ::vprintf; - using ::vsprintf; -} // namespace - -#if _GLIBCXX_USE_C99 - -#undef snprintf -#undef vfscanf -#undef vscanf -#undef vsnprintf -#undef vsscanf - -namespace __gnu_cxx -{ -#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC - extern "C" int - (snprintf)(char * __restrict, std::size_t, const char * __restrict, ...) - throw (); - extern "C" int - (vfscanf)(FILE * __restrict, const char * __restrict, __gnuc_va_list); - extern "C" int (vscanf)(const char * __restrict, __gnuc_va_list); - extern "C" int - (vsnprintf)(char * __restrict, std::size_t, const char * __restrict, - __gnuc_va_list) throw (); - extern "C" int - (vsscanf)(const char * __restrict, const char * __restrict, __gnuc_va_list) - throw (); -#endif - -#if !_GLIBCXX_USE_C99_DYNAMIC - using ::snprintf; - using ::vfscanf; - using ::vscanf; - using ::vsnprintf; - using ::vsscanf; -#endif -} // namespace __gnu_cxx - -namespace std -{ - using ::__gnu_cxx::snprintf; - using ::__gnu_cxx::vfscanf; - using ::__gnu_cxx::vscanf; - using ::__gnu_cxx::vsnprintf; - using ::__gnu_cxx::vsscanf; -} // namespace std - -#endif // _GLIBCXX_USE_C99 - -#endif diff --git a/openflow/usr/include/c++/5/cstdlib b/openflow/usr/include/c++/5/cstdlib deleted file mode 100644 index 7e9bb30..0000000 --- a/openflow/usr/include/c++/5/cstdlib +++ /dev/null @@ -1,273 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/cstdlib - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c stdlib.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.4.6 C library -// - -#pragma GCC system_header - -#include - -#ifndef _GLIBCXX_CSTDLIB -#define _GLIBCXX_CSTDLIB 1 - -#if !_GLIBCXX_HOSTED -// The C standard does not require a freestanding implementation to -// provide . However, the C++ standard does still require -// -- but only the functionality mentioned in -// [lib.support.start.term]. - -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 - -namespace std -{ - extern "C" void abort(void) throw () _GLIBCXX_NORETURN; - extern "C" int atexit(void (*)(void)) throw (); - extern "C" void exit(int) throw () _GLIBCXX_NORETURN; -#if __cplusplus >= 201103L -# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT - extern "C" int at_quick_exit(void (*)(void)) throw (); -# endif -# ifdef _GLIBCXX_HAVE_QUICK_EXIT - extern "C" void quick_exit(int) throw() _GLIBCXX_NORETURN; -# endif -#endif -} // namespace std - -#else - -#include - -// Get rid of those macros defined in in lieu of real functions. -#undef abort -#undef abs -#undef atexit -#if __cplusplus >= 201103L -# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT -# undef at_quick_exit -# endif -#endif -#undef atof -#undef atoi -#undef atol -#undef bsearch -#undef calloc -#undef div -#undef exit -#undef free -#undef getenv -#undef labs -#undef ldiv -#undef malloc -#undef mblen -#undef mbstowcs -#undef mbtowc -#undef qsort -#if __cplusplus >= 201103L -# ifdef _GLIBCXX_HAVE_QUICK_EXIT -# undef quick_exit -# endif -#endif -#undef rand -#undef realloc -#undef srand -#undef strtod -#undef strtol -#undef strtoul -#undef system -#undef wcstombs -#undef wctomb - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using ::div_t; - using ::ldiv_t; - - using ::abort; - using ::abs; - using ::atexit; -#if __cplusplus >= 201103L -# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT - using ::at_quick_exit; -# endif -#endif - using ::atof; - using ::atoi; - using ::atol; - using ::bsearch; - using ::calloc; - using ::div; - using ::exit; - using ::free; - using ::getenv; - using ::labs; - using ::ldiv; - using ::malloc; -#ifdef _GLIBCXX_HAVE_MBSTATE_T - using ::mblen; - using ::mbstowcs; - using ::mbtowc; -#endif // _GLIBCXX_HAVE_MBSTATE_T - using ::qsort; -#if __cplusplus >= 201103L -# ifdef _GLIBCXX_HAVE_QUICK_EXIT - using ::quick_exit; -# endif -#endif - using ::rand; - using ::realloc; - using ::srand; - using ::strtod; - using ::strtol; - using ::strtoul; - using ::system; -#ifdef _GLIBCXX_USE_WCHAR_T - using ::wcstombs; - using ::wctomb; -#endif // _GLIBCXX_USE_WCHAR_T - -#ifndef __CORRECT_ISO_CPP_STDLIB_H_PROTO - inline long - abs(long __i) { return __builtin_labs(__i); } - - inline ldiv_t - div(long __i, long __j) { return ldiv(__i, __j); } -#endif - -#ifdef _GLIBCXX_USE_LONG_LONG - inline long long - abs(long long __x) { return __builtin_llabs (__x); } -#endif - -#if defined(__GLIBCXX_TYPE_INT_N_0) - inline __GLIBCXX_TYPE_INT_N_0 - abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } -#endif -#if defined(__GLIBCXX_TYPE_INT_N_1) - inline __GLIBCXX_TYPE_INT_N_1 - abs(__GLIBCXX_TYPE_INT_N_1 __x) { return __x >= 0 ? __x : -__x; } -#endif -#if defined(__GLIBCXX_TYPE_INT_N_2) - inline __GLIBCXX_TYPE_INT_N_2 - abs(__GLIBCXX_TYPE_INT_N_2 __x) { return __x >= 0 ? __x : -__x; } -#endif -#if defined(__GLIBCXX_TYPE_INT_N_3) - inline __GLIBCXX_TYPE_INT_N_3 - abs(__GLIBCXX_TYPE_INT_N_3 __x) { return __x >= 0 ? __x : -__x; } -#endif - - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#if _GLIBCXX_USE_C99 - -#undef _Exit -#undef llabs -#undef lldiv -#undef atoll -#undef strtoll -#undef strtoull -#undef strtof -#undef strtold - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using ::lldiv_t; -#endif -#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC - extern "C" void (_Exit)(int) throw () _GLIBCXX_NORETURN; -#endif -#if !_GLIBCXX_USE_C99_DYNAMIC - using ::_Exit; -#endif - -#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using ::llabs; - - inline lldiv_t - div(long long __n, long long __d) - { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; } - - using ::lldiv; -#endif - -#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - extern "C" long long int (atoll)(const char *) throw (); - extern "C" long long int - (strtoll)(const char * __restrict, char ** __restrict, int) throw (); - extern "C" unsigned long long int - (strtoull)(const char * __restrict, char ** __restrict, int) throw (); -#endif -#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using ::atoll; - using ::strtoll; - using ::strtoull; -#endif - using ::strtof; - using ::strtold; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace __gnu_cxx - -namespace std -{ -#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using ::__gnu_cxx::lldiv_t; -#endif - using ::__gnu_cxx::_Exit; -#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using ::__gnu_cxx::llabs; - using ::__gnu_cxx::div; - using ::__gnu_cxx::lldiv; -#endif - using ::__gnu_cxx::atoll; - using ::__gnu_cxx::strtof; - using ::__gnu_cxx::strtoll; - using ::__gnu_cxx::strtoull; - using ::__gnu_cxx::strtold; -} // namespace std - -#endif // _GLIBCXX_USE_C99 - -#endif // !_GLIBCXX_HOSTED - -#endif diff --git a/openflow/usr/include/c++/5/cstring b/openflow/usr/include/c++/5/cstring deleted file mode 100644 index cd6fe5a..0000000 --- a/openflow/usr/include/c++/5/cstring +++ /dev/null @@ -1,123 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file cstring - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c string.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.4.6 C library -// - -#pragma GCC system_header - -#include -#include - -#ifndef _GLIBCXX_CSTRING -#define _GLIBCXX_CSTRING 1 - -// Get rid of those macros defined in in lieu of real functions. -#undef memchr -#undef memcmp -#undef memcpy -#undef memmove -#undef memset -#undef strcat -#undef strchr -#undef strcmp -#undef strcoll -#undef strcpy -#undef strcspn -#undef strerror -#undef strlen -#undef strncat -#undef strncmp -#undef strncpy -#undef strpbrk -#undef strrchr -#undef strspn -#undef strstr -#undef strtok -#undef strxfrm - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using ::memchr; - using ::memcmp; - using ::memcpy; - using ::memmove; - using ::memset; - using ::strcat; - using ::strcmp; - using ::strcoll; - using ::strcpy; - using ::strcspn; - using ::strerror; - using ::strlen; - using ::strncat; - using ::strncmp; - using ::strncpy; - using ::strspn; - using ::strtok; - using ::strxfrm; - using ::strchr; - using ::strpbrk; - using ::strrchr; - using ::strstr; - -#ifndef __CORRECT_ISO_CPP_STRING_H_PROTO - inline void* - memchr(void* __s, int __c, size_t __n) - { return __builtin_memchr(__s, __c, __n); } - - inline char* - strchr(char* __s, int __n) - { return __builtin_strchr(__s, __n); } - - inline char* - strpbrk(char* __s1, const char* __s2) - { return __builtin_strpbrk(__s1, __s2); } - - inline char* - strrchr(char* __s, int __n) - { return __builtin_strrchr(__s, __n); } - - inline char* - strstr(char* __s1, const char* __s2) - { return __builtin_strstr(__s1, __s2); } -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/ctgmath b/openflow/usr/include/c++/5/ctgmath deleted file mode 100644 index e89d1fc..0000000 --- a/openflow/usr/include/c++/5/ctgmath +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2007-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/ctgmath - * This is a Standard C++ Library header. - */ - -#pragma GCC system_header - -#ifndef _GLIBCXX_CTGMATH -#define _GLIBCXX_CTGMATH 1 - -#if __cplusplus < 201103L -# include -#else -# include -# include -#endif - -#endif - diff --git a/openflow/usr/include/c++/5/ctime b/openflow/usr/include/c++/5/ctime deleted file mode 100644 index bc5b0db..0000000 --- a/openflow/usr/include/c++/5/ctime +++ /dev/null @@ -1,75 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/ctime - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c time.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.5 Date and time -// - -#pragma GCC system_header - -#include -#include - -#ifndef _GLIBCXX_CTIME -#define _GLIBCXX_CTIME 1 - -// Get rid of those macros defined in in lieu of real functions. -#undef clock -#undef difftime -#undef mktime -#undef time -#undef asctime -#undef ctime -#undef gmtime -#undef localtime -#undef strftime - -namespace std -{ - using ::clock_t; - using ::time_t; - using ::tm; - - using ::clock; - using ::difftime; - using ::mktime; - using ::time; - using ::asctime; - using ::ctime; - using ::gmtime; - using ::localtime; - using ::strftime; -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/cwchar b/openflow/usr/include/c++/5/cwchar deleted file mode 100644 index dddb409..0000000 --- a/openflow/usr/include/c++/5/cwchar +++ /dev/null @@ -1,303 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/cwchar - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c wchar.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 21.4 -// - -#pragma GCC system_header - -#include - -#if _GLIBCXX_HAVE_WCHAR_H -#include -#endif - -#ifndef _GLIBCXX_CWCHAR -#define _GLIBCXX_CWCHAR 1 - -// Need to do a bit of trickery here with mbstate_t as char_traits -// assumes it is in wchar.h, regardless of wchar_t specializations. -#ifndef _GLIBCXX_HAVE_MBSTATE_T -extern "C" -{ - typedef struct - { - int __fill[6]; - } mbstate_t; -} -#endif - -namespace std -{ - using ::mbstate_t; -} // namespace std - -// Get rid of those macros defined in in lieu of real functions. -#undef btowc -#undef fgetwc -#undef fgetws -#undef fputwc -#undef fputws -#undef fwide -#undef fwprintf -#undef fwscanf -#undef getwc -#undef getwchar -#undef mbrlen -#undef mbrtowc -#undef mbsinit -#undef mbsrtowcs -#undef putwc -#undef putwchar -#undef swprintf -#undef swscanf -#undef ungetwc -#undef vfwprintf -#if _GLIBCXX_HAVE_VFWSCANF -# undef vfwscanf -#endif -#undef vswprintf -#if _GLIBCXX_HAVE_VSWSCANF -# undef vswscanf -#endif -#undef vwprintf -#if _GLIBCXX_HAVE_VWSCANF -# undef vwscanf -#endif -#undef wcrtomb -#undef wcscat -#undef wcschr -#undef wcscmp -#undef wcscoll -#undef wcscpy -#undef wcscspn -#undef wcsftime -#undef wcslen -#undef wcsncat -#undef wcsncmp -#undef wcsncpy -#undef wcspbrk -#undef wcsrchr -#undef wcsrtombs -#undef wcsspn -#undef wcsstr -#undef wcstod -#if _GLIBCXX_HAVE_WCSTOF -# undef wcstof -#endif -#undef wcstok -#undef wcstol -#undef wcstoul -#undef wcsxfrm -#undef wctob -#undef wmemchr -#undef wmemcmp -#undef wmemcpy -#undef wmemmove -#undef wmemset -#undef wprintf -#undef wscanf - -#if _GLIBCXX_USE_WCHAR_T - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using ::wint_t; - - using ::btowc; - using ::fgetwc; - using ::fgetws; - using ::fputwc; - using ::fputws; - using ::fwide; - using ::fwprintf; - using ::fwscanf; - using ::getwc; - using ::getwchar; - using ::mbrlen; - using ::mbrtowc; - using ::mbsinit; - using ::mbsrtowcs; - using ::putwc; - using ::putwchar; -#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF - using ::swprintf; -#endif - using ::swscanf; - using ::ungetwc; - using ::vfwprintf; -#if _GLIBCXX_HAVE_VFWSCANF - using ::vfwscanf; -#endif -#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF - using ::vswprintf; -#endif -#if _GLIBCXX_HAVE_VSWSCANF - using ::vswscanf; -#endif - using ::vwprintf; -#if _GLIBCXX_HAVE_VWSCANF - using ::vwscanf; -#endif - using ::wcrtomb; - using ::wcscat; - using ::wcscmp; - using ::wcscoll; - using ::wcscpy; - using ::wcscspn; - using ::wcsftime; - using ::wcslen; - using ::wcsncat; - using ::wcsncmp; - using ::wcsncpy; - using ::wcsrtombs; - using ::wcsspn; - using ::wcstod; -#if _GLIBCXX_HAVE_WCSTOF - using ::wcstof; -#endif - using ::wcstok; - using ::wcstol; - using ::wcstoul; - using ::wcsxfrm; - using ::wctob; - using ::wmemcmp; - using ::wmemcpy; - using ::wmemmove; - using ::wmemset; - using ::wprintf; - using ::wscanf; - using ::wcschr; - using ::wcspbrk; - using ::wcsrchr; - using ::wcsstr; - using ::wmemchr; - -#ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO - inline wchar_t* - wcschr(wchar_t* __p, wchar_t __c) - { return wcschr(const_cast(__p), __c); } - - inline wchar_t* - wcspbrk(wchar_t* __s1, const wchar_t* __s2) - { return wcspbrk(const_cast(__s1), __s2); } - - inline wchar_t* - wcsrchr(wchar_t* __p, wchar_t __c) - { return wcsrchr(const_cast(__p), __c); } - - inline wchar_t* - wcsstr(wchar_t* __s1, const wchar_t* __s2) - { return wcsstr(const_cast(__s1), __s2); } - - inline wchar_t* - wmemchr(wchar_t* __p, wchar_t __c, size_t __n) - { return wmemchr(const_cast(__p), __c, __n); } -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#if _GLIBCXX_USE_C99 - -#undef wcstold -#undef wcstoll -#undef wcstoull - -namespace __gnu_cxx -{ -#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC - extern "C" long double - (wcstold)(const wchar_t * __restrict, wchar_t ** __restrict) throw (); -#endif -#if !_GLIBCXX_USE_C99_DYNAMIC - using ::wcstold; -#endif -#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - extern "C" long long int - (wcstoll)(const wchar_t * __restrict, wchar_t ** __restrict, int) throw (); - extern "C" unsigned long long int - (wcstoull)(const wchar_t * __restrict, wchar_t ** __restrict, int) throw (); -#endif -#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using ::wcstoll; - using ::wcstoull; -#endif -} // namespace __gnu_cxx - -namespace std -{ - using ::__gnu_cxx::wcstold; - using ::__gnu_cxx::wcstoll; - using ::__gnu_cxx::wcstoull; -} // namespace - -#endif - -#endif //_GLIBCXX_USE_WCHAR_T - -#if __cplusplus >= 201103L - -#ifdef _GLIBCXX_USE_WCHAR_T - -namespace std -{ -#if _GLIBCXX_HAVE_WCSTOF - using std::wcstof; -#endif -#if _GLIBCXX_HAVE_VFWSCANF - using std::vfwscanf; -#endif -#if _GLIBCXX_HAVE_VSWSCANF - using std::vswscanf; -#endif -#if _GLIBCXX_HAVE_VWSCANF - using std::vwscanf; -#endif - -#if _GLIBCXX_USE_C99 - using std::wcstold; - using std::wcstoll; - using std::wcstoull; -#endif -} // namespace - -#endif // _GLIBCXX_USE_WCHAR_T - -#endif // C++11 - -#endif diff --git a/openflow/usr/include/c++/5/cwctype b/openflow/usr/include/c++/5/cwctype deleted file mode 100644 index 444bc12..0000000 --- a/openflow/usr/include/c++/5/cwctype +++ /dev/null @@ -1,110 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file include/cwctype - * This is a Standard C++ Library file. You should @c \#include this file - * in your programs, rather than any of the @a *.h implementation files. - * - * This is the C++ version of the Standard C Library header @c wctype.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: -// - -#pragma GCC system_header - -#include - -#if _GLIBCXX_HAVE_WCTYPE_H - -#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 10 -// Work around glibc BZ 9694 -#include -#endif - -#include -#endif // _GLIBCXX_HAVE_WCTYPE_H - -#ifndef _GLIBCXX_CWCTYPE -#define _GLIBCXX_CWCTYPE 1 - -// Get rid of those macros defined in in lieu of real functions. -#undef iswalnum -#undef iswalpha -#if _GLIBCXX_HAVE_ISWBLANK -# undef iswblank -#endif -#undef iswcntrl -#undef iswctype -#undef iswdigit -#undef iswgraph -#undef iswlower -#undef iswprint -#undef iswpunct -#undef iswspace -#undef iswupper -#undef iswxdigit -#undef towctrans -#undef towlower -#undef towupper -#undef wctrans -#undef wctype - -#if _GLIBCXX_USE_WCHAR_T - -namespace std -{ - using ::wctrans_t; - using ::wctype_t; - using ::wint_t; - - using ::iswalnum; - using ::iswalpha; -#if _GLIBCXX_HAVE_ISWBLANK - using ::iswblank; -#endif - using ::iswcntrl; - using ::iswctype; - using ::iswdigit; - using ::iswgraph; - using ::iswlower; - using ::iswprint; - using ::iswpunct; - using ::iswspace; - using ::iswupper; - using ::iswxdigit; - using ::towctrans; - using ::towlower; - using ::towupper; - using ::wctrans; - using ::wctype; -} // namespace - -#endif //_GLIBCXX_USE_WCHAR_T - -#endif // _GLIBCXX_CWCTYPE diff --git a/openflow/usr/include/c++/5/cxxabi.h b/openflow/usr/include/c++/5/cxxabi.h deleted file mode 100644 index 571e42e..0000000 --- a/openflow/usr/include/c++/5/cxxabi.h +++ /dev/null @@ -1,710 +0,0 @@ -// ABI Support -*- C++ -*- - -// Copyright (C) 2000-2015 Free Software Foundation, Inc. -// -// This file is part of GCC. -// -// GCC is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// GCC is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -// Written by Nathan Sidwell, Codesourcery LLC, - -/* This file declares the new abi entry points into the runtime. It is not - normally necessary for user programs to include this header, or use the - entry points directly. However, this header is available should that be - needed. - - Some of the entry points are intended for both C and C++, thus this header - is includable from both C and C++. Though the C++ specific parts are not - available in C, naturally enough. */ - -/** @file cxxabi.h - * The header provides an interface to the C++ ABI. - */ - -#ifndef _CXXABI_H -#define _CXXABI_H 1 - -#pragma GCC system_header - -#pragma GCC visibility push(default) - -#include -#include -#include -#include - -#ifndef _GLIBCXX_CDTOR_CALLABI -#define _GLIBCXX_CDTOR_CALLABI -#endif - -#ifdef __cplusplus -namespace __cxxabiv1 -{ - extern "C" - { -#endif - - typedef __cxa_cdtor_return_type (*__cxa_cdtor_type)(void *); - - // Allocate array. - void* - __cxa_vec_new(size_t __element_count, size_t __element_size, - size_t __padding_size, __cxa_cdtor_type __constructor, - __cxa_cdtor_type __destructor); - - void* - __cxa_vec_new2(size_t __element_count, size_t __element_size, - size_t __padding_size, __cxa_cdtor_type __constructor, - __cxa_cdtor_type __destructor, void *(*__alloc) (size_t), - void (*__dealloc) (void*)); - - void* - __cxa_vec_new3(size_t __element_count, size_t __element_size, - size_t __padding_size, __cxa_cdtor_type __constructor, - __cxa_cdtor_type __destructor, void *(*__alloc) (size_t), - void (*__dealloc) (void*, size_t)); - - // Construct array. - __cxa_vec_ctor_return_type - __cxa_vec_ctor(void* __array_address, size_t __element_count, - size_t __element_size, __cxa_cdtor_type __constructor, - __cxa_cdtor_type __destructor); - - __cxa_vec_ctor_return_type - __cxa_vec_cctor(void* __dest_array, void* __src_array, - size_t __element_count, size_t __element_size, - __cxa_cdtor_return_type (*__constructor) (void*, void*), - __cxa_cdtor_type __destructor); - - // Destruct array. - void - __cxa_vec_dtor(void* __array_address, size_t __element_count, - size_t __element_size, __cxa_cdtor_type __destructor); - - void - __cxa_vec_cleanup(void* __array_address, size_t __element_count, size_t __s, - __cxa_cdtor_type __destructor) _GLIBCXX_NOTHROW; - - // Destruct and release array. - void - __cxa_vec_delete(void* __array_address, size_t __element_size, - size_t __padding_size, __cxa_cdtor_type __destructor); - - void - __cxa_vec_delete2(void* __array_address, size_t __element_size, - size_t __padding_size, __cxa_cdtor_type __destructor, - void (*__dealloc) (void*)); - - void - __cxa_vec_delete3(void* __array_address, size_t __element_size, - size_t __padding_size, __cxa_cdtor_type __destructor, - void (*__dealloc) (void*, size_t)); - - int - __cxa_guard_acquire(__guard*); - - void - __cxa_guard_release(__guard*) _GLIBCXX_NOTHROW; - - void - __cxa_guard_abort(__guard*) _GLIBCXX_NOTHROW; - - // DSO destruction. - int - __cxa_atexit(void (*)(void*), void*, void*) _GLIBCXX_NOTHROW; - - int - __cxa_finalize(void*); - - // TLS destruction. - int - __cxa_thread_atexit(void (*)(void*), void*, void *) _GLIBCXX_NOTHROW; - - // Pure virtual functions. - void - __cxa_pure_virtual(void) __attribute__ ((__noreturn__)); - - void - __cxa_deleted_virtual(void) __attribute__ ((__noreturn__)); - - // Exception handling auxiliary. - void - __cxa_bad_cast() __attribute__((__noreturn__)); - - void - __cxa_bad_typeid() __attribute__((__noreturn__)); - - void - __cxa_throw_bad_array_new_length() __attribute__((__noreturn__)); - - /** - * @brief Demangling routine. - * ABI-mandated entry point in the C++ runtime library for demangling. - * - * @param __mangled_name A NUL-terminated character string - * containing the name to be demangled. - * - * @param __output_buffer A region of memory, allocated with - * malloc, of @a *__length bytes, into which the demangled name is - * stored. If @a __output_buffer is not long enough, it is - * expanded using realloc. @a __output_buffer may instead be NULL; - * in that case, the demangled name is placed in a region of memory - * allocated with malloc. - * - * @param __length If @a __length is non-NULL, the length of the - * buffer containing the demangled name is placed in @a *__length. - * - * @param __status @a *__status is set to one of the following values: - * 0: The demangling operation succeeded. - * -1: A memory allocation failure occurred. - * -2: @a mangled_name is not a valid name under the C++ ABI mangling rules. - * -3: One of the arguments is invalid. - * - * @return A pointer to the start of the NUL-terminated demangled - * name, or NULL if the demangling fails. The caller is - * responsible for deallocating this memory using @c free. - * - * The demangling is performed using the C++ ABI mangling rules, - * with GNU extensions. For example, this function is used in - * __gnu_cxx::__verbose_terminate_handler. - * - * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch39.html - * for other examples of use. - * - * @note The same demangling functionality is available via - * libiberty (@c and @c libiberty.a) in GCC - * 3.1 and later, but that requires explicit installation (@c - * --enable-install-libiberty) and uses a different API, although - * the ABI is unchanged. - */ - char* - __cxa_demangle(const char* __mangled_name, char* __output_buffer, - size_t* __length, int* __status); - -#ifdef __cplusplus - } -} // namespace __cxxabiv1 -#endif - -#ifdef __cplusplus - -#include - -namespace __cxxabiv1 -{ - // Type information for int, float etc. - class __fundamental_type_info : public std::type_info - { - public: - explicit - __fundamental_type_info(const char* __n) : std::type_info(__n) { } - - virtual - ~__fundamental_type_info(); - }; - - // Type information for array objects. - class __array_type_info : public std::type_info - { - public: - explicit - __array_type_info(const char* __n) : std::type_info(__n) { } - - virtual - ~__array_type_info(); - }; - - // Type information for functions (both member and non-member). - class __function_type_info : public std::type_info - { - public: - explicit - __function_type_info(const char* __n) : std::type_info(__n) { } - - virtual - ~__function_type_info(); - - protected: - // Implementation defined member function. - virtual bool - __is_function_p() const; - }; - - // Type information for enumerations. - class __enum_type_info : public std::type_info - { - public: - explicit - __enum_type_info(const char* __n) : std::type_info(__n) { } - - virtual - ~__enum_type_info(); - }; - - // Common type information for simple pointers and pointers to member. - class __pbase_type_info : public std::type_info - { - public: - unsigned int __flags; // Qualification of the target object. - const std::type_info* __pointee; // Type of pointed to object. - - explicit - __pbase_type_info(const char* __n, int __quals, - const std::type_info* __type) - : std::type_info(__n), __flags(__quals), __pointee(__type) - { } - - virtual - ~__pbase_type_info(); - - // Implementation defined type. - enum __masks - { - __const_mask = 0x1, - __volatile_mask = 0x2, - __restrict_mask = 0x4, - __incomplete_mask = 0x8, - __incomplete_class_mask = 0x10 - }; - - protected: - __pbase_type_info(const __pbase_type_info&); - - __pbase_type_info& - operator=(const __pbase_type_info&); - - // Implementation defined member functions. - virtual bool - __do_catch(const std::type_info* __thr_type, void** __thr_obj, - unsigned int __outer) const; - - inline virtual bool - __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj, - unsigned __outer) const; - }; - - inline bool __pbase_type_info:: - __pointer_catch (const __pbase_type_info *thrown_type, - void **thr_obj, - unsigned outer) const - { - return __pointee->__do_catch (thrown_type->__pointee, thr_obj, outer + 2); - } - - // Type information for simple pointers. - class __pointer_type_info : public __pbase_type_info - { - public: - explicit - __pointer_type_info(const char* __n, int __quals, - const std::type_info* __type) - : __pbase_type_info (__n, __quals, __type) { } - - - virtual - ~__pointer_type_info(); - - protected: - // Implementation defined member functions. - virtual bool - __is_pointer_p() const; - - virtual bool - __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj, - unsigned __outer) const; - }; - - class __class_type_info; - - // Type information for a pointer to member variable. - class __pointer_to_member_type_info : public __pbase_type_info - { - public: - __class_type_info* __context; // Class of the member. - - explicit - __pointer_to_member_type_info(const char* __n, int __quals, - const std::type_info* __type, - __class_type_info* __klass) - : __pbase_type_info(__n, __quals, __type), __context(__klass) { } - - virtual - ~__pointer_to_member_type_info(); - - protected: - __pointer_to_member_type_info(const __pointer_to_member_type_info&); - - __pointer_to_member_type_info& - operator=(const __pointer_to_member_type_info&); - - // Implementation defined member function. - virtual bool - __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj, - unsigned __outer) const; - }; - - // Helper class for __vmi_class_type. - class __base_class_type_info - { - public: - const __class_type_info* __base_type; // Base class type. -#ifdef _GLIBCXX_LLP64 - long long __offset_flags; // Offset and info. -#else - long __offset_flags; // Offset and info. -#endif - - enum __offset_flags_masks - { - __virtual_mask = 0x1, - __public_mask = 0x2, - __hwm_bit = 2, - __offset_shift = 8 // Bits to shift offset. - }; - - // Implementation defined member functions. - bool - __is_virtual_p() const - { return __offset_flags & __virtual_mask; } - - bool - __is_public_p() const - { return __offset_flags & __public_mask; } - - ptrdiff_t - __offset() const - { - // This shift, being of a signed type, is implementation - // defined. GCC implements such shifts as arithmetic, which is - // what we want. - return static_cast(__offset_flags) >> __offset_shift; - } - }; - - // Type information for a class. - class __class_type_info : public std::type_info - { - public: - explicit - __class_type_info (const char *__n) : type_info(__n) { } - - virtual - ~__class_type_info (); - - // Implementation defined types. - // The type sub_kind tells us about how a base object is contained - // within a derived object. We often do this lazily, hence the - // UNKNOWN value. At other times we may use NOT_CONTAINED to mean - // not publicly contained. - enum __sub_kind - { - // We have no idea. - __unknown = 0, - - // Not contained within us (in some circumstances this might - // mean not contained publicly) - __not_contained, - - // Contained ambiguously. - __contained_ambig, - - // Via a virtual path. - __contained_virtual_mask = __base_class_type_info::__virtual_mask, - - // Via a public path. - __contained_public_mask = __base_class_type_info::__public_mask, - - // Contained within us. - __contained_mask = 1 << __base_class_type_info::__hwm_bit, - - __contained_private = __contained_mask, - __contained_public = __contained_mask | __contained_public_mask - }; - - struct __upcast_result; - struct __dyncast_result; - - protected: - // Implementation defined member functions. - virtual bool - __do_upcast(const __class_type_info* __dst_type, void**__obj_ptr) const; - - virtual bool - __do_catch(const type_info* __thr_type, void** __thr_obj, - unsigned __outer) const; - - public: - // Helper for upcast. See if DST is us, or one of our bases. - // Return false if not found, true if found. - virtual bool - __do_upcast(const __class_type_info* __dst, const void* __obj, - __upcast_result& __restrict __result) const; - - // Indicate whether SRC_PTR of type SRC_TYPE is contained publicly - // within OBJ_PTR. OBJ_PTR points to a base object of our type, - // which is the destination type. SRC2DST indicates how SRC - // objects might be contained within this type. If SRC_PTR is one - // of our SRC_TYPE bases, indicate the virtuality. Returns - // not_contained for non containment or private containment. - inline __sub_kind - __find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr, - const __class_type_info* __src_type, - const void* __src_ptr) const; - - // Helper for dynamic cast. ACCESS_PATH gives the access from the - // most derived object to this base. DST_TYPE indicates the - // desired type we want. OBJ_PTR points to a base of our type - // within the complete object. SRC_TYPE indicates the static type - // started from and SRC_PTR points to that base within the most - // derived object. Fill in RESULT with what we find. Return true - // if we have located an ambiguous match. - virtual bool - __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path, - const __class_type_info* __dst_type, const void* __obj_ptr, - const __class_type_info* __src_type, const void* __src_ptr, - __dyncast_result& __result) const; - - // Helper for find_public_subobj. SRC2DST indicates how SRC_TYPE - // bases are inherited by the type started from -- which is not - // necessarily the current type. The current type will be a base - // of the destination type. OBJ_PTR points to the current base. - virtual __sub_kind - __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr, - const __class_type_info* __src_type, - const void* __src_ptr) const; - }; - - // Type information for a class with a single non-virtual base. - class __si_class_type_info : public __class_type_info - { - public: - const __class_type_info* __base_type; - - explicit - __si_class_type_info(const char *__n, const __class_type_info *__base) - : __class_type_info(__n), __base_type(__base) { } - - virtual - ~__si_class_type_info(); - - protected: - __si_class_type_info(const __si_class_type_info&); - - __si_class_type_info& - operator=(const __si_class_type_info&); - - // Implementation defined member functions. - virtual bool - __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path, - const __class_type_info* __dst_type, const void* __obj_ptr, - const __class_type_info* __src_type, const void* __src_ptr, - __dyncast_result& __result) const; - - virtual __sub_kind - __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr, - const __class_type_info* __src_type, - const void* __sub_ptr) const; - - virtual bool - __do_upcast(const __class_type_info*__dst, const void*__obj, - __upcast_result& __restrict __result) const; - }; - - // Type information for a class with multiple and/or virtual bases. - class __vmi_class_type_info : public __class_type_info - { - public: - unsigned int __flags; // Details about the class hierarchy. - unsigned int __base_count; // Number of direct bases. - - // The array of bases uses the trailing array struct hack so this - // class is not constructable with a normal constructor. It is - // internally generated by the compiler. - __base_class_type_info __base_info[1]; // Array of bases. - - explicit - __vmi_class_type_info(const char* __n, int ___flags) - : __class_type_info(__n), __flags(___flags), __base_count(0) { } - - virtual - ~__vmi_class_type_info(); - - // Implementation defined types. - enum __flags_masks - { - __non_diamond_repeat_mask = 0x1, // Distinct instance of repeated base. - __diamond_shaped_mask = 0x2, // Diamond shaped multiple inheritance. - __flags_unknown_mask = 0x10 - }; - - protected: - // Implementation defined member functions. - virtual bool - __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path, - const __class_type_info* __dst_type, const void* __obj_ptr, - const __class_type_info* __src_type, const void* __src_ptr, - __dyncast_result& __result) const; - - virtual __sub_kind - __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr, - const __class_type_info* __src_type, - const void* __src_ptr) const; - - virtual bool - __do_upcast(const __class_type_info* __dst, const void* __obj, - __upcast_result& __restrict __result) const; - }; - - // Exception handling forward declarations. - struct __cxa_exception; - struct __cxa_refcounted_exception; - struct __cxa_dependent_exception; - struct __cxa_eh_globals; - - extern "C" - { - // Dynamic cast runtime. - - // src2dst has the following possible values - // >-1: src_type is a unique public non-virtual base of dst_type - // dst_ptr + src2dst == src_ptr - // -1: unspecified relationship - // -2: src_type is not a public base of dst_type - // -3: src_type is a multiple public non-virtual base of dst_type - void* - __dynamic_cast(const void* __src_ptr, // Starting object. - const __class_type_info* __src_type, // Static type of object. - const __class_type_info* __dst_type, // Desired target type. - ptrdiff_t __src2dst); // How src and dst are related. - - - // Exception handling runtime. - - // The __cxa_eh_globals for the current thread can be obtained by using - // either of the following functions. The "fast" version assumes at least - // one prior call of __cxa_get_globals has been made from the current - // thread, so no initialization is necessary. - __cxa_eh_globals* - __cxa_get_globals() _GLIBCXX_NOTHROW __attribute__ ((__const__)); - - __cxa_eh_globals* - __cxa_get_globals_fast() _GLIBCXX_NOTHROW __attribute__ ((__const__)); - - // Allocate memory for the primary exception plus the thrown object. - void* - __cxa_allocate_exception(size_t) _GLIBCXX_NOTHROW; - - // Free the space allocated for the primary exception. - void - __cxa_free_exception(void*) _GLIBCXX_NOTHROW; - - // Throw the exception. - void - __cxa_throw(void*, std::type_info*, void (_GLIBCXX_CDTOR_CALLABI *) (void *)) - __attribute__((__noreturn__)); - - // Used to implement exception handlers. - void* - __cxa_get_exception_ptr(void*) _GLIBCXX_NOTHROW __attribute__ ((__pure__)); - - void* - __cxa_begin_catch(void*) _GLIBCXX_NOTHROW; - - void - __cxa_end_catch(); - - void - __cxa_rethrow() __attribute__((__noreturn__)); - - // Returns the type_info for the currently handled exception [15.3/8], or - // null if there is none. - std::type_info* - __cxa_current_exception_type() _GLIBCXX_NOTHROW __attribute__ ((__pure__)); - - // GNU Extensions. - - // Allocate memory for a dependent exception. - __cxa_dependent_exception* - __cxa_allocate_dependent_exception() _GLIBCXX_NOTHROW; - - // Free the space allocated for the dependent exception. - void - __cxa_free_dependent_exception(__cxa_dependent_exception*) _GLIBCXX_NOTHROW; - - } // extern "C" - - // A magic placeholder class that can be caught by reference - // to recognize foreign exceptions. - class __foreign_exception - { - virtual ~__foreign_exception() throw(); - virtual void __pure_dummy() = 0; // prevent catch by value - }; - -} // namespace __cxxabiv1 - -/** @namespace abi - * @brief The cross-vendor C++ Application Binary Interface. A - * namespace alias to __cxxabiv1, but user programs should use the - * alias 'abi'. - * - * A brief overview of an ABI is given in the libstdc++ FAQ, question - * 5.8 (you may have a copy of the FAQ locally, or you can view the online - * version at http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#5_8 ). - * - * GCC subscribes to a cross-vendor ABI for C++, sometimes - * called the IA64 ABI because it happens to be the native ABI for that - * platform. It is summarized at http://www.codesourcery.com/cxx-abi/ - * along with the current specification. - * - * For users of GCC greater than or equal to 3.x, entry points are - * available in , which notes, 'It is not normally - * necessary for user programs to include this header, or use the - * entry points directly. However, this header is available should - * that be needed.' -*/ -namespace abi = __cxxabiv1; - -namespace __gnu_cxx -{ - /** - * @brief Exception thrown by __cxa_guard_acquire. - * @ingroup exceptions - * - * 6.7[stmt.dcl]/4: If control re-enters the declaration (recursively) - * while the object is being initialized, the behavior is undefined. - * - * Since we already have a library function to handle locking, we might - * as well check for this situation and throw an exception. - * We use the second byte of the guard variable to remember that we're - * in the middle of an initialization. - */ - class recursive_init_error: public std::exception - { - public: - recursive_init_error() throw() { } - virtual ~recursive_init_error() throw (); - }; -} -#endif // __cplusplus - -#pragma GCC visibility pop - -#endif // __CXXABI_H diff --git a/openflow/usr/include/c++/5/debug/array b/openflow/usr/include/c++/5/debug/array deleted file mode 100644 index 411e816..0000000 --- a/openflow/usr/include/c++/5/debug/array +++ /dev/null @@ -1,310 +0,0 @@ -// Debugging array implementation -*- C++ -*- - -// Copyright (C) 2012-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/array - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_DEBUG_ARRAY -#define _GLIBCXX_DEBUG_ARRAY 1 - -#pragma GCC system_header - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __debug -{ - template - struct array - { - typedef _Tp value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef value_type* iterator; - typedef const value_type* const_iterator; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - // Support for zero-sized arrays mandatory. - typedef _GLIBCXX_STD_C::__array_traits<_Tp, _Nm> _AT_Type; - typename _AT_Type::_Type _M_elems; - - template - struct _Array_check_subscript - { - std::size_t size() { return _Size; } - - _Array_check_subscript(std::size_t __index) - { __glibcxx_check_subscript(__index); } - }; - - template - struct _Array_check_nonempty - { - bool empty() { return _Size == 0; } - - _Array_check_nonempty() - { __glibcxx_check_nonempty(); } - }; - - // No explicit construct/copy/destroy for aggregate type. - - // DR 776. - void - fill(const value_type& __u) - { std::fill_n(begin(), size(), __u); } - - void - swap(array& __other) - noexcept(noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))) - { std::swap_ranges(begin(), end(), __other.begin()); } - - // Iterators. - iterator - begin() noexcept - { return iterator(data()); } - - const_iterator - begin() const noexcept - { return const_iterator(data()); } - - iterator - end() noexcept - { return iterator(data() + _Nm); } - - const_iterator - end() const noexcept - { return const_iterator(data() + _Nm); } - - reverse_iterator - rbegin() noexcept - { return reverse_iterator(end()); } - - const_reverse_iterator - rbegin() const noexcept - { return const_reverse_iterator(end()); } - - reverse_iterator - rend() noexcept - { return reverse_iterator(begin()); } - - const_reverse_iterator - rend() const noexcept - { return const_reverse_iterator(begin()); } - - const_iterator - cbegin() const noexcept - { return const_iterator(data()); } - - const_iterator - cend() const noexcept - { return const_iterator(data() + _Nm); } - - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(end()); } - - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(begin()); } - - // Capacity. - constexpr size_type - size() const noexcept { return _Nm; } - - constexpr size_type - max_size() const noexcept { return _Nm; } - - constexpr bool - empty() const noexcept { return size() == 0; } - - // Element access. - reference - operator[](size_type __n) noexcept - { - __glibcxx_check_subscript(__n); - return _AT_Type::_S_ref(_M_elems, __n); - } - - constexpr const_reference - operator[](size_type __n) const noexcept - { - return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n) - : (_GLIBCXX_THROW_OR_ABORT(_Array_check_subscript<_Nm>(__n)), - _AT_Type::_S_ref(_M_elems, 0)); - } - - reference - at(size_type __n) - { - if (__n >= _Nm) - std::__throw_out_of_range_fmt(__N("array::at: __n " - "(which is %zu) >= _Nm " - "(which is %zu)"), - __n, _Nm); - return _AT_Type::_S_ref(_M_elems, __n); - } - - constexpr const_reference - at(size_type __n) const - { - // Result of conditional expression must be an lvalue so use - // boolean ? lvalue : (throw-expr, lvalue) - return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n) - : (std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) " - ">= _Nm (which is %zu)"), - __n, _Nm), - _AT_Type::_S_ref(_M_elems, 0)); - } - - reference - front() noexcept - { - __glibcxx_check_nonempty(); - return *begin(); - } - - constexpr const_reference - front() const noexcept - { - return _Nm ? _AT_Type::_S_ref(_M_elems, 0) - : (_GLIBCXX_THROW_OR_ABORT(_Array_check_nonempty<_Nm>()), - _AT_Type::_S_ref(_M_elems, 0)); - } - - reference - back() noexcept - { - __glibcxx_check_nonempty(); - return _Nm ? *(end() - 1) : *end(); - } - - constexpr const_reference - back() const noexcept - { - return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1) - : (_GLIBCXX_THROW_OR_ABORT(_Array_check_nonempty<_Nm>()), - _AT_Type::_S_ref(_M_elems, 0)); - } - - pointer - data() noexcept - { return _AT_Type::_S_ptr(_M_elems); } - - const_pointer - data() const noexcept - { return _AT_Type::_S_ptr(_M_elems); } - }; - - // Array comparisons. - template - inline bool - operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) - { return std::equal(__one.begin(), __one.end(), __two.begin()); } - - template - inline bool - operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) - { return !(__one == __two); } - - template - inline bool - operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b) - { - return std::lexicographical_compare(__a.begin(), __a.end(), - __b.begin(), __b.end()); - } - - template - inline bool - operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) - { return __two < __one; } - - template - inline bool - operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) - { return !(__one > __two); } - - template - inline bool - operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) - { return !(__one < __two); } - - // Specialized algorithms. - template - inline void - swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two) - noexcept(noexcept(__one.swap(__two))) - { __one.swap(__two); } - - template - constexpr _Tp& - get(array<_Tp, _Nm>& __arr) noexcept - { - static_assert(_Int < _Nm, "index is out of bounds"); - return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: - _S_ref(__arr._M_elems, _Int); - } - - template - constexpr _Tp&& - get(array<_Tp, _Nm>&& __arr) noexcept - { - static_assert(_Int < _Nm, "index is out of bounds"); - return std::move(__debug::get<_Int>(__arr)); - } - - template - constexpr const _Tp& - get(const array<_Tp, _Nm>& __arr) noexcept - { - static_assert(_Int < _Nm, "index is out of bounds"); - return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: - _S_ref(__arr._M_elems, _Int); - } -} // namespace __debug - - // Tuple interface to class template array. - - /// tuple_size - template - struct tuple_size<__debug::array<_Tp, _Nm>> - : public integral_constant { }; - - /// tuple_element - template - struct tuple_element<_Int, __debug::array<_Tp, _Nm>> - { - static_assert(_Int < _Nm, "index is out of bounds"); - typedef _Tp type; - }; -} // namespace std - -#endif // _GLIBCXX_DEBUG_ARRAY diff --git a/openflow/usr/include/c++/5/debug/bitset b/openflow/usr/include/c++/5/debug/bitset deleted file mode 100644 index 9cbf457..0000000 --- a/openflow/usr/include/c++/5/debug/bitset +++ /dev/null @@ -1,426 +0,0 @@ -// Debugging bitset implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/bitset - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_BITSET -#define _GLIBCXX_DEBUG_BITSET - -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __debug -{ - /// Class std::bitset with additional safety/checking/debug instrumentation. - template - class bitset - : public _GLIBCXX_STD_C::bitset<_Nb> -#if __cplusplus < 201103L - , public __gnu_debug::_Safe_sequence_base -#endif - { - typedef _GLIBCXX_STD_C::bitset<_Nb> _Base; - - public: - // In C++0x we rely on normal reference type to preserve the property - // of bitset to be use as a literal. - // TODO: Find another solution. -#if __cplusplus >= 201103L - typedef typename _Base::reference reference; -#else - // bit reference: - class reference - : private _Base::reference - , public __gnu_debug::_Safe_iterator_base - { - typedef typename _Base::reference _Base_ref; - - friend class bitset; - reference(); - - reference(const _Base_ref& __base, - bitset* __seq __attribute__((__unused__))) _GLIBCXX_NOEXCEPT - : _Base_ref(__base) - , _Safe_iterator_base(__seq, false) - { } - - public: - reference(const reference& __x) _GLIBCXX_NOEXCEPT - : _Base_ref(__x) - , _Safe_iterator_base(__x, false) - { } - - reference& - operator=(bool __x) _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), - _M_message(__gnu_debug::__msg_bad_bitset_write) - ._M_iterator(*this)); - *static_cast<_Base_ref*>(this) = __x; - return *this; - } - - reference& - operator=(const reference& __x) _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __x._M_singular(), - _M_message(__gnu_debug::__msg_bad_bitset_read) - ._M_iterator(__x)); - _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), - _M_message(__gnu_debug::__msg_bad_bitset_write) - ._M_iterator(*this)); - *static_cast<_Base_ref*>(this) = __x; - return *this; - } - - bool - operator~() const _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), - _M_message(__gnu_debug::__msg_bad_bitset_read) - ._M_iterator(*this)); - return ~(*static_cast(this)); - } - - operator bool() const _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), - _M_message(__gnu_debug::__msg_bad_bitset_read) - ._M_iterator(*this)); - return *static_cast(this); - } - - reference& - flip() _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), - _M_message(__gnu_debug::__msg_bad_bitset_flip) - ._M_iterator(*this)); - _Base_ref::flip(); - return *this; - } - }; -#endif - - // 23.3.5.1 constructors: - _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT - : _Base() { } - -#if __cplusplus >= 201103L - constexpr bitset(unsigned long long __val) noexcept -#else - bitset(unsigned long __val) -#endif - : _Base(__val) { } - - template - explicit - bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str, - typename std::basic_string<_CharT, _Traits, _Alloc>::size_type - __pos = 0, - typename std::basic_string<_CharT, _Traits, _Alloc>::size_type - __n = (std::basic_string<_CharT, _Traits, _Alloc>::npos)) - : _Base(__str, __pos, __n) { } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 396. what are characters zero and one. - template - bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str, - typename std::basic_string<_CharT, _Traits, _Alloc>::size_type - __pos, - typename std::basic_string<_CharT, _Traits, _Alloc>::size_type - __n, - _CharT __zero, _CharT __one = _CharT('1')) - : _Base(__str, __pos, __n, __zero, __one) { } - - bitset(const _Base& __x) : _Base(__x) { } - -#if __cplusplus >= 201103L - template - explicit - bitset(const _CharT* __str, - typename std::basic_string<_CharT>::size_type __n - = std::basic_string<_CharT>::npos, - _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) - : _Base(__str, __n, __zero, __one) { } -#endif - - // 23.3.5.2 bitset operations: - bitset<_Nb>& - operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT - { - _M_base() &= __rhs; - return *this; - } - - bitset<_Nb>& - operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT - { - _M_base() |= __rhs; - return *this; - } - - bitset<_Nb>& - operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT - { - _M_base() ^= __rhs; - return *this; - } - - bitset<_Nb>& - operator<<=(size_t __pos) _GLIBCXX_NOEXCEPT - { - _M_base() <<= __pos; - return *this; - } - - bitset<_Nb>& - operator>>=(size_t __pos) _GLIBCXX_NOEXCEPT - { - _M_base() >>= __pos; - return *this; - } - - bitset<_Nb>& - set() _GLIBCXX_NOEXCEPT - { - _Base::set(); - return *this; - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 186. bitset::set() second parameter should be bool - bitset<_Nb>& - set(size_t __pos, bool __val = true) - { - _Base::set(__pos, __val); - return *this; - } - - bitset<_Nb>& - reset() _GLIBCXX_NOEXCEPT - { - _Base::reset(); - return *this; - } - - bitset<_Nb>& - reset(size_t __pos) - { - _Base::reset(__pos); - return *this; - } - - bitset<_Nb> - operator~() const _GLIBCXX_NOEXCEPT - { return bitset(~_M_base()); } - - bitset<_Nb>& - flip() _GLIBCXX_NOEXCEPT - { - _Base::flip(); - return *this; - } - - bitset<_Nb>& - flip(size_t __pos) - { - _Base::flip(__pos); - return *this; - } - - // element access: - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 11. Bitset minor problems - reference - operator[](size_t __pos) - { - __glibcxx_check_subscript(__pos); -#if __cplusplus >= 201103L - return _M_base()[__pos]; -#else - return reference(_M_base()[__pos], this); -#endif - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 11. Bitset minor problems - _GLIBCXX_CONSTEXPR bool - operator[](size_t __pos) const - { -#if __cplusplus < 201103L - // TODO: Check in debug-mode too. - __glibcxx_check_subscript(__pos); -#endif - return _Base::operator[](__pos); - } - - using _Base::to_ulong; -#if __cplusplus >= 201103L - using _Base::to_ullong; -#endif - - template - std::basic_string<_CharT, _Traits, _Alloc> - to_string() const - { return _M_base().template to_string<_CharT, _Traits, _Alloc>(); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 396. what are characters zero and one. - template - std::basic_string<_CharT, _Traits, _Alloc> - to_string(_CharT __zero, _CharT __one = _CharT('1')) const - { - return _M_base().template - to_string<_CharT, _Traits, _Alloc>(__zero, __one); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 434. bitset::to_string() hard to use. - template - std::basic_string<_CharT, _Traits, std::allocator<_CharT> > - to_string() const - { return to_string<_CharT, _Traits, std::allocator<_CharT> >(); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 853. to_string needs updating with zero and one. - template - std::basic_string<_CharT, _Traits, std::allocator<_CharT> > - to_string(_CharT __zero, _CharT __one = _CharT('1')) const - { return to_string<_CharT, _Traits, - std::allocator<_CharT> >(__zero, __one); } - - template - std::basic_string<_CharT, std::char_traits<_CharT>, - std::allocator<_CharT> > - to_string() const - { - return to_string<_CharT, std::char_traits<_CharT>, - std::allocator<_CharT> >(); - } - - template - std::basic_string<_CharT, std::char_traits<_CharT>, - std::allocator<_CharT> > - to_string(_CharT __zero, _CharT __one = _CharT('1')) const - { - return to_string<_CharT, std::char_traits<_CharT>, - std::allocator<_CharT> >(__zero, __one); - } - - std::basic_string, std::allocator > - to_string() const - { - return to_string,std::allocator >(); - } - - std::basic_string, std::allocator > - to_string(char __zero, char __one = '1') const - { - return to_string, - std::allocator >(__zero, __one); - } - - using _Base::count; - using _Base::size; - - bool - operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT - { return _M_base() == __rhs; } - - bool - operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT - { return _M_base() != __rhs; } - - using _Base::test; - using _Base::all; - using _Base::any; - using _Base::none; - - bitset<_Nb> - operator<<(size_t __pos) const _GLIBCXX_NOEXCEPT - { return bitset<_Nb>(_M_base() << __pos); } - - bitset<_Nb> - operator>>(size_t __pos) const _GLIBCXX_NOEXCEPT - { return bitset<_Nb>(_M_base() >> __pos); } - - _Base& - _M_base() _GLIBCXX_NOEXCEPT - { return *this; } - - const _Base& - _M_base() const _GLIBCXX_NOEXCEPT - { return *this; } - }; - - template - bitset<_Nb> - operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT - { return bitset<_Nb>(__x) &= __y; } - - template - bitset<_Nb> - operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT - { return bitset<_Nb>(__x) |= __y; } - - template - bitset<_Nb> - operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT - { return bitset<_Nb>(__x) ^= __y; } - - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) - { return __is >> __x._M_base(); } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const bitset<_Nb>& __x) - { return __os << __x._M_base(); } - -} // namespace __debug - -#if __cplusplus >= 201103L - // DR 1182. - /// std::hash specialization for bitset. - template - struct hash<__debug::bitset<_Nb>> - : public __hash_base> - { - size_t - operator()(const __debug::bitset<_Nb>& __b) const noexcept - { return std::hash<_GLIBCXX_STD_C::bitset<_Nb>>()(__b._M_base()); } - }; -#endif - -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/debug/debug.h b/openflow/usr/include/c++/5/debug/debug.h deleted file mode 100644 index 161108d..0000000 --- a/openflow/usr/include/c++/5/debug/debug.h +++ /dev/null @@ -1,131 +0,0 @@ -// Debugging support implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/debug.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_MACRO_SWITCH_H -#define _GLIBCXX_DEBUG_MACRO_SWITCH_H 1 - -/** Macros and namespaces used by the implementation outside of debug - * wrappers to verify certain properties. The __glibcxx_requires_xxx - * macros are merely wrappers around the __glibcxx_check_xxx wrappers - * when we are compiling with debug mode, but disappear when we are - * in release mode so that there is no checking performed in, e.g., - * the standard library algorithms. -*/ - -// Debug mode namespaces. - -/** - * @namespace std::__debug - * @brief GNU debug code, replaces standard behavior with debug behavior. - */ -namespace std -{ - namespace __debug { } -} - -/** @namespace __gnu_debug - * @brief GNU debug classes for public use. -*/ -namespace __gnu_debug -{ - using namespace std::__debug; -} - -#ifndef _GLIBCXX_DEBUG - -# define _GLIBCXX_DEBUG_ASSERT(_Condition) -# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) -# define _GLIBCXX_DEBUG_ONLY(_Statement) ; -# define __glibcxx_requires_cond(_Cond,_Msg) -# define __glibcxx_requires_valid_range(_First,_Last) -# define __glibcxx_requires_non_empty_range(_First,_Last) -# define __glibcxx_requires_sorted(_First,_Last) -# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) -# define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) -# define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) -# define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) -# define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) -# define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) -# define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) -# define __glibcxx_requires_heap(_First,_Last) -# define __glibcxx_requires_heap_pred(_First,_Last,_Pred) -# define __glibcxx_requires_nonempty() -# define __glibcxx_requires_string(_String) -# define __glibcxx_requires_string_len(_String,_Len) -# define __glibcxx_requires_subscript(_N) - -#else - -# include - -#define _GLIBCXX_DEBUG_ASSERT(_Condition) __glibcxx_assert(_Condition) - -#ifdef _GLIBCXX_DEBUG_PEDANTIC -# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition) -#else -# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) -#endif - -# define _GLIBCXX_DEBUG_ONLY(_Statement) _Statement - -# define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg) -# define __glibcxx_requires_valid_range(_First,_Last) \ - __glibcxx_check_valid_range(_First,_Last) -# define __glibcxx_requires_non_empty_range(_First,_Last) \ - __glibcxx_check_non_empty_range(_First,_Last) -# define __glibcxx_requires_sorted(_First,_Last) \ - __glibcxx_check_sorted(_First,_Last) -# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \ - __glibcxx_check_sorted_pred(_First,_Last,_Pred) -# define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) \ - __glibcxx_check_sorted_set(_First1,_Last1,_First2) -# define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) \ - __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) -# define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) \ - __glibcxx_check_partitioned_lower(_First,_Last,_Value) -# define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) \ - __glibcxx_check_partitioned_upper(_First,_Last,_Value) -# define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ - __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) -# define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ - __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) -# define __glibcxx_requires_heap(_First,_Last) \ - __glibcxx_check_heap(_First,_Last) -# define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \ - __glibcxx_check_heap_pred(_First,_Last,_Pred) -# define __glibcxx_requires_nonempty() __glibcxx_check_nonempty() -# define __glibcxx_requires_string(_String) __glibcxx_check_string(_String) -# define __glibcxx_requires_string_len(_String,_Len) \ - __glibcxx_check_string_len(_String,_Len) -# define __glibcxx_requires_subscript(_N) __glibcxx_check_subscript(_N) - -# include - -#endif - -#endif // _GLIBCXX_DEBUG_MACRO_SWITCH_H diff --git a/openflow/usr/include/c++/5/debug/deque b/openflow/usr/include/c++/5/debug/deque deleted file mode 100644 index fffc5e4..0000000 --- a/openflow/usr/include/c++/5/debug/deque +++ /dev/null @@ -1,639 +0,0 @@ -// Debugging deque implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/deque - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_DEQUE -#define _GLIBCXX_DEBUG_DEQUE 1 - -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __debug -{ - /// Class std::deque with safety/checking/debug instrumentation. - template > - class deque - : public __gnu_debug::_Safe_container< - deque<_Tp, _Allocator>, _Allocator, - __gnu_debug::_Safe_sequence>, - public _GLIBCXX_STD_C::deque<_Tp, _Allocator> - { - typedef _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base; - typedef __gnu_debug::_Safe_container< - deque, _Allocator, __gnu_debug::_Safe_sequence> _Safe; - - typedef typename _Base::const_iterator _Base_const_iterator; - typedef typename _Base::iterator _Base_iterator; - typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; - - public: - typedef typename _Base::reference reference; - typedef typename _Base::const_reference const_reference; - - typedef __gnu_debug::_Safe_iterator<_Base_iterator, deque> - iterator; - typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, deque> - const_iterator; - - typedef typename _Base::size_type size_type; - typedef typename _Base::difference_type difference_type; - - typedef _Tp value_type; - typedef _Allocator allocator_type; - typedef typename _Base::pointer pointer; - typedef typename _Base::const_pointer const_pointer; - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - // 23.2.1.1 construct/copy/destroy: - -#if __cplusplus < 201103L - deque() - : _Base() { } - - deque(const deque& __x) - : _Base(__x) { } - - ~deque() { } -#else - deque() = default; - deque(const deque&) = default; - deque(deque&&) = default; - - deque(const deque& __d, const _Allocator& __a) - : _Base(__d, __a) { } - - deque(deque&& __d, const _Allocator& __a) - : _Safe(std::move(__d)), _Base(std::move(__d), __a) { } - - deque(initializer_list __l, - const allocator_type& __a = allocator_type()) - : _Base(__l, __a) { } - - ~deque() = default; -#endif - - explicit - deque(const _Allocator& __a) - : _Base(__a) { } - -#if __cplusplus >= 201103L - explicit - deque(size_type __n, const _Allocator& __a = _Allocator()) - : _Base(__n, __a) { } - - deque(size_type __n, const _Tp& __value, - const _Allocator& __a = _Allocator()) - : _Base(__n, __value, __a) { } -#else - explicit - deque(size_type __n, const _Tp& __value = _Tp(), - const _Allocator& __a = _Allocator()) - : _Base(__n, __value, __a) { } -#endif - -#if __cplusplus >= 201103L - template> -#else - template -#endif - deque(_InputIterator __first, _InputIterator __last, - const _Allocator& __a = _Allocator()) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), __a) - { } - - deque(const _Base& __x) - : _Base(__x) { } - -#if __cplusplus < 201103L - deque& - operator=(const deque& __x) - { - this->_M_safe() = __x; - _M_base() = __x; - return *this; - } -#else - deque& - operator=(const deque&) = default; - - deque& - operator=(deque&&) = default; - - deque& - operator=(initializer_list __l) - { - _M_base() = __l; - this->_M_invalidate_all(); - return *this; - } -#endif - -#if __cplusplus >= 201103L - template> -#else - template -#endif - void - assign(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - _Base::assign(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - this->_M_invalidate_all(); - } - - void - assign(size_type __n, const _Tp& __t) - { - _Base::assign(__n, __t); - this->_M_invalidate_all(); - } - -#if __cplusplus >= 201103L - void - assign(initializer_list __l) - { - _Base::assign(__l); - this->_M_invalidate_all(); - } -#endif - - using _Base::get_allocator; - - // iterators: - iterator - begin() _GLIBCXX_NOEXCEPT - { return iterator(_Base::begin(), this); } - - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::begin(), this); } - - iterator - end() _GLIBCXX_NOEXCEPT - { return iterator(_Base::end(), this); } - - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::end(), this); } - - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return reverse_iterator(end()); } - - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(end()); } - - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return reverse_iterator(begin()); } - - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(begin()); } - -#if __cplusplus >= 201103L - const_iterator - cbegin() const noexcept - { return const_iterator(_Base::begin(), this); } - - const_iterator - cend() const noexcept - { return const_iterator(_Base::end(), this); } - - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(end()); } - - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(begin()); } -#endif - - private: - void - _M_invalidate_after_nth(difference_type __n) - { - typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth; - this->_M_invalidate_if(_After_nth(__n, _Base::begin())); - } - - public: - // 23.2.1.2 capacity: - using _Base::size; - using _Base::max_size; - -#if __cplusplus >= 201103L - void - resize(size_type __sz) - { - bool __invalidate_all = __sz > this->size(); - if (__sz < this->size()) - this->_M_invalidate_after_nth(__sz); - - _Base::resize(__sz); - - if (__invalidate_all) - this->_M_invalidate_all(); - } - - void - resize(size_type __sz, const _Tp& __c) - { - bool __invalidate_all = __sz > this->size(); - if (__sz < this->size()) - this->_M_invalidate_after_nth(__sz); - - _Base::resize(__sz, __c); - - if (__invalidate_all) - this->_M_invalidate_all(); - } -#else - void - resize(size_type __sz, _Tp __c = _Tp()) - { - bool __invalidate_all = __sz > this->size(); - if (__sz < this->size()) - this->_M_invalidate_after_nth(__sz); - - _Base::resize(__sz, __c); - - if (__invalidate_all) - this->_M_invalidate_all(); - } -#endif - -#if __cplusplus >= 201103L - void - shrink_to_fit() noexcept - { - if (_Base::_M_shrink_to_fit()) - this->_M_invalidate_all(); - } -#endif - - using _Base::empty; - - // element access: - reference - operator[](size_type __n) _GLIBCXX_NOEXCEPT - { - __glibcxx_check_subscript(__n); - return _M_base()[__n]; - } - - const_reference - operator[](size_type __n) const _GLIBCXX_NOEXCEPT - { - __glibcxx_check_subscript(__n); - return _M_base()[__n]; - } - - using _Base::at; - - reference - front() _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - return _Base::front(); - } - - const_reference - front() const _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - return _Base::front(); - } - - reference - back() _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - return _Base::back(); - } - - const_reference - back() const _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - return _Base::back(); - } - - // 23.2.1.3 modifiers: - void - push_front(const _Tp& __x) - { - _Base::push_front(__x); - this->_M_invalidate_all(); - } - - void - push_back(const _Tp& __x) - { - _Base::push_back(__x); - this->_M_invalidate_all(); - } - -#if __cplusplus >= 201103L - void - push_front(_Tp&& __x) - { emplace_front(std::move(__x)); } - - void - push_back(_Tp&& __x) - { emplace_back(std::move(__x)); } - - template - void - emplace_front(_Args&&... __args) - { - _Base::emplace_front(std::forward<_Args>(__args)...); - this->_M_invalidate_all(); - } - - template - void - emplace_back(_Args&&... __args) - { - _Base::emplace_back(std::forward<_Args>(__args)...); - this->_M_invalidate_all(); - } - - template - iterator - emplace(const_iterator __position, _Args&&... __args) - { - __glibcxx_check_insert(__position); - _Base_iterator __res = _Base::emplace(__position.base(), - std::forward<_Args>(__args)...); - this->_M_invalidate_all(); - return iterator(__res, this); - } -#endif - - iterator -#if __cplusplus >= 201103L - insert(const_iterator __position, const _Tp& __x) -#else - insert(iterator __position, const _Tp& __x) -#endif - { - __glibcxx_check_insert(__position); - _Base_iterator __res = _Base::insert(__position.base(), __x); - this->_M_invalidate_all(); - return iterator(__res, this); - } - -#if __cplusplus >= 201103L - iterator - insert(const_iterator __position, _Tp&& __x) - { return emplace(__position, std::move(__x)); } - - iterator - insert(const_iterator __position, initializer_list __l) - { - __glibcxx_check_insert(__position); - _Base_iterator __res = _Base::insert(__position.base(), __l); - this->_M_invalidate_all(); - return iterator(__res, this); - } -#endif - -#if __cplusplus >= 201103L - iterator - insert(const_iterator __position, size_type __n, const _Tp& __x) - { - __glibcxx_check_insert(__position); - _Base_iterator __res = _Base::insert(__position.base(), __n, __x); - this->_M_invalidate_all(); - return iterator(__res, this); - } -#else - void - insert(iterator __position, size_type __n, const _Tp& __x) - { - __glibcxx_check_insert(__position); - _Base::insert(__position.base(), __n, __x); - this->_M_invalidate_all(); - } -#endif - -#if __cplusplus >= 201103L - template> - iterator - insert(const_iterator __position, - _InputIterator __first, _InputIterator __last) - { - __glibcxx_check_insert_range(__position, __first, __last); - _Base_iterator __res = _Base::insert(__position.base(), - __gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - this->_M_invalidate_all(); - return iterator(__res, this); - } -#else - template - void - insert(iterator __position, - _InputIterator __first, _InputIterator __last) - { - __glibcxx_check_insert_range(__position, __first, __last); - _Base::insert(__position.base(), __gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - this->_M_invalidate_all(); - } -#endif - - void - pop_front() _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - this->_M_invalidate_if(_Equal(_Base::begin())); - _Base::pop_front(); - } - - void - pop_back() _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - this->_M_invalidate_if(_Equal(--_Base::end())); - _Base::pop_back(); - } - - iterator -#if __cplusplus >= 201103L - erase(const_iterator __position) -#else - erase(iterator __position) -#endif - { - __glibcxx_check_erase(__position); -#if __cplusplus >= 201103L - _Base_const_iterator __victim = __position.base(); -#else - _Base_iterator __victim = __position.base(); -#endif - if (__victim == _Base::begin() || __victim == _Base::end() - 1) - { - this->_M_invalidate_if(_Equal(__victim)); - return iterator(_Base::erase(__victim), this); - } - else - { - _Base_iterator __res = _Base::erase(__victim); - this->_M_invalidate_all(); - return iterator(__res, this); - } - } - - iterator -#if __cplusplus >= 201103L - erase(const_iterator __first, const_iterator __last) -#else - erase(iterator __first, iterator __last) -#endif - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 151. can't currently clear() empty container - __glibcxx_check_erase_range(__first, __last); - - if (__first.base() == __last.base()) -#if __cplusplus >= 201103L - return iterator(__first.base()._M_const_cast(), this); -#else - return __first; -#endif - else if (__first.base() == _Base::begin() - || __last.base() == _Base::end()) - { - this->_M_detach_singular(); - for (_Base_const_iterator __position = __first.base(); - __position != __last.base(); ++__position) - { - this->_M_invalidate_if(_Equal(__position)); - } - __try - { - return iterator(_Base::erase(__first.base(), __last.base()), - this); - } - __catch(...) - { - this->_M_revalidate_singular(); - __throw_exception_again; - } - } - else - { - _Base_iterator __res = _Base::erase(__first.base(), - __last.base()); - this->_M_invalidate_all(); - return iterator(__res, this); - } - } - - void - swap(deque& __x) -#if __cplusplus >= 201103L - noexcept( noexcept(declval<_Base>().swap(__x)) ) -#endif - { - _Safe::_M_swap(__x); - _Base::swap(__x); - } - - void - clear() _GLIBCXX_NOEXCEPT - { - _Base::clear(); - this->_M_invalidate_all(); - } - - _Base& - _M_base() _GLIBCXX_NOEXCEPT { return *this; } - - const _Base& - _M_base() const _GLIBCXX_NOEXCEPT { return *this; } - }; - - template - inline bool - operator==(const deque<_Tp, _Alloc>& __lhs, - const deque<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() == __rhs._M_base(); } - - template - inline bool - operator!=(const deque<_Tp, _Alloc>& __lhs, - const deque<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() != __rhs._M_base(); } - - template - inline bool - operator<(const deque<_Tp, _Alloc>& __lhs, - const deque<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() < __rhs._M_base(); } - - template - inline bool - operator<=(const deque<_Tp, _Alloc>& __lhs, - const deque<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() <= __rhs._M_base(); } - - template - inline bool - operator>=(const deque<_Tp, _Alloc>& __lhs, - const deque<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() >= __rhs._M_base(); } - - template - inline bool - operator>(const deque<_Tp, _Alloc>& __lhs, - const deque<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() > __rhs._M_base(); } - - template - inline void - swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs) - { __lhs.swap(__rhs); } - -} // namespace __debug -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/debug/formatter.h b/openflow/usr/include/c++/5/debug/formatter.h deleted file mode 100644 index 6767cd9..0000000 --- a/openflow/usr/include/c++/5/debug/formatter.h +++ /dev/null @@ -1,464 +0,0 @@ -// Debug-mode error formatting implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/formatter.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_FORMATTER_H -#define _GLIBCXX_DEBUG_FORMATTER_H 1 - -#include -#include -#include - -namespace __gnu_debug -{ - using std::type_info; - - template - bool __check_singular(const _Iterator&); - - class _Safe_sequence_base; - - template - class _Safe_iterator; - - template - class _Safe_local_iterator; - - template - class _Safe_sequence; - - enum _Debug_msg_id - { - // General checks - __msg_valid_range, - __msg_insert_singular, - __msg_insert_different, - __msg_erase_bad, - __msg_erase_different, - __msg_subscript_oob, - __msg_empty, - __msg_unpartitioned, - __msg_unpartitioned_pred, - __msg_unsorted, - __msg_unsorted_pred, - __msg_not_heap, - __msg_not_heap_pred, - // std::bitset checks - __msg_bad_bitset_write, - __msg_bad_bitset_read, - __msg_bad_bitset_flip, - // std::list checks - __msg_self_splice, - __msg_splice_alloc, - __msg_splice_bad, - __msg_splice_other, - __msg_splice_overlap, - // iterator checks - __msg_init_singular, - __msg_init_copy_singular, - __msg_init_const_singular, - __msg_copy_singular, - __msg_bad_deref, - __msg_bad_inc, - __msg_bad_dec, - __msg_iter_subscript_oob, - __msg_advance_oob, - __msg_retreat_oob, - __msg_iter_compare_bad, - __msg_compare_different, - __msg_iter_order_bad, - __msg_order_different, - __msg_distance_bad, - __msg_distance_different, - // istream_iterator - __msg_deref_istream, - __msg_inc_istream, - // ostream_iterator - __msg_output_ostream, - // istreambuf_iterator - __msg_deref_istreambuf, - __msg_inc_istreambuf, - // forward_list - __msg_insert_after_end, - __msg_erase_after_bad, - __msg_valid_range2, - // unordered container local iterators - __msg_local_iter_compare_bad, - __msg_non_empty_range, - // self move assign - __msg_self_move_assign, - // unordered container buckets - __msg_bucket_index_oob, - __msg_valid_load_factor, - // others - __msg_equal_allocs, - __msg_insert_range_from_self - }; - - class _Error_formatter - { - /// Whether an iterator is constant, mutable, or unknown - enum _Constness - { - __unknown_constness, - __const_iterator, - __mutable_iterator, - __last_constness - }; - - // The state of the iterator (fine-grained), if we know it. - enum _Iterator_state - { - __unknown_state, - __singular, // singular, may still be attached to a sequence - __begin, // dereferenceable, and at the beginning - __middle, // dereferenceable, not at the beginning - __end, // past-the-end, may be at beginning if sequence empty - __before_begin, // before begin - __last_state - }; - - // Tags denoting the type of parameter for construction - struct _Is_iterator { }; - struct _Is_sequence { }; - - // A parameter that may be referenced by an error message - struct _Parameter - { - enum - { - __unused_param, - __iterator, - __sequence, - __integer, - __string - } _M_kind; - - union - { - // When _M_kind == __iterator - struct - { - const char* _M_name; - const void* _M_address; - const type_info* _M_type; - _Constness _M_constness; - _Iterator_state _M_state; - const void* _M_sequence; - const type_info* _M_seq_type; - } _M_iterator; - - // When _M_kind == __sequence - struct - { - const char* _M_name; - const void* _M_address; - const type_info* _M_type; - } _M_sequence; - - // When _M_kind == __integer - struct - { - const char* _M_name; - long _M_value; - } _M_integer; - - // When _M_kind == __string - struct - { - const char* _M_name; - const char* _M_value; - } _M_string; - } _M_variant; - - _Parameter() : _M_kind(__unused_param), _M_variant() { } - - _Parameter(long __value, const char* __name) - : _M_kind(__integer), _M_variant() - { - _M_variant._M_integer._M_name = __name; - _M_variant._M_integer._M_value = __value; - } - - _Parameter(const char* __value, const char* __name) - : _M_kind(__string), _M_variant() - { - _M_variant._M_string._M_name = __name; - _M_variant._M_string._M_value = __value; - } - - template - _Parameter(const _Safe_iterator<_Iterator, _Sequence>& __it, - const char* __name, _Is_iterator) - : _M_kind(__iterator), _M_variant() - { - _M_variant._M_iterator._M_name = __name; - _M_variant._M_iterator._M_address = &__it; -#if __cpp_rtti - _M_variant._M_iterator._M_type = &typeid(__it); -#else - _M_variant._M_iterator._M_type = 0; -#endif - _M_variant._M_iterator._M_constness = - std::__are_same<_Safe_iterator<_Iterator, _Sequence>, - typename _Sequence::iterator>:: - __value ? __mutable_iterator : __const_iterator; - _M_variant._M_iterator._M_sequence = __it._M_get_sequence(); -#if __cpp_rtti - _M_variant._M_iterator._M_seq_type = &typeid(_Sequence); -#else - _M_variant._M_iterator._M_seq_type = 0; -#endif - - if (__it._M_singular()) - _M_variant._M_iterator._M_state = __singular; - else - { - if (__it._M_is_before_begin()) - _M_variant._M_iterator._M_state = __before_begin; - else if (__it._M_is_end()) - _M_variant._M_iterator._M_state = __end; - else if (__it._M_is_begin()) - _M_variant._M_iterator._M_state = __begin; - else - _M_variant._M_iterator._M_state = __middle; - } - } - - template - _Parameter(const _Safe_local_iterator<_Iterator, _Sequence>& __it, - const char* __name, _Is_iterator) - : _M_kind(__iterator), _M_variant() - { - _M_variant._M_iterator._M_name = __name; - _M_variant._M_iterator._M_address = &__it; -#if __cpp_rtti - _M_variant._M_iterator._M_type = &typeid(__it); -#else - _M_variant._M_iterator._M_type = 0; -#endif - _M_variant._M_iterator._M_constness = - std::__are_same<_Safe_local_iterator<_Iterator, _Sequence>, - typename _Sequence::local_iterator>:: - __value ? __mutable_iterator : __const_iterator; - _M_variant._M_iterator._M_sequence = __it._M_get_sequence(); -#if __cpp_rtti - _M_variant._M_iterator._M_seq_type = &typeid(_Sequence); -#else - _M_variant._M_iterator._M_seq_type = 0; -#endif - - if (__it._M_singular()) - _M_variant._M_iterator._M_state = __singular; - else - { - if (__it._M_is_end()) - _M_variant._M_iterator._M_state = __end; - else if (__it._M_is_begin()) - _M_variant._M_iterator._M_state = __begin; - else - _M_variant._M_iterator._M_state = __middle; - } - } - - template - _Parameter(const _Type*& __it, const char* __name, _Is_iterator) - : _M_kind(__iterator), _M_variant() - { - _M_variant._M_iterator._M_name = __name; - _M_variant._M_iterator._M_address = &__it; -#if __cpp_rtti - _M_variant._M_iterator._M_type = &typeid(__it); -#else - _M_variant._M_iterator._M_type = 0; -#endif - _M_variant._M_iterator._M_constness = __mutable_iterator; - _M_variant._M_iterator._M_state = __it? __unknown_state : __singular; - _M_variant._M_iterator._M_sequence = 0; - _M_variant._M_iterator._M_seq_type = 0; - } - - template - _Parameter(_Type*& __it, const char* __name, _Is_iterator) - : _M_kind(__iterator), _M_variant() - { - _M_variant._M_iterator._M_name = __name; - _M_variant._M_iterator._M_address = &__it; -#if __cpp_rtti - _M_variant._M_iterator._M_type = &typeid(__it); -#else - _M_variant._M_iterator._M_type = 0; -#endif - _M_variant._M_iterator._M_constness = __const_iterator; - _M_variant._M_iterator._M_state = __it? __unknown_state : __singular; - _M_variant._M_iterator._M_sequence = 0; - _M_variant._M_iterator._M_seq_type = 0; - } - - template - _Parameter(const _Iterator& __it, const char* __name, _Is_iterator) - : _M_kind(__iterator), _M_variant() - { - _M_variant._M_iterator._M_name = __name; - _M_variant._M_iterator._M_address = &__it; -#if __cpp_rtti - _M_variant._M_iterator._M_type = &typeid(__it); -#else - _M_variant._M_iterator._M_type = 0; -#endif - _M_variant._M_iterator._M_constness = __unknown_constness; - _M_variant._M_iterator._M_state = - __gnu_debug::__check_singular(__it)? __singular : __unknown_state; - _M_variant._M_iterator._M_sequence = 0; - _M_variant._M_iterator._M_seq_type = 0; - } - - template - _Parameter(const _Safe_sequence<_Sequence>& __seq, - const char* __name, _Is_sequence) - : _M_kind(__sequence), _M_variant() - { - _M_variant._M_sequence._M_name = __name; - _M_variant._M_sequence._M_address = - static_cast(&__seq); -#if __cpp_rtti - _M_variant._M_sequence._M_type = &typeid(_Sequence); -#else - _M_variant._M_sequence._M_type = 0; -#endif - } - - template - _Parameter(const _Sequence& __seq, const char* __name, _Is_sequence) - : _M_kind(__sequence), _M_variant() - { - _M_variant._M_sequence._M_name = __name; - _M_variant._M_sequence._M_address = &__seq; -#if __cpp_rtti - _M_variant._M_sequence._M_type = &typeid(_Sequence); -#else - _M_variant._M_sequence._M_type = 0; -#endif - } - - void - _M_print_field(const _Error_formatter* __formatter, - const char* __name) const; - - void - _M_print_description(const _Error_formatter* __formatter) const; - }; - - friend struct _Parameter; - - public: - template - const _Error_formatter& - _M_iterator(const _Iterator& __it, const char* __name = 0) const - { - if (_M_num_parameters < std::size_t(__max_parameters)) - _M_parameters[_M_num_parameters++] = _Parameter(__it, __name, - _Is_iterator()); - return *this; - } - - const _Error_formatter& - _M_integer(long __value, const char* __name = 0) const - { - if (_M_num_parameters < std::size_t(__max_parameters)) - _M_parameters[_M_num_parameters++] = _Parameter(__value, __name); - return *this; - } - - const _Error_formatter& - _M_string(const char* __value, const char* __name = 0) const - { - if (_M_num_parameters < std::size_t(__max_parameters)) - _M_parameters[_M_num_parameters++] = _Parameter(__value, __name); - return *this; - } - - template - const _Error_formatter& - _M_sequence(const _Sequence& __seq, const char* __name = 0) const - { - if (_M_num_parameters < std::size_t(__max_parameters)) - _M_parameters[_M_num_parameters++] = _Parameter(__seq, __name, - _Is_sequence()); - return *this; - } - - const _Error_formatter& - _M_message(const char* __text) const - { _M_text = __text; return *this; } - - const _Error_formatter& - _M_message(_Debug_msg_id __id) const throw (); - - _GLIBCXX_NORETURN void - _M_error() const; - - private: - _Error_formatter(const char* __file, std::size_t __line) - : _M_file(__file), _M_line(__line), _M_num_parameters(0), _M_text(0), - _M_max_length(78), _M_column(1), _M_first_line(true), _M_wordwrap(false) - { _M_get_max_length(); } - - template - void - _M_format_word(char*, int, const char*, _Tp) const throw (); - - void - _M_print_word(const char* __word) const; - - void - _M_print_string(const char* __string) const; - - void - _M_get_max_length() const throw (); - - enum { __max_parameters = 9 }; - - const char* _M_file; - std::size_t _M_line; - mutable _Parameter _M_parameters[__max_parameters]; - mutable std::size_t _M_num_parameters; - mutable const char* _M_text; - mutable std::size_t _M_max_length; - enum { _M_indent = 4 } ; - mutable std::size_t _M_column; - mutable bool _M_first_line; - mutable bool _M_wordwrap; - - public: - static _Error_formatter - _M_at(const char* __file, std::size_t __line) - { return _Error_formatter(__file, __line); } - }; -} // namespace __gnu_debug - -#endif diff --git a/openflow/usr/include/c++/5/debug/forward_list b/openflow/usr/include/c++/5/debug/forward_list deleted file mode 100644 index 0f09d23..0000000 --- a/openflow/usr/include/c++/5/debug/forward_list +++ /dev/null @@ -1,827 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2010-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/forward_list - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_FORWARD_LIST -#define _GLIBCXX_DEBUG_FORWARD_LIST 1 - -#pragma GCC system_header - -#include -#include -#include -#include - -namespace __gnu_debug -{ - /// Special iterators swap and invalidation for forward_list because of the - /// before_begin iterator. - template - class _Safe_forward_list - : public _Safe_sequence<_SafeSequence> - { - _SafeSequence& - _M_this() noexcept - { return *static_cast<_SafeSequence*>(this); } - - static void - _M_swap_aux(_Safe_sequence_base& __lhs, - _Safe_iterator_base*& __lhs_iterators, - _Safe_sequence_base& __rhs, - _Safe_iterator_base*& __rhs_iterators); - - void _M_swap_single(_Safe_sequence_base&) noexcept; - - protected: - void - _M_invalidate_all() - { - using _Base_const_iterator = __decltype(_M_this()._M_base().cend()); - this->_M_invalidate_if([this](_Base_const_iterator __it) - { - return __it != _M_this()._M_base().cbefore_begin() - && __it != _M_this()._M_base().cend(); }); - } - - void _M_swap(_Safe_sequence_base&) noexcept; - }; - - template - void - _Safe_forward_list<_SafeSequence>:: - _M_swap_aux(_Safe_sequence_base& __lhs, - _Safe_iterator_base*& __lhs_iterators, - _Safe_sequence_base& __rhs, - _Safe_iterator_base*& __rhs_iterators) - { - using const_iterator = typename _SafeSequence::const_iterator; - _Safe_iterator_base* __bbegin_its = 0; - _Safe_iterator_base* __last_bbegin = 0; - _SafeSequence& __rseq = static_cast<_SafeSequence&>(__rhs); - - for (_Safe_iterator_base* __iter = __lhs_iterators; __iter;) - { - // Even iterator is cast to const_iterator, not a problem. - _Safe_iterator_base* __victim_base = __iter; - const_iterator* __victim = - static_cast(__victim_base); - __iter = __iter->_M_next; - if (__victim->base() == __rseq._M_base().cbefore_begin()) - { - __victim->_M_unlink(); - if (__lhs_iterators == __victim_base) - __lhs_iterators = __victim_base->_M_next; - if (__bbegin_its) - { - __victim_base->_M_next = __bbegin_its; - __bbegin_its->_M_prior = __victim_base; - } - else - __last_bbegin = __victim_base; - __bbegin_its = __victim_base; - } - else - __victim_base->_M_sequence = &__lhs; - } - - if (__bbegin_its) - { - if (__rhs_iterators) - { - __rhs_iterators->_M_prior = __last_bbegin; - __last_bbegin->_M_next = __rhs_iterators; - } - __rhs_iterators = __bbegin_its; - } - } - - template - void - _Safe_forward_list<_SafeSequence>:: - _M_swap_single(_Safe_sequence_base& __other) noexcept - { - std::swap(_M_this()._M_iterators, __other._M_iterators); - std::swap(_M_this()._M_const_iterators, __other._M_const_iterators); - // Useless, always 1 on forward_list - //std::swap(_M_this()_M_version, __other._M_version); - _Safe_iterator_base* __this_its = _M_this()._M_iterators; - _M_swap_aux(__other, __other._M_iterators, - _M_this(), _M_this()._M_iterators); - _Safe_iterator_base* __this_const_its = _M_this()._M_const_iterators; - _M_swap_aux(__other, __other._M_const_iterators, - _M_this(), _M_this()._M_const_iterators); - _M_swap_aux(_M_this(), __this_its, - __other, __other._M_iterators); - _M_swap_aux(_M_this(), __this_const_its, - __other, __other._M_const_iterators); - } - - /* Special forward_list _M_swap version that does not swap the - * before-begin ownership.*/ - template - void - _Safe_forward_list<_SafeSequence>:: - _M_swap(_Safe_sequence_base& __other) noexcept - { - // We need to lock both sequences to swap - using namespace __gnu_cxx; - __mutex *__this_mutex = &_M_this()._M_get_mutex(); - __mutex *__other_mutex = - &static_cast<_SafeSequence&>(__other)._M_get_mutex(); - if (__this_mutex == __other_mutex) - { - __scoped_lock __lock(*__this_mutex); - _M_swap_single(__other); - } - else - { - __scoped_lock __l1(__this_mutex < __other_mutex - ? *__this_mutex : *__other_mutex); - __scoped_lock __l2(__this_mutex < __other_mutex - ? *__other_mutex : *__this_mutex); - _M_swap_single(__other); - } - } -} - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __debug -{ - /// Class std::forward_list with safety/checking/debug instrumentation. - template > - class forward_list - : public __gnu_debug::_Safe_container< - forward_list<_Tp, _Alloc>, _Alloc, __gnu_debug::_Safe_forward_list>, - public _GLIBCXX_STD_C::forward_list<_Tp, _Alloc> - { - typedef _GLIBCXX_STD_C::forward_list<_Tp, _Alloc> _Base; - typedef __gnu_debug::_Safe_container< - forward_list, _Alloc, __gnu_debug::_Safe_forward_list> _Safe; - - typedef typename _Base::iterator _Base_iterator; - typedef typename _Base::const_iterator _Base_const_iterator; - - public: - typedef typename _Base::reference reference; - typedef typename _Base::const_reference const_reference; - - typedef __gnu_debug::_Safe_iterator< - _Base_iterator, forward_list> iterator; - typedef __gnu_debug::_Safe_iterator< - _Base_const_iterator, forward_list> const_iterator; - - typedef typename _Base::size_type size_type; - typedef typename _Base::difference_type difference_type; - - typedef _Tp value_type; - typedef typename _Base::allocator_type allocator_type; - typedef typename _Base::pointer pointer; - typedef typename _Base::const_pointer const_pointer; - - // 23.2.3.1 construct/copy/destroy: - explicit - forward_list(const allocator_type& __al = allocator_type()) - : _Base(__al) { } - - forward_list(const forward_list& __list, const allocator_type& __al) - : _Base(__list, __al) - { } - - forward_list(forward_list&& __list, const allocator_type& __al) - : _Safe(std::move(__list._M_safe()), __al), - _Base(std::move(__list._M_base()), __al) - { } - - explicit - forward_list(size_type __n, const allocator_type& __al = allocator_type()) - : _Base(__n, __al) - { } - - forward_list(size_type __n, const _Tp& __value, - const allocator_type& __al = allocator_type()) - : _Base(__n, __value, __al) - { } - - template> - forward_list(_InputIterator __first, _InputIterator __last, - const allocator_type& __al = allocator_type()) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), __al) - { } - - forward_list(const forward_list&) = default; - - forward_list(forward_list&&) = default; - - forward_list(std::initializer_list<_Tp> __il, - const allocator_type& __al = allocator_type()) - : _Base(__il, __al) - { } - - ~forward_list() = default; - - forward_list& - operator=(const forward_list&) = default; - - forward_list& - operator=(forward_list&&) = default; - - forward_list& - operator=(std::initializer_list<_Tp> __il) - { - _M_base() = __il; - this->_M_invalidate_all(); - return *this; - } - - template> - void - assign(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - _Base::assign(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - this->_M_invalidate_all(); - } - - void - assign(size_type __n, const _Tp& __val) - { - _Base::assign(__n, __val); - this->_M_invalidate_all(); - } - - void - assign(std::initializer_list<_Tp> __il) - { - _Base::assign(__il); - this->_M_invalidate_all(); - } - - using _Base::get_allocator; - - // iterators: - - iterator - before_begin() noexcept - { return iterator(_Base::before_begin(), this); } - - const_iterator - before_begin() const noexcept - { return const_iterator(_Base::before_begin(), this); } - - iterator - begin() noexcept - { return iterator(_Base::begin(), this); } - - const_iterator - begin() const noexcept - { return const_iterator(_Base::begin(), this); } - - iterator - end() noexcept - { return iterator(_Base::end(), this); } - - const_iterator - end() const noexcept - { return const_iterator(_Base::end(), this); } - - const_iterator - cbegin() const noexcept - { return const_iterator(_Base::cbegin(), this); } - - const_iterator - cbefore_begin() const noexcept - { return const_iterator(_Base::cbefore_begin(), this); } - - const_iterator - cend() const noexcept - { return const_iterator(_Base::cend(), this); } - - using _Base::empty; - using _Base::max_size; - - // element access: - - reference - front() - { - __glibcxx_check_nonempty(); - return _Base::front(); - } - - const_reference - front() const - { - __glibcxx_check_nonempty(); - return _Base::front(); - } - - // modifiers: - - using _Base::emplace_front; - using _Base::push_front; - - void - pop_front() - { - __glibcxx_check_nonempty(); - this->_M_invalidate_if([this](_Base_const_iterator __it) - { return __it == this->_M_base().cbegin(); }); - _Base::pop_front(); - } - - template - iterator - emplace_after(const_iterator __pos, _Args&&... __args) - { - __glibcxx_check_insert_after(__pos); - return iterator(_Base::emplace_after(__pos.base(), - std::forward<_Args>(__args)...), - this); - } - - iterator - insert_after(const_iterator __pos, const _Tp& __val) - { - __glibcxx_check_insert_after(__pos); - return iterator(_Base::insert_after(__pos.base(), __val), this); - } - - iterator - insert_after(const_iterator __pos, _Tp&& __val) - { - __glibcxx_check_insert_after(__pos); - return iterator(_Base::insert_after(__pos.base(), std::move(__val)), - this); - } - - iterator - insert_after(const_iterator __pos, size_type __n, const _Tp& __val) - { - __glibcxx_check_insert_after(__pos); - return iterator(_Base::insert_after(__pos.base(), __n, __val), - this); - } - - template> - iterator - insert_after(const_iterator __pos, - _InputIterator __first, _InputIterator __last) - { - __glibcxx_check_insert_range_after(__pos, __first, __last); - return iterator(_Base::insert_after(__pos.base(), - __gnu_debug::__base(__first), - __gnu_debug::__base(__last)), - this); - } - - iterator - insert_after(const_iterator __pos, std::initializer_list<_Tp> __il) - { - __glibcxx_check_insert_after(__pos); - return iterator(_Base::insert_after(__pos.base(), __il), this); - } - - private: - _Base_iterator - _M_erase_after(_Base_const_iterator __pos) - { - _Base_const_iterator __next = std::next(__pos); - this->_M_invalidate_if([__next](_Base_const_iterator __it) - { return __it == __next; }); - return _Base::erase_after(__pos); - } - public: - iterator - erase_after(const_iterator __pos) - { - __glibcxx_check_erase_after(__pos); - return iterator(_M_erase_after(__pos.base()), this); - } - - iterator - erase_after(const_iterator __pos, const_iterator __last) - { - __glibcxx_check_erase_range_after(__pos, __last); - for (_Base_const_iterator __victim = std::next(__pos.base()); - __victim != __last.base(); ++__victim) - { - _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range2) - ._M_sequence(*this, "this") - ._M_iterator(__pos, "pos") - ._M_iterator(__last, "last")); - this->_M_invalidate_if([__victim](_Base_const_iterator __it) - { return __it == __victim; }); - } - return iterator(_Base::erase_after(__pos.base(), __last.base()), this); - } - - void - swap(forward_list& __list) - noexcept( noexcept(declval<_Base>().swap(__list)) ) - { - _Safe::_M_swap(__list); - _Base::swap(__list); - } - - void - resize(size_type __sz) - { - this->_M_detach_singular(); - - // if __sz < size(), invalidate all iterators in [begin+__sz, end() - _Base_iterator __victim = _Base::begin(); - _Base_iterator __end = _Base::end(); - for (size_type __i = __sz; __victim != __end && __i > 0; --__i) - ++__victim; - - for (; __victim != __end; ++__victim) - { - this->_M_invalidate_if([__victim](_Base_const_iterator __it) - { return __it == __victim; }); - } - - __try - { - _Base::resize(__sz); - } - __catch(...) - { - this->_M_revalidate_singular(); - __throw_exception_again; - } - } - - void - resize(size_type __sz, const value_type& __val) - { - this->_M_detach_singular(); - - // if __sz < size(), invalidate all iterators in [begin+__sz, end()) - _Base_iterator __victim = _Base::begin(); - _Base_iterator __end = _Base::end(); - for (size_type __i = __sz; __victim != __end && __i > 0; --__i) - ++__victim; - - for (; __victim != __end; ++__victim) - { - this->_M_invalidate_if([__victim](_Base_const_iterator __it) - { return __it == __victim; }); - } - - __try - { - _Base::resize(__sz, __val); - } - __catch(...) - { - this->_M_revalidate_singular(); - __throw_exception_again; - } - } - - void - clear() noexcept - { - _Base::clear(); - this->_M_invalidate_all(); - } - - // 23.2.3.5 forward_list operations: - void - splice_after(const_iterator __pos, forward_list&& __list) - { - __glibcxx_check_insert_after(__pos); - _GLIBCXX_DEBUG_VERIFY(&__list != this, - _M_message(__gnu_debug::__msg_self_splice) - ._M_sequence(*this, "this")); - _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(), - _M_message(__gnu_debug::__msg_splice_alloc) - ._M_sequence(*this) - ._M_sequence(__list, "__list")); - this->_M_transfer_from_if(__list, [&__list](_Base_const_iterator __it) - { - return __it != __list._M_base().cbefore_begin() - && __it != __list._M_base().end(); - }); - _Base::splice_after(__pos.base(), std::move(__list._M_base())); - } - - void - splice_after(const_iterator __pos, forward_list& __list) - { splice_after(__pos, std::move(__list)); } - - void - splice_after(const_iterator __pos, forward_list&& __list, - const_iterator __i) - { - __glibcxx_check_insert_after(__pos); - _GLIBCXX_DEBUG_VERIFY(__i._M_before_dereferenceable(), - _M_message(__gnu_debug::__msg_splice_bad) - ._M_iterator(__i, "__i")); - _GLIBCXX_DEBUG_VERIFY(__i._M_attached_to(&__list), - _M_message(__gnu_debug::__msg_splice_other) - ._M_iterator(__i, "__i") - ._M_sequence(__list, "__list")); - _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(), - _M_message(__gnu_debug::__msg_splice_alloc) - ._M_sequence(*this) - ._M_sequence(__list, "__list")); - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 250. splicing invalidates iterators - _Base_const_iterator __next = std::next(__i.base()); - this->_M_transfer_from_if(__list, [__next](_Base_const_iterator __it) - { return __it == __next; }); - _Base::splice_after(__pos.base(), std::move(__list._M_base()), - __i.base()); - } - - void - splice_after(const_iterator __pos, forward_list& __list, - const_iterator __i) - { splice_after(__pos, std::move(__list), __i); } - - void - splice_after(const_iterator __pos, forward_list&& __list, - const_iterator __before, const_iterator __last) - { - __glibcxx_check_insert_after(__pos); - __glibcxx_check_valid_range(__before, __last); - _GLIBCXX_DEBUG_VERIFY(__before._M_attached_to(&__list), - _M_message(__gnu_debug::__msg_splice_other) - ._M_sequence(__list, "list") - ._M_iterator(__before, "before")); - _GLIBCXX_DEBUG_VERIFY(__before._M_dereferenceable() - || __before._M_is_before_begin(), - _M_message(__gnu_debug::__msg_valid_range2) - ._M_sequence(__list, "list") - ._M_iterator(__before, "before") - ._M_iterator(__last, "last")); - _GLIBCXX_DEBUG_VERIFY(__before != __last, - _M_message(__gnu_debug::__msg_valid_range2) - ._M_sequence(__list, "list") - ._M_iterator(__before, "before") - ._M_iterator(__last, "last")); - _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(), - _M_message(__gnu_debug::__msg_splice_alloc) - ._M_sequence(*this) - ._M_sequence(__list, "__list")); - - for (_Base_const_iterator __tmp = std::next(__before.base()); - __tmp != __last.base(); ++__tmp) - { - _GLIBCXX_DEBUG_VERIFY(__tmp != __list._M_base().end(), - _M_message(__gnu_debug::__msg_valid_range2) - ._M_sequence(__list, "list") - ._M_iterator(__before, "before") - ._M_iterator(__last, "last")); - _GLIBCXX_DEBUG_VERIFY(&__list != this || __tmp != __pos.base(), - _M_message(__gnu_debug::__msg_splice_overlap) - ._M_iterator(__tmp, "position") - ._M_iterator(__before, "before") - ._M_iterator(__last, "last")); - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 250. splicing invalidates iterators - this->_M_transfer_from_if(__list, [__tmp](_Base_const_iterator __it) - { return __it == __tmp; }); - } - - _Base::splice_after(__pos.base(), std::move(__list._M_base()), - __before.base(), __last.base()); - } - - void - splice_after(const_iterator __pos, forward_list& __list, - const_iterator __before, const_iterator __last) - { splice_after(__pos, std::move(__list), __before, __last); } - - void - remove(const _Tp& __val) - { - _Base_iterator __x = _Base::before_begin(); - _Base_iterator __old = __x++; - while (__x != _Base::end()) - { - if (*__x == __val) - __x = _M_erase_after(__old); - else - __old = __x++; - } - } - - template - void - remove_if(_Pred __pred) - { - _Base_iterator __x = _Base::before_begin(); - _Base_iterator __old = __x++; - while (__x != _Base::end()) - { - if (__pred(*__x)) - __x = _M_erase_after(__old); - else - __old = __x++; - } - } - - void - unique() - { - _Base_iterator __first = _Base::begin(); - _Base_iterator __last = _Base::end(); - if (__first == __last) - return; - _Base_iterator __next = std::next(__first); - while (__next != __last) - { - if (*__first == *__next) - __next = _M_erase_after(__first); - else - __first = __next++; - } - } - - template - void - unique(_BinPred __binary_pred) - { - _Base_iterator __first = _Base::begin(); - _Base_iterator __last = _Base::end(); - if (__first == __last) - return; - _Base_iterator __next = std::next(__first); - while (__next != __last) - { - if (__binary_pred(*__first, *__next)) - __next = _M_erase_after(__first); - else - __first = __next++; - } - } - - void - merge(forward_list&& __list) - { - if (this != &__list) - { - __glibcxx_check_sorted(_Base::begin(), _Base::end()); - __glibcxx_check_sorted(__list._M_base().begin(), - __list._M_base().end()); - this->_M_transfer_from_if(__list, [&__list](_Base_const_iterator __it) - { - return __it != __list._M_base().cbefore_begin() - && __it != __list._M_base().cend(); - }); - _Base::merge(std::move(__list._M_base())); - } - } - - void - merge(forward_list& __list) - { merge(std::move(__list)); } - - template - void - merge(forward_list&& __list, _Comp __comp) - { - if (this != &__list) - { - __glibcxx_check_sorted_pred(_Base::begin(), _Base::end(), __comp); - __glibcxx_check_sorted_pred(__list._M_base().begin(), - __list._M_base().end(), __comp); - this->_M_transfer_from_if(__list, - [&__list](_Base_const_iterator __it) - { - return __it != __list._M_base().cbefore_begin() - && __it != __list._M_base().cend(); - }); - _Base::merge(std::move(__list._M_base()), __comp); - } - } - - template - void - merge(forward_list& __list, _Comp __comp) - { merge(std::move(__list), __comp); } - - using _Base::sort; - using _Base::reverse; - - _Base& - _M_base() noexcept { return *this; } - - const _Base& - _M_base() const noexcept { return *this; } - }; - - template - bool - operator==(const forward_list<_Tp, _Alloc>& __lx, - const forward_list<_Tp, _Alloc>& __ly) - { return __lx._M_base() == __ly._M_base(); } - - template - inline bool - operator<(const forward_list<_Tp, _Alloc>& __lx, - const forward_list<_Tp, _Alloc>& __ly) - { return __lx._M_base() < __ly._M_base(); } - - template - inline bool - operator!=(const forward_list<_Tp, _Alloc>& __lx, - const forward_list<_Tp, _Alloc>& __ly) - { return !(__lx == __ly); } - - /// Based on operator< - template - inline bool - operator>(const forward_list<_Tp, _Alloc>& __lx, - const forward_list<_Tp, _Alloc>& __ly) - { return (__ly < __lx); } - - /// Based on operator< - template - inline bool - operator>=(const forward_list<_Tp, _Alloc>& __lx, - const forward_list<_Tp, _Alloc>& __ly) - { return !(__lx < __ly); } - - /// Based on operator< - template - inline bool - operator<=(const forward_list<_Tp, _Alloc>& __lx, - const forward_list<_Tp, _Alloc>& __ly) - { return !(__ly < __lx); } - - /// See std::forward_list::swap(). - template - inline void - swap(forward_list<_Tp, _Alloc>& __lx, - forward_list<_Tp, _Alloc>& __ly) - { __lx.swap(__ly); } - -} // namespace __debug -} // namespace std - -namespace __gnu_debug -{ - template - struct _BeforeBeginHelper > - { - typedef std::__debug::forward_list<_Tp, _Alloc> _Sequence; - - template - static bool - _S_Is(const _Safe_iterator<_Iterator, _Sequence>& __it) - { - return - __it.base() == __it._M_get_sequence()->_M_base().before_begin(); - } - - template - static bool - _S_Is_Beginnest(const _Safe_iterator<_Iterator, _Sequence>& __it) - { return _S_Is(__it); } - }; - -#ifndef _GLIBCXX_DEBUG_PEDANTIC - template - struct _Insert_range_from_self_is_safe< - std::__debug::forward_list<_Tp, _Alloc> > - { enum { __value = 1 }; }; -#endif -} - -#endif diff --git a/openflow/usr/include/c++/5/debug/functions.h b/openflow/usr/include/c++/5/debug/functions.h deleted file mode 100644 index 3bbbd13..0000000 --- a/openflow/usr/include/c++/5/debug/functions.h +++ /dev/null @@ -1,562 +0,0 @@ -// Debugging support implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/functions.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_FUNCTIONS_H -#define _GLIBCXX_DEBUG_FUNCTIONS_H 1 - -#include -#include // for iterator_traits, categories and - // _Iter_base -#include // for __is_integer -#include // for __addressof and addressof -#include // for less -#if __cplusplus >= 201103L -# include // for is_lvalue_reference and __and_ -#endif -#include - -namespace __gnu_debug -{ - template - class _Safe_iterator; - - template - class _Safe_local_iterator; - - template - struct _Insert_range_from_self_is_safe - { enum { __value = 0 }; }; - - template - struct _Is_contiguous_sequence : std::__false_type { }; - - // An arbitrary iterator pointer is not singular. - inline bool - __check_singular_aux(const void*) { return false; } - - // We may have an iterator that derives from _Safe_iterator_base but isn't - // a _Safe_iterator. - template - inline bool - __check_singular(const _Iterator& __x) - { return __check_singular_aux(&__x); } - - /** Non-NULL pointers are nonsingular. */ - template - inline bool - __check_singular(const _Tp* __ptr) - { return __ptr == 0; } - - /** Assume that some arbitrary iterator is dereferenceable, because we - can't prove that it isn't. */ - template - inline bool - __check_dereferenceable(const _Iterator&) - { return true; } - - /** Non-NULL pointers are dereferenceable. */ - template - inline bool - __check_dereferenceable(const _Tp* __ptr) - { return __ptr; } - - /** Safe iterators know if they are dereferenceable. */ - template - inline bool - __check_dereferenceable(const _Safe_iterator<_Iterator, _Sequence>& __x) - { return __x._M_dereferenceable(); } - - /** Safe local iterators know if they are dereferenceable. */ - template - inline bool - __check_dereferenceable(const _Safe_local_iterator<_Iterator, - _Sequence>& __x) - { return __x._M_dereferenceable(); } - - /** If the distance between two random access iterators is - * nonnegative, assume the range is valid. - */ - template - inline bool - __valid_range_aux2(const _RandomAccessIterator& __first, - const _RandomAccessIterator& __last, - std::random_access_iterator_tag) - { return __last - __first >= 0; } - - /** Can't test for a valid range with input iterators, because - * iteration may be destructive. So we just assume that the range - * is valid. - */ - template - inline bool - __valid_range_aux2(const _InputIterator&, const _InputIterator&, - std::input_iterator_tag) - { return true; } - - /** We say that integral types for a valid range, and defer to other - * routines to realize what to do with integral types instead of - * iterators. - */ - template - inline bool - __valid_range_aux(const _Integral&, const _Integral&, std::__true_type) - { return true; } - - /** We have iterators, so figure out what kind of iterators that are - * to see if we can check the range ahead of time. - */ - template - inline bool - __valid_range_aux(const _InputIterator& __first, - const _InputIterator& __last, std::__false_type) - { return __valid_range_aux2(__first, __last, - std::__iterator_category(__first)); } - - /** Don't know what these iterators are, or if they are even - * iterators (we may get an integral type for InputIterator), so - * see if they are integral and pass them on to the next phase - * otherwise. - */ - template - inline bool - __valid_range(const _InputIterator& __first, const _InputIterator& __last) - { - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - return __valid_range_aux(__first, __last, _Integral()); - } - - /** Safe iterators know how to check if they form a valid range. */ - template - inline bool - __valid_range(const _Safe_iterator<_Iterator, _Sequence>& __first, - const _Safe_iterator<_Iterator, _Sequence>& __last) - { return __first._M_valid_range(__last); } - - /** Safe local iterators know how to check if they form a valid range. */ - template - inline bool - __valid_range(const _Safe_local_iterator<_Iterator, _Sequence>& __first, - const _Safe_local_iterator<_Iterator, _Sequence>& __last) - { return __first._M_valid_range(__last); } - - /* Checks that [first, last) is a valid range, and then returns - * __first. This routine is useful when we can't use a separate - * assertion statement because, e.g., we are in a constructor. - */ - template - inline _InputIterator - __check_valid_range(const _InputIterator& __first, - const _InputIterator& __last - __attribute__((__unused__))) - { - __glibcxx_check_valid_range(__first, __last); - return __first; - } - - /* Handle the case where __other is a pointer to _Sequence::value_type. */ - template - inline bool - __foreign_iterator_aux4(const _Safe_iterator<_Iterator, _Sequence>& __it, - const typename _Sequence::value_type* __other) - { - typedef const typename _Sequence::value_type* _PointerType; - typedef std::less<_PointerType> _Less; -#if __cplusplus >= 201103L - constexpr _Less __l{}; -#else - const _Less __l = _Less(); -#endif - const _Sequence* __seq = __it._M_get_sequence(); - const _PointerType __begin = std::__addressof(*__seq->_M_base().begin()); - const _PointerType __end = std::__addressof(*(__seq->_M_base().end()-1)); - - // Check whether __other points within the contiguous storage. - return __l(__other, __begin) || __l(__end, __other); - } - - /* Fallback overload for when we can't tell, assume it is valid. */ - template - inline bool - __foreign_iterator_aux4(const _Safe_iterator<_Iterator, _Sequence>&, ...) - { return true; } - - /* Handle sequences with contiguous storage */ - template - inline bool - __foreign_iterator_aux3(const _Safe_iterator<_Iterator, _Sequence>& __it, - const _InputIterator& __other, - const _InputIterator& __other_end, - std::__true_type) - { - if (__other == __other_end) - return true; // inserting nothing is safe even if not foreign iters - if (__it._M_get_sequence()->begin() == __it._M_get_sequence()->end()) - return true; // can't be self-inserting if self is empty - return __foreign_iterator_aux4(__it, std::__addressof(*__other)); - } - - /* Handle non-contiguous containers, assume it is valid. */ - template - inline bool - __foreign_iterator_aux3(const _Safe_iterator<_Iterator, _Sequence>&, - const _InputIterator&, const _InputIterator&, - std::__false_type) - { return true; } - - /** Handle debug iterators from the same type of container. */ - template - inline bool - __foreign_iterator_aux2(const _Safe_iterator<_Iterator, _Sequence>& __it, - const _Safe_iterator<_OtherIterator, _Sequence>& __other, - const _Safe_iterator<_OtherIterator, _Sequence>&) - { return __it._M_get_sequence() != __other._M_get_sequence(); } - - /** Handle debug iterators from different types of container. */ - template - inline bool - __foreign_iterator_aux2(const _Safe_iterator<_Iterator, _Sequence>& __it, - const _Safe_iterator<_OtherIterator, _OtherSequence>&, - const _Safe_iterator<_OtherIterator, _OtherSequence>&) - { return true; } - - /* Handle non-debug iterators. */ - template - inline bool - __foreign_iterator_aux2(const _Safe_iterator<_Iterator, _Sequence>& __it, - const _InputIterator& __other, - const _InputIterator& __other_end) - { -#if __cplusplus < 201103L - typedef _Is_contiguous_sequence<_Sequence> __tag; -#else - using __lvalref = std::is_lvalue_reference< - typename std::iterator_traits<_InputIterator>::reference>; - using __contiguous = _Is_contiguous_sequence<_Sequence>; - using __tag = typename std::conditional<__lvalref::value, __contiguous, - std::__false_type>::type; -#endif - return __foreign_iterator_aux3(__it, __other, __other_end, __tag()); - } - - /* Handle the case where we aren't really inserting a range after all */ - template - inline bool - __foreign_iterator_aux(const _Safe_iterator<_Iterator, _Sequence>&, - _Integral, _Integral, - std::__true_type) - { return true; } - - /* Handle all iterators. */ - template - inline bool - __foreign_iterator_aux(const _Safe_iterator<_Iterator, _Sequence>& __it, - _InputIterator __other, _InputIterator __other_end, - std::__false_type) - { - return _Insert_range_from_self_is_safe<_Sequence>::__value - || __foreign_iterator_aux2(__it, __other, __other_end); - } - - template - inline bool - __foreign_iterator(const _Safe_iterator<_Iterator, _Sequence>& __it, - _InputIterator __other, _InputIterator __other_end) - { - typedef typename std::__is_integer<_InputIterator>::__type _Integral; - return __foreign_iterator_aux(__it, __other, __other_end, _Integral()); - } - - /** Checks that __s is non-NULL or __n == 0, and then returns __s. */ - template - inline const _CharT* - __check_string(const _CharT* __s, - const _Integer& __n __attribute__((__unused__))) - { -#ifdef _GLIBCXX_DEBUG_PEDANTIC - __glibcxx_assert(__s != 0 || __n == 0); -#endif - return __s; - } - - /** Checks that __s is non-NULL and then returns __s. */ - template - inline const _CharT* - __check_string(const _CharT* __s) - { -#ifdef _GLIBCXX_DEBUG_PEDANTIC - __glibcxx_assert(__s != 0); -#endif - return __s; - } - - // Can't check if an input iterator sequence is sorted, because we - // can't step through the sequence. - template - inline bool - __check_sorted_aux(const _InputIterator&, const _InputIterator&, - std::input_iterator_tag) - { return true; } - - // Can verify if a forward iterator sequence is in fact sorted using - // std::__is_sorted - template - inline bool - __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last, - std::forward_iterator_tag) - { - if (__first == __last) - return true; - - _ForwardIterator __next = __first; - for (++__next; __next != __last; __first = __next, ++__next) - if (*__next < *__first) - return false; - - return true; - } - - // Can't check if an input iterator sequence is sorted, because we can't step - // through the sequence. - template - inline bool - __check_sorted_aux(const _InputIterator&, const _InputIterator&, - _Predicate, std::input_iterator_tag) - { return true; } - - // Can verify if a forward iterator sequence is in fact sorted using - // std::__is_sorted - template - inline bool - __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last, - _Predicate __pred, std::forward_iterator_tag) - { - if (__first == __last) - return true; - - _ForwardIterator __next = __first; - for (++__next; __next != __last; __first = __next, ++__next) - if (__pred(*__next, *__first)) - return false; - - return true; - } - - // Determine if a sequence is sorted. - template - inline bool - __check_sorted(const _InputIterator& __first, const _InputIterator& __last) - { - // Verify that the < operator for elements in the sequence is a - // StrictWeakOrdering by checking that it is irreflexive. - __glibcxx_assert(__first == __last || !(*__first < *__first)); - - return __check_sorted_aux(__first, __last, - std::__iterator_category(__first)); - } - - template - inline bool - __check_sorted(const _InputIterator& __first, const _InputIterator& __last, - _Predicate __pred) - { - // Verify that the predicate is StrictWeakOrdering by checking that it - // is irreflexive. - __glibcxx_assert(__first == __last || !__pred(*__first, *__first)); - - return __check_sorted_aux(__first, __last, __pred, - std::__iterator_category(__first)); - } - - template - inline bool - __check_sorted_set_aux(const _InputIterator& __first, - const _InputIterator& __last, - std::__true_type) - { return __check_sorted(__first, __last); } - - template - inline bool - __check_sorted_set_aux(const _InputIterator&, - const _InputIterator&, - std::__false_type) - { return true; } - - template - inline bool - __check_sorted_set_aux(const _InputIterator& __first, - const _InputIterator& __last, - _Predicate __pred, std::__true_type) - { return __check_sorted(__first, __last, __pred); } - - template - inline bool - __check_sorted_set_aux(const _InputIterator&, - const _InputIterator&, _Predicate, - std::__false_type) - { return true; } - - // ... special variant used in std::merge, std::includes, std::set_*. - template - inline bool - __check_sorted_set(const _InputIterator1& __first, - const _InputIterator1& __last, - const _InputIterator2&) - { - typedef typename std::iterator_traits<_InputIterator1>::value_type - _ValueType1; - typedef typename std::iterator_traits<_InputIterator2>::value_type - _ValueType2; - - typedef typename std::__are_same<_ValueType1, _ValueType2>::__type - _SameType; - return __check_sorted_set_aux(__first, __last, _SameType()); - } - - template - inline bool - __check_sorted_set(const _InputIterator1& __first, - const _InputIterator1& __last, - const _InputIterator2&, _Predicate __pred) - { - typedef typename std::iterator_traits<_InputIterator1>::value_type - _ValueType1; - typedef typename std::iterator_traits<_InputIterator2>::value_type - _ValueType2; - - typedef typename std::__are_same<_ValueType1, _ValueType2>::__type - _SameType; - return __check_sorted_set_aux(__first, __last, __pred, _SameType()); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 270. Binary search requirements overly strict - // Determine if a sequence is partitioned w.r.t. this element. - template - inline bool - __check_partitioned_lower(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value) - { - while (__first != __last && *__first < __value) - ++__first; - if (__first != __last) - { - ++__first; - while (__first != __last && !(*__first < __value)) - ++__first; - } - return __first == __last; - } - - template - inline bool - __check_partitioned_upper(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value) - { - while (__first != __last && !(__value < *__first)) - ++__first; - if (__first != __last) - { - ++__first; - while (__first != __last && __value < *__first) - ++__first; - } - return __first == __last; - } - - // Determine if a sequence is partitioned w.r.t. this element. - template - inline bool - __check_partitioned_lower(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value, - _Pred __pred) - { - while (__first != __last && bool(__pred(*__first, __value))) - ++__first; - if (__first != __last) - { - ++__first; - while (__first != __last && !bool(__pred(*__first, __value))) - ++__first; - } - return __first == __last; - } - - template - inline bool - __check_partitioned_upper(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value, - _Pred __pred) - { - while (__first != __last && !bool(__pred(__value, *__first))) - ++__first; - if (__first != __last) - { - ++__first; - while (__first != __last && bool(__pred(__value, *__first))) - ++__first; - } - return __first == __last; - } - - // Helper struct to detect random access safe iterators. - template - struct __is_safe_random_iterator - { - enum { __value = 0 }; - typedef std::__false_type __type; - }; - - template - struct __is_safe_random_iterator<_Safe_iterator<_Iterator, _Sequence> > - : std::__are_same:: - iterator_category> - { }; - - template - struct _Siter_base - : std::_Iter_base<_Iterator, __is_safe_random_iterator<_Iterator>::__value> - { }; - - /** Helper function to extract base iterator of random access safe iterator - in order to reduce performance impact of debug mode. Limited to random - access iterator because it is the only category for which it is possible - to check for correct iterators order in the __valid_range function - thanks to the < operator. - */ - template - inline typename _Siter_base<_Iterator>::iterator_type - __base(_Iterator __it) - { return _Siter_base<_Iterator>::_S_base(__it); } -} // namespace __gnu_debug - -#endif diff --git a/openflow/usr/include/c++/5/debug/list b/openflow/usr/include/c++/5/debug/list deleted file mode 100644 index 41ed7f5..0000000 --- a/openflow/usr/include/c++/5/debug/list +++ /dev/null @@ -1,800 +0,0 @@ -// Debugging list implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/list - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_LIST -#define _GLIBCXX_DEBUG_LIST 1 - -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __debug -{ - /// Class std::list with safety/checking/debug instrumentation. - template > - class list - : public __gnu_debug::_Safe_container< - list<_Tp, _Allocator>, _Allocator, - __gnu_debug::_Safe_node_sequence, false>, - public _GLIBCXX_STD_C::list<_Tp, _Allocator> - { - typedef _GLIBCXX_STD_C::list<_Tp, _Allocator> _Base; - typedef __gnu_debug::_Safe_container< - list, _Allocator, __gnu_debug::_Safe_node_sequence, false> _Safe; - - typedef typename _Base::iterator _Base_iterator; - typedef typename _Base::const_iterator _Base_const_iterator; - typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; - typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; - - public: - typedef typename _Base::reference reference; - typedef typename _Base::const_reference const_reference; - - typedef __gnu_debug::_Safe_iterator<_Base_iterator, list> - iterator; - typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, list> - const_iterator; - - typedef typename _Base::size_type size_type; - typedef typename _Base::difference_type difference_type; - - typedef _Tp value_type; - typedef _Allocator allocator_type; - typedef typename _Base::pointer pointer; - typedef typename _Base::const_pointer const_pointer; - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - // 23.2.2.1 construct/copy/destroy: - -#if __cplusplus < 201103L - list() - : _Base() { } - - list(const list& __x) - : _Base(__x) { } - - ~list() { } -#else - list() = default; - list(const list&) = default; - list(list&&) = default; - - list(initializer_list __l, - const allocator_type& __a = allocator_type()) - : _Base(__l, __a) { } - - ~list() = default; -#endif - - explicit - list(const _Allocator& __a) _GLIBCXX_NOEXCEPT - : _Base(__a) { } - -#if __cplusplus >= 201103L - explicit - list(size_type __n) - : _Base(__n) { } - - list(size_type __n, const _Tp& __value, - const _Allocator& __a = _Allocator()) - : _Base(__n, __value, __a) { } -#else - explicit - list(size_type __n, const _Tp& __value = _Tp(), - const _Allocator& __a = _Allocator()) - : _Base(__n, __value, __a) { } -#endif - -#if __cplusplus >= 201103L - template> -#else - template -#endif - list(_InputIterator __first, _InputIterator __last, - const _Allocator& __a = _Allocator()) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), __a) - { } - - list(const _Base& __x) - : _Base(__x) { } - -#if __cplusplus < 201103L - list& - operator=(const list& __x) - { - this->_M_safe() = __x; - _M_base() = __x; - return *this; - } -#else - list& - operator=(const list&) = default; - - list& - operator=(list&&) = default; - - list& - operator=(initializer_list __l) - { - this->_M_invalidate_all(); - _M_base() = __l; - return *this; - } - - void - assign(initializer_list __l) - { - _Base::assign(__l); - this->_M_invalidate_all(); - } -#endif - -#if __cplusplus >= 201103L - template> -#else - template -#endif - void - assign(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - _Base::assign(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - this->_M_invalidate_all(); - } - - void - assign(size_type __n, const _Tp& __t) - { - _Base::assign(__n, __t); - this->_M_invalidate_all(); - } - - using _Base::get_allocator; - - // iterators: - iterator - begin() _GLIBCXX_NOEXCEPT - { return iterator(_Base::begin(), this); } - - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::begin(), this); } - - iterator - end() _GLIBCXX_NOEXCEPT - { return iterator(_Base::end(), this); } - - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::end(), this); } - - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return reverse_iterator(end()); } - - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(end()); } - - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return reverse_iterator(begin()); } - - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(begin()); } - -#if __cplusplus >= 201103L - const_iterator - cbegin() const noexcept - { return const_iterator(_Base::begin(), this); } - - const_iterator - cend() const noexcept - { return const_iterator(_Base::end(), this); } - - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(end()); } - - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(begin()); } -#endif - - // 23.2.2.2 capacity: - using _Base::empty; - using _Base::size; - using _Base::max_size; - -#if __cplusplus >= 201103L - void - resize(size_type __sz) - { - this->_M_detach_singular(); - - // if __sz < size(), invalidate all iterators in [begin + __sz, end()) - _Base_iterator __victim = _Base::begin(); - _Base_iterator __end = _Base::end(); - for (size_type __i = __sz; __victim != __end && __i > 0; --__i) - ++__victim; - - for (; __victim != __end; ++__victim) - this->_M_invalidate_if(_Equal(__victim)); - - __try - { - _Base::resize(__sz); - } - __catch(...) - { - this->_M_revalidate_singular(); - __throw_exception_again; - } - } - - void - resize(size_type __sz, const _Tp& __c) - { - this->_M_detach_singular(); - - // if __sz < size(), invalidate all iterators in [begin + __sz, end()) - _Base_iterator __victim = _Base::begin(); - _Base_iterator __end = _Base::end(); - for (size_type __i = __sz; __victim != __end && __i > 0; --__i) - ++__victim; - - for (; __victim != __end; ++__victim) - this->_M_invalidate_if(_Equal(__victim)); - - __try - { - _Base::resize(__sz, __c); - } - __catch(...) - { - this->_M_revalidate_singular(); - __throw_exception_again; - } - } -#else - void - resize(size_type __sz, _Tp __c = _Tp()) - { - this->_M_detach_singular(); - - // if __sz < size(), invalidate all iterators in [begin + __sz, end()) - _Base_iterator __victim = _Base::begin(); - _Base_iterator __end = _Base::end(); - for (size_type __i = __sz; __victim != __end && __i > 0; --__i) - ++__victim; - - for (; __victim != __end; ++__victim) - this->_M_invalidate_if(_Equal(__victim)); - - __try - { - _Base::resize(__sz, __c); - } - __catch(...) - { - this->_M_revalidate_singular(); - __throw_exception_again; - } - } -#endif - - // element access: - reference - front() _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - return _Base::front(); - } - - const_reference - front() const _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - return _Base::front(); - } - - reference - back() _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - return _Base::back(); - } - - const_reference - back() const _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - return _Base::back(); - } - - // 23.2.2.3 modifiers: - using _Base::push_front; - -#if __cplusplus >= 201103L - using _Base::emplace_front; -#endif - - void - pop_front() _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - this->_M_invalidate_if(_Equal(_Base::begin())); - _Base::pop_front(); - } - - using _Base::push_back; - -#if __cplusplus >= 201103L - using _Base::emplace_back; -#endif - - void - pop_back() _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - this->_M_invalidate_if(_Equal(--_Base::end())); - _Base::pop_back(); - } - -#if __cplusplus >= 201103L - template - iterator - emplace(const_iterator __position, _Args&&... __args) - { - __glibcxx_check_insert(__position); - return iterator(_Base::emplace(__position.base(), - std::forward<_Args>(__args)...), this); - } -#endif - - iterator -#if __cplusplus >= 201103L - insert(const_iterator __position, const _Tp& __x) -#else - insert(iterator __position, const _Tp& __x) -#endif - { - __glibcxx_check_insert(__position); - return iterator(_Base::insert(__position.base(), __x), this); - } - -#if __cplusplus >= 201103L - iterator - insert(const_iterator __position, _Tp&& __x) - { return emplace(__position, std::move(__x)); } - - iterator - insert(const_iterator __p, initializer_list __l) - { - __glibcxx_check_insert(__p); - return iterator(_Base::insert(__p.base(), __l), this); - } -#endif - -#if __cplusplus >= 201103L - iterator - insert(const_iterator __position, size_type __n, const _Tp& __x) - { - __glibcxx_check_insert(__position); - return iterator(_Base::insert(__position.base(), __n, __x), this); - } -#else - void - insert(iterator __position, size_type __n, const _Tp& __x) - { - __glibcxx_check_insert(__position); - _Base::insert(__position.base(), __n, __x); - } -#endif - -#if __cplusplus >= 201103L - template> - iterator - insert(const_iterator __position, _InputIterator __first, - _InputIterator __last) - { - __glibcxx_check_insert_range(__position, __first, __last); - return iterator(_Base::insert(__position.base(), - __gnu_debug::__base(__first), - __gnu_debug::__base(__last)), - this); - } -#else - template - void - insert(iterator __position, _InputIterator __first, - _InputIterator __last) - { - __glibcxx_check_insert_range(__position, __first, __last); - _Base::insert(__position.base(), __gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - } -#endif - - private: - _Base_iterator -#if __cplusplus >= 201103L - _M_erase(_Base_const_iterator __position) noexcept -#else - _M_erase(_Base_iterator __position) -#endif - { - this->_M_invalidate_if(_Equal(__position)); - return _Base::erase(__position); - } - - public: - iterator -#if __cplusplus >= 201103L - erase(const_iterator __position) noexcept -#else - erase(iterator __position) -#endif - { - __glibcxx_check_erase(__position); - return iterator(_M_erase(__position.base()), this); - } - - iterator -#if __cplusplus >= 201103L - erase(const_iterator __first, const_iterator __last) noexcept -#else - erase(iterator __first, iterator __last) -#endif - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 151. can't currently clear() empty container - __glibcxx_check_erase_range(__first, __last); - for (_Base_const_iterator __victim = __first.base(); - __victim != __last.base(); ++__victim) - { - _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "position") - ._M_iterator(__last, "last")); - this->_M_invalidate_if(_Equal(__victim)); - } - return iterator(_Base::erase(__first.base(), __last.base()), this); - } - - void - swap(list& __x) -#if __cplusplus >= 201103L - noexcept( noexcept(declval<_Base>().swap(__x)) ) -#endif - { - _Safe::_M_swap(__x); - _Base::swap(__x); - } - - void - clear() _GLIBCXX_NOEXCEPT - { - _Base::clear(); - this->_M_invalidate_all(); - } - - // 23.2.2.4 list operations: - void -#if __cplusplus >= 201103L - splice(const_iterator __position, list&& __x) noexcept -#else - splice(iterator __position, list& __x) -#endif - { - _GLIBCXX_DEBUG_VERIFY(&__x != this, - _M_message(__gnu_debug::__msg_self_splice) - ._M_sequence(*this, "this")); - this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end())); - _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base())); - } - -#if __cplusplus >= 201103L - void - splice(const_iterator __position, list& __x) noexcept - { splice(__position, std::move(__x)); } -#endif - - void -#if __cplusplus >= 201103L - splice(const_iterator __position, list&& __x, const_iterator __i) noexcept -#else - splice(iterator __position, list& __x, iterator __i) -#endif - { - __glibcxx_check_insert(__position); - - // We used to perform the splice_alloc check: not anymore, redundant - // after implementing the relevant bits of N1599. - - _GLIBCXX_DEBUG_VERIFY(__i._M_dereferenceable(), - _M_message(__gnu_debug::__msg_splice_bad) - ._M_iterator(__i, "__i")); - _GLIBCXX_DEBUG_VERIFY(__i._M_attached_to(&__x), - _M_message(__gnu_debug::__msg_splice_other) - ._M_iterator(__i, "__i")._M_sequence(__x, "__x")); - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 250. splicing invalidates iterators - this->_M_transfer_from_if(__x, _Equal(__i.base())); - _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()), - __i.base()); - } - -#if __cplusplus >= 201103L - void - splice(const_iterator __position, list& __x, const_iterator __i) noexcept - { splice(__position, std::move(__x), __i); } -#endif - - void -#if __cplusplus >= 201103L - splice(const_iterator __position, list&& __x, const_iterator __first, - const_iterator __last) noexcept -#else - splice(iterator __position, list& __x, iterator __first, - iterator __last) -#endif - { - __glibcxx_check_insert(__position); - __glibcxx_check_valid_range(__first, __last); - _GLIBCXX_DEBUG_VERIFY(__first._M_attached_to(&__x), - _M_message(__gnu_debug::__msg_splice_other) - ._M_sequence(__x, "x") - ._M_iterator(__first, "first")); - - // We used to perform the splice_alloc check: not anymore, redundant - // after implementing the relevant bits of N1599. - - for (_Base_const_iterator __tmp = __first.base(); - __tmp != __last.base(); ++__tmp) - { - _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - _GLIBCXX_DEBUG_VERIFY(&__x != this || __tmp != __position.base(), - _M_message(__gnu_debug::__msg_splice_overlap) - ._M_iterator(__tmp, "position") - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 250. splicing invalidates iterators - this->_M_transfer_from_if(__x, _Equal(__tmp)); - } - - _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()), - __first.base(), __last.base()); - } - -#if __cplusplus >= 201103L - void - splice(const_iterator __position, list& __x, - const_iterator __first, const_iterator __last) noexcept - { splice(__position, std::move(__x), __first, __last); } -#endif - - void - remove(const _Tp& __value) - { - for (_Base_iterator __x = _Base::begin(); __x != _Base::end(); ) - { - if (*__x == __value) - __x = _M_erase(__x); - else - ++__x; - } - } - - template - void - remove_if(_Predicate __pred) - { - for (_Base_iterator __x = _Base::begin(); __x != _Base::end(); ) - { - if (__pred(*__x)) - __x = _M_erase(__x); - else - ++__x; - } - } - - void - unique() - { - _Base_iterator __first = _Base::begin(); - _Base_iterator __last = _Base::end(); - if (__first == __last) - return; - _Base_iterator __next = __first; ++__next; - while (__next != __last) - { - if (*__first == *__next) - __next = _M_erase(__next); - else - __first = __next++; - } - } - - template - void - unique(_BinaryPredicate __binary_pred) - { - _Base_iterator __first = _Base::begin(); - _Base_iterator __last = _Base::end(); - if (__first == __last) - return; - _Base_iterator __next = __first; ++__next; - while (__next != __last) - { - if (__binary_pred(*__first, *__next)) - __next = _M_erase(__next); - else - __first = __next++; - } - } - - void -#if __cplusplus >= 201103L - merge(list&& __x) -#else - merge(list& __x) -#endif - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 300. list::merge() specification incomplete - if (this != &__x) - { - __glibcxx_check_sorted(_Base::begin(), _Base::end()); - __glibcxx_check_sorted(__x.begin().base(), __x.end().base()); - this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end())); - _Base::merge(_GLIBCXX_MOVE(__x._M_base())); - } - } - -#if __cplusplus >= 201103L - void - merge(list& __x) - { merge(std::move(__x)); } -#endif - - template - void -#if __cplusplus >= 201103L - merge(list&& __x, _Compare __comp) -#else - merge(list& __x, _Compare __comp) -#endif - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 300. list::merge() specification incomplete - if (this != &__x) - { - __glibcxx_check_sorted_pred(_Base::begin(), _Base::end(), - __comp); - __glibcxx_check_sorted_pred(__x.begin().base(), __x.end().base(), - __comp); - this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end())); - _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp); - } - } - -#if __cplusplus >= 201103L - template - void - merge(list& __x, _Compare __comp) - { merge(std::move(__x), __comp); } -#endif - - void - sort() { _Base::sort(); } - - template - void - sort(_StrictWeakOrdering __pred) { _Base::sort(__pred); } - - using _Base::reverse; - - _Base& - _M_base() _GLIBCXX_NOEXCEPT { return *this; } - - const _Base& - _M_base() const _GLIBCXX_NOEXCEPT { return *this; } - }; - - template - inline bool - operator==(const list<_Tp, _Alloc>& __lhs, - const list<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() == __rhs._M_base(); } - - template - inline bool - operator!=(const list<_Tp, _Alloc>& __lhs, - const list<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() != __rhs._M_base(); } - - template - inline bool - operator<(const list<_Tp, _Alloc>& __lhs, - const list<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() < __rhs._M_base(); } - - template - inline bool - operator<=(const list<_Tp, _Alloc>& __lhs, - const list<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() <= __rhs._M_base(); } - - template - inline bool - operator>=(const list<_Tp, _Alloc>& __lhs, - const list<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() >= __rhs._M_base(); } - - template - inline bool - operator>(const list<_Tp, _Alloc>& __lhs, - const list<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() > __rhs._M_base(); } - - template - inline void - swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs) - { __lhs.swap(__rhs); } - -} // namespace __debug -} // namespace std - -#ifndef _GLIBCXX_DEBUG_PEDANTIC -namespace __gnu_debug -{ - template - struct _Insert_range_from_self_is_safe > - { enum { __value = 1 }; }; -} -#endif - -#endif diff --git a/openflow/usr/include/c++/5/debug/macros.h b/openflow/usr/include/c++/5/debug/macros.h deleted file mode 100644 index f796e71..0000000 --- a/openflow/usr/include/c++/5/debug/macros.h +++ /dev/null @@ -1,364 +0,0 @@ -// Debugging support implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/macros.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_MACROS_H -#define _GLIBCXX_DEBUG_MACROS_H 1 - -/** - * Macros used by the implementation to verify certain - * properties. These macros may only be used directly by the debug - * wrappers. Note that these are macros (instead of the more obviously - * @a correct choice of making them functions) because we need line and - * file information at the call site, to minimize the distance between - * the user error and where the error is reported. - * - */ -#define _GLIBCXX_DEBUG_VERIFY_AT(_Condition,_ErrorMessage,_File,_Line) \ - do \ - { \ - if (! (_Condition)) \ - __gnu_debug::_Error_formatter::_M_at(_File, _Line) \ - ._ErrorMessage._M_error(); \ - } while (false) - -#define _GLIBCXX_DEBUG_VERIFY(_Condition,_ErrorMessage) \ - _GLIBCXX_DEBUG_VERIFY_AT(_Condition,_ErrorMessage,__FILE__,__LINE__) - -// Verify that [_First, _Last) forms a valid iterator range. -#define __glibcxx_check_valid_range(_First,_Last) \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last), \ - _M_message(__gnu_debug::__msg_valid_range) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last)) - -// Verify that [_First, _Last) forms a non-empty iterator range. -#define __glibcxx_check_non_empty_range(_First,_Last) \ -_GLIBCXX_DEBUG_VERIFY(_First != _Last, \ - _M_message(__gnu_debug::__msg_non_empty_range) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last)) - -/** Verify that we can insert into *this with the iterator _Position. - * Insertion into a container at a specific position requires that - * the iterator be nonsingular, either dereferenceable or past-the-end, - * and that it reference the sequence we are inserting into. Note that - * this macro is only valid when the container is a_Safe_sequence and - * the iterator is a _Safe_iterator. -*/ -#define __glibcxx_check_insert(_Position) \ -_GLIBCXX_DEBUG_VERIFY(!_Position._M_singular(), \ - _M_message(__gnu_debug::__msg_insert_singular) \ - ._M_sequence(*this, "this") \ - ._M_iterator(_Position, #_Position)); \ -_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ - _M_message(__gnu_debug::__msg_insert_different) \ - ._M_sequence(*this, "this") \ - ._M_iterator(_Position, #_Position)) - -/** Verify that we can insert into *this after the iterator _Position. - * Insertion into a container after a specific position requires that - * the iterator be nonsingular, either dereferenceable or before-begin, - * and that it reference the sequence we are inserting into. Note that - * this macro is only valid when the container is a_Safe_sequence and - * the iterator is a _Safe_iterator. -*/ -#define __glibcxx_check_insert_after(_Position) \ -__glibcxx_check_insert(_Position); \ -_GLIBCXX_DEBUG_VERIFY(!_Position._M_is_end(), \ - _M_message(__gnu_debug::__msg_insert_after_end) \ - ._M_sequence(*this, "this") \ - ._M_iterator(_Position, #_Position)) - -/** Verify that we can insert the values in the iterator range - * [_First, _Last) into *this with the iterator _Position. Insertion - * into a container at a specific position requires that the iterator - * be nonsingular (i.e., either dereferenceable or past-the-end), - * that it reference the sequence we are inserting into, and that the - * iterator range [_First, _Last) is a valid (possibly empty) - * range which does not reference the sequence we are inserting into. - * Note that this macro is only valid when the container is a - * _Safe_sequence and the _Position iterator is a _Safe_iterator. -*/ -#define __glibcxx_check_insert_range(_Position,_First,_Last) \ -__glibcxx_check_valid_range(_First,_Last); \ -__glibcxx_check_insert(_Position); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__foreign_iterator(_Position,_First,_Last),\ - _M_message(__gnu_debug::__msg_insert_range_from_self)\ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last) \ - ._M_sequence(*this, "this")) - -/** Verify that we can insert the values in the iterator range - * [_First, _Last) into *this after the iterator _Position. Insertion - * into a container after a specific position requires that the iterator - * be nonsingular (i.e., either dereferenceable or past-the-end), - * that it reference the sequence we are inserting into, and that the - * iterator range [_First, _Last) is a valid (possibly empty) - * range which does not reference the sequence we are inserting into. - * Note that this macro is only valid when the container is a - * _Safe_sequence and the _Position iterator is a _Safe_iterator. -*/ -#define __glibcxx_check_insert_range_after(_Position,_First,_Last) \ -__glibcxx_check_valid_range(_First,_Last); \ -__glibcxx_check_insert_after(_Position); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__foreign_iterator(_Position,_First,_Last),\ - _M_message(__gnu_debug::__msg_insert_range_from_self)\ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last) \ - ._M_sequence(*this, "this")) - -/** Verify that we can erase the element referenced by the iterator - * _Position. We can erase the element if the _Position iterator is - * dereferenceable and references this sequence. -*/ -#define __glibcxx_check_erase(_Position) \ -_GLIBCXX_DEBUG_VERIFY(_Position._M_dereferenceable(), \ - _M_message(__gnu_debug::__msg_erase_bad) \ - ._M_sequence(*this, "this") \ - ._M_iterator(_Position, #_Position)); \ -_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ - _M_message(__gnu_debug::__msg_erase_different) \ - ._M_sequence(*this, "this") \ - ._M_iterator(_Position, #_Position)) - -/** Verify that we can erase the element after the iterator - * _Position. We can erase the element if the _Position iterator is - * before a dereferenceable one and references this sequence. -*/ -#define __glibcxx_check_erase_after(_Position) \ -_GLIBCXX_DEBUG_VERIFY(_Position._M_before_dereferenceable(), \ - _M_message(__gnu_debug::__msg_erase_after_bad) \ - ._M_sequence(*this, "this") \ - ._M_iterator(_Position, #_Position)); \ -_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ - _M_message(__gnu_debug::__msg_erase_different) \ - ._M_sequence(*this, "this") \ - ._M_iterator(_Position, #_Position)) - -/** Verify that we can erase the elements in the iterator range - * [_First, _Last). We can erase the elements if [_First, _Last) is a - * valid iterator range within this sequence. -*/ -#define __glibcxx_check_erase_range(_First,_Last) \ -__glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \ - _M_message(__gnu_debug::__msg_erase_different) \ - ._M_sequence(*this, "this") \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last)) - -/** Verify that we can erase the elements in the iterator range - * (_First, _Last). We can erase the elements if (_First, _Last) is a - * valid iterator range within this sequence. -*/ -#define __glibcxx_check_erase_range_after(_First,_Last) \ -_GLIBCXX_DEBUG_VERIFY(_First._M_can_compare(_Last), \ - _M_message(__gnu_debug::__msg_erase_different) \ - ._M_sequence(*this, "this") \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last)); \ -_GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \ - _M_message(__gnu_debug::__msg_erase_different) \ - ._M_sequence(*this, "this") \ - ._M_iterator(_First, #_First)); \ -_GLIBCXX_DEBUG_VERIFY(_First != _Last, \ - _M_message(__gnu_debug::__msg_valid_range2) \ - ._M_sequence(*this, "this") \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last)); \ -_GLIBCXX_DEBUG_VERIFY(_First._M_incrementable(), \ - _M_message(__gnu_debug::__msg_valid_range2) \ - ._M_sequence(*this, "this") \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last)); \ -_GLIBCXX_DEBUG_VERIFY(!_Last._M_is_before_begin(), \ - _M_message(__gnu_debug::__msg_valid_range2) \ - ._M_sequence(*this, "this") \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last)) \ - -// Verify that the subscript _N is less than the container's size. -#define __glibcxx_check_subscript(_N) \ -_GLIBCXX_DEBUG_VERIFY(_N < this->size(), \ - _M_message(__gnu_debug::__msg_subscript_oob) \ - ._M_sequence(*this, "this") \ - ._M_integer(_N, #_N) \ - ._M_integer(this->size(), "size")) - -// Verify that the bucket _N is less than the container's buckets count. -#define __glibcxx_check_bucket_index(_N) \ -_GLIBCXX_DEBUG_VERIFY(_N < this->bucket_count(), \ - _M_message(__gnu_debug::__msg_bucket_index_oob) \ - ._M_sequence(*this, "this") \ - ._M_integer(_N, #_N) \ - ._M_integer(this->bucket_count(), "size")) - -// Verify that the container is nonempty -#define __glibcxx_check_nonempty() \ -_GLIBCXX_DEBUG_VERIFY(! this->empty(), \ - _M_message(__gnu_debug::__msg_empty) \ - ._M_sequence(*this, "this")) - -// Verify that the iterator range [_First, _Last) is sorted -#define __glibcxx_check_sorted(_First,_Last) \ -__glibcxx_check_valid_range(_First,_Last); \ - _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted( \ - __gnu_debug::__base(_First), \ - __gnu_debug::__base(_Last)), \ - _M_message(__gnu_debug::__msg_unsorted) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last)) - -/** Verify that the iterator range [_First, _Last) is sorted by the - predicate _Pred. */ -#define __glibcxx_check_sorted_pred(_First,_Last,_Pred) \ -__glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted( \ - __gnu_debug::__base(_First), \ - __gnu_debug::__base(_Last), _Pred), \ - _M_message(__gnu_debug::__msg_unsorted_pred) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last) \ - ._M_string(#_Pred)) - -// Special variant for std::merge, std::includes, std::set_* -#define __glibcxx_check_sorted_set(_First1,_Last1,_First2) \ -__glibcxx_check_valid_range(_First1,_Last1); \ -_GLIBCXX_DEBUG_VERIFY( \ - __gnu_debug::__check_sorted_set(__gnu_debug::__base(_First1), \ - __gnu_debug::__base(_Last1), _First2),\ - _M_message(__gnu_debug::__msg_unsorted) \ - ._M_iterator(_First1, #_First1) \ - ._M_iterator(_Last1, #_Last1)) - -// Likewise with a _Pred. -#define __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) \ -__glibcxx_check_valid_range(_First1,_Last1); \ -_GLIBCXX_DEBUG_VERIFY( \ - __gnu_debug::__check_sorted_set(__gnu_debug::__base(_First1), \ - __gnu_debug::__base(_Last1), \ - _First2, _Pred), \ - _M_message(__gnu_debug::__msg_unsorted_pred) \ - ._M_iterator(_First1, #_First1) \ - ._M_iterator(_Last1, #_Last1) \ - ._M_string(#_Pred)) - -/** Verify that the iterator range [_First, _Last) is partitioned - w.r.t. the value _Value. */ -#define __glibcxx_check_partitioned_lower(_First,_Last,_Value) \ -__glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ - __gnu_debug::__base(_First), \ - __gnu_debug::__base(_Last), _Value), \ - _M_message(__gnu_debug::__msg_unpartitioned) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last) \ - ._M_string(#_Value)) - -#define __glibcxx_check_partitioned_upper(_First,_Last,_Value) \ -__glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ - __gnu_debug::__base(_First), \ - __gnu_debug::__base(_Last), _Value), \ - _M_message(__gnu_debug::__msg_unpartitioned) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last) \ - ._M_string(#_Value)) - -/** Verify that the iterator range [_First, _Last) is partitioned - w.r.t. the value _Value and predicate _Pred. */ -#define __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ -__glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ - __gnu_debug::__base(_First), \ - __gnu_debug::__base(_Last), _Value, _Pred), \ - _M_message(__gnu_debug::__msg_unpartitioned_pred) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last) \ - ._M_string(#_Pred) \ - ._M_string(#_Value)) - -/** Verify that the iterator range [_First, _Last) is partitioned - w.r.t. the value _Value and predicate _Pred. */ -#define __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ -__glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ - __gnu_debug::__base(_First), \ - __gnu_debug::__base(_Last), _Value, _Pred), \ - _M_message(__gnu_debug::__msg_unpartitioned_pred) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last) \ - ._M_string(#_Pred) \ - ._M_string(#_Value)) - -// Verify that the iterator range [_First, _Last) is a heap -#define __glibcxx_check_heap(_First,_Last) \ - _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First), \ - __gnu_debug::__base(_Last)), \ - _M_message(__gnu_debug::__msg_not_heap) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last)) - -/** Verify that the iterator range [_First, _Last) is a heap - w.r.t. the predicate _Pred. */ -#define __glibcxx_check_heap_pred(_First,_Last,_Pred) \ - _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First), \ - __gnu_debug::__base(_Last), \ - _Pred), \ - _M_message(__gnu_debug::__msg_not_heap_pred) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last) \ - ._M_string(#_Pred)) - -// Verify that the container is not self move assigned -#define __glibcxx_check_self_move_assign(_Other) \ -_GLIBCXX_DEBUG_VERIFY(this != &_Other, \ - _M_message(__gnu_debug::__msg_self_move_assign) \ - ._M_sequence(*this, "this")) - -// Verify that load factor is positive -#define __glibcxx_check_max_load_factor(_F) \ -_GLIBCXX_DEBUG_VERIFY(_F > 0.0f, \ - _M_message(__gnu_debug::__msg_valid_load_factor) \ - ._M_sequence(*this, "this")) - -#define __glibcxx_check_equal_allocs(_This, _Other) \ -_GLIBCXX_DEBUG_VERIFY(_This.get_allocator() == _Other.get_allocator(), \ - _M_message(__gnu_debug::__msg_equal_allocs) \ - ._M_sequence(_This, "this")) - -#ifdef _GLIBCXX_DEBUG_PEDANTIC -# define __glibcxx_check_string(_String) _GLIBCXX_DEBUG_ASSERT(_String != 0) -# define __glibcxx_check_string_len(_String,_Len) \ - _GLIBCXX_DEBUG_ASSERT(_String != 0 || _Len == 0) -#else -# define __glibcxx_check_string(_String) -# define __glibcxx_check_string_len(_String,_Len) -#endif - -#endif diff --git a/openflow/usr/include/c++/5/debug/map b/openflow/usr/include/c++/5/debug/map deleted file mode 100644 index 2593b2b..0000000 --- a/openflow/usr/include/c++/5/debug/map +++ /dev/null @@ -1,36 +0,0 @@ -// Debugging map/multimap implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/map - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_MAP -#define _GLIBCXX_DEBUG_MAP 1 - -#include -#include -#include - -#endif diff --git a/openflow/usr/include/c++/5/debug/map.h b/openflow/usr/include/c++/5/debug/map.h deleted file mode 100644 index 53d8ecc..0000000 --- a/openflow/usr/include/c++/5/debug/map.h +++ /dev/null @@ -1,514 +0,0 @@ -// Debugging map implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/map.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_MAP_H -#define _GLIBCXX_DEBUG_MAP_H 1 - -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __debug -{ - /// Class std::map with safety/checking/debug instrumentation. - template, - typename _Allocator = std::allocator > > - class map - : public __gnu_debug::_Safe_container< - map<_Key, _Tp, _Compare, _Allocator>, _Allocator, - __gnu_debug::_Safe_node_sequence>, - public _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator> - { - typedef _GLIBCXX_STD_C::map< - _Key, _Tp, _Compare, _Allocator> _Base; - typedef __gnu_debug::_Safe_container< - map, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe; - - typedef typename _Base::const_iterator _Base_const_iterator; - typedef typename _Base::iterator _Base_iterator; - typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; - - public: - // types: - typedef _Key key_type; - typedef _Tp mapped_type; - typedef std::pair value_type; - typedef _Compare key_compare; - typedef _Allocator allocator_type; - typedef typename _Base::reference reference; - typedef typename _Base::const_reference const_reference; - - typedef __gnu_debug::_Safe_iterator<_Base_iterator, map> - iterator; - typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, map> - const_iterator; - - typedef typename _Base::size_type size_type; - typedef typename _Base::difference_type difference_type; - typedef typename _Base::pointer pointer; - typedef typename _Base::const_pointer const_pointer; - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - // 23.3.1.1 construct/copy/destroy: - -#if __cplusplus < 201103L - map() : _Base() { } - - map(const map& __x) - : _Base(__x) { } - - ~map() { } -#else - map() = default; - map(const map&) = default; - map(map&&) = default; - - map(initializer_list __l, - const _Compare& __c = _Compare(), - const allocator_type& __a = allocator_type()) - : _Base(__l, __c, __a) { } - - explicit - map(const allocator_type& __a) - : _Base(__a) { } - - map(const map& __m, const allocator_type& __a) - : _Base(__m, __a) { } - - map(map&& __m, const allocator_type& __a) - : _Safe(std::move(__m._M_safe()), __a), - _Base(std::move(__m._M_base()), __a) { } - - map(initializer_list __l, const allocator_type& __a) - : _Base(__l, __a) { } - - template - map(_InputIterator __first, _InputIterator __last, - const allocator_type& __a) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), __a) - { } - - ~map() = default; -#endif - - map(const _Base& __x) - : _Base(__x) { } - - explicit map(const _Compare& __comp, - const _Allocator& __a = _Allocator()) - : _Base(__comp, __a) { } - - template - map(_InputIterator __first, _InputIterator __last, - const _Compare& __comp = _Compare(), - const _Allocator& __a = _Allocator()) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), - __comp, __a) { } - -#if __cplusplus < 201103L - map& - operator=(const map& __x) - { - this->_M_safe() = __x; - _M_base() = __x; - return *this; - } -#else - map& - operator=(const map&) = default; - - map& - operator=(map&&) = default; - - map& - operator=(initializer_list __l) - { - _M_base() = __l; - this->_M_invalidate_all(); - return *this; - } -#endif - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 133. map missing get_allocator() - using _Base::get_allocator; - - // iterators: - iterator - begin() _GLIBCXX_NOEXCEPT - { return iterator(_Base::begin(), this); } - - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::begin(), this); } - - iterator - end() _GLIBCXX_NOEXCEPT - { return iterator(_Base::end(), this); } - - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::end(), this); } - - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return reverse_iterator(end()); } - - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(end()); } - - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return reverse_iterator(begin()); } - - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(begin()); } - -#if __cplusplus >= 201103L - const_iterator - cbegin() const noexcept - { return const_iterator(_Base::begin(), this); } - - const_iterator - cend() const noexcept - { return const_iterator(_Base::end(), this); } - - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(end()); } - - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(begin()); } -#endif - - // capacity: - using _Base::empty; - using _Base::size; - using _Base::max_size; - - // 23.3.1.2 element access: - using _Base::operator[]; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 464. Suggestion for new member functions in standard containers. - using _Base::at; - - // modifiers: -#if __cplusplus >= 201103L - template - std::pair - emplace(_Args&&... __args) - { - auto __res = _Base::emplace(std::forward<_Args>(__args)...); - return std::pair(iterator(__res.first, this), - __res.second); - } - - template - iterator - emplace_hint(const_iterator __pos, _Args&&... __args) - { - __glibcxx_check_insert(__pos); - return iterator(_Base::emplace_hint(__pos.base(), - std::forward<_Args>(__args)...), - this); - } -#endif - - std::pair - insert(const value_type& __x) - { - std::pair<_Base_iterator, bool> __res = _Base::insert(__x); - return std::pair(iterator(__res.first, this), - __res.second); - } - -#if __cplusplus >= 201103L - template::value>::type> - std::pair - insert(_Pair&& __x) - { - std::pair<_Base_iterator, bool> __res - = _Base::insert(std::forward<_Pair>(__x)); - return std::pair(iterator(__res.first, this), - __res.second); - } -#endif - -#if __cplusplus >= 201103L - void - insert(std::initializer_list __list) - { _Base::insert(__list); } -#endif - - iterator -#if __cplusplus >= 201103L - insert(const_iterator __position, const value_type& __x) -#else - insert(iterator __position, const value_type& __x) -#endif - { - __glibcxx_check_insert(__position); - return iterator(_Base::insert(__position.base(), __x), this); - } - -#if __cplusplus >= 201103L - template::value>::type> - iterator - insert(const_iterator __position, _Pair&& __x) - { - __glibcxx_check_insert(__position); - return iterator(_Base::insert(__position.base(), - std::forward<_Pair>(__x)), this); - } -#endif - - template - void - insert(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - _Base::insert(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - } - -#if __cplusplus >= 201103L - iterator - erase(const_iterator __position) - { - __glibcxx_check_erase(__position); - this->_M_invalidate_if(_Equal(__position.base())); - return iterator(_Base::erase(__position.base()), this); - } - - iterator - erase(iterator __position) - { return erase(const_iterator(__position)); } -#else - void - erase(iterator __position) - { - __glibcxx_check_erase(__position); - this->_M_invalidate_if(_Equal(__position.base())); - _Base::erase(__position.base()); - } -#endif - - size_type - erase(const key_type& __x) - { - _Base_iterator __victim = _Base::find(__x); - if (__victim == _Base::end()) - return 0; - else - { - this->_M_invalidate_if(_Equal(__victim)); - _Base::erase(__victim); - return 1; - } - } - -#if __cplusplus >= 201103L - iterator - erase(const_iterator __first, const_iterator __last) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 151. can't currently clear() empty container - __glibcxx_check_erase_range(__first, __last); - for (_Base_const_iterator __victim = __first.base(); - __victim != __last.base(); ++__victim) - { - _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - this->_M_invalidate_if(_Equal(__victim)); - } - return iterator(_Base::erase(__first.base(), __last.base()), this); - } -#else - void - erase(iterator __first, iterator __last) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 151. can't currently clear() empty container - __glibcxx_check_erase_range(__first, __last); - for (_Base_iterator __victim = __first.base(); - __victim != __last.base(); ++__victim) - { - _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - this->_M_invalidate_if(_Equal(__victim)); - } - _Base::erase(__first.base(), __last.base()); - } -#endif - - void - swap(map& __x) -#if __cplusplus >= 201103L - noexcept( noexcept(declval<_Base>().swap(__x)) ) -#endif - { - _Safe::_M_swap(__x); - _Base::swap(__x); - } - - void - clear() _GLIBCXX_NOEXCEPT - { - this->_M_invalidate_all(); - _Base::clear(); - } - - // observers: - using _Base::key_comp; - using _Base::value_comp; - - // 23.3.1.3 map operations: - iterator - find(const key_type& __x) - { return iterator(_Base::find(__x), this); } - - const_iterator - find(const key_type& __x) const - { return const_iterator(_Base::find(__x), this); } - - using _Base::count; - - iterator - lower_bound(const key_type& __x) - { return iterator(_Base::lower_bound(__x), this); } - - const_iterator - lower_bound(const key_type& __x) const - { return const_iterator(_Base::lower_bound(__x), this); } - - iterator - upper_bound(const key_type& __x) - { return iterator(_Base::upper_bound(__x), this); } - - const_iterator - upper_bound(const key_type& __x) const - { return const_iterator(_Base::upper_bound(__x), this); } - - std::pair - equal_range(const key_type& __x) - { - std::pair<_Base_iterator, _Base_iterator> __res = - _Base::equal_range(__x); - return std::make_pair(iterator(__res.first, this), - iterator(__res.second, this)); - } - - std::pair - equal_range(const key_type& __x) const - { - std::pair<_Base_const_iterator, _Base_const_iterator> __res = - _Base::equal_range(__x); - return std::make_pair(const_iterator(__res.first, this), - const_iterator(__res.second, this)); - } - - _Base& - _M_base() _GLIBCXX_NOEXCEPT { return *this; } - - const _Base& - _M_base() const _GLIBCXX_NOEXCEPT { return *this; } - }; - - template - inline bool - operator==(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, - const map<_Key, _Tp, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() == __rhs._M_base(); } - - template - inline bool - operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, - const map<_Key, _Tp, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() != __rhs._M_base(); } - - template - inline bool - operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, - const map<_Key, _Tp, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() < __rhs._M_base(); } - - template - inline bool - operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, - const map<_Key, _Tp, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() <= __rhs._M_base(); } - - template - inline bool - operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, - const map<_Key, _Tp, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() >= __rhs._M_base(); } - - template - inline bool - operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, - const map<_Key, _Tp, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() > __rhs._M_base(); } - - template - inline void - swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs, - map<_Key, _Tp, _Compare, _Allocator>& __rhs) - { __lhs.swap(__rhs); } - -} // namespace __debug -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/debug/multimap.h b/openflow/usr/include/c++/5/debug/multimap.h deleted file mode 100644 index 5c7f2a9..0000000 --- a/openflow/usr/include/c++/5/debug/multimap.h +++ /dev/null @@ -1,495 +0,0 @@ -// Debugging multimap implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/multimap.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_MULTIMAP_H -#define _GLIBCXX_DEBUG_MULTIMAP_H 1 - -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __debug -{ - /// Class std::multimap with safety/checking/debug instrumentation. - template, - typename _Allocator = std::allocator > > - class multimap - : public __gnu_debug::_Safe_container< - multimap<_Key, _Tp, _Compare, _Allocator>, _Allocator, - __gnu_debug::_Safe_node_sequence>, - public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator> - { - typedef _GLIBCXX_STD_C::multimap< - _Key, _Tp, _Compare, _Allocator> _Base; - typedef __gnu_debug::_Safe_container< - multimap, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe; - - typedef typename _Base::const_iterator _Base_const_iterator; - typedef typename _Base::iterator _Base_iterator; - typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; - - public: - // types: - typedef _Key key_type; - typedef _Tp mapped_type; - typedef std::pair value_type; - typedef _Compare key_compare; - typedef _Allocator allocator_type; - typedef typename _Base::reference reference; - typedef typename _Base::const_reference const_reference; - - typedef __gnu_debug::_Safe_iterator<_Base_iterator, multimap> - iterator; - typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, - multimap> const_iterator; - - typedef typename _Base::size_type size_type; - typedef typename _Base::difference_type difference_type; - typedef typename _Base::pointer pointer; - typedef typename _Base::const_pointer const_pointer; - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - // 23.3.1.1 construct/copy/destroy: - -#if __cplusplus < 201103L - multimap() : _Base() { } - - multimap(const multimap& __x) - : _Base(__x) { } - - ~multimap() { } -#else - multimap() = default; - multimap(const multimap&) = default; - multimap(multimap&&) = default; - - multimap(initializer_list __l, - const _Compare& __c = _Compare(), - const allocator_type& __a = allocator_type()) - : _Base(__l, __c, __a) { } - - explicit - multimap(const allocator_type& __a) - : _Base(__a) { } - - multimap(const multimap& __m, const allocator_type& __a) - : _Base(__m, __a) { } - - multimap(multimap&& __m, const allocator_type& __a) - : _Safe(std::move(__m._M_safe()), __a), - _Base(std::move(__m._M_base()), __a) { } - - multimap(initializer_list __l, const allocator_type& __a) - : _Base(__l, __a) { } - - template - multimap(_InputIterator __first, _InputIterator __last, - const allocator_type& __a) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), __a) { } - - ~multimap() = default; -#endif - - explicit multimap(const _Compare& __comp, - const _Allocator& __a = _Allocator()) - : _Base(__comp, __a) { } - - template - multimap(_InputIterator __first, _InputIterator __last, - const _Compare& __comp = _Compare(), - const _Allocator& __a = _Allocator()) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), - __comp, __a) { } - - multimap(const _Base& __x) - : _Base(__x) { } - -#if __cplusplus < 201103L - multimap& - operator=(const multimap& __x) - { - this->_M_safe() = __x; - _M_base() = __x; - return *this; - } -#else - multimap& - operator=(const multimap&) = default; - - multimap& - operator=(multimap&&) = default; - - multimap& - operator=(initializer_list __l) - { - _M_base() = __l; - this->_M_invalidate_all(); - return *this; - } -#endif - - using _Base::get_allocator; - - // iterators: - iterator - begin() _GLIBCXX_NOEXCEPT - { return iterator(_Base::begin(), this); } - - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::begin(), this); } - - iterator - end() _GLIBCXX_NOEXCEPT - { return iterator(_Base::end(), this); } - - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::end(), this); } - - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return reverse_iterator(end()); } - - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(end()); } - - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return reverse_iterator(begin()); } - - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(begin()); } - -#if __cplusplus >= 201103L - const_iterator - cbegin() const noexcept - { return const_iterator(_Base::begin(), this); } - - const_iterator - cend() const noexcept - { return const_iterator(_Base::end(), this); } - - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(end()); } - - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(begin()); } -#endif - - // capacity: - using _Base::empty; - using _Base::size; - using _Base::max_size; - - // modifiers: -#if __cplusplus >= 201103L - template - iterator - emplace(_Args&&... __args) - { - return iterator(_Base::emplace(std::forward<_Args>(__args)...), this); - } - - template - iterator - emplace_hint(const_iterator __pos, _Args&&... __args) - { - __glibcxx_check_insert(__pos); - return iterator(_Base::emplace_hint(__pos.base(), - std::forward<_Args>(__args)...), - this); - } -#endif - - iterator - insert(const value_type& __x) - { return iterator(_Base::insert(__x), this); } - -#if __cplusplus >= 201103L - template::value>::type> - iterator - insert(_Pair&& __x) - { return iterator(_Base::insert(std::forward<_Pair>(__x)), this); } -#endif - -#if __cplusplus >= 201103L - void - insert(std::initializer_list __list) - { _Base::insert(__list); } -#endif - - iterator -#if __cplusplus >= 201103L - insert(const_iterator __position, const value_type& __x) -#else - insert(iterator __position, const value_type& __x) -#endif - { - __glibcxx_check_insert(__position); - return iterator(_Base::insert(__position.base(), __x), this); - } - -#if __cplusplus >= 201103L - template::value>::type> - iterator - insert(const_iterator __position, _Pair&& __x) - { - __glibcxx_check_insert(__position); - return iterator(_Base::insert(__position.base(), - std::forward<_Pair>(__x)), this); - } -#endif - - template - void - insert(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - _Base::insert(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - } - -#if __cplusplus >= 201103L - iterator - erase(const_iterator __position) - { - __glibcxx_check_erase(__position); - this->_M_invalidate_if(_Equal(__position.base())); - return iterator(_Base::erase(__position.base()), this); - } - - iterator - erase(iterator __position) - { return erase(const_iterator(__position)); } -#else - void - erase(iterator __position) - { - __glibcxx_check_erase(__position); - this->_M_invalidate_if(_Equal(__position.base())); - _Base::erase(__position.base()); - } -#endif - - size_type - erase(const key_type& __x) - { - std::pair<_Base_iterator, _Base_iterator> __victims = - _Base::equal_range(__x); - size_type __count = 0; - _Base_iterator __victim = __victims.first; - while (__victim != __victims.second) - { - this->_M_invalidate_if(_Equal(__victim)); - _Base::erase(__victim++); - ++__count; - } - return __count; - } - -#if __cplusplus >= 201103L - iterator - erase(const_iterator __first, const_iterator __last) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 151. can't currently clear() empty container - __glibcxx_check_erase_range(__first, __last); - for (_Base_const_iterator __victim = __first.base(); - __victim != __last.base(); ++__victim) - { - _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - this->_M_invalidate_if(_Equal(__victim)); - } - return iterator(_Base::erase(__first.base(), __last.base()), this); - } -#else - void - erase(iterator __first, iterator __last) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 151. can't currently clear() empty container - __glibcxx_check_erase_range(__first, __last); - for (_Base_iterator __victim = __first.base(); - __victim != __last.base(); ++__victim) - { - _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - this->_M_invalidate_if(_Equal(__victim)); - } - _Base::erase(__first.base(), __last.base()); - } -#endif - - void - swap(multimap& __x) -#if __cplusplus >= 201103L - noexcept( noexcept(declval<_Base>().swap(__x)) ) -#endif - { - _Safe::_M_swap(__x); - _Base::swap(__x); - } - - void - clear() _GLIBCXX_NOEXCEPT - { - this->_M_invalidate_all(); - _Base::clear(); - } - - // observers: - using _Base::key_comp; - using _Base::value_comp; - - // 23.3.1.3 multimap operations: - iterator - find(const key_type& __x) - { return iterator(_Base::find(__x), this); } - - const_iterator - find(const key_type& __x) const - { return const_iterator(_Base::find(__x), this); } - - using _Base::count; - - iterator - lower_bound(const key_type& __x) - { return iterator(_Base::lower_bound(__x), this); } - - const_iterator - lower_bound(const key_type& __x) const - { return const_iterator(_Base::lower_bound(__x), this); } - - iterator - upper_bound(const key_type& __x) - { return iterator(_Base::upper_bound(__x), this); } - - const_iterator - upper_bound(const key_type& __x) const - { return const_iterator(_Base::upper_bound(__x), this); } - - std::pair - equal_range(const key_type& __x) - { - std::pair<_Base_iterator, _Base_iterator> __res = - _Base::equal_range(__x); - return std::make_pair(iterator(__res.first, this), - iterator(__res.second, this)); - } - - std::pair - equal_range(const key_type& __x) const - { - std::pair<_Base_const_iterator, _Base_const_iterator> __res = - _Base::equal_range(__x); - return std::make_pair(const_iterator(__res.first, this), - const_iterator(__res.second, this)); - } - - _Base& - _M_base() _GLIBCXX_NOEXCEPT { return *this; } - - const _Base& - _M_base() const _GLIBCXX_NOEXCEPT { return *this; } - }; - - template - inline bool - operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, - const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() == __rhs._M_base(); } - - template - inline bool - operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, - const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() != __rhs._M_base(); } - - template - inline bool - operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, - const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() < __rhs._M_base(); } - - template - inline bool - operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, - const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() <= __rhs._M_base(); } - - template - inline bool - operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, - const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() >= __rhs._M_base(); } - - template - inline bool - operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, - const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() > __rhs._M_base(); } - - template - inline void - swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, - multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) - { __lhs.swap(__rhs); } - -} // namespace __debug -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/debug/multiset.h b/openflow/usr/include/c++/5/debug/multiset.h deleted file mode 100644 index 8dec44e..0000000 --- a/openflow/usr/include/c++/5/debug/multiset.h +++ /dev/null @@ -1,483 +0,0 @@ -// Debugging multiset implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/multiset.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_MULTISET_H -#define _GLIBCXX_DEBUG_MULTISET_H 1 - -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __debug -{ - /// Class std::multiset with safety/checking/debug instrumentation. - template, - typename _Allocator = std::allocator<_Key> > - class multiset - : public __gnu_debug::_Safe_container< - multiset<_Key, _Compare, _Allocator>, _Allocator, - __gnu_debug::_Safe_node_sequence>, - public _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> - { - typedef _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> _Base; - typedef __gnu_debug::_Safe_container< - multiset, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe; - - typedef typename _Base::const_iterator _Base_const_iterator; - typedef typename _Base::iterator _Base_iterator; - typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; - - public: - // types: - typedef _Key key_type; - typedef _Key value_type; - typedef _Compare key_compare; - typedef _Compare value_compare; - typedef _Allocator allocator_type; - typedef typename _Base::reference reference; - typedef typename _Base::const_reference const_reference; - - typedef __gnu_debug::_Safe_iterator<_Base_iterator, multiset> - iterator; - typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, - multiset> const_iterator; - - typedef typename _Base::size_type size_type; - typedef typename _Base::difference_type difference_type; - typedef typename _Base::pointer pointer; - typedef typename _Base::const_pointer const_pointer; - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - // 23.3.3.1 construct/copy/destroy: - -#if __cplusplus < 201103L - multiset() : _Base() { } - - multiset(const multiset& __x) - : _Base(__x) { } - - ~multiset() { } -#else - multiset() = default; - multiset(const multiset&) = default; - multiset(multiset&&) = default; - - multiset(initializer_list __l, - const _Compare& __comp = _Compare(), - const allocator_type& __a = allocator_type()) - : _Base(__l, __comp, __a) { } - - explicit - multiset(const allocator_type& __a) - : _Base(__a) { } - - multiset(const multiset& __m, const allocator_type& __a) - : _Base(__m, __a) { } - - multiset(multiset&& __m, const allocator_type& __a) - : _Safe(std::move(__m._M_safe()), __a), - _Base(std::move(__m._M_base()), __a) { } - - multiset(initializer_list __l, const allocator_type& __a) - : _Base(__l, __a) - { } - - template - multiset(_InputIterator __first, _InputIterator __last, - const allocator_type& __a) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), __a) { } - - ~multiset() = default; -#endif - - explicit multiset(const _Compare& __comp, - const _Allocator& __a = _Allocator()) - : _Base(__comp, __a) { } - - template - multiset(_InputIterator __first, _InputIterator __last, - const _Compare& __comp = _Compare(), - const _Allocator& __a = _Allocator()) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), - __comp, __a) { } - - multiset(const _Base& __x) - : _Base(__x) { } - -#if __cplusplus < 201103L - multiset& - operator=(const multiset& __x) - { - this->_M_safe() = __x; - _M_base() = __x; - return *this; - } -#else - multiset& - operator=(const multiset&) = default; - - multiset& - operator=(multiset&&) = default; - - multiset& - operator=(initializer_list __l) - { - _M_base() = __l; - this->_M_invalidate_all(); - return *this; - } -#endif - - using _Base::get_allocator; - - // iterators: - iterator - begin() _GLIBCXX_NOEXCEPT - { return iterator(_Base::begin(), this); } - - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::begin(), this); } - - iterator - end() _GLIBCXX_NOEXCEPT - { return iterator(_Base::end(), this); } - - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::end(), this); } - - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return reverse_iterator(end()); } - - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(end()); } - - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return reverse_iterator(begin()); } - - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(begin()); } - -#if __cplusplus >= 201103L - const_iterator - cbegin() const noexcept - { return const_iterator(_Base::begin(), this); } - - const_iterator - cend() const noexcept - { return const_iterator(_Base::end(), this); } - - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(end()); } - - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(begin()); } -#endif - - // capacity: - using _Base::empty; - using _Base::size; - using _Base::max_size; - - // modifiers: -#if __cplusplus >= 201103L - template - iterator - emplace(_Args&&... __args) - { - return iterator(_Base::emplace(std::forward<_Args>(__args)...), - this); - } - - template - iterator - emplace_hint(const_iterator __pos, _Args&&... __args) - { - __glibcxx_check_insert(__pos); - return iterator(_Base::emplace_hint(__pos.base(), - std::forward<_Args>(__args)...), - this); - } -#endif - - iterator - insert(const value_type& __x) - { return iterator(_Base::insert(__x), this); } - -#if __cplusplus >= 201103L - iterator - insert(value_type&& __x) - { return iterator(_Base::insert(std::move(__x)), this); } -#endif - - iterator - insert(const_iterator __position, const value_type& __x) - { - __glibcxx_check_insert(__position); - return iterator(_Base::insert(__position.base(), __x), this); - } - -#if __cplusplus >= 201103L - iterator - insert(const_iterator __position, value_type&& __x) - { - __glibcxx_check_insert(__position); - return iterator(_Base::insert(__position.base(), std::move(__x)), - this); - } -#endif - - template - void - insert(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - _Base::insert(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - } - -#if __cplusplus >= 201103L - void - insert(initializer_list __l) - { _Base::insert(__l); } -#endif - -#if __cplusplus >= 201103L - iterator - erase(const_iterator __position) - { - __glibcxx_check_erase(__position); - this->_M_invalidate_if(_Equal(__position.base())); - return iterator(_Base::erase(__position.base()), this); - } -#else - void - erase(iterator __position) - { - __glibcxx_check_erase(__position); - this->_M_invalidate_if(_Equal(__position.base())); - _Base::erase(__position.base()); - } -#endif - - size_type - erase(const key_type& __x) - { - std::pair<_Base_iterator, _Base_iterator> __victims = - _Base::equal_range(__x); - size_type __count = 0; - _Base_iterator __victim = __victims.first; - while (__victim != __victims.second) - { - this->_M_invalidate_if(_Equal(__victim)); - _Base::erase(__victim++); - ++__count; - } - return __count; - } - -#if __cplusplus >= 201103L - iterator - erase(const_iterator __first, const_iterator __last) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 151. can't currently clear() empty container - __glibcxx_check_erase_range(__first, __last); - for (_Base_const_iterator __victim = __first.base(); - __victim != __last.base(); ++__victim) - { - _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - this->_M_invalidate_if(_Equal(__victim)); - } - return iterator(_Base::erase(__first.base(), __last.base()), this); - } -#else - void - erase(iterator __first, iterator __last) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 151. can't currently clear() empty container - __glibcxx_check_erase_range(__first, __last); - for (_Base_iterator __victim = __first.base(); - __victim != __last.base(); ++__victim) - { - _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - this->_M_invalidate_if(_Equal(__victim)); - } - _Base::erase(__first.base(), __last.base()); - } -#endif - - void - swap(multiset& __x) -#if __cplusplus >= 201103L - noexcept( noexcept(declval<_Base>().swap(__x)) ) -#endif - { - _Safe::_M_swap(__x); - _Base::swap(__x); - } - - void - clear() _GLIBCXX_NOEXCEPT - { - this->_M_invalidate_all(); - _Base::clear(); - } - - // observers: - using _Base::key_comp; - using _Base::value_comp; - - // multiset operations: - iterator - find(const key_type& __x) - { return iterator(_Base::find(__x), this); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 214. set::find() missing const overload - const_iterator - find(const key_type& __x) const - { return const_iterator(_Base::find(__x), this); } - - using _Base::count; - - iterator - lower_bound(const key_type& __x) - { return iterator(_Base::lower_bound(__x), this); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 214. set::find() missing const overload - const_iterator - lower_bound(const key_type& __x) const - { return const_iterator(_Base::lower_bound(__x), this); } - - iterator - upper_bound(const key_type& __x) - { return iterator(_Base::upper_bound(__x), this); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 214. set::find() missing const overload - const_iterator - upper_bound(const key_type& __x) const - { return const_iterator(_Base::upper_bound(__x), this); } - - std::pair - equal_range(const key_type& __x) - { - std::pair<_Base_iterator, _Base_iterator> __res = - _Base::equal_range(__x); - return std::make_pair(iterator(__res.first, this), - iterator(__res.second, this)); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 214. set::find() missing const overload - std::pair - equal_range(const key_type& __x) const - { - std::pair<_Base_const_iterator, _Base_const_iterator> __res = - _Base::equal_range(__x); - return std::make_pair(const_iterator(__res.first, this), - const_iterator(__res.second, this)); - } - - _Base& - _M_base() _GLIBCXX_NOEXCEPT { return *this; } - - const _Base& - _M_base() const _GLIBCXX_NOEXCEPT { return *this; } - }; - - template - inline bool - operator==(const multiset<_Key, _Compare, _Allocator>& __lhs, - const multiset<_Key, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() == __rhs._M_base(); } - - template - inline bool - operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs, - const multiset<_Key, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() != __rhs._M_base(); } - - template - inline bool - operator<(const multiset<_Key, _Compare, _Allocator>& __lhs, - const multiset<_Key, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() < __rhs._M_base(); } - - template - inline bool - operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs, - const multiset<_Key, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() <= __rhs._M_base(); } - - template - inline bool - operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs, - const multiset<_Key, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() >= __rhs._M_base(); } - - template - inline bool - operator>(const multiset<_Key, _Compare, _Allocator>& __lhs, - const multiset<_Key, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() > __rhs._M_base(); } - - template - void - swap(multiset<_Key, _Compare, _Allocator>& __x, - multiset<_Key, _Compare, _Allocator>& __y) - { return __x.swap(__y); } - -} // namespace __debug -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/debug/safe_base.h b/openflow/usr/include/c++/5/debug/safe_base.h deleted file mode 100644 index c9f32bf..0000000 --- a/openflow/usr/include/c++/5/debug/safe_base.h +++ /dev/null @@ -1,262 +0,0 @@ -// Safe sequence/iterator base implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/safe_base.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_SAFE_BASE_H -#define _GLIBCXX_DEBUG_SAFE_BASE_H 1 - -#include - -namespace __gnu_debug -{ - class _Safe_sequence_base; - - /** \brief Basic functionality for a @a safe iterator. - * - * The %_Safe_iterator_base base class implements the functionality - * of a safe iterator that is not specific to a particular iterator - * type. It contains a pointer back to the sequence it references - * along with iterator version information and pointers to form a - * doubly-linked list of iterators referenced by the container. - * - * This class must not perform any operations that can throw an - * exception, or the exception guarantees of derived iterators will - * be broken. - */ - class _Safe_iterator_base - { - public: - /** The sequence this iterator references; may be NULL to indicate - a singular iterator. */ - _Safe_sequence_base* _M_sequence; - - /** The version number of this iterator. The sentinel value 0 is - * used to indicate an invalidated iterator (i.e., one that is - * singular because of an operation on the container). This - * version number must equal the version number in the sequence - * referenced by _M_sequence for the iterator to be - * non-singular. - */ - unsigned int _M_version; - - /** Pointer to the previous iterator in the sequence's list of - iterators. Only valid when _M_sequence != NULL. */ - _Safe_iterator_base* _M_prior; - - /** Pointer to the next iterator in the sequence's list of - iterators. Only valid when _M_sequence != NULL. */ - _Safe_iterator_base* _M_next; - - protected: - /** Initializes the iterator and makes it singular. */ - _Safe_iterator_base() - : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) - { } - - /** Initialize the iterator to reference the sequence pointed to - * by @p __seq. @p __constant is true when we are initializing a - * constant iterator, and false if it is a mutable iterator. Note - * that @p __seq may be NULL, in which case the iterator will be - * singular. Otherwise, the iterator will reference @p __seq and - * be nonsingular. - */ - _Safe_iterator_base(const _Safe_sequence_base* __seq, bool __constant) - : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) - { this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant); } - - /** Initializes the iterator to reference the same sequence that - @p __x does. @p __constant is true if this is a constant - iterator, and false if it is mutable. */ - _Safe_iterator_base(const _Safe_iterator_base& __x, bool __constant) - : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) - { this->_M_attach(__x._M_sequence, __constant); } - - ~_Safe_iterator_base() { this->_M_detach(); } - - /** For use in _Safe_iterator. */ - __gnu_cxx::__mutex& - _M_get_mutex() throw (); - - public: - /** Attaches this iterator to the given sequence, detaching it - * from whatever sequence it was attached to originally. If the - * new sequence is the NULL pointer, the iterator is left - * unattached. - */ - void - _M_attach(_Safe_sequence_base* __seq, bool __constant); - - /** Likewise, but not thread-safe. */ - void - _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw (); - - /** Detach the iterator for whatever sequence it is attached to, - * if any. - */ - void - _M_detach(); - - /** Likewise, but not thread-safe. */ - void - _M_detach_single() throw (); - - /** Determines if we are attached to the given sequence. */ - bool - _M_attached_to(const _Safe_sequence_base* __seq) const - { return _M_sequence == __seq; } - - /** Is this iterator singular? */ - _GLIBCXX_PURE bool - _M_singular() const throw (); - - /** Can we compare this iterator to the given iterator @p __x? - Returns true if both iterators are nonsingular and reference - the same sequence. */ - _GLIBCXX_PURE bool - _M_can_compare(const _Safe_iterator_base& __x) const throw (); - - /** Invalidate the iterator, making it singular. */ - void - _M_invalidate() - { _M_version = 0; } - - /** Reset all member variables */ - void - _M_reset() throw (); - - /** Unlink itself */ - void - _M_unlink() throw () - { - if (_M_prior) - _M_prior->_M_next = _M_next; - if (_M_next) - _M_next->_M_prior = _M_prior; - } - }; - - /** - * @brief Base class that supports tracking of iterators that - * reference a sequence. - * - * The %_Safe_sequence_base class provides basic support for - * tracking iterators into a sequence. Sequences that track - * iterators must derived from %_Safe_sequence_base publicly, so - * that safe iterators (which inherit _Safe_iterator_base) can - * attach to them. This class contains two linked lists of - * iterators, one for constant iterators and one for mutable - * iterators, and a version number that allows very fast - * invalidation of all iterators that reference the container. - * - * This class must ensure that no operation on it may throw an - * exception, otherwise @a safe sequences may fail to provide the - * exception-safety guarantees required by the C++ standard. - */ - class _Safe_sequence_base - { - public: - /// The list of mutable iterators that reference this container - _Safe_iterator_base* _M_iterators; - - /// The list of constant iterators that reference this container - _Safe_iterator_base* _M_const_iterators; - - /// The container version number. This number may never be 0. - mutable unsigned int _M_version; - - protected: - // Initialize with a version number of 1 and no iterators - _Safe_sequence_base() _GLIBCXX_NOEXCEPT - : _M_iterators(0), _M_const_iterators(0), _M_version(1) - { } - -#if __cplusplus >= 201103L - _Safe_sequence_base(const _Safe_sequence_base&) noexcept - : _Safe_sequence_base() { } -#endif - - /** Notify all iterators that reference this sequence that the - sequence is being destroyed. */ - ~_Safe_sequence_base() - { this->_M_detach_all(); } - - /** Detach all iterators, leaving them singular. */ - void - _M_detach_all(); - - /** Detach all singular iterators. - * @post for all iterators i attached to this sequence, - * i->_M_version == _M_version. - */ - void - _M_detach_singular(); - - /** Revalidates all attached singular iterators. This method may - * be used to validate iterators that were invalidated before - * (but for some reason, such as an exception, need to become - * valid again). - */ - void - _M_revalidate_singular(); - - /** Swap this sequence with the given sequence. This operation - * also swaps ownership of the iterators, so that when the - * operation is complete all iterators that originally referenced - * one container now reference the other container. - */ - void - _M_swap(_Safe_sequence_base& __x) _GLIBCXX_USE_NOEXCEPT; - - /** For use in _Safe_sequence. */ - __gnu_cxx::__mutex& - _M_get_mutex() throw (); - - public: - /** Invalidates all iterators. */ - void - _M_invalidate_all() const - { if (++_M_version == 0) _M_version = 1; } - - /** Attach an iterator to this sequence. */ - void - _M_attach(_Safe_iterator_base* __it, bool __constant); - - /** Likewise but not thread safe. */ - void - _M_attach_single(_Safe_iterator_base* __it, bool __constant) throw (); - - /** Detach an iterator from this sequence */ - void - _M_detach(_Safe_iterator_base* __it); - - /** Likewise but not thread safe. */ - void - _M_detach_single(_Safe_iterator_base* __it) throw (); - }; -} // namespace __gnu_debug - -#endif diff --git a/openflow/usr/include/c++/5/debug/safe_container.h b/openflow/usr/include/c++/5/debug/safe_container.h deleted file mode 100644 index 00232b7..0000000 --- a/openflow/usr/include/c++/5/debug/safe_container.h +++ /dev/null @@ -1,125 +0,0 @@ -// Safe container implementation -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/safe_container.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_SAFE_CONTAINER_H -#define _GLIBCXX_DEBUG_SAFE_CONTAINER_H 1 - -#include - -namespace __gnu_debug -{ - /// Safe class dealing with some allocator dependent operations. - template class _SafeBase, - bool _IsCxx11AllocatorAware = true> - class _Safe_container - : public _SafeBase<_SafeContainer> - { - typedef _SafeBase<_SafeContainer> _Base; - - _SafeContainer& - _M_cont() _GLIBCXX_NOEXCEPT - { return *static_cast<_SafeContainer*>(this); } - - protected: - _Safe_container& - _M_safe() _GLIBCXX_NOEXCEPT - { return *this; } - -#if __cplusplus >= 201103L - _Safe_container() = default; - _Safe_container(const _Safe_container&) = default; - _Safe_container(_Safe_container&& __x) noexcept - : _Safe_container() - { _Base::_M_swap(__x); } - - _Safe_container(_Safe_container&& __x, - const _Alloc& __a) - : _Safe_container() - { - if (__x._M_cont().get_allocator() == __a) - _Base::_M_swap(__x); - else - __x._M_invalidate_all(); - } -#endif - - public: - // Copy assignment invalidate all iterators. - _Safe_container& - operator=(const _Safe_container&) _GLIBCXX_NOEXCEPT - { - this->_M_invalidate_all(); - return *this; - } - -#if __cplusplus >= 201103L - _Safe_container& - operator=(_Safe_container&& __x) noexcept - { - __glibcxx_check_self_move_assign(__x); - - if (_IsCxx11AllocatorAware) - { - typedef __gnu_cxx::__alloc_traits<_Alloc> _Alloc_traits; - - bool __xfer_memory = _Alloc_traits::_S_propagate_on_move_assign() - || _M_cont().get_allocator() == __x._M_cont().get_allocator(); - if (__xfer_memory) - _Base::_M_swap(__x); - else - this->_M_invalidate_all(); - } - else - _Base::_M_swap(__x); - - __x._M_invalidate_all(); - return *this; - } - - void - _M_swap(_Safe_container& __x) noexcept - { - if (_IsCxx11AllocatorAware) - { - typedef __gnu_cxx::__alloc_traits<_Alloc> _Alloc_traits; - - if (!_Alloc_traits::_S_propagate_on_swap()) - __glibcxx_check_equal_allocs(this->_M_cont()._M_base(), - __x._M_cont()._M_base()); - } - - _Base::_M_swap(__x); - } -#endif - }; - -} // namespace __gnu_debug - -#endif diff --git a/openflow/usr/include/c++/5/debug/safe_iterator.h b/openflow/usr/include/c++/5/debug/safe_iterator.h deleted file mode 100644 index 1eea238..0000000 --- a/openflow/usr/include/c++/5/debug/safe_iterator.h +++ /dev/null @@ -1,775 +0,0 @@ -// Safe iterator implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/safe_iterator.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_H -#define _GLIBCXX_DEBUG_SAFE_ITERATOR_H 1 - -#include -#include -#include -#include -#include -#include - -namespace __gnu_debug -{ - /** Helper struct to deal with sequence offering a before_begin - * iterator. - **/ - template - struct _BeforeBeginHelper - { - template - static bool - _S_Is(const _Safe_iterator<_Iterator, _Sequence>&) - { return false; } - - template - static bool - _S_Is_Beginnest(const _Safe_iterator<_Iterator, _Sequence>& __it) - { return __it.base() == __it._M_get_sequence()->_M_base().begin(); } - }; - - /** Iterators that derive from _Safe_iterator_base can be determined singular - * or non-singular. - **/ - inline bool - __check_singular_aux(const _Safe_iterator_base* __x) - { return __x->_M_singular(); } - - /** The precision to which we can calculate the distance between - * two iterators. - */ - enum _Distance_precision - { - __dp_equality, //< Can compare iterator equality, only - __dp_sign, //< Can determine equality and ordering - __dp_exact //< Can determine distance precisely - }; - - /** Determine the distance between two iterators with some known - * precision. - */ - template - inline std::pair::difference_type, - _Distance_precision> - __get_distance(const _Iterator& __lhs, const _Iterator& __rhs, - std::random_access_iterator_tag) - { return std::make_pair(__rhs - __lhs, __dp_exact); } - - template - inline std::pair::difference_type, - _Distance_precision> - __get_distance(const _Iterator& __lhs, const _Iterator& __rhs, - std::forward_iterator_tag) - { return std::make_pair(__lhs == __rhs? 0 : 1, __dp_equality); } - - template - inline std::pair::difference_type, - _Distance_precision> - __get_distance(const _Iterator& __lhs, const _Iterator& __rhs) - { - typedef typename std::iterator_traits<_Iterator>::iterator_category - _Category; - return __get_distance(__lhs, __rhs, _Category()); - } - - /** \brief Safe iterator wrapper. - * - * The class template %_Safe_iterator is a wrapper around an - * iterator that tracks the iterator's movement among sequences and - * checks that operations performed on the "safe" iterator are - * legal. In additional to the basic iterator operations (which are - * validated, and then passed to the underlying iterator), - * %_Safe_iterator has member functions for iterator invalidation, - * attaching/detaching the iterator from sequences, and querying - * the iterator's state. - * - * Note that _Iterator must be the first base class so that it gets - * initialized before the iterator is being attached to the container's list - * of iterators and it is being detached before _Iterator get - * destroyed. Otherwise it would result in a data race. - */ - template - class _Safe_iterator - : private _Iterator, - public _Safe_iterator_base - { - typedef _Iterator _Iter_base; - typedef _Safe_iterator_base _Safe_base; - typedef typename _Sequence::const_iterator _Const_iterator; - - /// Determine if this is a constant iterator. - bool - _M_constant() const - { return std::__are_same<_Const_iterator, _Safe_iterator>::__value; } - - typedef std::iterator_traits<_Iterator> _Traits; - - struct _Attach_single - { }; - - _Safe_iterator(const _Iterator& __i, _Safe_sequence_base* __seq, - _Attach_single) - _GLIBCXX_NOEXCEPT - : _Iter_base(__i) - { _M_attach_single(__seq); } - - public: - typedef _Iterator iterator_type; - typedef typename _Traits::iterator_category iterator_category; - typedef typename _Traits::value_type value_type; - typedef typename _Traits::difference_type difference_type; - typedef typename _Traits::reference reference; - typedef typename _Traits::pointer pointer; - - /// @post the iterator is singular and unattached - _Safe_iterator() _GLIBCXX_NOEXCEPT : _Iter_base() { } - - /** - * @brief Safe iterator construction from an unsafe iterator and - * its sequence. - * - * @pre @p seq is not NULL - * @post this is not singular - */ - _Safe_iterator(const _Iterator& __i, const _Safe_sequence_base* __seq) - _GLIBCXX_NOEXCEPT - : _Iter_base(__i), _Safe_base(__seq, _M_constant()) - { - _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(), - _M_message(__msg_init_singular) - ._M_iterator(*this, "this")); - } - - /** - * @brief Copy construction. - */ - _Safe_iterator(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT - : _Iter_base(__x.base()) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 408. Is vector > forbidden? - _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() - || __x.base() == _Iterator(), - _M_message(__msg_init_copy_singular) - ._M_iterator(*this, "this") - ._M_iterator(__x, "other")); - _M_attach(__x._M_sequence); - } - -#if __cplusplus >= 201103L - /** - * @brief Move construction. - * @post __x is singular and unattached - */ - _Safe_iterator(_Safe_iterator&& __x) noexcept - : _Iter_base() - { - _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() - || __x.base() == _Iterator(), - _M_message(__msg_init_copy_singular) - ._M_iterator(*this, "this") - ._M_iterator(__x, "other")); - _Safe_sequence_base* __seq = __x._M_sequence; - __x._M_detach(); - std::swap(base(), __x.base()); - _M_attach(__seq); - } -#endif - - /** - * @brief Converting constructor from a mutable iterator to a - * constant iterator. - */ - template - _Safe_iterator( - const _Safe_iterator<_MutableIterator, - typename __gnu_cxx::__enable_if<(std::__are_same<_MutableIterator, - typename _Sequence::iterator::iterator_type>::__value), - _Sequence>::__type>& __x) _GLIBCXX_NOEXCEPT - : _Iter_base(__x.base()) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 408. Is vector > forbidden? - _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() - || __x.base() == _Iterator(), - _M_message(__msg_init_const_singular) - ._M_iterator(*this, "this") - ._M_iterator(__x, "other")); - _M_attach(__x._M_sequence); - } - - /** - * @brief Copy assignment. - */ - _Safe_iterator& - operator=(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 408. Is vector > forbidden? - _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() - || __x.base() == _Iterator(), - _M_message(__msg_copy_singular) - ._M_iterator(*this, "this") - ._M_iterator(__x, "other")); - - if (this->_M_sequence && this->_M_sequence == __x._M_sequence) - { - __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); - base() = __x.base(); - _M_version = __x._M_sequence->_M_version; - } - else - { - _M_detach(); - base() = __x.base(); - _M_attach(__x._M_sequence); - } - - return *this; - } - -#if __cplusplus >= 201103L - /** - * @brief Move assignment. - * @post __x is singular and unattached - */ - _Safe_iterator& - operator=(_Safe_iterator&& __x) noexcept - { - _GLIBCXX_DEBUG_VERIFY(this != &__x, - _M_message(__msg_self_move_assign) - ._M_iterator(*this, "this")); - _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() - || __x.base() == _Iterator(), - _M_message(__msg_copy_singular) - ._M_iterator(*this, "this") - ._M_iterator(__x, "other")); - - if (this->_M_sequence && this->_M_sequence == __x._M_sequence) - { - __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); - base() = __x.base(); - _M_version = __x._M_sequence->_M_version; - } - else - { - _M_detach(); - base() = __x.base(); - _M_attach(__x._M_sequence); - } - - __x._M_detach(); - __x.base() = _Iterator(); - return *this; - } -#endif - - /** - * @brief Iterator dereference. - * @pre iterator is dereferenceable - */ - reference - operator*() const _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), - _M_message(__msg_bad_deref) - ._M_iterator(*this, "this")); - return *base(); - } - - /** - * @brief Iterator dereference. - * @pre iterator is dereferenceable - * @todo Make this correct w.r.t. iterators that return proxies - */ - pointer - operator->() const _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), - _M_message(__msg_bad_deref) - ._M_iterator(*this, "this")); - return std::__addressof(*base()); - } - - // ------ Input iterator requirements ------ - /** - * @brief Iterator preincrement - * @pre iterator is incrementable - */ - _Safe_iterator& - operator++() _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), - _M_message(__msg_bad_inc) - ._M_iterator(*this, "this")); - __gnu_cxx::__scoped_lock(this->_M_get_mutex()); - ++base(); - return *this; - } - - /** - * @brief Iterator postincrement - * @pre iterator is incrementable - */ - _Safe_iterator - operator++(int) _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), - _M_message(__msg_bad_inc) - ._M_iterator(*this, "this")); - __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); - return _Safe_iterator(base()++, this->_M_sequence, _Attach_single()); - } - - // ------ Bidirectional iterator requirements ------ - /** - * @brief Iterator predecrement - * @pre iterator is decrementable - */ - _Safe_iterator& - operator--() _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(), - _M_message(__msg_bad_dec) - ._M_iterator(*this, "this")); - __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); - --base(); - return *this; - } - - /** - * @brief Iterator postdecrement - * @pre iterator is decrementable - */ - _Safe_iterator - operator--(int) _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(), - _M_message(__msg_bad_dec) - ._M_iterator(*this, "this")); - __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); - return _Safe_iterator(base()--, this->_M_sequence, _Attach_single()); - } - - // ------ Random access iterator requirements ------ - reference - operator[](const difference_type& __n) const _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n) - && this->_M_can_advance(__n+1), - _M_message(__msg_iter_subscript_oob) - ._M_iterator(*this)._M_integer(__n)); - return base()[__n]; - } - - _Safe_iterator& - operator+=(const difference_type& __n) _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n), - _M_message(__msg_advance_oob) - ._M_iterator(*this)._M_integer(__n)); - __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); - base() += __n; - return *this; - } - - _Safe_iterator - operator+(const difference_type& __n) const _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n), - _M_message(__msg_advance_oob) - ._M_iterator(*this)._M_integer(__n)); - return _Safe_iterator(base() + __n, this->_M_sequence); - } - - _Safe_iterator& - operator-=(const difference_type& __n) _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(-__n), - _M_message(__msg_retreat_oob) - ._M_iterator(*this)._M_integer(__n)); - __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); - base() -= __n; - return *this; - } - - _Safe_iterator - operator-(const difference_type& __n) const _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(-__n), - _M_message(__msg_retreat_oob) - ._M_iterator(*this)._M_integer(__n)); - return _Safe_iterator(base() - __n, this->_M_sequence); - } - - // ------ Utilities ------ - /** - * @brief Return the underlying iterator - */ - _Iterator& - base() _GLIBCXX_NOEXCEPT { return *this; } - - const _Iterator& - base() const _GLIBCXX_NOEXCEPT { return *this; } - - /** - * @brief Conversion to underlying non-debug iterator to allow - * better interaction with non-debug containers. - */ - operator _Iterator() const _GLIBCXX_NOEXCEPT { return *this; } - - /** Attach iterator to the given sequence. */ - void - _M_attach(_Safe_sequence_base* __seq) - { _Safe_base::_M_attach(__seq, _M_constant()); } - - /** Likewise, but not thread-safe. */ - void - _M_attach_single(_Safe_sequence_base* __seq) - { _Safe_base::_M_attach_single(__seq, _M_constant()); } - - /// Is the iterator dereferenceable? - bool - _M_dereferenceable() const - { return !this->_M_singular() && !_M_is_end() && !_M_is_before_begin(); } - - /// Is the iterator before a dereferenceable one? - bool - _M_before_dereferenceable() const - { - if (this->_M_incrementable()) - { - _Iterator __base = base(); - return ++__base != _M_get_sequence()->_M_base().end(); - } - return false; - } - - /// Is the iterator incrementable? - bool - _M_incrementable() const - { return !this->_M_singular() && !_M_is_end(); } - - // Is the iterator decrementable? - bool - _M_decrementable() const { return !_M_singular() && !_M_is_begin(); } - - // Can we advance the iterator @p __n steps (@p __n may be negative) - bool - _M_can_advance(const difference_type& __n) const; - - // Is the iterator range [*this, __rhs) valid? - bool - _M_valid_range(const _Safe_iterator& __rhs) const; - - // The sequence this iterator references. - typename - __gnu_cxx::__conditional_type::__value, - const _Sequence*, - _Sequence*>::__type - _M_get_sequence() const - { return static_cast<_Sequence*>(_M_sequence); } - - /// Is this iterator equal to the sequence's begin() iterator? - bool - _M_is_begin() const - { return base() == _M_get_sequence()->_M_base().begin(); } - - /// Is this iterator equal to the sequence's end() iterator? - bool - _M_is_end() const - { return base() == _M_get_sequence()->_M_base().end(); } - - /// Is this iterator equal to the sequence's before_begin() iterator if - /// any? - bool - _M_is_before_begin() const - { return _BeforeBeginHelper<_Sequence>::_S_Is(*this); } - - /// Is this iterator equal to the sequence's before_begin() iterator if - /// any or begin() otherwise? - bool - _M_is_beginnest() const - { return _BeforeBeginHelper<_Sequence>::_S_Is_Beginnest(*this); } - }; - - template - inline bool - operator==(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, - const _Safe_iterator<_IteratorR, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_iter_compare_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_compare_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() == __rhs.base(); - } - - template - inline bool - operator==(const _Safe_iterator<_Iterator, _Sequence>& __lhs, - const _Safe_iterator<_Iterator, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_iter_compare_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_compare_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() == __rhs.base(); - } - - template - inline bool - operator!=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, - const _Safe_iterator<_IteratorR, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_iter_compare_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_compare_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() != __rhs.base(); - } - - template - inline bool - operator!=(const _Safe_iterator<_Iterator, _Sequence>& __lhs, - const _Safe_iterator<_Iterator, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_iter_compare_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_compare_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() != __rhs.base(); - } - - template - inline bool - operator<(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, - const _Safe_iterator<_IteratorR, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_iter_order_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_order_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() < __rhs.base(); - } - - template - inline bool - operator<(const _Safe_iterator<_Iterator, _Sequence>& __lhs, - const _Safe_iterator<_Iterator, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_iter_order_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_order_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() < __rhs.base(); - } - - template - inline bool - operator<=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, - const _Safe_iterator<_IteratorR, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_iter_order_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_order_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() <= __rhs.base(); - } - - template - inline bool - operator<=(const _Safe_iterator<_Iterator, _Sequence>& __lhs, - const _Safe_iterator<_Iterator, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_iter_order_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_order_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() <= __rhs.base(); - } - - template - inline bool - operator>(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, - const _Safe_iterator<_IteratorR, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_iter_order_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_order_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() > __rhs.base(); - } - - template - inline bool - operator>(const _Safe_iterator<_Iterator, _Sequence>& __lhs, - const _Safe_iterator<_Iterator, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_iter_order_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_order_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() > __rhs.base(); - } - - template - inline bool - operator>=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, - const _Safe_iterator<_IteratorR, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_iter_order_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_order_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() >= __rhs.base(); - } - - template - inline bool - operator>=(const _Safe_iterator<_Iterator, _Sequence>& __lhs, - const _Safe_iterator<_Iterator, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_iter_order_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_order_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() >= __rhs.base(); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // According to the resolution of DR179 not only the various comparison - // operators but also operator- must accept mixed iterator/const_iterator - // parameters. - template - inline typename _Safe_iterator<_IteratorL, _Sequence>::difference_type - operator-(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, - const _Safe_iterator<_IteratorR, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_distance_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_distance_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() - __rhs.base(); - } - - template - inline typename _Safe_iterator<_Iterator, _Sequence>::difference_type - operator-(const _Safe_iterator<_Iterator, _Sequence>& __lhs, - const _Safe_iterator<_Iterator, _Sequence>& __rhs) - _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_distance_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_distance_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() - __rhs.base(); - } - - template - inline _Safe_iterator<_Iterator, _Sequence> - operator+(typename _Safe_iterator<_Iterator,_Sequence>::difference_type __n, - const _Safe_iterator<_Iterator, _Sequence>& __i) _GLIBCXX_NOEXCEPT - { return __i + __n; } -} // namespace __gnu_debug - -#include - -#endif diff --git a/openflow/usr/include/c++/5/debug/safe_iterator.tcc b/openflow/usr/include/c++/5/debug/safe_iterator.tcc deleted file mode 100644 index 47b6f2f..0000000 --- a/openflow/usr/include/c++/5/debug/safe_iterator.tcc +++ /dev/null @@ -1,100 +0,0 @@ -// Debugging iterator implementation (out of line) -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/safe_iterator.tcc - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC -#define _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC 1 - -namespace __gnu_debug -{ - template - bool - _Safe_iterator<_Iterator, _Sequence>:: - _M_can_advance(const difference_type& __n) const - { - if (this->_M_singular()) - return false; - if (__n == 0) - return true; - if (__n < 0) - { - std::pair __dist = - __get_distance(_M_get_sequence()->_M_base().begin(), base()); - bool __ok = ((__dist.second == __dp_exact && __dist.first >= -__n) - || (__dist.second != __dp_exact && __dist.first > 0)); - return __ok; - } - else - { - std::pair __dist = - __get_distance(base(), _M_get_sequence()->_M_base().end()); - bool __ok = ((__dist.second == __dp_exact && __dist.first >= __n) - || (__dist.second != __dp_exact && __dist.first > 0)); - return __ok; - } - } - - template - bool - _Safe_iterator<_Iterator, _Sequence>:: - _M_valid_range(const _Safe_iterator& __rhs) const - { - if (!_M_can_compare(__rhs)) - return false; - - /* Determine if we can order the iterators without the help of - the container */ - std::pair __dist = - __get_distance(base(), __rhs.base()); - switch (__dist.second) { - case __dp_equality: - if (__dist.first == 0) - return true; - break; - - case __dp_sign: - case __dp_exact: - return __dist.first >= 0; - } - - /* We can only test for equality, but check if one of the - iterators is at an extreme. */ - /* Optim for classic [begin, it) or [it, end) ranges, limit checks - * when code is valid. Note, for the special case of forward_list, - * before_begin replaces the role of begin. */ - if (_M_is_beginnest() || __rhs._M_is_end()) - return true; - if (_M_is_end() || __rhs._M_is_beginnest()) - return false; - - // Assume that this is a valid range; we can't check anything else - return true; - } -} // namespace __gnu_debug - -#endif - diff --git a/openflow/usr/include/c++/5/debug/safe_local_iterator.h b/openflow/usr/include/c++/5/debug/safe_local_iterator.h deleted file mode 100644 index 066e10b..0000000 --- a/openflow/usr/include/c++/5/debug/safe_local_iterator.h +++ /dev/null @@ -1,439 +0,0 @@ -// Safe iterator implementation -*- C++ -*- - -// Copyright (C) 2011-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/safe_local_iterator.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_H -#define _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_H 1 - -#include -#include -#include -#include -#include - -namespace __gnu_debug -{ - /** \brief Safe iterator wrapper. - * - * The class template %_Safe_local_iterator is a wrapper around an - * iterator that tracks the iterator's movement among sequences and - * checks that operations performed on the "safe" iterator are - * legal. In additional to the basic iterator operations (which are - * validated, and then passed to the underlying iterator), - * %_Safe_local_iterator has member functions for iterator invalidation, - * attaching/detaching the iterator from sequences, and querying - * the iterator's state. - */ - template - class _Safe_local_iterator - : private _Iterator - , public _Safe_local_iterator_base - { - typedef _Iterator _Iter_base; - typedef _Safe_local_iterator_base _Safe_base; - typedef typename _Sequence::const_local_iterator _Const_local_iterator; - typedef typename _Sequence::size_type size_type; - - /// Determine if this is a constant iterator. - bool - _M_constant() const - { - return std::__are_same<_Const_local_iterator, - _Safe_local_iterator>::__value; - } - - typedef std::iterator_traits<_Iterator> _Traits; - - struct _Attach_single - { }; - - _Safe_local_iterator(const _Iterator& __i, _Safe_sequence_base* __cont, - _Attach_single) noexcept - : _Iter_base(__i) - { _M_attach_single(__cont); } - - public: - typedef _Iterator iterator_type; - typedef typename _Traits::iterator_category iterator_category; - typedef typename _Traits::value_type value_type; - typedef typename _Traits::difference_type difference_type; - typedef typename _Traits::reference reference; - typedef typename _Traits::pointer pointer; - - /// @post the iterator is singular and unattached - _Safe_local_iterator() noexcept : _Iter_base() { } - - /** - * @brief Safe iterator construction from an unsafe iterator and - * its sequence. - * - * @pre @p seq is not NULL - * @post this is not singular - */ - _Safe_local_iterator(const _Iterator& __i, - const _Safe_sequence_base* __cont) - : _Iter_base(__i), _Safe_base(__cont, _M_constant()) - { - _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(), - _M_message(__msg_init_singular) - ._M_iterator(*this, "this")); - } - - /** - * @brief Copy construction. - */ - _Safe_local_iterator(const _Safe_local_iterator& __x) noexcept - : _Iter_base(__x.base()) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 408. Is vector > forbidden? - _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() - || __x.base() == _Iterator(), - _M_message(__msg_init_copy_singular) - ._M_iterator(*this, "this") - ._M_iterator(__x, "other")); - _M_attach(__x._M_sequence); - } - - /** - * @brief Move construction. - * @post __x is singular and unattached - */ - _Safe_local_iterator(_Safe_local_iterator&& __x) noexcept - : _Iter_base() - { - _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() - || __x.base() == _Iterator(), - _M_message(__msg_init_copy_singular) - ._M_iterator(*this, "this") - ._M_iterator(__x, "other")); - auto __cont = __x._M_sequence; - __x._M_detach(); - std::swap(base(), __x.base()); - _M_attach(__cont); - } - - /** - * @brief Converting constructor from a mutable iterator to a - * constant iterator. - */ - template - _Safe_local_iterator( - const _Safe_local_iterator<_MutableIterator, - typename __gnu_cxx::__enable_if::__value, - _Sequence>::__type>& __x) - : _Iter_base(__x.base()) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 408. Is vector > forbidden? - _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() - || __x.base() == _Iterator(), - _M_message(__msg_init_const_singular) - ._M_iterator(*this, "this") - ._M_iterator(__x, "other")); - _M_attach(__x._M_sequence); - } - - /** - * @brief Copy assignment. - */ - _Safe_local_iterator& - operator=(const _Safe_local_iterator& __x) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 408. Is vector > forbidden? - _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() - || __x.base() == _Iterator(), - _M_message(__msg_copy_singular) - ._M_iterator(*this, "this") - ._M_iterator(__x, "other")); - - if (this->_M_sequence && this->_M_sequence == __x._M_sequence) - { - __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); - base() = __x.base(); - _M_version = __x._M_sequence->_M_version; - } - else - { - _M_detach(); - base() = __x.base(); - _M_attach(__x._M_sequence); - } - - return *this; - } - - /** - * @brief Move assignment. - * @post __x is singular and unattached - */ - _Safe_local_iterator& - operator=(_Safe_local_iterator&& __x) noexcept - { - _GLIBCXX_DEBUG_VERIFY(this != &__x, - _M_message(__msg_self_move_assign) - ._M_iterator(*this, "this")); - _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() - || __x.base() == _Iterator(), - _M_message(__msg_copy_singular) - ._M_iterator(*this, "this") - ._M_iterator(__x, "other")); - - if (this->_M_sequence && this->_M_sequence == __x._M_sequence) - { - __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); - base() = __x.base(); - _M_version = __x._M_sequence->_M_version; - } - else - { - _M_detach(); - base() = __x.base(); - _M_attach(__x._M_sequence); - } - - __x._M_detach(); - __x.base() = _Iterator(); - return *this; - } - - /** - * @brief Iterator dereference. - * @pre iterator is dereferenceable - */ - reference - operator*() const - { - _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), - _M_message(__msg_bad_deref) - ._M_iterator(*this, "this")); - return *base(); - } - - /** - * @brief Iterator dereference. - * @pre iterator is dereferenceable - * @todo Make this correct w.r.t. iterators that return proxies - */ - pointer - operator->() const - { - _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), - _M_message(__msg_bad_deref) - ._M_iterator(*this, "this")); - return std::__addressof(*base()); - } - - // ------ Input iterator requirements ------ - /** - * @brief Iterator preincrement - * @pre iterator is incrementable - */ - _Safe_local_iterator& - operator++() - { - _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), - _M_message(__msg_bad_inc) - ._M_iterator(*this, "this")); - __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); - ++base(); - return *this; - } - - /** - * @brief Iterator postincrement - * @pre iterator is incrementable - */ - _Safe_local_iterator - operator++(int) - { - _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), - _M_message(__msg_bad_inc) - ._M_iterator(*this, "this")); - __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); - return _Safe_local_iterator(base()++, this->_M_sequence, - _Attach_single()); - } - - // ------ Utilities ------ - /** - * @brief Return the underlying iterator - */ - _Iterator& - base() noexcept { return *this; } - - const _Iterator& - base() const noexcept { return *this; } - - /** - * @brief Return the bucket - */ - size_type - bucket() const { return base()._M_get_bucket(); } - - /** - * @brief Conversion to underlying non-debug iterator to allow - * better interaction with non-debug containers. - */ - operator _Iterator() const { return *this; } - - /** Attach iterator to the given sequence. */ - void - _M_attach(_Safe_sequence_base* __seq) - { _Safe_base::_M_attach(__seq, _M_constant()); } - - /** Likewise, but not thread-safe. */ - void - _M_attach_single(_Safe_sequence_base* __seq) - { _Safe_base::_M_attach_single(__seq, _M_constant()); } - - /// Is the iterator dereferenceable? - bool - _M_dereferenceable() const - { return !this->_M_singular() && !_M_is_end(); } - - /// Is the iterator incrementable? - bool - _M_incrementable() const - { return !this->_M_singular() && !_M_is_end(); } - - // Is the iterator range [*this, __rhs) valid? - bool - _M_valid_range(const _Safe_local_iterator& __rhs) const; - - // The sequence this iterator references. - typename - __gnu_cxx::__conditional_type::__value, - const _Sequence*, - _Sequence*>::__type - _M_get_sequence() const - { return static_cast<_Sequence*>(_M_sequence); } - - /// Is this iterator equal to the sequence's begin(bucket) iterator? - bool _M_is_begin() const - { return base() == _M_get_sequence()->_M_base().begin(bucket()); } - - /// Is this iterator equal to the sequence's end(bucket) iterator? - bool _M_is_end() const - { return base() == _M_get_sequence()->_M_base().end(bucket()); } - - /// Is this iterator part of the same bucket as the other one? - template - bool - _M_in_same_bucket(const _Safe_local_iterator<_Other, - _Sequence>& __other) const - { return bucket() == __other.bucket(); } - }; - - template - inline bool - operator==(const _Safe_local_iterator<_IteratorL, _Sequence>& __lhs, - const _Safe_local_iterator<_IteratorR, _Sequence>& __rhs) - { - _GLIBCXX_DEBUG_VERIFY(!__lhs._M_singular() && !__rhs._M_singular(), - _M_message(__msg_iter_compare_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_compare_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_in_same_bucket(__rhs), - _M_message(__msg_local_iter_compare_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() == __rhs.base(); - } - - template - inline bool - operator==(const _Safe_local_iterator<_Iterator, _Sequence>& __lhs, - const _Safe_local_iterator<_Iterator, _Sequence>& __rhs) - { - _GLIBCXX_DEBUG_VERIFY(!__lhs._M_singular() && !__rhs._M_singular(), - _M_message(__msg_iter_compare_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_compare_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_in_same_bucket(__rhs), - _M_message(__msg_local_iter_compare_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() == __rhs.base(); - } - - template - inline bool - operator!=(const _Safe_local_iterator<_IteratorL, _Sequence>& __lhs, - const _Safe_local_iterator<_IteratorR, _Sequence>& __rhs) - { - _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), - _M_message(__msg_iter_compare_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_compare_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_in_same_bucket(__rhs), - _M_message(__msg_local_iter_compare_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() != __rhs.base(); - } - - template - inline bool - operator!=(const _Safe_local_iterator<_Iterator, _Sequence>& __lhs, - const _Safe_local_iterator<_Iterator, _Sequence>& __rhs) - { - _GLIBCXX_DEBUG_VERIFY(!__lhs._M_singular() && !__rhs._M_singular(), - _M_message(__msg_iter_compare_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), - _M_message(__msg_compare_different) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - _GLIBCXX_DEBUG_VERIFY(__lhs._M_in_same_bucket(__rhs), - _M_message(__msg_local_iter_compare_bad) - ._M_iterator(__lhs, "lhs") - ._M_iterator(__rhs, "rhs")); - return __lhs.base() != __rhs.base(); - } -} // namespace __gnu_debug - -#include - -#endif diff --git a/openflow/usr/include/c++/5/debug/safe_local_iterator.tcc b/openflow/usr/include/c++/5/debug/safe_local_iterator.tcc deleted file mode 100644 index 455e4cd..0000000 --- a/openflow/usr/include/c++/5/debug/safe_local_iterator.tcc +++ /dev/null @@ -1,74 +0,0 @@ -// Debugging iterator implementation (out of line) -*- C++ -*- - -// Copyright (C) 2011-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/safe_local_iterator.tcc - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_TCC -#define _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_TCC 1 - -namespace __gnu_debug -{ - template - bool - _Safe_local_iterator<_Iterator, _Sequence>:: - _M_valid_range(const _Safe_local_iterator& __rhs) const - { - if (!_M_can_compare(__rhs)) - return false; - if (bucket() != __rhs.bucket()) - return false; - - /* Determine if we can order the iterators without the help of - the container */ - std::pair __dist = - __get_distance(base(), __rhs.base()); - switch (__dist.second) - { - case __dp_equality: - if (__dist.first == 0) - return true; - break; - - case __dp_sign: - case __dp_exact: - return __dist.first >= 0; - } - - /* We can only test for equality, but check if one of the - iterators is at an extreme. */ - /* Optim for classic [begin, it) or [it, end) ranges, limit checks - * when code is valid. */ - if (_M_is_begin() || __rhs._M_is_end()) - return true; - if (_M_is_end() || __rhs._M_is_begin()) - return false; - - // Assume that this is a valid range; we can't check anything else - return true; - } -} // namespace __gnu_debug - -#endif diff --git a/openflow/usr/include/c++/5/debug/safe_sequence.h b/openflow/usr/include/c++/5/debug/safe_sequence.h deleted file mode 100644 index abb0c29..0000000 --- a/openflow/usr/include/c++/5/debug/safe_sequence.h +++ /dev/null @@ -1,153 +0,0 @@ -// Safe sequence implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/safe_sequence.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_SAFE_SEQUENCE_H -#define _GLIBCXX_DEBUG_SAFE_SEQUENCE_H 1 - -#include -#include -#include -#include - -namespace __gnu_debug -{ - template - class _Safe_iterator; - - /** A simple function object that returns true if the passed-in - * value is not equal to the stored value. It saves typing over - * using both bind1st and not_equal. - */ - template - class _Not_equal_to - { - _Type __value; - - public: - explicit _Not_equal_to(const _Type& __v) : __value(__v) { } - - bool - operator()(const _Type& __x) const - { return __value != __x; } - }; - - /** A simple function object that returns true if the passed-in - * value is equal to the stored value. */ - template - class _Equal_to - { - _Type __value; - - public: - explicit _Equal_to(const _Type& __v) : __value(__v) { } - - bool - operator()(const _Type& __x) const - { return __value == __x; } - }; - - /** A function object that returns true when the given random access - iterator is at least @c n steps away from the given iterator. */ - template - class _After_nth_from - { - typedef typename std::iterator_traits<_Iterator>::difference_type - difference_type; - - _Iterator _M_base; - difference_type _M_n; - - public: - _After_nth_from(const difference_type& __n, const _Iterator& __base) - : _M_base(__base), _M_n(__n) { } - - bool - operator()(const _Iterator& __x) const - { return __x - _M_base >= _M_n; } - }; - - /** - * @brief Base class for constructing a @a safe sequence type that - * tracks iterators that reference it. - * - * The class template %_Safe_sequence simplifies the construction of - * @a safe sequences that track the iterators that reference the - * sequence, so that the iterators are notified of changes in the - * sequence that may affect their operation, e.g., if the container - * invalidates its iterators or is destructed. This class template - * may only be used by deriving from it and passing the name of the - * derived class as its template parameter via the curiously - * recurring template pattern. The derived class must have @c - * iterator and @c const_iterator types that are instantiations of - * class template _Safe_iterator for this sequence. Iterators will - * then be tracked automatically. - */ - template - class _Safe_sequence : public _Safe_sequence_base - { - public: - /** Invalidates all iterators @c x that reference this sequence, - are not singular, and for which @c __pred(x) returns @c - true. @c __pred will be invoked with the normal iterators nested - in the safe ones. */ - template - void - _M_invalidate_if(_Predicate __pred); - - /** Transfers all iterators @c x that reference @c from sequence, - are not singular, and for which @c __pred(x) returns @c - true. @c __pred will be invoked with the normal iterators nested - in the safe ones. */ - template - void - _M_transfer_from_if(_Safe_sequence& __from, _Predicate __pred); - }; - - /// Like _Safe_sequence but with a special _M_invalidate_all implementation - /// not invalidating past-the-end iterators. Used by node based sequence. - template - class _Safe_node_sequence - : public _Safe_sequence<_Sequence> - { - protected: - void - _M_invalidate_all() - { - typedef typename _Sequence::const_iterator _Const_iterator; - typedef typename _Const_iterator::iterator_type _Base_const_iterator; - typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; - const _Sequence& __seq = *static_cast<_Sequence*>(this); - this->_M_invalidate_if(_Not_equal(__seq._M_base().end())); - } - }; - -} // namespace __gnu_debug - -#include - -#endif diff --git a/openflow/usr/include/c++/5/debug/safe_sequence.tcc b/openflow/usr/include/c++/5/debug/safe_sequence.tcc deleted file mode 100644 index d05b59c..0000000 --- a/openflow/usr/include/c++/5/debug/safe_sequence.tcc +++ /dev/null @@ -1,153 +0,0 @@ -// Safe sequence implementation -*- C++ -*- - -// Copyright (C) 2010-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/safe_sequence.tcc - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_SAFE_SEQUENCE_TCC -#define _GLIBCXX_DEBUG_SAFE_SEQUENCE_TCC 1 - -namespace __gnu_debug -{ - template - template - void - _Safe_sequence<_Sequence>:: - _M_invalidate_if(_Predicate __pred) - { - typedef typename _Sequence::iterator iterator; - typedef typename _Sequence::const_iterator const_iterator; - - __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex()); - for (_Safe_iterator_base* __iter = _M_iterators; __iter;) - { - iterator* __victim = static_cast(__iter); - __iter = __iter->_M_next; - if (!__victim->_M_singular() && __pred(__victim->base())) - { - __victim->_M_invalidate(); - } - } - - for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;) - { - const_iterator* __victim = static_cast(__iter2); - __iter2 = __iter2->_M_next; - if (!__victim->_M_singular() && __pred(__victim->base())) - { - __victim->_M_invalidate(); - } - } - } - - template - template - void - _Safe_sequence<_Sequence>:: - _M_transfer_from_if(_Safe_sequence& __from, _Predicate __pred) - { - typedef typename _Sequence::iterator iterator; - typedef typename _Sequence::const_iterator const_iterator; - - _Safe_iterator_base* __transfered_iterators = 0; - _Safe_iterator_base* __transfered_const_iterators = 0; - _Safe_iterator_base* __last_iterator = 0; - _Safe_iterator_base* __last_const_iterator = 0; - { - // We lock __from first and detach iterator(s) to transfer - __gnu_cxx::__scoped_lock sentry(__from._M_get_mutex()); - - for (_Safe_iterator_base* __iter = __from._M_iterators; __iter;) - { - _Safe_iterator_base* __victim_base = __iter; - iterator* __victim = static_cast(__victim_base); - __iter = __iter->_M_next; - if (!__victim->_M_singular() && __pred(__victim->base())) - { - __victim->_M_detach_single(); - if (__transfered_iterators) - { - __victim_base->_M_next = __transfered_iterators; - __transfered_iterators->_M_prior = __victim_base; - } - else - __last_iterator = __victim_base; - __victim_base->_M_sequence = this; - __victim_base->_M_version = this->_M_version; - __transfered_iterators = __victim_base; - } - } - - for (_Safe_iterator_base* __iter2 = __from._M_const_iterators; - __iter2;) - { - _Safe_iterator_base* __victim_base = __iter2; - const_iterator* __victim = - static_cast(__victim_base); - __iter2 = __iter2->_M_next; - if (!__victim->_M_singular() && __pred(__victim->base())) - { - __victim->_M_detach_single(); - if (__transfered_const_iterators) - { - __victim_base->_M_next = __transfered_const_iterators; - __transfered_const_iterators->_M_prior = __victim_base; - } - else - __last_const_iterator = __victim; - __victim_base->_M_sequence = this; - __victim_base->_M_version = this->_M_version; - __transfered_const_iterators = __victim_base; - } - } - } - - // Now we can lock *this and add the transfered iterators if any - if (__last_iterator || __last_const_iterator) - { - __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex()); - if (__last_iterator) - { - if (this->_M_iterators) - { - this->_M_iterators->_M_prior = __last_iterator; - __last_iterator->_M_next = this->_M_iterators; - } - this->_M_iterators = __transfered_iterators; - } - if (__last_const_iterator) - { - if (this->_M_const_iterators) - { - this->_M_const_iterators->_M_prior = __last_const_iterator; - __last_const_iterator->_M_next = this->_M_const_iterators; - } - this->_M_const_iterators = __transfered_const_iterators; - } - } - } -} // namespace __gnu_debug - -#endif diff --git a/openflow/usr/include/c++/5/debug/safe_unordered_base.h b/openflow/usr/include/c++/5/debug/safe_unordered_base.h deleted file mode 100644 index 8dec59d..0000000 --- a/openflow/usr/include/c++/5/debug/safe_unordered_base.h +++ /dev/null @@ -1,180 +0,0 @@ -// Safe container/iterator base implementation -*- C++ -*- - -// Copyright (C) 2011-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/safe_unordered_base.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_BASE_H -#define _GLIBCXX_DEBUG_SAFE_UNORDERED_BASE_H 1 - -#include - -namespace __gnu_debug -{ - class _Safe_unordered_container_base; - - /** \brief Basic functionality for a @a safe iterator. - * - * The %_Safe_local_iterator_base base class implements the functionality - * of a safe local iterator that is not specific to a particular iterator - * type. It contains a pointer back to the container it references - * along with iterator version information and pointers to form a - * doubly-linked list of local iterators referenced by the container. - * - * This class must not perform any operations that can throw an - * exception, or the exception guarantees of derived iterators will - * be broken. - */ - class _Safe_local_iterator_base : public _Safe_iterator_base - { - protected: - /** Initializes the iterator and makes it singular. */ - _Safe_local_iterator_base() - { } - - /** Initialize the iterator to reference the container pointed to - * by @p __seq. @p __constant is true when we are initializing a - * constant local iterator, and false if it is a mutable local iterator. - * Note that @p __seq may be NULL, in which case the iterator will be - * singular. Otherwise, the iterator will reference @p __seq and - * be nonsingular. - */ - _Safe_local_iterator_base(const _Safe_sequence_base* __seq, bool __constant) - { this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant); } - - /** Initializes the iterator to reference the same container that - @p __x does. @p __constant is true if this is a constant - iterator, and false if it is mutable. */ - _Safe_local_iterator_base(const _Safe_local_iterator_base& __x, - bool __constant) - { this->_M_attach(__x._M_sequence, __constant); } - - ~_Safe_local_iterator_base() { this->_M_detach(); } - - _Safe_unordered_container_base* - _M_get_container() const noexcept; - - public: - /** Attaches this iterator to the given container, detaching it - * from whatever container it was attached to originally. If the - * new container is the NULL pointer, the iterator is left - * unattached. - */ - void _M_attach(_Safe_sequence_base* __seq, bool __constant); - - /** Likewise, but not thread-safe. */ - void _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw (); - - /** Detach the iterator for whatever container it is attached to, - * if any. - */ - void _M_detach(); - - /** Likewise, but not thread-safe. */ - void _M_detach_single() throw (); - }; - - /** - * @brief Base class that supports tracking of local iterators that - * reference an unordered container. - * - * The %_Safe_unordered_container_base class provides basic support for - * tracking iterators into an unordered container. Containers that track - * iterators must derived from %_Safe_unordered_container_base publicly, so - * that safe iterators (which inherit _Safe_iterator_base) can - * attach to them. This class contains four linked lists of - * iterators, one for constant iterators, one for mutable - * iterators, one for constant local iterators, one for mutable local - * iterators and a version number that allows very fast - * invalidation of all iterators that reference the container. - * - * This class must ensure that no operation on it may throw an - * exception, otherwise @a safe containers may fail to provide the - * exception-safety guarantees required by the C++ standard. - */ - class _Safe_unordered_container_base : public _Safe_sequence_base - { - typedef _Safe_sequence_base _Base; - public: - /// The list of mutable local iterators that reference this container - _Safe_iterator_base* _M_local_iterators; - - /// The list of constant local iterators that reference this container - _Safe_iterator_base* _M_const_local_iterators; - - protected: - // Initialize with a version number of 1 and no iterators - _Safe_unordered_container_base() noexcept - : _M_local_iterators(nullptr), _M_const_local_iterators(nullptr) - { } - - // Copy constructor does not copy iterators. - _Safe_unordered_container_base(const _Safe_unordered_container_base&) - noexcept - : _Safe_unordered_container_base() { } - - // When moved unordered containers iterators are swapped. - _Safe_unordered_container_base(_Safe_unordered_container_base&& __x) - noexcept - : _Safe_unordered_container_base() - { this->_M_swap(__x); } - - /** Notify all iterators that reference this container that the - container is being destroyed. */ - ~_Safe_unordered_container_base() noexcept - { this->_M_detach_all(); } - - /** Detach all iterators, leaving them singular. */ - void - _M_detach_all(); - - /** Swap this container with the given container. This operation - * also swaps ownership of the iterators, so that when the - * operation is complete all iterators that originally referenced - * one container now reference the other container. - */ - void - _M_swap(_Safe_unordered_container_base& __x) noexcept; - - public: - /** Attach an iterator to this container. */ - void - _M_attach_local(_Safe_iterator_base* __it, bool __constant); - - /** Likewise but not thread safe. */ - void - _M_attach_local_single(_Safe_iterator_base* __it, bool __constant) throw (); - - /** Detach an iterator from this container */ - void - _M_detach_local(_Safe_iterator_base* __it); - - /** Likewise but not thread safe. */ - void - _M_detach_local_single(_Safe_iterator_base* __it) throw (); - }; -} // namespace __gnu_debug - -#endif diff --git a/openflow/usr/include/c++/5/debug/safe_unordered_container.h b/openflow/usr/include/c++/5/debug/safe_unordered_container.h deleted file mode 100644 index 05d08b7..0000000 --- a/openflow/usr/include/c++/5/debug/safe_unordered_container.h +++ /dev/null @@ -1,105 +0,0 @@ -// Safe container implementation -*- C++ -*- - -// Copyright (C) 2011-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/safe_unordered_container.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_H -#define _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_H 1 - -#include -#include -#include -#include - -namespace __gnu_debug -{ - /** - * @brief Base class for constructing a @a safe unordered container type - * that tracks iterators that reference it. - * - * The class template %_Safe_unordered_container simplifies the - * construction of @a safe unordered containers that track the iterators - * that reference the container, so that the iterators are notified of - * changes in the container that may affect their operation, e.g., if - * the container invalidates its iterators or is destructed. This class - * template may only be used by deriving from it and passing the name - * of the derived class as its template parameter via the curiously - * recurring template pattern. The derived class must have @c - * iterator and @c const_iterator types that are instantiations of - * class template _Safe_iterator for this container and @c local_iterator - * and @c const_local_iterator types that are instantiations of class - * template _Safe_local_iterator for this container. Iterators will - * then be tracked automatically. - */ - template - class _Safe_unordered_container : public _Safe_unordered_container_base - { - private: - _Container& - _M_cont() noexcept - { return *static_cast<_Container*>(this); } - - protected: - void - _M_invalidate_locals() - { - auto __local_end = _M_cont()._M_base().end(0); - this->_M_invalidate_local_if( - [__local_end](__decltype(_M_cont()._M_base().cend(0)) __it) - { return __it != __local_end; }); - } - - void - _M_invalidate_all() - { - auto __end = _M_cont()._M_base().end(); - this->_M_invalidate_if( - [__end](__decltype(_M_cont()._M_base().cend()) __it) - { return __it != __end; }); - _M_invalidate_locals(); - } - - /** Invalidates all iterators @c x that reference this container, - are not singular, and for which @c __pred(x) returns @c - true. @c __pred will be invoked with the normal iterators nested - in the safe ones. */ - template - void - _M_invalidate_if(_Predicate __pred); - - /** Invalidates all local iterators @c x that reference this container, - are not singular, and for which @c __pred(x) returns @c - true. @c __pred will be invoked with the normal ilocal iterators - nested in the safe ones. */ - template - void - _M_invalidate_local_if(_Predicate __pred); - }; -} // namespace __gnu_debug - -#include - -#endif diff --git a/openflow/usr/include/c++/5/debug/safe_unordered_container.tcc b/openflow/usr/include/c++/5/debug/safe_unordered_container.tcc deleted file mode 100644 index e517d0d..0000000 --- a/openflow/usr/include/c++/5/debug/safe_unordered_container.tcc +++ /dev/null @@ -1,100 +0,0 @@ -// Safe container implementation -*- C++ -*- - -// Copyright (C) 2011-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/safe_unordered_container.tcc - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_TCC -#define _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_TCC 1 - -namespace __gnu_debug -{ - template - template - void - _Safe_unordered_container<_Container>:: - _M_invalidate_if(_Predicate __pred) - { - typedef typename _Container::iterator iterator; - typedef typename _Container::const_iterator const_iterator; - - __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex()); - for (_Safe_iterator_base* __iter = _M_iterators; __iter;) - { - iterator* __victim = static_cast(__iter); - __iter = __iter->_M_next; - if (!__victim->_M_singular() && __pred(__victim->base())) - { - __victim->_M_invalidate(); - } - } - - for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;) - { - const_iterator* __victim = static_cast(__iter2); - __iter2 = __iter2->_M_next; - if (!__victim->_M_singular() && __pred(__victim->base())) - { - __victim->_M_invalidate(); - } - } - } - - - template - template - void - _Safe_unordered_container<_Container>:: - _M_invalidate_local_if(_Predicate __pred) - { - typedef typename _Container::local_iterator local_iterator; - typedef typename _Container::const_local_iterator const_local_iterator; - - __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex()); - for (_Safe_iterator_base* __iter = _M_local_iterators; __iter;) - { - local_iterator* __victim = static_cast(__iter); - __iter = __iter->_M_next; - if (!__victim->_M_singular() && __pred(__victim->base())) - { - __victim->_M_invalidate(); - } - } - - for (_Safe_iterator_base* __iter2 = _M_const_local_iterators; __iter2;) - { - const_local_iterator* __victim = - static_cast(__iter2); - __iter2 = __iter2->_M_next; - if (!__victim->_M_singular() && __pred(__victim->base())) - { - __victim->_M_invalidate(); - } - } - } - -} // namespace __gnu_debug - -#endif diff --git a/openflow/usr/include/c++/5/debug/set b/openflow/usr/include/c++/5/debug/set deleted file mode 100644 index b45f486..0000000 --- a/openflow/usr/include/c++/5/debug/set +++ /dev/null @@ -1,36 +0,0 @@ -// Debugging set/multiset implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/set - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_SET -#define _GLIBCXX_DEBUG_SET 1 - -#include -#include -#include - -#endif diff --git a/openflow/usr/include/c++/5/debug/set.h b/openflow/usr/include/c++/5/debug/set.h deleted file mode 100644 index 00d539f..0000000 --- a/openflow/usr/include/c++/5/debug/set.h +++ /dev/null @@ -1,490 +0,0 @@ -// Debugging set implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/set.h - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_SET_H -#define _GLIBCXX_DEBUG_SET_H 1 - -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __debug -{ - /// Class std::set with safety/checking/debug instrumentation. - template, - typename _Allocator = std::allocator<_Key> > - class set - : public __gnu_debug::_Safe_container< - set<_Key, _Compare, _Allocator>, _Allocator, - __gnu_debug::_Safe_node_sequence>, - public _GLIBCXX_STD_C::set<_Key,_Compare,_Allocator> - { - typedef _GLIBCXX_STD_C::set<_Key, _Compare, _Allocator> _Base; - typedef __gnu_debug::_Safe_container< - set, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe; - - typedef typename _Base::const_iterator _Base_const_iterator; - typedef typename _Base::iterator _Base_iterator; - typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; - - public: - // types: - typedef _Key key_type; - typedef _Key value_type; - typedef _Compare key_compare; - typedef _Compare value_compare; - typedef _Allocator allocator_type; - typedef typename _Base::reference reference; - typedef typename _Base::const_reference const_reference; - - typedef __gnu_debug::_Safe_iterator<_Base_iterator, set> - iterator; - typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, set> - const_iterator; - - typedef typename _Base::size_type size_type; - typedef typename _Base::difference_type difference_type; - typedef typename _Base::pointer pointer; - typedef typename _Base::const_pointer const_pointer; - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - // 23.3.3.1 construct/copy/destroy: - -#if __cplusplus < 201103L - set() : _Base() { } - - set(const set& __x) - : _Base(__x) { } - - ~set() { } -#else - set() = default; - set(const set&) = default; - set(set&&) = default; - - set(initializer_list __l, - const _Compare& __comp = _Compare(), - const allocator_type& __a = allocator_type()) - : _Base(__l, __comp, __a) { } - - explicit - set(const allocator_type& __a) - : _Base(__a) { } - - set(const set& __x, const allocator_type& __a) - : _Base(__x, __a) { } - - set(set&& __x, const allocator_type& __a) - : _Safe(std::move(__x._M_safe()), __a), - _Base(std::move(__x._M_base()), __a) { } - - set(initializer_list __l, const allocator_type& __a) - : _Base(__l, __a) { } - - template - set(_InputIterator __first, _InputIterator __last, - const allocator_type& __a) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), __a) { } - - ~set() = default; -#endif - - explicit set(const _Compare& __comp, - const _Allocator& __a = _Allocator()) - : _Base(__comp, __a) { } - - template - set(_InputIterator __first, _InputIterator __last, - const _Compare& __comp = _Compare(), - const _Allocator& __a = _Allocator()) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), - __comp, __a) { } - - set(const _Base& __x) - : _Base(__x) { } - -#if __cplusplus < 201103L - set& - operator=(const set& __x) - { - this->_M_safe() = __x; - _M_base() = __x; - return *this; - } -#else - set& - operator=(const set&) = default; - - set& - operator=(set&&) = default; - - set& - operator=(initializer_list __l) - { - _M_base() = __l; - this->_M_invalidate_all(); - return *this; - } -#endif - - using _Base::get_allocator; - - // iterators: - iterator - begin() _GLIBCXX_NOEXCEPT - { return iterator(_Base::begin(), this); } - - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::begin(), this); } - - iterator - end() _GLIBCXX_NOEXCEPT - { return iterator(_Base::end(), this); } - - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::end(), this); } - - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return reverse_iterator(end()); } - - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(end()); } - - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return reverse_iterator(begin()); } - - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(begin()); } - -#if __cplusplus >= 201103L - const_iterator - cbegin() const noexcept - { return const_iterator(_Base::begin(), this); } - - const_iterator - cend() const noexcept - { return const_iterator(_Base::end(), this); } - - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(end()); } - - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(begin()); } -#endif - - // capacity: - using _Base::empty; - using _Base::size; - using _Base::max_size; - - // modifiers: -#if __cplusplus >= 201103L - template - std::pair - emplace(_Args&&... __args) - { - auto __res = _Base::emplace(std::forward<_Args>(__args)...); - return std::pair(iterator(__res.first, this), - __res.second); - } - - template - iterator - emplace_hint(const_iterator __pos, _Args&&... __args) - { - __glibcxx_check_insert(__pos); - return iterator(_Base::emplace_hint(__pos.base(), - std::forward<_Args>(__args)...), - this); - } -#endif - - std::pair - insert(const value_type& __x) - { - std::pair<_Base_iterator, bool> __res = _Base::insert(__x); - return std::pair(iterator(__res.first, this), - __res.second); - } - -#if __cplusplus >= 201103L - std::pair - insert(value_type&& __x) - { - std::pair<_Base_iterator, bool> __res - = _Base::insert(std::move(__x)); - return std::pair(iterator(__res.first, this), - __res.second); - } -#endif - - iterator - insert(const_iterator __position, const value_type& __x) - { - __glibcxx_check_insert(__position); - return iterator(_Base::insert(__position.base(), __x), this); - } - -#if __cplusplus >= 201103L - iterator - insert(const_iterator __position, value_type&& __x) - { - __glibcxx_check_insert(__position); - return iterator(_Base::insert(__position.base(), std::move(__x)), - this); - } -#endif - - template - void - insert(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - _Base::insert(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - } - -#if __cplusplus >= 201103L - void - insert(initializer_list __l) - { _Base::insert(__l); } -#endif - -#if __cplusplus >= 201103L - iterator - erase(const_iterator __position) - { - __glibcxx_check_erase(__position); - this->_M_invalidate_if(_Equal(__position.base())); - return iterator(_Base::erase(__position.base()), this); - } -#else - void - erase(iterator __position) - { - __glibcxx_check_erase(__position); - this->_M_invalidate_if(_Equal(__position.base())); - _Base::erase(__position.base()); - } -#endif - - size_type - erase(const key_type& __x) - { - _Base_iterator __victim = _Base::find(__x); - if (__victim == _Base::end()) - return 0; - else - { - this->_M_invalidate_if(_Equal(__victim)); - _Base::erase(__victim); - return 1; - } - } - -#if __cplusplus >= 201103L - iterator - erase(const_iterator __first, const_iterator __last) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 151. can't currently clear() empty container - __glibcxx_check_erase_range(__first, __last); - for (_Base_const_iterator __victim = __first.base(); - __victim != __last.base(); ++__victim) - { - _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - this->_M_invalidate_if(_Equal(__victim)); - } - return iterator(_Base::erase(__first.base(), __last.base()), this); - } -#else - void - erase(iterator __first, iterator __last) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 151. can't currently clear() empty container - __glibcxx_check_erase_range(__first, __last); - for (_Base_iterator __victim = __first.base(); - __victim != __last.base(); ++__victim) - { - _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - this->_M_invalidate_if(_Equal(__victim)); - } - _Base::erase(__first.base(), __last.base()); - } -#endif - - void - swap(set& __x) -#if __cplusplus >= 201103L - noexcept( noexcept(declval<_Base>().swap(__x)) ) -#endif - { - _Safe::_M_swap(__x); - _Base::swap(__x); - } - - void - clear() _GLIBCXX_NOEXCEPT - { - this->_M_invalidate_all(); - _Base::clear(); - } - - // observers: - using _Base::key_comp; - using _Base::value_comp; - - // set operations: - iterator - find(const key_type& __x) - { return iterator(_Base::find(__x), this); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 214. set::find() missing const overload - const_iterator - find(const key_type& __x) const - { return const_iterator(_Base::find(__x), this); } - - using _Base::count; - - iterator - lower_bound(const key_type& __x) - { return iterator(_Base::lower_bound(__x), this); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 214. set::find() missing const overload - const_iterator - lower_bound(const key_type& __x) const - { return const_iterator(_Base::lower_bound(__x), this); } - - iterator - upper_bound(const key_type& __x) - { return iterator(_Base::upper_bound(__x), this); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 214. set::find() missing const overload - const_iterator - upper_bound(const key_type& __x) const - { return const_iterator(_Base::upper_bound(__x), this); } - - std::pair - equal_range(const key_type& __x) - { - std::pair<_Base_iterator, _Base_iterator> __res = - _Base::equal_range(__x); - return std::make_pair(iterator(__res.first, this), - iterator(__res.second, this)); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 214. set::find() missing const overload - std::pair - equal_range(const key_type& __x) const - { - std::pair<_Base_iterator, _Base_iterator> __res = - _Base::equal_range(__x); - return std::make_pair(const_iterator(__res.first, this), - const_iterator(__res.second, this)); - } - - _Base& - _M_base() _GLIBCXX_NOEXCEPT { return *this; } - - const _Base& - _M_base() const _GLIBCXX_NOEXCEPT { return *this; } - }; - - template - inline bool - operator==(const set<_Key, _Compare, _Allocator>& __lhs, - const set<_Key, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() == __rhs._M_base(); } - - template - inline bool - operator!=(const set<_Key, _Compare, _Allocator>& __lhs, - const set<_Key, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() != __rhs._M_base(); } - - template - inline bool - operator<(const set<_Key, _Compare, _Allocator>& __lhs, - const set<_Key, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() < __rhs._M_base(); } - - template - inline bool - operator<=(const set<_Key, _Compare, _Allocator>& __lhs, - const set<_Key, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() <= __rhs._M_base(); } - - template - inline bool - operator>=(const set<_Key, _Compare, _Allocator>& __lhs, - const set<_Key, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() >= __rhs._M_base(); } - - template - inline bool - operator>(const set<_Key, _Compare, _Allocator>& __lhs, - const set<_Key, _Compare, _Allocator>& __rhs) - { return __lhs._M_base() > __rhs._M_base(); } - - template - void - swap(set<_Key, _Compare, _Allocator>& __x, - set<_Key, _Compare, _Allocator>& __y) - { return __x.swap(__y); } - -} // namespace __debug -} // namespace std - -#endif diff --git a/openflow/usr/include/c++/5/debug/string b/openflow/usr/include/c++/5/debug/string deleted file mode 100644 index 3793a35..0000000 --- a/openflow/usr/include/c++/5/debug/string +++ /dev/null @@ -1,1161 +0,0 @@ -// Debugging string implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/string - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_STRING -#define _GLIBCXX_DEBUG_STRING 1 - -#include -#include -#include -#include - -namespace __gnu_debug -{ - /// Class std::basic_string with safety/checking/debug instrumentation. - template, - typename _Allocator = std::allocator<_CharT> > - class basic_string - : public __gnu_debug::_Safe_container< - basic_string<_CharT, _Traits, _Allocator>, - _Allocator, _Safe_sequence, false>, - public std::basic_string<_CharT, _Traits, _Allocator> - { - typedef std::basic_string<_CharT, _Traits, _Allocator> _Base; - typedef __gnu_debug::_Safe_container< - basic_string, _Allocator, _Safe_sequence, false> _Safe; - - public: - // types: - typedef _Traits traits_type; - typedef typename _Traits::char_type value_type; - typedef _Allocator allocator_type; - typedef typename _Base::size_type size_type; - typedef typename _Base::difference_type difference_type; - typedef typename _Base::reference reference; - typedef typename _Base::const_reference const_reference; - typedef typename _Base::pointer pointer; - typedef typename _Base::const_pointer const_pointer; - - typedef __gnu_debug::_Safe_iterator< - typename _Base::iterator, basic_string> iterator; - typedef __gnu_debug::_Safe_iterator< - typename _Base::const_iterator, basic_string> const_iterator; - - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - using _Base::npos; - - // 21.3.1 construct/copy/destroy: - explicit basic_string(const _Allocator& __a = _Allocator()) - // _GLIBCXX_NOEXCEPT - : _Base(__a) { } - -#if __cplusplus < 201103L - basic_string(const basic_string& __str) - : _Base(__str) { } - - ~basic_string() { } -#else - basic_string(const basic_string&) = default; - basic_string(basic_string&&) = default; - - basic_string(std::initializer_list<_CharT> __l, - const _Allocator& __a = _Allocator()) - : _Base(__l, __a) - { } - - ~basic_string() = default; -#endif // C++11 - - // Provides conversion from a normal-mode string to a debug-mode string - basic_string(const _Base& __base) - : _Base(__base) { } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 42. string ctors specify wrong default allocator - basic_string(const basic_string& __str, size_type __pos, - size_type __n = _Base::npos, - const _Allocator& __a = _Allocator()) - : _Base(__str, __pos, __n, __a) { } - - basic_string(const _CharT* __s, size_type __n, - const _Allocator& __a = _Allocator()) - : _Base(__gnu_debug::__check_string(__s, __n), __n, __a) { } - - basic_string(const _CharT* __s, const _Allocator& __a = _Allocator()) - : _Base(__gnu_debug::__check_string(__s), __a) - { this->assign(__s); } - - basic_string(size_type __n, _CharT __c, - const _Allocator& __a = _Allocator()) - : _Base(__n, __c, __a) { } - - template - basic_string(_InputIterator __begin, _InputIterator __end, - const _Allocator& __a = _Allocator()) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__begin, - __end)), - __gnu_debug::__base(__end), __a) { } - -#if __cplusplus < 201103L - basic_string& - operator=(const basic_string& __str) - { - this->_M_safe() = __str; - _M_base() = __str; - return *this; - } -#else - basic_string& - operator=(const basic_string&) = default; - - basic_string& - operator=(basic_string&&) = default; -#endif - - basic_string& - operator=(const _CharT* __s) - { - __glibcxx_check_string(__s); - _M_base() = __s; - this->_M_invalidate_all(); - return *this; - } - - basic_string& - operator=(_CharT __c) - { - _M_base() = __c; - this->_M_invalidate_all(); - return *this; - } - -#if __cplusplus >= 201103L - basic_string& - operator=(std::initializer_list<_CharT> __l) - { - _M_base() = __l; - this->_M_invalidate_all(); - return *this; - } -#endif // C++11 - - // 21.3.2 iterators: - iterator - begin() // _GLIBCXX_NOEXCEPT - { return iterator(_Base::begin(), this); } - - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::begin(), this); } - - iterator - end() // _GLIBCXX_NOEXCEPT - { return iterator(_Base::end(), this); } - - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::end(), this); } - - reverse_iterator - rbegin() // _GLIBCXX_NOEXCEPT - { return reverse_iterator(end()); } - - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(end()); } - - reverse_iterator - rend() // _GLIBCXX_NOEXCEPT - { return reverse_iterator(begin()); } - - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(begin()); } - -#if __cplusplus >= 201103L - const_iterator - cbegin() const noexcept - { return const_iterator(_Base::begin(), this); } - - const_iterator - cend() const noexcept - { return const_iterator(_Base::end(), this); } - - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(end()); } - - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(begin()); } -#endif - - // 21.3.3 capacity: - using _Base::size; - using _Base::length; - using _Base::max_size; - - void - resize(size_type __n, _CharT __c) - { - _Base::resize(__n, __c); - this->_M_invalidate_all(); - } - - void - resize(size_type __n) - { this->resize(__n, _CharT()); } - -#if __cplusplus >= 201103L - void - shrink_to_fit() noexcept - { - if (capacity() > size()) - { - __try - { - reserve(0); - this->_M_invalidate_all(); - } - __catch(...) - { } - } - } -#endif - - using _Base::capacity; - using _Base::reserve; - - void - clear() // _GLIBCXX_NOEXCEPT - { - _Base::clear(); - this->_M_invalidate_all(); - } - - using _Base::empty; - - // 21.3.4 element access: - const_reference - operator[](size_type __pos) const _GLIBCXX_NOEXCEPT - { - _GLIBCXX_DEBUG_VERIFY(__pos <= this->size(), - _M_message(__gnu_debug::__msg_subscript_oob) - ._M_sequence(*this, "this") - ._M_integer(__pos, "__pos") - ._M_integer(this->size(), "size")); - return _M_base()[__pos]; - } - - reference - operator[](size_type __pos) // _GLIBCXX_NOEXCEPT - { -#ifdef _GLIBCXX_DEBUG_PEDANTIC - __glibcxx_check_subscript(__pos); -#else - // as an extension v3 allows s[s.size()] when s is non-const. - _GLIBCXX_DEBUG_VERIFY(__pos <= this->size(), - _M_message(__gnu_debug::__msg_subscript_oob) - ._M_sequence(*this, "this") - ._M_integer(__pos, "__pos") - ._M_integer(this->size(), "size")); -#endif - return _M_base()[__pos]; - } - - using _Base::at; - -#if __cplusplus >= 201103L - using _Base::front; - using _Base::back; -#endif - - // 21.3.5 modifiers: - basic_string& - operator+=(const basic_string& __str) - { - _M_base() += __str; - this->_M_invalidate_all(); - return *this; - } - - basic_string& - operator+=(const _CharT* __s) - { - __glibcxx_check_string(__s); - _M_base() += __s; - this->_M_invalidate_all(); - return *this; - } - - basic_string& - operator+=(_CharT __c) - { - _M_base() += __c; - this->_M_invalidate_all(); - return *this; - } - -#if __cplusplus >= 201103L - basic_string& - operator+=(std::initializer_list<_CharT> __l) - { - _M_base() += __l; - this->_M_invalidate_all(); - return *this; - } -#endif // C++11 - - basic_string& - append(const basic_string& __str) - { - _Base::append(__str); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - append(const basic_string& __str, size_type __pos, size_type __n) - { - _Base::append(__str, __pos, __n); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - append(const _CharT* __s, size_type __n) - { - __glibcxx_check_string_len(__s, __n); - _Base::append(__s, __n); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - append(const _CharT* __s) - { - __glibcxx_check_string(__s); - _Base::append(__s); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - append(size_type __n, _CharT __c) - { - _Base::append(__n, __c); - this->_M_invalidate_all(); - return *this; - } - - template - basic_string& - append(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - _Base::append(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - this->_M_invalidate_all(); - return *this; - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 7. string clause minor problems - void - push_back(_CharT __c) - { - _Base::push_back(__c); - this->_M_invalidate_all(); - } - - basic_string& - assign(const basic_string& __x) - { - _Base::assign(__x); - this->_M_invalidate_all(); - return *this; - } - -#if __cplusplus >= 201103L - basic_string& - assign(basic_string&& __x) - { - _Base::assign(std::move(__x)); - this->_M_invalidate_all(); - return *this; - } -#endif // C++11 - - basic_string& - assign(const basic_string& __str, size_type __pos, size_type __n) - { - _Base::assign(__str, __pos, __n); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - assign(const _CharT* __s, size_type __n) - { - __glibcxx_check_string_len(__s, __n); - _Base::assign(__s, __n); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - assign(const _CharT* __s) - { - __glibcxx_check_string(__s); - _Base::assign(__s); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - assign(size_type __n, _CharT __c) - { - _Base::assign(__n, __c); - this->_M_invalidate_all(); - return *this; - } - - template - basic_string& - assign(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - _Base::assign(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - this->_M_invalidate_all(); - return *this; - } - -#if __cplusplus >= 201103L - basic_string& - assign(std::initializer_list<_CharT> __l) - { - _Base::assign(__l); - this->_M_invalidate_all(); - return *this; - } -#endif // C++11 - - basic_string& - insert(size_type __pos1, const basic_string& __str) - { - _Base::insert(__pos1, __str); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - insert(size_type __pos1, const basic_string& __str, - size_type __pos2, size_type __n) - { - _Base::insert(__pos1, __str, __pos2, __n); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - insert(size_type __pos, const _CharT* __s, size_type __n) - { - __glibcxx_check_string(__s); - _Base::insert(__pos, __s, __n); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - insert(size_type __pos, const _CharT* __s) - { - __glibcxx_check_string(__s); - _Base::insert(__pos, __s); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - insert(size_type __pos, size_type __n, _CharT __c) - { - _Base::insert(__pos, __n, __c); - this->_M_invalidate_all(); - return *this; - } - - iterator - insert(iterator __p, _CharT __c) - { - __glibcxx_check_insert(__p); - typename _Base::iterator __res = _Base::insert(__p.base(), __c); - this->_M_invalidate_all(); - return iterator(__res, this); - } - - void - insert(iterator __p, size_type __n, _CharT __c) - { - __glibcxx_check_insert(__p); - _Base::insert(__p.base(), __n, __c); - this->_M_invalidate_all(); - } - - template - void - insert(iterator __p, _InputIterator __first, _InputIterator __last) - { - __glibcxx_check_insert_range(__p, __first, __last); - _Base::insert(__p.base(), __gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - this->_M_invalidate_all(); - } - -#if __cplusplus >= 201103L - void - insert(iterator __p, std::initializer_list<_CharT> __l) - { - __glibcxx_check_insert(__p); - _Base::insert(__p.base(), __l); - this->_M_invalidate_all(); - } -#endif // C++11 - - basic_string& - erase(size_type __pos = 0, size_type __n = _Base::npos) - { - _Base::erase(__pos, __n); - this->_M_invalidate_all(); - return *this; - } - - iterator - erase(iterator __position) - { - __glibcxx_check_erase(__position); - typename _Base::iterator __res = _Base::erase(__position.base()); - this->_M_invalidate_all(); - return iterator(__res, this); - } - - iterator - erase(iterator __first, iterator __last) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 151. can't currently clear() empty container - __glibcxx_check_erase_range(__first, __last); - typename _Base::iterator __res = _Base::erase(__first.base(), - __last.base()); - this->_M_invalidate_all(); - return iterator(__res, this); - } - -#if __cplusplus >= 201103L - void - pop_back() // noexcept - { - __glibcxx_check_nonempty(); - _Base::pop_back(); - this->_M_invalidate_all(); - } -#endif // C++11 - - basic_string& - replace(size_type __pos1, size_type __n1, const basic_string& __str) - { - _Base::replace(__pos1, __n1, __str); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - replace(size_type __pos1, size_type __n1, const basic_string& __str, - size_type __pos2, size_type __n2) - { - _Base::replace(__pos1, __n1, __str, __pos2, __n2); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - replace(size_type __pos, size_type __n1, const _CharT* __s, - size_type __n2) - { - __glibcxx_check_string_len(__s, __n2); - _Base::replace(__pos, __n1, __s, __n2); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - replace(size_type __pos, size_type __n1, const _CharT* __s) - { - __glibcxx_check_string(__s); - _Base::replace(__pos, __n1, __s); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) - { - _Base::replace(__pos, __n1, __n2, __c); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - replace(iterator __i1, iterator __i2, const basic_string& __str) - { - __glibcxx_check_erase_range(__i1, __i2); - _Base::replace(__i1.base(), __i2.base(), __str); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n) - { - __glibcxx_check_erase_range(__i1, __i2); - __glibcxx_check_string_len(__s, __n); - _Base::replace(__i1.base(), __i2.base(), __s, __n); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - replace(iterator __i1, iterator __i2, const _CharT* __s) - { - __glibcxx_check_erase_range(__i1, __i2); - __glibcxx_check_string(__s); - _Base::replace(__i1.base(), __i2.base(), __s); - this->_M_invalidate_all(); - return *this; - } - - basic_string& - replace(iterator __i1, iterator __i2, size_type __n, _CharT __c) - { - __glibcxx_check_erase_range(__i1, __i2); - _Base::replace(__i1.base(), __i2.base(), __n, __c); - this->_M_invalidate_all(); - return *this; - } - - template - basic_string& - replace(iterator __i1, iterator __i2, - _InputIterator __j1, _InputIterator __j2) - { - __glibcxx_check_erase_range(__i1, __i2); - __glibcxx_check_valid_range(__j1, __j2); - _Base::replace(__i1.base(), __i2.base(), __j1, __j2); - this->_M_invalidate_all(); - return *this; - } - -#if __cplusplus >= 201103L - basic_string& replace(iterator __i1, iterator __i2, - std::initializer_list<_CharT> __l) - { - __glibcxx_check_erase_range(__i1, __i2); - _Base::replace(__i1.base(), __i2.base(), __l); - this->_M_invalidate_all(); - return *this; - } -#endif // C++11 - - size_type - copy(_CharT* __s, size_type __n, size_type __pos = 0) const - { - __glibcxx_check_string_len(__s, __n); - return _Base::copy(__s, __n, __pos); - } - - void - swap(basic_string& __x) - { - _Safe::_M_swap(__x); - _Base::swap(__x); - } - - // 21.3.6 string operations: - const _CharT* - c_str() const _GLIBCXX_NOEXCEPT - { - const _CharT* __res = _Base::c_str(); - this->_M_invalidate_all(); - return __res; - } - - const _CharT* - data() const _GLIBCXX_NOEXCEPT - { - const _CharT* __res = _Base::data(); - this->_M_invalidate_all(); - return __res; - } - - using _Base::get_allocator; - - size_type - find(const basic_string& __str, size_type __pos = 0) const - _GLIBCXX_NOEXCEPT - { return _Base::find(__str, __pos); } - - size_type - find(const _CharT* __s, size_type __pos, size_type __n) const - { - __glibcxx_check_string(__s); - return _Base::find(__s, __pos, __n); - } - - size_type - find(const _CharT* __s, size_type __pos = 0) const - { - __glibcxx_check_string(__s); - return _Base::find(__s, __pos); - } - - size_type - find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT - { return _Base::find(__c, __pos); } - - size_type - rfind(const basic_string& __str, size_type __pos = _Base::npos) const - _GLIBCXX_NOEXCEPT - { return _Base::rfind(__str, __pos); } - - size_type - rfind(const _CharT* __s, size_type __pos, size_type __n) const - { - __glibcxx_check_string_len(__s, __n); - return _Base::rfind(__s, __pos, __n); - } - - size_type - rfind(const _CharT* __s, size_type __pos = _Base::npos) const - { - __glibcxx_check_string(__s); - return _Base::rfind(__s, __pos); - } - - size_type - rfind(_CharT __c, size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT - { return _Base::rfind(__c, __pos); } - - size_type - find_first_of(const basic_string& __str, size_type __pos = 0) const - _GLIBCXX_NOEXCEPT - { return _Base::find_first_of(__str, __pos); } - - size_type - find_first_of(const _CharT* __s, size_type __pos, size_type __n) const - { - __glibcxx_check_string(__s); - return _Base::find_first_of(__s, __pos, __n); - } - - size_type - find_first_of(const _CharT* __s, size_type __pos = 0) const - { - __glibcxx_check_string(__s); - return _Base::find_first_of(__s, __pos); - } - - size_type - find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT - { return _Base::find_first_of(__c, __pos); } - - size_type - find_last_of(const basic_string& __str, - size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT - { return _Base::find_last_of(__str, __pos); } - - size_type - find_last_of(const _CharT* __s, size_type __pos, size_type __n) const - { - __glibcxx_check_string(__s); - return _Base::find_last_of(__s, __pos, __n); - } - - size_type - find_last_of(const _CharT* __s, size_type __pos = _Base::npos) const - { - __glibcxx_check_string(__s); - return _Base::find_last_of(__s, __pos); - } - - size_type - find_last_of(_CharT __c, size_type __pos = _Base::npos) const - _GLIBCXX_NOEXCEPT - { return _Base::find_last_of(__c, __pos); } - - size_type - find_first_not_of(const basic_string& __str, size_type __pos = 0) const - _GLIBCXX_NOEXCEPT - { return _Base::find_first_not_of(__str, __pos); } - - size_type - find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const - { - __glibcxx_check_string_len(__s, __n); - return _Base::find_first_not_of(__s, __pos, __n); - } - - size_type - find_first_not_of(const _CharT* __s, size_type __pos = 0) const - { - __glibcxx_check_string(__s); - return _Base::find_first_not_of(__s, __pos); - } - - size_type - find_first_not_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT - { return _Base::find_first_not_of(__c, __pos); } - - size_type - find_last_not_of(const basic_string& __str, - size_type __pos = _Base::npos) const - _GLIBCXX_NOEXCEPT - { return _Base::find_last_not_of(__str, __pos); } - - size_type - find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const - { - __glibcxx_check_string(__s); - return _Base::find_last_not_of(__s, __pos, __n); - } - - size_type - find_last_not_of(const _CharT* __s, size_type __pos = _Base::npos) const - { - __glibcxx_check_string(__s); - return _Base::find_last_not_of(__s, __pos); - } - - size_type - find_last_not_of(_CharT __c, size_type __pos = _Base::npos) const - _GLIBCXX_NOEXCEPT - { return _Base::find_last_not_of(__c, __pos); } - - basic_string - substr(size_type __pos = 0, size_type __n = _Base::npos) const - { return basic_string(_Base::substr(__pos, __n)); } - - int - compare(const basic_string& __str) const - { return _Base::compare(__str); } - - int - compare(size_type __pos1, size_type __n1, - const basic_string& __str) const - { return _Base::compare(__pos1, __n1, __str); } - - int - compare(size_type __pos1, size_type __n1, const basic_string& __str, - size_type __pos2, size_type __n2) const - { return _Base::compare(__pos1, __n1, __str, __pos2, __n2); } - - int - compare(const _CharT* __s) const - { - __glibcxx_check_string(__s); - return _Base::compare(__s); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 5. string::compare specification questionable - int - compare(size_type __pos1, size_type __n1, const _CharT* __s) const - { - __glibcxx_check_string(__s); - return _Base::compare(__pos1, __n1, __s); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 5. string::compare specification questionable - int - compare(size_type __pos1, size_type __n1,const _CharT* __s, - size_type __n2) const - { - __glibcxx_check_string_len(__s, __n2); - return _Base::compare(__pos1, __n1, __s, __n2); - } - - _Base& - _M_base() _GLIBCXX_NOEXCEPT { return *this; } - - const _Base& - _M_base() const _GLIBCXX_NOEXCEPT { return *this; } - - using _Safe::_M_invalidate_all; - }; - - template - inline basic_string<_CharT,_Traits,_Allocator> - operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; } - - template - inline basic_string<_CharT,_Traits,_Allocator> - operator+(const _CharT* __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { - __glibcxx_check_string(__lhs); - return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; - } - - template - inline basic_string<_CharT,_Traits,_Allocator> - operator+(_CharT __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { return basic_string<_CharT,_Traits,_Allocator>(1, __lhs) += __rhs; } - - template - inline basic_string<_CharT,_Traits,_Allocator> - operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const _CharT* __rhs) - { - __glibcxx_check_string(__rhs); - return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; - } - - template - inline basic_string<_CharT,_Traits,_Allocator> - operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - _CharT __rhs) - { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; } - - template - inline bool - operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { return __lhs._M_base() == __rhs._M_base(); } - - template - inline bool - operator==(const _CharT* __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { - __glibcxx_check_string(__lhs); - return __lhs == __rhs._M_base(); - } - - template - inline bool - operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const _CharT* __rhs) - { - __glibcxx_check_string(__rhs); - return __lhs._M_base() == __rhs; - } - - template - inline bool - operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { return __lhs._M_base() != __rhs._M_base(); } - - template - inline bool - operator!=(const _CharT* __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { - __glibcxx_check_string(__lhs); - return __lhs != __rhs._M_base(); - } - - template - inline bool - operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const _CharT* __rhs) - { - __glibcxx_check_string(__rhs); - return __lhs._M_base() != __rhs; - } - - template - inline bool - operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { return __lhs._M_base() < __rhs._M_base(); } - - template - inline bool - operator<(const _CharT* __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { - __glibcxx_check_string(__lhs); - return __lhs < __rhs._M_base(); - } - - template - inline bool - operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const _CharT* __rhs) - { - __glibcxx_check_string(__rhs); - return __lhs._M_base() < __rhs; - } - - template - inline bool - operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { return __lhs._M_base() <= __rhs._M_base(); } - - template - inline bool - operator<=(const _CharT* __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { - __glibcxx_check_string(__lhs); - return __lhs <= __rhs._M_base(); - } - - template - inline bool - operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const _CharT* __rhs) - { - __glibcxx_check_string(__rhs); - return __lhs._M_base() <= __rhs; - } - - template - inline bool - operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { return __lhs._M_base() >= __rhs._M_base(); } - - template - inline bool - operator>=(const _CharT* __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { - __glibcxx_check_string(__lhs); - return __lhs >= __rhs._M_base(); - } - - template - inline bool - operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const _CharT* __rhs) - { - __glibcxx_check_string(__rhs); - return __lhs._M_base() >= __rhs; - } - - template - inline bool - operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { return __lhs._M_base() > __rhs._M_base(); } - - template - inline bool - operator>(const _CharT* __lhs, - const basic_string<_CharT,_Traits,_Allocator>& __rhs) - { - __glibcxx_check_string(__lhs); - return __lhs > __rhs._M_base(); - } - - template - inline bool - operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs, - const _CharT* __rhs) - { - __glibcxx_check_string(__rhs); - return __lhs._M_base() > __rhs; - } - - // 21.3.7.8: - template - inline void - swap(basic_string<_CharT,_Traits,_Allocator>& __lhs, - basic_string<_CharT,_Traits,_Allocator>& __rhs) - { __lhs.swap(__rhs); } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const basic_string<_CharT, _Traits, _Allocator>& __str) - { return __os << __str._M_base(); } - - template - std::basic_istream<_CharT,_Traits>& - operator>>(std::basic_istream<_CharT,_Traits>& __is, - basic_string<_CharT,_Traits,_Allocator>& __str) - { - std::basic_istream<_CharT,_Traits>& __res = __is >> __str._M_base(); - __str._M_invalidate_all(); - return __res; - } - - template - std::basic_istream<_CharT,_Traits>& - getline(std::basic_istream<_CharT,_Traits>& __is, - basic_string<_CharT,_Traits,_Allocator>& __str, _CharT __delim) - { - std::basic_istream<_CharT,_Traits>& __res = getline(__is, - __str._M_base(), - __delim); - __str._M_invalidate_all(); - return __res; - } - - template - std::basic_istream<_CharT,_Traits>& - getline(std::basic_istream<_CharT,_Traits>& __is, - basic_string<_CharT,_Traits,_Allocator>& __str) - { - std::basic_istream<_CharT,_Traits>& __res = getline(__is, - __str._M_base()); - __str._M_invalidate_all(); - return __res; - } - - typedef basic_string string; - -#ifdef _GLIBCXX_USE_WCHAR_T - typedef basic_string wstring; -#endif - - template - struct _Insert_range_from_self_is_safe< - __gnu_debug::basic_string<_CharT, _Traits, _Allocator> > - { enum { __value = 1 }; }; - -} // namespace __gnu_debug - -#endif diff --git a/openflow/usr/include/c++/5/debug/unordered_map b/openflow/usr/include/c++/5/debug/unordered_map deleted file mode 100644 index 3f46641..0000000 --- a/openflow/usr/include/c++/5/debug/unordered_map +++ /dev/null @@ -1,950 +0,0 @@ -// Debugging unordered_map/unordered_multimap implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/unordered_map - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_UNORDERED_MAP -#define _GLIBCXX_DEBUG_UNORDERED_MAP 1 - -#if __cplusplus < 201103L -# include -#else -# include - -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __debug -{ - /// Class std::unordered_map with safety/checking/debug instrumentation. - template, - typename _Pred = std::equal_to<_Key>, - typename _Alloc = std::allocator > > - class unordered_map - : public __gnu_debug::_Safe_container< - unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>, _Alloc, - __gnu_debug::_Safe_unordered_container>, - public _GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> - { - typedef _GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash, - _Pred, _Alloc> _Base; - typedef __gnu_debug::_Safe_container _Safe; - typedef typename _Base::const_iterator _Base_const_iterator; - typedef typename _Base::iterator _Base_iterator; - typedef typename _Base::const_local_iterator - _Base_const_local_iterator; - typedef typename _Base::local_iterator _Base_local_iterator; - - public: - typedef typename _Base::size_type size_type; - typedef typename _Base::hasher hasher; - typedef typename _Base::key_equal key_equal; - typedef typename _Base::allocator_type allocator_type; - - typedef typename _Base::key_type key_type; - typedef typename _Base::value_type value_type; - - typedef __gnu_debug::_Safe_iterator< - _Base_iterator, unordered_map> iterator; - typedef __gnu_debug::_Safe_iterator< - _Base_const_iterator, unordered_map> const_iterator; - typedef __gnu_debug::_Safe_local_iterator< - _Base_local_iterator, unordered_map> local_iterator; - typedef __gnu_debug::_Safe_local_iterator< - _Base_const_local_iterator, unordered_map> const_local_iterator; - - unordered_map() = default; - - explicit - unordered_map(size_type __n, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Base(__n, __hf, __eql, __a) { } - - template - unordered_map(_InputIterator __first, _InputIterator __last, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), __n, - __hf, __eql, __a) { } - - unordered_map(const unordered_map&) = default; - - unordered_map(const _Base& __x) - : _Base(__x) { } - - unordered_map(unordered_map&&) = default; - - explicit - unordered_map(const allocator_type& __a) - : _Base(__a) { } - - unordered_map(const unordered_map& __umap, - const allocator_type& __a) - : _Base(__umap, __a) { } - - unordered_map(unordered_map&& __umap, - const allocator_type& __a) - : _Safe(std::move(__umap._M_safe()), __a), - _Base(std::move(__umap._M_base()), __a) { } - - unordered_map(initializer_list __l, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Base(__l, __n, __hf, __eql, __a) { } - - unordered_map(size_type __n, const allocator_type& __a) - : unordered_map(__n, hasher(), key_equal(), __a) - { } - - unordered_map(size_type __n, - const hasher& __hf, - const allocator_type& __a) - : unordered_map(__n, __hf, key_equal(), __a) - { } - - template - unordered_map(_InputIterator __first, _InputIterator __last, - size_type __n, - const allocator_type& __a) - : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) - { } - - template - unordered_map(_InputIterator __first, _InputIterator __last, - size_type __n, - const hasher& __hf, - const allocator_type& __a) - : unordered_map(__first, __last, __n, __hf, key_equal(), __a) - { } - - unordered_map(initializer_list __l, - size_type __n, - const allocator_type& __a) - : unordered_map(__l, __n, hasher(), key_equal(), __a) - { } - - unordered_map(initializer_list __l, - size_type __n, - const hasher& __hf, - const allocator_type& __a) - : unordered_map(__l, __n, __hf, key_equal(), __a) - { } - - ~unordered_map() = default; - - unordered_map& - operator=(const unordered_map&) = default; - - unordered_map& - operator=(unordered_map&&) = default; - - unordered_map& - operator=(initializer_list __l) - { - _M_base() = __l; - this->_M_invalidate_all(); - return *this; - } - - void - swap(unordered_map& __x) - noexcept( noexcept(declval<_Base>().swap(__x)) ) - { - _Safe::_M_swap(__x); - _Base::swap(__x); - } - - void - clear() noexcept - { - _Base::clear(); - this->_M_invalidate_all(); - } - - iterator - begin() noexcept - { return iterator(_Base::begin(), this); } - - const_iterator - begin() const noexcept - { return const_iterator(_Base::begin(), this); } - - iterator - end() noexcept - { return iterator(_Base::end(), this); } - - const_iterator - end() const noexcept - { return const_iterator(_Base::end(), this); } - - const_iterator - cbegin() const noexcept - { return const_iterator(_Base::begin(), this); } - - const_iterator - cend() const noexcept - { return const_iterator(_Base::end(), this); } - - // local versions - local_iterator - begin(size_type __b) - { - __glibcxx_check_bucket_index(__b); - return local_iterator(_Base::begin(__b), this); - } - - local_iterator - end(size_type __b) - { - __glibcxx_check_bucket_index(__b); - return local_iterator(_Base::end(__b), this); - } - - const_local_iterator - begin(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::begin(__b), this); - } - - const_local_iterator - end(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::end(__b), this); - } - - const_local_iterator - cbegin(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::cbegin(__b), this); - } - - const_local_iterator - cend(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::cend(__b), this); - } - - size_type - bucket_size(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return _Base::bucket_size(__b); - } - - float - max_load_factor() const noexcept - { return _Base::max_load_factor(); } - - void - max_load_factor(float __f) - { - __glibcxx_check_max_load_factor(__f); - _Base::max_load_factor(__f); - } - - template - std::pair - emplace(_Args&&... __args) - { - size_type __bucket_count = this->bucket_count(); - std::pair<_Base_iterator, bool> __res - = _Base::emplace(std::forward<_Args>(__args)...); - _M_check_rehashed(__bucket_count); - return std::make_pair(iterator(__res.first, this), __res.second); - } - - template - iterator - emplace_hint(const_iterator __hint, _Args&&... __args) - { - __glibcxx_check_insert(__hint); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::emplace_hint(__hint.base(), - std::forward<_Args>(__args)...); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - std::pair - insert(const value_type& __obj) - { - size_type __bucket_count = this->bucket_count(); - std::pair<_Base_iterator, bool> __res = _Base::insert(__obj); - _M_check_rehashed(__bucket_count); - return std::make_pair(iterator(__res.first, this), __res.second); - } - - iterator - insert(const_iterator __hint, const value_type& __obj) - { - __glibcxx_check_insert(__hint); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::insert(__hint.base(), __obj); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - template::value>::type> - std::pair - insert(_Pair&& __obj) - { - size_type __bucket_count = this->bucket_count(); - std::pair<_Base_iterator, bool> __res = - _Base::insert(std::forward<_Pair>(__obj)); - _M_check_rehashed(__bucket_count); - return std::make_pair(iterator(__res.first, this), __res.second); - } - - template::value>::type> - iterator - insert(const_iterator __hint, _Pair&& __obj) - { - __glibcxx_check_insert(__hint); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = - _Base::insert(__hint.base(), std::forward<_Pair>(__obj)); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - void - insert(std::initializer_list __l) - { - size_type __bucket_count = this->bucket_count(); - _Base::insert(__l); - _M_check_rehashed(__bucket_count); - } - - template - void - insert(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - size_type __bucket_count = this->bucket_count(); - _Base::insert(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - _M_check_rehashed(__bucket_count); - } - - iterator - find(const key_type& __key) - { return iterator(_Base::find(__key), this); } - - const_iterator - find(const key_type& __key) const - { return const_iterator(_Base::find(__key), this); } - - std::pair - equal_range(const key_type& __key) - { - std::pair<_Base_iterator, _Base_iterator> __res = - _Base::equal_range(__key); - return std::make_pair(iterator(__res.first, this), - iterator(__res.second, this)); - } - - std::pair - equal_range(const key_type& __key) const - { - std::pair<_Base_const_iterator, _Base_const_iterator> __res = - _Base::equal_range(__key); - return std::make_pair(const_iterator(__res.first, this), - const_iterator(__res.second, this)); - } - - size_type - erase(const key_type& __key) - { - size_type __ret(0); - _Base_iterator __victim(_Base::find(__key)); - if (__victim != _Base::end()) - { - this->_M_invalidate_if([__victim](_Base_const_iterator __it) - { return __it == __victim; }); - this->_M_invalidate_local_if( - [__victim](_Base_const_local_iterator __it) - { return __it._M_curr() == __victim._M_cur; }); - size_type __bucket_count = this->bucket_count(); - _Base::erase(__victim); - _M_check_rehashed(__bucket_count); - __ret = 1; - } - return __ret; - } - - iterator - erase(const_iterator __it) - { - __glibcxx_check_erase(__it); - _Base_const_iterator __victim = __it.base(); - this->_M_invalidate_if([__victim](_Base_const_iterator __it) - { return __it == __victim; }); - this->_M_invalidate_local_if( - [__victim](_Base_const_local_iterator __it) - { return __it._M_curr() == __victim._M_cur; }); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __next = _Base::erase(__it.base()); - _M_check_rehashed(__bucket_count); - return iterator(__next, this); - } - - iterator - erase(iterator __it) - { return erase(const_iterator(__it)); } - - iterator - erase(const_iterator __first, const_iterator __last) - { - __glibcxx_check_erase_range(__first, __last); - for (_Base_const_iterator __tmp = __first.base(); - __tmp != __last.base(); ++__tmp) - { - _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - this->_M_invalidate_if([__tmp](_Base_const_iterator __it) - { return __it == __tmp; }); - this->_M_invalidate_local_if( - [__tmp](_Base_const_local_iterator __it) - { return __it._M_curr() == __tmp._M_cur; }); - } - size_type __bucket_count = this->bucket_count(); - _Base_iterator __next = _Base::erase(__first.base(), __last.base()); - _M_check_rehashed(__bucket_count); - return iterator(__next, this); - } - - _Base& - _M_base() noexcept { return *this; } - - const _Base& - _M_base() const noexcept { return *this; } - - private: - void - _M_check_rehashed(size_type __prev_count) - { - if (__prev_count != this->bucket_count()) - this->_M_invalidate_locals(); - } - }; - - template - inline void - swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { __x.swap(__y); } - - template - inline bool - operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { return __x._M_base() == __y._M_base(); } - - template - inline bool - operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { return !(__x == __y); } - - - /// Class std::unordered_multimap with safety/checking/debug instrumentation. - template, - typename _Pred = std::equal_to<_Key>, - typename _Alloc = std::allocator > > - class unordered_multimap - : public __gnu_debug::_Safe_container< - unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>, _Alloc, - __gnu_debug::_Safe_unordered_container>, - public _GLIBCXX_STD_C::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc> - { - typedef _GLIBCXX_STD_C::unordered_multimap<_Key, _Tp, _Hash, - _Pred, _Alloc> _Base; - typedef __gnu_debug::_Safe_container _Safe; - typedef typename _Base::const_iterator _Base_const_iterator; - typedef typename _Base::iterator _Base_iterator; - typedef typename _Base::const_local_iterator _Base_const_local_iterator; - typedef typename _Base::local_iterator _Base_local_iterator; - - public: - typedef typename _Base::size_type size_type; - typedef typename _Base::hasher hasher; - typedef typename _Base::key_equal key_equal; - typedef typename _Base::allocator_type allocator_type; - - typedef typename _Base::key_type key_type; - typedef typename _Base::value_type value_type; - - typedef __gnu_debug::_Safe_iterator< - _Base_iterator, unordered_multimap> iterator; - typedef __gnu_debug::_Safe_iterator< - _Base_const_iterator, unordered_multimap> const_iterator; - typedef __gnu_debug::_Safe_local_iterator< - _Base_local_iterator, unordered_multimap> local_iterator; - typedef __gnu_debug::_Safe_local_iterator< - _Base_const_local_iterator, unordered_multimap> const_local_iterator; - - unordered_multimap() = default; - - explicit - unordered_multimap(size_type __n, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Base(__n, __hf, __eql, __a) { } - - template - unordered_multimap(_InputIterator __first, _InputIterator __last, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), __n, - __hf, __eql, __a) { } - - unordered_multimap(const unordered_multimap&) = default; - - unordered_multimap(const _Base& __x) - : _Base(__x) { } - - unordered_multimap(unordered_multimap&&) = default; - - explicit - unordered_multimap(const allocator_type& __a) - : _Base(__a) { } - - unordered_multimap(const unordered_multimap& __umap, - const allocator_type& __a) - : _Base(__umap, __a) { } - - unordered_multimap(unordered_multimap&& __umap, - const allocator_type& __a) - : _Safe(std::move(__umap._M_safe()), __a), - _Base(std::move(__umap._M_base()), __a) { } - - unordered_multimap(initializer_list __l, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Base(__l, __n, __hf, __eql, __a) { } - - unordered_multimap(size_type __n, const allocator_type& __a) - : unordered_multimap(__n, hasher(), key_equal(), __a) - { } - - unordered_multimap(size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multimap(__n, __hf, key_equal(), __a) - { } - - template - unordered_multimap(_InputIterator __first, _InputIterator __last, - size_type __n, - const allocator_type& __a) - : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) - { } - - template - unordered_multimap(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) - { } - - unordered_multimap(initializer_list __l, - size_type __n, - const allocator_type& __a) - : unordered_multimap(__l, __n, hasher(), key_equal(), __a) - { } - - unordered_multimap(initializer_list __l, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multimap(__l, __n, __hf, key_equal(), __a) - { } - - ~unordered_multimap() = default; - - unordered_multimap& - operator=(const unordered_multimap&) = default; - - unordered_multimap& - operator=(unordered_multimap&&) = default; - - unordered_multimap& - operator=(initializer_list __l) - { - this->_M_base() = __l; - this->_M_invalidate_all(); - return *this; - } - - void - swap(unordered_multimap& __x) - noexcept( noexcept(declval<_Base>().swap(__x)) ) - { - _Safe::_M_swap(__x); - _Base::swap(__x); - } - - void - clear() noexcept - { - _Base::clear(); - this->_M_invalidate_all(); - } - - iterator - begin() noexcept - { return iterator(_Base::begin(), this); } - - const_iterator - begin() const noexcept - { return const_iterator(_Base::begin(), this); } - - iterator - end() noexcept - { return iterator(_Base::end(), this); } - - const_iterator - end() const noexcept - { return const_iterator(_Base::end(), this); } - - const_iterator - cbegin() const noexcept - { return const_iterator(_Base::begin(), this); } - - const_iterator - cend() const noexcept - { return const_iterator(_Base::end(), this); } - - // local versions - local_iterator - begin(size_type __b) - { - __glibcxx_check_bucket_index(__b); - return local_iterator(_Base::begin(__b), this); - } - - local_iterator - end(size_type __b) - { - __glibcxx_check_bucket_index(__b); - return local_iterator(_Base::end(__b), this); - } - - const_local_iterator - begin(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::begin(__b), this); - } - - const_local_iterator - end(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::end(__b), this); - } - - const_local_iterator - cbegin(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::cbegin(__b), this); - } - - const_local_iterator - cend(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::cend(__b), this); - } - - size_type - bucket_size(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return _Base::bucket_size(__b); - } - - float - max_load_factor() const noexcept - { return _Base::max_load_factor(); } - - void - max_load_factor(float __f) - { - __glibcxx_check_max_load_factor(__f); - _Base::max_load_factor(__f); - } - - template - iterator - emplace(_Args&&... __args) - { - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it - = _Base::emplace(std::forward<_Args>(__args)...); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - template - iterator - emplace_hint(const_iterator __hint, _Args&&... __args) - { - __glibcxx_check_insert(__hint); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::emplace_hint(__hint.base(), - std::forward<_Args>(__args)...); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - iterator - insert(const value_type& __obj) - { - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::insert(__obj); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - iterator - insert(const_iterator __hint, const value_type& __obj) - { - __glibcxx_check_insert(__hint); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::insert(__hint.base(), __obj); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - template::value>::type> - iterator - insert(_Pair&& __obj) - { - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::insert(std::forward<_Pair>(__obj)); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - template::value>::type> - iterator - insert(const_iterator __hint, _Pair&& __obj) - { - __glibcxx_check_insert(__hint); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = - _Base::insert(__hint.base(), std::forward<_Pair>(__obj)); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - void - insert(std::initializer_list __l) - { _Base::insert(__l); } - - template - void - insert(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - size_type __bucket_count = this->bucket_count(); - _Base::insert(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - _M_check_rehashed(__bucket_count); - } - - iterator - find(const key_type& __key) - { return iterator(_Base::find(__key), this); } - - const_iterator - find(const key_type& __key) const - { return const_iterator(_Base::find(__key), this); } - - std::pair - equal_range(const key_type& __key) - { - std::pair<_Base_iterator, _Base_iterator> __res = - _Base::equal_range(__key); - return std::make_pair(iterator(__res.first, this), - iterator(__res.second, this)); - } - - std::pair - equal_range(const key_type& __key) const - { - std::pair<_Base_const_iterator, _Base_const_iterator> __res = - _Base::equal_range(__key); - return std::make_pair(const_iterator(__res.first, this), - const_iterator(__res.second, this)); - } - - size_type - erase(const key_type& __key) - { - size_type __ret(0); - size_type __bucket_count = this->bucket_count(); - std::pair<_Base_iterator, _Base_iterator> __pair = - _Base::equal_range(__key); - for (_Base_iterator __victim = __pair.first; __victim != __pair.second;) - { - this->_M_invalidate_if([__victim](_Base_const_iterator __it) - { return __it == __victim; }); - this->_M_invalidate_local_if( - [__victim](_Base_const_local_iterator __it) - { return __it._M_curr() == __victim._M_cur; }); - _Base::erase(__victim++); - ++__ret; - } - _M_check_rehashed(__bucket_count); - return __ret; - } - - iterator - erase(const_iterator __it) - { - __glibcxx_check_erase(__it); - _Base_const_iterator __victim = __it.base(); - this->_M_invalidate_if([__victim](_Base_const_iterator __it) - { return __it == __victim; }); - this->_M_invalidate_local_if( - [__victim](_Base_const_local_iterator __it) - { return __it._M_curr() == __victim._M_cur; }); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __next = _Base::erase(__it.base()); - _M_check_rehashed(__bucket_count); - return iterator(__next, this); - } - - iterator - erase(iterator __it) - { return erase(const_iterator(__it)); } - - iterator - erase(const_iterator __first, const_iterator __last) - { - __glibcxx_check_erase_range(__first, __last); - for (_Base_const_iterator __tmp = __first.base(); - __tmp != __last.base(); ++__tmp) - { - _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - this->_M_invalidate_if([__tmp](_Base_const_iterator __it) - { return __it == __tmp; }); - this->_M_invalidate_local_if( - [__tmp](_Base_const_local_iterator __it) - { return __it._M_curr() == __tmp._M_cur; }); - } - size_type __bucket_count = this->bucket_count(); - _Base_iterator __next = _Base::erase(__first.base(), __last.base()); - _M_check_rehashed(__bucket_count); - return iterator(__next, this); - } - - _Base& - _M_base() noexcept { return *this; } - - const _Base& - _M_base() const noexcept { return *this; } - - private: - void - _M_check_rehashed(size_type __prev_count) - { - if (__prev_count != this->bucket_count()) - this->_M_invalidate_locals(); - } - }; - - template - inline void - swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { __x.swap(__y); } - - template - inline bool - operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { return __x._M_base() == __y._M_base(); } - - template - inline bool - operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { return !(__x == __y); } - -} // namespace __debug -} // namespace std - -#endif // C++11 - -#endif diff --git a/openflow/usr/include/c++/5/debug/unordered_set b/openflow/usr/include/c++/5/debug/unordered_set deleted file mode 100644 index 10a9c27..0000000 --- a/openflow/usr/include/c++/5/debug/unordered_set +++ /dev/null @@ -1,930 +0,0 @@ -// Debugging unordered_set/unordered_multiset implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/unordered_set - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_UNORDERED_SET -#define _GLIBCXX_DEBUG_UNORDERED_SET 1 - -#if __cplusplus < 201103L -# include -#else -# include - -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __debug -{ - /// Class std::unordered_set with safety/checking/debug instrumentation. - template, - typename _Pred = std::equal_to<_Value>, - typename _Alloc = std::allocator<_Value> > - class unordered_set - : public __gnu_debug::_Safe_container< - unordered_set<_Value, _Hash, _Pred, _Alloc>, _Alloc, - __gnu_debug::_Safe_unordered_container>, - public _GLIBCXX_STD_C::unordered_set<_Value, _Hash, _Pred, _Alloc> - { - typedef _GLIBCXX_STD_C::unordered_set< - _Value, _Hash, _Pred, _Alloc> _Base; - typedef __gnu_debug::_Safe_container< - unordered_set, _Alloc, __gnu_debug::_Safe_unordered_container> _Safe; - - typedef typename _Base::const_iterator _Base_const_iterator; - typedef typename _Base::iterator _Base_iterator; - typedef typename _Base::const_local_iterator _Base_const_local_iterator; - typedef typename _Base::local_iterator _Base_local_iterator; - - public: - typedef typename _Base::size_type size_type; - typedef typename _Base::hasher hasher; - typedef typename _Base::key_equal key_equal; - typedef typename _Base::allocator_type allocator_type; - - typedef typename _Base::key_type key_type; - typedef typename _Base::value_type value_type; - - typedef __gnu_debug::_Safe_iterator< - _Base_iterator, unordered_set> iterator; - typedef __gnu_debug::_Safe_iterator< - _Base_const_iterator, unordered_set> const_iterator; - typedef __gnu_debug::_Safe_local_iterator< - _Base_local_iterator, unordered_set> local_iterator; - typedef __gnu_debug::_Safe_local_iterator< - _Base_const_local_iterator, unordered_set> const_local_iterator; - - unordered_set() = default; - - explicit - unordered_set(size_type __n, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Base(__n, __hf, __eql, __a) { } - - template - unordered_set(_InputIterator __first, _InputIterator __last, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), __n, - __hf, __eql, __a) { } - - unordered_set(const unordered_set&) = default; - - unordered_set(const _Base& __x) - : _Base(__x) { } - - unordered_set(unordered_set&&) = default; - - explicit - unordered_set(const allocator_type& __a) - : _Base(__a) { } - - unordered_set(const unordered_set& __uset, - const allocator_type& __a) - : _Base(__uset, __a) { } - - unordered_set(unordered_set&& __uset, - const allocator_type& __a) - : _Safe(std::move(__uset._M_safe()), __a), - _Base(std::move(__uset._M_base()), __a) { } - - unordered_set(initializer_list __l, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Base(__l, __n, __hf, __eql, __a) { } - - unordered_set(size_type __n, const allocator_type& __a) - : unordered_set(__n, hasher(), key_equal(), __a) - { } - - unordered_set(size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_set(__n, __hf, key_equal(), __a) - { } - - template - unordered_set(_InputIterator __first, _InputIterator __last, - size_type __n, - const allocator_type& __a) - : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) - { } - - template - unordered_set(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_set(__first, __last, __n, __hf, key_equal(), __a) - { } - - unordered_set(initializer_list __l, - size_type __n, - const allocator_type& __a) - : unordered_set(__l, __n, hasher(), key_equal(), __a) - { } - - unordered_set(initializer_list __l, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_set(__l, __n, __hf, key_equal(), __a) - { } - - ~unordered_set() = default; - - unordered_set& - operator=(const unordered_set&) = default; - - unordered_set& - operator=(unordered_set&&) = default; - - unordered_set& - operator=(initializer_list __l) - { - _M_base() = __l; - this->_M_invalidate_all(); - return *this; - } - - void - swap(unordered_set& __x) - noexcept( noexcept(declval<_Base>().swap(__x)) ) - { - _Safe::_M_swap(__x); - _Base::swap(__x); - } - - void - clear() noexcept - { - _Base::clear(); - this->_M_invalidate_all(); - } - - iterator - begin() noexcept - { return iterator(_Base::begin(), this); } - - const_iterator - begin() const noexcept - { return const_iterator(_Base::begin(), this); } - - iterator - end() noexcept - { return iterator(_Base::end(), this); } - - const_iterator - end() const noexcept - { return const_iterator(_Base::end(), this); } - - const_iterator - cbegin() const noexcept - { return const_iterator(_Base::begin(), this); } - - const_iterator - cend() const noexcept - { return const_iterator(_Base::end(), this); } - - // local versions - local_iterator - begin(size_type __b) - { - __glibcxx_check_bucket_index(__b); - return local_iterator(_Base::begin(__b), this); - } - - local_iterator - end(size_type __b) - { - __glibcxx_check_bucket_index(__b); - return local_iterator(_Base::end(__b), this); - } - - const_local_iterator - begin(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::begin(__b), this); - } - - const_local_iterator - end(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::end(__b), this); - } - - const_local_iterator - cbegin(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::cbegin(__b), this); - } - - const_local_iterator - cend(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::cend(__b), this); - } - - size_type - bucket_size(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return _Base::bucket_size(__b); - } - - float - max_load_factor() const noexcept - { return _Base::max_load_factor(); } - - void - max_load_factor(float __f) - { - __glibcxx_check_max_load_factor(__f); - _Base::max_load_factor(__f); - } - - template - std::pair - emplace(_Args&&... __args) - { - size_type __bucket_count = this->bucket_count(); - std::pair<_Base_iterator, bool> __res - = _Base::emplace(std::forward<_Args>(__args)...); - _M_check_rehashed(__bucket_count); - return std::make_pair(iterator(__res.first, this), __res.second); - } - - template - iterator - emplace_hint(const_iterator __hint, _Args&&... __args) - { - __glibcxx_check_insert(__hint); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::emplace_hint(__hint.base(), - std::forward<_Args>(__args)...); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - std::pair - insert(const value_type& __obj) - { - size_type __bucket_count = this->bucket_count(); - std::pair<_Base_iterator, bool> __res - = _Base::insert(__obj); - _M_check_rehashed(__bucket_count); - return std::make_pair(iterator(__res.first, this), __res.second); - } - - iterator - insert(const_iterator __hint, const value_type& __obj) - { - __glibcxx_check_insert(__hint); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::insert(__hint.base(), __obj); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - std::pair - insert(value_type&& __obj) - { - size_type __bucket_count = this->bucket_count(); - std::pair<_Base_iterator, bool> __res - = _Base::insert(std::move(__obj)); - _M_check_rehashed(__bucket_count); - return std::make_pair(iterator(__res.first, this), __res.second); - } - - iterator - insert(const_iterator __hint, value_type&& __obj) - { - __glibcxx_check_insert(__hint); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::insert(__hint.base(), std::move(__obj)); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - void - insert(std::initializer_list __l) - { - size_type __bucket_count = this->bucket_count(); - _Base::insert(__l); - _M_check_rehashed(__bucket_count); - } - - template - void - insert(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - size_type __bucket_count = this->bucket_count(); - _Base::insert(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - _M_check_rehashed(__bucket_count); - } - - iterator - find(const key_type& __key) - { return iterator(_Base::find(__key), this); } - - const_iterator - find(const key_type& __key) const - { return const_iterator(_Base::find(__key), this); } - - std::pair - equal_range(const key_type& __key) - { - std::pair<_Base_iterator, _Base_iterator> __res - = _Base::equal_range(__key); - return std::make_pair(iterator(__res.first, this), - iterator(__res.second, this)); - } - - std::pair - equal_range(const key_type& __key) const - { - std::pair<_Base_const_iterator, _Base_const_iterator> - __res = _Base::equal_range(__key); - return std::make_pair(const_iterator(__res.first, this), - const_iterator(__res.second, this)); - } - - size_type - erase(const key_type& __key) - { - size_type __ret(0); - _Base_iterator __victim(_Base::find(__key)); - if (__victim != _Base::end()) - { - this->_M_invalidate_if( - [__victim](_Base_const_iterator __it) - { return __it == __victim; }); - this->_M_invalidate_local_if( - [__victim](_Base_const_local_iterator __it) - { return __it._M_curr() == __victim._M_cur; }); - size_type __bucket_count = this->bucket_count(); - _Base::erase(__victim); - _M_check_rehashed(__bucket_count); - __ret = 1; - } - return __ret; - } - - iterator - erase(const_iterator __it) - { - __glibcxx_check_erase(__it); - _Base_const_iterator __victim = __it.base(); - this->_M_invalidate_if( - [__victim](_Base_const_iterator __it) - { return __it == __victim; }); - this->_M_invalidate_local_if( - [__victim](_Base_const_local_iterator __it) - { return __it._M_curr() == __victim._M_cur; }); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __next = _Base::erase(__it.base()); - _M_check_rehashed(__bucket_count); - return iterator(__next, this); - } - - iterator - erase(iterator __it) - { return erase(const_iterator(__it)); } - - iterator - erase(const_iterator __first, const_iterator __last) - { - __glibcxx_check_erase_range(__first, __last); - for (_Base_const_iterator __tmp = __first.base(); - __tmp != __last.base(); ++__tmp) - { - _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - this->_M_invalidate_if( - [__tmp](_Base_const_iterator __it) - { return __it == __tmp; }); - this->_M_invalidate_local_if( - [__tmp](_Base_const_local_iterator __it) - { return __it._M_curr() == __tmp._M_cur; }); - } - size_type __bucket_count = this->bucket_count(); - _Base_iterator __next = _Base::erase(__first.base(), - __last.base()); - _M_check_rehashed(__bucket_count); - return iterator(__next, this); - } - - _Base& - _M_base() noexcept { return *this; } - - const _Base& - _M_base() const noexcept { return *this; } - - private: - void - _M_check_rehashed(size_type __prev_count) - { - if (__prev_count != this->bucket_count()) - this->_M_invalidate_locals(); - } - }; - - template - inline void - swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, - unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) - { __x.swap(__y); } - - template - inline bool - operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) - { return __x._M_base() == __y._M_base(); } - - template - inline bool - operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) - { return !(__x == __y); } - - - /// Class std::unordered_multiset with safety/checking/debug instrumentation. - template, - typename _Pred = std::equal_to<_Value>, - typename _Alloc = std::allocator<_Value> > - class unordered_multiset - : public __gnu_debug::_Safe_container< - unordered_multiset<_Value, _Hash, _Pred, _Alloc>, _Alloc, - __gnu_debug::_Safe_unordered_container>, - public _GLIBCXX_STD_C::unordered_multiset<_Value, _Hash, _Pred, _Alloc> - { - typedef _GLIBCXX_STD_C::unordered_multiset< - _Value, _Hash, _Pred, _Alloc> _Base; - typedef __gnu_debug::_Safe_container _Safe; - typedef typename _Base::const_iterator _Base_const_iterator; - typedef typename _Base::iterator _Base_iterator; - typedef typename _Base::const_local_iterator - _Base_const_local_iterator; - typedef typename _Base::local_iterator _Base_local_iterator; - - public: - typedef typename _Base::size_type size_type; - typedef typename _Base::hasher hasher; - typedef typename _Base::key_equal key_equal; - typedef typename _Base::allocator_type allocator_type; - - typedef typename _Base::key_type key_type; - typedef typename _Base::value_type value_type; - - typedef __gnu_debug::_Safe_iterator< - _Base_iterator, unordered_multiset> iterator; - typedef __gnu_debug::_Safe_iterator< - _Base_const_iterator, unordered_multiset> const_iterator; - typedef __gnu_debug::_Safe_local_iterator< - _Base_local_iterator, unordered_multiset> local_iterator; - typedef __gnu_debug::_Safe_local_iterator< - _Base_const_local_iterator, unordered_multiset> const_local_iterator; - - unordered_multiset() = default; - - explicit - unordered_multiset(size_type __n, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Base(__n, __hf, __eql, __a) { } - - template - unordered_multiset(_InputIterator __first, _InputIterator __last, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), __n, - __hf, __eql, __a) { } - - unordered_multiset(const unordered_multiset&) = default; - - unordered_multiset(const _Base& __x) - : _Base(__x) { } - - unordered_multiset(unordered_multiset&&) = default; - - explicit - unordered_multiset(const allocator_type& __a) - : _Base(__a) { } - - unordered_multiset(const unordered_multiset& __uset, - const allocator_type& __a) - : _Base(__uset, __a) { } - - unordered_multiset(unordered_multiset&& __uset, - const allocator_type& __a) - : _Safe(std::move(__uset._M_safe()), __a), - _Base(std::move(__uset._M_base()), __a) { } - - unordered_multiset(initializer_list __l, - size_type __n = 0, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _Base(__l, __n, __hf, __eql, __a) { } - - unordered_multiset(size_type __n, const allocator_type& __a) - : unordered_multiset(__n, hasher(), key_equal(), __a) - { } - - unordered_multiset(size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multiset(__n, __hf, key_equal(), __a) - { } - - template - unordered_multiset(_InputIterator __first, _InputIterator __last, - size_type __n, - const allocator_type& __a) - : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) - { } - - template - unordered_multiset(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) - { } - - unordered_multiset(initializer_list __l, - size_type __n, - const allocator_type& __a) - : unordered_multiset(__l, __n, hasher(), key_equal(), __a) - { } - - unordered_multiset(initializer_list __l, - size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multiset(__l, __n, __hf, key_equal(), __a) - { } - - ~unordered_multiset() = default; - - unordered_multiset& - operator=(const unordered_multiset&) = default; - - unordered_multiset& - operator=(unordered_multiset&&) = default; - - unordered_multiset& - operator=(initializer_list __l) - { - this->_M_base() = __l; - this->_M_invalidate_all(); - return *this; - } - - void - swap(unordered_multiset& __x) - noexcept( noexcept(declval<_Base>().swap(__x)) ) - { - _Safe::_M_swap(__x); - _Base::swap(__x); - } - - void - clear() noexcept - { - _Base::clear(); - this->_M_invalidate_all(); - } - - iterator - begin() noexcept - { return iterator(_Base::begin(), this); } - - const_iterator - begin() const noexcept - { return const_iterator(_Base::begin(), this); } - - iterator - end() noexcept - { return iterator(_Base::end(), this); } - - const_iterator - end() const noexcept - { return const_iterator(_Base::end(), this); } - - const_iterator - cbegin() const noexcept - { return const_iterator(_Base::begin(), this); } - - const_iterator - cend() const noexcept - { return const_iterator(_Base::end(), this); } - - // local versions - local_iterator - begin(size_type __b) - { - __glibcxx_check_bucket_index(__b); - return local_iterator(_Base::begin(__b), this); - } - - local_iterator - end(size_type __b) - { - __glibcxx_check_bucket_index(__b); - return local_iterator(_Base::end(__b), this); - } - - const_local_iterator - begin(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::begin(__b), this); - } - - const_local_iterator - end(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::end(__b), this); - } - - const_local_iterator - cbegin(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::cbegin(__b), this); - } - - const_local_iterator - cend(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return const_local_iterator(_Base::cend(__b), this); - } - - size_type - bucket_size(size_type __b) const - { - __glibcxx_check_bucket_index(__b); - return _Base::bucket_size(__b); - } - - float - max_load_factor() const noexcept - { return _Base::max_load_factor(); } - - void - max_load_factor(float __f) - { - __glibcxx_check_max_load_factor(__f); - _Base::max_load_factor(__f); - } - - template - iterator - emplace(_Args&&... __args) - { - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it - = _Base::emplace(std::forward<_Args>(__args)...); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - template - iterator - emplace_hint(const_iterator __hint, _Args&&... __args) - { - __glibcxx_check_insert(__hint); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::emplace_hint(__hint.base(), - std::forward<_Args>(__args)...); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - iterator - insert(const value_type& __obj) - { - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::insert(__obj); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - iterator - insert(const_iterator __hint, const value_type& __obj) - { - __glibcxx_check_insert(__hint); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::insert(__hint.base(), __obj); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - iterator - insert(value_type&& __obj) - { - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::insert(std::move(__obj)); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - iterator - insert(const_iterator __hint, value_type&& __obj) - { - __glibcxx_check_insert(__hint); - size_type __bucket_count = this->bucket_count(); - _Base_iterator __it = _Base::insert(__hint.base(), std::move(__obj)); - _M_check_rehashed(__bucket_count); - return iterator(__it, this); - } - - void - insert(std::initializer_list __l) - { - size_type __bucket_count = this->bucket_count(); - _Base::insert(__l); - _M_check_rehashed(__bucket_count); - } - - template - void - insert(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - size_type __bucket_count = this->bucket_count(); - _Base::insert(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - _M_check_rehashed(__bucket_count); - } - - iterator - find(const key_type& __key) - { return iterator(_Base::find(__key), this); } - - const_iterator - find(const key_type& __key) const - { return const_iterator(_Base::find(__key), this); } - - std::pair - equal_range(const key_type& __key) - { - std::pair<_Base_iterator, _Base_iterator> __res - = _Base::equal_range(__key); - return std::make_pair(iterator(__res.first, this), - iterator(__res.second, this)); - } - - std::pair - equal_range(const key_type& __key) const - { - std::pair<_Base_const_iterator, _Base_const_iterator> - __res = _Base::equal_range(__key); - return std::make_pair(const_iterator(__res.first, this), - const_iterator(__res.second, this)); - } - - size_type - erase(const key_type& __key) - { - size_type __ret(0); - std::pair<_Base_iterator, _Base_iterator> __pair = - _Base::equal_range(__key); - for (_Base_iterator __victim = __pair.first; __victim != __pair.second;) - { - this->_M_invalidate_if([__victim](_Base_const_iterator __it) - { return __it == __victim; }); - this->_M_invalidate_local_if( - [__victim](_Base_const_local_iterator __it) - { return __it._M_curr() == __victim._M_cur; }); - _Base::erase(__victim++); - ++__ret; - } - return __ret; - } - - iterator - erase(const_iterator __it) - { - __glibcxx_check_erase(__it); - _Base_const_iterator __victim = __it.base(); - this->_M_invalidate_if([__victim](_Base_const_iterator __it) - { return __it == __victim; }); - this->_M_invalidate_local_if( - [__victim](_Base_const_local_iterator __it) - { return __it._M_curr() == __victim._M_cur; }); - return iterator(_Base::erase(__it.base()), this); - } - - iterator - erase(iterator __it) - { return erase(const_iterator(__it)); } - - iterator - erase(const_iterator __first, const_iterator __last) - { - __glibcxx_check_erase_range(__first, __last); - for (_Base_const_iterator __tmp = __first.base(); - __tmp != __last.base(); ++__tmp) - { - _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(), - _M_message(__gnu_debug::__msg_valid_range) - ._M_iterator(__first, "first") - ._M_iterator(__last, "last")); - this->_M_invalidate_if([__tmp](_Base_const_iterator __it) - { return __it == __tmp; }); - this->_M_invalidate_local_if( - [__tmp](_Base_const_local_iterator __it) - { return __it._M_curr() == __tmp._M_cur; }); - } - return iterator(_Base::erase(__first.base(), - __last.base()), this); - } - - _Base& - _M_base() noexcept { return *this; } - - const _Base& - _M_base() const noexcept { return *this; } - - private: - void - _M_check_rehashed(size_type __prev_count) - { - if (__prev_count != this->bucket_count()) - this->_M_invalidate_locals(); - } - }; - - template - inline void - swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, - unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) - { __x.swap(__y); } - - template - inline bool - operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) - { return __x._M_base() == __y._M_base(); } - - template - inline bool - operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) - { return !(__x == __y); } - -} // namespace __debug -} // namespace std - -#endif // C++11 - -#endif diff --git a/openflow/usr/include/c++/5/debug/vector b/openflow/usr/include/c++/5/debug/vector deleted file mode 100644 index 085e5f7..0000000 --- a/openflow/usr/include/c++/5/debug/vector +++ /dev/null @@ -1,768 +0,0 @@ -// Debugging vector implementation -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file debug/vector - * This file is a GNU debug extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_DEBUG_VECTOR -#define _GLIBCXX_DEBUG_VECTOR 1 - -#include -#include -#include -#include -#include - -namespace __gnu_debug -{ - /** @brief Base class for Debug Mode vector. - * - * Adds information about the guaranteed capacity, which is useful for - * detecting code which relies on non-portable implementation details of - * the libstdc++ reallocation policy. - */ - template - class _Safe_vector - { - typedef typename _BaseSequence::size_type size_type; - - const _SafeSequence& - _M_seq() const { return *static_cast(this); } - - protected: - _Safe_vector() _GLIBCXX_NOEXCEPT - : _M_guaranteed_capacity(0) - { _M_update_guaranteed_capacity(); } - - _Safe_vector(const _Safe_vector&) _GLIBCXX_NOEXCEPT - : _M_guaranteed_capacity(0) - { _M_update_guaranteed_capacity(); } - - _Safe_vector(size_type __n) _GLIBCXX_NOEXCEPT - : _M_guaranteed_capacity(__n) - { } - -#if __cplusplus >= 201103L - _Safe_vector(_Safe_vector&& __x) noexcept - : _Safe_vector() - { __x._M_guaranteed_capacity = 0; } - - _Safe_vector& - operator=(const _Safe_vector&) noexcept - { - _M_update_guaranteed_capacity(); - return *this; - } - - _Safe_vector& - operator=(_Safe_vector&& __x) noexcept - { - _M_update_guaranteed_capacity(); - __x._M_guaranteed_capacity = 0; - return *this; - } -#endif - - size_type _M_guaranteed_capacity; - - bool - _M_requires_reallocation(size_type __elements) const _GLIBCXX_NOEXCEPT - { return __elements > _M_seq().capacity(); } - - void - _M_update_guaranteed_capacity() _GLIBCXX_NOEXCEPT - { - if (_M_seq().size() > _M_guaranteed_capacity) - _M_guaranteed_capacity = _M_seq().size(); - } - }; -} - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace __debug -{ - /// Class std::vector with safety/checking/debug instrumentation. - template > - class vector - : public __gnu_debug::_Safe_container< - vector<_Tp, _Allocator>, _Allocator, __gnu_debug::_Safe_sequence>, - public _GLIBCXX_STD_C::vector<_Tp, _Allocator>, - public __gnu_debug::_Safe_vector< - vector<_Tp, _Allocator>, - _GLIBCXX_STD_C::vector<_Tp, _Allocator> > - { - typedef _GLIBCXX_STD_C::vector<_Tp, _Allocator> _Base; - typedef __gnu_debug::_Safe_container< - vector, _Allocator, __gnu_debug::_Safe_sequence> _Safe; - typedef __gnu_debug::_Safe_vector _Safe_vector; - - typedef typename _Base::iterator _Base_iterator; - typedef typename _Base::const_iterator _Base_const_iterator; - typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; - - public: - typedef typename _Base::reference reference; - typedef typename _Base::const_reference const_reference; - - typedef __gnu_debug::_Safe_iterator< - _Base_iterator, vector> iterator; - typedef __gnu_debug::_Safe_iterator< - _Base_const_iterator, vector> const_iterator; - - typedef typename _Base::size_type size_type; - typedef typename _Base::difference_type difference_type; - - typedef _Tp value_type; - typedef _Allocator allocator_type; - typedef typename _Base::pointer pointer; - typedef typename _Base::const_pointer const_pointer; - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - // 23.2.4.1 construct/copy/destroy: - -#if __cplusplus < 201103L - vector() _GLIBCXX_NOEXCEPT - : _Base() { } -#else - vector() = default; -#endif - - explicit - vector(const _Allocator& __a) _GLIBCXX_NOEXCEPT - : _Base(__a) { } - -#if __cplusplus >= 201103L - explicit - vector(size_type __n, const _Allocator& __a = _Allocator()) - : _Base(__n, __a), _Safe_vector(__n) { } - - vector(size_type __n, const _Tp& __value, - const _Allocator& __a = _Allocator()) - : _Base(__n, __value, __a) { } -#else - explicit - vector(size_type __n, const _Tp& __value = _Tp(), - const _Allocator& __a = _Allocator()) - : _Base(__n, __value, __a) { } -#endif - -#if __cplusplus >= 201103L - template> -#else - template -#endif - vector(_InputIterator __first, _InputIterator __last, - const _Allocator& __a = _Allocator()) - : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, - __last)), - __gnu_debug::__base(__last), __a) { } - -#if __cplusplus < 201103L - vector(const vector& __x) - : _Base(__x) { } - - ~vector() _GLIBCXX_NOEXCEPT { } -#else - vector(const vector&) = default; - vector(vector&&) = default; - - vector(const vector& __x, const allocator_type& __a) - : _Base(__x, __a) { } - - vector(vector&& __x, const allocator_type& __a) - : _Safe(std::move(__x._M_safe()), __a), - _Base(std::move(__x._M_base()), __a), - _Safe_vector(std::move(__x)) { } - - vector(initializer_list __l, - const allocator_type& __a = allocator_type()) - : _Base(__l, __a) { } - - ~vector() = default; -#endif - - /// Construction from a normal-mode vector - vector(const _Base& __x) - : _Base(__x) { } - -#if __cplusplus < 201103L - vector& - operator=(const vector& __x) - { - this->_M_safe() = __x; - _M_base() = __x; - this->_M_update_guaranteed_capacity(); - return *this; - } -#else - vector& - operator=(const vector&) = default; - - vector& - operator=(vector&&) = default; - - vector& - operator=(initializer_list __l) - { - _M_base() = __l; - this->_M_invalidate_all(); - this->_M_update_guaranteed_capacity(); - return *this; - } -#endif - -#if __cplusplus >= 201103L - template> -#else - template -#endif - void - assign(_InputIterator __first, _InputIterator __last) - { - __glibcxx_check_valid_range(__first, __last); - _Base::assign(__gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - this->_M_invalidate_all(); - this->_M_update_guaranteed_capacity(); - } - - void - assign(size_type __n, const _Tp& __u) - { - _Base::assign(__n, __u); - this->_M_invalidate_all(); - this->_M_update_guaranteed_capacity(); - } - -#if __cplusplus >= 201103L - void - assign(initializer_list __l) - { - _Base::assign(__l); - this->_M_invalidate_all(); - this->_M_update_guaranteed_capacity(); - } -#endif - - using _Base::get_allocator; - - // iterators: - iterator - begin() _GLIBCXX_NOEXCEPT - { return iterator(_Base::begin(), this); } - - const_iterator - begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::begin(), this); } - - iterator - end() _GLIBCXX_NOEXCEPT - { return iterator(_Base::end(), this); } - - const_iterator - end() const _GLIBCXX_NOEXCEPT - { return const_iterator(_Base::end(), this); } - - reverse_iterator - rbegin() _GLIBCXX_NOEXCEPT - { return reverse_iterator(end()); } - - const_reverse_iterator - rbegin() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(end()); } - - reverse_iterator - rend() _GLIBCXX_NOEXCEPT - { return reverse_iterator(begin()); } - - const_reverse_iterator - rend() const _GLIBCXX_NOEXCEPT - { return const_reverse_iterator(begin()); } - -#if __cplusplus >= 201103L - const_iterator - cbegin() const noexcept - { return const_iterator(_Base::begin(), this); } - - const_iterator - cend() const noexcept - { return const_iterator(_Base::end(), this); } - - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(end()); } - - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(begin()); } -#endif - - // 23.2.4.2 capacity: - using _Base::size; - using _Base::max_size; - -#if __cplusplus >= 201103L - void - resize(size_type __sz) - { - bool __realloc = this->_M_requires_reallocation(__sz); - if (__sz < this->size()) - this->_M_invalidate_after_nth(__sz); - _Base::resize(__sz); - if (__realloc) - this->_M_invalidate_all(); - this->_M_update_guaranteed_capacity(); - } - - void - resize(size_type __sz, const _Tp& __c) - { - bool __realloc = this->_M_requires_reallocation(__sz); - if (__sz < this->size()) - this->_M_invalidate_after_nth(__sz); - _Base::resize(__sz, __c); - if (__realloc) - this->_M_invalidate_all(); - this->_M_update_guaranteed_capacity(); - } -#else - void - resize(size_type __sz, _Tp __c = _Tp()) - { - bool __realloc = this->_M_requires_reallocation(__sz); - if (__sz < this->size()) - this->_M_invalidate_after_nth(__sz); - _Base::resize(__sz, __c); - if (__realloc) - this->_M_invalidate_all(); - this->_M_update_guaranteed_capacity(); - } -#endif - -#if __cplusplus >= 201103L - void - shrink_to_fit() - { - if (_Base::_M_shrink_to_fit()) - { - this->_M_guaranteed_capacity = _Base::capacity(); - this->_M_invalidate_all(); - } - } -#endif - - size_type - capacity() const _GLIBCXX_NOEXCEPT - { -#ifdef _GLIBCXX_DEBUG_PEDANTIC - return this->_M_guaranteed_capacity; -#else - return _Base::capacity(); -#endif - } - - using _Base::empty; - - void - reserve(size_type __n) - { - bool __realloc = this->_M_requires_reallocation(__n); - _Base::reserve(__n); - if (__n > this->_M_guaranteed_capacity) - this->_M_guaranteed_capacity = __n; - if (__realloc) - this->_M_invalidate_all(); - } - - // element access: - reference - operator[](size_type __n) _GLIBCXX_NOEXCEPT - { - __glibcxx_check_subscript(__n); - return _M_base()[__n]; - } - - const_reference - operator[](size_type __n) const _GLIBCXX_NOEXCEPT - { - __glibcxx_check_subscript(__n); - return _M_base()[__n]; - } - - using _Base::at; - - reference - front() _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - return _Base::front(); - } - - const_reference - front() const _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - return _Base::front(); - } - - reference - back() _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - return _Base::back(); - } - - const_reference - back() const _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - return _Base::back(); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 464. Suggestion for new member functions in standard containers. - using _Base::data; - - // 23.2.4.3 modifiers: - void - push_back(const _Tp& __x) - { - bool __realloc = this->_M_requires_reallocation(this->size() + 1); - _Base::push_back(__x); - if (__realloc) - this->_M_invalidate_all(); - this->_M_update_guaranteed_capacity(); - } - -#if __cplusplus >= 201103L - template - typename __gnu_cxx::__enable_if::__value, - void>::__type - push_back(_Tp&& __x) - { emplace_back(std::move(__x)); } - - template - void - emplace_back(_Args&&... __args) - { - bool __realloc = this->_M_requires_reallocation(this->size() + 1); - _Base::emplace_back(std::forward<_Args>(__args)...); - if (__realloc) - this->_M_invalidate_all(); - this->_M_update_guaranteed_capacity(); - } -#endif - - void - pop_back() _GLIBCXX_NOEXCEPT - { - __glibcxx_check_nonempty(); - this->_M_invalidate_if(_Equal(--_Base::end())); - _Base::pop_back(); - } - -#if __cplusplus >= 201103L - template - iterator - emplace(const_iterator __position, _Args&&... __args) - { - __glibcxx_check_insert(__position); - bool __realloc = this->_M_requires_reallocation(this->size() + 1); - difference_type __offset = __position.base() - _Base::begin(); - _Base_iterator __res = _Base::emplace(__position.base(), - std::forward<_Args>(__args)...); - if (__realloc) - this->_M_invalidate_all(); - else - this->_M_invalidate_after_nth(__offset); - this->_M_update_guaranteed_capacity(); - return iterator(__res, this); - } -#endif - - iterator -#if __cplusplus >= 201103L - insert(const_iterator __position, const _Tp& __x) -#else - insert(iterator __position, const _Tp& __x) -#endif - { - __glibcxx_check_insert(__position); - bool __realloc = this->_M_requires_reallocation(this->size() + 1); - difference_type __offset = __position.base() - _Base::begin(); - _Base_iterator __res = _Base::insert(__position.base(), __x); - if (__realloc) - this->_M_invalidate_all(); - else - this->_M_invalidate_after_nth(__offset); - this->_M_update_guaranteed_capacity(); - return iterator(__res, this); - } - -#if __cplusplus >= 201103L - template - typename __gnu_cxx::__enable_if::__value, - iterator>::__type - insert(const_iterator __position, _Tp&& __x) - { return emplace(__position, std::move(__x)); } - - iterator - insert(const_iterator __position, initializer_list __l) - { return this->insert(__position, __l.begin(), __l.end()); } -#endif - -#if __cplusplus >= 201103L - iterator - insert(const_iterator __position, size_type __n, const _Tp& __x) - { - __glibcxx_check_insert(__position); - bool __realloc = this->_M_requires_reallocation(this->size() + __n); - difference_type __offset = __position.base() - _Base::cbegin(); - _Base_iterator __res = _Base::insert(__position.base(), __n, __x); - if (__realloc) - this->_M_invalidate_all(); - else - this->_M_invalidate_after_nth(__offset); - this->_M_update_guaranteed_capacity(); - return iterator(__res, this); - } -#else - void - insert(iterator __position, size_type __n, const _Tp& __x) - { - __glibcxx_check_insert(__position); - bool __realloc = this->_M_requires_reallocation(this->size() + __n); - difference_type __offset = __position.base() - _Base::begin(); - _Base::insert(__position.base(), __n, __x); - if (__realloc) - this->_M_invalidate_all(); - else - this->_M_invalidate_after_nth(__offset); - this->_M_update_guaranteed_capacity(); - } -#endif - -#if __cplusplus >= 201103L - template> - iterator - insert(const_iterator __position, - _InputIterator __first, _InputIterator __last) - { - __glibcxx_check_insert_range(__position, __first, __last); - - /* Hard to guess if invalidation will occur, because __last - - __first can't be calculated in all cases, so we just - punt here by checking if it did occur. */ - _Base_iterator __old_begin = _M_base().begin(); - difference_type __offset = __position.base() - _Base::cbegin(); - _Base_iterator __res = _Base::insert(__position.base(), - __gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - - if (_M_base().begin() != __old_begin) - this->_M_invalidate_all(); - else - this->_M_invalidate_after_nth(__offset); - this->_M_update_guaranteed_capacity(); - return iterator(__res, this); - } -#else - template - void - insert(iterator __position, - _InputIterator __first, _InputIterator __last) - { - __glibcxx_check_insert_range(__position, __first, __last); - - /* Hard to guess if invalidation will occur, because __last - - __first can't be calculated in all cases, so we just - punt here by checking if it did occur. */ - _Base_iterator __old_begin = _M_base().begin(); - difference_type __offset = __position.base() - _Base::begin(); - _Base::insert(__position.base(), __gnu_debug::__base(__first), - __gnu_debug::__base(__last)); - - if (_M_base().begin() != __old_begin) - this->_M_invalidate_all(); - else - this->_M_invalidate_after_nth(__offset); - this->_M_update_guaranteed_capacity(); - } -#endif - - iterator -#if __cplusplus >= 201103L - erase(const_iterator __position) -#else - erase(iterator __position) -#endif - { - __glibcxx_check_erase(__position); - difference_type __offset = __position.base() - _Base::begin(); - _Base_iterator __res = _Base::erase(__position.base()); - this->_M_invalidate_after_nth(__offset); - return iterator(__res, this); - } - - iterator -#if __cplusplus >= 201103L - erase(const_iterator __first, const_iterator __last) -#else - erase(iterator __first, iterator __last) -#endif - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 151. can't currently clear() empty container - __glibcxx_check_erase_range(__first, __last); - - if (__first.base() != __last.base()) - { - difference_type __offset = __first.base() - _Base::begin(); - _Base_iterator __res = _Base::erase(__first.base(), - __last.base()); - this->_M_invalidate_after_nth(__offset); - return iterator(__res, this); - } - else -#if __cplusplus >= 201103L - return begin() + (__first.base() - cbegin().base()); -#else - return __first; -#endif - } - - void - swap(vector& __x) -#if __cplusplus >= 201103L - noexcept( noexcept(declval<_Base>().swap(__x)) ) -#endif - { - _Safe::_M_swap(__x); - _Base::swap(__x); - std::swap(this->_M_guaranteed_capacity, __x._M_guaranteed_capacity); - } - - void - clear() _GLIBCXX_NOEXCEPT - { - _Base::clear(); - this->_M_invalidate_all(); - } - - _Base& - _M_base() _GLIBCXX_NOEXCEPT { return *this; } - - const _Base& - _M_base() const _GLIBCXX_NOEXCEPT { return *this; } - - private: - void - _M_invalidate_after_nth(difference_type __n) _GLIBCXX_NOEXCEPT - { - typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth; - this->_M_invalidate_if(_After_nth(__n, _Base::begin())); - } - }; - - template - inline bool - operator==(const vector<_Tp, _Alloc>& __lhs, - const vector<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() == __rhs._M_base(); } - - template - inline bool - operator!=(const vector<_Tp, _Alloc>& __lhs, - const vector<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() != __rhs._M_base(); } - - template - inline bool - operator<(const vector<_Tp, _Alloc>& __lhs, - const vector<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() < __rhs._M_base(); } - - template - inline bool - operator<=(const vector<_Tp, _Alloc>& __lhs, - const vector<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() <= __rhs._M_base(); } - - template - inline bool - operator>=(const vector<_Tp, _Alloc>& __lhs, - const vector<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() >= __rhs._M_base(); } - - template - inline bool - operator>(const vector<_Tp, _Alloc>& __lhs, - const vector<_Tp, _Alloc>& __rhs) - { return __lhs._M_base() > __rhs._M_base(); } - - template - inline void - swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs) - { __lhs.swap(__rhs); } - -} // namespace __debug - -#if __cplusplus >= 201103L - // DR 1182. - /// std::hash specialization for vector. - template - struct hash<__debug::vector> - : public __hash_base> - { - size_t - operator()(const __debug::vector& __b) const noexcept - { return std::hash<_GLIBCXX_STD_C::vector>() - (__b._M_base()); } - }; -#endif - -} // namespace std - -namespace __gnu_debug -{ - template - struct _Is_contiguous_sequence > - : std::__true_type - { }; - - template - struct _Is_contiguous_sequence > - : std::__false_type - { }; -} - -#endif diff --git a/openflow/usr/include/c++/5/decimal/decimal b/openflow/usr/include/c++/5/decimal/decimal deleted file mode 100644 index 31b6c3d..0000000 --- a/openflow/usr/include/c++/5/decimal/decimal +++ /dev/null @@ -1,494 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2009-2015 Free Software Foundation, Inc. -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file decimal/decimal - * This is a Standard C++ Library header. - */ - -// ISO/IEC TR 24733 -// Written by Janis Johnson - -#ifndef _GLIBCXX_DECIMAL -#define _GLIBCXX_DECIMAL 1 - -#pragma GCC system_header - -#include - -#ifndef _GLIBCXX_USE_DECIMAL_FLOAT -#error This file requires compiler and library support for ISO/IEC TR 24733 \ -that is currently not available. -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ - /** - * @defgroup decimal Decimal Floating-Point Arithmetic - * @ingroup numerics - * - * Classes and functions for decimal floating-point arithmetic. - * @{ - */ - - /** @namespace std::decimal - * @brief ISO/IEC TR 24733 Decimal floating-point arithmetic. - */ -namespace decimal -{ - _GLIBCXX_BEGIN_NAMESPACE_VERSION - - class decimal32; - class decimal64; - class decimal128; - - // 3.2.5 Initialization from coefficient and exponent. - static decimal32 make_decimal32(long long __coeff, int __exp); - static decimal32 make_decimal32(unsigned long long __coeff, int __exp); - static decimal64 make_decimal64(long long __coeff, int __exp); - static decimal64 make_decimal64(unsigned long long __coeff, int __exp); - static decimal128 make_decimal128(long long __coeff, int __exp); - static decimal128 make_decimal128(unsigned long long __coeff, int __exp); - - /// Non-conforming extension: Conversion to integral type. - long long decimal32_to_long_long(decimal32 __d); - long long decimal64_to_long_long(decimal64 __d); - long long decimal128_to_long_long(decimal128 __d); - long long decimal_to_long_long(decimal32 __d); - long long decimal_to_long_long(decimal64 __d); - long long decimal_to_long_long(decimal128 __d); - - // 3.2.6 Conversion to generic floating-point type. - float decimal32_to_float(decimal32 __d); - float decimal64_to_float(decimal64 __d); - float decimal128_to_float(decimal128 __d); - float decimal_to_float(decimal32 __d); - float decimal_to_float(decimal64 __d); - float decimal_to_float(decimal128 __d); - - double decimal32_to_double(decimal32 __d); - double decimal64_to_double(decimal64 __d); - double decimal128_to_double(decimal128 __d); - double decimal_to_double(decimal32 __d); - double decimal_to_double(decimal64 __d); - double decimal_to_double(decimal128 __d); - - long double decimal32_to_long_double(decimal32 __d); - long double decimal64_to_long_double(decimal64 __d); - long double decimal128_to_long_double(decimal128 __d); - long double decimal_to_long_double(decimal32 __d); - long double decimal_to_long_double(decimal64 __d); - long double decimal_to_long_double(decimal128 __d); - - // 3.2.7 Unary arithmetic operators. - decimal32 operator+(decimal32 __rhs); - decimal64 operator+(decimal64 __rhs); - decimal128 operator+(decimal128 __rhs); - decimal32 operator-(decimal32 __rhs); - decimal64 operator-(decimal64 __rhs); - decimal128 operator-(decimal128 __rhs); - - // 3.2.8 Binary arithmetic operators. -#define _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(_Op, _T1, _T2, _T3) \ - _T1 operator _Op(_T2 __lhs, _T3 __rhs); -#define _DECLARE_DECIMAL_BINARY_OP_WITH_INT(_Op, _Tp) \ - _Tp operator _Op(_Tp __lhs, int __rhs); \ - _Tp operator _Op(_Tp __lhs, unsigned int __rhs); \ - _Tp operator _Op(_Tp __lhs, long __rhs); \ - _Tp operator _Op(_Tp __lhs, unsigned long __rhs); \ - _Tp operator _Op(_Tp __lhs, long long __rhs); \ - _Tp operator _Op(_Tp __lhs, unsigned long long __rhs); \ - _Tp operator _Op(int __lhs, _Tp __rhs); \ - _Tp operator _Op(unsigned int __lhs, _Tp __rhs); \ - _Tp operator _Op(long __lhs, _Tp __rhs); \ - _Tp operator _Op(unsigned long __lhs, _Tp __rhs); \ - _Tp operator _Op(long long __lhs, _Tp __rhs); \ - _Tp operator _Op(unsigned long long __lhs, _Tp __rhs); - - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal32, decimal32, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_INT(+, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal32, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_INT(+, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal32, decimal128) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal64, decimal128) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal128) - _DECLARE_DECIMAL_BINARY_OP_WITH_INT(+, decimal128) - - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal32, decimal32, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_INT(-, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal32, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_INT(-, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal32, decimal128) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal64, decimal128) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal128) - _DECLARE_DECIMAL_BINARY_OP_WITH_INT(-, decimal128) - - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal32, decimal32, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_INT(*, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal32, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_INT(*, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal32, decimal128) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal64, decimal128) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal128) - _DECLARE_DECIMAL_BINARY_OP_WITH_INT(*, decimal128) - - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal32, decimal32, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_INT(/, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal32, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_INT(/, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal32, decimal128) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal64, decimal128) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal32) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal64) - _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal128) - _DECLARE_DECIMAL_BINARY_OP_WITH_INT(/, decimal128) - -#undef _DECLARE_DECIMAL_BINARY_OP_WITH_DEC -#undef _DECLARE_DECIMAL_BINARY_OP_WITH_INT - - // 3.2.9 Comparison operators. -#define _DECLARE_DECIMAL_COMPARISON(_Op, _Tp) \ - bool operator _Op(_Tp __lhs, decimal32 __rhs); \ - bool operator _Op(_Tp __lhs, decimal64 __rhs); \ - bool operator _Op(_Tp __lhs, decimal128 __rhs); \ - bool operator _Op(_Tp __lhs, int __rhs); \ - bool operator _Op(_Tp __lhs, unsigned int __rhs); \ - bool operator _Op(_Tp __lhs, long __rhs); \ - bool operator _Op(_Tp __lhs, unsigned long __rhs); \ - bool operator _Op(_Tp __lhs, long long __rhs); \ - bool operator _Op(_Tp __lhs, unsigned long long __rhs); \ - bool operator _Op(int __lhs, _Tp __rhs); \ - bool operator _Op(unsigned int __lhs, _Tp __rhs); \ - bool operator _Op(long __lhs, _Tp __rhs); \ - bool operator _Op(unsigned long __lhs, _Tp __rhs); \ - bool operator _Op(long long __lhs, _Tp __rhs); \ - bool operator _Op(unsigned long long __lhs, _Tp __rhs); - - _DECLARE_DECIMAL_COMPARISON(==, decimal32) - _DECLARE_DECIMAL_COMPARISON(==, decimal64) - _DECLARE_DECIMAL_COMPARISON(==, decimal128) - - _DECLARE_DECIMAL_COMPARISON(!=, decimal32) - _DECLARE_DECIMAL_COMPARISON(!=, decimal64) - _DECLARE_DECIMAL_COMPARISON(!=, decimal128) - - _DECLARE_DECIMAL_COMPARISON(<, decimal32) - _DECLARE_DECIMAL_COMPARISON(<, decimal64) - _DECLARE_DECIMAL_COMPARISON(<, decimal128) - - _DECLARE_DECIMAL_COMPARISON(>=, decimal32) - _DECLARE_DECIMAL_COMPARISON(>=, decimal64) - _DECLARE_DECIMAL_COMPARISON(>=, decimal128) - - _DECLARE_DECIMAL_COMPARISON(>, decimal32) - _DECLARE_DECIMAL_COMPARISON(>, decimal64) - _DECLARE_DECIMAL_COMPARISON(>, decimal128) - - _DECLARE_DECIMAL_COMPARISON(>=, decimal32) - _DECLARE_DECIMAL_COMPARISON(>=, decimal64) - _DECLARE_DECIMAL_COMPARISON(>=, decimal128) - -#undef _DECLARE_DECIMAL_COMPARISON - - /// 3.2.2 Class decimal32. - class decimal32 - { - public: - typedef float __decfloat32 __attribute__((mode(SD))); - - // 3.2.2.2 Construct/copy/destroy. - decimal32() : __val(0.e-101DF) {} - - // 3.2.2.3 Conversion from floating-point type. - explicit decimal32(decimal64 __d64); - explicit decimal32(decimal128 __d128); - explicit decimal32(float __r) : __val(__r) {} - explicit decimal32(double __r) : __val(__r) {} - explicit decimal32(long double __r) : __val(__r) {} - - // 3.2.2.4 Conversion from integral type. - decimal32(int __z) : __val(__z) {} - decimal32(unsigned int __z) : __val(__z) {} - decimal32(long __z) : __val(__z) {} - decimal32(unsigned long __z) : __val(__z) {} - decimal32(long long __z) : __val(__z) {} - decimal32(unsigned long long __z) : __val(__z) {} - - /// Conforming extension: Conversion from scalar decimal type. - decimal32(__decfloat32 __z) : __val(__z) {} - -#if __cplusplus >= 201103L - // 3.2.2.5 Conversion to integral type. - // Note: explicit per n3407. - explicit operator long long() const { return (long long)__val; } -#endif - - // 3.2.2.6 Increment and decrement operators. - decimal32& operator++() - { - __val += 1; - return *this; - } - - decimal32 operator++(int) - { - decimal32 __tmp = *this; - __val += 1; - return __tmp; - } - - decimal32& operator--() - { - __val -= 1; - return *this; - } - - decimal32 operator--(int) - { - decimal32 __tmp = *this; - __val -= 1; - return __tmp; - } - - // 3.2.2.7 Compound assignment. -#define _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(_Op) \ - decimal32& operator _Op(decimal32 __rhs); \ - decimal32& operator _Op(decimal64 __rhs); \ - decimal32& operator _Op(decimal128 __rhs); \ - decimal32& operator _Op(int __rhs); \ - decimal32& operator _Op(unsigned int __rhs); \ - decimal32& operator _Op(long __rhs); \ - decimal32& operator _Op(unsigned long __rhs); \ - decimal32& operator _Op(long long __rhs); \ - decimal32& operator _Op(unsigned long long __rhs); - - _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(+=) - _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(-=) - _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(*=) - _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(/=) -#undef _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT - - private: - __decfloat32 __val; - - public: - __decfloat32 __getval(void) { return __val; } - void __setval(__decfloat32 __x) { __val = __x; } - }; - - /// 3.2.3 Class decimal64. - class decimal64 - { - public: - typedef float __decfloat64 __attribute__((mode(DD))); - - // 3.2.3.2 Construct/copy/destroy. - decimal64() : __val(0.e-398dd) {} - - // 3.2.3.3 Conversion from floating-point type. - decimal64(decimal32 d32); - explicit decimal64(decimal128 d128); - explicit decimal64(float __r) : __val(__r) {} - explicit decimal64(double __r) : __val(__r) {} - explicit decimal64(long double __r) : __val(__r) {} - - // 3.2.3.4 Conversion from integral type. - decimal64(int __z) : __val(__z) {} - decimal64(unsigned int __z) : __val(__z) {} - decimal64(long __z) : __val(__z) {} - decimal64(unsigned long __z) : __val(__z) {} - decimal64(long long __z) : __val(__z) {} - decimal64(unsigned long long __z) : __val(__z) {} - - /// Conforming extension: Conversion from scalar decimal type. - decimal64(__decfloat64 __z) : __val(__z) {} - -#if __cplusplus >= 201103L - // 3.2.3.5 Conversion to integral type. - // Note: explicit per n3407. - explicit operator long long() const { return (long long)__val; } -#endif - - // 3.2.3.6 Increment and decrement operators. - decimal64& operator++() - { - __val += 1; - return *this; - } - - decimal64 operator++(int) - { - decimal64 __tmp = *this; - __val += 1; - return __tmp; - } - - decimal64& operator--() - { - __val -= 1; - return *this; - } - - decimal64 operator--(int) - { - decimal64 __tmp = *this; - __val -= 1; - return __tmp; - } - - // 3.2.3.7 Compound assignment. -#define _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(_Op) \ - decimal64& operator _Op(decimal32 __rhs); \ - decimal64& operator _Op(decimal64 __rhs); \ - decimal64& operator _Op(decimal128 __rhs); \ - decimal64& operator _Op(int __rhs); \ - decimal64& operator _Op(unsigned int __rhs); \ - decimal64& operator _Op(long __rhs); \ - decimal64& operator _Op(unsigned long __rhs); \ - decimal64& operator _Op(long long __rhs); \ - decimal64& operator _Op(unsigned long long __rhs); - - _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(+=) - _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(-=) - _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(*=) - _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(/=) -#undef _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT - - private: - __decfloat64 __val; - - public: - __decfloat64 __getval(void) { return __val; } - void __setval(__decfloat64 __x) { __val = __x; } - }; - - /// 3.2.4 Class decimal128. - class decimal128 - { - public: - typedef float __decfloat128 __attribute__((mode(TD))); - - // 3.2.4.2 Construct/copy/destroy. - decimal128() : __val(0.e-6176DL) {} - - // 3.2.4.3 Conversion from floating-point type. - decimal128(decimal32 d32); - decimal128(decimal64 d64); - explicit decimal128(float __r) : __val(__r) {} - explicit decimal128(double __r) : __val(__r) {} - explicit decimal128(long double __r) : __val(__r) {} - - - // 3.2.4.4 Conversion from integral type. - decimal128(int __z) : __val(__z) {} - decimal128(unsigned int __z) : __val(__z) {} - decimal128(long __z) : __val(__z) {} - decimal128(unsigned long __z) : __val(__z) {} - decimal128(long long __z) : __val(__z) {} - decimal128(unsigned long long __z) : __val(__z) {} - - /// Conforming extension: Conversion from scalar decimal type. - decimal128(__decfloat128 __z) : __val(__z) {} - -#if __cplusplus >= 201103L - // 3.2.4.5 Conversion to integral type. - // Note: explicit per n3407. - explicit operator long long() const { return (long long)__val; } -#endif - - // 3.2.4.6 Increment and decrement operators. - decimal128& operator++() - { - __val += 1; - return *this; - } - - decimal128 operator++(int) - { - decimal128 __tmp = *this; - __val += 1; - return __tmp; - } - - decimal128& operator--() - { - __val -= 1; - return *this; - } - - decimal128 operator--(int) - { - decimal128 __tmp = *this; - __val -= 1; - return __tmp; - } - - // 3.2.4.7 Compound assignment. -#define _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(_Op) \ - decimal128& operator _Op(decimal32 __rhs); \ - decimal128& operator _Op(decimal64 __rhs); \ - decimal128& operator _Op(decimal128 __rhs); \ - decimal128& operator _Op(int __rhs); \ - decimal128& operator _Op(unsigned int __rhs); \ - decimal128& operator _Op(long __rhs); \ - decimal128& operator _Op(unsigned long __rhs); \ - decimal128& operator _Op(long long __rhs); \ - decimal128& operator _Op(unsigned long long __rhs); - - _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(+=) - _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(-=) - _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(*=) - _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(/=) -#undef _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT - - private: - __decfloat128 __val; - - public: - __decfloat128 __getval(void) { return __val; } - void __setval(__decfloat128 __x) { __val = __x; } - }; - -#define _GLIBCXX_USE_DECIMAL_ 1 - - _GLIBCXX_END_NAMESPACE_VERSION -} // namespace decimal - // @} group decimal -} // namespace std - -#include - -#endif /* _GLIBCXX_DECIMAL */ diff --git a/openflow/usr/include/c++/5/decimal/decimal.h b/openflow/usr/include/c++/5/decimal/decimal.h deleted file mode 100644 index da2c01e..0000000 --- a/openflow/usr/include/c++/5/decimal/decimal.h +++ /dev/null @@ -1,468 +0,0 @@ -// decimal classes -*- C++ -*- - -// Copyright (C) 2009-2015 Free Software Foundation, Inc. - -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file decimal/decimal.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{decimal} - */ - -// ISO/IEC TR 24733 -// Written by Janis Johnson - -#ifndef _GLIBCXX_DECIMAL_IMPL -#define _GLIBCXX_DECIMAL_IMPL 1 - -#pragma GCC system_header - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace decimal -{ - _GLIBCXX_BEGIN_NAMESPACE_VERSION - - // ISO/IEC TR 24733 3.2.[234].1 Construct/copy/destroy. - - inline decimal32::decimal32(decimal64 __r) : __val(__r.__getval()) {} - inline decimal32::decimal32(decimal128 __r) : __val(__r.__getval()) {} - inline decimal64::decimal64(decimal32 __r) : __val(__r.__getval()) {} - inline decimal64::decimal64(decimal128 __r) : __val(__r.__getval()) {} - inline decimal128::decimal128(decimal32 __r) : __val(__r.__getval()) {} - inline decimal128::decimal128(decimal64 __r) : __val(__r.__getval()) {} - - // ISO/IEC TR 24733 3.2.[234].6 Compound assignment. - -#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, _T2) \ - inline _T1& _T1::operator _Op1(_T2 __rhs) \ - { \ - __setval(__getval() _Op2 __rhs.__getval()); \ - return *this; \ - } - -#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, _T2) \ - inline _T1& _T1::operator _Op1(_T2 __rhs) \ - { \ - __setval(__getval() _Op2 __rhs); \ - return *this; \ - } - -#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(_Op1, _Op2, _T1) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal32) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal64) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal128) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, int) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned int) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, long) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned long)\ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, long long) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned long long) - - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal32) - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal32) - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal32) - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal32) - - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal64) - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal64) - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal64) - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal64) - - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal128) - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal128) - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal128) - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal128) - -#undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC -#undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT -#undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS - - // Extension: Conversion to integral type. - - inline long long decimal32_to_long_long(decimal32 __d) - { return (long long)__d.__getval(); } - - inline long long decimal64_to_long_long(decimal64 __d) - { return (long long)__d.__getval(); } - - inline long long decimal128_to_long_long(decimal128 __d) - { return (long long)__d.__getval(); } - - inline long long decimal_to_long_long(decimal32 __d) - { return (long long)__d.__getval(); } - - inline long long decimal_to_long_long(decimal64 __d) - { return (long long)__d.__getval(); } - - inline long long decimal_to_long_long(decimal128 __d) - { return (long long)__d.__getval(); } - - // ISO/IEC TR 24733 3.2.5 Initialization from coefficient and exponent. - - static decimal32 make_decimal32(long long __coeff, int __exponent) - { - decimal32 __decexp = 1, __multiplier; - - if (__exponent < 0) - { - __multiplier = 1.E-1DF; - __exponent = -__exponent; - } - else - __multiplier = 1.E1DF; - - for (int __i = 0; __i < __exponent; ++__i) - __decexp *= __multiplier; - - return __coeff * __decexp; - } - - static decimal32 make_decimal32(unsigned long long __coeff, int __exponent) - { - decimal32 __decexp = 1, __multiplier; - - if (__exponent < 0) - { - __multiplier = 1.E-1DF; - __exponent = -__exponent; - } - else - __multiplier = 1.E1DF; - - for (int __i = 0; __i < __exponent; ++__i) - __decexp *= __multiplier; - - return __coeff * __decexp; - } - - static decimal64 make_decimal64(long long __coeff, int __exponent) - { - decimal64 __decexp = 1, __multiplier; - - if (__exponent < 0) - { - __multiplier = 1.E-1DD; - __exponent = -__exponent; - } - else - __multiplier = 1.E1DD; - - for (int __i = 0; __i < __exponent; ++__i) - __decexp *= __multiplier; - - return __coeff * __decexp; - } - - static decimal64 make_decimal64(unsigned long long __coeff, int __exponent) - { - decimal64 __decexp = 1, __multiplier; - - if (__exponent < 0) - { - __multiplier = 1.E-1DD; - __exponent = -__exponent; - } - else - __multiplier = 1.E1DD; - - for (int __i = 0; __i < __exponent; ++__i) - __decexp *= __multiplier; - - return __coeff * __decexp; - } - - static decimal128 make_decimal128(long long __coeff, int __exponent) - { - decimal128 __decexp = 1, __multiplier; - - if (__exponent < 0) - { - __multiplier = 1.E-1DL; - __exponent = -__exponent; - } - else - __multiplier = 1.E1DL; - - for (int __i = 0; __i < __exponent; ++__i) - __decexp *= __multiplier; - - return __coeff * __decexp; - } - - static decimal128 make_decimal128(unsigned long long __coeff, int __exponent) - { - decimal128 __decexp = 1, __multiplier; - - if (__exponent < 0) - { - __multiplier = 1.E-1DL; - __exponent = -__exponent; - } - else - __multiplier = 1.E1DL; - - for (int __i = 0; __i < __exponent; ++__i) - __decexp *= __multiplier; - - return __coeff * __decexp; - } - - // ISO/IEC TR 24733 3.2.6 Conversion to generic floating-point type. - - inline float decimal32_to_float(decimal32 __d) - { return (float)__d.__getval(); } - - inline float decimal64_to_float(decimal64 __d) - { return (float)__d.__getval(); } - - inline float decimal128_to_float(decimal128 __d) - { return (float)__d.__getval(); } - - inline float decimal_to_float(decimal32 __d) - { return (float)__d.__getval(); } - - inline float decimal_to_float(decimal64 __d) - { return (float)__d.__getval(); } - - inline float decimal_to_float(decimal128 __d) - { return (float)__d.__getval(); } - - inline double decimal32_to_double(decimal32 __d) - { return (double)__d.__getval(); } - - inline double decimal64_to_double(decimal64 __d) - { return (double)__d.__getval(); } - - inline double decimal128_to_double(decimal128 __d) - { return (double)__d.__getval(); } - - inline double decimal_to_double(decimal32 __d) - { return (double)__d.__getval(); } - - inline double decimal_to_double(decimal64 __d) - { return (double)__d.__getval(); } - - inline double decimal_to_double(decimal128 __d) - { return (double)__d.__getval(); } - - inline long double decimal32_to_long_double(decimal32 __d) - { return (long double)__d.__getval(); } - - inline long double decimal64_to_long_double(decimal64 __d) - { return (long double)__d.__getval(); } - - inline long double decimal128_to_long_double(decimal128 __d) - { return (long double)__d.__getval(); } - - inline long double decimal_to_long_double(decimal32 __d) - { return (long double)__d.__getval(); } - - inline long double decimal_to_long_double(decimal64 __d) - { return (long double)__d.__getval(); } - - inline long double decimal_to_long_double(decimal128 __d) - { return (long double)__d.__getval(); } - - // ISO/IEC TR 24733 3.2.7 Unary arithmetic operators. - -#define _DEFINE_DECIMAL_UNARY_OP(_Op, _Tp) \ - inline _Tp operator _Op(_Tp __rhs) \ - { \ - _Tp __tmp; \ - __tmp.__setval(_Op __rhs.__getval()); \ - return __tmp; \ - } - - _DEFINE_DECIMAL_UNARY_OP(+, decimal32) - _DEFINE_DECIMAL_UNARY_OP(+, decimal64) - _DEFINE_DECIMAL_UNARY_OP(+, decimal128) - _DEFINE_DECIMAL_UNARY_OP(-, decimal32) - _DEFINE_DECIMAL_UNARY_OP(-, decimal64) - _DEFINE_DECIMAL_UNARY_OP(-, decimal128) - -#undef _DEFINE_DECIMAL_UNARY_OP - - // ISO/IEC TR 24733 3.2.8 Binary arithmetic operators. - -#define _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(_Op, _T1, _T2, _T3) \ - inline _T1 operator _Op(_T2 __lhs, _T3 __rhs) \ - { \ - _T1 __retval; \ - __retval.__setval(__lhs.__getval() _Op __rhs.__getval()); \ - return __retval; \ - } - -#define _DEFINE_DECIMAL_BINARY_OP_BOTH(_Op, _T1, _T2, _T3) \ - inline _T1 operator _Op(_T2 __lhs, _T3 __rhs) \ - { \ - _T1 __retval; \ - __retval.__setval(__lhs.__getval() _Op __rhs.__getval()); \ - return __retval; \ - } - -#define _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, _T2) \ - inline _T1 operator _Op(_T1 __lhs, _T2 __rhs) \ - { \ - _T1 __retval; \ - __retval.__setval(__lhs.__getval() _Op __rhs); \ - return __retval; \ - } - -#define _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, _T2) \ - inline _T1 operator _Op(_T2 __lhs, _T1 __rhs) \ - { \ - _T1 __retval; \ - __retval.__setval(__lhs _Op __rhs.__getval()); \ - return __retval; \ - } - -#define _DEFINE_DECIMAL_BINARY_OP_WITH_INT(_Op, _T1) \ - _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, int); \ - _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned int); \ - _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, long); \ - _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned long); \ - _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, long long); \ - _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned long long); \ - _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, int); \ - _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned int); \ - _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, long); \ - _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned long); \ - _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, long long); \ - _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned long long); \ - - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal32, decimal32, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal32, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal32, decimal128) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal64, decimal128) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal128) - _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal128) - - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal32, decimal32, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal32, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal32, decimal128) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal64, decimal128) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal128) - _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal128) - - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal32, decimal32, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal32, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal32, decimal128) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal64, decimal128) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal128) - _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal128) - - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal32, decimal32, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal32, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal32, decimal128) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal64, decimal128) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal32) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal64) - _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal128) - _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal128) - -#undef _DEFINE_DECIMAL_BINARY_OP_WITH_DEC -#undef _DEFINE_DECIMAL_BINARY_OP_BOTH -#undef _DEFINE_DECIMAL_BINARY_OP_LHS -#undef _DEFINE_DECIMAL_BINARY_OP_RHS -#undef _DEFINE_DECIMAL_BINARY_OP_WITH_INT - - // ISO/IEC TR 24733 3.2.9 Comparison operators. - -#define _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _T1, _T2) \ - inline bool operator _Op(_T1 __lhs, _T2 __rhs) \ - { return __lhs.__getval() _Op __rhs.__getval(); } - -#define _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _T1, _T2) \ - inline bool operator _Op(_T1 __lhs, _T2 __rhs) \ - { return __lhs.__getval() _Op __rhs; } - -#define _DEFINE_DECIMAL_COMPARISON_RHS(_Op, _T1, _T2) \ - inline bool operator _Op(_T1 __lhs, _T2 __rhs) \ - { return __lhs _Op __rhs.__getval(); } - -#define _DEFINE_DECIMAL_COMPARISONS(_Op, _Tp) \ - _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal32) \ - _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal64) \ - _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal128) \ - _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, int) \ - _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned int) \ - _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, long) \ - _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned long) \ - _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, long long) \ - _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned long long) \ - _DEFINE_DECIMAL_COMPARISON_RHS(_Op, int, _Tp) \ - _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned int, _Tp) \ - _DEFINE_DECIMAL_COMPARISON_RHS(_Op, long, _Tp) \ - _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned long, _Tp) \ - _DEFINE_DECIMAL_COMPARISON_RHS(_Op, long long, _Tp) \ - _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned long long, _Tp) - - _DEFINE_DECIMAL_COMPARISONS(==, decimal32) - _DEFINE_DECIMAL_COMPARISONS(==, decimal64) - _DEFINE_DECIMAL_COMPARISONS(==, decimal128) - _DEFINE_DECIMAL_COMPARISONS(!=, decimal32) - _DEFINE_DECIMAL_COMPARISONS(!=, decimal64) - _DEFINE_DECIMAL_COMPARISONS(!=, decimal128) - _DEFINE_DECIMAL_COMPARISONS(<, decimal32) - _DEFINE_DECIMAL_COMPARISONS(<, decimal64) - _DEFINE_DECIMAL_COMPARISONS(<, decimal128) - _DEFINE_DECIMAL_COMPARISONS(<=, decimal32) - _DEFINE_DECIMAL_COMPARISONS(<=, decimal64) - _DEFINE_DECIMAL_COMPARISONS(<=, decimal128) - _DEFINE_DECIMAL_COMPARISONS(>, decimal32) - _DEFINE_DECIMAL_COMPARISONS(>, decimal64) - _DEFINE_DECIMAL_COMPARISONS(>, decimal128) - _DEFINE_DECIMAL_COMPARISONS(>=, decimal32) - _DEFINE_DECIMAL_COMPARISONS(>=, decimal64) - _DEFINE_DECIMAL_COMPARISONS(>=, decimal128) - -#undef _DEFINE_DECIMAL_COMPARISON_BOTH -#undef _DEFINE_DECIMAL_COMPARISON_LHS -#undef _DEFINE_DECIMAL_COMPARISON_RHS -#undef _DEFINE_DECIMAL_COMPARISONS - _GLIBCXX_END_NAMESPACE_VERSION -} // namespace decimal -} // namespace std - -#endif /* _GLIBCXX_DECIMAL_IMPL */ diff --git a/openflow/usr/include/c++/5/deque b/openflow/usr/include/c++/5/deque deleted file mode 100644 index 171e970..0000000 --- a/openflow/usr/include/c++/5/deque +++ /dev/null @@ -1,76 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/deque - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_DEQUE -#define _GLIBCXX_DEQUE 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include -#include -#include - -#ifdef _GLIBCXX_DEBUG -# include -#endif - -#ifdef _GLIBCXX_PROFILE -# include -#endif - -#endif /* _GLIBCXX_DEQUE */ diff --git a/openflow/usr/include/c++/5/exception b/openflow/usr/include/c++/5/exception deleted file mode 100644 index d6c1855..0000000 --- a/openflow/usr/include/c++/5/exception +++ /dev/null @@ -1,166 +0,0 @@ -// Exception Handling support header for -*- C++ -*- - -// Copyright (C) 1995-2015 Free Software Foundation, Inc. -// -// This file is part of GCC. -// -// GCC is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// GCC is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file exception - * This is a Standard C++ Library header. - */ - -#ifndef __EXCEPTION__ -#define __EXCEPTION__ - -#pragma GCC system_header - -#pragma GCC visibility push(default) - -#include -#include - -extern "C++" { - -namespace std -{ - /** - * @defgroup exceptions Exceptions - * @ingroup diagnostics - * - * Classes and functions for reporting errors via exception classes. - * @{ - */ - - /** - * @brief Base class for all library exceptions. - * - * This is the base class for all exceptions thrown by the standard - * library, and by certain language expressions. You are free to derive - * your own %exception classes, or use a different hierarchy, or to - * throw non-class data (e.g., fundamental types). - */ - class exception - { - public: - exception() _GLIBCXX_USE_NOEXCEPT { } - virtual ~exception() _GLIBCXX_USE_NOEXCEPT; - - /** Returns a C-style character string describing the general cause - * of the current error. */ - virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; - }; - - /** If an %exception is thrown which is not listed in a function's - * %exception specification, one of these may be thrown. */ - class bad_exception : public exception - { - public: - bad_exception() _GLIBCXX_USE_NOEXCEPT { } - - // This declaration is not useless: - // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 - virtual ~bad_exception() _GLIBCXX_USE_NOEXCEPT; - - // See comment in eh_exception.cc. - virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; - }; - - /// If you write a replacement %terminate handler, it must be of this type. - typedef void (*terminate_handler) (); - - /// If you write a replacement %unexpected handler, it must be of this type. - typedef void (*unexpected_handler) (); - - /// Takes a new handler function as an argument, returns the old function. - terminate_handler set_terminate(terminate_handler) _GLIBCXX_USE_NOEXCEPT; - -#if __cplusplus >= 201103L - /// Return the current terminate handler. - terminate_handler get_terminate() noexcept; -#endif - - /** The runtime will call this function if %exception handling must be - * abandoned for any reason. It can also be called by the user. */ - void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__)); - - /// Takes a new handler function as an argument, returns the old function. - unexpected_handler set_unexpected(unexpected_handler) _GLIBCXX_USE_NOEXCEPT; - -#if __cplusplus >= 201103L - /// Return the current unexpected handler. - unexpected_handler get_unexpected() noexcept; -#endif - - /** The runtime will call this function if an %exception is thrown which - * violates the function's %exception specification. */ - void unexpected() __attribute__ ((__noreturn__)); - - /** [18.6.4]/1: 'Returns true after completing evaluation of a - * throw-expression until either completing initialization of the - * exception-declaration in the matching handler or entering @c unexpected() - * due to the throw; or after entering @c terminate() for any reason - * other than an explicit call to @c terminate(). [Note: This includes - * stack unwinding [15.2]. end note]' - * - * 2: 'When @c uncaught_exception() is true, throwing an - * %exception can result in a call of @c terminate() - * (15.5.1).' - */ - bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); - - // @} group exceptions -} // namespace std - -namespace __gnu_cxx -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @brief A replacement for the standard terminate_handler which - * prints more information about the terminating exception (if any) - * on stderr. - * - * @ingroup exceptions - * - * Call - * @code - * std::set_terminate(__gnu_cxx::__verbose_terminate_handler) - * @endcode - * to use. For more info, see - * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt02ch06s02.html - * - * In 3.4 and later, this is on by default. - */ - void __verbose_terminate_handler(); - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -} // extern "C++" - -#pragma GCC visibility pop - -#if (__cplusplus >= 201103L) && (ATOMIC_INT_LOCK_FREE > 1) -#include -#include -#endif - -#endif diff --git a/openflow/usr/include/c++/5/experimental/algorithm b/openflow/usr/include/c++/5/experimental/algorithm deleted file mode 100644 index 4281b42..0000000 --- a/openflow/usr/include/c++/5/experimental/algorithm +++ /dev/null @@ -1,137 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/algorithm - * This is a TS C++ Library header. - */ - -#ifndef _GLIBCXX_EXPERIMENTAL_ALGORITHM -#define _GLIBCXX_EXPERIMENTAL_ALGORITHM 1 - -#pragma GCC system_header - -#if __cplusplus <= 201103L -# include -#else - -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -inline namespace fundamentals_v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - inline _ForwardIterator - search(_ForwardIterator __first, _ForwardIterator __last, - const _Searcher& __searcher) - { return __searcher(__first, __last); } - -#define __cpp_lib_experimental_sample 201402 - - /// Reservoir sampling algorithm. - template - _RandomAccessIterator - __sample(_InputIterator __first, _InputIterator __last, input_iterator_tag, - _RandomAccessIterator __out, random_access_iterator_tag, - _Size __n, _UniformRandomNumberGenerator&& __g) - { - using __distrib_type = std::uniform_int_distribution<_Size>; - using __param_type = typename __distrib_type::param_type; - __distrib_type __d{}; - _Size __sample_sz = 0; - while (__first != __last && __sample_sz != __n) - __out[__sample_sz++] = *__first++; - for (auto __pop_sz = __sample_sz; __first != __last; - ++__first, ++__pop_sz) - { - const auto __k = __d(__g, __param_type{0, __pop_sz}); - if (__k < __n) - __out[__k] = *__first; - } - return __out + __sample_sz; - } - - /// Selection sampling algorithm. - template - _OutputIterator - __sample(_ForwardIterator __first, _ForwardIterator __last, - forward_iterator_tag, - _OutputIterator __out, _Cat, - _Size __n, _UniformRandomNumberGenerator&& __g) - { - using __distrib_type = std::uniform_int_distribution<_Size>; - using __param_type = typename __distrib_type::param_type; - __distrib_type __d{}; - _Size __unsampled_sz = std::distance(__first, __last); - for (__n = std::min(__n, __unsampled_sz); __n != 0; ++__first) - if (__d(__g, __param_type{0, --__unsampled_sz}) < __n) - { - *__out++ = *__first; - --__n; - } - return __out; - } - - /// Take a random sample from a population. - template - _SampleIterator - sample(_PopulationIterator __first, _PopulationIterator __last, - _SampleIterator __out, _Distance __n, - _UniformRandomNumberGenerator&& __g) - { - using __pop_cat = typename - std::iterator_traits<_PopulationIterator>::iterator_category; - using __samp_cat = typename - std::iterator_traits<_SampleIterator>::iterator_category; - - static_assert( - __or_, - is_convertible<__samp_cat, random_access_iterator_tag>>::value, - "output range must use a RandomAccessIterator when input range" - " does not meet the ForwardIterator requirements"); - - static_assert(is_integral<_Distance>::value, - "sample size must be an integer type"); - - return std::experimental::__sample( - __first, __last, __pop_cat{}, __out, __samp_cat{}, - __n, std::forward<_UniformRandomNumberGenerator>(__g)); - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - -#endif // C++14 - -#endif // _GLIBCXX_EXPERIMENTAL_ALGORITHM diff --git a/openflow/usr/include/c++/5/experimental/any b/openflow/usr/include/c++/5/experimental/any deleted file mode 100644 index 487ba01..0000000 --- a/openflow/usr/include/c++/5/experimental/any +++ /dev/null @@ -1,437 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/any - * This is a TS C++ Library header. - */ - -#ifndef _GLIBCXX_EXPERIMENTAL_ANY -#define _GLIBCXX_EXPERIMENTAL_ANY 1 - -#pragma GCC system_header - -#if __cplusplus <= 201103L -# include -#else - -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -inline namespace fundamentals_v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @defgroup any Type-safe container of any type - * @ingroup experimental - * - * A type-safe container for single values of value types, as - * described in n3804 "Any Library Proposal (Revision 3)". - * - * @{ - */ - -#define __cpp_lib_experimental_any 201411 - - /** - * @brief Exception class thrown by a failed @c any_cast - * @ingroup exceptions - */ - class bad_any_cast : public bad_cast - { - public: - virtual const char* what() const noexcept { return "bad any_cast"; } - }; - - [[gnu::noreturn]] inline void __throw_bad_any_cast() - { -#if __cpp_exceptions - throw bad_any_cast{}; -#else - __builtin_abort(); -#endif - } - - /** - * @brief A type-safe container of any type. - * - * An @c any object's state is either empty or it stores a contained object - * of CopyConstructible type. - */ - class any - { - // Holds either pointer to a heap object or the contained object itself. - union _Storage - { - void* _M_ptr; - std::aligned_storage::type _M_buffer; - }; - - template, - bool _Fits = (sizeof(_Tp) <= sizeof(_Storage))> - using _Internal = std::integral_constant; - - template - struct _Manager_internal; // uses small-object optimization - - template - struct _Manager_external; // creates contained object on the heap - - template - using _Manager = conditional_t<_Internal<_Tp>::value, - _Manager_internal<_Tp>, - _Manager_external<_Tp>>; - - template> - using _Decay = enable_if_t::value, _Decayed>; - - public: - // construct/destruct - - /// Default constructor, creates an empty object. - any() noexcept : _M_manager(nullptr) { } - - /// Copy constructor, copies the state of @p __other - any(const any& __other) : _M_manager(__other._M_manager) - { - if (!__other.empty()) - { - _Arg __arg; - __arg._M_any = this; - _M_manager(_Op_clone, &__other, &__arg); - } - } - - /** - * @brief Move constructor, transfer the state from @p __other - * - * @post @c __other.empty() (not guaranteed for other implementations) - */ - any(any&& __other) noexcept - : _M_manager(__other._M_manager), - _M_storage(__other._M_storage) - { __other._M_manager = nullptr; } - - /// Construct with a copy of @p __value as the contained object. - template , - typename _Mgr = _Manager<_Tp>> - any(_ValueType&& __value) - : _M_manager(&_Mgr::_S_manage), - _M_storage(_Mgr::_S_create(std::forward<_ValueType>(__value))) - { - static_assert(is_copy_constructible<_Tp>::value, - "The contained object must be CopyConstructible"); - } - - /// Destructor, calls @c clear() - ~any() { clear(); } - - // assignments - - /// Copy the state of - any& operator=(const any& __rhs) - { - any(__rhs).swap(*this); - return *this; - } - - /** - * @brief Move assignment operator - * - * @post @c __rhs.empty() (not guaranteed for other implementations) - */ - any& operator=(any&& __rhs) noexcept - { - any(std::move(__rhs)).swap(*this); - return *this; - } - - /// Store a copy of @p __rhs as the contained object. - template - any& operator=(_ValueType&& __rhs) - { - any(std::forward<_ValueType>(__rhs)).swap(*this); - return *this; - } - - // modifiers - - /// If not empty, destroy the contained object. - void clear() noexcept - { - if (!empty()) - { - _M_manager(_Op_destroy, this, nullptr); - _M_manager = nullptr; - } - } - - /// Exchange state with another object. - void swap(any& __rhs) noexcept - { - std::swap(_M_manager, __rhs._M_manager); - std::swap(_M_storage, __rhs._M_storage); - } - - // observers - - /// Reports whether there is a contained object or not. - bool empty() const noexcept { return _M_manager == nullptr; } - -#if __cpp_rtti - /// The @c typeid of the contained object, or @c typeid(void) if empty. - const type_info& type() const noexcept - { - if (empty()) - return typeid(void); - _Arg __arg; - _M_manager(_Op_get_type_info, this, &__arg); - return *__arg._M_typeinfo; - } -#endif - - template - static constexpr bool __is_valid_cast() - { return __or_, is_copy_constructible<_Tp>>::value; } - - private: - enum _Op { _Op_access, _Op_get_type_info, _Op_clone, _Op_destroy }; - - union _Arg - { - void* _M_obj; - const std::type_info* _M_typeinfo; - any* _M_any; - }; - - void (*_M_manager)(_Op, const any*, _Arg*); - _Storage _M_storage; - - template - friend void* __any_caster(const any* __any) - { - if (__any->_M_manager != &_Manager>::_S_manage) - return nullptr; - _Arg __arg; - __any->_M_manager(_Op_access, __any, &__arg); - return __arg._M_obj; - } - - // Manage in-place contained object. - template - struct _Manager_internal - { - static void - _S_manage(_Op __which, const any* __anyp, _Arg* __arg); - - template - static _Storage - _S_create(_Up&& __value) - { - _Storage __storage; - void* __addr = &__storage._M_buffer; - ::new (__addr) _Tp(std::forward<_Up>(__value)); - return __storage; - } - - template - static _Storage - _S_alloc(const _Alloc&, _Up&& __value) - { - return _S_create(std::forward<_Up>(__value)); - } - }; - - // Manage external contained object. - template - struct _Manager_external - { - static void - _S_manage(_Op __which, const any* __anyp, _Arg* __arg); - - template - static _Storage - _S_create(_Up&& __value) - { - _Storage __storage; - __storage._M_ptr = new _Tp(std::forward<_Up>(__value)); - return __storage; - } - }; - }; - - /// Exchange the states of two @c any objects. - inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); } - - /** - * @brief Access the contained object. - * - * @tparam _ValueType A const-reference or CopyConstructible type. - * @param __any The object to access. - * @return The contained object. - * @throw bad_any_cast If - * __any.type() != typeid(remove_reference_t<_ValueType>) - * - */ - template - inline _ValueType any_cast(const any& __any) - { - static_assert(any::__is_valid_cast<_ValueType>(), - "Template argument must be a reference or CopyConstructible type"); - auto __p = any_cast>>(&__any); - if (__p) - return *__p; - __throw_bad_any_cast(); - } - - /** - * @brief Access the contained object. - * - * @tparam _ValueType A reference or CopyConstructible type. - * @param __any The object to access. - * @return The contained object. - * @throw bad_any_cast If - * __any.type() != typeid(remove_reference_t<_ValueType>) - * - * - * @{ - */ - template - inline _ValueType any_cast(any& __any) - { - static_assert(any::__is_valid_cast<_ValueType>(), - "Template argument must be a reference or CopyConstructible type"); - auto __p = any_cast>(&__any); - if (__p) - return *__p; - __throw_bad_any_cast(); - } - - template - inline _ValueType any_cast(any&& __any) - { - static_assert(any::__is_valid_cast<_ValueType>(), - "Template argument must be a reference or CopyConstructible type"); - auto __p = any_cast>(&__any); - if (__p) - return *__p; - __throw_bad_any_cast(); - } - // @} - - /** - * @brief Access the contained object. - * - * @tparam _ValueType The type of the contained object. - * @param __any A pointer to the object to access. - * @return The address of the contained object if - * __any != nullptr && __any.type() == typeid(_ValueType) - * , otherwise a null pointer. - * - * @{ - */ - template - inline const _ValueType* any_cast(const any* __any) noexcept - { - if (__any) - return static_cast<_ValueType*>(__any_caster<_ValueType>(__any)); - return nullptr; - } - - template - inline _ValueType* any_cast(any* __any) noexcept - { - if (__any) - return static_cast<_ValueType*>(__any_caster<_ValueType>(__any)); - return nullptr; - } - // @} - - template - void - any::_Manager_internal<_Tp>:: - _S_manage(_Op __which, const any* __any, _Arg* __arg) - { - // The contained object is in _M_storage._M_buffer - auto __ptr = reinterpret_cast(&__any->_M_storage._M_buffer); - switch (__which) - { - case _Op_access: - __arg->_M_obj = const_cast<_Tp*>(__ptr); - break; - case _Op_get_type_info: -#if __cpp_rtti - __arg->_M_typeinfo = &typeid(_Tp); -#endif - break; - case _Op_clone: - ::new(&__arg->_M_any->_M_storage._M_buffer) _Tp(*__ptr); - break; - case _Op_destroy: - __ptr->~_Tp(); - break; - } - } - - template - void - any::_Manager_external<_Tp>:: - _S_manage(_Op __which, const any* __any, _Arg* __arg) - { - // The contained object is *_M_storage._M_ptr - auto __ptr = static_cast(__any->_M_storage._M_ptr); - switch (__which) - { - case _Op_access: - __arg->_M_obj = const_cast<_Tp*>(__ptr); - break; - case _Op_get_type_info: -#if __cpp_rtti - __arg->_M_typeinfo = &typeid(_Tp); -#endif - break; - case _Op_clone: - __arg->_M_any->_M_storage._M_ptr = new _Tp(*__ptr); - break; - case _Op_destroy: - delete __ptr; - break; - } - } - - // @} group any -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - -#endif // C++14 - -#endif // _GLIBCXX_EXPERIMENTAL_ANY diff --git a/openflow/usr/include/c++/5/experimental/chrono b/openflow/usr/include/c++/5/experimental/chrono deleted file mode 100644 index 0631fa5..0000000 --- a/openflow/usr/include/c++/5/experimental/chrono +++ /dev/null @@ -1,65 +0,0 @@ -// Variable Templates For chrono -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/chrono - * This is a TS C++ Library header. - */ - -// -// N3932 Variable Templates For Type Traits (Revision 1) -// - -#ifndef _GLIBCXX_EXPERIMENTAL_CHRONO -#define _GLIBCXX_EXPERIMENTAL_CHRONO 1 - -#pragma GCC system_header - -#if __cplusplus <= 201103L -# include -#else - -#include - - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace chrono { -namespace experimental -{ -inline namespace fundamentals_v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION -// See C++14 §20.12.4, customization traits -template - constexpr bool treat_as_floating_point_v = - treat_as_floating_point<_Rep>::value; -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace chrono -} // namespace std - -#endif // __cplusplus <= 201103L - -#endif // _GLIBCXX_EXPERIMENTAL_CHRONO diff --git a/openflow/usr/include/c++/5/experimental/filesystem b/openflow/usr/include/c++/5/experimental/filesystem deleted file mode 100644 index db7ab11..0000000 --- a/openflow/usr/include/c++/5/experimental/filesystem +++ /dev/null @@ -1,77 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/filesystem - * This is a TS C++ Library header. - */ - -#ifndef _GLIBCXX_EXPERIMENTAL_FILESYSTEM -#define _GLIBCXX_EXPERIMENTAL_FILESYSTEM 1 - -#pragma GCC system_header - -#if __cplusplus < 201103L -# include -#else - -#include -#include -#include -#include - -#define __cpp_lib_experimental_filesystem 201406 - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -namespace filesystem -{ -inline namespace v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @ingroup filesystem - */ - inline std::string filesystem_error::_M_gen_what() - { - std::string __what = "filesystem error: "; - __what += system_error::what(); - if (!_M_path1.empty()) - __what += " [" + _M_path1.string() + ']'; - if (!_M_path2.empty()) - __what += " [" + _M_path2.string() + ']'; - return __what; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace v1 -} // namespace filesystem -} // namespace experimental -} // namespace std - -#endif // C++11 - -#endif // _GLIBCXX_EXPERIMENTAL_FILESYSTEM diff --git a/openflow/usr/include/c++/5/experimental/fs_dir.h b/openflow/usr/include/c++/5/experimental/fs_dir.h deleted file mode 100644 index 0c5253f..0000000 --- a/openflow/usr/include/c++/5/experimental/fs_dir.h +++ /dev/null @@ -1,338 +0,0 @@ -// Filesystem directory utilities -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/fs_dir.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{experimental/filesystem} - */ - -#ifndef _GLIBCXX_EXPERIMENTAL_FS_DIR_H -#define _GLIBCXX_EXPERIMENTAL_FS_DIR_H 1 - -#if __cplusplus < 201103L -# include -#else -# include -# include -# include -# include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -namespace filesystem -{ -inline namespace v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @ingroup filesystem - * @{ - */ - - class file_status - { - public: - // constructors - explicit - file_status(file_type __ft = file_type::none, - perms __prms = perms::unknown) noexcept - : _M_type(__ft), _M_perms(__prms) { } - - file_status(const file_status&) noexcept = default; - file_status(file_status&&) noexcept = default; - ~file_status() = default; - - file_status& operator=(const file_status&) noexcept = default; - file_status& operator=(file_status&&) noexcept = default; - - // observers - file_type type() const noexcept { return _M_type; } - perms permissions() const noexcept { return _M_perms; } - - // modifiers - void type(file_type __ft) noexcept { _M_type = __ft; } - void permissions(perms __prms) noexcept { _M_perms = __prms; } - - private: - file_type _M_type; - perms _M_perms; - }; - -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - - class directory_entry - { - public: - // constructors and destructor - directory_entry() noexcept = default; - directory_entry(const directory_entry&) = default; - directory_entry(directory_entry&&) noexcept = default; - explicit directory_entry(const filesystem::path& __p) : _M_path(__p) { } - ~directory_entry() = default; - - // modifiers - directory_entry& operator=(const directory_entry&) = default; - directory_entry& operator=(directory_entry&&) noexcept = default; - - void assign(const filesystem::path& __p) { _M_path = __p; } - - void - replace_filename(const filesystem::path& __p) - { _M_path = _M_path.parent_path() / __p; } - - // observers - const filesystem::path& path() const noexcept { return _M_path; } - operator const filesystem::path&() const noexcept { return _M_path; } - - file_status - status() const - { return filesystem::status(_M_path); } - - file_status - status(error_code& __ec) const noexcept - { return filesystem::status(_M_path, __ec); } - - file_status - symlink_status() const - { return filesystem::symlink_status(_M_path); } - - file_status - symlink_status(error_code& __ec) const noexcept - { return filesystem::symlink_status(_M_path, __ec); } - - bool - operator< (const directory_entry& __rhs) const noexcept - { return _M_path < __rhs._M_path; } - - bool - operator==(const directory_entry& __rhs) const noexcept - { return _M_path == __rhs._M_path; } - - bool - operator!=(const directory_entry& __rhs) const noexcept - { return _M_path != __rhs._M_path; } - - bool - operator<=(const directory_entry& __rhs) const noexcept - { return _M_path <= __rhs._M_path; } - - bool - operator> (const directory_entry& __rhs) const noexcept - { return _M_path > __rhs._M_path; } - - bool - operator>=(const directory_entry& __rhs) const noexcept - { return _M_path >= __rhs._M_path; } - - private: - filesystem::path _M_path; - }; - - struct _Dir; - class recursive_directory_iterator; - - class directory_iterator - { - public: - typedef directory_entry value_type; - typedef ptrdiff_t difference_type; - typedef const directory_entry* pointer; - typedef const directory_entry& reference; - typedef input_iterator_tag iterator_category; - - directory_iterator() noexcept = default; - - explicit - directory_iterator(const path& __p) - : directory_iterator(__p, directory_options::none, nullptr) { } - - directory_iterator(const path& __p, directory_options __options) - : directory_iterator(__p, __options, nullptr) { } - - directory_iterator(const path& __p, error_code& __ec) noexcept - : directory_iterator(__p, directory_options::none, __ec) { } - - directory_iterator(const path& __p, - directory_options __options, error_code& __ec) noexcept - : directory_iterator(__p, __options, &__ec) { } - - directory_iterator(const directory_iterator& __rhs) = default; - - directory_iterator(directory_iterator&& __rhs) noexcept = default; - - ~directory_iterator() = default; - - directory_iterator& operator=(const directory_iterator& __rhs) = default; - directory_iterator& operator=(directory_iterator&& __rhs) noexcept = default; - - const directory_entry& operator*() const; - const directory_entry* operator->() const { return &**this; } - directory_iterator& operator++(); - directory_iterator& increment(error_code& __ec) noexcept; - - directory_iterator operator++(int) - { - auto __tmp = *this; - ++*this; - return __tmp; - } - - private: - directory_iterator(const path&, directory_options, error_code*); - - friend bool - operator==(const directory_iterator& __lhs, - const directory_iterator& __rhs); - - friend class recursive_directory_iterator; - - std::shared_ptr<_Dir> _M_dir; - }; - - inline directory_iterator - begin(directory_iterator __iter) { return __iter; } - - inline directory_iterator - end(directory_iterator) { return directory_iterator(); } - - inline bool - operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) - { - return !__rhs._M_dir.owner_before(__lhs._M_dir) - && !__lhs._M_dir.owner_before(__rhs._M_dir); - } - - inline bool - operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) - { return !(__lhs == __rhs); } - - class recursive_directory_iterator - { - public: - typedef directory_entry value_type; - typedef ptrdiff_t difference_type; - typedef const directory_entry* pointer; - typedef const directory_entry& reference; - typedef input_iterator_tag iterator_category; - - recursive_directory_iterator() noexcept = default; - - explicit - recursive_directory_iterator(const path& __p) - : recursive_directory_iterator(__p, directory_options::none, nullptr) { } - - recursive_directory_iterator(const path& __p, directory_options __options) - : recursive_directory_iterator(__p, __options, nullptr) { } - - recursive_directory_iterator(const path& __p, - directory_options __options, - error_code& __ec) noexcept - : recursive_directory_iterator(__p, __options, &__ec) { } - - recursive_directory_iterator(const path& __p, error_code& __ec) noexcept - : recursive_directory_iterator(__p, directory_options::none, &__ec) { } - - recursive_directory_iterator( - const recursive_directory_iterator&) = default; - - recursive_directory_iterator( - recursive_directory_iterator&&) noexcept = default; - - ~recursive_directory_iterator(); - - // observers - directory_options options() const { return _M_options; } - int depth() const; - bool recursion_pending() const { return _M_pending; } - - const directory_entry& operator*() const; - const directory_entry* operator->() const { return &**this; } - - // modifiers - recursive_directory_iterator& - operator=(const recursive_directory_iterator& __rhs) noexcept; - recursive_directory_iterator& - operator=(recursive_directory_iterator&& __rhs) noexcept; - - recursive_directory_iterator& operator++(); - recursive_directory_iterator& increment(error_code& __ec) noexcept; - - recursive_directory_iterator operator++(int) - { - auto __tmp = *this; - ++*this; - return __tmp; - } - - void pop(); - - void disable_recursion_pending() { _M_pending = false; } - - private: - recursive_directory_iterator(const path&, directory_options, error_code*); - - friend bool - operator==(const recursive_directory_iterator& __lhs, - const recursive_directory_iterator& __rhs); - - struct _Dir_stack; - std::shared_ptr<_Dir_stack> _M_dirs; - directory_options _M_options; - bool _M_pending; - }; - - inline recursive_directory_iterator - begin(recursive_directory_iterator __iter) { return __iter; } - - inline recursive_directory_iterator - end(recursive_directory_iterator) { return recursive_directory_iterator(); } - - inline bool - operator==(const recursive_directory_iterator& __lhs, - const recursive_directory_iterator& __rhs) - { - return !__rhs._M_dirs.owner_before(__lhs._M_dirs) - && !__lhs._M_dirs.owner_before(__rhs._M_dirs); - } - - inline bool - operator!=(const recursive_directory_iterator& __lhs, - const recursive_directory_iterator& __rhs) - { return !(__lhs == __rhs); } - -_GLIBCXX_END_NAMESPACE_CXX11 - - // @} group filesystem -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace v1 -} // namespace filesystem -} // namespace experimental -} // namespace std - -#endif // C++11 - -#endif // _GLIBCXX_EXPERIMENTAL_FS_DIR_H diff --git a/openflow/usr/include/c++/5/experimental/fs_fwd.h b/openflow/usr/include/c++/5/experimental/fs_fwd.h deleted file mode 100644 index dd6f5e6..0000000 --- a/openflow/usr/include/c++/5/experimental/fs_fwd.h +++ /dev/null @@ -1,290 +0,0 @@ -// Filesystem declarations -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/fs_fwd.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{experimental/filesystem} - */ - -#ifndef _GLIBCXX_EXPERIMENTAL_FS_FWD_H -#define _GLIBCXX_EXPERIMENTAL_FS_FWD_H 1 - -#if __cplusplus < 201103L -# include -#else - -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -namespace filesystem -{ -inline namespace v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#if _GLIBCXX_USE_CXX11_ABI - inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } -#endif - - /** - * @defgroup filesystem Filesystem - * @ingroup experimental - * - * Utilities for performing operations on file systems and their components, - * such as paths, regular files, and directories. - * - * @{ - */ - - class file_status; -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - class path; - class filesystem_error; - class directory_entry; - class directory_iterator; - class recursive_directory_iterator; -_GLIBCXX_END_NAMESPACE_CXX11 - - struct space_info - { - uintmax_t capacity; - uintmax_t free; - uintmax_t available; - }; - - enum class file_type : signed char { - none = 0, not_found = -1, regular = 1, directory = 2, symlink = 3, - block = 4, character = 5, fifo = 6, socket = 7, unknown = 8 - }; - - /// Bitmask type - enum class copy_options : unsigned short { - none = 0, - skip_existing = 1, overwrite_existing = 2, update_existing = 4, - recursive = 8, - copy_symlinks = 16, skip_symlinks = 32, - directories_only = 64, create_symlinks = 128, create_hard_links = 256 - }; - - constexpr copy_options - operator&(copy_options __x, copy_options __y) - { - using __utype = typename std::underlying_type::type; - return static_cast( - static_cast<__utype>(__x) & static_cast<__utype>(__y)); - } - - constexpr copy_options - operator|(copy_options __x, copy_options __y) - { - using __utype = typename std::underlying_type::type; - return static_cast( - static_cast<__utype>(__x) | static_cast<__utype>(__y)); - } - - constexpr copy_options - operator^(copy_options __x, copy_options __y) - { - using __utype = typename std::underlying_type::type; - return static_cast( - static_cast<__utype>(__x) ^ static_cast<__utype>(__y)); - } - - constexpr copy_options - operator~(copy_options __x) - { - using __utype = typename std::underlying_type::type; - return static_cast(~static_cast<__utype>(__x)); - } - - inline copy_options& - operator&=(copy_options& __x, copy_options __y) - { return __x = __x & __y; } - - inline copy_options& - operator|=(copy_options& __x, copy_options __y) - { return __x = __x | __y; } - - inline copy_options& - operator^=(copy_options& __x, copy_options __y) - { return __x = __x ^ __y; } - - - /// Bitmask type - enum class perms : unsigned { - none = 0, - owner_read = 0400, - owner_write = 0200, - owner_exec = 0100, - owner_all = 0700, - group_read = 040, - group_write = 020, - group_exec = 010, - group_all = 070, - others_read = 04, - others_write = 02, - others_exec = 01, - others_all = 07, - all = 0777, - set_uid = 04000, - set_gid = 02000, - sticky_bit = 01000, - mask = 07777, - unknown = 0xFFFF, - add_perms = 0x10000, - remove_perms = 0x20000, - resolve_symlinks = 0x40000 - }; - - constexpr perms - operator&(perms __x, perms __y) - { - using __utype = typename std::underlying_type::type; - return static_cast( - static_cast<__utype>(__x) & static_cast<__utype>(__y)); - } - - constexpr perms - operator|(perms __x, perms __y) - { - using __utype = typename std::underlying_type::type; - return static_cast( - static_cast<__utype>(__x) | static_cast<__utype>(__y)); - } - - constexpr perms - operator^(perms __x, perms __y) - { - using __utype = typename std::underlying_type::type; - return static_cast( - static_cast<__utype>(__x) ^ static_cast<__utype>(__y)); - } - - constexpr perms - operator~(perms __x) - { - using __utype = typename std::underlying_type::type; - return static_cast(~static_cast<__utype>(__x)); - } - - inline perms& - operator&=(perms& __x, perms __y) - { return __x = __x & __y; } - - inline perms& - operator|=(perms& __x, perms __y) - { return __x = __x | __y; } - - inline perms& - operator^=(perms& __x, perms __y) - { return __x = __x ^ __y; } - - // Bitmask type - enum class directory_options : unsigned char { - none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 - }; - - constexpr directory_options - operator&(directory_options __x, directory_options __y) - { - using __utype = typename std::underlying_type::type; - return static_cast( - static_cast<__utype>(__x) & static_cast<__utype>(__y)); - } - - constexpr directory_options - operator|(directory_options __x, directory_options __y) - { - using __utype = typename std::underlying_type::type; - return static_cast( - static_cast<__utype>(__x) | static_cast<__utype>(__y)); - } - - constexpr directory_options - operator^(directory_options __x, directory_options __y) - { - using __utype = typename std::underlying_type::type; - return static_cast( - static_cast<__utype>(__x) ^ static_cast<__utype>(__y)); - } - - constexpr directory_options - operator~(directory_options __x) - { - using __utype = typename std::underlying_type::type; - return static_cast(~static_cast<__utype>(__x)); - } - - inline directory_options& - operator&=(directory_options& __x, directory_options __y) - { return __x = __x & __y; } - - inline directory_options& - operator|=(directory_options& __x, directory_options __y) - { return __x = __x | __y; } - - inline directory_options& - operator^=(directory_options& __x, directory_options __y) - { return __x = __x ^ __y; } - - typedef chrono::time_point file_time_type; - - // operational functions - - void copy(const path& __from, const path& __to, copy_options __options); - void copy(const path& __from, const path& __to, copy_options __options, - error_code&) noexcept; - - bool copy_file(const path& __from, const path& __to, copy_options __option); - bool copy_file(const path& __from, const path& __to, copy_options __option, - error_code&) noexcept; - - path current_path(); - - file_status status(const path&); - file_status status(const path&, error_code&) noexcept; - - bool status_known(file_status) noexcept; - - file_status symlink_status(const path&); - file_status symlink_status(const path&, error_code&) noexcept; - - bool is_regular_file(file_status) noexcept; - bool is_symlink(file_status) noexcept; - - // @} group filesystem -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace v1 -} // namespace filesystem -} // namespace experimental -} // namespace std - -#endif // C++11 - -#endif // _GLIBCXX_EXPERIMENTAL_FS_FWD_H diff --git a/openflow/usr/include/c++/5/experimental/fs_ops.h b/openflow/usr/include/c++/5/experimental/fs_ops.h deleted file mode 100644 index 91b8902..0000000 --- a/openflow/usr/include/c++/5/experimental/fs_ops.h +++ /dev/null @@ -1,292 +0,0 @@ -// Filesystem operational functions -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your __option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/fs_fwd.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{experimental/filesystem} - */ - -#ifndef _GLIBCXX_EXPERIMENTAL_FS_OPS_H -#define _GLIBCXX_EXPERIMENTAL_FS_OPS_H 1 - -#if __cplusplus < 201103L -# include -#else - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -namespace filesystem -{ -inline namespace v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @ingroup filesystem - * @{ - */ - - path absolute(const path& __p, const path& __base = current_path()); - - path canonical(const path& __p, const path& __base = current_path()); - path canonical(const path& __p, error_code& __ec); - path canonical(const path& __p, const path& __base, error_code& __ec); - - inline void - copy(const path& __from, const path& __to) - { copy(__from, __to, copy_options::none); } - - inline void - copy(const path& __from, const path& __to, error_code& __ec) noexcept - { copy(__from, __to, copy_options::none, __ec); } - - void copy(const path& __from, const path& __to, copy_options __options); - void copy(const path& __from, const path& __to, copy_options __options, - error_code& __ec) noexcept; - - inline bool - copy_file(const path& __from, const path& __to) - { return copy_file(__from, __to, copy_options::none); } - - inline bool - copy_file(const path& __from, const path& __to, error_code& __ec) noexcept - { return copy_file(__from, __to, copy_options::none, __ec); } - - bool copy_file(const path& __from, const path& __to, copy_options __option); - bool copy_file(const path& __from, const path& __to, copy_options __option, - error_code& __ec) noexcept; - - void copy_symlink(const path& __existing_symlink, const path& __new_symlink); - void copy_symlink(const path& __existing_symlink, const path& __new_symlink, - error_code& __ec) noexcept; - - bool create_directories(const path& __p); - bool create_directories(const path& __p, error_code& __ec) noexcept; - - bool create_directory(const path& __p); - bool create_directory(const path& __p, error_code& __ec) noexcept; - - bool create_directory(const path& __p, const path& attributes); - bool create_directory(const path& __p, const path& attributes, - error_code& __ec) noexcept; - - void create_directory_symlink(const path& __to, const path& __new_symlink); - void create_directory_symlink(const path& __to, const path& __new_symlink, - error_code& __ec) noexcept; - - void create_hard_link(const path& __to, const path& __new_hard_link); - void create_hard_link(const path& __to, const path& __new_hard_link, - error_code& __ec) noexcept; - - void create_symlink(const path& __to, const path& __new_symlink); - void create_symlink(const path& __to, const path& __new_symlink, - error_code& __ec) noexcept; - - path current_path(); - path current_path(error_code& __ec); - void current_path(const path& __p); - void current_path(const path& __p, error_code& __ec) noexcept; - - inline bool - exists(file_status __s) noexcept - { return status_known(__s) && __s.type() != file_type::not_found; } - - inline bool - exists(const path& __p) - { return exists(status(__p)); } - - inline bool - exists(const path& __p, error_code& __ec) noexcept - { return exists(status(__p, __ec)); } - - bool - equivalent(const path& __p1, const path& __p2); - - bool - equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept; - - uintmax_t file_size(const path& __p); - uintmax_t file_size(const path& __p, error_code& __ec) noexcept; - - uintmax_t hard_link_count(const path& __p); - uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept; - - inline bool - is_block_file(file_status __s) noexcept - { return __s.type() == file_type::block; } - - inline bool - is_block_file(const path& __p) - { return is_block_file(status(__p)); } - - inline bool - is_block_file(const path& __p, error_code& __ec) noexcept - { return is_block_file(status(__p, __ec)); } - - inline bool - is_character_file(file_status __s) noexcept - { return __s.type() == file_type::character; } - - inline bool - is_character_file(const path& __p) - { return is_character_file(status(__p)); } - - inline bool - is_character_file(const path& __p, error_code& __ec) noexcept - { return is_character_file(status(__p, __ec)); } - - inline bool - is_directory(file_status __s) noexcept - { return __s.type() == file_type::directory; } - - inline bool - is_directory(const path& __p) - { return is_directory(status(__p)); } - - inline bool - is_directory(const path& __p, error_code& __ec) noexcept - { return is_directory(status(__p, __ec)); } - - bool is_empty(const path& __p); - bool is_empty(const path& __p, error_code& __ec) noexcept; - - inline bool - is_fifo(file_status __s) noexcept - { return __s.type() == file_type::fifo; } - - inline bool - is_fifo(const path& __p) - { return is_fifo(status(__p)); } - - inline bool - is_fifo(const path& __p, error_code& __ec) noexcept - { return is_fifo(status(__p, __ec)); } - - inline bool - is_other(file_status __s) noexcept - { - return exists(__s) && !is_regular_file(__s) && !is_directory(__s) - && !is_symlink(__s); - } - - inline bool - is_other(const path& __p) - { return is_other(status(__p)); } - - inline bool - is_other(const path& __p, error_code& __ec) noexcept - { return is_other(status(__p, __ec)); } - - inline bool - is_regular_file(file_status __s) noexcept - { return __s.type() == file_type::regular; } - - inline bool - is_regular_file(const path& __p) - { return is_regular_file(status(__p)); } - - inline bool - is_regular_file(const path& __p, error_code& __ec) noexcept - { return is_regular_file(status(__p, __ec)); } - - inline bool - is_socket(file_status __s) noexcept - { return __s.type() == file_type::socket; } - - inline bool - is_socket(const path& __p) - { return is_socket(status(__p)); } - - inline bool - is_socket(const path& __p, error_code& __ec) noexcept - { return is_socket(status(__p, __ec)); } - - inline bool - is_symlink(file_status __s) noexcept - { return __s.type() == file_type::symlink; } - - inline bool - is_symlink(const path& __p) - { return is_symlink(symlink_status(__p)); } - - inline bool - is_symlink(const path& __p, error_code& __ec) noexcept - { return is_symlink(symlink_status(__p, __ec)); } - - file_time_type last_write_time(const path& __p); - file_time_type last_write_time(const path& __p, error_code& __ec) noexcept; - void last_write_time(const path& __p, file_time_type __new_time); - void last_write_time(const path& __p, file_time_type __new_time, - error_code& __ec) noexcept; - - void permissions(const path& __p, perms __prms); - void permissions(const path& __p, perms __prms, error_code& __ec) noexcept; - - path read_symlink(const path& __p); - path read_symlink(const path& __p, error_code& __ec); - - bool remove(const path& __p); - bool remove(const path& __p, error_code& __ec) noexcept; - - uintmax_t remove_all(const path& __p); - uintmax_t remove_all(const path& __p, error_code& __ec) noexcept; - - void rename(const path& __from, const path& __to); - void rename(const path& __from, const path& __to, error_code& __ec) noexcept; - - void resize_file(const path& __p, uintmax_t __size); - void resize_file(const path& __p, uintmax_t __size, error_code& __ec) noexcept; - - space_info space(const path& __p); - space_info space(const path& __p, error_code& __ec) noexcept; - - file_status status(const path& __p); - file_status status(const path& __p, error_code& __ec) noexcept; - - inline bool status_known(file_status __s) noexcept - { return __s.type() != file_type::none; } - - file_status symlink_status(const path& __p); - file_status symlink_status(const path& __p, error_code& __ec) noexcept; - - path system_complete(const path& __p); - path system_complete(const path& __p, error_code& __ec); - - path temp_directory_path(); - path temp_directory_path(error_code& __ec); - - // @} group filesystem -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace v1 -} // namespace filesystem -} // namespace experimental -} // namespace std - -#endif // C++11 - -#endif // _GLIBCXX_EXPERIMENTAL_FS_OPS_H diff --git a/openflow/usr/include/c++/5/experimental/fs_path.h b/openflow/usr/include/c++/5/experimental/fs_path.h deleted file mode 100644 index 176918a..0000000 --- a/openflow/usr/include/c++/5/experimental/fs_path.h +++ /dev/null @@ -1,1024 +0,0 @@ -// Class filesystem::path -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/fs_path.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{experimental/filesystem} - */ - -#ifndef _GLIBCXX_EXPERIMENTAL_FS_PATH_H -#define _GLIBCXX_EXPERIMENTAL_FS_PATH_H 1 - -#if __cplusplus < 201103L -# include -#else - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) && !defined(__CYGWIN__) -# define _GLIBCXX_FILESYSTEM_IS_WINDOWS 1 -# include -#endif - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -namespace filesystem -{ -inline namespace v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION -_GLIBCXX_BEGIN_NAMESPACE_CXX11 - - /** - * @ingroup filesystem - * @{ - */ - - /// A filesystem path. - class path - { - template - struct __is_encoded_char : std::false_type { }; - - template> - using __is_path_iter_src - = __and_<__is_encoded_char, - std::is_base_of>; - - template - static __is_path_iter_src<_Iter> - __is_path_src(_Iter, int); - - template - static __is_encoded_char<_CharT> - __is_path_src(const basic_string<_CharT, _Traits, _Alloc>&, int); - - template - static std::false_type - __is_path_src(const _Unknown&, ...); - - template - struct __constructible_from; - - template - struct __constructible_from<_Iter, _Iter> - : __is_path_iter_src<_Iter> - { }; - - template - struct __constructible_from<_Source, void> - : decltype(__is_path_src(std::declval<_Source>(), 0)) - { }; - - template - using _Path = typename - std::enable_if<__and_<__not_>, - __constructible_from<_Tp1, _Tp2>>::value, - path>::type; - - template - static _Source - _S_range_begin(_Source __begin) { return __begin; } - - struct __null_terminated { }; - - template - static __null_terminated - _S_range_end(_Source) { return {}; } - - template - static const _CharT* - _S_range_begin(const basic_string<_CharT, _Traits, _Alloc>& __str) - { return __str.data(); } - - template - static const _CharT* - _S_range_end(const basic_string<_CharT, _Traits, _Alloc>& __str) - { return __str.data() + __str.size(); } - - template())), - typename _Val = typename std::iterator_traits<_Iter>::value_type> - using __value_type_is_char - = typename std::enable_if::value>::type; - - public: -#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS - typedef wchar_t value_type; - static constexpr value_type preferred_separator = L'\\'; -#else - typedef char value_type; - static constexpr value_type preferred_separator = '/'; -#endif - typedef std::basic_string string_type; - - // constructors and destructor - - path() noexcept { } - - path(const path& __p) = default; - - path(path&& __p) noexcept - : _M_pathname(std::move(__p._M_pathname)), _M_type(__p._M_type) - { - _M_split_cmpts(); - __p.clear(); - } - - template> - path(_Source const& __source) - : _M_pathname(_S_convert(_S_range_begin(__source), - _S_range_end(__source))) - { _M_split_cmpts(); } - - template> - path(_InputIterator __first, _InputIterator __last) - : _M_pathname(_S_convert(__first, __last)) - { _M_split_cmpts(); } - - template, - typename _Require2 = __value_type_is_char<_Source>> - path(_Source const& __source, const locale& __loc) - : _M_pathname(_S_convert_loc(_S_range_begin(__source), - _S_range_end(__source), __loc)) - { _M_split_cmpts(); } - - template, - typename _Require2 = __value_type_is_char<_InputIterator>> - path(_InputIterator __first, _InputIterator __last, const locale& __loc) - : _M_pathname(_S_convert_loc(__first, __last, __loc)) - { _M_split_cmpts(); } - - ~path() = default; - - // assignments - - path& operator=(const path& __p) = default; - path& operator=(path&& __p) noexcept; - - template - _Path<_Source>& - operator=(_Source const& __source) - { return *this = path(__source); } - - template - _Path<_Source>& - assign(_Source const& __source) - { return *this = path(__source); } - - template - _Path<_InputIterator, _InputIterator>& - assign(_InputIterator __first, _InputIterator __last) - { return *this = path(__first, __last); } - - // appends - - path& operator/=(const path& __p) { return _M_append(__p._M_pathname); } - - template - _Path<_Source>& - operator/=(_Source const& __source) - { return append(__source); } - - template - _Path<_Source>& - append(_Source const& __source) - { - return _M_append(_S_convert(_S_range_begin(__source), - _S_range_end(__source))); - } - - template - _Path<_InputIterator, _InputIterator>& - append(_InputIterator __first, _InputIterator __last) - { return _M_append(_S_convert(__first, __last)); } - - // concatenation - - path& operator+=(const path& __x); - path& operator+=(const string_type& __x); - path& operator+=(const value_type* __x); - path& operator+=(value_type __x); - - template - _Path<_Source>& - operator+=(_Source const& __x) { return concat(__x); } - - template - _Path<_CharT*, _CharT*>& - operator+=(_CharT __x); - - template - _Path<_Source>& - concat(_Source const& __x) - { return *this += _S_convert(_S_range_begin(__x), _S_range_end(__x)); } - - template - _Path<_InputIterator, _InputIterator>& - concat(_InputIterator __first, _InputIterator __last) - { return *this += _S_convert(__first, __last); } - - // modifiers - - void clear() noexcept { _M_pathname.clear(); _M_split_cmpts(); } - - path& make_preferred(); - path& remove_filename(); - path& replace_filename(const path& __replacement); - path& replace_extension(const path& __replacement = path()); - - void swap(path& __rhs) noexcept; - - // native format observers - - const string_type& native() const noexcept { return _M_pathname; } - const value_type* c_str() const noexcept { return _M_pathname.c_str(); } - operator string_type() const { return _M_pathname; } - - template, - typename _Allocator = std::allocator<_CharT>> - std::basic_string<_CharT, _Traits, _Allocator> - string(const _Allocator& __a = _Allocator()) const; - - std::string string() const; -#if _GLIBCXX_USE_WCHAR_T - std::wstring wstring() const; -#endif - std::string u8string() const; - std::u16string u16string() const; - std::u32string u32string() const; - - // generic format observers - template, - typename _Allocator = std::allocator<_CharT>> - std::basic_string<_CharT, _Traits, _Allocator> - generic_string(const _Allocator& __a = _Allocator()) const; - - std::string generic_string() const; -#if _GLIBCXX_USE_WCHAR_T - std::wstring generic_wstring() const; -#endif - std::string generic_u8string() const; - std::u16string generic_u16string() const; - std::u32string generic_u32string() const; - - // compare - - int compare(const path& __p) const noexcept; - int compare(const string_type& __s) const; - int compare(const value_type* __s) const; - - // decomposition - - path root_name() const; - path root_directory() const; - path root_path() const; - path relative_path() const; - path parent_path() const; - path filename() const; - path stem() const; - path extension() const; - - // query - - bool empty() const noexcept { return _M_pathname.empty(); } - bool has_root_name() const; - bool has_root_directory() const; - bool has_root_path() const; - bool has_relative_path() const; - bool has_parent_path() const; - bool has_filename() const; - bool has_stem() const; - bool has_extension() const; - bool is_absolute() const; - bool is_relative() const { return !is_absolute(); } - - // iterators - class iterator; - typedef iterator const_iterator; - - iterator begin() const; - iterator end() const; - - private: - enum class _Type : unsigned char { - _Multi, _Root_name, _Root_dir, _Filename - }; - - path(string_type __str, _Type __type) : _M_pathname(__str), _M_type(__type) - { - _GLIBCXX_DEBUG_ASSERT(!empty()); - _GLIBCXX_DEBUG_ASSERT(_M_type != _Type::_Multi); - } - - enum class _Split { _Stem, _Extension }; - - path& _M_append(const string_type& __str) - { - if (!_M_pathname.empty() && !_S_is_dir_sep(_M_pathname.back()) - && !__str.empty() && !_S_is_dir_sep(__str.front())) - _M_pathname += preferred_separator; - _M_pathname += __str; - _M_split_cmpts(); - return *this; - } - - pair _M_find_extension() const; - - template - struct _Cvt; - - static string_type - _S_convert(value_type* __src, __null_terminated) - { return string_type(__src); } - - static string_type - _S_convert(const value_type* __src, __null_terminated) - { return string_type(__src); } - - template - static string_type - _S_convert(_Iter __first, _Iter __last) - { - using __value_type = typename std::iterator_traits<_Iter>::value_type; - return _Cvt<__value_type>::_S_convert(__first, __last); - } - - template - static string_type - _S_convert(_InputIterator __src, __null_terminated) - { - using _Tp = typename std::iterator_traits<_InputIterator>::value_type; - std::basic_string<_Tp> __tmp; - while (*__src != _Tp{}) - __tmp.push_back(*__src++); - return _S_convert(__tmp.data(), __tmp.data() + __tmp.size()); - } - - static string_type - _S_convert_loc(const char* __first, const char* __last, - const std::locale& __loc); - - template - static string_type - _S_convert_loc(_Iter __first, _Iter __last, const std::locale& __loc) - { - const std::string __str(__first, __last); - return _S_convert_loc(__str.data(), __str.data()+__str.size(), __loc); - } - - template - static string_type - _S_convert_loc(_InputIterator __src, __null_terminated, - const std::locale& __loc) - { - std::string __tmp; - while (*__src != '\0') - __tmp.push_back(*__src++); - return _S_convert_loc(__tmp.data(), __tmp.data()+__tmp.size(), __loc); - } - - bool _S_is_dir_sep(value_type __ch) - { -#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS - return __ch == L'/' || __ch == preferred_separator; -#else - return __ch == '/'; -#endif - } - - void _M_split_cmpts(); - void _M_trim(); - void _M_add_root_name(size_t __n); - void _M_add_root_dir(size_t __pos); - void _M_add_filename(size_t __pos, size_t __n); - - string_type _M_pathname; - - struct _Cmpt; - using _List = _GLIBCXX_STD_C::vector<_Cmpt>; - _List _M_cmpts; // empty unless _M_type == _Type::_Multi - _Type _M_type = _Type::_Multi; - }; - - inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); } - - size_t hash_value(const path& __p) noexcept; - - /// Compare paths - inline bool operator<(const path& __lhs, const path& __rhs) noexcept - { return __lhs.compare(__rhs) < 0; } - - /// Compare paths - inline bool operator<=(const path& __lhs, const path& __rhs) noexcept - { return !(__rhs < __lhs); } - - /// Compare paths - inline bool operator>(const path& __lhs, const path& __rhs) noexcept - { return __rhs < __lhs; } - - /// Compare paths - inline bool operator>=(const path& __lhs, const path& __rhs) noexcept - { return !(__lhs < __rhs); } - - /// Compare paths - inline bool operator==(const path& __lhs, const path& __rhs) noexcept - { return __lhs.compare(__rhs) == 0; } - - /// Compare paths - inline bool operator!=(const path& __lhs, const path& __rhs) noexcept - { return !(__lhs == __rhs); } - - /// Append one path to another - inline path operator/(const path& __lhs, const path& __rhs) - { return path(__lhs) /= __rhs; } - - /// Write a path to a stream - template - basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) - { - auto __tmp = __p.string<_CharT, _Traits>(); - using __quoted_string - = std::__detail::_Quoted_string; - __os << __quoted_string{__tmp, '"', '\\'}; - return __os; - } - - /// Read a path from a stream - template - basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) - { - basic_string<_CharT, _Traits> __tmp; - using __quoted_string - = std::__detail::_Quoted_string; - if (__is >> __quoted_string{ __tmp, '"', '\\' }) - __p = std::move(__tmp); - return __is; - } - - // TODO constrain with _Path and __value_type_is_char - template - inline path - u8path(const _Source& __source) - { -#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS - return path{ path::string_type{__source} }; -#else - return path{ __source }; -#endif - } - - // TODO constrain with _Path and __value_type_is_char - template - inline path - u8path(_InputIterator __first, _InputIterator __last) - { -#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS - return path{ path::string_type{__first, __last} }; -#else - return path{ __first, __last }; -#endif - } - - class filesystem_error : public std::system_error - { - public: - filesystem_error(const string& __what_arg, error_code __ec) - : system_error(__ec, __what_arg) { } - - filesystem_error(const string& __what_arg, const path& __p1, - error_code __ec) - : system_error(__ec, __what_arg), _M_path1(__p1) { } - - filesystem_error(const string& __what_arg, const path& __p1, - const path& __p2, error_code __ec) - : system_error(__ec, __what_arg), _M_path1(__p1), _M_path2(__p2) - { } - - ~filesystem_error(); - - const path& path1() const noexcept { return _M_path1; } - const path& path2() const noexcept { return _M_path2; } - const char* what() const noexcept { return _M_what.c_str(); } - - private: - std::string _M_gen_what(); - - path _M_path1; - path _M_path2; - std::string _M_what = _M_gen_what(); - }; - - template<> - struct path::__is_encoded_char : std::true_type - { using value_type = char; }; - - template<> - struct path::__is_encoded_char : std::true_type - { using value_type = wchar_t; }; - - template<> - struct path::__is_encoded_char : std::true_type - { using value_type = char16_t; }; - - template<> - struct path::__is_encoded_char : std::true_type - { using value_type = char32_t; }; - - struct path::_Cmpt : path - { - _Cmpt(string_type __s, _Type __t, size_t __pos) - : path(std::move(__s), __t), _M_pos(__pos) { } - - _Cmpt() : _M_pos(-1) { } - - size_t _M_pos; - }; - - // specialize _Cvt for degenerate 'noconv' case - template<> - struct path::_Cvt - { - template - static string_type - _S_convert(_Iter __first, _Iter __last) - { return string_type{__first, __last}; } - }; - - template - struct path::_Cvt - { -#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS - static string_type - _S_wconvert(const char* __f, const char* __l, true_type) - { - using _Cvt = std::codecvt; - const auto& __cvt = std::use_facet<_Cvt>(std::locale{}); - std::wstring __wstr; - if (__str_codecvt_in(__f, __l, __wstr, __cvt)) - return __wstr; - _GLIBCXX_THROW_OR_ABORT(filesystem_error( - "Cannot convert character sequence", - std::make_error_code(errc::illegal_byte_sequence))); - } - - static string_type - _S_wconvert(const _CharT* __f, const _CharT* __l, false_type) - { - std::codecvt_utf8<_CharT> __cvt; - std::string __str; - if (__str_codecvt_out(__f, __l, __str, __cvt)) - { - const char* __f2 = __str.data(); - const char* __l2 = __f2 + __str.size(); - std::codecvt_utf8 __wcvt; - std::wstring __wstr; - if (__str_codecvt_in(__f2, __l2, __wstr, __wcvt)) - return __wstr; - } - _GLIBCXX_THROW_OR_ABORT(filesystem_error( - "Cannot convert character sequence", - std::make_error_code(errc::illegal_byte_sequence))); - } - - static string_type - _S_convert(const _CharT* __f, const _CharT* __l) - { - return _S_wconvert(__f, __l, is_same<_CharT, char>{}); - } -#else - static string_type - _S_convert(const _CharT* __f, const _CharT* __l) - { - std::codecvt_utf8<_CharT> __cvt; - std::string __str; - if (__str_codecvt_out(__f, __l, __str, __cvt)) - return __str; - _GLIBCXX_THROW_OR_ABORT(filesystem_error( - "Cannot convert character sequence", - std::make_error_code(errc::illegal_byte_sequence))); - } -#endif - - static string_type - _S_convert(_CharT* __f, _CharT* __l) - { - return _S_convert(const_cast(__f), - const_cast(__l)); - } - - template - static string_type - _S_convert(_Iter __first, _Iter __last) - { - const std::basic_string<_CharT> __str(__first, __last); - return _S_convert(__str.data(), __str.data() + __str.size()); - } - - template - static string_type - _S_convert(__gnu_cxx::__normal_iterator<_Iter, _Cont> __first, - __gnu_cxx::__normal_iterator<_Iter, _Cont> __last) - { return _S_convert(__first.base(), __last.base()); } - }; - - /// An iterator for the components of a path - class path::iterator - { - public: - using difference_type = std::ptrdiff_t; - using value_type = path; - using reference = const path&; - using pointer = const path*; - using iterator_category = std::bidirectional_iterator_tag; - - iterator() : _M_path(nullptr), _M_cur(), _M_at_end() { } - - iterator(const iterator&) = default; - iterator& operator=(const iterator&) = default; - - reference operator*() const; - pointer operator->() const { return std::__addressof(**this); } - - iterator& operator++(); - iterator operator++(int) { auto __tmp = *this; ++_M_cur; return __tmp; } - - iterator& operator--(); - iterator operator--(int) { auto __tmp = *this; --_M_cur; return __tmp; } - - friend bool operator==(const iterator& __lhs, const iterator& __rhs) - { return __lhs._M_equals(__rhs); } - - friend bool operator!=(const iterator& __lhs, const iterator& __rhs) - { return !__lhs._M_equals(__rhs); } - - private: - friend class path; - - iterator(const path* __path, path::_List::const_iterator __iter) - : _M_path(__path), _M_cur(__iter), _M_at_end() - { } - - iterator(const path* __path, bool __at_end) - : _M_path(__path), _M_cur(), _M_at_end(__at_end) - { } - - bool _M_equals(iterator) const; - - const path* _M_path; - path::_List::const_iterator _M_cur; - bool _M_at_end; // only used when type != _Multi - }; - - - inline path& - path::operator=(path&& __p) noexcept - { - _M_pathname = std::move(__p._M_pathname); - _M_cmpts = std::move(__p._M_cmpts); - _M_type = __p._M_type; - __p.clear(); - return *this; - } - - inline path& - path::operator+=(const path& __p) - { - return operator+=(__p.native()); - } - - inline path& - path::operator+=(const string_type& __x) - { - _M_pathname += __x; - _M_split_cmpts(); - return *this; - } - - inline path& - path::operator+=(const value_type* __x) - { - _M_pathname += __x; - _M_split_cmpts(); - return *this; - } - - inline path& - path::operator+=(value_type __x) - { - _M_pathname += __x; - _M_split_cmpts(); - return *this; - } - - template - inline path::_Path<_CharT*, _CharT*>& - path::operator+=(_CharT __x) - { - auto* __addr = std::__addressof(__x); - return concat(__addr, __addr + 1); - } - - inline path& - path::make_preferred() - { -#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS - std::replace(_M_pathname.begin(), _M_pathname.end(), L'/', - preferred_separator); -#endif - return *this; - } - - inline void path::swap(path& __rhs) noexcept - { - _M_pathname.swap(__rhs._M_pathname); - _M_cmpts.swap(__rhs._M_cmpts); - std::swap(_M_type, __rhs._M_type); - } - - template - inline std::basic_string<_CharT, _Traits, _Allocator> - path::string(const _Allocator& __a) const - { - if (is_same<_CharT, value_type>::value) - return { _M_pathname.begin(), _M_pathname.end(), __a }; - - const value_type* __first = _M_pathname.data(); - const value_type* __last = __first + _M_pathname.size(); - -#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS - using _CharAlloc = __alloc_rebind<_Allocator, char>; - using _String = basic_string, _CharAlloc>; - using _WString = basic_string<_CharT, _Traits, _Allocator>; - - // use codecvt_utf8 to convert native string to UTF-8 - codecvt_utf8 __cvt; - _String __u8str{_CharAlloc{__a}}; - if (__str_codecvt_out(__first, __last, __u8str, __cvt)) - { - struct - { - const _String* - operator()(const _String& __from, _String&, true_type) - { return std::__addressof(__from); } - - _WString* - operator()(const _String& __from, _WString& __to, false_type) - { - // use codecvt_utf8<_CharT> to convert UTF-8 to wide string - codecvt_utf8<_CharT> __cvt; - const char* __f = __from.data(); - const char* __l = __f + __from.size(); - if (__str_codecvt_in(__f, __l, __to, __cvt)) - return std::__addressof(__to); - return nullptr; - } - } __dispatch; - _WString __wstr; - if (auto* __p = __dispatch(__u8str, __wstr, is_same<_CharT, char>{})) - return *__p; - } -#else - codecvt_utf8<_CharT> __cvt; - basic_string<_CharT, _Traits, _Allocator> __wstr{__a}; - if (__str_codecvt_in(__first, __last, __wstr, __cvt)) - return __wstr; -#endif - _GLIBCXX_THROW_OR_ABORT(filesystem_error( - "Cannot convert character sequence", - std::make_error_code(errc::illegal_byte_sequence))); - } - - inline std::string - path::string() const { return string(); } - -#if _GLIBCXX_USE_WCHAR_T - inline std::wstring - path::wstring() const { return string(); } -#endif - - inline std::string - path::u8string() const - { -#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS - std::string __str; - // convert from native encoding to UTF-8 - codecvt_utf8 __cvt; - const value_type* __first = _M_pathname.data(); - const value_type* __last = __first + _M_pathname.size(); - if (__str_codecvt_out(__first, __last, __str, __cvt)) - return __str; - _GLIBCXX_THROW_OR_ABORT(filesystem_error( - "Cannot convert character sequence", - std::make_error_code(errc::illegal_byte_sequence))); -#else - return _M_pathname; -#endif - } - - inline std::u16string - path::u16string() const { return string(); } - - inline std::u32string - path::u32string() const { return string(); } - -#ifndef _GLIBCXX_FILESYSTEM_IS_WINDOWS - template - inline std::basic_string<_CharT, _Traits, _Allocator> - path::generic_string(const _Allocator& __a) const - { return string<_CharT, _Traits, _Allocator>(__a); } - - inline std::string - path::generic_string() const { return string(); } - -#if _GLIBCXX_USE_WCHAR_T - inline std::wstring - path::generic_wstring() const { return wstring(); } -#endif - - inline std::string - path::generic_u8string() const { return u8string(); } - - inline std::u16string - path::generic_u16string() const { return u16string(); } - - inline std::u32string - path::generic_u32string() const { return u32string(); } -#endif - - inline int - path::compare(const string_type& __s) const { return compare(path(__s)); } - - inline int - path::compare(const value_type* __s) const { return compare(path(__s)); } - - inline path - path::filename() const { return empty() ? path() : *--end(); } - - inline path - path::stem() const - { - auto ext = _M_find_extension(); - if (ext.first && ext.second != 0) - return path{ext.first->substr(0, ext.second)}; - return {}; - } - - inline path - path::extension() const - { - auto ext = _M_find_extension(); - if (ext.first && ext.second != string_type::npos) - return path{ext.first->substr(ext.second)}; - return {}; - } - - inline bool - path::has_stem() const - { - auto ext = _M_find_extension(); - return ext.first && ext.second != 0; - } - - inline bool - path::has_extension() const - { - auto ext = _M_find_extension(); - return ext.first && ext.second != string_type::npos; - } - - inline bool - path::is_absolute() const - { -#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS - return has_root_name(); -#else - return has_root_directory(); -#endif - } - - inline path::iterator - path::begin() const - { - if (_M_type == _Type::_Multi) - return iterator(this, _M_cmpts.begin()); - return iterator(this, false); - } - - inline path::iterator - path::end() const - { - if (_M_type == _Type::_Multi) - return iterator(this, _M_cmpts.end()); - return iterator(this, true); - } - - inline path::iterator& - path::iterator::operator++() - { - _GLIBCXX_DEBUG_ASSERT(_M_path != nullptr); - if (_M_path->_M_type == _Type::_Multi) - { - _GLIBCXX_DEBUG_ASSERT(_M_cur != _M_path->_M_cmpts.end()); - ++_M_cur; - } - else - { - _GLIBCXX_DEBUG_ASSERT(!_M_at_end); - _M_at_end = true; - } - return *this; - } - - inline path::iterator& - path::iterator::operator--() - { - _GLIBCXX_DEBUG_ASSERT(_M_path != nullptr); - if (_M_path->_M_type == _Type::_Multi) - { - _GLIBCXX_DEBUG_ASSERT(_M_cur != _M_path->_M_cmpts.begin()); - --_M_cur; - } - else - { - _GLIBCXX_DEBUG_ASSERT(_M_at_end); - _M_at_end = false; - } - return *this; - } - - inline path::iterator::reference - path::iterator::operator*() const - { - _GLIBCXX_DEBUG_ASSERT(_M_path != nullptr); - if (_M_path->_M_type == _Type::_Multi) - { - _GLIBCXX_DEBUG_ASSERT(_M_cur != _M_path->_M_cmpts.end()); - return *_M_cur; - } - return *_M_path; - } - - inline bool - path::iterator::_M_equals(iterator __rhs) const - { - if (_M_path != __rhs._M_path) - return false; - if (_M_path == nullptr) - return true; - if (_M_path->_M_type == path::_Type::_Multi) - return _M_cur == __rhs._M_cur; - return _M_at_end == __rhs._M_at_end; - } - - // @} group filesystem -_GLIBCXX_END_NAMESPACE_CXX11 -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace v1 -} // namespace filesystem -} // namespace experimental -} // namespace std - -#endif // C++11 - -#endif // _GLIBCXX_EXPERIMENTAL_FS_PATH_H diff --git a/openflow/usr/include/c++/5/experimental/functional b/openflow/usr/include/c++/5/experimental/functional deleted file mode 100644 index 40d3bd4..0000000 --- a/openflow/usr/include/c++/5/experimental/functional +++ /dev/null @@ -1,440 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/functional - * This is a TS C++ Library header. - */ - -#ifndef _GLIBCXX_EXPERIMENTAL_FUNCTIONAL -#define _GLIBCXX_EXPERIMENTAL_FUNCTIONAL 1 - -#pragma GCC system_header - -#if __cplusplus <= 201103L -# include -#else - -#include -#include -#include -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -inline namespace fundamentals_v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // See C++14 §20.9.9, Function object binders - - /// Variable template for std::is_bind_expression - template - constexpr bool is_bind_expression_v = std::is_bind_expression<_Tp>::value; - - /// Variable template for std::is_placeholder - template - constexpr int is_placeholder_v = std::is_placeholder<_Tp>::value; - -#define __cpp_lib_experimental_boyer_moore_searching 201411 - - // Searchers - - template> - class default_searcher - { - public: - default_searcher(_ForwardIterator1 __pat_first, - _ForwardIterator1 __pat_last, - _BinaryPredicate __pred = _BinaryPredicate()) - : _M_m(__pat_first, __pat_last, std::move(__pred)) - { } - - template - _ForwardIterator2 - operator()(_ForwardIterator2 __first, _ForwardIterator2 __last) const - { - return std::search(__first, __last, - std::get<0>(_M_m), std::get<1>(_M_m), - std::get<2>(_M_m)); - } - - private: - std::tuple<_ForwardIterator1, _ForwardIterator1, _BinaryPredicate> _M_m; - }; - - template - struct __boyer_moore_map_base - { - template - __boyer_moore_map_base(_RAIter __pat, size_t __patlen, - _Hash&& __hf, _Pred&& __pred) - : _M_bad_char{ __patlen, std::move(__hf), std::move(__pred) } - { - if (__patlen > 0) - for (__diff_type __i = 0; __i < __patlen - 1; ++__i) - _M_bad_char[__pat[__i]] = __patlen - 1 - __i; - } - - using __diff_type = _Tp; - - __diff_type - _M_lookup(_Key __key, __diff_type __not_found) const - { - auto __iter = _M_bad_char.find(__key); - if (__iter == _M_bad_char.end()) - return __not_found; - return __iter->second; - } - - _Pred - _M_pred() const { return _M_bad_char.key_eq(); } - - std::unordered_map<_Key, _Tp, _Hash, _Pred> _M_bad_char; - }; - - template - struct __boyer_moore_array_base - { - template - __boyer_moore_array_base(_RAIter __pat, size_t __patlen, - _Unused&&, _Pred&& __pred) - : _M_bad_char{ {}, std::move(__pred) } - { - std::get<0>(_M_bad_char).fill(__patlen); - if (__patlen > 0) - for (__diff_type __i = 0; __i < __patlen - 1; ++__i) - { - auto __ch = __pat[__i]; - using _UCh = std::make_unsigned_t; - auto __uch = static_cast<_UCh>(__ch); - std::get<0>(_M_bad_char)[__uch] = __patlen - 1 - __i; - } - } - - using __diff_type = _Tp; - - template - __diff_type - _M_lookup(_Key __key, __diff_type __not_found) const - { - auto __ukey = static_cast>(__key); - if (__ukey >= _Len) - return __not_found; - return std::get<0>(_M_bad_char)[__ukey]; - } - - const _Pred& - _M_pred() const { return std::get<1>(_M_bad_char); } - - std::tuple, _Pred> _M_bad_char; - }; - - template - struct __is_std_equal_to : std::false_type { }; - - template<> - struct __is_std_equal_to> : std::true_type { }; - - // Use __boyer_moore_array_base when pattern consists of narrow characters - // and uses std::equal_to as the predicate. - template::value_type, - typename _Diff = typename iterator_traits<_RAIter>::difference_type> - using __boyer_moore_base_t - = std::conditional_t::value - && __is_std_equal_to<_Pred>::value, - __boyer_moore_array_base<_Diff, 256, _Pred>, - __boyer_moore_map_base<_Val, _Diff, _Hash, _Pred>>; - - template::value_type>, - typename _BinaryPredicate = std::equal_to<>> - class boyer_moore_searcher - : __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate> - { - using _Base = __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>; - using typename _Base::__diff_type; - - public: - boyer_moore_searcher(_RAIter __pat_first, _RAIter __pat_last, - _Hash __hf = _Hash(), - _BinaryPredicate __pred = _BinaryPredicate()); - - template - _RandomAccessIterator2 - operator()(_RandomAccessIterator2 __first, - _RandomAccessIterator2 __last) const; - - private: - bool - _M_is_prefix(_RAIter __word, __diff_type __len, - __diff_type __pos) - { - const auto& __pred = this->_M_pred(); - __diff_type __suffixlen = __len - __pos; - for (__diff_type __i = 0; __i < __suffixlen; ++__i) - if (!__pred(__word[__i], __word[__pos + __i])) - return false; - return true; - } - - __diff_type - _M_suffix_length(_RAIter __word, __diff_type __len, - __diff_type __pos) - { - const auto& __pred = this->_M_pred(); - __diff_type __i = 0; - while (__pred(__word[__pos - __i], __word[__len - 1 - __i]) - && __i < __pos) - { - ++__i; - } - return __i; - } - - template - __diff_type - _M_bad_char_shift(_Tp __c) const - { return this->_M_lookup(__c, _M_pat_end - _M_pat); } - - _RAIter _M_pat; - _RAIter _M_pat_end; - std::vector<__diff_type> _M_good_suffix; - }; - - template::value_type>, - typename _BinaryPredicate = std::equal_to<>> - class boyer_moore_horspool_searcher - : __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate> - { - using _Base = __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>; - using typename _Base::__diff_type; - - public: - boyer_moore_horspool_searcher(_RAIter __pat, - _RAIter __pat_end, - _Hash __hf = _Hash(), - _BinaryPredicate __pred - = _BinaryPredicate()) - : _Base(__pat, __pat_end - __pat, std::move(__hf), std::move(__pred)), - _M_pat(__pat), _M_pat_end(__pat_end) - { } - - template - _RandomAccessIterator2 - operator()(_RandomAccessIterator2 __first, - _RandomAccessIterator2 __last) const - { - const auto& __pred = this->_M_pred(); - auto __patlen = _M_pat_end - _M_pat; - if (__patlen == 0) - return __first; - auto __len = __last - __first; - while (__len >= __patlen) - { - for (auto __scan = __patlen - 1; - __pred(__first[__scan], _M_pat[__scan]); --__scan) - if (__scan == 0) - return __first; - auto __shift = _M_bad_char_shift(__first[__patlen - 1]); - __len -= __shift; - __first += __shift; - } - return __last; - } - - private: - template - __diff_type - _M_bad_char_shift(_Tp __c) const - { return this->_M_lookup(__c, _M_pat_end - _M_pat); } - - _RAIter _M_pat; - _RAIter _M_pat_end; - }; - - /// Generator function for default_searcher - template> - inline default_searcher<_ForwardIterator, _BinaryPredicate> - make_default_searcher(_ForwardIterator __pat_first, - _ForwardIterator __pat_last, - _BinaryPredicate __pred = _BinaryPredicate()) - { return { __pat_first, __pat_last, __pred }; } - - /// Generator function for boyer_moore_searcher - template::value_type>, - typename _BinaryPredicate = equal_to<>> - inline boyer_moore_searcher<_RAIter, _Hash, _BinaryPredicate> - make_boyer_moore_searcher(_RAIter __pat_first, _RAIter __pat_last, - _Hash __hf = _Hash(), - _BinaryPredicate __pred = _BinaryPredicate()) - { return { __pat_first, __pat_last, std::move(__hf), std::move(__pred) }; } - - /// Generator function for boyer_moore_horspool_searcher - template::value_type>, - typename _BinaryPredicate = equal_to<>> - inline boyer_moore_horspool_searcher<_RAIter, _Hash, _BinaryPredicate> - make_boyer_moore_horspool_searcher(_RAIter __pat_first, _RAIter __pat_last, - _Hash __hf = _Hash(), - _BinaryPredicate __pred - = _BinaryPredicate()) - { return { __pat_first, __pat_last, std::move(__hf), std::move(__pred) }; } - - template - boyer_moore_searcher<_RAIter, _Hash, _BinaryPredicate>:: - boyer_moore_searcher(_RAIter __pat, _RAIter __pat_end, - _Hash __hf, _BinaryPredicate __pred) - : _Base(__pat, __pat_end - __pat, std::move(__hf), std::move(__pred)), - _M_pat(__pat), _M_pat_end(__pat_end), _M_good_suffix(__pat_end - __pat) - { - auto __patlen = __pat_end - __pat; - if (__patlen == 0) - return; - __diff_type __last_prefix = __patlen - 1; - for (__diff_type __p = __patlen - 1; __p >= 0; --__p) - { - if (_M_is_prefix(__pat, __patlen, __p + 1)) - __last_prefix = __p + 1; - _M_good_suffix[__p] = __last_prefix + (__patlen - 1 - __p); - } - for (__diff_type __p = 0; __p < __patlen - 1; ++__p) - { - auto __slen = _M_suffix_length(__pat, __patlen, __p); - auto __pos = __patlen - 1 - __slen; - if (!__pred(__pat[__p - __slen], __pat[__pos])) - _M_good_suffix[__pos] = __patlen - 1 - __p + __slen; - } - } - - template - template - _RandomAccessIterator2 - boyer_moore_searcher<_RAIter, _Hash, _BinaryPredicate>:: - operator()(_RandomAccessIterator2 __first, - _RandomAccessIterator2 __last) const - { - auto __patlen = _M_pat_end - _M_pat; - if (__patlen == 0) - return __first; - const auto& __pred = this->_M_pred(); - __diff_type __i = __patlen - 1; - auto __stringlen = __last - __first; - while (__i < __stringlen) - { - __diff_type __j = __patlen - 1; - while (__j >= 0 && __pred(__first[__i], _M_pat[__j])) - { - --__i; - --__j; - } - if (__j < 0) - return __first + __i + 1; - __i += std::max(_M_bad_char_shift(__first[__i]), - _M_good_suffix[__j]); - } - return __last; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace fundamentals_v1 - -inline namespace fundamentals_v2 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#define __cpp_lib_experimental_not_fn 201406 - - /// Generalized negator. - template - class _Not_fn - { - _Fn _M_fn; - - public: - template - explicit - _Not_fn(_Fn2&& __fn) : _M_fn(std::forward<_Fn2>(__fn)) { } - - _Not_fn(const _Not_fn& __fn) = default; - _Not_fn(_Not_fn&& __fn) = default; - _Not_fn& operator=(const _Not_fn& __fn) = default; - _Not_fn& operator=(_Not_fn&& __fn) = default; - ~_Not_fn() = default; - - template - auto - operator()(_Args&&... __args) - noexcept(noexcept(!_M_fn(std::forward<_Args>(__args)...))) - -> decltype(!_M_fn(std::forward<_Args>(__args)...)) - { return !_M_fn(std::forward<_Args>(__args)...); } - - template - auto - operator()(_Args&&... __args) const - noexcept(noexcept(!_M_fn(std::forward<_Args>(__args)...))) - -> decltype(!_M_fn(std::forward<_Args>(__args)...)) - { return !_M_fn(std::forward<_Args>(__args)...); } - - template - auto - operator()(_Args&&... __args) volatile - noexcept(noexcept(!_M_fn(std::forward<_Args>(__args)...))) - -> decltype(!_M_fn(std::forward<_Args>(__args)...)) - { return !_M_fn(std::forward<_Args>(__args)...); } - - template - auto - operator()(_Args&&... __args) const volatile - noexcept(noexcept(!_M_fn(std::forward<_Args>(__args)...))) - -> decltype(!_M_fn(std::forward<_Args>(__args)...)) - { return !_M_fn(std::forward<_Args>(__args)...); } - }; - - /// [func.not_fn] Function template not_fn - template - inline auto - not_fn(_Fn&& __fn) - noexcept(std::is_nothrow_constructible, _Fn&&>::value) - { - using __maybe_type = _Maybe_wrap_member_pointer>; - return _Not_fn{std::forward<_Fn>(__fn)}; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace fundamentals_v2 -} // namespace experimental -} // namespace std - -#endif // C++14 - -#endif // _GLIBCXX_EXPERIMENTAL_FUNCTIONAL diff --git a/openflow/usr/include/c++/5/experimental/optional b/openflow/usr/include/c++/5/experimental/optional deleted file mode 100644 index f6e3fa0..0000000 --- a/openflow/usr/include/c++/5/experimental/optional +++ /dev/null @@ -1,864 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/optional - * This is a TS C++ Library header. - */ - -#ifndef _GLIBCXX_EXPERIMENTAL_OPTIONAL -#define _GLIBCXX_EXPERIMENTAL_OPTIONAL 1 - -/** - * @defgroup experimental Experimental - * - * Components specified by various Technical Specifications. - * - * As indicated by the std::experimental namespace and the header paths, - * the contents of these Technical Specifications are experimental and not - * part of the C++ standard. As such the interfaces and implementations may - * change in the future, and there is no guarantee of compatibility - * between different GCC releases for these features. - */ - -#if __cplusplus <= 201103L -# include -#else - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -inline namespace fundamentals_v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @defgroup optional Optional values - * @ingroup experimental - * - * Class template for optional values and surrounding facilities, as - * described in n3793 "A proposal to add a utility class to represent - * optional objects (Revision 5)". - * - * @{ - */ - -#define __cpp_lib_experimental_optional 201411 - - // All subsequent [X.Y.n] references are against n3793. - - // [X.Y.4] - template - class optional; - - // [X.Y.5] - /// Tag type for in-place construction. - struct in_place_t { }; - - /// Tag for in-place construction. - constexpr in_place_t in_place { }; - - // [X.Y.6] - /// Tag type to disengage optional objects. - struct nullopt_t - { - // Do not user-declare default constructor at all for - // optional_value = {} syntax to work. - // nullopt_t() = delete; - - // Used for constructing nullopt. - enum class _Construct { _Token }; - - // Must be constexpr for nullopt_t to be literal. - explicit constexpr nullopt_t(_Construct) { } - }; - - // [X.Y.6] - /// Tag to disengage optional objects. - constexpr nullopt_t nullopt { nullopt_t::_Construct::_Token }; - - // [X.Y.7] - /** - * @brief Exception class thrown when a disengaged optional object is - * dereferenced. - * @ingroup exceptions - */ - class bad_optional_access : public logic_error - { - public: - bad_optional_access() : logic_error("bad optional access") { } - - // XXX This constructor is non-standard. Should not be inline - explicit bad_optional_access(const char* __arg) : logic_error(__arg) { } - - virtual ~bad_optional_access() noexcept = default; - }; - - void - __throw_bad_optional_access(const char*) - __attribute__((__noreturn__)); - - // XXX Does not belong here. - inline void - __throw_bad_optional_access(const char* __s) - { _GLIBCXX_THROW_OR_ABORT(bad_optional_access(__s)); } - - template - struct _Has_addressof_mem : std::false_type { }; - - template - struct _Has_addressof_mem<_Tp, - __void_t().operator&() )> - > - : std::true_type { }; - - template - struct _Has_addressof_free : std::false_type { }; - - template - struct _Has_addressof_free<_Tp, - __void_t()) )> - > - : std::true_type { }; - - /** - * @brief Trait that detects the presence of an overloaded unary operator&. - * - * Practically speaking this detects the presence of such an operator when - * called on a const-qualified lvalue (i.e. - * declval<_Tp * const&>().operator&()). - */ - template - struct _Has_addressof - : std::__or_<_Has_addressof_mem<_Tp>, _Has_addressof_free<_Tp>>::type - { }; - - /** - * @brief An overload that attempts to take the address of an lvalue as a - * constant expression. Falls back to __addressof in the presence of an - * overloaded addressof operator (unary operator&), in which case the call - * will not be a constant expression. - */ - template::value, int>...> - constexpr _Tp* __constexpr_addressof(_Tp& __t) - { return &__t; } - - /** - * @brief Fallback overload that defers to __addressof. - */ - template::value, int>...> - inline _Tp* __constexpr_addressof(_Tp& __t) - { return std::__addressof(__t); } - - /** - * @brief Class template that holds the necessary state for @ref optional - * and that has the responsibility for construction and the special members. - * - * Such a separate base class template is necessary in order to - * conditionally enable the special members (e.g. copy/move constructors). - * Note that this means that @ref _Optional_base implements the - * functionality for copy and move assignment, but not for converting - * assignment. - * - * @see optional, _Enable_special_members - */ - template::value> - class _Optional_base - { - private: - // Remove const to avoid prohibition of reusing object storage for - // const-qualified types in [3.8/9]. This is strictly internal - // and even optional itself is oblivious to it. - using _Stored_type = remove_const_t<_Tp>; - - public: - // [X.Y.4.1] Constructors. - - // Constructors for disengaged optionals. - constexpr _Optional_base() noexcept - : _M_empty{} { } - - constexpr _Optional_base(nullopt_t) noexcept - : _Optional_base{} { } - - // Constructors for engaged optionals. - constexpr _Optional_base(const _Tp& __t) - : _M_payload(__t), _M_engaged(true) { } - - constexpr _Optional_base(_Tp&& __t) - : _M_payload(std::move(__t)), _M_engaged(true) { } - - template - constexpr explicit _Optional_base(in_place_t, _Args&&... __args) - : _M_payload(std::forward<_Args>(__args)...), _M_engaged(true) { } - - template&, - _Args&&...>::value, - int>...> - constexpr explicit _Optional_base(in_place_t, - initializer_list<_Up> __il, - _Args&&... __args) - : _M_payload(__il, std::forward<_Args>(__args)...), - _M_engaged(true) { } - - // Copy and move constructors. - _Optional_base(const _Optional_base& __other) - { - if (__other._M_engaged) - this->_M_construct(__other._M_get()); - } - - _Optional_base(_Optional_base&& __other) - noexcept(is_nothrow_move_constructible<_Tp>()) - { - if (__other._M_engaged) - this->_M_construct(std::move(__other._M_get())); - } - - // [X.Y.4.3] (partly) Assignment. - _Optional_base& - operator=(const _Optional_base& __other) - { - if (this->_M_engaged && __other._M_engaged) - this->_M_get() = __other._M_get(); - else - { - if (__other._M_engaged) - this->_M_construct(__other._M_get()); - else - this->_M_reset(); - } - - return *this; - } - - _Optional_base& - operator=(_Optional_base&& __other) - noexcept(__and_, - is_nothrow_move_assignable<_Tp>>()) - { - if (this->_M_engaged && __other._M_engaged) - this->_M_get() = std::move(__other._M_get()); - else - { - if (__other._M_engaged) - this->_M_construct(std::move(__other._M_get())); - else - this->_M_reset(); - } - return *this; - } - - // [X.Y.4.2] Destructor. - ~_Optional_base() - { - if (this->_M_engaged) - this->_M_payload.~_Stored_type(); - } - - // The following functionality is also needed by optional, hence the - // protected accessibility. - protected: - constexpr bool _M_is_engaged() const noexcept - { return this->_M_engaged; } - - // The _M_get operations have _M_engaged as a precondition. - constexpr _Tp& - _M_get() noexcept - { return _M_payload; } - - constexpr const _Tp& - _M_get() const noexcept - { return _M_payload; } - - // The _M_construct operation has !_M_engaged as a precondition - // while _M_destruct has _M_engaged as a precondition. - template - void - _M_construct(_Args&&... __args) - noexcept(is_nothrow_constructible<_Stored_type, _Args...>()) - { - ::new (std::__addressof(this->_M_payload)) - _Stored_type(std::forward<_Args>(__args)...); - this->_M_engaged = true; - } - - void - _M_destruct() - { - this->_M_engaged = false; - this->_M_payload.~_Stored_type(); - } - - // _M_reset is a 'safe' operation with no precondition. - void - _M_reset() - { - if (this->_M_engaged) - this->_M_destruct(); - } - - private: - struct _Empty_byte { }; - union { - _Empty_byte _M_empty; - _Stored_type _M_payload; - }; - bool _M_engaged = false; - }; - - /// Partial specialization that is exactly identical to the primary template - /// save for not providing a destructor, to fulfill triviality requirements. - template - class _Optional_base<_Tp, false> - { - private: - using _Stored_type = remove_const_t<_Tp>; - - public: - constexpr _Optional_base() noexcept - : _M_empty{} { } - - constexpr _Optional_base(nullopt_t) noexcept - : _Optional_base{} { } - - constexpr _Optional_base(const _Tp& __t) - : _M_payload(__t), _M_engaged(true) { } - - constexpr _Optional_base(_Tp&& __t) - : _M_payload(std::move(__t)), _M_engaged(true) { } - - template - constexpr explicit _Optional_base(in_place_t, _Args&&... __args) - : _M_payload(std::forward<_Args>(__args)...), _M_engaged(true) { } - - template&, - _Args&&...>::value, - int>...> - constexpr explicit _Optional_base(in_place_t, - initializer_list<_Up> __il, - _Args&&... __args) - : _M_payload(__il, std::forward<_Args>(__args)...), - _M_engaged(true) { } - - _Optional_base(const _Optional_base& __other) - { - if (__other._M_engaged) - this->_M_construct(__other._M_get()); - } - - _Optional_base(_Optional_base&& __other) - noexcept(is_nothrow_move_constructible<_Tp>()) - { - if (__other._M_engaged) - this->_M_construct(std::move(__other._M_get())); - } - - _Optional_base& - operator=(const _Optional_base& __other) - { - if (this->_M_engaged && __other._M_engaged) - this->_M_get() = __other._M_get(); - else - { - if (__other._M_engaged) - this->_M_construct(__other._M_get()); - else - this->_M_reset(); - } - return *this; - } - - _Optional_base& - operator=(_Optional_base&& __other) - noexcept(__and_, - is_nothrow_move_assignable<_Tp>>()) - { - if (this->_M_engaged && __other._M_engaged) - this->_M_get() = std::move(__other._M_get()); - else - { - if (__other._M_engaged) - this->_M_construct(std::move(__other._M_get())); - else - this->_M_reset(); - } - return *this; - } - - // Sole difference - // ~_Optional_base() noexcept = default; - - protected: - constexpr bool _M_is_engaged() const noexcept - { return this->_M_engaged; } - - _Tp& - _M_get() noexcept - { return _M_payload; } - - constexpr const _Tp& - _M_get() const noexcept - { return _M_payload; } - - template - void - _M_construct(_Args&&... __args) - noexcept(is_nothrow_constructible<_Stored_type, _Args...>()) - { - ::new (std::__addressof(this->_M_payload)) - _Stored_type(std::forward<_Args>(__args)...); - this->_M_engaged = true; - } - - void - _M_destruct() - { - this->_M_engaged = false; - this->_M_payload.~_Stored_type(); - } - - void - _M_reset() - { - if (this->_M_engaged) - this->_M_destruct(); - } - - private: - struct _Empty_byte { }; - union - { - _Empty_byte _M_empty; - _Stored_type _M_payload; - }; - bool _M_engaged = false; - }; - - /** - * @brief Class template for optional values. - */ - template - class optional - : private _Optional_base<_Tp>, - private _Enable_copy_move< - // Copy constructor. - is_copy_constructible<_Tp>::value, - // Copy assignment. - __and_, is_copy_assignable<_Tp>>::value, - // Move constructor. - is_move_constructible<_Tp>::value, - // Move assignment. - __and_, is_move_assignable<_Tp>>::value, - // Unique tag type. - optional<_Tp>> - { - static_assert(__and_<__not_, nullopt_t>>, - __not_, in_place_t>>, - __not_>>(), - "Invalid instantiation of optional"); - - private: - using _Base = _Optional_base<_Tp>; - - public: - using value_type = _Tp; - - // _Optional_base has the responsibility for construction. - using _Base::_Base; - - // [X.Y.4.3] (partly) Assignment. - optional& - operator=(nullopt_t) noexcept - { - this->_M_reset(); - return *this; - } - - template - enable_if_t>::value, optional&> - operator=(_Up&& __u) - { - static_assert(__and_, - is_assignable<_Tp&, _Up>>(), - "Cannot assign to value type from argument"); - - if (this->_M_is_engaged()) - this->_M_get() = std::forward<_Up>(__u); - else - this->_M_construct(std::forward<_Up>(__u)); - - return *this; - } - - template - void - emplace(_Args&&... __args) - { - static_assert(is_constructible<_Tp, _Args&&...>(), - "Cannot emplace value type from arguments"); - - this->_M_reset(); - this->_M_construct(std::forward<_Args>(__args)...); - } - - template - enable_if_t&, - _Args&&...>::value> - emplace(initializer_list<_Up> __il, _Args&&... __args) - { - this->_M_reset(); - this->_M_construct(__il, std::forward<_Args>(__args)...); - } - - // [X.Y.4.2] Destructor is implicit, implemented in _Optional_base. - - // [X.Y.4.4] Swap. - void - swap(optional& __other) - noexcept(is_nothrow_move_constructible<_Tp>() - && noexcept(swap(declval<_Tp&>(), declval<_Tp&>()))) - { - using std::swap; - - if (this->_M_is_engaged() && __other._M_is_engaged()) - swap(this->_M_get(), __other._M_get()); - else if (this->_M_is_engaged()) - { - __other._M_construct(std::move(this->_M_get())); - this->_M_destruct(); - } - else if (__other._M_is_engaged()) - { - this->_M_construct(std::move(__other._M_get())); - __other._M_destruct(); - } - } - - // [X.Y.4.5] Observers. - constexpr const _Tp* - operator->() const - { return __constexpr_addressof(this->_M_get()); } - - _Tp* - operator->() - { return std::__addressof(this->_M_get()); } - - constexpr const _Tp& - operator*() const& - { return this->_M_get(); } - - constexpr _Tp& - operator*()& - { return this->_M_get(); } - - constexpr _Tp&& - operator*()&& - { return std::move(this->_M_get()); } - - constexpr const _Tp&& - operator*() const&& - { return std::move(this->_M_get()); } - - constexpr explicit operator bool() const noexcept - { return this->_M_is_engaged(); } - - constexpr const _Tp& - value() const& - { - return this->_M_is_engaged() - ? this->_M_get() - : (__throw_bad_optional_access("Attempt to access value of a " - "disengaged optional object"), - this->_M_get()); - } - - constexpr _Tp& - value()& - { - return this->_M_is_engaged() - ? this->_M_get() - : (__throw_bad_optional_access("Attempt to access value of a " - "disengaged optional object"), - this->_M_get()); - } - - constexpr _Tp&& - value()&& - { - return this->_M_is_engaged() - ? std::move(this->_M_get()) - : (__throw_bad_optional_access("Attempt to access value of a " - "disengaged optional object"), - std::move(this->_M_get())); - } - - constexpr const _Tp&& - value() const&& - { - return this->_M_is_engaged() - ? std::move(this->_M_get()) - : (__throw_bad_optional_access("Attempt to access value of a " - "disengaged optional object"), - std::move(this->_M_get())); - } - - template - constexpr _Tp - value_or(_Up&& __u) const& - { - static_assert(__and_, - is_convertible<_Up&&, _Tp>>(), - "Cannot return value"); - - return this->_M_is_engaged() - ? this->_M_get() - : static_cast<_Tp>(std::forward<_Up>(__u)); - } - - template - _Tp - value_or(_Up&& __u) && - { - static_assert(__and_, - is_convertible<_Up&&, _Tp>>(), - "Cannot return value" ); - - return this->_M_is_engaged() - ? std::move(this->_M_get()) - : static_cast<_Tp>(std::forward<_Up>(__u)); - } - }; - - // [X.Y.8] Comparisons between optional values. - template - constexpr bool - operator==(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs) - { - return static_cast(__lhs) == static_cast(__rhs) - && (!__lhs || *__lhs == *__rhs); - } - - template - constexpr bool - operator!=(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs) - { return !(__lhs == __rhs); } - - template - constexpr bool - operator<(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs) - { - return static_cast(__rhs) && (!__lhs || *__lhs < *__rhs); - } - - template - constexpr bool - operator>(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs) - { return __rhs < __lhs; } - - template - constexpr bool - operator<=(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs) - { return !(__rhs < __lhs); } - - template - constexpr bool - operator>=(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs) - { return !(__lhs < __rhs); } - - // [X.Y.9] Comparisons with nullopt. - template - constexpr bool - operator==(const optional<_Tp>& __lhs, nullopt_t) noexcept - { return !__lhs; } - - template - constexpr bool - operator==(nullopt_t, const optional<_Tp>& __rhs) noexcept - { return !__rhs; } - - template - constexpr bool - operator!=(const optional<_Tp>& __lhs, nullopt_t) noexcept - { return static_cast(__lhs); } - - template - constexpr bool - operator!=(nullopt_t, const optional<_Tp>& __rhs) noexcept - { return static_cast(__rhs); } - - template - constexpr bool - operator<(const optional<_Tp>& /* __lhs */, nullopt_t) noexcept - { return false; } - - template - constexpr bool - operator<(nullopt_t, const optional<_Tp>& __rhs) noexcept - { return static_cast(__rhs); } - - template - constexpr bool - operator>(const optional<_Tp>& __lhs, nullopt_t) noexcept - { return static_cast(__lhs); } - - template - constexpr bool - operator>(nullopt_t, const optional<_Tp>& /* __rhs */) noexcept - { return false; } - - template - constexpr bool - operator<=(const optional<_Tp>& __lhs, nullopt_t) noexcept - { return !__lhs; } - - template - constexpr bool - operator<=(nullopt_t, const optional<_Tp>& /* __rhs */) noexcept - { return true; } - - template - constexpr bool - operator>=(const optional<_Tp>& /* __lhs */, nullopt_t) noexcept - { return true; } - - template - constexpr bool - operator>=(nullopt_t, const optional<_Tp>& __rhs) noexcept - { return !__rhs; } - - // [X.Y.10] Comparisons with value type. - template - constexpr bool - operator==(const optional<_Tp>& __lhs, const _Tp& __rhs) - { return __lhs && *__lhs == __rhs; } - - template - constexpr bool - operator==(const _Tp& __lhs, const optional<_Tp>& __rhs) - { return __rhs && __lhs == *__rhs; } - - template - constexpr bool - operator!=(const optional<_Tp>& __lhs, _Tp const& __rhs) - { return !__lhs || !(*__lhs == __rhs); } - - template - constexpr bool - operator!=(const _Tp& __lhs, const optional<_Tp>& __rhs) - { return !__rhs || !(__lhs == *__rhs); } - - template - constexpr bool - operator<(const optional<_Tp>& __lhs, const _Tp& __rhs) - { return !__lhs || *__lhs < __rhs; } - - template - constexpr bool - operator<(const _Tp& __lhs, const optional<_Tp>& __rhs) - { return __rhs && __lhs < *__rhs; } - - template - constexpr bool - operator>(const optional<_Tp>& __lhs, const _Tp& __rhs) - { return __lhs && __rhs < *__lhs; } - - template - constexpr bool - operator>(const _Tp& __lhs, const optional<_Tp>& __rhs) - { return !__rhs || *__rhs < __lhs; } - - template - constexpr bool - operator<=(const optional<_Tp>& __lhs, const _Tp& __rhs) - { return !__lhs || !(__rhs < *__lhs); } - - template - constexpr bool - operator<=(const _Tp& __lhs, const optional<_Tp>& __rhs) - { return __rhs && !(*__rhs < __lhs); } - - template - constexpr bool - operator>=(const optional<_Tp>& __lhs, const _Tp& __rhs) - { return __lhs && !(*__lhs < __rhs); } - - template - constexpr bool - operator>=(const _Tp& __lhs, const optional<_Tp>& __rhs) - { return !__rhs || !(__lhs < *__rhs); } - - // [X.Y.11] - template - inline void - swap(optional<_Tp>& __lhs, optional<_Tp>& __rhs) - noexcept(noexcept(__lhs.swap(__rhs))) - { __lhs.swap(__rhs); } - - template - constexpr optional> - make_optional(_Tp&& __t) - { return optional> { std::forward<_Tp>(__t) }; } - - // @} group optional -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace fundamentals_v1 -} - - // [X.Y.12] - template - struct hash> - { - using result_type = size_t; - using argument_type = experimental::optional<_Tp>; - - size_t - operator()(const experimental::optional<_Tp>& __t) const - noexcept(noexcept(hash<_Tp> {}(*__t))) - { - // We pick an arbitrary hash for disengaged optionals which hopefully - // usual values of _Tp won't typically hash to. - constexpr size_t __magic_disengaged_hash = static_cast(-3333); - return __t ? hash<_Tp> {}(*__t) : __magic_disengaged_hash; - } - }; -} - -#endif // C++14 - -#endif // _GLIBCXX_EXPERIMENTAL_OPTIONAL diff --git a/openflow/usr/include/c++/5/experimental/ratio b/openflow/usr/include/c++/5/experimental/ratio deleted file mode 100644 index a009dea..0000000 --- a/openflow/usr/include/c++/5/experimental/ratio +++ /dev/null @@ -1,73 +0,0 @@ -// Variable Templates For ratio -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/ratio - * This is a TS C++ Library header. - */ - -// -// N3932 Variable Templates For Type Traits (Revision 1) -// - -#ifndef _GLIBCXX_EXPERIMENTAL_RATIO -#define _GLIBCXX_EXPERIMENTAL_RATIO 1 - -#pragma GCC system_header - -#if __cplusplus <= 201103L -# include -#else - -#include - - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -inline namespace fundamentals_v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION -// See C++14 §20.11.5, ratio comparison -template - constexpr bool ratio_equal_v = ratio_equal<_R1, _R2>::value; -template - constexpr bool ratio_not_equal_v = ratio_not_equal<_R1, _R2>::value; -template - constexpr bool ratio_less_v = ratio_less<_R1, _R2>::value; -template - constexpr bool ratio_less_equal_v = ratio_less_equal<_R1, _R2>::value; -template - constexpr bool ratio_greater_v = ratio_greater<_R1, _R2>::value; -template - constexpr bool ratio_greater_equal_v = ratio_greater_equal<_R1, _R2>::value; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - -#endif // __cplusplus <= 201103L - -#endif // _GLIBCXX_EXPERIMENTAL_RATIO diff --git a/openflow/usr/include/c++/5/experimental/string_view b/openflow/usr/include/c++/5/experimental/string_view deleted file mode 100644 index f11a187..0000000 --- a/openflow/usr/include/c++/5/experimental/string_view +++ /dev/null @@ -1,693 +0,0 @@ -// Components for manipulating non-owning sequences of characters -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/string_view - * This is a TS C++ Library header. - */ - -// -// N3762 basic_string_view library -// - -#ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW -#define _GLIBCXX_EXPERIMENTAL_STRING_VIEW 1 - -#pragma GCC system_header - -#if __cplusplus <= 201103L -# include -#else - -#include -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -inline namespace fundamentals_v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#define __cpp_lib_experimental_string_view 201411 - - /** - * @class basic_string_view - * @brief A non-owning reference to a string. - * - * @ingroup strings - * @ingroup sequences - * @ingroup experimental - * - * @tparam _CharT Type of character - * @tparam _Traits Traits for character type, defaults to - * char_traits<_CharT>. - * - * A basic_string_view looks like this: - * - * @code - * _CharT* _M_str - * size_t _M_len - * @endcode - */ - template> - class basic_string_view - { - public: - - // types - using traits_type = _Traits; - using value_type = _CharT; - using pointer = const _CharT*; - using const_pointer = const _CharT*; - using reference = const _CharT&; - using const_reference = const _CharT&; - using const_iterator = const _CharT*; - using iterator = const_iterator; - using const_reverse_iterator = std::reverse_iterator; - using reverse_iterator = const_reverse_iterator; - using size_type = size_t; - using difference_type = ptrdiff_t; - static constexpr size_type npos = size_type(-1); - - // [string.view.cons], construct/copy - - constexpr - basic_string_view() noexcept - : _M_len{0}, _M_str{nullptr} - { } - - constexpr basic_string_view(const basic_string_view&) noexcept = default; - - template - basic_string_view(const basic_string<_CharT, _Traits, - _Allocator>& __str) noexcept - : _M_len{__str.length()}, _M_str{__str.data()} - { } - - constexpr basic_string_view(const _CharT* __str) - : _M_len{__str == nullptr ? 0 : traits_type::length(__str)}, - _M_str{__str} - { } - - constexpr basic_string_view(const _CharT* __str, size_type __len) - : _M_len{__len}, - _M_str{__str} - { } - - basic_string_view& - operator=(const basic_string_view&) noexcept = default; - - // [string.view.iterators], iterators - - constexpr const_iterator - begin() const noexcept - { return this->_M_str; } - - constexpr const_iterator - end() const noexcept - { return this->_M_str + this->_M_len; } - - constexpr const_iterator - cbegin() const noexcept - { return this->_M_str; } - - constexpr const_iterator - cend() const noexcept - { return this->_M_str + this->_M_len; } - - const_reverse_iterator - rbegin() const noexcept - { return const_reverse_iterator(this->end()); } - - const_reverse_iterator - rend() const noexcept - { return const_reverse_iterator(this->begin()); } - - const_reverse_iterator - crbegin() const noexcept - { return const_reverse_iterator(this->end()); } - - const_reverse_iterator - crend() const noexcept - { return const_reverse_iterator(this->begin()); } - - // [string.view.capacity], capacity - - constexpr size_type - size() const noexcept - { return this->_M_len; } - - constexpr size_type - length() const noexcept - { return _M_len; } - - constexpr size_type - max_size() const noexcept - { - return (npos - sizeof(size_type) - sizeof(void*)) - / sizeof(value_type) / 4; - } - - constexpr bool - empty() const noexcept - { return this->_M_len == 0; } - - // [string.view.access], element access - - constexpr const _CharT& - operator[](size_type __pos) const - { - // TODO: Assert to restore in a way compatible with the constexpr. - // _GLIBCXX_DEBUG_ASSERT(__pos < this->_M_len); - return *(this->_M_str + __pos); - } - - constexpr const _CharT& - at(size_type __pos) const - { - return __pos < this->_M_len - ? *(this->_M_str + __pos) - : (__throw_out_of_range_fmt(__N("basic_string_view::at: __pos " - "(which is %zu) >= this->size() " - "(which is %zu)"), - __pos, this->size()), - *this->_M_str); - } - - constexpr const _CharT& - front() const - { - // TODO: Assert to restore in a way compatible with the constexpr. - // _GLIBCXX_DEBUG_ASSERT(this->_M_len > 0); - return *this->_M_str; - } - - constexpr const _CharT& - back() const - { - // TODO: Assert to restore in a way compatible with the constexpr. - // _GLIBCXX_DEBUG_ASSERT(this->_M_len > 0); - return *(this->_M_str + this->_M_len - 1); - } - - constexpr const _CharT* - data() const noexcept - { return this->_M_str; } - - // [string.view.modifiers], modifiers: - - void - remove_prefix(size_type __n) - { - _GLIBCXX_DEBUG_ASSERT(this->_M_len >= __n); - this->_M_str += __n; - this->_M_len -= __n; - } - - void - remove_suffix(size_type __n) - { this->_M_len -= __n; } - - void - swap(basic_string_view& __sv) noexcept - { - std::swap(this->_M_len, __sv._M_len); - std::swap(this->_M_str, __sv._M_str); - } - - - // [string.view.ops], string operations: - - template - explicit operator basic_string<_CharT, _Traits, _Allocator>() const - { - return { this->_M_str, this->_M_len }; - } - - template> - basic_string<_CharT, _Traits, _Allocator> - to_string(const _Allocator& __alloc = _Allocator()) const - { - return { this->_M_str, this->_M_len, __alloc }; - } - - size_type - copy(_CharT* __str, size_type __n, size_type __pos = 0) const - { - __glibcxx_requires_string_len(__str, __n); - if (__pos > this->_M_len) - __throw_out_of_range_fmt(__N("basic_string_view::copy: __pos " - "(which is %zu) > this->size() " - "(which is %zu)"), - __pos, this->size()); - size_type __rlen{std::min(__n, size_type{this->_M_len - __pos})}; - for (auto __begin = this->_M_str + __pos, - __end = __begin + __rlen; __begin != __end;) - *__str++ = *__begin++; - return __rlen; - } - - - // [string.view.ops], string operations: - - constexpr basic_string_view - substr(size_type __pos, size_type __n=npos) const - { - return __pos <= this->_M_len - ? basic_string_view{this->_M_str + __pos, - std::min(__n, size_type{this->_M_len - __pos})} - : (__throw_out_of_range_fmt(__N("basic_string_view::substr: __pos " - "(which is %zu) > this->size() " - "(which is %zu)"), - __pos, this->size()), basic_string_view{}); - } - - int - compare(basic_string_view __str) const noexcept - { - int __ret = traits_type::compare(this->_M_str, __str._M_str, - std::min(this->_M_len, __str._M_len)); - if (__ret == 0) - __ret = _S_compare(this->_M_len, __str._M_len); - return __ret; - } - - int - compare(size_type __pos1, size_type __n1, basic_string_view __str) const - { return this->substr(__pos1, __n1).compare(__str); } - - int - compare(size_type __pos1, size_type __n1, - basic_string_view __str, size_type __pos2, size_type __n2) const - { return this->substr(__pos1, __n1).compare(__str.substr(__pos2, __n2)); } - - int - compare(const _CharT* __str) const noexcept - { return this->compare(basic_string_view{__str}); } - - int - compare(size_type __pos1, size_type __n1, const _CharT* __str) const - { return this->substr(__pos1, __n1).compare(basic_string_view{__str}); } - - int - compare(size_type __pos1, size_type __n1, - const _CharT* __str, size_type __n2) const - { - return this->substr(__pos1, __n1) - .compare(basic_string_view(__str, __n2)); - } - - size_type - find(basic_string_view __str, size_type __pos = 0) const noexcept - { return this->find(__str._M_str, __pos, __str._M_len); } - - size_type - find(_CharT __c, size_type __pos=0) const noexcept; - - size_type - find(const _CharT* __str, size_type __pos, size_type __n) const noexcept; - - size_type - find(const _CharT* __str, size_type __pos=0) const noexcept - { return this->find(__str, __pos, traits_type::length(__str)); } - - size_type - rfind(basic_string_view __str, size_type __pos = npos) const noexcept - { return this->rfind(__str._M_str, __pos, __str._M_len); } - - size_type - rfind(_CharT __c, size_type __pos = npos) const noexcept; - - size_type - rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept; - - size_type - rfind(const _CharT* __str, size_type __pos = npos) const noexcept - { return this->rfind(__str, __pos, traits_type::length(__str)); } - - size_type - find_first_of(basic_string_view __str, size_type __pos = 0) const noexcept - { return this->find_first_of(__str._M_str, __pos, __str._M_len); } - - size_type - find_first_of(_CharT __c, size_type __pos = 0) const noexcept - { return this->find(__c, __pos); } - - size_type - find_first_of(const _CharT* __str, size_type __pos, size_type __n) const; - - size_type - find_first_of(const _CharT* __str, size_type __pos = 0) const noexcept - { return this->find_first_of(__str, __pos, traits_type::length(__str)); } - - size_type - find_last_of(basic_string_view __str, - size_type __pos = npos) const noexcept - { return this->find_last_of(__str._M_str, __pos, __str._M_len); } - - size_type - find_last_of(_CharT __c, size_type __pos=npos) const noexcept - { return this->rfind(__c, __pos); } - - size_type - find_last_of(const _CharT* __str, size_type __pos, size_type __n) const; - - size_type - find_last_of(const _CharT* __str, size_type __pos = npos) const noexcept - { return this->find_last_of(__str, __pos, traits_type::length(__str)); } - - size_type - find_first_not_of(basic_string_view __str, - size_type __pos = 0) const noexcept - { return this->find_first_not_of(__str._M_str, __pos, __str._M_len); } - - size_type - find_first_not_of(_CharT __c, size_type __pos = 0) const noexcept; - - size_type - find_first_not_of(const _CharT* __str, - size_type __pos, size_type __n) const; - - size_type - find_first_not_of(const _CharT* __str, size_type __pos = 0) const noexcept - { - return this->find_first_not_of(__str, __pos, - traits_type::length(__str)); - } - - size_type - find_last_not_of(basic_string_view __str, - size_type __pos = npos) const noexcept - { return this->find_last_not_of(__str._M_str, __pos, __str._M_len); } - - size_type - find_last_not_of(_CharT __c, size_type __pos = npos) const noexcept; - - size_type - find_last_not_of(const _CharT* __str, - size_type __pos, size_type __n) const; - - size_type - find_last_not_of(const _CharT* __str, - size_type __pos = npos) const noexcept - { - return this->find_last_not_of(__str, __pos, - traits_type::length(__str)); - } - - private: - - static constexpr const int - _S_compare(size_type __n1, size_type __n2) noexcept - { - return difference_type{__n1 - __n2} > std::numeric_limits::max() - ? std::numeric_limits::max() - : difference_type{__n1 - __n2} < std::numeric_limits::min() - ? std::numeric_limits::min() - : static_cast(difference_type{__n1 - __n2}); - } - - size_t _M_len; - const _CharT* _M_str; - }; - - - // [string.view.comparison], non-member basic_string_view comparison functions - - namespace __detail - { - // Identity transform to make ADL work with just one argument. - // See n3766.html. - template - struct __identity - { typedef _Tp type; }; - - template<> - struct __identity; - - template - using __idt = typename __identity<_Tp>::type; - } - - template - inline bool - operator==(basic_string_view<_CharT, _Traits> __x, - basic_string_view<_CharT, _Traits> __y) noexcept - { return __x.compare(__y) == 0; } - - template - inline bool - operator==(basic_string_view<_CharT, _Traits> __x, - __detail::__idt> __y) noexcept - { return __x.compare(__y) == 0; } - - template - inline bool - operator==(__detail::__idt> __x, - basic_string_view<_CharT, _Traits> __y) noexcept - { return __x.compare(__y) == 0; } - - template - inline bool - operator!=(basic_string_view<_CharT, _Traits> __x, - basic_string_view<_CharT, _Traits> __y) noexcept - { return !(__x == __y); } - - template - inline bool - operator!=(basic_string_view<_CharT, _Traits> __x, - __detail::__idt> __y) noexcept - { return !(__x == __y); } - - template - inline bool - operator!=(__detail::__idt> __x, - basic_string_view<_CharT, _Traits> __y) noexcept - { return !(__x == __y); } - - template - inline bool - operator< (basic_string_view<_CharT, _Traits> __x, - basic_string_view<_CharT, _Traits> __y) noexcept - { return __x.compare(__y) < 0; } - - template - inline bool - operator< (basic_string_view<_CharT, _Traits> __x, - __detail::__idt> __y) noexcept - { return __x.compare(__y) < 0; } - - template - inline bool - operator< (__detail::__idt> __x, - basic_string_view<_CharT, _Traits> __y) noexcept - { return __x.compare(__y) < 0; } - - template - inline bool - operator> (basic_string_view<_CharT, _Traits> __x, - basic_string_view<_CharT, _Traits> __y) noexcept - { return __x.compare(__y) > 0; } - - template - inline bool - operator> (basic_string_view<_CharT, _Traits> __x, - __detail::__idt> __y) noexcept - { return __x.compare(__y) > 0; } - - template - inline bool - operator> (__detail::__idt> __x, - basic_string_view<_CharT, _Traits> __y) noexcept - { return __x.compare(__y) > 0; } - - template - inline bool - operator<=(basic_string_view<_CharT, _Traits> __x, - basic_string_view<_CharT, _Traits> __y) noexcept - { return __x.compare(__y) <= 0; } - - template - inline bool - operator<=(basic_string_view<_CharT, _Traits> __x, - __detail::__idt> __y) noexcept - { return __x.compare(__y) <= 0; } - - template - inline bool - operator<=(__detail::__idt> __x, - basic_string_view<_CharT, _Traits> __y) noexcept - { return __x.compare(__y) <= 0; } - - template - inline bool - operator>=(basic_string_view<_CharT, _Traits> __x, - basic_string_view<_CharT, _Traits> __y) noexcept - { return __x.compare(__y) >= 0; } - - template - inline bool - operator>=(basic_string_view<_CharT, _Traits> __x, - __detail::__idt> __y) noexcept - { return __x.compare(__y) >= 0; } - - template - inline bool - operator>=(__detail::__idt> __x, - basic_string_view<_CharT, _Traits> __y) noexcept - { return __x.compare(__y) >= 0; } - - // [string.view.io], Inserters and extractors - template - inline basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __os, - basic_string_view<_CharT,_Traits> __str) - { return __ostream_insert(__os, __str.data(), __str.size()); } - - - // basic_string_view typedef names - - using string_view = basic_string_view; -#ifdef _GLIBCXX_USE_WCHAR_T - using wstring_view = basic_string_view; -#endif -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - using u16string_view = basic_string_view; - using u32string_view = basic_string_view; -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace fundamentals_v1 -} // namespace experimental - - - // [string.view.hash], hash support: - -_GLIBCXX_BEGIN_NAMESPACE_VERSION - template - struct hash; - - template<> - struct hash - : public __hash_base - { - size_t - operator()(const experimental::string_view& __str) const noexcept - { return std::_Hash_impl::hash(__str.data(), __str.length()); } - }; - - template<> - struct __is_fast_hash> : std::false_type - { }; - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - struct hash - : public __hash_base - { - size_t - operator()(const experimental::wstring_view& __s) const noexcept - { return std::_Hash_impl::hash(__s.data(), - __s.length() * sizeof(wchar_t)); } - }; - - template<> - struct __is_fast_hash> : std::false_type - { }; -#endif - -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - template<> - struct hash - : public __hash_base - { - size_t - operator()(const experimental::u16string_view& __s) const noexcept - { return std::_Hash_impl::hash(__s.data(), - __s.length() * sizeof(char16_t)); } - }; - - template<> - struct __is_fast_hash> : std::false_type - { }; - - template<> - struct hash - : public __hash_base - { - size_t - operator()(const experimental::u32string_view& __s) const noexcept - { return std::_Hash_impl::hash(__s.data(), - __s.length() * sizeof(char32_t)); } - }; - - template<> - struct __is_fast_hash> : std::false_type - { }; -#endif -_GLIBCXX_END_NAMESPACE_VERSION - -namespace experimental -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // I added these EMSR. - inline namespace literals - { - inline namespace string_view_literals - { - - inline constexpr basic_string_view - operator""sv(const char* __str, size_t __len) - { return basic_string_view{__str, __len}; } - -#ifdef _GLIBCXX_USE_WCHAR_T - inline constexpr basic_string_view - operator""sv(const wchar_t* __str, size_t __len) - { return basic_string_view{__str, __len}; } -#endif - -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - inline constexpr basic_string_view - operator""sv(const char16_t* __str, size_t __len) - { return basic_string_view{__str, __len}; } - - inline constexpr basic_string_view - operator""sv(const char32_t* __str, size_t __len) - { return basic_string_view{__str, __len}; } -#endif - - } - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace experimental -} // namespace std - -#include - -#endif // __cplusplus <= 201103L - -#endif // _GLIBCXX_EXPERIMENTAL_STRING_VIEW diff --git a/openflow/usr/include/c++/5/experimental/string_view.tcc b/openflow/usr/include/c++/5/experimental/string_view.tcc deleted file mode 100644 index 9421842..0000000 --- a/openflow/usr/include/c++/5/experimental/string_view.tcc +++ /dev/null @@ -1,230 +0,0 @@ -// Components for manipulating non-owning sequences of characters -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/string_view.tcc - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{experimental/string_view} - */ - -// -// N3762 basic_string_view library -// - -#ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC -#define _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC 1 - -#pragma GCC system_header - -#if __cplusplus <= 201103L -# include -#else - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - template - typename basic_string_view<_CharT, _Traits>::size_type - basic_string_view<_CharT, _Traits>:: - find(const _CharT* __str, size_type __pos, size_type __n) const noexcept - { - __glibcxx_requires_string_len(__str, __n); - - if (__n == 0) - return __pos <= this->_M_len ? __pos : npos; - - if (__n <= this->_M_len) - { - for (; __pos <= this->_M_len - __n; ++__pos) - if (traits_type::eq(this->_M_str[__pos], __str[0]) - && traits_type::compare(this->_M_str + __pos + 1, - __str + 1, __n - 1) == 0) - return __pos; - } - return npos; - } - - template - typename basic_string_view<_CharT, _Traits>::size_type - basic_string_view<_CharT, _Traits>:: - find(_CharT __c, size_type __pos) const noexcept - { - size_type __ret = npos; - if (__pos < this->_M_len) - { - const size_type __n = this->_M_len - __pos; - const _CharT* __p = traits_type::find(this->_M_str + __pos, __n, __c); - if (__p) - __ret = __p - this->_M_str; - } - return __ret; - } - - template - typename basic_string_view<_CharT, _Traits>::size_type - basic_string_view<_CharT, _Traits>:: - rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept - { - __glibcxx_requires_string_len(__str, __n); - - if (__n <= this->_M_len) - { - __pos = std::min(size_type(this->_M_len - __n), __pos); - do - { - if (traits_type::compare(this->_M_str + __pos, __str, __n) == 0) - return __pos; - } - while (__pos-- > 0); - } - return npos; - } - - template - typename basic_string_view<_CharT, _Traits>::size_type - basic_string_view<_CharT, _Traits>:: - rfind(_CharT __c, size_type __pos) const noexcept - { - size_type __size = this->_M_len; - if (__size > 0) - { - if (--__size > __pos) - __size = __pos; - for (++__size; __size-- > 0; ) - if (traits_type::eq(this->_M_str[__size], __c)) - return __size; - } - return npos; - } - - template - typename basic_string_view<_CharT, _Traits>::size_type - basic_string_view<_CharT, _Traits>:: - find_first_of(const _CharT* __str, size_type __pos, size_type __n) const - { - __glibcxx_requires_string_len(__str, __n); - for (; __n && __pos < this->_M_len; ++__pos) - { - const _CharT* __p = traits_type::find(__str, __n, - this->_M_str[__pos]); - if (__p) - return __pos; - } - return npos; - } - - template - typename basic_string_view<_CharT, _Traits>::size_type - basic_string_view<_CharT, _Traits>:: - find_last_of(const _CharT* __str, size_type __pos, size_type __n) const - { - __glibcxx_requires_string_len(__str, __n); - size_type __size = this->size(); - if (__size && __n) - { - if (--__size > __pos) - __size = __pos; - do - { - if (traits_type::find(__str, __n, this->_M_str[__size])) - return __size; - } - while (__size-- != 0); - } - return npos; - } - - template - typename basic_string_view<_CharT, _Traits>::size_type - basic_string_view<_CharT, _Traits>:: - find_first_not_of(const _CharT* __str, size_type __pos, size_type __n) const - { - __glibcxx_requires_string_len(__str, __n); - for (; __pos < this->_M_len; ++__pos) - if (!traits_type::find(__str, __n, this->_M_str[__pos])) - return __pos; - return npos; - } - - template - typename basic_string_view<_CharT, _Traits>::size_type - basic_string_view<_CharT, _Traits>:: - find_first_not_of(_CharT __c, size_type __pos) const noexcept - { - for (; __pos < this->_M_len; ++__pos) - if (!traits_type::eq(this->_M_str[__pos], __c)) - return __pos; - return npos; - } - - template - typename basic_string_view<_CharT, _Traits>::size_type - basic_string_view<_CharT, _Traits>:: - find_last_not_of(const _CharT* __str, size_type __pos, size_type __n) const - { - __glibcxx_requires_string_len(__str, __n); - size_type __size = this->_M_len; - if (__size) - { - if (--__size > __pos) - __size = __pos; - do - { - if (!traits_type::find(__str, __n, this->_M_str[__size])) - return __size; - } - while (__size--); - } - return npos; - } - - template - typename basic_string_view<_CharT, _Traits>::size_type - basic_string_view<_CharT, _Traits>:: - find_last_not_of(_CharT __c, size_type __pos) const noexcept - { - size_type __size = this->_M_len; - if (__size) - { - if (--__size > __pos) - __size = __pos; - do - { - if (!traits_type::eq(this->_M_str[__size], __c)) - return __size; - } - while (__size--); - } - return npos; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace experimental -} // namespace std - -#endif // __cplusplus <= 201103L - -#endif // _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC diff --git a/openflow/usr/include/c++/5/experimental/system_error b/openflow/usr/include/c++/5/experimental/system_error deleted file mode 100644 index ba3f8be..0000000 --- a/openflow/usr/include/c++/5/experimental/system_error +++ /dev/null @@ -1,65 +0,0 @@ -// Variable Templates For system_error -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/system_error - * This is a TS C++ Library header. - */ - -// -// N3932 Variable Templates For Type Traits (Revision 1) -// - -#ifndef _GLIBCXX_EXPERIMENTAL_SYSTEM_ERROR -#define _GLIBCXX_EXPERIMENTAL_SYSTEM_ERROR 1 - -#pragma GCC system_header - -#if __cplusplus <= 201103L -# include -#else - -#include - - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -inline namespace fundamentals_v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION -// See C++14 §19.5, System error support -template - constexpr bool is_error_code_enum_v = is_error_code_enum<_Tp>::value; -template - constexpr bool is_error_condition_enum_v = - is_error_condition_enum<_Tp>::value; -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - -#endif // __cplusplus <= 201103L - -#endif // _GLIBCXX_EXPERIMENTAL_SYSTEM_ERROR diff --git a/openflow/usr/include/c++/5/experimental/tuple b/openflow/usr/include/c++/5/experimental/tuple deleted file mode 100644 index 99935f1..0000000 --- a/openflow/usr/include/c++/5/experimental/tuple +++ /dev/null @@ -1,78 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/tuple - * This is a TS C++ Library header. - */ - -#ifndef _GLIBCXX_EXPERIMENTAL_TUPLE -#define _GLIBCXX_EXPERIMENTAL_TUPLE 1 - -#pragma GCC system_header - -#if __cplusplus <= 201103L -# include -#else - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -inline namespace fundamentals_v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // See C++14 §20.4.2.5, tuple helper classes - template - constexpr size_t tuple_size_v = tuple_size<_Tp>::value; - -#define __cpp_lib_experimental_tuple 201402 - - template - constexpr decltype(auto) - __apply_impl(_Fn&& f, _Tuple&& t, std::index_sequence<_Idx...>) - { - return std::forward<_Fn>(f)(std::get<_Idx>(std::forward<_Tuple>(t))...); - } - - template - constexpr decltype(auto) - apply(_Fn&& f, _Tuple&& t) - { - using _Indices = - std::make_index_sequence>::value>; - return __apply_impl(std::forward<_Fn>(f), std::forward<_Tuple>(t), - _Indices{}); - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - -#endif // C++14 - -#endif // _GLIBCXX_EXPERIMENTAL_TUPLE diff --git a/openflow/usr/include/c++/5/experimental/type_traits b/openflow/usr/include/c++/5/experimental/type_traits deleted file mode 100644 index db78eec..0000000 --- a/openflow/usr/include/c++/5/experimental/type_traits +++ /dev/null @@ -1,228 +0,0 @@ -// Variable Templates For Type Traits -*- C++ -*- - -// Copyright (C) 2014-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file experimental/type_traits - * This is a TS C++ Library header. - */ - -// -// N3932 Variable Templates For Type Traits (Revision 1) -// - -#ifndef _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS -#define _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS 1 - -#pragma GCC system_header - -#if __cplusplus <= 201103L -# include -#else - -#include - - -namespace std _GLIBCXX_VISIBILITY(default) -{ -namespace experimental -{ -inline namespace fundamentals_v1 -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#define __cpp_lib_experimental_type_trait_variable_templates 201402 - -// See C++14 §20.10.4.1, primary type categories -template - constexpr bool is_void_v = is_void<_Tp>::value; -template - constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value; -template - constexpr bool is_integral_v = is_integral<_Tp>::value; -template - constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; -template - constexpr bool is_array_v = is_array<_Tp>::value; -template - constexpr bool is_pointer_v = is_pointer<_Tp>::value; -template - constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value; -template - constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value; -template - constexpr bool is_member_object_pointer_v = - is_member_object_pointer<_Tp>::value; -template - constexpr bool is_member_function_pointer_v = - is_member_function_pointer<_Tp>::value; -template - constexpr bool is_enum_v = is_enum<_Tp>::value; -template - constexpr bool is_union_v = is_union<_Tp>::value; -template - constexpr bool is_class_v = is_class<_Tp>::value; -template - constexpr bool is_function_v = is_function<_Tp>::value; - -// See C++14 §20.10.4.2, composite type categories -template - constexpr bool is_reference_v = is_reference<_Tp>::value; -template - constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; -template - constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; -template - constexpr bool is_object_v = is_object<_Tp>::value; -template - constexpr bool is_scalar_v = is_scalar<_Tp>::value; -template - constexpr bool is_compound_v = is_compound<_Tp>::value; -template - constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; - -// See C++14 §20.10.4.3, type properties -template - constexpr bool is_const_v = is_const<_Tp>::value; -template - constexpr bool is_volatile_v = is_volatile<_Tp>::value; -template - constexpr bool is_trivial_v = is_trivial<_Tp>::value; -template - constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value; -template - constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; -template - constexpr bool is_pod_v = is_pod<_Tp>::value; -template - constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; -template - constexpr bool is_empty_v = is_empty<_Tp>::value; -template - constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value; -template - constexpr bool is_abstract_v = is_abstract<_Tp>::value; -template - constexpr bool is_final_v = is_final<_Tp>::value; -template - constexpr bool is_signed_v = is_signed<_Tp>::value; -template - constexpr bool is_unsigned_v = is_unsigned<_Tp>::value; -template - constexpr bool is_constructible_v = is_constructible<_Tp, _Args...>::value; -template - constexpr bool is_default_constructible_v = - is_default_constructible<_Tp>::value; -template - constexpr bool is_copy_constructible_v = is_copy_constructible<_Tp>::value; -template - constexpr bool is_move_constructible_v = is_move_constructible<_Tp>::value; -template - constexpr bool is_assignable_v = is_assignable<_Tp, _Up>::value; -template - constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value; -template - constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value; -template - constexpr bool is_destructible_v = is_destructible<_Tp>::value; -template - constexpr bool is_trivially_constructible_v = - is_trivially_constructible<_Tp, _Args...>::value; -template - constexpr bool is_trivially_default_constructible_v = - is_trivially_default_constructible<_Tp>::value; -template - constexpr bool is_trivially_copy_constructible_v = - is_trivially_copy_constructible<_Tp>::value; -template - constexpr bool is_trivially_move_constructible_v = - is_trivially_move_constructible<_Tp>::value; -template - constexpr bool is_trivially_assignable_v = - is_trivially_assignable<_Tp, _Up>::value; -template - constexpr bool is_trivially_copy_assignable_v = - is_trivially_copy_assignable<_Tp>::value; -template - constexpr bool is_trivially_move_assignable_v = - is_trivially_move_assignable<_Tp>::value; -template - constexpr bool is_trivially_destructible_v = - is_trivially_destructible<_Tp>::value; -template - constexpr bool is_nothrow_constructible_v = - is_nothrow_constructible<_Tp, _Args...>::value; -template - constexpr bool is_nothrow_default_constructible_v = - is_nothrow_default_constructible<_Tp>::value; -template - constexpr bool is_nothrow_copy_constructible_v = - is_nothrow_copy_constructible<_Tp>::value; -template - constexpr bool is_nothrow_move_constructible_v = - is_nothrow_move_constructible<_Tp>::value; -template - constexpr bool is_nothrow_assignable_v = - is_nothrow_assignable<_Tp, _Up>::value; -template - constexpr bool is_nothrow_copy_assignable_v = - is_nothrow_copy_assignable<_Tp>::value; -template - constexpr bool is_nothrow_move_assignable_v = - is_nothrow_move_assignable<_Tp>::value; -template - constexpr bool is_nothrow_destructible_v = - is_nothrow_destructible<_Tp>::value; -template - constexpr bool has_virtual_destructor_v = - has_virtual_destructor<_Tp>::value; - -// See C++14 §20.10.5, type property queries -template - constexpr size_t alignment_of_v = alignment_of<_Tp>::value; -template - constexpr size_t rank_v = rank<_Tp>::value; -template - constexpr size_t extent_v = extent<_Tp, _Idx>::value; - -// See C++14 §20.10.6, type relations -template - constexpr bool is_same_v = is_same<_Tp, _Up>::value; -template - constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value; -template - constexpr bool is_convertible_v = is_convertible<_From, _To>::value; - - - // 3.3.2, Other type transformations - // invocation_type (still unimplemented) - // raw_invocation_type (still unimplemented) - // invocation_type_t (still unimplemented) - // raw_invocation_type_t (still unimplemented) -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - -#endif // __cplusplus <= 201103L - -#endif // _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS diff --git a/openflow/usr/include/c++/5/ext/algorithm b/openflow/usr/include/c++/5/ext/algorithm deleted file mode 100644 index 4b68eff..0000000 --- a/openflow/usr/include/c++/5/ext/algorithm +++ /dev/null @@ -1,603 +0,0 @@ -// Algorithm extensions -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file ext/algorithm - * This file is a GNU extension to the Standard C++ Library (possibly - * containing extensions from the HP/SGI STL subset). - */ - -#ifndef _EXT_ALGORITHM -#define _EXT_ALGORITHM 1 - -#pragma GCC system_header - -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::ptrdiff_t; - using std::min; - using std::pair; - using std::input_iterator_tag; - using std::random_access_iterator_tag; - using std::iterator_traits; - - //-------------------------------------------------- - // copy_n (not part of the C++ standard) - - template - pair<_InputIterator, _OutputIterator> - __copy_n(_InputIterator __first, _Size __count, - _OutputIterator __result, - input_iterator_tag) - { - for ( ; __count > 0; --__count) - { - *__result = *__first; - ++__first; - ++__result; - } - return pair<_InputIterator, _OutputIterator>(__first, __result); - } - - template - inline pair<_RAIterator, _OutputIterator> - __copy_n(_RAIterator __first, _Size __count, - _OutputIterator __result, - random_access_iterator_tag) - { - _RAIterator __last = __first + __count; - return pair<_RAIterator, _OutputIterator>(__last, std::copy(__first, - __last, - __result)); - } - - /** - * @brief Copies the range [first,first+count) into [result,result+count). - * @param __first An input iterator. - * @param __count The number of elements to copy. - * @param __result An output iterator. - * @return A std::pair composed of first+count and result+count. - * - * This is an SGI extension. - * This inline function will boil down to a call to @c memmove whenever - * possible. Failing that, if random access iterators are passed, then the - * loop count will be known (and therefore a candidate for compiler - * optimizations such as unrolling). - * @ingroup SGIextensions - */ - template - inline pair<_InputIterator, _OutputIterator> - copy_n(_InputIterator __first, _Size __count, _OutputIterator __result) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator>::value_type>) - - return __gnu_cxx::__copy_n(__first, __count, __result, - std::__iterator_category(__first)); - } - - template - int - __lexicographical_compare_3way(_InputIterator1 __first1, - _InputIterator1 __last1, - _InputIterator2 __first2, - _InputIterator2 __last2) - { - while (__first1 != __last1 && __first2 != __last2) - { - if (*__first1 < *__first2) - return -1; - if (*__first2 < *__first1) - return 1; - ++__first1; - ++__first2; - } - if (__first2 == __last2) - return !(__first1 == __last1); - else - return -1; - } - - inline int - __lexicographical_compare_3way(const unsigned char* __first1, - const unsigned char* __last1, - const unsigned char* __first2, - const unsigned char* __last2) - { - const ptrdiff_t __len1 = __last1 - __first1; - const ptrdiff_t __len2 = __last2 - __first2; - const int __result = __builtin_memcmp(__first1, __first2, - min(__len1, __len2)); - return __result != 0 ? __result - : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1)); - } - - inline int - __lexicographical_compare_3way(const char* __first1, const char* __last1, - const char* __first2, const char* __last2) - { -#if CHAR_MAX == SCHAR_MAX - return __lexicographical_compare_3way((const signed char*) __first1, - (const signed char*) __last1, - (const signed char*) __first2, - (const signed char*) __last2); -#else - return __lexicographical_compare_3way((const unsigned char*) __first1, - (const unsigned char*) __last1, - (const unsigned char*) __first2, - (const unsigned char*) __last2); -#endif - } - - /** - * @brief @c memcmp on steroids. - * @param __first1 An input iterator. - * @param __last1 An input iterator. - * @param __first2 An input iterator. - * @param __last2 An input iterator. - * @return An int, as with @c memcmp. - * - * The return value will be less than zero if the first range is - * lexigraphically less than the second, greater than zero - * if the second range is lexigraphically less than the - * first, and zero otherwise. - * This is an SGI extension. - * @ingroup SGIextensions - */ - template - int - lexicographical_compare_3way(_InputIterator1 __first1, - _InputIterator1 __last1, - _InputIterator2 __first2, - _InputIterator2 __last2) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_InputIterator1>::value_type>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_InputIterator2>::value_type>) - __glibcxx_requires_valid_range(__first1, __last1); - __glibcxx_requires_valid_range(__first2, __last2); - - return __lexicographical_compare_3way(__first1, __last1, __first2, - __last2); - } - - // count and count_if: this version, whose return type is void, was present - // in the HP STL, and is retained as an extension for backward compatibility. - template - void - count(_InputIterator __first, _InputIterator __last, - const _Tp& __value, - _Size& __n) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_EqualityComparableConcept< - typename iterator_traits<_InputIterator>::value_type >) - __glibcxx_function_requires(_EqualityComparableConcept<_Tp>) - __glibcxx_requires_valid_range(__first, __last); - - for ( ; __first != __last; ++__first) - if (*__first == __value) - ++__n; - } - - template - void - count_if(_InputIterator __first, _InputIterator __last, - _Predicate __pred, - _Size& __n) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_InputIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - for ( ; __first != __last; ++__first) - if (__pred(*__first)) - ++__n; - } - - // random_sample and random_sample_n (extensions, not part of the standard). - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template - _OutputIterator - random_sample_n(_ForwardIterator __first, _ForwardIterator __last, - _OutputIterator __out, const _Distance __n) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - _Distance __remaining = std::distance(__first, __last); - _Distance __m = min(__n, __remaining); - - while (__m > 0) - { - if ((std::rand() % __remaining) < __m) - { - *__out = *__first; - ++__out; - --__m; - } - --__remaining; - ++__first; - } - return __out; - } - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template - _OutputIterator - random_sample_n(_ForwardIterator __first, _ForwardIterator __last, - _OutputIterator __out, const _Distance __n, - _RandomNumberGenerator& __rand) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_function_requires(_UnaryFunctionConcept< - _RandomNumberGenerator, _Distance, _Distance>) - __glibcxx_requires_valid_range(__first, __last); - - _Distance __remaining = std::distance(__first, __last); - _Distance __m = min(__n, __remaining); - - while (__m > 0) - { - if (__rand(__remaining) < __m) - { - *__out = *__first; - ++__out; - --__m; - } - --__remaining; - ++__first; - } - return __out; - } - - template - _RandomAccessIterator - __random_sample(_InputIterator __first, _InputIterator __last, - _RandomAccessIterator __out, - const _Distance __n) - { - _Distance __m = 0; - _Distance __t = __n; - for ( ; __first != __last && __m < __n; ++__m, ++__first) - __out[__m] = *__first; - - while (__first != __last) - { - ++__t; - _Distance __M = std::rand() % (__t); - if (__M < __n) - __out[__M] = *__first; - ++__first; - } - return __out + __m; - } - - template - _RandomAccessIterator - __random_sample(_InputIterator __first, _InputIterator __last, - _RandomAccessIterator __out, - _RandomNumberGenerator& __rand, - const _Distance __n) - { - // concept requirements - __glibcxx_function_requires(_UnaryFunctionConcept< - _RandomNumberGenerator, _Distance, _Distance>) - - _Distance __m = 0; - _Distance __t = __n; - for ( ; __first != __last && __m < __n; ++__m, ++__first) - __out[__m] = *__first; - - while (__first != __last) - { - ++__t; - _Distance __M = __rand(__t); - if (__M < __n) - __out[__M] = *__first; - ++__first; - } - return __out + __m; - } - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template - inline _RandomAccessIterator - random_sample(_InputIterator __first, _InputIterator __last, - _RandomAccessIterator __out_first, - _RandomAccessIterator __out_last) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_requires_valid_range(__first, __last); - __glibcxx_requires_valid_range(__out_first, __out_last); - - return __random_sample(__first, __last, - __out_first, __out_last - __out_first); - } - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template - inline _RandomAccessIterator - random_sample(_InputIterator __first, _InputIterator __last, - _RandomAccessIterator __out_first, - _RandomAccessIterator __out_last, - _RandomNumberGenerator& __rand) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_requires_valid_range(__first, __last); - __glibcxx_requires_valid_range(__out_first, __out_last); - - return __random_sample(__first, __last, - __out_first, __rand, - __out_last - __out_first); - } - -#if __cplusplus >= 201103L - using std::is_heap; -#else - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template - inline bool - is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) - { - // concept requirements - __glibcxx_function_requires(_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_RandomAccessIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__is_heap(__first, __last - __first); - } - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template - inline bool - is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _StrictWeakOrdering __comp) - { - // concept requirements - __glibcxx_function_requires(_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering, - typename iterator_traits<_RandomAccessIterator>::value_type, - typename iterator_traits<_RandomAccessIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - return std::__is_heap(__first, __comp, __last - __first); - } -#endif - -#if __cplusplus >= 201103L - using std::is_sorted; -#else - // is_sorted, a predicated testing whether a range is sorted in - // nondescending order. This is an extension, not part of the C++ - // standard. - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template - bool - is_sorted(_ForwardIterator __first, _ForwardIterator __last) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - if (__first == __last) - return true; - - _ForwardIterator __next = __first; - for (++__next; __next != __last; __first = __next, ++__next) - if (*__next < *__first) - return false; - return true; - } - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template - bool - is_sorted(_ForwardIterator __first, _ForwardIterator __last, - _StrictWeakOrdering __comp) - { - // concept requirements - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - __glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering, - typename iterator_traits<_ForwardIterator>::value_type, - typename iterator_traits<_ForwardIterator>::value_type>) - __glibcxx_requires_valid_range(__first, __last); - - if (__first == __last) - return true; - - _ForwardIterator __next = __first; - for (++__next; __next != __last; __first = __next, ++__next) - if (__comp(*__next, *__first)) - return false; - return true; - } -#endif // C++11 - - /** - * @brief Find the median of three values. - * @param __a A value. - * @param __b A value. - * @param __c A value. - * @return One of @p a, @p b or @p c. - * - * If @c {l,m,n} is some convolution of @p {a,b,c} such that @c l<=m<=n - * then the value returned will be @c m. - * This is an SGI extension. - * @ingroup SGIextensions - */ - template - const _Tp& - __median(const _Tp& __a, const _Tp& __b, const _Tp& __c) - { - // concept requirements - __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) - if (__a < __b) - if (__b < __c) - return __b; - else if (__a < __c) - return __c; - else - return __a; - else if (__a < __c) - return __a; - else if (__b < __c) - return __c; - else - return __b; - } - - /** - * @brief Find the median of three values using a predicate for comparison. - * @param __a A value. - * @param __b A value. - * @param __c A value. - * @param __comp A binary predicate. - * @return One of @p a, @p b or @p c. - * - * If @c {l,m,n} is some convolution of @p {a,b,c} such that @p comp(l,m) - * and @p comp(m,n) are both true then the value returned will be @c m. - * This is an SGI extension. - * @ingroup SGIextensions - */ - template - const _Tp& - __median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp) - { - // concept requirements - __glibcxx_function_requires(_BinaryFunctionConcept<_Compare, bool, - _Tp, _Tp>) - if (__comp(__a, __b)) - if (__comp(__b, __c)) - return __b; - else if (__comp(__a, __c)) - return __c; - else - return __a; - else if (__comp(__a, __c)) - return __a; - else if (__comp(__b, __c)) - return __c; - else - return __b; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _EXT_ALGORITHM */ diff --git a/openflow/usr/include/c++/5/ext/aligned_buffer.h b/openflow/usr/include/c++/5/ext/aligned_buffer.h deleted file mode 100644 index d023bc1..0000000 --- a/openflow/usr/include/c++/5/ext/aligned_buffer.h +++ /dev/null @@ -1,119 +0,0 @@ -// Aligned memory buffer -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ext/aligned_buffer.h - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _ALIGNED_BUFFER_H -#define _ALIGNED_BUFFER_H 1 - -#pragma GCC system_header - -#if __cplusplus >= 201103L -# include -#else -# include -#endif - -namespace __gnu_cxx -{ - // A utility type containing a POD object that can hold an object of type - // _Tp initialized via placement new or allocator_traits::construct. - // Intended for use as a data member subobject, use __aligned_buffer for - // complete objects. - template - struct __aligned_membuf - { - // Target macro ADJUST_FIELD_ALIGN can produce different alignment for - // types when used as class members. __aligned_membuf is intended - // for use as a class member, so align the buffer as for a class member. - struct _Tp2 { _Tp _M_t; }; - - alignas(__alignof__(_Tp2::_M_t)) unsigned char _M_storage[sizeof(_Tp)]; - - __aligned_membuf() = default; - - // Can be used to avoid value-initialization zeroing _M_storage. - __aligned_membuf(std::nullptr_t) { } - - void* - _M_addr() noexcept - { return static_cast(&_M_storage); } - - const void* - _M_addr() const noexcept - { return static_cast(&_M_storage); } - - _Tp* - _M_ptr() noexcept - { return static_cast<_Tp*>(_M_addr()); } - - const _Tp* - _M_ptr() const noexcept - { return static_cast(_M_addr()); } - }; - - // Similar to __aligned_membuf but aligned for complete objects, not members. - // This type is used in , , - // and , but ideally they would use __aligned_membuf - // instead, as it has smaller size for some types on some targets. - // This type is still used to avoid an ABI change. - template - struct __aligned_buffer - : std::aligned_storage::value> - { - typename - std::aligned_storage::value>::type - _M_storage; - - __aligned_buffer() = default; - - // Can be used to avoid value-initialization - __aligned_buffer(std::nullptr_t) { } - - void* - _M_addr() noexcept - { - return static_cast(&_M_storage); - } - - const void* - _M_addr() const noexcept - { - return static_cast(&_M_storage); - } - - _Tp* - _M_ptr() noexcept - { return static_cast<_Tp*>(_M_addr()); } - - const _Tp* - _M_ptr() const noexcept - { return static_cast(_M_addr()); } - }; - -} // namespace - -#endif /* _ALIGNED_BUFFER_H */ diff --git a/openflow/usr/include/c++/5/ext/alloc_traits.h b/openflow/usr/include/c++/5/ext/alloc_traits.h deleted file mode 100644 index 06bc70a..0000000 --- a/openflow/usr/include/c++/5/ext/alloc_traits.h +++ /dev/null @@ -1,215 +0,0 @@ -// Allocator traits -*- C++ -*- - -// Copyright (C) 2011-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ext/alloc_traits.h - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _EXT_ALLOC_TRAITS_H -#define _EXT_ALLOC_TRAITS_H 1 - -#pragma GCC system_header - -#if __cplusplus >= 201103L -# include -# include -#else -# include // for __alloc_swap -#endif - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -#if __cplusplus >= 201103L - template - struct __allocator_always_compares_equal : std::false_type { }; - - template - struct __allocator_always_compares_equal> - : std::true_type { }; - - template struct array_allocator; - - template - struct __allocator_always_compares_equal> - : std::true_type { }; - - template struct bitmap_allocator; - - template - struct __allocator_always_compares_equal> - : std::true_type { }; - - template struct malloc_allocator; - - template - struct __allocator_always_compares_equal> - : std::true_type { }; - - template struct mt_allocator; - - template - struct __allocator_always_compares_equal> - : std::true_type { }; - - template struct new_allocator; - - template - struct __allocator_always_compares_equal> - : std::true_type { }; - - template struct pool_allocator; - - template - struct __allocator_always_compares_equal> - : std::true_type { }; -#endif - -/** - * @brief Uniform interface to C++98 and C++0x allocators. - * @ingroup allocators -*/ -template - struct __alloc_traits -#if __cplusplus >= 201103L - : std::allocator_traits<_Alloc> -#endif - { - typedef _Alloc allocator_type; -#if __cplusplus >= 201103L - typedef std::allocator_traits<_Alloc> _Base_type; - typedef typename _Base_type::value_type value_type; - typedef typename _Base_type::pointer pointer; - typedef typename _Base_type::const_pointer const_pointer; - typedef typename _Base_type::size_type size_type; - typedef typename _Base_type::difference_type difference_type; - // C++11 allocators do not define reference or const_reference - typedef value_type& reference; - typedef const value_type& const_reference; - using _Base_type::allocate; - using _Base_type::deallocate; - using _Base_type::construct; - using _Base_type::destroy; - using _Base_type::max_size; - - private: - template - using __is_custom_pointer - = std::__and_, - std::__not_>>; - - public: - // overload construct for non-standard pointer types - template - static typename std::enable_if<__is_custom_pointer<_Ptr>::value>::type - construct(_Alloc& __a, _Ptr __p, _Args&&... __args) - { - _Base_type::construct(__a, std::addressof(*__p), - std::forward<_Args>(__args)...); - } - - // overload destroy for non-standard pointer types - template - static typename std::enable_if<__is_custom_pointer<_Ptr>::value>::type - destroy(_Alloc& __a, _Ptr __p) - { _Base_type::destroy(__a, std::addressof(*__p)); } - - static _Alloc _S_select_on_copy(const _Alloc& __a) - { return _Base_type::select_on_container_copy_construction(__a); } - - static void _S_on_swap(_Alloc& __a, _Alloc& __b) - { std::__alloc_on_swap(__a, __b); } - - static constexpr bool _S_propagate_on_copy_assign() - { return _Base_type::propagate_on_container_copy_assignment::value; } - - static constexpr bool _S_propagate_on_move_assign() - { return _Base_type::propagate_on_container_move_assignment::value; } - - static constexpr bool _S_propagate_on_swap() - { return _Base_type::propagate_on_container_swap::value; } - - static constexpr bool _S_always_equal() - { return __allocator_always_compares_equal<_Alloc>::value; } - - static constexpr bool _S_nothrow_move() - { return _S_propagate_on_move_assign() || _S_always_equal(); } - - static constexpr bool _S_nothrow_swap() - { - using std::swap; - return !_S_propagate_on_swap() - || noexcept(swap(std::declval<_Alloc&>(), std::declval<_Alloc&>())); - } - - template - struct rebind - { typedef typename _Base_type::template rebind_alloc<_Tp> other; }; -#else - - typedef typename _Alloc::pointer pointer; - typedef typename _Alloc::const_pointer const_pointer; - typedef typename _Alloc::value_type value_type; - typedef typename _Alloc::reference reference; - typedef typename _Alloc::const_reference const_reference; - typedef typename _Alloc::size_type size_type; - typedef typename _Alloc::difference_type difference_type; - - static pointer - allocate(_Alloc& __a, size_type __n) - { return __a.allocate(__n); } - - static void deallocate(_Alloc& __a, pointer __p, size_type __n) - { __a.deallocate(__p, __n); } - - template - static void construct(_Alloc& __a, pointer __p, const _Tp& __arg) - { __a.construct(__p, __arg); } - - static void destroy(_Alloc& __a, pointer __p) - { __a.destroy(__p); } - - static size_type max_size(const _Alloc& __a) - { return __a.max_size(); } - - static const _Alloc& _S_select_on_copy(const _Alloc& __a) { return __a; } - - static void _S_on_swap(_Alloc& __a, _Alloc& __b) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 431. Swapping containers with unequal allocators. - std::__alloc_swap<_Alloc>::_S_do_it(__a, __b); - } - - template - struct rebind - { typedef typename _Alloc::template rebind<_Tp>::other other; }; -#endif - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace __gnu_cxx - -#endif diff --git a/openflow/usr/include/c++/5/ext/array_allocator.h b/openflow/usr/include/c++/5/ext/array_allocator.h deleted file mode 100644 index d909cea..0000000 --- a/openflow/usr/include/c++/5/ext/array_allocator.h +++ /dev/null @@ -1,180 +0,0 @@ -// array allocator -*- C++ -*- - -// Copyright (C) 2004-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ext/array_allocator.h - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _ARRAY_ALLOCATOR_H -#define _ARRAY_ALLOCATOR_H 1 - -#include -#include -#include -#include -#include -#if __cplusplus >= 201103L -#include -#endif - -// Suppress deprecated warning for this file. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::size_t; - using std::ptrdiff_t; - - /// Base class. - template - class array_allocator_base - { - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - - pointer - address(reference __x) const _GLIBCXX_NOEXCEPT - { return std::__addressof(__x); } - - const_pointer - address(const_reference __x) const _GLIBCXX_NOEXCEPT - { return std::__addressof(__x); } - - void - deallocate(pointer, size_type) - { - // Does nothing. - } - - size_type - max_size() const _GLIBCXX_USE_NOEXCEPT - { return size_t(-1) / sizeof(_Tp); } - -#if __cplusplus >= 201103L - template - void - construct(_Up* __p, _Args&&... __args) - { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } - - template - void - destroy(_Up* __p) { __p->~_Up(); } -#else - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 402. wrong new expression in [some_] allocator::construct - void - construct(pointer __p, const _Tp& __val) - { ::new((void *)__p) value_type(__val); } - - void - destroy(pointer __p) { __p->~_Tp(); } -#endif - } _GLIBCXX_DEPRECATED; - - /** - * @brief An allocator that uses previously allocated memory. - * This memory can be externally, globally, or otherwise allocated. - * @ingroup allocators - */ - template > - class array_allocator : public array_allocator_base<_Tp> - { - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - typedef _Array array_type; - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2103. std::allocator propagate_on_container_move_assignment - typedef std::true_type propagate_on_container_move_assignment; -#endif - - private: - array_type* _M_array; - size_type _M_used; - - public: - template - struct rebind - { - typedef array_allocator<_Tp1, _Array1> other _GLIBCXX_DEPRECATED; - } _GLIBCXX_DEPRECATED; - - array_allocator(array_type* __array = 0) _GLIBCXX_USE_NOEXCEPT - : _M_array(__array), _M_used(size_type()) { } - - array_allocator(const array_allocator& __o) _GLIBCXX_USE_NOEXCEPT - : _M_array(__o._M_array), _M_used(__o._M_used) { } - - template - array_allocator(const array_allocator<_Tp1, _Array1>&) - _GLIBCXX_USE_NOEXCEPT - : _M_array(0), _M_used(size_type()) { } - - ~array_allocator() _GLIBCXX_USE_NOEXCEPT { } - - pointer - allocate(size_type __n, const void* = 0) - { - if (_M_array == 0 || _M_used + __n > _M_array->size()) - std::__throw_bad_alloc(); - pointer __ret = _M_array->begin() + _M_used; - _M_used += __n; - return __ret; - } - } _GLIBCXX_DEPRECATED; - - template - inline bool - operator==(const array_allocator<_Tp, _Array>&, - const array_allocator<_Tp, _Array>&) - { return true; } - - template - inline bool - operator!=(const array_allocator<_Tp, _Array>&, - const array_allocator<_Tp, _Array>&) - { return false; } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#pragma GCC diagnostic pop - -#endif diff --git a/openflow/usr/include/c++/5/ext/atomicity.h b/openflow/usr/include/c++/5/ext/atomicity.h deleted file mode 100644 index aff33f8..0000000 --- a/openflow/usr/include/c++/5/ext/atomicity.h +++ /dev/null @@ -1,117 +0,0 @@ -// Support for atomic operations -*- C++ -*- - -// Copyright (C) 2004-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ext/atomicity.h - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _GLIBCXX_ATOMICITY_H -#define _GLIBCXX_ATOMICITY_H 1 - -#pragma GCC system_header - -#include -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Functions for portable atomic access. - // To abstract locking primitives across all thread policies, use: - // __exchange_and_add_dispatch - // __atomic_add_dispatch -#ifdef _GLIBCXX_ATOMIC_BUILTINS - static inline _Atomic_word - __exchange_and_add(volatile _Atomic_word* __mem, int __val) - { return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } - - static inline void - __atomic_add(volatile _Atomic_word* __mem, int __val) - { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } -#else - _Atomic_word - __attribute__ ((__unused__)) - __exchange_and_add(volatile _Atomic_word*, int) throw (); - - void - __attribute__ ((__unused__)) - __atomic_add(volatile _Atomic_word*, int) throw (); -#endif - - static inline _Atomic_word - __exchange_and_add_single(_Atomic_word* __mem, int __val) - { - _Atomic_word __result = *__mem; - *__mem += __val; - return __result; - } - - static inline void - __atomic_add_single(_Atomic_word* __mem, int __val) - { *__mem += __val; } - - static inline _Atomic_word - __attribute__ ((__unused__)) - __exchange_and_add_dispatch(_Atomic_word* __mem, int __val) - { -#ifdef __GTHREADS - if (__gthread_active_p()) - return __exchange_and_add(__mem, __val); - else - return __exchange_and_add_single(__mem, __val); -#else - return __exchange_and_add_single(__mem, __val); -#endif - } - - static inline void - __attribute__ ((__unused__)) - __atomic_add_dispatch(_Atomic_word* __mem, int __val) - { -#ifdef __GTHREADS - if (__gthread_active_p()) - __atomic_add(__mem, __val); - else - __atomic_add_single(__mem, __val); -#else - __atomic_add_single(__mem, __val); -#endif - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -// Even if the CPU doesn't need a memory barrier, we need to ensure -// that the compiler doesn't reorder memory accesses across the -// barriers. -#ifndef _GLIBCXX_READ_MEM_BARRIER -#define _GLIBCXX_READ_MEM_BARRIER __asm __volatile ("":::"memory") -#endif -#ifndef _GLIBCXX_WRITE_MEM_BARRIER -#define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("":::"memory") -#endif - -#endif diff --git a/openflow/usr/include/c++/5/ext/bitmap_allocator.h b/openflow/usr/include/c++/5/ext/bitmap_allocator.h deleted file mode 100644 index ff55866..0000000 --- a/openflow/usr/include/c++/5/ext/bitmap_allocator.h +++ /dev/null @@ -1,1119 +0,0 @@ -// Bitmap Allocator. -*- C++ -*- - -// Copyright (C) 2004-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ext/bitmap_allocator.h - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _BITMAP_ALLOCATOR_H -#define _BITMAP_ALLOCATOR_H 1 - -#include // For std::pair. -#include // For __throw_bad_alloc(). -#include // For greater_equal, and less_equal. -#include // For operator new. -#include // _GLIBCXX_DEBUG_ASSERT -#include -#include - -/** @brief The constant in the expression below is the alignment - * required in bytes. - */ -#define _BALLOC_ALIGN_BYTES 8 - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ - using std::size_t; - using std::ptrdiff_t; - - namespace __detail - { - _GLIBCXX_BEGIN_NAMESPACE_VERSION - /** @class __mini_vector bitmap_allocator.h bitmap_allocator.h - * - * @brief __mini_vector<> is a stripped down version of the - * full-fledged std::vector<>. - * - * It is to be used only for built-in types or PODs. Notable - * differences are: - * - * 1. Not all accessor functions are present. - * 2. Used ONLY for PODs. - * 3. No Allocator template argument. Uses ::operator new() to get - * memory, and ::operator delete() to free it. - * Caveat: The dtor does NOT free the memory allocated, so this a - * memory-leaking vector! - */ - template - class __mini_vector - { - __mini_vector(const __mini_vector&); - __mini_vector& operator=(const __mini_vector&); - - public: - typedef _Tp value_type; - typedef _Tp* pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef pointer iterator; - - private: - pointer _M_start; - pointer _M_finish; - pointer _M_end_of_storage; - - size_type - _M_space_left() const throw() - { return _M_end_of_storage - _M_finish; } - - pointer - allocate(size_type __n) - { return static_cast(::operator new(__n * sizeof(_Tp))); } - - void - deallocate(pointer __p, size_type) - { ::operator delete(__p); } - - public: - // Members used: size(), push_back(), pop_back(), - // insert(iterator, const_reference), erase(iterator), - // begin(), end(), back(), operator[]. - - __mini_vector() - : _M_start(0), _M_finish(0), _M_end_of_storage(0) { } - - size_type - size() const throw() - { return _M_finish - _M_start; } - - iterator - begin() const throw() - { return this->_M_start; } - - iterator - end() const throw() - { return this->_M_finish; } - - reference - back() const throw() - { return *(this->end() - 1); } - - reference - operator[](const size_type __pos) const throw() - { return this->_M_start[__pos]; } - - void - insert(iterator __pos, const_reference __x); - - void - push_back(const_reference __x) - { - if (this->_M_space_left()) - { - *this->end() = __x; - ++this->_M_finish; - } - else - this->insert(this->end(), __x); - } - - void - pop_back() throw() - { --this->_M_finish; } - - void - erase(iterator __pos) throw(); - - void - clear() throw() - { this->_M_finish = this->_M_start; } - }; - - // Out of line function definitions. - template - void __mini_vector<_Tp>:: - insert(iterator __pos, const_reference __x) - { - if (this->_M_space_left()) - { - size_type __to_move = this->_M_finish - __pos; - iterator __dest = this->end(); - iterator __src = this->end() - 1; - - ++this->_M_finish; - while (__to_move) - { - *__dest = *__src; - --__dest; --__src; --__to_move; - } - *__pos = __x; - } - else - { - size_type __new_size = this->size() ? this->size() * 2 : 1; - iterator __new_start = this->allocate(__new_size); - iterator __first = this->begin(); - iterator __start = __new_start; - while (__first != __pos) - { - *__start = *__first; - ++__start; ++__first; - } - *__start = __x; - ++__start; - while (__first != this->end()) - { - *__start = *__first; - ++__start; ++__first; - } - if (this->_M_start) - this->deallocate(this->_M_start, this->size()); - - this->_M_start = __new_start; - this->_M_finish = __start; - this->_M_end_of_storage = this->_M_start + __new_size; - } - } - - template - void __mini_vector<_Tp>:: - erase(iterator __pos) throw() - { - while (__pos + 1 != this->end()) - { - *__pos = __pos[1]; - ++__pos; - } - --this->_M_finish; - } - - - template - struct __mv_iter_traits - { - typedef typename _Tp::value_type value_type; - typedef typename _Tp::difference_type difference_type; - }; - - template - struct __mv_iter_traits<_Tp*> - { - typedef _Tp value_type; - typedef ptrdiff_t difference_type; - }; - - enum - { - bits_per_byte = 8, - bits_per_block = sizeof(size_t) * size_t(bits_per_byte) - }; - - template - _ForwardIterator - __lower_bound(_ForwardIterator __first, _ForwardIterator __last, - const _Tp& __val, _Compare __comp) - { - typedef typename __mv_iter_traits<_ForwardIterator>::difference_type - _DistanceType; - - _DistanceType __len = __last - __first; - _DistanceType __half; - _ForwardIterator __middle; - - while (__len > 0) - { - __half = __len >> 1; - __middle = __first; - __middle += __half; - if (__comp(*__middle, __val)) - { - __first = __middle; - ++__first; - __len = __len - __half - 1; - } - else - __len = __half; - } - return __first; - } - - /** @brief The number of Blocks pointed to by the address pair - * passed to the function. - */ - template - inline size_t - __num_blocks(_AddrPair __ap) - { return (__ap.second - __ap.first) + 1; } - - /** @brief The number of Bit-maps pointed to by the address pair - * passed to the function. - */ - template - inline size_t - __num_bitmaps(_AddrPair __ap) - { return __num_blocks(__ap) / size_t(bits_per_block); } - - // _Tp should be a pointer type. - template - class _Inclusive_between - : public std::unary_function, bool> - { - typedef _Tp pointer; - pointer _M_ptr_value; - typedef typename std::pair<_Tp, _Tp> _Block_pair; - - public: - _Inclusive_between(pointer __ptr) : _M_ptr_value(__ptr) - { } - - bool - operator()(_Block_pair __bp) const throw() - { - if (std::less_equal()(_M_ptr_value, __bp.second) - && std::greater_equal()(_M_ptr_value, __bp.first)) - return true; - else - return false; - } - }; - - // Used to pass a Functor to functions by reference. - template - class _Functor_Ref - : public std::unary_function - { - _Functor& _M_fref; - - public: - typedef typename _Functor::argument_type argument_type; - typedef typename _Functor::result_type result_type; - - _Functor_Ref(_Functor& __fref) : _M_fref(__fref) - { } - - result_type - operator()(argument_type __arg) - { return _M_fref(__arg); } - }; - - /** @class _Ffit_finder bitmap_allocator.h bitmap_allocator.h - * - * @brief The class which acts as a predicate for applying the - * first-fit memory allocation policy for the bitmap allocator. - */ - // _Tp should be a pointer type, and _Alloc is the Allocator for - // the vector. - template - class _Ffit_finder - : public std::unary_function, bool> - { - typedef typename std::pair<_Tp, _Tp> _Block_pair; - typedef typename __detail::__mini_vector<_Block_pair> _BPVector; - typedef typename _BPVector::difference_type _Counter_type; - - size_t* _M_pbitmap; - _Counter_type _M_data_offset; - - public: - _Ffit_finder() : _M_pbitmap(0), _M_data_offset(0) - { } - - bool - operator()(_Block_pair __bp) throw() - { - // Set the _rover to the last physical location bitmap, - // which is the bitmap which belongs to the first free - // block. Thus, the bitmaps are in exact reverse order of - // the actual memory layout. So, we count down the bitmaps, - // which is the same as moving up the memory. - - // If the used count stored at the start of the Bit Map headers - // is equal to the number of Objects that the current Block can - // store, then there is definitely no space for another single - // object, so just return false. - _Counter_type __diff = __detail::__num_bitmaps(__bp); - - if (*(reinterpret_cast - (__bp.first) - (__diff + 1)) == __detail::__num_blocks(__bp)) - return false; - - size_t* __rover = reinterpret_cast(__bp.first) - 1; - - for (_Counter_type __i = 0; __i < __diff; ++__i) - { - _M_data_offset = __i; - if (*__rover) - { - _M_pbitmap = __rover; - return true; - } - --__rover; - } - return false; - } - - size_t* - _M_get() const throw() - { return _M_pbitmap; } - - _Counter_type - _M_offset() const throw() - { return _M_data_offset * size_t(bits_per_block); } - }; - - /** @class _Bitmap_counter bitmap_allocator.h bitmap_allocator.h - * - * @brief The bitmap counter which acts as the bitmap - * manipulator, and manages the bit-manipulation functions and - * the searching and identification functions on the bit-map. - */ - // _Tp should be a pointer type. - template - class _Bitmap_counter - { - typedef typename - __detail::__mini_vector > _BPVector; - typedef typename _BPVector::size_type _Index_type; - typedef _Tp pointer; - - _BPVector& _M_vbp; - size_t* _M_curr_bmap; - size_t* _M_last_bmap_in_block; - _Index_type _M_curr_index; - - public: - // Use the 2nd parameter with care. Make sure that such an - // entry exists in the vector before passing that particular - // index to this ctor. - _Bitmap_counter(_BPVector& Rvbp, long __index = -1) : _M_vbp(Rvbp) - { this->_M_reset(__index); } - - void - _M_reset(long __index = -1) throw() - { - if (__index == -1) - { - _M_curr_bmap = 0; - _M_curr_index = static_cast<_Index_type>(-1); - return; - } - - _M_curr_index = __index; - _M_curr_bmap = reinterpret_cast - (_M_vbp[_M_curr_index].first) - 1; - - _GLIBCXX_DEBUG_ASSERT(__index <= (long)_M_vbp.size() - 1); - - _M_last_bmap_in_block = _M_curr_bmap - - ((_M_vbp[_M_curr_index].second - - _M_vbp[_M_curr_index].first + 1) - / size_t(bits_per_block) - 1); - } - - // Dangerous Function! Use with extreme care. Pass to this - // function ONLY those values that are known to be correct, - // otherwise this will mess up big time. - void - _M_set_internal_bitmap(size_t* __new_internal_marker) throw() - { _M_curr_bmap = __new_internal_marker; } - - bool - _M_finished() const throw() - { return(_M_curr_bmap == 0); } - - _Bitmap_counter& - operator++() throw() - { - if (_M_curr_bmap == _M_last_bmap_in_block) - { - if (++_M_curr_index == _M_vbp.size()) - _M_curr_bmap = 0; - else - this->_M_reset(_M_curr_index); - } - else - --_M_curr_bmap; - return *this; - } - - size_t* - _M_get() const throw() - { return _M_curr_bmap; } - - pointer - _M_base() const throw() - { return _M_vbp[_M_curr_index].first; } - - _Index_type - _M_offset() const throw() - { - return size_t(bits_per_block) - * ((reinterpret_cast(this->_M_base()) - - _M_curr_bmap) - 1); - } - - _Index_type - _M_where() const throw() - { return _M_curr_index; } - }; - - /** @brief Mark a memory address as allocated by re-setting the - * corresponding bit in the bit-map. - */ - inline void - __bit_allocate(size_t* __pbmap, size_t __pos) throw() - { - size_t __mask = 1 << __pos; - __mask = ~__mask; - *__pbmap &= __mask; - } - - /** @brief Mark a memory address as free by setting the - * corresponding bit in the bit-map. - */ - inline void - __bit_free(size_t* __pbmap, size_t __pos) throw() - { - size_t __mask = 1 << __pos; - *__pbmap |= __mask; - } - - _GLIBCXX_END_NAMESPACE_VERSION - } // namespace __detail - -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** @brief Generic Version of the bsf instruction. - */ - inline size_t - _Bit_scan_forward(size_t __num) - { return static_cast(__builtin_ctzl(__num)); } - - /** @class free_list bitmap_allocator.h bitmap_allocator.h - * - * @brief The free list class for managing chunks of memory to be - * given to and returned by the bitmap_allocator. - */ - class free_list - { - public: - typedef size_t* value_type; - typedef __detail::__mini_vector vector_type; - typedef vector_type::iterator iterator; - typedef __mutex __mutex_type; - - private: - struct _LT_pointer_compare - { - bool - operator()(const size_t* __pui, - const size_t __cui) const throw() - { return *__pui < __cui; } - }; - -#if defined __GTHREADS - __mutex_type& - _M_get_mutex() - { - static __mutex_type _S_mutex; - return _S_mutex; - } -#endif - - vector_type& - _M_get_free_list() - { - static vector_type _S_free_list; - return _S_free_list; - } - - /** @brief Performs validation of memory based on their size. - * - * @param __addr The pointer to the memory block to be - * validated. - * - * Validates the memory block passed to this function and - * appropriately performs the action of managing the free list of - * blocks by adding this block to the free list or deleting this - * or larger blocks from the free list. - */ - void - _M_validate(size_t* __addr) throw() - { - vector_type& __free_list = _M_get_free_list(); - const vector_type::size_type __max_size = 64; - if (__free_list.size() >= __max_size) - { - // Ok, the threshold value has been reached. We determine - // which block to remove from the list of free blocks. - if (*__addr >= *__free_list.back()) - { - // Ok, the new block is greater than or equal to the - // last block in the list of free blocks. We just free - // the new block. - ::operator delete(static_cast(__addr)); - return; - } - else - { - // Deallocate the last block in the list of free lists, - // and insert the new one in its correct position. - ::operator delete(static_cast(__free_list.back())); - __free_list.pop_back(); - } - } - - // Just add the block to the list of free lists unconditionally. - iterator __temp = __detail::__lower_bound - (__free_list.begin(), __free_list.end(), - *__addr, _LT_pointer_compare()); - - // We may insert the new free list before _temp; - __free_list.insert(__temp, __addr); - } - - /** @brief Decides whether the wastage of memory is acceptable for - * the current memory request and returns accordingly. - * - * @param __block_size The size of the block available in the free - * list. - * - * @param __required_size The required size of the memory block. - * - * @return true if the wastage incurred is acceptable, else returns - * false. - */ - bool - _M_should_i_give(size_t __block_size, - size_t __required_size) throw() - { - const size_t __max_wastage_percentage = 36; - if (__block_size >= __required_size && - (((__block_size - __required_size) * 100 / __block_size) - < __max_wastage_percentage)) - return true; - else - return false; - } - - public: - /** @brief This function returns the block of memory to the - * internal free list. - * - * @param __addr The pointer to the memory block that was given - * by a call to the _M_get function. - */ - inline void - _M_insert(size_t* __addr) throw() - { -#if defined __GTHREADS - __scoped_lock __bfl_lock(_M_get_mutex()); -#endif - // Call _M_validate to decide what should be done with - // this particular free list. - this->_M_validate(reinterpret_cast(__addr) - 1); - // See discussion as to why this is 1! - } - - /** @brief This function gets a block of memory of the specified - * size from the free list. - * - * @param __sz The size in bytes of the memory required. - * - * @return A pointer to the new memory block of size at least - * equal to that requested. - */ - size_t* - _M_get(size_t __sz) throw(std::bad_alloc); - - /** @brief This function just clears the internal Free List, and - * gives back all the memory to the OS. - */ - void - _M_clear(); - }; - - - // Forward declare the class. - template - class bitmap_allocator; - - // Specialize for void: - template<> - class bitmap_allocator - { - public: - typedef void* pointer; - typedef const void* const_pointer; - - // Reference-to-void members are impossible. - typedef void value_type; - template - struct rebind - { - typedef bitmap_allocator<_Tp1> other; - }; - }; - - /** - * @brief Bitmap Allocator, primary template. - * @ingroup allocators - */ - template - class bitmap_allocator : private free_list - { - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - typedef free_list::__mutex_type __mutex_type; - - template - struct rebind - { - typedef bitmap_allocator<_Tp1> other; - }; - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2103. propagate_on_container_move_assignment - typedef std::true_type propagate_on_container_move_assignment; -#endif - - private: - template - struct aligned_size - { - enum - { - modulus = _BSize % _AlignSize, - value = _BSize + (modulus ? _AlignSize - (modulus) : 0) - }; - }; - - struct _Alloc_block - { - char __M_unused[aligned_size::value]; - }; - - - typedef typename std::pair<_Alloc_block*, _Alloc_block*> _Block_pair; - - typedef typename __detail::__mini_vector<_Block_pair> _BPVector; - typedef typename _BPVector::iterator _BPiter; - - template - static _BPiter - _S_find(_Predicate __p) - { - _BPiter __first = _S_mem_blocks.begin(); - while (__first != _S_mem_blocks.end() && !__p(*__first)) - ++__first; - return __first; - } - -#if defined _GLIBCXX_DEBUG - // Complexity: O(lg(N)). Where, N is the number of block of size - // sizeof(value_type). - void - _S_check_for_free_blocks() throw() - { - typedef typename __detail::_Ffit_finder<_Alloc_block*> _FFF; - _BPiter __bpi = _S_find(_FFF()); - - _GLIBCXX_DEBUG_ASSERT(__bpi == _S_mem_blocks.end()); - } -#endif - - /** @brief Responsible for exponentially growing the internal - * memory pool. - * - * @throw std::bad_alloc. If memory can not be allocated. - * - * Complexity: O(1), but internally depends upon the - * complexity of the function free_list::_M_get. The part where - * the bitmap headers are written has complexity: O(X),where X - * is the number of blocks of size sizeof(value_type) within - * the newly acquired block. Having a tight bound. - */ - void - _S_refill_pool() throw(std::bad_alloc) - { -#if defined _GLIBCXX_DEBUG - _S_check_for_free_blocks(); -#endif - - const size_t __num_bitmaps = (_S_block_size - / size_t(__detail::bits_per_block)); - const size_t __size_to_allocate = sizeof(size_t) - + _S_block_size * sizeof(_Alloc_block) - + __num_bitmaps * sizeof(size_t); - - size_t* __temp = - reinterpret_cast(this->_M_get(__size_to_allocate)); - *__temp = 0; - ++__temp; - - // The Header information goes at the Beginning of the Block. - _Block_pair __bp = - std::make_pair(reinterpret_cast<_Alloc_block*> - (__temp + __num_bitmaps), - reinterpret_cast<_Alloc_block*> - (__temp + __num_bitmaps) - + _S_block_size - 1); - - // Fill the Vector with this information. - _S_mem_blocks.push_back(__bp); - - for (size_t __i = 0; __i < __num_bitmaps; ++__i) - __temp[__i] = ~static_cast(0); // 1 Indicates all Free. - - _S_block_size *= 2; - } - - static _BPVector _S_mem_blocks; - static size_t _S_block_size; - static __detail::_Bitmap_counter<_Alloc_block*> _S_last_request; - static typename _BPVector::size_type _S_last_dealloc_index; -#if defined __GTHREADS - static __mutex_type _S_mut; -#endif - - public: - - /** @brief Allocates memory for a single object of size - * sizeof(_Tp). - * - * @throw std::bad_alloc. If memory can not be allocated. - * - * Complexity: Worst case complexity is O(N), but that - * is hardly ever hit. If and when this particular case is - * encountered, the next few cases are guaranteed to have a - * worst case complexity of O(1)! That's why this function - * performs very well on average. You can consider this - * function to have a complexity referred to commonly as: - * Amortized Constant time. - */ - pointer - _M_allocate_single_object() throw(std::bad_alloc) - { -#if defined __GTHREADS - __scoped_lock __bit_lock(_S_mut); -#endif - - // The algorithm is something like this: The last_request - // variable points to the last accessed Bit Map. When such a - // condition occurs, we try to find a free block in the - // current bitmap, or succeeding bitmaps until the last bitmap - // is reached. If no free block turns up, we resort to First - // Fit method. - - // WARNING: Do not re-order the condition in the while - // statement below, because it relies on C++'s short-circuit - // evaluation. The return from _S_last_request->_M_get() will - // NOT be dereference able if _S_last_request->_M_finished() - // returns true. This would inevitably lead to a NULL pointer - // dereference if tinkered with. - while (_S_last_request._M_finished() == false - && (*(_S_last_request._M_get()) == 0)) - _S_last_request.operator++(); - - if (__builtin_expect(_S_last_request._M_finished() == true, false)) - { - // Fall Back to First Fit algorithm. - typedef typename __detail::_Ffit_finder<_Alloc_block*> _FFF; - _FFF __fff; - _BPiter __bpi = _S_find(__detail::_Functor_Ref<_FFF>(__fff)); - - if (__bpi != _S_mem_blocks.end()) - { - // Search was successful. Ok, now mark the first bit from - // the right as 0, meaning Allocated. This bit is obtained - // by calling _M_get() on __fff. - size_t __nz_bit = _Bit_scan_forward(*__fff._M_get()); - __detail::__bit_allocate(__fff._M_get(), __nz_bit); - - _S_last_request._M_reset(__bpi - _S_mem_blocks.begin()); - - // Now, get the address of the bit we marked as allocated. - pointer __ret = reinterpret_cast - (__bpi->first + __fff._M_offset() + __nz_bit); - size_t* __puse_count = - reinterpret_cast - (__bpi->first) - (__detail::__num_bitmaps(*__bpi) + 1); - - ++(*__puse_count); - return __ret; - } - else - { - // Search was unsuccessful. We Add more memory to the - // pool by calling _S_refill_pool(). - _S_refill_pool(); - - // _M_Reset the _S_last_request structure to the first - // free block's bit map. - _S_last_request._M_reset(_S_mem_blocks.size() - 1); - - // Now, mark that bit as allocated. - } - } - - // _S_last_request holds a pointer to a valid bit map, that - // points to a free block in memory. - size_t __nz_bit = _Bit_scan_forward(*_S_last_request._M_get()); - __detail::__bit_allocate(_S_last_request._M_get(), __nz_bit); - - pointer __ret = reinterpret_cast - (_S_last_request._M_base() + _S_last_request._M_offset() + __nz_bit); - - size_t* __puse_count = reinterpret_cast - (_S_mem_blocks[_S_last_request._M_where()].first) - - (__detail:: - __num_bitmaps(_S_mem_blocks[_S_last_request._M_where()]) + 1); - - ++(*__puse_count); - return __ret; - } - - /** @brief Deallocates memory that belongs to a single object of - * size sizeof(_Tp). - * - * Complexity: O(lg(N)), but the worst case is not hit - * often! This is because containers usually deallocate memory - * close to each other and this case is handled in O(1) time by - * the deallocate function. - */ - void - _M_deallocate_single_object(pointer __p) throw() - { -#if defined __GTHREADS - __scoped_lock __bit_lock(_S_mut); -#endif - _Alloc_block* __real_p = reinterpret_cast<_Alloc_block*>(__p); - - typedef typename _BPVector::iterator _Iterator; - typedef typename _BPVector::difference_type _Difference_type; - - _Difference_type __diff; - long __displacement; - - _GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index >= 0); - - __detail::_Inclusive_between<_Alloc_block*> __ibt(__real_p); - if (__ibt(_S_mem_blocks[_S_last_dealloc_index])) - { - _GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index - <= _S_mem_blocks.size() - 1); - - // Initial Assumption was correct! - __diff = _S_last_dealloc_index; - __displacement = __real_p - _S_mem_blocks[__diff].first; - } - else - { - _Iterator _iter = _S_find(__ibt); - - _GLIBCXX_DEBUG_ASSERT(_iter != _S_mem_blocks.end()); - - __diff = _iter - _S_mem_blocks.begin(); - __displacement = __real_p - _S_mem_blocks[__diff].first; - _S_last_dealloc_index = __diff; - } - - // Get the position of the iterator that has been found. - const size_t __rotate = (__displacement - % size_t(__detail::bits_per_block)); - size_t* __bitmapC = - reinterpret_cast - (_S_mem_blocks[__diff].first) - 1; - __bitmapC -= (__displacement / size_t(__detail::bits_per_block)); - - __detail::__bit_free(__bitmapC, __rotate); - size_t* __puse_count = reinterpret_cast - (_S_mem_blocks[__diff].first) - - (__detail::__num_bitmaps(_S_mem_blocks[__diff]) + 1); - - _GLIBCXX_DEBUG_ASSERT(*__puse_count != 0); - - --(*__puse_count); - - if (__builtin_expect(*__puse_count == 0, false)) - { - _S_block_size /= 2; - - // We can safely remove this block. - // _Block_pair __bp = _S_mem_blocks[__diff]; - this->_M_insert(__puse_count); - _S_mem_blocks.erase(_S_mem_blocks.begin() + __diff); - - // Reset the _S_last_request variable to reflect the - // erased block. We do this to protect future requests - // after the last block has been removed from a particular - // memory Chunk, which in turn has been returned to the - // free list, and hence had been erased from the vector, - // so the size of the vector gets reduced by 1. - if ((_Difference_type)_S_last_request._M_where() >= __diff--) - _S_last_request._M_reset(__diff); - - // If the Index into the vector of the region of memory - // that might hold the next address that will be passed to - // deallocated may have been invalidated due to the above - // erase procedure being called on the vector, hence we - // try to restore this invariant too. - if (_S_last_dealloc_index >= _S_mem_blocks.size()) - { - _S_last_dealloc_index =(__diff != -1 ? __diff : 0); - _GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index >= 0); - } - } - } - - public: - bitmap_allocator() _GLIBCXX_USE_NOEXCEPT - { } - - bitmap_allocator(const bitmap_allocator&) _GLIBCXX_USE_NOEXCEPT - { } - - template - bitmap_allocator(const bitmap_allocator<_Tp1>&) _GLIBCXX_USE_NOEXCEPT - { } - - ~bitmap_allocator() _GLIBCXX_USE_NOEXCEPT - { } - - pointer - allocate(size_type __n) - { - if (__n > this->max_size()) - std::__throw_bad_alloc(); - - if (__builtin_expect(__n == 1, true)) - return this->_M_allocate_single_object(); - else - { - const size_type __b = __n * sizeof(value_type); - return reinterpret_cast(::operator new(__b)); - } - } - - pointer - allocate(size_type __n, typename bitmap_allocator::const_pointer) - { return allocate(__n); } - - void - deallocate(pointer __p, size_type __n) throw() - { - if (__builtin_expect(__p != 0, true)) - { - if (__builtin_expect(__n == 1, true)) - this->_M_deallocate_single_object(__p); - else - ::operator delete(__p); - } - } - - pointer - address(reference __r) const _GLIBCXX_NOEXCEPT - { return std::__addressof(__r); } - - const_pointer - address(const_reference __r) const _GLIBCXX_NOEXCEPT - { return std::__addressof(__r); } - - size_type - max_size() const _GLIBCXX_USE_NOEXCEPT - { return size_type(-1) / sizeof(value_type); } - -#if __cplusplus >= 201103L - template - void - construct(_Up* __p, _Args&&... __args) - { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } - - template - void - destroy(_Up* __p) - { __p->~_Up(); } -#else - void - construct(pointer __p, const_reference __data) - { ::new((void *)__p) value_type(__data); } - - void - destroy(pointer __p) - { __p->~value_type(); } -#endif - }; - - template - bool - operator==(const bitmap_allocator<_Tp1>&, - const bitmap_allocator<_Tp2>&) throw() - { return true; } - - template - bool - operator!=(const bitmap_allocator<_Tp1>&, - const bitmap_allocator<_Tp2>&) throw() - { return false; } - - // Static member definitions. - template - typename bitmap_allocator<_Tp>::_BPVector - bitmap_allocator<_Tp>::_S_mem_blocks; - - template - size_t bitmap_allocator<_Tp>::_S_block_size = - 2 * size_t(__detail::bits_per_block); - - template - typename bitmap_allocator<_Tp>::_BPVector::size_type - bitmap_allocator<_Tp>::_S_last_dealloc_index = 0; - - template - __detail::_Bitmap_counter - ::_Alloc_block*> - bitmap_allocator<_Tp>::_S_last_request(_S_mem_blocks); - -#if defined __GTHREADS - template - typename bitmap_allocator<_Tp>::__mutex_type - bitmap_allocator<_Tp>::_S_mut; -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace __gnu_cxx - -#endif - diff --git a/openflow/usr/include/c++/5/ext/cast.h b/openflow/usr/include/c++/5/ext/cast.h deleted file mode 100644 index 64611aa..0000000 --- a/openflow/usr/include/c++/5/ext/cast.h +++ /dev/null @@ -1,121 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2008-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ext/cast.h - * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{ext/pointer.h} - */ - -#ifndef _GLIBCXX_CAST_H -#define _GLIBCXX_CAST_H 1 - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * These functions are here to allow containers to support non standard - * pointer types. For normal pointers, these resolve to the use of the - * standard cast operation. For other types the functions will perform - * the appropriate cast to/from the custom pointer class so long as that - * class meets the following conditions: - * 1) has a typedef element_type which names tehe type it points to. - * 2) has a get() const method which returns element_type*. - * 3) has a constructor which can take one element_type* argument. - */ - - /** - * This type supports the semantics of the pointer cast operators (below.) - */ - template - struct _Caster - { typedef typename _ToType::element_type* type; }; - - template - struct _Caster<_ToType*> - { typedef _ToType* type; }; - - /** - * Casting operations for cases where _FromType is not a standard pointer. - * _ToType can be a standard or non-standard pointer. Given that _FromType - * is not a pointer, it must have a get() method that returns the standard - * pointer equivalent of the address it points to, and must have an - * element_type typedef which names the type it points to. - */ - template - inline _ToType - __static_pointer_cast(const _FromType& __arg) - { return _ToType(static_cast:: - type>(__arg.get())); } - - template - inline _ToType - __dynamic_pointer_cast(const _FromType& __arg) - { return _ToType(dynamic_cast:: - type>(__arg.get())); } - - template - inline _ToType - __const_pointer_cast(const _FromType& __arg) - { return _ToType(const_cast:: - type>(__arg.get())); } - - template - inline _ToType - __reinterpret_pointer_cast(const _FromType& __arg) - { return _ToType(reinterpret_cast:: - type>(__arg.get())); } - - /** - * Casting operations for cases where _FromType is a standard pointer. - * _ToType can be a standard or non-standard pointer. - */ - template - inline _ToType - __static_pointer_cast(_FromType* __arg) - { return _ToType(static_cast:: - type>(__arg)); } - - template - inline _ToType - __dynamic_pointer_cast(_FromType* __arg) - { return _ToType(dynamic_cast:: - type>(__arg)); } - - template - inline _ToType - __const_pointer_cast(_FromType* __arg) - { return _ToType(const_cast:: - type>(__arg)); } - - template - inline _ToType - __reinterpret_pointer_cast(_FromType* __arg) - { return _ToType(reinterpret_cast:: - type>(__arg)); } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif // _GLIBCXX_CAST_H diff --git a/openflow/usr/include/c++/5/ext/cmath b/openflow/usr/include/c++/5/ext/cmath deleted file mode 100644 index 49e1bcb..0000000 --- a/openflow/usr/include/c++/5/ext/cmath +++ /dev/null @@ -1,152 +0,0 @@ -// Math extensions -*- C++ -*- - -// Copyright (C) 2013-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ext/cmath - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _EXT_CMATH -#define _EXT_CMATH 1 - -#pragma GCC system_header - -#if __cplusplus < 201103L -# include -#else - -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // A class for math constants. - template - struct __math_constants - { - static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); - - // Constant @f$ \pi @f$. - static constexpr _RealType __pi = 3.1415926535897932384626433832795029L; - // Constant @f$ \pi / 2 @f$. - static constexpr _RealType __pi_half = 1.5707963267948966192313216916397514L; - // Constant @f$ \pi / 3 @f$. - static constexpr _RealType __pi_third = 1.0471975511965977461542144610931676L; - // Constant @f$ \pi / 4 @f$. - static constexpr _RealType __pi_quarter = 0.7853981633974483096156608458198757L; - // Constant @f$ \sqrt(\pi / 2) @f$. - static constexpr _RealType __root_pi_div_2 = 1.2533141373155002512078826424055226L; - // Constant @f$ 1 / \pi @f$. - static constexpr _RealType __one_div_pi = 0.3183098861837906715377675267450287L; - // Constant @f$ 2 / \pi @f$. - static constexpr _RealType __two_div_pi = 0.6366197723675813430755350534900574L; - // Constant @f$ 2 / \sqrt(\pi) @f$. - static constexpr _RealType __two_div_root_pi = 1.1283791670955125738961589031215452L; - - // Constant Euler's number @f$ e @f$. - static constexpr _RealType __e = 2.7182818284590452353602874713526625L; - // Constant @f$ 1 / e @f$. - static constexpr _RealType __one_div_e = 0.36787944117144232159552377016146087L; - // Constant @f$ \log_2(e) @f$. - static constexpr _RealType __log2_e = 1.4426950408889634073599246810018921L; - // Constant @f$ \log_10(e) @f$. - static constexpr _RealType __log10_e = 0.4342944819032518276511289189166051L; - // Constant @f$ \ln(2) @f$. - static constexpr _RealType __ln_2 = 0.6931471805599453094172321214581766L; - // Constant @f$ \ln(3) @f$. - static constexpr _RealType __ln_3 = 1.0986122886681096913952452369225257L; - // Constant @f$ \ln(10) @f$. - static constexpr _RealType __ln_10 = 2.3025850929940456840179914546843642L; - - // Constant Euler-Mascheroni @f$ \gamma_E @f$. - static constexpr _RealType __gamma_e = 0.5772156649015328606065120900824024L; - // Constant Golden Ratio @f$ \phi @f$. - static constexpr _RealType __phi = 1.6180339887498948482045868343656381L; - - // Constant @f$ \sqrt(2) @f$. - static constexpr _RealType __root_2 = 1.4142135623730950488016887242096981L; - // Constant @f$ \sqrt(3) @f$. - static constexpr _RealType __root_3 = 1.7320508075688772935274463415058724L; - // Constant @f$ \sqrt(5) @f$. - static constexpr _RealType __root_5 = 2.2360679774997896964091736687312762L; - // Constant @f$ \sqrt(7) @f$. - static constexpr _RealType __root_7 = 2.6457513110645905905016157536392604L; - // Constant @f$ 1 / \sqrt(2) @f$. - static constexpr _RealType __one_div_root_2 = 0.7071067811865475244008443621048490L; - }; - - // And the template definitions for the constants. - template - constexpr _RealType __math_constants<_RealType>::__pi; - template - constexpr _RealType __math_constants<_RealType>::__pi_half; - template - constexpr _RealType __math_constants<_RealType>::__pi_third; - template - constexpr _RealType __math_constants<_RealType>::__pi_quarter; - template - constexpr _RealType __math_constants<_RealType>::__root_pi_div_2; - template - constexpr _RealType __math_constants<_RealType>::__one_div_pi; - template - constexpr _RealType __math_constants<_RealType>::__two_div_pi; - template - constexpr _RealType __math_constants<_RealType>::__two_div_root_pi; - template - constexpr _RealType __math_constants<_RealType>::__e; - template - constexpr _RealType __math_constants<_RealType>::__one_div_e; - template - constexpr _RealType __math_constants<_RealType>::__log2_e; - template - constexpr _RealType __math_constants<_RealType>::__log10_e; - template - constexpr _RealType __math_constants<_RealType>::__ln_2; - template - constexpr _RealType __math_constants<_RealType>::__ln_3; - template - constexpr _RealType __math_constants<_RealType>::__ln_10; - template - constexpr _RealType __math_constants<_RealType>::__gamma_e; - template - constexpr _RealType __math_constants<_RealType>::__phi; - template - constexpr _RealType __math_constants<_RealType>::__root_2; - template - constexpr _RealType __math_constants<_RealType>::__root_3; - template - constexpr _RealType __math_constants<_RealType>::__root_5; - template - constexpr _RealType __math_constants<_RealType>::__root_7; - template - constexpr _RealType __math_constants<_RealType>::__one_div_root_2; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace __gnu_cxx - -#endif // C++11 - -#endif // _EXT_CMATH diff --git a/openflow/usr/include/c++/5/ext/codecvt_specializations.h b/openflow/usr/include/c++/5/ext/codecvt_specializations.h deleted file mode 100644 index 34e90bd..0000000 --- a/openflow/usr/include/c++/5/ext/codecvt_specializations.h +++ /dev/null @@ -1,515 +0,0 @@ -// Locale support (codecvt) -*- C++ -*- - -// Copyright (C) 2000-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -// -// ISO C++ 14882: 22.2.1.5 Template class codecvt -// - -// Written by Benjamin Kosnik - -/** @file ext/codecvt_specializations.h - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _EXT_CODECVT_SPECIALIZATIONS_H -#define _EXT_CODECVT_SPECIALIZATIONS_H 1 - -#include -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_CXX11 -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /// Extension to use iconv for dealing with character encodings. - // This includes conversions and comparisons between various character - // sets. This object encapsulates data that may need to be shared between - // char_traits, codecvt and ctype. - class encoding_state - { - public: - // Types: - // NB: A conversion descriptor subsumes and enhances the - // functionality of a simple state type such as mbstate_t. - typedef iconv_t descriptor_type; - - protected: - // Name of internal character set encoding. - std::string _M_int_enc; - - // Name of external character set encoding. - std::string _M_ext_enc; - - // Conversion descriptor between external encoding to internal encoding. - descriptor_type _M_in_desc; - - // Conversion descriptor between internal encoding to external encoding. - descriptor_type _M_out_desc; - - // The byte-order marker for the external encoding, if necessary. - int _M_ext_bom; - - // The byte-order marker for the internal encoding, if necessary. - int _M_int_bom; - - // Number of external bytes needed to construct one complete - // character in the internal encoding. - // NB: -1 indicates variable, or stateful, encodings. - int _M_bytes; - - public: - explicit - encoding_state() - : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0), _M_bytes(0) - { } - - explicit - encoding_state(const char* __int, const char* __ext, - int __ibom = 0, int __ebom = 0, int __bytes = 1) - : _M_int_enc(__int), _M_ext_enc(__ext), _M_in_desc(0), _M_out_desc(0), - _M_ext_bom(__ebom), _M_int_bom(__ibom), _M_bytes(__bytes) - { init(); } - - // 21.1.2 traits typedefs - // p4 - // typedef STATE_T state_type - // requires: state_type shall meet the requirements of - // CopyConstructible types (20.1.3) - // NB: This does not preserve the actual state of the conversion - // descriptor member, but it does duplicate the encoding - // information. - encoding_state(const encoding_state& __obj) : _M_in_desc(0), _M_out_desc(0) - { construct(__obj); } - - // Need assignment operator as well. - encoding_state& - operator=(const encoding_state& __obj) - { - construct(__obj); - return *this; - } - - ~encoding_state() - { destroy(); } - - bool - good() const throw() - { - const descriptor_type __err = (iconv_t)(-1); - bool __test = _M_in_desc && _M_in_desc != __err; - __test &= _M_out_desc && _M_out_desc != __err; - return __test; - } - - int - character_ratio() const - { return _M_bytes; } - - const std::string - internal_encoding() const - { return _M_int_enc; } - - int - internal_bom() const - { return _M_int_bom; } - - const std::string - external_encoding() const - { return _M_ext_enc; } - - int - external_bom() const - { return _M_ext_bom; } - - const descriptor_type& - in_descriptor() const - { return _M_in_desc; } - - const descriptor_type& - out_descriptor() const - { return _M_out_desc; } - - protected: - void - init() - { - const descriptor_type __err = (iconv_t)(-1); - const bool __have_encodings = _M_int_enc.size() && _M_ext_enc.size(); - if (!_M_in_desc && __have_encodings) - { - _M_in_desc = iconv_open(_M_int_enc.c_str(), _M_ext_enc.c_str()); - if (_M_in_desc == __err) - std::__throw_runtime_error(__N("encoding_state::_M_init " - "creating iconv input descriptor failed")); - } - if (!_M_out_desc && __have_encodings) - { - _M_out_desc = iconv_open(_M_ext_enc.c_str(), _M_int_enc.c_str()); - if (_M_out_desc == __err) - std::__throw_runtime_error(__N("encoding_state::_M_init " - "creating iconv output descriptor failed")); - } - } - - void - construct(const encoding_state& __obj) - { - destroy(); - _M_int_enc = __obj._M_int_enc; - _M_ext_enc = __obj._M_ext_enc; - _M_ext_bom = __obj._M_ext_bom; - _M_int_bom = __obj._M_int_bom; - _M_bytes = __obj._M_bytes; - init(); - } - - void - destroy() throw() - { - const descriptor_type __err = (iconv_t)(-1); - if (_M_in_desc && _M_in_desc != __err) - { - iconv_close(_M_in_desc); - _M_in_desc = 0; - } - if (_M_out_desc && _M_out_desc != __err) - { - iconv_close(_M_out_desc); - _M_out_desc = 0; - } - } - }; - - /// encoding_char_traits - // Custom traits type with encoding_state for the state type, and the - // associated fpos for the position type, all other - // bits equivalent to the required char_traits instantiations. - template - struct encoding_char_traits - : public std::char_traits<_CharT> - { - typedef encoding_state state_type; - typedef typename std::fpos pos_type; - }; - -_GLIBCXX_END_NAMESPACE_VERSION -_GLIBCXX_END_NAMESPACE_CXX11 -} // namespace - - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using __gnu_cxx::encoding_state; - - /// codecvt specialization. - // This partial specialization takes advantage of iconv to provide - // code conversions between a large number of character encodings. - template - class codecvt<_InternT, _ExternT, encoding_state> - : public __codecvt_abstract_base<_InternT, _ExternT, encoding_state> - { - public: - // Types: - typedef codecvt_base::result result; - typedef _InternT intern_type; - typedef _ExternT extern_type; - typedef __gnu_cxx::encoding_state state_type; - typedef state_type::descriptor_type descriptor_type; - - // Data Members: - static locale::id id; - - explicit - codecvt(size_t __refs = 0) - : __codecvt_abstract_base(__refs) - { } - - explicit - codecvt(state_type& __enc, size_t __refs = 0) - : __codecvt_abstract_base(__refs) - { } - - protected: - virtual - ~codecvt() { } - - virtual result - do_out(state_type& __state, const intern_type* __from, - const intern_type* __from_end, const intern_type*& __from_next, - extern_type* __to, extern_type* __to_end, - extern_type*& __to_next) const; - - virtual result - do_unshift(state_type& __state, extern_type* __to, - extern_type* __to_end, extern_type*& __to_next) const; - - virtual result - do_in(state_type& __state, const extern_type* __from, - const extern_type* __from_end, const extern_type*& __from_next, - intern_type* __to, intern_type* __to_end, - intern_type*& __to_next) const; - - virtual int - do_encoding() const throw(); - - virtual bool - do_always_noconv() const throw(); - - virtual int - do_length(state_type&, const extern_type* __from, - const extern_type* __end, size_t __max) const; - - virtual int - do_max_length() const throw(); - }; - - template - locale::id - codecvt<_InternT, _ExternT, encoding_state>::id; - - // This adaptor works around the signature problems of the second - // argument to iconv(): SUSv2 and others use 'const char**', but glibc 2.2 - // uses 'char**', which matches the POSIX 1003.1-2001 standard. - // Using this adaptor, g++ will do the work for us. - template - inline size_t - __iconv_adaptor(size_t(*__func)(iconv_t, _Tp, size_t*, char**, size_t*), - iconv_t __cd, char** __inbuf, size_t* __inbytes, - char** __outbuf, size_t* __outbytes) - { return __func(__cd, (_Tp)__inbuf, __inbytes, __outbuf, __outbytes); } - - template - codecvt_base::result - codecvt<_InternT, _ExternT, encoding_state>:: - do_out(state_type& __state, const intern_type* __from, - const intern_type* __from_end, const intern_type*& __from_next, - extern_type* __to, extern_type* __to_end, - extern_type*& __to_next) const - { - result __ret = codecvt_base::error; - if (__state.good()) - { - const descriptor_type& __desc = __state.out_descriptor(); - const size_t __fmultiple = sizeof(intern_type); - size_t __fbytes = __fmultiple * (__from_end - __from); - const size_t __tmultiple = sizeof(extern_type); - size_t __tbytes = __tmultiple * (__to_end - __to); - - // Argument list for iconv specifies a byte sequence. Thus, - // all to/from arrays must be brutally casted to char*. - char* __cto = reinterpret_cast(__to); - char* __cfrom; - size_t __conv; - - // Some encodings need a byte order marker as the first item - // in the byte stream, to designate endian-ness. The default - // value for the byte order marker is NULL, so if this is - // the case, it's not necessary and we can just go on our - // merry way. - int __int_bom = __state.internal_bom(); - if (__int_bom) - { - size_t __size = __from_end - __from; - intern_type* __cfixed = static_cast - (__builtin_alloca(sizeof(intern_type) * (__size + 1))); - __cfixed[0] = static_cast(__int_bom); - char_traits::copy(__cfixed + 1, __from, __size); - __cfrom = reinterpret_cast(__cfixed); - __conv = __iconv_adaptor(iconv, __desc, &__cfrom, - &__fbytes, &__cto, &__tbytes); - } - else - { - intern_type* __cfixed = const_cast(__from); - __cfrom = reinterpret_cast(__cfixed); - __conv = __iconv_adaptor(iconv, __desc, &__cfrom, &__fbytes, - &__cto, &__tbytes); - } - - if (__conv != size_t(-1)) - { - __from_next = reinterpret_cast(__cfrom); - __to_next = reinterpret_cast(__cto); - __ret = codecvt_base::ok; - } - else - { - if (__fbytes < __fmultiple * (__from_end - __from)) - { - __from_next = reinterpret_cast(__cfrom); - __to_next = reinterpret_cast(__cto); - __ret = codecvt_base::partial; - } - else - __ret = codecvt_base::error; - } - } - return __ret; - } - - template - codecvt_base::result - codecvt<_InternT, _ExternT, encoding_state>:: - do_unshift(state_type& __state, extern_type* __to, - extern_type* __to_end, extern_type*& __to_next) const - { - result __ret = codecvt_base::error; - if (__state.good()) - { - const descriptor_type& __desc = __state.in_descriptor(); - const size_t __tmultiple = sizeof(intern_type); - size_t __tlen = __tmultiple * (__to_end - __to); - - // Argument list for iconv specifies a byte sequence. Thus, - // all to/from arrays must be brutally casted to char*. - char* __cto = reinterpret_cast(__to); - size_t __conv = __iconv_adaptor(iconv,__desc, 0, 0, - &__cto, &__tlen); - - if (__conv != size_t(-1)) - { - __to_next = reinterpret_cast(__cto); - if (__tlen == __tmultiple * (__to_end - __to)) - __ret = codecvt_base::noconv; - else if (__tlen == 0) - __ret = codecvt_base::ok; - else - __ret = codecvt_base::partial; - } - else - __ret = codecvt_base::error; - } - return __ret; - } - - template - codecvt_base::result - codecvt<_InternT, _ExternT, encoding_state>:: - do_in(state_type& __state, const extern_type* __from, - const extern_type* __from_end, const extern_type*& __from_next, - intern_type* __to, intern_type* __to_end, - intern_type*& __to_next) const - { - result __ret = codecvt_base::error; - if (__state.good()) - { - const descriptor_type& __desc = __state.in_descriptor(); - const size_t __fmultiple = sizeof(extern_type); - size_t __flen = __fmultiple * (__from_end - __from); - const size_t __tmultiple = sizeof(intern_type); - size_t __tlen = __tmultiple * (__to_end - __to); - - // Argument list for iconv specifies a byte sequence. Thus, - // all to/from arrays must be brutally casted to char*. - char* __cto = reinterpret_cast(__to); - char* __cfrom; - size_t __conv; - - // Some encodings need a byte order marker as the first item - // in the byte stream, to designate endian-ness. The default - // value for the byte order marker is NULL, so if this is - // the case, it's not necessary and we can just go on our - // merry way. - int __ext_bom = __state.external_bom(); - if (__ext_bom) - { - size_t __size = __from_end - __from; - extern_type* __cfixed = static_cast - (__builtin_alloca(sizeof(extern_type) * (__size + 1))); - __cfixed[0] = static_cast(__ext_bom); - char_traits::copy(__cfixed + 1, __from, __size); - __cfrom = reinterpret_cast(__cfixed); - __conv = __iconv_adaptor(iconv, __desc, &__cfrom, - &__flen, &__cto, &__tlen); - } - else - { - extern_type* __cfixed = const_cast(__from); - __cfrom = reinterpret_cast(__cfixed); - __conv = __iconv_adaptor(iconv, __desc, &__cfrom, - &__flen, &__cto, &__tlen); - } - - - if (__conv != size_t(-1)) - { - __from_next = reinterpret_cast(__cfrom); - __to_next = reinterpret_cast(__cto); - __ret = codecvt_base::ok; - } - else - { - if (__flen < static_cast(__from_end - __from)) - { - __from_next = reinterpret_cast(__cfrom); - __to_next = reinterpret_cast(__cto); - __ret = codecvt_base::partial; - } - else - __ret = codecvt_base::error; - } - } - return __ret; - } - - template - int - codecvt<_InternT, _ExternT, encoding_state>:: - do_encoding() const throw() - { - int __ret = 0; - if (sizeof(_ExternT) <= sizeof(_InternT)) - __ret = sizeof(_InternT) / sizeof(_ExternT); - return __ret; - } - - template - bool - codecvt<_InternT, _ExternT, encoding_state>:: - do_always_noconv() const throw() - { return false; } - - template - int - codecvt<_InternT, _ExternT, encoding_state>:: - do_length(state_type&, const extern_type* __from, - const extern_type* __end, size_t __max) const - { return std::min(__max, static_cast(__end - __from)); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 74. Garbled text for codecvt::do_max_length - template - int - codecvt<_InternT, _ExternT, encoding_state>:: - do_max_length() const throw() - { return 1; } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/ext/concurrence.h b/openflow/usr/include/c++/5/ext/concurrence.h deleted file mode 100644 index 10e5700..0000000 --- a/openflow/usr/include/c++/5/ext/concurrence.h +++ /dev/null @@ -1,318 +0,0 @@ -// Support for concurrent programing -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ext/concurrence.h - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _CONCURRENCE_H -#define _CONCURRENCE_H 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Available locking policies: - // _S_single single-threaded code that doesn't need to be locked. - // _S_mutex multi-threaded code that requires additional support - // from gthr.h or abstraction layers in concurrence.h. - // _S_atomic multi-threaded code using atomic operations. - enum _Lock_policy { _S_single, _S_mutex, _S_atomic }; - - // Compile time constant that indicates prefered locking policy in - // the current configuration. - static const _Lock_policy __default_lock_policy = -#ifdef __GTHREADS -#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) \ - && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) - _S_atomic; -#else - _S_mutex; -#endif -#else - _S_single; -#endif - - // NB: As this is used in libsupc++, need to only depend on - // exception. No stdexception classes, no use of std::string. - class __concurrence_lock_error : public std::exception - { - public: - virtual char const* - what() const throw() - { return "__gnu_cxx::__concurrence_lock_error"; } - }; - - class __concurrence_unlock_error : public std::exception - { - public: - virtual char const* - what() const throw() - { return "__gnu_cxx::__concurrence_unlock_error"; } - }; - - class __concurrence_broadcast_error : public std::exception - { - public: - virtual char const* - what() const throw() - { return "__gnu_cxx::__concurrence_broadcast_error"; } - }; - - class __concurrence_wait_error : public std::exception - { - public: - virtual char const* - what() const throw() - { return "__gnu_cxx::__concurrence_wait_error"; } - }; - - // Substitute for concurrence_error object in the case of -fno-exceptions. - inline void - __throw_concurrence_lock_error() - { _GLIBCXX_THROW_OR_ABORT(__concurrence_lock_error()); } - - inline void - __throw_concurrence_unlock_error() - { _GLIBCXX_THROW_OR_ABORT(__concurrence_unlock_error()); } - -#ifdef __GTHREAD_HAS_COND - inline void - __throw_concurrence_broadcast_error() - { _GLIBCXX_THROW_OR_ABORT(__concurrence_broadcast_error()); } - - inline void - __throw_concurrence_wait_error() - { _GLIBCXX_THROW_OR_ABORT(__concurrence_wait_error()); } -#endif - - class __mutex - { - private: -#if __GTHREADS && defined __GTHREAD_MUTEX_INIT - __gthread_mutex_t _M_mutex = __GTHREAD_MUTEX_INIT; -#else - __gthread_mutex_t _M_mutex; -#endif - - __mutex(const __mutex&); - __mutex& operator=(const __mutex&); - - public: - __mutex() - { -#if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT - if (__gthread_active_p()) - __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); -#endif - } - -#if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT - ~__mutex() - { - if (__gthread_active_p()) - __gthread_mutex_destroy(&_M_mutex); - } -#endif - - void lock() - { -#if __GTHREADS - if (__gthread_active_p()) - { - if (__gthread_mutex_lock(&_M_mutex) != 0) - __throw_concurrence_lock_error(); - } -#endif - } - - void unlock() - { -#if __GTHREADS - if (__gthread_active_p()) - { - if (__gthread_mutex_unlock(&_M_mutex) != 0) - __throw_concurrence_unlock_error(); - } -#endif - } - - __gthread_mutex_t* gthread_mutex(void) - { return &_M_mutex; } - }; - - class __recursive_mutex - { - private: -#if __GTHREADS && defined __GTHREAD_RECURSIVE_MUTEX_INIT - __gthread_recursive_mutex_t _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT; -#else - __gthread_recursive_mutex_t _M_mutex; -#endif - - __recursive_mutex(const __recursive_mutex&); - __recursive_mutex& operator=(const __recursive_mutex&); - - public: - __recursive_mutex() - { -#if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT - if (__gthread_active_p()) - __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex); -#endif - } - -#if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT - ~__recursive_mutex() - { - if (__gthread_active_p()) - __gthread_recursive_mutex_destroy(&_M_mutex); - } -#endif - - void lock() - { -#if __GTHREADS - if (__gthread_active_p()) - { - if (__gthread_recursive_mutex_lock(&_M_mutex) != 0) - __throw_concurrence_lock_error(); - } -#endif - } - - void unlock() - { -#if __GTHREADS - if (__gthread_active_p()) - { - if (__gthread_recursive_mutex_unlock(&_M_mutex) != 0) - __throw_concurrence_unlock_error(); - } -#endif - } - - __gthread_recursive_mutex_t* gthread_recursive_mutex(void) - { return &_M_mutex; } - }; - - /// Scoped lock idiom. - // Acquire the mutex here with a constructor call, then release with - // the destructor call in accordance with RAII style. - class __scoped_lock - { - public: - typedef __mutex __mutex_type; - - private: - __mutex_type& _M_device; - - __scoped_lock(const __scoped_lock&); - __scoped_lock& operator=(const __scoped_lock&); - - public: - explicit __scoped_lock(__mutex_type& __name) : _M_device(__name) - { _M_device.lock(); } - - ~__scoped_lock() throw() - { _M_device.unlock(); } - }; - -#ifdef __GTHREAD_HAS_COND - class __cond - { - private: -#if __GTHREADS && defined __GTHREAD_COND_INIT - __gthread_cond_t _M_cond = __GTHREAD_COND_INIT; -#else - __gthread_cond_t _M_cond; -#endif - - __cond(const __cond&); - __cond& operator=(const __cond&); - - public: - __cond() - { -#if __GTHREADS && ! defined __GTHREAD_COND_INIT - if (__gthread_active_p()) - __GTHREAD_COND_INIT_FUNCTION(&_M_cond); -#endif - } - -#if __GTHREADS && ! defined __GTHREAD_COND_INIT - ~__cond() - { - if (__gthread_active_p()) - __gthread_cond_destroy(&_M_cond); - } -#endif - - void broadcast() - { -#if __GTHREADS - if (__gthread_active_p()) - { - if (__gthread_cond_broadcast(&_M_cond) != 0) - __throw_concurrence_broadcast_error(); - } -#endif - } - - void wait(__mutex *mutex) - { -#if __GTHREADS - { - if (__gthread_cond_wait(&_M_cond, mutex->gthread_mutex()) != 0) - __throw_concurrence_wait_error(); - } -#endif - } - - void wait_recursive(__recursive_mutex *mutex) - { -#if __GTHREADS - { - if (__gthread_cond_wait_recursive(&_M_cond, - mutex->gthread_recursive_mutex()) - != 0) - __throw_concurrence_wait_error(); - } -#endif - } - }; -#endif - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/ext/debug_allocator.h b/openflow/usr/include/c++/5/ext/debug_allocator.h deleted file mode 100644 index 161576b..0000000 --- a/openflow/usr/include/c++/5/ext/debug_allocator.h +++ /dev/null @@ -1,191 +0,0 @@ -// Allocators -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * Copyright (c) 1996-1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file ext/debug_allocator.h - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _DEBUG_ALLOCATOR_H -#define _DEBUG_ALLOCATOR_H 1 - -#include -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::size_t; - - /** - * @brief A meta-allocator with debugging bits. - * @ingroup allocators - * - * This is precisely the allocator defined in the C++03 Standard. - */ - template - class debug_allocator - { - template friend class debug_allocator; - - typedef __alloc_traits<_Alloc> _Traits; - - public: - typedef typename _Traits::size_type size_type; - typedef typename _Traits::difference_type difference_type; - typedef typename _Traits::pointer pointer; - typedef typename _Traits::const_pointer const_pointer; - typedef typename _Traits::reference reference; - typedef typename _Traits::const_reference const_reference; - typedef typename _Traits::value_type value_type; - - template - class rebind - { - typedef typename _Traits::template rebind<_Up>::other __other; - - public: - typedef debug_allocator<__other> other; - }; - - private: - // _M_extra is the number of objects that correspond to the - // extra space where debug information is stored. - size_type _M_extra; - - _Alloc _M_allocator; - - template::other> - struct __convertible - { }; - - template - struct __convertible<_Alloc2, _Alloc> - { - typedef void* __type; - }; - - size_type _S_extra() - { - const size_t __obj_size = sizeof(value_type); - return (sizeof(size_type) + __obj_size - 1) / __obj_size; - } - - public: - debug_allocator() : _M_extra(_S_extra()) { } - - template - debug_allocator(const debug_allocator<_Alloc2>& __a2, - typename __convertible<_Alloc2>::__type = 0) - : _M_allocator(__a2._M_allocator), _M_extra(_S_extra()) { } - - debug_allocator(const _Alloc& __a) - : _M_allocator(__a), _M_extra(_S_extra()) { } - - pointer - allocate(size_type __n) - { - pointer __res = _M_allocator.allocate(__n + _M_extra); - size_type* __ps = reinterpret_cast(__res); - *__ps = __n; - return __res + _M_extra; - } - - pointer - allocate(size_type __n, const void* __hint) - { - pointer __res = _M_allocator.allocate(__n + _M_extra, __hint); - size_type* __ps = reinterpret_cast(__res); - *__ps = __n; - return __res + _M_extra; - } - - void - deallocate(pointer __p, size_type __n) - { - using std::__throw_runtime_error; - if (__p) - { - pointer __real_p = __p - _M_extra; - if (*reinterpret_cast(__real_p) != __n) - __throw_runtime_error("debug_allocator::deallocate wrong size"); - _M_allocator.deallocate(__real_p, __n + _M_extra); - } - else - __throw_runtime_error("debug_allocator::deallocate null pointer"); - } - - void - construct(pointer __p, const value_type& __val) - { _Traits::construct(_M_allocator, __p, __val); } - -#if __cplusplus >= 201103L - template - void - construct(_Tp* __p, _Args&&... __args) - { - _Traits::construct(_M_allocator, __p, - std::forward<_Args>(__args)...); - } -#endif - - template - void - destroy(_Tp* __p) - { _Traits::destroy(_M_allocator, __p); } - - size_type - max_size() const throw() - { return _Traits::max_size(_M_allocator) - _M_extra; } - - friend bool - operator==(const debug_allocator& __lhs, const debug_allocator& __rhs) - { return __lhs._M_allocator == __rhs._M_allocator; } - }; - - template - inline bool - operator!=(const debug_allocator<_Alloc>& __lhs, - const debug_allocator<_Alloc>& __rhs) - { return !(__lhs == __rhs); } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/ext/enc_filebuf.h b/openflow/usr/include/c++/5/ext/enc_filebuf.h deleted file mode 100644 index 1b93405..0000000 --- a/openflow/usr/include/c++/5/ext/enc_filebuf.h +++ /dev/null @@ -1,65 +0,0 @@ -// filebuf with encoding state type -*- C++ -*- - -// Copyright (C) 2002-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ext/enc_filebuf.h - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _EXT_ENC_FILEBUF_H -#define _EXT_ENC_FILEBUF_H 1 - -#include -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /// class enc_filebuf. - template - class enc_filebuf - : public std::basic_filebuf<_CharT, encoding_char_traits<_CharT> > - { - public: - typedef encoding_char_traits<_CharT> traits_type; - typedef typename traits_type::state_type state_type; - typedef typename traits_type::pos_type pos_type; - - enc_filebuf(state_type& __state) - : std::basic_filebuf<_CharT, encoding_char_traits<_CharT> >() - { this->_M_state_beg = __state; } - - private: - // concept requirements: - // Set state type to something useful. - // Something more than copyconstructible is needed here, so - // require default and copy constructible + assignment operator. - __glibcxx_class_requires(state_type, _SGIAssignableConcept) - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/ext/extptr_allocator.h b/openflow/usr/include/c++/5/ext/extptr_allocator.h deleted file mode 100644 index 15915c7..0000000 --- a/openflow/usr/include/c++/5/ext/extptr_allocator.h +++ /dev/null @@ -1,197 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2008-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file ext/extptr_allocator.h - * This file is a GNU extension to the Standard C++ Library. - * - * @author Bob Walters - * - * An example allocator which uses an alternative pointer type from - * bits/pointer.h. Supports test cases which confirm container support - * for alternative pointers. - */ - -#ifndef _EXTPTR_ALLOCATOR_H -#define _EXTPTR_ALLOCATOR_H 1 - -#include -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @brief An example allocator which uses a non-standard pointer type. - * @ingroup allocators - * - * This allocator specifies that containers use a 'relative pointer' as it's - * pointer type. (See ext/pointer.h) Memory allocation in this example - * is still performed using std::allocator. - */ - template - class _ExtPtr_allocator - { - public: - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - - // Note the non-standard pointer types. - typedef _Pointer_adapter<_Relative_pointer_impl<_Tp> > pointer; - typedef _Pointer_adapter<_Relative_pointer_impl > - const_pointer; - - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - - template - struct rebind - { typedef _ExtPtr_allocator<_Up> other; }; - - _ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT - : _M_real_alloc() { } - - _ExtPtr_allocator(const _ExtPtr_allocator& __rarg) _GLIBCXX_USE_NOEXCEPT - : _M_real_alloc(__rarg._M_real_alloc) { } - - template - _ExtPtr_allocator(const _ExtPtr_allocator<_Up>& __rarg) - _GLIBCXX_USE_NOEXCEPT - : _M_real_alloc(__rarg._M_getUnderlyingImp()) { } - - ~_ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT - { } - - pointer address(reference __x) const _GLIBCXX_NOEXCEPT - { return std::__addressof(__x); } - - const_pointer address(const_reference __x) const _GLIBCXX_NOEXCEPT - { return std::__addressof(__x); } - - pointer allocate(size_type __n, void* __hint = 0) - { return _M_real_alloc.allocate(__n,__hint); } - - void deallocate(pointer __p, size_type __n) - { _M_real_alloc.deallocate(__p.get(), __n); } - - size_type max_size() const _GLIBCXX_USE_NOEXCEPT - { return __numeric_traits::__max / sizeof(_Tp); } - -#if __cplusplus >= 201103L - template - void - construct(_Up* __p, _Args&&... __args) - { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } - - template - void - construct(pointer __p, _Args&&... __args) - { construct(__p.get(), std::forward<_Args>(__args)...); } - - template - void - destroy(_Up* __p) - { __p->~_Up(); } - - void destroy(pointer __p) - { destroy(__p.get()); } - -#else - - void construct(pointer __p, const _Tp& __val) - { ::new(__p.get()) _Tp(__val); } - - void destroy(pointer __p) - { __p->~_Tp(); } -#endif - - template - inline bool - operator==(const _ExtPtr_allocator<_Up>& __rarg) - { return _M_real_alloc == __rarg._M_getUnderlyingImp(); } - - inline bool - operator==(const _ExtPtr_allocator& __rarg) - { return _M_real_alloc == __rarg._M_real_alloc; } - - template - inline bool - operator!=(const _ExtPtr_allocator<_Up>& __rarg) - { return _M_real_alloc != __rarg._M_getUnderlyingImp(); } - - inline bool - operator!=(const _ExtPtr_allocator& __rarg) - { return _M_real_alloc != __rarg._M_real_alloc; } - - template - inline friend void - swap(_ExtPtr_allocator<_Up>&, _ExtPtr_allocator<_Up>&); - - // A method specific to this implementation. - const std::allocator<_Tp>& - _M_getUnderlyingImp() const - { return _M_real_alloc; } - - private: - std::allocator<_Tp> _M_real_alloc; - }; - - // _ExtPtr_allocator specialization. - template<> - class _ExtPtr_allocator - { - public: - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef void value_type; - - // Note the non-standard pointer types - typedef _Pointer_adapter<_Relative_pointer_impl > pointer; - typedef _Pointer_adapter<_Relative_pointer_impl > - const_pointer; - - template - struct rebind - { typedef _ExtPtr_allocator<_Up> other; }; - - private: - std::allocator _M_real_alloc; - }; - - template - inline void - swap(_ExtPtr_allocator<_Tp>& __larg, _ExtPtr_allocator<_Tp>& __rarg) - { - std::allocator<_Tp> __tmp( __rarg._M_real_alloc ); - __rarg._M_real_alloc = __larg._M_real_alloc; - __larg._M_real_alloc = __tmp; - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif /* _EXTPTR_ALLOCATOR_H */ diff --git a/openflow/usr/include/c++/5/ext/functional b/openflow/usr/include/c++/5/ext/functional deleted file mode 100644 index ef32f1b..0000000 --- a/openflow/usr/include/c++/5/ext/functional +++ /dev/null @@ -1,430 +0,0 @@ -// Functional extensions -*- C++ -*- - -// Copyright (C) 2002-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file ext/functional - * This file is a GNU extension to the Standard C++ Library (possibly - * containing extensions from the HP/SGI STL subset). - */ - -#ifndef _EXT_FUNCTIONAL -#define _EXT_FUNCTIONAL 1 - -#pragma GCC system_header - -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::size_t; - using std::unary_function; - using std::binary_function; - using std::mem_fun1_t; - using std::const_mem_fun1_t; - using std::mem_fun1_ref_t; - using std::const_mem_fun1_ref_t; - - /** The @c identity_element functions are not part of the C++ - * standard; SGI provided them as an extension. Its argument is an - * operation, and its return value is the identity element for that - * operation. It is overloaded for addition and multiplication, - * and you can overload it for your own nefarious operations. - * - * @addtogroup SGIextensions - * @{ - */ - /// An \link SGIextensions SGI extension \endlink. - template - inline _Tp - identity_element(std::plus<_Tp>) - { return _Tp(0); } - - /// An \link SGIextensions SGI extension \endlink. - template - inline _Tp - identity_element(std::multiplies<_Tp>) - { return _Tp(1); } - /** @} */ - - /** As an extension to the binders, SGI provided composition functors and - * wrapper functions to aid in their creation. The @c unary_compose - * functor is constructed from two functions/functors, @c f and @c g. - * Calling @c operator() with a single argument @c x returns @c f(g(x)). - * The function @c compose1 takes the two functions and constructs a - * @c unary_compose variable for you. - * - * @c binary_compose is constructed from three functors, @c f, @c g1, - * and @c g2. Its @c operator() returns @c f(g1(x),g2(x)). The function - * compose2 takes f, g1, and g2, and constructs the @c binary_compose - * instance for you. For example, if @c f returns an int, then - * \code - * int answer = (compose2(f,g1,g2))(x); - * \endcode - * is equivalent to - * \code - * int temp1 = g1(x); - * int temp2 = g2(x); - * int answer = f(temp1,temp2); - * \endcode - * But the first form is more compact, and can be passed around as a - * functor to other algorithms. - * - * @addtogroup SGIextensions - * @{ - */ - /// An \link SGIextensions SGI extension \endlink. - template - class unary_compose - : public unary_function - { - protected: - _Operation1 _M_fn1; - _Operation2 _M_fn2; - - public: - unary_compose(const _Operation1& __x, const _Operation2& __y) - : _M_fn1(__x), _M_fn2(__y) {} - - typename _Operation1::result_type - operator()(const typename _Operation2::argument_type& __x) const - { return _M_fn1(_M_fn2(__x)); } - }; - - /// An \link SGIextensions SGI extension \endlink. - template - inline unary_compose<_Operation1, _Operation2> - compose1(const _Operation1& __fn1, const _Operation2& __fn2) - { return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); } - - /// An \link SGIextensions SGI extension \endlink. - template - class binary_compose - : public unary_function - { - protected: - _Operation1 _M_fn1; - _Operation2 _M_fn2; - _Operation3 _M_fn3; - - public: - binary_compose(const _Operation1& __x, const _Operation2& __y, - const _Operation3& __z) - : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { } - - typename _Operation1::result_type - operator()(const typename _Operation2::argument_type& __x) const - { return _M_fn1(_M_fn2(__x), _M_fn3(__x)); } - }; - - /// An \link SGIextensions SGI extension \endlink. - template - inline binary_compose<_Operation1, _Operation2, _Operation3> - compose2(const _Operation1& __fn1, const _Operation2& __fn2, - const _Operation3& __fn3) - { return binary_compose<_Operation1, _Operation2, _Operation3> - (__fn1, __fn2, __fn3); } - /** @} */ - - /** As an extension, SGI provided a functor called @c identity. When a - * functor is required but no operations are desired, this can be used as a - * pass-through. Its @c operator() returns its argument unchanged. - * - * @addtogroup SGIextensions - */ - template - struct identity - : public std::_Identity<_Tp> {}; - - /** @c select1st and @c select2nd are extensions provided by SGI. Their - * @c operator()s - * take a @c std::pair as an argument, and return either the first member - * or the second member, respectively. They can be used (especially with - * the composition functors) to @a strip data from a sequence before - * performing the remainder of an algorithm. - * - * @addtogroup SGIextensions - * @{ - */ - /// An \link SGIextensions SGI extension \endlink. - template - struct select1st - : public std::_Select1st<_Pair> {}; - - /// An \link SGIextensions SGI extension \endlink. - template - struct select2nd - : public std::_Select2nd<_Pair> {}; - - /** @} */ - - // extension documented next - template - struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> - { - _Arg1 - operator()(const _Arg1& __x, const _Arg2&) const - { return __x; } - }; - - template - struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> - { - _Arg2 - operator()(const _Arg1&, const _Arg2& __y) const - { return __y; } - }; - - /** The @c operator() of the @c project1st functor takes two arbitrary - * arguments and returns the first one, while @c project2nd returns the - * second one. They are extensions provided by SGI. - * - * @addtogroup SGIextensions - * @{ - */ - - /// An \link SGIextensions SGI extension \endlink. - template - struct project1st : public _Project1st<_Arg1, _Arg2> {}; - - /// An \link SGIextensions SGI extension \endlink. - template - struct project2nd : public _Project2nd<_Arg1, _Arg2> {}; - /** @} */ - - // extension documented next - template - struct _Constant_void_fun - { - typedef _Result result_type; - result_type _M_val; - - _Constant_void_fun(const result_type& __v) : _M_val(__v) {} - - const result_type& - operator()() const - { return _M_val; } - }; - - template - struct _Constant_unary_fun - { - typedef _Argument argument_type; - typedef _Result result_type; - result_type _M_val; - - _Constant_unary_fun(const result_type& __v) : _M_val(__v) {} - - const result_type& - operator()(const _Argument&) const - { return _M_val; } - }; - - template - struct _Constant_binary_fun - { - typedef _Arg1 first_argument_type; - typedef _Arg2 second_argument_type; - typedef _Result result_type; - _Result _M_val; - - _Constant_binary_fun(const _Result& __v) : _M_val(__v) {} - - const result_type& - operator()(const _Arg1&, const _Arg2&) const - { return _M_val; } - }; - - /** These three functors are each constructed from a single arbitrary - * variable/value. Later, their @c operator()s completely ignore any - * arguments passed, and return the stored value. - * - @c constant_void_fun's @c operator() takes no arguments - * - @c constant_unary_fun's @c operator() takes one argument (ignored) - * - @c constant_binary_fun's @c operator() takes two arguments (ignored) - * - * The helper creator functions @c constant0, @c constant1, and - * @c constant2 each take a @a result argument and construct variables of - * the appropriate functor type. - * - * @addtogroup SGIextensions - * @{ - */ - /// An \link SGIextensions SGI extension \endlink. - template - struct constant_void_fun - : public _Constant_void_fun<_Result> - { - constant_void_fun(const _Result& __v) - : _Constant_void_fun<_Result>(__v) {} - }; - - /// An \link SGIextensions SGI extension \endlink. - template - struct constant_unary_fun : public _Constant_unary_fun<_Result, _Argument> - { - constant_unary_fun(const _Result& __v) - : _Constant_unary_fun<_Result, _Argument>(__v) {} - }; - - /// An \link SGIextensions SGI extension \endlink. - template - struct constant_binary_fun - : public _Constant_binary_fun<_Result, _Arg1, _Arg2> - { - constant_binary_fun(const _Result& __v) - : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {} - }; - - /// An \link SGIextensions SGI extension \endlink. - template - inline constant_void_fun<_Result> - constant0(const _Result& __val) - { return constant_void_fun<_Result>(__val); } - - /// An \link SGIextensions SGI extension \endlink. - template - inline constant_unary_fun<_Result, _Result> - constant1(const _Result& __val) - { return constant_unary_fun<_Result, _Result>(__val); } - - /// An \link SGIextensions SGI extension \endlink. - template - inline constant_binary_fun<_Result,_Result,_Result> - constant2(const _Result& __val) - { return constant_binary_fun<_Result, _Result, _Result>(__val); } - /** @} */ - - /** The @c subtractive_rng class is documented on - * SGI's site. - * Note that this code assumes that @c int is 32 bits. - * - * @ingroup SGIextensions - */ - class subtractive_rng - : public unary_function - { - private: - unsigned int _M_table[55]; - size_t _M_index1; - size_t _M_index2; - - public: - /// Returns a number less than the argument. - unsigned int - operator()(unsigned int __limit) - { - _M_index1 = (_M_index1 + 1) % 55; - _M_index2 = (_M_index2 + 1) % 55; - _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2]; - return _M_table[_M_index1] % __limit; - } - - void - _M_initialize(unsigned int __seed) - { - unsigned int __k = 1; - _M_table[54] = __seed; - size_t __i; - for (__i = 0; __i < 54; __i++) - { - size_t __ii = (21 * (__i + 1) % 55) - 1; - _M_table[__ii] = __k; - __k = __seed - __k; - __seed = _M_table[__ii]; - } - for (int __loop = 0; __loop < 4; __loop++) - { - for (__i = 0; __i < 55; __i++) - _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55]; - } - _M_index1 = 0; - _M_index2 = 31; - } - - /// Ctor allowing you to initialize the seed. - subtractive_rng(unsigned int __seed) - { _M_initialize(__seed); } - - /// Default ctor; initializes its state with some number you don't see. - subtractive_rng() - { _M_initialize(161803398u); } - }; - - // Mem_fun adaptor helper functions mem_fun1 and mem_fun1_ref, - // provided for backward compatibility, they are no longer part of - // the C++ standard. - - template - inline mem_fun1_t<_Ret, _Tp, _Arg> - mem_fun1(_Ret (_Tp::*__f)(_Arg)) - { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); } - - template - inline const_mem_fun1_t<_Ret, _Tp, _Arg> - mem_fun1(_Ret (_Tp::*__f)(_Arg) const) - { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); } - - template - inline mem_fun1_ref_t<_Ret, _Tp, _Arg> - mem_fun1_ref(_Ret (_Tp::*__f)(_Arg)) - { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } - - template - inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg> - mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const) - { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif - diff --git a/openflow/usr/include/c++/5/ext/hash_map b/openflow/usr/include/c++/5/ext/hash_map deleted file mode 100644 index a9dc9cf..0000000 --- a/openflow/usr/include/c++/5/ext/hash_map +++ /dev/null @@ -1,599 +0,0 @@ -// Hashing map implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/** @file backward/hash_map - * This file is a GNU extension to the Standard C++ Library (possibly - * containing extensions from the HP/SGI STL subset). - */ - -#ifndef _BACKWARD_HASH_MAP -#define _BACKWARD_HASH_MAP 1 - -#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH -#include "backward_warning.h" -#endif - -#include -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::equal_to; - using std::allocator; - using std::pair; - using std::_Select1st; - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template, - class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> > - class hash_map - { - private: - typedef hashtable,_Key, _HashFn, - _Select1st >, - _EqualKey, _Alloc> _Ht; - - _Ht _M_ht; - - public: - typedef typename _Ht::key_type key_type; - typedef _Tp data_type; - typedef _Tp mapped_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher - hash_funct() const - { return _M_ht.hash_funct(); } - - key_equal - key_eq() const - { return _M_ht.key_eq(); } - - allocator_type - get_allocator() const - { return _M_ht.get_allocator(); } - - hash_map() - : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - - explicit - hash_map(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - - hash_map(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} - - hash_map(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - template - hash_map(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - - template - hash_map(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - - template - hash_map(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - - template - hash_map(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } - - size_type - size() const - { return _M_ht.size(); } - - size_type - max_size() const - { return _M_ht.max_size(); } - - bool - empty() const - { return _M_ht.empty(); } - - void - swap(hash_map& __hs) - { _M_ht.swap(__hs._M_ht); } - - template - friend bool - operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&, - const hash_map<_K1, _T1, _HF, _EqK, _Al>&); - - iterator - begin() - { return _M_ht.begin(); } - - iterator - end() - { return _M_ht.end(); } - - const_iterator - begin() const - { return _M_ht.begin(); } - - const_iterator - end() const - { return _M_ht.end(); } - - pair - insert(const value_type& __obj) - { return _M_ht.insert_unique(__obj); } - - template - void - insert(_InputIterator __f, _InputIterator __l) - { _M_ht.insert_unique(__f, __l); } - - pair - insert_noresize(const value_type& __obj) - { return _M_ht.insert_unique_noresize(__obj); } - - iterator - find(const key_type& __key) - { return _M_ht.find(__key); } - - const_iterator - find(const key_type& __key) const - { return _M_ht.find(__key); } - - _Tp& - operator[](const key_type& __key) - { return _M_ht.find_or_insert(value_type(__key, _Tp())).second; } - - size_type - count(const key_type& __key) const - { return _M_ht.count(__key); } - - pair - equal_range(const key_type& __key) - { return _M_ht.equal_range(__key); } - - pair - equal_range(const key_type& __key) const - { return _M_ht.equal_range(__key); } - - size_type - erase(const key_type& __key) - {return _M_ht.erase(__key); } - - void - erase(iterator __it) - { _M_ht.erase(__it); } - - void - erase(iterator __f, iterator __l) - { _M_ht.erase(__f, __l); } - - void - clear() - { _M_ht.clear(); } - - void - resize(size_type __hint) - { _M_ht.resize(__hint); } - - size_type - bucket_count() const - { return _M_ht.bucket_count(); } - - size_type - max_bucket_count() const - { return _M_ht.max_bucket_count(); } - - size_type - elems_in_bucket(size_type __n) const - { return _M_ht.elems_in_bucket(__n); } - }; - - template - inline bool - operator==(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, - const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) - { return __hm1._M_ht == __hm2._M_ht; } - - template - inline bool - operator!=(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, - const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) - { return !(__hm1 == __hm2); } - - template - inline void - swap(hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, - hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) - { __hm1.swap(__hm2); } - - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template, - class _EqualKey = equal_to<_Key>, - class _Alloc = allocator<_Tp> > - class hash_multimap - { - // concept requirements - __glibcxx_class_requires(_Key, _SGIAssignableConcept) - __glibcxx_class_requires(_Tp, _SGIAssignableConcept) - __glibcxx_class_requires3(_HashFn, size_t, _Key, _UnaryFunctionConcept) - __glibcxx_class_requires3(_EqualKey, _Key, _Key, _BinaryPredicateConcept) - - private: - typedef hashtable, _Key, _HashFn, - _Select1st >, _EqualKey, _Alloc> - _Ht; - - _Ht _M_ht; - - public: - typedef typename _Ht::key_type key_type; - typedef _Tp data_type; - typedef _Tp mapped_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher - hash_funct() const - { return _M_ht.hash_funct(); } - - key_equal - key_eq() const - { return _M_ht.key_eq(); } - - allocator_type - get_allocator() const - { return _M_ht.get_allocator(); } - - hash_multimap() - : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - - explicit - hash_multimap(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - - hash_multimap(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} - - hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - template - hash_multimap(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - - template - hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - - template - hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - - template - hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } - - size_type - size() const - { return _M_ht.size(); } - - size_type - max_size() const - { return _M_ht.max_size(); } - - bool - empty() const - { return _M_ht.empty(); } - - void - swap(hash_multimap& __hs) - { _M_ht.swap(__hs._M_ht); } - - template - friend bool - operator==(const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&, - const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&); - - iterator - begin() - { return _M_ht.begin(); } - - iterator - end() - { return _M_ht.end(); } - - const_iterator - begin() const - { return _M_ht.begin(); } - - const_iterator - end() const - { return _M_ht.end(); } - - iterator - insert(const value_type& __obj) - { return _M_ht.insert_equal(__obj); } - - template - void - insert(_InputIterator __f, _InputIterator __l) - { _M_ht.insert_equal(__f,__l); } - - iterator - insert_noresize(const value_type& __obj) - { return _M_ht.insert_equal_noresize(__obj); } - - iterator - find(const key_type& __key) - { return _M_ht.find(__key); } - - const_iterator - find(const key_type& __key) const - { return _M_ht.find(__key); } - - size_type - count(const key_type& __key) const - { return _M_ht.count(__key); } - - pair - equal_range(const key_type& __key) - { return _M_ht.equal_range(__key); } - - pair - equal_range(const key_type& __key) const - { return _M_ht.equal_range(__key); } - - size_type - erase(const key_type& __key) - { return _M_ht.erase(__key); } - - void - erase(iterator __it) - { _M_ht.erase(__it); } - - void - erase(iterator __f, iterator __l) - { _M_ht.erase(__f, __l); } - - void - clear() - { _M_ht.clear(); } - - void - resize(size_type __hint) - { _M_ht.resize(__hint); } - - size_type - bucket_count() const - { return _M_ht.bucket_count(); } - - size_type - max_bucket_count() const - { return _M_ht.max_bucket_count(); } - - size_type - elems_in_bucket(size_type __n) const - { return _M_ht.elems_in_bucket(__n); } - }; - - template - inline bool - operator==(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1, - const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2) - { return __hm1._M_ht == __hm2._M_ht; } - - template - inline bool - operator!=(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1, - const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2) - { return !(__hm1 == __hm2); } - - template - inline void - swap(hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, - hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) - { __hm1.swap(__hm2); } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Specialization of insert_iterator so that it will work for hash_map - // and hash_multimap. - template - class insert_iterator<__gnu_cxx::hash_map<_Key, _Tp, _HashFn, - _EqKey, _Alloc> > - { - protected: - typedef __gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> - _Container; - _Container* container; - - public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) - : container(&__x) {} - - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __value) - { - container->insert(__value); - return *this; - } - - insert_iterator<_Container>& - operator*() - { return *this; } - - insert_iterator<_Container>& - operator++() { return *this; } - - insert_iterator<_Container>& - operator++(int) - { return *this; } - }; - - template - class insert_iterator<__gnu_cxx::hash_multimap<_Key, _Tp, _HashFn, - _EqKey, _Alloc> > - { - protected: - typedef __gnu_cxx::hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> - _Container; - _Container* container; - typename _Container::iterator iter; - - public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) - : container(&__x) {} - - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __value) - { - container->insert(__value); - return *this; - } - - insert_iterator<_Container>& - operator*() - { return *this; } - - insert_iterator<_Container>& - operator++() - { return *this; } - - insert_iterator<_Container>& - operator++(int) - { return *this; } - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/ext/hash_set b/openflow/usr/include/c++/5/ext/hash_set deleted file mode 100644 index 3c9ec70..0000000 --- a/openflow/usr/include/c++/5/ext/hash_set +++ /dev/null @@ -1,567 +0,0 @@ -// Hashing set implementation -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/** @file backward/hash_set - * This file is a GNU extension to the Standard C++ Library (possibly - * containing extensions from the HP/SGI STL subset). - */ - -#ifndef _BACKWARD_HASH_SET -#define _BACKWARD_HASH_SET 1 - -#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH -#include "backward_warning.h" -#endif - -#include -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::equal_to; - using std::allocator; - using std::pair; - using std::_Identity; - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template, - class _EqualKey = equal_to<_Value>, - class _Alloc = allocator<_Value> > - class hash_set - { - // concept requirements - __glibcxx_class_requires(_Value, _SGIAssignableConcept) - __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept) - __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept) - - private: - typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, - _EqualKey, _Alloc> _Ht; - _Ht _M_ht; - - public: - typedef typename _Ht::key_type key_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Alloc::pointer pointer; - typedef typename _Alloc::const_pointer const_pointer; - typedef typename _Alloc::reference reference; - typedef typename _Alloc::const_reference const_reference; - - typedef typename _Ht::const_iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher - hash_funct() const - { return _M_ht.hash_funct(); } - - key_equal - key_eq() const - { return _M_ht.key_eq(); } - - allocator_type - get_allocator() const - { return _M_ht.get_allocator(); } - - hash_set() - : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - - explicit - hash_set(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - - hash_set(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} - - hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - template - hash_set(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - - template - hash_set(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - - template - hash_set(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - - template - hash_set(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } - - size_type - size() const - { return _M_ht.size(); } - - size_type - max_size() const - { return _M_ht.max_size(); } - - bool - empty() const - { return _M_ht.empty(); } - - void - swap(hash_set& __hs) - { _M_ht.swap(__hs._M_ht); } - - template - friend bool - operator==(const hash_set<_Val, _HF, _EqK, _Al>&, - const hash_set<_Val, _HF, _EqK, _Al>&); - - iterator - begin() const - { return _M_ht.begin(); } - - iterator - end() const - { return _M_ht.end(); } - - pair - insert(const value_type& __obj) - { - pair __p = _M_ht.insert_unique(__obj); - return pair(__p.first, __p.second); - } - - template - void - insert(_InputIterator __f, _InputIterator __l) - { _M_ht.insert_unique(__f, __l); } - - pair - insert_noresize(const value_type& __obj) - { - pair __p - = _M_ht.insert_unique_noresize(__obj); - return pair(__p.first, __p.second); - } - - iterator - find(const key_type& __key) const - { return _M_ht.find(__key); } - - size_type - count(const key_type& __key) const - { return _M_ht.count(__key); } - - pair - equal_range(const key_type& __key) const - { return _M_ht.equal_range(__key); } - - size_type - erase(const key_type& __key) - {return _M_ht.erase(__key); } - - void - erase(iterator __it) - { _M_ht.erase(__it); } - - void - erase(iterator __f, iterator __l) - { _M_ht.erase(__f, __l); } - - void - clear() - { _M_ht.clear(); } - - void - resize(size_type __hint) - { _M_ht.resize(__hint); } - - size_type - bucket_count() const - { return _M_ht.bucket_count(); } - - size_type - max_bucket_count() const - { return _M_ht.max_bucket_count(); } - - size_type - elems_in_bucket(size_type __n) const - { return _M_ht.elems_in_bucket(__n); } - }; - - template - inline bool - operator==(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1, - const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2) - { return __hs1._M_ht == __hs2._M_ht; } - - template - inline bool - operator!=(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1, - const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2) - { return !(__hs1 == __hs2); } - - template - inline void - swap(hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, - hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) - { __hs1.swap(__hs2); } - - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template, - class _EqualKey = equal_to<_Value>, - class _Alloc = allocator<_Value> > - class hash_multiset - { - // concept requirements - __glibcxx_class_requires(_Value, _SGIAssignableConcept) - __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept) - __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept) - - private: - typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, - _EqualKey, _Alloc> _Ht; - _Ht _M_ht; - - public: - typedef typename _Ht::key_type key_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Alloc::pointer pointer; - typedef typename _Alloc::const_pointer const_pointer; - typedef typename _Alloc::reference reference; - typedef typename _Alloc::const_reference const_reference; - - typedef typename _Ht::const_iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher - hash_funct() const - { return _M_ht.hash_funct(); } - - key_equal - key_eq() const - { return _M_ht.key_eq(); } - - allocator_type - get_allocator() const - { return _M_ht.get_allocator(); } - - hash_multiset() - : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - - explicit - hash_multiset(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - - hash_multiset(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} - - hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - template - hash_multiset(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - - template - hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - - template - hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - - template - hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } - - size_type - size() const - { return _M_ht.size(); } - - size_type - max_size() const - { return _M_ht.max_size(); } - - bool - empty() const - { return _M_ht.empty(); } - - void - swap(hash_multiset& hs) - { _M_ht.swap(hs._M_ht); } - - template - friend bool - operator==(const hash_multiset<_Val, _HF, _EqK, _Al>&, - const hash_multiset<_Val, _HF, _EqK, _Al>&); - - iterator - begin() const - { return _M_ht.begin(); } - - iterator - end() const - { return _M_ht.end(); } - - iterator - insert(const value_type& __obj) - { return _M_ht.insert_equal(__obj); } - - template - void - insert(_InputIterator __f, _InputIterator __l) - { _M_ht.insert_equal(__f,__l); } - - iterator - insert_noresize(const value_type& __obj) - { return _M_ht.insert_equal_noresize(__obj); } - - iterator - find(const key_type& __key) const - { return _M_ht.find(__key); } - - size_type - count(const key_type& __key) const - { return _M_ht.count(__key); } - - pair - equal_range(const key_type& __key) const - { return _M_ht.equal_range(__key); } - - size_type - erase(const key_type& __key) - { return _M_ht.erase(__key); } - - void - erase(iterator __it) - { _M_ht.erase(__it); } - - void - erase(iterator __f, iterator __l) - { _M_ht.erase(__f, __l); } - - void - clear() - { _M_ht.clear(); } - - void - resize(size_type __hint) - { _M_ht.resize(__hint); } - - size_type - bucket_count() const - { return _M_ht.bucket_count(); } - - size_type - max_bucket_count() const - { return _M_ht.max_bucket_count(); } - - size_type - elems_in_bucket(size_type __n) const - { return _M_ht.elems_in_bucket(__n); } - }; - - template - inline bool - operator==(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, - const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) - { return __hs1._M_ht == __hs2._M_ht; } - - template - inline bool - operator!=(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, - const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) - { return !(__hs1 == __hs2); } - - template - inline void - swap(hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, - hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) - { __hs1.swap(__hs2); } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Specialization of insert_iterator so that it will work for hash_set - // and hash_multiset. - template - class insert_iterator<__gnu_cxx::hash_set<_Value, _HashFcn, - _EqualKey, _Alloc> > - { - protected: - typedef __gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc> - _Container; - _Container* container; - - public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) - : container(&__x) {} - - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __value) - { - container->insert(__value); - return *this; - } - - insert_iterator<_Container>& - operator*() - { return *this; } - - insert_iterator<_Container>& - operator++() - { return *this; } - - insert_iterator<_Container>& - operator++(int) - { return *this; } - }; - - template - class insert_iterator<__gnu_cxx::hash_multiset<_Value, _HashFcn, - _EqualKey, _Alloc> > - { - protected: - typedef __gnu_cxx::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> - _Container; - _Container* container; - typename _Container::iterator iter; - - public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) - : container(&__x) {} - - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __value) - { - container->insert(__value); - return *this; - } - - insert_iterator<_Container>& - operator*() - { return *this; } - - insert_iterator<_Container>& - operator++() - { return *this; } - - insert_iterator<_Container>& - operator++(int) { return *this; } - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/ext/iterator b/openflow/usr/include/c++/5/ext/iterator deleted file mode 100644 index f330829..0000000 --- a/openflow/usr/include/c++/5/ext/iterator +++ /dev/null @@ -1,116 +0,0 @@ -// HP/SGI iterator extensions -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file ext/iterator - * This file is a GNU extension to the Standard C++ Library (possibly - * containing extensions from the HP/SGI STL subset). - */ - -#ifndef _EXT_ITERATOR -#define _EXT_ITERATOR 1 - -#pragma GCC system_header - -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // There are two signatures for distance. In addition to the one - // taking two iterators and returning a result, there is another - // taking two iterators and a reference-to-result variable, and - // returning nothing. The latter seems to be an SGI extension. - // -- pedwards - template - inline void - __distance(_InputIterator __first, _InputIterator __last, - _Distance& __n, std::input_iterator_tag) - { - // concept requirements - __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - while (__first != __last) - { - ++__first; - ++__n; - } - } - - template - inline void - __distance(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Distance& __n, std::random_access_iterator_tag) - { - // concept requirements - __glibcxx_function_requires(_RandomAccessIteratorConcept< - _RandomAccessIterator>) - __n += __last - __first; - } - - /** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo - */ - template - inline void - distance(_InputIterator __first, _InputIterator __last, - _Distance& __n) - { - // concept requirements -- taken care of in __distance - __distance(__first, __last, __n, std::__iterator_category(__first)); - } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif - diff --git a/openflow/usr/include/c++/5/ext/malloc_allocator.h b/openflow/usr/include/c++/5/ext/malloc_allocator.h deleted file mode 100644 index 033b3fe..0000000 --- a/openflow/usr/include/c++/5/ext/malloc_allocator.h +++ /dev/null @@ -1,152 +0,0 @@ -// Allocator that wraps "C" malloc -*- C++ -*- - -// Copyright (C) 2001-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ext/malloc_allocator.h - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _MALLOC_ALLOCATOR_H -#define _MALLOC_ALLOCATOR_H 1 - -#include -#include -#include -#include -#if __cplusplus >= 201103L -#include -#endif - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::size_t; - using std::ptrdiff_t; - - /** - * @brief An allocator that uses malloc. - * @ingroup allocators - * - * This is precisely the allocator defined in the C++ Standard. - * - all allocation calls malloc - * - all deallocation calls free - */ - template - class malloc_allocator - { - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - - template - struct rebind - { typedef malloc_allocator<_Tp1> other; }; - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2103. propagate_on_container_move_assignment - typedef std::true_type propagate_on_container_move_assignment; -#endif - - malloc_allocator() _GLIBCXX_USE_NOEXCEPT { } - - malloc_allocator(const malloc_allocator&) _GLIBCXX_USE_NOEXCEPT { } - - template - malloc_allocator(const malloc_allocator<_Tp1>&) - _GLIBCXX_USE_NOEXCEPT { } - - ~malloc_allocator() _GLIBCXX_USE_NOEXCEPT { } - - pointer - address(reference __x) const _GLIBCXX_NOEXCEPT - { return std::__addressof(__x); } - - const_pointer - address(const_reference __x) const _GLIBCXX_NOEXCEPT - { return std::__addressof(__x); } - - // NB: __n is permitted to be 0. The C++ standard says nothing - // about what the return value is when __n == 0. - pointer - allocate(size_type __n, const void* = 0) - { - if (__n > this->max_size()) - std::__throw_bad_alloc(); - - pointer __ret = static_cast<_Tp*>(std::malloc(__n * sizeof(_Tp))); - if (!__ret) - std::__throw_bad_alloc(); - return __ret; - } - - // __p is not permitted to be a null pointer. - void - deallocate(pointer __p, size_type) - { std::free(static_cast(__p)); } - - size_type - max_size() const _GLIBCXX_USE_NOEXCEPT - { return size_t(-1) / sizeof(_Tp); } - -#if __cplusplus >= 201103L - template - void - construct(_Up* __p, _Args&&... __args) - { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } - - template - void - destroy(_Up* __p) { __p->~_Up(); } -#else - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 402. wrong new expression in [some_] allocator::construct - void - construct(pointer __p, const _Tp& __val) - { ::new((void *)__p) value_type(__val); } - - void - destroy(pointer __p) { __p->~_Tp(); } -#endif - }; - - template - inline bool - operator==(const malloc_allocator<_Tp>&, const malloc_allocator<_Tp>&) - { return true; } - - template - inline bool - operator!=(const malloc_allocator<_Tp>&, const malloc_allocator<_Tp>&) - { return false; } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif diff --git a/openflow/usr/include/c++/5/ext/memory b/openflow/usr/include/c++/5/ext/memory deleted file mode 100644 index ed82af4..0000000 --- a/openflow/usr/include/c++/5/ext/memory +++ /dev/null @@ -1,197 +0,0 @@ -// Memory extensions -*- C++ -*- - -// Copyright (C) 2002-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file ext/memory - * This file is a GNU extension to the Standard C++ Library (possibly - * containing extensions from the HP/SGI STL subset). - */ - -#ifndef _EXT_MEMORY -#define _EXT_MEMORY 1 - -#pragma GCC system_header - -#include -#include - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::ptrdiff_t; - using std::pair; - using std::__iterator_category; - using std::_Temporary_buffer; - - template - pair<_InputIter, _ForwardIter> - __uninitialized_copy_n(_InputIter __first, _Size __count, - _ForwardIter __result, std::input_iterator_tag) - { - _ForwardIter __cur = __result; - __try - { - for (; __count > 0 ; --__count, ++__first, ++__cur) - std::_Construct(&*__cur, *__first); - return pair<_InputIter, _ForwardIter>(__first, __cur); - } - __catch(...) - { - std::_Destroy(__result, __cur); - __throw_exception_again; - } - } - - template - inline pair<_RandomAccessIter, _ForwardIter> - __uninitialized_copy_n(_RandomAccessIter __first, _Size __count, - _ForwardIter __result, - std::random_access_iterator_tag) - { - _RandomAccessIter __last = __first + __count; - return (pair<_RandomAccessIter, _ForwardIter> - (__last, std::uninitialized_copy(__first, __last, __result))); - } - - template - inline pair<_InputIter, _ForwardIter> - __uninitialized_copy_n(_InputIter __first, _Size __count, - _ForwardIter __result) - { return __gnu_cxx::__uninitialized_copy_n(__first, __count, __result, - __iterator_category(__first)); } - - /** - * @brief Copies the range [first,last) into result. - * @param __first An input iterator. - * @param __count Length - * @param __result An output iterator. - * @return __result + (__first + __count) - * @ingroup SGIextensions - * - * Like copy(), but does not require an initialized output range. - */ - template - inline pair<_InputIter, _ForwardIter> - uninitialized_copy_n(_InputIter __first, _Size __count, - _ForwardIter __result) - { return __gnu_cxx::__uninitialized_copy_n(__first, __count, __result, - __iterator_category(__first)); } - - - // An alternative version of uninitialized_copy_n that constructs - // and destroys objects with a user-provided allocator. - template - pair<_InputIter, _ForwardIter> - __uninitialized_copy_n_a(_InputIter __first, _Size __count, - _ForwardIter __result, - _Allocator __alloc) - { - _ForwardIter __cur = __result; - __try - { - for (; __count > 0 ; --__count, ++__first, ++__cur) - __alloc.construct(&*__cur, *__first); - return pair<_InputIter, _ForwardIter>(__first, __cur); - } - __catch(...) - { - std::_Destroy(__result, __cur, __alloc); - __throw_exception_again; - } - } - - template - inline pair<_InputIter, _ForwardIter> - __uninitialized_copy_n_a(_InputIter __first, _Size __count, - _ForwardIter __result, - std::allocator<_Tp>) - { - return __gnu_cxx::uninitialized_copy_n(__first, __count, __result); - } - - /** - * This class provides similar behavior and semantics of the standard - * functions get_temporary_buffer() and return_temporary_buffer(), but - * encapsulated in a type vaguely resembling a standard container. - * - * By default, a temporary_buffer stores space for objects of - * whatever type the Iter iterator points to. It is constructed from a - * typical [first,last) range, and provides the begin(), end(), size() - * functions, as well as requested_size(). For non-trivial types, copies - * of *first will be used to initialize the storage. - * - * @c malloc is used to obtain underlying storage. - * - * Like get_temporary_buffer(), not all the requested memory may be - * available. Ideally, the created buffer will be large enough to hold a - * copy of [first,last), but if size() is less than requested_size(), - * then this didn't happen. - * - * @ingroup SGIextensions - */ - template ::value_type > - struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp> - { - /// Requests storage large enough to hold a copy of [first,last). - temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) - : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) { } - - /// Destroys objects and frees storage. - ~temporary_buffer() { } - }; - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#endif - diff --git a/openflow/usr/include/c++/5/ext/mt_allocator.h b/openflow/usr/include/c++/5/ext/mt_allocator.h deleted file mode 100644 index 923d0e6..0000000 --- a/openflow/usr/include/c++/5/ext/mt_allocator.h +++ /dev/null @@ -1,766 +0,0 @@ -// MT-optimized allocator -*- C++ -*- - -// Copyright (C) 2003-2015 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ext/mt_allocator.h - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _MT_ALLOCATOR_H -#define _MT_ALLOCATOR_H 1 - -#include -#include -#include -#include -#include -#if __cplusplus >= 201103L -#include -#endif - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::size_t; - using std::ptrdiff_t; - - typedef void (*__destroy_handler)(void*); - - /// Base class for pool object. - struct __pool_base - { - // Using short int as type for the binmap implies we are never - // caching blocks larger than 32768 with this allocator. - typedef unsigned short int _Binmap_type; - - // Variables used to configure the behavior of the allocator, - // assigned and explained in detail below. - struct _Tune - { - // Compile time constants for the default _Tune values. - enum { _S_align = 8 }; - enum { _S_max_bytes = 128 }; - enum { _S_min_bin = 8 }; - enum { _S_chunk_size = 4096 - 4 * sizeof(void*) }; - enum { _S_max_threads = 4096 }; - enum { _S_freelist_headroom = 10 }; - - // Alignment needed. - // NB: In any case must be >= sizeof(_Block_record), that - // is 4 on 32 bit machines and 8 on 64 bit machines. - size_t _M_align; - - // Allocation requests (after round-up to power of 2) below - // this value will be handled by the allocator. A raw new/ - // call will be used for requests larger than this value. - // NB: Must be much smaller than _M_chunk_size and in any - // case <= 32768. - size_t _M_max_bytes; - - // Size in bytes of the smallest bin. - // NB: Must be a power of 2 and >= _M_align (and of course - // much smaller than _M_max_bytes). - size_t _M_min_bin; - - // In order to avoid fragmenting and minimize the number of - // new() calls we always request new memory using this - // value. Based on previous discussions on the libstdc++ - // mailing list we have chosen the value below. - // See http://gcc.gnu.org/ml/libstdc++/2001-07/msg00077.html - // NB: At least one order of magnitude > _M_max_bytes. - size_t _M_chunk_size; - - // The maximum number of supported threads. For - // single-threaded operation, use one. Maximum values will - // vary depending on details of the underlying system. (For - // instance, Linux 2.4.18 reports 4070 in - // /proc/sys/kernel/threads-max, while Linux 2.6.6 reports - // 65534) - size_t _M_max_threads; - - // Each time a deallocation occurs in a threaded application - // we make sure that there are no more than - // _M_freelist_headroom % of used memory on the freelist. If - // the number of additional records is more than - // _M_freelist_headroom % of the freelist, we move these - // records back to the global pool. - size_t _M_freelist_headroom; - - // Set to true forces all allocations to use new(). - bool _M_force_new; - - explicit - _Tune() - : _M_align(_S_align), _M_max_bytes(_S_max_bytes), _M_min_bin(_S_min_bin), - _M_chunk_size(_S_chunk_size), _M_max_threads(_S_max_threads), - _M_freelist_headroom(_S_freelist_headroom), - _M_force_new(std::getenv("GLIBCXX_FORCE_NEW") ? true : false) - { } - - explicit - _Tune(size_t __align, size_t __maxb, size_t __minbin, size_t __chunk, - size_t __maxthreads, size_t __headroom, bool __force) - : _M_align(__align), _M_max_bytes(__maxb), _M_min_bin(__minbin), - _M_chunk_size(__chunk), _M_max_threads(__maxthreads), - _M_freelist_headroom(__headroom), _M_force_new(__force) - { } - }; - - struct _Block_address - { - void* _M_initial; - _Block_address* _M_next; - }; - - const _Tune& - _M_get_options() const - { return _M_options; } - - void - _M_set_options(_Tune __t) - { - if (!_M_init) - _M_options = __t; - } - - bool - _M_check_threshold(size_t __bytes) - { return __bytes > _M_options._M_max_bytes || _M_options._M_force_new; } - - size_t - _M_get_binmap(size_t __bytes) - { return _M_binmap[__bytes]; } - - size_t - _M_get_align() - { return _M_options._M_align; } - - explicit - __pool_base() - : _M_options(_Tune()), _M_binmap(0), _M_init(false) { } - - explicit - __pool_base(const _Tune& __options) - : _M_options(__options), _M_binmap(0), _M_init(false) { } - - private: - explicit - __pool_base(const __pool_base&); - - __pool_base& - operator=(const __pool_base&); - - protected: - // Configuration options. - _Tune _M_options; - - _Binmap_type* _M_binmap; - - // Configuration of the pool object via _M_options can happen - // after construction but before initialization. After - // initialization is complete, this variable is set to true. - bool _M_init; - }; - - - /** - * @brief Data describing the underlying memory pool, parameterized on - * threading support. - */ - template - class __pool; - - /// Specialization for single thread. - template<> - class __pool : public __pool_base - { - public: - union _Block_record - { - // Points to the block_record of the next free block. - _Block_record* _M_next; - }; - - struct _Bin_record - { - // An "array" of pointers to the first free block. - _Block_record** _M_first; - - // A list of the initial addresses of all allocated blocks. - _Block_address* _M_address; - }; - - void - _M_initialize_once() - { - if (__builtin_expect(_M_init == false, false)) - _M_initialize(); - } - - void - _M_destroy() throw(); - - char* - _M_reserve_block(size_t __bytes, const size_t __thread_id); - - void - _M_reclaim_block(char* __p, size_t __bytes) throw (); - - size_t - _M_get_thread_id() { return 0; } - - const _Bin_record& - _M_get_bin(size_t __which) - { return _M_bin[__which]; } - - void - _M_adjust_freelist(const _Bin_record&, _Block_record*, size_t) - { } - - explicit __pool() - : _M_bin(0), _M_bin_size(1) { } - - explicit __pool(const __pool_base::_Tune& __tune) - : __pool_base(__tune), _M_bin(0), _M_bin_size(1) { } - - private: - // An "array" of bin_records each of which represents a specific - // power of 2 size. Memory to this "array" is allocated in - // _M_initialize(). - _Bin_record* _M_bin; - - // Actual value calculated in _M_initialize(). - size_t _M_bin_size; - - void - _M_initialize(); - }; - -#ifdef __GTHREADS - /// Specialization for thread enabled, via gthreads.h. - template<> - class __pool : public __pool_base - { - public: - // Each requesting thread is assigned an id ranging from 1 to - // _S_max_threads. Thread id 0 is used as a global memory pool. - // In order to get constant performance on the thread assignment - // routine, we keep a list of free ids. When a thread first - // requests memory we remove the first record in this list and - // stores the address in a __gthread_key. When initializing the - // __gthread_key we specify a destructor. When this destructor - // (i.e. the thread dies) is called, we return the thread id to - // the front of this list. - struct _Thread_record - { - // Points to next free thread id record. NULL if last record in list. - _Thread_record* _M_next; - - // Thread id ranging from 1 to _S_max_threads. - size_t _M_id; - }; - - union _Block_record - { - // Points to the block_record of the next free block. - _Block_record* _M_next; - - // The thread id of the thread which has requested this block. - size_t _M_thread_id; - }; - - struct _Bin_record - { - // An "array" of pointers to the first free block for each - // thread id. Memory to this "array" is allocated in - // _S_initialize() for _S_max_threads + global pool 0. - _Block_record** _M_first; - - // A list of the initial addresses of all allocated blocks. - _Block_address* _M_address; - - // An "array" of counters used to keep track of the amount of - // blocks that are on the freelist/used for each thread id. - // - Note that the second part of the allocated _M_used "array" - // actually hosts (atomic) counters of reclaimed blocks: in - // _M_reserve_block and in _M_reclaim_block those numbers are - // subtracted from the first ones to obtain the actual size - // of the "working set" of the given thread. - // - Memory to these "arrays" is allocated in _S_initialize() - // for _S_max_threads + global pool 0. - size_t* _M_free; - size_t* _M_used; - - // Each bin has its own mutex which is used to ensure data - // integrity while changing "ownership" on a block. The mutex - // is initialized in _S_initialize(). - __gthread_mutex_t* _M_mutex; - }; - - // XXX GLIBCXX_ABI Deprecated - void - _M_initialize(__destroy_handler); - - void - _M_initialize_once() - { - if (__builtin_expect(_M_init == false, false)) - _M_initialize(); - } - - void - _M_destroy() throw(); - - char* - _M_reserve_block(size_t __bytes, const size_t __thread_id); - - void - _M_reclaim_block(char* __p, size_t __bytes) throw (); - - const _Bin_record& - _M_get_bin(size_t __which) - { return _M_bin[__which]; } - - void - _M_adjust_freelist(const _Bin_record& __bin, _Block_record* __block, - size_t __thread_id) - { - if (__gthread_active_p()) - { - __block->_M_thread_id = __thread_id; - --__bin._M_free[__thread_id]; - ++__bin._M_used[__thread_id]; - } - } - - // XXX GLIBCXX_ABI Deprecated - _GLIBCXX_CONST void - _M_destroy_thread_key(void*) throw (); - - size_t - _M_get_thread_id(); - - explicit __pool() - : _M_bin(0), _M_bin_size(1), _M_thread_freelist(0) - { } - - explicit __pool(const __pool_base::_Tune& __tune) - : __pool_base(__tune), _M_bin(0), _M_bin_size(1), - _M_thread_freelist(0) - { } - - private: - // An "array" of bin_records each of which represents a specific - // power of 2 size. Memory to this "array" is allocated in - // _M_initialize(). - _Bin_record* _M_bin; - - // Actual value calculated in _M_initialize(). - size_t _M_bin_size; - - _Thread_record* _M_thread_freelist; - void* _M_thread_freelist_initial; - - void - _M_initialize(); - }; -#endif - - template